diff --git a/.gitattributes b/.gitattributes index 801b105d1826dadb1afc2c04866c55b4fecf3c7a..593d5399ad9722d11bb64314d9ec1430ad04843d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3130,3 +3130,7 @@ platform/dbops/binaries/postgres/bin/reindexdb filter=lfs diff=lfs merge=lfs -te platform/dbops/binaries/postgres/bin/pg_isready filter=lfs diff=lfs merge=lfs -text platform/dbops/binaries/postgres/lib/pgxs/src/test/regress/pg_regress filter=lfs diff=lfs merge=lfs -text platform/dbops/binaries/postgres/lib/pgxs/src/test/isolation/pg_isolation_regress filter=lfs diff=lfs merge=lfs -text +platform/dbops/binaries/build/bin/m4 filter=lfs diff=lfs merge=lfs -text +platform/dbops/binaries/build/bin/bison filter=lfs diff=lfs merge=lfs -text +platform/dbops/binaries/build/bin/flex filter=lfs diff=lfs merge=lfs -text +platform/dbops/binaries/build/bin/flex++ filter=lfs diff=lfs merge=lfs -text diff --git a/platform/dbops/binaries/build/bin/bison b/platform/dbops/binaries/build/bin/bison new file mode 100644 index 0000000000000000000000000000000000000000..505dd657fd01b98b5cefbfe87c59e38ce7a1ffe2 --- /dev/null +++ b/platform/dbops/binaries/build/bin/bison @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0d289becc2e80eec6fa731bb169dab75803617a4cb7d0e36bde99d19d7e1d35 +size 2529512 diff --git a/platform/dbops/binaries/build/bin/flex b/platform/dbops/binaries/build/bin/flex new file mode 100644 index 0000000000000000000000000000000000000000..35277dd87ece6249cdf56e517910e6669648ead1 --- /dev/null +++ b/platform/dbops/binaries/build/bin/flex @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64b8ea676b253de5c2f5ba1e0619c9c4452ce24cdbf1c75056661a6f412ccbf5 +size 906272 diff --git a/platform/dbops/binaries/build/bin/flex++ b/platform/dbops/binaries/build/bin/flex++ new file mode 100644 index 0000000000000000000000000000000000000000..35277dd87ece6249cdf56e517910e6669648ead1 --- /dev/null +++ b/platform/dbops/binaries/build/bin/flex++ @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64b8ea676b253de5c2f5ba1e0619c9c4452ce24cdbf1c75056661a6f412ccbf5 +size 906272 diff --git a/platform/dbops/binaries/build/bin/m4 b/platform/dbops/binaries/build/bin/m4 new file mode 100644 index 0000000000000000000000000000000000000000..529370768497c598622b20cc02986b049a902e3c --- /dev/null +++ b/platform/dbops/binaries/build/bin/m4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36005242445a56d5417da3b499a35667e32495095393e54f9ad911f08001eb37 +size 1247104 diff --git a/platform/dbops/binaries/build/bin/yacc b/platform/dbops/binaries/build/bin/yacc new file mode 100644 index 0000000000000000000000000000000000000000..865e22b5bba1141582d10ff208c56c27eeabee70 --- /dev/null +++ b/platform/dbops/binaries/build/bin/yacc @@ -0,0 +1,123 @@ +#! /bin/sh + +# The functions in this file provide support for relocatability of +# shell scripts. They should be included near the beginning of each +# shell script in a relocatable program, by adding @relocatable_sh@ +# and causing the script to be expanded with AC_CONFIG_FILES. A +# small amount of additional code must be added and adapted to the +# package by hand; see doc/relocatable-maint.texi (in Gnulib) for +# details. +# +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# Support for relocatability. +func_find_curr_installdir () +{ + # Determine curr_installdir, even taking into account symlinks. + curr_executable="$0" + case "$curr_executable" in + */* | *\\*) ;; + *) # Need to look in the PATH. + if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } + fi + save_IFS="$IFS"; IFS="$PATH_SEPARATOR" + for dir in $PATH; do + IFS="$save_IFS" + test -z "$dir" && dir=. + for exec_ext in ''; do + if test -f "$dir/$curr_executable$exec_ext"; then + curr_executable="$dir/$curr_executable$exec_ext" + break 2 + fi + done + done + IFS="$save_IFS" + ;; + esac + # Make absolute. + case "$curr_executable" in + /* | ?:/* | ?:\\*) ;; + *) curr_executable=`pwd`/"$curr_executable" ;; + esac + # Resolve symlinks. + sed_dirname='s,/[^/]*$,,' + sed_linkdest='s,^.* -> \(.*\),\1,p' + while : ; do + lsline=`LC_ALL=C ls -l "$curr_executable"` + case "$lsline" in + *" -> "*) + linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"` + case "$linkdest" in + /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;; + *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;; + esac ;; + *) break ;; + esac + done + curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'` + # Canonicalize. + curr_installdir=`cd "$curr_installdir" && pwd` +} +func_find_prefixes () +{ + # Compute the original/current installation prefixes by stripping the + # trailing directories off the original/current installation directories. + orig_installprefix="$orig_installdir" + curr_installprefix="$curr_installdir" + while true; do + orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'` + curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'` + if test -z "$orig_last" || test -z "$curr_last"; then + break + fi + if test "$orig_last" != "$curr_last"; then + break + fi + orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'` + curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'` + done +} +if test "no" = yes; then + prefix="/data/adaptai/platform/dbops/binaries/build" + exec_prefix="${prefix}" + bindir="${exec_prefix}/bin" + orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables + func_find_curr_installdir # determine curr_installdir + func_find_prefixes + relocate () { + echo "$1/" \ + | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" \ + | sed -e 's,/$,,' + } +else + relocate () { + echo "$1" + } +fi + +prefix=/data/adaptai/platform/dbops/binaries/build +exec_prefix=${prefix} +bindir=`relocate "${exec_prefix}/bin"` +exec "$bindir/bison" -y "$@" diff --git a/platform/dbops/binaries/build/include/FlexLexer.h b/platform/dbops/binaries/build/include/FlexLexer.h new file mode 100644 index 0000000000000000000000000000000000000000..c4dad2b1421d45824c13fc1e9fc01525b0ad8cd6 --- /dev/null +++ b/platform/dbops/binaries/build/include/FlexLexer.h @@ -0,0 +1,220 @@ +// -*-C++-*- +// FlexLexer.h -- define interfaces for lexical analyzer classes generated +// by flex + +// Copyright (c) 1993 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Kent Williams and Tom Epperly. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: + +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. + +// Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE. + +// This file defines FlexLexer, an abstract class which specifies the +// external interface provided to flex C++ lexer objects, and yyFlexLexer, +// which defines a particular lexer class. +// +// If you want to create multiple lexer classes, you use the -P flag +// to rename each yyFlexLexer to some other xxFlexLexer. You then +// include in your other sources once per lexer class: +// +// #undef yyFlexLexer +// #define yyFlexLexer xxFlexLexer +// #include +// +// #undef yyFlexLexer +// #define yyFlexLexer zzFlexLexer +// #include +// ... + +#ifndef __FLEX_LEXER_H +// Never included before - need to define base class. +#define __FLEX_LEXER_H + +#include + +extern "C++" { + +struct yy_buffer_state; +typedef int yy_state_type; + +class FlexLexer +{ +public: + virtual ~FlexLexer() { } + + const char* YYText() const { return yytext; } + int YYLeng() const { return yyleng; } + + virtual void + yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0; + virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0; + virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0; + virtual void yy_delete_buffer( yy_buffer_state* b ) = 0; + virtual void yyrestart( std::istream* s ) = 0; + virtual void yyrestart( std::istream& s ) = 0; + + virtual int yylex() = 0; + + // Call yylex with new input/output sources. + int yylex( std::istream& new_in, std::ostream& new_out ) + { + switch_streams( new_in, new_out ); + return yylex(); + } + + int yylex( std::istream* new_in, std::ostream* new_out = 0) + { + switch_streams( new_in, new_out ); + return yylex(); + } + + // Switch to new input/output streams. A nil stream pointer + // indicates "keep the current one". + virtual void switch_streams( std::istream* new_in, + std::ostream* new_out ) = 0; + virtual void switch_streams( std::istream& new_in, + std::ostream& new_out ) = 0; + + int lineno() const { return yylineno; } + + int debug() const { return yy_flex_debug; } + void set_debug( int flag ) { yy_flex_debug = flag; } + +protected: + char* yytext; + int yyleng; + int yylineno; // only maintained if you use %option yylineno + int yy_flex_debug; // only has effect with -d or "%option debug" +}; + +} +#endif // FLEXLEXER_H + +#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) +// Either this is the first time through (yyFlexLexerOnce not defined), +// or this is a repeated include to define a different flavor of +// yyFlexLexer, as discussed in the flex manual. +# define yyFlexLexerOnce + +extern "C++" { + +class yyFlexLexer : public FlexLexer { +public: + // arg_yyin and arg_yyout default to the cin and cout, but we + // only make that assignment when initializing in yylex(). + yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ); + yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 ); +private: + void ctor_common(); + +public: + + virtual ~yyFlexLexer(); + + void yy_switch_to_buffer( yy_buffer_state* new_buffer ); + yy_buffer_state* yy_create_buffer( std::istream* s, int size ); + yy_buffer_state* yy_create_buffer( std::istream& s, int size ); + void yy_delete_buffer( yy_buffer_state* b ); + void yyrestart( std::istream* s ); + void yyrestart( std::istream& s ); + + void yypush_buffer_state( yy_buffer_state* new_buffer ); + void yypop_buffer_state(); + + virtual int yylex(); + virtual void switch_streams( std::istream& new_in, std::ostream& new_out ); + virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 ); + virtual int yywrap(); + +protected: + virtual int LexerInput( char* buf, int max_size ); + virtual void LexerOutput( const char* buf, int size ); + virtual void LexerError( const char* msg ); + + void yyunput( int c, char* buf_ptr ); + int yyinput(); + + void yy_load_buffer_state(); + void yy_init_buffer( yy_buffer_state* b, std::istream& s ); + void yy_flush_buffer( yy_buffer_state* b ); + + int yy_start_stack_ptr; + int yy_start_stack_depth; + int* yy_start_stack; + + void yy_push_state( int new_state ); + void yy_pop_state(); + int yy_top_state(); + + yy_state_type yy_get_previous_state(); + yy_state_type yy_try_NUL_trans( yy_state_type current_state ); + int yy_get_next_buffer(); + + std::istream yyin; // input source for default LexerInput + std::ostream yyout; // output sink for default LexerOutput + + // yy_hold_char holds the character lost when yytext is formed. + char yy_hold_char; + + // Number of characters read into yy_ch_buf. + int yy_n_chars; + + // Points to current character in buffer. + char* yy_c_buf_p; + + int yy_init; // whether we need to initialize + int yy_start; // start state number + + // Flag which is used to allow yywrap()'s to do buffer switches + // instead of setting up a fresh yyin. A bit of a hack ... + int yy_did_buffer_switch_on_eof; + + + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ + void yyensure_buffer_stack(void); + + // The following are not always needed, but may be depending + // on use of certain flex features (like REJECT or yymore()). + + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + yy_state_type* yy_state_buf; + yy_state_type* yy_state_ptr; + + char* yy_full_match; + int* yy_full_state; + int yy_full_lp; + + int yy_lp; + int yy_looking_for_trail_begin; + + int yy_more_flag; + int yy_more_len; + int yy_more_offset; + int yy_prev_more_offset; +}; + +} + +#endif // yyFlexLexer || ! yyFlexLexerOnce diff --git a/platform/dbops/binaries/build/lib/libfl.a b/platform/dbops/binaries/build/lib/libfl.a new file mode 100644 index 0000000000000000000000000000000000000000..f28ab0ab5daa82db462c648a879bdadf07c00eb9 Binary files /dev/null and b/platform/dbops/binaries/build/lib/libfl.a differ diff --git a/platform/dbops/binaries/build/lib/libfl.la b/platform/dbops/binaries/build/lib/libfl.la new file mode 100644 index 0000000000000000000000000000000000000000..5f1d1e9b618a76a0a24aebaf1b549a323c9390e7 --- /dev/null +++ b/platform/dbops/binaries/build/lib/libfl.la @@ -0,0 +1,41 @@ +# libfl.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libfl.so.2' + +# Names of this library. +library_names='libfl.so.2.0.0 libfl.so.2 libfl.so' + +# The name of the static archive. +old_library='libfl.a' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libfl. +current=2 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/data/adaptai/platform/dbops/binaries/build/lib' diff --git a/platform/dbops/binaries/build/lib/libfl.so b/platform/dbops/binaries/build/lib/libfl.so new file mode 100644 index 0000000000000000000000000000000000000000..1e7c06e6266732df5798040590f515bcf5b4823a Binary files /dev/null and b/platform/dbops/binaries/build/lib/libfl.so differ diff --git a/platform/dbops/binaries/build/lib/libfl.so.2 b/platform/dbops/binaries/build/lib/libfl.so.2 new file mode 100644 index 0000000000000000000000000000000000000000..1e7c06e6266732df5798040590f515bcf5b4823a Binary files /dev/null and b/platform/dbops/binaries/build/lib/libfl.so.2 differ diff --git a/platform/dbops/binaries/build/lib/libfl.so.2.0.0 b/platform/dbops/binaries/build/lib/libfl.so.2.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..1e7c06e6266732df5798040590f515bcf5b4823a Binary files /dev/null and b/platform/dbops/binaries/build/lib/libfl.so.2.0.0 differ diff --git a/platform/dbops/binaries/build/lib/liby.a b/platform/dbops/binaries/build/lib/liby.a new file mode 100644 index 0000000000000000000000000000000000000000..89176ffaf7743cce9a42d36d88ec1b4b10925ad1 Binary files /dev/null and b/platform/dbops/binaries/build/lib/liby.a differ diff --git a/platform/dbops/binaries/build/share/aclocal/bison-i18n.m4 b/platform/dbops/binaries/build/share/aclocal/bison-i18n.m4 new file mode 100644 index 0000000000000000000000000000000000000000..59ab5c47dbe6d3ef824c69519163545535e94102 --- /dev/null +++ b/platform/dbops/binaries/build/share/aclocal/bison-i18n.m4 @@ -0,0 +1,51 @@ +# bison-i18n.m4 serial 2 + +dnl Copyright (C) 2005-2006, 2009-2015, 2018-2021 Free Software +dnl Foundation, Inc. + +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Support for internationalization of bison-generated parsers. + +dnl BISON_I18N +dnl should be used in configure.ac, after AM_GNU_GETTEXT. If USE_NLS is yes, it +dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files +dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all. +AC_DEFUN([BISON_I18N], +[ + if test -z "$USE_NLS"; then + echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2 + exit 1 + fi + BISON_LOCALEDIR= + BISON_USE_NLS=no + if test "$USE_NLS" = yes; then + dnl Determine bison's localedir. + dnl AC_PROG_YACC sets the YACC variable; other macros set the BISON variable. + dnl But even is YACC is called "yacc", it may be a script that invokes bison + dnl and accepts the --print-localedir option. + dnl YACC's default value is empty; BISON's default value is :. + if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then + BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir` + fi + AC_SUBST([BISON_LOCALEDIR]) + if test -n "$BISON_LOCALEDIR"; then + dnl There is no need to enable internationalization if the user doesn't + dnl want message catalogs. So look at the language/locale names for + dnl which the user wants message catalogs. This is $LINGUAS. If unset + dnl or empty, he wants all of them. + USER_LINGUAS="${LINGUAS-%UNSET%}" + if test -n "$USER_LINGUAS"; then + BISON_USE_NLS=yes + fi + fi + fi + if test $BISON_USE_NLS = yes; then + AC_DEFINE([YYENABLE_NLS], 1, + [Define to 1 to internationalize bison runtime messages.]) + fi +]) diff --git a/platform/dbops/binaries/build/share/bison/README.md b/platform/dbops/binaries/build/share/bison/README.md new file mode 100644 index 0000000000000000000000000000000000000000..09886ea819cefc66bb2d8c2e86624c0426ea2e38 --- /dev/null +++ b/platform/dbops/binaries/build/share/bison/README.md @@ -0,0 +1,227 @@ +This directory contains data needed by Bison. + +# Directory Content +## Skeletons +Bison skeletons: the general shapes of the different parser kinds, that are +specialized for specific grammars by the bison program. + +Currently, the supported skeletons are: + +- yacc.c + It used to be named bison.simple: it corresponds to C Yacc + compatible LALR(1) parsers. + +- lalr1.cc + Produces a C++ parser class. + +- lalr1.java + Produces a Java parser class. + +- glr.c + A Generalized LR C parser based on Bison's LALR(1) tables. + +- glr.cc + A Generalized LR C++ parser. Actually a C++ wrapper around glr.c. + +These skeletons are the only ones supported by the Bison team. Because the +interface between skeletons and the bison program is not finished, *we are +not bound to it*. In particular, Bison is not mature enough for us to +consider that "foreign skeletons" are supported. + +## m4sugar +This directory contains M4sugar, sort of an extended library for M4, which +is used by Bison to instantiate the skeletons. + +## xslt +This directory contains XSLT programs that transform Bison's XML output into +various formats. + +- bison.xsl + A library of routines used by the other XSLT programs. + +- xml2dot.xsl + Conversion into GraphViz's dot format. + +- xml2text.xsl + Conversion into text. + +- xml2xhtml.xsl + Conversion into XHTML. + +# Implementation Notes About the Skeletons + +"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison +executable with LR tables, facts about the symbols, etc. and they generate +the output (say parser.cc, parser.hh, location.hh, etc.). They are only in +charge of generating the parser and its auxiliary files, they do not +generate the XML output, the parser.output reports, nor the graphical +rendering. + +The bits of information passing from bison to the backend is named +"muscles". Muscles are passed to M4 via its standard input: it's a set of +m4 definitions. To see them, use `--trace=muscles`. + +Except for muscles, whose names are generated by bison, the skeletons have +no constraint at all on the macro names: there is no technical/theoretical +limitation, as long as you generate the output, you can do what you want. +However, of course, that would be a bad idea if, say, the C and C++ +skeletons used different approaches and had completely different +implementations. That would be a maintenance nightmare. + +Below, we document some of the macros that we use in several of the +skeletons. If you are to write a new skeleton, please, implement them for +your language. Overall, be sure to follow the same patterns as the existing +skeletons. + +## Vocabulary + +We use "formal arguments", or "formals" for short, to denote the declared +parameters of a function (e.g., `int argc, const char **argv`). Yes, this +is somewhat contradictory with `param` in the `%param` directives. + +We use "effective arguments", or "args" for short, to denote the values +passed in function calls (e.g., `argc, argv`). + +## Symbols + +### `b4_symbol(NUM, FIELD)` +In order to unify the handling of the various aspects of symbols (tag, type +name, whether terminal, etc.), bison.exe defines one macro per (token, +field), where field can `has_id`, `id`, etc.: see +`prepare_symbol_definitions()` in `src/output.c`. + +NUM can be: +- `empty` to denote the "empty" pseudo-symbol when it exists, +- `eof`, `error`, or `undef` +- a symbol number. + +FIELD can be: + +- `has_id`: 0 or 1 + Whether the symbol has an `id`. + +- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix) + If `has_id`, the name of the token kind (prefixed by api.token.prefix if + defined), otherwise empty. Guaranteed to be usable as a C identifier. + This is used to define the token kind (i.e., the enum used by the return + value of yylex). Should be named `token_kind`. + +- `tag`: string + A human readable representation of the symbol. Can be `'foo'`, + `'foo.id'`, `'"foo"'` etc. + +- `code`: integer + The token code associated to the token kind `id`. + The external number as used by yylex. Can be ASCII code when a character, + some number chosen by bison, or some user number in the case of `%token + FOO `. Corresponds to `yychar` in `yacc.c`. + +- `is_token`: 0 or 1 + Whether this is a terminal symbol. + +- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`) + The base of the symbol kind, i.e., the enumerator of this symbol (token or + nonterminal) which is mapped to its `number`. + +- `kind`: string + Same as `kind_base`, but possibly with a prefix in some languages. E.g., + EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are + `S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++. + +- `number`: integer + The code associated to the `kind`. + The internal number (computed from the external number by yytranslate). + Corresponds to yytoken in yacc.c. This is the same number that serves as + key in b4_symbol(NUM, FIELD). + + In bison, symbols are first assigned increasing numbers in order of + appearance (but tokens first, then nterms). After grammar reduction, + unused nterms are then renumbered to appear last (i.e., first tokens, then + used nterms and finally unused nterms). This final number NUM is the one + contained in this field, and it is the one used as key in `b4_symbol(NUM, + FIELD)`. + + The code of the rule actions, however, is emitted before we know what + symbols are unused, so they use the original numbers. To avoid confusion, + they actually use "orig NUM" instead of just "NUM". bison also emits + definitions for `b4_symbol(orig NUM, number)` that map from original + numbers to the new ones. `b4_symbol` actually resolves `orig NUM` in the + other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the + symbols whose original number was 42. + +- `has_type`: 0, 1 + Whether has a semantic value. + +- `type_tag`: string + When api.value.type=union, the generated name for the union member. + yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc. + +- `type`: string + If it has a semantic value, its type tag, or, if variant are used, + its type. + In the case of api.value.type=union, type is the real type (e.g. int). + +- `slot`: string + If it has a semantic value, the name of the union member (i.e., bounces to + either `type_tag` or `type`). It would be better to fix our mess and + always use `type` for the true type of the member, and `type_tag` for the + name of the union member. + +- `has_printer`: 0, 1 +- `printer`: string +- `printer_file`: string +- `printer_line`: integer +- `printer_loc`: location + If the symbol has a printer, everything about it. + +- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`, `destructor_loc` + Likewise. + +### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])` +Expansion of $$, $1, $3, etc. + +The semantic value from a given VAL. +- `VAL`: some semantic value storage (typically a union). e.g., `yylval` +- `SYMBOL-NUM`: the symbol number from which we extract the type tag. +- `TYPE-TAG`, the user forced the ``. + +The result can be used safely, it is put in parens to avoid nasty precedence +issues. + +### `b4_lhs_value(SYMBOL-NUM, [TYPE])` +Expansion of `$$` or `$$`, for symbol `SYMBOL-NUM`. + +### `b4_rhs_data(RULE-LENGTH, POS)` +The data corresponding to the symbol `#POS`, where the current rule has +`RULE-LENGTH` symbols on RHS. + +### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])` +Expansion of `$POS`, where the current rule has `RULE-LENGTH` symbols +on RHS. + + diff --git a/platform/dbops/binaries/build/share/bison/bison-default.css b/platform/dbops/binaries/build/share/bison/bison-default.css new file mode 100644 index 0000000000000000000000000000000000000000..aadaba1784c10bf1792194695657cbfc3172b96a --- /dev/null +++ b/platform/dbops/binaries/build/share/bison/bison-default.css @@ -0,0 +1,61 @@ +/* Default styling rules for Bison when doing terminal output. + Copyright (C) 2019-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is an experimental feature. The class names may change in the + future. */ + +/* Diagnostics. */ +.warning { color: purple; } +.error { color: red; } +.note { color: cyan; } + +.fixit-insert { color: green; } + +/* Semantic values in Bison's own parser traces. */ +.value { color: green; } + +/* "Sections" in traces (--trace). */ +.trace0 { color: green; } + +/* Syntax error messages. */ +.expected { color: green; } +.unexpected { color: red; } + + +/* Counterexamples. */ + +/* Cex: point in rule. */ +.cex-dot { color: red; } + +/* Cex: coloring various rules. */ +.cex-0 { color: yellow; } +.cex-1 { color: green; } +.cex-2 { color: blue; } +.cex-3 { color: purple; } +.cex-4 { color: violet; } +.cex-5 { color: orange; } +.cex-6 { color: brown; } +.cex-7 { color: mauve; } +.cex-8 { color: #013220; } /* Dark green. */ +.cex-9 { color: #e75480; } /* Dark pink. */ +.cex-10 { color: cyan; } +.cex-11 { color: orange; } + +/* Cex: derivation rewriting steps. */ +.cex-step { font-style: italic; } + +/* Cex: leaves of a derivation. */ +.cex-leaf { font-weight: 600; } diff --git a/platform/dbops/binaries/build/share/info/bison.info b/platform/dbops/binaries/build/share/info/bison.info new file mode 100644 index 0000000000000000000000000000000000000000..4f4fb08267c73e34d9454149484c4fc38c355492 --- /dev/null +++ b/platform/dbops/binaries/build/share/info/bison.info @@ -0,0 +1,16454 @@ +This is bison.info, produced by makeinfo version 6.8 from bison.texi. + +This manual (12 September 2021) is for GNU Bison (version 3.8.2), the +GNU parser generator. + + Copyright © 1988–1993, 1995, 1998–2015, 2018–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual. Buying copies from the FSF supports it in + developing GNU and promoting software freedom.” +INFO-DIR-SECTION Software development +START-INFO-DIR-ENTRY +* bison: (bison). GNU parser generator (Yacc replacement). +END-INFO-DIR-ENTRY + + +File: bison.info, Node: Top, Next: Introduction, Up: (dir) + +Bison +***** + +This manual (12 September 2021) is for GNU Bison (version 3.8.2), the +GNU parser generator. + + Copyright © 1988–1993, 1995, 1998–2015, 2018–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with the Front-Cover texts + being “A GNU Manual,” and with the Back-Cover Texts as in (a) + below. A copy of the license is included in the section entitled + “GNU Free Documentation License.” + + (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and + modify this GNU manual. Buying copies from the FSF supports it in + developing GNU and promoting software freedom.” + +* Menu: + +* Introduction:: What GNU Bison is. +* Conditions:: Conditions for using Bison and its output. +* Copying:: The GNU General Public License says + how you can copy and share Bison. + +Tutorial sections: +* Concepts:: Basic concepts for understanding Bison. +* Examples:: Three simple explained examples of using Bison. + +Reference sections: +* Grammar File:: Writing Bison declarations and rules. +* Interface:: C-language interface to the parser function ‘yyparse’. +* Algorithm:: How the Bison parser works at run-time. +* Error Recovery:: Writing rules for error recovery. +* Context Dependency:: What to do if your language syntax is too + messy for Bison to handle straightforwardly. +* Debugging:: Understanding or debugging Bison parsers. +* Invocation:: How to run Bison (to produce the parser implementation). +* Other Languages:: Creating C++, D and Java parsers. +* History:: How Bison came to be +* Versioning:: Dealing with Bison versioning +* FAQ:: Frequently Asked Questions +* Table of Symbols:: All the keywords of the Bison language are explained. +* Glossary:: Basic concepts are explained. +* GNU Free Documentation License:: Copying and sharing this manual +* Bibliography:: Publications cited in this manual. +* Index of Terms:: Cross-references to the text. + + — The Detailed Node Listing — + +The Concepts of Bison + +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison’s sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations:: Overview of location tracking. +* Bison Parser:: What are Bison’s input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. + +Writing GLR Parsers + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars. +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities. +* GLR Semantic Actions:: Considerations for semantic values and deferred actions. +* Semantic Predicates:: Controlling a parse with arbitrary computations. + +Examples + +* RPN Calc:: Reverse Polish Notation Calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @N and @$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. + +Reverse Polish Notation Calculator + +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. + +Grammar Rules for ‘rpcalc’ + +* Rpcalc Input:: Explanation of the ‘input’ nonterminal +* Rpcalc Line:: Explanation of the ‘line’ nonterminal +* Rpcalc Exp:: Explanation of the ‘exp’ nonterminal + +Location Tracking Calculator: ‘ltcalc’ + +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. + +Multi-Function Calculator: ‘mfcalc’ + +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. +* Mfcalc Lexer:: The lexical analyzer. +* Mfcalc Main:: The controlling function. + +Bison Grammar Files + +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Semantics:: Semantic values and actions. +* Tracking Locations:: Locations and actions. +* Named References:: Using named references in actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. + +Outline of a Bison Grammar + +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. + +Grammar Rules + +* Rules Syntax:: Syntax of the rules. +* Empty Rules:: Symbols that can match the empty string. +* Recursion:: Writing recursive rules. + + +Defining Language Semantics + +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Type Generation:: Generating the semantic value type. +* Union Decl:: Declaring the set of all semantic value types. +* Structured Value Type:: Providing a structured semantic value type. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Midrule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. + +Actions in Midrule + +* Using Midrule Actions:: Putting an action in the middle of a rule. +* Typed Midrule Actions:: Specifying the semantic type of their values. +* Midrule Action Translation:: How midrule actions are actually processed. +* Midrule Conflicts:: Midrule actions can cause conflicts. + +Tracking Locations + +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Printing Locations:: Defining how locations are printed. +* Location Default Action:: Defining a general way to compute locations. + +Bison Declarations + +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Symbol Decls:: Summary of the Syntax of Symbol Declarations. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Printer Decl:: Declaring how symbol values are displayed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. +* %define Summary:: Defining variables to adjust Bison’s behavior. +* %code Summary:: Inserting code into the parser source. + +Parser C-Language Interface + +* Parser Function:: How to call ‘yyparse’ and what it returns. +* Push Parser Interface:: How to create, use, and destroy push parsers. +* Lexical:: You must supply a function ‘yylex’ + which reads tokens. +* Error Reporting:: Passing error messages to the user. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user’s + native language. + +The Lexical Analyzer Function ‘yylex’ + +* Calling Convention:: How ‘yyparse’ calls ‘yylex’. +* Special Tokens:: Signaling end-of-file and errors to the parser. +* Tokens from Literals:: Finding token kinds from string aliases. +* Token Values:: How ‘yylex’ must return the semantic value + of the token it has read. +* Token Locations:: How ‘yylex’ must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (*note Pure Decl::). + +Error Reporting + +* Error Reporting Function:: You must supply a ‘yyerror’ function. +* Syntax Error Reporting Function:: You can supply a ‘yyreport_syntax_error’ function. + +Parser Internationalization + +* Enabling I18n:: Preparing your project to support internationalization. +* Token I18n:: Preparing tokens for internationalization in error messages. + +The Bison Parser Algorithm + +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator’s precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mysterious Conflicts:: Conflicts that look unjustified. +* Tuning LR:: How to tune fundamental aspects of LR-based parsing. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. + +Operator Precedence + +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence and associativity. +* Precedence Only:: How to specify precedence only. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. +* Non Operators:: Using precedence for general conflicts. + +Tuning LR + +* LR Table Construction:: Choose a different construction algorithm. +* Default Reductions:: Disable default reductions. +* LAC:: Correct lookahead sets in the parser states. +* Unreachable States:: Keep unreachable parser states for debugging. + +Handling Context Dependencies + +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. + +Debugging Your Parser + +* Counterexamples:: Understanding conflicts. +* Understanding:: Understanding the structure of your parser. +* Graphviz:: Getting a visual representation of the parser. +* Xml:: Getting a markup representation of the parser. +* Tracing:: Tracing the execution of your parser. + +Tracing Your Parser + +* Enabling Traces:: Activating run-time trace support +* Mfcalc Traces:: Extending ‘mfcalc’ to support traces + +Invoking Bison + +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible ‘yylex’ and ‘main’. + +Bison Options + +* Operation Modes:: Options controlling the global behavior of ‘bison’ +* Diagnostics:: Options controlling the diagnostics +* Tuning the Parser:: Options changing the generated parsers +* Output Files:: Options controlling the output + +Parsers Written In Other Languages + +* C++ Parsers:: The interface to generate C++ parser classes +* D Parsers:: The interface to generate D parser classes +* Java Parsers:: The interface to generate Java parser classes + +C++ Parsers + +* A Simple C++ Example:: A short introduction to C++ parsers +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Parser Interface:: Instantiating and running the parser +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Context:: You can supply a ‘report_syntax_error’ function. +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use + +C++ Location Values + +* C++ position:: One point in the source file +* C++ location:: Two points in the source file +* Exposing the Location Classes:: Using the Bison location class in your + project +* User Defined Location Type:: Required interface for locations + +A Complete C++ Example + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + +D Parsers + +* D Bison Interface:: Asking for D parser generation +* D Semantic Values:: %token and %nterm vs. D +* D Location Values:: The position and location classes +* D Parser Interface:: Instantiating and running the parser +* D Parser Context Interface:: Circumstances of a syntax error +* D Scanner Interface:: Specifying the scanner for the parser +* D Action Features:: Special features for use in actions +* D Push Parser Interface:: Instantiating and running the push parser +* D Complete Symbols:: Using token constructors + +Java Parsers + +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %token and %nterm vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Parser Context Interface:: Circumstances of a syntax error +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Push Parser Interface:: Instantiating and running the push parser +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java + +A Brief History of the Greater Ungulates + +* Yacc:: The original Yacc +* yacchack:: An obscure early implementation of reentrancy +* Byacc:: Berkeley Yacc +* Bison:: This program +* Other Ungulates:: Similar programs + +Bison Version Compatibility + +* Versioning:: Dealing with Bison versioning + +Frequently Asked Questions + +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: ‘yyparse’ Keeps some State +* Strings are Destroyed:: ‘yylval’ Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Enabling Relocatability:: Moving Bison/using it through network shares +* Secure? Conform?:: Is Bison POSIX safe? +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users + +Copying This Manual + +* GNU Free Documentation License:: Copying and sharing this manual + + + +File: bison.info, Node: Introduction, Next: Conditions, Prev: Top, Up: Top + +Introduction +************ + +“Bison” is a general-purpose parser generator that converts an annotated +context-free grammar into a deterministic LR or generalized LR (GLR) +parser employing LALR(1), IELR(1) or canonical LR(1) parser tables. +Once you are proficient with Bison, you can use it to develop a wide +range of language parsers, from those used in simple desk calculators to +complex programming languages. + + Bison is upward compatible with Yacc: all properly-written Yacc +grammars ought to work with Bison with no change. Anyone familiar with +Yacc should be able to use Bison with little trouble. You need to be +fluent in C, C++, D or Java programming in order to use Bison or to +understand this manual. + + We begin with tutorial chapters that explain the basic concepts of +using Bison and show three explained examples, each building on the +last. If you don’t know Bison or Yacc, start by reading these chapters. +Reference chapters follow, which describe specific aspects of Bison in +detail. + + Bison was written originally by Robert Corbett. Richard Stallman +made it Yacc-compatible. Wilfred Hansen of Carnegie Mellon University +added multi-character string literals and other features. Since then, +Bison has grown more robust and evolved many other new features thanks +to the hard work of a long list of volunteers. For details, see the +‘THANKS’ and ‘ChangeLog’ files included in the Bison distribution. + + This edition corresponds to version 3.8.2 of Bison. + + +File: bison.info, Node: Conditions, Next: Copying, Prev: Introduction, Up: Top + +Conditions for Using Bison +************************** + +The distribution terms for Bison-generated parsers permit using the +parsers in nonfree programs. Before Bison version 2.2, these extra +permissions applied only when Bison was generating LALR(1) parsers in C. +And before Bison version 1.24, Bison-generated parsers could be used +only in programs that were free software. + + The other GNU programming tools, such as the GNU C compiler, have +never had such a requirement. They could always be used for nonfree +software. The reason Bison was different was not due to a special +policy decision; it resulted from applying the usual General Public +License to all of the Bison source code. + + The main output of the Bison utility—the Bison parser implementation +file—contains a verbatim copy of a sizable piece of Bison, which is the +code for the parser’s implementation. (The actions from your grammar +are inserted into this implementation at one point, but most of the rest +of the implementation is not changed.) When we applied the GPL terms to +the skeleton code for the parser’s implementation, the effect was to +restrict the use of Bison output to free software. + + We didn’t change the terms because of sympathy for people who want to +make software proprietary. *Software should be free.* But we concluded +that limiting Bison’s use to free software was doing little to encourage +people to make other software free. So we decided to make the practical +conditions for using Bison match the practical conditions for using the +other GNU tools. + + This exception applies when Bison is generating code for a parser. +You can tell whether the exception applies to a Bison output file by +inspecting the file for text beginning with “As a special exception...”. +The text spells out the exact terms of the exception. + + +File: bison.info, Node: Copying, Next: Concepts, Prev: Conditions, Up: Top + +GNU GENERAL PUBLIC LICENSE +************************** + + Version 3, 29 June 2007 + + Copyright © 2007 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + +Preamble +======== + +The GNU General Public License is a free, copyleft license for software +and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program—to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers’ and authors’ protection, the GPL clearly explains +that there is no warranty for this free software. For both users’ and +authors’ sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users’ freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS +==================== + + 0. Definitions. + + “This License” refers to version 3 of the GNU General Public + License. + + “Copyright” also means copyright-like laws that apply to other + kinds of works, such as semiconductor masks. + + “The Program” refers to any copyrightable work licensed under this + License. Each licensee is addressed as “you”. “Licensees” and + “recipients” may be individuals or organizations. + + To “modify” a work means to copy from or adapt all or part of the + work in a fashion requiring copyright permission, other than the + making of an exact copy. The resulting work is called a “modified + version” of the earlier work or a work “based on” the earlier work. + + A “covered work” means either the unmodified Program or a work + based on the Program. + + To “propagate” a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it on + a computer or modifying a private copy. Propagation includes + copying, distribution (with or without modification), making + available to the public, and in some countries other activities as + well. + + To “convey” a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user + through a computer network, with no transfer of a copy, is not + conveying. + + An interactive user interface displays “Appropriate Legal Notices” + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to + the extent that warranties are provided), that licensees may convey + the work under this License, and how to view a copy of this + License. If the interface presents a list of user commands or + options, such as a menu, a prominent item in the list meets this + criterion. + + 1. Source Code. + + The “source code” for a work means the preferred form of the work + for making modifications to it. “Object code” means any non-source + form of a work. + + A “Standard Interface” means an interface that either is an + official standard defined by a recognized standards body, or, in + the case of interfaces specified for a particular programming + language, one that is widely used among developers working in that + language. + + The “System Libraries” of an executable work include anything, + other than the work as a whole, that (a) is included in the normal + form of packaging a Major Component, but which is not part of that + Major Component, and (b) serves only to enable use of the work with + that Major Component, or to implement a Standard Interface for + which an implementation is available to the public in source code + form. A “Major Component”, in this context, means a major + essential component (kernel, window system, and so on) of the + specific operating system (if any) on which the executable work + runs, or a compiler used to produce the work, or an object code + interpreter used to run it. + + The “Corresponding Source” for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including scripts + to control those activities. However, it does not include the + work’s System Libraries, or general-purpose tools or generally + available free programs which are used unmodified in performing + those activities but which are not part of the work. For example, + Corresponding Source includes interface definition files associated + with source files for the work, and the source code for shared + libraries and dynamically linked subprograms that the work is + specifically designed to require, such as by intimate data + communication or control flow between those subprograms and other + parts of the work. + + The Corresponding Source need not include anything that users can + regenerate automatically from other parts of the Corresponding + Source. + + The Corresponding Source for a work in source code form is that + same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running + a covered work is covered by this License only if the output, given + its content, constitutes a covered work. This License acknowledges + your rights of fair use or other equivalent, as provided by + copyright law. + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise + remains in force. You may convey covered works to others for the + sole purpose of having them make modifications exclusively for you, + or provide you with facilities for running those works, provided + that you comply with the terms of this License in conveying all + material for which you do not control copyright. Those thus making + or running the covered works for you must do so exclusively on your + behalf, under your direction and control, on terms that prohibit + them from making any copies of your copyrighted material outside + their relationship with you. + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section + 10 makes it unnecessary. + + 3. Protecting Users’ Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under + article 11 of the WIPO copyright treaty adopted on 20 December + 1996, or similar laws prohibiting or restricting circumvention of + such measures. + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such + circumvention is effected by exercising rights under this License + with respect to the covered work, and you disclaim any intention to + limit operation or modification of the work as a means of + enforcing, against the work’s users, your or third parties’ legal + rights to forbid circumvention of technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program’s source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the + code; keep intact all notices of the absence of any warranty; and + give all recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these + conditions: + + a. The work must carry prominent notices stating that you + modified it, and giving a relevant date. + + b. The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in + section 4 to “keep intact all notices”. + + c. You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable + section 7 additional terms, to the whole of the work, and all + its parts, regardless of how they are packaged. This License + gives no permission to license the work in any other way, but + it does not invalidate such permission if you have separately + received it. + + d. If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has + interactive interfaces that do not display Appropriate Legal + Notices, your work need not make them do so. + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered + work, and which are not combined with it such as to form a larger + program, in or on a volume of a storage or distribution medium, is + called an “aggregate” if the compilation and its resulting + copyright are not used to limit the access or legal rights of the + compilation’s users beyond what the individual works permit. + Inclusion of a covered work in an aggregate does not cause this + License to apply to the other parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this + License, in one of these ways: + + a. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that + product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the + software in the product that is covered by this License, on a + durable physical medium customarily used for software + interchange, for a price no more than your reasonable cost of + physically performing this conveying of source, or (2) access + to copy the Corresponding Source from a network server at no + charge. + + c. Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, + and only if you received the object code with such an offer, + in accord with subsection 6b. + + d. Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to + the Corresponding Source in the same way through the same + place at no further charge. You need not require recipients + to copy the Corresponding Source along with the object code. + If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated by + you or a third party) that supports equivalent copying + facilities, provided you maintain clear directions next to the + object code saying where to find the Corresponding Source. + Regardless of what server hosts the Corresponding Source, you + remain obligated to ensure that it is available for as long as + needed to satisfy these requirements. + + e. Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the + general public at no charge under subsection 6d. + + A separable portion of the object code, whose source code is + excluded from the Corresponding Source as a System Library, need + not be included in conveying the object code work. + + A “User Product” is either (1) a “consumer product”, which means + any tangible personal property which is normally used for personal, + family, or household purposes, or (2) anything designed or sold for + incorporation into a dwelling. In determining whether a product is + a consumer product, doubtful cases shall be resolved in favor of + coverage. For a particular product received by a particular user, + “normally used” refers to a typical or common use of that class of + product, regardless of the status of the particular user or of the + way in which the particular user actually uses, or expects or is + expected to use, the product. A product is a consumer product + regardless of whether the product has substantial commercial, + industrial or non-consumer uses, unless such uses represent the + only significant mode of use of the product. + + “Installation Information” for a User Product means any methods, + procedures, authorization keys, or other information required to + install and execute modified versions of a covered work in that + User Product from a modified version of its Corresponding Source. + The information must suffice to ensure that the continued + functioning of the modified object code is in no case prevented or + interfered with solely because modification has been made. + + If you convey an object code work under this section in, or with, + or specifically for use in, a User Product, and the conveying + occurs as part of a transaction in which the right of possession + and use of the User Product is transferred to the recipient in + perpetuity or for a fixed term (regardless of how the transaction + is characterized), the Corresponding Source conveyed under this + section must be accompanied by the Installation Information. But + this requirement does not apply if neither you nor any third party + retains the ability to install modified object code on the User + Product (for example, the work has been installed in ROM). + + The requirement to provide Installation Information does not + include a requirement to continue to provide support service, + warranty, or updates for a work that has been modified or installed + by the recipient, or for the User Product in which it has been + modified or installed. Access to a network may be denied when the + modification itself materially and adversely affects the operation + of the network or violates the rules and protocols for + communication across the network. + + Corresponding Source conveyed, and Installation Information + provided, in accord with this section must be in a format that is + publicly documented (and with an implementation available to the + public in source code form), and must require no special password + or key for unpacking, reading or copying. + + 7. Additional Terms. + + “Additional permissions” are terms that supplement the terms of + this License by making exceptions from one or more of its + conditions. Additional permissions that are applicable to the + entire Program shall be treated as though they were included in + this License, to the extent that they are valid under applicable + law. If additional permissions apply only to part of the Program, + that part may be used separately under those permissions, but the + entire Program remains governed by this License without regard to + the additional permissions. + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part + of it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material + you add to a covered work, you may (if authorized by the copyright + holders of that material) supplement the terms of this License with + terms: + + a. Disclaiming warranty or limiting liability differently from + the terms of sections 15 and 16 of this License; or + + b. Requiring preservation of specified reasonable legal notices + or author attributions in that material or in the Appropriate + Legal Notices displayed by works containing it; or + + c. Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked + in reasonable ways as different from the original version; or + + d. Limiting the use for publicity purposes of names of licensors + or authors of the material; or + + e. Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f. Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified + versions of it) with contractual assumptions of liability to + the recipient, for any liability that these contractual + assumptions directly impose on those licensors and authors. + + All other non-permissive additional terms are considered “further + restrictions” within the meaning of section 10. If the Program as + you received it, or any part of it, contains a notice stating that + it is governed by this License along with a term that is a further + restriction, you may remove that term. If a license document + contains a further restriction but permits relicensing or conveying + under this License, you may add to a covered work material governed + by the terms of that license document, provided that the further + restriction does not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in + the form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights + under this License (including any patent licenses granted under the + third paragraph of section 11). + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, you do not qualify to receive new licenses + for the same material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer + transmission to receive a copy likewise does not require + acceptance. However, nothing other than this License grants you + permission to propagate or modify any covered work. These actions + infringe copyright if you do not accept this License. Therefore, + by modifying or propagating a covered work, you indicate your + acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not + responsible for enforcing compliance by third parties with this + License. + + An “entity transaction” is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a + covered work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party’s predecessor in interest had or + could give under the previous paragraph, plus a right to possession + of the Corresponding Source of the work from the predecessor in + interest, if the predecessor has it or can get it with reasonable + efforts. + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you + may not impose a license fee, royalty, or other charge for exercise + of rights granted under this License, and you may not initiate + litigation (including a cross-claim or counterclaim in a lawsuit) + alleging that any patent claim is infringed by making, using, + selling, offering for sale, or importing the Program or any portion + of it. + + 11. Patents. + + A “contributor” is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. + The work thus licensed is called the contributor’s “contributor + version”. + + A contributor’s “essential patent claims” are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, + permitted by this License, of making, using, or selling its + contributor version, but do not include claims that would be + infringed only as a consequence of further modification of the + contributor version. For purposes of this definition, “control” + includes the right to grant patent sublicenses in a manner + consistent with the requirements of this License. + + Each contributor grants you a non-exclusive, worldwide, + royalty-free patent license under the contributor’s essential + patent claims, to make, use, sell, offer for sale, import and + otherwise run, modify and propagate the contents of its contributor + version. + + In the following three paragraphs, a “patent license” is any + express agreement or commitment, however denominated, not to + enforce a patent (such as an express permission to practice a + patent or covenant not to sue for patent infringement). To “grant” + such a patent license to a party means to make such an agreement or + commitment not to enforce a patent against the party. + + If you convey a covered work, knowingly relying on a patent + license, and the Corresponding Source of the work is not available + for anyone to copy, free of charge and under the terms of this + License, through a publicly available network server or other + readily accessible means, then you must either (1) cause the + Corresponding Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this particular + work, or (3) arrange, in a manner consistent with the requirements + of this License, to extend the patent license to downstream + recipients. “Knowingly relying” means you have actual knowledge + that, but for the patent license, your conveying the covered work + in a country, or your recipient’s use of the covered work in a + country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, + modify or convey a specific copy of the covered work, then the + patent license you grant is automatically extended to all + recipients of the covered work and works based on it. + + A patent license is “discriminatory” if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that + are specifically granted under this License. You may not convey a + covered work if you are a party to an arrangement with a third + party that is in the business of distributing software, under which + you make payment to the third party based on the extent of your + activity of conveying the work, and under which the third party + grants, to any of the parties who would receive the covered work + from you, a discriminatory patent license (a) in connection with + copies of the covered work conveyed by you (or copies made from + those copies), or (b) primarily for and in connection with specific + products or compilations that contain the covered work, unless you + entered into that arrangement, or that patent license was granted, + prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + 12. No Surrender of Others’ Freedom. + + If conditions are imposed on you (whether by court order, agreement + or otherwise) that contradict the conditions of this License, they + do not excuse you from the conditions of this License. If you + cannot convey a covered work so as to satisfy simultaneously your + obligations under this License and any other pertinent obligations, + then as a consequence you may not convey it at all. For example, + if you agree to terms that obligate you to collect a royalty for + further conveying from those to whom you convey the Program, the + only way you could satisfy both those terms and this License would + be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a + single combined work, and to convey the resulting work. The terms + of this License will continue to apply to the part which is the + covered work, but the special requirements of the GNU Affero + General Public License, section 13, concerning interaction through + a network will apply to the combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new + versions of the GNU General Public License from time to time. Such + new versions will be similar in spirit to the present version, but + may differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU + General Public License “or any later version” applies to it, you + have the option of following the terms and conditions either of + that numbered version or of any later version published by the Free + Software Foundation. If the Program does not specify a version + number of the GNU General Public License, you may choose any + version ever published by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Program. + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE + COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE + RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. + SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES + AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE + THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA + BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF + THE POSSIBILITY OF SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely + approximates an absolute waiver of all civil liability in + connection with the Program, unless a warranty or assumption of + liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS +=========================== + +How to Apply These Terms to Your New Programs +============================================= + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least the +“copyright” line and a pointer to where the full notice is found. + + ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. + Copyright (C) YEAR NAME OF AUTHOR + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Also add information on how to contact you by electronic and paper +mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + PROGRAM Copyright (C) YEAR NAME OF AUTHOR + This program comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’. + This is free software, and you are welcome to redistribute it + under certain conditions; type ‘show c’ for details. + + The hypothetical commands ‘show w’ and ‘show c’ should show the +appropriate parts of the General Public License. Of course, your +program’s commands might be different; for a GUI interface, you would +use an “about box”. + + You should also get your employer (if you work as a programmer) or +school, if any, to sign a “copyright disclaimer” for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + + The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . + + +File: bison.info, Node: Concepts, Next: Examples, Prev: Copying, Up: Top + +1 The Concepts of Bison +*********************** + +This chapter introduces many of the basic concepts without which the +details of Bison will not make sense. If you do not already know how to +use Bison or Yacc, we suggest you start by reading this chapter +carefully. + +* Menu: + +* Language and Grammar:: Languages and context-free grammars, + as mathematical ideas. +* Grammar in Bison:: How we represent grammars for Bison’s sake. +* Semantic Values:: Each token or syntactic grouping can have + a semantic value (the value of an integer, + the name of an identifier, etc.). +* Semantic Actions:: Each rule can have an action containing C code. +* GLR Parsers:: Writing parsers for general context-free languages. +* Locations:: Overview of location tracking. +* Bison Parser:: What are Bison’s input and output, + how is the output used? +* Stages:: Stages in writing and running Bison grammars. +* Grammar Layout:: Overall structure of a Bison grammar file. + + +File: bison.info, Node: Language and Grammar, Next: Grammar in Bison, Up: Concepts + +1.1 Languages and Context-Free Grammars +======================================= + +In order for Bison to parse a language, it must be described by a +“context-free grammar”. This means that you specify one or more +“syntactic groupings” and give rules for constructing them from their +parts. For example, in the C language, one kind of grouping is called +an ‘expression’. One rule for making an expression might be, “An +expression can be made of a minus sign and another expression”. Another +would be, “An expression can be an integer”. As you can see, rules are +often recursive, but there must be at least one rule which leads out of +the recursion. + + The most common formal system for presenting such rules for humans to +read is “Backus-Naur Form” or “BNF”, which was developed in order to +specify the language Algol 60. Any grammar expressed in BNF is a +context-free grammar. The input to Bison is essentially +machine-readable BNF. + + There are various important subclasses of context-free grammars. +Although it can handle almost all context-free grammars, Bison is +optimized for what are called LR(1) grammars. In brief, in these +grammars, it must be possible to tell how to parse any portion of an +input string with just a single token of lookahead. For historical +reasons, Bison by default is limited by the additional restrictions of +LALR(1), which is hard to explain simply. *Note Mysterious Conflicts::, +for more information on this. You can escape these additional +restrictions by requesting IELR(1) or canonical LR(1) parser tables. +*Note LR Table Construction::, to learn how. + + Parsers for LR(1) grammars are “deterministic”, meaning roughly that +the next grammar rule to apply at any point in the input is uniquely +determined by the preceding input and a fixed, finite portion (called a +“lookahead”) of the remaining input. A context-free grammar can be +“ambiguous”, meaning that there are multiple ways to apply the grammar +rules to get the same inputs. Even unambiguous grammars can be +“nondeterministic”, meaning that no fixed lookahead always suffices to +determine the next grammar rule to apply. With the proper declarations, +Bison is also able to parse these more general context-free grammars, +using a technique known as GLR parsing (for Generalized LR). Bison’s GLR +parsers are able to handle any context-free grammar for which the number +of possible parses of any given string is finite. + + In the formal grammatical rules for a language, each kind of +syntactic unit or grouping is named by a “symbol”. Those which are +built by grouping smaller constructs according to grammatical rules are +called “nonterminal symbols”; those which can’t be subdivided are called +“terminal symbols” or “token kinds”. We call a piece of input +corresponding to a single terminal symbol a “token”, and a piece +corresponding to a single nonterminal symbol a “grouping”. + + We can use the C language as an example of what symbols, terminal and +nonterminal, mean. The tokens of C are identifiers, constants (numeric +and string), and the various keywords, arithmetic operators and +punctuation marks. So the terminal symbols of a grammar for C include +‘identifier’, ‘number’, ‘string’, plus one symbol for each keyword, +operator or punctuation mark: ‘if’, ‘return’, ‘const’, ‘static’, ‘int’, +‘char’, ‘plus-sign’, ‘open-brace’, ‘close-brace’, ‘comma’ and many more. +(These tokens can be subdivided into characters, but that is a matter of +lexicography, not grammar.) + + Here is a simple C function subdivided into tokens: + + int /* keyword ‘int’ */ + square (int x) /* identifier, open-paren, keyword ‘int’, + identifier, close-paren */ + { /* open-brace */ + return x * x; /* keyword ‘return’, identifier, asterisk, + identifier, semicolon */ + } /* close-brace */ + + The syntactic groupings of C include the expression, the statement, +the declaration, and the function definition. These are represented in +the grammar of C by nonterminal symbols ‘expression’, ‘statement’, +‘declaration’ and ‘function definition’. The full grammar uses dozens +of additional language constructs, each with its own nonterminal symbol, +in order to express the meanings of these four. The example above is a +function definition; it contains one declaration, and one statement. In +the statement, each ‘x’ is an expression and so is ‘x * x’. + + Each nonterminal symbol must have grammatical rules showing how it is +made out of simpler constructs. For example, one kind of C statement is +the ‘return’ statement; this would be described with a grammar rule +which reads informally as follows: + + A ‘statement’ can be made of a ‘return’ keyword, an ‘expression’ + and a ‘semicolon’. + +There would be many other rules for ‘statement’, one for each kind of +statement in C. + + One nonterminal symbol must be distinguished as the special one which +defines a complete utterance in the language. It is called the “start +symbol”. In a compiler, this means a complete input program. In the C +language, the nonterminal symbol ‘sequence of definitions and +declarations’ plays this role. + + For example, ‘1 + 2’ is a valid C expression—a valid part of a C +program—but it is not valid as an _entire_ C program. In the +context-free grammar of C, this follows from the fact that ‘expression’ +is not the start symbol. + + The Bison parser reads a sequence of tokens as its input, and groups +the tokens using the grammar rules. If the input is valid, the end +result is that the entire token sequence reduces to a single grouping +whose symbol is the grammar’s start symbol. If we use a grammar for C, +the entire input must be a ‘sequence of definitions and declarations’. +If not, the parser reports a syntax error. + + +File: bison.info, Node: Grammar in Bison, Next: Semantic Values, Prev: Language and Grammar, Up: Concepts + +1.2 From Formal Rules to Bison Input +==================================== + +A formal grammar is a mathematical construct. To define the language +for Bison, you must write a file expressing the grammar in Bison syntax: +a “Bison grammar” file. *Note Grammar File::. + + A nonterminal symbol in the formal grammar is represented in Bison +input as an identifier, like an identifier in C. By convention, it +should be in lower case, such as ‘expr’, ‘stmt’ or ‘declaration’. + + The Bison representation for a terminal symbol is also called a +“token kind”. Token kinds as well can be represented as C-like +identifiers. By convention, these identifiers should be upper case to +distinguish them from nonterminals: for example, ‘INTEGER’, +‘IDENTIFIER’, ‘IF’ or ‘RETURN’. A terminal symbol that stands for a +particular keyword in the language should be named after that keyword +converted to upper case. The terminal symbol ‘error’ is reserved for +error recovery. *Note Symbols::. + + A terminal symbol can also be represented as a character literal, +just like a C character constant. You should do this whenever a token +is just a single character (parenthesis, plus-sign, etc.): use that same +character in a literal as the terminal symbol for that token. + + A third way to represent a terminal symbol is with a C string +constant containing several characters. *Note Symbols::, for more +information. + + The grammar rules also have an expression in Bison syntax. For +example, here is the Bison rule for a C ‘return’ statement. The +semicolon in quotes is a literal character token, representing part of +the C syntax for the statement; the naked semicolon, and the colon, are +Bison punctuation used in every rule. + + stmt: RETURN expr ';' ; + +*Note Rules::. + + +File: bison.info, Node: Semantic Values, Next: Semantic Actions, Prev: Grammar in Bison, Up: Concepts + +1.3 Semantic Values +=================== + +A formal grammar selects tokens only by their classifications: for +example, if a rule mentions the terminal symbol ‘integer constant’, it +means that _any_ integer constant is grammatically valid in that +position. The precise value of the constant is irrelevant to how to +parse the input: if ‘x+4’ is grammatical then ‘x+1’ or ‘x+3989’ is +equally grammatical. + + But the precise value is very important for what the input means once +it is parsed. A compiler is useless if it fails to distinguish between +4, 1 and 3989 as constants in the program! Therefore, each token in a +Bison grammar has both a token kind and a “semantic value”. *Note +Semantics::, for details. + + The token kind is a terminal symbol defined in the grammar, such as +‘INTEGER’, ‘IDENTIFIER’ or ‘','’. It tells everything you need to know +to decide where the token may validly appear and how to group it with +other tokens. The grammar rules know nothing about tokens except their +kinds. + + The semantic value has all the rest of the information about the +meaning of the token, such as the value of an integer, or the name of an +identifier. (A token such as ‘','’ which is just punctuation doesn’t +need to have any semantic value.) + + For example, an input token might be classified as token kind +‘INTEGER’ and have the semantic value 4. Another input token might have +the same token kind ‘INTEGER’ but value 3989. When a grammar rule says +that ‘INTEGER’ is allowed, either of these tokens is acceptable because +each is an ‘INTEGER’. When the parser accepts the token, it keeps track +of the token’s semantic value. + + Each grouping can also have a semantic value as well as its +nonterminal symbol. For example, in a calculator, an expression +typically has a semantic value that is a number. In a compiler for a +programming language, an expression typically has a semantic value that +is a tree structure describing the meaning of the expression. + + +File: bison.info, Node: Semantic Actions, Next: GLR Parsers, Prev: Semantic Values, Up: Concepts + +1.4 Semantic Actions +==================== + +In order to be useful, a program must do more than parse input; it must +also produce some output based on the input. In a Bison grammar, a +grammar rule can have an “action” made up of C statements. Each time +the parser recognizes a match for that rule, the action is executed. +*Note Actions::. + + Most of the time, the purpose of an action is to compute the semantic +value of the whole construct from the semantic values of its parts. For +example, suppose we have a rule which says an expression can be the sum +of two expressions. When the parser recognizes such a sum, each of the +subexpressions has a semantic value which describes how it was built up. +The action for this rule should create a similar sort of value for the +newly recognized larger expression. + + For example, here is a rule that says an expression can be the sum of +two subexpressions: + + expr: expr '+' expr { $$ = $1 + $3; } ; + +The action says how to produce the semantic value of the sum expression +from the values of the two subexpressions. + + +File: bison.info, Node: GLR Parsers, Next: Locations, Prev: Semantic Actions, Up: Concepts + +1.5 Writing GLR Parsers +======================= + +In some grammars, Bison’s deterministic LR(1) parsing algorithm cannot +decide whether to apply a certain grammar rule at a given point. That +is, it may not be able to decide (on the basis of the input read so far) +which of two possible reductions (applications of a grammar rule) +applies, or whether to apply a reduction or read more of the input and +apply a reduction later in the input. These are known respectively as +“reduce/reduce” conflicts (*note Reduce/Reduce::), and “shift/reduce” +conflicts (*note Shift/Reduce::). + + To use a grammar that is not easily modified to be LR(1), a more +general parsing algorithm is sometimes necessary. If you include +‘%glr-parser’ among the Bison declarations in your file (*note Grammar +Outline::), the result is a Generalized LR (GLR) parser. These parsers +handle Bison grammars that contain no unresolved conflicts (i.e., after +applying precedence declarations) identically to deterministic parsers. +However, when faced with unresolved shift/reduce and reduce/reduce +conflicts, GLR parsers use the simple expedient of doing both, +effectively cloning the parser to follow both possibilities. Each of +the resulting parsers can again split, so that at any given time, there +can be any number of possible parses being explored. The parsers +proceed in lockstep; that is, all of them consume (shift) a given input +symbol before any of them proceed to the next. Each of the cloned +parsers eventually meets one of two possible fates: either it runs into +a parsing error, in which case it simply vanishes, or it merges with +another parser, because the two of them have reduced the input to an +identical set of symbols. + + During the time that there are multiple parsers, semantic actions are +recorded, but not performed. When a parser disappears, its recorded +semantic actions disappear as well, and are never performed. When a +reduction makes two parsers identical, causing them to merge, Bison +records both sets of semantic actions. Whenever the last two parsers +merge, reverting to the single-parser case, Bison resolves all the +outstanding actions either by precedences given to the grammar rules +involved, or by performing both actions, and then calling a designated +user-defined function on the resulting values to produce an arbitrary +merged result. + +* Menu: + +* Simple GLR Parsers:: Using GLR parsers on unambiguous grammars. +* Merging GLR Parses:: Using GLR parsers to resolve ambiguities. +* GLR Semantic Actions:: Considerations for semantic values and deferred actions. +* Semantic Predicates:: Controlling a parse with arbitrary computations. + + +File: bison.info, Node: Simple GLR Parsers, Next: Merging GLR Parses, Up: GLR Parsers + +1.5.1 Using GLR on Unambiguous Grammars +--------------------------------------- + +In the simplest cases, you can use the GLR algorithm to parse grammars +that are unambiguous but fail to be LR(1). Such grammars typically +require more than one symbol of lookahead. + + Consider a problem that arises in the declaration of enumerated and +subrange types in the programming language Pascal. Here are some +examples: + + type subrange = lo .. hi; + type enum = (a, b, c); + +The original language standard allows only numeric literals and constant +identifiers for the subrange bounds (‘lo’ and ‘hi’), but Extended Pascal +(ISO/IEC 10206) and many other Pascal implementations allow arbitrary +expressions there. This gives rise to the following situation, +containing a superfluous pair of parentheses: + + type subrange = (a) .. b; + +Compare this to the following declaration of an enumerated type with +only one value: + + type enum = (a); + +(These declarations are contrived, but they are syntactically valid, and +more-complicated cases can come up in practical programs.) + + These two declarations look identical until the ‘..’ token. With +normal LR(1) one-token lookahead it is not possible to decide between +the two forms when the identifier ‘a’ is parsed. It is, however, +desirable for a parser to decide this, since in the latter case ‘a’ must +become a new identifier to represent the enumeration value, while in the +former case ‘a’ must be evaluated with its current meaning, which may be +a constant or even a function call. + + You could parse ‘(a)’ as an “unspecified identifier in parentheses”, +to be resolved later, but this typically requires substantial +contortions in both semantic actions and large parts of the grammar, +where the parentheses are nested in the recursive rules for expressions. + + You might think of using the lexer to distinguish between the two +forms by returning different tokens for currently defined and undefined +identifiers. But if these declarations occur in a local scope, and ‘a’ +is defined in an outer scope, then both forms are possible—either +locally redefining ‘a’, or using the value of ‘a’ from the outer scope. +So this approach cannot work. + + A simple solution to this problem is to declare the parser to use the +GLR algorithm. When the GLR parser reaches the critical state, it +merely splits into two branches and pursues both syntax rules +simultaneously. Sooner or later, one of them runs into a parsing error. +If there is a ‘..’ token before the next ‘;’, the rule for enumerated +types fails since it cannot accept ‘..’ anywhere; otherwise, the +subrange type rule fails since it requires a ‘..’ token. So one of the +branches fails silently, and the other one continues normally, +performing all the intermediate actions that were postponed during the +split. + + If the input is syntactically incorrect, both branches fail and the +parser reports a syntax error as usual. + + The effect of all this is that the parser seems to “guess” the +correct branch to take, or in other words, it seems to use more +lookahead than the underlying LR(1) algorithm actually allows for. In +this example, LR(2) would suffice, but also some cases that are not +LR(k) for any k can be handled this way. + + In general, a GLR parser can take quadratic or cubic worst-case time, +and the current Bison parser even takes exponential time and space for +some grammars. In practice, this rarely happens, and for many grammars +it is possible to prove that it cannot happen. The present example +contains only one conflict between two rules, and the type-declaration +context containing the conflict cannot be nested. So the number of +branches that can exist at any time is limited by the constant 2, and +the parsing time is still linear. + + Here is a Bison grammar corresponding to the example above. It +parses a vastly simplified form of Pascal type declarations. + + %token TYPE DOTDOT ID + + %left '+' '-' + %left '*' '/' + + %% + type_decl: TYPE ID '=' type ';' ; + + type: + '(' id_list ')' + | expr DOTDOT expr + ; + + id_list: + ID + | id_list ',' ID + ; + + expr: + '(' expr ')' + | expr '+' expr + | expr '-' expr + | expr '*' expr + | expr '/' expr + | ID + ; + + When used as a normal LR(1) grammar, Bison correctly complains about +one reduce/reduce conflict. In the conflicting situation the parser +chooses one of the alternatives, arbitrarily the one declared first. +Therefore the following correct input is not recognized: + + type t = (a) .. b; + + The parser can be turned into a GLR parser, while also telling Bison +to be silent about the one known reduce/reduce conflict, by adding these +two declarations to the Bison grammar file (before the first ‘%%’): + + %glr-parser + %expect-rr 1 + +No change in the grammar itself is required. Now the parser recognizes +all valid declarations, according to the limited syntax above, +transparently. In fact, the user does not even notice when the parser +splits. + + So here we have a case where we can use the benefits of GLR, almost +without disadvantages. Even in simple cases like this, however, there +are at least two potential problems to beware. First, always analyze +the conflicts reported by Bison to make sure that GLR splitting is only +done where it is intended. A GLR parser splitting inadvertently may +cause problems less obvious than an LR parser statically choosing the +wrong alternative in a conflict. Second, consider interactions with the +lexer (*note Semantic Tokens::) with great care. Since a split parser +consumes tokens without performing any actions during the split, the +lexer cannot obtain information via parser actions. Some cases of lexer +interactions can be eliminated by using GLR to shift the complications +from the lexer to the parser. You must check the remaining cases for +correctness. + + In our example, it would be safe for the lexer to return tokens based +on their current meanings in some symbol table, because no new symbols +are defined in the middle of a type declaration. Though it is possible +for a parser to define the enumeration constants as they are parsed, +before the type declaration is completed, it actually makes no +difference since they cannot be used within the same enumerated type +declaration. + + +File: bison.info, Node: Merging GLR Parses, Next: GLR Semantic Actions, Prev: Simple GLR Parsers, Up: GLR Parsers + +1.5.2 Using GLR to Resolve Ambiguities +-------------------------------------- + +Let’s consider an example, vastly simplified from a C++ grammar.(1) + + %{ + #include + int yylex (void); + void yyerror (char const *); + %} + + %define api.value.type {char const *} + + %token TYPENAME ID + + %right '=' + %left '+' + + %glr-parser + + %% + + prog: + %empty + | prog stmt { printf ("\n"); } + ; + + stmt: + expr ';' %dprec 1 + | decl %dprec 2 + ; + + expr: + ID { printf ("%s ", $$); } + | TYPENAME '(' expr ')' + { printf ("%s ", $1); } + | expr '+' expr { printf ("+ "); } + | expr '=' expr { printf ("= "); } + ; + + decl: + TYPENAME declarator ';' + { printf ("%s ", $1); } + | TYPENAME declarator '=' expr ';' + { printf ("%s ", $1); } + ; + + declarator: + ID { printf ("\"%s\" ", $1); } + | '(' declarator ')' + ; + +This models a problematic part of the C++ grammar—the ambiguity between +certain declarations and statements. For example, + + T (x) = y+z; + +parses as either an ‘expr’ or a ‘stmt’ (assuming that ‘T’ is recognized +as a ‘TYPENAME’ and ‘x’ as an ‘ID’). Bison detects this as a +reduce/reduce conflict between the rules ‘expr : ID’ and ‘declarator : +ID’, which it cannot resolve at the time it encounters ‘x’ in the +example above. Since this is a GLR parser, it therefore splits the +problem into two parses, one for each choice of resolving the +reduce/reduce conflict. Unlike the example from the previous section +(*note Simple GLR Parsers::), however, neither of these parses “dies,” +because the grammar as it stands is ambiguous. One of the parsers +eventually reduces ‘stmt : expr ';'’ and the other reduces ‘stmt : +decl’, after which both parsers are in an identical state: they’ve seen +‘prog stmt’ and have the same unprocessed input remaining. We say that +these parses have “merged.” + + At this point, the GLR parser requires a specification in the grammar +of how to choose between the competing parses. In the example above, +the two ‘%dprec’ declarations specify that Bison is to give precedence +to the parse that interprets the example as a ‘decl’, which implies that +‘x’ is a declarator. The parser therefore prints + + "x" y z + T + + The ‘%dprec’ declarations only come into play when more than one +parse survives. Consider a different input string for this parser: + + T (x) + y; + +This is another example of using GLR to parse an unambiguous construct, +as shown in the previous section (*note Simple GLR Parsers::). Here, +there is no ambiguity (this cannot be parsed as a declaration). +However, at the time the Bison parser encounters ‘x’, it does not have +enough information to resolve the reduce/reduce conflict (again, between +‘x’ as an ‘expr’ or a ‘declarator’). In this case, no precedence +declaration is used. Again, the parser splits into two, one assuming +that ‘x’ is an ‘expr’, and the other assuming ‘x’ is a ‘declarator’. +The second of these parsers then vanishes when it sees ‘+’, and the +parser prints + + x T y + + + Suppose that instead of resolving the ambiguity, you wanted to see +all the possibilities. For this purpose, you must merge the semantic +actions of the two possible parsers, rather than choosing one over the +other. To do so, you could change the declaration of ‘stmt’ as follows: + + stmt: + expr ';' %merge + | decl %merge + ; + +and define the ‘stmt_merge’ function as: + + static YYSTYPE + stmt_merge (YYSTYPE x0, YYSTYPE x1) + { + printf (" "); + return ""; + } + +with an accompanying forward declaration in the C declarations at the +beginning of the file: + + %{ + static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); + %} + +With these declarations, the resulting parser parses the first example +as both an ‘expr’ and a ‘decl’, and prints + + "x" y z + T x T y z + = + + Bison requires that all of the productions that participate in any +particular merge have identical ‘%merge’ clauses. Otherwise, the +ambiguity would be unresolvable, and the parser will report an error +during any parse that results in the offending merge. + + + The signature of the merger depends on the type of the symbol. In +the previous example, the merged-to symbol (‘stmt’) does not have a +specific type, and the merger is + + YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); + +However, if ‘stmt’ had a declared type, e.g., + + %type stmt; + +or + + %union { + Node *node; + ... + }; + %type stmt; + +then the prototype of the merger must be: + + Node *stmt_merge (YYSTYPE x0, YYSTYPE x1); + +(This signature might be a mistake originally, and maybe it should have +been ‘Node *stmt_merge (Node *x0, Node *x1)’. If you have an opinion +about it, please let us know.) + + ---------- Footnotes ---------- + + (1) The sources of an extended version of this example are available +in C as ‘examples/c/glr’, and in C++ as ‘examples/c++/glr’. + + +File: bison.info, Node: GLR Semantic Actions, Next: Semantic Predicates, Prev: Merging GLR Parses, Up: GLR Parsers + +1.5.3 GLR Semantic Actions +-------------------------- + +The nature of GLR parsing and the structure of the generated parsers +give rise to certain restrictions on semantic values and actions. + +1.5.3.1 Deferred semantic actions +................................. + +By definition, a deferred semantic action is not performed at the same +time as the associated reduction. This raises caveats for several Bison +features you might use in a semantic action in a GLR parser. + + In any semantic action, you can examine ‘yychar’ to determine the +kind of the lookahead token present at the time of the associated +reduction. After checking that ‘yychar’ is not set to ‘YYEMPTY’ or +‘YYEOF’, you can then examine ‘yylval’ and ‘yylloc’ to determine the +lookahead token’s semantic value and location, if any. In a nondeferred +semantic action, you can also modify any of these variables to influence +syntax analysis. *Note Lookahead::. + + In a deferred semantic action, it’s too late to influence syntax +analysis. In this case, ‘yychar’, ‘yylval’, and ‘yylloc’ are set to +shallow copies of the values they had at the time of the associated +reduction. For this reason alone, modifying them is dangerous. +Moreover, the result of modifying them is undefined and subject to +change with future versions of Bison. For example, if a semantic action +might be deferred, you should never write it to invoke ‘yyclearin’ +(*note Action Features::) or to attempt to free memory referenced by +‘yylval’. + +1.5.3.2 YYERROR +............... + +Another Bison feature requiring special consideration is ‘YYERROR’ +(*note Action Features::), which you can invoke in a semantic action to +initiate error recovery. During deterministic GLR operation, the effect +of ‘YYERROR’ is the same as its effect in a deterministic parser. The +effect in a deferred action is similar, but the precise point of the +error is undefined; instead, the parser reverts to deterministic +operation, selecting an unspecified stack on which to continue with a +syntax error. In a semantic predicate (see *note Semantic Predicates::) +during nondeterministic parsing, ‘YYERROR’ silently prunes the parse +that invoked the test. + +1.5.3.3 Restrictions on semantic values and locations +..................................................... + +GLR parsers require that you use POD (Plain Old Data) types for semantic +values and location types when using the generated parsers as C++ code. + + +File: bison.info, Node: Semantic Predicates, Prev: GLR Semantic Actions, Up: GLR Parsers + +1.5.4 Controlling a Parse with Arbitrary Predicates +--------------------------------------------------- + +In addition to the ‘%dprec’ and ‘%merge’ directives, GLR parsers allow +you to reject parses on the basis of arbitrary computations executed in +user code, without having Bison treat this rejection as an error if +there are alternative parses. For example, + + widget: + %?{ new_syntax } "widget" id new_args { $$ = f($3, $4); } + | %?{ !new_syntax } "widget" id old_args { $$ = f($3, $4); } + ; + +is one way to allow the same parser to handle two different syntaxes for +widgets. The clause preceded by ‘%?’ is treated like an ordinary +midrule action, except that its text is handled as an expression and is +always evaluated immediately (even when in nondeterministic mode). If +the expression yields 0 (false), the clause is treated as a syntax +error, which, in a nondeterministic parser, causes the stack in which it +is reduced to die. In a deterministic parser, it acts like ‘YYERROR’. + + As the example shows, predicates otherwise look like semantic +actions, and therefore you must take them into account when determining +the numbers to use for denoting the semantic values of right-hand side +symbols. Predicate actions, however, have no defined value, and may not +be given labels. + + There is a subtle difference between semantic predicates and ordinary +actions in nondeterministic mode, since the latter are deferred. For +example, we could try to rewrite the previous example as + + widget: + { if (!new_syntax) YYERROR; } + "widget" id new_args { $$ = f($3, $4); } + | { if (new_syntax) YYERROR; } + "widget" id old_args { $$ = f($3, $4); } + ; + +(reversing the sense of the predicate tests to cause an error when they +are false). However, this does _not_ have the same effect if ‘new_args’ +and ‘old_args’ have overlapping syntax. Since the midrule actions +testing ‘new_syntax’ are deferred, a GLR parser first encounters the +unresolved ambiguous reduction for cases where ‘new_args’ and ‘old_args’ +recognize the same string _before_ performing the tests of ‘new_syntax’. +It therefore reports an error. + + Finally, be careful in writing predicates: deferred actions have not +been evaluated, so that using them in a predicate will have undefined +effects. + + +File: bison.info, Node: Locations, Next: Bison Parser, Prev: GLR Parsers, Up: Concepts + +1.6 Locations +============= + +Many applications, like interpreters or compilers, have to produce +verbose and useful error messages. To achieve this, one must be able to +keep track of the “textual location”, or “location”, of each syntactic +construct. Bison provides a mechanism for handling these locations. + + Each token has a semantic value. In a similar fashion, each token +has an associated location, but the type of locations is the same for +all tokens and groupings. Moreover, the output parser is equipped with +a default data structure for storing locations (*note Tracking +Locations::, for more details). + + Like semantic values, locations can be reached in actions using a +dedicated set of constructs. In the example above, the location of the +whole grouping is ‘@$’, while the locations of the subexpressions are +‘@1’ and ‘@3’. + + When a rule is matched, a default action is used to compute the +semantic value of its left hand side (*note Actions::). In the same +way, another default action is used for locations. However, the action +for locations is general enough for most cases, meaning there is usually +no need to describe for each rule how ‘@$’ should be formed. When +building a new location for a given grouping, the default behavior of +the output parser is to take the beginning of the first symbol, and the +end of the last symbol. + + +File: bison.info, Node: Bison Parser, Next: Stages, Prev: Locations, Up: Concepts + +1.7 Bison Output: the Parser Implementation File +================================================ + +When you run Bison, you give it a Bison grammar file as input. The most +important output is a C source file that implements a parser for the +language described by the grammar. This parser is called a “Bison +parser”, and this file is called a “Bison parser implementation file”. +Keep in mind that the Bison utility and the Bison parser are two +distinct programs: the Bison utility is a program whose output is the +Bison parser implementation file that becomes part of your program. + + The job of the Bison parser is to group tokens into groupings +according to the grammar rules—for example, to build identifiers and +operators into expressions. As it does this, it runs the actions for +the grammar rules it uses. + + The tokens come from a function called the “lexical analyzer” that +you must supply in some fashion (such as by writing it in C). The Bison +parser calls the lexical analyzer each time it wants a new token. It +doesn’t know what is “inside” the tokens (though their semantic values +may reflect this). Typically the lexical analyzer makes the tokens by +parsing characters of text, but Bison does not depend on this. *Note +Lexical::. + + The Bison parser implementation file is C code which defines a +function named ‘yyparse’ which implements that grammar. This function +does not make a complete C program: you must supply some additional +functions. One is the lexical analyzer. Another is an error-reporting +function which the parser calls to report an error. In addition, a +complete C program must start with a function called ‘main’; you have to +provide this, and arrange for it to call ‘yyparse’ or the parser will +never run. *Note Interface::. + + Aside from the token kind names and the symbols in the actions you +write, all symbols defined in the Bison parser implementation file +itself begin with ‘yy’ or ‘YY’. This includes interface functions such +as the lexical analyzer function ‘yylex’, the error reporting function +‘yyerror’ and the parser function ‘yyparse’ itself. This also includes +numerous identifiers used for internal purposes. Therefore, you should +avoid using C identifiers starting with ‘yy’ or ‘YY’ in the Bison +grammar file except for the ones defined in this manual. Also, you +should avoid using the C identifiers ‘malloc’ and ‘free’ for anything +other than their usual meanings. + + In some cases the Bison parser implementation file includes system +headers, and in those cases your code should respect the identifiers +reserved by those headers. On some non-GNU hosts, ‘’, +‘’, ‘’ (if available), and ‘’ are included +to declare memory allocators and integer types and constants. +‘’ is included if message translation is in use (*note +Internationalization::). Other system headers may be included if you +define ‘YYDEBUG’ (*note Tracing::) or ‘YYSTACK_USE_ALLOCA’ (*note Table +of Symbols::) to a nonzero value. + + +File: bison.info, Node: Stages, Next: Grammar Layout, Prev: Bison Parser, Up: Concepts + +1.8 Stages in Using Bison +========================= + +The actual language-design process using Bison, from grammar +specification to a working compiler or interpreter, has these parts: + + 1. Formally specify the grammar in a form recognized by Bison (*note + Grammar File::). For each grammatical rule in the language, + describe the action that is to be taken when an instance of that + rule is recognized. The action is described by a sequence of C + statements. + + 2. Write a lexical analyzer to process input and pass tokens to the + parser. The lexical analyzer may be written by hand in C (*note + Lexical::). It could also be produced using Lex, but the use of + Lex is not discussed in this manual. + + 3. Write a controlling function that calls the Bison-produced parser. + + 4. Write error-reporting routines. + + To turn this source code as written into a runnable program, you must +follow these steps: + + 1. Run Bison on the grammar to produce the parser. + + 2. Compile the code output by Bison, as well as any other source + files. + + 3. Link the object files to produce the finished product. + + +File: bison.info, Node: Grammar Layout, Prev: Stages, Up: Concepts + +1.9 The Overall Layout of a Bison Grammar +========================================= + +The input file for the Bison utility is a “Bison grammar file”. The +general form of a Bison grammar file is as follows: + + %{ + PROLOGUE + %} + + BISON DECLARATIONS + + %% + GRAMMAR RULES + %% + EPILOGUE + +The ‘%%’, ‘%{’ and ‘%}’ are punctuation that appears in every Bison +grammar file to separate the sections. + + The prologue may define types and variables used in the actions. You +can also use preprocessor commands to define macros used there, and use +‘#include’ to include header files that do any of these things. You +need to declare the lexical analyzer ‘yylex’ and the error printer +‘yyerror’ here, along with any other global identifiers used by the +actions in the grammar rules. + + The Bison declarations declare the names of the terminal and +nonterminal symbols, and may also describe operator precedence and the +data types of semantic values of various symbols. + + The grammar rules define how to construct each nonterminal symbol +from its parts. + + The epilogue can contain any code you want to use. Often the +definitions of functions declared in the prologue go here. In a simple +program, all the rest of the program can go here. + + +File: bison.info, Node: Examples, Next: Grammar File, Prev: Concepts, Up: Top + +2 Examples +********** + +Now we show and explain several sample programs written using Bison: a +Reverse Polish Notation calculator, an algebraic (infix) notation +calculator — later extended to track “locations” — and a multi-function +calculator. All produce usable, though limited, interactive desk-top +calculators. + + These examples are simple, but Bison grammars for real programming +languages are written the same way. You can copy these examples into a +source file to try them. + + + Bison comes with several examples (including for the different target +languages). If this package is properly installed, you shall find them +in ‘PREFIX/share/doc/bison/examples’, where PREFIX is the root of the +installation, probably something like ‘/usr/local’ or ‘/usr’. + +* Menu: + +* RPN Calc:: Reverse Polish Notation Calculator; + a first example with no operator precedence. +* Infix Calc:: Infix (algebraic) notation calculator. + Operator precedence is introduced. +* Simple Error Recovery:: Continuing after syntax errors. +* Location Tracking Calc:: Demonstrating the use of @N and @$. +* Multi-function Calc:: Calculator with memory and trig functions. + It uses multiple data-types for semantic values. +* Exercises:: Ideas for improving the multi-function calculator. + + +File: bison.info, Node: RPN Calc, Next: Infix Calc, Up: Examples + +2.1 Reverse Polish Notation Calculator +====================================== + +The first example(1) is that of a simple double-precision “Reverse +Polish Notation” calculator (a calculator using postfix operators). +This example provides a good starting point, since operator precedence +is not an issue. The second example will illustrate how operator +precedence is handled. + + The source code for this calculator is named ‘rpcalc.y’. The ‘.y’ +extension is a convention used for Bison grammar files. + +* Menu: + +* Rpcalc Declarations:: Prologue (declarations) for rpcalc. +* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation. +* Rpcalc Lexer:: The lexical analyzer. +* Rpcalc Main:: The controlling function. +* Rpcalc Error:: The error reporting function. +* Rpcalc Generate:: Running Bison on the grammar file. +* Rpcalc Compile:: Run the C compiler on the output code. + + ---------- Footnotes ---------- + + (1) The sources of ‘rpcalc’ are available as ‘examples/c/rpcalc’. + + +File: bison.info, Node: Rpcalc Declarations, Next: Rpcalc Rules, Up: RPN Calc + +2.1.1 Declarations for ‘rpcalc’ +------------------------------- + +Here are the C and Bison declarations for the Reverse Polish Notation +calculator. As in C, comments are placed between ‘/*...*/’ or after +‘//’. + + /* Reverse Polish Notation calculator. */ + + %{ + #include + #include + int yylex (void); + void yyerror (char const *); + %} + + %define api.value.type {double} + %token NUM + + %% /* Grammar rules and actions follow. */ + + The declarations section (*note Prologue::) contains two preprocessor +directives and two forward declarations. + + The ‘#include’ directive is used to declare the exponentiation +function ‘pow’. + + The forward declarations for ‘yylex’ and ‘yyerror’ are needed because +the C language requires that functions be declared before they are used. +These functions will be defined in the epilogue, but the parser calls +them so they must be declared in the prologue. + + The second section, Bison declarations, provides information to Bison +about the tokens and their types (*note Bison Declarations::). + + The ‘%define’ directive defines the variable ‘api.value.type’, thus +specifying the C data type for semantic values of both tokens and +groupings (*note Value Type::). The Bison parser will use whatever type +‘api.value.type’ is defined as; if you don’t define it, ‘int’ is the +default. Because we specify ‘{double}’, each token and each expression +has an associated value, which is a floating point number. C code can +use ‘YYSTYPE’ to refer to the value ‘api.value.type’. + + Each terminal symbol that is not a single-character literal must be +declared. (Single-character literals normally don’t need to be +declared.) In this example, all the arithmetic operators are designated +by single-character literals, so the only terminal symbol that needs to +be declared is ‘NUM’, the token kind for numeric constants. + + +File: bison.info, Node: Rpcalc Rules, Next: Rpcalc Lexer, Prev: Rpcalc Declarations, Up: RPN Calc + +2.1.2 Grammar Rules for ‘rpcalc’ +-------------------------------- + +Here are the grammar rules for the Reverse Polish Notation calculator. + + input: + %empty + | input line + ; + + line: + '\n' + | exp '\n' { printf ("%.10g\n", $1); } + ; + + exp: + NUM + | exp exp '+' { $$ = $1 + $2; } + | exp exp '-' { $$ = $1 - $2; } + | exp exp '*' { $$ = $1 * $2; } + | exp exp '/' { $$ = $1 / $2; } + | exp exp '^' { $$ = pow ($1, $2); } /* Exponentiation */ + | exp 'n' { $$ = -$1; } /* Unary minus */ + ; + %% + + The groupings of the rpcalc “language” defined here are the +expression (given the name ‘exp’), the line of input (‘line’), and the +complete input transcript (‘input’). Each of these nonterminal symbols +has several alternate rules, joined by the vertical bar ‘|’ which is +read as “or”. The following sections explain what these rules mean. + + The semantics of the language is determined by the actions taken when +a grouping is recognized. The actions are the C code that appears +inside braces. *Note Actions::. + + You must specify these actions in C, but Bison provides the means for +passing semantic values between the rules. In each action, the +pseudo-variable ‘$$’ stands for the semantic value for the grouping that +the rule is going to construct. Assigning a value to ‘$$’ is the main +job of most actions. The semantic values of the components of the rule +are referred to as ‘$1’, ‘$2’, and so on. + +* Menu: + +* Rpcalc Input:: Explanation of the ‘input’ nonterminal +* Rpcalc Line:: Explanation of the ‘line’ nonterminal +* Rpcalc Exp:: Explanation of the ‘exp’ nonterminal + + +File: bison.info, Node: Rpcalc Input, Next: Rpcalc Line, Up: Rpcalc Rules + +2.1.2.1 Explanation of ‘input’ +.............................. + +Consider the definition of ‘input’: + + input: + %empty + | input line + ; + + This definition reads as follows: “A complete input is either an +empty string, or a complete input followed by an input line”. Notice +that “complete input” is defined in terms of itself. This definition is +said to be “left recursive” since ‘input’ appears always as the leftmost +symbol in the sequence. *Note Recursion::. + + The first alternative is empty because there are no symbols between +the colon and the first ‘|’; this means that ‘input’ can match an empty +string of input (no tokens). We write the rules this way because it is +legitimate to type ‘Ctrl-d’ right after you start the calculator. It’s +conventional to put an empty alternative first and to use the (optional) +‘%empty’ directive, or to write the comment ‘/* empty */’ in it (*note +Empty Rules::). + + The second alternate rule (‘input line’) handles all nontrivial +input. It means, “After reading any number of lines, read one more line +if possible.” The left recursion makes this rule into a loop. Since the +first alternative matches empty input, the loop can be executed zero or +more times. + + The parser function ‘yyparse’ continues to process input until a +grammatical error is seen or the lexical analyzer says there are no more +input tokens; we will arrange for the latter to happen at end-of-input. + + +File: bison.info, Node: Rpcalc Line, Next: Rpcalc Exp, Prev: Rpcalc Input, Up: Rpcalc Rules + +2.1.2.2 Explanation of ‘line’ +............................. + +Now consider the definition of ‘line’: + + line: + '\n' + | exp '\n' { printf ("%.10g\n", $1); } + ; + + The first alternative is a token which is a newline character; this +means that rpcalc accepts a blank line (and ignores it, since there is +no action). The second alternative is an expression followed by a +newline. This is the alternative that makes rpcalc useful. The +semantic value of the ‘exp’ grouping is the value of ‘$1’ because the +‘exp’ in question is the first symbol in the alternative. The action +prints this value, which is the result of the computation the user asked +for. + + This action is unusual because it does not assign a value to ‘$$’. +As a consequence, the semantic value associated with the ‘line’ is +uninitialized (its value will be unpredictable). This would be a bug if +that value were ever used, but we don’t use it: once rpcalc has printed +the value of the user’s input line, that value is no longer needed. + + +File: bison.info, Node: Rpcalc Exp, Prev: Rpcalc Line, Up: Rpcalc Rules + +2.1.2.3 Explanation of ‘exp’ +............................ + +The ‘exp’ grouping has several rules, one for each kind of expression. +The first rule handles the simplest expressions: those that are just +numbers. The second handles an addition-expression, which looks like +two expressions followed by a plus-sign. The third handles subtraction, +and so on. + + exp: + NUM + | exp exp '+' { $$ = $1 + $2; } + | exp exp '-' { $$ = $1 - $2; } + ... + ; + + We have used ‘|’ to join all the rules for ‘exp’, but we could +equally well have written them separately: + + exp: NUM; + exp: exp exp '+' { $$ = $1 + $2; }; + exp: exp exp '-' { $$ = $1 - $2; }; + ... + + Most of the rules have actions that compute the value of the +expression in terms of the value of its parts. For example, in the rule +for addition, ‘$1’ refers to the first component ‘exp’ and ‘$2’ refers +to the second one. The third component, ‘'+'’, has no meaningful +associated semantic value, but if it had one you could refer to it as +‘$3’. The first rule relies on the implicit default action: ‘{ $$ = $1; +}’. + + When ‘yyparse’ recognizes a sum expression using this rule, the sum +of the two subexpressions’ values is produced as the value of the entire +expression. *Note Actions::. + + You don’t have to give an action for every rule. When a rule has no +action, Bison by default copies the value of ‘$1’ into ‘$$’. This is +what happens in the first rule (the one that uses ‘NUM’). + + The formatting shown here is the recommended convention, but Bison +does not require it. You can add or change white space as much as you +wish. For example, this: + + exp: NUM | exp exp '+' {$$ = $1 + $2; } | ... ; + +means the same thing as this: + + exp: + NUM + | exp exp '+' { $$ = $1 + $2; } + | ... + ; + +The latter, however, is much more readable. + + +File: bison.info, Node: Rpcalc Lexer, Next: Rpcalc Main, Prev: Rpcalc Rules, Up: RPN Calc + +2.1.3 The ‘rpcalc’ Lexical Analyzer +----------------------------------- + +The lexical analyzer’s job is low-level parsing: converting characters +or sequences of characters into tokens. The Bison parser gets its +tokens by calling the lexical analyzer. *Note Lexical::. + + Only a simple lexical analyzer is needed for the RPN calculator. +This lexical analyzer skips blanks and tabs, then reads in numbers as +‘double’ and returns them as ‘NUM’ tokens. Any other character that +isn’t part of a number is a separate token. Note that the token-code +for such a single-character token is the character itself. + + The return value of the lexical analyzer function is a numeric code +which represents a token kind. The same text used in Bison rules to +stand for this token kind is also a C expression for the numeric code of +the kind. This works in two ways. If the token kind is a character +literal, then its numeric code is that of the character; you can use the +same character literal in the lexical analyzer to express the number. +If the token kind is an identifier, that identifier is defined by Bison +as a C enum whose definition is the appropriate code. In this example, +therefore, ‘NUM’ becomes an enum for ‘yylex’ to use. + + The semantic value of the token (if it has one) is stored into the +global variable ‘yylval’, which is where the Bison parser will look for +it. (The C data type of ‘yylval’ is ‘YYSTYPE’, whose value was defined +at the beginning of the grammar via ‘%define api.value.type {double}’; +*note Rpcalc Declarations::.) + + A token kind code of zero is returned if the end-of-input is +encountered. (Bison recognizes any nonpositive value as indicating +end-of-input.) + + Here is the code for the lexical analyzer: + + /* The lexical analyzer returns a double floating point + number on the stack and the token NUM, or the numeric code + of the character read if not a number. It skips all blanks + and tabs, and returns 0 for end-of-input. */ + + #include + #include + + int + yylex (void) + { + int c = getchar (); + /* Skip white space. */ + while (c == ' ' || c == '\t') + c = getchar (); + /* Process numbers. */ + if (c == '.' || isdigit (c)) + { + ungetc (c, stdin); + if (scanf ("%lf", &yylval) != 1) + abort (); + return NUM; + } + /* Return end-of-input. */ + else if (c == EOF) + return YYEOF; + /* Return a single char. */ + else + return c; + } + + +File: bison.info, Node: Rpcalc Main, Next: Rpcalc Error, Prev: Rpcalc Lexer, Up: RPN Calc + +2.1.4 The Controlling Function +------------------------------ + +In keeping with the spirit of this example, the controlling function is +kept to the bare minimum. The only requirement is that it call +‘yyparse’ to start the process of parsing. + + int + main (void) + { + return yyparse (); + } + + +File: bison.info, Node: Rpcalc Error, Next: Rpcalc Generate, Prev: Rpcalc Main, Up: RPN Calc + +2.1.5 The Error Reporting Routine +--------------------------------- + +When ‘yyparse’ detects a syntax error, it calls the error reporting +function ‘yyerror’ to print an error message (usually but not always +‘"syntax error"’). It is up to the programmer to supply ‘yyerror’ +(*note Interface::), so here is the definition we will use: + + #include + + /* Called by yyparse on error. */ + void + yyerror (char const *s) + { + fprintf (stderr, "%s\n", s); + } + + After ‘yyerror’ returns, the Bison parser may recover from the error +and continue parsing if the grammar contains a suitable error rule +(*note Error Recovery::). Otherwise, ‘yyparse’ returns nonzero. We +have not written any error rules in this example, so any invalid input +will cause the calculator program to exit. This is not clean behavior +for a real calculator, but it is adequate for the first example. + + +File: bison.info, Node: Rpcalc Generate, Next: Rpcalc Compile, Prev: Rpcalc Error, Up: RPN Calc + +2.1.6 Running Bison to Make the Parser +-------------------------------------- + +Before running Bison to produce a parser, we need to decide how to +arrange all the source code in one or more source files. For such a +simple example, the easiest thing is to put everything in one file, the +grammar file. The definitions of ‘yylex’, ‘yyerror’ and ‘main’ go at +the end, in the epilogue of the grammar file (*note Grammar Layout::). + + For a large project, you would probably have several source files, +and use ‘make’ to arrange to recompile them. + + With all the source in the grammar file, you use the following +command to convert it into a parser implementation file: + + $ bison FILE.y + +In this example, the grammar file is called ‘rpcalc.y’ (for “Reverse +Polish CALCulator”). Bison produces a parser implementation file named +‘FILE.tab.c’, removing the ‘.y’ from the grammar file name. The parser +implementation file contains the source code for ‘yyparse’. The +additional functions in the grammar file (‘yylex’, ‘yyerror’ and ‘main’) +are copied verbatim to the parser implementation file. + + +File: bison.info, Node: Rpcalc Compile, Prev: Rpcalc Generate, Up: RPN Calc + +2.1.7 Compiling the Parser Implementation File +---------------------------------------------- + +Here is how to compile and run the parser implementation file: + + # List files in current directory. + $ ls + rpcalc.tab.c rpcalc.y + + # Compile the Bison parser. + # ‘-lm’ tells compiler to search math library for ‘pow’. + $ cc -lm -o rpcalc rpcalc.tab.c + + # List files again. + $ ls + rpcalc rpcalc.tab.c rpcalc.y + + The file ‘rpcalc’ now contains the executable code. Here is an +example session using ‘rpcalc’. + + $ rpcalc + 4 9 + + ⇒ 13 + 3 7 + 3 4 5 *+- + ⇒ -13 + 3 7 + 3 4 5 * + - n Note the unary minus, ‘n’ + ⇒ 13 + 5 6 / 4 n + + ⇒ -3.166666667 + 3 4 ^ Exponentiation + ⇒ 81 + ^D End-of-file indicator + $ + + +File: bison.info, Node: Infix Calc, Next: Simple Error Recovery, Prev: RPN Calc, Up: Examples + +2.2 Infix Notation Calculator: ‘calc’ +===================================== + +We now modify rpcalc to handle infix operators instead of postfix.(1) +Infix notation involves the concept of operator precedence and the need +for parentheses nested to arbitrary depth. Here is the Bison code for +‘calc.y’, an infix desk-top calculator. + + /* Infix notation calculator. */ + + %{ + #include + #include + int yylex (void); + void yyerror (char const *); + %} + + /* Bison declarations. */ + %define api.value.type {double} + %token NUM + %left '-' '+' + %left '*' '/' + %precedence NEG /* negation--unary minus */ + %right '^' /* exponentiation */ + + %% /* The grammar follows. */ + input: + %empty + | input line + ; + + line: + '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + ; + + exp: + NUM + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + ; + %% + +The functions ‘yylex’, ‘yyerror’ and ‘main’ can be the same as before. + + There are two important new features shown in this code. + + In the second section (Bison declarations), ‘%left’ declares token +kinds and says they are left-associative operators. The declarations +‘%left’ and ‘%right’ (right associativity) take the place of ‘%token’ +which is used to declare a token kind name without +associativity/precedence. (These tokens are single-character literals, +which ordinarily don’t need to be declared. We declare them here to +specify the associativity/precedence.) + + Operator precedence is determined by the line ordering of the +declarations; the higher the line number of the declaration (lower on +the page or screen), the higher the precedence. Hence, exponentiation +has the highest precedence, unary minus (‘NEG’) is next, followed by ‘*’ +and ‘/’, and so on. Unary minus is not associative, only precedence +matters (‘%precedence’. *Note Precedence::. + + The other important new feature is the ‘%prec’ in the grammar section +for the unary minus operator. The ‘%prec’ simply instructs Bison that +the rule ‘| '-' exp’ has the same precedence as ‘NEG’—in this case the +next-to-highest. *Note Contextual Precedence::. + + Here is a sample run of ‘calc.y’: + + $ calc + 4 + 4.5 - (34/(8*3+-3)) + 6.880952381 + -56 + 2 + -54 + 3 ^ 2 + 9 + + ---------- Footnotes ---------- + + (1) A similar example, but using an unambiguous grammar rather than +precedence and associativity annotations, is available as +‘examples/c/calc’. + + +File: bison.info, Node: Simple Error Recovery, Next: Location Tracking Calc, Prev: Infix Calc, Up: Examples + +2.3 Simple Error Recovery +========================= + +Up to this point, this manual has not addressed the issue of “error +recovery”—how to continue parsing after the parser detects a syntax +error. All we have handled is error reporting with ‘yyerror’. Recall +that by default ‘yyparse’ returns after calling ‘yyerror’. This means +that an erroneous input line causes the calculator program to exit. Now +we show how to rectify this deficiency. + + The Bison language itself includes the reserved word ‘error’, which +may be included in the grammar rules. In the example below it has been +added to one of the alternatives for ‘line’: + + line: + '\n' + | exp '\n' { printf ("\t%.10g\n", $1); } + | error '\n' { yyerrok; } + ; + + This addition to the grammar allows for simple error recovery in the +event of a syntax error. If an expression that cannot be evaluated is +read, the error will be recognized by the third rule for ‘line’, and +parsing will continue. (The ‘yyerror’ function is still called upon to +print its message as well.) The action executes the statement +‘yyerrok’, a macro defined automatically by Bison; its meaning is that +error recovery is complete (*note Error Recovery::). Note the +difference between ‘yyerrok’ and ‘yyerror’; neither one is a misprint. + + This form of error recovery deals with syntax errors. There are +other kinds of errors; for example, division by zero, which raises an +exception signal that is normally fatal. A real calculator program must +handle this signal and use ‘longjmp’ to return to ‘main’ and resume +parsing input lines; it would also have to discard the rest of the +current line of input. We won’t discuss this issue further because it +is not specific to Bison programs. + + +File: bison.info, Node: Location Tracking Calc, Next: Multi-function Calc, Prev: Simple Error Recovery, Up: Examples + +2.4 Location Tracking Calculator: ‘ltcalc’ +========================================== + +This example extends the infix notation calculator with location +tracking. This feature will be used to improve the error messages. For +the sake of clarity, this example is a simple integer calculator, since +most of the work needed to use locations will be done in the lexical +analyzer. + +* Menu: + +* Ltcalc Declarations:: Bison and C declarations for ltcalc. +* Ltcalc Rules:: Grammar rules for ltcalc, with explanations. +* Ltcalc Lexer:: The lexical analyzer. + + +File: bison.info, Node: Ltcalc Declarations, Next: Ltcalc Rules, Up: Location Tracking Calc + +2.4.1 Declarations for ‘ltcalc’ +------------------------------- + +The C and Bison declarations for the location tracking calculator are +the same as the declarations for the infix notation calculator. + + /* Location tracking calculator. */ + + %{ + #include + int yylex (void); + void yyerror (char const *); + %} + + /* Bison declarations. */ + %define api.value.type {int} + %token NUM + + %left '-' '+' + %left '*' '/' + %precedence NEG + %right '^' + + %% /* The grammar follows. */ + +Note there are no declarations specific to locations. Defining a data +type for storing locations is not needed: we will use the type provided +by default (*note Location Type::), which is a four member structure +with the following integer fields: ‘first_line’, ‘first_column’, +‘last_line’ and ‘last_column’. By conventions, and in accordance with +the GNU Coding Standards and common practice, the line and column count +both start at 1. + + +File: bison.info, Node: Ltcalc Rules, Next: Ltcalc Lexer, Prev: Ltcalc Declarations, Up: Location Tracking Calc + +2.4.2 Grammar Rules for ‘ltcalc’ +-------------------------------- + +Whether handling locations or not has no effect on the syntax of your +language. Therefore, grammar rules for this example will be very close +to those of the previous example: we will only modify them to benefit +from the new information. + + Here, we will use locations to report divisions by zero, and locate +the wrong expressions or subexpressions. + + input: + %empty + | input line + ; + + line: + '\n' + | exp '\n' { printf ("%d\n", $1); } + ; + + exp: + NUM + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp + { + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, "%d.%d-%d.%d: division by zero", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + + This code shows how to reach locations inside of semantic actions, by +using the pseudo-variables ‘@N’ for rule components, and the +pseudo-variable ‘@$’ for groupings. + + We don’t need to assign a value to ‘@$’: the output parser does it +automatically. By default, before executing the C code of each action, +‘@$’ is set to range from the beginning of ‘@1’ to the end of ‘@N’, for +a rule with N components. This behavior can be redefined (*note +Location Default Action::), and for very specific rules, ‘@$’ can be +computed by hand. + + +File: bison.info, Node: Ltcalc Lexer, Prev: Ltcalc Rules, Up: Location Tracking Calc + +2.4.3 The ‘ltcalc’ Lexical Analyzer. +------------------------------------ + +Until now, we relied on Bison’s defaults to enable location tracking. +The next step is to rewrite the lexical analyzer, and make it able to +feed the parser with the token locations, as it already does for +semantic values. + + To this end, we must take into account every single character of the +input text, to avoid the computed locations of being fuzzy or wrong: + + int + yylex (void) + { + int c; + + /* Skip white space. */ + while ((c = getchar ()) == ' ' || c == '\t') + ++yylloc.last_column; + + /* Step. */ + yylloc.first_line = yylloc.last_line; + yylloc.first_column = yylloc.last_column; + + /* Process numbers. */ + if (isdigit (c)) + { + yylval = c - '0'; + ++yylloc.last_column; + while (isdigit (c = getchar ())) + { + ++yylloc.last_column; + yylval = yylval * 10 + c - '0'; + } + ungetc (c, stdin); + return NUM; + } + + /* Return end-of-input. */ + if (c == EOF) + return YYEOF; + + /* Return a single char, and update location. */ + if (c == '\n') + { + ++yylloc.last_line; + yylloc.last_column = 0; + } + else + ++yylloc.last_column; + return c; + } + + Basically, the lexical analyzer performs the same processing as +before: it skips blanks and tabs, and reads numbers or single-character +tokens. In addition, it updates ‘yylloc’, the global variable (of type +‘YYLTYPE’) containing the token’s location. + + Now, each time this function returns a token, the parser has its kind +as well as its semantic value, and its location in the text. The last +needed change is to initialize ‘yylloc’, for example in the controlling +function: + + int + main (void) + { + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 0; + return yyparse (); + } + + Remember that computing locations is not a matter of syntax. Every +character must be associated to a location update, whether it is in +valid input, in comments, in literal strings, and so on. + + +File: bison.info, Node: Multi-function Calc, Next: Exercises, Prev: Location Tracking Calc, Up: Examples + +2.5 Multi-Function Calculator: ‘mfcalc’ +======================================= + +Now that the basics of Bison have been discussed, it is time to move on +to a more advanced problem.(1) The above calculators provided only five +functions, ‘+’, ‘-’, ‘*’, ‘/’ and ‘^’. It would be nice to have a +calculator that provides other mathematical functions such as ‘sin’, +‘cos’, etc. + + It is easy to add new operators to the infix calculator as long as +they are only single-character literals. The lexical analyzer ‘yylex’ +passes back all nonnumeric characters as tokens, so new grammar rules +suffice for adding a new operator. But we want something more flexible: +built-in functions whose syntax has this form: + + FUNCTION_NAME (ARGUMENT) + +At the same time, we will add memory to the calculator, by allowing you +to create named variables, store values in them, and use them later. +Here is a sample session with the multi-function calculator: + + $ mfcalc + pi = 3.141592653589 + ⇒ 3.1415926536 + sin(pi) + ⇒ 0.0000000000 + alpha = beta1 = 2.3 + ⇒ 2.3000000000 + alpha + ⇒ 2.3000000000 + ln(alpha) + ⇒ 0.8329091229 + exp(ln(beta1)) + ⇒ 2.3000000000 + $ + + Note that multiple assignment and nested function calls are +permitted. + +* Menu: + +* Mfcalc Declarations:: Bison declarations for multi-function calculator. +* Mfcalc Rules:: Grammar rules for the calculator. +* Mfcalc Symbol Table:: Symbol table management subroutines. +* Mfcalc Lexer:: The lexical analyzer. +* Mfcalc Main:: The controlling function. + + ---------- Footnotes ---------- + + (1) The sources of ‘mfcalc’ are available as ‘examples/c/mfcalc’. + + +File: bison.info, Node: Mfcalc Declarations, Next: Mfcalc Rules, Up: Multi-function Calc + +2.5.1 Declarations for ‘mfcalc’ +------------------------------- + +Here are the C and Bison declarations for the multi-function calculator. + + %{ + #include /* For printf, etc. */ + #include /* For pow, used in the grammar. */ + #include "calc.h" /* Contains definition of 'symrec'. */ + int yylex (void); + void yyerror (char const *); + %} + + %define api.value.type union /* Generate YYSTYPE from these types: */ + %token NUM /* Double precision number. */ + %token VAR FUN /* Symbol table pointer: variable/function. */ + %nterm exp + + %precedence '=' + %left '-' '+' + %left '*' '/' + %precedence NEG /* negation--unary minus */ + %right '^' /* exponentiation */ + + The above grammar introduces only two new features of the Bison +language. These features allow semantic values to have various data +types (*note Multiple Types::). + + The special ‘union’ value assigned to the ‘%define’ variable +‘api.value.type’ specifies that the symbols are defined with their data +types. Bison will generate an appropriate definition of ‘YYSTYPE’ to +store these values. + + Since values can now have various types, it is necessary to associate +a type with each grammar symbol whose semantic value is used. These +symbols are ‘NUM’, ‘VAR’, ‘FUN’, and ‘exp’. Their declarations are +augmented with their data type (placed between angle brackets). For +instance, values of ‘NUM’ are stored in ‘double’. + + The Bison construct ‘%nterm’ is used for declaring nonterminal +symbols, just as ‘%token’ is used for declaring token kinds. Previously +we did not use ‘%nterm’ before because nonterminal symbols are normally +declared implicitly by the rules that define them. But ‘exp’ must be +declared explicitly so we can specify its value type. *Note Type +Decl::. + + +File: bison.info, Node: Mfcalc Rules, Next: Mfcalc Symbol Table, Prev: Mfcalc Declarations, Up: Multi-function Calc + +2.5.2 Grammar Rules for ‘mfcalc’ +-------------------------------- + +Here are the grammar rules for the multi-function calculator. Most of +them are copied directly from ‘calc’; three rules, those which mention +‘VAR’ or ‘FUN’, are new. + + %% /* The grammar follows. */ + input: + %empty + | input line + ; + + line: + '\n' + | exp '\n' { printf ("%.10g\n", $1); } + | error '\n' { yyerrok; } + ; + + exp: + NUM + | VAR { $$ = $1->value.var; } + | VAR '=' exp { $$ = $3; $1->value.var = $3; } + | FUN '(' exp ')' { $$ = $1->value.fun ($3); } + | exp '+' exp { $$ = $1 + $3; } + | exp '-' exp { $$ = $1 - $3; } + | exp '*' exp { $$ = $1 * $3; } + | exp '/' exp { $$ = $1 / $3; } + | '-' exp %prec NEG { $$ = -$2; } + | exp '^' exp { $$ = pow ($1, $3); } + | '(' exp ')' { $$ = $2; } + ; + /* End of grammar. */ + %% + + +File: bison.info, Node: Mfcalc Symbol Table, Next: Mfcalc Lexer, Prev: Mfcalc Rules, Up: Multi-function Calc + +2.5.3 The ‘mfcalc’ Symbol Table +------------------------------- + +The multi-function calculator requires a symbol table to keep track of +the names and meanings of variables and functions. This doesn’t affect +the grammar rules (except for the actions) or the Bison declarations, +but it requires some additional C functions for support. + + The symbol table itself consists of a linked list of records. Its +definition, which is kept in the header ‘calc.h’, is as follows. It +provides for either functions or variables to be placed in the table. + + /* Function type. */ + typedef double (func_t) (double); + + /* Data type for links in the chain of symbols. */ + struct symrec + { + char *name; /* name of symbol */ + int type; /* type of symbol: either VAR or FUN */ + union + { + double var; /* value of a VAR */ + func_t *fun; /* value of a FUN */ + } value; + struct symrec *next; /* link field */ + }; + + typedef struct symrec symrec; + + /* The symbol table: a chain of 'struct symrec'. */ + extern symrec *sym_table; + + symrec *putsym (char const *name, int sym_type); + symrec *getsym (char const *name); + + The new version of ‘main’ will call ‘init_table’ to initialize the +symbol table: + + struct init + { + char const *name; + func_t *fun; + }; + + struct init const funs[] = + { + { "atan", atan }, + { "cos", cos }, + { "exp", exp }, + { "ln", log }, + { "sin", sin }, + { "sqrt", sqrt }, + { 0, 0 }, + }; + + /* The symbol table: a chain of 'struct symrec'. */ + symrec *sym_table; + + /* Put functions in table. */ + static void + init_table (void) + { + for (int i = 0; funs[i].name; i++) + { + symrec *ptr = putsym (funs[i].name, FUN); + ptr->value.fun = funs[i].fun; + } + } + + By simply editing the initialization list and adding the necessary +include files, you can add additional functions to the calculator. + + Two important functions allow look-up and installation of symbols in +the symbol table. The function ‘putsym’ is passed a name and the kind +(‘VAR’ or ‘FUN’) of the object to be installed. The object is linked to +the front of the list, and a pointer to the object is returned. The +function ‘getsym’ is passed the name of the symbol to look up. If +found, a pointer to that symbol is returned; otherwise zero is returned. + + /* The mfcalc code assumes that malloc and realloc + always succeed, and that integer calculations + never overflow. Production-quality code should + not make these assumptions. */ + #include + #include /* malloc, realloc. */ + #include /* strlen. */ + + symrec * + putsym (char const *name, int sym_type) + { + symrec *res = (symrec *) malloc (sizeof (symrec)); + res->name = strdup (name); + res->type = sym_type; + res->value.var = 0; /* Set value to 0 even if fun. */ + res->next = sym_table; + sym_table = res; + return res; + } + + symrec * + getsym (char const *name) + { + for (symrec *p = sym_table; p; p = p->next) + if (strcmp (p->name, name) == 0) + return p; + return NULL; + } + + +File: bison.info, Node: Mfcalc Lexer, Next: Mfcalc Main, Prev: Mfcalc Symbol Table, Up: Multi-function Calc + +2.5.4 The ‘mfcalc’ Lexer +------------------------ + +The function ‘yylex’ must now recognize variables, numeric values, and +the single-character arithmetic operators. Strings of alphanumeric +characters with a leading letter are recognized as either variables or +functions depending on what the symbol table says about them. + + The string is passed to ‘getsym’ for look up in the symbol table. If +the name appears in the table, a pointer to its location and its type +(‘VAR’ or ‘FUN’) is returned to ‘yyparse’. If it is not already in the +table, then it is installed as a ‘VAR’ using ‘putsym’. Again, a pointer +and its type (which must be ‘VAR’) is returned to ‘yyparse’. + + No change is needed in the handling of numeric values and arithmetic +operators in ‘yylex’. + + #include + #include + + int + yylex (void) + { + int c = getchar (); + + /* Ignore white space, get first nonwhite character. */ + while (c == ' ' || c == '\t') + c = getchar (); + + if (c == EOF) + return YYEOF; + + /* Char starts a number => parse the number. */ + if (c == '.' || isdigit (c)) + { + ungetc (c, stdin); + if (scanf ("%lf", &yylval.NUM) != 1) + abort (); + return NUM; + } + +Bison generated a definition of ‘YYSTYPE’ with a member named ‘NUM’ to +store value of ‘NUM’ symbols. + + /* Char starts an identifier => read the name. */ + if (isalpha (c)) + { + static ptrdiff_t bufsize = 0; + static char *symbuf = 0; + ptrdiff_t i = 0; + do + { + /* If buffer is full, make it bigger. */ + if (bufsize <= i) + { + bufsize = 2 * bufsize + 40; + symbuf = realloc (symbuf, (size_t) bufsize); + } + /* Add this character to the buffer. */ + symbuf[i++] = (char) c; + /* Get another character. */ + c = getchar (); + } + while (isalnum (c)); + + ungetc (c, stdin); + symbuf[i] = '\0'; + + symrec *s = getsym (symbuf); + if (!s) + s = putsym (symbuf, VAR); + yylval.VAR = s; /* or yylval.FUN = s. */ + return s->type; + } + + /* Any other character is a token by itself. */ + return c; + } + + +File: bison.info, Node: Mfcalc Main, Prev: Mfcalc Lexer, Up: Multi-function Calc + +2.5.5 The ‘mfcalc’ Main +----------------------- + +The error reporting function is unchanged, and the new version of ‘main’ +includes a call to ‘init_table’ and sets the ‘yydebug’ on user demand +(*Note Tracing::, for details): + + /* Called by yyparse on error. */ + void yyerror (char const *s) + { + fprintf (stderr, "%s\n", s); + } + + int main (int argc, char const* argv[]) + { + /* Enable parse traces on option -p. */ + if (argc == 2 && strcmp(argv[1], "-p") == 0) + yydebug = 1; + init_table (); + return yyparse (); + } + + This program is both powerful and flexible. You may easily add new +functions, and it is a simple job to modify this code to install +predefined variables such as ‘pi’ or ‘e’ as well. + + +File: bison.info, Node: Exercises, Prev: Multi-function Calc, Up: Examples + +2.6 Exercises +============= + + 1. Add some new functions from ‘math.h’ to the initialization list. + + 2. Add another array that contains constants and their values. Then + modify ‘init_table’ to add these constants to the symbol table. It + will be easiest to give the constants type ‘VAR’. + + 3. Make the program report an error if the user refers to an + uninitialized variable in any way except to store a value in it. + + +File: bison.info, Node: Grammar File, Next: Interface, Prev: Examples, Up: Top + +3 Bison Grammar Files +********************* + +Bison takes as input a context-free grammar specification and produces a +C-language function that recognizes correct instances of the grammar. + + The Bison grammar file conventionally has a name ending in ‘.y’. +*Note Invocation::. + +* Menu: + +* Grammar Outline:: Overall layout of the grammar file. +* Symbols:: Terminal and nonterminal symbols. +* Rules:: How to write grammar rules. +* Semantics:: Semantic values and actions. +* Tracking Locations:: Locations and actions. +* Named References:: Using named references in actions. +* Declarations:: All kinds of Bison declarations are described here. +* Multiple Parsers:: Putting more than one Bison parser in one program. + + +File: bison.info, Node: Grammar Outline, Next: Symbols, Up: Grammar File + +3.1 Outline of a Bison Grammar +============================== + +A Bison grammar file has four main sections, shown here with the +appropriate delimiters: + + %{ + PROLOGUE + %} + + BISON DECLARATIONS + + %% + GRAMMAR RULES + %% + + EPILOGUE + + Comments enclosed in ‘/* ... */’ may appear in any of the sections. +As a GNU extension, ‘//’ introduces a comment that continues until end +of line. + +* Menu: + +* Prologue:: Syntax and usage of the prologue. +* Prologue Alternatives:: Syntax and usage of alternatives to the prologue. +* Bison Declarations:: Syntax and usage of the Bison declarations section. +* Grammar Rules:: Syntax and usage of the grammar rules section. +* Epilogue:: Syntax and usage of the epilogue. + + +File: bison.info, Node: Prologue, Next: Prologue Alternatives, Up: Grammar Outline + +3.1.1 The prologue +------------------ + +The PROLOGUE section contains macro definitions and declarations of +functions and variables that are used in the actions in the grammar +rules. These are copied to the beginning of the parser implementation +file so that they precede the definition of ‘yyparse’. You can use +‘#include’ to get the declarations from a header file. If you don’t +need any C declarations, you may omit the ‘%{’ and ‘%}’ delimiters that +bracket this section. + + The PROLOGUE section is terminated by the first occurrence of ‘%}’ +that is outside a comment, a string literal, or a character constant. + + You may have more than one PROLOGUE section, intermixed with the +BISON DECLARATIONS. This allows you to have C and Bison declarations +that refer to each other. For example, the ‘%union’ declaration may use +types defined in a header file, and you may wish to prototype functions +that take arguments of type ‘YYSTYPE’. This can be done with two +PROLOGUE blocks, one before and one after the ‘%union’ declaration. + + %{ + #define _GNU_SOURCE + #include + #include "ptypes.h" + %} + + %union { + long n; + tree t; /* ‘tree’ is defined in ‘ptypes.h’. */ + } + + %{ + static void print_token (yytoken_kind_t token, YYSTYPE val); + %} + + ... + + When in doubt, it is usually safer to put prologue code before all +Bison declarations, rather than after. For example, any definitions of +feature test macros like ‘_GNU_SOURCE’ or ‘_POSIX_C_SOURCE’ should +appear before all Bison declarations, as feature test macros can affect +the behavior of Bison-generated ‘#include’ directives. + + +File: bison.info, Node: Prologue Alternatives, Next: Bison Declarations, Prev: Prologue, Up: Grammar Outline + +3.1.2 Prologue Alternatives +--------------------------- + +The functionality of PROLOGUE sections can often be subtle and +inflexible. As an alternative, Bison provides a ‘%code’ directive with +an explicit qualifier field, which identifies the purpose of the code +and thus the location(s) where Bison should generate it. For C/C++, the +qualifier can be omitted for the default location, or it can be one of +‘requires’, ‘provides’, ‘top’. *Note %code Summary::. + + Look again at the example of the previous section: + + %{ + #define _GNU_SOURCE + #include + #include "ptypes.h" + %} + + %union { + long n; + tree t; /* ‘tree’ is defined in ‘ptypes.h’. */ + } + + %{ + static void print_token (yytoken_kind_t token, YYSTYPE val); + %} + + ... + +Notice that there are two PROLOGUE sections here, but there’s a subtle +distinction between their functionality. For example, if you decide to +override Bison’s default definition for ‘YYLTYPE’, in which PROLOGUE +section should you write your new definition?(1) You should write it in +the first since Bison will insert that code into the parser +implementation file _before_ the default ‘YYLTYPE’ definition. In which +PROLOGUE section should you prototype an internal function, +‘trace_token’, that accepts ‘YYLTYPE’ and ‘yytoken_kind_t’ as arguments? +You should prototype it in the second since Bison will insert that code +_after_ the ‘YYLTYPE’ and ‘yytoken_kind_t’ definitions. + + This distinction in functionality between the two PROLOGUE sections +is established by the appearance of the ‘%union’ between them. This +behavior raises a few questions. First, why should the position of a +‘%union’ affect definitions related to ‘YYLTYPE’ and ‘yytoken_kind_t’? +Second, what if there is no ‘%union’? In that case, the second kind of +PROLOGUE section is not available. This behavior is not intuitive. + + To avoid this subtle ‘%union’ dependency, rewrite the example using a +‘%code top’ and an unqualified ‘%code’. Let’s go ahead and add the new +‘YYLTYPE’ definition and the ‘trace_token’ prototype at the same time: + + %code top { + #define _GNU_SOURCE + #include + + /* WARNING: The following code really belongs + * in a '%code requires'; see below. */ + + #include "ptypes.h" + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %union { + long n; + tree t; /* ‘tree’ is defined in ‘ptypes.h’. */ + } + + %code { + static void print_token (yytoken_kind_t token, YYSTYPE val); + static void trace_token (yytoken_kind_t token, YYLTYPE loc); + } + + ... + +In this way, ‘%code top’ and the unqualified ‘%code’ achieve the same +functionality as the two kinds of PROLOGUE sections, but it’s always +explicit which kind you intend. Moreover, both kinds are always +available even in the absence of ‘%union’. + + The ‘%code top’ block above logically contains two parts. The first +two lines before the warning need to appear near the top of the parser +implementation file. The first line after the warning is required by +‘YYSTYPE’ and thus also needs to appear in the parser implementation +file. However, if you’ve instructed Bison to generate a parser header +file (*note Decl Summary::), you probably want that line to appear +before the ‘YYSTYPE’ definition in that header file as well. The +‘YYLTYPE’ definition should also appear in the parser header file to +override the default ‘YYLTYPE’ definition there. + + In other words, in the ‘%code top’ block above, all but the first two +lines are dependency code required by the ‘YYSTYPE’ and ‘YYLTYPE’ +definitions. Thus, they belong in one or more ‘%code requires’: + + %code top { + #define _GNU_SOURCE + #include + } + + %code requires { + #include "ptypes.h" + } + %union { + long n; + tree t; /* ‘tree’ is defined in ‘ptypes.h’. */ + } + + %code requires { + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %code { + static void print_token (yytoken_kind_t token, YYSTYPE val); + static void trace_token (yytoken_kind_t token, YYLTYPE loc); + } + + ... + +Now Bison will insert ‘#include "ptypes.h"’ and the new ‘YYLTYPE’ +definition before the Bison-generated ‘YYSTYPE’ and ‘YYLTYPE’ +definitions in both the parser implementation file and the parser header +file. (By the same reasoning, ‘%code requires’ would also be the +appropriate place to write your own definition for ‘YYSTYPE’.) + + When you are writing dependency code for ‘YYSTYPE’ and ‘YYLTYPE’, you +should prefer ‘%code requires’ over ‘%code top’ regardless of whether +you instruct Bison to generate a parser header file. When you are +writing code that you need Bison to insert only into the parser +implementation file and that has no special need to appear at the top of +that file, you should prefer the unqualified ‘%code’ over ‘%code top’. +These practices will make the purpose of each block of your code +explicit to Bison and to other developers reading your grammar file. +Following these practices, we expect the unqualified ‘%code’ and ‘%code +requires’ to be the most important of the four PROLOGUE alternatives. + + At some point while developing your parser, you might decide to +provide ‘trace_token’ to modules that are external to your parser. +Thus, you might wish for Bison to insert the prototype into both the +parser header file and the parser implementation file. Since this +function is not a dependency required by ‘YYSTYPE’ or ‘YYLTYPE’, it +doesn’t make sense to move its prototype to a ‘%code requires’. More +importantly, since it depends upon ‘YYLTYPE’ and ‘yytoken_kind_t’, +‘%code requires’ is not sufficient. Instead, move its prototype from +the unqualified ‘%code’ to a ‘%code provides’: + + %code top { + #define _GNU_SOURCE + #include + } + + %code requires { + #include "ptypes.h" + } + %union { + long n; + tree t; /* ‘tree’ is defined in ‘ptypes.h’. */ + } + + %code requires { + #define YYLTYPE YYLTYPE + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; + } YYLTYPE; + } + + %code provides { + void trace_token (yytoken_kind_t token, YYLTYPE loc); + } + + %code { + static void print_token (FILE *file, int token, YYSTYPE val); + } + + ... + +Bison will insert the ‘trace_token’ prototype into both the parser +header file and the parser implementation file after the definitions for +‘yytoken_kind_t’, ‘YYLTYPE’, and ‘YYSTYPE’. + + The above examples are careful to write directives in an order that +reflects the layout of the generated parser implementation and header +files: ‘%code top’, ‘%code requires’, ‘%code provides’, and then +‘%code’. While your grammar files may generally be easier to read if +you also follow this order, Bison does not require it. Instead, Bison +lets you choose an organization that makes sense to you. + + You may declare any of these directives multiple times in the grammar +file. In that case, Bison concatenates the contained code in +declaration order. This is the only way in which the position of one of +these directives within the grammar file affects its functionality. + + The result of the previous two properties is greater flexibility in +how you may organize your grammar file. For example, you may organize +semantic-type-related directives by semantic type: + + %code requires { #include "type1.h" } + %union { type1 field1; } + %destructor { type1_free ($$); } + %printer { type1_print (yyo, $$); } + + %code requires { #include "type2.h" } + %union { type2 field2; } + %destructor { type2_free ($$); } + %printer { type2_print (yyo, $$); } + +You could even place each of the above directive groups in the rules +section of the grammar file next to the set of rules that uses the +associated semantic type. (In the rules section, you must terminate +each of those directives with a semicolon.) And you don’t have to worry +that some directive (like a ‘%union’) in the definitions section is +going to adversely affect their functionality in some counter-intuitive +manner just because it comes first. Such an organization is not +possible using PROLOGUE sections. + + This section has been concerned with explaining the advantages of the +four PROLOGUE alternatives over the original Yacc PROLOGUE. However, in +most cases when using these directives, you shouldn’t need to think +about all the low-level ordering issues discussed here. Instead, you +should simply use these directives to label each block of your code +according to its purpose and let Bison handle the ordering. ‘%code’ is +the most generic label. Move code to ‘%code requires’, ‘%code +provides’, or ‘%code top’ as needed. + + ---------- Footnotes ---------- + + (1) However, defining ‘YYLTYPE’ via a C macro is not the recommended +way. *Note Location Type:: + + +File: bison.info, Node: Bison Declarations, Next: Grammar Rules, Prev: Prologue Alternatives, Up: Grammar Outline + +3.1.3 The Bison Declarations Section +------------------------------------ + +The BISON DECLARATIONS section contains declarations that define +terminal and nonterminal symbols, specify precedence, and so on. In +some simple grammars you may not need any declarations. *Note +Declarations::. + + +File: bison.info, Node: Grammar Rules, Next: Epilogue, Prev: Bison Declarations, Up: Grammar Outline + +3.1.4 The Grammar Rules Section +------------------------------- + +The “grammar rules” section contains one or more Bison grammar rules, +and nothing else. *Note Rules::. + + There must always be at least one grammar rule, and the first ‘%%’ +(which precedes the grammar rules) may never be omitted even if it is +the first thing in the file. + + +File: bison.info, Node: Epilogue, Prev: Grammar Rules, Up: Grammar Outline + +3.1.5 The epilogue +------------------ + +The EPILOGUE is copied verbatim to the end of the parser implementation +file, just as the PROLOGUE is copied to the beginning. This is the most +convenient place to put anything that you want to have in the parser +implementation file but which need not come before the definition of +‘yyparse’. For example, the definitions of ‘yylex’ and ‘yyerror’ often +go here. Because C requires functions to be declared before being used, +you often need to declare functions like ‘yylex’ and ‘yyerror’ in the +Prologue, even if you define them in the Epilogue. *Note Interface::. + + If the last section is empty, you may omit the ‘%%’ that separates it +from the grammar rules. + + The Bison parser itself contains many macros and identifiers whose +names start with ‘yy’ or ‘YY’, so it is a good idea to avoid using any +such names (except those documented in this manual) in the epilogue of +the grammar file. + + +File: bison.info, Node: Symbols, Next: Rules, Prev: Grammar Outline, Up: Grammar File + +3.2 Symbols, Terminal and Nonterminal +===================================== + +“Symbols” in Bison grammars represent the grammatical classifications of +the language. + + A “terminal symbol” (also known as a “token kind”) represents a class +of syntactically equivalent tokens. You use the symbol in grammar rules +to mean that a token in that class is allowed. The symbol is +represented in the Bison parser by a numeric code, and the ‘yylex’ +function returns a token kind code to indicate what kind of token has +been read. You don’t need to know what the code value is; you can use +the symbol to stand for it. + + A “nonterminal symbol” stands for a class of syntactically equivalent +groupings. The symbol name is used in writing grammar rules. By +convention, it should be all lower case. + + Symbol names can contain letters, underscores, periods, and +non-initial digits and dashes. Dashes in symbol names are a GNU +extension, incompatible with POSIX Yacc. Periods and dashes make symbol +names less convenient to use with named references, which require +brackets around such names (*note Named References::). Terminal symbols +that contain periods or dashes make little sense: since they are not +valid symbols (in most programming languages) they are not exported as +token names. + + There are three ways of writing terminal symbols in the grammar: + + • A “named token kind” is written with an identifier, like an + identifier in C. By convention, it should be all upper case. Each + such name must be defined with a Bison declaration such as + ‘%token’. *Note Token Decl::. + + • A “character token kind” (or “literal character token”) is written + in the grammar using the same syntax used in C for character + constants; for example, ‘'+'’ is a character token kind. A + character token kind doesn’t need to be declared unless you need to + specify its semantic value data type (*note Value Type::), + associativity, or precedence (*note Precedence::). + + By convention, a character token kind is used only to represent a + token that consists of that particular character. Thus, the token + kind ‘'+'’ is used to represent the character ‘+’ as a token. + Nothing enforces this convention, but if you depart from it, your + program will confuse other readers. + + All the usual escape sequences used in character literals in C can + be used in Bison as well, but you must not use the null character + as a character literal because its numeric code, zero, signifies + end-of-input (*note Calling Convention::). Also, unlike standard + C, trigraphs have no special meaning in Bison character literals, + nor is backslash-newline allowed. + + • A “literal string token” is written like a C string constant; for + example, ‘"<="’ is a literal string token. A literal string token + doesn’t need to be declared unless you need to specify its semantic + value data type (*note Value Type::), associativity, or precedence + (*note Precedence::). + + You can associate the literal string token with a symbolic name as + an alias, using the ‘%token’ declaration (*note Token Decl::). If + you don’t do that, the lexical analyzer has to retrieve the token + code for the literal string token from the ‘yytname’ table (*note + Calling Convention::). + + *Warning*: literal string tokens do not work in Yacc. + + By convention, a literal string token is used only to represent a + token that consists of that particular string. Thus, you should + use the token kind ‘"<="’ to represent the string ‘<=’ as a token. + Bison does not enforce this convention, but if you depart from it, + people who read your program will be confused. + + All the escape sequences used in string literals in C can be used + in Bison as well, except that you must not use a null character + within a string literal. Also, unlike Standard C, trigraphs have + no special meaning in Bison string literals, nor is + backslash-newline allowed. A literal string token must contain two + or more characters; for a token containing just one character, use + a character token (see above). + + How you choose to write a terminal symbol has no effect on its +grammatical meaning. That depends only on where it appears in rules and +on when the parser function returns that symbol. + + The value returned by ‘yylex’ is always one of the terminal symbols, +except that a zero or negative value signifies end-of-input. Whichever +way you write the token kind in the grammar rules, you write it the same +way in the definition of ‘yylex’. The numeric code for a character +token kind is simply the positive numeric code of the character, so +‘yylex’ can use the identical value to generate the requisite code, +though you may need to convert it to ‘unsigned char’ to avoid +sign-extension on hosts where ‘char’ is signed. Each named token kind +becomes a C macro in the parser implementation file, so ‘yylex’ can use +the name to stand for the code. (This is why periods don’t make sense +in terminal symbols.) *Note Calling Convention::. + + If ‘yylex’ is defined in a separate file, you need to arrange for the +token-kind definitions to be available there. Use the ‘-d’ option when +you run Bison, so that it will write these definitions into a separate +header file ‘NAME.tab.h’ which you can include in the other source files +that need it. *Note Invocation::. + + If you want to write a grammar that is portable to any Standard C +host, you must use only nonnull character tokens taken from the basic +execution character set of Standard C. This set consists of the ten +digits, the 52 lower- and upper-case English letters, and the characters +in the following C-language string: + + "\a\b\t\n\v\f\r !\"#%&'()*+,-./:;<=>?[\\]^_{|}~" + + The ‘yylex’ function and Bison must use a consistent character set +and encoding for character tokens. For example, if you run Bison in an +ASCII environment, but then compile and run the resulting program in an +environment that uses an incompatible character set like EBCDIC, the +resulting program may not work because the tables generated by Bison +will assume ASCII numeric values for character tokens. It is standard +practice for software distributions to contain C source files that were +generated by Bison in an ASCII environment, so installers on platforms +that are incompatible with ASCII must rebuild those files before +compiling them. + + The symbol ‘error’ is a terminal symbol reserved for error recovery +(*note Error Recovery::); you shouldn’t use it for any other purpose. +In particular, ‘yylex’ should never return this value. The default +value of the error token is 256, unless you explicitly assigned 256 to +one of your tokens with a ‘%token’ declaration. + + +File: bison.info, Node: Rules, Next: Semantics, Prev: Symbols, Up: Grammar File + +3.3 Grammar Rules +================= + +A Bison grammar is a list of rules. + +* Menu: + +* Rules Syntax:: Syntax of the rules. +* Empty Rules:: Symbols that can match the empty string. +* Recursion:: Writing recursive rules. + + +File: bison.info, Node: Rules Syntax, Next: Empty Rules, Up: Rules + +3.3.1 Syntax of Grammar Rules +----------------------------- + +A Bison grammar rule has the following general form: + + RESULT: COMPONENTS...; + +where RESULT is the nonterminal symbol that this rule describes, and +COMPONENTS are various terminal and nonterminal symbols that are put +together by this rule (*note Symbols::). + + For example, + + exp: exp '+' exp; + +says that two groupings of type ‘exp’, with a ‘+’ token in between, can +be combined into a larger grouping of type ‘exp’. + + White space in rules is significant only to separate symbols. You +can add extra white space as you wish. + + Scattered among the components can be ACTIONS that determine the +semantics of the rule. An action looks like this: + + {C STATEMENTS} + +This is an example of “braced code”, that is, C code surrounded by +braces, much like a compound statement in C. Braced code can contain +any sequence of C tokens, so long as its braces are balanced. Bison +does not check the braced code for correctness directly; it merely +copies the code to the parser implementation file, where the C compiler +can check it. + + Within braced code, the balanced-brace count is not affected by +braces within comments, string literals, or character constants, but it +is affected by the C digraphs ‘<%’ and ‘%>’ that represent braces. At +the top level braced code must be terminated by ‘}’ and not by a +digraph. Bison does not look for trigraphs, so if braced code uses +trigraphs you should ensure that they do not affect the nesting of +braces or the boundaries of comments, string literals, or character +constants. + + Usually there is only one action and it follows the components. +*Note Actions::. + + Multiple rules for the same RESULT can be written separately or can +be joined with the vertical-bar character ‘|’ as follows: + + RESULT: + RULE1-COMPONENTS... + | RULE2-COMPONENTS... + ... + ; + +They are still considered distinct rules even when joined in this way. + + +File: bison.info, Node: Empty Rules, Next: Recursion, Prev: Rules Syntax, Up: Rules + +3.3.2 Empty Rules +----------------- + +A rule is said to be “empty” if its right-hand side (COMPONENTS) is +empty. It means that RESULT in the previous example can match the empty +string. As another example, here is how to define an optional +semicolon: + + semicolon.opt: | ";"; + +It is easy not to see an empty rule, especially when ‘|’ is used. The +‘%empty’ directive allows to make explicit that a rule is empty on +purpose: + + semicolon.opt: + %empty + | ";" + ; + + Flagging a non-empty rule with ‘%empty’ is an error. If run with +‘-Wempty-rule’, ‘bison’ will report empty rules without ‘%empty’. Using +‘%empty’ enables this warning, unless ‘-Wno-empty-rule’ was specified. + + The ‘%empty’ directive is a Bison extension, it does not work with +Yacc. To remain compatible with POSIX Yacc, it is customary to write a +comment ‘/* empty */’ in each rule with no components: + + semicolon.opt: + /* empty */ + | ";" + ; + + +File: bison.info, Node: Recursion, Prev: Empty Rules, Up: Rules + +3.3.3 Recursive Rules +--------------------- + +A rule is called “recursive” when its RESULT nonterminal appears also on +its right hand side. Nearly all Bison grammars need to use recursion, +because that is the only way to define a sequence of any number of a +particular thing. Consider this recursive definition of a +comma-separated sequence of one or more expressions: + + expseq1: + exp + | expseq1 ',' exp + ; + +Since the recursive use of ‘expseq1’ is the leftmost symbol in the right +hand side, we call this “left recursion”. By contrast, here the same +construct is defined using “right recursion”: + + expseq1: + exp + | exp ',' expseq1 + ; + +Any kind of sequence can be defined using either left recursion or right +recursion, but you should always use left recursion, because it can +parse a sequence of any number of elements with bounded stack space. +Right recursion uses up space on the Bison stack in proportion to the +number of elements in the sequence, because all the elements must be +shifted onto the stack before the rule can be applied even once. *Note +Algorithm::, for further explanation of this. + + “Indirect” or “mutual” recursion occurs when the result of the rule +does not appear directly on its right hand side, but does appear in +rules for other nonterminals which do appear on its right hand side. + + For example: + + expr: + primary + | primary '+' primary + ; + + primary: + constant + | '(' expr ')' + ; + +defines two mutually-recursive nonterminals, since each refers to the +other. + + +File: bison.info, Node: Semantics, Next: Tracking Locations, Prev: Rules, Up: Grammar File + +3.4 Defining Language Semantics +=============================== + +The grammar rules for a language determine only the syntax. The +semantics are determined by the semantic values associated with various +tokens and groupings, and by the actions taken when various groupings +are recognized. + + For example, the calculator calculates properly because the value +associated with each expression is the proper number; it adds properly +because the action for the grouping ‘X + Y’ is to add the numbers +associated with X and Y. + +* Menu: + +* Value Type:: Specifying one data type for all semantic values. +* Multiple Types:: Specifying several alternative data types. +* Type Generation:: Generating the semantic value type. +* Union Decl:: Declaring the set of all semantic value types. +* Structured Value Type:: Providing a structured semantic value type. +* Actions:: An action is the semantic definition of a grammar rule. +* Action Types:: Specifying data types for actions to operate on. +* Midrule Actions:: Most actions go at the end of a rule. + This says when, why and how to use the exceptional + action in the middle of a rule. + + +File: bison.info, Node: Value Type, Next: Multiple Types, Up: Semantics + +3.4.1 Data Types of Semantic Values +----------------------------------- + +In a simple program it may be sufficient to use the same data type for +the semantic values of all language constructs. This was true in the +RPN and infix calculator examples (*note RPN Calc::). + + Bison normally uses the type ‘int’ for semantic values if your +program uses the same data type for all language constructs. To specify +some other type, define the ‘%define’ variable ‘api.value.type’ like +this: + + %define api.value.type {double} + +or + + %define api.value.type {struct semantic_value_type} + + The value of ‘api.value.type’ should be a type name that does not +contain parentheses or square brackets. + + Alternatively in C, instead of relying of Bison’s ‘%define’ support, +you may rely on the C preprocessor and define ‘YYSTYPE’ as a macro: + + #define YYSTYPE double + +This macro definition must go in the prologue of the grammar file (*note +Grammar Outline::). If compatibility with POSIX Yacc matters to you, +use this. Note however that Bison cannot know ‘YYSTYPE’’s value, not +even whether it is defined, so there are services it cannot provide. +Besides this works only for C. + + +File: bison.info, Node: Multiple Types, Next: Type Generation, Prev: Value Type, Up: Semantics + +3.4.2 More Than One Value Type +------------------------------ + +In most programs, you will need different data types for different kinds +of tokens and groupings. For example, a numeric constant may need type +‘int’ or ‘long’, while a string constant needs type ‘char *’, and an +identifier might need a pointer to an entry in the symbol table. + + To use more than one data type for semantic values in one parser, +Bison requires you to do two things: + + • Specify the entire collection of possible data types. There are + several options: + • let Bison compute the union type from the tags you assign to + symbols; + + • use the ‘%union’ Bison declaration (*note Union Decl::); + + • define the ‘%define’ variable ‘api.value.type’ to be a union + type whose members are the type tags (*note Structured Value + Type::); + + • use a ‘typedef’ or a ‘#define’ to define ‘YYSTYPE’ to be a + union type whose member names are the type tags. + + • Choose one of those types for each symbol (terminal or nonterminal) + for which semantic values are used. This is done for tokens with + the ‘%token’ Bison declaration (*note Token Decl::) and for + groupings with the ‘%nterm’/‘%type’ Bison declarations (*note Type + Decl::). + + +File: bison.info, Node: Type Generation, Next: Union Decl, Prev: Multiple Types, Up: Semantics + +3.4.3 Generating the Semantic Value Type +---------------------------------------- + +The special value ‘union’ of the ‘%define’ variable ‘api.value.type’ +instructs Bison that the type tags (used with the ‘%token’, ‘%nterm’ and +‘%type’ directives) are genuine types, not names of members of +‘YYSTYPE’. + + For example: + + %define api.value.type union + %token INT "integer" + %token 'n' + %nterm expr + %token ID "identifier" + +generates an appropriate value of ‘YYSTYPE’ to support each symbol type. +The name of the member of ‘YYSTYPE’ for tokens than have a declared +identifier ID (such as ‘INT’ and ‘ID’ above, but not ‘'n'’) is ‘ID’. +The other symbols have unspecified names on which you should not depend; +instead, relying on C casts to access the semantic value with the +appropriate type: + + /* For an "integer". */ + yylval.INT = 42; + return INT; + + /* For an 'n', also declared as int. */ + *((int*)&yylval) = 42; + return 'n'; + + /* For an "identifier". */ + yylval.ID = "42"; + return ID; + + If the ‘%define’ variable ‘api.token.prefix’ is defined (*note +%define Summary::), then it is also used to prefix the union member +names. For instance, with ‘%define api.token.prefix {TOK_}’: + + /* For an "integer". */ + yylval.TOK_INT = 42; + return TOK_INT; + + This Bison extension cannot work if ‘%yacc’ (or ‘-y’/‘--yacc’) is +enabled, as POSIX mandates that Yacc generate tokens as macros (e.g., +‘#define INT 258’, or ‘#define TOK_INT 258’). + + A similar feature is provided for C++ that in addition overcomes C++ +limitations (that forbid non-trivial objects to be part of a ‘union’): +‘%define api.value.type variant’, see *note C++ Variants::. + + +File: bison.info, Node: Union Decl, Next: Structured Value Type, Prev: Type Generation, Up: Semantics + +3.4.4 The Union Declaration +--------------------------- + +The ‘%union’ declaration specifies the entire collection of possible +data types for semantic values. The keyword ‘%union’ is followed by +braced code containing the same thing that goes inside a ‘union’ in C. + + For example: + + %union { + double val; + symrec *tptr; + } + +This says that the two alternative types are ‘double’ and ‘symrec *’. +They are given names ‘val’ and ‘tptr’; these names are used in the +‘%token’, ‘%nterm’ and ‘%type’ declarations to pick one of the types for +a terminal or nonterminal symbol (*note Type Decl::). + + As an extension to POSIX, a tag is allowed after the ‘%union’. For +example: + + %union value { + double val; + symrec *tptr; + } + +specifies the union tag ‘value’, so the corresponding C type is ‘union +value’. If you do not specify a tag, it defaults to ‘YYSTYPE’ (*note +%define Summary::). + + As another extension to POSIX, you may specify multiple ‘%union’ +declarations; their contents are concatenated. However, only the first +‘%union’ declaration can specify a tag. + + Note that, unlike making a ‘union’ declaration in C, you need not +write a semicolon after the closing brace. + + +File: bison.info, Node: Structured Value Type, Next: Actions, Prev: Union Decl, Up: Semantics + +3.4.5 Providing a Structured Semantic Value Type +------------------------------------------------ + +Instead of ‘%union’, you can define and use your own union type +‘YYSTYPE’ if your grammar contains at least one ‘’ tag. For +example, you can put the following into a header file ‘parser.h’: + + union YYSTYPE { + double val; + symrec *tptr; + }; + +and then your grammar can use the following instead of ‘%union’: + + %{ + #include "parser.h" + %} + %define api.value.type {union YYSTYPE} + %nterm expr + %token ID + + Actually, you may also provide a ‘struct’ rather that a ‘union’, +which may be handy if you want to track information for every symbol +(such as preceding comments). + + The type you provide may even be structured and include pointers, in +which case the type tags you provide may be composite, with ‘.’ and ‘->’ +operators. + + +File: bison.info, Node: Actions, Next: Action Types, Prev: Structured Value Type, Up: Semantics + +3.4.6 Actions +------------- + +An action accompanies a syntactic rule and contains C code to be +executed each time an instance of that rule is recognized. The task of +most actions is to compute a semantic value for the grouping built by +the rule from the semantic values associated with tokens or smaller +groupings. + + An action consists of braced code containing C statements, and can be +placed at any position in the rule; it is executed at that position. +Most rules have just one action at the end of the rule, following all +the components. Actions in the middle of a rule are tricky and used +only for special purposes (*note Midrule Actions::). + + The C code in an action can refer to the semantic values of the +components matched by the rule with the construct ‘$N’, which stands for +the value of the Nth component. The semantic value for the grouping +being constructed is ‘$$’. In addition, the semantic values of symbols +can be accessed with the named references construct ‘$NAME’ or +‘$[NAME]’. Bison translates both of these constructs into expressions +of the appropriate type when it copies the actions into the parser +implementation file. ‘$$’ (or ‘$NAME’, when it stands for the current +grouping) is translated to a modifiable lvalue, so it can be assigned +to. + + Here is a typical example: + + exp: + ... + | exp '+' exp { $$ = $1 + $3; } + + Or, in terms of named references: + + exp[result]: + ... + | exp[left] '+' exp[right] { $result = $left + $right; } + +This rule constructs an ‘exp’ from two smaller ‘exp’ groupings connected +by a plus-sign token. In the action, ‘$1’ and ‘$3’ (‘$left’ and +‘$right’) refer to the semantic values of the two component ‘exp’ +groupings, which are the first and third symbols on the right hand side +of the rule. The sum is stored into ‘$$’ (‘$result’) so that it becomes +the semantic value of the addition-expression just recognized by the +rule. If there were a useful semantic value associated with the ‘+’ +token, it could be referred to as ‘$2’. + + *Note Named References::, for more information about using the named +references construct. + + Note that the vertical-bar character ‘|’ is really a rule separator, +and actions are attached to a single rule. This is a difference with +tools like Flex, for which ‘|’ stands for either “or”, or “the same +action as that of the next rule”. In the following example, the action +is triggered only when ‘b’ is found: + + a-or-b: 'a'|'b' { a_or_b_found = 1; }; + + If you don’t specify an action for a rule, Bison supplies a default: +‘$$ = $1’. Thus, the value of the first symbol in the rule becomes the +value of the whole rule. Of course, the default action is valid only if +the two data types match. There is no meaningful default action for an +empty rule; every empty rule must have an explicit action unless the +rule’s value does not matter. + + ‘$N’ with N zero or negative is allowed for reference to tokens and +groupings on the stack _before_ those that match the current rule. This +is a very risky practice, and to use it reliably you must be certain of +the context in which the rule is applied. Here is a case in which you +can use this reliably: + + foo: + expr bar '+' expr { ... } + | expr bar '-' expr { ... } + ; + + bar: + %empty { previous_expr = $0; } + ; + + As long as ‘bar’ is used only in the fashion shown here, ‘$0’ always +refers to the ‘expr’ which precedes ‘bar’ in the definition of ‘foo’. + + It is also possible to access the semantic value of the lookahead +token, if any, from a semantic action. This semantic value is stored in +‘yylval’. *Note Action Features::. + + +File: bison.info, Node: Action Types, Next: Midrule Actions, Prev: Actions, Up: Semantics + +3.4.7 Data Types of Values in Actions +------------------------------------- + +If you have chosen a single data type for semantic values, the ‘$$’ and +‘$N’ constructs always have that data type. + + If you have used ‘%union’ to specify a variety of data types, then +you must declare a choice among these types for each terminal or +nonterminal symbol that can have a semantic value. Then each time you +use ‘$$’ or ‘$N’, its data type is determined by which symbol it refers +to in the rule. In this example, + + exp: + ... + | exp '+' exp { $$ = $1 + $3; } + +‘$1’ and ‘$3’ refer to instances of ‘exp’, so they all have the data +type declared for the nonterminal symbol ‘exp’. If ‘$2’ were used, it +would have the data type declared for the terminal symbol ‘'+'’, +whatever that might be. + + Alternatively, you can specify the data type when you refer to the +value, by inserting ‘’ after the ‘$’ at the beginning of the +reference. For example, if you have defined types as shown here: + + %union { + int itype; + double dtype; + } + +then you can write ‘$1’ to refer to the first subunit of the rule +as an integer, or ‘$1’ to refer to it as a double. + + +File: bison.info, Node: Midrule Actions, Prev: Action Types, Up: Semantics + +3.4.8 Actions in Midrule +------------------------ + +Occasionally it is useful to put an action in the middle of a rule. +These actions are written just like usual end-of-rule actions, but they +are executed before the parser even recognizes the following components. + +* Menu: + +* Using Midrule Actions:: Putting an action in the middle of a rule. +* Typed Midrule Actions:: Specifying the semantic type of their values. +* Midrule Action Translation:: How midrule actions are actually processed. +* Midrule Conflicts:: Midrule actions can cause conflicts. + + +File: bison.info, Node: Using Midrule Actions, Next: Typed Midrule Actions, Up: Midrule Actions + +3.4.8.1 Using Midrule Actions +............................. + +A midrule action may refer to the components preceding it using ‘$N’, +but it may not refer to subsequent components because it is run before +they are parsed. + + The midrule action itself counts as one of the components of the +rule. This makes a difference when there is another action later in the +same rule (and usually there is another at the end): you have to count +the actions along with the symbols when working out which number N to +use in ‘$N’. + + The midrule action can also have a semantic value. The action can +set its value with an assignment to ‘$$’, and actions later in the rule +can refer to the value using ‘$N’. Since there is no symbol to name the +action, there is no way to declare a data type for the value in advance, +so you must use the ‘$<...>N’ construct to specify a data type each time +you refer to this value. + + There is no way to set the value of the entire rule with a midrule +action, because assignments to ‘$$’ do not have that effect. The only +way to set the value for the entire rule is with an ordinary action at +the end of the rule. + + Here is an example from a hypothetical compiler, handling a ‘let’ +statement that looks like ‘let (VARIABLE) STATEMENT’ and serves to +create a variable named VARIABLE temporarily for the duration of +STATEMENT. To parse this construct, we must put VARIABLE into the +symbol table while STATEMENT is parsed, then remove it afterward. Here +is how it is done: + + stmt: + "let" '(' var ')' + { + $$ = push_context (); + declare_variable ($3); + } + stmt + { + $$ = $6; + pop_context ($5); + } + +As soon as ‘let (VARIABLE)’ has been recognized, the first action is +run. It saves a copy of the current semantic context (the list of +accessible variables) as its semantic value, using alternative ‘context’ +in the data-type union. Then it calls ‘declare_variable’ to add the new +variable to that list. Once the first action is finished, the embedded +statement ‘stmt’ can be parsed. + + Note that the midrule action is component number 5, so the ‘stmt’ is +component number 6. Named references can be used to improve the +readability and maintainability (*note Named References::): + + stmt: + "let" '(' var ')' + { + $let = push_context (); + declare_variable ($3); + }[let] + stmt + { + $$ = $6; + pop_context ($let); + } + + After the embedded statement is parsed, its semantic value becomes +the value of the entire ‘let’-statement. Then the semantic value from +the earlier action is used to restore the prior list of variables. This +removes the temporary ‘let’-variable from the list so that it won’t +appear to exist while the rest of the program is parsed. + + Because the types of the semantic values of midrule actions are +unknown to Bison, type-based features (e.g., ‘%printer’, ‘%destructor’) +do not work, which could result in memory leaks. They also forbid the +use of the ‘variant’ implementation of the ‘api.value.type’ in C++ +(*note C++ Variants::). + + *Note Typed Midrule Actions::, for one way to address this issue, and +*note Midrule Action Translation::, for another: turning mid-action +actions into regular actions. + + +File: bison.info, Node: Typed Midrule Actions, Next: Midrule Action Translation, Prev: Using Midrule Actions, Up: Midrule Actions + +3.4.8.2 Typed Midrule Actions +............................. + +In the above example, if the parser initiates error recovery (*note +Error Recovery::) while parsing the tokens in the embedded statement +‘stmt’, it might discard the previous semantic context ‘$5’ +without restoring it. Thus, ‘$5’ needs a destructor (*note +Destructor Decl::), and Bison needs the type of the semantic value +(‘context’) to select the right destructor. + + As an extension to Yacc’s midrule actions, Bison offers a means to +type their semantic value: specify its type tag (‘<...>’ before the +midrule action. + + Consider the previous example, with an untyped midrule action: + + stmt: + "let" '(' var ')' + { + $$ = push_context (); // *** + declare_variable ($3); + } + stmt + { + $$ = $6; + pop_context ($5); // *** + } + +If instead you write: + + stmt: + "let" '(' var ')' + { // *** + $$ = push_context (); // *** + declare_variable ($3); + } + stmt + { + $$ = $6; + pop_context ($5); // *** + } + +then ‘%printer’ and ‘%destructor’ work properly (no more leaks!), C++ +‘variant’s can be used, and redundancy is reduced (‘’ is +specified once). + + +File: bison.info, Node: Midrule Action Translation, Next: Midrule Conflicts, Prev: Typed Midrule Actions, Up: Midrule Actions + +3.4.8.3 Midrule Action Translation +.................................. + +Midrule actions are actually transformed into regular rules and actions. +The various reports generated by Bison (textual, graphical, etc., see +*note Understanding::) reveal this translation, best explained by means +of an example. The following rule: + + exp: { a(); } "b" { c(); } { d(); } "e" { f(); }; + +is translated into: + + $@1: %empty { a(); }; + $@2: %empty { c(); }; + $@3: %empty { d(); }; + exp: $@1 "b" $@2 $@3 "e" { f(); }; + +with new nonterminal symbols ‘$@N’, where N is a number. + + A midrule action is expected to generate a value if it uses ‘$$’, or +the (final) action uses ‘$N’ where N denote the midrule action. In that +case its nonterminal is rather named ‘@N’: + + exp: { a(); } "b" { $$ = c(); } { d(); } "e" { f = $1; }; + +is translated into + + @1: %empty { a(); }; + @2: %empty { $$ = c(); }; + $@3: %empty { d(); }; + exp: @1 "b" @2 $@3 "e" { f = $1; } + + There are probably two errors in the above example: the first midrule +action does not generate a value (it does not use ‘$$’ although the +final action uses it), and the value of the second one is not used (the +final action does not use ‘$3’). Bison reports these errors when the +‘midrule-value’ warnings are enabled (*note Invocation::): + + $ bison -Wmidrule-value mid.y + mid.y:2.6-13: warning: unset value: $$ + 2 | exp: { a(); } "b" { $$ = c(); } { d(); } "e" { f = $1; }; + | ^~~~~~~~ + mid.y:2.19-31: warning: unused value: $3 + 2 | exp: { a(); } "b" { $$ = c(); } { d(); } "e" { f = $1; }; + | ^~~~~~~~~~~~~ + + + It is sometimes useful to turn midrule actions into regular actions, +e.g., to factor them, or to escape from their limitations. For +instance, as an alternative to _typed_ midrule action, you may bury the +midrule action inside a nonterminal symbol and to declare a printer and +a destructor for that symbol: + + %nterm let + %destructor { pop_context ($$); } let + %printer { print_context (yyo, $$); } let + + %% + + stmt: + let stmt + { + $$ = $2; + pop_context ($let); + }; + + let: + "let" '(' var ')' + { + $let = push_context (); + declare_variable ($var); + }; + + + +File: bison.info, Node: Midrule Conflicts, Prev: Midrule Action Translation, Up: Midrule Actions + +3.4.8.4 Conflicts due to Midrule Actions +........................................ + +Taking action before a rule is completely recognized often leads to +conflicts since the parser must commit to a parse in order to execute +the action. For example, the following two rules, without midrule +actions, can coexist in a working parser because the parser can shift +the open-brace token and look at what follows before deciding whether +there is a declaration or not: + + compound: + '{' declarations statements '}' + | '{' statements '}' + ; + +But when we add a midrule action as follows, the rules become +nonfunctional: + + compound: + { prepare_for_local_variables (); } + '{' declarations statements '}' + | '{' statements '}' + ; + +Now the parser is forced to decide whether to run the midrule action +when it has read no farther than the open-brace. In other words, it +must commit to using one rule or the other, without sufficient +information to do it correctly. (The open-brace token is what is called +the “lookahead” token at this time, since the parser is still deciding +what to do about it. *Note Lookahead::.) + + You might think that you could correct the problem by putting +identical actions into the two rules, like this: + + compound: + { prepare_for_local_variables (); } + '{' declarations statements '}' + | { prepare_for_local_variables (); } + '{' statements '}' + ; + +But this does not help, because Bison does not realize that the two +actions are identical. (Bison never tries to understand the C code in +an action.) + + If the grammar is such that a declaration can be distinguished from a +statement by the first token (which is true in C), then one solution +which does work is to put the action after the open-brace, like this: + + compound: + '{' { prepare_for_local_variables (); } + declarations statements '}' + | '{' statements '}' + ; + +Now the first token of the following declaration or statement, which +would in any case tell Bison which rule to use, can still do so. + + Another solution is to bury the action inside a nonterminal symbol +which serves as a subroutine: + + subroutine: + %empty { prepare_for_local_variables (); } + ; + + compound: + subroutine '{' declarations statements '}' + | subroutine '{' statements '}' + ; + +Now Bison can execute the action in the rule for ‘subroutine’ without +deciding which rule for ‘compound’ it will eventually use. + + +File: bison.info, Node: Tracking Locations, Next: Named References, Prev: Semantics, Up: Grammar File + +3.5 Tracking Locations +====================== + +Though grammar rules and semantic actions are enough to write a fully +functional parser, it can be useful to process some additional +information, especially symbol locations. + + The way locations are handled is defined by providing a data type, +and actions to take when rules are matched. + +* Menu: + +* Location Type:: Specifying a data type for locations. +* Actions and Locations:: Using locations in actions. +* Printing Locations:: Defining how locations are printed. +* Location Default Action:: Defining a general way to compute locations. + + +File: bison.info, Node: Location Type, Next: Actions and Locations, Up: Tracking Locations + +3.5.1 Data Type of Locations +---------------------------- + +Defining a data type for locations is much simpler than for semantic +values, since all tokens and groupings always use the same type. The +location type is specified using ‘%define api.location.type’: + + %define api.location.type {location_t} + + This defines, in the C generated code, the ‘YYLTYPE’ type name. When +‘YYLTYPE’ is not defined, Bison uses a default structure type with four +members: + + typedef struct YYLTYPE + { + int first_line; + int first_column; + int last_line; + int last_column; + } YYLTYPE; + + In C, you may also specify the type of locations by defining a macro +called ‘YYLTYPE’, just as you can specify the semantic value type by +defining a ‘YYSTYPE’ macro (*note Value Type::). However, rather than +using macros, we recommend the ‘api.value.type’ and ‘api.location.type’ +‘%define’ variables. + + Default locations represent a range in the source file(s), but this +is not a requirement. It could be a single point or just a line number, +or even more complex structures. + + When the default location type is used, Bison initializes all these +fields to 1 for ‘yylloc’ at the beginning of the parsing. To initialize +‘yylloc’ with a custom location type (or to chose a different +initialization), use the ‘%initial-action’ directive. *Note Initial +Action Decl::. + + +File: bison.info, Node: Actions and Locations, Next: Printing Locations, Prev: Location Type, Up: Tracking Locations + +3.5.2 Actions and Locations +--------------------------- + +Actions are not only useful for defining language semantics, but also +for describing the behavior of the output parser with locations. + + The most obvious way for building locations of syntactic groupings is +very similar to the way semantic values are computed. In a given rule, +several constructs can be used to access the locations of the elements +being matched. The location of the Nth component of the right hand side +is ‘@N’, while the location of the left hand side grouping is ‘@$’. + + In addition, the named references construct ‘@NAME’ and ‘@[NAME]’ may +also be used to address the symbol locations. *Note Named References::, +for more information about using the named references construct. + + Here is a basic example using the default data type for locations: + + exp: + ... + | exp '/' exp + { + @$.first_column = @1.first_column; + @$.first_line = @1.first_line; + @$.last_column = @3.last_column; + @$.last_line = @3.last_line; + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, "%d.%d-%d.%d: division by zero", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + + As for semantic values, there is a default action for locations that +is run each time a rule is matched. It sets the beginning of ‘@$’ to +the beginning of the first symbol, and the end of ‘@$’ to the end of the +last symbol. + + With this default action, the location tracking can be fully +automatic. The example above simply rewrites this way: + + exp: + ... + | exp '/' exp + { + if ($3) + $$ = $1 / $3; + else + { + $$ = 1; + fprintf (stderr, "%d.%d-%d.%d: division by zero", + @3.first_line, @3.first_column, + @3.last_line, @3.last_column); + } + } + + It is also possible to access the location of the lookahead token, if +any, from a semantic action. This location is stored in ‘yylloc’. +*Note Action Features::. + + +File: bison.info, Node: Printing Locations, Next: Location Default Action, Prev: Actions and Locations, Up: Tracking Locations + +3.5.3 Printing Locations +------------------------ + +When using the default location type, the debug traces report the +symbols’ location. The generated parser does so using the +‘YYLOCATION_PRINT’ macro. + + -- Macro: YYLOCATION_PRINT (FILE, LOC); + When traces are enabled, print LOC (of type ‘YYLTYPE const *’) on + FILE (of type ‘FILE *’). Do nothing when traces are disabled, or + if the location type is user defined. + + To get locations in the debug traces with your user-defined location +types, define the ‘YYLOCATION_PRINT’ macro. For instance: + + #define YYLOCATION_PRINT location_print + + +File: bison.info, Node: Location Default Action, Prev: Printing Locations, Up: Tracking Locations + +3.5.4 Default Action for Locations +---------------------------------- + +Actually, actions are not the best place to compute locations. Since +locations are much more general than semantic values, there is room in +the output parser to redefine the default action to take for each rule. +The ‘YYLLOC_DEFAULT’ macro is invoked each time a rule is matched, +before the associated action is run. It is also invoked while +processing a syntax error, to compute the error’s location. Before +reporting an unresolvable syntactic ambiguity, a GLR parser invokes +‘YYLLOC_DEFAULT’ recursively to compute the location of that ambiguity. + + Most of the time, this macro is general enough to suppress location +dedicated code from semantic actions. + + The ‘YYLLOC_DEFAULT’ macro takes three parameters. The first one is +the location of the grouping (the result of the computation). When a +rule is matched, the second parameter identifies locations of all right +hand side elements of the rule being matched, and the third parameter is +the size of the rule’s right hand side. When a GLR parser reports an +ambiguity, which of multiple candidate right hand sides it passes to +‘YYLLOC_DEFAULT’ is undefined. When processing a syntax error, the +second parameter identifies locations of the symbols that were discarded +during error processing, and the third parameter is the number of +discarded symbols. + + By default, ‘YYLLOC_DEFAULT’ is defined this way: + + # define YYLLOC_DEFAULT(Cur, Rhs, N) \ + do \ + if (N) \ + { \ + (Cur).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Cur).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Cur).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Cur).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Cur).first_line = (Cur).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Cur).first_column = (Cur).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (0) + +where ‘YYRHSLOC (rhs, k)’ is the location of the Kth symbol in RHS when +K is positive, and the location of the symbol just before the reduction +when K and N are both zero. + + When defining ‘YYLLOC_DEFAULT’, you should consider that: + + • All arguments are free of side-effects. However, only the first + one (the result) should be modified by ‘YYLLOC_DEFAULT’. + + • For consistency with semantic actions, valid indexes within the + right hand side range from 1 to N. When N is zero, only 0 is a + valid index, and it refers to the symbol just before the reduction. + During error processing N is always positive. + + • Your macro should parenthesize its arguments, if need be, since the + actual arguments may not be surrounded by parentheses. Also, your + macro should expand to something that can be used as a single + statement when it is followed by a semicolon. + + +File: bison.info, Node: Named References, Next: Declarations, Prev: Tracking Locations, Up: Grammar File + +3.6 Named References +==================== + +As described in the preceding sections, the traditional way to refer to +any semantic value or location is a “positional reference”, which takes +the form ‘$N’, ‘$$’, ‘@N’, and ‘@$’. However, such a reference is not +very descriptive. Moreover, if you later decide to insert or remove +symbols in the right-hand side of a grammar rule, the need to renumber +such references can be tedious and error-prone. + + To avoid these issues, you can also refer to a semantic value or +location using a “named reference”. First of all, original symbol names +may be used as named references. For example: + + invocation: op '(' args ')' + { $invocation = new_invocation ($op, $args, @invocation); } + +Positional and named references can be mixed arbitrarily. For example: + + invocation: op '(' args ')' + { $$ = new_invocation ($op, $args, @$); } + +However, sometimes regular symbol names are not sufficient due to +ambiguities: + + exp: exp '/' exp + { $exp = $exp / $exp; } // $exp is ambiguous. + + exp: exp '/' exp + { $$ = $1 / $exp; } // One usage is ambiguous. + + exp: exp '/' exp + { $$ = $1 / $3; } // No error. + +When ambiguity occurs, explicitly declared names may be used for values +and locations. Explicit names are declared as a bracketed name after a +symbol appearance in rule definitions. For example: + exp[result]: exp[left] '/' exp[right] + { $result = $left / $right; } + +In order to access a semantic value generated by a midrule action, an +explicit name may also be declared by putting a bracketed name after the +closing brace of the midrule action code: + exp[res]: exp[x] '+' {$left = $x;}[left] exp[right] + { $res = $left + $right; } + + + In references, in order to specify names containing dots and dashes, +an explicit bracketed syntax ‘$[name]’ and ‘@[name]’ must be used: + if-stmt: "if" '(' expr ')' "then" then.stmt ';' + { $[if-stmt] = new_if_stmt ($expr, $[then.stmt]); } + + It often happens that named references are followed by a dot, dash or +other C punctuation marks and operators. By default, Bison will read +‘$name.suffix’ as a reference to symbol value ‘$name’ followed by +‘.suffix’, i.e., an access to the ‘suffix’ field of the semantic value. +In order to force Bison to recognize ‘name.suffix’ in its entirety as +the name of a semantic value, the bracketed syntax ‘$[name.suffix]’ must +be used. + + +File: bison.info, Node: Declarations, Next: Multiple Parsers, Prev: Named References, Up: Grammar File + +3.7 Bison Declarations +====================== + +The “Bison declarations” section of a Bison grammar defines the symbols +used in formulating the grammar and the data types of semantic values. +*Note Symbols::. + + All token kind names (but not single-character literal tokens such as +‘'+'’ and ‘'*'’) must be declared. Nonterminal symbols must be declared +if you need to specify which data type to use for the semantic value +(*note Multiple Types::). + + The first rule in the grammar file also specifies the start symbol, +by default. If you want some other symbol to be the start symbol, you +must declare it explicitly (*note Language and Grammar::). + +* Menu: + +* Require Decl:: Requiring a Bison version. +* Token Decl:: Declaring terminal symbols. +* Precedence Decl:: Declaring terminals with precedence and associativity. +* Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Symbol Decls:: Summary of the Syntax of Symbol Declarations. +* Initial Action Decl:: Code run before parsing starts. +* Destructor Decl:: Declaring how symbols are freed. +* Printer Decl:: Declaring how symbol values are displayed. +* Expect Decl:: Suppressing warnings about parsing conflicts. +* Start Decl:: Specifying the start symbol. +* Pure Decl:: Requesting a reentrant parser. +* Push Decl:: Requesting a push parser. +* Decl Summary:: Table of all Bison declarations. +* %define Summary:: Defining variables to adjust Bison’s behavior. +* %code Summary:: Inserting code into the parser source. + + +File: bison.info, Node: Require Decl, Next: Token Decl, Up: Declarations + +3.7.1 Require a Version of Bison +-------------------------------- + +You may require the minimum version of Bison to process the grammar. If +the requirement is not met, ‘bison’ exits with an error (exit status +63). + + %require "VERSION" + + Some deprecated behaviors are disabled for some required VERSION: +‘"3.2"’ (or better) + The C++ deprecated files ‘position.hh’ and ‘stack.hh’ are no longer + generated. + + +File: bison.info, Node: Token Decl, Next: Precedence Decl, Prev: Require Decl, Up: Declarations + +3.7.2 Token Kind Names +---------------------- + +The basic way to declare a token kind name (terminal symbol) is as +follows: + + %token NAME + + Bison will convert this into a definition in the parser, so that the +function ‘yylex’ (if it is in this file) can use the name NAME to stand +for this token kind’s code. + + Alternatively, you can use ‘%left’, ‘%right’, ‘%precedence’, or +‘%nonassoc’ instead of ‘%token’, if you wish to specify associativity +and precedence. *Note Precedence Decl::. However, for clarity, we +recommend to use these directives only to declare associativity and +precedence, and not to add string aliases, semantic types, etc. + + You can explicitly specify the numeric code for a token kind by +appending a nonnegative decimal or hexadecimal integer value in the +field immediately following the token name: + + %token NUM 300 + %token XNUM 0x12d // a GNU extension + +It is generally best, however, to let Bison choose the numeric codes for +all token kinds. Bison will automatically select codes that don’t +conflict with each other or with normal characters. + + In the event that the stack type is a union, you must augment the +‘%token’ or other token declaration to include the data type alternative +delimited by angle-brackets (*note Multiple Types::). + + For example: + + %union { /* define stack type */ + double val; + symrec *tptr; + } + %token NUM /* define token NUM and its type */ + + You can associate a literal string token with a token kind name by +writing the literal string at the end of a ‘%token’ declaration which +declares the name. For example: + + %token ARROW "=>" + +For example, a grammar for the C language might specify these names with +equivalent literal string tokens: + + %token OR "||" + %token LE 134 "<=" + %left OR "<=" + +Once you equate the literal string and the token kind name, you can use +them interchangeably in further declarations or the grammar rules. The +‘yylex’ function can use the token name or the literal string to obtain +the token kind code (*note Calling Convention::). + + String aliases allow for better error messages using the literal +strings instead of the token names, such as ‘syntax error, unexpected +||, expecting number or (’ rather than ‘syntax error, unexpected OR, +expecting NUM or LPAREN’. + + String aliases may also be marked for internationalization (*note +Token I18n::): + + %token + OR "||" + LPAREN "(" + RPAREN ")" + '\n' _("end of line") + + NUM _("number") + +would produce in French ‘erreur de syntaxe, || inattendu, attendait +nombre ou (’ rather than ‘erreur de syntaxe, || inattendu, attendait +number ou (’. + + +File: bison.info, Node: Precedence Decl, Next: Type Decl, Prev: Token Decl, Up: Declarations + +3.7.3 Operator Precedence +------------------------- + +Use the ‘%left’, ‘%right’, ‘%nonassoc’, or ‘%precedence’ declaration to +declare a token and specify its precedence and associativity, all at +once. These are called “precedence declarations”. *Note Precedence::, +for general information on operator precedence. + + The syntax of a precedence declaration is nearly the same as that of +‘%token’: either + + %left SYMBOLS... + +or + + %left SYMBOLS... + + And indeed any of these declarations serves the purposes of ‘%token’. +But in addition, they specify the associativity and relative precedence +for all the SYMBOLS: + + • The associativity of an operator OP determines how repeated uses of + the operator nest: whether ‘X OP Y OP Z’ is parsed by grouping X + with Y first or by grouping Y with Z first. ‘%left’ specifies + left-associativity (grouping X with Y first) and ‘%right’ specifies + right-associativity (grouping Y with Z first). ‘%nonassoc’ + specifies no associativity, which means that ‘X OP Y OP Z’ is + considered a syntax error. + + ‘%precedence’ gives only precedence to the SYMBOLS, and defines no + associativity at all. Use this to define precedence only, and + leave any potential conflict due to associativity enabled. + + • The precedence of an operator determines how it nests with other + operators. All the tokens declared in a single precedence + declaration have equal precedence and nest together according to + their associativity. When two tokens declared in different + precedence declarations associate, the one declared later has the + higher precedence and is grouped first. + + For backward compatibility, there is a confusing difference between +the argument lists of ‘%token’ and precedence declarations. Only a +‘%token’ can associate a literal string with a token kind name. A +precedence declaration always interprets a literal string as a reference +to a separate token. For example: + + %left OR "<=" // Does not declare an alias. + %left OR 134 "<=" 135 // Declares 134 for OR and 135 for "<=". + + +File: bison.info, Node: Type Decl, Next: Symbol Decls, Prev: Precedence Decl, Up: Declarations + +3.7.4 Nonterminal Symbols +------------------------- + +When you use ‘%union’ to specify multiple value types, you must declare +the value type of each nonterminal symbol for which values are used. +This is done with a ‘%type’ declaration, like this: + + %type NONTERMINAL... + +Here NONTERMINAL is the name of a nonterminal symbol, and TYPE is the +name given in the ‘%union’ to the alternative that you want (*note Union +Decl::). You can give any number of nonterminal symbols in the same +‘%type’ declaration, if they have the same value type. Use spaces to +separate the symbol names. + + While POSIX Yacc allows ‘%type’ only for nonterminals, Bison accepts +that this directive be also applied to terminal symbols. To declare +exclusively nonterminal symbols, use the safer ‘%nterm’: + + %nterm NONTERMINAL... + + +File: bison.info, Node: Symbol Decls, Next: Initial Action Decl, Prev: Type Decl, Up: Declarations + +3.7.5 Syntax of Symbol Declarations +----------------------------------- + +The syntax of the various directives to declare symbols is as follows. + + %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )* + %left TAG? ( ID NUMBER?)+ ( TAG ( ID NUMBER? )+ )* + %type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )* + %nterm TAG? ID+ ( TAG ID+ )* + +where TAG denotes a type tag such as ‘’, ID denotes an identifier +such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or +‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string +literal such as ‘"number"’. The postfix quantifiers are ‘?’ (zero or +one), ‘*’ (zero or more) and ‘+’ (one or more). + + The directives ‘%precedence’, ‘%right’ and ‘%nonassoc’ behave like +‘%left’. + + +File: bison.info, Node: Initial Action Decl, Next: Destructor Decl, Prev: Symbol Decls, Up: Declarations + +3.7.6 Performing Actions before Parsing +--------------------------------------- + +Sometimes your parser needs to perform some initializations before +parsing. The ‘%initial-action’ directive allows for such arbitrary +code. + + -- Directive: %initial-action { CODE } + Declare that the braced CODE must be invoked before parsing each + time ‘yyparse’ is called. The CODE may use ‘$$’ (or ‘$$’) and + ‘@$’ — initial value and location of the lookahead — and the + ‘%parse-param’. + + For instance, if your locations use a file name, you may use + + %parse-param { char const *file_name }; + %initial-action + { + @$.initialize (file_name); + }; + + +File: bison.info, Node: Destructor Decl, Next: Printer Decl, Prev: Initial Action Decl, Up: Declarations + +3.7.7 Freeing Discarded Symbols +------------------------------- + +During error recovery (*note Error Recovery::), symbols already pushed +on the stack and tokens coming from the rest of the file are discarded +until the parser falls on its feet. If the parser runs out of memory, +or if it returns via ‘YYABORT’, ‘YYACCEPT’ or ‘YYNOMEM’, all the symbols +on the stack must be discarded. Even if the parser succeeds, it must +discard the start symbol. + + When discarded symbols convey heap based information, this memory is +lost. While this behavior can be tolerable for batch parsers, such as +in traditional compilers, it is unacceptable for programs like shells or +protocol implementations that may parse and execute indefinitely. + + The ‘%destructor’ directive defines code that is called when a symbol +is automatically discarded. + + -- Directive: %destructor { CODE } SYMBOLS + Invoke the braced CODE whenever the parser discards one of the + SYMBOLS. Within CODE, ‘$$’ (or ‘$$’) designates the semantic + value associated with the discarded symbol, and ‘@$’ designates its + location. The additional parser parameters are also available + (*note Parser Function::). + + When a symbol is listed among SYMBOLS, its ‘%destructor’ is called + a per-symbol ‘%destructor’. You may also define a per-type + ‘%destructor’ by listing a semantic type tag among SYMBOLS. In + that case, the parser will invoke this CODE whenever it discards + any grammar symbol that has that semantic type tag unless that + symbol has its own per-symbol ‘%destructor’. + + Finally, you can define two different kinds of default + ‘%destructor’s. You can place each of ‘<*>’ and ‘<>’ in the + SYMBOLS list of exactly one ‘%destructor’ declaration in your + grammar file. The parser will invoke the CODE associated with one + of these whenever it discards any user-defined grammar symbol that + has no per-symbol and no per-type ‘%destructor’. The parser uses + the CODE for ‘<*>’ in the case of such a grammar symbol for which + you have formally declared a semantic type tag (‘%token’, ‘%nterm’, + and ‘%type’ count as such a declaration, but ‘$$’ does not). + The parser uses the CODE for ‘<>’ in the case of such a grammar + symbol that has no declared semantic type tag. + +For example: + + %union { char *string; } + %token STRING1 STRING2 + %nterm string1 string2 + %union { char character; } + %token CHR + %nterm chr + %token TAGLESS + + %destructor { } + %destructor { free ($$); } <*> + %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1 + %destructor { printf ("Discarding tagless symbol.\n"); } <> + +guarantees that, when the parser discards any user-defined symbol that +has a semantic type tag other than ‘’, it passes its semantic +value to ‘free’ by default. However, when the parser discards a +‘STRING1’ or a ‘string1’, it uses the third ‘%destructor’, which frees +it and prints its line number to ‘stdout’ (‘free’ is invoked only once). +Finally, the parser merely prints a message whenever it discards any +symbol, such as ‘TAGLESS’, that has no semantic type tag. + + A Bison-generated parser invokes the default ‘%destructor’s only for +user-defined as opposed to Bison-defined symbols. For example, the +parser will not invoke either kind of default ‘%destructor’ for the +special Bison-defined symbols ‘$accept’, ‘$undefined’, or ‘$end’ (*note +Table of Symbols::), none of which you can reference in your grammar. +It also will not invoke either for the ‘error’ token (*note Table of +Symbols::), which is always defined by Bison regardless of whether you +reference it in your grammar. However, it may invoke one of them for +the end token (token 0) if you redefine it from ‘$end’ to, for example, +‘END’: + + %token END 0 + + Finally, Bison will never invoke a ‘%destructor’ for an unreferenced +midrule semantic value (*note Midrule Actions::). That is, Bison does +not consider a midrule to have a semantic value if you do not reference +‘$$’ in the midrule’s action or ‘$N’ (where N is the right-hand side +symbol position of the midrule) in any later action in that rule. +However, if you do reference either, the Bison-generated parser will +invoke the ‘<>’ ‘%destructor’ whenever it discards the midrule symbol. + + + “Discarded symbols” are the following: + + • stacked symbols popped during the first phase of error recovery, + • incoming terminals during the second phase of error recovery, + • the current lookahead and the entire stack (except the current + right-hand side symbols) when the parser returns immediately, and + • the current lookahead and the entire stack (including the current + right-hand side symbols) when the C++ parser (‘lalr1.cc’) catches + an exception in ‘parse’, + • the start symbol, when the parser succeeds. + + The parser can “return immediately” because of an explicit call to +‘YYABORT’, ‘YYACCEPT’ or ‘YYNOMEM’, or failed error recovery, or memory +exhaustion. + + Right-hand side symbols of a rule that explicitly triggers a syntax +error via ‘YYERROR’ are not discarded automatically. As a rule of +thumb, destructors are invoked only when user actions cannot manage the +memory. + + +File: bison.info, Node: Printer Decl, Next: Expect Decl, Prev: Destructor Decl, Up: Declarations + +3.7.8 Printing Semantic Values +------------------------------ + +When run-time traces are enabled (*note Tracing::), the parser reports +its actions, such as reductions. When a symbol involved in an action is +reported, only its kind is displayed, as the parser cannot know how +semantic values should be formatted. + + The ‘%printer’ directive defines code that is called when a symbol is +reported. Its syntax is the same as ‘%destructor’ (*note Destructor +Decl::). + + -- Directive: %printer { CODE } SYMBOLS + Invoke the braced CODE whenever the parser displays one of the + SYMBOLS. Within CODE, ‘yyo’ denotes the output stream (a ‘FILE*’ + in C, an ‘std::ostream&’ in C++, and ‘stdout’ in D), ‘$$’ (or + ‘$$’) designates the semantic value associated with the + symbol, and ‘@$’ its location. The additional parser parameters + are also available (*note Parser Function::). + + The SYMBOLS are defined as for ‘%destructor’ (*note Destructor + Decl::.): they can be per-type (e.g., ‘’), per-symbol (e.g., + ‘exp’, ‘NUM’, ‘"float"’), typed per-default (i.e., ‘<*>’, or + untyped per-default (i.e., ‘<>’). + +For example: + + %union { char *string; } + %token STRING1 STRING2 + %nterm string1 string2 + %union { char character; } + %token CHR + %nterm chr + %token TAGLESS + + %printer { fprintf (yyo, "'%c'", $$); } + %printer { fprintf (yyo, "&%p", $$); } <*> + %printer { fprintf (yyo, "\"%s\"", $$); } STRING1 string1 + %printer { fprintf (yyo, "<>"); } <> + +guarantees that, when the parser print any symbol that has a semantic +type tag other than ‘’, it display the address of the +semantic value by default. However, when the parser displays a +‘STRING1’ or a ‘string1’, it formats it as a string in double quotes. +It performs only the second ‘%printer’ in this case, so it prints only +once. Finally, the parser print ‘<>’ for any symbol, such as ‘TAGLESS’, +that has no semantic type tag. *Note Mfcalc Traces::, for a complete +example. + + +File: bison.info, Node: Expect Decl, Next: Start Decl, Prev: Printer Decl, Up: Declarations + +3.7.9 Suppressing Conflict Warnings +----------------------------------- + +Bison normally warns if there are any conflicts in the grammar (*note +Shift/Reduce::), but most real grammars have harmless shift/reduce +conflicts which are resolved in a predictable way and would be difficult +to eliminate. It is desirable to suppress the warning about these +conflicts unless the number of conflicts changes. You can do this with +the ‘%expect’ declaration. + + The declaration looks like this: + + %expect N + + Here N is a decimal integer. The declaration says there should be N +shift/reduce conflicts and no reduce/reduce conflicts. Bison reports an +error if the number of shift/reduce conflicts differs from N, or if +there are any reduce/reduce conflicts. + + For deterministic parsers, reduce/reduce conflicts are more serious, +and should be eliminated entirely. Bison will always report +reduce/reduce conflicts for these parsers. With GLR parsers, however, +both kinds of conflicts are routine; otherwise, there would be no need +to use GLR parsing. Therefore, it is also possible to specify an +expected number of reduce/reduce conflicts in GLR parsers, using the +declaration: + + %expect-rr N + + You may wish to be more specific in your specification of expected +conflicts. To this end, you can also attach ‘%expect’ and ‘%expect-rr’ +modifiers to individual rules. The interpretation of these modifiers +differs from their use as declarations. When attached to rules, they +indicate the number of states in which the rule is involved in a +conflict. You will need to consult the output resulting from ‘-v’ to +determine appropriate numbers to use. For example, for the following +grammar fragment, the first rule for ‘empty_dims’ appears in two states +in which the ‘[’ token is a lookahead. Having determined that, you can +document this fact with an ‘%expect’ modifier as follows: + + dims: + empty_dims + | '[' expr ']' dims + ; + + empty_dims: + %empty %expect 2 + | empty_dims '[' ']' + ; + + Mid-rule actions generate implicit rules that are also subject to +conflicts (*note Midrule Conflicts::). To attach an ‘%expect’ or +‘%expect-rr’ annotation to an implicit mid-rule action’s rule, put it +before the action. For example, + + %glr-parser + %expect-rr 1 + + %% + + clause: + "condition" %expect-rr 1 { value_mode(); } '(' exprs ')' + | "condition" %expect-rr 1 { class_mode(); } '(' types ')' + ; + +Here, the appropriate mid-rule action will not be determined until after +the ‘(’ token is shifted. Thus, the two actions will clash with each +other, and we should expect one reduce/reduce conflict for each. + + In general, using ‘%expect’ involves these steps: + + • Compile your grammar without ‘%expect’. Use the ‘-v’ option to get + a verbose list of where the conflicts occur. Bison will also print + the number of conflicts. + + • Check each of the conflicts to make sure that Bison’s default + resolution is what you really want. If not, rewrite the grammar + and go back to the beginning. + + • Add an ‘%expect’ declaration, copying the number N from the number + that Bison printed. With GLR parsers, add an ‘%expect-rr’ + declaration as well. + + • Optionally, count up the number of states in which one or more + conflicted reductions for particular rules appear and add these + numbers to the affected rules as ‘%expect-rr’ or ‘%expect’ + modifiers as appropriate. Rules that are in conflict appear in the + output listing surrounded by square brackets or, in the case of + reduce/reduce conflicts, as reductions having the same lookahead + symbol as a square-bracketed reduction in the same state. + + Now Bison will report an error if you introduce an unexpected +conflict, but will keep silent otherwise. + + +File: bison.info, Node: Start Decl, Next: Pure Decl, Prev: Expect Decl, Up: Declarations + +3.7.10 The Start-Symbol +----------------------- + +Bison assumes by default that the start symbol for the grammar is the +first nonterminal specified in the grammar specification section. The +programmer may override this restriction with the ‘%start’ declaration +as follows: + + %start SYMBOL + + +File: bison.info, Node: Pure Decl, Next: Push Decl, Prev: Start Decl, Up: Declarations + +3.7.11 A Pure (Reentrant) Parser +-------------------------------- + +A “reentrant” program is one which does not alter in the course of +execution; in other words, it consists entirely of “pure” (read-only) +code. Reentrancy is important whenever asynchronous execution is +possible; for example, a nonreentrant program may not be safe to call +from a signal handler. In systems with multiple threads of control, a +nonreentrant program must be called only within interlocks. + + Normally, Bison generates a parser which is not reentrant. This is +suitable for most uses, and it permits compatibility with Yacc. (The +standard Yacc interfaces are inherently nonreentrant, because they use +statically allocated variables for communication with ‘yylex’, including +‘yylval’ and ‘yylloc’.) + + Alternatively, you can generate a pure, reentrant parser. The Bison +declaration ‘%define api.pure’ says that you want the parser to be +reentrant. It looks like this: + + %define api.pure full + + The result is that the communication variables ‘yylval’ and ‘yylloc’ +become local variables in ‘yyparse’, and a different calling convention +is used for the lexical analyzer function ‘yylex’. *Note Pure +Calling::, for the details of this. The variable ‘yynerrs’ becomes +local in ‘yyparse’ in pull mode but it becomes a member of ‘yypstate’ in +push mode. (*note Error Reporting Function::). The convention for +calling ‘yyparse’ itself is unchanged. + + Whether the parser is pure has nothing to do with the grammar rules. +You can generate either a pure parser or a nonreentrant parser from any +valid grammar. + + +File: bison.info, Node: Push Decl, Next: Decl Summary, Prev: Pure Decl, Up: Declarations + +3.7.12 A Push Parser +-------------------- + +A pull parser is called once and it takes control until all its input is +completely parsed. A push parser, on the other hand, is called each +time a new token is made available. + + A push parser is typically useful when the parser is part of a main +event loop in the client’s application. This is typically a requirement +of a GUI, when the main event loop needs to be triggered within a +certain time period. + + Normally, Bison generates a pull parser. The following Bison +declaration says that you want the parser to be a push parser (*note +%define Summary::): + + %define api.push-pull push + + In almost all cases, you want to ensure that your push parser is also +a pure parser (*note Pure Decl::). The only time you should create an +impure push parser is to have backwards compatibility with the impure +Yacc pull mode interface. Unless you know what you are doing, your +declarations should look like this: + + %define api.pure full + %define api.push-pull push + + There is a major notable functional difference between the pure push +parser and the impure push parser. It is acceptable for a pure push +parser to have many parser instances, of the same type of parser, in +memory at the same time. An impure push parser should only use one +parser at a time. + + When a push parser is selected, Bison will generate some new symbols +in the generated parser. ‘yypstate’ is a structure that the generated +parser uses to store the parser’s state. ‘yypstate_new’ is the function +that will create a new parser instance. ‘yypstate_delete’ will free the +resources associated with the corresponding parser instance. Finally, +‘yypush_parse’ is the function that should be called whenever a token is +available to provide the parser. A trivial example of using a pure push +parser would look like this: + + int status; + yypstate *ps = yypstate_new (); + do { + status = yypush_parse (ps, yylex (), NULL); + } while (status == YYPUSH_MORE); + yypstate_delete (ps); + + If the user decided to use an impure push parser, a few things about +the generated parser will change. The ‘yychar’ variable becomes a +global variable instead of a local one in the ‘yypush_parse’ function. +For this reason, the signature of the ‘yypush_parse’ function is changed +to remove the token as a parameter. A nonreentrant push parser example +would thus look like this: + + extern int yychar; + int status; + yypstate *ps = yypstate_new (); + do { + yychar = yylex (); + status = yypush_parse (ps); + } while (status == YYPUSH_MORE); + yypstate_delete (ps); + + That’s it. Notice the next token is put into the global variable +‘yychar’ for use by the next invocation of the ‘yypush_parse’ function. + + Bison also supports both the push parser interface along with the +pull parser interface in the same generated parser. In order to get +this functionality, you should replace the ‘%define api.push-pull push’ +declaration with the ‘%define api.push-pull both’ declaration. Doing +this will create all of the symbols mentioned earlier along with the two +extra symbols, ‘yyparse’ and ‘yypull_parse’. ‘yyparse’ can be used +exactly as it normally would be used. However, the user should note +that it is implemented in the generated parser by calling +‘yypull_parse’. This makes the ‘yyparse’ function that is generated +with the ‘%define api.push-pull both’ declaration slower than the normal +‘yyparse’ function. If the user calls the ‘yypull_parse’ function it +will parse the rest of the input stream. It is possible to +‘yypush_parse’ tokens to select a subgrammar and then ‘yypull_parse’ the +rest of the input stream. If you would like to switch back and forth +between between parsing styles, you would have to write your own +‘yypull_parse’ function that knows when to quit looking for input. An +example of using the ‘yypull_parse’ function would look like this: + + yypstate *ps = yypstate_new (); + yypull_parse (ps); /* Will call the lexer */ + yypstate_delete (ps); + + Adding the ‘%define api.pure’ declaration does exactly the same thing +to the generated parser with ‘%define api.push-pull both’ as it did for +‘%define api.push-pull push’. + + +File: bison.info, Node: Decl Summary, Next: %define Summary, Prev: Push Decl, Up: Declarations + +3.7.13 Bison Declaration Summary +-------------------------------- + +Here is a summary of the declarations used to define a grammar: + + -- Directive: %union + Declare the collection of data types that semantic values may have + (*note Union Decl::). + + -- Directive: %token + Declare a terminal symbol (token kind name) with no precedence or + associativity specified (*note Token Decl::). + + -- Directive: %right + Declare a terminal symbol (token kind name) that is + right-associative (*note Precedence Decl::). + + -- Directive: %left + Declare a terminal symbol (token kind name) that is + left-associative (*note Precedence Decl::). + + -- Directive: %nonassoc + Declare a terminal symbol (token kind name) that is nonassociative + (*note Precedence Decl::). Using it in a way that would be + associative is a syntax error. + + -- Directive: %nterm + Declare the type of semantic values for a nonterminal symbol (*note + Type Decl::). + + -- Directive: %type + Declare the type of semantic values for a symbol (*note Type + Decl::). + + -- Directive: %start + Specify the grammar’s start symbol (*note Start Decl::). + + -- Directive: %expect + Declare the expected number of shift/reduce conflicts, either + overall or for a given rule (*note Expect Decl::). + + -- Directive: %expect-rr + Declare the expected number of reduce/reduce conflicts, either + overall or for a given rule (*note Expect Decl::). + + +In order to change the behavior of ‘bison’, use the following +directives: + + -- Directive: %code {CODE} + -- Directive: %code QUALIFIER {CODE} + Insert CODE verbatim into the output parser source at the default + location or at the location specified by QUALIFIER. *Note %code + Summary::. + + -- Directive: %debug + Instrument the parser for traces. Obsoleted by ‘%define + parse.trace’. *Note Tracing::. + + -- Directive: %define VARIABLE + -- Directive: %define VARIABLE VALUE + -- Directive: %define VARIABLE {VALUE} + -- Directive: %define VARIABLE "VALUE" + Define a variable to adjust Bison’s behavior. *Note %define + Summary::. + + -- Directive: %defines + -- Directive: %defines DEFINES-FILE + Historical name for ‘%header’. *Note ‘%header’: %header. + + -- Directive: %destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Destructor Decl::. + + -- Directive: %file-prefix "PREFIX" + Specify a prefix to use for all Bison output file names. The names + are chosen as if the grammar file were named ‘PREFIX.y’. + + -- Directive: %header + Write a parser header file containing definitions for the token + kind names defined in the grammar as well as a few other + declarations. If the parser implementation file is named ‘NAME.c’ + then the parser header file is named ‘NAME.h’. + + For C parsers, the parser header file declares ‘YYSTYPE’ unless + ‘YYSTYPE’ is already defined as a macro or you have used a ‘’ + tag without using ‘%union’. Therefore, if you are using a ‘%union’ + (*note Multiple Types::) with components that require other + definitions, or if you have defined a ‘YYSTYPE’ macro or type + definition (*note Value Type::), you need to arrange for these + definitions to be propagated to all modules, e.g., by putting them + in a prerequisite header that is included both by your parser and + by any other module that needs ‘YYSTYPE’. + + Unless your parser is pure, the parser header file declares + ‘yylval’ as an external variable. *Note Pure Decl::. + + If you have also used locations, the parser header file declares + ‘YYLTYPE’ and ‘yylloc’ using a protocol similar to that of the + ‘YYSTYPE’ macro and ‘yylval’. *Note Tracking Locations::. + + This parser header file is normally essential if you wish to put + the definition of ‘yylex’ in a separate source file, because + ‘yylex’ typically needs to be able to refer to the above-mentioned + declarations and to the token kind codes. *Note Token Values::. + + If you have declared ‘%code requires’ or ‘%code provides’, the + output header also contains their code. *Note %code Summary::. + + The generated header is protected against multiple inclusions with + a C preprocessor guard: ‘YY_PREFIX_FILE_INCLUDED’, where PREFIX and + FILE are the prefix (*note Multiple Parsers::) and generated file + name turned uppercase, with each series of non alphanumerical + characters converted to a single underscore. + + For instance with ‘%define api.prefix {calc}’ and ‘%header + "lib/parse.h"’, the header will be guarded as follows. + #ifndef YY_CALC_LIB_PARSE_H_INCLUDED + # define YY_CALC_LIB_PARSE_H_INCLUDED + ... + #endif /* ! YY_CALC_LIB_PARSE_H_INCLUDED */ + + Introduced in Bison 3.8. + + -- Directive: %header HEADER-FILE + Same as above, but save in the file ‘HEADER-FILE’. + + -- Directive: %language "LANGUAGE" + Specify the programming language for the generated parser. + Currently supported languages include C, C++, D and Java. LANGUAGE + is case-insensitive. + + -- Directive: %locations + Generate the code processing the locations (*note Action + Features::). This mode is enabled as soon as the grammar uses the + special ‘@N’ tokens, but if your grammar does not use it, using + ‘%locations’ allows for more accurate syntax error messages. + + -- Directive: %name-prefix "PREFIX" + Obsoleted by ‘%define api.prefix {PREFIX}’. *Note Multiple + Parsers::. For C++ parsers, see the ‘%define api.namespace’ + documentation in this section. + + Rename the external symbols used in the parser so that they start + with PREFIX instead of ‘yy’. The precise list of symbols renamed + in C parsers is ‘yyparse’, ‘yylex’, ‘yyerror’, ‘yynerrs’, ‘yylval’, + ‘yychar’, ‘yydebug’, and (if locations are used) ‘yylloc’. If you + use a push parser, ‘yypush_parse’, ‘yypull_parse’, ‘yypstate’, + ‘yypstate_new’ and ‘yypstate_delete’ will also be renamed. For + example, if you use ‘%name-prefix "c_"’, the names become + ‘c_parse’, ‘c_lex’, and so on. + + Contrary to defining ‘api.prefix’, some symbols are _not_ renamed + by ‘%name-prefix’, for instance ‘YYDEBUG’, ‘YYTOKENTYPE’, + ‘yytoken_kind_t’, ‘YYSTYPE’, ‘YYLTYPE’. + + -- Directive: %no-lines + Don’t generate any ‘#line’ preprocessor commands in the parser + implementation file. Ordinarily Bison writes these commands in the + parser implementation file so that the C compiler and debuggers + will associate errors and object code with your source file (the + grammar file). This directive causes them to associate errors with + the parser implementation file, treating it as an independent + source file in its own right. + + -- Directive: %output "FILE" + Generate the parser implementation in ‘FILE’. + + -- Directive: %pure-parser + Deprecated version of ‘%define api.pure’ (*note %define Summary::), + for which Bison is more careful to warn about unreasonable usage. + + -- Directive: %require "VERSION" + Require version VERSION or higher of Bison. *Note Require Decl::. + + -- Directive: %skeleton "FILE" + Specify the skeleton to use. + + If FILE does not contain a ‘/’, FILE is the name of a skeleton file + in the Bison installation directory. If it does, FILE is an + absolute file name or a file name relative to the directory of the + grammar file. This is similar to how most shells resolve commands. + + -- Directive: %token-table + This feature is obsolescent, avoid it in new projects. + + Generate an array of token names in the parser implementation file. + The name of the array is ‘yytname’; ‘yytname[I]’ is the name of the + token whose internal Bison token code is I. The first three + elements of ‘yytname’ correspond to the predefined tokens ‘"$end"’, + ‘"error"’, and ‘"$undefined"’; after these come the symbols defined + in the grammar file. + + The name in the table includes all the characters needed to + represent the token in Bison. For single-character literals and + literal strings, this includes the surrounding quoting characters + and any escape sequences. For example, the Bison single-character + literal ‘'+'’ corresponds to a three-character name, represented in + C as ‘"'+'"’; and the Bison two-character literal string ‘"\\/"’ + corresponds to a five-character name, represented in C as + ‘"\"\\\\/\""’. + + When you specify ‘%token-table’, Bison also generates macro + definitions for macros ‘YYNTOKENS’, ‘YYNNTS’, and ‘YYNRULES’, and + ‘YYNSTATES’: + + ‘YYNTOKENS’ + The number of terminal symbols, i.e., the highest token code, + plus one. + ‘YYNNTS’ + The number of nonterminal symbols. + ‘YYNRULES’ + The number of grammar rules, + ‘YYNSTATES’ + The number of parser states (*note Parser States::). + + Here’s code for looking up a multicharacter token in ‘yytname’, + assuming that the characters of the token are stored in + ‘token_buffer’, and assuming that the token does not contain any + characters like ‘"’ that require escaping. + + for (int i = 0; i < YYNTOKENS; i++) + if (yytname[i] + && yytname[i][0] == '"' + && ! strncmp (yytname[i] + 1, token_buffer, + strlen (token_buffer)) + && yytname[i][strlen (token_buffer) + 1] == '"' + && yytname[i][strlen (token_buffer) + 2] == 0) + break; + + This method is discouraged: the primary purpose of string aliases + is forging good error messages, not describing the spelling of + keywords. In addition, looking for the token kind at runtime + incurs a (small but noticeable) cost. + + Finally, ‘%token-table’ is incompatible with the ‘custom’ and + ‘detailed’ values of the ‘parse.error’ ‘%define’ variable. + + -- Directive: %verbose + Write an extra output file containing verbose descriptions of the + parser states and what is done for each type of lookahead token in + that state. *Note Understanding::, for more information. + + -- Directive: %yacc + Pretend the option ‘--yacc’ was given (*note ‘--yacc’: + option-yacc.), i.e., imitate Yacc, including its naming + conventions. Only makes sense with the ‘yacc.c’ skeleton. *Note + Tuning the Parser::, for more. + + Of course, being a Bison extension, ‘%yacc’ is somewhat + self-contradictory... + + +File: bison.info, Node: %define Summary, Next: %code Summary, Prev: Decl Summary, Up: Declarations + +3.7.14 %define Summary +---------------------- + +There are many features of Bison’s behavior that can be controlled by +assigning the feature a single value. For historical reasons, some such +features are assigned values by dedicated directives, such as ‘%start’, +which assigns the start symbol. However, newer such features are +associated with variables, which are assigned by the ‘%define’ +directive: + + -- Directive: %define VARIABLE + -- Directive: %define VARIABLE VALUE + -- Directive: %define VARIABLE {VALUE} + -- Directive: %define VARIABLE "VALUE" + Define VARIABLE to VALUE. + + The type of the values depend on the syntax. Braces denote value + in the target language (e.g., a namespace, a type, etc.). Keyword + values (no delimiters) denote finite choice (e.g., a variation of a + feature). String values denote remaining cases (e.g., a file + name). + + It is an error if a VARIABLE is defined by ‘%define’ multiple + times, but see *note ‘-D NAME[=VALUE]’: Tuning the Parser. + + The rest of this section summarizes variables and values that +‘%define’ accepts. + + Some VARIABLEs take Boolean values. In this case, Bison will +complain if the variable definition does not meet one of the following +four conditions: + + 1. ‘VALUE’ is ‘true’ + + 2. ‘VALUE’ is omitted (or ‘""’ is specified). This is equivalent to + ‘true’. + + 3. ‘VALUE’ is ‘false’. + + 4. VARIABLE is never defined. In this case, Bison selects a default + value. + + What VARIABLEs are accepted, as well as their meanings and default +values, depend on the selected target language and/or the parser +skeleton (*note Decl Summary::, *note Decl Summary::). Unaccepted +VARIABLEs produce an error. Some of the accepted VARIABLEs are +described below. + + -- Directive: %define api.filename.type {TYPE} + + • Language(s): C++ + + • Purpose: Define the type of file names in Bison’s default + location and position types. *Note Exposing the Location + Classes::. + + • Accepted Values: Any type that is printable (via streams) and + comparable (with ‘==’ and ‘!=’). + + • Default Value: ‘const std::string’. + + • History: Introduced in Bison 2.0 as ‘filename_type’ (with + ‘std::string’ as default), renamed as ‘api.filename.type’ in + Bison 3.7 (with ‘const std::string’ as default). + + -- Directive: %define api.header.include {"header.h"} + -- Directive: %define api.header.include {} + • Languages(s): C (‘yacc.c’) + + • Purpose: Specify how the generated parser should include the + generated header. + + Historically, when option ‘-d’ or ‘--header’ was used, ‘bison’ + generated a header and pasted an exact copy of it into the + generated parser implementation file. Since Bison 3.6, it is + ‘#include’d as ‘"BASENAME.h"’, instead of duplicated, unless + FILE is ‘y.tab’, see below. + + The ‘api.header.include’ variable allows to control how the + generated parser ‘#include’s the generated header. For + instance: + + %define api.header.include {"parse.h"} + + or + + %define api.header.include {} + + Using ‘api.header.include’ does not change the name of the + generated header, only how it is included. + + To work around limitations of Automake’s ‘ylwrap’ (which runs + ‘bison’ with ‘--yacc’), ‘api.header.include’ is _not_ + predefined when the output file is ‘y.tab.c’. Define it to + avoid the duplication. + + • Accepted Values: An argument for ‘#include’. + + • Default Value: ‘"HEADER-BASENAME"’, unless the header file is + ‘y.tab.h’, where HEADER-BASENAME is the name of the generated + header, without directory part. For instance with ‘bison -d + calc/parse.y’, ‘api.header.include’ defaults to ‘"parse.h"’, + not ‘"calc/parse.h"’. + + • History: Introduced in Bison 3.4. Defaults to ‘"BASENAME.h"’ + since Bison 3.7, unless the header file is ‘y.tab.h’. + + -- Directive: %define api.location.file "FILE" + -- Directive: %define api.location.file none + + • Language(s): C++ + + • Purpose: Define the name of the file in which Bison’s default + location and position types are generated. *Note Exposing the + Location Classes::. + + • Accepted Values: + ‘none’ + If locations are enabled, generate the definition of the + ‘position’ and ‘location’ classes in the header file if + ‘%header’, otherwise in the parser implementation. + + "FILE" + Generate the definition of the ‘position’ and ‘location’ + classes in FILE. This file name can be relative (to + where the parser file is output) or absolute. + + • Default Value: Not applicable if locations are not enabled, or + if a user location type is specified (see + ‘api.location.type’). Otherwise, Bison’s ‘location’ is + generated in ‘location.hh’ (*note C++ location::). + + • History: Introduced in Bison 3.2. + + -- Directive: %define api.location.include {"FILE"} + -- Directive: %define api.location.include {} + + • Language(s): C++ + + • Purpose: Specify how the generated file that defines the + ‘position’ and ‘location’ classes is included. This makes + sense when the ‘location’ class is exposed to the rest of your + application/library in another directory. *Note Exposing the + Location Classes::. + + • Accepted Values: Argument for ‘#include’. + + • Default Value: ‘"DIR/location.hh"’ where DIR is the directory + part of the output. For instance ‘src/parse’ if + ‘--output=src/parse/parser.cc’ was given. + + • History: Introduced in Bison 3.2. + + -- Directive: %define api.location.type {TYPE} + + • Language(s): C, C++, Java + + • Purpose: Define the location type. *Note Location Type::, and + *note User Defined Location Type::. + + • Accepted Values: String + + • Default Value: none + + • History: Introduced in Bison 2.7 for C++ and Java, in Bison + 3.4 for C. Was originally named ‘location_type’ in Bison 2.5 + and 2.6. + + -- Directive: %define api.namespace {NAMESPACE} + • Languages(s): C++ + + • Purpose: Specify the namespace for the parser class. For + example, if you specify: + + %define api.namespace {foo::bar} + + Bison uses ‘foo::bar’ verbatim in references such as: + + foo::bar::parser::value_type + + However, to open a namespace, Bison removes any leading ‘::’ + and then splits on any remaining occurrences: + + namespace foo { namespace bar { + class position; + class location; + } } + + • Accepted Values: Any absolute or relative C++ namespace + reference without a trailing ‘"::"’. For example, ‘"foo"’ or + ‘"::foo::bar"’. + + • Default Value: ‘yy’, unless you used the obsolete + ‘%name-prefix "PREFIX"’ directive. + + -- Directive: %define api.parser.class {NAME} + • Language(s): C++, Java, D + + • Purpose: The name of the parser class. + + • Accepted Values: Any valid identifier. + + • Default Value: In C++, ‘parser’. In D and Java, ‘YYParser’ or + ‘API.PREFIXParser’ (*note Java Bison Interface::). + + • History: Introduced in Bison 3.3 to replace + ‘parser_class_name’. + + -- Directive: %define api.prefix {PREFIX} + + • Language(s): C, C++, Java + + • Purpose: Rename exported symbols. *Note Multiple Parsers::. + + • Accepted Values: String + + • Default Value: ‘YY’ for Java, ‘yy’ otherwise. + + • History: introduced in Bison 2.6, with its argument in double + quotes. Uses braces since Bison 3.0 (double quotes are still + supported for backward compatibility). + + -- Directive: %define api.pure PURITY + + • Language(s): C + + • Purpose: Request a pure (reentrant) parser program. *Note + Pure Decl::. + + • Accepted Values: ‘true’, ‘false’, ‘full’ + + The value may be omitted: this is equivalent to specifying + ‘true’, as is the case for Boolean values. + + When ‘%define api.pure full’ is used, the parser is made + reentrant. This changes the signature for ‘yylex’ (*note Pure + Calling::), and also that of ‘yyerror’ when the tracking of + locations has been activated, as shown below. + + The ‘true’ value is very similar to the ‘full’ value, the only + difference is in the signature of ‘yyerror’ on Yacc parsers + without ‘%parse-param’, for historical reasons. + + I.e., if ‘%locations %define api.pure’ is passed then the + prototypes for ‘yyerror’ are: + + void yyerror (char const *msg); // Yacc parsers. + void yyerror (YYLTYPE *locp, char const *msg); // GLR parsers. + + But if ‘%locations %define api.pure %parse-param {int + *nastiness}’ is used, then both parsers have the same + signature: + + void yyerror (YYLTYPE *llocp, int *nastiness, char const *msg); + + (*note Error Reporting Function::) + + • Default Value: ‘false’ + + • History: the ‘full’ value was introduced in Bison 2.7 + + -- Directive: %define api.push-pull KIND + + • Language(s): C (deterministic parsers only), D, Java + + • Purpose: Request a pull parser, a push parser, or both. *Note + Push Decl::. + + • Accepted Values: ‘pull’, ‘push’, ‘both’ + + • Default Value: ‘pull’ + + -- Directive: %define api.symbol.prefix {PREFIX} + + • Languages(s): all + + • Purpose: Add a prefix to the name of the symbol kinds. For + instance + + %define api.symbol.prefix {S_} + %token FILE for ERROR + %% + start: FILE for ERROR; + + generates this definition in C: + + /* Symbol kind. */ + enum yysymbol_kind_t + { + S_YYEMPTY = -2, /* No symbol. */ + S_YYEOF = 0, /* $end */ + S_YYERROR = 1, /* error */ + S_YYUNDEF = 2, /* $undefined */ + S_FILE = 3, /* FILE */ + S_for = 4, /* for */ + S_ERROR = 5, /* ERROR */ + S_YYACCEPT = 6, /* $accept */ + S_start = 7 /* start */ + }; + + • Accepted Values: Any non empty string. Must be a valid + identifier in the target language (typically a non empty + sequence of letters, underscores, and —not at the beginning— + digits). + + The empty prefix is (generally) invalid: + • in C it would create collision with the ‘YYERROR’ macro, + and potentially token kind definitions and symbol kind + definitions would collide; + • unnamed symbols (such as ‘'+'’) have a name which starts + with a digit; + • even in languages with scoped enumerations such as Java, + an empty prefix is dangerous: symbol names may collide + with the target language keywords, or with other members + of the ‘SymbolKind’ class. + + • Default Value: ‘YYSYMBOL_’ in C, ‘S_’ in C++ and Java, empty + in D. + • History: introduced in Bison 3.6. + + -- Directive: %define api.token.constructor + + • Language(s): C++, D + + • Purpose: Request that symbols be handled as a whole (type, + value, and possibly location) in the scanner. In the case of + C++, it works only when variant-based semantic values are + enabled (*note C++ Variants::), see *note Complete Symbols::, + for details. In D, token constructors work with both ‘%union’ + and ‘%define api.value.type union’. + + • Accepted Values: Boolean. + + • Default Value: ‘false’ + • History: introduced in Bison 3.0. + + -- Directive: %define api.token.prefix {PREFIX} + • Languages(s): all + + • Purpose: Add a prefix to the token names when generating their + definition in the target language. For instance + + %define api.token.prefix {TOK_} + %token FILE for ERROR + %% + start: FILE for ERROR; + + generates the definition of the symbols ‘TOK_FILE’, ‘TOK_for’, + and ‘TOK_ERROR’ in the generated source files. In particular, + the scanner must use these prefixed token names, while the + grammar itself may still use the short names (as in the sample + rule given above). The generated informational files + (‘*.output’, ‘*.xml’, ‘*.gv’) are not modified by this prefix. + + Bison also prefixes the generated member names of the semantic + value union. *Note Type Generation::, for more details. + + See *note Calc++ Parser:: and *note Calc++ Scanner::, for a + complete example. + + • Accepted Values: Any string. Must be a valid identifier + prefix in the target language (typically, a possibly empty + sequence of letters, underscores, and —not at the beginning— + digits). + + • Default Value: empty + • History: introduced in Bison 3.0. + + -- Directive: %define api.token.raw + + • Language(s): all + + • Purpose: The output files normally define the enumeration of + the _token kinds_ with Yacc-compatible token codes: sequential + numbers starting at 257 except for single character tokens + which stand for themselves (e.g., in ASCII, ‘'a'’ is numbered + 65). The parser however uses _symbol kinds_ which are + assigned numbers sequentially starting at 0. Therefore each + time the scanner returns an (external) token kind, it must be + mapped to the (internal) symbol kind. + + When ‘api.token.raw’ is set, the code of the token kinds are + forced to coincide with the symbol kind. This saves one table + lookup per token to map them from the token kind to the symbol + kind, and also saves the generation of the mapping table. The + gain is typically moderate, but in extreme cases (very simple + user actions), a 10% improvement can be observed. + + When ‘api.token.raw’ is set, the grammar cannot use character + literals (such as ‘'a'’). + + • Accepted Values: Boolean. + + • Default Value: ‘true’ in D, ‘false’ otherwise + • History: introduced in Bison 3.5. Was initially introduced in + Bison 1.25 as ‘%raw’, but never worked and was removed in + Bison 1.29. + + -- Directive: %define api.value.automove + + • Language(s): C++ + + • Purpose: Let occurrences of semantic values of the right-hand + sides of a rule be implicitly turned in rvalues. When + enabled, a grammar such as: + + exp: + "number" { $$ = make_number ($1); } + | exp "+" exp { $$ = make_binary (add, $1, $3); } + | "(" exp ")" { $$ = $2; } + + is actually compiled as if you had written: + + exp: + "number" { $$ = make_number (std::move ($1)); } + | exp "+" exp { $$ = make_binary (add, + std::move ($1), + std::move ($3)); } + | "(" exp ")" { $$ = std::move ($2); } + + Using a value several times with automove enabled is typically + an error. For instance, instead of: + + exp: "twice" exp { $$ = make_binary (add, $2, $2); } + + write: + + exp: "twice" exp { auto v = $2; $$ = make_binary (add, v, v); } + + It is tempting to use ‘std::move’ on one of the ‘v’, but the + argument evaluation order in C++ is unspecified. + + • Accepted Values: Boolean. + + • Default Value: ‘false’ + • History: introduced in Bison 3.2 + + -- Directive: %define api.value.type SUPPORT + -- Directive: %define api.value.type {TYPE} + • Language(s): all + + • Purpose: The type for semantic values. + + • Accepted Values: + ‘{}’ + This grammar has no semantic value at all. This is not + properly supported yet. + ‘union-directive’ (C, C++, D) + The type is defined thanks to the ‘%union’ directive. + You don’t have to define ‘api.value.type’ in that case, + using ‘%union’ suffices. *Note Union Decl::. For + instance: + %define api.value.type union-directive + %union + { + int ival; + char *sval; + } + %token INT "integer" + %token STR "string" + + ‘union’ (C, C++) + The symbols are defined with type names, from which Bison + will generate a ‘union’. For instance: + %define api.value.type union + %token INT "integer" + %token STR "string" + Most C++ objects cannot be stored in a ‘union’, use + ‘variant’ instead. + + ‘variant’ (C++) + This is similar to ‘union’, but special storage + techniques are used to allow any kind of C++ object to be + used. For instance: + %define api.value.type variant + %token INT "integer" + %token STR "string" + *Note C++ Variants::. + + ‘{TYPE}’ + Use this TYPE as semantic value. + %code requires + { + struct my_value + { + enum + { + is_int, is_str + } kind; + union + { + int ival; + char *sval; + } u; + }; + } + %define api.value.type {struct my_value} + %token INT "integer" + %token STR "string" + + • Default Value: + − ‘union-directive’ if ‘%union’ is used, otherwise ... + − ‘int’ if type tags are used (i.e., ‘%token ...’ or + ‘%nterm ...’ is used), otherwise ... + − undefined. + + • History: introduced in Bison 3.0. Was introduced for Java + only in 2.3b as ‘stype’. + + -- Directive: %define api.value.union.name NAME + • Language(s): C + + • Purpose: The tag of the generated ‘union’ (_not_ the name of + the ‘typedef’). This variable is set to ‘ID’ when ‘%union ID’ + is used. There is no clear reason to give this union a name. + + • Accepted Values: Any valid identifier. + + • Default Value: ‘YYSTYPE’. + + • History: Introduced in Bison 3.0.3. + + -- Directive: %define lr.default-reduction WHEN + + • Language(s): all + + • Purpose: Specify the kind of states that are permitted to + contain default reductions. *Note Default Reductions::. + + • Accepted Values: ‘most’, ‘consistent’, ‘accepting’ + • Default Value: + • ‘accepting’ if ‘lr.type’ is ‘canonical-lr’. + • ‘most’ otherwise. + • History: introduced as ‘lr.default-reductions’ in 2.5, renamed + as ‘lr.default-reduction’ in 3.0. + + -- Directive: %define lr.keep-unreachable-state + + • Language(s): all + • Purpose: Request that Bison allow unreachable parser states to + remain in the parser tables. *Note Unreachable States::. + • Accepted Values: Boolean + • Default Value: ‘false’ + • History: introduced as ‘lr.keep_unreachable_states’ in 2.3b, + renamed as ‘lr.keep-unreachable-states’ in 2.5, and as + ‘lr.keep-unreachable-state’ in 3.0. + + -- Directive: %define lr.type TYPE + + • Language(s): all + + • Purpose: Specify the type of parser tables within the LR(1) + family. *Note LR Table Construction::. + + • Accepted Values: ‘lalr’, ‘ielr’, ‘canonical-lr’ + + • Default Value: ‘lalr’ + + -- Directive: %define namespace {NAMESPACE} + Obsoleted by ‘api.namespace’ + + -- Directive: %define parse.assert + + • Languages(s): C, C++ + + • Purpose: Issue runtime assertions to catch invalid uses. In + C, some important invariants in the implementation of the + parser are checked when this option is enabled. + + In C++, when variants are used (*note C++ Variants::), symbols + must be constructed and destroyed properly. This option + checks these constraints using runtime type information + (RTTI). Therefore the generated code cannot be compiled with + RTTI disabled (via compiler options such as ‘-fno-rtti’). + + • Accepted Values: Boolean + + • Default Value: ‘false’ + + -- Directive: %define parse.error VERBOSITY + • Languages(s): all + • Purpose: Control the generation of syntax error messages. + *Note Error Reporting::. + • Accepted Values: + • ‘simple’ Error messages passed to ‘yyerror’ are simply + ‘"syntax error"’. + + • ‘detailed’ Error messages report the unexpected token, + and possibly the expected ones. However, this report can + often be incorrect when LAC is not enabled (*note LAC::). + Token name internationalization is supported. + + • ‘verbose’ Similar (but inferior) to ‘detailed’. The D + parser does not support this value. + + Error messages report the unexpected token, and possibly + the expected ones. However, this report can often be + incorrect when LAC is not enabled (*note LAC::). + + Does not support token internationalization. Using + non-ASCII characters in token aliases is not portable. + + • ‘custom’ The user is in charge of generating the syntax + error message by defining the ‘yyreport_syntax_error’ + function. *Note Syntax Error Reporting Function::. + + • Default Value: ‘simple’ + + • History: introduced in 3.0 with support for ‘simple’ and + ‘verbose’. Values ‘custom’ and ‘detailed’ were introduced in + 3.6. + + -- Directive: %define parse.lac WHEN + + • Languages(s): C/C++ (deterministic parsers only), D and Java. + + • Purpose: Enable LAC (lookahead correction) to improve syntax + error handling. *Note LAC::. + • Accepted Values: ‘none’, ‘full’ + • Default Value: ‘none’ + + -- Directive: %define parse.trace + + • Languages(s): C, C++, D, Java + + • Purpose: Require parser instrumentation for tracing. *Note + Tracing::. + + In C/C++, define the macro ‘YYDEBUG’ (or ‘PREFIXDEBUG’ with + ‘%define api.prefix {PREFIX}’), see *note Multiple Parsers::) + to 1 (if it is not already defined) so that the debugging + facilities are compiled. + + • Accepted Values: Boolean + + • Default Value: ‘false’ + + -- Directive: %define parser_class_name {NAME} + Obsoleted by ‘api.parser.class’ + + +File: bison.info, Node: %code Summary, Prev: %define Summary, Up: Declarations + +3.7.15 %code Summary +-------------------- + +The ‘%code’ directive inserts code verbatim into the output parser +source at any of a predefined set of locations. It thus serves as a +flexible and user-friendly alternative to the traditional Yacc prologue, +‘%{CODE%}’. This section summarizes the functionality of ‘%code’ for +the various target languages supported by Bison. For a detailed +discussion of how to use ‘%code’ in place of ‘%{CODE%}’ for C/C++ and +why it is advantageous to do so, *note Prologue Alternatives::. + + -- Directive: %code {CODE} + This is the unqualified form of the ‘%code’ directive. It inserts + CODE verbatim at a language-dependent default location in the + parser implementation. + + For C/C++, the default location is the parser implementation file + after the usual contents of the parser header file. Thus, the + unqualified form replaces ‘%{CODE%}’ for most purposes. + + For D and Java, the default location is inside the parser class. + + -- Directive: %code QUALIFIER {CODE} + This is the qualified form of the ‘%code’ directive. QUALIFIER + identifies the purpose of CODE and thus the location(s) where Bison + should insert it. That is, if you need to specify + location-sensitive CODE that does not belong at the default + location selected by the unqualified ‘%code’ form, use this form + instead. + + For any particular qualifier or for the unqualified form, if there +are multiple occurrences of the ‘%code’ directive, Bison concatenates +the specified code in the order in which it appears in the grammar file. + + Not all qualifiers are accepted for all target languages. Unaccepted +qualifiers produce an error. Some of the accepted qualifiers are: + +‘requires’ + + • Language(s): C, C++ + + • Purpose: This is the best place to write dependency code + required for the value and location types (‘YYSTYPE’ and + ‘YYLTYPE’ in C). In other words, it’s the best place to define + types referenced in ‘%union’ directives. In C, if you use + ‘#define’ to override Bison’s default ‘YYSTYPE’ and ‘YYLTYPE’ + definitions, then it is also the best place. However you + should rather ‘%define’ ‘api.value.type’ and + ‘api.location.type’. + + • Location(s): The parser header file and the parser + implementation file before the Bison-generated definitions of + the value and location types (‘YYSTYPE’ and ‘YYLTYPE’ in C). + +‘provides’ + + • Language(s): C, C++ + + • Purpose: This is the best place to write additional + definitions and declarations that should be provided to other + modules. + + • Location(s): The parser header file and the parser + implementation file after the Bison-generated value and + location types (‘YYSTYPE’ and ‘YYLTYPE’ in C), and token + definitions. + +‘top’ + + • Language(s): C, C++ + + • Purpose: The unqualified ‘%code’ or ‘%code requires’ should + usually be more appropriate than ‘%code top’. However, + occasionally it is necessary to insert code much nearer the + top of the parser implementation file. For example: + + %code top { + #define _GNU_SOURCE + #include + } + + • Location(s): Near the top of the parser implementation file. + +‘imports’ + + • Language(s): D, Java + + • Purpose: This is the best place to write Java import + directives. D syntax allows for import statements all + throughout the code. + + • Location(s): The parser Java file after any Java package + directive and before any class definitions. The parser D file + before any class definitions. + + Though we say the insertion locations are language-dependent, they +are technically skeleton-dependent. Writers of non-standard skeletons +however should choose their locations consistently with the behavior of +the standard Bison skeletons. + + +File: bison.info, Node: Multiple Parsers, Prev: Declarations, Up: Grammar File + +3.8 Multiple Parsers in the Same Program +======================================== + +Most programs that use Bison parse only one language and therefore +contain only one Bison parser. But what if you want to parse more than +one language with the same program? Then you need to avoid name +conflicts between different definitions of functions and variables such +as ‘yyparse’, ‘yylval’. To use different parsers from the same +compilation unit, you also need to avoid conflicts on types and macros +(e.g., ‘YYSTYPE’) exported in the generated header. + + The easy way to do this is to define the ‘%define’ variable +‘api.prefix’. With different ‘api.prefix’s it is guaranteed that +headers do not conflict when included together, and that compiled +objects can be linked together too. Specifying ‘%define api.prefix +{PREFIX}’ (or passing the option ‘-Dapi.prefix={PREFIX}’, see *note +Invocation::) renames the interface functions and variables of the Bison +parser to start with PREFIX instead of ‘yy’, and all the macros to start +by PREFIX (i.e., PREFIX upper-cased) instead of ‘YY’. + + The renamed symbols include ‘yyparse’, ‘yylex’, ‘yyerror’, ‘yynerrs’, +‘yylval’, ‘yylloc’, ‘yychar’ and ‘yydebug’. If you use a push parser, +‘yypush_parse’, ‘yypull_parse’, ‘yypstate’, ‘yypstate_new’ and +‘yypstate_delete’ will also be renamed. The renamed macros include +‘YYSTYPE’, ‘YYLTYPE’, and ‘YYDEBUG’, which is treated specifically — +more about this below. + + For example, if you use ‘%define api.prefix {c}’, the names become +‘cparse’, ‘clex’, ..., ‘CSTYPE’, ‘CLTYPE’, and so on. + + Users of Flex must update the signature of the generated ‘yylex’ +function. Since the Flex scanner usually includes the generated header +of the parser (to get the definitions of the tokens, etc.), the most +convenient way is to insert the declaration of ‘yylex’ in the ‘provides’ +section: + + %define api.prefix {c} + // Emitted in the header file, after the definition of YYSTYPE. + %code provides + { + // Tell Flex the expected prototype of yylex. + #define YY_DECL \ + int clex (CSTYPE *yylval, CLTYPE *yylloc) + + // Declare the scanner. + YY_DECL; + } + + + The ‘%define’ variable ‘api.prefix’ works in two different ways. In +the implementation file, it works by adding macro definitions to the +beginning of the parser implementation file, defining ‘yyparse’ as +‘PREFIXparse’, and so on: + + #define YYSTYPE CTYPE + #define yyparse cparse + #define yylval clval + ... + YYSTYPE yylval; + int yyparse (void); + + This effectively substitutes one name for the other in the entire +parser implementation file, thus the “original” names (‘yylex’, +‘YYSTYPE’, ...) are also usable in the parser implementation file. + + However, in the parser header file, the symbols are defined renamed, +for instance: + + extern CSTYPE clval; + int cparse (void); + + The macro ‘YYDEBUG’ is commonly used to enable the tracing support in +parsers. To comply with this tradition, when ‘api.prefix’ is used, +‘YYDEBUG’ (not renamed) is used as a default value: + + /* Debug traces. */ + #ifndef CDEBUG + # if defined YYDEBUG + # if YYDEBUG + # define CDEBUG 1 + # else + # define CDEBUG 0 + # endif + # else + # define CDEBUG 0 + # endif + #endif + #if CDEBUG + extern int cdebug; + #endif + + + + Prior to Bison 2.6, a feature similar to ‘api.prefix’ was provided by +the obsolete directive ‘%name-prefix’ (*note Table of Symbols::) and the +option ‘--name-prefix’ (*note Output Files::). + + +File: bison.info, Node: Interface, Next: Algorithm, Prev: Grammar File, Up: Top + +4 Parser C-Language Interface +***************************** + +The Bison parser is actually a C function named ‘yyparse’. Here we +describe the interface conventions of ‘yyparse’ and the other functions +that it needs to use. + + Keep in mind that the parser uses many C identifiers starting with +‘yy’ and ‘YY’ for internal purposes. If you use such an identifier +(aside from those in this manual) in an action or in epilogue in the +grammar file, you are likely to run into trouble. + +* Menu: + +* Parser Function:: How to call ‘yyparse’ and what it returns. +* Push Parser Interface:: How to create, use, and destroy push parsers. +* Lexical:: You must supply a function ‘yylex’ + which reads tokens. +* Error Reporting:: Passing error messages to the user. +* Action Features:: Special features for use in actions. +* Internationalization:: How to let the parser speak in the user’s + native language. + + +File: bison.info, Node: Parser Function, Next: Push Parser Interface, Up: Interface + +4.1 The Parser Function ‘yyparse’ +================================= + +You call the function ‘yyparse’ to cause parsing to occur. This +function reads tokens, executes actions, and ultimately returns when it +encounters end-of-input or an unrecoverable syntax error. You can also +write an action which directs ‘yyparse’ to return immediately without +reading further. + + -- Function: int yyparse (void) + The value returned by ‘yyparse’ is 0 if parsing was successful + (return is due to end-of-input). + + The value is 1 if parsing failed because of invalid input, i.e., + input that contains a syntax error or that causes ‘YYABORT’ to be + invoked. + + The value is 2 if parsing failed due to memory exhaustion. + + In an action, you can cause immediate return from ‘yyparse’ by using +these macros: + + -- Macro: YYACCEPT + Return immediately with value 0 (to report success). + + -- Macro: YYABORT + Return immediately with value 1 (to report failure). + + -- Macro: YYNOMEM + Return immediately with value 2 (to report memory exhaustion). + + If you use a reentrant parser, you can optionally pass additional +parameter information to it in a reentrant way. To do so, use the +declaration ‘%parse-param’: + + -- Directive: %parse-param {ARGUMENT-DECLARATION} ... + Declare that one or more ARGUMENT-DECLARATION are additional + ‘yyparse’ arguments. The ARGUMENT-DECLARATION is used when + declaring functions or prototypes. The last identifier in + ARGUMENT-DECLARATION must be the argument name. + + Here’s an example. Write this in the parser: + + %parse-param {int *nastiness} {int *randomness} + +Then call the parser like this: + + { + int nastiness, randomness; + ... /* Store proper data in ‘nastiness’ and ‘randomness’. */ + value = yyparse (&nastiness, &randomness); + ... + } + +In the grammar actions, use expressions like this to refer to the data: + + exp: ... { ...; *randomness += 1; ... } + +Using the following: + %parse-param {int *randomness} + + Results in these signatures: + void yyerror (int *randomness, const char *msg); + int yyparse (int *randomness); + +Or, if both ‘%define api.pure full’ (or just ‘%define api.pure’) and +‘%locations’ are used: + + void yyerror (YYLTYPE *llocp, int *randomness, const char *msg); + int yyparse (int *randomness); + + +File: bison.info, Node: Push Parser Interface, Next: Lexical, Prev: Parser Function, Up: Interface + +4.2 Push Parser Interface +========================= + +You call the function ‘yypstate_new’ to create a new parser instance. +This function is available if either the ‘%define api.push-pull push’ or +‘%define api.push-pull both’ declaration is used. *Note Push Decl::. + + -- Function: yypstate* yypstate_new (void) + Return a valid parser instance if there is memory available, 0 + otherwise. In impure mode, it will also return 0 if a parser + instance is currently allocated. + + You call the function ‘yypstate_delete’ to delete a parser instance. +function is available if either the ‘%define api.push-pull push’ or +‘%define api.push-pull both’ declaration is used. *Note Push Decl::. + + -- Function: void yypstate_delete (yypstate *YYPS) + Reclaim the memory associated with a parser instance. After this + call, you should no longer attempt to use the parser instance. + + You call the function ‘yypush_parse’ to parse a single token. This +function is available if either the ‘%define api.push-pull push’ or +‘%define api.push-pull both’ declaration is used. *Note Push Decl::. + + -- Function: int yypush_parse (yypstate *YYPS) + The value returned by ‘yypush_parse’ is the same as for ‘yyparse’ + with the following exception: it returns ‘YYPUSH_MORE’ if more + input is required to finish parsing the grammar. + + After ‘yypush_parse’ returned, the instance may be consulted. For + instance check ‘yynerrs’ to see whether there were (possibly + recovered) syntax errors. + + After ‘yypush_parse’ returns a status other than ‘YYPUSH_MORE’, the + parser instance ‘yyps’ may be reused for a new parse. + + The fact that the parser state is reusable even after an error +simplifies reuse. For example, a calculator application which parses +each input line as an expression can just keep reusing the same ‘yyps’ +even if an input was invalid. + + You call the function ‘yypull_parse’ to parse the rest of the input +stream. This function is available if the ‘%define api.push-pull both’ +declaration is used. *Note Push Decl::. + + -- Function: int yypull_parse (yypstate *YYPS) + The value returned by ‘yypull_parse’ is the same as for ‘yyparse’. + + The parser instance ‘yyps’ may be reused for new parses. + + -- Function: int yypstate_expected_tokens (const yypstate *yyps, + yysymbol_kind_t ARGV[], int ARGC) + Fill ARGV with the expected tokens, which never includes + ‘YYSYMBOL_YYEMPTY’, ‘YYSYMBOL_YYerror’, or ‘YYSYMBOL_YYUNDEF’. + + Never put more than ARGC elements into ARGV, and on success return + the number of tokens stored in ARGV. If there are more expected + tokens than ARGC, fill ARGV up to ARGC and return 0. If there are + no expected tokens, also return 0, but set ‘argv[0]’ to + ‘YYSYMBOL_YYEMPTY’. + + When LAC is enabled, may return a negative number on errors, such + as ‘YYENOMEM’ on memory exhaustion. + + If ARGV is null, return the size needed to store all the possible + values, which is always less than ‘YYNTOKENS’. + + +File: bison.info, Node: Lexical, Next: Error Reporting, Prev: Push Parser Interface, Up: Interface + +4.3 The Lexical Analyzer Function ‘yylex’ +========================================= + +The “lexical analyzer” function, ‘yylex’, recognizes tokens from the +input stream and returns them to the parser. Bison does not create this +function automatically; you must write it so that ‘yyparse’ can call it. +The function is sometimes referred to as a lexical scanner. + + In simple programs, ‘yylex’ is often defined at the end of the Bison +grammar file. If ‘yylex’ is defined in a separate source file, you need +to arrange for the token-kind definitions to be available there. To do +this, use the ‘-d’ option when you run Bison, so that it will write +these definitions into the separate parser header file, ‘NAME.tab.h’, +which you can include in the other source files that need it. *Note +Invocation::. + +* Menu: + +* Calling Convention:: How ‘yyparse’ calls ‘yylex’. +* Special Tokens:: Signaling end-of-file and errors to the parser. +* Tokens from Literals:: Finding token kinds from string aliases. +* Token Values:: How ‘yylex’ must return the semantic value + of the token it has read. +* Token Locations:: How ‘yylex’ must return the text location + (line number, etc.) of the token, if the + actions want that. +* Pure Calling:: How the calling convention differs in a pure parser + (*note Pure Decl::). + + +File: bison.info, Node: Calling Convention, Next: Special Tokens, Up: Lexical + +4.3.1 Calling Convention for ‘yylex’ +------------------------------------ + +The value that ‘yylex’ returns must be the positive numeric code for the +kind of token it has just found; a zero or negative value signifies +end-of-input. + + When a token kind is referred to in the grammar rules by a name, that +name in the parser implementation file becomes an enumerator of the enum +‘yytoken_kind_t’ whose definition is the proper numeric code for that +token kind. So ‘yylex’ should use the name to indicate that type. +*Note Symbols::. + + When a token is referred to in the grammar rules by a character +literal, the numeric code for that character is also the code for the +token kind. So ‘yylex’ can simply return that character code, possibly +converted to ‘unsigned char’ to avoid sign-extension. The null +character must not be used this way, because its code is zero and that +signifies end-of-input. + + Here is an example showing these things: + + int + yylex (void) + { + ... + if (c == EOF) /* Detect end-of-input. */ + return YYEOF; + ... + else if (c == '+' || c == '-') + return c; /* Assume token kind for '+' is '+'. */ + ... + else + return INT; /* Return the kind of the token. */ + ... + } + +This interface has been designed so that the output from the ‘lex’ +utility can be used without change as the definition of ‘yylex’. + + +File: bison.info, Node: Special Tokens, Next: Tokens from Literals, Prev: Calling Convention, Up: Lexical + +4.3.2 Special Tokens +-------------------- + +In addition to the user defined tokens, Bison generates a few special +tokens that ‘yylex’ may return. + + The ‘YYEOF’ token denotes the end of file, and signals to the parser +that there is nothing left afterwards. *Note Calling Convention::, for +an example. + + Returning ‘YYUNDEF’ tells the parser that some lexical error was +found. It will emit an error message about an “invalid token”, and +enter error-recovery (*note Error Recovery::). Returning an unknown +token kind results in the exact same behavior. + + Returning ‘YYerror’ requires the parser to enter error-recovery +_without_ emitting an error message. This way the lexical analyzer can +produce an accurate error messages about the invalid input (something +the parser cannot do), and yet benefit from the error-recovery features +of the parser. + + int + yylex (void) + { + ... + switch (c) + { + ... + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + ... + return TOK_NUM; + ... + case EOF: + return YYEOF; + default: + yyerror ("syntax error: invalid character: %c", c); + return YYerror; + } + } + + +File: bison.info, Node: Tokens from Literals, Next: Token Values, Prev: Special Tokens, Up: Lexical + +4.3.3 Finding Tokens by String Literals +--------------------------------------- + +If the grammar uses literal string tokens, there are two ways that +‘yylex’ can determine the token kind codes for them: + + • If the grammar defines symbolic token names as aliases for the + literal string tokens, ‘yylex’ can use these symbolic names like + all others. In this case, the use of the literal string tokens in + the grammar file has no effect on ‘yylex’. + + This is the preferred approach. + + • ‘yylex’ can search for the multicharacter token in the ‘yytname’ + table. This method is discouraged: the primary purpose of string + aliases is forging good error messages, not describing the spelling + of keywords. In addition, looking for the token kind at runtime + incurs a (small but noticeable) cost. + + The ‘yytname’ table is generated only if you use the ‘%token-table’ + declaration. *Note Decl Summary::. + + +File: bison.info, Node: Token Values, Next: Token Locations, Prev: Tokens from Literals, Up: Lexical + +4.3.4 Semantic Values of Tokens +------------------------------- + +In an ordinary (nonreentrant) parser, the semantic value of the token +must be stored into the global variable ‘yylval’. When you are using +just one data type for semantic values, ‘yylval’ has that type. Thus, +if the type is ‘int’ (the default), you might write this in ‘yylex’: + + ... + yylval = value; /* Put value onto Bison stack. */ + return INT; /* Return the kind of the token. */ + ... + + When you are using multiple data types, ‘yylval’’s type is a union +made from the ‘%union’ declaration (*note Union Decl::). So when you +store a token’s value, you must use the proper member of the union. If +the ‘%union’ declaration looks like this: + + %union { + int intval; + double val; + symrec *tptr; + } + +then the code in ‘yylex’ might look like this: + + ... + yylval.intval = value; /* Put value onto Bison stack. */ + return INT; /* Return the kind of the token. */ + ... + + +File: bison.info, Node: Token Locations, Next: Pure Calling, Prev: Token Values, Up: Lexical + +4.3.5 Textual Locations of Tokens +--------------------------------- + +If you are using the ‘@N’-feature (*note Tracking Locations::) in +actions to keep track of the textual locations of tokens and groupings, +then you must provide this information in ‘yylex’. The function +‘yyparse’ expects to find the textual location of a token just parsed in +the global variable ‘yylloc’. So ‘yylex’ must store the proper data in +that variable. + + By default, the value of ‘yylloc’ is a structure and you need only +initialize the members that are going to be used by the actions. The +four members are called ‘first_line’, ‘first_column’, ‘last_line’ and +‘last_column’. Note that the use of this feature makes the parser +noticeably slower. + + The data type of ‘yylloc’ has the name ‘YYLTYPE’. + + +File: bison.info, Node: Pure Calling, Prev: Token Locations, Up: Lexical + +4.3.6 Calling Conventions for Pure Parsers +------------------------------------------ + +When you use the Bison declaration ‘%define api.pure full’ to request a +pure, reentrant parser, the global communication variables ‘yylval’ and +‘yylloc’ cannot be used. (*Note Pure Decl::.) In such parsers the two +global variables are replaced by pointers passed as arguments to +‘yylex’. You must declare them as shown here, and pass the information +back by storing it through those pointers. + + int + yylex (YYSTYPE *lvalp, YYLTYPE *llocp) + { + ... + *lvalp = value; /* Put value onto Bison stack. */ + return INT; /* Return the kind of the token. */ + ... + } + + If the grammar file does not use the ‘@’ constructs to refer to +textual locations, then the type ‘YYLTYPE’ will not be defined. In this +case, omit the second argument; ‘yylex’ will be called with only one +argument. + + If you wish to pass additional arguments to ‘yylex’, use ‘%lex-param’ +just like ‘%parse-param’ (*note Parser Function::). To pass additional +arguments to both ‘yylex’ and ‘yyparse’, use ‘%param’. + + -- Directive: %lex-param {ARGUMENT-DECLARATION} ... + Specify that ARGUMENT-DECLARATION are additional ‘yylex’ argument + declarations. You may pass one or more such declarations, which is + equivalent to repeating ‘%lex-param’. + + -- Directive: %param {ARGUMENT-DECLARATION} ... + Specify that ARGUMENT-DECLARATION are additional ‘yylex’/‘yyparse’ + argument declaration. This is equivalent to ‘%lex-param + {ARGUMENT-DECLARATION} ... %parse-param {ARGUMENT-DECLARATION} + ...’. You may pass one or more declarations, which is equivalent + to repeating ‘%param’. + +For instance: + + %lex-param {scanner_mode *mode} + %parse-param {parser_mode *mode} + %param {environment_type *env} + +results in the following signatures: + + int yylex (scanner_mode *mode, environment_type *env); + int yyparse (parser_mode *mode, environment_type *env); + + If ‘%define api.pure full’ is added: + + int yylex (YYSTYPE *lvalp, scanner_mode *mode, environment_type *env); + int yyparse (parser_mode *mode, environment_type *env); + +and finally, if both ‘%define api.pure full’ and ‘%locations’ are used: + + int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, + scanner_mode *mode, environment_type *env); + int yyparse (parser_mode *mode, environment_type *env); + + +File: bison.info, Node: Error Reporting, Next: Action Features, Prev: Lexical, Up: Interface + +4.4 Error Reporting +=================== + +During its execution the parser may have error messages to pass to the +user, such as syntax error, or memory exhaustion. How this message is +delivered to the user must be specified by the developer. + +* Menu: + +* Error Reporting Function:: You must supply a ‘yyerror’ function. +* Syntax Error Reporting Function:: You can supply a ‘yyreport_syntax_error’ function. + + +File: bison.info, Node: Error Reporting Function, Next: Syntax Error Reporting Function, Up: Error Reporting + +4.4.1 The Error Reporting Function ‘yyerror’ +-------------------------------------------- + +The Bison parser detects a “syntax error” (or “parse error”) whenever it +reads a token which cannot satisfy any syntax rule. An action in the +grammar can also explicitly proclaim an error, using the macro ‘YYERROR’ +(*note Action Features::). + + The Bison parser expects to report the error by calling an error +reporting function named ‘yyerror’, which you must supply. It is called +by ‘yyparse’ whenever a syntax error is found, and it receives one +argument. For a syntax error, the string is normally ‘"syntax error"’. + + If you invoke ‘%define parse.error detailed’ (or ‘custom’) in the +Bison declarations section (*note Bison Declarations::), then Bison +provides a more verbose and specific error message string instead of +just plain ‘"syntax error"’. However, that message sometimes contains +incorrect information if LAC is not enabled (*note LAC::). + + The parser can detect one other kind of error: memory exhaustion. +This can happen when the input contains constructions that are very +deeply nested. It isn’t likely you will encounter this, since the Bison +parser normally extends its stack automatically up to a very large +limit. But if memory is exhausted, ‘yyparse’ calls ‘yyerror’ in the +usual fashion, except that the argument string is ‘"memory exhausted"’. + + In some cases diagnostics like ‘"syntax error"’ are translated +automatically from English to some other language before they are passed +to ‘yyerror’. *Note Internationalization::. + + The following definition suffices in simple programs: + + void + yyerror (char const *s) + { + fprintf (stderr, "%s\n", s); + } + + After ‘yyerror’ returns to ‘yyparse’, the latter will attempt error +recovery if you have written suitable error recovery grammar rules +(*note Error Recovery::). If recovery is impossible, ‘yyparse’ will +immediately return 1. + + Obviously, in location tracking pure parsers, ‘yyerror’ should have +an access to the current location. With ‘%define api.pure’, this is +indeed the case for the GLR parsers, but not for the Yacc parser, for +historical reasons, and this is the why ‘%define api.pure full’ should +be preferred over ‘%define api.pure’. + + When ‘%locations %define api.pure full’ is used, ‘yyerror’ has the +following signature: + + void yyerror (YYLTYPE *locp, char const *msg); + +The prototypes are only indications of how the code produced by Bison +uses ‘yyerror’. Bison-generated code always ignores the returned value, +so ‘yyerror’ can return any type, including ‘void’. Also, ‘yyerror’ can +be a variadic function; that is why the message is always passed last. + + Traditionally ‘yyerror’ returns an ‘int’ that is always ignored, but +this is purely for historical reasons, and ‘void’ is preferable since it +more accurately describes the return type for ‘yyerror’. + + The variable ‘yynerrs’ contains the number of syntax errors reported +so far. Normally this variable is global; but if you request a pure +parser (*note Pure Decl::) then it is a local variable which only the +actions can access. + + +File: bison.info, Node: Syntax Error Reporting Function, Prev: Error Reporting Function, Up: Error Reporting + +4.4.2 The Syntax Error Reporting Function ‘yyreport_syntax_error’ +----------------------------------------------------------------- + +If you invoke ‘%define parse.error custom’ (*note Bison Declarations::), +then the parser no longer passes syntax error messages to ‘yyerror’, +rather it delegates that task to the user by calling the +‘yyreport_syntax_error’ function. + + The following functions and types are “‘static’”: they are defined in +the implementation file (‘*.c’) and available only from there. They are +meant to be used from the grammar’s epilogue. + + -- Function: static int yyreport_syntax_error (const yypcontext_t *CTX) + Report a syntax error to the user. Return 0 on success, ‘YYENOMEM’ + on memory exhaustion. Whether it uses ‘yyerror’ is up to the user. + + Use the following types and functions to build the error message. + + -- Type: yypcontext_t + An opaque type that captures the circumstances of the syntax error. + + -- Type: yysymbol_kind_t + An enum of all the grammar symbols, tokens and nonterminals. Its + enumerators are forged from the symbol names: + + enum yysymbol_kind_t + { + YYSYMBOL_YYEMPTY = -2, /* No symbol. */ + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_PLUS = 3, /* "+" */ + YYSYMBOL_MINUS = 4, /* "-" */ + [...] + YYSYMBOL_VAR = 14, /* "variable" */ + YYSYMBOL_NEG = 15, /* NEG */ + YYSYMBOL_YYACCEPT = 16, /* $accept */ + YYSYMBOL_exp = 17, /* exp */ + YYSYMBOL_input = 18 /* input */ + }; + typedef enum yysymbol_kind_t yysymbol_kind_t; + + -- Function: static yysymbol_kind_t yypcontext_token (const + yypcontext_t *CTX) + The “unexpected” token: the symbol kind of the lookahead token that + caused the syntax error. Returns ‘YYSYMBOL_YYEMPTY’ if there is no + lookahead. + + -- Function: static YYLTYPE * yypcontext_location (const yypcontext_t + *CTX) + The location of the syntax error (that of the unexpected token). + + -- Function: static int yypcontext_expected_tokens (const yypcontext_t + *ctx, yysymbol_kind_t ARGV[], int ARGC) + Fill ARGV with the expected tokens, which never includes + ‘YYSYMBOL_YYEMPTY’, ‘YYSYMBOL_YYerror’, or ‘YYSYMBOL_YYUNDEF’. + + Never put more than ARGC elements into ARGV, and on success return + the number of tokens stored in ARGV. If there are more expected + tokens than ARGC, fill ARGV up to ARGC and return 0. If there are + no expected tokens, also return 0, but set ‘argv[0]’ to + ‘YYSYMBOL_YYEMPTY’. + + When LAC is enabled, may return a negative number on errors, such + as ‘YYENOMEM’ on memory exhaustion. + + If ARGV is null, return the size needed to store all the possible + values, which is always less than ‘YYNTOKENS’. + + -- Function: static const char * yysymbol_name (symbol_kind_t SYMBOL) + The name of the symbol whose kind is SYMBOL, possibly translated. + + A custom syntax error function looks as follows. This implementation +is inappropriate for internationalization, see the ‘c/bistromathic’ +example for a better alternative. + + static int + yyreport_syntax_error (const yypcontext_t *ctx) + { + int res = 0; + YYLOCATION_PRINT (stderr, *yypcontext_location (ctx)); + fprintf (stderr, ": syntax error"); + // Report the tokens expected at this point. + { + enum { TOKENMAX = 5 }; + yysymbol_kind_t expected[TOKENMAX]; + int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); + if (n < 0) + // Forward errors to yyparse. + res = n; + else + for (int i = 0; i < n; ++i) + fprintf (stderr, "%s %s", + i == 0 ? ": expected" : " or", yysymbol_name (expected[i])); + } + // Report the unexpected token. + { + yysymbol_kind_t lookahead = yypcontext_token (ctx); + if (lookahead != YYSYMBOL_YYEMPTY) + fprintf (stderr, " before %s", yysymbol_name (lookahead)); + } + fprintf (stderr, "\n"); + return res; + } + + You still must provide a ‘yyerror’ function, used for instance to +report memory exhaustion. + + +File: bison.info, Node: Action Features, Next: Internationalization, Prev: Error Reporting, Up: Interface + +4.5 Special Features for Use in Actions +======================================= + +Here is a table of Bison constructs, variables and macros that are +useful in actions. + + -- Variable: $$ + Acts like a variable that contains the semantic value for the + grouping made by the current rule. *Note Actions::. + + -- Variable: $N + Acts like a variable that contains the semantic value for the Nth + component of the current rule. *Note Actions::. + + -- Variable: $$ + Like ‘$$’ but specifies alternative TYPEALT in the union specified + by the ‘%union’ declaration. *Note Action Types::. + + -- Variable: $N + Like ‘$N’ but specifies alternative TYPEALT in the union specified + by the ‘%union’ declaration. *Note Action Types::. + + -- Macro: YYABORT ; + Return immediately from ‘yyparse’, indicating failure. *Note + Parser Function::. + + -- Macro: YYACCEPT ; + Return immediately from ‘yyparse’, indicating success. *Note + Parser Function::. + + -- Macro: YYBACKUP (TOKEN, VALUE); + Unshift a token. This macro is allowed only for rules that reduce + a single value, and only when there is no lookahead token. It is + also disallowed in GLR parsers. It installs a lookahead token with + token kind TOKEN and semantic value VALUE; then it discards the + value that was going to be reduced by this rule. + + If the macro is used when it is not valid, such as when there is a + lookahead token already, then it reports a syntax error with a + message ‘cannot back up’ and performs ordinary error recovery. + + In either case, the rest of the action is not executed. + + -- Value: YYEMPTY + Value stored in ‘yychar’ when there is no lookahead token. + + -- Value: YYEOF + Value stored in ‘yychar’ when the lookahead is the end of the input + stream. + + -- Macro: YYERROR ; + Cause an immediate syntax error. This statement initiates error + recovery just as if the parser itself had detected an error; + however, it does not call ‘yyerror’, and does not print any + message. If you want to print an error message, call ‘yyerror’ + explicitly before the ‘YYERROR;’ statement. *Note Error + Recovery::. + + -- Macro: YYNOMEM ; + Return immediately from ‘yyparse’, indicating memory exhaustion. + *Note Parser Function::. + + -- Macro: YYRECOVERING + The expression ‘YYRECOVERING ()’ yields 1 when the parser is + recovering from a syntax error, and 0 otherwise. *Note Error + Recovery::. + + -- Variable: yychar + Variable containing either the lookahead token, or ‘YYEOF’ when the + lookahead is the end of the input stream, or ‘YYEMPTY’ when no + lookahead has been performed so the next token is not yet known. + Do not modify ‘yychar’ in a deferred semantic action (*note GLR + Semantic Actions::). *Note Lookahead::. + + -- Macro: yyclearin ; + Discard the current lookahead token. This is useful primarily in + error rules. Do not invoke ‘yyclearin’ in a deferred semantic + action (*note GLR Semantic Actions::). *Note Error Recovery::. + + -- Macro: yyerrok ; + Resume generating error messages immediately for subsequent syntax + errors. This is useful primarily in error rules. *Note Error + Recovery::. + + -- Variable: yylloc + Variable containing the lookahead token location when ‘yychar’ is + not set to ‘YYEMPTY’ or ‘YYEOF’. Do not modify ‘yylloc’ in a + deferred semantic action (*note GLR Semantic Actions::). *Note + Actions and Locations::. + + -- Variable: yylval + Variable containing the lookahead token semantic value when + ‘yychar’ is not set to ‘YYEMPTY’ or ‘YYEOF’. Do not modify + ‘yylval’ in a deferred semantic action (*note GLR Semantic + Actions::). *Note Actions::. + + -- Value: @$ + Acts like a structure variable containing information on the + textual location of the grouping made by the current rule. *Note + Tracking Locations::. + + -- Value: @N + Acts like a structure variable containing information on the + textual location of the Nth component of the current rule. *Note + Tracking Locations::. + + +File: bison.info, Node: Internationalization, Prev: Action Features, Up: Interface + +4.6 Parser Internationalization +=============================== + +A Bison-generated parser can print diagnostics, including error and +tracing messages. By default, they appear in English. However, Bison +also supports outputting diagnostics in the user’s native language. To +make this work, the user should set the usual environment variables. +*Note The User’s View: (gettext)Users. For example, the shell command +‘export LC_ALL=fr_CA.UTF-8’ might set the user’s locale to French +Canadian using the UTF-8 encoding. The exact set of available locales +depends on the user’s installation. + +* Menu: + +* Enabling I18n:: Preparing your project to support internationalization. +* Token I18n:: Preparing tokens for internationalization in error messages. + + +File: bison.info, Node: Enabling I18n, Next: Token I18n, Up: Internationalization + +4.6.1 Enabling Internationalization +----------------------------------- + +The maintainer of a package that uses a Bison-generated parser enables +the internationalization of the parser’s output through the following +steps. Here we assume a package that uses GNU Autoconf and GNU +Automake. + + 1. Into the directory containing the GNU Autoconf macros used by the + package —often called ‘m4’— copy the ‘bison-i18n.m4’ file installed + by Bison under ‘share/aclocal/bison-i18n.m4’ in Bison’s + installation directory. For example: + + cp /usr/local/share/aclocal/bison-i18n.m4 m4/bison-i18n.m4 + + 2. In the top-level ‘configure.ac’, after the ‘AM_GNU_GETTEXT’ + invocation, add an invocation of ‘BISON_I18N’. This macro is + defined in the file ‘bison-i18n.m4’ that you copied earlier. It + causes ‘configure’ to find the value of the ‘BISON_LOCALEDIR’ + variable, and it defines the source-language symbol ‘YYENABLE_NLS’ + to enable translations in the Bison-generated parser. + + 3. In the ‘main’ function of your program, designate the directory + containing Bison’s runtime message catalog, through a call to + ‘bindtextdomain’ with domain name ‘bison-runtime’. For example: + + bindtextdomain ("bison-runtime", BISON_LOCALEDIR); + + Typically this appears after any other call ‘bindtextdomain + (PACKAGE, LOCALEDIR)’ that your package already has. Here we rely + on ‘BISON_LOCALEDIR’ to be defined as a string through the + ‘Makefile’. + + 4. In the ‘Makefile.am’ that controls the compilation of the ‘main’ + function, make ‘BISON_LOCALEDIR’ available as a C preprocessor + macro, either in ‘DEFS’ or in ‘AM_CPPFLAGS’. For example: + + DEFS = @DEFS@ -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + or: + + AM_CPPFLAGS = -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"' + + 5. Finally, invoke the command ‘autoreconf’ to generate the build + infrastructure. + + +File: bison.info, Node: Token I18n, Prev: Enabling I18n, Up: Internationalization + +4.6.2 Token Internationalization +-------------------------------- + +When the ‘%define’ variable ‘parse.error’ is set to ‘custom’ or +‘detailed’, token aliases can be internationalized: + + %token + '\n' _("end of line") + + NUM _("number") + + FUN _("function") + VAR _("variable") + + The remainder of the grammar may freely use either the token symbol +(‘FUN’) or its alias (‘"function"’), but not with the +internationalization marker (‘_("function")’). + + If at least one token alias is internationalized, then the generated +parser will use both ‘N_’ and ‘_’, that must be defined (*note The +Programmer’s View: (gettext)Programmers.). They are used only on string +aliases marked for translation. In other words, even if your catalog +features a translation for “function”, then with + + %token + + FUN "function" + VAR _("variable") + +“function” will appear untranslated in debug traces and error messages. + + Unless defined by the user, the end-of-file token, ‘YYEOF’, is +provided “end of file” as an alias. It is also internationalized if the +user internationalized tokens. To map it to another string, use: + + %token END 0 _("end of input") + + +File: bison.info, Node: Algorithm, Next: Error Recovery, Prev: Interface, Up: Top + +5 The Bison Parser Algorithm +**************************** + +As Bison reads tokens, it pushes them onto a stack along with their +semantic values. The stack is called the “parser stack”. Pushing a +token is traditionally called “shifting”. + + For example, suppose the infix calculator has read ‘1 + 5 *’, with a +‘3’ to come. The stack will have four elements, one for each token that +was shifted. + + But the stack does not always have an element for each token read. +When the last N tokens and groupings shifted match the components of a +grammar rule, they can be combined according to that rule. This is +called “reduction”. Those tokens and groupings are replaced on the +stack by a single grouping whose symbol is the result (left hand side) +of that rule. Running the rule’s action is part of the process of +reduction, because this is what computes the semantic value of the +resulting grouping. + + For example, if the infix calculator’s parser stack contains this: + + 1 + 5 * 3 + +and the next input token is a newline character, then the last three +elements can be reduced to 15 via the rule: + + expr: expr '*' expr; + +Then the stack contains just these three elements: + + 1 + 15 + +At this point, another reduction can be made, resulting in the single +value 16. Then the newline token can be shifted. + + The parser tries, by shifts and reductions, to reduce the entire +input down to a single grouping whose symbol is the grammar’s +start-symbol (*note Language and Grammar::). + + This kind of parser is known in the literature as a bottom-up parser. + +* Menu: + +* Lookahead:: Parser looks one token ahead when deciding what to do. +* Shift/Reduce:: Conflicts: when either shifting or reduction is valid. +* Precedence:: Operator precedence works by resolving conflicts. +* Contextual Precedence:: When an operator’s precedence depends on context. +* Parser States:: The parser is a finite-state-machine with stack. +* Reduce/Reduce:: When two rules are applicable in the same situation. +* Mysterious Conflicts:: Conflicts that look unjustified. +* Tuning LR:: How to tune fundamental aspects of LR-based parsing. +* Generalized LR Parsing:: Parsing arbitrary context-free grammars. +* Memory Management:: What happens when memory is exhausted. How to avoid it. + + +File: bison.info, Node: Lookahead, Next: Shift/Reduce, Up: Algorithm + +5.1 Lookahead Tokens +==================== + +The Bison parser does _not_ always reduce immediately as soon as the +last N tokens and groupings match a rule. This is because such a simple +strategy is inadequate to handle most languages. Instead, when a +reduction is possible, the parser sometimes “looks ahead” at the next +token in order to decide what to do. + + When a token is read, it is not immediately shifted; first it becomes +the “lookahead token”, which is not on the stack. Now the parser can +perform one or more reductions of tokens and groupings on the stack, +while the lookahead token remains off to the side. When no more +reductions should take place, the lookahead token is shifted onto the +stack. This does not mean that all possible reductions have been done; +depending on the token kind of the lookahead token, some rules may +choose to delay their application. + + Here is a simple case where lookahead is needed. These three rules +define expressions which contain binary addition operators and postfix +unary factorial operators (‘!’), and allow parentheses for grouping. + + expr: + term '+' expr + | term + ; + + term: + '(' expr ')' + | term '!' + | "number" + ; + + Suppose that the tokens ‘1 + 2’ have been read and shifted; what +should be done? If the following token is ‘)’, then the first three +tokens must be reduced to form an ‘expr’. This is the only valid +course, because shifting the ‘)’ would produce a sequence of symbols +‘term ')'’, and no rule allows this. + + If the following token is ‘!’, then it must be shifted immediately so +that ‘2 !’ can be reduced to make a ‘term’. If instead the parser were +to reduce before shifting, ‘1 + 2’ would become an ‘expr’. It would +then be impossible to shift the ‘!’ because doing so would produce on +the stack the sequence of symbols ‘expr '!'’. No rule allows that +sequence. + + The lookahead token is stored in the variable ‘yychar’. Its semantic +value and location, if any, are stored in the variables ‘yylval’ and +‘yylloc’. *Note Action Features::. + + +File: bison.info, Node: Shift/Reduce, Next: Precedence, Prev: Lookahead, Up: Algorithm + +5.2 Shift/Reduce Conflicts +========================== + +Suppose we are parsing a language which has if-then and if-then-else +statements, with a pair of rules like this: + + if_stmt: + "if" expr "then" stmt + | "if" expr "then" stmt "else" stmt + ; + +Here ‘"if"’, ‘"then"’ and ‘"else"’ are terminal symbols for specific +keyword tokens. + + When the ‘"else"’ token is read and becomes the lookahead token, the +contents of the stack (assuming the input is valid) are just right for +reduction by the first rule. But it is also legitimate to shift the +‘"else"’, because that would lead to eventual reduction by the second +rule. + + This situation, where either a shift or a reduction would be valid, +is called a “shift/reduce conflict”. Bison is designed to resolve these +conflicts by choosing to shift, unless otherwise directed by operator +precedence declarations. To see the reason for this, let’s contrast it +with the other alternative. + + Since the parser prefers to shift the ‘"else"’, the result is to +attach the else-clause to the innermost if-statement, making these two +inputs equivalent: + + if x then if y then win; else lose; + + if x then do; if y then win; else lose; end; + + But if the parser chose to reduce when possible rather than shift, +the result would be to attach the else-clause to the outermost +if-statement, making these two inputs equivalent: + + if x then if y then win; else lose; + + if x then do; if y then win; end; else lose; + + The conflict exists because the grammar as written is ambiguous: +either parsing of the simple nested if-statement is legitimate. The +established convention is that these ambiguities are resolved by +attaching the else-clause to the innermost if-statement; this is what +Bison accomplishes by choosing to shift rather than reduce. (It would +ideally be cleaner to write an unambiguous grammar, but that is very +hard to do in this case.) This particular ambiguity was first +encountered in the specifications of Algol 60 and is called the +“dangling ‘else’” ambiguity. + + To assist the grammar author in understanding the nature of each +conflict, Bison can be asked to generate “counterexamples”. In the +present case it actually even proves that the grammar is ambiguous by +exhibiting a string with two different parses: + + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Shift derivation + if_stmt + ↳ 3: "if" expr "then" stmt + ↳ 2: if_stmt + ↳ 4: "if" expr "then" stmt • "else" stmt + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Reduce derivation + if_stmt + ↳ 4: "if" expr "then" stmt "else" stmt + ↳ 2: if_stmt + ↳ 3: "if" expr "then" stmt • + +*Note Counterexamples::, for more details. + + + To avoid warnings from Bison about predictable, _legitimate_ +shift/reduce conflicts, you can use the ‘%expect N’ declaration. There +will be no warning as long as the number of shift/reduce conflicts is +exactly N, and Bison will report an error if there is a different +number. *Note Expect Decl::. However, we don’t recommend the use of +‘%expect’ (except ‘%expect 0’!), as an equal number of conflicts does +not mean that they are the _same_. When possible, you should rather use +precedence directives to _fix_ the conflicts explicitly (*note Non +Operators::). + + The definition of ‘if_stmt’ above is solely to blame for the +conflict, but the conflict does not actually appear without additional +rules. Here is a complete Bison grammar file that actually manifests +the conflict: + + %% + stmt: + expr + | if_stmt + ; + + if_stmt: + "if" expr "then" stmt + | "if" expr "then" stmt "else" stmt + ; + + expr: + "identifier" + ; + + +File: bison.info, Node: Precedence, Next: Contextual Precedence, Prev: Shift/Reduce, Up: Algorithm + +5.3 Operator Precedence +======================= + +Another situation where shift/reduce conflicts appear is in arithmetic +expressions. Here shifting is not always the preferred resolution; the +Bison declarations for operator precedence allow you to specify when to +shift and when to reduce. + +* Menu: + +* Why Precedence:: An example showing why precedence is needed. +* Using Precedence:: How to specify precedence and associativity. +* Precedence Only:: How to specify precedence only. +* Precedence Examples:: How these features are used in the previous example. +* How Precedence:: How they work. +* Non Operators:: Using precedence for general conflicts. + + +File: bison.info, Node: Why Precedence, Next: Using Precedence, Up: Precedence + +5.3.1 When Precedence is Needed +------------------------------- + +Consider the following ambiguous grammar fragment (ambiguous because the +input ‘1 - 2 * 3’ can be parsed in two different ways): + + expr: + expr '-' expr + | expr '*' expr + | expr '<' expr + | '(' expr ')' + ... + ; + +Suppose the parser has seen the tokens ‘1’, ‘-’ and ‘2’; should it +reduce them via the rule for the subtraction operator? It depends on +the next token. Of course, if the next token is ‘)’, we must reduce; +shifting is invalid because no single rule can reduce the token sequence +‘- 2 )’ or anything starting with that. But if the next token is ‘*’ or +‘<’, we have a choice: either shifting or reduction would allow the +parse to complete, but with different results. + + To decide which one Bison should do, we must consider the results. +If the next operator token OP is shifted, then it must be reduced first +in order to permit another opportunity to reduce the difference. The +result is (in effect) ‘1 - (2 OP 3)’. On the other hand, if the +subtraction is reduced before shifting OP, the result is ‘(1 - 2) OP 3’. +Clearly, then, the choice of shift or reduce should depend on the +relative precedence of the operators ‘-’ and OP: ‘*’ should be shifted +first, but not ‘<’. + + What about input such as ‘1 - 2 - 5’; should this be ‘(1 - 2) - 5’ or +should it be ‘1 - (2 - 5)’? For most operators we prefer the former, +which is called “left association”. The latter alternative, “right +association”, is desirable for assignment operators. The choice of left +or right association is a matter of whether the parser chooses to shift +or reduce when the stack contains ‘1 - 2’ and the lookahead token is +‘-’: shifting makes right-associativity. + + +File: bison.info, Node: Using Precedence, Next: Precedence Only, Prev: Why Precedence, Up: Precedence + +5.3.2 Specifying Operator Precedence +------------------------------------ + +Bison allows you to specify these choices with the operator precedence +declarations ‘%left’ and ‘%right’. Each such declaration contains a +list of tokens, which are operators whose precedence and associativity +is being declared. The ‘%left’ declaration makes all those operators +left-associative and the ‘%right’ declaration makes them +right-associative. A third alternative is ‘%nonassoc’, which declares +that it is a syntax error to find the same operator twice “in a row”. +The last alternative, ‘%precedence’, allows to define only precedence +and no associativity at all. As a result, any associativity-related +conflict that remains will be reported as an compile-time error. The +directive ‘%nonassoc’ creates run-time error: using the operator in a +associative way is a syntax error. The directive ‘%precedence’ creates +compile-time errors: an operator _can_ be involved in an +associativity-related conflict, contrary to what expected the grammar +author. + + The relative precedence of different operators is controlled by the +order in which they are declared. The first precedence/associativity +declaration in the file declares the operators whose precedence is +lowest, the next such declaration declares the operators whose +precedence is a little higher, and so on. + + +File: bison.info, Node: Precedence Only, Next: Precedence Examples, Prev: Using Precedence, Up: Precedence + +5.3.3 Specifying Precedence Only +-------------------------------- + +Since POSIX Yacc defines only ‘%left’, ‘%right’, and ‘%nonassoc’, which +all defines precedence and associativity, little attention is paid to +the fact that precedence cannot be defined without defining +associativity. Yet, sometimes, when trying to solve a conflict, +precedence suffices. In such a case, using ‘%left’, ‘%right’, or +‘%nonassoc’ might hide future (associativity related) conflicts that +would remain hidden. + + The dangling ‘else’ ambiguity (*note Shift/Reduce::) can be solved +explicitly. This shift/reduce conflicts occurs in the following +situation, where the period denotes the current parsing state: + + if E1 then if E2 then S1 • else S2 + + The conflict involves the reduction of the rule ‘IF expr THEN stmt’, +which precedence is by default that of its last token (‘THEN’), and the +shifting of the token ‘ELSE’. The usual disambiguation (attach the +‘else’ to the closest ‘if’), shifting must be preferred, i.e., the +precedence of ‘ELSE’ must be higher than that of ‘THEN’. But neither is +expected to be involved in an associativity related conflict, which can +be specified as follows. + + %precedence THEN + %precedence ELSE + + The unary-minus is another typical example where associativity is +usually over-specified, see *note Infix Calc::. The ‘%left’ directive +is traditionally used to declare the precedence of ‘NEG’, which is more +than needed since it also defines its associativity. While this is +harmless in the traditional example, who knows how ‘NEG’ might be used +in future evolutions of the grammar... + + +File: bison.info, Node: Precedence Examples, Next: How Precedence, Prev: Precedence Only, Up: Precedence + +5.3.4 Precedence Examples +------------------------- + +In our example, we would want the following declarations: + + %left '<' + %left '-' + %left '*' + + In a more complete example, which supports other operators as well, +we would declare them in groups of equal precedence. For example, ‘'+'’ +is declared with ‘'-'’: + + %left '<' '>' '=' "!=" "<=" ">=" + %left '+' '-' + %left '*' '/' + + +File: bison.info, Node: How Precedence, Next: Non Operators, Prev: Precedence Examples, Up: Precedence + +5.3.5 How Precedence Works +-------------------------- + +The first effect of the precedence declarations is to assign precedence +levels to the terminal symbols declared. The second effect is to assign +precedence levels to certain rules: each rule gets its precedence from +the last terminal symbol mentioned in the components. (You can also +specify explicitly the precedence of a rule. *Note Contextual +Precedence::.) + + Finally, the resolution of conflicts works by comparing the +precedence of the rule being considered with that of the lookahead +token. If the token’s precedence is higher, the choice is to shift. If +the rule’s precedence is higher, the choice is to reduce. If they have +equal precedence, the choice is made based on the associativity of that +precedence level. The verbose output file made by ‘-v’ (*note +Invocation::) says how each conflict was resolved. + + Not all rules and not all tokens have precedence. If either the rule +or the lookahead token has no precedence, then the default is to shift. + + +File: bison.info, Node: Non Operators, Prev: How Precedence, Up: Precedence + +5.3.6 Using Precedence For Non Operators +---------------------------------------- + +Using properly precedence and associativity directives can help fixing +shift/reduce conflicts that do not involve arithmetic-like operators. +For instance, the “dangling ‘else’” problem (*note Shift/Reduce::) can +be solved elegantly in two different ways. + + In the present case, the conflict is between the token ‘"else"’ +willing to be shifted, and the rule ‘if_stmt: "if" expr "then" stmt’, +asking for reduction. By default, the precedence of a rule is that of +its last token, here ‘"then"’, so the conflict will be solved +appropriately by giving ‘"else"’ a precedence higher than that of +‘"then"’, for instance as follows: + + %precedence "then" + %precedence "else" + + Alternatively, you may give both tokens the same precedence, in which +case associativity is used to solve the conflict. To preserve the shift +action, use right associativity: + + %right "then" "else" + + Neither solution is perfect however. Since Bison does not provide, +so far, “scoped” precedence, both force you to declare the precedence of +these keywords with respect to the other operators your grammar. +Therefore, instead of being warned about new conflicts you would be +unaware of (e.g., a shift/reduce conflict due to ‘if test then 1 else 2 ++ 3’ being ambiguous: ‘if test then 1 else (2 + 3)’ or ‘(if test then 1 +else 2) + 3’?), the conflict will be already “fixed”. + + +File: bison.info, Node: Contextual Precedence, Next: Parser States, Prev: Precedence, Up: Algorithm + +5.4 Context-Dependent Precedence +================================ + +Often the precedence of an operator depends on the context. This sounds +outlandish at first, but it is really very common. For example, a minus +sign typically has a very high precedence as a unary operator, and a +somewhat lower precedence (lower than multiplication) as a binary +operator. + + The Bison precedence declarations can only be used once for a given +token; so a token has only one precedence declared in this way. For +context-dependent precedence, you need to use an additional mechanism: +the ‘%prec’ modifier for rules. + + The ‘%prec’ modifier declares the precedence of a particular rule by +specifying a terminal symbol whose precedence should be used for that +rule. It’s not necessary for that symbol to appear otherwise in the +rule. The modifier’s syntax is: + + %prec TERMINAL-SYMBOL + +and it is written after the components of the rule. Its effect is to +assign the rule the precedence of TERMINAL-SYMBOL, overriding the +precedence that would be deduced for it in the ordinary way. The +altered rule precedence then affects how conflicts involving that rule +are resolved (*note Precedence::). + + Here is how ‘%prec’ solves the problem of unary minus. First, +declare a precedence for a fictitious terminal symbol named ‘UMINUS’. +There are no tokens of this type, but the symbol serves to stand for its +precedence: + + ... + %left '+' '-' + %left '*' + %left UMINUS + + Now the precedence of ‘UMINUS’ can be used in specific rules: + + exp: + ... + | exp '-' exp + ... + | '-' exp %prec UMINUS + + +File: bison.info, Node: Parser States, Next: Reduce/Reduce, Prev: Contextual Precedence, Up: Algorithm + +5.5 Parser States +================= + +The function ‘yyparse’ is implemented using a finite-state machine. The +values pushed on the parser stack are not simply token kind codes; they +represent the entire sequence of terminal and nonterminal symbols at or +near the top of the stack. The current state collects all the +information about previous input which is relevant to deciding what to +do next. + + Each time a lookahead token is read, the current parser state +together with the kind of lookahead token are looked up in a table. +This table entry can say, “Shift the lookahead token.” In this case, it +also specifies the new parser state, which is pushed onto the top of the +parser stack. Or it can say, “Reduce using rule number N.” This means +that a certain number of tokens or groupings are taken off the top of +the stack, and replaced by one grouping. In other words, that number of +states are popped from the stack, and one new state is pushed. + + There is one other alternative: the table can say that the lookahead +token is erroneous in the current state. This causes error processing +to begin (*note Error Recovery::). + + +File: bison.info, Node: Reduce/Reduce, Next: Mysterious Conflicts, Prev: Parser States, Up: Algorithm + +5.6 Reduce/Reduce Conflicts +=========================== + +A reduce/reduce conflict occurs if there are two or more rules that +apply to the same sequence of input. This usually indicates a serious +error in the grammar. + + For example, here is an erroneous attempt to define a sequence of +zero or more ‘word’ groupings. + + sequence: + %empty { printf ("empty sequence\n"); } + | maybeword + | sequence word { printf ("added word %s\n", $2); } + ; + + maybeword: + %empty { printf ("empty maybeword\n"); } + | word { printf ("single word %s\n", $1); } + ; + +The error is an ambiguity: as counterexample generation would +demonstrate (*note Counterexamples::), there is more than one way to +parse a single ‘word’ into a ‘sequence’. It could be reduced to a +‘maybeword’ and then into a ‘sequence’ via the second rule. +Alternatively, nothing-at-all could be reduced into a ‘sequence’ via the +first rule, and this could be combined with the ‘word’ using the third +rule for ‘sequence’. + + There is also more than one way to reduce nothing-at-all into a +‘sequence’. This can be done directly via the first rule, or indirectly +via ‘maybeword’ and then the second rule. + + You might think that this is a distinction without a difference, +because it does not change whether any particular input is valid or not. +But it does affect which actions are run. One parsing order runs the +second rule’s action; the other runs the first rule’s action and the +third rule’s action. In this example, the output of the program +changes. + + Bison resolves a reduce/reduce conflict by choosing to use the rule +that appears first in the grammar, but it is very risky to rely on this. +Every reduce/reduce conflict must be studied and usually eliminated. +Here is the proper way to define ‘sequence’: + + sequence: + %empty { printf ("empty sequence\n"); } + | sequence word { printf ("added word %s\n", $2); } + ; + + Here is another common error that yields a reduce/reduce conflict: + + sequence: + %empty + | sequence words + | sequence redirects + ; + + words: + %empty + | words word + ; + + redirects: + %empty + | redirects redirect + ; + +The intention here is to define a sequence which can contain either +‘word’ or ‘redirect’ groupings. The individual definitions of +‘sequence’, ‘words’ and ‘redirects’ are error-free, but the three +together make a subtle ambiguity: even an empty input can be parsed in +infinitely many ways! + + Consider: nothing-at-all could be a ‘words’. Or it could be two +‘words’ in a row, or three, or any number. It could equally well be a +‘redirects’, or two, or any number. Or it could be a ‘words’ followed +by three ‘redirects’ and another ‘words’. And so on. + + Here are two ways to correct these rules. First, to make it a single +level of sequence: + + sequence: + %empty + | sequence word + | sequence redirect + ; + + Second, to prevent either a ‘words’ or a ‘redirects’ from being +empty: + + sequence: + %empty + | sequence words + | sequence redirects + ; + + words: + word + | words word + ; + + redirects: + redirect + | redirects redirect + ; + + Yet this proposal introduces another kind of ambiguity! The input +‘word word’ can be parsed as a single ‘words’ composed of two ‘word’s, +or as two one-‘word’ ‘words’ (and likewise for ‘redirect’/‘redirects’). +However this ambiguity is now a shift/reduce conflict, and therefore it +can now be addressed with precedence directives. + + To simplify the matter, we will proceed with ‘word’ and ‘redirect’ +being tokens: ‘"word"’ and ‘"redirect"’. + + To prefer the longest ‘words’, the conflict between the token +‘"word"’ and the rule ‘sequence: sequence words’ must be resolved as a +shift. To this end, we use the same techniques as exposed above, see +*note Non Operators::. One solution relies on precedences: use ‘%prec’ +to give a lower precedence to the rule: + + %precedence "word" + %precedence "sequence" + %% + sequence: + %empty + | sequence word %prec "sequence" + | sequence redirect %prec "sequence" + ; + + words: + word + | words "word" + ; + + Another solution relies on associativity: provide both the token and +the rule with the same precedence, but make them right-associative: + + %right "word" "redirect" + %% + sequence: + %empty + | sequence word %prec "word" + | sequence redirect %prec "redirect" + ; + + +File: bison.info, Node: Mysterious Conflicts, Next: Tuning LR, Prev: Reduce/Reduce, Up: Algorithm + +5.7 Mysterious Conflicts +======================== + +Sometimes reduce/reduce conflicts can occur that don’t look warranted. +Here is an example: + + %% + def: param_spec return_spec ','; + param_spec: + type + | name_list ':' type + ; + + return_spec: + type + | name ':' type + ; + + type: "id"; + + name: "id"; + name_list: + name + | name ',' name_list + ; + + It would seem that this grammar can be parsed with only a single +token of lookahead: when a ‘param_spec’ is being read, an ‘"id"’ is a +‘name’ if a comma or colon follows, or a ‘type’ if another ‘"id"’ +follows. In other words, this grammar is LR(1). Yet Bison finds one +reduce/reduce conflict, for which counterexample generation (*note +Counterexamples::) would find a _nonunifying_ example. + + This is because Bison does not handle all LR(1) grammars _by +default_, for historical reasons. In this grammar, two contexts, that +after an ‘"id"’ at the beginning of a ‘param_spec’ and likewise at the +beginning of a ‘return_spec’, are similar enough that Bison assumes they +are the same. They appear similar because the same set of rules would +be active—the rule for reducing to a ‘name’ and that for reducing to a +‘type’. Bison is unable to determine at that stage of processing that +the rules would require different lookahead tokens in the two contexts, +so it makes a single parser state for them both. Combining the two +contexts causes a conflict later. In parser terminology, this +occurrence means that the grammar is not LALR(1). + + For many practical grammars (specifically those that fall into the +non-LR(1) class), the limitations of LALR(1) result in difficulties +beyond just mysterious reduce/reduce conflicts. The best way to fix all +these problems is to select a different parser table construction +algorithm. Either IELR(1) or canonical LR(1) would suffice, but the +former is more efficient and easier to debug during development. *Note +LR Table Construction::, for details. + + If you instead wish to work around LALR(1)’s limitations, you can +often fix a mysterious conflict by identifying the two parser states +that are being confused, and adding something to make them look +distinct. In the above example, adding one rule to ‘return_spec’ as +follows makes the problem go away: + + ... + return_spec: + type + | name ':' type + | "id" "bogus" /* This rule is never used. */ + ; + + This corrects the problem because it introduces the possibility of an +additional active rule in the context after the ‘"id"’ at the beginning +of ‘return_spec’. This rule is not active in the corresponding context +in a ‘param_spec’, so the two contexts receive distinct parser states. +As long as the token ‘"bogus"’ is never generated by ‘yylex’, the added +rule cannot alter the way actual input is parsed. + + In this particular example, there is another way to solve the +problem: rewrite the rule for ‘return_spec’ to use ‘"id"’ directly +instead of via ‘name’. This also causes the two confusing contexts to +have different sets of active rules, because the one for ‘return_spec’ +activates the altered rule for ‘return_spec’ rather than the one for +‘name’. + + param_spec: + type + | name_list ':' type + ; + + return_spec: + type + | "id" ':' type + ; + + For a more detailed exposition of LALR(1) parsers and parser +generators, see *note DeRemer 1982::. + + +File: bison.info, Node: Tuning LR, Next: Generalized LR Parsing, Prev: Mysterious Conflicts, Up: Algorithm + +5.8 Tuning LR +============= + +The default behavior of Bison’s LR-based parsers is chosen mostly for +historical reasons, but that behavior is often not robust. For example, +in the previous section, we discussed the mysterious conflicts that can +be produced by LALR(1), Bison’s default parser table construction +algorithm. Another example is Bison’s ‘%define parse.error verbose’ +directive, which instructs the generated parser to produce verbose +syntax error messages, which can sometimes contain incorrect +information. + + In this section, we explore several modern features of Bison that +allow you to tune fundamental aspects of the generated LR-based parsers. +Some of these features easily eliminate shortcomings like those +mentioned above. Others can be helpful purely for understanding your +parser. + +* Menu: + +* LR Table Construction:: Choose a different construction algorithm. +* Default Reductions:: Disable default reductions. +* LAC:: Correct lookahead sets in the parser states. +* Unreachable States:: Keep unreachable parser states for debugging. + + +File: bison.info, Node: LR Table Construction, Next: Default Reductions, Up: Tuning LR + +5.8.1 LR Table Construction +--------------------------- + +For historical reasons, Bison constructs LALR(1) parser tables by +default. However, LALR does not possess the full language-recognition +power of LR. As a result, the behavior of parsers employing LALR parser +tables is often mysterious. We presented a simple example of this +effect in *note Mysterious Conflicts::. + + As we also demonstrated in that example, the traditional approach to +eliminating such mysterious behavior is to restructure the grammar. +Unfortunately, doing so correctly is often difficult. Moreover, merely +discovering that LALR causes mysterious behavior in your parser can be +difficult as well. + + Fortunately, Bison provides an easy way to eliminate the possibility +of such mysterious behavior altogether. You simply need to activate a +more powerful parser table construction algorithm by using the ‘%define +lr.type’ directive. + + -- Directive: %define lr.type TYPE + Specify the type of parser tables within the LR(1) family. The + accepted values for TYPE are: + + • ‘lalr’ (default) + • ‘ielr’ + • ‘canonical-lr’ + + For example, to activate IELR, you might add the following directive +to you grammar file: + + %define lr.type ielr + +For the example in *note Mysterious Conflicts::, the mysterious conflict +is then eliminated, so there is no need to invest time in comprehending +the conflict or restructuring the grammar to fix it. If, during future +development, the grammar evolves such that all mysterious behavior would +have disappeared using just LALR, you need not fear that continuing to +use IELR will result in unnecessarily large parser tables. That is, +IELR generates LALR tables when LALR (using a deterministic parsing +algorithm) is sufficient to support the full language-recognition power +of LR. Thus, by enabling IELR at the start of grammar development, you +can safely and completely eliminate the need to consider LALR’s +shortcomings. + + While IELR is almost always preferable, there are circumstances where +LALR or the canonical LR parser tables described by Knuth (*note Knuth +1965::) can be useful. Here we summarize the relative advantages of +each parser table construction algorithm within Bison: + + • LALR + + There are at least two scenarios where LALR can be worthwhile: + + • GLR without static conflict resolution. + + When employing GLR parsers (*note GLR Parsers::), if you do + not resolve any conflicts statically (for example, with + ‘%left’ or ‘%precedence’), then the parser explores all + potential parses of any given input. In this case, the choice + of parser table construction algorithm is guaranteed not to + alter the language accepted by the parser. LALR parser tables + are the smallest parser tables Bison can currently construct, + so they may then be preferable. Nevertheless, once you begin + to resolve conflicts statically, GLR behaves more like a + deterministic parser in the syntactic contexts where those + conflicts appear, and so either IELR or canonical LR can then + be helpful to avoid LALR’s mysterious behavior. + + • Malformed grammars. + + Occasionally during development, an especially malformed + grammar with a major recurring flaw may severely impede the + IELR or canonical LR parser table construction algorithm. + LALR can be a quick way to construct parser tables in order to + investigate such problems while ignoring the more subtle + differences from IELR and canonical LR. + + • IELR + + IELR (Inadequacy Elimination LR) is a minimal LR algorithm. That + is, given any grammar (LR or non-LR), parsers using IELR or + canonical LR parser tables always accept exactly the same set of + sentences. However, like LALR, IELR merges parser states during + parser table construction so that the number of parser states is + often an order of magnitude less than for canonical LR. More + importantly, because canonical LR’s extra parser states may contain + duplicate conflicts in the case of non-LR grammars, the number of + conflicts for IELR is often an order of magnitude less as well. + This effect can significantly reduce the complexity of developing a + grammar. + + • Canonical LR + + While inefficient, canonical LR parser tables can be an interesting + means to explore a grammar because they possess a property that + IELR and LALR tables do not. That is, if ‘%nonassoc’ is not used + and default reductions are left disabled (*note Default + Reductions::), then, for every left context of every canonical LR + state, the set of tokens accepted by that state is guaranteed to be + the exact set of tokens that is syntactically acceptable in that + left context. It might then seem that an advantage of canonical LR + parsers in production is that, under the above constraints, they + are guaranteed to detect a syntax error as soon as possible without + performing any unnecessary reductions. However, IELR parsers that + use LAC are also able to achieve this behavior without sacrificing + ‘%nonassoc’ or default reductions. For details and a few caveats + of LAC, *note LAC::. + + For a more detailed exposition of the mysterious behavior in LALR +parsers and the benefits of IELR, see *note Denny 2008::, and *note +Denny 2010 November::. + + +File: bison.info, Node: Default Reductions, Next: LAC, Prev: LR Table Construction, Up: Tuning LR + +5.8.2 Default Reductions +------------------------ + +After parser table construction, Bison identifies the reduction with the +largest lookahead set in each parser state. To reduce the size of the +parser state, traditional Bison behavior is to remove that lookahead set +and to assign that reduction to be the default parser action. Such a +reduction is known as a “default reduction”. + + Default reductions affect more than the size of the parser tables. +They also affect the behavior of the parser: + + • Delayed ‘yylex’ invocations. + + A “consistent state” is a state that has only one possible parser + action. If that action is a reduction and is encoded as a default + reduction, then that consistent state is called a “defaulted + state”. Upon reaching a defaulted state, a Bison-generated parser + does not bother to invoke ‘yylex’ to fetch the next token before + performing the reduction. In other words, whether default + reductions are enabled in consistent states determines how soon a + Bison-generated parser invokes ‘yylex’ for a token: immediately + when it _reaches_ that token in the input or when it eventually + _needs_ that token as a lookahead to determine the next parser + action. Traditionally, default reductions are enabled, and so the + parser exhibits the latter behavior. + + The presence of defaulted states is an important consideration when + designing ‘yylex’ and the grammar file. That is, if the behavior + of ‘yylex’ can influence or be influenced by the semantic actions + associated with the reductions in defaulted states, then the delay + of the next ‘yylex’ invocation until after those reductions is + significant. For example, the semantic actions might pop a scope + stack that ‘yylex’ uses to determine what token to return. Thus, + the delay might be necessary to ensure that ‘yylex’ does not look + up the next token in a scope that should already be considered + closed. + + • Delayed syntax error detection. + + When the parser fetches a new token by invoking ‘yylex’, it checks + whether there is an action for that token in the current parser + state. The parser detects a syntax error if and only if either (1) + there is no action for that token or (2) the action for that token + is the error action (due to the use of ‘%nonassoc’). However, if + there is a default reduction in that state (which might or might + not be a defaulted state), then it is impossible for condition 1 to + exist. That is, all tokens have an action. Thus, the parser + sometimes fails to detect the syntax error until it reaches a later + state. + + While default reductions never cause the parser to accept + syntactically incorrect sentences, the delay of syntax error + detection can have unexpected effects on the behavior of the + parser. However, the delay can be caused anyway by parser state + merging and the use of ‘%nonassoc’, and it can be fixed by another + Bison feature, LAC. We discuss the effects of delayed syntax error + detection and LAC more in the next section (*note LAC::). + + For canonical LR, the only default reduction that Bison enables by +default is the accept action, which appears only in the accepting state, +which has no other action and is thus a defaulted state. However, the +default accept action does not delay any ‘yylex’ invocation or syntax +error detection because the accept action ends the parse. + + For LALR and IELR, Bison enables default reductions in nearly all +states by default. There are only two exceptions. First, states that +have a shift action on the ‘error’ token do not have default reductions +because delayed syntax error detection could then prevent the ‘error’ +token from ever being shifted in that state. However, parser state +merging can cause the same effect anyway, and LAC fixes it in both +cases, so future versions of Bison might drop this exception when LAC is +activated. Second, GLR parsers do not record the default reduction as +the action on a lookahead token for which there is a conflict. The +correct action in this case is to split the parse instead. + + To adjust which states have default reductions enabled, use the +‘%define lr.default-reduction’ directive. + + -- Directive: %define lr.default-reduction WHERE + Specify the kind of states that are permitted to contain default + reductions. The accepted values of WHERE are: + • ‘most’ (default for LALR and IELR) + • ‘consistent’ + • ‘accepting’ (default for canonical LR) + + +File: bison.info, Node: LAC, Next: Unreachable States, Prev: Default Reductions, Up: Tuning LR + +5.8.3 LAC +--------- + +Canonical LR, IELR, and LALR can suffer from a couple of problems upon +encountering a syntax error. First, the parser might perform additional +parser stack reductions before discovering the syntax error. Such +reductions can perform user semantic actions that are unexpected because +they are based on an invalid token, and they cause error recovery to +begin in a different syntactic context than the one in which the invalid +token was encountered. Second, when verbose error messages are enabled +(*note Error Reporting::), the expected token list in the syntax error +message can both contain invalid tokens and omit valid tokens. + + The culprits for the above problems are ‘%nonassoc’, default +reductions in inconsistent states (*note Default Reductions::), and +parser state merging. Because IELR and LALR merge parser states, they +suffer the most. Canonical LR can suffer only if ‘%nonassoc’ is used or +if default reductions are enabled for inconsistent states. + + LAC (Lookahead Correction) is a new mechanism within the parsing +algorithm that solves these problems for canonical LR, IELR, and LALR +without sacrificing ‘%nonassoc’, default reductions, or state merging. +You can enable LAC with the ‘%define parse.lac’ directive. + + -- Directive: %define parse.lac VALUE + Enable LAC to improve syntax error handling. + • ‘none’ (default) + • ‘full’ + This feature is currently only available for deterministic parsers + in C and C++. + + Conceptually, the LAC mechanism is straight-forward. Whenever the +parser fetches a new token from the scanner so that it can determine the +next parser action, it immediately suspends normal parsing and performs +an exploratory parse using a temporary copy of the normal parser state +stack. During this exploratory parse, the parser does not perform user +semantic actions. If the exploratory parse reaches a shift action, +normal parsing then resumes on the normal parser stacks. If the +exploratory parse reaches an error instead, the parser reports a syntax +error. If verbose syntax error messages are enabled, the parser must +then discover the list of expected tokens, so it performs a separate +exploratory parse for each token in the grammar. + + There is one subtlety about the use of LAC. That is, when in a +consistent parser state with a default reduction, the parser will not +attempt to fetch a token from the scanner because no lookahead is needed +to determine the next parser action. Thus, whether default reductions +are enabled in consistent states (*note Default Reductions::) affects +how soon the parser detects a syntax error: immediately when it +_reaches_ an erroneous token or when it eventually _needs_ that token as +a lookahead to determine the next parser action. The latter behavior is +probably more intuitive, so Bison currently provides no way to achieve +the former behavior while default reductions are enabled in consistent +states. + + Thus, when LAC is in use, for some fixed decision of whether to +enable default reductions in consistent states, canonical LR and IELR +behave almost exactly the same for both syntactically acceptable and +syntactically unacceptable input. While LALR still does not support the +full language-recognition power of canonical LR and IELR, LAC at least +enables LALR’s syntax error handling to correctly reflect LALR’s +language-recognition power. + + There are a few caveats to consider when using LAC: + + • Infinite parsing loops. + + IELR plus LAC does have one shortcoming relative to canonical LR. + Some parsers generated by Bison can loop infinitely. LAC does not + fix infinite parsing loops that occur between encountering a syntax + error and detecting it, but enabling canonical LR or disabling + default reductions sometimes does. + + • Verbose error message limitations. + + Because of internationalization considerations, Bison-generated + parsers limit the size of the expected token list they are willing + to report in a verbose syntax error message. If the number of + expected tokens exceeds that limit, the list is simply dropped from + the message. Enabling LAC can increase the size of the list and + thus cause the parser to drop it. Of course, dropping the list is + better than reporting an incorrect list. + + • Performance. + + Because LAC requires many parse actions to be performed twice, it + can have a performance penalty. However, not all parse actions + must be performed twice. Specifically, during a series of default + reductions in consistent states and shift actions, the parser never + has to initiate an exploratory parse. Moreover, the most + time-consuming tasks in a parse are often the file I/O, the lexical + analysis performed by the scanner, and the user’s semantic actions, + but none of these are performed during the exploratory parse. + Finally, the base of the temporary stack used during an exploratory + parse is a pointer into the normal parser state stack so that the + stack is never physically copied. In our experience, the + performance penalty of LAC has proved insignificant for practical + grammars. + + While the LAC algorithm shares techniques that have been recognized +in the parser community for years, for the publication that introduces +LAC, see *note Denny 2010 May::. + + +File: bison.info, Node: Unreachable States, Prev: LAC, Up: Tuning LR + +5.8.4 Unreachable States +------------------------ + +If there exists no sequence of transitions from the parser’s start state +to some state S, then Bison considers S to be an “unreachable state”. A +state can become unreachable during conflict resolution if Bison +disables a shift action leading to it from a predecessor state. + + By default, Bison removes unreachable states from the parser after +conflict resolution because they are useless in the generated parser. +However, keeping unreachable states is sometimes useful when trying to +understand the relationship between the parser and the grammar. + + -- Directive: %define lr.keep-unreachable-state VALUE + Request that Bison allow unreachable states to remain in the parser + tables. VALUE must be a Boolean. The default is ‘false’. + + There are a few caveats to consider: + + • Missing or extraneous warnings. + + Unreachable states may contain conflicts and may use rules not used + in any other state. Thus, keeping unreachable states may induce + warnings that are irrelevant to your parser’s behavior, and it may + eliminate warnings that are relevant. Of course, the change in + warnings may actually be relevant to a parser table analysis that + wants to keep unreachable states, so this behavior will likely + remain in future Bison releases. + + • Other useless states. + + While Bison is able to remove unreachable states, it is not + guaranteed to remove other kinds of useless states. Specifically, + when Bison disables reduce actions during conflict resolution, some + goto actions may become useless, and thus some additional states + may become useless. If Bison were to compute which goto actions + were useless and then disable those actions, it could identify such + states as unreachable and then remove those states. However, Bison + does not compute which goto actions are useless. + + +File: bison.info, Node: Generalized LR Parsing, Next: Memory Management, Prev: Tuning LR, Up: Algorithm + +5.9 Generalized LR (GLR) Parsing +================================ + +Bison produces _deterministic_ parsers that choose uniquely when to +reduce and which reduction to apply based on a summary of the preceding +input and on one extra token of lookahead. As a result, normal Bison +handles a proper subset of the family of context-free languages. +Ambiguous grammars, since they have strings with more than one possible +sequence of reductions cannot have deterministic parsers in this sense. +The same is true of languages that require more than one symbol of +lookahead, since the parser lacks the information necessary to make a +decision at the point it must be made in a shift/reduce parser. +Finally, as previously mentioned (*note Mysterious Conflicts::), there +are languages where Bison’s default choice of how to summarize the input +seen so far loses necessary information. + + When you use the ‘%glr-parser’ declaration in your grammar file, +Bison generates a parser that uses a different algorithm, called +Generalized LR (or GLR). A Bison GLR parser uses the same basic +algorithm for parsing as an ordinary Bison parser, but behaves +differently in cases where there is a shift/reduce conflict that has not +been resolved by precedence rules (*note Precedence::) or a +reduce/reduce conflict. When a GLR parser encounters such a situation, +it effectively _splits_ into a several parsers, one for each possible +shift or reduction. These parsers then proceed as usual, consuming +tokens in lock-step. Some of the stacks may encounter other conflicts +and split further, with the result that instead of a sequence of states, +a Bison GLR parsing stack is what is in effect a tree of states. + + In effect, each stack represents a guess as to what the proper parse +is. Additional input may indicate that a guess was wrong, in which case +the appropriate stack silently disappears. Otherwise, the semantics +actions generated in each stack are saved, rather than being executed +immediately. When a stack disappears, its saved semantic actions never +get executed. When a reduction causes two stacks to become equivalent, +their sets of semantic actions are both saved with the state that +results from the reduction. We say that two stacks are equivalent when +they both represent the same sequence of states, and each pair of +corresponding states represents a grammar symbol that produces the same +segment of the input token stream. + + Whenever the parser makes a transition from having multiple states to +having one, it reverts to the normal deterministic parsing algorithm, +after resolving and executing the saved-up actions. At this transition, +some of the states on the stack will have semantic values that are sets +(actually multisets) of possible actions. The parser tries to pick one +of the actions by first finding one whose rule has the highest dynamic +precedence, as set by the ‘%dprec’ declaration. Otherwise, if the +alternative actions are not ordered by precedence, but there the same +merging function is declared for both rules by the ‘%merge’ declaration, +Bison resolves and evaluates both and then calls the merge function on +the result. Otherwise, it reports an ambiguity. + + It is possible to use a data structure for the GLR parsing tree that +permits the processing of any LR(1) grammar in linear time (in the size +of the input), any unambiguous (not necessarily LR(1)) grammar in +quadratic worst-case time, and any general (possibly ambiguous) +context-free grammar in cubic worst-case time. However, Bison currently +uses a simpler data structure that requires time proportional to the +length of the input times the maximum number of stacks required for any +prefix of the input. Thus, really ambiguous or nondeterministic +grammars can require exponential time and space to process. Such badly +behaving examples, however, are not generally of practical interest. +Usually, nondeterminism in a grammar is local—the parser is “in doubt” +only for a few tokens at a time. Therefore, the current data structure +should generally be adequate. On LR(1) portions of a grammar, in +particular, it is only slightly slower than with the deterministic LR(1) +Bison parser. + + For a more detailed exposition of GLR parsers, see *note Scott +2000::. + + +File: bison.info, Node: Memory Management, Prev: Generalized LR Parsing, Up: Algorithm + +5.10 Memory Management, and How to Avoid Memory Exhaustion +========================================================== + +The Bison parser stack can run out of memory if too many tokens are +shifted and not reduced. When this happens, the parser function +‘yyparse’ calls ‘yyerror’ and then returns 2. + + Because Bison parsers have growing stacks, hitting the upper limit +usually results from using a right recursion instead of a left +recursion, see *note Recursion::. + + By defining the macro ‘YYMAXDEPTH’, you can control how deep the +parser stack can become before memory is exhausted. Define the macro +with a value that is an integer. This value is the maximum number of +tokens that can be shifted (and not reduced) before overflow. + + The stack space allowed is not necessarily allocated. If you specify +a large value for ‘YYMAXDEPTH’, the parser normally allocates a small +stack at first, and then makes it bigger by stages as needed. This +increasing allocation happens automatically and silently. Therefore, +you do not need to make ‘YYMAXDEPTH’ painfully small merely to save +space for ordinary inputs that do not need much stack. + + However, do not allow ‘YYMAXDEPTH’ to be a value so large that +arithmetic overflow could occur when calculating the size of the stack +space. Also, do not allow ‘YYMAXDEPTH’ to be less than ‘YYINITDEPTH’. + + The default value of ‘YYMAXDEPTH’, if you do not define it, is 10000. + + You can control how much stack is allocated initially by defining the +macro ‘YYINITDEPTH’ to a positive integer. For the deterministic parser +in C, this value must be a compile-time constant unless you are assuming +C99 or some other target language or compiler that allows +variable-length arrays. The default is 200. + + Do not allow ‘YYINITDEPTH’ to be greater than ‘YYMAXDEPTH’. + + You can generate a deterministic parser containing C++ user code from +the default (C) skeleton, as well as from the C++ skeleton (*note C++ +Parsers::). However, if you do use the default skeleton and want to +allow the parsing stack to grow, be careful not to use semantic types or +location types that require non-trivial copy constructors. The C +skeleton bypasses these constructors when copying data to new, larger +stacks. + + +File: bison.info, Node: Error Recovery, Next: Context Dependency, Prev: Algorithm, Up: Top + +6 Error Recovery +**************** + +It is not usually acceptable to have a program terminate on a syntax +error. For example, a compiler should recover sufficiently to parse the +rest of the input file and check it for errors; a calculator should +accept another expression. + + In a simple interactive command parser where each input is one line, +it may be sufficient to allow ‘yyparse’ to return 1 on error and have +the caller ignore the rest of the input line when that happens (and then +call ‘yyparse’ again). But this is inadequate for a compiler, because +it forgets all the syntactic context leading up to the error. A syntax +error deep within a function in the compiler input should not cause the +compiler to treat the following line like the beginning of a source +file. + + You can define how to recover from a syntax error by writing rules to +recognize the special token ‘error’. This is a terminal symbol that is +always defined (you need not declare it) and reserved for error +handling. The Bison parser generates an ‘error’ token whenever a syntax +error happens; if you have provided a rule to recognize this token in +the current context, the parse can continue. + + For example: + + stmts: + %empty + | stmts '\n' + | stmts exp '\n' + | stmts error '\n' + + The fourth rule in this example says that an error followed by a +newline makes a valid addition to any ‘stmts’. + + What happens if a syntax error occurs in the middle of an ‘exp’? The +error recovery rule, interpreted strictly, applies to the precise +sequence of a ‘stmts’, an ‘error’ and a newline. If an error occurs in +the middle of an ‘exp’, there will probably be some additional tokens +and subexpressions on the stack after the last ‘stmts’, and there will +be tokens to read before the next newline. So the rule is not +applicable in the ordinary way. + + But Bison can force the situation to fit the rule, by discarding part +of the semantic context and part of the input. First it discards states +and objects from the stack until it gets back to a state in which the +‘error’ token is acceptable. (This means that the subexpressions +already parsed are discarded, back to the last complete ‘stmts’.) At +this point the ‘error’ token can be shifted. Then, if the old lookahead +token is not acceptable to be shifted next, the parser reads tokens and +discards them until it finds a token which is acceptable. In this +example, Bison reads and discards input until the next newline so that +the fourth rule can apply. Note that discarded symbols are possible +sources of memory leaks, see *note Destructor Decl::, for a means to +reclaim this memory. + + The choice of error rules in the grammar is a choice of strategies +for error recovery. A simple and useful strategy is simply to skip the +rest of the current input line or current statement if an error is +detected: + + stmt: error ';' /* On error, skip until ';' is read. */ + + It is also useful to recover to the matching close-delimiter of an +opening-delimiter that has already been parsed. Otherwise the +close-delimiter will probably appear to be unmatched, and generate +another, spurious error message: + + primary: + '(' expr ')' + | '(' error ')' + ... + ; + + Error recovery strategies are necessarily guesses. When they guess +wrong, one syntax error often leads to another. In the above example, +the error recovery rule guesses that an error is due to bad input within +one ‘stmt’. Suppose that instead a spurious semicolon is inserted in +the middle of a valid ‘stmt’. After the error recovery rule recovers +from the first error, another syntax error will be found straight away, +since the text following the spurious semicolon is also an invalid +‘stmt’. + + To prevent an outpouring of error messages, the parser will output no +error message for another syntax error that happens shortly after the +first; only after three consecutive input tokens have been successfully +shifted will error messages resume. + + Note that rules which accept the ‘error’ token may have actions, just +as any other rules can. + + You can make error messages resume immediately by using the macro +‘yyerrok’ in an action. If you do this in the error rule’s action, no +error messages will be suppressed. This macro requires no arguments; +‘yyerrok;’ is a valid C statement. + + The previous lookahead token is reanalyzed immediately after an +error. If this is unacceptable, then the macro ‘yyclearin’ may be used +to clear this token. Write the statement ‘yyclearin;’ in the error +rule’s action. *Note Action Features::. + + For example, suppose that on a syntax error, an error handling +routine is called that advances the input stream to some point where +parsing should once again commence. The next symbol returned by the +lexical scanner is probably correct. The previous lookahead token ought +to be discarded with ‘yyclearin;’. + + The expression ‘YYRECOVERING ()’ yields 1 when the parser is +recovering from a syntax error, and 0 otherwise. Syntax error +diagnostics are suppressed while recovering from a syntax error. + + +File: bison.info, Node: Context Dependency, Next: Debugging, Prev: Error Recovery, Up: Top + +7 Handling Context Dependencies +******************************* + +The Bison paradigm is to parse tokens first, then group them into larger +syntactic units. In many languages, the meaning of a token is affected +by its context. Although this violates the Bison paradigm, certain +techniques (known as “kludges”) may enable you to write Bison parsers +for such languages. + +* Menu: + +* Semantic Tokens:: Token parsing can depend on the semantic context. +* Lexical Tie-ins:: Token parsing can depend on the syntactic context. +* Tie-in Recovery:: Lexical tie-ins have implications for how + error recovery rules must be written. + + (Actually, “kludge” means any technique that gets its job done but is +neither clean nor robust.) + + +File: bison.info, Node: Semantic Tokens, Next: Lexical Tie-ins, Up: Context Dependency + +7.1 Semantic Info in Token Kinds +================================ + +The C language has a context dependency: the way an identifier is used +depends on what its current meaning is. For example, consider this: + + foo (x); + + This looks like a function call statement, but if ‘foo’ is a typedef +name, then this is actually a declaration of ‘x’. How can a Bison +parser for C decide how to parse this input? + + The method used in GNU C is to have two different token kinds, +‘IDENTIFIER’ and ‘TYPENAME’. When ‘yylex’ finds an identifier, it looks +up the current declaration of the identifier in order to decide which +token kind to return: ‘TYPENAME’ if the identifier is declared as a +typedef, ‘IDENTIFIER’ otherwise. + + The grammar rules can then express the context dependency by the +choice of token kind to recognize. ‘IDENTIFIER’ is accepted as an +expression, but ‘TYPENAME’ is not. ‘TYPENAME’ can start a declaration, +but ‘IDENTIFIER’ cannot. In contexts where the meaning of the +identifier is _not_ significant, such as in declarations that can shadow +a typedef name, either ‘TYPENAME’ or ‘IDENTIFIER’ is accepted—there is +one rule for each of the two token kinds. + + This technique is simple to use if the decision of which kinds of +identifiers to allow is made at a place close to where the identifier is +parsed. But in C this is not always so: C allows a declaration to +redeclare a typedef name provided an explicit type has been specified +earlier: + + typedef int foo, bar; + int baz (void) + { + static bar (bar); /* redeclare ‘bar’ as static variable */ + extern foo foo (foo); /* redeclare ‘foo’ as function */ + return foo (bar); + } + + Unfortunately, the name being declared is separated from the +declaration construct itself by a complicated syntactic structure—the +“declarator”. + + As a result, part of the Bison parser for C needs to be duplicated, +with all the nonterminal names changed: once for parsing a declaration +in which a typedef name can be redefined, and once for parsing a +declaration in which that can’t be done. Here is a part of the +duplication, with actions omitted for brevity: + + initdcl: + declarator maybeasm '=' init + | declarator maybeasm + ; + + notype_initdcl: + notype_declarator maybeasm '=' init + | notype_declarator maybeasm + ; + +Here ‘initdcl’ can redeclare a typedef name, but ‘notype_initdcl’ +cannot. The distinction between ‘declarator’ and ‘notype_declarator’ is +the same sort of thing. + + There is some similarity between this technique and a lexical tie-in +(described next), in that information which alters the lexical analysis +is changed during parsing by other parts of the program. The difference +is here the information is global, and is used for other purposes in the +program. A true lexical tie-in has a special-purpose flag controlled by +the syntactic context. + + +File: bison.info, Node: Lexical Tie-ins, Next: Tie-in Recovery, Prev: Semantic Tokens, Up: Context Dependency + +7.2 Lexical Tie-ins +=================== + +One way to handle context-dependency is the “lexical tie-in”: a flag +which is set by Bison actions, whose purpose is to alter the way tokens +are parsed. + + For example, suppose we have a language vaguely like C, but with a +special construct ‘hex (HEX-EXPR)’. After the keyword ‘hex’ comes an +expression in parentheses in which all integers are hexadecimal. In +particular, the token ‘a1b’ must be treated as an integer rather than as +an identifier if it appears in that context. Here is how you can do it: + + %{ + int hexflag; + int yylex (void); + void yyerror (char const *); + %} + %% + ... + expr: + IDENTIFIER + | constant + | HEX '(' { hexflag = 1; } + expr ')' { hexflag = 0; $$ = $4; } + | expr '+' expr { $$ = make_sum ($1, $3); } + ... + ; + + constant: + INTEGER + | STRING + ; + +Here we assume that ‘yylex’ looks at the value of ‘hexflag’; when it is +nonzero, all integers are parsed in hexadecimal, and tokens starting +with letters are parsed as integers if possible. + + The declaration of ‘hexflag’ shown in the prologue of the grammar +file is needed to make it accessible to the actions (*note Prologue::). +You must also write the code in ‘yylex’ to obey the flag. + + +File: bison.info, Node: Tie-in Recovery, Prev: Lexical Tie-ins, Up: Context Dependency + +7.3 Lexical Tie-ins and Error Recovery +====================================== + +Lexical tie-ins make strict demands on any error recovery rules you +have. *Note Error Recovery::. + + The reason for this is that the purpose of an error recovery rule is +to abort the parsing of one construct and resume in some larger +construct. For example, in C-like languages, a typical error recovery +rule is to skip tokens until the next semicolon, and then start a new +statement, like this: + + stmt: + expr ';' + | IF '(' expr ')' stmt { ... } + ... + | error ';' { hexflag = 0; } + ; + + If there is a syntax error in the middle of a ‘hex (EXPR)’ construct, +this error rule will apply, and then the action for the completed ‘hex +(EXPR)’ will never run. So ‘hexflag’ would remain set for the entire +rest of the input, or until the next ‘hex’ keyword, causing identifiers +to be misinterpreted as integers. + + To avoid this problem the error recovery rule itself clears +‘hexflag’. + + There may also be an error recovery rule that works within +expressions. For example, there could be a rule which applies within +parentheses and skips to the close-parenthesis: + + expr: + ... + | '(' expr ')' { $$ = $2; } + | '(' error ')' + ... + + If this rule acts within the ‘hex’ construct, it is not going to +abort that construct (since it applies to an inner level of parentheses +within the construct). Therefore, it should not clear the flag: the +rest of the ‘hex’ construct should be parsed with the flag still in +effect. + + What if there is an error recovery rule which might abort out of the +‘hex’ construct or might not, depending on circumstances? There is no +way you can write the action to determine whether a ‘hex’ construct is +being aborted or not. So if you are using a lexical tie-in, you had +better make sure your error recovery rules are not of this kind. Each +rule must be such that you can be sure that it always will, or always +won’t, have to clear the flag. + + +File: bison.info, Node: Debugging, Next: Invocation, Prev: Context Dependency, Up: Top + +8 Debugging Your Parser +*********************** + +Developing a parser can be a challenge, especially if you don’t +understand the algorithm (*note Algorithm::). This chapter explains how +to understand and debug a parser. + + The most frequent issue users face is solving their conflicts. To +fix them, the first step is understanding how they arise in a given +grammar. This is made much easier by automated generation of +counterexamples, cover in the first section (*note Counterexamples::). + + In most cases though, looking at the structure of the automaton is +still needed. The following sections explain how to generate and read +the detailed structural description of the automaton. There are several +formats available: + − as text, see *note Understanding::; + + − as a graph, see *note Graphviz::; + + − or as a markup report that can be turned, for instance, into HTML, + see *note Xml::. + + The last section focuses on the dynamic part of the parser: how to +enable and understand the parser run-time traces (*note Tracing::). + +* Menu: + +* Counterexamples:: Understanding conflicts. +* Understanding:: Understanding the structure of your parser. +* Graphviz:: Getting a visual representation of the parser. +* Xml:: Getting a markup representation of the parser. +* Tracing:: Tracing the execution of your parser. + + +File: bison.info, Node: Counterexamples, Next: Understanding, Up: Debugging + +8.1 Generation of Counterexamples +================================= + +Solving conflicts is probably the most delicate part of the design of an +LR parser, as demonstrated by the number of sections devoted to them in +this very documentation. To solve a conflict, one must understand it: +when does it occur? Is it because of a flaw in the grammar? Is it +rather because LR(1) cannot cope with this grammar? + + One difficulty is that conflicts occur in the _automaton_, and it can +be tricky to relate them to issues in the _grammar_ itself. With +experience and patience, analysis of the detailed description of the +automaton (*note Understanding::) allows one to find example strings +that reach these conflicts. + + That task is made much easier thanks to the generation of +counterexamples, initially developed by Chinawat Isradisaikul and Andrew +Myers (*note Isradisaikul 2015::). + + As a first example, see the grammar of *note Shift/Reduce::, which +features one shift/reduce conflict: + + $ bison else.y + else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples + +Let’s rerun ‘bison’ with the option ‘-Wcex’/‘-Wcounterexamples’(the +following output is actually in color): + + else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples] + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Shift derivation + if_stmt + ↳ 3: "if" expr "then" stmt + ↳ 2: if_stmt + ↳ 4: "if" expr "then" stmt • "else" stmt + Example: "if" expr "then" "if" expr "then" stmt • "else" stmt + Reduce derivation + if_stmt + ↳ 4: "if" expr "then" stmt "else" stmt + ↳ 2: if_stmt + ↳ 3: "if" expr "then" stmt • + + This shows two different derivations for one single expression, which +proves that the grammar is ambiguous. + + + As a more delicate example, consider the example grammar of *note +Reduce/Reduce::, which features a reduce/reduce conflict: + + %% + sequence: + %empty + | maybeword + | sequence "word" + ; + maybeword: + %empty + | "word" + ; + + Bison generates the following counterexamples: + + $ bison -Wcex sequence.y + sequence.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + sequence.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] + sequence.y: warning: shift/reduce conflict on token "word" [-Wcounterexamples] + Example: • "word" + Shift derivation + sequence + ↳ 2: maybeword + ↳ 5: • "word" + Example: • "word" + Reduce derivation + sequence + ↳ 3: sequence "word" + ↳ 1: • + sequence.y: warning: reduce/reduce conflict on tokens $end, "word" [-Wcounterexamples] + Example: • + First reduce derivation + sequence + ↳ 1: • + Example: • + Second reduce derivation + sequence + ↳ 2: maybeword + ↳ 4: • + sequence.y: warning: shift/reduce conflict on token "word" [-Wcounterexamples] + Example: • "word" + Shift derivation + sequence + ↳ 2: maybeword + ↳ 5: • "word" + Example: • "word" + Reduce derivation + sequence + ↳ 3: sequence "word" + ↳ 2: maybeword + ↳ 4: • + sequence.y:8.3-45: warning: rule useless in parser due to conflicts [-Wother] + 8 | %empty { printf ("empty maybeword\n"); } + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Each of these three conflicts, again, prove that the grammar is +ambiguous. For instance, the second conflict (the reduce/reduce one) +shows that the grammar accepts the empty input in two different ways. + + + Sometimes, the search will not find an example that can be derived in +two ways. In these cases, counterexample generation will provide two +examples that are the same up until the dot. Most notably, this will +happen when your grammar requires a stronger parser (more lookahead, LR +instead of LALR). The following example isn’t LR(1): + + %token ID + %% + s: a ID + a: expr + expr: %empty | expr ID ',' + + ‘bison’ reports: + + ids.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] + ids.y: warning: shift/reduce conflict on token ID [-Wcounterexamples] + First example: expr • ID ',' ID $end + Shift derivation + $accept + ↳ 0: s $end + ↳ 1: a ID + ↳ 2: expr + ↳ 4: expr • ID ',' + Second example: expr • ID $end + Reduce derivation + $accept + ↳ 0: s $end + ↳ 1: a ID + ↳ 2: expr • + ids.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother] + 4 | a: expr + | ^~~~ + + This conflict is caused by the parser not having enough information +to know the difference between these two examples. The parser would +need an additional lookahead token to know whether or not a comma +follows the ‘ID’ after ‘expr’. These types of conflicts tend to be more +difficult to fix, and usually need a rework of the grammar. In this +case, it can be fixed by changing around the recursion: ‘expr: ID | ',' +expr ID’. + + Alternatively, you might also want to consider using a GLR parser +(*note GLR Parsers::). + + + On occasions, it is useful to look at counterexamples _in situ_: with +the automaton report (*Note Understanding::, in particular *note State +8: state-8.). + + +File: bison.info, Node: Understanding, Next: Graphviz, Prev: Counterexamples, Up: Debugging + +8.2 Understanding Your Parser +============================= + +Bison parsers are “shift/reduce automata” (*note Algorithm::). In some +cases (much more frequent than one would hope), looking at this +automaton is required to tune or simply fix a parser. + + The textual file is generated when the options ‘--report’ or +‘--verbose’ are specified, see *note Invocation::. Its name is made by +removing ‘.tab.c’ or ‘.c’ from the parser implementation file name, and +adding ‘.output’ instead. Therefore, if the grammar file is ‘foo.y’, +then the parser implementation file is called ‘foo.tab.c’ by default. +As a consequence, the verbose output file is called ‘foo.output’. + + The following grammar file, ‘calc.y’, will be used in the sequel: + + %union + { + int ival; + const char *sval; + } + %token NUM + %nterm exp + %token STR + %nterm useless + %left '+' '-' + %left '*' + %% + exp: + exp '+' exp + | exp '-' exp + | exp '*' exp + | exp '/' exp + | NUM + ; + useless: STR; + %% + + ‘bison’ reports: + + calc.y: warning: 1 nonterminal useless in grammar [-Wother] + calc.y: warning: 1 rule useless in grammar [-Wother] + calc.y:19.1-7: warning: nonterminal useless in grammar: useless [-Wother] + 19 | useless: STR; + | ^~~~~~~ + calc.y: warning: 7 shift/reduce conflicts [-Wconflicts-sr] + calc.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples + + Going back to the calc example, when given ‘--report=state’, in +addition to ‘calc.tab.c’, it creates a file ‘calc.output’ with contents +detailed below. The order of the output and the exact presentation +might vary, but the interpretation is the same. + +The first section reports useless tokens, nonterminals and rules. +Useless nonterminals and rules are removed in order to produce a smaller +parser, but useless tokens are preserved, since they might be used by +the scanner (note the difference between “useless” and “unused” below): + + Nonterminals useless in grammar + useless + + Terminals unused in grammar + STR + + Rules useless in grammar + 6 useless: STR + +The next section lists states that still have conflicts. + + State 8 conflicts: 1 shift/reduce + State 9 conflicts: 1 shift/reduce + State 10 conflicts: 1 shift/reduce + State 11 conflicts: 4 shift/reduce + +Then Bison reproduces the exact grammar it used: + + Grammar + + 0 $accept: exp $end + + 1 exp: exp '+' exp + 2 | exp '-' exp + 3 | exp '*' exp + 4 | exp '/' exp + 5 | NUM + +and reports the uses of the symbols: + + Terminals, with rules where they appear + + $end (0) 0 + '*' (42) 3 + '+' (43) 1 + '-' (45) 2 + '/' (47) 4 + error (256) + NUM (258) 5 + STR (259) + + Nonterminals, with rules where they appear + + $accept (9) + on left: 0 + exp (10) + on left: 1 2 3 4 5 + on right: 0 1 2 3 4 + +Bison then proceeds onto the automaton itself, describing each state +with its set of “items”, also known as “dotted rules”. Each item is a +production rule together with a point (‘.’) marking the location of the +input cursor. + + State 0 + + 0 $accept: • exp $end + + NUM shift, and go to state 1 + + exp go to state 2 + + This reads as follows: “state 0 corresponds to being at the very +beginning of the parsing, in the initial rule, right before the start +symbol (here, ‘exp’). When the parser returns to this state right after +having reduced a rule that produced an ‘exp’, the control flow jumps to +state 2. If there is no such transition on a nonterminal symbol, and +the lookahead is a ‘NUM’, then this token is shifted onto the parse +stack, and the control flow jumps to state 1. Any other lookahead +triggers a syntax error.” + + Even though the only active rule in state 0 seems to be rule 0, the +report lists ‘NUM’ as a lookahead token because ‘NUM’ can be at the +beginning of any rule deriving an ‘exp’. By default Bison reports the +so-called “core” or “kernel” of the item set, but if you want to see +more detail you can invoke ‘bison’ with ‘--report=itemset’ to list the +derived items as well: + + State 0 + + 0 $accept: • exp $end + 1 exp: • exp '+' exp + 2 | • exp '-' exp + 3 | • exp '*' exp + 4 | • exp '/' exp + 5 | • NUM + + NUM shift, and go to state 1 + + exp go to state 2 + +In the state 1... + + State 1 + + 5 exp: NUM • + + $default reduce using rule 5 (exp) + +the rule 5, ‘exp: NUM;’, is completed. Whatever the lookahead token +(‘$default’), the parser will reduce it. If it was coming from State 0, +then, after this reduction it will return to state 0, and will jump to +state 2 (‘exp: go to state 2’). + + State 2 + + 0 $accept: exp • $end + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp + + $end shift, and go to state 3 + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 + +In state 2, the automaton can only shift a symbol. For instance, +because of the item ‘exp: exp • '+' exp’, if the lookahead is ‘+’ it is +shifted onto the parse stack, and the automaton jumps to state 4, +corresponding to the item ‘exp: exp '+' • exp’. Since there is no +default action, any lookahead not listed triggers a syntax error. + + The state 3 is named the “final state”, or the “accepting state”: + + State 3 + + 0 $accept: exp $end • + + $default accept + +the initial rule is completed (the start symbol and the end-of-input +were read), the parsing exits successfully. + + The interpretation of states 4 to 7 is straightforward, and is left +to the reader. + + State 4 + + 1 exp: exp '+' • exp + + NUM shift, and go to state 1 + + exp go to state 8 + + + State 5 + + 2 exp: exp '-' • exp + + NUM shift, and go to state 1 + + exp go to state 9 + + + State 6 + + 3 exp: exp '*' • exp + + NUM shift, and go to state 1 + + exp go to state 10 + + + State 7 + + 4 exp: exp '/' • exp + + NUM shift, and go to state 1 + + exp go to state 11 + + As was announced in beginning of the report, ‘State 8 conflicts: 1 +shift/reduce’: + + State 8 + + 1 exp: exp • '+' exp + 1 | exp '+' exp • + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) + + Indeed, there are two actions associated to the lookahead ‘/’: either +shifting (and going to state 7), or reducing rule 1. The conflict means +that either the grammar is ambiguous, or the parser lacks information to +make the right decision. Indeed the grammar is ambiguous, as, since we +did not specify the precedence of ‘/’, the sentence ‘NUM + NUM / NUM’ +can be parsed as ‘NUM + (NUM / NUM)’, which corresponds to shifting ‘/’, +or as ‘(NUM + NUM) / NUM’, which corresponds to reducing rule 1. + + Because in deterministic parsing a single decision can be made, Bison +arbitrarily chose to disable the reduction, see *note Shift/Reduce::. +Discarded actions are reported between square brackets. + + Note that all the previous states had a single possible action: +either shifting the next token and going to the corresponding state, or +reducing a single rule. In the other cases, i.e., when shifting _and_ +reducing is possible or when _several_ reductions are possible, the +lookahead is required to select the action. State 8 is one such state: +if the lookahead is ‘*’ or ‘/’ then the action is shifting, otherwise +the action is reducing rule 1. In other words, the first two items, +corresponding to rule 1, are not eligible when the lookahead token is +‘*’, since we specified that ‘*’ has higher precedence than ‘+’. More +generally, some items are eligible only with some set of possible +lookahead tokens. When run with ‘--report=lookahead’, Bison specifies +these lookahead tokens: + + State 8 + + 1 exp: exp • '+' exp + 1 | exp '+' exp • [$end, '+', '-', '/'] + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) + + Note however that while ‘NUM + NUM / NUM’ is ambiguous (which results +in the conflicts on ‘/’), ‘NUM + NUM * NUM’ is not: the conflict was +solved thanks to associativity and precedence directives. If invoked +with ‘--report=solved’, Bison includes information about the solved +conflicts in the report: + + Conflict between rule 1 and token '+' resolved as reduce (%left '+'). + Conflict between rule 1 and token '-' resolved as reduce (%left '-'). + Conflict between rule 1 and token '*' resolved as shift ('+' < '*'). + + When given ‘--report=counterexamples’, ‘bison’ will generate +counterexamples within the report, augmented with the corresponding +items (*note Counterexamples::). + + shift/reduce conflict on token '/': + 1 exp: exp '+' exp • + 4 exp: exp • '/' exp + Example: exp '+' exp • '/' exp + Shift derivation + exp + ↳ 1: exp '+' exp + ↳ 4: exp • '/' exp + Example: exp '+' exp • '/' exp + Reduce derivation + exp + ↳ 4: exp '/' exp + ↳ 1: exp '+' exp • + + This shows two separate derivations in the grammar for the same +‘exp’: ‘e1 + e2 / e3’. The derivations show how your rules would parse +the given example. Here, the first derivation completes a reduction +when seeing ‘/’, causing ‘e1 + e2’ to be grouped as an ‘exp’. The +second derivation shifts on ‘/’, resulting in ‘e2 / e3’ being grouped as +an ‘exp’. Therefore, it is easy to see that adding +precedence/associativity directives would fix this conflict. + + The remaining states are similar: + + State 9 + + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 2 | exp '-' exp • + 3 | exp • '*' exp + 4 | exp • '/' exp + + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '/' [reduce using rule 2 (exp)] + $default reduce using rule 2 (exp) + + State 10 + + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 3 | exp '*' exp • + 4 | exp • '/' exp + + '/' shift, and go to state 7 + + '/' [reduce using rule 3 (exp)] + $default reduce using rule 3 (exp) + + State 11 + + 1 exp: exp • '+' exp + 2 | exp • '-' exp + 3 | exp • '*' exp + 4 | exp • '/' exp + 4 | exp '/' exp • + + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 + + '+' [reduce using rule 4 (exp)] + '-' [reduce using rule 4 (exp)] + '*' [reduce using rule 4 (exp)] + '/' [reduce using rule 4 (exp)] + $default reduce using rule 4 (exp) + +Observe that state 11 contains conflicts not only due to the lack of +precedence of ‘/’ with respect to ‘+’, ‘-’, and ‘*’, but also because +the associativity of ‘/’ is not specified. + + Bison may also produce an HTML version of this output, via an XML +file and XSLT processing (*note Xml::). + + +File: bison.info, Node: Graphviz, Next: Xml, Prev: Understanding, Up: Debugging + +8.3 Visualizing Your Parser +=========================== + +As another means to gain better understanding of the shift/reduce +automaton corresponding to the Bison parser, a DOT file can be +generated. Note that debugging a real grammar with this is tedious at +best, and impractical most of the times, because the generated files are +huge (the generation of a PDF or PNG file from it will take very long, +and more often than not it will fail due to memory exhaustion). This +option was rather designed for beginners, to help them understand LR +parsers. + + This file is generated when the ‘--graph’ option is specified (*note +Invocation::). Its name is made by removing ‘.tab.c’ or ‘.c’ from the +parser implementation file name, and adding ‘.gv’ instead. If the +grammar file is ‘foo.y’, the Graphviz output file is called ‘foo.gv’. A +DOT file may also be produced via an XML file and XSLT processing (*note +Xml::). + + The following grammar file, ‘rr.y’, will be used in the sequel: + + %% + exp: a ";" | b "."; + a: "0"; + b: "0"; + + The graphical output is very similar to the textual one, and as such +it is easier understood by making direct comparisons between them. +*Note Debugging::, for a detailed analysis of the textual report. + +Graphical Representation of States +---------------------------------- + +The items (dotted rules) for each state are grouped together in graph +nodes. Their numbering is the same as in the verbose file. See the +following points, about transitions, for examples + + When invoked with ‘--report=lookaheads’, the lookahead tokens, when +needed, are shown next to the relevant rule between square brackets as a +comma separated list. This is the case in the figure for the +representation of reductions, below. + + + The transitions are represented as directed edges between the current +and the target states. + +Graphical Representation of Shifts +---------------------------------- + +Shifts are shown as solid arrows, labeled with the lookahead token for +that shift. The following describes a reduction in the ‘rr.output’ +file: + + State 3 + + 1 exp: a • ";" + + ";" shift, and go to state 6 + + A Graphviz rendering of this portion of the graph could be: + +[image src="figs/example-shift.svg" text=".----------------. +| State 3 | +| 1 exp: a • \";\" | +`----------------' + | + | \";\" + | + v +.----------------. +| State 6 | +| 1 exp: a \";\" • | +`----------------'"] + +Graphical Representation of Reductions +-------------------------------------- + +Reductions are shown as solid arrows, leading to a diamond-shaped node +bearing the number of the reduction rule. The arrow is labeled with the +appropriate comma separated lookahead tokens. If the reduction is the +default action for the given state, there is no such label. + + This is how reductions are represented in the verbose file +‘rr.output’: + State 1 + + 3 a: "0" • [";"] + 4 b: "0" • ["."] + + "." reduce using rule 4 (b) + $default reduce using rule 3 (a) + + A Graphviz rendering of this portion of the graph could be: + +[image src="figs/example-reduce.svg" text=" .------------------. + | State 1 | + | 3 a: \"0\" • [\";\"] | + | 4 b: \"0\" • [\".\"] | + `------------------' + / \\ + / \\ [\".\"] + / \\ + v v + / \\ / \\ + / R \\ / R \\ +(green) \\ 3 / \\ 4 / (green) + \\ / \\ /"] + + When unresolved conflicts are present, because in deterministic +parsing a single decision can be made, Bison can arbitrarily choose to +disable a reduction, see *note Shift/Reduce::. Discarded actions are +distinguished by a red filling color on these nodes, just like how they +are reported between square brackets in the verbose file. + + The reduction corresponding to the rule number 0 is the acceptation +state. It is shown as a blue diamond, labeled “Acc”. + +Graphical Representation of Gotos +--------------------------------- + +The ‘go to’ jump transitions are represented as dotted lines bearing the +name of the rule being jumped to. + + +File: bison.info, Node: Xml, Next: Tracing, Prev: Graphviz, Up: Debugging + +8.4 Visualizing your parser in multiple formats +=============================================== + +Bison supports two major report formats: textual output (*note +Understanding::) when invoked with option ‘--verbose’, and DOT (*note +Graphviz::) when invoked with option ‘--graph’. However, another +alternative is to output an XML file that may then be, with ‘xsltproc’, +rendered as either a raw text format equivalent to the verbose file, or +as an HTML version of the same file, with clickable transitions, or even +as a DOT. The ‘.output’ and DOT files obtained via XSLT have no +difference whatsoever with those obtained by invoking ‘bison’ with +options ‘--verbose’ or ‘--graph’. + + The XML file is generated when the options ‘-x’ or ‘--xml[=FILE]’ are +specified, see *note Invocation::. If not specified, its name is made +by removing ‘.tab.c’ or ‘.c’ from the parser implementation file name, +and adding ‘.xml’ instead. For instance, if the grammar file is +‘foo.y’, the default XML output file is ‘foo.xml’. + + Bison ships with a ‘data/xslt’ directory, containing XSL +Transformation files to apply to the XML file. Their names are +non-ambiguous: + +‘xml2dot.xsl’ + Used to output a copy of the DOT visualization of the automaton. +‘xml2text.xsl’ + Used to output a copy of the ‘.output’ file. +‘xml2xhtml.xsl’ + Used to output an xhtml enhancement of the ‘.output’ file. + + Sample usage (requires ‘xsltproc’): + $ bison -x gr.y + $ bison --print-datadir + /usr/local/share/bison + $ xsltproc /usr/local/share/bison/xslt/xml2xhtml.xsl gr.xml >gr.html + + +File: bison.info, Node: Tracing, Prev: Xml, Up: Debugging + +8.5 Tracing Your Parser +======================= + +When a Bison grammar compiles properly but parses “incorrectly”, the +‘yydebug’ parser-trace feature helps figuring out why. + +* Menu: + +* Enabling Traces:: Activating run-time trace support +* Mfcalc Traces:: Extending ‘mfcalc’ to support traces + + +File: bison.info, Node: Enabling Traces, Next: Mfcalc Traces, Up: Tracing + +8.5.1 Enabling Traces +--------------------- + +There are several means to enable compilation of trace facilities, in +decreasing order of preference: + +the variable ‘parse.trace’ + Add the ‘%define parse.trace’ directive (*note %define Summary::), + or pass the ‘-Dparse.trace’ option (*note Tuning the Parser::). + This is a Bison extension. Unless POSIX and Yacc portability + matter to you, this is the preferred solution. + +the option ‘-t’ (POSIX Yacc compliant) +the option ‘--debug’ (Bison extension) + Use the ‘-t’ option when you run Bison (*note Invocation::). With + ‘%define api.prefix {c}’, it defines ‘CDEBUG’ to 1, otherwise it + defines ‘YYDEBUG’ to 1. + +the directive ‘%debug’ (deprecated) + Add the ‘%debug’ directive (*note Decl Summary::). This Bison + extension is maintained for backward compatibility; use ‘%define + parse.trace’ instead. + +the macro ‘YYDEBUG’ (C/C++ only) + Define the macro ‘YYDEBUG’ to a nonzero value when you compile the + parser. This is compliant with POSIX Yacc. You could use + ‘-DYYDEBUG=1’ as a compiler option or you could put ‘#define + YYDEBUG 1’ in the prologue of the grammar file (*note Prologue::). + + If the ‘%define’ variable ‘api.prefix’ is used (*note Multiple + Parsers::), for instance ‘%define api.prefix {c}’, then if ‘CDEBUG’ + is defined, its value controls the tracing feature (enabled if and + only if nonzero); otherwise tracing is enabled if and only if + ‘YYDEBUG’ is nonzero. + + In C++, where POSIX compliance makes no sense, avoid this option, + and prefer ‘%define parse.trace’. If you ‘#define’ the ‘YYDEBUG’ + macro at the wrong place (e.g., in ‘%code top’ instead of ‘%code + require’), the parser class will have two different definitions, + thus leading to ODR violations and happy debugging times. + + We suggest that you always enable the trace option so that debugging +is always possible. + + In C the trace facility outputs messages with macro calls of the form +‘YYFPRINTF (stderr, FORMAT, ARGS)’ where FORMAT and ARGS are the usual +‘printf’ format and variadic arguments. If you define ‘YYDEBUG’ to a +nonzero value but do not define ‘YYFPRINTF’, ‘’ is +automatically included and ‘YYFPRINTF’ is defined to ‘fprintf’. + + Once you have compiled the program with trace facilities, the way to +request a trace is to store a nonzero value in the variable ‘yydebug’. +You can do this by making the C code do it (in ‘main’, perhaps), or you +can alter the value with a C debugger. + + Each step taken by the parser when ‘yydebug’ is nonzero produces a +line or two of trace information, written on ‘stderr’. The trace +messages tell you these things: + + • Each time the parser calls ‘yylex’, what kind of token was read. + + • Each time a token is shifted, the depth and complete contents of + the state stack (*note Parser States::). + + • Each time a rule is reduced, which rule it is, and the complete + contents of the state stack afterward. + + To make sense of this information, it helps to refer to the automaton +description file (*note Understanding::). This file shows the meaning +of each state in terms of positions in various rules, and also what each +state will do with each possible input token. As you read the +successive trace messages, you can see that the parser is functioning +according to its specification in the listing file. Eventually you will +arrive at the place where something undesirable happens, and you will +see which parts of the grammar are to blame. + + The parser implementation file is a C/C++/D/Java program and you can +use debuggers on it, but it’s not easy to interpret what it is doing. +The parser function is a finite-state machine interpreter, and aside +from the actions it executes the same code over and over. Only the +values of variables show where in the grammar it is working. + + +File: bison.info, Node: Mfcalc Traces, Prev: Enabling Traces, Up: Tracing + +8.5.2 Enabling Debug Traces for ‘mfcalc’ +---------------------------------------- + +The debugging information normally gives the token kind of each token +read, but not its semantic value. The ‘%printer’ directive allows +specify how semantic values are reported, see *note Printer Decl::. + + As a demonstration of ‘%printer’, consider the multi-function +calculator, ‘mfcalc’ (*note Multi-function Calc::). To enable run-time +traces, and semantic value reports, insert the following directives in +its prologue: + + /* Generate the parser description file. */ + %verbose + /* Enable run-time traces (yydebug). */ + %define parse.trace + + /* Formatting semantic values. */ + %printer { fprintf (yyo, "%s", $$->name); } VAR; + %printer { fprintf (yyo, "%s()", $$->name); } FUN; + %printer { fprintf (yyo, "%g", $$); } ; + + The ‘%define’ directive instructs Bison to generate run-time trace +support. Then, activation of these traces is controlled at run-time by +the ‘yydebug’ variable, which is disabled by default. Because these +traces will refer to the “states” of the parser, it is helpful to ask +for the creation of a description of that parser; this is the purpose of +(admittedly ill-named) ‘%verbose’ directive. + + The set of ‘%printer’ directives demonstrates how to format the +semantic value in the traces. Note that the specification can be done +either on the symbol type (e.g., ‘VAR’ or ‘FUN’), or on the type tag: +since ‘’ is the type for both ‘NUM’ and ‘exp’, this printer will +be used for them. + + Here is a sample of the information provided by run-time traces. The +traces are sent onto standard error. + + $ echo 'sin(1-1)' | ./mfcalc -p + Starting parse + Entering state 0 + Reducing stack by rule 1 (line 34): + -> $$ = nterm input () + Stack now 0 + Entering state 1 + +This first batch shows a specific feature of this grammar: the first +rule (which is in line 34 of ‘mfcalc.y’ can be reduced without even +having to look for the first token. The resulting left-hand symbol +(‘$$’) is a valueless (‘()’) ‘input’ nonterminal (‘nterm’). + + Then the parser calls the scanner. + Reading a token + Next token is token FUN (sin()) + Shifting token FUN (sin()) + Entering state 6 + +That token (‘token’) is a function (‘FUN’) whose value is ‘sin’ as +formatted per our ‘%printer’ specification: ‘sin()’. The parser stores +(‘Shifting’) that token, and others, until it can do something about it. + + Reading a token + Next token is token '(' () + Shifting token '(' () + Entering state 14 + Reading a token + Next token is token NUM (1.000000) + Shifting token NUM (1.000000) + Entering state 4 + Reducing stack by rule 6 (line 44): + $1 = token NUM (1.000000) + -> $$ = nterm exp (1.000000) + Stack now 0 1 6 14 + Entering state 24 + +The previous reduction demonstrates the ‘%printer’ directive for +‘’: both the token ‘NUM’ and the resulting nonterminal ‘exp’ +have ‘1’ as value. + + Reading a token + Next token is token '-' () + Shifting token '-' () + Entering state 17 + Reading a token + Next token is token NUM (1.000000) + Shifting token NUM (1.000000) + Entering state 4 + Reducing stack by rule 6 (line 44): + $1 = token NUM (1.000000) + -> $$ = nterm exp (1.000000) + Stack now 0 1 6 14 24 17 + Entering state 26 + Reading a token + Next token is token ')' () + Reducing stack by rule 11 (line 49): + $1 = nterm exp (1.000000) + $2 = token '-' () + $3 = nterm exp (1.000000) + -> $$ = nterm exp (0.000000) + Stack now 0 1 6 14 + Entering state 24 + +The rule for the subtraction was just reduced. The parser is about to +discover the end of the call to ‘sin’. + + Next token is token ')' () + Shifting token ')' () + Entering state 31 + Reducing stack by rule 9 (line 47): + $1 = token FUN (sin()) + $2 = token '(' () + $3 = nterm exp (0.000000) + $4 = token ')' () + -> $$ = nterm exp (0.000000) + Stack now 0 1 + Entering state 11 + +Finally, the end-of-line allow the parser to complete the computation, +and display its result. + + Reading a token + Next token is token '\n' () + Shifting token '\n' () + Entering state 22 + Reducing stack by rule 4 (line 40): + $1 = nterm exp (0.000000) + $2 = token '\n' () + ⇒ 0 + -> $$ = nterm line () + Stack now 0 1 + Entering state 10 + Reducing stack by rule 2 (line 35): + $1 = nterm input () + $2 = nterm line () + -> $$ = nterm input () + Stack now 0 + Entering state 1 + + The parser has returned into state 1, in which it is waiting for the +next expression to evaluate, or for the end-of-file token, which causes +the completion of the parsing. + + Reading a token + Now at end of input. + Shifting token $end () + Entering state 2 + Stack now 0 1 2 + Cleanup: popping token $end () + Cleanup: popping nterm input () + + +File: bison.info, Node: Invocation, Next: Other Languages, Prev: Debugging, Up: Top + +9 Invoking Bison +**************** + +The usual way to invoke Bison is as follows: + + $ bison FILE + + Here FILE is the grammar file name, which usually ends in ‘.y’. The +parser implementation file’s name is made by replacing the ‘.y’ with +‘.tab.c’ and removing any leading directory. Thus, the ‘bison foo.y’ +file name yields ‘foo.tab.c’, and the ‘bison hack/foo.y’ file name +yields ‘foo.tab.c’. It’s also possible, in case you are writing C++ +code instead of C in your grammar file, to name it ‘foo.ypp’ or +‘foo.y++’. Then, the output files will take an extension like the given +one as input (respectively ‘foo.tab.cpp’ and ‘foo.tab.c++’). This +feature takes effect with all options that manipulate file names like +‘-o’ or ‘-d’. + + For example: + + $ bison -d FILE.YXX +will produce ‘file.tab.cxx’ and ‘file.tab.hxx’, and + + $ bison -d -o OUTPUT.C++ FILE.Y +will produce ‘output.c++’ and ‘output.h++’. + + For compatibility with POSIX, the standard Bison distribution also +contains a shell script called ‘yacc’ that invokes Bison with the ‘-y’ +option. + + + The exit status of ‘bison’ is: +0 (success) + when there were no errors. Warnings, which are diagnostics about + dubious constructs, do not change the exit status, unless they are + turned into errors (*note ‘-Werror’: Werror.). + +1 (failure) + when there were errors. No file was generated (except the reports + generated by ‘--verbose’, etc.). In particular, the output files + that possibly existed were not changed. + +63 (mismatch) + when ‘bison’ does not meet the version requirements of the grammar + file. *Note Require Decl::. No file was generated or changed. + +* Menu: + +* Bison Options:: All the options described in detail, + in alphabetical order by short options. +* Option Cross Key:: Alphabetical list of long options. +* Yacc Library:: Yacc-compatible ‘yylex’ and ‘main’. + + +File: bison.info, Node: Bison Options, Next: Option Cross Key, Up: Invocation + +9.1 Bison Options +================= + +Bison supports both traditional single-letter options and mnemonic long +option names. Long option names are indicated with ‘--’ instead of ‘-’. +Abbreviations for option names are allowed as long as they are unique. +When a long option takes an argument, like ‘--file-prefix’, connect the +option name and the argument with ‘=’. + + Here is a list of options that can be used with Bison. It is +followed by a cross key alphabetized by long option. + +* Menu: + +* Operation Modes:: Options controlling the global behavior of ‘bison’ +* Diagnostics:: Options controlling the diagnostics +* Tuning the Parser:: Options changing the generated parsers +* Output Files:: Options controlling the output + + +File: bison.info, Node: Operation Modes, Next: Diagnostics, Up: Bison Options + +9.1.1 Operation Modes +--------------------- + +Options controlling the global behavior of ‘bison’. + +‘-h’ +‘--help’ + Print a summary of the command-line options to Bison and exit. + +‘-V’ +‘--version’ + Print the version number of Bison and exit. + +‘--print-localedir’ + Print the name of the directory containing locale-dependent data. + +‘--print-datadir’ + Print the name of the directory containing skeletons, CSS and XSLT. + +‘-u’ +‘--update’ + Update the grammar file (remove duplicates, update deprecated + directives, etc.) and exit (i.e., do not generate any of the + output files). Leaves a backup of the original file with a ‘~’ + appended. For instance: + + $ cat foo.y + %error-verbose + %define parse.error verbose + %% + exp:; + $ bison -u foo.y + foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated] + 1 | %error-verbose + | ^~~~~~~~~~~~~~ + foo.y:2.1-27: warning: %define variable 'parse.error' redefined [-Wother] + 2 | %define parse.error verbose + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ + foo.y:1.1-14: previous definition + 1 | %error-verbose + | ^~~~~~~~~~~~~~ + bison: file 'foo.y' was updated (backup: 'foo.y~') + $ cat foo.y + %define parse.error verbose + %% + exp:; + + See the documentation of ‘--feature=fixit’ below for more details. + +‘-f [FEATURE]’ +‘--feature[=FEATURE]’ + Activate miscellaneous FEATUREs. FEATURE can be one of: + ‘caret’ + ‘diagnostics-show-caret’ + Show caret errors, in a manner similar to GCC’s + ‘-fdiagnostics-show-caret’, or Clang’s ‘-fcaret-diagnostics’. + The location provided with the message is used to quote the + corresponding line of the source file, underlining the + important part of it with carets (‘^’). Here is an example, + using the following file ‘in.y’: + + %nterm exp + %% + exp: exp '+' exp { $exp = $1 + $2; }; + + When invoked with ‘-fcaret’ (or nothing), Bison will report: + + in.y:3.20-23: error: ambiguous reference: '$exp' + 3 | exp: exp '+' exp { $exp = $1 + $2; }; + | ^~~~ + in.y:3.1-3: refers to: $exp at $$ + 3 | exp: exp '+' exp { $exp = $1 + $2; }; + | ^~~ + in.y:3.6-8: refers to: $exp at $1 + 3 | exp: exp '+' exp { $exp = $1 + $2; }; + | ^~~ + in.y:3.14-16: refers to: $exp at $3 + 3 | exp: exp '+' exp { $exp = $1 + $2; }; + | ^~~ + in.y:3.32-33: error: $2 of 'exp' has no declared type + 3 | exp: exp '+' exp { $exp = $1 + $2; }; + | ^~ + + Whereas, when invoked with ‘-fno-caret’, Bison will only + report: + + in.y:3.20-23: error: ambiguous reference: '$exp' + in.y:3.1-3: refers to: $exp at $$ + in.y:3.6-8: refers to: $exp at $1 + in.y:3.14-16: refers to: $exp at $3 + in.y:3.32-33: error: $2 of 'exp' has no declared type + + This option is activated by default. + + ‘fixit’ + ‘diagnostics-parseable-fixits’ + Show machine-readable fixes, in a manner similar to GCC’s and + Clang’s ‘-fdiagnostics-parseable-fixits’. + + Fix-its are generated for duplicate directives: + + $ cat foo.y + %define api.prefix {foo} + %define api.prefix {bar} + %% + exp:; + + $ bison -ffixit foo.y + foo.y:2.1-24: error: %define variable 'api.prefix' redefined + 2 | %define api.prefix {bar} + | ^~~~~~~~~~~~~~~~~~~~~~~~ + foo.y:1.1-24: previous definition + 1 | %define api.prefix {foo} + | ^~~~~~~~~~~~~~~~~~~~~~~~ + fix-it:"foo.y":{2:1-2:25}:"" + foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] + + They are also generated to update deprecated directives, + unless ‘-Wno-deprecated’ was given: + + $ cat /tmp/foo.yy + %error-verbose + %name-prefix "foo" + %% + exp:; + $ bison foo.y + foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated] + 1 | %error-verbose + | ^~~~~~~~~~~~~~ + foo.y:2.1-18: warning: deprecated directive, use '%define api.prefix {foo}' [-Wdeprecated] + 2 | %name-prefix "foo" + | ^~~~~~~~~~~~~~~~~~ + foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] + + The fix-its are applied by ‘bison’ itself when given the + option ‘-u’/‘--update’. See its documentation above. + + ‘syntax-only’ + Do not generate the output files. The name of this feature is + somewhat misleading as more than just checking the syntax is + done: every stage is run (including checking for conflicts for + instance), except the generation of the output files. + + +File: bison.info, Node: Diagnostics, Next: Tuning the Parser, Prev: Operation Modes, Up: Bison Options + +9.1.2 Diagnostics +----------------- + +Options controlling the diagnostics. + +‘-W [CATEGORY]’ +‘--warnings[=CATEGORY]’ + Output warnings falling in CATEGORY. CATEGORY can be one of: + ‘conflicts-sr’ + ‘conflicts-rr’ + S/R and R/R conflicts. These warnings are enabled by default. + However, if the ‘%expect’ or ‘%expect-rr’ directive is + specified, an unexpected number of conflicts is an error, and + an expected number of conflicts is not reported, so ‘-W’ and + ‘--warning’ then have no effect on the conflict report. + + ‘counterexamples’ + ‘cex’ + Provide counterexamples for conflicts. *Note + Counterexamples::. Counterexamples take time to compute. The + option ‘-Wcex’ should be used by the developer when working on + the grammar; it hardly makes sense to use it in a CI. + + ‘dangling-alias’ + Report string literals that are not bound to a token symbol. + + String literals, which allow for better error messages, are + (too) liberally accepted by Bison, which might result in + silent errors. For instance + + %type cond "condition" + + does not define “condition” as a string alias to + ‘cond’—nonterminal symbols do not have string aliases. It is + rather equivalent to + + %nterm cond + %token "condition" + + i.e., it gives the ‘"condition"’ token the type ‘exVal’. + + Also, because string aliases do not need to be defined, typos + such as ‘"baz"’ instead of ‘"bar"’ will be not reported. + + The option ‘-Wdangling-alias’ catches these situations. On + + %token BAR "bar" + %type foo "foo" + %% + foo: "baz" {} + + ‘bison -Wdangling-alias’ reports + + warning: string literal not attached to a symbol + | %type foo "foo" + | ^~~~~ + warning: string literal not attached to a symbol + | foo: "baz" {} + | ^~~~~ + + ‘deprecated’ + Deprecated constructs whose support will be removed in future + versions of Bison. + + ‘empty-rule’ + Empty rules without ‘%empty’. *Note Empty Rules::. Disabled + by default, but enabled by uses of ‘%empty’, unless + ‘-Wno-empty-rule’ was specified. + + ‘midrule-values’ + Warn about midrule values that are set but not used within any + of the actions of the parent rule. For example, warn about + unused ‘$2’ in: + + exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; }; + + Also warn about midrule values that are used but not set. For + example, warn about unset ‘$$’ in the midrule action in: + + exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; }; + + These warnings are not enabled by default since they sometimes + prove to be false alarms in existing grammars employing the + Yacc constructs ‘$0’ or ‘$-N’ (where N is some positive + integer). + + ‘precedence’ + Useless precedence and associativity directives. Disabled by + default. + + Consider for instance the following grammar: + + %nonassoc "=" + %left "+" + %left "*" + %precedence "(" + %% + stmt: + exp + | "var" "=" exp + ; + + exp: + exp "+" exp + | exp "*" "number" + | "(" exp ")" + | "number" + ; + + Bison reports: + + warning: useless precedence and associativity for "=" + | %nonassoc "=" + | ^~~ + warning: useless associativity for "*", use %precedence + | %left "*" + | ^~~ + warning: useless precedence for "(" + | %precedence "(" + | ^~~ + + One would get the exact same parser with the following + directives instead: + + %left "+" + %precedence "*" + + ‘yacc’ + Incompatibilities with POSIX Yacc. + + ‘other’ + All warnings not categorized above. These warnings are + enabled by default. + + This category is provided merely for the sake of completeness. + Future releases of Bison may move warnings from this category + to new, more specific categories. + + ‘all’ + All the warnings except ‘counterexamples’, ‘dangling-alias’ + and ‘yacc’. + + ‘none’ + Turn off all the warnings. + + ‘error’ + See ‘-Werror’, below. + + A category can be turned off by prefixing its name with ‘no-’. For + instance, ‘-Wno-yacc’ will hide the warnings about POSIX Yacc + incompatibilities. + +‘-Werror’ + Turn enabled warnings for every CATEGORY into errors, unless they + are explicitly disabled by ‘-Wno-error=CATEGORY’. + +‘-Werror=CATEGORY’ + Enable warnings falling in CATEGORY, and treat them as errors. + + CATEGORY is the same as for ‘--warnings’, with the exception that + it may not be prefixed with ‘no-’ (see above). + + Note that the precedence of the ‘=’ and ‘,’ operators is such that + the following commands are _not_ equivalent, as the first will not + treat S/R conflicts as errors. + + $ bison -Werror=yacc,conflicts-sr input.y + $ bison -Werror=yacc,error=conflicts-sr input.y + +‘-Wno-error’ + Do not turn enabled warnings for every CATEGORY into errors, unless + they are explicitly enabled by ‘-Werror=CATEGORY’. + +‘-Wno-error=CATEGORY’ + Deactivate the error treatment for this CATEGORY. However, the + warning itself won’t be disabled, or enabled, by this option. + +‘--color’ + Equivalent to ‘--color=always’. + +‘--color=WHEN’ + Control whether diagnostics are colorized, depending on WHEN: + ‘always’ + ‘yes’ + Enable colorized diagnostics. + + ‘never’ + ‘no’ + Disable colorized diagnostics. + + ‘auto (default)’ + ‘tty’ + Diagnostics will be colorized if the output device is a tty, + i.e. when the output goes directly to a text screen or + terminal emulator window. + +‘--style=FILE’ + Specifies the CSS style FILE to use when colorizing. It has an + effect only when the ‘--color’ option is effective. The + ‘bison-default.css’ file provide a good example from which to + define your own style file. See the documentation of libtextstyle + for more details. + + +File: bison.info, Node: Tuning the Parser, Next: Output Files, Prev: Diagnostics, Up: Bison Options + +9.1.3 Tuning the Parser +----------------------- + +Options changing the generated parsers. + +‘-t’ +‘--debug’ + In the parser implementation file, define the macro ‘YYDEBUG’ to 1 + if it is not already defined, so that the debugging facilities are + compiled. *Note Tracing::. + +‘-D NAME[=VALUE]’ +‘--define=NAME[=VALUE]’ +‘-F NAME[=VALUE]’ +‘--force-define=NAME[=VALUE]’ + Each of these is equivalent to ‘%define NAME VALUE’ (*note %define + Summary::). Note that the delimiters are part of VALUE: + ‘-Dapi.value.type=union’, ‘-Dapi.value.type={union}’ and + ‘-Dapi.value.type="union"’ correspond to ‘%define api.value.type + union’, ‘%define api.value.type {union}’ and ‘%define + api.value.type "union"’. + + Bison processes multiple definitions for the same NAME as follows: + + • Bison quietly ignores all command-line definitions for NAME + except the last. + • If that command-line definition is specified by a ‘-D’ or + ‘--define’, Bison reports an error for any ‘%define’ + definition for NAME. + • If that command-line definition is specified by a ‘-F’ or + ‘--force-define’ instead, Bison quietly ignores all ‘%define’ + definitions for NAME. + • Otherwise, Bison reports an error if there are multiple + ‘%define’ definitions for NAME. + + You should avoid using ‘-F’ and ‘--force-define’ in your make files + unless you are confident that it is safe to quietly ignore any + conflicting ‘%define’ that may be added to the grammar file. + +‘-L LANGUAGE’ +‘--language=LANGUAGE’ + Specify the programming language for the generated parser, as if + ‘%language’ was specified (*note Decl Summary::). Currently + supported languages include C, C++, D and Java. LANGUAGE is + case-insensitive. + +‘--locations’ + Pretend that ‘%locations’ was specified. *Note Decl Summary::. + +‘-p PREFIX’ +‘--name-prefix=PREFIX’ + Pretend that ‘%name-prefix "PREFIX"’ was specified (*note Decl + Summary::). The option ‘-p’ is specified by POSIX. When POSIX + compatibility is not a requirement, ‘-Dapi.prefix=PREFIX’ is a + better option (*note Multiple Parsers::). + +‘-l’ +‘--no-lines’ + Don’t put any ‘#line’ preprocessor commands in the parser + implementation file. Ordinarily Bison puts them in the parser + implementation file so that the C compiler and debuggers will + associate errors with your source file, the grammar file. This + option causes them to associate errors with the parser + implementation file, treating it as an independent source file in + its own right. + +‘-S FILE’ +‘--skeleton=FILE’ + Specify the skeleton to use, similar to ‘%skeleton’ (*note Decl + Summary::). + + If FILE does not contain a ‘/’, FILE is the name of a skeleton file + in the Bison installation directory. If it does, FILE is an + absolute file name or a file name relative to the current working + directory. This is similar to how most shells resolve commands. + +‘-k’ +‘--token-table’ + Pretend that ‘%token-table’ was specified. *Note Decl Summary::. + +‘-y’ +‘--yacc’ + Act more like the traditional ‘yacc’ command: + • Generate different diagnostics (it implies ‘-Wyacc’). + • Generate ‘#define’ statements in addition to an ‘enum’ to + associate token codes with token kind names. + • If the ‘POSIXLY_CORRECT’ environment variable is defined, + generate prototypes for ‘yyerror’ and ‘yylex’(1) (since Bison + 3.8): + int yylex (void); + void yyerror (const char *); + As a Bison extension, additional arguments required by + ‘%pure-parser’, ‘%locations’, ‘%lex-param’ and ‘%parse-param’ + are taken into account. You may disable ‘yyerror’’s prototype + with ‘#define yyerror yyerror’ (as specified by POSIX), or + with ‘#define YYERROR_IS_DECLARED’ (a Bison extension). + Likewise for ‘yylex’. + • Imitate Yacc’s output file name conventions, so that the + parser implementation file is called ‘y.tab.c’, and the other + outputs are called ‘y.output’ and ‘y.tab.h’. Do not use + ‘--yacc’ just to change the output file names since it also + triggers all the aforementioned behavior changes; rather use + ‘-o y.tab.c’. + + The ‘-y’/‘--yacc’ option is intended for use with traditional Yacc + grammars. This option only makes sense for the default C skeleton, + ‘yacc.c’. If your grammar uses Bison extensions Bison cannot be + Yacc-compatible, even if this option is specified. + + Thus, the following shell script can substitute for Yacc, and the + Bison distribution contains such a ‘yacc’ script for compatibility + with POSIX: + + #! /bin/sh + bison -y "$@" + + ---------- Footnotes ---------- + + (1) See . + + +File: bison.info, Node: Output Files, Prev: Tuning the Parser, Up: Bison Options + +9.1.4 Output Files +------------------ + +Options controlling the output. + +‘-H [FILE]’ +‘--header=[FILE]’ + Pretend that ‘%header’ was specified, i.e., write an extra output + file containing definitions for the token kind names defined in the + grammar, as well as a few other declarations. *Note Decl + Summary::. + +‘--defines[=FILE]’ + Historical name for option ‘--header’ before Bison 3.8. + +‘-d’ + This is the same as ‘--header’ except ‘-d’ does not accept a FILE + argument since POSIX Yacc requires that ‘-d’ can be bundled with + other short options. + +‘-b FILE-PREFIX’ +‘--file-prefix=PREFIX’ + Pretend that ‘%file-prefix’ was specified, i.e., specify prefix to + use for all Bison output file names. *Note Decl Summary::. + +‘-r THINGS’ +‘--report=THINGS’ + Write an extra output file containing verbose description of the + comma separated list of THINGS among: + + ‘state’ + Description of the grammar, conflicts (resolved and + unresolved), and parser’s automaton. + + ‘itemset’ + Implies ‘state’ and augments the description of the automaton + with the full set of items for each state, instead of its core + only. + + ‘lookahead’ + Implies ‘state’ and augments the description of the automaton + with each rule’s lookahead set. + + ‘solved’ + Implies ‘state’. Explain how conflicts were solved thanks to + precedence and associativity directives. + + ‘counterexamples’ + ‘cex’ + Look for counterexamples for the conflicts. *Note + Counterexamples::. Counterexamples take time to compute. The + option ‘-rcex’ should be used by the developer when working on + the grammar; it hardly makes sense to use it in a CI. + + ‘all’ + Enable all the items. + + ‘none’ + Do not generate the report. + +‘--report-file=FILE’ + Specify the FILE for the verbose description. + +‘-v’ +‘--verbose’ + Pretend that ‘%verbose’ was specified, i.e., write an extra output + file containing verbose descriptions of the grammar and parser. + *Note Decl Summary::. + +‘-o FILE’ +‘--output=FILE’ + Specify the FILE for the parser implementation file. + + The names of the other output files are constructed from FILE as + described under the ‘-v’ and ‘-d’ options. + +‘-g [FILE]’ +‘--graph[=FILE]’ + Output a graphical representation of the parser’s automaton + computed by Bison, in Graphviz (https://www.graphviz.org/) DOT + (https://www.graphviz.org/doc/info/lang.html) format. ‘FILE’ is + optional. If omitted and the grammar file is ‘foo.y’, the output + file will be ‘foo.gv’. + +‘-x [FILE]’ +‘--xml[=FILE]’ + Output an XML report of the parser’s automaton computed by Bison. + ‘FILE’ is optional. If omitted and the grammar file is ‘foo.y’, + the output file will be ‘foo.xml’. + +‘-M OLD=NEW’ +‘--file-prefix-map=OLD=NEW’ + Replace prefix OLD with NEW when writing file paths in output + files. + + +File: bison.info, Node: Option Cross Key, Next: Yacc Library, Prev: Bison Options, Up: Invocation + +9.2 Option Cross Key +==================== + +Here is a list of options, alphabetized by long option, to help you find +the corresponding short option and directive. + +Long Option Short Option Bison Directive +--------------------------------------------------------------------------------- +‘--color[=WHEN]’ +‘--debug’ ‘-t’ ‘%debug’ +‘--define=NAME[=VALUE]’ ‘-D NAME[=VALUE]’ ‘%define NAME [VALUE]’ +‘--feature[=FEATURES]’ ‘-f [FEATURES]’ +‘--file-prefix-map=OLD=NEW’ ‘-M OLD=NEW’ +‘--file-prefix=PREFIX’ ‘-b PREFIX’ ‘%file-prefix "PREFIX"’ +‘--force-define=NAME[=VALUE]’ ‘-F NAME[=VALUE]’ ‘%define NAME [VALUE]’ +‘--graph[=FILE]’ ‘-g [FILE]’ +‘--header=[FILE]’ ‘-H [FILE]’ ‘%header ["FILE"]’ +‘--help’ ‘-h’ +‘--html[=FILE]’ +‘--language=LANGUAGE’ ‘-L LANGUAGE’ ‘%language "LANGUAGE"’ +‘--locations’ ‘%locations’ +‘--name-prefix=PREFIX’ ‘-p PREFIX’ ‘%name-prefix "PREFIX"’ +‘--no-lines’ ‘-l’ ‘%no-lines’ +‘--output=FILE’ ‘-o FILE’ ‘%output "FILE"’ +‘--print-datadir’ +‘--print-localedir’ +‘--report-file=FILE’ +‘--report=THINGS’ ‘-r THINGS’ +‘--skeleton=FILE’ ‘-S FILE’ ‘%skeleton "FILE"’ +‘--style=FILE’ +‘--token-table’ ‘-k’ ‘%token-table’ +‘--update’ ‘-u’ +‘--verbose’ ‘-v’ ‘%verbose’ +‘--version’ ‘-V’ +‘--warnings[=CATEGORY]’ ‘-W [CATEGORY]’ +‘--xml[=FILE]’ ‘-x [FILE]’ +‘--yacc’ ‘-y’ ‘%yacc’ + + +File: bison.info, Node: Yacc Library, Prev: Option Cross Key, Up: Invocation + +9.3 Yacc Library +================ + +The Yacc library contains default implementations of the ‘yyerror’ and +‘main’ functions. These default implementations are normally not +useful, but POSIX requires them. To use the Yacc library, link your +program with the ‘-ly’ option. Note that Bison’s implementation of the +Yacc library is distributed under the terms of the GNU General Public +License (*note Copying::). + + If you use the Yacc library’s ‘yyerror’ function, you should declare +‘yyerror’ as follows: + + int yyerror (char const *); + +The ‘int’ value returned by this ‘yyerror’ is ignored. + + The implementation of Yacc library’s ‘main’ function is: + + int main (void) + { + setlocale (LC_ALL, ""); + return yyparse (); + } + +so if you use it, the internationalization support is enabled (e.g., +error messages are translated), and your ‘yyparse’ function should have +the following type signature: + + int yyparse (void); + + +File: bison.info, Node: Other Languages, Next: History, Prev: Invocation, Up: Top + +10 Parsers Written In Other Languages +************************************* + +In addition to C, Bison can generate parsers in C++, D and Java. This +chapter is devoted to these languages. The reader is expected to +understand how Bison works; read the introductory chapters first if you +don’t. + +* Menu: + +* C++ Parsers:: The interface to generate C++ parser classes +* D Parsers:: The interface to generate D parser classes +* Java Parsers:: The interface to generate Java parser classes + + +File: bison.info, Node: C++ Parsers, Next: D Parsers, Up: Other Languages + +10.1 C++ Parsers +================ + +The Bison parser in C++ is an object, an instance of the class +‘yy::parser’. + +* Menu: + +* A Simple C++ Example:: A short introduction to C++ parsers +* C++ Bison Interface:: Asking for C++ parser generation +* C++ Parser Interface:: Instantiating and running the parser +* C++ Semantic Values:: %union vs. C++ +* C++ Location Values:: The position and location classes +* C++ Parser Context:: You can supply a ‘report_syntax_error’ function. +* C++ Scanner Interface:: Exchanges between yylex and parse +* A Complete C++ Example:: Demonstrating their use + + +File: bison.info, Node: A Simple C++ Example, Next: C++ Bison Interface, Up: C++ Parsers + +10.1.1 A Simple C++ Example +--------------------------- + +This tutorial about C++ parsers is based on a simple, self contained +example.(1) The following sections are the reference manual for Bison +with C++, the last one showing a fully blown example (*note A Complete +C++ Example::). + + To look nicer, our example will be in C++14. It is not required: +Bison supports the original C++98 standard. + + A Bison file has three parts. In the first part, the prologue, we +start by making sure we run a version of Bison which is recent enough, +and that we generate C++. + + %require "3.2" + %language "c++" + + Let’s dive directly into the middle part: the grammar. Our input is +a simple list of strings, that we display once the parsing is done. + + %% + result: + list { std::cout << $1 << '\n'; } + ; + + %nterm > list; + list: + %empty { /* Generates an empty string list */ } + | list item { $$ = $1; $$.push_back ($2); } + ; + + We used a vector of strings as a semantic value! To use genuine C++ +objects as semantic values—not just PODs—we cannot rely on the union +that Bison uses by default to store them, we need _variants_ (*note C++ +Variants::): + + %define api.value.type variant + + Obviously, the rule for ‘result’ needs to print a vector of strings. +In the prologue, we add: + + %code + { + // Print a list of strings. + auto + operator<< (std::ostream& o, const std::vector& ss) + -> std::ostream& + { + o << '{'; + const char *sep = ""; + for (const auto& s: ss) + { + o << sep << s; + sep = ", "; + } + return o << '}'; + } + } + +You may want to move it into the ‘yy’ namespace to avoid leaking it in +your default namespace. We recommend that you keep the actions simple, +and move details into auxiliary functions, as we did with ‘operator<<’. + + Our list of strings will be built from two types of items: numbers +and strings: + + %nterm item; + %token TEXT; + %token NUMBER; + item: + TEXT + | NUMBER { $$ = std::to_string ($1); } + ; + + In the case of ‘TEXT’, the implicit default action applies: +‘$$ = $1’. + + + Our scanner deserves some attention. The traditional interface of +‘yylex’ is not type safe: since the token kind and the token value are +not correlated, you may return a ‘NUMBER’ with a string as semantic +value. To avoid this, we use _token constructors_ (*note Complete +Symbols::). This directive: + + %define api.token.constructor + +requests that Bison generates the functions ‘make_TEXT’ and +‘make_NUMBER’, but also ‘make_YYEOF’, for the end of input. + + Everything is in place for our scanner: + + %code + { + namespace yy + { + // Return the next token. + auto yylex () -> parser::symbol_type + { + static int count = 0; + switch (int stage = count++) + { + case 0: + return parser::make_TEXT ("I have three numbers for you."); + case 1: case 2: case 3: + return parser::make_NUMBER (stage); + case 4: + return parser::make_TEXT ("And that's all!"); + default: + return parser::make_YYEOF (); + } + } + } + } + + In the epilogue, the third part of a Bison grammar file, we leave +simple details: the error reporting function, and the main function. + + %% + namespace yy + { + // Report an error to the user. + auto parser::error (const std::string& msg) -> void + { + std::cerr << msg << '\n'; + } + } + + int main () + { + yy::parser parse; + return parse (); + } + + Compile, and run! + + $ bison simple.yy -o simple.cc + $ g++ -std=c++14 simple.cc -o simple + $ ./simple + {I have three numbers for you., 1, 2, 3, And that's all!} + + ---------- Footnotes ---------- + + (1) The sources of this example are available as +‘examples/c++/simple.yy’. + + +File: bison.info, Node: C++ Bison Interface, Next: C++ Parser Interface, Prev: A Simple C++ Example, Up: C++ Parsers + +10.1.2 C++ Bison Interface +-------------------------- + +The C++ deterministic parser is selected using the skeleton directive, +‘%skeleton "lalr1.cc"’. *Note Decl Summary::. + + When run, ‘bison’ will create several entities in the ‘yy’ namespace. +Use the ‘%define api.namespace’ directive to change the namespace name, +see *note %define Summary::. The various classes are generated in the +following files: + +‘FILE.hh’ + (Assuming the extension of the grammar file was ‘.yy’.) The + declaration of the C++ parser class and auxiliary types. By + default, this file is not generated (*note Decl Summary::). + +‘FILE.cc’ + The implementation of the C++ parser class. The basename and + extension of these two files (‘FILE.hh’ and ‘FILE.cc’) follow the + same rules as with regular C parsers (*note Invocation::). + +‘location.hh’ + Generated when both ‘%header’ and ‘%locations’ are enabled, this + file contains the definition of the classes ‘position’ and + ‘location’, used for location tracking. It is not generated if + ‘%define api.location.file none’ is specified, or if user defined + locations are used. *Note C++ Location Values::. + +‘position.hh’ +‘stack.hh’ + Useless legacy files. To get rid of then, use ‘%require "3.2"’ or + newer. + + All these files are documented using Doxygen; run ‘doxygen’ for a +complete and accurate documentation. + + +File: bison.info, Node: C++ Parser Interface, Next: C++ Semantic Values, Prev: C++ Bison Interface, Up: C++ Parsers + +10.1.3 C++ Parser Interface +--------------------------- + +The output files ‘FILE.hh’ and ‘FILE.cc’ declare and define the parser +class in the namespace ‘yy’. The class name defaults to ‘parser’, but +may be changed using ‘%define api.parser.class {NAME}’. The interface +of this class is detailed below. It can be extended using the +‘%parse-param’ feature: its semantics is slightly changed since it +describes an additional member of the parser class, and an additional +argument for its constructor. + + -- Type of parser: token + A structure that contains (only) the ‘token_kind_type’ enumeration, + which defines the tokens. To refer to the token ‘FOO’, use + ‘yy::parser::token::FOO’. The scanner can use ‘typedef + yy::parser::token token;’ to “import” the token enumeration (*note + Calc++ Scanner::). + + -- Type of parser: token_kind_type + An enumeration of the token kinds. Its enumerators are forged from + the token names, with a possible token prefix (*note + ‘api.token.prefix’: api-token-prefix.): + + /// Token kinds. + struct token + { + enum token_kind_type + { + YYEMPTY = -2, // No token. + YYEOF = 0, // "end of file" + YYerror = 256, // error + YYUNDEF = 257, // "invalid token" + PLUS = 258, // "+" + MINUS = 259, // "-" + [...] + VAR = 271, // "variable" + NEG = 272 // NEG + }; + }; + + /// Token kind, as returned by yylex. + typedef token::token_kind_type token_kind_type; + + -- Type of parser: value_type + The types for semantic values. *Note C++ Semantic Values::. + + -- Type of parser: location_type + The type of locations, if location tracking is enabled. *Note C++ + Location Values::. + + -- Type of parser: syntax_error + This class derives from ‘std::runtime_error’. Throw instances of + it from the scanner or from the actions to raise parse errors. + This is equivalent with first invoking ‘error’ to report the + location and message of the syntax error, and then to invoke + ‘YYERROR’ to enter the error-recovery mode. But contrary to + ‘YYERROR’ which can only be invoked from user actions (i.e., + written in the action itself), the exception can be thrown from + functions invoked from the user action. + + -- Constructor on parser: parser () + -- Constructor on parser: parser (TYPE1 ARG1, ...) + Build a new parser object. There are no arguments, unless + ‘%parse-param {TYPE1 ARG1}’ was used. + + -- Constructor on syntax_error: syntax_error (const location_type& L, + const std::string& M) + -- Constructor on syntax_error: syntax_error (const std::string& M) + Instantiate a syntax-error exception. + + -- Method on parser: int operator() () + -- Method on parser: int parse () + Run the syntactic analysis, and return 0 on success, 1 otherwise. + Both routines are equivalent, ‘operator()’ being more C++ish. + + The whole function is wrapped in a ‘try’/‘catch’ block, so that + when an exception is thrown, the ‘%destructor’s are called to + release the lookahead symbol, and the symbols pushed on the stack. + + Exception related code in the generated parser is protected by CPP + guards (‘#if’) and disabled when exceptions are not supported + (i.e., passing ‘-fno-exceptions’ to the C++ compiler). + + -- Method on parser: std::ostream& debug_stream () + -- Method on parser: void set_debug_stream (std::ostream& O) + Get or set the stream used for tracing the parsing. It defaults to + ‘std::cerr’. + + -- Method on parser: debug_level_type debug_level () + -- Method on parser: void set_debug_level (debug_level_type L) + Get or set the tracing level (an integral). Currently its value is + either 0, no trace, or nonzero, full tracing. + + -- Method on parser: void error (const location_type& L, const + std::string& M) + -- Method on parser: void error (const std::string& M) + The definition for this member function must be supplied by the + user: the parser uses it to report a parser error occurring at L, + described by M. If location tracking is not enabled, the second + signature is used. + + +File: bison.info, Node: C++ Semantic Values, Next: C++ Location Values, Prev: C++ Parser Interface, Up: C++ Parsers + +10.1.4 C++ Semantic Values +-------------------------- + +Bison supports two different means to handle semantic values in C++. +One is alike the C interface, and relies on unions. As C++ +practitioners know, unions are inconvenient in C++, therefore another +approach is provided, based on variants. + +* Menu: + +* C++ Unions:: Semantic values cannot be objects +* C++ Variants:: Using objects as semantic values + + +File: bison.info, Node: C++ Unions, Next: C++ Variants, Up: C++ Semantic Values + +10.1.4.1 C++ Unions +................... + +The ‘%union’ directive works as for C, see *note Union Decl::. In +particular it produces a genuine ‘union’, which have a few specific +features in C++. + − The value type is ‘yy::parser::value_type’, not ‘YYSTYPE’. + − Non POD (Plain Old Data) types cannot be used. C++98 forbids any + instance of classes with constructors in unions: only _pointers_ to + such objects are allowed. C++11 relaxed this constraints, but at + the cost of safety. + + Because objects have to be stored via pointers, memory is not +reclaimed automatically: using the ‘%destructor’ directive is the only +means to avoid leaks. *Note Destructor Decl::. + + +File: bison.info, Node: C++ Variants, Prev: C++ Unions, Up: C++ Semantic Values + +10.1.4.2 C++ Variants +..................... + +Bison provides a _variant_ based implementation of semantic values for +C++. This alleviates all the limitations reported in the previous +section, and in particular, object types can be used without pointers. + + To enable variant-based semantic values, set the ‘%define’ variable +‘api.value.type’ to ‘variant’ (*note %define Summary::). Then ‘%union’ +is ignored; instead of using the name of the fields of the ‘%union’ to +“type” the symbols, use genuine types. + + For instance, instead of: + + %union + { + int ival; + std::string* sval; + } + %token NUMBER; + %token STRING; + +write: + + %token NUMBER; + %token STRING; + + ‘STRING’ is no longer a pointer, which should fairly simplify the +user actions in the grammar and in the scanner (in particular the memory +management). + + Since C++ features destructors, and since it is customary to +specialize ‘operator<<’ to support uniform printing of values, variants +also typically simplify Bison printers and destructors. + + Variants are stricter than unions. When based on unions, you may +play any dirty game with ‘yylval’, say storing an ‘int’, reading a +‘char*’, and then storing a ‘double’ in it. This is no longer possible +with variants: they must be initialized, then assigned to, and +eventually, destroyed. As a matter of fact, Bison variants forbid the +use of alternative types such as ‘$2’ or ‘$$’, even in +midrule actions. It is mandatory to use typed midrule actions (*note +Typed Midrule Actions::). + + -- Method on value_type: T& emplace () + -- Method on value_type: T& emplace (const T& T) + Available in C++98/C++03 only. Default construct/copy-construct + from T. Return a reference to where the actual value may be + stored. Requires that the variant was not initialized yet. + + -- Method on value_type: T& emplace (U&&... U) + Available in C++11 and later only. Build a variant of type ‘T’ + from the variadic forwarding references U.... + + *Warning*: We do not use Boost.Variant, for two reasons. First, it +appeared unacceptable to require Boost on the user’s machine (i.e., the +machine on which the generated parser will be compiled, not the machine +on which ‘bison’ was run). Second, for each possible semantic value, +Boost.Variant not only stores the value, but also a tag specifying its +type. But the parser already “knows” the type of the semantic value, so +that would be duplicating the information. + + We do not use C++17’s ‘std::variant’ either: we want to support all +the C++ standards, and of course ‘std::variant’ also stores a tag to +record the current type. + + Therefore we developed light-weight variants whose type tag is +external (so they are really like ‘unions’ for C++ actually). There is +a number of limitations in (the current implementation of) variants: + • Alignment must be enforced: values should be aligned in memory + according to the most demanding type. Computing the smallest + alignment possible requires meta-programming techniques that are + not currently implemented in Bison, and therefore, since, as far as + we know, ‘double’ is the most demanding type on all platforms, + alignments are enforced for ‘double’ whatever types are actually + used. This may waste space in some cases. + + • There might be portability issues we are not aware of. + + As far as we know, these limitations _can_ be alleviated. All it +takes is some time and/or some talented C++ hacker willing to contribute +to Bison. + + +File: bison.info, Node: C++ Location Values, Next: C++ Parser Context, Prev: C++ Semantic Values, Up: C++ Parsers + +10.1.5 C++ Location Values +-------------------------- + +When the directive ‘%locations’ is used, the C++ parser supports +location tracking, see *note Tracking Locations::. + + By default, two auxiliary classes define a ‘position’, a single point +in a file, and a ‘location’, a range composed of a pair of ‘position’s +(possibly spanning several files). If the ‘%define’ variable +‘api.location.type’ is defined, then these classes will not be +generated, and the user defined type will be used. + +* Menu: + +* C++ position:: One point in the source file +* C++ location:: Two points in the source file +* Exposing the Location Classes:: Using the Bison location class in your + project +* User Defined Location Type:: Required interface for locations + + +File: bison.info, Node: C++ position, Next: C++ location, Up: C++ Location Values + +10.1.5.1 C++ ‘position’ +....................... + + -- Type of position: filename_type + The base type for file names. Defaults to ‘const std::string’. + *Note ‘api.filename.type’: api-filename-type, to change its + definition. + + -- Type of position: counter_type + The type used to store line and column numbers. Defined as ‘int’. + + -- Constructor on position: position (filename_type* FILE = nullptr, + counter_type LINE = 1, counter_type COL = 1) + Create a ‘position’ denoting a given point. Note that ‘file’ is + not reclaimed when the ‘position’ is destroyed: memory managed must + be handled elsewhere. + + -- Method on position: void initialize (filename_type* FILE = nullptr, + counter_type LINE = 1, counter_type COL = 1) + Reset the position to the given values. + + -- Instance Variable of position: filename_type* file + The name of the file. It will always be handled as a pointer, the + parser will never duplicate nor deallocate it. + + -- Instance Variable of position: counter_type line + The line, starting at 1. + + -- Method on position: void lines (counter_type HEIGHT = 1) + If HEIGHT is not null, advance by HEIGHT lines, resetting the + column number. The resulting line number cannot be less than 1. + + -- Instance Variable of position: counter_type column + The column, starting at 1. + + -- Method on position: void columns (counter_type WIDTH = 1) + Advance by WIDTH columns, without changing the line number. The + resulting column number cannot be less than 1. + + -- Method on position: position& operator+= (counter_type WIDTH) + -- Method on position: position operator+ (counter_type WIDTH) + -- Method on position: position& operator-= (counter_type WIDTH) + -- Method on position: position operator- (counter_type WIDTH) + Various forms of syntactic sugar for ‘columns’. + + -- Method on position: bool operator== (const position& THAT) + -- Method on position: bool operator!= (const position& THAT) + Whether ‘*this’ and ‘that’ denote equal/different positions. + + -- Function: std::ostream& operator<< (std::ostream& O, const position& + P) + Report P on O like this: ‘FILE:LINE.COLUMN’, or ‘LINE.COLUMN’ if + FILE is null. + + +File: bison.info, Node: C++ location, Next: Exposing the Location Classes, Prev: C++ position, Up: C++ Location Values + +10.1.5.2 C++ ‘location’ +....................... + + -- Constructor on location: location (const position& BEGIN, const + position& END) + Create a ‘Location’ from the endpoints of the range. + + -- Constructor on location: location (const position& POS = position()) + -- Constructor on location: location (filename_type* FILE, counter_type + LINE, counter_type COL) + Create a ‘Location’ denoting an empty range located at a given + point. + + -- Method on location: void initialize (filename_type* FILE = nullptr, + counter_type LINE = 1, counter_type COL = 1) + Reset the location to an empty range at the given values. + + -- Instance Variable of location: position begin + -- Instance Variable of location: position end + The first, inclusive, position of the range, and the first beyond. + + -- Method on location: void columns (counter_type WIDTH = 1) + -- Method on location: void lines (counter_type HEIGHT = 1) + Forwarded to the ‘end’ position. + + -- Method on location: location operator+ (counter_type WIDTH) + -- Method on location: location operator+= (counter_type WIDTH) + -- Method on location: location operator- (counter_type WIDTH) + -- Method on location: location operator-= (counter_type WIDTH) + Various forms of syntactic sugar for ‘columns’. + + -- Method on location: location operator+ (const location& END) + -- Method on location: location operator+= (const location& END) + Join two locations: starts at the position of the first one, and + ends at the position of the second. + + -- Method on location: void step () + Move ‘begin’ onto ‘end’. + + -- Method on location: bool operator== (const location& THAT) + -- Method on location: bool operator!= (const location& THAT) + Whether ‘*this’ and ‘that’ denote equal/different ranges of + positions. + + -- Function: std::ostream& operator<< (std::ostream& O, const location& + P) + Report P on O, taking care of special cases such as: no ‘filename’ + defined, or equal filename/line or column. + + +File: bison.info, Node: Exposing the Location Classes, Next: User Defined Location Type, Prev: C++ location, Up: C++ Location Values + +10.1.5.3 Exposing the Location Classes +...................................... + +When both ‘%header’ and ‘%locations’ are enabled, Bison generates an +additional file: ‘location.hh’. If you don’t use locations outside of +the parser, you may avoid its creation with ‘%define api.location.file +none’. + + However this file is useful if, for instance, your parser builds an +abstract syntax tree decorated with locations: you may use Bison’s +‘location’ type independently of Bison’s parser. You may name the file +differently, e.g., ‘%define api.location.file +"include/ast/location.hh"’: this name can have directory components, or +even be absolute. The way the location file is included is controlled +by ‘api.location.include’. + + This way it is possible to have several parsers share the same +location file. + + For instance, in ‘src/foo/parser.yy’, generate the +‘include/ast/loc.hh’ file: + + // src/foo/parser.yy + %locations + %define api.namespace {foo} + %define api.location.file "include/ast/loc.hh" + %define api.location.include {} + +and use it in ‘src/bar/parser.yy’: + + // src/bar/parser.yy + %locations + %define api.namespace {bar} + %code requires {#include } + %define api.location.type {bar::location} + + Absolute file names are supported; it is safe in your ‘Makefile’ to +pass the flag ‘-Dapi.location.file='"$(top_srcdir)/include/ast/loc.hh"'’ +to ‘bison’ for ‘src/foo/parser.yy’. The generated file will not have +references to this absolute path, thanks to ‘%define +api.location.include {}’. Adding ‘-I $(top_srcdir)/include’ +to your ‘CPPFLAGS’ will suffice for the compiler to find ‘ast/loc.hh’. + + +File: bison.info, Node: User Defined Location Type, Prev: Exposing the Location Classes, Up: C++ Location Values + +10.1.5.4 User Defined Location Type +................................... + +Instead of using the built-in types you may use the ‘%define’ variable +‘api.location.type’ to specify your own type: + + %define api.location.type {LOCATIONTYPE} + + The requirements over your LOCATIONTYPE are: + • it must be copyable; + + • in order to compute the (default) value of ‘@$’ in a reduction, the + parser basically runs + @$.begin = @1.begin; + @$.end = @N.end; // The location of last right-hand side symbol. + so there must be copyable ‘begin’ and ‘end’ members; + + • alternatively you may redefine the computation of the default + location, in which case these members are not required (*note + Location Default Action::); + + • if traces are enabled, then there must exist an ‘std::ostream& + operator<< (std::ostream& o, const LOCATIONTYPE& s)’ function. + + + In programs with several C++ parsers, you may also use the ‘%define’ +variable ‘api.location.type’ to share a common set of built-in +definitions for ‘position’ and ‘location’. For instance, one parser +‘master/parser.yy’ might use: + + %header + %locations + %define api.namespace {master::} + +to generate the ‘master/position.hh’ and ‘master/location.hh’ files, +reused by other parsers as follows: + + %define api.location.type {master::location} + %code requires { #include } + + +File: bison.info, Node: C++ Parser Context, Next: C++ Scanner Interface, Prev: C++ Location Values, Up: C++ Parsers + +10.1.6 C++ Parser Context +------------------------- + +When ‘%define parse.error custom’ is used (*note Syntax Error Reporting +Function::), the user must define the following function. + + -- Method on parser: void report_syntax_error (const context_type&CTX) + const + Report a syntax error to the user. Whether it uses ‘yyerror’ is up + to the user. + + Use the following types and functions to build the error message. + + -- Type of parser: context + A type that captures the circumstances of the syntax error. + + -- Type of parser: symbol_kind_type + An enum of all the grammar symbols, tokens and nonterminals. Its + enumerators are forged from the symbol names: + + struct symbol_kind + { + enum symbol_kind_type + { + S_YYEMPTY = -2, // No symbol. + S_YYEOF = 0, // "end of file" + S_YYERROR = 1, // error + S_YYUNDEF = 2, // "invalid token" + S_PLUS = 3, // "+" + S_MINUS = 4, // "-" + [...] + S_VAR = 14, // "variable" + S_NEG = 15, // NEG + S_YYACCEPT = 16, // $accept + S_exp = 17, // exp + S_input = 18 // input + }; + }; + typedef symbol_kind::symbol_kind_t symbol_kind_type; + + -- Method on context: const symbol_type& lookahead () const + The “unexpected” token: the lookahead that caused the syntax error. + + -- Method on context: symbol_kind_type token () const + The symbol kind of the lookahead token that caused the syntax + error. Returns ‘symbol_kind::S_YYEMPTY’ if there is no lookahead. + + -- Method on context: const location& location () const + The location of the syntax error (that of the lookahead). + + -- Method on context: int expected_tokens (symbol_kind_type ARGV[], int + ARGC) const + Fill ARGV with the expected tokens, which never includes + ‘symbol_kind::S_YYEMPTY’, ‘symbol_kind::S_YYERROR’, or + ‘symbol_kind::S_YYUNDEF’. + + Never put more than ARGC elements into ARGV, and on success return + the number of tokens stored in ARGV. If there are more expected + tokens than ARGC, fill ARGV up to ARGC and return 0. If there are + no expected tokens, also return 0, but set ‘argv[0]’ to + ‘symbol_kind::S_YYEMPTY’. + + If ARGV is null, return the size needed to store all the possible + values, which is always less than ‘YYNTOKENS’. + + -- Method on parser: const char * symbol_name (symbol_kind_t SYMBOL) + const + The name of the symbol whose kind is SYMBOL, possibly translated. + + Returns a ‘std::string’ when ‘parse.error’ is ‘verbose’. + + A custom syntax error function looks as follows. This implementation +is inappropriate for internationalization, see the ‘c/bistromathic’ +example for a better alternative. + + void + yy::parser::report_syntax_error (const context& ctx) + { + int res = 0; + std::cerr << ctx.location () << ": syntax error"; + // Report the tokens expected at this point. + { + enum { TOKENMAX = 5 }; + symbol_kind_type expected[TOKENMAX]; + int n = ctx.expected_tokens (ctx, expected, TOKENMAX); + for (int i = 0; i < n; ++i) + std::cerr << i == 0 ? ": expected " : " or " + << symbol_name (expected[i]); + } + // Report the unexpected token. + { + symbol_kind_type lookahead = ctx.token (); + if (lookahead != symbol_kind::S_YYEMPTY) + std::cerr << " before " << symbol_name (lookahead)); + } + std::cerr << '\n'; + } + + You still must provide a ‘yyerror’ function, used for instance to +report memory exhaustion. + + +File: bison.info, Node: C++ Scanner Interface, Next: A Complete C++ Example, Prev: C++ Parser Context, Up: C++ Parsers + +10.1.7 C++ Scanner Interface +---------------------------- + +The parser invokes the scanner by calling ‘yylex’. Contrary to C +parsers, C++ parsers are always pure: there is no point in using the +‘%define api.pure’ directive. The actual interface with ‘yylex’ depends +whether you use unions, or variants. + +* Menu: + +* Split Symbols:: Passing symbols as two/three components +* Complete Symbols:: Making symbols a whole + + +File: bison.info, Node: Split Symbols, Next: Complete Symbols, Up: C++ Scanner Interface + +10.1.7.1 Split Symbols +...................... + +The generated parser expects ‘yylex’ to have the following prototype. + + -- Function: int yylex (value_type* YYLVAL, location_type* YYLLOC, + TYPE1 ARG1, ...) + -- Function: int yylex (value_type* YYLVAL, TYPE1 ARG1, ...) + Return the next token. Its kind is the return value, its semantic + value and location (if enabled) being YYLVAL and YYLLOC. + Invocations of ‘%lex-param {TYPE1 ARG1}’ yield additional + arguments. + + Note that when using variants, the interface for ‘yylex’ is the same, +but ‘yylval’ is handled differently. + + Regular union-based code in Lex scanner typically looks like: + + [0-9]+ { + yylval->ival = text_to_int (yytext); + return yy::parser::token::INTEGER; + } + [a-z]+ { + yylval->sval = new std::string (yytext); + return yy::parser::token::IDENTIFIER; + } + + Using variants, ‘yylval’ is already constructed, but it is not +initialized. So the code would look like: + + [0-9]+ { + yylval->emplace () = text_to_int (yytext); + return yy::parser::token::INTEGER; + } + [a-z]+ { + yylval->emplace () = yytext; + return yy::parser::token::IDENTIFIER; + } + +or + + [0-9]+ { + yylval->emplace (text_to_int (yytext)); + return yy::parser::token::INTEGER; + } + [a-z]+ { + yylval->emplace (yytext); + return yy::parser::token::IDENTIFIER; + } + + +File: bison.info, Node: Complete Symbols, Prev: Split Symbols, Up: C++ Scanner Interface + +10.1.7.2 Complete Symbols +......................... + +With both ‘%define api.value.type variant’ and ‘%define +api.token.constructor’, the parser defines the type ‘symbol_type’, and +expects ‘yylex’ to have the following prototype. + + -- Function: parser::symbol_type yylex () + -- Function: parser::symbol_type yylex (TYPE1 ARG1, ...) + Return a _complete_ symbol, aggregating its type (i.e., the + traditional value returned by ‘yylex’), its semantic value, and + possibly its location. Invocations of ‘%lex-param {TYPE1 ARG1}’ + yield additional arguments. + + -- Type of parser: symbol_type + A “complete symbol”, that binds together its kind, value and (when + applicable) location. + + -- Method on symbol_type: symbol_kind_type kind () const + The kind of this symbol. + + -- Method on symbol_type: const char * name () const + The name of the kind of this symbol. + + Returns a ‘std::string’ when ‘parse.error’ is ‘verbose’. + + + For each token kind, Bison generates named constructors as follows. + + -- Constructor on parser::symbol_type: symbol_type (int TOKEN, const + VALUE_TYPE& VALUE, const location_type& LOCATION) + -- Constructor on parser::symbol_type: symbol_type (int TOKEN, const + location_type& LOCATION) + -- Constructor on parser::symbol_type: symbol_type (int TOKEN, const + VALUE_TYPE& VALUE) + -- Constructor on parser::symbol_type: symbol_type (int TOKEN) + Build a complete terminal symbol for the token kind TOKEN + (including the ‘api.token.prefix’), whose semantic value, if it has + one, is VALUE of adequate VALUE_TYPE. Pass the LOCATION iff + location tracking is enabled. + + Consistency between TOKEN and VALUE_TYPE is checked via an + ‘assert’. + + For instance, given the following declarations: + + %define api.token.prefix {TOK_} + %token IDENTIFIER; + %token INTEGER; + %token ':'; + +you may use these constructors: + + symbol_type (int token, const std::string&, const location_type&); + symbol_type (int token, const int&, const location_type&); + symbol_type (int token, const location_type&); + + Correct matching between token kinds and value types is checked via +‘assert’; for instance, ‘symbol_type (ID, 42)’ would abort. Named +constructors are preferable (see below), as they offer better type +safety (for instance ‘make_ID (42)’ would not even compile), but +symbol_type constructors may help when token kinds are discovered at +run-time, e.g., + + [a-z]+ { + if (auto i = lookup_keyword (yytext)) + return yy::parser::symbol_type (i, loc); + else + return yy::parser::make_ID (yytext, loc); + } + + + Note that it is possible to generate and compile type incorrect code +(e.g. ‘symbol_type (':', yytext, loc)’). It will fail at run time, +provided the assertions are enabled (i.e., ‘-DNDEBUG’ was not passed to +the compiler). Bison supports an alternative that guarantees that type +incorrect code will not even compile. Indeed, it generates _named +constructors_ as follows. + + -- Method on parser: symbol_type make_TOKEN (const VALUE_TYPE& VALUE, + const location_type& LOCATION) + -- Method on parser: symbol_type make_TOKEN (const location_type& + LOCATION) + -- Method on parser: symbol_type make_TOKEN (const VALUE_TYPE& VALUE) + -- Method on parser: symbol_type make_TOKEN () + Build a complete terminal symbol for the token kind TOKEN (not + including the ‘api.token.prefix’), whose semantic value, if it has + one, is VALUE of adequate VALUE_TYPE. Pass the LOCATION iff + location tracking is enabled. + + For instance, given the following declarations: + + %define api.token.prefix {TOK_} + %token IDENTIFIER; + %token INTEGER; + %token COLON; + %token EOF 0; + +Bison generates: + + symbol_type make_IDENTIFIER (const std::string&, const location_type&); + symbol_type make_INTEGER (const int&, const location_type&); + symbol_type make_COLON (const location_type&); + symbol_type make_EOF (const location_type&); + +which should be used in a scanner as follows. + + [a-z]+ return yy::parser::make_IDENTIFIER (yytext, loc); + [0-9]+ return yy::parser::make_INTEGER (text_to_int (yytext), loc); + ":" return yy::parser::make_COLON (loc); + <> return yy::parser::make_EOF (loc); + + Tokens that do not have an identifier are not accessible: you cannot +simply use characters such as ‘':'’, they must be declared with +‘%token’, including the end-of-file token. + + +File: bison.info, Node: A Complete C++ Example, Prev: C++ Scanner Interface, Up: C++ Parsers + +10.1.8 A Complete C++ Example +----------------------------- + +This section demonstrates the use of a C++ parser with a simple but +complete example. This example should be available on your system, +ready to compile, in the directory ‘examples/c++/calc++’. It focuses on +the use of Bison, therefore the design of the various C++ classes is +very naive: no accessors, no encapsulation of members etc. We will use +a Lex scanner, and more precisely, a Flex scanner, to demonstrate the +various interactions. A hand-written scanner is actually easier to +interface with. + +* Menu: + +* Calc++ --- C++ Calculator:: The specifications +* Calc++ Parsing Driver:: An active parsing context +* Calc++ Parser:: A parser class +* Calc++ Scanner:: A pure C++ Flex scanner +* Calc++ Top Level:: Conducting the band + + +File: bison.info, Node: Calc++ --- C++ Calculator, Next: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.1.8.1 Calc++ — C++ Calculator +................................ + +Of course the grammar is dedicated to arithmetic, a single expression, +possibly preceded by variable assignments. An environment containing +possibly predefined variables such as ‘one’ and ‘two’, is exchanged with +the parser. An example of valid input follows. + + three := 3 + seven := one + two * three + seven * seven + + +File: bison.info, Node: Calc++ Parsing Driver, Next: Calc++ Parser, Prev: Calc++ --- C++ Calculator, Up: A Complete C++ Example + +10.1.8.2 Calc++ Parsing Driver +.............................. + +To support a pure interface with the parser (and the scanner) the +technique of the “parsing context” is convenient: a structure containing +all the data to exchange. Since, in addition to simply launch the +parsing, there are several auxiliary tasks to execute (open the file for +scanning, instantiate the parser etc.), we recommend transforming the +simple parsing context structure into a fully blown “parsing driver” +class. + + The declaration of this driver class, in ‘driver.hh’, is as follows. +The first part includes the CPP guard and imports the required standard +library components, and the declaration of the parser class. + + #ifndef DRIVER_HH + # define DRIVER_HH + # include + # include + # include "parser.hh" + +Then comes the declaration of the scanning function. Flex expects the +signature of ‘yylex’ to be defined in the macro ‘YY_DECL’, and the C++ +parser expects it to be declared. We can factor both as follows. + + // Give Flex the prototype of yylex we want ... + # define YY_DECL \ + yy::parser::symbol_type yylex (driver& drv) + // ... and declare it for the parser's sake. + YY_DECL; + +The ‘driver’ class is then declared with its most obvious members. + + // Conducting the whole scanning and parsing of Calc++. + class driver + { + public: + driver (); + + std::map variables; + + int result; + +The main routine is of course calling the parser. + + // Run the parser on file F. Return 0 on success. + int parse (const std::string& f); + // The name of the file being parsed. + std::string file; + // Whether to generate parser debug traces. + bool trace_parsing; + +To encapsulate the coordination with the Flex scanner, it is useful to +have member functions to open and close the scanning phase. + + // Handling the scanner. + void scan_begin (); + void scan_end (); + // Whether to generate scanner debug traces. + bool trace_scanning; + // The token's location used by the scanner. + yy::location location; + }; + #endif // ! DRIVER_HH + + The implementation of the driver (‘driver.cc’) is straightforward. + + #include "driver.hh" + #include "parser.hh" + + driver::driver () + : trace_parsing (false), trace_scanning (false) + { + variables["one"] = 1; + variables["two"] = 2; + } + + The ‘parse’ member function deserves some attention. + + int + driver::parse (const std::string &f) + { + file = f; + location.initialize (&file); + scan_begin (); + yy::parser parse (*this); + parse.set_debug_level (trace_parsing); + int res = parse (); + scan_end (); + return res; + } + + +File: bison.info, Node: Calc++ Parser, Next: Calc++ Scanner, Prev: Calc++ Parsing Driver, Up: A Complete C++ Example + +10.1.8.3 Calc++ Parser +...................... + +The grammar file ‘parser.yy’ starts by asking for the C++ deterministic +parser skeleton, the creation of the parser header file. Because the +C++ skeleton changed several times, it is safer to require the version +you designed the grammar for. + + %skeleton "lalr1.cc" // -*- C++ -*- + %require "3.8.2" + %header + +Because our scanner returns only genuine tokens and never simple +characters (i.e., it returns ‘PLUS’, not ‘'+'’), we can avoid +conversions. + + %define api.token.raw + +This example uses genuine C++ objects as semantic values, therefore, we +require the variant-based storage of semantic values. To make sure we +properly use it, we enable assertions. To fully benefit from +type-safety and more natural definition of “symbol”, we enable +‘api.token.constructor’. + + %define api.token.constructor + %define api.value.type variant + %define parse.assert + +Then come the declarations/inclusions needed by the semantic values. +Because the parser uses the parsing driver and reciprocally, both would +like to include the header of the other, which is, of course, insane. +This mutual dependency will be broken using forward declarations. +Because the driver’s header needs detailed knowledge about the parser +class (in particular its inner types), it is the parser’s header which +will use a forward declaration of the driver. *Note %code Summary::. + + %code requires { + # include + class driver; + } + +The driver is passed by reference to the parser and to the scanner. +This provides a simple but effective pure interface, not relying on +global variables. + + // The parsing context. + %param { driver& drv } + +Then we request location tracking. + + %locations + +Use the following two directives to enable parser tracing and detailed +error messages. However, detailed error messages can contain incorrect +information if lookahead correction is not enabled (*note LAC::). + + %define parse.trace + %define parse.error detailed + %define parse.lac full + +The code between ‘%code {’ and ‘}’ is output in the ‘*.cc’ file; it +needs detailed knowledge about the driver. + + %code { + # include "driver.hh" + } + +User friendly names are provided for each symbol. To avoid name clashes +in the generated files (*note Calc++ Scanner::), prefix tokens with +‘TOK_’ (*note %define Summary::). + + %define api.token.prefix {TOK_} + %token + ASSIGN ":=" + MINUS "-" + PLUS "+" + STAR "*" + SLASH "/" + LPAREN "(" + RPAREN ")" + ; + +Since we use variant-based semantic values, ‘%union’ is not used, and +‘%token’, ‘%nterm’ and ‘%type’ expect genuine types, not type tags. + + %token IDENTIFIER "identifier" + %token NUMBER "number" + %nterm exp + +No ‘%destructor’ is needed to enable memory deallocation during error +recovery; the memory, for strings for instance, will be reclaimed by the +regular destructors. All the values are printed using their +‘operator<<’ (*note Printer Decl::). + + %printer { yyo << $$; } <*>; + +The grammar itself is straightforward (*note Location Tracking Calc::). + + %% + %start unit; + unit: assignments exp { drv.result = $2; }; + + assignments: + %empty {} + | assignments assignment {}; + + assignment: + "identifier" ":=" exp { drv.variables[$1] = $3; }; + + %left "+" "-"; + %left "*" "/"; + exp: + "number" + | "identifier" { $$ = drv.variables[$1]; } + | exp "+" exp { $$ = $1 + $3; } + | exp "-" exp { $$ = $1 - $3; } + | exp "*" exp { $$ = $1 * $3; } + | exp "/" exp { $$ = $1 / $3; } + | "(" exp ")" { $$ = $2; } + %% + +Finally the ‘error’ member function reports the errors. + + void + yy::parser::error (const location_type& l, const std::string& m) + { + std::cerr << l << ": " << m << '\n'; + } + + +File: bison.info, Node: Calc++ Scanner, Next: Calc++ Top Level, Prev: Calc++ Parser, Up: A Complete C++ Example + +10.1.8.4 Calc++ Scanner +....................... + +In addition to standard headers, the Flex scanner includes the driver’s, +then the parser’s to get the set of defined tokens. + + %{ /* -*- C++ -*- */ + # include + # include + # include + # include // strerror + # include + # include "driver.hh" + # include "parser.hh" + %} + +Since our calculator has no ‘#include’-like feature, we don’t need +‘yywrap’. We don’t need the ‘unput’ and ‘input’ functions either, and +we parse an actual file, this is not an interactive session with the +user. Finally, we enable scanner tracing. + + %option noyywrap nounput noinput batch debug + +The following function will be handy to convert a string denoting a +number into a ‘NUMBER’ token. + + %{ + // A number symbol corresponding to the value in S. + yy::parser::symbol_type + make_NUMBER (const std::string &s, const yy::parser::location_type& loc); + %} + +Abbreviations allow for more readable rules. + + id [a-zA-Z][a-zA-Z_0-9]* + int [0-9]+ + blank [ \t\r] + +The following paragraph suffices to track locations accurately. Each +time ‘yylex’ is invoked, the begin position is moved onto the end +position. Then when a pattern is matched, its width is added to the end +column. When matching ends of lines, the end cursor is adjusted, and +each time blanks are matched, the begin cursor is moved onto the end +cursor to effectively ignore the blanks preceding tokens. Comments +would be treated equally. + + %{ + // Code run each time a pattern is matched. + # define YY_USER_ACTION loc.columns (yyleng); + %} + %% + %{ + // A handy shortcut to the location held by the driver. + yy::location& loc = drv.location; + // Code run each time yylex is called. + loc.step (); + %} + {blank}+ loc.step (); + \n+ loc.lines (yyleng); loc.step (); + +The rules are simple. The driver is used to report errors. + + "-" return yy::parser::make_MINUS (loc); + "+" return yy::parser::make_PLUS (loc); + "*" return yy::parser::make_STAR (loc); + "/" return yy::parser::make_SLASH (loc); + "(" return yy::parser::make_LPAREN (loc); + ")" return yy::parser::make_RPAREN (loc); + ":=" return yy::parser::make_ASSIGN (loc); + + {int} return make_NUMBER (yytext, loc); + {id} return yy::parser::make_IDENTIFIER (yytext, loc); + . { + throw yy::parser::syntax_error + (loc, "invalid character: " + std::string(yytext)); + } + <> return yy::parser::make_YYEOF (loc); + %% + +You should keep your rules simple, both in the parser and in the +scanner. Throwing from the auxiliary functions is then very handy to +report errors. + + yy::parser::symbol_type + make_NUMBER (const std::string &s, const yy::parser::location_type& loc) + { + errno = 0; + long n = strtol (s.c_str(), NULL, 10); + if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) + throw yy::parser::syntax_error (loc, "integer is out of range: " + s); + return yy::parser::make_NUMBER ((int) n, loc); + } + +Finally, because the scanner-related driver’s member-functions depend on +the scanner’s data, it is simpler to implement them in this file. + + void + driver::scan_begin () + { + yy_flex_debug = trace_scanning; + if (file.empty () || file == "-") + yyin = stdin; + else if (!(yyin = fopen (file.c_str (), "r"))) + { + std::cerr << "cannot open " << file << ": " << strerror (errno) << '\n'; + exit (EXIT_FAILURE); + } + } + + void + driver::scan_end () + { + fclose (yyin); + } + + +File: bison.info, Node: Calc++ Top Level, Prev: Calc++ Scanner, Up: A Complete C++ Example + +10.1.8.5 Calc++ Top Level +......................... + +The top level file, ‘calc++.cc’, poses no problem. + + #include + #include "driver.hh" + + int + main (int argc, char *argv[]) + { + int res = 0; + driver drv; + for (int i = 1; i < argc; ++i) + if (argv[i] == std::string ("-p")) + drv.trace_parsing = true; + else if (argv[i] == std::string ("-s")) + drv.trace_scanning = true; + else if (!drv.parse (argv[i])) + std::cout << drv.result << '\n'; + else + res = 1; + return res; + } + + +File: bison.info, Node: D Parsers, Next: Java Parsers, Prev: C++ Parsers, Up: Other Languages + +10.2 D Parsers +============== + +* Menu: + +* D Bison Interface:: Asking for D parser generation +* D Semantic Values:: %token and %nterm vs. D +* D Location Values:: The position and location classes +* D Parser Interface:: Instantiating and running the parser +* D Parser Context Interface:: Circumstances of a syntax error +* D Scanner Interface:: Specifying the scanner for the parser +* D Action Features:: Special features for use in actions +* D Push Parser Interface:: Instantiating and running the push parser +* D Complete Symbols:: Using token constructors + + +File: bison.info, Node: D Bison Interface, Next: D Semantic Values, Up: D Parsers + +10.2.1 D Bison Interface +------------------------ + +The D parser skeletons are selected using the ‘%language "D"’ directive +or the ‘-L D’/‘--language=D’ option. + + When generating a D parser, ‘bison BASENAME.y’ will create a single D +source file named ‘BASENAME.d’ containing the parser implementation. +Using a grammar file without a ‘.y’ suffix is currently broken. The +basename of the parser implementation file can be changed by the +‘%file-prefix’ directive or the ‘-b’/‘--file-prefix’ option. The entire +parser implementation file name can be changed by the ‘%output’ +directive or the ‘-o’/‘--output’ option. The parser implementation file +contains a single class for the parser. + + You can create documentation for generated parsers using Ddoc. + + GLR parsers are currently unsupported in D. Do not use the +‘glr-parser’ directive. + + No header file can be generated for D parsers. Do not use the +‘%header’ directive or the ‘-d’/‘--header’ options. + + +File: bison.info, Node: D Semantic Values, Next: D Location Values, Prev: D Bison Interface, Up: D Parsers + +10.2.2 D Semantic Values +------------------------ + +Semantic types are handled by ‘%union’ and ‘%define api.value.type +union’, similar to C/C++ parsers. In the latter case, the union of the +values is handled by the backend. In D, unions can hold classes, +structs, etc., so this directive is more similar to ‘%define +api.value.type variant’ from C++. + + D parsers do not support ‘%destructor’, since the language adopts +garbage collection. The parser will try to hold references to semantic +values for as little time as needed. + + D parsers support ‘%printer’. An example for the output of type +‘int’, where ‘yyo’ is the parser’s debug output: + + %printer { yyo.write($$); } + + +File: bison.info, Node: D Location Values, Next: D Parser Interface, Prev: D Semantic Values, Up: D Parsers + +10.2.3 D Location Values +------------------------ + +When the directive ‘%locations’ is used, the D parser supports location +tracking, see *note Tracking Locations::. The position and the location +structures are provided. + + -- Instance Variable of Location: Position begin + -- Instance Variable of Location: Position end + The first, inclusive, position of the range, and the first beyond. + + -- Constructor on Location: this(Position LOC) + Create a ‘Location’ denoting an empty range located at a given + point. + + -- Constructor on Location: this(Position BEGIN, Position END) + Create a ‘Location’ from the endpoints of the range. + + -- Method on Location: string toString() + The range represented by the location as a string. + + +File: bison.info, Node: D Parser Interface, Next: D Parser Context Interface, Prev: D Location Values, Up: D Parsers + +10.2.4 D Parser Interface +------------------------- + +The name of the generated parser class defaults to ‘YYParser’. The ‘YY’ +prefix may be changed using the ‘%define api.prefix’. Alternatively, +use ‘%define api.parser.class {NAME}’ to give a custom name to the +class. The interface of this class is detailed below. + + By default, the parser class has public visibility. To add modifiers +to the parser class, ‘%define’ ‘api.parser.public’, +‘api.parser.abstract’ and/or ‘api.parser.final’. + + The superclass and the implemented interfaces of the parser class can +be specified with the ‘%define api.parser.extends’ and ‘%define +api.parser.implements’ directives. + + The parser class defines an interface, ‘Lexer’ (*note D Scanner +Interface::). Other than this interface and the members described in +the interface below, all the other members and fields are preceded with +a ‘yy’ or ‘YY’ prefix to avoid clashes with user code. + + The parser class can be extended using the ‘%parse-param’ directive. +Each occurrence of the directive will add a by default public field to +the parser class, and an argument to its constructor, which initializes +them automatically. + + -- Constructor on YYParser: this(LEX_PARAM, ..., PARSE_PARAM, ...) + Build a new parser object with embedded ‘%code lexer’. There are + no parameters, unless ‘%param’s and/or ‘%parse-param’s and/or + ‘%lex-param’s are used. + + -- Constructor on YYParser: this(Lexer LEXER, PARSE_PARAM, ...) + Build a new parser object using the specified scanner. There are + no additional parameters unless ‘%param’s and/or ‘%parse-param’s + are used. + + -- Method on YYParser: boolean parse() + Run the syntactic analysis, and return ‘true’ on success, ‘false’ + otherwise. + + -- Method on YYParser: boolean getErrorVerbose() + -- Method on YYParser: void setErrorVerbose(boolean VERBOSE) + Get or set the option to produce verbose error messages. These are + only available with ‘%define parse.error detailed’, which also + turns on verbose error messages. + + -- Method on YYParser: void yyerror(string MSG) + -- Method on YYParser: void yyerror(Location LOC, string MSG) + Print an error message using the ‘yyerror’ method of the scanner + instance in use. The ‘Location’ and ‘Position’ parameters are + available only if location tracking is active. + + -- Method on YYParser: boolean recovering() + During the syntactic analysis, return ‘true’ if recovering from a + syntax error. *Note Error Recovery::. + + -- Method on YYParser: File getDebugStream() + -- Method on YYParser: void setDebugStream(File O) + Get or set the stream used for tracing the parsing. It defaults to + ‘stderr’. + + -- Method on YYParser: int getDebugLevel() + -- Method on YYParser: void setDebugLevel(int L) + Get or set the tracing level. Currently its value is either 0, no + trace, or nonzero, full tracing. + + -- Constant of YYParser: string bisonVersion + -- Constant of YYParser: string bisonSkeleton + Identify the Bison version and skeleton used to generate this + parser. + + The internationalization in D is very similar to the one in C. The D +parser uses ‘dgettext’ for translating Bison messages. + + To enable internationalization, compile using ‘-version ENABLE_NLS +-version YYENABLE_NLS’ and import ‘bindtextdomain’ and ‘textdomain’ from +C: + + extern(C) char* bindtextdomain(const char* domainname, const char* dirname); + extern(C) char* textdomain(const char* domainname); + + The main function should load the translation catalogs, similarly to +the ‘c/bistromathic’ example: + + int main() + { + import core.stdc.locale; + + // Set up internationalization. + setlocale(LC_ALL, ""); + // Use Bison's standard translation catalog for error messages + // (the generated messages). + bindtextdomain("bison-runtime", BISON_LOCALEDIR); + // For the translation catalog of your own project, use the + // name of your project. + bindtextdomain("bison", LOCALEDIR); + textdomain("bison"); + + // usual main content + ... + } + + For user message translations, the user must implement the ‘string +_(const char* MSG)’ function. It is recommended to use ‘gettext’: + + %code imports { + static if (!is(typeof(_))) + { + version(ENABLE_NLS) + { + extern(C) char* gettext(const char*); + string _(const char* s) + { + return to!string(gettext(s)); + } + } + } + static if (!is(typeof(_))) + { + pragma(inline, true) + string _(string msg) { return msg; } + } + } + + +File: bison.info, Node: D Parser Context Interface, Next: D Scanner Interface, Prev: D Parser Interface, Up: D Parsers + +10.2.5 D Parser Context Interface +--------------------------------- + +The parser context provides information to build error reports when you +invoke ‘%define parse.error custom’. + + -- Type of YYParser: SymbolKind + A struct containing an enum of all the grammar symbols, tokens and + nonterminals. Its enumerators are forged from the symbol names. + Use ‘void toString(W)(W sink)’ to get the symbol names. + + -- Method on YYParser.Context: YYParser.SymbolKind getToken() + The kind of the lookahead. Return ‘null’ iff there is no + lookahead. + + -- Method on YYParser.Context: YYParser.Location getLocation() + The location of the lookahead. + + -- Method on YYParser.Context: int + getExpectedTokens(YYParser.SymbolKind[] ARGV, int ARGC) + Fill ARGV with the expected tokens, which never includes + ‘SymbolKind.YYERROR’, or ‘SymbolKind.YYUNDEF’. + + Never put more than ARGC elements into ARGV, and on success return + the number of tokens stored in ARGV. If there are more expected + tokens than ARGC, fill ARGV up to ARGC and return 0. If there are + no expected tokens, also return 0, but set ‘argv[0]’ to ‘null’. + + If ARGV is null, return the size needed to store all the possible + values, which is always less than ‘YYNTOKENS’. + + +File: bison.info, Node: D Scanner Interface, Next: D Action Features, Prev: D Parser Context Interface, Up: D Parsers + +10.2.6 D Scanner Interface +-------------------------- + +There are two possible ways to interface a Bison-generated D parser with +a scanner: the scanner may be defined by ‘%code lexer’, or defined +elsewhere. In either case, the scanner has to implement the ‘Lexer’ +inner interface of the parser class. This interface also contains +constants for all user-defined token names and the predefined ‘YYEOF’ +token. + + In the first case, the body of the scanner class is placed in ‘%code +lexer’ blocks. If you want to pass parameters from the parser +constructor to the scanner constructor, specify them with ‘%lex-param’; +they are passed before ‘%parse-param’s to the constructor. + + In the second case, the scanner has to implement the ‘Lexer’ +interface, which is defined within the parser class (e.g., +‘YYParser.Lexer’). The constructor of the parser object will then +accept an object implementing the interface; ‘%lex-param’ is not used in +this case. + + In both cases, the scanner has to implement the following methods. + + -- Method on Lexer: void yyerror(Location LOC, string MSG) + This method is defined by the user to emit an error message. The + first parameter is omitted if location tracking is not active. + + -- Method on Lexer: Symbol yylex() + Return the next token. The return value is of type ‘Symbol’, which + binds together the kind, the semantic value and the location. + + -- Method on Lexer: void reportSyntaxError(YYParser.Context CTX) + If you invoke ‘%define parse.error custom’ (*note Bison + Declarations::), then the parser no longer passes syntax error + messages to ‘yyerror’, rather it delegates that task to the user by + calling the ‘reportSyntaxError’ function. + + Whether it uses ‘yyerror’ is up to the user. + + Here is an example of a reporting function (*note D Parser Context + Interface::). + + public void reportSyntaxError(YYParser.Context ctx) + { + stderr.write(ctx.getLocation(), ": syntax error"); + // Report the expected tokens. + { + immutable int TOKENMAX = 5; + YYParser.SymbolKind[] arg = new YYParser.SymbolKind[TOKENMAX]; + int n = ctx.getExpectedTokens(arg, TOKENMAX); + if (n < TOKENMAX) + for (int i = 0; i < n; ++i) + stderr.write((i == 0 ? ": expected " : " or "), arg[i]); + } + // Report the unexpected token which triggered the error. + { + YYParser.SymbolKind lookahead = ctx.getToken(); + stderr.writeln(" before ", lookahead); + } + } + + This implementation is inappropriate for internationalization, see + the ‘c/bistromathic’ example for a better alternative. + + +File: bison.info, Node: D Action Features, Next: D Push Parser Interface, Prev: D Scanner Interface, Up: D Parsers + +10.2.7 Special Features for Use in D Actions +-------------------------------------------- + +Here is a table of Bison constructs, variables and functions that are +useful in actions. + + -- Variable: $$ + Acts like a variable that contains the semantic value for the + grouping made by the current rule. *Note Actions::. + + -- Variable: $N + Acts like a variable that contains the semantic value for the Nth + component of the current rule. *Note Actions::. + + -- Function: yyerrok + Resume generating error messages immediately for subsequent syntax + errors. This is useful primarily in error rules. *Note Error + Recovery::. + + +File: bison.info, Node: D Push Parser Interface, Next: D Complete Symbols, Prev: D Action Features, Up: D Parsers + +10.2.8 D Push Parser Interface +------------------------------ + +Normally, Bison generates a pull parser for D. The following Bison +declaration says that you want the parser to be a push parser (*note +%define Summary::): + + %define api.push-pull push + + Most of the discussion about the D pull Parser Interface, (*note D +Parser Interface::) applies to the push parser interface as well. + + When generating a push parser, the method ‘pushParse’ is created with +the following signature: + + -- Method on YYParser: int pushParse (Symbol SYM) + + The primary difference with respect to a pull parser is that the +parser method ‘pushParse’ is invoked repeatedly to parse each token. +This function is available if either the ‘%define api.push-pull push’ or +‘%define api.push-pull both’ declaration is used (*note %define +Summary::). + + The value returned by the ‘pushParse’ method is one of the following: +‘ACCEPT’, ‘ABORT’, or ‘PUSH_MORE’. This new value, ‘PUSH_MORE’, may be +returned if more input is required to finish parsing the input. + + If ‘api.push-pull’ is defined as ‘both’, then the generated parser +class will also implement the ‘parse’ method. This method’s body is a +loop that repeatedly invokes the scanner and then passes the values +obtained from the scanner to the ‘pushParse’ method. + + +File: bison.info, Node: D Complete Symbols, Prev: D Push Parser Interface, Up: D Parsers + +10.2.9 D Complete Symbols +------------------------- + +To build return values for ‘yylex’, call the ‘Symbol’ method of the same +name as the token kind reported, and adding the parameters for value and +location if necessary. These methods generate compile-time errors if +the parameters are inconsistent. Token constructors work with both +‘%union’ and ‘%define api.value.type union’. + + The order of the parameters is the same as for the ‘Symbol’ +constructor. An example for the token kind ‘NUM’, which has value +‘ival’ and with location tracking activated: + + Symbol.NUM(ival, location); + + +File: bison.info, Node: Java Parsers, Prev: D Parsers, Up: Other Languages + +10.3 Java Parsers +================= + +* Menu: + +* Java Bison Interface:: Asking for Java parser generation +* Java Semantic Values:: %token and %nterm vs. Java +* Java Location Values:: The position and location classes +* Java Parser Interface:: Instantiating and running the parser +* Java Parser Context Interface:: Circumstances of a syntax error +* Java Scanner Interface:: Specifying the scanner for the parser +* Java Action Features:: Special features for use in actions +* Java Push Parser Interface:: Instantiating and running the push parser +* Java Differences:: Differences between C/C++ and Java Grammars +* Java Declarations Summary:: List of Bison declarations used with Java + + +File: bison.info, Node: Java Bison Interface, Next: Java Semantic Values, Up: Java Parsers + +10.3.1 Java Bison Interface +--------------------------- + +The Java parser skeletons are selected using the ‘%language "Java"’ +directive or the ‘-L java’/‘--language=java’ option. + + When generating a Java parser, ‘bison BASENAME.y’ will create a +single Java source file named ‘BASENAME.java’ containing the parser +implementation. Using a grammar file without a ‘.y’ suffix is currently +broken. The basename of the parser implementation file can be changed +by the ‘%file-prefix’ directive or the ‘-b’/‘--file-prefix’ option. The +entire parser implementation file name can be changed by the ‘%output’ +directive or the ‘-o’/‘--output’ option. The parser implementation file +contains a single class for the parser. + + You can create documentation for generated parsers using Javadoc. + + Contrary to C parsers, Java parsers do not use global variables; the +state of the parser is always local to an instance of the parser class. +Therefore, all Java parsers are “pure”, and the ‘%define api.pure’ +directive does nothing when used in Java. + + GLR parsers are currently unsupported in Java. Do not use the +‘glr-parser’ directive. + + No header file can be generated for Java parsers. Do not use the +‘%header’ directive or the ‘-d’/‘-H’/‘--header’ options. + + Currently, support for tracing is always compiled in. Thus the +‘%define parse.trace’ and ‘%token-table’ directives and the +‘-t’/‘--debug’ and ‘-k’/‘--token-table’ options have no effect. This +may change in the future to eliminate unused code in the generated +parser, so use ‘%define parse.trace’ explicitly if needed. Also, in the +future the ‘%token-table’ directive might enable a public interface to +access the token names and codes. + + Getting a “code too large” error from the Java compiler means the +code hit the 64KB bytecode per method limitation of the Java class file. +Try reducing the amount of code in actions and static initializers; +otherwise, report a bug so that the parser skeleton will be improved. + + +File: bison.info, Node: Java Semantic Values, Next: Java Location Values, Prev: Java Bison Interface, Up: Java Parsers + +10.3.2 Java Semantic Values +--------------------------- + +There is no ‘%union’ directive in Java parsers. Instead, the semantic +values’ types (class names) should be specified in the ‘%nterm’ or +‘%token’ directive: + + %nterm expr assignment_expr term factor + %nterm number + + By default, the semantic stack is declared to have ‘Object’ members, +which means that the class types you specify can be of any class. To +improve the type safety of the parser, you can declare the common +superclass of all the semantic values using the ‘%define api.value.type’ +directive. For example, after the following declaration: + + %define api.value.type {ASTNode} + +any ‘%token’, ‘%nterm’ or ‘%type’ specifying a semantic type which is +not a subclass of ‘ASTNode’, will cause a compile-time error. + + Types used in the directives may be qualified with a package name. +Primitive data types are accepted for Java version 1.5 or later. Note +that in this case the autoboxing feature of Java 1.5 will be used. +Generic types may not be used; this is due to a limitation in the +implementation of Bison, and may change in future releases. + + Java parsers do not support ‘%destructor’, since the language adopts +garbage collection. The parser will try to hold references to semantic +values for as little time as needed. + + Java parsers do not support ‘%printer’, as ‘toString()’ can be used +to print the semantic values. This however may change (in a +backwards-compatible way) in future versions of Bison. + + +File: bison.info, Node: Java Location Values, Next: Java Parser Interface, Prev: Java Semantic Values, Up: Java Parsers + +10.3.3 Java Location Values +--------------------------- + +When the directive ‘%locations’ is used, the Java parser supports +location tracking, see *note Tracking Locations::. An auxiliary +user-defined class defines a “position”, a single point in a file; Bison +itself defines a class representing a “location”, a range composed of a +pair of positions (possibly spanning several files). The location class +is an inner class of the parser; the name is ‘Location’ by default, and +may also be renamed using ‘%define api.location.type {CLASS-NAME}’. + + The location class treats the position as a completely opaque value. +By default, the class name is ‘Position’, but this can be changed with +‘%define api.position.type {CLASS-NAME}’. This class must be supplied +by the user. + + -- Instance Variable of Location: Position begin + -- Instance Variable of Location: Position end + The first, inclusive, position of the range, and the first beyond. + + -- Constructor on Location: Location (Position LOC) + Create a ‘Location’ denoting an empty range located at a given + point. + + -- Constructor on Location: Location (Position BEGIN, Position END) + Create a ‘Location’ from the endpoints of the range. + + -- Method on Location: String toString () + Prints the range represented by the location. For this to work + properly, the position class should override the ‘equals’ and + ‘toString’ methods appropriately. + + +File: bison.info, Node: Java Parser Interface, Next: Java Parser Context Interface, Prev: Java Location Values, Up: Java Parsers + +10.3.4 Java Parser Interface +---------------------------- + +The name of the generated parser class defaults to ‘YYParser’. The ‘YY’ +prefix may be changed using the ‘%define api.prefix’. Alternatively, +use ‘%define api.parser.class {NAME}’ to give a custom name to the +class. The interface of this class is detailed below. + + By default, the parser class has package visibility. A declaration +‘%define api.parser.public’ will change to public visibility. Remember +that, according to the Java language specification, the name of the +‘.java’ file should match the name of the class in this case. +Similarly, you can use ‘api.parser.abstract’, ‘api.parser.final’ and +‘api.parser.strictfp’ with the ‘%define’ declaration to add other +modifiers to the parser class. A single ‘%define api.parser.annotations +{ANNOTATIONS}’ directive can be used to add any number of annotations to +the parser class. + + The Java package name of the parser class can be specified using the +‘%define package’ directive. The superclass and the implemented +interfaces of the parser class can be specified with the ‘%define +api.parser.extends’ and ‘%define api.parser.implements’ directives. + + The parser class defines an inner class, ‘Location’, that is used for +location tracking (see *note Java Location Values::), and a inner +interface, ‘Lexer’ (see *note Java Scanner Interface::). Other than +these inner class/interface, and the members described in the interface +below, all the other members and fields are preceded with a ‘yy’ or ‘YY’ +prefix to avoid clashes with user code. + + The parser class can be extended using the ‘%parse-param’ directive. +Each occurrence of the directive will add a ‘protected final’ field to +the parser class, and an argument to its constructor, which initializes +them automatically. + + -- Constructor on YYParser: YYParser (LEX_PARAM, ..., PARSE_PARAM, ...) + Build a new parser object with embedded ‘%code lexer’. There are + no parameters, unless ‘%param’s and/or ‘%parse-param’s and/or + ‘%lex-param’s are used. + + Use ‘%code init’ for code added to the start of the constructor + body. This is especially useful to initialize superclasses. Use + ‘%define init_throws’ to specify any uncaught exceptions. + + -- Constructor on YYParser: YYParser (Lexer LEXER, PARSE_PARAM, ...) + Build a new parser object using the specified scanner. There are + no additional parameters unless ‘%param’s and/or ‘%parse-param’s + are used. + + If the scanner is defined by ‘%code lexer’, this constructor is + declared ‘protected’ and is called automatically with a scanner + created with the correct ‘%param’s and/or ‘%lex-param’s. + + Use ‘%code init’ for code added to the start of the constructor + body. This is especially useful to initialize superclasses. Use + ‘%define init_throws’ to specify any uncaught exceptions. + + -- Method on YYParser: boolean parse () + Run the syntactic analysis, and return ‘true’ on success, ‘false’ + otherwise. + + -- Method on YYParser: boolean getErrorVerbose () + -- Method on YYParser: void setErrorVerbose (boolean VERBOSE) + Get or set the option to produce verbose error messages. These are + only available with ‘%define parse.error detailed’ (or ‘verbose’), + which also turns on verbose error messages. + + -- Method on YYParser: void yyerror (String MSG) + -- Method on YYParser: void yyerror (Position POS, String MSG) + -- Method on YYParser: void yyerror (Location LOC, String MSG) + Print an error message using the ‘yyerror’ method of the scanner + instance in use. The ‘Location’ and ‘Position’ parameters are + available only if location tracking is active. + + -- Method on YYParser: boolean recovering () + During the syntactic analysis, return ‘true’ if recovering from a + syntax error. *Note Error Recovery::. + + -- Method on YYParser: java.io.PrintStream getDebugStream () + -- Method on YYParser: void setDebugStream (java.io.PrintStream O) + Get or set the stream used for tracing the parsing. It defaults to + ‘System.err’. + + -- Method on YYParser: int getDebugLevel () + -- Method on YYParser: void setDebugLevel (int L) + Get or set the tracing level. Currently its value is either 0, no + trace, or nonzero, full tracing. + + -- Constant of YYParser: String bisonVersion + -- Constant of YYParser: String bisonSkeleton + Identify the Bison version and skeleton used to generate this + parser. + + If you enabled token internationalization (*note Token I18n::), you +must provide the parser with the following function: + + -- Static Method of YYParser: String i18n (string S) + Return the translation of S in the user’s language. As an example: + + %code { + static ResourceBundle myResources + = ResourceBundle.getBundle("domain-name"); + static final String i18n(String s) { + return myResources.getString(s); + } + } + + +File: bison.info, Node: Java Parser Context Interface, Next: Java Scanner Interface, Prev: Java Parser Interface, Up: Java Parsers + +10.3.5 Java Parser Context Interface +------------------------------------ + +The parser context provides information to build error reports when you +invoke ‘%define parse.error custom’. + + -- Type of YYParser: SymbolKind + An enum of all the grammar symbols, tokens and nonterminals. Its + enumerators are forged from the symbol names: + + public enum SymbolKind + { + S_YYEOF(0), /* "end of file" */ + S_YYERROR(1), /* error */ + S_YYUNDEF(2), /* "invalid token" */ + S_BANG(3), /* "!" */ + S_PLUS(4), /* "+" */ + S_MINUS(5), /* "-" */ + [...] + S_NUM(13), /* "number" */ + S_NEG(14), /* NEG */ + S_YYACCEPT(15), /* $accept */ + S_input(16), /* input */ + S_line(17); /* line */ + }; + + -- Method on YYParser.SymbolKind: String getName () + The name of this symbol, possibly translated. + + -- Method on YYParser.Context: YYParser.SymbolKind getToken () + The kind of the lookahead. Return ‘null’ iff there is no + lookahead. + + -- Method on YYParser.Context: YYParser.Location getLocation () + The location of the lookahead. + + -- Method on YYParser.Context: int getExpectedTokens + (YYParser.SymbolKind[] ARGV, int ARGC) + Fill ARGV with the expected tokens, which never includes + ‘SymbolKind.S_YYERROR’, or ‘SymbolKind.S_YYUNDEF’. + + Never put more than ARGC elements into ARGV, and on success return + the number of tokens stored in ARGV. If there are more expected + tokens than ARGC, fill ARGV up to ARGC and return 0. If there are + no expected tokens, also return 0, but set ‘argv[0]’ to ‘null’. + + If ARGV is null, return the size needed to store all the possible + values, which is always less than ‘YYNTOKENS’. + + +File: bison.info, Node: Java Scanner Interface, Next: Java Action Features, Prev: Java Parser Context Interface, Up: Java Parsers + +10.3.6 Java Scanner Interface +----------------------------- + +There are two possible ways to interface a Bison-generated Java parser +with a scanner: the scanner may be defined by ‘%code lexer’, or defined +elsewhere. In either case, the scanner has to implement the ‘Lexer’ +inner interface of the parser class. This interface also contains +constants for all user-defined token names and the predefined ‘YYEOF’ +token. + + In the first case, the body of the scanner class is placed in ‘%code +lexer’ blocks. If you want to pass parameters from the parser +constructor to the scanner constructor, specify them with ‘%lex-param’; +they are passed before ‘%parse-param’s to the constructor. + + In the second case, the scanner has to implement the ‘Lexer’ +interface, which is defined within the parser class (e.g., +‘YYParser.Lexer’). The constructor of the parser object will then +accept an object implementing the interface; ‘%lex-param’ is not used in +this case. + + In both cases, the scanner has to implement the following methods. + + -- Method on Lexer: void yyerror (Location LOC, String MSG) + This method is defined by the user to emit an error message. The + first parameter is omitted if location tracking is not active. Its + type can be changed using ‘%define api.location.type {CLASS-NAME}’. + + -- Method on Lexer: int yylex () + Return the next token. Its type is the return value, its semantic + value and location are saved and returned by the their methods in + the interface. Not needed for push-only parsers. + + Use ‘%define lex_throws’ to specify any uncaught exceptions. + Default is ‘java.io.IOException’. + + -- Method on Lexer: Position getStartPos () + -- Method on Lexer: Position getEndPos () + Return respectively the first position of the last token that + ‘yylex’ returned, and the first position beyond it. These methods + are not needed unless location tracking and pull parsing are + active. + + They should return new objects for each call, to avoid that all the + symbol share the same Position boundaries. + + The return type can be changed using ‘%define api.position.type + {CLASS-NAME}’. + + -- Method on Lexer: Object getLVal () + Return the semantic value of the last token that yylex returned. + Not needed for push-only parsers. + + The return type can be changed using ‘%define api.value.type + {CLASS-NAME}’. + + -- Method on Lexer: void reportSyntaxError (YYParser.Context CTX) + If you invoke ‘%define parse.error custom’ (*note Bison + Declarations::), then the parser no longer passes syntax error + messages to ‘yyerror’, rather it delegates that task to the user by + calling the ‘reportSyntaxError’ function. + + Whether it uses ‘yyerror’ is up to the user. + + Here is an example of a reporting function (*note Java Parser + Context Interface::). + + public void reportSyntaxError(YYParser.Context ctx) { + System.err.print(ctx.getLocation() + ": syntax error"); + // Report the expected tokens. + { + final int TOKENMAX = 5; + YYParser.SymbolKind[] arg = new YYParser.SymbolKind[TOKENMAX]; + int n = ctx.getExpectedTokens(arg, TOKENMAX); + for (int i = 0; i < n; ++i) + System.err.print((i == 0 ? ": expected " : " or ") + + arg[i].getName()); + } + // Report the unexpected token which triggered the error. + { + YYParser.SymbolKind lookahead = ctx.getToken(); + if (lookahead != null) + System.err.print(" before " + lookahead.getName()); + } + System.err.println(""); + } + + This implementation is inappropriate for internationalization, see + the ‘c/bistromathic’ example for a better alternative. + + +File: bison.info, Node: Java Action Features, Next: Java Push Parser Interface, Prev: Java Scanner Interface, Up: Java Parsers + +10.3.7 Special Features for Use in Java Actions +----------------------------------------------- + +The following special constructs can be uses in Java actions. Other +analogous C action features are currently unavailable for Java. + + Use ‘%define throws’ to specify any uncaught exceptions from parser +actions, and initial actions specified by ‘%initial-action’. + + -- Variable: $N + The semantic value for the Nth component of the current rule. This + may not be assigned to. *Note Java Semantic Values::. + + -- Variable: $N + Like ‘$N’ but specifies a alternative type TYPEALT. *Note Java + Semantic Values::. + + -- Variable: $$ + The semantic value for the grouping made by the current rule. As a + value, this is in the base type (‘Object’ or as specified by + ‘%define api.value.type’) as in not cast to the declared subtype + because casts are not allowed on the left-hand side of Java + assignments. Use an explicit Java cast if the correct subtype is + needed. *Note Java Semantic Values::. + + -- Variable: $$ + Same as ‘$$’ since Java always allow assigning to the base type. + Perhaps we should use this and ‘$<>$’ for the value and ‘$$’ for + setting the value but there is currently no easy way to distinguish + these constructs. *Note Java Semantic Values::. + + -- Variable: @N + The location information of the Nth component of the current rule. + This may not be assigned to. *Note Java Location Values::. + + -- Variable: @$ + The location information of the grouping made by the current rule. + *Note Java Location Values::. + + -- Statement: return YYABORT ; + Return immediately from the parser, indicating failure. *Note Java + Parser Interface::. + + -- Statement: return YYACCEPT ; + Return immediately from the parser, indicating success. *Note Java + Parser Interface::. + + -- Statement: return YYERROR ; + Start error recovery (without printing an error message). *Note + Error Recovery::. + + -- Function: boolean recovering () + Return whether error recovery is being done. In this state, the + parser reads token until it reaches a known state, and then + restarts normal operation. *Note Error Recovery::. + + -- Function: void yyerror (String MSG) + -- Function: void yyerror (Position LOC, String MSG) + -- Function: void yyerror (Location LOC, String MSG) + Print an error message using the ‘yyerror’ method of the scanner + instance in use. The ‘Location’ and ‘Position’ parameters are + available only if location tracking is active. + + +File: bison.info, Node: Java Push Parser Interface, Next: Java Differences, Prev: Java Action Features, Up: Java Parsers + +10.3.8 Java Push Parser Interface +--------------------------------- + +Normally, Bison generates a pull parser for Java. The following Bison +declaration says that you want the parser to be a push parser (*note +%define Summary::): + + %define api.push-pull push + + Most of the discussion about the Java pull Parser Interface, (*note +Java Parser Interface::) applies to the push parser interface as well. + + When generating a push parser, the method ‘push_parse’ is created +with the following signature (depending on if locations are enabled). + + -- Method on YYParser: void push_parse (int TOKEN, Object YYLVAL) + -- Method on YYParser: void push_parse (int TOKEN, Object YYLVAL, + Location YYLOC) + -- Method on YYParser: void push_parse (int TOKEN, Object YYLVAL, + Position YYPOS) + + The primary difference with respect to a pull parser is that the +parser method ‘push_parse’ is invoked repeatedly to parse each token. +This function is available if either the ‘%define api.push-pull push’ or +‘%define api.push-pull both’ declaration is used (*note %define +Summary::). The ‘Location’ and ‘Position’ parameters are available only +if location tracking is active. + + The value returned by the ‘push_parse’ method is one of the +following: 0 (success), 1 (abort), 2 (memory exhaustion), or +‘YYPUSH_MORE’. This new value, ‘YYPUSH_MORE’, may be returned if more +input is required to finish parsing the grammar. + + If ‘api.push-pull’ is defined as ‘both’, then the generated parser +class will also implement the ‘parse’ method. This method’s body is a +loop that repeatedly invokes the scanner and then passes the values +obtained from the scanner to the ‘push_parse’ method. + + There is one additional complication. Technically, the push parser +does not need to know about the scanner (i.e. an object implementing +the ‘YYParser.Lexer’ interface), but it does need access to the +‘yyerror’ method. Currently, the ‘yyerror’ method is defined in the +‘YYParser.Lexer’ interface. Hence, an implementation of that interface +is still required in order to provide an implementation of ‘yyerror’. +The current approach (and subject to change) is to require the +‘YYParser’ constructor to be given an object implementing the +‘YYParser.Lexer’ interface. This object need only implement the +‘yyerror’ method; the other methods can be stubbed since they will never +be invoked. The simplest way to do this is to add a trivial scanner +implementation to your grammar file using whatever implementation of +‘yyerror’ is desired. The following code sample shows a simple way to +accomplish this. + + %code lexer + { + public Object getLVal () {return null;} + public int yylex () {return 0;} + public void yyerror (String s) {System.err.println(s);} + } + + +File: bison.info, Node: Java Differences, Next: Java Declarations Summary, Prev: Java Push Parser Interface, Up: Java Parsers + +10.3.9 Differences between C/C++ and Java Grammars +-------------------------------------------------- + +The different structure of the Java language forces several differences +between C/C++ grammars, and grammars designed for Java parsers. This +section summarizes these differences. + + • Java has no a preprocessor, so obviously the ‘YYERROR’, ‘YYACCEPT’, + ‘YYABORT’ symbols (*note Table of Symbols::) cannot be macros. + Instead, they should be preceded by ‘return’ when they appear in an + action. The actual definition of these symbols is opaque to the + Bison grammar, and it might change in the future. The only + meaningful operation that you can do, is to return them. *Note + Java Action Features::. + + Note that of these three symbols, only ‘YYACCEPT’ and ‘YYABORT’ + will cause a return from the ‘yyparse’ method(1). + + • Java lacks unions, so ‘%union’ has no effect. Instead, semantic + values have a common base type: ‘Object’ or as specified by + ‘%define api.value.type’. Angle brackets on ‘%token’, ‘type’, ‘$N’ + and ‘$$’ specify subtypes rather than fields of an union. The type + of ‘$$’, even with angle brackets, is the base type since Java + casts are not allow on the left-hand side of assignments. Also, + ‘$N’ and ‘@N’ are not allowed on the left-hand side of assignments. + *Note Java Semantic Values::, and *note Java Action Features::. + + • The prologue declarations have a different meaning than in C/C++ + code. + ‘%code imports’ + blocks are placed at the beginning of the Java source code. + They may include copyright notices. For a ‘package’ + declarations, use ‘%define api.package’ instead. + + unqualified ‘%code’ + blocks are placed inside the parser class. + + ‘%code lexer’ + blocks, if specified, should include the implementation of the + scanner. If there is no such block, the scanner can be any + class that implements the appropriate interface (*note Java + Scanner Interface::). + + Other ‘%code’ blocks are not supported in Java parsers. In + particular, ‘%{ ... %}’ blocks should not be used and may give an + error in future versions of Bison. + + The epilogue has the same meaning as in C/C++ code and it can be + used to define other classes used by the parser _outside_ the + parser class. + + ---------- Footnotes ---------- + + (1) Java parsers include the actions in a separate method than +‘yyparse’ in order to have an intuitive syntax that corresponds to these +C macros. + + +File: bison.info, Node: Java Declarations Summary, Prev: Java Differences, Up: Java Parsers + +10.3.10 Java Declarations Summary +--------------------------------- + +This summary only include declarations specific to Java or have special +meaning when used in a Java parser. + + -- Directive: %language "Java" + Generate a Java class for the parser. + + -- Directive: %lex-param {TYPE NAME} + A parameter for the lexer class defined by ‘%code lexer’ _only_, + added as parameters to the lexer constructor and the parser + constructor that _creates_ a lexer. Default is none. *Note Java + Scanner Interface::. + + -- Directive: %parse-param {TYPE NAME} + A parameter for the parser class added as parameters to + constructor(s) and as fields initialized by the constructor(s). + Default is none. *Note Java Parser Interface::. + + -- Directive: %token TOKEN ... + Declare tokens. Note that the angle brackets enclose a Java + _type_. *Note Java Semantic Values::. + + -- Directive: %nterm NONTERMINAL ... + Declare the type of nonterminals. Note that the angle brackets + enclose a Java _type_. *Note Java Semantic Values::. + + -- Directive: %code { CODE ... } + Code appended to the inside of the parser class. *Note Java + Differences::. + + -- Directive: %code imports { CODE ... } + Code inserted just after the ‘package’ declaration. *Note Java + Differences::. + + -- Directive: %code init { CODE ... } + Code inserted at the beginning of the parser constructor body. + *Note Java Parser Interface::. + + -- Directive: %code lexer { CODE ... } + Code added to the body of a inner lexer class within the parser + class. *Note Java Scanner Interface::. + + -- Directive: %% CODE ... + Code (after the second ‘%%’) appended to the end of the file, + _outside_ the parser class. *Note Java Differences::. + + -- Directive: %{ CODE ... %} + Not supported. Use ‘%code imports’ instead. *Note Java + Differences::. + + -- Directive: %define api.prefix {PREFIX} + The prefix of the parser class name ‘PREFIXParser’ if ‘%define + api.parser.class’ is not used. Default is ‘YY’. *Note Java Bison + Interface::. + + -- Directive: %define api.parser.abstract + Whether the parser class is declared ‘abstract’. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define api.parser.annotations {ANNOTATIONS} + The Java annotations for the parser class. Default is none. *Note + Java Bison Interface::. + + -- Directive: %define api.parser.class {NAME} + The name of the parser class. Default is ‘YYParser’ or + ‘API.PREFIXParser’. *Note Java Bison Interface::. + + -- Directive: %define api.parser.extends {SUPERCLASS} + The superclass of the parser class. Default is none. *Note Java + Bison Interface::. + + -- Directive: %define api.parser.final + Whether the parser class is declared ‘final’. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define api.parser.implements {INTERFACES} + The implemented interfaces of the parser class, a comma-separated + list. Default is none. *Note Java Bison Interface::. + + -- Directive: %define api.parser.public + Whether the parser class is declared ‘public’. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define api.parser.strictfp + Whether the parser class is declared ‘strictfp’. Default is false. + *Note Java Bison Interface::. + + -- Directive: %define init_throws {EXCEPTIONS} + The exceptions thrown by ‘%code init’ from the parser class + constructor. Default is none. *Note Java Parser Interface::. + + -- Directive: %define lex_throws {EXCEPTIONS} + The exceptions thrown by the ‘yylex’ method of the lexer, a + comma-separated list. Default is ‘java.io.IOException’. *Note + Java Scanner Interface::. + + -- Directive: %define api.location.type {CLASS} + The name of the class used for locations (a range between two + positions). This class is generated as an inner class of the + parser class by ‘bison’. Default is ‘Location’. Formerly named + ‘location_type’. *Note Java Location Values::. + + -- Directive: %define api.package {PACKAGE} + The package to put the parser class in. Default is none. *Note + Java Bison Interface::. Renamed from ‘package’ in Bison 3.7. + + -- Directive: %define api.position.type {CLASS} + The name of the class used for positions. This class must be + supplied by the user. Default is ‘Position’. Formerly named + ‘position_type’. *Note Java Location Values::. + + -- Directive: %define api.value.type {CLASS} + The base type of semantic values. Default is ‘Object’. *Note Java + Semantic Values::. + + -- Directive: %define throws {EXCEPTIONS} + The exceptions thrown by user-supplied parser actions and + ‘%initial-action’, a comma-separated list. Default is none. *Note + Java Parser Interface::. + + +File: bison.info, Node: History, Next: Versioning, Prev: Other Languages, Up: Top + +11 A Brief History of the Greater Ungulates +******************************************* + +* Menu: + +* Yacc:: The original Yacc +* yacchack:: An obscure early implementation of reentrancy +* Byacc:: Berkeley Yacc +* Bison:: This program +* Other Ungulates:: Similar programs + + +File: bison.info, Node: Yacc, Next: yacchack, Up: History + +11.1 The ancestral Yacc +======================= + +Bison originated as a workalike of a program called Yacc — Yet Another +Compiler Compiler.(1) Yacc was written at Bell Labs as part of the very +early development of Unix; one of its first uses was to develop the +original Portable C Compiler, pcc. The same person, Steven C. Johnson, +wrote Yacc and the original pcc. + + According to the author (2), Yacc was first invented in 1971 and +reached a form recognizably similar to the C version in 1973. Johnson +published ‘A Portable Compiler: Theory and Practice’ (*note Johnson +1978::). + + Yacc was not itself originally written in C but in its predecessor +language, B. This goes far to explain its odd interface, which exposes a +large number of global variables rather than bundling them into a C +struct. All other Yacc-like programs are descended from the C port of +Yacc. + + Yacc, through both its deployment in pcc and as a standalone tool for +generating other parsers, helped drive the early spread of Unix. Yacc +itself, however, passed out of use after around 1990 when workalikes +with less restrictive licenses and more features became available. + + Original Yacc became generally available when Caldera released the +sources of old versions of Unix up to V7 and 32V in 2002. By that time +it had been long superseded in practical use by Bison even on Yacc’s +native Unix variants. + + ---------- Footnotes ---------- + + (1) Because of the acronym, the name is sometimes given as “YACC”, +but Johnson used “Yacc” in the descriptive paper included in the Version +7 Unix Manual +(https://s3.amazonaws.com/plan9-bell-labs/7thEdMan/v7vol2b.pdf). + + (2) + + +File: bison.info, Node: yacchack, Next: Byacc, Prev: Yacc, Up: History + +11.2 yacchack +============= + +One of the deficiencies of original Yacc was its inability to produce +reentrant parsers. This was first remedied by a set of drop-in +modifications called “yacchack”, published by Eric S. Raymond on USENET +around 1983. This code was quickly forgotten when zoo and Berkeley Yacc +became available a few years later. + + +File: bison.info, Node: Byacc, Next: Bison, Prev: yacchack, Up: History + +11.3 Berkeley Yacc +================== + +Berkeley Yacc was originated in 1985 by Robert Corbett (*note Corbett +1984::). It was originally named “zoo”, but by October 1989 it became +known as Berkeley Yacc or byacc. + + Berkeley Yacc had three advantages over the ancestral Yacc: it +generated faster parsers, it could generate reentrant parsers, and the +source code was released to the public domain rather than being under an +AT&T proprietary license. The better performance came from implementing +techniques from DeRemer and Penello’s seminal paper on LALR parsing +(*note DeRemer 1982::). + + Use of byacc spread rapidly due to its public domain license. +However, once Bison became available, byacc itself passed out of general +use. + + +File: bison.info, Node: Bison, Next: Other Ungulates, Prev: Byacc, Up: History + +11.4 Bison +========== + +Robert Corbett actually wrote two (closely related) LALR parsers in +1985, both using the DeRemer/Penello techniques. One was “zoo”, the +other was “Byson”. In 1987 Richard Stallman began working on Byson; the +name changed to Bison and the interface became Yacc-compatible. + + The main visible difference between Yacc and Byson/Bison at the time +of Byson’s first release is that Byson supported the ‘@N’ construct +(giving access to the starting and ending line number and character +number associated with any of the symbols in the current rule). + + There was also the command ‘%expect N’ which said not to mention the +conflicts if there are N shift/reduce conflicts and no reduce/reduce +conflicts. In more recent versions of Bison, ‘%expect’ and its +‘%expect-rr’ variant for reduce/reduce conflicts can be applied to +individual rules. + + Later versions of Bison added many more new features. + + Bison error reporting has been improved in various ways. Notably. +ancestral Yacc and Byson did not have carets in error messages. + + Compared to Yacc Bison uses a faster but less space-efficient +encoding for the parse tables (*note Corbett 1984::), and more modern +techniques for generating the lookahead sets (*note DeRemer 1982::). +This approach is the standard one since then. + + (It has also been plausibly alleged the differences in the algorithms +stem mainly from the horrible kludges that Johnson had to perpetrate to +make the original Yacc fit in a PDP-11.) + + Named references, semantic predicates, ‘%locations’, ‘%glr-parser’, +‘%printer’, %destructor, dumps to DOT, ‘%parse-param’, ‘%lex-param’, and +dumps to XSLT, LAC, and IELR(1) generation are new in Bison. + + Bison also has many features to support C++ that were not present in +the ancestral Yacc or Byson. + + Bison obsolesced all previous Yacc variants and workalikes generating +C by 1995. + + +File: bison.info, Node: Other Ungulates, Prev: Bison, Up: History + +11.5 Other Ungulates +==================== + +The Yacc concept has frequently been ported to other languages. Some of +the early ports are extinct along with the languages that hosted them; +others have been superseded by parser skeletons shipped with Bison. + + However, independent implementations persist. One of the best-known +still in use is David Beazley’s “PLY” (Python Lex-Yacc) for Python. +Another is goyacc, supporting the Go language. An “ocamlyacc” is +shipped as part of the Ocaml compiler suite. + + +File: bison.info, Node: Versioning, Next: FAQ, Prev: History, Up: Top + +12 Bison Version Compatibility: Best Practices +********************************************** + +Bison provides a Yacc compatibility mode in which it strives to conform +with the POSIX standard. Grammar files which are written to the POSIX +standard, and do not take advantage of any of the special capabilities +of Bison, should work with many versions of Bison without modification. + + All other features of Bison are particular to Bison, and are +changing. Bison is actively maintained and continuously evolving. It +should come as no surprise that an older version of Bison will not +accept Bison source code which uses newer features that do no not exist +at all in the older Bison. Regrettably, in spite of reasonable effort +to maintain compatibility, the reverse situation may also occur: it may +happen that code developed using an older version of Bison does not +build with a newer version of Bison without modifications. + + Because Bison is a code generation tool, it is possible to retain its +output and distribute that to the users of the program. The users are +then not required to have Bison installed at all, only an implementation +of the programming language, such as C, which is required for processing +the generated output. + + It is the output of Bison that is intended to be of the utmost +portability. So, that is to say, whereas the Bison grammar source code +may have a dependency on specific versions of Bison, the generated +parser from any version of Bison should work with with a large number of +implementations of C, or whatever language is applicable. + + The recommended best practice for using Bison (in the context of +software that is distributed in source code form) is to ship the +generated parser to the downstream users. Only those downstream users +who engage in active development of the program who need to make changes +to the grammar file need to have Bison installed at all, and those users +can install the specific version of Bison which is required. + + Following this recommended practice also makes it possible to use a +more recent Bison than what is available to users through operating +system distributions, thereby taking advantage of the latest techniques +that Bison allows. + + Some features of Bison have been, or are being adopted into other +Yacc-like programs. Therefore it might seem that is a good idea to +write grammar code which targets multiple implementations, similarly to +the way C programs are often written to target multiple compilers and +language versions. Other than the Yacc subset described by POSIX, the +Bison language is not rigorously standardized. When a Bison feature is +adopted by another parser generator, it may be initially compatible with +that version of Bison on which it was based, but the compatibility may +degrade going forward. Developers who strive to make their Bison code +simultaneously compatible with other parser generators are encouraged to +nevertheless use specific versions of all generators, and still follow +the recommended practice of shipping generated output. For example, a +project can internally maintain compatibility with multiple generators, +and choose the output of a particular one to ship to the users. Or +else, the project could ship all of the outputs, arranging for a way for +the user to specify which one is used to build the program. + + +File: bison.info, Node: FAQ, Next: Table of Symbols, Prev: Versioning, Up: Top + +13 Frequently Asked Questions +***************************** + +Several questions about Bison come up occasionally. Here some of them +are addressed. + +* Menu: + +* Memory Exhausted:: Breaking the Stack Limits +* How Can I Reset the Parser:: ‘yyparse’ Keeps some State +* Strings are Destroyed:: ‘yylval’ Loses Track of Strings +* Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars +* Secure? Conform?:: Is Bison POSIX safe? +* Enabling Relocatability:: Moving Bison/using it through network shares +* I can't build Bison:: Troubleshooting +* Where can I find help?:: Troubleshouting +* Bug Reports:: Troublereporting +* More Languages:: Parsers in C++, Java, and so on +* Beta Testing:: Experimenting development versions +* Mailing Lists:: Meeting other Bison users + + +File: bison.info, Node: Memory Exhausted, Next: How Can I Reset the Parser, Up: FAQ + +13.1 Memory Exhausted +===================== + + My parser returns with error with a ‘memory exhausted’ message. + What can I do? + + This question is already addressed elsewhere, see *note Recursion::. + + +File: bison.info, Node: How Can I Reset the Parser, Next: Strings are Destroyed, Prev: Memory Exhausted, Up: FAQ + +13.2 How Can I Reset the Parser +=============================== + +The following phenomenon has several symptoms, resulting in the +following typical questions: + + I invoke ‘yyparse’ several times, and on correct input it works + properly; but when a parse error is found, all the other calls fail + too. How can I reset the error flag of ‘yyparse’? + +or + + My parser includes support for an ‘#include’-like feature, in which + case I run ‘yyparse’ from ‘yyparse’. This fails although I did + specify ‘%define api.pure full’. + + These problems typically come not from Bison itself, but from +Lex-generated scanners. Because these scanners use large buffers for +speed, they might not notice a change of input file. As a +demonstration, consider the following source file, ‘first-line.l’: + + %{ + #include + #include + %} + %% + .*\n ECHO; return 1; + %% + int + yyparse (char const *file) + { + yyin = fopen (file, "r"); + if (!yyin) + { + perror ("fopen"); + exit (EXIT_FAILURE); + } + /* One token only. */ + yylex (); + if (fclose (yyin) != 0) + { + perror ("fclose"); + exit (EXIT_FAILURE); + } + return 0; + } + + int + main (void) + { + yyparse ("input"); + yyparse ("input"); + return 0; + } + +If the file ‘input’ contains + + input:1: Hello, + input:2: World! + +then instead of getting the first line twice, you get: + + $ flex -ofirst-line.c first-line.l + $ gcc -ofirst-line first-line.c -ll + $ ./first-line + input:1: Hello, + input:2: World! + + Therefore, whenever you change ‘yyin’, you must tell the +Lex-generated scanner to discard its current buffer and switch to the +new one. This depends upon your implementation of Lex; see its +documentation for more. For Flex, it suffices to call ‘YY_FLUSH_BUFFER’ +after each change to ‘yyin’. If your Flex-generated scanner needs to +read from several input streams to handle features like include files, +you might consider using Flex functions like ‘yy_switch_to_buffer’ that +manipulate multiple input buffers. + + If your Flex-generated scanner uses start conditions (*note Start +conditions: (flex)Start conditions.), you might also want to reset the +scanner’s state, i.e., go back to the initial start condition, through a +call to ‘BEGIN (0)’. + + +File: bison.info, Node: Strings are Destroyed, Next: Implementing Gotos/Loops, Prev: How Can I Reset the Parser, Up: FAQ + +13.3 Strings are Destroyed +========================== + + My parser seems to destroy old strings, or maybe it loses track of + them. Instead of reporting ‘"foo", "bar"’, it reports ‘"bar", + "bar"’, or even ‘"foo\nbar", "bar"’. + + This error is probably the single most frequent “bug report” sent to +Bison lists, but is only concerned with a misunderstanding of the role +of the scanner. Consider the following Lex code: + + %{ + #include + char *yylval = NULL; + %} + %% + .* yylval = yytext; return 1; + \n continue; + %% + int + main () + { + /* Similar to using $1, $2 in a Bison action. */ + char *fst = (yylex (), yylval); + char *snd = (yylex (), yylval); + printf ("\"%s\", \"%s\"\n", fst, snd); + return 0; + } + + If you compile and run this code, you get: + + $ flex -osplit-lines.c split-lines.l + $ gcc -osplit-lines split-lines.c -ll + $ printf 'one\ntwo\n' | ./split-lines + "one + two", "two" + +this is because ‘yytext’ is a buffer provided for _reading_ in the +action, but if you want to keep it, you have to duplicate it (e.g., +using ‘strdup’). Note that the output may depend on how your +implementation of Lex handles ‘yytext’. For instance, when given the +Lex compatibility option ‘-l’ (which triggers the option ‘%array’) Flex +generates a different behavior: + + $ flex -l -osplit-lines.c split-lines.l + $ gcc -osplit-lines split-lines.c -ll + $ printf 'one\ntwo\n' | ./split-lines + "two", "two" + + +File: bison.info, Node: Implementing Gotos/Loops, Next: Multiple start-symbols, Prev: Strings are Destroyed, Up: FAQ + +13.4 Implementing Gotos/Loops +============================= + + My simple calculator supports variables, assignments, and + functions, but how can I implement gotos, or loops? + + Although very pedagogical, the examples included in the document blur +the distinction to make between the parser—whose job is to recover the +structure of a text and to transmit it to subsequent modules of the +program—and the processing (such as the execution) of this structure. +This works well with so called straight line programs, i.e., precisely +those that have a straightforward execution model: execute simple +instructions one after the others. + + If you want a richer model, you will probably need to use the parser +to construct a tree that does represent the structure it has recovered; +this tree is usually called the “abstract syntax tree”, or “AST” for +short. Then, walking through this tree, traversing it in various ways, +will enable treatments such as its execution or its translation, which +will result in an interpreter or a compiler. + + This topic is way beyond the scope of this manual, and the reader is +invited to consult the dedicated literature. + + +File: bison.info, Node: Multiple start-symbols, Next: Secure? Conform?, Prev: Implementing Gotos/Loops, Up: FAQ + +13.5 Multiple start-symbols +=========================== + + I have several closely related grammars, and I would like to share + their implementations. In fact, I could use a single grammar but + with multiple entry points. + + Bison does not support multiple start-symbols, but there is a very +simple means to simulate them. If ‘foo’ and ‘bar’ are the two pseudo +start-symbols, then introduce two new tokens, say ‘START_FOO’ and +‘START_BAR’, and use them as switches from the real start-symbol: + + %token START_FOO START_BAR; + %start start; + start: + START_FOO foo + | START_BAR bar; + + These tokens prevent the introduction of new conflicts. As far as +the parser goes, that is all that is needed. + + Now the difficult part is ensuring that the scanner will send these +tokens first. If your scanner is hand-written, that should be +straightforward. If your scanner is generated by Lex, them there is +simple means to do it: recall that anything between ‘%{ ... %}’ after +the first ‘%%’ is copied verbatim in the top of the generated ‘yylex’ +function. Make sure a variable ‘start_token’ is available in the +scanner (e.g., a global variable or using ‘%lex-param’ etc.), and use +the following: + + /* Prologue. */ + %% + %{ + if (start_token) + { + int t = start_token; + start_token = 0; + return t; + } + %} + /* The rules. */ + + +File: bison.info, Node: Secure? Conform?, Next: Enabling Relocatability, Prev: Multiple start-symbols, Up: FAQ + +13.6 Secure? Conform? +===================== + + Is Bison secure? Does it conform to POSIX? + + If you’re looking for a guarantee or certification, we don’t provide +it. However, Bison is intended to be a reliable program that conforms +to the POSIX specification for Yacc. If you run into problems, please +send us a bug report. + + +File: bison.info, Node: Enabling Relocatability, Next: I can't build Bison, Prev: Secure? Conform?, Up: FAQ + +13.7 Enabling Relocatability +============================ + +It has been a pain for many users of GNU packages for a long time that +packages are not relocatable. It means a user cannot copy a program, +installed by another user on the same machine, to his home directory, +and have it work correctly (including i18n). So many users need to go +through ‘configure; make; make install’ with all its dependencies, +options, and hurdles. + + Most package management systems, that allow the user to install +pre-built binaries of the packages, solve the “ease of installation” +problem, but they hardwire path names, usually to ‘/usr’ or +‘/usr/local’. This means that users need root privileges to install a +binary package, and prevents installing two different versions of the +same binary package. + + A relocatable program can be moved or copied to a different location +on the file system. It is possible to make symlinks to the installed +and moved programs, and invoke them through the symlink. It is possible +to do the same thing with a hard link _only_ if the hard link file is in +the same directory as the real program. + + To configure a program to be relocatable, add ‘--enable-relocatable’ +to the ‘configure’ command line. + + On some OSes the executables remember the location of shared +libraries and prefer them over any other search path. Therefore, such +an executable will look for its shared libraries first in the original +installation directory and only then in the current installation +directory. Thus, for reliability, it is best to also give a ‘--prefix’ +option pointing to a directory that does not exist now and which never +will be created, e.g. ‘--prefix=/nonexistent’. You may use +‘DESTDIR=DEST-DIR’ on the ‘make’ command line to avoid installing into +that directory. + + We do not recommend using a prefix writable by unprivileged users +(e.g. ‘/tmp/inst$$’) because such a directory can be recreated by an +unprivileged user after the original directory has been removed. We +also do not recommend prefixes that might be behind an automounter (e.g. +‘$HOME/inst$$’) because of the performance impact of directory +searching. + + Here’s a sample installation run that takes into account all these +recommendations: + + ./configure --enable-relocatable --prefix=/nonexistent + make + make install DESTDIR=/tmp/inst$$ + + Installation with ‘--enable-relocatable’ will not work for setuid or +setgid executables, because such executables search only system library +paths for security reasons. + + The runtime penalty and size penalty are negligible on GNU/Linux +(just one system call more when an executable is launched), and small on +other systems (the wrapper program just sets an environment variable and +executes the real program). + + +File: bison.info, Node: I can't build Bison, Next: Where can I find help?, Prev: Enabling Relocatability, Up: FAQ + +13.8 I can’t build Bison +======================== + + I can’t build Bison because ‘make’ complains that ‘msgfmt’ is not + found. What should I do? + + Like most GNU packages with internationalization support, that +feature is turned on by default. If you have problems building in the +‘po’ subdirectory, it indicates that your system’s internationalization +support is lacking. You can re-configure Bison with ‘--disable-nls’ to +turn off this support, or you can install GNU gettext from + and re-configure Bison. See the file +‘ABOUT-NLS’ for more information. + + I can’t build Bison because my C compiler is too old. + + Except for GLR parsers (which require C99), the C code that Bison +generates requires only C89 or later. However, Bison itself requires +common C99 features such as declarations after statements. Bison’s +‘configure’ script attempts to enable C99 (or later) support on +compilers that default to pre-C99. If your compiler lacks these C99 +features entirely, GCC may well be a better choice; or you can try +upgrading to your compiler’s latest version. + + +File: bison.info, Node: Where can I find help?, Next: Bug Reports, Prev: I can't build Bison, Up: FAQ + +13.9 Where can I find help? +=========================== + + I’m having trouble using Bison. Where can I find help? + + First, read this fine manual. Beyond that, you can send mail to +. This mailing list is intended to be populated +with people who are willing to answer questions about using and +installing Bison. Please keep in mind that (most of) the people on the +list have aspects of their lives which are not related to Bison (!), so +you may not receive an answer to your question right away. This can be +frustrating, but please try not to honk them off; remember that any help +they provide is purely voluntary and out of the kindness of their +hearts. + + +File: bison.info, Node: Bug Reports, Next: More Languages, Prev: Where can I find help?, Up: FAQ + +13.10 Bug Reports +================= + + I found a bug. What should I include in the bug report? + + Before sending a bug report, make sure you are using the latest +version. Check or one of its +mirrors. Be sure to include the version number in your bug report. If +the bug is present in the latest version but not in a previous version, +try to determine the most recent version which did not contain the bug. + + If the bug is parser-related, you should include the smallest grammar +you can which demonstrates the bug. The grammar file should also be +complete (i.e., I should be able to run it through Bison without having +to edit or add anything). The smaller and simpler the grammar, the +easier it will be to fix the bug. + + Include information about your compilation environment, including +your operating system’s name and version and your compiler’s name and +version. If you have trouble compiling, you should also include a +transcript of the build session, starting with the invocation of +‘configure’. Depending on the nature of the bug, you may be asked to +send additional files as well (such as ‘config.h’ or ‘config.cache’). + + Patches are most welcome, but not required. That is, do not hesitate +to send a bug report just because you cannot provide a fix. + + Send bug reports to . + + +File: bison.info, Node: More Languages, Next: Beta Testing, Prev: Bug Reports, Up: FAQ + +13.11 More Languages +==================== + + Will Bison ever have C++ and Java support? How about INSERT YOUR + FAVORITE LANGUAGE HERE? + + C++, D and Java are supported. We’d love to add other languages; +contributions are welcome. + + +File: bison.info, Node: Beta Testing, Next: Mailing Lists, Prev: More Languages, Up: FAQ + +13.12 Beta Testing +================== + + What is involved in being a beta tester? + + It’s not terribly involved. Basically, you would download a test +release, compile it, and use it to build and run a parser or two. After +that, you would submit either a bug report or a message saying that +everything is okay. It is important to report successes as well as +failures because test releases eventually become mainstream releases, +but only if they are adequately tested. If no one tests, development is +essentially halted. + + Beta testers are particularly needed for operating systems to which +the developers do not have easy access. They currently have easy access +to recent GNU/Linux and Solaris versions. Reports about other operating +systems are especially welcome. + + +File: bison.info, Node: Mailing Lists, Prev: Beta Testing, Up: FAQ + +13.13 Mailing Lists +=================== + + How do I join the help-bison and bug-bison mailing lists? + + See . + + +File: bison.info, Node: Table of Symbols, Next: Glossary, Prev: FAQ, Up: Top + +Appendix A Bison Symbols +************************ + + -- Variable: @$ + In an action, the location of the left-hand side of the rule. + *Note Tracking Locations::. + + -- Variable: @N + -- Symbol: @N + In an action, the location of the N-th symbol of the right-hand + side of the rule. *Note Tracking Locations::. + + In a grammar, the Bison-generated nonterminal symbol for a midrule + action with a semantic value. *Note Midrule Action Translation::. + + -- Variable: @NAME + -- Variable: @[NAME] + In an action, the location of a symbol addressed by NAME. *Note + Tracking Locations::. + + -- Symbol: $@N + In a grammar, the Bison-generated nonterminal symbol for a midrule + action with no semantics value. *Note Midrule Action + Translation::. + + -- Variable: $$ + In an action, the semantic value of the left-hand side of the rule. + *Note Actions::. + + -- Variable: $N + In an action, the semantic value of the N-th symbol of the + right-hand side of the rule. *Note Actions::. + + -- Variable: $NAME + -- Variable: $[NAME] + In an action, the semantic value of a symbol addressed by NAME. + *Note Actions::. + + -- Delimiter: %% + Delimiter used to separate the grammar rule section from the Bison + declarations section or the epilogue. *Note Grammar Layout::. + + -- Delimiter: %{CODE%} + All code listed between ‘%{’ and ‘%}’ is copied verbatim to the + parser implementation file. Such code forms the prologue of the + grammar file. *Note Grammar Outline::. + + -- Directive: %?{EXPRESSION} + Predicate actions. This is a type of action clause that may appear + in rules. The expression is evaluated, and if false, causes a + syntax error. In GLR parsers during nondeterministic operation, + this silently causes an alternative parse to die. During + deterministic operation, it is the same as the effect of YYERROR. + *Note Semantic Predicates::. + + -- Construct: /* ... */ + -- Construct: // ... + Comments, as in C/C++. + + -- Delimiter: : + Separates a rule’s result from its components. *Note Rules::. + + -- Delimiter: ; + Terminates a rule. *Note Rules::. + + -- Delimiter: | + Separates alternate rules for the same result nonterminal. *Note + Rules::. + + -- Directive: <*> + Used to define a default tagged ‘%destructor’ or default tagged + ‘%printer’. + + *Note Destructor Decl::. + + -- Directive: <> + Used to define a default tagless ‘%destructor’ or default tagless + ‘%printer’. + + *Note Destructor Decl::. + + -- Symbol: $accept + The predefined nonterminal whose only rule is ‘$accept: START + $end’, where START is the start symbol. *Note Start Decl::. It + cannot be used in the grammar. + + -- Directive: %code {CODE} + -- Directive: %code QUALIFIER {CODE} + Insert CODE verbatim into the output parser source at the default + location or at the location specified by QUALIFIER. *Note %code + Summary::. + + -- Directive: %debug + Equip the parser for debugging. *Note Decl Summary::. + + -- Directive: %define VARIABLE + -- Directive: %define VARIABLE VALUE + -- Directive: %define VARIABLE {VALUE} + -- Directive: %define VARIABLE "VALUE" + Define a variable to adjust Bison’s behavior. *Note %define + Summary::. + + -- Directive: %defines + -- Directive: %defines DEFINES-FILE + Historical name for ‘%header’. *Note Decl Summary::. + + -- Directive: %destructor + Specify how the parser should reclaim the memory associated to + discarded symbols. *Note Destructor Decl::. + + -- Directive: %dprec + Bison declaration to assign a precedence to a rule that is used at + parse time to resolve reduce/reduce conflicts. *Note GLR + Parsers::. + + -- Directive: %empty + Bison declaration to declare make explicit that a rule has an empty + right-hand side. *Note Empty Rules::. + + -- Symbol: $end + The predefined token marking the end of the token stream. It + cannot be used in the grammar. + + -- Symbol: error + A token name reserved for error recovery. This token may be used + in grammar rules so as to allow the Bison parser to recognize an + error in the grammar without halting the process. In effect, a + sentence containing an error may be recognized as valid. On a + syntax error, the token ‘error’ becomes the current lookahead + token. Actions corresponding to ‘error’ are then executed, and the + lookahead token is reset to the token that originally caused the + violation. *Note Error Recovery::. + + -- Directive: %error-verbose + An obsolete directive standing for ‘%define parse.error verbose’. + + -- Directive: %file-prefix "PREFIX" + Bison declaration to set the prefix of the output files. *Note + Decl Summary::. + + -- Directive: %glr-parser + Bison declaration to produce a GLR parser. *Note GLR Parsers::. + + -- Directive: %header + Bison declaration to create a parser header file, which is usually + meant for the scanner. *Note Decl Summary::. + + -- Directive: %header HEADER-FILE + Same as above, but save in the file HEADER-FILE. *Note Decl + Summary::. + + -- Directive: %initial-action + Run user code before parsing. *Note Initial Action Decl::. + + -- Directive: %language + Specify the programming language for the generated parser. *Note + Decl Summary::. + + -- Directive: %left + Bison declaration to assign precedence and left associativity to + token(s). *Note Precedence Decl::. + + -- Directive: %lex-param {ARGUMENT-DECLARATION} ... + Bison declaration to specifying additional arguments that ‘yylex’ + should accept. *Note Pure Calling::. + + -- Directive: %merge + Bison declaration to assign a merging function to a rule. If there + is a reduce/reduce conflict with a rule having the same merging + function, the function is applied to the two semantic values to get + a single result. *Note GLR Parsers::. + + -- Directive: %name-prefix "PREFIX" + Obsoleted by the ‘%define’ variable ‘api.prefix’ (*note Multiple + Parsers::). + + Rename the external symbols (variables and functions) used in the + parser so that they start with PREFIX instead of ‘yy’. Contrary to + ‘api.prefix’, do no rename types and macros. + + The precise list of symbols renamed in C parsers is ‘yyparse’, + ‘yylex’, ‘yyerror’, ‘yynerrs’, ‘yylval’, ‘yychar’, ‘yydebug’, and + (if locations are used) ‘yylloc’. If you use a push parser, + ‘yypush_parse’, ‘yypull_parse’, ‘yypstate’, ‘yypstate_new’ and + ‘yypstate_delete’ will also be renamed. For example, if you use + ‘%name-prefix "c_"’, the names become ‘c_parse’, ‘c_lex’, and so + on. For C++ parsers, see the ‘%define api.namespace’ documentation + in this section. + + -- Directive: %no-lines + Bison declaration to avoid generating ‘#line’ directives in the + parser implementation file. *Note Decl Summary::. + + -- Directive: %nonassoc + Bison declaration to assign precedence and nonassociativity to + token(s). *Note Precedence Decl::. + + -- Directive: %nterm + Bison declaration to declare nonterminals. *Note Type Decl::. + + -- Directive: %output "FILE" + Bison declaration to set the name of the parser implementation + file. *Note Decl Summary::. + + -- Directive: %param {ARGUMENT-DECLARATION} ... + Bison declaration to specify additional arguments that both ‘yylex’ + and ‘yyparse’ should accept. *Note Parser Function::. + + -- Directive: %parse-param {ARGUMENT-DECLARATION} ... + Bison declaration to specify additional arguments that ‘yyparse’ + should accept. *Note Parser Function::. + + -- Directive: %prec + Bison declaration to assign a precedence to a specific rule. *Note + Contextual Precedence::. + + -- Directive: %precedence + Bison declaration to assign precedence to token(s), but no + associativity *Note Precedence Decl::. + + -- Directive: %pure-parser + Deprecated version of ‘%define api.pure’ (*note %define Summary::), + for which Bison is more careful to warn about unreasonable usage. + + -- Directive: %require "VERSION" + Require version VERSION or higher of Bison. *Note Require Decl::. + + -- Directive: %right + Bison declaration to assign precedence and right associativity to + token(s). *Note Precedence Decl::. + + -- Directive: %skeleton + Specify the skeleton to use; usually for development. *Note Decl + Summary::. + + -- Directive: %start + Bison declaration to specify the start symbol. *Note Start Decl::. + + -- Directive: %token + Bison declaration to declare token(s) without specifying + precedence. *Note Token Decl::. + + -- Directive: %token-table + Bison declaration to include a token name table in the parser + implementation file. *Note Decl Summary::. + + -- Directive: %type + Bison declaration to declare symbol value types. *Note Type + Decl::. + + -- Symbol: $undefined + The predefined token onto which all undefined values returned by + ‘yylex’ are mapped. It cannot be used in the grammar, rather, use + ‘error’. + + -- Directive: %union + Bison declaration to specify several possible data types for + semantic values. *Note Union Decl::. + + -- Macro: YYABORT + Macro to pretend that an unrecoverable syntax error has occurred, + by making ‘yyparse’ return 1 immediately. The error reporting + function ‘yyerror’ is not called. *Note Parser Function::. + + For Java parsers, this functionality is invoked using ‘return + YYABORT;’ instead. + + -- Macro: YYACCEPT + Macro to pretend that a complete utterance of the language has been + read, by making ‘yyparse’ return 0 immediately. *Note Parser + Function::. + + For Java parsers, this functionality is invoked using ‘return + YYACCEPT;’ instead. + + -- Macro: YYBACKUP + Macro to discard a value from the parser stack and fake a lookahead + token. *Note Action Features::. + + -- Macro: YYBISON + The version of Bison as an integer, for instance 30704 for version + 3.7.4. Defined in ‘yacc.c’ only. Before version 3.7.4, ‘YYBISON’ + was defined to 1. + + -- Variable: yychar + External integer variable that contains the integer value of the + lookahead token. (In a pure parser, it is a local variable within + ‘yyparse’.) Error-recovery rule actions may examine this variable. + *Note Action Features::. + + -- Variable: yyclearin + Macro used in error-recovery rule actions. It clears the previous + lookahead token. *Note Error Recovery::. + + -- Macro: YYDEBUG + Macro to define to equip the parser with tracing code. *Note + Tracing::. + + -- Variable: yydebug + External integer variable set to zero by default. If ‘yydebug’ is + given a nonzero value, the parser will output information on input + symbols and parser action. *Note Tracing::. + + -- Value: YYEMPTY + The pseudo token kind when there is no lookahead token. + + -- Value: YYEOF + The token kind denoting is the end of the input stream. + + -- Macro: yyerrok + Macro to cause parser to recover immediately to its normal mode + after a syntax error. *Note Error Recovery::. + + -- Macro: YYERROR + Cause an immediate syntax error. This statement initiates error + recovery just as if the parser itself had detected an error; + however, it does not call ‘yyerror’, and does not print any + message. If you want to print an error message, call ‘yyerror’ + explicitly before the ‘YYERROR;’ statement. *Note Error + Recovery::. + + For Java parsers, this functionality is invoked using ‘return + YYERROR;’ instead. + + -- Function: yyerror + User-supplied function to be called by ‘yyparse’ on error. *Note + Error Reporting Function::. + + -- Macro: YYFPRINTF + Macro used to output run-time traces in C. *Note Enabling Traces::. + + -- Macro: YYINITDEPTH + Macro for specifying the initial size of the parser stack. *Note + Memory Management::. + + -- Function: yylex + User-supplied lexical analyzer function, called with no arguments + to get the next token. *Note Lexical::. + + -- Variable: yylloc + External variable in which ‘yylex’ should place the line and column + numbers associated with a token. (In a pure parser, it is a local + variable within ‘yyparse’, and its address is passed to ‘yylex’.) + You can ignore this variable if you don’t use the ‘@’ feature in + the grammar actions. *Note Token Locations::. In semantic + actions, it stores the location of the lookahead token. *Note + Actions and Locations::. + + -- Type: YYLTYPE + Data type of ‘yylloc’. By default in C, a structure with four + members (start/end line/column). *Note Location Type::. + + -- Variable: yylval + External variable in which ‘yylex’ should place the semantic value + associated with a token. (In a pure parser, it is a local variable + within ‘yyparse’, and its address is passed to ‘yylex’.) *Note + Token Values::. In semantic actions, it stores the semantic value + of the lookahead token. *Note Actions::. + + -- Macro: YYMAXDEPTH + Macro for specifying the maximum size of the parser stack. *Note + Memory Management::. + + -- Variable: yynerrs + Global variable which Bison increments each time it reports a + syntax error. (In a pure parser, it is a local variable within + ‘yyparse’. In a pure push parser, it is a member of ‘yypstate’.) + *Note Error Reporting Function::. + + -- Macro: YYNOMEM + Macro to pretend that memory is exhausted, by making ‘yyparse’ + return 2 immediately. The error reporting function ‘yyerror’ is + called. *Note Parser Function::. + + -- Function: yyparse + The parser function produced by Bison; call this function to start + parsing. *Note Parser Function::. + + -- Function: yypstate_delete + The function to delete a parser instance, produced by Bison in push + mode; call this function to delete the memory associated with a + parser. *Note ‘yypstate_delete’: yypstate_delete. Does nothing + when called with a null pointer. + + -- Function: yypstate_new + The function to create a parser instance, produced by Bison in push + mode; call this function to create a new parser. *Note + ‘yypstate_new’: yypstate_new. + + -- Function: yypull_parse + The parser function produced by Bison in push mode; call this + function to parse the rest of the input stream. *Note + ‘yypull_parse’: yypull_parse. + + -- Function: yypush_parse + The parser function produced by Bison in push mode; call this + function to parse a single token. *Note ‘yypush_parse’: + yypush_parse. + + -- Macro: YYRECOVERING + The expression ‘YYRECOVERING ()’ yields 1 when the parser is + recovering from a syntax error, and 0 otherwise. *Note Action + Features::. + + -- Macro: YYSTACK_USE_ALLOCA + Macro used to control the use of ‘alloca’ when the deterministic + parser in C needs to extend its stacks. If defined to 0, the + parser will use ‘malloc’ to extend its stacks and memory exhaustion + occurs if ‘malloc’ fails (*note Memory Management::). If defined + to 1, the parser will use ‘alloca’. Values other than 0 and 1 are + reserved for future Bison extensions. If not defined, + ‘YYSTACK_USE_ALLOCA’ defaults to 0. + + In the all-too-common case where your code may run on a host with a + limited stack and with unreliable stack-overflow checking, you + should set ‘YYMAXDEPTH’ to a value that cannot possibly result in + unchecked stack overflow on any of your target hosts when ‘alloca’ + is called. You can inspect the code that Bison generates in order + to determine the proper numeric values. This will require some + expertise in low-level implementation details. + + -- Type: YYSTYPE + In C, data type of semantic values; ‘int’ by default. Deprecated + in favor of the ‘%define’ variable ‘api.value.type’. *Note Value + Type::. + + -- Type: yysymbol_kind_t + An enum of all the symbols, tokens and nonterminals, of the + grammar. *Note Syntax Error Reporting Function::. The symbol + kinds are used internally by the parser, and should not be confused + with the token kinds: the symbol kind of a terminal symbol is not + equal to its token kind! (Unless ‘%define api.token.raw’ was + used.) + + -- Type: yytoken_kind_t + An enum of all the “token kinds” declared with ‘%token’ (*note + Token Decl::). These are the return values for ‘yylex’. They + should not be confused with the _symbol kinds_, used internally by + the parser. + + -- Value: YYUNDEF + The token kind denoting an unknown token. + + +File: bison.info, Node: Glossary, Next: GNU Free Documentation License, Prev: Table of Symbols, Up: Top + +Appendix B Glossary +******************* + +Accepting state + A state whose only action is the accept action. The accepting + state is thus a consistent state. *Note Understanding::. + +Backus-Naur Form (BNF; also called “Backus Normal Form”) + Formal method of specifying context-free grammars originally + proposed by John Backus, and slightly improved by Peter Naur in his + 1960-01-02 committee document contributing to what became the Algol + 60 report. *Note Language and Grammar::. + +Consistent state + A state containing only one possible action. *Note Default + Reductions::. + +Context-free grammars + Grammars specified as rules that can be applied regardless of + context. Thus, if there is a rule which says that an integer can + be used as an expression, integers are allowed _anywhere_ an + expression is permitted. *Note Language and Grammar::. + +Counterexample + A sequence of tokens and/or nonterminals, with one dot, that + demonstrates a conflict. The dot marks the place where the + conflict occurs. + + A _unifying_ counterexample is a single string that has two + different parses; its existence proves that the grammar is + ambiguous. When a unifying counterexample cannot be found in + reasonable time, a _nonunifying_ counterexample is built: _two_ + different string sharing the prefix up to the dot. + + *Note Counterexamples:: + +Default reduction + The reduction that a parser should perform if the current parser + state contains no other action for the lookahead token. In + permitted parser states, Bison declares the reduction with the + largest lookahead set to be the default reduction and removes that + lookahead set. *Note Default Reductions::. + +Defaulted state + A consistent state with a default reduction. *Note Default + Reductions::. + +Dynamic allocation + Allocation of memory that occurs during execution, rather than at + compile time or on entry to a function. + +Empty string + Analogous to the empty set in set theory, the empty string is a + character string of length zero. + +Finite-state stack machine + A “machine” that has discrete states in which it is said to exist + at each instant in time. As input to the machine is processed, the + machine moves from state to state as specified by the logic of the + machine. In the case of the parser, the input is the language + being parsed, and the states correspond to various stages in the + grammar rules. *Note Algorithm::. + +Generalized LR (GLR) + A parsing algorithm that can handle all context-free grammars, + including those that are not LR(1). It resolves situations that + Bison’s deterministic parsing algorithm cannot by effectively + splitting off multiple parsers, trying all possible parsers, and + discarding those that fail in the light of additional right + context. *Note Generalized LR Parsing::. + +Grouping + A language construct that is (in general) grammatically divisible; + for example, ‘expression’ or ‘declaration’ in C. *Note Language + and Grammar::. + +IELR(1) (Inadequacy Elimination LR(1)) + A minimal LR(1) parser table construction algorithm. That is, + given any context-free grammar, IELR(1) generates parser tables + with the full language-recognition power of canonical LR(1) but + with nearly the same number of parser states as LALR(1). This + reduction in parser states is often an order of magnitude. More + importantly, because canonical LR(1)’s extra parser states may + contain duplicate conflicts in the case of non-LR(1) grammars, the + number of conflicts for IELR(1) is often an order of magnitude less + as well. This can significantly reduce the complexity of + developing a grammar. *Note LR Table Construction::. + +Infix operator + An arithmetic operator that is placed between the operands on which + it performs some operation. + +Input stream + A continuous flow of data between devices or programs. + +Kind + “Token” and “symbol” are each overloaded to mean either a grammar + symbol (kind) or all parse info (kind, value, location) associated + with occurrences of that grammar symbol from the input. To + disambiguate, + + • we use “token kind” and “symbol kind” to mean both grammar + symbols and the values that represent them in a base + programming language (C, C++, etc.). The names of the types + of these values are typically ‘token_kind_t’, or + ‘token_kind_type’, or ‘TokenKind’, depending on the + programming language. + + • we use “token” and “symbol” without the word “kind” to mean + parsed occurrences, and we append the word “type” to refer to + the types that represent them in a base programming language. + + In summary: When you see “kind”, interpret “symbol” or “token” to + mean a _grammar symbol_. When you don’t see “kind” (including when + you see “type”), interpret “symbol” or “token” to mean a _parsed + symbol_. + +LAC (Lookahead Correction) + A parsing mechanism that fixes the problem of delayed syntax error + detection, which is caused by LR state merging, default reductions, + and the use of ‘%nonassoc’. Delayed syntax error detection results + in unexpected semantic actions, initiation of error recovery in the + wrong syntactic context, and an incorrect list of expected tokens + in a verbose syntax error message. *Note LAC::. + +Language construct + One of the typical usage schemas of the language. For example, one + of the constructs of the C language is the ‘if’ statement. *Note + Language and Grammar::. + +Left associativity + Operators having left associativity are analyzed from left to + right: ‘a+b+c’ first computes ‘a+b’ and then combines with ‘c’. + *Note Precedence::. + +Left recursion + A rule whose result symbol is also its first component symbol; for + example, ‘expseq1 : expseq1 ',' exp;’. *Note Recursion::. + +Left-to-right parsing + Parsing a sentence of a language by analyzing it token by token + from left to right. *Note Algorithm::. + +Lexical analyzer (scanner) + A function that reads an input stream and returns tokens one by + one. *Note Lexical::. + +Lexical tie-in + A flag, set by actions in the grammar rules, which alters the way + tokens are parsed. *Note Lexical Tie-ins::. + +Literal string token + A token which consists of two or more fixed characters. *Note + Symbols::. + +Lookahead token + A token already read but not yet shifted. *Note Lookahead::. + +LALR(1) + The class of context-free grammars that Bison (like most other + parser generators) can handle by default; a subset of LR(1). *Note + Mysterious Conflicts::. + +LR(1) + The class of context-free grammars in which at most one token of + lookahead is needed to disambiguate the parsing of any piece of + input. + +Nonterminal symbol + A grammar symbol standing for a grammatical construct that can be + expressed through rules in terms of smaller constructs; in other + words, a construct that is not a token. *Note Symbols::. + +Parser + A function that recognizes valid sentences of a language by + analyzing the syntax structure of a set of tokens passed to it from + a lexical analyzer. + +Postfix operator + An arithmetic operator that is placed after the operands upon which + it performs some operation. + +Reduction + Replacing a string of nonterminals and/or terminals with a single + nonterminal, according to a grammar rule. *Note Algorithm::. + +Reentrant + A reentrant subprogram is a subprogram which can be in invoked any + number of times in parallel, without interference between the + various invocations. *Note Pure Decl::. + +Reverse Polish Notation + A language in which all operators are postfix operators. + +Right recursion + A rule whose result symbol is also its last component symbol; for + example, ‘expseq1: exp ',' expseq1;’. *Note Recursion::. + +Semantics + In computer languages, the semantics are specified by the actions + taken for each instance of the language, i.e., the meaning of each + statement. *Note Semantics::. + +Shift + A parser is said to shift when it makes the choice of analyzing + further input from the stream rather than reducing immediately some + already-recognized rule. *Note Algorithm::. + +Single-character literal + A single character that is recognized and interpreted as is. *Note + Grammar in Bison::. + +Start symbol + The nonterminal symbol that stands for a complete valid utterance + in the language being parsed. The start symbol is usually listed + as the first nonterminal symbol in a language specification. *Note + Start Decl::. + +Symbol kind + A (finite) enumeration of the grammar symbols, as processed by the + parser. *Note Symbols::. + +Symbol table + A data structure where symbol names and associated data are stored + during parsing to allow for recognition and use of existing + information in repeated uses of a symbol. *Note Multi-function + Calc::. + +Syntax error + An error encountered during parsing of an input stream due to + invalid syntax. *Note Error Recovery::. + +Terminal symbol + A grammar symbol that has no rules in the grammar and therefore is + grammatically indivisible. The piece of text it represents is a + token. *Note Language and Grammar::. + +Token + A basic, grammatically indivisible unit of a language. The symbol + that describes a token in the grammar is a terminal symbol. The + input of the Bison parser is a stream of tokens which comes from + the lexical analyzer. *Note Symbols::. + +Token kind + A (finite) enumeration of the grammar terminals, as discriminated + by the scanner. *Note Symbols::. + +Unreachable state + A parser state to which there does not exist a sequence of + transitions from the parser’s start state. A state can become + unreachable during conflict resolution. *Note Unreachable + States::. + + +File: bison.info, Node: GNU Free Documentation License, Next: Bibliography, Prev: Glossary, Up: Top + +Appendix C GNU Free Documentation License +***************************************** + + Version 1.3, 3 November 2008 + + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document “free” in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of “copyleft”, which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. We + recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it can + be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + “Document”, below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as “you”. You accept + the license if you copy, modify or distribute the work in a way + requiring permission under copyright law. + + A “Modified Version” of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A “Secondary Section” is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document’s overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The “Invariant Sections” are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this License. + If a section does not fit the above definition of Secondary then it + is not allowed to be designated as Invariant. The Document may + contain zero Invariant Sections. If the Document does not identify + any Invariant Sections then there are none. + + The “Cover Texts” are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A “Transparent” copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images composed + of pixels) generic paint programs or (for drawings) some widely + available drawing editor, and that is suitable for input to text + formatters or for automatic translation to a variety of formats + suitable for input to text formatters. A copy made in an otherwise + Transparent file format whose markup, or absence of markup, has + been arranged to thwart or discourage subsequent modification by + readers is not Transparent. An image format is not Transparent if + used for any substantial amount of text. A copy that is not + “Transparent” is called “Opaque”. + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and standard-conforming + simple HTML, PostScript or PDF designed for human modification. + Examples of transparent image formats include PNG, XCF and JPG. + Opaque formats include proprietary formats that can be read and + edited only by proprietary word processors, SGML or XML for which + the DTD and/or processing tools are not generally available, and + the machine-generated HTML, PostScript or PDF produced by some word + processors for output purposes only. + + The “Title Page” means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, “Title + Page” means the text near the most prominent appearance of the + work’s title, preceding the beginning of the body of the text. + + The “publisher” means any person or entity that distributes copies + of the Document to the public. + + A section “Entitled XYZ” means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) + To “Preserve the Title” of such a section when you modify the + Document means that it remains a section “Entitled XYZ” according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow the + conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document’s license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the title + equally prominent and visible. You may add other material on the + covers in addition. Copying with changes limited to the covers, as + long as they preserve the title of the Document and satisfy these + conditions, can be treated as verbatim copying in other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a machine-readable + Transparent copy along with each Opaque copy, or state in or with + each Opaque copy a computer-network location from which the general + network-using public has access to download using public-standard + network protocols a complete Transparent copy of the Document, free + of added material. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of copies, + to give them a chance to provide you with an updated version of the + Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus licensing + distribution and modification of the Modified Version to whoever + possesses a copy of it. In addition, you must do these things in + the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that + version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document’s + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled “History”, Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on the + Title Page. If there is no section Entitled “History” in the + Document, create one stating the title, year, authors, and + publisher of the Document as given on its Title Page, then add + an item describing the Modified Version as stated in the + previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + “History” section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + + K. For any section Entitled “Acknowledgements” or “Dedications”, + Preserve the Title of the section, and preserve in the section + all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, unaltered + in their text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. + + M. Delete any section Entitled “Endorsements”. Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + “Endorsements” or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option designate + some or all of these sections as invariant. To do this, add their + titles to the list of Invariant Sections in the Modified Version’s + license notice. These titles must be distinct from any other + section titles. + + You may add a section Entitled “Endorsements”, provided it contains + nothing but endorsements of your Modified Version by various + parties—for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition of + a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts in the Modified Version. Only one passage + of Front-Cover Text and one of Back-Cover Text may be added by (or + through arrangements made by) any one entity. If the Document + already includes a cover text for the same cover, previously added + by you or by arrangement made by the same entity you are acting on + behalf of, you may not add another; but you may replace the old + one, on explicit permission from the previous publisher that added + the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination all + of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + “History” in the various original documents, forming one section + Entitled “History”; likewise combine any sections Entitled + “Acknowledgements”, and any sections Entitled “Dedications”. You + must delete all sections Entitled “Endorsements.” + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the documents + in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow this + License in all other respects regarding verbatim copying of that + document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of a + storage or distribution medium, is called an “aggregate” if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation’s users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document’s Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled “Acknowledgements”, + “Dedications”, or “History”, the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense, or distribute it is void, + and will automatically terminate your rights under this License. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, receipt of a copy of some or all of the + same material does not give you any rights to use it. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + . + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License “or any later version” applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If the + Document does not specify a version number of this License, you may + choose any version ever published (not as a draft) by the Free + Software Foundation. If the Document specifies that a proxy can + decide which future versions of this License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Document. + + 11. RELICENSING + + “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any + World Wide Web server that publishes copyrightable works and also + provides prominent facilities for anybody to edit those works. A + public wiki that anybody can edit is an example of such a server. + A “Massive Multiauthor Collaboration” (or “MMC”) contained in the + site means any set of copyrightable works thus published on the MMC + site. + + “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 + license published by Creative Commons Corporation, a not-for-profit + corporation with a principal place of business in San Francisco, + California, as well as future copyleft versions of that license + published by that same organization. + + “Incorporate” means to publish or republish a Document, in whole or + in part, as part of another Document. + + An MMC is “eligible for relicensing” if it is licensed under this + License, and if all works that were first published under this + License somewhere other than this MMC, and subsequently + incorporated in whole or in part into the MMC, (1) had no cover + texts or invariant sections, and (2) were thus incorporated prior + to November 1, 2008. + + The operator of an MMC Site may republish an MMC contained in the + site under CC-BY-SA on the same site at any time before August 1, + 2009, provided the MMC is eligible for relicensing. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the “with...Texts.” line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of free +software license, such as the GNU General Public License, to permit +their use in free software. + + +File: bison.info, Node: Bibliography, Next: Index of Terms, Prev: GNU Free Documentation License, Up: Top + +Bibliography +************ + +[Corbett 1984] + Robert Paul Corbett, Static Semantics in Compiler Error Recovery + Ph.D. Dissertation, Report No. UCB/CSD 85/251, Department of + Electrical Engineering and Computer Science, Compute Science + Division, University of California, Berkeley, California (June + 1985). + +[Denny 2008] + Joel E. Denny and Brian A. Malloy, IELR(1): Practical LR(1) Parser + Tables for Non-LR(1) Grammars with Conflict Resolution, in + ‘Proceedings of the 2008 ACM Symposium on Applied Computing’ + (SAC’08), ACM, New York, NY, USA, pp. 240–245. + + +[Denny 2010 May] + Joel E. Denny, PSLR(1): Pseudo-Scannerless Minimal LR(1) for the + Deterministic Parsing of Composite Languages, Ph.D. Dissertation, + Clemson University, Clemson, SC, USA (May 2010). + + +[Denny 2010 November] + Joel E. Denny and Brian A. Malloy, The IELR(1) Algorithm for + Generating Minimal LR(1) Parser Tables for Non-LR(1) Grammars with + Conflict Resolution, in ‘Science of Computer Programming’, Vol. 75, + Issue 11 (November 2010), pp. 943–979. + + +[DeRemer 1982] + Frank DeRemer and Thomas Pennello, Efficient Computation of LALR(1) + Look-Ahead Sets, in ‘ACM Transactions on Programming Languages and + Systems’, Vol. 4, No. 4 (October 1982), pp. 615–649. + + +[Isradisaikul 2015] + Chinawat Isradisaikul, Andrew Myers, Finding Counterexamples from + Parsing Conflicts, in ‘Proceedings of the 36th ACM SIGPLAN + Conference on Programming Language Design and Implementation’ (PLDI + ’15), ACM, pp. 555–564. + + +[Johnson 1978] + Steven C. Johnson, A portable compiler: theory and practice, in + ‘Proceedings of the 5th ACM SIGACT-SIGPLAN symposium on Principles + of programming languages’ (POPL ’78), pp. 97–104. + . + +[Knuth 1965] + Donald E. Knuth, On the Translation of Languages from Left to + Right, in ‘Information and Control’, Vol. 8, Issue 6 (December + 1965), pp. 607–639. + + +[Scott 2000] + Elizabeth Scott, Adrian Johnstone, and Shamsa Sadaf Hussain, + ‘Tomita-Style Generalised LR Parsers’, Royal Holloway, University + of London, Department of Computer Science, TR-00-12 (December + 2000). + + + +File: bison.info, Node: Index of Terms, Prev: Bibliography, Up: Top + +Index of Terms +************** + +[index] +* Menu: + +* $$: Actions. (line 6) +* $$ <1>: Java Action Features. + (line 20) +* $$ <2>: Action Features. (line 9) +* $$ <3>: D Action Features. (line 9) +* $$ <4>: Table of Symbols. (line 28) +* $$: Java Action Features. + (line 28) +* $$ <1>: Action Features. (line 17) +* $N: Java Action Features. + (line 16) +* $N <1>: Action Features. (line 21) +* $@N: Midrule Action Translation. + (line 6) +* $@N <1>: Table of Symbols. (line 23) +* $accept: Table of Symbols. (line 84) +* $end: Table of Symbols. (line 122) +* $N: Actions. (line 6) +* $N <1>: Java Action Features. + (line 12) +* $N <2>: Action Features. (line 13) +* $N <3>: D Action Features. (line 13) +* $N <4>: Table of Symbols. (line 32) +* $NAME: Actions. (line 6) +* $NAME <1>: Table of Symbols. (line 36) +* $undefined: Table of Symbols. (line 253) +* $[NAME]: Actions. (line 6) +* $[NAME] <1>: Table of Symbols. (line 37) +* %%: Java Declarations Summary. + (line 47) +* %% <1>: Table of Symbols. (line 41) +* %?: Semantic Predicates. (line 6) +* %?{EXPRESSION}: Table of Symbols. (line 50) +* %code: Prologue Alternatives. + (line 6) +* %code <1>: Decl Summary. (line 52) +* %code <2>: Decl Summary. (line 53) +* %code <3>: Decl Summary. (line 54) +* %code <4>: %code Summary. (line 6) +* %code <5>: %code Summary. (line 14) +* %code <6>: %code Summary. (line 25) +* %code <7>: Calc++ Parser. (line 63) +* %code <8>: Java Declarations Summary. + (line 31) +* %code <9>: Table of Symbols. (line 89) +* %code <10>: Table of Symbols. (line 90) +* %code imports: %code Summary. (line 87) +* %code imports <1>: Java Declarations Summary. + (line 35) +* %code init: Java Declarations Summary. + (line 39) +* %code lexer: Java Declarations Summary. + (line 43) +* %code provides: Prologue Alternatives. + (line 6) +* %code provides <1>: Decl Summary. (line 109) +* %code provides <2>: %code Summary. (line 58) +* %code requires: Prologue Alternatives. + (line 6) +* %code requires <1>: Decl Summary. (line 109) +* %code requires <2>: %code Summary. (line 41) +* %code requires <3>: Calc++ Parser. (line 31) +* %code top: Prologue Alternatives. + (line 6) +* %code top <1>: %code Summary. (line 71) +* %debug: Decl Summary. (line 58) +* %debug <1>: Enabling Traces. (line 22) +* %debug <2>: Table of Symbols. (line 95) +* %define: Decl Summary. (line 62) +* %define <1>: Decl Summary. (line 63) +* %define <2>: Decl Summary. (line 64) +* %define <3>: Decl Summary. (line 65) +* %define <4>: %define Summary. (line 13) +* %define <5>: %define Summary. (line 14) +* %define <6>: %define Summary. (line 15) +* %define <7>: %define Summary. (line 16) +* %define <8>: %define Summary. (line 561) +* %define <9>: %define Summary. (line 640) +* %define <10>: Table of Symbols. (line 98) +* %define <11>: Table of Symbols. (line 99) +* %define <12>: Table of Symbols. (line 100) +* %define <13>: Table of Symbols. (line 101) +* %define api.filename.type: %define Summary. (line 51) +* %define api.header.include: %define Summary. (line 68) +* %define api.header.include <1>: %define Summary. (line 69) +* %define api.location.file: %define Summary. (line 110) +* %define api.location.file <1>: %define Summary. (line 111) +* %define api.location.include: %define Summary. (line 137) +* %define api.location.include <1>: %define Summary. (line 138) +* %define api.location.type: %define Summary. (line 156) +* %define api.location.type <1>: User Defined Location Type. + (line 6) +* %define api.location.type <2>: Java Declarations Summary. + (line 101) +* %define api.namespace: %define Summary. (line 171) +* %define api.namespace <1>: C++ Bison Interface. (line 10) +* %define api.package: Java Declarations Summary. + (line 107) +* %define api.parser.abstract: Java Declarations Summary. + (line 60) +* %define api.parser.annotations: Java Declarations Summary. + (line 64) +* %define api.parser.class: %define Summary. (line 198) +* %define api.parser.class <1>: Java Declarations Summary. + (line 68) +* %define api.parser.extends: Java Declarations Summary. + (line 72) +* %define api.parser.final: Java Declarations Summary. + (line 76) +* %define api.parser.implements: Java Declarations Summary. + (line 80) +* %define api.parser.public: Java Declarations Summary. + (line 84) +* %define api.parser.strictfp: Java Declarations Summary. + (line 88) +* %define api.position.type: Java Declarations Summary. + (line 111) +* %define api.prefix: %define Summary. (line 211) +* %define api.prefix <1>: Java Declarations Summary. + (line 55) +* %define api.pure: Pure Decl. (line 6) +* %define api.pure <1>: %define Summary. (line 225) +* %define api.push-pull: Push Decl. (line 6) +* %define api.push-pull <1>: %define Summary. (line 264) +* %define api.push-pull <2>: D Push Parser Interface. + (line 6) +* %define api.push-pull <3>: Java Push Parser Interface. + (line 6) +* %define api.symbol.prefix: %define Summary. (line 275) +* %define api.token.constructor: %define Summary. (line 323) +* %define api.token.constructor <1>: Calc++ Parser. (line 21) +* %define api.token.prefix: %define Summary. (line 339) +* %define api.token.raw: %define Summary. (line 371) +* %define api.token.raw <1>: Calc++ Parser. (line 15) +* %define api.value.automove: %define Summary. (line 401) +* %define api.value.type: %define Summary. (line 440) +* %define api.value.type <1>: %define Summary. (line 441) +* %define api.value.type <2>: Java Declarations Summary. + (line 116) +* %define api.value.type union: Type Generation. (line 6) +* %define api.value.type variant: Calc++ Parser. (line 21) +* %define api.value.union.name: %define Summary. (line 512) +* %define init_throws: Java Declarations Summary. + (line 92) +* %define lex_throws: Java Declarations Summary. + (line 96) +* %define lr.default-reduction: %define Summary. (line 525) +* %define lr.default-reduction <1>: Default Reductions. (line 6) +* %define lr.default-reduction <2>: Default Reductions. (line 82) +* %define lr.keep-unreachable-state: %define Summary. (line 539) +* %define lr.keep-unreachable-state <1>: Unreachable States. (line 6) +* %define lr.keep-unreachable-state <2>: Unreachable States. (line 16) +* %define lr.type: %define Summary. (line 550) +* %define lr.type <1>: LR Table Construction. + (line 6) +* %define lr.type <2>: LR Table Construction. + (line 23) +* %define parse.assert: %define Summary. (line 564) +* %define parse.error: %define Summary. (line 582) +* %define parse.error custom: Syntax Error Reporting Function. + (line 6) +* %define parse.error detailed: Error Reporting Function. + (line 16) +* %define parse.error verbose: Error Reporting Function. + (line 16) +* %define parse.lac: %define Summary. (line 615) +* %define parse.lac <1>: LAC. (line 6) +* %define parse.lac <2>: LAC. (line 27) +* %define parse.trace: %define Summary. (line 624) +* %define parse.trace <1>: Enabling Traces. (line 10) +* %define throws: Java Declarations Summary. + (line 120) +* %defines: Decl Summary. (line 69) +* %defines <1>: Decl Summary. (line 70) +* %defines <2>: Table of Symbols. (line 105) +* %defines <3>: Table of Symbols. (line 106) +* %destructor: Typed Midrule Actions. + (line 6) +* %destructor <1>: Destructor Decl. (line 6) +* %destructor <2>: Destructor Decl. (line 21) +* %destructor <3>: Destructor Decl. (line 22) +* %destructor <4>: Decl Summary. (line 73) +* %destructor <5>: Table of Symbols. (line 109) +* %dprec: Merging GLR Parses. (line 6) +* %dprec <1>: Table of Symbols. (line 113) +* %empty: Empty Rules. (line 6) +* %empty <1>: Table of Symbols. (line 118) +* %error-verbose: Table of Symbols. (line 136) +* %expect: Expect Decl. (line 6) +* %expect <1>: Decl Summary. (line 40) +* %expect-rr: Simple GLR Parsers. (line 6) +* %expect-rr <1>: Expect Decl. (line 6) +* %expect-rr <2>: Decl Summary. (line 44) +* %file-prefix: Decl Summary. (line 77) +* %file-prefix <1>: Table of Symbols. (line 139) +* %glr-parser: GLR Parsers. (line 6) +* %glr-parser <1>: Simple GLR Parsers. (line 6) +* %glr-parser <2>: Table of Symbols. (line 143) +* %header: Decl Summary. (line 81) +* %header <1>: Decl Summary. (line 127) +* %header <2>: Table of Symbols. (line 146) +* %header <3>: Table of Symbols. (line 150) +* %initial-action: Initial Action Decl. (line 6) +* %initial-action <1>: Initial Action Decl. (line 10) +* %initial-action <2>: Initial Action Decl. (line 11) +* %initial-action <3>: Table of Symbols. (line 154) +* %language: Decl Summary. (line 130) +* %language <1>: Table of Symbols. (line 157) +* %language "Java": Java Declarations Summary. + (line 9) +* %left: Symbol Decls. (line 6) +* %left <1>: Decl Summary. (line 20) +* %left <2>: Using Precedence. (line 6) +* %left <3>: Table of Symbols. (line 161) +* %lex-param: Pure Calling. (line 31) +* %lex-param <1>: Pure Calling. (line 32) +* %lex-param <2>: Java Declarations Summary. + (line 12) +* %lex-param <3>: Table of Symbols. (line 165) +* %locations: Decl Summary. (line 135) +* %merge: Merging GLR Parses. (line 6) +* %merge <1>: Table of Symbols. (line 169) +* %name-prefix: Decl Summary. (line 141) +* %name-prefix <1>: Table of Symbols. (line 175) +* %no-lines: Decl Summary. (line 159) +* %no-lines <1>: Table of Symbols. (line 192) +* %nonassoc: Decl Summary. (line 24) +* %nonassoc <1>: Using Precedence. (line 6) +* %nonassoc <2>: LR Table Construction. + (line 97) +* %nonassoc <3>: Default Reductions. (line 6) +* %nonassoc <4>: Table of Symbols. (line 196) +* %nterm: Type Decl. (line 6) +* %nterm <1>: Symbol Decls. (line 6) +* %nterm <2>: Decl Summary. (line 29) +* %nterm <3>: Java Declarations Summary. + (line 27) +* %nterm <4>: Table of Symbols. (line 200) +* %output: Decl Summary. (line 168) +* %output <1>: Table of Symbols. (line 203) +* %param: Pure Calling. (line 36) +* %param <1>: Pure Calling. (line 37) +* %param <2>: Table of Symbols. (line 207) +* %parse-param: Parser Function. (line 38) +* %parse-param <1>: Parser Function. (line 39) +* %parse-param <2>: Java Declarations Summary. + (line 18) +* %parse-param <3>: Table of Symbols. (line 211) +* %prec: Contextual Precedence. + (line 6) +* %prec <1>: Table of Symbols. (line 215) +* %precedence: Using Precedence. (line 6) +* %precedence <1>: Precedence Only. (line 6) +* %precedence <2>: Table of Symbols. (line 219) +* %printer: Printer Decl. (line 6) +* %printer <1>: Printer Decl. (line 15) +* %printer <2>: Printer Decl. (line 16) +* %pure-parser: Decl Summary. (line 171) +* %pure-parser <1>: Table of Symbols. (line 223) +* %require: Require Decl. (line 6) +* %require <1>: Decl Summary. (line 175) +* %require <2>: Table of Symbols. (line 227) +* %right: Decl Summary. (line 16) +* %right <1>: Using Precedence. (line 6) +* %right <2>: Table of Symbols. (line 230) +* %skeleton: Decl Summary. (line 178) +* %skeleton <1>: Table of Symbols. (line 234) +* %start: Start Decl. (line 6) +* %start <1>: Decl Summary. (line 37) +* %start <2>: Table of Symbols. (line 238) +* %token: Token Decl. (line 6) +* %token <1>: Symbol Decls. (line 6) +* %token <2>: Decl Summary. (line 12) +* %token <3>: Java Declarations Summary. + (line 23) +* %token <4>: Table of Symbols. (line 241) +* %token-table: Decl Summary. (line 186) +* %token-table <1>: Table of Symbols. (line 245) +* %type: Type Decl. (line 6) +* %type <1>: Symbol Decls. (line 6) +* %type <2>: Decl Summary. (line 33) +* %type <3>: Table of Symbols. (line 249) +* %union: Union Decl. (line 6) +* %union <1>: Structured Value Type. + (line 6) +* %union <2>: Decl Summary. (line 8) +* %union <3>: Table of Symbols. (line 258) +* %verbose: Decl Summary. (line 241) +* %yacc: Decl Summary. (line 246) +* %{: Java Declarations Summary. + (line 51) +* %{CODE%}: Table of Symbols. (line 45) +* /*: Table of Symbols. (line 58) +* /* ... */: Grammar Outline. (line 6) +* //: Table of Symbols. (line 59) +* // ...: Grammar Outline. (line 6) +* :: Table of Symbols. (line 62) +* ;: Table of Symbols. (line 65) +* <*>: Destructor Decl. (line 6) +* <*> <1>: Printer Decl. (line 6) +* <*> <2>: Table of Symbols. (line 72) +* <>: Destructor Decl. (line 6) +* <> <1>: Printer Decl. (line 6) +* <> <2>: Table of Symbols. (line 78) +* @$: Actions and Locations. + (line 6) +* @$ <1>: Java Action Features. + (line 38) +* @$ <2>: Action Features. (line 99) +* @$ <3>: Table of Symbols. (line 6) +* @N: Midrule Action Translation. + (line 6) +* @N <1>: Actions and Locations. + (line 6) +* @N <2>: Java Action Features. + (line 34) +* @N <3>: Action Features. (line 104) +* @N <4>: Action Features. (line 105) +* @N <5>: Table of Symbols. (line 10) +* @N <6>: Table of Symbols. (line 11) +* @NAME: Actions and Locations. + (line 6) +* @NAME <1>: Table of Symbols. (line 18) +* @[NAME]: Actions and Locations. + (line 6) +* @[NAME] <1>: Table of Symbols. (line 19) +* |: Rules Syntax. (line 48) +* | <1>: Table of Symbols. (line 68) +* abstract syntax tree: Implementing Gotos/Loops. + (line 17) +* accepting state: Understanding. (line 185) +* action: Actions. (line 6) +* action data types: Action Types. (line 6) +* action features summary: Action Features. (line 6) +* actions in midrule: Midrule Actions. (line 6) +* actions in midrule <1>: Destructor Decl. (line 83) +* actions, location: Actions and Locations. + (line 6) +* actions, semantic: Semantic Actions. (line 6) +* additional C code section: Epilogue. (line 6) +* algorithm of parser: Algorithm. (line 6) +* ambiguous grammars: Language and Grammar. + (line 33) +* ambiguous grammars <1>: Generalized LR Parsing. + (line 6) +* associativity: Why Precedence. (line 34) +* AST: Implementing Gotos/Loops. + (line 17) +* Backus-Naur form: Language and Grammar. + (line 16) +* begin of location: C++ location. (line 20) +* begin of Location: D Location Values. (line 10) +* begin of Location <1>: Java Location Values. + (line 19) +* Bison declaration summary: Decl Summary. (line 6) +* Bison declarations: Declarations. (line 6) +* Bison declarations (introduction): Bison Declarations. (line 6) +* Bison grammar: Grammar in Bison. (line 6) +* Bison invocation: Invocation. (line 6) +* Bison parser: Bison Parser. (line 6) +* Bison parser algorithm: Algorithm. (line 6) +* Bison symbols, table of: Table of Symbols. (line 6) +* Bison utility: Bison Parser. (line 6) +* bison-i18n.m4: Enabling I18n. (line 11) +* bison-po: Internationalization. + (line 6) +* bisonSkeleton of YYParser: D Parser Interface. (line 70) +* bisonSkeleton of YYParser <1>: Java Parser Interface. + (line 92) +* bisonVersion of YYParser: D Parser Interface. (line 69) +* bisonVersion of YYParser <1>: Java Parser Interface. + (line 91) +* BISON_I18N: Enabling I18n. (line 18) +* BISON_LOCALEDIR: Enabling I18n. (line 18) +* BNF: Language and Grammar. + (line 16) +* braced code: Rules Syntax. (line 29) +* byacc: Byacc. (line 6) +* C code, section for additional: Epilogue. (line 6) +* C-language interface: Interface. (line 6) +* calc: Infix Calc. (line 6) +* calculator, infix notation: Infix Calc. (line 6) +* calculator, location tracking: Location Tracking Calc. + (line 6) +* calculator, multi-function: Multi-function Calc. (line 6) +* calculator, simple: RPN Calc. (line 6) +* canonical LR: Mysterious Conflicts. + (line 48) +* canonical LR <1>: LR Table Construction. + (line 6) +* cex: Counterexamples. (line 6) +* character token: Symbols. (line 37) +* column of position: C++ position. (line 35) +* columns on location: C++ location. (line 24) +* columns on position: C++ position. (line 38) +* comment: Grammar Outline. (line 6) +* compatibility: Versioning. (line 6) +* compiling the parser: Rpcalc Compile. (line 6) +* conflict counterexamples: Counterexamples. (line 6) +* conflicts: GLR Parsers. (line 6) +* conflicts <1>: Simple GLR Parsers. (line 6) +* conflicts <2>: Merging GLR Parses. (line 6) +* conflicts <3>: Shift/Reduce. (line 6) +* conflicts, reduce/reduce: Reduce/Reduce. (line 6) +* conflicts, suppressing warnings of: Expect Decl. (line 6) +* consistent states: Default Reductions. (line 17) +* context: C++ Parser Context. (line 16) +* context-dependent precedence: Contextual Precedence. + (line 6) +* context-free grammar: Language and Grammar. + (line 6) +* controlling function: Rpcalc Main. (line 6) +* core, item set: Understanding. (line 132) +* counterexample, nonunifying: Glossary. (line 31) +* counterexample, unifying: Glossary. (line 31) +* counterexamples: Counterexamples. (line 6) +* counter_type: C++ position. (line 11) +* dangling else: Shift/Reduce. (line 6) +* data type of locations: Location Type. (line 6) +* data types in actions: Action Types. (line 6) +* data types of semantic values: Value Type. (line 6) +* debugging: Tracing. (line 6) +* debug_level on parser: C++ Parser Interface. + (line 91) +* debug_stream on parser: C++ Parser Interface. + (line 86) +* declaration summary: Decl Summary. (line 6) +* declarations: Prologue. (line 6) +* declarations section: Prologue. (line 6) +* declarations, Bison: Declarations. (line 6) +* declarations, Bison (introduction): Bison Declarations. (line 6) +* declaring literal string tokens: Token Decl. (line 6) +* declaring operator precedence: Precedence Decl. (line 6) +* declaring the start symbol: Start Decl. (line 6) +* declaring token kind names: Token Decl. (line 6) +* declaring value types: Type Generation. (line 6) +* declaring value types <1>: Union Decl. (line 6) +* declaring value types <2>: Structured Value Type. + (line 6) +* declaring value types, nonterminals: Type Decl. (line 6) +* default action: Actions. (line 61) +* default data type: Value Type. (line 6) +* default location type: Location Type. (line 6) +* default reductions: Default Reductions. (line 6) +* default stack limit: Memory Management. (line 30) +* default start symbol: Start Decl. (line 6) +* defaulted states: Default Reductions. (line 17) +* deferred semantic actions: GLR Semantic Actions. + (line 12) +* defining language semantics: Semantics. (line 6) +* delayed syntax error detection: LR Table Construction. + (line 97) +* delayed syntax error detection <1>: Default Reductions. (line 43) +* delayed yylex invocations: Default Reductions. (line 17) +* discarded symbols: Destructor Decl. (line 92) +* discarded symbols, midrule actions: Typed Midrule Actions. + (line 6) +* dot: Graphviz. (line 6) +* dotted rule: Understanding. (line 110) +* else, dangling: Shift/Reduce. (line 6) +* emplace on value_type: C++ Variants. (line 53) +* emplace on value_type: C++ Variants. (line 47) +* emplace on value_type <1>: C++ Variants. (line 48) +* empty rule: Empty Rules. (line 6) +* end of location: C++ location. (line 21) +* end of Location: D Location Values. (line 11) +* end of Location <1>: Java Location Values. + (line 20) +* epilogue: Epilogue. (line 6) +* error: Error Recovery. (line 20) +* error <1>: Table of Symbols. (line 126) +* error on parser: C++ Parser Interface. + (line 96) +* error on parser <1>: C++ Parser Interface. + (line 98) +* error recovery: Error Recovery. (line 6) +* error recovery, midrule actions: Typed Midrule Actions. + (line 6) +* error recovery, simple: Simple Error Recovery. + (line 6) +* error reporting function: Error Reporting Function. + (line 6) +* error reporting routine: Rpcalc Error. (line 6) +* examples, simple: Examples. (line 6) +* exceptions: C++ Parser Interface. + (line 78) +* exercises: Exercises. (line 6) +* expected_tokens on context: C++ Parser Context. (line 53) +* file format: Grammar Layout. (line 6) +* file of position: C++ position. (line 24) +* filename_type: C++ position. (line 6) +* finite-state machine: Parser States. (line 6) +* formal grammar: Grammar in Bison. (line 6) +* format of grammar file: Grammar Layout. (line 6) +* freeing discarded symbols: Destructor Decl. (line 6) +* frequently asked questions: FAQ. (line 6) +* generalized LR (GLR) parsing: Language and Grammar. + (line 33) +* generalized LR (GLR) parsing <1>: GLR Parsers. (line 6) +* generalized LR (GLR) parsing <2>: Generalized LR Parsing. + (line 6) +* generalized LR (GLR) parsing, ambiguous grammars: Merging GLR Parses. + (line 6) +* generalized LR (GLR) parsing, unambiguous grammars: Simple GLR Parsers. + (line 6) +* getDebugLevel on YYParser: Java Parser Interface. + (line 86) +* getDebugLevel() on YYParser: D Parser Interface. (line 64) +* getDebugStream on YYParser: Java Parser Interface. + (line 81) +* getDebugStream() on YYParser: D Parser Interface. (line 59) +* getEndPos on Lexer: Java Scanner Interface. + (line 40) +* getErrorVerbose on YYParser: Java Parser Interface. + (line 64) +* getErrorVerbose() on YYParser: D Parser Interface. (line 43) +* getExpectedTokens on YYParser.Context: Java Parser Context Interface. + (line 39) +* getExpectedTokens(YYParser.SymbolKind[] on YYParser.Context: D Parser Context Interface. + (line 21) +* getLocation on YYParser.Context: Java Parser Context Interface. + (line 36) +* getLocation() on YYParser.Context: D Parser Context Interface. + (line 18) +* getLVal on Lexer: Java Scanner Interface. + (line 52) +* getName on YYParser.SymbolKind: Java Parser Context Interface. + (line 29) +* getStartPos on Lexer: Java Scanner Interface. + (line 39) +* gettext: Internationalization. + (line 6) +* getToken on YYParser.Context: Java Parser Context Interface. + (line 32) +* getToken() on YYParser.Context: D Parser Context Interface. + (line 14) +* glossary: Glossary. (line 6) +* GLR parsers and yychar: GLR Semantic Actions. + (line 16) +* GLR parsers and yyclearin: GLR Semantic Actions. + (line 24) +* GLR parsers and YYERROR: GLR Semantic Actions. + (line 37) +* GLR parsers and yylloc: GLR Semantic Actions. + (line 16) +* GLR parsers and YYLLOC_DEFAULT: Location Default Action. + (line 6) +* GLR parsers and yylval: GLR Semantic Actions. + (line 16) +* GLR parsing: Language and Grammar. + (line 33) +* GLR parsing <1>: GLR Parsers. (line 6) +* GLR parsing <2>: Generalized LR Parsing. + (line 6) +* GLR parsing, ambiguous grammars: Merging GLR Parses. (line 6) +* GLR parsing, unambiguous grammars: Simple GLR Parsers. (line 6) +* GLR with LALR: LR Table Construction. + (line 59) +* grammar file: Grammar Layout. (line 6) +* grammar rule syntax: Rules Syntax. (line 6) +* grammar rules section: Grammar Rules. (line 6) +* grammar, Bison: Grammar in Bison. (line 6) +* grammar, context-free: Language and Grammar. + (line 6) +* grouping, syntactic: Language and Grammar. + (line 46) +* Header guard: Decl Summary. (line 112) +* history: History. (line 6) +* i18n: Internationalization. + (line 6) +* i18n of YYParser: Java Parser Interface. + (line 99) +* IELR: Mysterious Conflicts. + (line 48) +* IELR <1>: LR Table Construction. + (line 6) +* IELR grammars: Language and Grammar. + (line 22) +* infix notation calculator: Infix Calc. (line 6) +* initialize on location: C++ location. (line 16) +* initialize on position: C++ position. (line 20) +* interface: Interface. (line 6) +* internationalization: Internationalization. + (line 6) +* introduction: Introduction. (line 6) +* invoking Bison: Invocation. (line 6) +* item: Understanding. (line 110) +* item set core: Understanding. (line 132) +* item set core <1>: Understanding. (line 132) +* kernel, item set: Understanding. (line 132) +* kind on symbol_type: Complete Symbols. (line 21) +* LAC: LR Table Construction. + (line 97) +* LAC <1>: Default Reductions. (line 54) +* LAC <2>: LAC. (line 6) +* LALR: Mysterious Conflicts. + (line 36) +* LALR <1>: LR Table Construction. + (line 6) +* LALR grammars: Language and Grammar. + (line 22) +* language semantics, defining: Semantics. (line 6) +* layout of Bison grammar: Grammar Layout. (line 6) +* left recursion: Recursion. (line 17) +* lexical analyzer: Lexical. (line 6) +* lexical analyzer, purpose: Bison Parser. (line 6) +* lexical analyzer, writing: Rpcalc Lexer. (line 6) +* lexical tie-in: Lexical Tie-ins. (line 6) +* line of position: C++ position. (line 28) +* lines on location: C++ location. (line 25) +* lines on position: C++ position. (line 31) +* literal string token: Symbols. (line 57) +* literal token: Symbols. (line 37) +* location: Locations. (line 6) +* location <1>: Tracking Locations. (line 6) +* location actions: Actions and Locations. + (line 6) +* location on context: C++ Parser Context. (line 50) +* location on location: C++ location. (line 6) +* location on location <1>: C++ location. (line 10) +* location on location <2>: C++ location. (line 11) +* Location on Location: Java Location Values. + (line 23) +* Location on Location <1>: Java Location Values. + (line 27) +* location tracking calculator: Location Tracking Calc. + (line 6) +* location, textual: Locations. (line 6) +* location, textual <1>: Tracking Locations. (line 6) +* location_type: C++ Parser Interface. + (line 49) +* lookahead correction: LAC. (line 6) +* lookahead on context: C++ Parser Context. (line 43) +* lookahead token: Lookahead. (line 6) +* LR: Mysterious Conflicts. + (line 36) +* LR grammars: Language and Grammar. + (line 22) +* ltcalc: Location Tracking Calc. + (line 6) +* main function in simple example: Rpcalc Main. (line 6) +* make_TOKEN on parser: Complete Symbols. (line 82) +* make_TOKEN on parser <1>: Complete Symbols. (line 84) +* make_TOKEN on parser <2>: Complete Symbols. (line 86) +* make_TOKEN on parser <3>: Complete Symbols. (line 87) +* memory exhaustion: Memory Management. (line 6) +* memory management: Memory Management. (line 6) +* mfcalc: Multi-function Calc. (line 6) +* midrule actions: Midrule Actions. (line 6) +* midrule actions <1>: Destructor Decl. (line 83) +* multi-function calculator: Multi-function Calc. (line 6) +* multicharacter literal: Symbols. (line 57) +* mutual recursion: Recursion. (line 34) +* Mysterious Conflict: LR Table Construction. + (line 6) +* Mysterious Conflicts: Mysterious Conflicts. + (line 6) +* name on symbol_type: Complete Symbols. (line 24) +* named references: Named References. (line 6) +* NLS: Internationalization. + (line 6) +* nondeterministic parsing: Language and Grammar. + (line 33) +* nondeterministic parsing <1>: Generalized LR Parsing. + (line 6) +* nonterminal symbol: Symbols. (line 6) +* nonterminal, useless: Understanding. (line 56) +* nonunifying counterexample: Glossary. (line 31) +* operator precedence: Precedence. (line 6) +* operator precedence, declaring: Precedence Decl. (line 6) +* operator!= on location: C++ location. (line 43) +* operator!= on position: C++ position. (line 49) +* operator() on parser: C++ Parser Interface. + (line 73) +* operator+ on location: C++ location. (line 28) +* operator+ on location <1>: C++ location. (line 34) +* operator+ on position: C++ position. (line 43) +* operator+= on location: C++ location. (line 29) +* operator+= on location <1>: C++ location. (line 35) +* operator+= on position: C++ position. (line 42) +* operator- on location: C++ location. (line 30) +* operator- on position: C++ position. (line 45) +* operator-= on location: C++ location. (line 31) +* operator-= on position: C++ position. (line 44) +* operator<<: C++ position. (line 52) +* operator<< <1>: C++ location. (line 47) +* operator== on location: C++ location. (line 42) +* operator== on position: C++ position. (line 48) +* options for invoking Bison: Invocation. (line 6) +* overflow of parser stack: Memory Management. (line 6) +* parse error: Error Reporting Function. + (line 6) +* parse on parser: C++ Parser Interface. + (line 74) +* parse on YYParser: Java Parser Interface. + (line 60) +* parse() on YYParser: D Parser Interface. (line 39) +* parser: Bison Parser. (line 6) +* parser on parser: C++ Parser Interface. + (line 63) +* parser on parser <1>: C++ Parser Interface. + (line 64) +* parser stack: Algorithm. (line 6) +* parser stack overflow: Memory Management. (line 6) +* parser state: Parser States. (line 6) +* position on position: C++ position. (line 14) +* precedence declarations: Precedence Decl. (line 6) +* precedence of operators: Precedence. (line 6) +* precedence, context-dependent: Contextual Precedence. + (line 6) +* precedence, unary operator: Contextual Precedence. + (line 6) +* preventing warnings about conflicts: Expect Decl. (line 6) +* printing semantic values: Printer Decl. (line 6) +* Prologue: Prologue. (line 6) +* Prologue <1>: %code Summary. (line 6) +* Prologue Alternatives: Prologue Alternatives. + (line 6) +* pure parser: Pure Decl. (line 6) +* push parser: Push Decl. (line 6) +* push parser <1>: Push Decl. (line 6) +* pushParse on YYParser: D Push Parser Interface. + (line 18) +* push_parse on YYParser: Java Push Parser Interface. + (line 18) +* push_parse on YYParser <1>: Java Push Parser Interface. + (line 19) +* push_parse on YYParser <2>: Java Push Parser Interface. + (line 21) +* questions: FAQ. (line 6) +* recovering: Java Action Features. + (line 54) +* recovering on YYParser: Java Parser Interface. + (line 77) +* recovering() on YYParser: D Parser Interface. (line 55) +* recovery from errors: Error Recovery. (line 6) +* recursive rule: Recursion. (line 6) +* reduce/reduce conflict: Reduce/Reduce. (line 6) +* reduce/reduce conflicts: GLR Parsers. (line 6) +* reduce/reduce conflicts <1>: Simple GLR Parsers. (line 6) +* reduce/reduce conflicts <2>: Merging GLR Parses. (line 6) +* reduction: Algorithm. (line 6) +* reentrant parser: Pure Decl. (line 6) +* reportSyntaxError on Lexer: Java Scanner Interface. + (line 59) +* reportSyntaxError(YYParser.Context on Lexer: D Scanner Interface. + (line 34) +* report_syntax_error on parser: C++ Parser Context. (line 9) +* requiring a version of Bison: Require Decl. (line 6) +* Reverse Polish Notation: RPN Calc. (line 6) +* right recursion: Recursion. (line 17) +* rpcalc: RPN Calc. (line 6) +* rule syntax: Rules Syntax. (line 6) +* rule, dotted: Understanding. (line 110) +* rule, empty: Empty Rules. (line 6) +* rule, recursive: Recursion. (line 6) +* rule, useless: Understanding. (line 56) +* rules section for grammar: Grammar Rules. (line 6) +* running Bison (introduction): Rpcalc Generate. (line 6) +* semantic actions: Semantic Actions. (line 6) +* Semantic predicates in GLR parsers: Semantic Predicates. (line 6) +* semantic value: Semantic Values. (line 6) +* semantic value type: Value Type. (line 6) +* setDebugLevel on YYParser: Java Parser Interface. + (line 87) +* setDebugLevel(int on YYParser: D Parser Interface. (line 65) +* setDebugStream on YYParser: Java Parser Interface. + (line 82) +* setDebugStream(File on YYParser: D Parser Interface. (line 60) +* setErrorVerbose on YYParser: Java Parser Interface. + (line 65) +* setErrorVerbose(boolean on YYParser: D Parser Interface. (line 44) +* set_debug_level on parser: C++ Parser Interface. + (line 92) +* set_debug_stream on parser: C++ Parser Interface. + (line 87) +* shift/reduce conflicts: GLR Parsers. (line 6) +* shift/reduce conflicts <1>: Simple GLR Parsers. (line 6) +* shift/reduce conflicts <2>: Shift/Reduce. (line 6) +* shifting: Algorithm. (line 6) +* simple examples: Examples. (line 6) +* single-character literal: Symbols. (line 37) +* stack overflow: Memory Management. (line 6) +* stack, parser: Algorithm. (line 6) +* stages in using Bison: Stages. (line 6) +* start symbol: Language and Grammar. + (line 94) +* start symbol, declaring: Start Decl. (line 6) +* state (of parser): Parser States. (line 6) +* step on location: C++ location. (line 39) +* string token: Symbols. (line 57) +* summary, action features: Action Features. (line 6) +* summary, Bison declaration: Decl Summary. (line 6) +* suppressing conflict warnings: Expect Decl. (line 6) +* symbol: Symbols. (line 6) +* symbol table example: Mfcalc Symbol Table. (line 6) +* SymbolKind: D Parser Context Interface. + (line 9) +* SymbolKind <1>: Java Parser Context Interface. + (line 9) +* symbols (abstract): Language and Grammar. + (line 46) +* symbols in Bison, table of: Table of Symbols. (line 6) +* symbol_kind_type: C++ Parser Context. (line 19) +* symbol_name on parser: C++ Parser Context. (line 68) +* symbol_type: Complete Symbols. (line 17) +* symbol_type on parser::symbol_type: Complete Symbols. (line 32) +* symbol_type on parser::symbol_type <1>: Complete Symbols. (line 34) +* symbol_type on parser::symbol_type <2>: Complete Symbols. (line 36) +* symbol_type on parser::symbol_type <3>: Complete Symbols. (line 38) +* syntactic grouping: Language and Grammar. + (line 46) +* syntax error: Error Reporting Function. + (line 6) +* syntax of grammar rules: Rules Syntax. (line 6) +* syntax_error: C++ Parser Interface. + (line 53) +* syntax_error on syntax_error: C++ Parser Interface. + (line 68) +* syntax_error on syntax_error <1>: C++ Parser Interface. + (line 70) +* terminal symbol: Symbols. (line 6) +* textual location: Locations. (line 6) +* textual location <1>: Tracking Locations. (line 6) +* this(Lexer on YYParser: D Parser Interface. (line 34) +* this(LEX_PARAM, on YYParser: D Parser Interface. (line 29) +* this(Position on Location: D Location Values. (line 14) +* this(Position on Location <1>: D Location Values. (line 18) +* token: Language and Grammar. + (line 46) +* token <1>: C++ Parser Interface. + (line 14) +* token kind: Symbols. (line 6) +* token kind names, declaring: Token Decl. (line 6) +* token on context: C++ Parser Context. (line 46) +* token, useless: Understanding. (line 56) +* token_kind_type: C++ Parser Interface. + (line 21) +* toString on Location: Java Location Values. + (line 30) +* toString() on Location: D Location Values. (line 21) +* tracing the parser: Tracing. (line 6) +* unary operator precedence: Contextual Precedence. + (line 6) +* ungulates: History. (line 6) +* unifying counterexample: Glossary. (line 31) +* unreachable states: Unreachable States. (line 6) +* useless nonterminal: Understanding. (line 56) +* useless rule: Understanding. (line 56) +* useless token: Understanding. (line 56) +* using Bison: Stages. (line 6) +* value type, semantic: Value Type. (line 6) +* value types, declaring: Type Generation. (line 6) +* value types, declaring <1>: Union Decl. (line 6) +* value types, declaring <2>: Structured Value Type. + (line 6) +* value types, nonterminals, declaring: Type Decl. (line 6) +* value, semantic: Semantic Values. (line 6) +* value_type: C++ Parser Interface. + (line 46) +* version: Versioning. (line 6) +* version requirement: Require Decl. (line 6) +* warnings, preventing: Expect Decl. (line 6) +* writing a lexical analyzer: Rpcalc Lexer. (line 6) +* xml: Xml. (line 6) +* yacchack: yacchack. (line 6) +* YYABORT: Parser Function. (line 28) +* YYABORT <1>: Parser Function. (line 29) +* YYABORT <2>: Action Features. (line 25) +* YYABORT <3>: Java Action Features. + (line 42) +* YYABORT <4>: Table of Symbols. (line 262) +* YYACCEPT: Parser Function. (line 25) +* YYACCEPT <1>: Parser Function. (line 26) +* YYACCEPT <2>: Action Features. (line 29) +* YYACCEPT <3>: Java Action Features. + (line 46) +* YYACCEPT <4>: Table of Symbols. (line 270) +* YYBACKUP: Action Features. (line 33) +* YYBACKUP <1>: Action Features. (line 34) +* YYBACKUP <2>: Table of Symbols. (line 278) +* YYBISON: Table of Symbols. (line 282) +* yychar: GLR Semantic Actions. + (line 16) +* yychar <1>: Lookahead. (line 49) +* yychar <2>: Action Features. (line 70) +* yychar <3>: Table of Symbols. (line 287) +* yyclearin: GLR Semantic Actions. + (line 24) +* yyclearin <1>: Action Features. (line 77) +* yyclearin <2>: Error Recovery. (line 99) +* yyclearin <3>: Table of Symbols. (line 293) +* yydebug: Tracing. (line 6) +* YYDEBUG: Enabling Traces. (line 27) +* YYDEBUG <1>: Table of Symbols. (line 297) +* yydebug <1>: Table of Symbols. (line 301) +* YYEMPTY: Action Features. (line 46) +* YYEMPTY <1>: Table of Symbols. (line 306) +* YYENABLE_NLS: Enabling I18n. (line 18) +* YYEOF: Action Features. (line 49) +* YYEOF <1>: Table of Symbols. (line 309) +* yyerrok: Action Features. (line 82) +* yyerrok <1>: Error Recovery. (line 94) +* yyerrok <2>: D Action Features. (line 17) +* yyerrok <3>: Table of Symbols. (line 312) +* YYERROR: GLR Semantic Actions. + (line 37) +* yyerror: Error Reporting Function. + (line 6) +* YYERROR <1>: Action Features. (line 53) +* YYERROR <2>: Java Action Features. + (line 50) +* yyerror <1>: Java Action Features. + (line 59) +* yyerror <2>: Java Action Features. + (line 60) +* yyerror <3>: Java Action Features. + (line 61) +* YYERROR <3>: Table of Symbols. (line 316) +* yyerror <4>: Table of Symbols. (line 327) +* yyerror on Lexer: Java Scanner Interface. + (line 26) +* yyerror on YYParser: Java Parser Interface. + (line 70) +* yyerror on YYParser <1>: Java Parser Interface. + (line 71) +* yyerror on YYParser <2>: Java Parser Interface. + (line 72) +* yyerror(Location on Lexer: D Scanner Interface. (line 26) +* yyerror(Location on YYParser: D Parser Interface. (line 50) +* yyerror(string on YYParser: D Parser Interface. (line 49) +* YYFPRINTF: Enabling Traces. (line 47) +* YYFPRINTF <1>: Table of Symbols. (line 331) +* YYINITDEPTH: Memory Management. (line 32) +* YYINITDEPTH <1>: Table of Symbols. (line 334) +* yylex: Lexical. (line 6) +* yylex <1>: Split Symbols. (line 8) +* yylex <2>: Split Symbols. (line 10) +* yylex <3>: Complete Symbols. (line 10) +* yylex <4>: Complete Symbols. (line 11) +* yylex <5>: Table of Symbols. (line 338) +* yylex on Lexer: Java Scanner Interface. + (line 31) +* yylex() on Lexer: D Scanner Interface. (line 30) +* yylloc: GLR Semantic Actions. + (line 16) +* yylloc <1>: Actions and Locations. + (line 63) +* yylloc <2>: Token Locations. (line 6) +* yylloc <3>: Lookahead. (line 49) +* yylloc <4>: Action Features. (line 87) +* yylloc <5>: Table of Symbols. (line 342) +* YYLLOC_DEFAULT: Location Default Action. + (line 6) +* YYLOCATION_PRINT: Printing Locations. (line 6) +* YYLOCATION_PRINT <1>: Printing Locations. (line 10) +* YYLTYPE: Token Locations. (line 19) +* YYLTYPE <1>: Table of Symbols. (line 351) +* yylval: GLR Semantic Actions. + (line 16) +* yylval <1>: Actions. (line 86) +* yylval <2>: Token Values. (line 6) +* yylval <3>: Lookahead. (line 49) +* yylval <4>: Action Features. (line 93) +* yylval <5>: Table of Symbols. (line 355) +* YYMAXDEPTH: Memory Management. (line 14) +* YYMAXDEPTH <1>: Table of Symbols. (line 362) +* yynerrs: Error Reporting Function. + (line 66) +* yynerrs <1>: Table of Symbols. (line 366) +* YYNOMEM: Parser Function. (line 31) +* YYNOMEM <1>: Parser Function. (line 32) +* YYNOMEM <2>: Action Features. (line 61) +* YYNOMEM <3>: Table of Symbols. (line 372) +* yyo: Printer Decl. (line 16) +* yyparse: Parser Function. (line 6) +* yyparse <1>: Parser Function. (line 12) +* yyparse <2>: Table of Symbols. (line 377) +* YYParser on YYParser: Java Parser Interface. + (line 38) +* YYParser on YYParser <1>: Java Parser Interface. + (line 47) +* yypcontext_expected_tokens: Syntax Error Reporting Function. + (line 55) +* yypcontext_location: Syntax Error Reporting Function. + (line 51) +* yypcontext_t: Syntax Error Reporting Function. + (line 21) +* yypcontext_token: Syntax Error Reporting Function. + (line 45) +* yypstate_delete: Push Parser Interface. + (line 15) +* yypstate_delete <1>: Push Parser Interface. + (line 19) +* yypstate_delete <2>: Table of Symbols. (line 381) +* yypstate_expected_tokens: Push Parser Interface. + (line 53) +* yypstate_new: Push Parser Interface. + (line 6) +* yypstate_new <1>: Push Parser Interface. + (line 10) +* yypstate_new <2>: Table of Symbols. (line 387) +* yypull_parse: Push Parser Interface. + (line 48) +* yypull_parse <1>: Table of Symbols. (line 392) +* yypush_parse: Push Parser Interface. + (line 23) +* yypush_parse <1>: Push Parser Interface. + (line 27) +* yypush_parse <2>: Table of Symbols. (line 397) +* YYRECOVERING: Error Recovery. (line 110) +* YYRECOVERING <1>: Action Features. (line 65) +* YYRECOVERING <2>: Action Features. (line 66) +* YYRECOVERING <3>: Table of Symbols. (line 402) +* yyreport_syntax_error: Syntax Error Reporting Function. + (line 15) +* YYSTACK_USE_ALLOCA: Table of Symbols. (line 407) +* YYSTYPE: Table of Symbols. (line 424) +* yysymbol_kind_t: Syntax Error Reporting Function. + (line 24) +* yysymbol_kind_t <1>: Table of Symbols. (line 429) +* yysymbol_name: Syntax Error Reporting Function. + (line 72) +* yytoken_kind_t: Table of Symbols. (line 437) +* YYUNDEF: Table of Symbols. (line 443) +* zoo: Bison. (line 6) + + + +Tag Table: +Node: Top1066 +Node: Introduction18219 +Node: Conditions19794 +Node: Copying21717 +Node: Concepts59459 +Node: Language and Grammar60655 +Node: Grammar in Bison66769 +Node: Semantic Values68685 +Node: Semantic Actions70821 +Node: GLR Parsers71998 +Node: Simple GLR Parsers74773 +Node: Merging GLR Parses81253 +Ref: Merging GLR Parses-Footnote-186591 +Node: GLR Semantic Actions86732 +Node: Semantic Predicates89333 +Node: Locations91786 +Node: Bison Parser93264 +Node: Stages96464 +Node: Grammar Layout97689 +Node: Examples99051 +Node: RPN Calc100544 +Ref: RPN Calc-Footnote-1101596 +Node: Rpcalc Declarations101674 +Node: Rpcalc Rules103730 +Node: Rpcalc Input105629 +Node: Rpcalc Line107208 +Node: Rpcalc Exp108360 +Node: Rpcalc Lexer110373 +Node: Rpcalc Main113070 +Node: Rpcalc Error113481 +Node: Rpcalc Generate114509 +Node: Rpcalc Compile115757 +Node: Infix Calc116721 +Ref: Infix Calc-Footnote-1119567 +Node: Simple Error Recovery119720 +Node: Location Tracking Calc121658 +Node: Ltcalc Declarations122358 +Node: Ltcalc Rules123453 +Node: Ltcalc Lexer125295 +Node: Multi-function Calc127636 +Ref: Multi-function Calc-Footnote-1129413 +Node: Mfcalc Declarations129491 +Node: Mfcalc Rules131515 +Node: Mfcalc Symbol Table132793 +Node: Mfcalc Lexer136255 +Node: Mfcalc Main138828 +Node: Exercises139704 +Node: Grammar File140231 +Node: Grammar Outline141081 +Node: Prologue141939 +Node: Prologue Alternatives143740 +Ref: Prologue Alternatives-Footnote-1153440 +Node: Bison Declarations153545 +Node: Grammar Rules153955 +Node: Epilogue154411 +Node: Symbols155462 +Node: Rules162497 +Node: Rules Syntax162812 +Node: Empty Rules164877 +Node: Recursion165964 +Node: Semantics167622 +Node: Value Type168928 +Node: Multiple Types170216 +Node: Type Generation171666 +Node: Union Decl173596 +Node: Structured Value Type174989 +Node: Actions176015 +Node: Action Types179899 +Node: Midrule Actions181252 +Node: Using Midrule Actions181906 +Node: Typed Midrule Actions185445 +Node: Midrule Action Translation186995 +Node: Midrule Conflicts189488 +Node: Tracking Locations192097 +Node: Location Type192829 +Node: Actions and Locations194352 +Node: Printing Locations196734 +Node: Location Default Action197496 +Node: Named References201033 +Node: Declarations203630 +Node: Require Decl205319 +Node: Token Decl205833 +Node: Precedence Decl208750 +Node: Type Decl211026 +Node: Symbol Decls211977 +Node: Initial Action Decl212932 +Node: Destructor Decl213747 +Node: Printer Decl219393 +Node: Expect Decl221662 +Node: Start Decl225663 +Node: Pure Decl226057 +Node: Push Decl227805 +Node: Decl Summary232244 +Ref: %header234925 +Node: %define Summary243258 +Ref: api-filename-type245169 +Ref: api-token-prefix256117 +Node: %code Summary268123 +Node: Multiple Parsers272379 +Node: Interface276239 +Node: Parser Function277348 +Node: Push Parser Interface279841 +Ref: yypstate_new280226 +Ref: yypstate_delete280667 +Ref: yypush_parse281081 +Ref: yypull_parse282093 +Node: Lexical283096 +Node: Calling Convention284671 +Node: Special Tokens286200 +Node: Tokens from Literals287639 +Node: Token Values288720 +Node: Token Locations289888 +Node: Pure Calling290820 +Node: Error Reporting293417 +Node: Error Reporting Function293940 +Node: Syntax Error Reporting Function297312 +Node: Action Features301923 +Node: Internationalization306263 +Node: Enabling I18n307123 +Node: Token I18n309241 +Node: Algorithm310644 +Node: Lookahead313066 +Node: Shift/Reduce315280 +Node: Precedence319347 +Node: Why Precedence320119 +Node: Using Precedence322034 +Node: Precedence Only323534 +Node: Precedence Examples325336 +Node: How Precedence325860 +Node: Non Operators327005 +Node: Contextual Precedence328578 +Node: Parser States330324 +Node: Reduce/Reduce331579 +Node: Mysterious Conflicts336388 +Node: Tuning LR340015 +Node: LR Table Construction341221 +Node: Default Reductions346839 +Node: LAC351626 +Node: Unreachable States357132 +Node: Generalized LR Parsing359139 +Node: Memory Management363524 +Node: Error Recovery365908 +Node: Context Dependency371188 +Node: Semantic Tokens372045 +Node: Lexical Tie-ins375121 +Node: Tie-in Recovery376577 +Node: Debugging378709 +Node: Counterexamples380174 +Node: Understanding386180 +Ref: state-8392904 +Node: Graphviz398455 +Node: Xml402776 +Node: Tracing404514 +Node: Enabling Traces404891 +Node: Mfcalc Traces409019 +Node: Invocation414230 +Node: Bison Options416336 +Node: Operation Modes417183 +Node: Diagnostics422900 +Ref: Wconflicts-sr423208 +Ref: Wconflicts-rr423232 +Ref: Wcounterexamples423620 +Ref: Wdangling-alias423933 +Ref: Wdeprecated425263 +Ref: Wempty-rule425387 +Ref: Wmidrule-values425599 +Ref: Wprecedence426310 +Ref: Wyacc427444 +Ref: Wother427506 +Ref: Wall427810 +Ref: Wnone427930 +Ref: Werror428206 +Node: Tuning the Parser430013 +Ref: option-yacc433427 +Ref: Tuning the Parser-Footnote-1435280 +Node: Output Files435346 +Node: Option Cross Key438623 +Node: Yacc Library440761 +Node: Other Languages441834 +Node: C++ Parsers442459 +Node: A Simple C++ Example443188 +Ref: A Simple C++ Example-Footnote-1447342 +Node: C++ Bison Interface447425 +Node: C++ Parser Interface449015 +Node: C++ Semantic Values453602 +Node: C++ Unions454152 +Node: C++ Variants454945 +Node: C++ Location Values458718 +Node: C++ position459657 +Node: C++ location462026 +Node: Exposing the Location Classes464216 +Node: User Defined Location Type466115 +Node: C++ Parser Context467694 +Node: C++ Scanner Interface471661 +Node: Split Symbols472229 +Node: Complete Symbols473964 +Node: A Complete C++ Example478719 +Node: Calc++ --- C++ Calculator479662 +Node: Calc++ Parsing Driver480183 +Node: Calc++ Parser483150 +Node: Calc++ Scanner487273 +Node: Calc++ Top Level491228 +Node: D Parsers491927 +Node: D Bison Interface492631 +Node: D Semantic Values493744 +Node: D Location Values494577 +Node: D Parser Interface495448 +Node: D Parser Context Interface500364 +Node: D Scanner Interface501807 +Node: D Action Features504747 +Node: D Push Parser Interface505516 +Node: D Complete Symbols506992 +Node: Java Parsers507708 +Node: Java Bison Interface508524 +Node: Java Semantic Values510715 +Node: Java Location Values512412 +Node: Java Parser Interface514010 +Node: Java Parser Context Interface519267 +Node: Java Scanner Interface521352 +Node: Java Action Features525424 +Node: Java Push Parser Interface528175 +Node: Java Differences531170 +Ref: Java Differences-Footnote-1533833 +Node: Java Declarations Summary533987 +Node: History539020 +Node: Yacc539476 +Ref: Yacc-Footnote-1540972 +Ref: Yacc-Footnote-2541203 +Node: yacchack541273 +Node: Byacc541700 +Node: Bison542519 +Node: Other Ungulates544537 +Node: Versioning545127 +Node: FAQ548550 +Node: Memory Exhausted549577 +Node: How Can I Reset the Parser549879 +Node: Strings are Destroyed552473 +Node: Implementing Gotos/Loops554178 +Node: Multiple start-symbols555471 +Node: Secure? Conform?557051 +Node: Enabling Relocatability557505 +Node: I can't build Bison560429 +Node: Where can I find help?561701 +Node: Bug Reports562496 +Node: More Languages563975 +Node: Beta Testing564312 +Node: Mailing Lists565188 +Node: Table of Symbols565400 +Node: Glossary582432 +Node: GNU Free Documentation License592794 +Node: Bibliography618148 +Ref: Corbett 1984618288 +Ref: Denny 2008618638 +Ref: Denny 2010 May618964 +Ref: Denny 2010 November619239 +Ref: DeRemer 1982619577 +Ref: Isradisaikul 2015619849 +Ref: Johnson 1978620178 +Ref: Knuth 1965620447 +Ref: Scott 2000620683 +Node: Index of Terms621000 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/platform/dbops/binaries/build/share/info/flex.info b/platform/dbops/binaries/build/share/info/flex.info new file mode 100644 index 0000000000000000000000000000000000000000..a972bcd9d272fdaff2ec12d4a5d130f9c456f050 --- /dev/null +++ b/platform/dbops/binaries/build/share/info/flex.info @@ -0,0 +1,281 @@ +This is flex.info, produced by makeinfo version 6.1 from flex.texi. + +The flex manual is placed under the same licensing conditions as the +rest of flex: + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 The Flex +Project. + + Copyright (C) 1990, 1997 The Regents of the University of California. +All rights reserved. + + This code is derived from software contributed to Berkeley by Vern +Paxson. + + The United States Government has rights in this work pursuant to +contract no. DE-AC03-76SF00098 between the United States Department of +Energy and the University of California. + + Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + + Neither the name of the University nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* flex: (flex). Fast lexical analyzer generator (lex replacement). +END-INFO-DIR-ENTRY + + +Indirect: +flex.info-1: 1622 +flex.info-2: 318745 + +Tag Table: +(Indirect) +Node: Top1622 +Node: Copyright9414 +Node: Reporting Bugs10933 +Node: Introduction11189 +Node: Simple Examples12018 +Node: Format15304 +Node: Definitions Section15759 +Ref: Definitions Section-Footnote-118017 +Node: Rules Section18085 +Node: User Code Section19243 +Node: Comments in the Input19681 +Node: Patterns21051 +Ref: case and character ranges27883 +Node: Matching31886 +Node: Actions35171 +Node: Generated Scanner44133 +Node: Start Conditions49136 +Node: Multiple Input Buffers59678 +Ref: Scanning Strings66221 +Node: EOF67850 +Node: Misc Macros69436 +Node: User Values72290 +Node: Yacc74615 +Node: Scanner Options75510 +Node: Options for Specifying Filenames78299 +Ref: option-header78525 +Ref: option-outfile79239 +Ref: option-stdout79564 +Node: Options Affecting Scanner Behavior80547 +Ref: option-case-insensitive80788 +Ref: option-lex-compat81221 +Ref: option-batch81753 +Ref: option-interactive82272 +Ref: option-7bit83626 +Ref: option-8bit84930 +Ref: option-default85342 +Ref: option-always-interactive85406 +Ref: option-posix86010 +Ref: option-stack87157 +Ref: option-stdinit87265 +Ref: option-yylineno87744 +Ref: option-yywrap88187 +Node: Code-Level And API Options88454 +Ref: option-ansi-definitions88681 +Ref: option-ansi-prototypes88756 +Ref: option-bison-bridge88829 +Ref: option-bison-locations89170 +Ref: option-noline89430 +Ref: option-reentrant89944 +Ref: option-c++90556 +Ref: option-array90682 +Ref: option-pointer90780 +Ref: option-prefix90907 +Ref: option-main92435 +Ref: option-nounistd92619 +Ref: option-yyclass93130 +Node: Options for Scanner Speed and Size93614 +Ref: option-align94164 +Ref: option-ecs94666 +Ref: option-meta-ecs95705 +Ref: option-read96193 +Ref: option-full98076 +Ref: option-fast98271 +Node: Debugging Options99195 +Ref: option-backup99382 +Ref: option-debug99927 +Ref: option-perf-report100649 +Ref: option-nodefault101275 +Ref: option-trace101593 +Ref: option-nowarn101884 +Ref: option-verbose101952 +Ref: option-warn102381 +Node: Miscellaneous Options102600 +Node: Performance103056 +Node: Cxx113303 +Node: Reentrant121395 +Node: Reentrant Uses122129 +Node: Reentrant Overview123691 +Node: Reentrant Example124491 +Node: Reentrant Detail125264 +Node: Specify Reentrant125768 +Node: Extra Reentrant Argument126418 +Node: Global Replacement127670 +Node: Init and Destroy Functions128905 +Node: Accessor Methods131426 +Node: Extra Data132773 +Node: About yyscan_t135040 +Node: Reentrant Functions135437 +Ref: bison-functions136921 +Node: Lex and Posix137660 +Node: Memory Management145007 +Ref: memory-management145153 +Node: The Default Memory Management145387 +Ref: The Default Memory Management-Footnote-1149207 +Node: Overriding The Default Memory Management149360 +Ref: Overriding The Default Memory Management-Footnote-1151774 +Node: A Note About yytext And Memory151938 +Node: Serialized Tables153178 +Ref: serialization153322 +Node: Creating Serialized Tables154102 +Node: Loading and Unloading Serialized Tables155717 +Node: Tables File Format157490 +Node: Diagnostics164515 +Node: Limitations167924 +Node: Bibliography169872 +Node: FAQ170542 +Node: When was flex born?175705 +Node: How do I expand backslash-escape sequences in C-style quoted strings?176082 +Node: Why do flex scanners call fileno if it is not ANSI compatible?177385 +Node: Does flex support recursive pattern definitions?178182 +Node: How do I skip huge chunks of input (tens of megabytes) while using flex?179029 +Node: Flex is not matching my patterns in the same order that I defined them.179496 +Node: My actions are executing out of order or sometimes not at all.181242 +Node: How can I have multiple input sources feed into the same scanner at the same time?182015 +Node: Can I build nested parsers that work with the same input file?184000 +Node: How can I match text only at the end of a file?185007 +Node: How can I make REJECT cascade across start condition boundaries?185811 +Node: Why cant I use fast or full tables with interactive mode?186825 +Node: How much faster is -F or -f than -C?188082 +Node: If I have a simple grammar cant I just parse it with flex?188394 +Node: Why doesn't yyrestart() set the start state back to INITIAL?188876 +Node: How can I match C-style comments?189503 +Node: The period isn't working the way I expected.190313 +Node: Can I get the flex manual in another format?191558 +Node: Does there exist a "faster" NDFA->DFA algorithm?192048 +Node: How does flex compile the DFA so quickly?192558 +Node: How can I use more than 8192 rules?193524 +Node: How do I abandon a file in the middle of a scan and switch to a new file?194934 +Node: How do I execute code only during initialization (only before the first scan)?195488 +Node: How do I execute code at termination?196265 +Node: Where else can I find help?196591 +Node: Can I include comments in the "rules" section of the file?196965 +Node: I get an error about undefined yywrap().197345 +Node: How can I change the matching pattern at run time?197821 +Node: How can I expand macros in the input?198183 +Node: How can I build a two-pass scanner?199215 +Node: How do I match any string not matched in the preceding rules?200133 +Node: I am trying to port code from AT&T lex that uses yysptr and yysbuf.201042 +Node: Is there a way to make flex treat NULL like a regular character?201837 +Node: Whenever flex can not match the input it says "flex scanner jammed".202357 +Node: Why doesn't flex have non-greedy operators like perl does?203000 +Node: Memory leak - 16386 bytes allocated by malloc.204353 +Ref: faq-memory-leak204651 +Node: How do I track the byte offset for lseek()?205622 +Node: How do I use my own I/O classes in a C++ scanner?207131 +Node: How do I skip as many chars as possible?207974 +Node: deleteme00209049 +Node: Are certain equivalent patterns faster than others?209489 +Node: Is backing up a big deal?212907 +Node: Can I fake multi-byte character support?214813 +Node: deleteme01216254 +Node: Can you discuss some flex internals?217363 +Node: unput() messes up yy_at_bol219607 +Node: The | operator is not doing what I want220709 +Node: Why can't flex understand this variable trailing context pattern?222255 +Node: The ^ operator isn't working223504 +Node: Trailing context is getting confused with trailing optional patterns224739 +Node: Is flex GNU or not?225982 +Node: ERASEME53227655 +Node: I need to scan if-then-else blocks and while loops228425 +Node: ERASEME55229624 +Node: ERASEME56230722 +Node: ERASEME57232080 +Node: Is there a repository for flex scanners?233078 +Node: How can I conditionally compile or preprocess my flex input file?233394 +Node: Where can I find grammars for lex and yacc?233867 +Node: I get an end-of-buffer message for each character scanned.234214 +Node: unnamed-faq-62234809 +Node: unnamed-faq-63235827 +Node: unnamed-faq-64237124 +Node: unnamed-faq-65238090 +Node: unnamed-faq-66238876 +Node: unnamed-faq-67239991 +Node: unnamed-faq-68240978 +Node: unnamed-faq-69242120 +Node: unnamed-faq-70242833 +Node: unnamed-faq-71243594 +Node: unnamed-faq-72244803 +Node: unnamed-faq-73245846 +Node: unnamed-faq-74246770 +Node: unnamed-faq-75247715 +Node: unnamed-faq-76248847 +Node: unnamed-faq-77249553 +Node: unnamed-faq-78250446 +Node: unnamed-faq-79251444 +Node: unnamed-faq-80253144 +Node: unnamed-faq-81254462 +Node: unnamed-faq-82257262 +Node: unnamed-faq-83258219 +Node: unnamed-faq-84259999 +Node: unnamed-faq-85261102 +Node: unnamed-faq-86262109 +Node: unnamed-faq-87263047 +Node: unnamed-faq-88263693 +Node: unnamed-faq-90264524 +Node: unnamed-faq-91265787 +Node: unnamed-faq-92268215 +Node: unnamed-faq-93268714 +Node: unnamed-faq-94269641 +Node: unnamed-faq-95271053 +Node: unnamed-faq-96272571 +Node: unnamed-faq-97273330 +Node: unnamed-faq-98273997 +Node: unnamed-faq-99274662 +Node: unnamed-faq-100275591 +Node: unnamed-faq-101276301 +Node: What is the difference between YYLEX_PARAM and YY_DECL?277114 +Node: Why do I get "conflicting types for yylex" error?277638 +Node: How do I access the values set in a Flex action from within a Bison action?278168 +Node: Appendices278597 +Node: Makefiles and Flex278862 +Ref: Makefiles and Flex-Footnote-1282064 +Ref: Makefiles and Flex-Footnote-2282181 +Ref: Makefiles and Flex-Footnote-3282368 +Node: Bison Bridge282419 +Ref: Bison Bridge-Footnote-1285086 +Node: M4 Dependency285278 +Ref: M4 Dependency-Footnote-1286692 +Node: Common Patterns286828 +Node: Numbers287151 +Node: Identifiers288127 +Node: Quoted Constructs288954 +Node: Addresses290008 +Node: Indices291320 +Node: Concept Index291612 +Node: Index of Functions and Macros318745 +Node: Index of Variables323714 +Node: Index of Data Types325380 +Node: Index of Hooks326268 +Node: Index of Scanner Options326836 + +End Tag Table diff --git a/platform/dbops/binaries/build/share/info/flex.info-1 b/platform/dbops/binaries/build/share/info/flex.info-1 new file mode 100644 index 0000000000000000000000000000000000000000..b79df5eda5998be8751038cc0a3ac0f828fd6004 --- /dev/null +++ b/platform/dbops/binaries/build/share/info/flex.info-1 @@ -0,0 +1,7791 @@ +This is flex.info, produced by makeinfo version 6.1 from flex.texi. + +The flex manual is placed under the same licensing conditions as the +rest of flex: + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 The Flex +Project. + + Copyright (C) 1990, 1997 The Regents of the University of California. +All rights reserved. + + This code is derived from software contributed to Berkeley by Vern +Paxson. + + The United States Government has rights in this work pursuant to +contract no. DE-AC03-76SF00098 between the United States Department of +Energy and the University of California. + + Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + + Neither the name of the University nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +INFO-DIR-SECTION Programming +START-INFO-DIR-ENTRY +* flex: (flex). Fast lexical analyzer generator (lex replacement). +END-INFO-DIR-ENTRY + + +File: flex.info, Node: Top, Next: Copyright, Prev: (dir), Up: (dir) + +flex +**** + +This manual describes 'flex', a tool for generating programs that +perform pattern-matching on text. The manual includes both tutorial and +reference sections. + + This edition of 'The flex Manual' documents 'flex' version 2.6.4. It +was last updated on 6 May 2017. + + This manual was written by Vern Paxson, Will Estes and John Millaway. + +* Menu: + +* Copyright:: +* Reporting Bugs:: +* Introduction:: +* Simple Examples:: +* Format:: +* Patterns:: +* Matching:: +* Actions:: +* Generated Scanner:: +* Start Conditions:: +* Multiple Input Buffers:: +* EOF:: +* Misc Macros:: +* User Values:: +* Yacc:: +* Scanner Options:: +* Performance:: +* Cxx:: +* Reentrant:: +* Lex and Posix:: +* Memory Management:: +* Serialized Tables:: +* Diagnostics:: +* Limitations:: +* Bibliography:: +* FAQ:: +* Appendices:: +* Indices:: + + -- The Detailed Node Listing -- + +Format of the Input File + +* Definitions Section:: +* Rules Section:: +* User Code Section:: +* Comments in the Input:: + +Scanner Options + +* Options for Specifying Filenames:: +* Options Affecting Scanner Behavior:: +* Code-Level And API Options:: +* Options for Scanner Speed and Size:: +* Debugging Options:: +* Miscellaneous Options:: + +Reentrant C Scanners + +* Reentrant Uses:: +* Reentrant Overview:: +* Reentrant Example:: +* Reentrant Detail:: +* Reentrant Functions:: + +The Reentrant API in Detail + +* Specify Reentrant:: +* Extra Reentrant Argument:: +* Global Replacement:: +* Init and Destroy Functions:: +* Accessor Methods:: +* Extra Data:: +* About yyscan_t:: + +Memory Management + +* The Default Memory Management:: +* Overriding The Default Memory Management:: +* A Note About yytext And Memory:: + +Serialized Tables + +* Creating Serialized Tables:: +* Loading and Unloading Serialized Tables:: +* Tables File Format:: + +FAQ + +* When was flex born?:: +* How do I expand backslash-escape sequences in C-style quoted strings?:: +* Why do flex scanners call fileno if it is not ANSI compatible?:: +* Does flex support recursive pattern definitions?:: +* How do I skip huge chunks of input (tens of megabytes) while using flex?:: +* Flex is not matching my patterns in the same order that I defined them.:: +* My actions are executing out of order or sometimes not at all.:: +* How can I have multiple input sources feed into the same scanner at the same time?:: +* Can I build nested parsers that work with the same input file?:: +* How can I match text only at the end of a file?:: +* How can I make REJECT cascade across start condition boundaries?:: +* Why cant I use fast or full tables with interactive mode?:: +* How much faster is -F or -f than -C?:: +* If I have a simple grammar cant I just parse it with flex?:: +* Why doesn't yyrestart() set the start state back to INITIAL?:: +* How can I match C-style comments?:: +* The period isn't working the way I expected.:: +* Can I get the flex manual in another format?:: +* Does there exist a "faster" NDFA->DFA algorithm?:: +* How does flex compile the DFA so quickly?:: +* How can I use more than 8192 rules?:: +* How do I abandon a file in the middle of a scan and switch to a new file?:: +* How do I execute code only during initialization (only before the first scan)?:: +* How do I execute code at termination?:: +* Where else can I find help?:: +* Can I include comments in the "rules" section of the file?:: +* I get an error about undefined yywrap().:: +* How can I change the matching pattern at run time?:: +* How can I expand macros in the input?:: +* How can I build a two-pass scanner?:: +* How do I match any string not matched in the preceding rules?:: +* I am trying to port code from AT&T lex that uses yysptr and yysbuf.:: +* Is there a way to make flex treat NULL like a regular character?:: +* Whenever flex can not match the input it says "flex scanner jammed".:: +* Why doesn't flex have non-greedy operators like perl does?:: +* Memory leak - 16386 bytes allocated by malloc.:: +* How do I track the byte offset for lseek()?:: +* How do I use my own I/O classes in a C++ scanner?:: +* How do I skip as many chars as possible?:: +* deleteme00:: +* Are certain equivalent patterns faster than others?:: +* Is backing up a big deal?:: +* Can I fake multi-byte character support?:: +* deleteme01:: +* Can you discuss some flex internals?:: +* unput() messes up yy_at_bol:: +* The | operator is not doing what I want:: +* Why can't flex understand this variable trailing context pattern?:: +* The ^ operator isn't working:: +* Trailing context is getting confused with trailing optional patterns:: +* Is flex GNU or not?:: +* ERASEME53:: +* I need to scan if-then-else blocks and while loops:: +* ERASEME55:: +* ERASEME56:: +* ERASEME57:: +* Is there a repository for flex scanners?:: +* How can I conditionally compile or preprocess my flex input file?:: +* Where can I find grammars for lex and yacc?:: +* I get an end-of-buffer message for each character scanned.:: +* unnamed-faq-62:: +* unnamed-faq-63:: +* unnamed-faq-64:: +* unnamed-faq-65:: +* unnamed-faq-66:: +* unnamed-faq-67:: +* unnamed-faq-68:: +* unnamed-faq-69:: +* unnamed-faq-70:: +* unnamed-faq-71:: +* unnamed-faq-72:: +* unnamed-faq-73:: +* unnamed-faq-74:: +* unnamed-faq-75:: +* unnamed-faq-76:: +* unnamed-faq-77:: +* unnamed-faq-78:: +* unnamed-faq-79:: +* unnamed-faq-80:: +* unnamed-faq-81:: +* unnamed-faq-82:: +* unnamed-faq-83:: +* unnamed-faq-84:: +* unnamed-faq-85:: +* unnamed-faq-86:: +* unnamed-faq-87:: +* unnamed-faq-88:: +* unnamed-faq-90:: +* unnamed-faq-91:: +* unnamed-faq-92:: +* unnamed-faq-93:: +* unnamed-faq-94:: +* unnamed-faq-95:: +* unnamed-faq-96:: +* unnamed-faq-97:: +* unnamed-faq-98:: +* unnamed-faq-99:: +* unnamed-faq-100:: +* unnamed-faq-101:: +* What is the difference between YYLEX_PARAM and YY_DECL?:: +* Why do I get "conflicting types for yylex" error?:: +* How do I access the values set in a Flex action from within a Bison action?:: + +Appendices + +* Makefiles and Flex:: +* Bison Bridge:: +* M4 Dependency:: +* Common Patterns:: + +Indices + +* Concept Index:: +* Index of Functions and Macros:: +* Index of Variables:: +* Index of Data Types:: +* Index of Hooks:: +* Index of Scanner Options:: + + + +File: flex.info, Node: Copyright, Next: Reporting Bugs, Prev: Top, Up: Top + +1 Copyright +*********** + +The flex manual is placed under the same licensing conditions as the +rest of flex: + + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 The Flex +Project. + + Copyright (C) 1990, 1997 The Regents of the University of California. +All rights reserved. + + This code is derived from software contributed to Berkeley by Vern +Paxson. + + The United States Government has rights in this work pursuant to +contract no. DE-AC03-76SF00098 between the United States Department of +Energy and the University of California. + + Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + + Neither the name of the University nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +File: flex.info, Node: Reporting Bugs, Next: Introduction, Prev: Copyright, Up: Top + +2 Reporting Bugs +**************** + +If you find a bug in 'flex', please report it using GitHub's issue +tracking facility at + + +File: flex.info, Node: Introduction, Next: Simple Examples, Prev: Reporting Bugs, Up: Top + +3 Introduction +************** + +'flex' is a tool for generating "scanners". A scanner is a program +which recognizes lexical patterns in text. The 'flex' program reads the +given input files, or its standard input if no file names are given, for +a description of a scanner to generate. The description is in the form +of pairs of regular expressions and C code, called "rules". 'flex' +generates as output a C source file, 'lex.yy.c' by default, which +defines a routine 'yylex()'. This file can be compiled and linked with +the flex runtime library to produce an executable. When the executable +is run, it analyzes its input for occurrences of the regular +expressions. Whenever it finds one, it executes the corresponding C +code. + + +File: flex.info, Node: Simple Examples, Next: Format, Prev: Introduction, Up: Top + +4 Some Simple Examples +********************** + +First some simple examples to get the flavor of how one uses 'flex'. + + The following 'flex' input specifies a scanner which, when it +encounters the string 'username' will replace it with the user's login +name: + + %% + username printf( "%s", getlogin() ); + + By default, any text not matched by a 'flex' scanner is copied to the +output, so the net effect of this scanner is to copy its input file to +its output with each occurrence of 'username' expanded. In this input, +there is just one rule. 'username' is the "pattern" and the 'printf' is +the "action". The '%%' symbol marks the beginning of the rules. + + Here's another simple example: + + int num_lines = 0, num_chars = 0; + + %% + \n ++num_lines; ++num_chars; + . ++num_chars; + + %% + + int main() + { + yylex(); + printf( "# of lines = %d, # of chars = %d\n", + num_lines, num_chars ); + } + + This scanner counts the number of characters and the number of lines +in its input. It produces no output other than the final report on the +character and line counts. The first line declares two globals, +'num_lines' and 'num_chars', which are accessible both inside 'yylex()' +and in the 'main()' routine declared after the second '%%'. There are +two rules, one which matches a newline ('\n') and increments both the +line count and the character count, and one which matches any character +other than a newline (indicated by the '.' regular expression). + + A somewhat more complicated example: + + /* scanner for a toy Pascal-like language */ + + %{ + /* need this for the call to atof() below */ + #include + %} + + DIGIT [0-9] + ID [a-z][a-z0-9]* + + %% + + {DIGIT}+ { + printf( "An integer: %s (%d)\n", yytext, + atoi( yytext ) ); + } + + {DIGIT}+"."{DIGIT}* { + printf( "A float: %s (%g)\n", yytext, + atof( yytext ) ); + } + + if|then|begin|end|procedure|function { + printf( "A keyword: %s\n", yytext ); + } + + {ID} printf( "An identifier: %s\n", yytext ); + + "+"|"-"|"*"|"/" printf( "An operator: %s\n", yytext ); + + "{"[^{}\n]*"}" /* eat up one-line comments */ + + [ \t\n]+ /* eat up whitespace */ + + . printf( "Unrecognized character: %s\n", yytext ); + + %% + + int main( int argc, char **argv ) + { + ++argv, --argc; /* skip over program name */ + if ( argc > 0 ) + yyin = fopen( argv[0], "r" ); + else + yyin = stdin; + + yylex(); + } + + This is the beginnings of a simple scanner for a language like +Pascal. It identifies different types of "tokens" and reports on what +it has seen. + + The details of this example will be explained in the following +sections. + + +File: flex.info, Node: Format, Next: Patterns, Prev: Simple Examples, Up: Top + +5 Format of the Input File +************************** + +The 'flex' input file consists of three sections, separated by a line +containing only '%%'. + + definitions + %% + rules + %% + user code + +* Menu: + +* Definitions Section:: +* Rules Section:: +* User Code Section:: +* Comments in the Input:: + + +File: flex.info, Node: Definitions Section, Next: Rules Section, Prev: Format, Up: Format + +5.1 Format of the Definitions Section +===================================== + +The "definitions section" contains declarations of simple "name" +definitions to simplify the scanner specification, and declarations of +"start conditions", which are explained in a later section. + + Name definitions have the form: + + name definition + + The 'name' is a word beginning with a letter or an underscore ('_') +followed by zero or more letters, digits, '_', or '-' (dash). The +definition is taken to begin at the first non-whitespace character +following the name and continuing to the end of the line. The +definition can subsequently be referred to using '{name}', which will +expand to '(definition)'. For example, + + DIGIT [0-9] + ID [a-z][a-z0-9]* + + Defines 'DIGIT' to be a regular expression which matches a single +digit, and 'ID' to be a regular expression which matches a letter +followed by zero-or-more letters-or-digits. A subsequent reference to + + {DIGIT}+"."{DIGIT}* + + is identical to + + ([0-9])+"."([0-9])* + + and matches one-or-more digits followed by a '.' followed by +zero-or-more digits. + + An unindented comment (i.e., a line beginning with '/*') is copied +verbatim to the output up to the next '*/'. + + Any _indented_ text or text enclosed in '%{' and '%}' is also copied +verbatim to the output (with the %{ and %} symbols removed). The %{ and +%} symbols must appear unindented on lines by themselves. + + A '%top' block is similar to a '%{' ... '%}' block, except that the +code in a '%top' block is relocated to the _top_ of the generated file, +before any flex definitions (1). The '%top' block is useful when you +want certain preprocessor macros to be defined or certain files to be +included before the generated code. The single characters, '{' and '}' +are used to delimit the '%top' block, as show in the example below: + + %top{ + /* This code goes at the "top" of the generated file. */ + #include + #include + } + + Multiple '%top' blocks are allowed, and their order is preserved. + + ---------- Footnotes ---------- + + (1) Actually, 'yyIN_HEADER' is defined before the '%top' block. + + +File: flex.info, Node: Rules Section, Next: User Code Section, Prev: Definitions Section, Up: Format + +5.2 Format of the Rules Section +=============================== + +The "rules" section of the 'flex' input contains a series of rules of +the form: + + pattern action + + where the pattern must be unindented and the action must begin on the +same line. *Note Patterns::, for a further description of patterns and +actions. + + In the rules section, any indented or %{ %} enclosed text appearing +before the first rule may be used to declare variables which are local +to the scanning routine and (after the declarations) code which is to be +executed whenever the scanning routine is entered. Other indented or %{ +%} text in the rule section is still copied to the output, but its +meaning is not well-defined and it may well cause compile-time errors +(this feature is present for POSIX compliance. *Note Lex and Posix::, +for other such features). + + Any _indented_ text or text enclosed in '%{' and '%}' is copied +verbatim to the output (with the %{ and %} symbols removed). The %{ and +%} symbols must appear unindented on lines by themselves. + + +File: flex.info, Node: User Code Section, Next: Comments in the Input, Prev: Rules Section, Up: Format + +5.3 Format of the User Code Section +=================================== + +The user code section is simply copied to 'lex.yy.c' verbatim. It is +used for companion routines which call or are called by the scanner. +The presence of this section is optional; if it is missing, the second +'%%' in the input file may be skipped, too. + + +File: flex.info, Node: Comments in the Input, Prev: User Code Section, Up: Format + +5.4 Comments in the Input +========================= + +Flex supports C-style comments, that is, anything between '/*' and '*/' +is considered a comment. Whenever flex encounters a comment, it copies +the entire comment verbatim to the generated source code. Comments may +appear just about anywhere, but with the following exceptions: + + * Comments may not appear in the Rules Section wherever flex is + expecting a regular expression. This means comments may not appear + at the beginning of a line, or immediately following a list of + scanner states. + * Comments may not appear on an '%option' line in the Definitions + Section. + + If you want to follow a simple rule, then always begin a comment on a +new line, with one or more whitespace characters before the initial +'/*'). This rule will work anywhere in the input file. + + All the comments in the following example are valid: + + %{ + /* code block */ + %} + + /* Definitions Section */ + %x STATE_X + + %% + /* Rules Section */ + ruleA /* after regex */ { /* code block */ } /* after code block */ + /* Rules Section (indented) */ + { + ruleC ECHO; + ruleD ECHO; + %{ + /* code block */ + %} + } + %% + /* User Code Section */ + + + +File: flex.info, Node: Patterns, Next: Matching, Prev: Format, Up: Top + +6 Patterns +********** + +The patterns in the input (see *note Rules Section::) are written using +an extended set of regular expressions. These are: + +'x' + match the character 'x' + +'.' + any character (byte) except newline + +'[xyz]' + a "character class"; in this case, the pattern matches either an + 'x', a 'y', or a 'z' + +'[abj-oZ]' + a "character class" with a range in it; matches an 'a', a 'b', any + letter from 'j' through 'o', or a 'Z' + +'[^A-Z]' + a "negated character class", i.e., any character but those in the + class. In this case, any character EXCEPT an uppercase letter. + +'[^A-Z\n]' + any character EXCEPT an uppercase letter or a newline + +'[a-z]{-}[aeiou]' + the lowercase consonants + +'r*' + zero or more r's, where r is any regular expression + +'r+' + one or more r's + +'r?' + zero or one r's (that is, "an optional r") + +'r{2,5}' + anywhere from two to five r's + +'r{2,}' + two or more r's + +'r{4}' + exactly 4 r's + +'{name}' + the expansion of the 'name' definition (*note Format::). + +'"[xyz]\"foo"' + the literal string: '[xyz]"foo' + +'\X' + if X is 'a', 'b', 'f', 'n', 'r', 't', or 'v', then the ANSI-C + interpretation of '\x'. Otherwise, a literal 'X' (used to escape + operators such as '*') + +'\0' + a NUL character (ASCII code 0) + +'\123' + the character with octal value 123 + +'\x2a' + the character with hexadecimal value 2a + +'(r)' + match an 'r'; parentheses are used to override precedence (see + below) + +'(?r-s:pattern)' + apply option 'r' and omit option 's' while interpreting pattern. + Options may be zero or more of the characters 'i', 's', or 'x'. + + 'i' means case-insensitive. '-i' means case-sensitive. + + 's' alters the meaning of the '.' syntax to match any single byte + whatsoever. '-s' alters the meaning of '.' to match any byte + except '\n'. + + 'x' ignores comments and whitespace in patterns. Whitespace is + ignored unless it is backslash-escaped, contained within '""'s, or + appears inside a character class. + + The following are all valid: + + (?:foo) same as (foo) + (?i:ab7) same as ([aA][bB]7) + (?-i:ab) same as (ab) + (?s:.) same as [\x00-\xFF] + (?-s:.) same as [^\n] + (?ix-s: a . b) same as ([Aa][^\n][bB]) + (?x:a b) same as ("ab") + (?x:a\ b) same as ("a b") + (?x:a" "b) same as ("a b") + (?x:a[ ]b) same as ("a b") + (?x:a + /* comment */ + b + c) same as (abc) + +'(?# comment )' + omit everything within '()'. The first ')' character encountered + ends the pattern. It is not possible to for the comment to contain + a ')' character. The comment may span lines. + +'rs' + the regular expression 'r' followed by the regular expression 's'; + called "concatenation" + +'r|s' + either an 'r' or an 's' + +'r/s' + an 'r' but only if it is followed by an 's'. The text matched by + 's' is included when determining whether this rule is the longest + match, but is then returned to the input before the action is + executed. So the action only sees the text matched by 'r'. This + type of pattern is called "trailing context". (There are some + combinations of 'r/s' that flex cannot match correctly. *Note + Limitations::, regarding dangerous trailing context.) + +'^r' + an 'r', but only at the beginning of a line (i.e., when just + starting to scan, or right after a newline has been scanned). + +'r$' + an 'r', but only at the end of a line (i.e., just before a + newline). Equivalent to 'r/\n'. + + Note that 'flex''s notion of "newline" is exactly whatever the C + compiler used to compile 'flex' interprets '\n' as; in particular, + on some DOS systems you must either filter out '\r's in the input + yourself, or explicitly use 'r/\r\n' for 'r$'. + +'r' + an 'r', but only in start condition 's' (see *note Start + Conditions:: for discussion of start conditions). + +'r' + same, but in any of start conditions 's1', 's2', or 's3'. + +'<*>r' + an 'r' in any start condition, even an exclusive one. + +'<>' + an end-of-file. + +'<>' + an end-of-file when in start condition 's1' or 's2' + + Note that inside of a character class, all regular expression +operators lose their special meaning except escape ('\') and the +character class operators, '-', ']]', and, at the beginning of the +class, '^'. + + The regular expressions listed above are grouped according to +precedence, from highest precedence at the top to lowest at the bottom. +Those grouped together have equal precedence (see special note on the +precedence of the repeat operator, '{}', under the documentation for the +'--posix' POSIX compliance option). For example, + + foo|bar* + + is the same as + + (foo)|(ba(r*)) + + since the '*' operator has higher precedence than concatenation, and +concatenation higher than alternation ('|'). This pattern therefore +matches _either_ the string 'foo' _or_ the string 'ba' followed by +zero-or-more 'r''s. To match 'foo' or zero-or-more repetitions of the +string 'bar', use: + + foo|(bar)* + + And to match a sequence of zero or more repetitions of 'foo' and +'bar': + + (foo|bar)* + + In addition to characters and ranges of characters, character classes +can also contain "character class expressions". These are expressions +enclosed inside '[:' and ':]' delimiters (which themselves must appear +between the '[' and ']' of the character class. Other elements may +occur inside the character class, too). The valid expressions are: + + [:alnum:] [:alpha:] [:blank:] + [:cntrl:] [:digit:] [:graph:] + [:lower:] [:print:] [:punct:] + [:space:] [:upper:] [:xdigit:] + + These expressions all designate a set of characters equivalent to the +corresponding standard C 'isXXX' function. For example, '[:alnum:]' +designates those characters for which 'isalnum()' returns true - i.e., +any alphabetic or numeric character. Some systems don't provide +'isblank()', so flex defines '[:blank:]' as a blank or a tab. + + For example, the following character classes are all equivalent: + + [[:alnum:]] + [[:alpha:][:digit:]] + [[:alpha:][0-9]] + [a-zA-Z0-9] + + A word of caution. Character classes are expanded immediately when +seen in the 'flex' input. This means the character classes are +sensitive to the locale in which 'flex' is executed, and the resulting +scanner will not be sensitive to the runtime locale. This may or may +not be desirable. + + * If your scanner is case-insensitive (the '-i' flag), then + '[:upper:]' and '[:lower:]' are equivalent to '[:alpha:]'. + + * Character classes with ranges, such as '[a-Z]', should be used with + caution in a case-insensitive scanner if the range spans upper or + lowercase characters. Flex does not know if you want to fold all + upper and lowercase characters together, or if you want the literal + numeric range specified (with no case folding). When in doubt, + flex will assume that you meant the literal numeric range, and will + issue a warning. The exception to this rule is a character range + such as '[a-z]' or '[S-W]' where it is obvious that you want + case-folding to occur. Here are some examples with the '-i' flag + enabled: + + Range Result Literal Range Alternate Range + '[a-t]' ok '[a-tA-T]' + '[A-T]' ok '[a-tA-T]' + '[A-t]' ambiguous '[A-Z\[\\\]_`a-t]' '[a-tA-T]' + '[_-{]' ambiguous '[_`a-z{]' '[_`a-zA-Z{]' + '[@-C]' ambiguous '[@ABC]' '[@A-Z\[\\\]_`abc]' + + * A negated character class such as the example '[^A-Z]' above _will_ + match a newline unless '\n' (or an equivalent escape sequence) is + one of the characters explicitly present in the negated character + class (e.g., '[^A-Z\n]'). This is unlike how many other regular + expression tools treat negated character classes, but unfortunately + the inconsistency is historically entrenched. Matching newlines + means that a pattern like '[^"]*' can match the entire input unless + there's another quote in the input. + + Flex allows negation of character class expressions by prepending + '^' to the POSIX character class name. + + [:^alnum:] [:^alpha:] [:^blank:] + [:^cntrl:] [:^digit:] [:^graph:] + [:^lower:] [:^print:] [:^punct:] + [:^space:] [:^upper:] [:^xdigit:] + + Flex will issue a warning if the expressions '[:^upper:]' and + '[:^lower:]' appear in a case-insensitive scanner, since their + meaning is unclear. The current behavior is to skip them entirely, + but this may change without notice in future revisions of flex. + + * + The '{-}' operator computes the difference of two character + classes. For example, '[a-c]{-}[b-z]' represents all the + characters in the class '[a-c]' that are not in the class '[b-z]' + (which in this case, is just the single character 'a'). The '{-}' + operator is left associative, so '[abc]{-}[b]{-}[c]' is the same as + '[a]'. Be careful not to accidentally create an empty set, which + will never match. + + * + The '{+}' operator computes the union of two character classes. + For example, '[a-z]{+}[0-9]' is the same as '[a-z0-9]'. This + operator is useful when preceded by the result of a difference + operation, as in, '[[:alpha:]]{-}[[:lower:]]{+}[q]', which is + equivalent to '[A-Zq]' in the "C" locale. + + * A rule can have at most one instance of trailing context (the '/' + operator or the '$' operator). The start condition, '^', and + '<>' patterns can only occur at the beginning of a pattern, + and, as well as with '/' and '$', cannot be grouped inside + parentheses. A '^' which does not occur at the beginning of a rule + or a '$' which does not occur at the end of a rule loses its + special properties and is treated as a normal character. + + * The following are invalid: + + foo/bar$ + foobar + + Note that the first of these can be written 'foo/bar\n'. + + * The following will result in '$' or '^' being treated as a normal + character: + + foo|(bar$) + foo|^bar + + If the desired meaning is a 'foo' or a 'bar'-followed-by-a-newline, + the following could be used (the special '|' action is explained + below, *note Actions::): + + foo | + bar$ /* action goes here */ + + A similar trick will work for matching a 'foo' or a + 'bar'-at-the-beginning-of-a-line. + + +File: flex.info, Node: Matching, Next: Actions, Prev: Patterns, Up: Top + +7 How the Input Is Matched +************************** + +When the generated scanner is run, it analyzes its input looking for +strings which match any of its patterns. If it finds more than one +match, it takes the one matching the most text (for trailing context +rules, this includes the length of the trailing part, even though it +will then be returned to the input). If it finds two or more matches of +the same length, the rule listed first in the 'flex' input file is +chosen. + + Once the match is determined, the text corresponding to the match +(called the "token") is made available in the global character pointer +'yytext', and its length in the global integer 'yyleng'. The "action" +corresponding to the matched pattern is then executed (*note Actions::), +and then the remaining input is scanned for another match. + + If no match is found, then the "default rule" is executed: the next +character in the input is considered matched and copied to the standard +output. Thus, the simplest valid 'flex' input is: + + %% + + which generates a scanner that simply copies its input (one character +at a time) to its output. + + Note that 'yytext' can be defined in two different ways: either as a +character _pointer_ or as a character _array_. You can control which +definition 'flex' uses by including one of the special directives +'%pointer' or '%array' in the first (definitions) section of your flex +input. The default is '%pointer', unless you use the '-l' lex +compatibility option, in which case 'yytext' will be an array. The +advantage of using '%pointer' is substantially faster scanning and no +buffer overflow when matching very large tokens (unless you run out of +dynamic memory). The disadvantage is that you are restricted in how +your actions can modify 'yytext' (*note Actions::), and calls to the +'unput()' function destroys the present contents of 'yytext', which can +be a considerable porting headache when moving between different 'lex' +versions. + + The advantage of '%array' is that you can then modify 'yytext' to +your heart's content, and calls to 'unput()' do not destroy 'yytext' +(*note Actions::). Furthermore, existing 'lex' programs sometimes +access 'yytext' externally using declarations of the form: + + extern char yytext[]; + + This definition is erroneous when used with '%pointer', but correct +for '%array'. + + The '%array' declaration defines 'yytext' to be an array of 'YYLMAX' +characters, which defaults to a fairly large value. You can change the +size by simply #define'ing 'YYLMAX' to a different value in the first +section of your 'flex' input. As mentioned above, with '%pointer' +yytext grows dynamically to accommodate large tokens. While this means +your '%pointer' scanner can accommodate very large tokens (such as +matching entire blocks of comments), bear in mind that each time the +scanner must resize 'yytext' it also must rescan the entire token from +the beginning, so matching such tokens can prove slow. 'yytext' +presently does _not_ dynamically grow if a call to 'unput()' results in +too much text being pushed back; instead, a run-time error results. + + Also note that you cannot use '%array' with C++ scanner classes +(*note Cxx::). + + +File: flex.info, Node: Actions, Next: Generated Scanner, Prev: Matching, Up: Top + +8 Actions +********* + +Each pattern in a rule has a corresponding "action", which can be any +arbitrary C statement. The pattern ends at the first non-escaped +whitespace character; the remainder of the line is its action. If the +action is empty, then when the pattern is matched the input token is +simply discarded. For example, here is the specification for a program +which deletes all occurrences of 'zap me' from its input: + + %% + "zap me" + + This example will copy all other characters in the input to the +output since they will be matched by the default rule. + + Here is a program which compresses multiple blanks and tabs down to a +single blank, and throws away whitespace found at the end of a line: + + %% + [ \t]+ putchar( ' ' ); + [ \t]+$ /* ignore this token */ + + If the action contains a '{', then the action spans till the +balancing '}' is found, and the action may cross multiple lines. 'flex' +knows about C strings and comments and won't be fooled by braces found +within them, but also allows actions to begin with '%{' and will +consider the action to be all the text up to the next '%}' (regardless +of ordinary braces inside the action). + + An action consisting solely of a vertical bar ('|') means "same as +the action for the next rule". See below for an illustration. + + Actions can include arbitrary C code, including 'return' statements +to return a value to whatever routine called 'yylex()'. Each time +'yylex()' is called it continues processing tokens from where it last +left off until it either reaches the end of the file or executes a +return. + + Actions are free to modify 'yytext' except for lengthening it (adding +characters to its end-these will overwrite later characters in the input +stream). This however does not apply when using '%array' (*note +Matching::). In that case, 'yytext' may be freely modified in any way. + + Actions are free to modify 'yyleng' except they should not do so if +the action also includes use of 'yymore()' (see below). + + There are a number of special directives which can be included within +an action: + +'ECHO' + copies yytext to the scanner's output. + +'BEGIN' + followed by the name of a start condition places the scanner in the + corresponding start condition (see below). + +'REJECT' + directs the scanner to proceed on to the "second best" rule which + matched the input (or a prefix of the input). The rule is chosen + as described above in *note Matching::, and 'yytext' and 'yyleng' + set up appropriately. It may either be one which matched as much + text as the originally chosen rule but came later in the 'flex' + input file, or one which matched less text. For example, the + following will both count the words in the input and call the + routine 'special()' whenever 'frob' is seen: + + int word_count = 0; + %% + + frob special(); REJECT; + [^ \t\n]+ ++word_count; + + Without the 'REJECT', any occurrences of 'frob' in the input would + not be counted as words, since the scanner normally executes only + one action per token. Multiple uses of 'REJECT' are allowed, each + one finding the next best choice to the currently active rule. For + example, when the following scanner scans the token 'abcd', it will + write 'abcdabcaba' to the output: + + %% + a | + ab | + abc | + abcd ECHO; REJECT; + .|\n /* eat up any unmatched character */ + + The first three rules share the fourth's action since they use the + special '|' action. + + 'REJECT' is a particularly expensive feature in terms of scanner + performance; if it is used in _any_ of the scanner's actions it + will slow down _all_ of the scanner's matching. Furthermore, + 'REJECT' cannot be used with the '-Cf' or '-CF' options (*note + Scanner Options::). + + Note also that unlike the other special actions, 'REJECT' is a + _branch_. Code immediately following it in the action will _not_ + be executed. + +'yymore()' + tells the scanner that the next time it matches a rule, the + corresponding token should be _appended_ onto the current value of + 'yytext' rather than replacing it. For example, given the input + 'mega-kludge' the following will write 'mega-mega-kludge' to the + output: + + %% + mega- ECHO; yymore(); + kludge ECHO; + + First 'mega-' is matched and echoed to the output. Then 'kludge' + is matched, but the previous 'mega-' is still hanging around at the + beginning of 'yytext' so the 'ECHO' for the 'kludge' rule will + actually write 'mega-kludge'. + + Two notes regarding use of 'yymore()'. First, 'yymore()' depends on +the value of 'yyleng' correctly reflecting the size of the current +token, so you must not modify 'yyleng' if you are using 'yymore()'. +Second, the presence of 'yymore()' in the scanner's action entails a +minor performance penalty in the scanner's matching speed. + + 'yyless(n)' returns all but the first 'n' characters of the current +token back to the input stream, where they will be rescanned when the +scanner looks for the next match. 'yytext' and 'yyleng' are adjusted +appropriately (e.g., 'yyleng' will now be equal to 'n'). For example, +on the input 'foobar' the following will write out 'foobarbar': + + %% + foobar ECHO; yyless(3); + [a-z]+ ECHO; + + An argument of 0 to 'yyless()' will cause the entire current input +string to be scanned again. Unless you've changed how the scanner will +subsequently process its input (using 'BEGIN', for example), this will +result in an endless loop. + + Note that 'yyless()' is a macro and can only be used in the flex +input file, not from other source files. + + 'unput(c)' puts the character 'c' back onto the input stream. It +will be the next character scanned. The following action will take the +current token and cause it to be rescanned enclosed in parentheses. + + { + int i; + /* Copy yytext because unput() trashes yytext */ + char *yycopy = strdup( yytext ); + unput( ')' ); + for ( i = yyleng - 1; i >= 0; --i ) + unput( yycopy[i] ); + unput( '(' ); + free( yycopy ); + } + + Note that since each 'unput()' puts the given character back at the +_beginning_ of the input stream, pushing back strings must be done +back-to-front. + + An important potential problem when using 'unput()' is that if you +are using '%pointer' (the default), a call to 'unput()' _destroys_ the +contents of 'yytext', starting with its rightmost character and +devouring one character to the left with each call. If you need the +value of 'yytext' preserved after a call to 'unput()' (as in the above +example), you must either first copy it elsewhere, or build your scanner +using '%array' instead (*note Matching::). + + Finally, note that you cannot put back 'EOF' to attempt to mark the +input stream with an end-of-file. + + 'input()' reads the next character from the input stream. For +example, the following is one way to eat up C comments: + + %% + "/*" { + int c; + + for ( ; ; ) + { + while ( (c = input()) != '*' && + c != EOF ) + ; /* eat up text of comment */ + + if ( c == '*' ) + { + while ( (c = input()) == '*' ) + ; + if ( c == '/' ) + break; /* found the end */ + } + + if ( c == EOF ) + { + error( "EOF in comment" ); + break; + } + } + } + + (Note that if the scanner is compiled using 'C++', then 'input()' is +instead referred to as yyinput(), in order to avoid a name clash with +the 'C++' stream by the name of 'input'.) + + 'YY_FLUSH_BUFFER;' flushes the scanner's internal buffer so that the +next time the scanner attempts to match a token, it will first refill +the buffer using 'YY_INPUT()' (*note Generated Scanner::). This action +is a special case of the more general 'yy_flush_buffer;' function, +described below (*note Multiple Input Buffers::) + + 'yyterminate()' can be used in lieu of a return statement in an +action. It terminates the scanner and returns a 0 to the scanner's +caller, indicating "all done". By default, 'yyterminate()' is also +called when an end-of-file is encountered. It is a macro and may be +redefined. + + +File: flex.info, Node: Generated Scanner, Next: Start Conditions, Prev: Actions, Up: Top + +9 The Generated Scanner +*********************** + +The output of 'flex' is the file 'lex.yy.c', which contains the scanning +routine 'yylex()', a number of tables used by it for matching tokens, +and a number of auxiliary routines and macros. By default, 'yylex()' is +declared as follows: + + int yylex() + { + ... various definitions and the actions in here ... + } + + (If your environment supports function prototypes, then it will be +'int yylex( void )'.) This definition may be changed by defining the +'YY_DECL' macro. For example, you could use: + + #define YY_DECL float lexscan( a, b ) float a, b; + + to give the scanning routine the name 'lexscan', returning a float, +and taking two floats as arguments. Note that if you give arguments to +the scanning routine using a K&R-style/non-prototyped function +declaration, you must terminate the definition with a semi-colon (;). + + 'flex' generates 'C99' function definitions by default. Flex used to +have the ability to generate obsolete, er, 'traditional', function +definitions. This was to support bootstrapping gcc on old systems. +Unfortunately, traditional definitions prevent us from using any +standard data types smaller than int (such as short, char, or bool) as +function arguments. Furthermore, traditional definitions support added +extra complexity in the skeleton file. For this reason, current +versions of 'flex' generate standard C99 code only, leaving K&R-style +functions to the historians. + + Whenever 'yylex()' is called, it scans tokens from the global input +file 'yyin' (which defaults to stdin). It continues until it either +reaches an end-of-file (at which point it returns the value 0) or one of +its actions executes a 'return' statement. + + If the scanner reaches an end-of-file, subsequent calls are undefined +unless either 'yyin' is pointed at a new input file (in which case +scanning continues from that file), or 'yyrestart()' is called. +'yyrestart()' takes one argument, a 'FILE *' pointer (which can be NULL, +if you've set up 'YY_INPUT' to scan from a source other than 'yyin'), +and initializes 'yyin' for scanning from that file. Essentially there +is no difference between just assigning 'yyin' to a new input file or +using 'yyrestart()' to do so; the latter is available for compatibility +with previous versions of 'flex', and because it can be used to switch +input files in the middle of scanning. It can also be used to throw +away the current input buffer, by calling it with an argument of 'yyin'; +but it would be better to use 'YY_FLUSH_BUFFER' (*note Actions::). Note +that 'yyrestart()' does _not_ reset the start condition to 'INITIAL' +(*note Start Conditions::). + + If 'yylex()' stops scanning due to executing a 'return' statement in +one of the actions, the scanner may then be called again and it will +resume scanning where it left off. + + By default (and for purposes of efficiency), the scanner uses +block-reads rather than simple 'getc()' calls to read characters from +'yyin'. The nature of how it gets its input can be controlled by +defining the 'YY_INPUT' macro. The calling sequence for 'YY_INPUT()' is +'YY_INPUT(buf,result,max_size)'. Its action is to place up to +'max_size' characters in the character array 'buf' and return in the +integer variable 'result' either the number of characters read or the +constant 'YY_NULL' (0 on Unix systems) to indicate 'EOF'. The default +'YY_INPUT' reads from the global file-pointer 'yyin'. + + Here is a sample definition of 'YY_INPUT' (in the definitions section +of the input file): + + %{ + #define YY_INPUT(buf,result,max_size) \ + { \ + int c = getchar(); \ + result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ + } + %} + + This definition will change the input processing to occur one +character at a time. + + When the scanner receives an end-of-file indication from YY_INPUT, it +then checks the 'yywrap()' function. If 'yywrap()' returns false +(zero), then it is assumed that the function has gone ahead and set up +'yyin' to point to another input file, and scanning continues. If it +returns true (non-zero), then the scanner terminates, returning 0 to its +caller. Note that in either case, the start condition remains +unchanged; it does _not_ revert to 'INITIAL'. + + If you do not supply your own version of 'yywrap()', then you must +either use '%option noyywrap' (in which case the scanner behaves as +though 'yywrap()' returned 1), or you must link with '-lfl' to obtain +the default version of the routine, which always returns 1. + + For scanning from in-memory buffers (e.g., scanning strings), see +*note Scanning Strings::. *Note Multiple Input Buffers::. + + The scanner writes its 'ECHO' output to the 'yyout' global (default, +'stdout'), which may be redefined by the user simply by assigning it to +some other 'FILE' pointer. + + +File: flex.info, Node: Start Conditions, Next: Multiple Input Buffers, Prev: Generated Scanner, Up: Top + +10 Start Conditions +******************* + +'flex' provides a mechanism for conditionally activating rules. Any +rule whose pattern is prefixed with '' will only be active when the +scanner is in the "start condition" named 'sc'. For example, + + [^"]* { /* eat up the string body ... */ + ... + } + + will be active only when the scanner is in the 'STRING' start +condition, and + + \. { /* handle an escape ... */ + ... + } + + will be active only when the current start condition is either +'INITIAL', 'STRING', or 'QUOTE'. + + Start conditions are declared in the definitions (first) section of +the input using unindented lines beginning with either '%s' or '%x' +followed by a list of names. The former declares "inclusive" start +conditions, the latter "exclusive" start conditions. A start condition +is activated using the 'BEGIN' action. Until the next 'BEGIN' action is +executed, rules with the given start condition will be active and rules +with other start conditions will be inactive. If the start condition is +inclusive, then rules with no start conditions at all will also be +active. If it is exclusive, then _only_ rules qualified with the start +condition will be active. A set of rules contingent on the same +exclusive start condition describe a scanner which is independent of any +of the other rules in the 'flex' input. Because of this, exclusive +start conditions make it easy to specify "mini-scanners" which scan +portions of the input that are syntactically different from the rest +(e.g., comments). + + If the distinction between inclusive and exclusive start conditions +is still a little vague, here's a simple example illustrating the +connection between the two. The set of rules: + + %s example + %% + + foo do_something(); + + bar something_else(); + + is equivalent to + + %x example + %% + + foo do_something(); + + bar something_else(); + + Without the '' qualifier, the 'bar' pattern in the +second example wouldn't be active (i.e., couldn't match) when in start +condition 'example'. If we just used '' to qualify 'bar', +though, then it would only be active in 'example' and not in 'INITIAL', +while in the first example it's active in both, because in the first +example the 'example' start condition is an inclusive '(%s)' start +condition. + + Also note that the special start-condition specifier '<*>' matches +every start condition. Thus, the above example could also have been +written: + + %x example + %% + + foo do_something(); + + <*>bar something_else(); + + The default rule (to 'ECHO' any unmatched character) remains active +in start conditions. It is equivalent to: + + <*>.|\n ECHO; + + 'BEGIN(0)' returns to the original state where only the rules with no +start conditions are active. This state can also be referred to as the +start-condition 'INITIAL', so 'BEGIN(INITIAL)' is equivalent to +'BEGIN(0)'. (The parentheses around the start condition name are not +required but are considered good style.) + + 'BEGIN' actions can also be given as indented code at the beginning +of the rules section. For example, the following will cause the scanner +to enter the 'SPECIAL' start condition whenever 'yylex()' is called and +the global variable 'enter_special' is true: + + int enter_special; + + %x SPECIAL + %% + if ( enter_special ) + BEGIN(SPECIAL); + + blahblahblah + ...more rules follow... + + To illustrate the uses of start conditions, here is a scanner which +provides two different interpretations of a string like '123.456'. By +default it will treat it as three tokens, the integer '123', a dot +('.'), and the integer '456'. But if the string is preceded earlier in +the line by the string 'expect-floats' it will treat it as a single +token, the floating-point number '123.456': + + %{ + #include + %} + %s expect + + %% + expect-floats BEGIN(expect); + + [0-9]+.[0-9]+ { + printf( "found a float, = %f\n", + atof( yytext ) ); + } + \n { + /* that's the end of the line, so + * we need another "expect-number" + * before we'll recognize any more + * numbers + */ + BEGIN(INITIAL); + } + + [0-9]+ { + printf( "found an integer, = %d\n", + atoi( yytext ) ); + } + + "." printf( "found a dot\n" ); + + Here is a scanner which recognizes (and discards) C comments while +maintaining a count of the current input line. + + %x comment + %% + int line_num = 1; + + "/*" BEGIN(comment); + + [^*\n]* /* eat anything that's not a '*' */ + "*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ + \n ++line_num; + "*"+"/" BEGIN(INITIAL); + + This scanner goes to a bit of trouble to match as much text as +possible with each rule. In general, when attempting to write a +high-speed scanner try to match as much possible in each rule, as it's a +big win. + + Note that start-conditions names are really integer values and can be +stored as such. Thus, the above could be extended in the following +fashion: + + %x comment foo + %% + int line_num = 1; + int comment_caller; + + "/*" { + comment_caller = INITIAL; + BEGIN(comment); + } + + ... + + "/*" { + comment_caller = foo; + BEGIN(comment); + } + + [^*\n]* /* eat anything that's not a '*' */ + "*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ + \n ++line_num; + "*"+"/" BEGIN(comment_caller); + + Furthermore, you can access the current start condition using the +integer-valued 'YY_START' macro. For example, the above assignments to +'comment_caller' could instead be written + + comment_caller = YY_START; + + Flex provides 'YYSTATE' as an alias for 'YY_START' (since that is +what's used by AT&T 'lex'). + + For historical reasons, start conditions do not have their own +name-space within the generated scanner. The start condition names are +unmodified in the generated scanner and generated header. *Note +option-header::. *Note option-prefix::. + + Finally, here's an example of how to match C-style quoted strings +using exclusive start conditions, including expanded escape sequences +(but not including checking for a string that's too long): + + %x str + + %% + char string_buf[MAX_STR_CONST]; + char *string_buf_ptr; + + + \" string_buf_ptr = string_buf; BEGIN(str); + + \" { /* saw closing quote - all done */ + BEGIN(INITIAL); + *string_buf_ptr = '\0'; + /* return string constant token type and + * value to parser + */ + } + + \n { + /* error - unterminated string constant */ + /* generate error message */ + } + + \\[0-7]{1,3} { + /* octal escape sequence */ + int result; + + (void) sscanf( yytext + 1, "%o", &result ); + + if ( result > 0xff ) + /* error, constant is out-of-bounds */ + + *string_buf_ptr++ = result; + } + + \\[0-9]+ { + /* generate error - bad escape sequence; something + * like '\48' or '\0777777' + */ + } + + \\n *string_buf_ptr++ = '\n'; + \\t *string_buf_ptr++ = '\t'; + \\r *string_buf_ptr++ = '\r'; + \\b *string_buf_ptr++ = '\b'; + \\f *string_buf_ptr++ = '\f'; + + \\(.|\n) *string_buf_ptr++ = yytext[1]; + + [^\\\n\"]+ { + char *yptr = yytext; + + while ( *yptr ) + *string_buf_ptr++ = *yptr++; + } + + Often, such as in some of the examples above, you wind up writing a +whole bunch of rules all preceded by the same start condition(s). Flex +makes this a little easier and cleaner by introducing a notion of start +condition "scope". A start condition scope is begun with: + + { + + where '' is a list of one or more start conditions. Inside the +start condition scope, every rule automatically has the prefix '' +applied to it, until a '}' which matches the initial '{'. So, for +example, + + { + "\\n" return '\n'; + "\\r" return '\r'; + "\\f" return '\f'; + "\\0" return '\0'; + } + + is equivalent to: + + "\\n" return '\n'; + "\\r" return '\r'; + "\\f" return '\f'; + "\\0" return '\0'; + + Start condition scopes may be nested. + + The following routines are available for manipulating stacks of start +conditions: + + -- Function: void yy_push_state ( int 'new_state' ) + pushes the current start condition onto the top of the start + condition stack and switches to 'new_state' as though you had used + 'BEGIN new_state' (recall that start condition names are also + integers). + + -- Function: void yy_pop_state () + pops the top of the stack and switches to it via 'BEGIN'. + + -- Function: int yy_top_state () + returns the top of the stack without altering the stack's contents. + + The start condition stack grows dynamically and so has no built-in +size limitation. If memory is exhausted, program execution aborts. + + To use start condition stacks, your scanner must include a '%option +stack' directive (*note Scanner Options::). + + +File: flex.info, Node: Multiple Input Buffers, Next: EOF, Prev: Start Conditions, Up: Top + +11 Multiple Input Buffers +************************* + +Some scanners (such as those which support "include" files) require +reading from several input streams. As 'flex' scanners do a large +amount of buffering, one cannot control where the next input will be +read from by simply writing a 'YY_INPUT()' which is sensitive to the +scanning context. 'YY_INPUT()' is only called when the scanner reaches +the end of its buffer, which may be a long time after scanning a +statement such as an 'include' statement which requires switching the +input source. + + To negotiate these sorts of problems, 'flex' provides a mechanism for +creating and switching between multiple input buffers. An input buffer +is created by using: + + -- Function: YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ) + + which takes a 'FILE' pointer and a size and creates a buffer +associated with the given file and large enough to hold 'size' +characters (when in doubt, use 'YY_BUF_SIZE' for the size). It returns +a 'YY_BUFFER_STATE' handle, which may then be passed to other routines +(see below). The 'YY_BUFFER_STATE' type is a pointer to an opaque +'struct yy_buffer_state' structure, so you may safely initialize +'YY_BUFFER_STATE' variables to '((YY_BUFFER_STATE) 0)' if you wish, and +also refer to the opaque structure in order to correctly declare input +buffers in source files other than that of your scanner. Note that the +'FILE' pointer in the call to 'yy_create_buffer' is only used as the +value of 'yyin' seen by 'YY_INPUT'. If you redefine 'YY_INPUT()' so it +no longer uses 'yyin', then you can safely pass a NULL 'FILE' pointer to +'yy_create_buffer'. You select a particular buffer to scan from using: + + -- Function: void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ) + + The above function switches the scanner's input buffer so subsequent +tokens will come from 'new_buffer'. Note that 'yy_switch_to_buffer()' +may be used by 'yywrap()' to set things up for continued scanning, +instead of opening a new file and pointing 'yyin' at it. If you are +looking for a stack of input buffers, then you want to use +'yypush_buffer_state()' instead of this function. Note also that +switching input sources via either 'yy_switch_to_buffer()' or 'yywrap()' +does _not_ change the start condition. + + -- Function: void yy_delete_buffer ( YY_BUFFER_STATE buffer ) + + is used to reclaim the storage associated with a buffer. ('buffer' +can be NULL, in which case the routine does nothing.) You can also +clear the current contents of a buffer using: + + -- Function: void yypush_buffer_state ( YY_BUFFER_STATE buffer ) + + This function pushes the new buffer state onto an internal stack. +The pushed state becomes the new current state. The stack is maintained +by flex and will grow as required. This function is intended to be used +instead of 'yy_switch_to_buffer', when you want to change states, but +preserve the current state for later use. + + -- Function: void yypop_buffer_state ( ) + + This function removes the current state from the top of the stack, +and deletes it by calling 'yy_delete_buffer'. The next state on the +stack, if any, becomes the new current state. + + -- Function: void yy_flush_buffer ( YY_BUFFER_STATE buffer ) + + This function discards the buffer's contents, so the next time the +scanner attempts to match a token from the buffer, it will first fill +the buffer anew using 'YY_INPUT()'. + + -- Function: YY_BUFFER_STATE yy_new_buffer ( FILE *file, int size ) + + is an alias for 'yy_create_buffer()', provided for compatibility with +the C++ use of 'new' and 'delete' for creating and destroying dynamic +objects. + + 'YY_CURRENT_BUFFER' macro returns a 'YY_BUFFER_STATE' handle to the +current buffer. It should not be used as an lvalue. + + Here are two examples of using these features for writing a scanner +which expands include files (the '<>' feature is discussed below). + + This first example uses yypush_buffer_state and yypop_buffer_state. +Flex maintains the stack internally. + + /* the "incl" state is used for picking up the name + * of an include file + */ + %x incl + %% + include BEGIN(incl); + + [a-z]+ ECHO; + [^a-z\n]*\n? ECHO; + + [ \t]* /* eat the whitespace */ + [^ \t\n]+ { /* got the include file name */ + yyin = fopen( yytext, "r" ); + + if ( ! yyin ) + error( ... ); + + yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE )); + + BEGIN(INITIAL); + } + + <> { + yypop_buffer_state(); + + if ( !YY_CURRENT_BUFFER ) + { + yyterminate(); + } + } + + The second example, below, does the same thing as the previous +example did, but manages its own input buffer stack manually (instead of +letting flex do it). + + /* the "incl" state is used for picking up the name + * of an include file + */ + %x incl + + %{ + #define MAX_INCLUDE_DEPTH 10 + YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; + int include_stack_ptr = 0; + %} + + %% + include BEGIN(incl); + + [a-z]+ ECHO; + [^a-z\n]*\n? ECHO; + + [ \t]* /* eat the whitespace */ + [^ \t\n]+ { /* got the include file name */ + if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) + { + fprintf( stderr, "Includes nested too deeply" ); + exit( 1 ); + } + + include_stack[include_stack_ptr++] = + YY_CURRENT_BUFFER; + + yyin = fopen( yytext, "r" ); + + if ( ! yyin ) + error( ... ); + + yy_switch_to_buffer( + yy_create_buffer( yyin, YY_BUF_SIZE ) ); + + BEGIN(INITIAL); + } + + <> { + if ( --include_stack_ptr == 0 ) + { + yyterminate(); + } + + else + { + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer( + include_stack[include_stack_ptr] ); + } + } + + The following routines are available for setting up input buffers for +scanning in-memory strings instead of files. All of them create a new +input buffer for scanning the string, and return a corresponding +'YY_BUFFER_STATE' handle (which you should delete with +'yy_delete_buffer()' when done with it). They also switch to the new +buffer using 'yy_switch_to_buffer()', so the next call to 'yylex()' will +start scanning the string. + + -- Function: YY_BUFFER_STATE yy_scan_string ( const char *str ) + scans a NUL-terminated string. + + -- Function: YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len + ) + scans 'len' bytes (including possibly 'NUL's) starting at location + 'bytes'. + + Note that both of these functions create and scan a _copy_ of the +string or bytes. (This may be desirable, since 'yylex()' modifies the +contents of the buffer it is scanning.) You can avoid the copy by +using: + + -- Function: YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t + size) + which scans in place the buffer starting at 'base', consisting of + 'size' bytes, the last two bytes of which _must_ be + 'YY_END_OF_BUFFER_CHAR' (ASCII NUL). These last two bytes are not + scanned; thus, scanning consists of 'base[0]' through + 'base[size-2]', inclusive. + + If you fail to set up 'base' in this manner (i.e., forget the final +two 'YY_END_OF_BUFFER_CHAR' bytes), then 'yy_scan_buffer()' returns a +NULL pointer instead of creating a new input buffer. + + -- Data type: yy_size_t + is an integral type to which you can cast an integer expression + reflecting the size of the buffer. + + +File: flex.info, Node: EOF, Next: Misc Macros, Prev: Multiple Input Buffers, Up: Top + +12 End-of-File Rules +******************** + +The special rule '<>' indicates actions which are to be taken when +an end-of-file is encountered and 'yywrap()' returns non-zero (i.e., +indicates no further files to process). The action must finish by doing +one of the following things: + + * assigning 'yyin' to a new input file (in previous versions of + 'flex', after doing the assignment you had to call the special + action 'YY_NEW_FILE'. This is no longer necessary.) + + * executing a 'return' statement; + + * executing the special 'yyterminate()' action. + + * or, switching to a new buffer using 'yy_switch_to_buffer()' as + shown in the example above. + + <> rules may not be used with other patterns; they may only be +qualified with a list of start conditions. If an unqualified <> +rule is given, it applies to _all_ start conditions which do not already +have <> actions. To specify an <> rule for only the initial +start condition, use: + + <> + + These rules are useful for catching things like unclosed comments. +An example: + + %x quote + %% + + ...other rules for dealing with quotes... + + <> { + error( "unterminated quote" ); + yyterminate(); + } + <> { + if ( *++filelist ) + yyin = fopen( *filelist, "r" ); + else + yyterminate(); + } + + +File: flex.info, Node: Misc Macros, Next: User Values, Prev: EOF, Up: Top + +13 Miscellaneous Macros +*********************** + +The macro 'YY_USER_ACTION' can be defined to provide an action which is +always executed prior to the matched rule's action. For example, it +could be #define'd to call a routine to convert yytext to lower-case. +When 'YY_USER_ACTION' is invoked, the variable 'yy_act' gives the number +of the matched rule (rules are numbered starting with 1). Suppose you +want to profile how often each of your rules is matched. The following +would do the trick: + + #define YY_USER_ACTION ++ctr[yy_act] + + where 'ctr' is an array to hold the counts for the different rules. +Note that the macro 'YY_NUM_RULES' gives the total number of rules +(including the default rule), even if you use '-s)', so a correct +declaration for 'ctr' is: + + int ctr[YY_NUM_RULES]; + + The macro 'YY_USER_INIT' may be defined to provide an action which is +always executed before the first scan (and before the scanner's internal +initializations are done). For example, it could be used to call a +routine to read in a data table or open a logging file. + + The macro 'yy_set_interactive(is_interactive)' can be used to control +whether the current buffer is considered "interactive". An interactive +buffer is processed more slowly, but must be used when the scanner's +input source is indeed interactive to avoid problems due to waiting to +fill buffers (see the discussion of the '-I' flag in *note Scanner +Options::). A non-zero value in the macro invocation marks the buffer +as interactive, a zero value as non-interactive. Note that use of this +macro overrides '%option always-interactive' or '%option +never-interactive' (*note Scanner Options::). 'yy_set_interactive()' +must be invoked prior to beginning to scan the buffer that is (or is +not) to be considered interactive. + + The macro 'yy_set_bol(at_bol)' can be used to control whether the +current buffer's scanning context for the next token match is done as +though at the beginning of a line. A non-zero macro argument makes +rules anchored with '^' active, while a zero argument makes '^' rules +inactive. + + The macro 'YY_AT_BOL()' returns true if the next token scanned from +the current buffer will have '^' rules active, false otherwise. + + In the generated scanner, the actions are all gathered in one large +switch statement and separated using 'YY_BREAK', which may be redefined. +By default, it is simply a 'break', to separate each rule's action from +the following rule's. Redefining 'YY_BREAK' allows, for example, C++ +users to #define YY_BREAK to do nothing (while being very careful that +every rule ends with a 'break' or a 'return'!) to avoid suffering from +unreachable statement warnings where because a rule's action ends with +'return', the 'YY_BREAK' is inaccessible. + + +File: flex.info, Node: User Values, Next: Yacc, Prev: Misc Macros, Up: Top + +14 Values Available To the User +******************************* + +This chapter summarizes the various values available to the user in the +rule actions. + +'char *yytext' + holds the text of the current token. It may be modified but not + lengthened (you cannot append characters to the end). + + If the special directive '%array' appears in the first section of + the scanner description, then 'yytext' is instead declared 'char + yytext[YYLMAX]', where 'YYLMAX' is a macro definition that you can + redefine in the first section if you don't like the default value + (generally 8KB). Using '%array' results in somewhat slower + scanners, but the value of 'yytext' becomes immune to calls to + 'unput()', which potentially destroy its value when 'yytext' is a + character pointer. The opposite of '%array' is '%pointer', which + is the default. + + You cannot use '%array' when generating C++ scanner classes (the + '-+' flag). + +'int yyleng' + holds the length of the current token. + +'FILE *yyin' + is the file which by default 'flex' reads from. It may be + redefined but doing so only makes sense before scanning begins or + after an EOF has been encountered. Changing it in the midst of + scanning will have unexpected results since 'flex' buffers its + input; use 'yyrestart()' instead. Once scanning terminates because + an end-of-file has been seen, you can assign 'yyin' at the new + input file and then call the scanner again to continue scanning. + +'void yyrestart( FILE *new_file )' + may be called to point 'yyin' at the new input file. The + switch-over to the new file is immediate (any previously + buffered-up input is lost). Note that calling 'yyrestart()' with + 'yyin' as an argument thus throws away the current input buffer and + continues scanning the same input file. + +'FILE *yyout' + is the file to which 'ECHO' actions are done. It can be reassigned + by the user. + +'YY_CURRENT_BUFFER' + returns a 'YY_BUFFER_STATE' handle to the current buffer. + +'YY_START' + returns an integer value corresponding to the current start + condition. You can subsequently use this value with 'BEGIN' to + return to that start condition. + + +File: flex.info, Node: Yacc, Next: Scanner Options, Prev: User Values, Up: Top + +15 Interfacing with Yacc +************************ + +One of the main uses of 'flex' is as a companion to the 'yacc' +parser-generator. 'yacc' parsers expect to call a routine named +'yylex()' to find the next input token. The routine is supposed to +return the type of the next token as well as putting any associated +value in the global 'yylval'. To use 'flex' with 'yacc', one specifies +the '-d' option to 'yacc' to instruct it to generate the file 'y.tab.h' +containing definitions of all the '%tokens' appearing in the 'yacc' +input. This file is then included in the 'flex' scanner. For example, +if one of the tokens is 'TOK_NUMBER', part of the scanner might look +like: + + %{ + #include "y.tab.h" + %} + + %% + + [0-9]+ yylval = atoi( yytext ); return TOK_NUMBER; + + +File: flex.info, Node: Scanner Options, Next: Performance, Prev: Yacc, Up: Top + +16 Scanner Options +****************** + +The various 'flex' options are categorized by function in the following +menu. If you want to lookup a particular option by name, *Note Index of +Scanner Options::. + +* Menu: + +* Options for Specifying Filenames:: +* Options Affecting Scanner Behavior:: +* Code-Level And API Options:: +* Options for Scanner Speed and Size:: +* Debugging Options:: +* Miscellaneous Options:: + + Even though there are many scanner options, a typical scanner might +only specify the following options: + + %option 8bit reentrant bison-bridge + %option warn nodefault + %option yylineno + %option outfile="scanner.c" header-file="scanner.h" + + The first line specifies the general type of scanner we want. The +second line specifies that we are being careful. The third line asks +flex to track line numbers. The last line tells flex what to name the +files. (The options can be specified in any order. We just divided +them.) + + 'flex' also provides a mechanism for controlling options within the +scanner specification itself, rather than from the flex command-line. +This is done by including '%option' directives in the first section of +the scanner specification. You can specify multiple options with a +single '%option' directive, and multiple directives in the first section +of your flex input file. + + Most options are given simply as names, optionally preceded by the +word 'no' (with no intervening whitespace) to negate their meaning. The +names are the same as their long-option equivalents (but without the +leading '--' ). + + 'flex' scans your rule actions to determine whether you use the +'REJECT' or 'yymore()' features. The 'REJECT' and 'yymore' options are +available to override its decision as to whether you use the options, +either by setting them (e.g., '%option reject)' to indicate the feature +is indeed used, or unsetting them to indicate it actually is not used +(e.g., '%option noyymore)'. + + A number of options are available for lint purists who want to +suppress the appearance of unneeded routines in the generated scanner. +Each of the following, if unset (e.g., '%option nounput'), results in +the corresponding routine not appearing in the generated scanner: + + input, unput + yy_push_state, yy_pop_state, yy_top_state + yy_scan_buffer, yy_scan_bytes, yy_scan_string + + yyget_extra, yyset_extra, yyget_leng, yyget_text, + yyget_lineno, yyset_lineno, yyget_in, yyset_in, + yyget_out, yyset_out, yyget_lval, yyset_lval, + yyget_lloc, yyset_lloc, yyget_debug, yyset_debug + + (though 'yy_push_state()' and friends won't appear anyway unless you +use '%option stack)'. + + +File: flex.info, Node: Options for Specifying Filenames, Next: Options Affecting Scanner Behavior, Prev: Scanner Options, Up: Scanner Options + +16.1 Options for Specifying Filenames +===================================== + +'--header-file=FILE, '%option header-file="FILE"'' + instructs flex to write a C header to 'FILE'. This file contains + function prototypes, extern variables, and types used by the + scanner. Only the external API is exported by the header file. + Many macros that are usable from within scanner actions are not + exported to the header file. This is due to namespace problems and + the goal of a clean external API. + + While in the header, the macro 'yyIN_HEADER' is defined, where 'yy' + is substituted with the appropriate prefix. + + The '--header-file' option is not compatible with the '--c++' + option, since the C++ scanner provides its own header in + 'yyFlexLexer.h'. + +'-oFILE, --outfile=FILE, '%option outfile="FILE"'' + directs flex to write the scanner to the file 'FILE' instead of + 'lex.yy.c'. If you combine '--outfile' with the '--stdout' option, + then the scanner is written to 'stdout' but its '#line' directives + (see the '-l' option above) refer to the file 'FILE'. + +'-t, --stdout, '%option stdout'' + instructs 'flex' to write the scanner it generates to standard + output instead of 'lex.yy.c'. + +'-SFILE, --skel=FILE' + overrides the default skeleton file from which 'flex' constructs + its scanners. You'll never need this option unless you are doing + 'flex' maintenance or development. + +'--tables-file=FILE' + Write serialized scanner dfa tables to FILE. The generated scanner + will not contain the tables, and requires them to be loaded at + runtime. *Note serialization::. + +'--tables-verify' + This option is for flex development. We document it here in case + you stumble upon it by accident or in case you suspect some + inconsistency in the serialized tables. Flex will serialize the + scanner dfa tables but will also generate the in-code tables as it + normally does. At runtime, the scanner will verify that the + serialized tables match the in-code tables, instead of loading + them. + + +File: flex.info, Node: Options Affecting Scanner Behavior, Next: Code-Level And API Options, Prev: Options for Specifying Filenames, Up: Scanner Options + +16.2 Options Affecting Scanner Behavior +======================================= + +'-i, --case-insensitive, '%option case-insensitive'' + instructs 'flex' to generate a "case-insensitive" scanner. The + case of letters given in the 'flex' input patterns will be ignored, + and tokens in the input will be matched regardless of case. The + matched text given in 'yytext' will have the preserved case (i.e., + it will not be folded). For tricky behavior, see *note case and + character ranges::. + +'-l, --lex-compat, '%option lex-compat'' + turns on maximum compatibility with the original AT&T 'lex' + implementation. Note that this does not mean _full_ compatibility. + Use of this option costs a considerable amount of performance, and + it cannot be used with the '--c++', '--full', '--fast', '-Cf', or + '-CF' options. For details on the compatibilities it provides, see + *note Lex and Posix::. This option also results in the name + 'YY_FLEX_LEX_COMPAT' being '#define''d in the generated scanner. + +'-B, --batch, '%option batch'' + instructs 'flex' to generate a "batch" scanner, the opposite of + _interactive_ scanners generated by '--interactive' (see below). + In general, you use '-B' when you are _certain_ that your scanner + will never be used interactively, and you want to squeeze a + _little_ more performance out of it. If your goal is instead to + squeeze out a _lot_ more performance, you should be using the '-Cf' + or '-CF' options, which turn on '--batch' automatically anyway. + +'-I, --interactive, '%option interactive'' + instructs 'flex' to generate an interactive scanner. An + interactive scanner is one that only looks ahead to decide what + token has been matched if it absolutely must. It turns out that + always looking one extra character ahead, even if the scanner has + already seen enough text to disambiguate the current token, is a + bit faster than only looking ahead when necessary. But scanners + that always look ahead give dreadful interactive performance; for + example, when a user types a newline, it is not recognized as a + newline token until they enter _another_ token, which often means + typing in another whole line. + + 'flex' scanners default to 'interactive' unless you use the '-Cf' + or '-CF' table-compression options (*note Performance::). That's + because if you're looking for high-performance you should be using + one of these options, so if you didn't, 'flex' assumes you'd rather + trade off a bit of run-time performance for intuitive interactive + behavior. Note also that you _cannot_ use '--interactive' in + conjunction with '-Cf' or '-CF'. Thus, this option is not really + needed; it is on by default for all those cases in which it is + allowed. + + You can force a scanner to _not_ be interactive by using '--batch' + +'-7, --7bit, '%option 7bit'' + instructs 'flex' to generate a 7-bit scanner, i.e., one which can + only recognize 7-bit characters in its input. The advantage of + using '--7bit' is that the scanner's tables can be up to half the + size of those generated using the '--8bit'. The disadvantage is + that such scanners often hang or crash if their input contains an + 8-bit character. + + Note, however, that unless you generate your scanner using the + '-Cf' or '-CF' table compression options, use of '--7bit' will save + only a small amount of table space, and make your scanner + considerably less portable. 'Flex''s default behavior is to + generate an 8-bit scanner unless you use the '-Cf' or '-CF', in + which case 'flex' defaults to generating 7-bit scanners unless your + site was always configured to generate 8-bit scanners (as will + often be the case with non-USA sites). You can tell whether flex + generated a 7-bit or an 8-bit scanner by inspecting the flag + summary in the '--verbose' output as described above. + + Note that if you use '-Cfe' or '-CFe' 'flex' still defaults to + generating an 8-bit scanner, since usually with these compression + options full 8-bit tables are not much more expensive than 7-bit + tables. + +'-8, --8bit, '%option 8bit'' + instructs 'flex' to generate an 8-bit scanner, i.e., one which can + recognize 8-bit characters. This flag is only needed for scanners + generated using '-Cf' or '-CF', as otherwise flex defaults to + generating an 8-bit scanner anyway. + + See the discussion of '--7bit' above for 'flex''s default behavior + and the tradeoffs between 7-bit and 8-bit scanners. + +'--default, '%option default'' + generate the default rule. + +'--always-interactive, '%option always-interactive'' + instructs flex to generate a scanner which always considers its + input _interactive_. Normally, on each new input file the scanner + calls 'isatty()' in an attempt to determine whether the scanner's + input source is interactive and thus should be read a character at + a time. When this option is used, however, then no such call is + made. + +'--never-interactive, '--never-interactive'' + instructs flex to generate a scanner which never considers its + input interactive. This is the opposite of 'always-interactive'. + +'-X, --posix, '%option posix'' + turns on maximum compatibility with the POSIX 1003.2-1992 + definition of 'lex'. Since 'flex' was originally designed to + implement the POSIX definition of 'lex' this generally involves + very few changes in behavior. At the current writing the known + differences between 'flex' and the POSIX standard are: + + * In POSIX and AT&T 'lex', the repeat operator, '{}', has lower + precedence than concatenation (thus 'ab{3}' yields 'ababab'). + Most POSIX utilities use an Extended Regular Expression (ERE) + precedence that has the precedence of the repeat operator + higher than concatenation (which causes 'ab{3}' to yield + 'abbb'). By default, 'flex' places the precedence of the + repeat operator higher than concatenation which matches the + ERE processing of other POSIX utilities. When either + '--posix' or '-l' are specified, 'flex' will use the + traditional AT&T and POSIX-compliant precedence for the repeat + operator where concatenation has higher precedence than the + repeat operator. + +'--stack, '%option stack'' + enables the use of start condition stacks (*note Start + Conditions::). + +'--stdinit, '%option stdinit'' + if set (i.e., %option stdinit) initializes 'yyin' and 'yyout' to + 'stdin' and 'stdout', instead of the default of 'NULL'. Some + existing 'lex' programs depend on this behavior, even though it is + not compliant with ANSI C, which does not require 'stdin' and + 'stdout' to be compile-time constant. In a reentrant scanner, + however, this is not a problem since initialization is performed in + 'yylex_init' at runtime. + +'--yylineno, '%option yylineno'' + directs 'flex' to generate a scanner that maintains the number of + the current line read from its input in the global variable + 'yylineno'. This option is implied by '%option lex-compat'. In a + reentrant C scanner, the macro 'yylineno' is accessible regardless + of the value of '%option yylineno', however, its value is not + modified by 'flex' unless '%option yylineno' is enabled. + +'--yywrap, '%option yywrap'' + if unset (i.e., '--noyywrap)', makes the scanner not call + 'yywrap()' upon an end-of-file, but simply assume that there are no + more files to scan (until the user points 'yyin' at a new file and + calls 'yylex()' again). + + +File: flex.info, Node: Code-Level And API Options, Next: Options for Scanner Speed and Size, Prev: Options Affecting Scanner Behavior, Up: Scanner Options + +16.3 Code-Level And API Options +=============================== + +'--ansi-definitions, '%option ansi-definitions'' + Deprecated, ignored + +'--ansi-prototypes, '%option ansi-prototypes'' + Deprecated, ignored + +'--bison-bridge, '%option bison-bridge'' + instructs flex to generate a C scanner that is meant to be called + by a 'GNU bison' parser. The scanner has minor API changes for + 'bison' compatibility. In particular, the declaration of 'yylex' + is modified to take an additional parameter, 'yylval'. *Note Bison + Bridge::. + +'--bison-locations, '%option bison-locations'' + instruct flex that 'GNU bison' '%locations' are being used. This + means 'yylex' will be passed an additional parameter, 'yylloc'. + This option implies '%option bison-bridge'. *Note Bison Bridge::. + +'-L, --noline, '%option noline'' + instructs 'flex' not to generate '#line' directives. Without this + option, 'flex' peppers the generated scanner with '#line' + directives so error messages in the actions will be correctly + located with respect to either the original 'flex' input file (if + the errors are due to code in the input file), or 'lex.yy.c' (if + the errors are 'flex''s fault - you should report these sorts of + errors to the email address given in *note Reporting Bugs::). + +'-R, --reentrant, '%option reentrant'' + instructs flex to generate a reentrant C scanner. The generated + scanner may safely be used in a multi-threaded environment. The + API for a reentrant scanner is different than for a non-reentrant + scanner *note Reentrant::). Because of the API difference between + reentrant and non-reentrant 'flex' scanners, non-reentrant flex + code must be modified before it is suitable for use with this + option. This option is not compatible with the '--c++' option. + + The option '--reentrant' does not affect the performance of the + scanner. + +'-+, --c++, '%option c++'' + specifies that you want flex to generate a C++ scanner class. + *Note Cxx::, for details. + +'--array, '%option array'' + specifies that you want yytext to be an array instead of a char* + +'--pointer, '%option pointer'' + specify that 'yytext' should be a 'char *', not an array. This + default is 'char *'. + +'-PPREFIX, --prefix=PREFIX, '%option prefix="PREFIX"'' + changes the default 'yy' prefix used by 'flex' for all + globally-visible variable and function names to instead be + 'PREFIX'. For example, '--prefix=foo' changes the name of 'yytext' + to 'footext'. It also changes the name of the default output file + from 'lex.yy.c' to 'lex.foo.c'. Here is a partial list of the + names affected: + + yy_create_buffer + yy_delete_buffer + yy_flex_debug + yy_init_buffer + yy_flush_buffer + yy_load_buffer_state + yy_switch_to_buffer + yyin + yyleng + yylex + yylineno + yyout + yyrestart + yytext + yywrap + yyalloc + yyrealloc + yyfree + + (If you are using a C++ scanner, then only 'yywrap' and + 'yyFlexLexer' are affected.) Within your scanner itself, you can + still refer to the global variables and functions using either + version of their name; but externally, they have the modified name. + + This option lets you easily link together multiple 'flex' programs + into the same executable. Note, though, that using this option + also renames 'yywrap()', so you now _must_ either provide your own + (appropriately-named) version of the routine for your scanner, or + use '%option noyywrap', as linking with '-lfl' no longer provides + one for you by default. + +'--main, '%option main'' + directs flex to provide a default 'main()' program for the scanner, + which simply calls 'yylex()'. This option implies 'noyywrap' (see + below). + +'--nounistd, '%option nounistd'' + suppresses inclusion of the non-ANSI header file 'unistd.h'. This + option is meant to target environments in which 'unistd.h' does not + exist. Be aware that certain options may cause flex to generate + code that relies on functions normally found in 'unistd.h', (e.g. + 'isatty()', 'read()'.) If you wish to use these functions, you + will have to inform your compiler where to find them. *Note + option-always-interactive::. *Note option-read::. + +'--yyclass=NAME, '%option yyclass="NAME"'' + only applies when generating a C++ scanner (the '--c++' option). + It informs 'flex' that you have derived 'NAME' as a subclass of + 'yyFlexLexer', so 'flex' will place your actions in the member + function 'foo::yylex()' instead of 'yyFlexLexer::yylex()'. It also + generates a 'yyFlexLexer::yylex()' member function that emits a + run-time error (by invoking 'yyFlexLexer::LexerError())' if called. + *Note Cxx::. + + +File: flex.info, Node: Options for Scanner Speed and Size, Next: Debugging Options, Prev: Code-Level And API Options, Up: Scanner Options + +16.4 Options for Scanner Speed and Size +======================================= + +'-C[aefFmr]' + controls the degree of table compression and, more generally, + trade-offs between small scanners and fast scanners. + + '-C' + A lone '-C' specifies that the scanner tables should be + compressed but neither equivalence classes nor + meta-equivalence classes should be used. + + '-Ca, --align, '%option align'' + ("align") instructs flex to trade off larger tables in the + generated scanner for faster performance because the elements + of the tables are better aligned for memory access and + computation. On some RISC architectures, fetching and + manipulating longwords is more efficient than with + smaller-sized units such as shortwords. This option can + quadruple the size of the tables used by your scanner. + + '-Ce, --ecs, '%option ecs'' + directs 'flex' to construct "equivalence classes", i.e., sets + of characters which have identical lexical properties (for + example, if the only appearance of digits in the 'flex' input + is in the character class "[0-9]" then the digits '0', '1', + ..., '9' will all be put in the same equivalence class). + Equivalence classes usually give dramatic reductions in the + final table/object file sizes (typically a factor of 2-5) and + are pretty cheap performance-wise (one array look-up per + character scanned). + + '-Cf' + specifies that the "full" scanner tables should be generated - + 'flex' should not compress the tables by taking advantages of + similar transition functions for different states. + + '-CF' + specifies that the alternate fast scanner representation + (described above under the '--fast' flag) should be used. + This option cannot be used with '--c++'. + + '-Cm, --meta-ecs, '%option meta-ecs'' + directs 'flex' to construct "meta-equivalence classes", which + are sets of equivalence classes (or characters, if equivalence + classes are not being used) that are commonly used together. + Meta-equivalence classes are often a big win when using + compressed tables, but they have a moderate performance impact + (one or two 'if' tests and one array look-up per character + scanned). + + '-Cr, --read, '%option read'' + causes the generated scanner to _bypass_ use of the standard + I/O library ('stdio') for input. Instead of calling 'fread()' + or 'getc()', the scanner will use the 'read()' system call, + resulting in a performance gain which varies from system to + system, but in general is probably negligible unless you are + also using '-Cf' or '-CF'. Using '-Cr' can cause strange + behavior if, for example, you read from 'yyin' using 'stdio' + prior to calling the scanner (because the scanner will miss + whatever text your previous reads left in the 'stdio' input + buffer). '-Cr' has no effect if you define 'YY_INPUT()' + (*note Generated Scanner::). + + The options '-Cf' or '-CF' and '-Cm' do not make sense together - + there is no opportunity for meta-equivalence classes if the table + is not being compressed. Otherwise the options may be freely + mixed, and are cumulative. + + The default setting is '-Cem', which specifies that 'flex' should + generate equivalence classes and meta-equivalence classes. This + setting provides the highest degree of table compression. You can + trade off faster-executing scanners at the cost of larger tables + with the following generally being true: + + slowest & smallest + -Cem + -Cm + -Ce + -C + -C{f,F}e + -C{f,F} + -C{f,F}a + fastest & largest + + Note that scanners with the smallest tables are usually generated + and compiled the quickest, so during development you will usually + want to use the default, maximal compression. + + '-Cfe' is often a good compromise between speed and size for + production scanners. + +'-f, --full, '%option full'' + specifies "fast scanner". No table compression is done and 'stdio' + is bypassed. The result is large but fast. This option is + equivalent to '--Cfr' + +'-F, --fast, '%option fast'' + specifies that the _fast_ scanner table representation should be + used (and 'stdio' bypassed). This representation is about as fast + as the full table representation '--full', and for some sets of + patterns will be considerably smaller (and for others, larger). In + general, if the pattern set contains both _keywords_ and a + catch-all, _identifier_ rule, such as in the set: + + "case" return TOK_CASE; + "switch" return TOK_SWITCH; + ... + "default" return TOK_DEFAULT; + [a-z]+ return TOK_ID; + + then you're better off using the full table representation. If + only the _identifier_ rule is present and you then use a hash table + or some such to detect the keywords, you're better off using + '--fast'. + + This option is equivalent to '-CFr'. It cannot be used with + '--c++'. + + +File: flex.info, Node: Debugging Options, Next: Miscellaneous Options, Prev: Options for Scanner Speed and Size, Up: Scanner Options + +16.5 Debugging Options +====================== + +'-b, --backup, '%option backup'' + Generate backing-up information to 'lex.backup'. This is a list of + scanner states which require backing up and the input characters on + which they do so. By adding rules one can remove backing-up + states. If _all_ backing-up states are eliminated and '-Cf' or + '-CF' is used, the generated scanner will run faster (see the + '--perf-report' flag). Only users who wish to squeeze every last + cycle out of their scanners need worry about this option. (*note + Performance::). + +'-d, --debug, '%option debug'' + makes the generated scanner run in "debug" mode. Whenever a + pattern is recognized and the global variable 'yy_flex_debug' is + non-zero (which is the default), the scanner will write to 'stderr' + a line of the form: + + -accepting rule at line 53 ("the matched text") + + The line number refers to the location of the rule in the file + defining the scanner (i.e., the file that was fed to flex). + Messages are also generated when the scanner backs up, accepts the + default rule, reaches the end of its input buffer (or encounters a + NUL; at this point, the two look the same as far as the scanner's + concerned), or reaches an end-of-file. + +'-p, --perf-report, '%option perf-report'' + generates a performance report to 'stderr'. The report consists of + comments regarding features of the 'flex' input file which will + cause a serious loss of performance in the resulting scanner. If + you give the flag twice, you will also get comments regarding + features that lead to minor performance losses. + + Note that the use of 'REJECT', and variable trailing context (*note + Limitations::) entails a substantial performance penalty; use of + 'yymore()', the '^' operator, and the '--interactive' flag entail + minor performance penalties. + +'-s, --nodefault, '%option nodefault'' + causes the _default rule_ (that unmatched scanner input is echoed + to 'stdout)' to be suppressed. If the scanner encounters input + that does not match any of its rules, it aborts with an error. + This option is useful for finding holes in a scanner's rule set. + +'-T, --trace, '%option trace'' + makes 'flex' run in "trace" mode. It will generate a lot of + messages to 'stderr' concerning the form of the input and the + resultant non-deterministic and deterministic finite automata. + This option is mostly for use in maintaining 'flex'. + +'-w, --nowarn, '%option nowarn'' + suppresses warning messages. + +'-v, --verbose, '%option verbose'' + specifies that 'flex' should write to 'stderr' a summary of + statistics regarding the scanner it generates. Most of the + statistics are meaningless to the casual 'flex' user, but the first + line identifies the version of 'flex' (same as reported by + '--version'), and the next line the flags used when generating the + scanner, including those that are on by default. + +'--warn, '%option warn'' + warn about certain things. In particular, if the default rule can + be matched but no default rule has been given, the flex will warn + you. We recommend using this option always. + + +File: flex.info, Node: Miscellaneous Options, Prev: Debugging Options, Up: Scanner Options + +16.6 Miscellaneous Options +========================== + +'-c' + A do-nothing option included for POSIX compliance. + +'-h, -?, --help' + generates a "help" summary of 'flex''s options to 'stdout' and then + exits. + +'-n' + Another do-nothing option included for POSIX compliance. + +'-V, --version' + prints the version number to 'stdout' and exits. + + +File: flex.info, Node: Performance, Next: Cxx, Prev: Scanner Options, Up: Top + +17 Performance Considerations +***************************** + +The main design goal of 'flex' is that it generate high-performance +scanners. It has been optimized for dealing well with large sets of +rules. Aside from the effects on scanner speed of the table compression +'-C' options outlined above, there are a number of options/actions which +degrade performance. These are, from most expensive to least: + + REJECT + arbitrary trailing context + + pattern sets that require backing up + %option yylineno + %array + + %option interactive + %option always-interactive + + ^ beginning-of-line operator + yymore() + + with the first two all being quite expensive and the last two being +quite cheap. Note also that 'unput()' is implemented as a routine call +that potentially does quite a bit of work, while 'yyless()' is a +quite-cheap macro. So if you are just putting back some excess text you +scanned, use 'yyless()'. + + 'REJECT' should be avoided at all costs when performance is +important. It is a particularly expensive option. + + There is one case when '%option yylineno' can be expensive. That is +when your patterns match long tokens that could _possibly_ contain a +newline character. There is no performance penalty for rules that can +not possibly match newlines, since flex does not need to check them for +newlines. In general, you should avoid rules such as '[^f]+', which +match very long tokens, including newlines, and may possibly match your +entire file! A better approach is to separate '[^f]+' into two rules: + + %option yylineno + %% + [^f\n]+ + \n+ + + The above scanner does not incur a performance penalty. + + Getting rid of backing up is messy and often may be an enormous +amount of work for a complicated scanner. In principal, one begins by +using the '-b' flag to generate a 'lex.backup' file. For example, on +the input: + + %% + foo return TOK_KEYWORD; + foobar return TOK_KEYWORD; + + the file looks like: + + State #6 is non-accepting - + associated rule line numbers: + 2 3 + out-transitions: [ o ] + jam-transitions: EOF [ \001-n p-\177 ] + + State #8 is non-accepting - + associated rule line numbers: + 3 + out-transitions: [ a ] + jam-transitions: EOF [ \001-` b-\177 ] + + State #9 is non-accepting - + associated rule line numbers: + 3 + out-transitions: [ r ] + jam-transitions: EOF [ \001-q s-\177 ] + + Compressed tables always back up. + + The first few lines tell us that there's a scanner state in which it +can make a transition on an 'o' but not on any other character, and that +in that state the currently scanned text does not match any rule. The +state occurs when trying to match the rules found at lines 2 and 3 in +the input file. If the scanner is in that state and then reads +something other than an 'o', it will have to back up to find a rule +which is matched. With a bit of headscratching one can see that this +must be the state it's in when it has seen 'fo'. When this has +happened, if anything other than another 'o' is seen, the scanner will +have to back up to simply match the 'f' (by the default rule). + + The comment regarding State #8 indicates there's a problem when +'foob' has been scanned. Indeed, on any character other than an 'a', +the scanner will have to back up to accept "foo". Similarly, the +comment for State #9 concerns when 'fooba' has been scanned and an 'r' +does not follow. + + The final comment reminds us that there's no point going to all the +trouble of removing backing up from the rules unless we're using '-Cf' +or '-CF', since there's no performance gain doing so with compressed +scanners. + + The way to remove the backing up is to add "error" rules: + + %% + foo return TOK_KEYWORD; + foobar return TOK_KEYWORD; + + fooba | + foob | + fo { + /* false alarm, not really a keyword */ + return TOK_ID; + } + + Eliminating backing up among a list of keywords can also be done +using a "catch-all" rule: + + %% + foo return TOK_KEYWORD; + foobar return TOK_KEYWORD; + + [a-z]+ return TOK_ID; + + This is usually the best solution when appropriate. + + Backing up messages tend to cascade. With a complicated set of rules +it's not uncommon to get hundreds of messages. If one can decipher +them, though, it often only takes a dozen or so rules to eliminate the +backing up (though it's easy to make a mistake and have an error rule +accidentally match a valid token. A possible future 'flex' feature will +be to automatically add rules to eliminate backing up). + + It's important to keep in mind that you gain the benefits of +eliminating backing up only if you eliminate _every_ instance of backing +up. Leaving just one means you gain nothing. + + _Variable_ trailing context (where both the leading and trailing +parts do not have a fixed length) entails almost the same performance +loss as 'REJECT' (i.e., substantial). So when possible a rule like: + + %% + mouse|rat/(cat|dog) run(); + + is better written: + + %% + mouse/cat|dog run(); + rat/cat|dog run(); + + or as + + %% + mouse|rat/cat run(); + mouse|rat/dog run(); + + Note that here the special '|' action does _not_ provide any savings, +and can even make things worse (*note Limitations::). + + Another area where the user can increase a scanner's performance (and +one that's easier to implement) arises from the fact that the longer the +tokens matched, the faster the scanner will run. This is because with +long tokens the processing of most input characters takes place in the +(short) inner scanning loop, and does not often have to go through the +additional work of setting up the scanning environment (e.g., 'yytext') +for the action. Recall the scanner for C comments: + + %x comment + %% + int line_num = 1; + + "/*" BEGIN(comment); + + [^*\n]* + "*"+[^*/\n]* + \n ++line_num; + "*"+"/" BEGIN(INITIAL); + + This could be sped up by writing it as: + + %x comment + %% + int line_num = 1; + + "/*" BEGIN(comment); + + [^*\n]* + [^*\n]*\n ++line_num; + "*"+[^*/\n]* + "*"+[^*/\n]*\n ++line_num; + "*"+"/" BEGIN(INITIAL); + + Now instead of each newline requiring the processing of another +action, recognizing the newlines is distributed over the other rules to +keep the matched text as long as possible. Note that _adding_ rules +does _not_ slow down the scanner! The speed of the scanner is +independent of the number of rules or (modulo the considerations given +at the beginning of this section) how complicated the rules are with +regard to operators such as '*' and '|'. + + A final example in speeding up a scanner: suppose you want to scan +through a file containing identifiers and keywords, one per line and +with no other extraneous characters, and recognize all the keywords. A +natural first approach is: + + %% + asm | + auto | + break | + ... etc ... + volatile | + while /* it's a keyword */ + + .|\n /* it's not a keyword */ + + To eliminate the back-tracking, introduce a catch-all rule: + + %% + asm | + auto | + break | + ... etc ... + volatile | + while /* it's a keyword */ + + [a-z]+ | + .|\n /* it's not a keyword */ + + Now, if it's guaranteed that there's exactly one word per line, then +we can reduce the total number of matches by a half by merging in the +recognition of newlines with that of the other tokens: + + %% + asm\n | + auto\n | + break\n | + ... etc ... + volatile\n | + while\n /* it's a keyword */ + + [a-z]+\n | + .|\n /* it's not a keyword */ + + One has to be careful here, as we have now reintroduced backing up +into the scanner. In particular, while _we_ know that there will never +be any characters in the input stream other than letters or newlines, +'flex' can't figure this out, and it will plan for possibly needing to +back up when it has scanned a token like 'auto' and then the next +character is something other than a newline or a letter. Previously it +would then just match the 'auto' rule and be done, but now it has no +'auto' rule, only a 'auto\n' rule. To eliminate the possibility of +backing up, we could either duplicate all rules but without final +newlines, or, since we never expect to encounter such an input and +therefore don't how it's classified, we can introduce one more catch-all +rule, this one which doesn't include a newline: + + %% + asm\n | + auto\n | + break\n | + ... etc ... + volatile\n | + while\n /* it's a keyword */ + + [a-z]+\n | + [a-z]+ | + .|\n /* it's not a keyword */ + + Compiled with '-Cf', this is about as fast as one can get a 'flex' +scanner to go for this particular problem. + + A final note: 'flex' is slow when matching 'NUL's, particularly when +a token contains multiple 'NUL's. It's best to write rules which match +_short_ amounts of text if it's anticipated that the text will often +include 'NUL's. + + Another final note regarding performance: as mentioned in *note +Matching::, dynamically resizing 'yytext' to accommodate huge tokens is +a slow process because it presently requires that the (huge) token be +rescanned from the beginning. Thus if performance is vital, you should +attempt to match "large" quantities of text but not "huge" quantities, +where the cutoff between the two is at about 8K characters per token. + + +File: flex.info, Node: Cxx, Next: Reentrant, Prev: Performance, Up: Top + +18 Generating C++ Scanners +************************** + +*IMPORTANT*: the present form of the scanning class is _experimental_ +and may change considerably between major releases. + + 'flex' provides two different ways to generate scanners for use with +C++. The first way is to simply compile a scanner generated by 'flex' +using a C++ compiler instead of a C compiler. You should not encounter +any compilation errors (*note Reporting Bugs::). You can then use C++ +code in your rule actions instead of C code. Note that the default +input source for your scanner remains 'yyin', and default echoing is +still done to 'yyout'. Both of these remain 'FILE *' variables and not +C++ _streams_. + + You can also use 'flex' to generate a C++ scanner class, using the +'-+' option (or, equivalently, '%option c++)', which is automatically +specified if the name of the 'flex' executable ends in a '+', such as +'flex++'. When using this option, 'flex' defaults to generating the +scanner to the file 'lex.yy.cc' instead of 'lex.yy.c'. The generated +scanner includes the header file 'FlexLexer.h', which defines the +interface to two C++ classes. + + The first class in 'FlexLexer.h', 'FlexLexer', provides an abstract +base class defining the general scanner class interface. It provides +the following member functions: + +'const char* YYText()' + returns the text of the most recently matched token, the equivalent + of 'yytext'. + +'int YYLeng()' + returns the length of the most recently matched token, the + equivalent of 'yyleng'. + +'int lineno() const' + returns the current input line number (see '%option yylineno)', or + '1' if '%option yylineno' was not used. + +'void set_debug( int flag )' + sets the debugging flag for the scanner, equivalent to assigning to + 'yy_flex_debug' (*note Scanner Options::). Note that you must + build the scanner using '%option debug' to include debugging + information in it. + +'int debug() const' + returns the current setting of the debugging flag. + + Also provided are member functions equivalent to +'yy_switch_to_buffer()', 'yy_create_buffer()' (though the first argument +is an 'istream&' object reference and not a 'FILE*)', +'yy_flush_buffer()', 'yy_delete_buffer()', and 'yyrestart()' (again, the +first argument is a 'istream&' object reference). + + The second class defined in 'FlexLexer.h' is 'yyFlexLexer', which is +derived from 'FlexLexer'. It defines the following additional member +functions: + +'yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )' +'yyFlexLexer( istream& arg_yyin, ostream& arg_yyout )' + constructs a 'yyFlexLexer' object using the given streams for input + and output. If not specified, the streams default to 'cin' and + 'cout', respectively. 'yyFlexLexer' does not take ownership of its + stream arguments. It's up to the user to ensure the streams + pointed to remain alive at least as long as the 'yyFlexLexer' + instance. + +'virtual int yylex()' + performs the same role is 'yylex()' does for ordinary 'flex' + scanners: it scans the input stream, consuming tokens, until a + rule's action returns a value. If you derive a subclass 'S' from + 'yyFlexLexer' and want to access the member functions and variables + of 'S' inside 'yylex()', then you need to use '%option yyclass="S"' + to inform 'flex' that you will be using that subclass instead of + 'yyFlexLexer'. In this case, rather than generating + 'yyFlexLexer::yylex()', 'flex' generates 'S::yylex()' (and also + generates a dummy 'yyFlexLexer::yylex()' that calls + 'yyFlexLexer::LexerError()' if called). + +'virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)' +'virtual void switch_streams(istream& new_in, ostream& new_out)' + reassigns 'yyin' to 'new_in' (if non-null) and 'yyout' to 'new_out' + (if non-null), deleting the previous input buffer if 'yyin' is + reassigned. + +'int yylex( istream* new_in, ostream* new_out = 0 )' +'int yylex( istream& new_in, ostream& new_out )' + first switches the input streams via 'switch_streams( new_in, + new_out )' and then returns the value of 'yylex()'. + + In addition, 'yyFlexLexer' defines the following protected virtual +functions which you can redefine in derived classes to tailor the +scanner: + +'virtual int LexerInput( char* buf, int max_size )' + reads up to 'max_size' characters into 'buf' and returns the number + of characters read. To indicate end-of-input, return 0 characters. + Note that 'interactive' scanners (see the '-B' and '-I' flags in + *note Scanner Options::) define the macro 'YY_INTERACTIVE'. If you + redefine 'LexerInput()' and need to take different actions + depending on whether or not the scanner might be scanning an + interactive input source, you can test for the presence of this + name via '#ifdef' statements. + +'virtual void LexerOutput( const char* buf, int size )' + writes out 'size' characters from the buffer 'buf', which, while + 'NUL'-terminated, may also contain internal 'NUL's if the scanner's + rules can match text with 'NUL's in them. + +'virtual void LexerError( const char* msg )' + reports a fatal error message. The default version of this + function writes the message to the stream 'cerr' and exits. + + Note that a 'yyFlexLexer' object contains its _entire_ scanning +state. Thus you can use such objects to create reentrant scanners, but +see also *note Reentrant::. You can instantiate multiple instances of +the same 'yyFlexLexer' class, and you can also combine multiple C++ +scanner classes together in the same program using the '-P' option +discussed above. + + Finally, note that the '%array' feature is not available to C++ +scanner classes; you must use '%pointer' (the default). + + Here is an example of a simple C++ scanner: + + // An example of using the flex C++ scanner class. + + %{ + #include + using namespace std; + int mylineno = 0; + %} + + %option noyywrap c++ + + string \"[^\n"]+\" + + ws [ \t]+ + + alpha [A-Za-z] + dig [0-9] + name ({alpha}|{dig}|\$)({alpha}|{dig}|[_.\-/$])* + num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)? + num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)? + number {num1}|{num2} + + %% + + {ws} /* skip blanks and tabs */ + + "/*" { + int c; + + while((c = yyinput()) != 0) + { + if(c == '\n') + ++mylineno; + + else if(c == '*') + { + if((c = yyinput()) == '/') + break; + else + unput(c); + } + } + } + + {number} cout << "number " << YYText() << '\n'; + + \n mylineno++; + + {name} cout << "name " << YYText() << '\n'; + + {string} cout << "string " << YYText() << '\n'; + + %% + + // This include is required if main() is an another source file. + //#include + + int main( int /* argc */, char** /* argv */ ) + { + FlexLexer* lexer = new yyFlexLexer; + while(lexer->yylex() != 0) + ; + return 0; + } + + If you want to create multiple (different) lexer classes, you use the +'-P' flag (or the 'prefix=' option) to rename each 'yyFlexLexer' to some +other 'xxFlexLexer'. You then can include '' in your other +sources once per lexer class, first renaming 'yyFlexLexer' as follows: + + #undef yyFlexLexer + #define yyFlexLexer xxFlexLexer + #include + + #undef yyFlexLexer + #define yyFlexLexer zzFlexLexer + #include + + if, for example, you used '%option prefix="xx"' for one of your +scanners and '%option prefix="zz"' for the other. + + +File: flex.info, Node: Reentrant, Next: Lex and Posix, Prev: Cxx, Up: Top + +19 Reentrant C Scanners +*********************** + +'flex' has the ability to generate a reentrant C scanner. This is +accomplished by specifying '%option reentrant' ('-R') The generated +scanner is both portable, and safe to use in one or more separate +threads of control. The most common use for reentrant scanners is from +within multi-threaded applications. Any thread may create and execute a +reentrant 'flex' scanner without the need for synchronization with other +threads. + +* Menu: + +* Reentrant Uses:: +* Reentrant Overview:: +* Reentrant Example:: +* Reentrant Detail:: +* Reentrant Functions:: + + +File: flex.info, Node: Reentrant Uses, Next: Reentrant Overview, Prev: Reentrant, Up: Reentrant + +19.1 Uses for Reentrant Scanners +================================ + +However, there are other uses for a reentrant scanner. For example, you +could scan two or more files simultaneously to implement a 'diff' at the +token level (i.e., instead of at the character level): + + /* Example of maintaining more than one active scanner. */ + + do { + int tok1, tok2; + + tok1 = yylex( scanner_1 ); + tok2 = yylex( scanner_2 ); + + if( tok1 != tok2 ) + printf("Files are different."); + + } while ( tok1 && tok2 ); + + Another use for a reentrant scanner is recursion. (Note that a +recursive scanner can also be created using a non-reentrant scanner and +buffer states. *Note Multiple Input Buffers::.) + + The following crude scanner supports the 'eval' command by invoking +another instance of itself. + + /* Example of recursive invocation. */ + + %option reentrant + + %% + "eval(".+")" { + yyscan_t scanner; + YY_BUFFER_STATE buf; + + yylex_init( &scanner ); + yytext[yyleng-1] = ' '; + + buf = yy_scan_string( yytext + 5, scanner ); + yylex( scanner ); + + yy_delete_buffer(buf,scanner); + yylex_destroy( scanner ); + } + ... + %% + + +File: flex.info, Node: Reentrant Overview, Next: Reentrant Example, Prev: Reentrant Uses, Up: Reentrant + +19.2 An Overview of the Reentrant API +===================================== + +The API for reentrant scanners is different than for non-reentrant +scanners. Here is a quick overview of the API: + + '%option reentrant' must be specified. + + * All functions take one additional argument: 'yyscanner' + + * All global variables are replaced by their macro equivalents. (We + tell you this because it may be important to you during debugging.) + + * 'yylex_init' and 'yylex_destroy' must be called before and after + 'yylex', respectively. + + * Accessor methods (get/set functions) provide access to common + 'flex' variables. + + * User-specific data can be stored in 'yyextra'. + + +File: flex.info, Node: Reentrant Example, Next: Reentrant Detail, Prev: Reentrant Overview, Up: Reentrant + +19.3 Reentrant Example +====================== + +First, an example of a reentrant scanner: + /* This scanner prints "//" comments. */ + + %option reentrant stack noyywrap + %x COMMENT + + %% + + "//" yy_push_state( COMMENT, yyscanner); + .|\n + + \n yy_pop_state( yyscanner ); + [^\n]+ fprintf( yyout, "%s\n", yytext); + + %% + + int main ( int argc, char * argv[] ) + { + yyscan_t scanner; + + yylex_init ( &scanner ); + yylex ( scanner ); + yylex_destroy ( scanner ); + return 0; + } + + +File: flex.info, Node: Reentrant Detail, Next: Reentrant Functions, Prev: Reentrant Example, Up: Reentrant + +19.4 The Reentrant API in Detail +================================ + +Here are the things you need to do or know to use the reentrant C API of +'flex'. + +* Menu: + +* Specify Reentrant:: +* Extra Reentrant Argument:: +* Global Replacement:: +* Init and Destroy Functions:: +* Accessor Methods:: +* Extra Data:: +* About yyscan_t:: + + +File: flex.info, Node: Specify Reentrant, Next: Extra Reentrant Argument, Prev: Reentrant Detail, Up: Reentrant Detail + +19.4.1 Declaring a Scanner As Reentrant +--------------------------------------- + +%option reentrant (-reentrant) must be specified. + + Notice that '%option reentrant' is specified in the above example +(*note Reentrant Example::. Had this option not been specified, 'flex' +would have happily generated a non-reentrant scanner without +complaining. You may explicitly specify '%option noreentrant', if you +do _not_ want a reentrant scanner, although it is not necessary. The +default is to generate a non-reentrant scanner. + + +File: flex.info, Node: Extra Reentrant Argument, Next: Global Replacement, Prev: Specify Reentrant, Up: Reentrant Detail + +19.4.2 The Extra Argument +------------------------- + +All functions take one additional argument: 'yyscanner'. + + Notice that the calls to 'yy_push_state' and 'yy_pop_state' both have +an argument, 'yyscanner' , that is not present in a non-reentrant +scanner. Here are the declarations of 'yy_push_state' and +'yy_pop_state' in the reentrant scanner: + + static void yy_push_state ( int new_state , yyscan_t yyscanner ) ; + static void yy_pop_state ( yyscan_t yyscanner ) ; + + Notice that the argument 'yyscanner' appears in the declaration of +both functions. In fact, all 'flex' functions in a reentrant scanner +have this additional argument. It is always the last argument in the +argument list, it is always of type 'yyscan_t' (which is typedef'd to +'void *') and it is always named 'yyscanner'. As you may have guessed, +'yyscanner' is a pointer to an opaque data structure encapsulating the +current state of the scanner. For a list of function declarations, see +*note Reentrant Functions::. Note that preprocessor macros, such as +'BEGIN', 'ECHO', and 'REJECT', do not take this additional argument. + + +File: flex.info, Node: Global Replacement, Next: Init and Destroy Functions, Prev: Extra Reentrant Argument, Up: Reentrant Detail + +19.4.3 Global Variables Replaced By Macros +------------------------------------------ + +All global variables in traditional flex have been replaced by macro +equivalents. + + Note that in the above example, 'yyout' and 'yytext' are not plain +variables. These are macros that will expand to their equivalent +lvalue. All of the familiar 'flex' globals have been replaced by their +macro equivalents. In particular, 'yytext', 'yyleng', 'yylineno', +'yyin', 'yyout', 'yyextra', 'yylval', and 'yylloc' are macros. You may +safely use these macros in actions as if they were plain variables. We +only tell you this so you don't expect to link to these variables +externally. Currently, each macro expands to a member of an internal +struct, e.g., + + #define yytext (((struct yyguts_t*)yyscanner)->yytext_r) + + One important thing to remember about 'yytext' and friends is that +'yytext' is not a global variable in a reentrant scanner, you can not +access it directly from outside an action or from other functions. You +must use an accessor method, e.g., 'yyget_text', to accomplish this. +(See below). + + +File: flex.info, Node: Init and Destroy Functions, Next: Accessor Methods, Prev: Global Replacement, Up: Reentrant Detail + +19.4.4 Init and Destroy Functions +--------------------------------- + +'yylex_init' and 'yylex_destroy' must be called before and after +'yylex', respectively. + + int yylex_init ( yyscan_t * ptr_yy_globals ) ; + int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t * ptr_yy_globals ) ; + int yylex ( yyscan_t yyscanner ) ; + int yylex_destroy ( yyscan_t yyscanner ) ; + + The function 'yylex_init' must be called before calling any other +function. The argument to 'yylex_init' is the address of an +uninitialized pointer to be filled in by 'yylex_init', overwriting any +previous contents. The function 'yylex_init_extra' may be used instead, +taking as its first argument a variable of type 'YY_EXTRA_TYPE'. See +the section on yyextra, below, for more details. + + The value stored in 'ptr_yy_globals' should thereafter be passed to +'yylex' and 'yylex_destroy'. Flex does not save the argument passed to +'yylex_init', so it is safe to pass the address of a local pointer to +'yylex_init' so long as it remains in scope for the duration of all +calls to the scanner, up to and including the call to 'yylex_destroy'. + + The function 'yylex' should be familiar to you by now. The reentrant +version takes one argument, which is the value returned (via an +argument) by 'yylex_init'. Otherwise, it behaves the same as the +non-reentrant version of 'yylex'. + + Both 'yylex_init' and 'yylex_init_extra' returns 0 (zero) on success, +or non-zero on failure, in which case errno is set to one of the +following values: + + * ENOMEM Memory allocation error. *Note memory-management::. + * EINVAL Invalid argument. + + The function 'yylex_destroy' should be called to free resources used +by the scanner. After 'yylex_destroy' is called, the contents of +'yyscanner' should not be used. Of course, there is no need to destroy +a scanner if you plan to reuse it. A 'flex' scanner (both reentrant and +non-reentrant) may be restarted by calling 'yyrestart'. + + Below is an example of a program that creates a scanner, uses it, +then destroys it when done: + + int main () + { + yyscan_t scanner; + int tok; + + yylex_init(&scanner); + + while ((tok=yylex(scanner)) > 0) + printf("tok=%d yytext=%s\n", tok, yyget_text(scanner)); + + yylex_destroy(scanner); + return 0; + } + + +File: flex.info, Node: Accessor Methods, Next: Extra Data, Prev: Init and Destroy Functions, Up: Reentrant Detail + +19.4.5 Accessing Variables with Reentrant Scanners +-------------------------------------------------- + +Accessor methods (get/set functions) provide access to common 'flex' +variables. + + Many scanners that you build will be part of a larger project. +Portions of your project will need access to 'flex' values, such as +'yytext'. In a non-reentrant scanner, these values are global, so there +is no problem accessing them. However, in a reentrant scanner, there +are no global 'flex' values. You can not access them directly. +Instead, you must access 'flex' values using accessor methods (get/set +functions). Each accessor method is named 'yyget_NAME' or 'yyset_NAME', +where 'NAME' is the name of the 'flex' variable you want. For example: + + /* Set the last character of yytext to NULL. */ + void chop ( yyscan_t scanner ) + { + int len = yyget_leng( scanner ); + yyget_text( scanner )[len - 1] = '\0'; + } + + The above code may be called from within an action like this: + + %% + .+\n { chop( yyscanner );} + + You may find that '%option header-file' is particularly useful for +generating prototypes of all the accessor functions. *Note +option-header::. + + +File: flex.info, Node: Extra Data, Next: About yyscan_t, Prev: Accessor Methods, Up: Reentrant Detail + +19.4.6 Extra Data +----------------- + +User-specific data can be stored in 'yyextra'. + + In a reentrant scanner, it is unwise to use global variables to +communicate with or maintain state between different pieces of your +program. However, you may need access to external data or invoke +external functions from within the scanner actions. Likewise, you may +need to pass information to your scanner (e.g., open file descriptors, +or database connections). In a non-reentrant scanner, the only way to +do this would be through the use of global variables. 'Flex' allows you +to store arbitrary, "extra" data in a scanner. This data is accessible +through the accessor methods 'yyget_extra' and 'yyset_extra' from +outside the scanner, and through the shortcut macro 'yyextra' from +within the scanner itself. They are defined as follows: + + #define YY_EXTRA_TYPE void* + YY_EXTRA_TYPE yyget_extra ( yyscan_t scanner ); + void yyset_extra ( YY_EXTRA_TYPE arbitrary_data , yyscan_t scanner); + + In addition, an extra form of 'yylex_init' is provided, +'yylex_init_extra'. This function is provided so that the yyextra value +can be accessed from within the very first yyalloc, used to allocate the +scanner itself. + + By default, 'YY_EXTRA_TYPE' is defined as type 'void *'. You may +redefine this type using '%option extra-type="your_type"' in the +scanner: + + /* An example of overriding YY_EXTRA_TYPE. */ + %{ + #include + #include + %} + %option reentrant + %option extra-type="struct stat *" + %% + + __filesize__ printf( "%ld", yyextra->st_size ); + __lastmod__ printf( "%ld", yyextra->st_mtime ); + %% + void scan_file( char* filename ) + { + yyscan_t scanner; + struct stat buf; + FILE *in; + + in = fopen( filename, "r" ); + stat( filename, &buf ); + + yylex_init_extra( buf, &scanner ); + yyset_in( in, scanner ); + yylex( scanner ); + yylex_destroy( scanner ); + + fclose( in ); + } + + +File: flex.info, Node: About yyscan_t, Prev: Extra Data, Up: Reentrant Detail + +19.4.7 About yyscan_t +--------------------- + +'yyscan_t' is defined as: + + typedef void* yyscan_t; + + It is initialized by 'yylex_init()' to point to an internal +structure. You should never access this value directly. In particular, +you should never attempt to free it (use 'yylex_destroy()' instead.) + + +File: flex.info, Node: Reentrant Functions, Prev: Reentrant Detail, Up: Reentrant + +19.5 Functions and Macros Available in Reentrant C Scanners +=========================================================== + +The following Functions are available in a reentrant scanner: + + char *yyget_text ( yyscan_t scanner ); + int yyget_leng ( yyscan_t scanner ); + FILE *yyget_in ( yyscan_t scanner ); + FILE *yyget_out ( yyscan_t scanner ); + int yyget_lineno ( yyscan_t scanner ); + YY_EXTRA_TYPE yyget_extra ( yyscan_t scanner ); + int yyget_debug ( yyscan_t scanner ); + + void yyset_debug ( int flag, yyscan_t scanner ); + void yyset_in ( FILE * in_str , yyscan_t scanner ); + void yyset_out ( FILE * out_str , yyscan_t scanner ); + void yyset_lineno ( int line_number , yyscan_t scanner ); + void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t scanner ); + + There are no "set" functions for yytext and yyleng. This is +intentional. + + The following Macro shortcuts are available in actions in a reentrant +scanner: + + yytext + yyleng + yyin + yyout + yylineno + yyextra + yy_flex_debug + + In a reentrant C scanner, support for yylineno is always present +(i.e., you may access yylineno), but the value is never modified by +'flex' unless '%option yylineno' is enabled. This is to allow the user +to maintain the line count independently of 'flex'. + + The following functions and macros are made available when '%option +bison-bridge' ('--bison-bridge') is specified: + + YYSTYPE * yyget_lval ( yyscan_t scanner ); + void yyset_lval ( YYSTYPE * yylvalp , yyscan_t scanner ); + yylval + + The following functions and macros are made available when '%option +bison-locations' ('--bison-locations') is specified: + + YYLTYPE *yyget_lloc ( yyscan_t scanner ); + void yyset_lloc ( YYLTYPE * yyllocp , yyscan_t scanner ); + yylloc + + Support for yylval assumes that 'YYSTYPE' is a valid type. Support +for yylloc assumes that 'YYSLYPE' is a valid type. Typically, these +types are generated by 'bison', and are included in section 1 of the +'flex' input. + + +File: flex.info, Node: Lex and Posix, Next: Memory Management, Prev: Reentrant, Up: Top + +20 Incompatibilities with Lex and Posix +*************************************** + +'flex' is a rewrite of the AT&T Unix _lex_ tool (the two implementations +do not share any code, though), with some extensions and +incompatibilities, both of which are of concern to those who wish to +write scanners acceptable to both implementations. 'flex' is fully +compliant with the POSIX 'lex' specification, except that when using +'%pointer' (the default), a call to 'unput()' destroys the contents of +'yytext', which is counter to the POSIX specification. In this section +we discuss all of the known areas of incompatibility between 'flex', +AT&T 'lex', and the POSIX specification. 'flex''s '-l' option turns on +maximum compatibility with the original AT&T 'lex' implementation, at +the cost of a major loss in the generated scanner's performance. We +note below which incompatibilities can be overcome using the '-l' +option. 'flex' is fully compatible with 'lex' with the following +exceptions: + + * The undocumented 'lex' scanner internal variable 'yylineno' is not + supported unless '-l' or '%option yylineno' is used. + + * 'yylineno' should be maintained on a per-buffer basis, rather than + a per-scanner (single global variable) basis. + + * 'yylineno' is not part of the POSIX specification. + + * The 'input()' routine is not redefinable, though it may be called + to read characters following whatever has been matched by a rule. + If 'input()' encounters an end-of-file the normal 'yywrap()' + processing is done. A "real" end-of-file is returned by 'input()' + as 'EOF'. + + * Input is instead controlled by defining the 'YY_INPUT()' macro. + + * The 'flex' restriction that 'input()' cannot be redefined is in + accordance with the POSIX specification, which simply does not + specify any way of controlling the scanner's input other than by + making an initial assignment to 'yyin'. + + * The 'unput()' routine is not redefinable. This restriction is in + accordance with POSIX. + + * 'flex' scanners are not as reentrant as 'lex' scanners. In + particular, if you have an interactive scanner and an interrupt + handler which long-jumps out of the scanner, and the scanner is + subsequently called again, you may get the following message: + + fatal flex scanner internal error--end of buffer missed + + To reenter the scanner, first use: + + yyrestart( yyin ); + + Note that this call will throw away any buffered input; usually + this isn't a problem with an interactive scanner. *Note + Reentrant::, for 'flex''s reentrant API. + + * Also note that 'flex' C++ scanner classes _are_ reentrant, so if + using C++ is an option for you, you should use them instead. *Note + Cxx::, and *note Reentrant:: for details. + + * 'output()' is not supported. Output from the ECHO macro is done to + the file-pointer 'yyout' (default 'stdout)'. + + * 'output()' is not part of the POSIX specification. + + * 'lex' does not support exclusive start conditions (%x), though they + are in the POSIX specification. + + * When definitions are expanded, 'flex' encloses them in parentheses. + With 'lex', the following: + + NAME [A-Z][A-Z0-9]* + %% + foo{NAME}? printf( "Found it\n" ); + %% + + will not match the string 'foo' because when the macro is expanded + the rule is equivalent to 'foo[A-Z][A-Z0-9]*?' and the precedence + is such that the '?' is associated with '[A-Z0-9]*'. With 'flex', + the rule will be expanded to 'foo([A-Z][A-Z0-9]*)?' and so the + string 'foo' will match. + + * Note that if the definition begins with '^' or ends with '$' then + it is _not_ expanded with parentheses, to allow these operators to + appear in definitions without losing their special meanings. But + the '', '/', and '<>' operators cannot be used in a 'flex' + definition. + + * Using '-l' results in the 'lex' behavior of no parentheses around + the definition. + + * The POSIX specification is that the definition be enclosed in + parentheses. + + * Some implementations of 'lex' allow a rule's action to begin on a + separate line, if the rule's pattern has trailing whitespace: + + %% + foo|bar + { foobar_action();} + + 'flex' does not support this feature. + + * The 'lex' '%r' (generate a Ratfor scanner) option is not supported. + It is not part of the POSIX specification. + + * After a call to 'unput()', _yytext_ is undefined until the next + token is matched, unless the scanner was built using '%array'. + This is not the case with 'lex' or the POSIX specification. The + '-l' option does away with this incompatibility. + + * The precedence of the '{,}' (numeric range) operator is different. + The AT&T and POSIX specifications of 'lex' interpret 'abc{1,3}' as + match one, two, or three occurrences of 'abc'", whereas 'flex' + interprets it as "match 'ab' followed by one, two, or three + occurrences of 'c'". The '-l' and '--posix' options do away with + this incompatibility. + + * The precedence of the '^' operator is different. 'lex' interprets + '^foo|bar' as "match either 'foo' at the beginning of a line, or + 'bar' anywhere", whereas 'flex' interprets it as "match either + 'foo' or 'bar' if they come at the beginning of a line". The + latter is in agreement with the POSIX specification. + + * The special table-size declarations such as '%a' supported by 'lex' + are not required by 'flex' scanners.. 'flex' ignores them. + * The name 'FLEX_SCANNER' is '#define''d so scanners may be written + for use with either 'flex' or 'lex'. Scanners also include + 'YY_FLEX_MAJOR_VERSION', 'YY_FLEX_MINOR_VERSION' and + 'YY_FLEX_SUBMINOR_VERSION' indicating which version of 'flex' + generated the scanner. For example, for the 2.5.22 release, these + defines would be 2, 5 and 22 respectively. If the version of + 'flex' being used is a beta version, then the symbol 'FLEX_BETA' is + defined. + + * The symbols '[[' and ']]' in the code sections of the input may + conflict with the m4 delimiters. *Note M4 Dependency::. + + The following 'flex' features are not included in 'lex' or the POSIX +specification: + + * C++ scanners + * %option + * start condition scopes + * start condition stacks + * interactive/non-interactive scanners + * yy_scan_string() and friends + * yyterminate() + * yy_set_interactive() + * yy_set_bol() + * YY_AT_BOL() <> + * <*> + * YY_DECL + * YY_START + * YY_USER_ACTION + * YY_USER_INIT + * #line directives + * %{}'s around actions + * reentrant C API + * multiple actions on a line + * almost all of the 'flex' command-line options + + The feature "multiple actions on a line" refers to the fact that with +'flex' you can put multiple actions on the same line, separated with +semi-colons, while with 'lex', the following: + + foo handle_foo(); ++num_foos_seen; + + is (rather surprisingly) truncated to + + foo handle_foo(); + + 'flex' does not truncate the action. Actions that are not enclosed +in braces are simply terminated at the end of the line. + + +File: flex.info, Node: Memory Management, Next: Serialized Tables, Prev: Lex and Posix, Up: Top + +21 Memory Management +******************** + +This chapter describes how flex handles dynamic memory, and how you can +override the default behavior. + +* Menu: + +* The Default Memory Management:: +* Overriding The Default Memory Management:: +* A Note About yytext And Memory:: + + +File: flex.info, Node: The Default Memory Management, Next: Overriding The Default Memory Management, Prev: Memory Management, Up: Memory Management + +21.1 The Default Memory Management +================================== + +Flex allocates dynamic memory during initialization, and once in a while +from within a call to yylex(). Initialization takes place during the +first call to yylex(). Thereafter, flex may reallocate more memory if +it needs to enlarge a buffer. As of version 2.5.9 Flex will clean up +all memory when you call 'yylex_destroy' *Note faq-memory-leak::. + + Flex allocates dynamic memory for four purposes, listed below (1) + +16kB for the input buffer. + Flex allocates memory for the character buffer used to perform + pattern matching. Flex must read ahead from the input stream and + store it in a large character buffer. This buffer is typically the + largest chunk of dynamic memory flex consumes. This buffer will + grow if necessary, doubling the size each time. Flex frees this + memory when you call yylex_destroy(). The default size of this + buffer (16384 bytes) is almost always too large. The ideal size + for this buffer is the length of the longest token expected, in + bytes, plus a little more. Flex will allocate a few extra bytes + for housekeeping. Currently, to override the size of the input + buffer you must '#define YY_BUF_SIZE' to whatever number of bytes + you want. We don't plan to change this in the near future, but we + reserve the right to do so if we ever add a more robust memory + management API. + +64kb for the REJECT state. This will only be allocated if you use REJECT. + The size is large enough to hold the same number of states as + characters in the input buffer. If you override the size of the + input buffer (via 'YY_BUF_SIZE'), then you automatically override + the size of this buffer as well. + +100 bytes for the start condition stack. + Flex allocates memory for the start condition stack. This is the + stack used for pushing start states, i.e., with yy_push_state(). + It will grow if necessary. Since the states are simply integers, + this stack doesn't consume much memory. This stack is not present + if '%option stack' is not specified. You will rarely need to tune + this buffer. The ideal size for this stack is the maximum depth + expected. The memory for this stack is automatically destroyed + when you call yylex_destroy(). *Note option-stack::. + +40 bytes for each YY_BUFFER_STATE. + Flex allocates memory for each YY_BUFFER_STATE. The buffer state + itself is about 40 bytes, plus an additional large character buffer + (described above.) The initial buffer state is created during + initialization, and with each call to yy_create_buffer(). You + can't tune the size of this, but you can tune the character buffer + as described above. Any buffer state that you explicitly create by + calling yy_create_buffer() is _NOT_ destroyed automatically. You + must call yy_delete_buffer() to free the memory. The exception to + this rule is that flex will delete the current buffer automatically + when you call yylex_destroy(). If you delete the current buffer, + be sure to set it to NULL. That way, flex will not try to delete + the buffer a second time (possibly crashing your program!) At the + time of this writing, flex does not provide a growable stack for + the buffer states. You have to manage that yourself. *Note + Multiple Input Buffers::. + +84 bytes for the reentrant scanner guts + Flex allocates about 84 bytes for the reentrant scanner structure + when you call yylex_init(). It is destroyed when the user calls + yylex_destroy(). + + ---------- Footnotes ---------- + + (1) The quantities given here are approximate, and may vary due to +host architecture, compiler configuration, or due to future enhancements +to flex. + + +File: flex.info, Node: Overriding The Default Memory Management, Next: A Note About yytext And Memory, Prev: The Default Memory Management, Up: Memory Management + +21.2 Overriding The Default Memory Management +============================================= + +Flex calls the functions 'yyalloc', 'yyrealloc', and 'yyfree' when it +needs to allocate or free memory. By default, these functions are +wrappers around the standard C functions, 'malloc', 'realloc', and +'free', respectively. You can override the default implementations by +telling flex that you will provide your own implementations. + + To override the default implementations, you must do two things: + + 1. Suppress the default implementations by specifying one or more of + the following options: + + * '%option noyyalloc' + * '%option noyyrealloc' + * '%option noyyfree'. + + 2. Provide your own implementation of the following functions: (1) + + // For a non-reentrant scanner + void * yyalloc (size_t bytes); + void * yyrealloc (void * ptr, size_t bytes); + void yyfree (void * ptr); + + // For a reentrant scanner + void * yyalloc (size_t bytes, void * yyscanner); + void * yyrealloc (void * ptr, size_t bytes, void * yyscanner); + void yyfree (void * ptr, void * yyscanner); + + In the following example, we will override all three memory routines. +We assume that there is a custom allocator with garbage collection. In +order to make this example interesting, we will use a reentrant scanner, +passing a pointer to the custom allocator through 'yyextra'. + + %{ + #include "some_allocator.h" + %} + + /* Suppress the default implementations. */ + %option noyyalloc noyyrealloc noyyfree + %option reentrant + + /* Initialize the allocator. */ + %{ + #define YY_EXTRA_TYPE struct allocator* + #define YY_USER_INIT yyextra = allocator_create(); + %} + + %% + .|\n ; + %% + + /* Provide our own implementations. */ + void * yyalloc (size_t bytes, void* yyscanner) { + return allocator_alloc (yyextra, bytes); + } + + void * yyrealloc (void * ptr, size_t bytes, void* yyscanner) { + return allocator_realloc (yyextra, bytes); + } + + void yyfree (void * ptr, void * yyscanner) { + /* Do nothing -- we leave it to the garbage collector. */ + } + + + ---------- Footnotes ---------- + + (1) It is not necessary to override all (or any) of the memory +management routines. You may, for example, override 'yyrealloc', but +not 'yyfree' or 'yyalloc'. + + +File: flex.info, Node: A Note About yytext And Memory, Prev: Overriding The Default Memory Management, Up: Memory Management + +21.3 A Note About yytext And Memory +=================================== + +When flex finds a match, 'yytext' points to the first character of the +match in the input buffer. The string itself is part of the input +buffer, and is _NOT_ allocated separately. The value of yytext will be +overwritten the next time yylex() is called. In short, the value of +yytext is only valid from within the matched rule's action. + + Often, you want the value of yytext to persist for later processing, +i.e., by a parser with non-zero lookahead. In order to preserve yytext, +you will have to copy it with strdup() or a similar function. But this +introduces some headache because your parser is now responsible for +freeing the copy of yytext. If you use a yacc or bison parser, +(commonly used with flex), you will discover that the error recovery +mechanisms can cause memory to be leaked. + + To prevent memory leaks from strdup'd yytext, you will have to track +the memory somehow. Our experience has shown that a garbage collection +mechanism or a pooled memory mechanism will save you a lot of grief when +writing parsers. + + +File: flex.info, Node: Serialized Tables, Next: Diagnostics, Prev: Memory Management, Up: Top + +22 Serialized Tables +******************** + +A 'flex' scanner has the ability to save the DFA tables to a file, and +load them at runtime when needed. The motivation for this feature is to +reduce the runtime memory footprint. Traditionally, these tables have +been compiled into the scanner as C arrays, and are sometimes quite +large. Since the tables are compiled into the scanner, the memory used +by the tables can never be freed. This is a waste of memory, especially +if an application uses several scanners, but none of them at the same +time. + + The serialization feature allows the tables to be loaded at runtime, +before scanning begins. The tables may be discarded when scanning is +finished. + +* Menu: + +* Creating Serialized Tables:: +* Loading and Unloading Serialized Tables:: +* Tables File Format:: + + +File: flex.info, Node: Creating Serialized Tables, Next: Loading and Unloading Serialized Tables, Prev: Serialized Tables, Up: Serialized Tables + +22.1 Creating Serialized Tables +=============================== + +You may create a scanner with serialized tables by specifying: + + %option tables-file=FILE + or + --tables-file=FILE + + These options instruct flex to save the DFA tables to the file FILE. +The tables will _not_ be embedded in the generated scanner. The scanner +will not function on its own. The scanner will be dependent upon the +serialized tables. You must load the tables from this file at runtime +before you can scan anything. + + If you do not specify a filename to '--tables-file', the tables will +be saved to 'lex.yy.tables', where 'yy' is the appropriate prefix. + + If your project uses several different scanners, you can concatenate +the serialized tables into one file, and flex will find the correct set +of tables, using the scanner prefix as part of the lookup key. An +example follows: + + $ flex --tables-file --prefix=cpp cpp.l + $ flex --tables-file --prefix=c c.l + $ cat lex.cpp.tables lex.c.tables > all.tables + + The above example created two scanners, 'cpp', and 'c'. Since we did +not specify a filename, the tables were serialized to 'lex.c.tables' and +'lex.cpp.tables', respectively. Then, we concatenated the two files +together into 'all.tables', which we will distribute with our project. +At runtime, we will open the file and tell flex to load the tables from +it. Flex will find the correct tables automatically. (See next +section). + + +File: flex.info, Node: Loading and Unloading Serialized Tables, Next: Tables File Format, Prev: Creating Serialized Tables, Up: Serialized Tables + +22.2 Loading and Unloading Serialized Tables +============================================ + +If you've built your scanner with '%option tables-file', then you must +load the scanner tables at runtime. This can be accomplished with the +following function: + + -- Function: int yytables_fload (FILE* FP [, yyscan_t SCANNER]) + Locates scanner tables in the stream pointed to by FP and loads + them. Memory for the tables is allocated via 'yyalloc'. You must + call this function before the first call to 'yylex'. The argument + SCANNER only appears in the reentrant scanner. This function + returns '0' (zero) on success, or non-zero on error. + + The loaded tables are *not* automatically destroyed (unloaded) when +you call 'yylex_destroy'. The reason is that you may create several +scanners of the same type (in a reentrant scanner), each of which needs +access to these tables. To avoid a nasty memory leak, you must call the +following function: + + -- Function: int yytables_destroy ([yyscan_t SCANNER]) + Unloads the scanner tables. The tables must be loaded again before + you can scan any more data. The argument SCANNER only appears in + the reentrant scanner. This function returns '0' (zero) on + success, or non-zero on error. + + *The functions 'yytables_fload' and 'yytables_destroy' are not +thread-safe.* You must ensure that these functions are called exactly +once (for each scanner type) in a threaded program, before any thread +calls 'yylex'. After the tables are loaded, they are never written to, +and no thread protection is required thereafter - until you destroy +them. + + +File: flex.info, Node: Tables File Format, Prev: Loading and Unloading Serialized Tables, Up: Serialized Tables + +22.3 Tables File Format +======================= + +This section defines the file format of serialized 'flex' tables. + + The tables format allows for one or more sets of tables to be +specified, where each set corresponds to a given scanner. Scanners are +indexed by name, as described below. The file format is as follows: + + TABLE SET 1 + +-------------------------------+ + Header | uint32 th_magic; | + | uint32 th_hsize; | + | uint32 th_ssize; | + | uint16 th_flags; | + | char th_version[]; | + | char th_name[]; | + | uint8 th_pad64[]; | + +-------------------------------+ + Table 1 | uint16 td_id; | + | uint16 td_flags; | + | uint32 td_hilen; | + | uint32 td_lolen; | + | void td_data[]; | + | uint8 td_pad64[]; | + +-------------------------------+ + Table 2 | | + . . . + . . . + . . . + . . . + Table n | | + +-------------------------------+ + TABLE SET 2 + . + . + . + TABLE SET N + + The above diagram shows that a complete set of tables consists of a +header followed by multiple individual tables. Furthermore, multiple +complete sets may be present in the same file, each set with its own +header and tables. The sets are contiguous in the file. The only way +to know if another set follows is to check the next four bytes for the +magic number (or check for EOF). The header and tables sections are +padded to 64-bit boundaries. Below we describe each field in detail. +This format does not specify how the scanner will expand the given data, +i.e., data may be serialized as int8, but expanded to an int32 array at +runtime. This is to reduce the size of the serialized data where +possible. Remember, _all integer values are in network byte order_. + +Fields of a table header: + +'th_magic' + Magic number, always 0xF13C57B1. + +'th_hsize' + Size of this entire header, in bytes, including all fields plus any + padding. + +'th_ssize' + Size of this entire set, in bytes, including the header, all + tables, plus any padding. + +'th_flags' + Bit flags for this table set. Currently unused. + +'th_version[]' + Flex version in NULL-terminated string format. e.g., '2.5.13a'. + This is the version of flex that was used to create the serialized + tables. + +'th_name[]' + Contains the name of this table set. The default is 'yytables', + and is prefixed accordingly, e.g., 'footables'. Must be + NULL-terminated. + +'th_pad64[]' + Zero or more NULL bytes, padding the entire header to the next + 64-bit boundary as calculated from the beginning of the header. + +Fields of a table: + +'td_id' + Specifies the table identifier. Possible values are: + 'YYTD_ID_ACCEPT (0x01)' + 'yy_accept' + 'YYTD_ID_BASE (0x02)' + 'yy_base' + 'YYTD_ID_CHK (0x03)' + 'yy_chk' + 'YYTD_ID_DEF (0x04)' + 'yy_def' + 'YYTD_ID_EC (0x05)' + 'yy_ec ' + 'YYTD_ID_META (0x06)' + 'yy_meta' + 'YYTD_ID_NUL_TRANS (0x07)' + 'yy_NUL_trans' + 'YYTD_ID_NXT (0x08)' + 'yy_nxt'. This array may be two dimensional. See the + 'td_hilen' field below. + 'YYTD_ID_RULE_CAN_MATCH_EOL (0x09)' + 'yy_rule_can_match_eol' + 'YYTD_ID_START_STATE_LIST (0x0A)' + 'yy_start_state_list'. This array is handled specially + because it is an array of pointers to structs. See the + 'td_flags' field below. + 'YYTD_ID_TRANSITION (0x0B)' + 'yy_transition'. This array is handled specially because it + is an array of structs. See the 'td_lolen' field below. + 'YYTD_ID_ACCLIST (0x0C)' + 'yy_acclist' + +'td_flags' + Bit flags describing how to interpret the data in 'td_data'. The + data arrays are one-dimensional by default, but may be two + dimensional as specified in the 'td_hilen' field. + + 'YYTD_DATA8 (0x01)' + The data is serialized as an array of type int8. + 'YYTD_DATA16 (0x02)' + The data is serialized as an array of type int16. + 'YYTD_DATA32 (0x04)' + The data is serialized as an array of type int32. + 'YYTD_PTRANS (0x08)' + The data is a list of indexes of entries in the expanded + 'yy_transition' array. Each index should be expanded to a + pointer to the corresponding entry in the 'yy_transition' + array. We count on the fact that the 'yy_transition' array + has already been seen. + 'YYTD_STRUCT (0x10)' + The data is a list of yy_trans_info structs, each of which + consists of two integers. There is no padding between struct + elements or between structs. The type of each member is + determined by the 'YYTD_DATA*' bits. + +'td_hilen' + If 'td_hilen' is non-zero, then the data is a two-dimensional + array. Otherwise, the data is a one-dimensional array. 'td_hilen' + contains the number of elements in the higher dimensional array, + and 'td_lolen' contains the number of elements in the lowest + dimension. + + Conceptually, 'td_data' is either 'sometype td_data[td_lolen]', or + 'sometype td_data[td_hilen][td_lolen]', where 'sometype' is + specified by the 'td_flags' field. It is possible for both + 'td_lolen' and 'td_hilen' to be zero, in which case 'td_data' is a + zero length array, and no data is loaded, i.e., this table is + simply skipped. Flex does not currently generate tables of zero + length. + +'td_lolen' + Specifies the number of elements in the lowest dimension array. If + this is a one-dimensional array, then it is simply the number of + elements in this array. The element size is determined by the + 'td_flags' field. + +'td_data[]' + The table data. This array may be a one- or two-dimensional array, + of type 'int8', 'int16', 'int32', 'struct yy_trans_info', or + 'struct yy_trans_info*', depending upon the values in the + 'td_flags', 'td_hilen', and 'td_lolen' fields. + +'td_pad64[]' + Zero or more NULL bytes, padding the entire table to the next + 64-bit boundary as calculated from the beginning of this table. + + +File: flex.info, Node: Diagnostics, Next: Limitations, Prev: Serialized Tables, Up: Top + +23 Diagnostics +************** + +The following is a list of 'flex' diagnostic messages: + + * 'warning, rule cannot be matched' indicates that the given rule + cannot be matched because it follows other rules that will always + match the same text as it. For example, in the following 'foo' + cannot be matched because it comes after an identifier "catch-all" + rule: + + [a-z]+ got_identifier(); + foo got_foo(); + + Using 'REJECT' in a scanner suppresses this warning. + + * 'warning, -s option given but default rule can be matched' means + that it is possible (perhaps only in a particular start condition) + that the default rule (match any single character) is the only one + that will match a particular input. Since '-s' was given, + presumably this is not intended. + + * 'reject_used_but_not_detected undefined' or + 'yymore_used_but_not_detected undefined'. These errors can occur + at compile time. They indicate that the scanner uses 'REJECT' or + 'yymore()' but that 'flex' failed to notice the fact, meaning that + 'flex' scanned the first two sections looking for occurrences of + these actions and failed to find any, but somehow you snuck some in + (via a #include file, for example). Use '%option reject' or + '%option yymore' to indicate to 'flex' that you really do use these + features. + + * 'flex scanner jammed'. a scanner compiled with '-s' has + encountered an input string which wasn't matched by any of its + rules. This error can also occur due to internal problems. + + * 'token too large, exceeds YYLMAX'. your scanner uses '%array' and + one of its rules matched a string longer than the 'YYLMAX' constant + (8K bytes by default). You can increase the value by #define'ing + 'YYLMAX' in the definitions section of your 'flex' input. + + * 'scanner requires -8 flag to use the character 'x''. Your scanner + specification includes recognizing the 8-bit character ''x'' and + you did not specify the -8 flag, and your scanner defaulted to + 7-bit because you used the '-Cf' or '-CF' table compression + options. See the discussion of the '-7' flag, *note Scanner + Options::, for details. + + * 'flex scanner push-back overflow'. you used 'unput()' to push back + so much text that the scanner's buffer could not hold both the + pushed-back text and the current token in 'yytext'. Ideally the + scanner should dynamically resize the buffer in this case, but at + present it does not. + + * 'input buffer overflow, can't enlarge buffer because scanner uses + REJECT'. the scanner was working on matching an extremely large + token and needed to expand the input buffer. This doesn't work + with scanners that use 'REJECT'. + + * 'fatal flex scanner internal error--end of buffer missed'. This + can occur in a scanner which is reentered after a long-jump has + jumped out (or over) the scanner's activation frame. Before + reentering the scanner, use: + yyrestart( yyin ); + or, as noted above, switch to using the C++ scanner class. + + * 'too many start conditions in <> construct!' you listed more start + conditions in a <> construct than exist (so you must have listed at + least one of them twice). + + +File: flex.info, Node: Limitations, Next: Bibliography, Prev: Diagnostics, Up: Top + +24 Limitations +************** + +Some trailing context patterns cannot be properly matched and generate +warning messages ('dangerous trailing context'). These are patterns +where the ending of the first part of the rule matches the beginning of +the second part, such as 'zx*/xy*', where the 'x*' matches the 'x' at +the beginning of the trailing context. (Note that the POSIX draft +states that the text matched by such patterns is undefined.) For some +trailing context rules, parts which are actually fixed-length are not +recognized as such, leading to the abovementioned performance loss. In +particular, parts using '|' or '{n}' (such as 'foo{3}') are always +considered variable-length. Combining trailing context with the special +'|' action can result in _fixed_ trailing context being turned into the +more expensive _variable_ trailing context. For example, in the +following: + + %% + abc | + xyz/def + + Use of 'unput()' invalidates yytext and yyleng, unless the '%array' +directive or the '-l' option has been used. Pattern-matching of 'NUL's +is substantially slower than matching other characters. Dynamic +resizing of the input buffer is slow, as it entails rescanning all the +text matched so far by the current (generally huge) token. Due to both +buffering of input and read-ahead, you cannot intermix calls to +'' routines, such as, getchar(), with 'flex' rules and expect +it to work. Call 'input()' instead. The total table entries listed by +the '-v' flag excludes the number of table entries needed to determine +what rule has been matched. The number of entries is equal to the +number of DFA states if the scanner does not use 'REJECT', and somewhat +greater than the number of states if it does. 'REJECT' cannot be used +with the '-f' or '-F' options. + + The 'flex' internal algorithms need documentation. + + +File: flex.info, Node: Bibliography, Next: FAQ, Prev: Limitations, Up: Top + +25 Additional Reading +********************* + +You may wish to read more about the following programs: + * lex + * yacc + * sed + * awk + + The following books may contain material of interest: + + John Levine, Tony Mason, and Doug Brown, _Lex & Yacc_, O'Reilly and +Associates. Be sure to get the 2nd edition. + + M. E. Lesk and E. Schmidt, _LEX - Lexical Analyzer Generator_ + + Alfred Aho, Ravi Sethi and Jeffrey Ullman, _Compilers: Principles, +Techniques and Tools_, Addison-Wesley (1986). Describes the +pattern-matching techniques used by 'flex' (deterministic finite +automata). + + +File: flex.info, Node: FAQ, Next: Appendices, Prev: Bibliography, Up: Top + +FAQ +*** + +From time to time, the 'flex' maintainer receives certain questions. +Rather than repeat answers to well-understood problems, we publish them +here. + +* Menu: + +* When was flex born?:: +* How do I expand backslash-escape sequences in C-style quoted strings?:: +* Why do flex scanners call fileno if it is not ANSI compatible?:: +* Does flex support recursive pattern definitions?:: +* How do I skip huge chunks of input (tens of megabytes) while using flex?:: +* Flex is not matching my patterns in the same order that I defined them.:: +* My actions are executing out of order or sometimes not at all.:: +* How can I have multiple input sources feed into the same scanner at the same time?:: +* Can I build nested parsers that work with the same input file?:: +* How can I match text only at the end of a file?:: +* How can I make REJECT cascade across start condition boundaries?:: +* Why cant I use fast or full tables with interactive mode?:: +* How much faster is -F or -f than -C?:: +* If I have a simple grammar cant I just parse it with flex?:: +* Why doesn't yyrestart() set the start state back to INITIAL?:: +* How can I match C-style comments?:: +* The period isn't working the way I expected.:: +* Can I get the flex manual in another format?:: +* Does there exist a "faster" NDFA->DFA algorithm?:: +* How does flex compile the DFA so quickly?:: +* How can I use more than 8192 rules?:: +* How do I abandon a file in the middle of a scan and switch to a new file?:: +* How do I execute code only during initialization (only before the first scan)?:: +* How do I execute code at termination?:: +* Where else can I find help?:: +* Can I include comments in the "rules" section of the file?:: +* I get an error about undefined yywrap().:: +* How can I change the matching pattern at run time?:: +* How can I expand macros in the input?:: +* How can I build a two-pass scanner?:: +* How do I match any string not matched in the preceding rules?:: +* I am trying to port code from AT&T lex that uses yysptr and yysbuf.:: +* Is there a way to make flex treat NULL like a regular character?:: +* Whenever flex can not match the input it says "flex scanner jammed".:: +* Why doesn't flex have non-greedy operators like perl does?:: +* Memory leak - 16386 bytes allocated by malloc.:: +* How do I track the byte offset for lseek()?:: +* How do I use my own I/O classes in a C++ scanner?:: +* How do I skip as many chars as possible?:: +* deleteme00:: +* Are certain equivalent patterns faster than others?:: +* Is backing up a big deal?:: +* Can I fake multi-byte character support?:: +* deleteme01:: +* Can you discuss some flex internals?:: +* unput() messes up yy_at_bol:: +* The | operator is not doing what I want:: +* Why can't flex understand this variable trailing context pattern?:: +* The ^ operator isn't working:: +* Trailing context is getting confused with trailing optional patterns:: +* Is flex GNU or not?:: +* ERASEME53:: +* I need to scan if-then-else blocks and while loops:: +* ERASEME55:: +* ERASEME56:: +* ERASEME57:: +* Is there a repository for flex scanners?:: +* How can I conditionally compile or preprocess my flex input file?:: +* Where can I find grammars for lex and yacc?:: +* I get an end-of-buffer message for each character scanned.:: +* unnamed-faq-62:: +* unnamed-faq-63:: +* unnamed-faq-64:: +* unnamed-faq-65:: +* unnamed-faq-66:: +* unnamed-faq-67:: +* unnamed-faq-68:: +* unnamed-faq-69:: +* unnamed-faq-70:: +* unnamed-faq-71:: +* unnamed-faq-72:: +* unnamed-faq-73:: +* unnamed-faq-74:: +* unnamed-faq-75:: +* unnamed-faq-76:: +* unnamed-faq-77:: +* unnamed-faq-78:: +* unnamed-faq-79:: +* unnamed-faq-80:: +* unnamed-faq-81:: +* unnamed-faq-82:: +* unnamed-faq-83:: +* unnamed-faq-84:: +* unnamed-faq-85:: +* unnamed-faq-86:: +* unnamed-faq-87:: +* unnamed-faq-88:: +* unnamed-faq-90:: +* unnamed-faq-91:: +* unnamed-faq-92:: +* unnamed-faq-93:: +* unnamed-faq-94:: +* unnamed-faq-95:: +* unnamed-faq-96:: +* unnamed-faq-97:: +* unnamed-faq-98:: +* unnamed-faq-99:: +* unnamed-faq-100:: +* unnamed-faq-101:: +* What is the difference between YYLEX_PARAM and YY_DECL?:: +* Why do I get "conflicting types for yylex" error?:: +* How do I access the values set in a Flex action from within a Bison action?:: + + +File: flex.info, Node: When was flex born?, Next: How do I expand backslash-escape sequences in C-style quoted strings?, Up: FAQ + +When was flex born? +=================== + +Vern Paxson took over the 'Software Tools' lex project from Jef +Poskanzer in 1982. At that point it was written in Ratfor. Around 1987 +or so, Paxson translated it into C, and a legend was born :-). + + +File: flex.info, Node: How do I expand backslash-escape sequences in C-style quoted strings?, Next: Why do flex scanners call fileno if it is not ANSI compatible?, Prev: When was flex born?, Up: FAQ + +How do I expand backslash-escape sequences in C-style quoted strings? +===================================================================== + +A key point when scanning quoted strings is that you cannot (easily) +write a single rule that will precisely match the string if you allow +things like embedded escape sequences and newlines. If you try to match +strings with a single rule then you'll wind up having to rescan the +string anyway to find any escape sequences. + + Instead you can use exclusive start conditions and a set of rules, +one for matching non-escaped text, one for matching a single escape, one +for matching an embedded newline, and one for recognizing the end of the +string. Each of these rules is then faced with the question of where to +put its intermediary results. The best solution is for the rules to +append their local value of 'yytext' to the end of a "string literal" +buffer. A rule like the escape-matcher will append to the buffer the +meaning of the escape sequence rather than the literal text in 'yytext'. +In this way, 'yytext' does not need to be modified at all. + + +File: flex.info, Node: Why do flex scanners call fileno if it is not ANSI compatible?, Next: Does flex support recursive pattern definitions?, Prev: How do I expand backslash-escape sequences in C-style quoted strings?, Up: FAQ + +Why do flex scanners call fileno if it is not ANSI compatible? +============================================================== + +Flex scanners call 'fileno()' in order to get the file descriptor +corresponding to 'yyin'. The file descriptor may be passed to +'isatty()' or 'read()', depending upon which '%options' you specified. +If your system does not have 'fileno()' support, to get rid of the +'read()' call, do not specify '%option read'. To get rid of the +'isatty()' call, you must specify one of '%option always-interactive' or +'%option never-interactive'. + + +File: flex.info, Node: Does flex support recursive pattern definitions?, Next: How do I skip huge chunks of input (tens of megabytes) while using flex?, Prev: Why do flex scanners call fileno if it is not ANSI compatible?, Up: FAQ + +Does flex support recursive pattern definitions? +================================================ + +e.g., + + %% + block "{"({block}|{statement})*"}" + + No. You cannot have recursive definitions. The pattern-matching +power of regular expressions in general (and therefore flex scanners, +too) is limited. In particular, regular expressions cannot "balance" +parentheses to an arbitrary degree. For example, it's impossible to +write a regular expression that matches all strings containing the same +number of '{'s as '}'s. For more powerful pattern matching, you need a +parser, such as 'GNU bison'. + + +File: flex.info, Node: How do I skip huge chunks of input (tens of megabytes) while using flex?, Next: Flex is not matching my patterns in the same order that I defined them., Prev: Does flex support recursive pattern definitions?, Up: FAQ + +How do I skip huge chunks of input (tens of megabytes) while using flex? +======================================================================== + +Use 'fseek()' (or 'lseek()') to position yyin, then call 'yyrestart()'. + + +File: flex.info, Node: Flex is not matching my patterns in the same order that I defined them., Next: My actions are executing out of order or sometimes not at all., Prev: How do I skip huge chunks of input (tens of megabytes) while using flex?, Up: FAQ + +Flex is not matching my patterns in the same order that I defined them. +======================================================================= + +'flex' picks the rule that matches the most text (i.e., the longest +possible input string). This is because 'flex' uses an entirely +different matching technique ("deterministic finite automata") that +actually does all of the matching simultaneously, in parallel. (Seems +impossible, but it's actually a fairly simple technique once you +understand the principles.) + + A side-effect of this parallel matching is that when the input +matches more than one rule, 'flex' scanners pick the rule that matched +the _most_ text. This is explained further in the manual, in the +section *Note Matching::. + + If you want 'flex' to choose a shorter match, then you can work +around this behavior by expanding your short rule to match more text, +then put back the extra: + + data_.* yyless( 5 ); BEGIN BLOCKIDSTATE; + + Another fix would be to make the second rule active only during the +'' start condition, and make that start condition +exclusive by declaring it with '%x' instead of '%s'. + + A final fix is to change the input language so that the ambiguity for +'data_' is removed, by adding characters to it that don't match the +identifier rule, or by removing characters (such as '_') from the +identifier rule so it no longer matches 'data_'. (Of course, you might +also not have the option of changing the input language.) + + +File: flex.info, Node: My actions are executing out of order or sometimes not at all., Next: How can I have multiple input sources feed into the same scanner at the same time?, Prev: Flex is not matching my patterns in the same order that I defined them., Up: FAQ + +My actions are executing out of order or sometimes not at all. +============================================================== + +Most likely, you have (in error) placed the opening '{' of the action +block on a different line than the rule, e.g., + + ^(foo|bar) + { <<<--- WRONG! + + } + + 'flex' requires that the opening '{' of an action associated with a +rule begin on the same line as does the rule. You need instead to write +your rules as follows: + + ^(foo|bar) { // CORRECT! + + } + + +File: flex.info, Node: How can I have multiple input sources feed into the same scanner at the same time?, Next: Can I build nested parsers that work with the same input file?, Prev: My actions are executing out of order or sometimes not at all., Up: FAQ + +How can I have multiple input sources feed into the same scanner at the same time? +================================================================================== + +If ... + * your scanner is free of backtracking (verified using 'flex''s '-b' + flag), + * AND you run your scanner interactively ('-I' option; default unless + using special table compression options), + * AND you feed it one character at a time by redefining 'YY_INPUT' to + do so, + + then every time it matches a token, it will have exhausted its input +buffer (because the scanner is free of backtracking). This means you +can safely use 'select()' at the point and only call 'yylex()' for +another token if 'select()' indicates there's data available. + + That is, move the 'select()' out from the input function to a point +where it determines whether 'yylex()' gets called for the next token. + + With this approach, you will still have problems if your input can +arrive piecemeal; 'select()' could inform you that the beginning of a +token is available, you call 'yylex()' to get it, but it winds up +blocking waiting for the later characters in the token. + + Here's another way: Move your input multiplexing inside of +'YY_INPUT'. That is, whenever 'YY_INPUT' is called, it 'select()''s to +see where input is available. If input is available for the scanner, it +reads and returns the next byte. If input is available from another +source, it calls whatever function is responsible for reading from that +source. (If no input is available, it blocks until some input is +available.) I've used this technique in an interpreter I wrote that +both reads keyboard input using a 'flex' scanner and IPC traffic from +sockets, and it works fine. + + +File: flex.info, Node: Can I build nested parsers that work with the same input file?, Next: How can I match text only at the end of a file?, Prev: How can I have multiple input sources feed into the same scanner at the same time?, Up: FAQ + +Can I build nested parsers that work with the same input file? +============================================================== + +This is not going to work without some additional effort. The reason is +that 'flex' block-buffers the input it reads from 'yyin'. This means +that the "outermost" 'yylex()', when called, will automatically slurp up +the first 8K of input available on yyin, and subsequent calls to other +'yylex()''s won't see that input. You might be tempted to work around +this problem by redefining 'YY_INPUT' to only return a small amount of +text, but it turns out that that approach is quite difficult. Instead, +the best solution is to combine all of your scanners into one large +scanner, using a different exclusive start condition for each. + + +File: flex.info, Node: How can I match text only at the end of a file?, Next: How can I make REJECT cascade across start condition boundaries?, Prev: Can I build nested parsers that work with the same input file?, Up: FAQ + +How can I match text only at the end of a file? +=============================================== + +There is no way to write a rule which is "match this text, but only if +it comes at the end of the file". You can fake it, though, if you +happen to have a character lying around that you don't allow in your +input. Then you redefine 'YY_INPUT' to call your own routine which, if +it sees an 'EOF', returns the magic character first (and remembers to +return a real 'EOF' next time it's called). Then you could write: + + (.|\n)*{EOF_CHAR} /* saw comment at EOF */ + + +File: flex.info, Node: How can I make REJECT cascade across start condition boundaries?, Next: Why cant I use fast or full tables with interactive mode?, Prev: How can I match text only at the end of a file?, Up: FAQ + +How can I make REJECT cascade across start condition boundaries? +================================================================ + +You can do this as follows. Suppose you have a start condition 'A', and +after exhausting all of the possible matches in '', you want to try +matches in ''. Then you could use the following: + + %x A + %% + rule_that_is_long ...; REJECT; + rule ...; REJECT; /* shorter rule */ + etc. + ... + .|\n { + /* Shortest and last rule in , so + * cascaded REJECTs will eventually + * wind up matching this rule. We want + * to now switch to the initial state + * and try matching from there instead. + */ + yyless(0); /* put back matched text */ + BEGIN(INITIAL); + } + + +File: flex.info, Node: Why cant I use fast or full tables with interactive mode?, Next: How much faster is -F or -f than -C?, Prev: How can I make REJECT cascade across start condition boundaries?, Up: FAQ + +Why can't I use fast or full tables with interactive mode? +========================================================== + +One of the assumptions flex makes is that interactive applications are +inherently slow (they're waiting on a human after all). It has to do +with how the scanner detects that it must be finished scanning a token. +For interactive scanners, after scanning each character the current +state is looked up in a table (essentially) to see whether there's a +chance of another input character possibly extending the length of the +match. If not, the scanner halts. For non-interactive scanners, the +end-of-token test is much simpler, basically a compare with 0, so no +memory bus cycles. Since the test occurs in the innermost scanning +loop, one would like to make it go as fast as possible. + + Still, it seems reasonable to allow the user to choose to trade off a +bit of performance in this area to gain the corresponding flexibility. +There might be another reason, though, why fast scanners don't support +the interactive option. + + +File: flex.info, Node: How much faster is -F or -f than -C?, Next: If I have a simple grammar cant I just parse it with flex?, Prev: Why cant I use fast or full tables with interactive mode?, Up: FAQ + +How much faster is -F or -f than -C? +==================================== + +Much faster (factor of 2-3). + + +File: flex.info, Node: If I have a simple grammar cant I just parse it with flex?, Next: Why doesn't yyrestart() set the start state back to INITIAL?, Prev: How much faster is -F or -f than -C?, Up: FAQ + +If I have a simple grammar can't I just parse it with flex? +=========================================================== + +Is your grammar recursive? That's almost always a sign that you're +better off using a parser/scanner rather than just trying to use a +scanner alone. + + +File: flex.info, Node: Why doesn't yyrestart() set the start state back to INITIAL?, Next: How can I match C-style comments?, Prev: If I have a simple grammar cant I just parse it with flex?, Up: FAQ + +Why doesn't yyrestart() set the start state back to INITIAL? +============================================================ + +There are two reasons. The first is that there might be programs that +rely on the start state not changing across file changes. The second is +that beginning with 'flex' version 2.4, use of 'yyrestart()' is no +longer required, so fixing the problem there doesn't solve the more +general problem. + + +File: flex.info, Node: How can I match C-style comments?, Next: The period isn't working the way I expected., Prev: Why doesn't yyrestart() set the start state back to INITIAL?, Up: FAQ + +How can I match C-style comments? +================================= + +You might be tempted to try something like this: + + "/*".*"*/" // WRONG! + + or, worse, this: + + "/*"(.|\n)"*/" // WRONG! + + The above rules will eat too much input, and blow up on things like: + + /* a comment */ do_my_thing( "oops */" ); + + Here is one way which allows you to track line information: + + { + "/*" BEGIN(IN_COMMENT); + } + { + "*/" BEGIN(INITIAL); + [^*\n]+ // eat comment in chunks + "*" // eat the lone star + \n yylineno++; + } + + +File: flex.info, Node: The period isn't working the way I expected., Next: Can I get the flex manual in another format?, Prev: How can I match C-style comments?, Up: FAQ + +The '.' isn't working the way I expected. +========================================= + +Here are some tips for using '.': + + * A common mistake is to place the grouping parenthesis AFTER an + operator, when you really meant to place the parenthesis BEFORE the + operator, e.g., you probably want this '(foo|bar)+' and NOT this + '(foo|bar+)'. + + The first pattern matches the words 'foo' or 'bar' any number of + times, e.g., it matches the text 'barfoofoobarfoo'. The second + pattern matches a single instance of 'foo' or a single instance of + 'bar' followed by one or more 'r's, e.g., it matches the text + 'barrrr' . + * A '.' inside '[]''s just means a literal'.' (period), and NOT "any + character except newline". + * Remember that '.' matches any character EXCEPT '\n' (and 'EOF'). + If you really want to match ANY character, including newlines, then + use '(.|\n)' Beware that the regex '(.|\n)+' will match your entire + input! + * Finally, if you want to match a literal '.' (a period), then use + '[.]' or '"."' + + +File: flex.info, Node: Can I get the flex manual in another format?, Next: Does there exist a "faster" NDFA->DFA algorithm?, Prev: The period isn't working the way I expected., Up: FAQ + +Can I get the flex manual in another format? +============================================ + +The 'flex' source distribution includes a texinfo manual. You are free +to convert that texinfo into whatever format you desire. The 'texinfo' +package includes tools for conversion to a number of formats. + + +File: flex.info, Node: Does there exist a "faster" NDFA->DFA algorithm?, Next: How does flex compile the DFA so quickly?, Prev: Can I get the flex manual in another format?, Up: FAQ + +Does there exist a "faster" NDFA->DFA algorithm? +================================================ + +There's no way around the potential exponential running time - it can +take you exponential time just to enumerate all of the DFA states. In +practice, though, the running time is closer to linear, or sometimes +quadratic. + + +File: flex.info, Node: How does flex compile the DFA so quickly?, Next: How can I use more than 8192 rules?, Prev: Does there exist a "faster" NDFA->DFA algorithm?, Up: FAQ + +How does flex compile the DFA so quickly? +========================================= + +There are two big speed wins that 'flex' uses: + + 1. It analyzes the input rules to construct equivalence classes for + those characters that always make the same transitions. It then + rewrites the NFA using equivalence classes for transitions instead + of characters. This cuts down the NFA->DFA computation time + dramatically, to the point where, for uncompressed DFA tables, the + DFA generation is often I/O bound in writing out the tables. + 2. It maintains hash values for previously computed DFA states, so + testing whether a newly constructed DFA state is equivalent to a + previously constructed state can be done very quickly, by first + comparing hash values. + + +File: flex.info, Node: How can I use more than 8192 rules?, Next: How do I abandon a file in the middle of a scan and switch to a new file?, Prev: How does flex compile the DFA so quickly?, Up: FAQ + +How can I use more than 8192 rules? +=================================== + +'Flex' is compiled with an upper limit of 8192 rules per scanner. If +you need more than 8192 rules in your scanner, you'll have to recompile +'flex' with the following changes in 'flexdef.h': + + < #define YY_TRAILING_MASK 0x2000 + < #define YY_TRAILING_HEAD_MASK 0x4000 + -- + > #define YY_TRAILING_MASK 0x20000000 + > #define YY_TRAILING_HEAD_MASK 0x40000000 + + This should work okay as long as your C compiler uses 32 bit +integers. But you might want to think about whether using such a huge +number of rules is the best way to solve your problem. + + The following may also be relevant: + + With luck, you should be able to increase the definitions in +flexdef.h for: + + #define JAMSTATE -32766 /* marks a reference to the state that always jams */ + #define MAXIMUM_MNS 31999 + #define BAD_SUBSCRIPT -32767 + + recompile everything, and it'll all work. Flex only has these +16-bit-like values built into it because a long time ago it was +developed on a machine with 16-bit ints. I've given this advice to +others in the past but haven't heard back from them whether it worked +okay or not... + + +File: flex.info, Node: How do I abandon a file in the middle of a scan and switch to a new file?, Next: How do I execute code only during initialization (only before the first scan)?, Prev: How can I use more than 8192 rules?, Up: FAQ + +How do I abandon a file in the middle of a scan and switch to a new file? +========================================================================= + +Just call 'yyrestart(newfile)'. Be sure to reset the start state if you +want a "fresh start, since 'yyrestart' does NOT reset the start state +back to 'INITIAL'. + + +File: flex.info, Node: How do I execute code only during initialization (only before the first scan)?, Next: How do I execute code at termination?, Prev: How do I abandon a file in the middle of a scan and switch to a new file?, Up: FAQ + +How do I execute code only during initialization (only before the first scan)? +============================================================================== + +You can specify an initial action by defining the macro 'YY_USER_INIT' +(though note that 'yyout' may not be available at the time this macro is +executed). Or you can add to the beginning of your rules section: + + %% + /* Must be indented! */ + static int did_init = 0; + + if ( ! did_init ){ + do_my_init(); + did_init = 1; + } + + +File: flex.info, Node: How do I execute code at termination?, Next: Where else can I find help?, Prev: How do I execute code only during initialization (only before the first scan)?, Up: FAQ + +How do I execute code at termination? +===================================== + +You can specify an action for the '<>' rule. + + +File: flex.info, Node: Where else can I find help?, Next: Can I include comments in the "rules" section of the file?, Prev: How do I execute code at termination?, Up: FAQ + +Where else can I find help? +=========================== + +You can find the flex homepage on the web at +. See that page for details about flex +mailing lists as well. + + +File: flex.info, Node: Can I include comments in the "rules" section of the file?, Next: I get an error about undefined yywrap()., Prev: Where else can I find help?, Up: FAQ + +Can I include comments in the "rules" section of the file? +========================================================== + +Yes, just about anywhere you want to. See the manual for the specific +syntax. + + +File: flex.info, Node: I get an error about undefined yywrap()., Next: How can I change the matching pattern at run time?, Prev: Can I include comments in the "rules" section of the file?, Up: FAQ + +I get an error about undefined yywrap(). +======================================== + +You must supply a 'yywrap()' function of your own, or link to 'libfl.a' +(which provides one), or use + + %option noyywrap + + in your source to say you don't want a 'yywrap()' function. + + +File: flex.info, Node: How can I change the matching pattern at run time?, Next: How can I expand macros in the input?, Prev: I get an error about undefined yywrap()., Up: FAQ + +How can I change the matching pattern at run time? +================================================== + +You can't, it's compiled into a static table when flex builds the +scanner. + + +File: flex.info, Node: How can I expand macros in the input?, Next: How can I build a two-pass scanner?, Prev: How can I change the matching pattern at run time?, Up: FAQ + +How can I expand macros in the input? +===================================== + +The best way to approach this problem is at a higher level, e.g., in the +parser. + + However, you can do this using multiple input buffers. + + %% + macro/[a-z]+ { + /* Saw the macro "macro" followed by extra stuff. */ + main_buffer = YY_CURRENT_BUFFER; + expansion_buffer = yy_scan_string(expand(yytext)); + yy_switch_to_buffer(expansion_buffer); + } + + <> { + if ( expansion_buffer ) + { + // We were doing an expansion, return to where + // we were. + yy_switch_to_buffer(main_buffer); + yy_delete_buffer(expansion_buffer); + expansion_buffer = 0; + } + else + yyterminate(); + } + + You probably will want a stack of expansion buffers to allow nested +macros. From the above though hopefully the idea is clear. + + +File: flex.info, Node: How can I build a two-pass scanner?, Next: How do I match any string not matched in the preceding rules?, Prev: How can I expand macros in the input?, Up: FAQ + +How can I build a two-pass scanner? +=================================== + +One way to do it is to filter the first pass to a temporary file, then +process the temporary file on the second pass. You will probably see a +performance hit, due to all the disk I/O. + + When you need to look ahead far forward like this, it almost always +means that the right solution is to build a parse tree of the entire +input, then walk it after the parse in order to generate the output. In +a sense, this is a two-pass approach, once through the text and once +through the parse tree, but the performance hit for the latter is +usually an order of magnitude smaller, since everything is already +classified, in binary format, and residing in memory. + + +File: flex.info, Node: How do I match any string not matched in the preceding rules?, Next: I am trying to port code from AT&T lex that uses yysptr and yysbuf., Prev: How can I build a two-pass scanner?, Up: FAQ + +How do I match any string not matched in the preceding rules? +============================================================= + +One way to assign precedence, is to place the more specific rules first. +If two rules would match the same input (same sequence of characters) +then the first rule listed in the 'flex' input wins, e.g., + + %% + foo[a-zA-Z_]+ return FOO_ID; + bar[a-zA-Z_]+ return BAR_ID; + [a-zA-Z_]+ return GENERIC_ID; + + Note that the rule '[a-zA-Z_]+' must come *after* the others. It +will match the same amount of text as the more specific rules, and in +that case the 'flex' scanner will pick the first rule listed in your +scanner as the one to match. + + +File: flex.info, Node: I am trying to port code from AT&T lex that uses yysptr and yysbuf., Next: Is there a way to make flex treat NULL like a regular character?, Prev: How do I match any string not matched in the preceding rules?, Up: FAQ + +I am trying to port code from AT&T lex that uses yysptr and yysbuf. +=================================================================== + +Those are internal variables pointing into the AT&T scanner's input +buffer. I imagine they're being manipulated in user versions of the +'input()' and 'unput()' functions. If so, what you need to do is +analyze those functions to figure out what they're doing, and then +replace 'input()' with an appropriate definition of 'YY_INPUT'. You +shouldn't need to (and must not) replace 'flex''s 'unput()' function. + + +File: flex.info, Node: Is there a way to make flex treat NULL like a regular character?, Next: Whenever flex can not match the input it says "flex scanner jammed"., Prev: I am trying to port code from AT&T lex that uses yysptr and yysbuf., Up: FAQ + +Is there a way to make flex treat NULL like a regular character? +================================================================ + +Yes, '\0' and '\x00' should both do the trick. Perhaps you have an +ancient version of 'flex'. The latest release is version 2.6.4. + + +File: flex.info, Node: Whenever flex can not match the input it says "flex scanner jammed"., Next: Why doesn't flex have non-greedy operators like perl does?, Prev: Is there a way to make flex treat NULL like a regular character?, Up: FAQ + +Whenever flex can not match the input it says "flex scanner jammed". +==================================================================== + +You need to add a rule that matches the otherwise-unmatched text, e.g., + + %option yylineno + %% + [[a bunch of rules here]] + + . printf("bad input character '%s' at line %d\n", yytext, yylineno); + + See '%option default' for more information. + + +File: flex.info, Node: Why doesn't flex have non-greedy operators like perl does?, Next: Memory leak - 16386 bytes allocated by malloc., Prev: Whenever flex can not match the input it says "flex scanner jammed"., Up: FAQ + +Why doesn't flex have non-greedy operators like perl does? +========================================================== + +A DFA can do a non-greedy match by stopping the first time it enters an +accepting state, instead of consuming input until it determines that no +further matching is possible (a "jam" state). This is actually easier +to implement than longest leftmost match (which flex does). + + But it's also much less useful than longest leftmost match. In +general, when you find yourself wishing for non-greedy matching, that's +usually a sign that you're trying to make the scanner do some parsing. +That's generally the wrong approach, since it lacks the power to do a +decent job. Better is to either introduce a separate parser, or to +split the scanner into multiple scanners using (exclusive) start +conditions. + + You might have a separate start state once you've seen the 'BEGIN'. +In that state, you might then have a regex that will match 'END' (to +kick you out of the state), and perhaps '(.|\n)' to get a single +character within the chunk ... + + This approach also has much better error-reporting properties. + + +File: flex.info, Node: Memory leak - 16386 bytes allocated by malloc., Next: How do I track the byte offset for lseek()?, Prev: Why doesn't flex have non-greedy operators like perl does?, Up: FAQ + +Memory leak - 16386 bytes allocated by malloc. +============================================== + +UPDATED 2002-07-10: As of 'flex' version 2.5.9, this leak means that you +did not call 'yylex_destroy()'. If you are using an earlier version of +'flex', then read on. + + The leak is about 16426 bytes. That is, (8192 * 2 + 2) for the +read-buffer, and about 40 for 'struct yy_buffer_state' (depending upon +alignment). The leak is in the non-reentrant C scanner only (NOT in the +reentrant scanner, NOT in the C++ scanner). Since 'flex' doesn't know +when you are done, the buffer is never freed. + + However, the leak won't multiply since the buffer is reused no matter +how many times you call 'yylex()'. + + If you want to reclaim the memory when you are completely done +scanning, then you might try this: + + /* For non-reentrant C scanner only. */ + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_init = 1; + + Note: 'yy_init' is an "internal variable", and hasn't been tested in +this situation. It is possible that some other globals may need +resetting as well. + + +File: flex.info, Node: How do I track the byte offset for lseek()?, Next: How do I use my own I/O classes in a C++ scanner?, Prev: Memory leak - 16386 bytes allocated by malloc., Up: FAQ + +How do I track the byte offset for lseek()? +=========================================== + + > We thought that it would be possible to have this number through the + > evaluation of the following expression: + > + > seek_position = (no_buffers)*YY_READ_BUF_SIZE + yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf + + While this is the right idea, it has two problems. The first is that +it's possible that 'flex' will request less than 'YY_READ_BUF_SIZE' +during an invocation of 'YY_INPUT' (or that your input source will +return less even though 'YY_READ_BUF_SIZE' bytes were requested). The +second problem is that when refilling its internal buffer, 'flex' keeps +some characters from the previous buffer (because usually it's in the +middle of a match, and needs those characters to construct 'yytext' for +the match once it's done). Because of this, 'yy_c_buf_p - +YY_CURRENT_BUFFER->yy_ch_buf' won't be exactly the number of characters +already read from the current buffer. + + An alternative solution is to count the number of characters you've +matched since starting to scan. This can be done by using +'YY_USER_ACTION'. For example, + + #define YY_USER_ACTION num_chars += yyleng; + + (You need to be careful to update your bookkeeping if you use +'yymore('), 'yyless()', 'unput()', or 'input()'.) + + +File: flex.info, Node: How do I use my own I/O classes in a C++ scanner?, Next: How do I skip as many chars as possible?, Prev: How do I track the byte offset for lseek()?, Up: FAQ + +How do I use my own I/O classes in a C++ scanner? +================================================= + +When the flex C++ scanning class rewrite finally happens, then this sort +of thing should become much easier. + + You can do this by passing the various functions (such as +'LexerInput()' and 'LexerOutput()') NULL 'iostream*''s, and then dealing +with your own I/O classes surreptitiously (i.e., stashing them in +special member variables). This works because the only assumption about +the lexer regarding what's done with the iostream's is that they're +ultimately passed to 'LexerInput()' and 'LexerOutput', which then do +whatever is necessary with them. + + +File: flex.info, Node: How do I skip as many chars as possible?, Next: deleteme00, Prev: How do I use my own I/O classes in a C++ scanner?, Up: FAQ + +How do I skip as many chars as possible? +======================================== + +How do I skip as many chars as possible - without interfering with the +other patterns? + + In the example below, we want to skip over characters until we see +the phrase "endskip". The following will _NOT_ work correctly (do you +see why not?) + + /* INCORRECT SCANNER */ + %x SKIP + %% + startskip BEGIN(SKIP); + ... + "endskip" BEGIN(INITIAL); + .* ; + + The problem is that the pattern .* will eat up the word "endskip." +The simplest (but slow) fix is: + + "endskip" BEGIN(INITIAL); + . ; + + The fix involves making the second rule match more, without making it +match "endskip" plus something else. So for example: + + "endskip" BEGIN(INITIAL); + [^e]+ ; + . ;/* so you eat up e's, too */ + + +File: flex.info, Node: deleteme00, Next: Are certain equivalent patterns faster than others?, Prev: How do I skip as many chars as possible?, Up: FAQ + +deleteme00 +========== + + QUESTION: + When was flex born? + + Vern Paxson took over + the Software Tools lex project from Jef Poskanzer in 1982. At that point it + was written in Ratfor. Around 1987 or so, Paxson translated it into C, and + a legend was born :-). + + +File: flex.info, Node: Are certain equivalent patterns faster than others?, Next: Is backing up a big deal?, Prev: deleteme00, Up: FAQ + +Are certain equivalent patterns faster than others? +=================================================== + + To: Adoram Rogel + Subject: Re: Flex 2.5.2 performance questions + In-reply-to: Your message of Wed, 18 Sep 96 11:12:17 EDT. + Date: Wed, 18 Sep 96 10:51:02 PDT + From: Vern Paxson + + [Note, the most recent flex release is 2.5.4, which you can get from + ftp.ee.lbl.gov. It has bug fixes over 2.5.2 and 2.5.3.] + + > 1. Using the pattern + > ([Ff](oot)?)?[Nn](ote)?(\.)? + > instead of + > (((F|f)oot(N|n)ote)|((N|n)ote)|((N|n)\.)|((F|f)(N|n)(\.))) + > (in a very complicated flex program) caused the program to slow from + > 300K+/min to 100K/min (no other changes were done). + + These two are not equivalent. For example, the first can match "footnote." + but the second can only match "footnote". This is almost certainly the + cause in the discrepancy - the slower scanner run is matching more tokens, + and/or having to do more backing up. + + > 2. Which of these two are better: [Ff]oot or (F|f)oot ? + + From a performance point of view, they're equivalent (modulo presumably + minor effects such as memory cache hit rates; and the presence of trailing + context, see below). From a space point of view, the first is slightly + preferable. + + > 3. I have a pattern that look like this: + > pats {p1}|{p2}|{p3}|...|{p50} (50 patterns ORd) + > + > running yet another complicated program that includes the following rule: + > {and}/{no4}{bb}{pats} + > + > gets me to "too complicated - over 32,000 states"... + + I can't tell from this example whether the trailing context is variable-length + or fixed-length (it could be the latter if {and} is fixed-length). If it's + variable length, which flex -p will tell you, then this reflects a basic + performance problem, and if you can eliminate it by restructuring your + scanner, you will see significant improvement. + + > so I divided {pats} to {pats1}, {pats2},..., {pats5} each consists of about + > 10 patterns and changed the rule to be 5 rules. + > This did compile, but what is the rule of thumb here ? + + The rule is to avoid trailing context other than fixed-length, in which for + a/b, either the 'a' pattern or the 'b' pattern have a fixed length. Use + of the '|' operator automatically makes the pattern variable length, so in + this case '[Ff]oot' is preferred to '(F|f)oot'. + + > 4. I changed a rule that looked like this: + > {and}{bb}/{ROMAN}[^A-Za-z] { BEGIN... + > + > to the next 2 rules: + > {and}{bb}/{ROMAN}[A-Za-z] { ECHO;} + > {and}{bb}/{ROMAN} { BEGIN... + > + > Again, I understand the using [^...] will cause a great performance loss + + Actually, it doesn't cause any sort of performance loss. It's a surprising + fact about regular expressions that they always match in linear time + regardless of how complex they are. + + > but are there any specific rules about it ? + + See the "Performance Considerations" section of the man page, and also + the example in MISC/fastwc/. + + Vern + + +File: flex.info, Node: Is backing up a big deal?, Next: Can I fake multi-byte character support?, Prev: Are certain equivalent patterns faster than others?, Up: FAQ + +Is backing up a big deal? +========================= + + To: Adoram Rogel + Subject: Re: Flex 2.5.2 performance questions + In-reply-to: Your message of Thu, 19 Sep 96 10:16:04 EDT. + Date: Thu, 19 Sep 96 09:58:00 PDT + From: Vern Paxson + + > a lot about the backing up problem. + > I believe that there lies my biggest problem, and I'll try to improve + > it. + + Since you have variable trailing context, this is a bigger performance + problem. Fixing it is usually easier than fixing backing up, which in a + complicated scanner (yours seems to fit the bill) can be extremely + difficult to do correctly. + + You also don't mention what flags you are using for your scanner. + -f makes a large speed difference, and -Cfe buys you nearly as much + speed but the resulting scanner is considerably smaller. + + > I have an | operator in {and} and in {pats} so both of them are variable + > length. + + -p should have reported this. + + > Is changing one of them to fixed-length is enough ? + + Yes. + + > Is it possible to change the 32,000 states limit ? + + Yes. I've appended instructions on how. Before you make this change, + though, you should think about whether there are ways to fundamentally + simplify your scanner - those are certainly preferable! + + Vern + + To increase the 32K limit (on a machine with 32 bit integers), you increase + the magnitude of the following in flexdef.h: + + #define JAMSTATE -32766 /* marks a reference to the state that always jams */ + #define MAXIMUM_MNS 31999 + #define BAD_SUBSCRIPT -32767 + #define MAX_SHORT 32700 + + Adding a 0 or two after each should do the trick. + + +File: flex.info, Node: Can I fake multi-byte character support?, Next: deleteme01, Prev: Is backing up a big deal?, Up: FAQ + +Can I fake multi-byte character support? +======================================== + + To: Heeman_Lee@hp.com + Subject: Re: flex - multi-byte support? + In-reply-to: Your message of Thu, 03 Oct 1996 17:24:04 PDT. + Date: Fri, 04 Oct 1996 11:42:18 PDT + From: Vern Paxson + + > I assume as long as my *.l file defines the + > range of expected character code values (in octal format), flex will + > scan the file and read multi-byte characters correctly. But I have no + > confidence in this assumption. + + Your lack of confidence is justified - this won't work. + + Flex has in it a widespread assumption that the input is processed + one byte at a time. Fixing this is on the to-do list, but is involved, + so it won't happen any time soon. In the interim, the best I can suggest + (unless you want to try fixing it yourself) is to write your rules in + terms of pairs of bytes, using definitions in the first section: + + X \xfe\xc2 + ... + %% + foo{X}bar found_foo_fe_c2_bar(); + + etc. Definitely a pain - sorry about that. + + By the way, the email address you used for me is ancient, indicating you + have a very old version of flex. You can get the most recent, 2.5.4, from + ftp.ee.lbl.gov. + + Vern + + +File: flex.info, Node: deleteme01, Next: Can you discuss some flex internals?, Prev: Can I fake multi-byte character support?, Up: FAQ + +deleteme01 +========== + + To: moleary@primus.com + Subject: Re: Flex / Unicode compatibility question + In-reply-to: Your message of Tue, 22 Oct 1996 10:15:42 PDT. + Date: Tue, 22 Oct 1996 11:06:13 PDT + From: Vern Paxson + + Unfortunately flex at the moment has a widespread assumption within it + that characters are processed 8 bits at a time. I don't see any easy + fix for this (other than writing your rules in terms of double characters - + a pain). I also don't know of a wider lex, though you might try surfing + the Plan 9 stuff because I know it's a Unicode system, and also the PCCT + toolkit (try searching say Alta Vista for "Purdue Compiler Construction + Toolkit"). + + Fixing flex to handle wider characters is on the long-term to-do list. + But since flex is a strictly spare-time project these days, this probably + won't happen for quite a while, unless someone else does it first. + + Vern + + +File: flex.info, Node: Can you discuss some flex internals?, Next: unput() messes up yy_at_bol, Prev: deleteme01, Up: FAQ + +Can you discuss some flex internals? +==================================== + + To: Johan Linde + Subject: Re: translation of flex + In-reply-to: Your message of Sun, 10 Nov 1996 09:16:36 PST. + Date: Mon, 11 Nov 1996 10:33:50 PST + From: Vern Paxson + + > I'm working for the Swedish team translating GNU program, and I'm currently + > working with flex. I have a few questions about some of the messages which + > I hope you can answer. + + All of the things you're wondering about, by the way, concerning flex + internals - probably the only person who understands what they mean in + English is me! So I wouldn't worry too much about getting them right. + That said ... + + > #: main.c:545 + > msgid " %d protos created\n" + > + > Does proto mean prototype? + + Yes - prototypes of state compression tables. + + > #: main.c:539 + > msgid " %d/%d (peak %d) template nxt-chk entries created\n" + > + > Here I'm mainly puzzled by 'nxt-chk'. I guess it means 'next-check'. (?) + > However, 'template next-check entries' doesn't make much sense to me. To be + > able to find a good translation I need to know a little bit more about it. + + There is a scheme in the Aho/Sethi/Ullman compiler book for compressing + scanner tables. It involves creating two pairs of tables. The first has + "base" and "default" entries, the second has "next" and "check" entries. + The "base" entry is indexed by the current state and yields an index into + the next/check table. The "default" entry gives what to do if the state + transition isn't found in next/check. The "next" entry gives the next + state to enter, but only if the "check" entry verifies that this entry is + correct for the current state. Flex creates templates of series of + next/check entries and then encodes differences from these templates as a + way to compress the tables. + + > #: main.c:533 + > msgid " %d/%d base-def entries created\n" + > + > The same problem here for 'base-def'. + + See above. + + Vern + + +File: flex.info, Node: unput() messes up yy_at_bol, Next: The | operator is not doing what I want, Prev: Can you discuss some flex internals?, Up: FAQ + +unput() messes up yy_at_bol +=========================== + + To: Xinying Li + Subject: Re: FLEX ? + In-reply-to: Your message of Wed, 13 Nov 1996 17:28:38 PST. + Date: Wed, 13 Nov 1996 19:51:54 PST + From: Vern Paxson + + > "unput()" them to input flow, question occurs. If I do this after I scan + > a carriage, the variable "YY_CURRENT_BUFFER->yy_at_bol" is changed. That + > means the carriage flag has gone. + + You can control this by calling yy_set_bol(). It's described in the manual. + + > And if in pre-reading it goes to the end of file, is anything done + > to control the end of curren buffer and end of file? + + No, there's no way to put back an end-of-file. + + > By the way I am using flex 2.5.2 and using the "-l". + + The latest release is 2.5.4, by the way. It fixes some bugs in 2.5.2 and + 2.5.3. You can get it from ftp.ee.lbl.gov. + + Vern + + +File: flex.info, Node: The | operator is not doing what I want, Next: Why can't flex understand this variable trailing context pattern?, Prev: unput() messes up yy_at_bol, Up: FAQ + +The | operator is not doing what I want +======================================= + + To: Alain.ISSARD@st.com + Subject: Re: Start condition with FLEX + In-reply-to: Your message of Mon, 18 Nov 1996 09:45:02 PST. + Date: Mon, 18 Nov 1996 10:41:34 PST + From: Vern Paxson + + > I am not able to use the start condition scope and to use the | (OR) with + > rules having start conditions. + + The problem is that if you use '|' as a regular expression operator, for + example "a|b" meaning "match either 'a' or 'b'", then it must *not* have + any blanks around it. If you instead want the special '|' *action* (which + from your scanner appears to be the case), which is a way of giving two + different rules the same action: + + foo | + bar matched_foo_or_bar(); + + then '|' *must* be separated from the first rule by whitespace and *must* + be followed by a new line. You *cannot* write it as: + + foo | bar matched_foo_or_bar(); + + even though you might think you could because yacc supports this syntax. + The reason for this unfortunately incompatibility is historical, but it's + unlikely to be changed. + + Your problems with start condition scope are simply due to syntax errors + from your use of '|' later confusing flex. + + Let me know if you still have problems. + + Vern + + +File: flex.info, Node: Why can't flex understand this variable trailing context pattern?, Next: The ^ operator isn't working, Prev: The | operator is not doing what I want, Up: FAQ + +Why can't flex understand this variable trailing context pattern? +================================================================= + + To: Gregory Margo + Subject: Re: flex-2.5.3 bug report + In-reply-to: Your message of Sat, 23 Nov 1996 16:50:09 PST. + Date: Sat, 23 Nov 1996 17:07:32 PST + From: Vern Paxson + + > Enclosed is a lex file that "real" lex will process, but I cannot get + > flex to process it. Could you try it and maybe point me in the right direction? + + Your problem is that some of the definitions in the scanner use the '/' + trailing context operator, and have it enclosed in ()'s. Flex does not + allow this operator to be enclosed in ()'s because doing so allows undefined + regular expressions such as "(a/b)+". So the solution is to remove the + parentheses. Note that you must also be building the scanner with the -l + option for AT&T lex compatibility. Without this option, flex automatically + encloses the definitions in parentheses. + + Vern + + +File: flex.info, Node: The ^ operator isn't working, Next: Trailing context is getting confused with trailing optional patterns, Prev: Why can't flex understand this variable trailing context pattern?, Up: FAQ + +The ^ operator isn't working +============================ + + To: Thomas Hadig + Subject: Re: Flex Bug ? + In-reply-to: Your message of Tue, 26 Nov 1996 14:35:01 PST. + Date: Tue, 26 Nov 1996 11:15:05 PST + From: Vern Paxson + + > In my lexer code, i have the line : + > ^\*.* { } + > + > Thus all lines starting with an astrix (*) are comment lines. + > This does not work ! + + I can't get this problem to reproduce - it works fine for me. Note + though that if what you have is slightly different: + + COMMENT ^\*.* + %% + {COMMENT} { } + + then it won't work, because flex pushes back macro definitions enclosed + in ()'s, so the rule becomes + + (^\*.*) { } + + and now that the '^' operator is not at the immediate beginning of the + line, it's interpreted as just a regular character. You can avoid this + behavior by using the "-l" lex-compatibility flag, or "%option lex-compat". + + Vern + + +File: flex.info, Node: Trailing context is getting confused with trailing optional patterns, Next: Is flex GNU or not?, Prev: The ^ operator isn't working, Up: FAQ + +Trailing context is getting confused with trailing optional patterns +==================================================================== + + To: Adoram Rogel + Subject: Re: Flex 2.5.4 BOF ??? + In-reply-to: Your message of Tue, 26 Nov 1996 16:10:41 PST. + Date: Wed, 27 Nov 1996 10:56:25 PST + From: Vern Paxson + + > Organization(s)?/[a-z] + > + > This matched "Organizations" (looking in debug mode, the trailing s + > was matched with trailing context instead of the optional (s) in the + > end of the word. + + That should only happen with lex. Flex can properly match this pattern. + (That might be what you're saying, I'm just not sure.) + + > Is there a way to avoid this dangerous trailing context problem ? + + Unfortunately, there's no easy way. On the other hand, I don't see why + it should be a problem. Lex's matching is clearly wrong, and I'd hope + that usually the intent remains the same as expressed with the pattern, + so flex's matching will be correct. + + Vern + + +File: flex.info, Node: Is flex GNU or not?, Next: ERASEME53, Prev: Trailing context is getting confused with trailing optional patterns, Up: FAQ + +Is flex GNU or not? +=================== + + To: Cameron MacKinnon + Subject: Re: Flex documentation bug + In-reply-to: Your message of Mon, 02 Dec 1996 00:07:08 PST. + Date: Sun, 01 Dec 1996 22:29:39 PST + From: Vern Paxson + + > I'm not sure how or where to submit bug reports (documentation or + > otherwise) for the GNU project stuff ... + + Well, strictly speaking flex isn't part of the GNU project. They just + distribute it because no one's written a decent GPL'd lex replacement. + So you should send bugs directly to me. Those sent to the GNU folks + sometimes find there way to me, but some may drop between the cracks. + + > In GNU Info, under the section 'Start Conditions', and also in the man + > page (mine's dated April '95) is a nice little snippet showing how to + > parse C quoted strings into a buffer, defined to be MAX_STR_CONST in + > size. Unfortunately, no overflow checking is ever done ... + + This is already mentioned in the manual: + + Finally, here's an example of how to match C-style quoted + strings using exclusive start conditions, including expanded + escape sequences (but not including checking for a string + that's too long): + + The reason for not doing the overflow checking is that it will needlessly + clutter up an example whose main purpose is just to demonstrate how to + use flex. + + The latest release is 2.5.4, by the way, available from ftp.ee.lbl.gov. + + Vern + + +File: flex.info, Node: ERASEME53, Next: I need to scan if-then-else blocks and while loops, Prev: Is flex GNU or not?, Up: FAQ + +ERASEME53 +========= + + To: tsv@cs.UManitoba.CA + Subject: Re: Flex (reg).. + In-reply-to: Your message of Thu, 06 Mar 1997 23:50:16 PST. + Date: Thu, 06 Mar 1997 15:54:19 PST + From: Vern Paxson + + > [:alpha:] ([:alnum:] | \\_)* + + If your rule really has embedded blanks as shown above, then it won't + work, as the first blank delimits the rule from the action. (It wouldn't + even compile ...) You need instead: + + [:alpha:]([:alnum:]|\\_)* + + and that should work fine - there's no restriction on what can go inside + of ()'s except for the trailing context operator, '/'. + + Vern + + +File: flex.info, Node: I need to scan if-then-else blocks and while loops, Next: ERASEME55, Prev: ERASEME53, Up: FAQ + +I need to scan if-then-else blocks and while loops +================================================== + + To: "Mike Stolnicki" + Subject: Re: FLEX help + In-reply-to: Your message of Fri, 30 May 1997 13:33:27 PDT. + Date: Fri, 30 May 1997 10:46:35 PDT + From: Vern Paxson + + > We'd like to add "if-then-else", "while", and "for" statements to our + > language ... + > We've investigated many possible solutions. The one solution that seems + > the most reasonable involves knowing the position of a TOKEN in yyin. + + I strongly advise you to instead build a parse tree (abstract syntax tree) + and loop over that instead. You'll find this has major benefits in keeping + your interpreter simple and extensible. + + That said, the functionality you mention for get_position and set_position + have been on the to-do list for a while. As flex is a purely spare-time + project for me, no guarantees when this will be added (in particular, it + for sure won't be for many months to come). + + Vern + + +File: flex.info, Node: ERASEME55, Next: ERASEME56, Prev: I need to scan if-then-else blocks and while loops, Up: FAQ + +ERASEME55 +========= + + To: Colin Paul Adams + Subject: Re: Flex C++ classes and Bison + In-reply-to: Your message of 09 Aug 1997 17:11:41 PDT. + Date: Fri, 15 Aug 1997 10:48:19 PDT + From: Vern Paxson + + > #define YY_DECL int yylex (YYSTYPE *lvalp, struct parser_control + > *parm) + > + > I have been trying to get this to work as a C++ scanner, but it does + > not appear to be possible (warning that it matches no declarations in + > yyFlexLexer, or something like that). + > + > Is this supposed to be possible, or is it being worked on (I DID + > notice the comment that scanner classes are still experimental, so I'm + > not too hopeful)? + + What you need to do is derive a subclass from yyFlexLexer that provides + the above yylex() method, squirrels away lvalp and parm into member + variables, and then invokes yyFlexLexer::yylex() to do the regular scanning. + + Vern + + +File: flex.info, Node: ERASEME56, Next: ERASEME57, Prev: ERASEME55, Up: FAQ + +ERASEME56 +========= + + To: Mikael.Latvala@lmf.ericsson.se + Subject: Re: Possible mistake in Flex v2.5 document + In-reply-to: Your message of Fri, 05 Sep 1997 16:07:24 PDT. + Date: Fri, 05 Sep 1997 10:01:54 PDT + From: Vern Paxson + + > In that example you show how to count comment lines when using + > C style /* ... */ comments. My question is, shouldn't you take into + > account a scenario where end of a comment marker occurs inside + > character or string literals? + + The scanner certainly needs to also scan character and string literals. + However it does that (there's an example in the man page for strings), the + lexer will recognize the beginning of the literal before it runs across the + embedded "/*". Consequently, it will finish scanning the literal before it + even considers the possibility of matching "/*". + + Example: + + '([^']*|{ESCAPE_SEQUENCE})' + + will match all the text between the ''s (inclusive). So the lexer + considers this as a token beginning at the first ', and doesn't even + attempt to match other tokens inside it. + + I thinnk this subtlety is not worth putting in the manual, as I suspect + it would confuse more people than it would enlighten. + + Vern + + +File: flex.info, Node: ERASEME57, Next: Is there a repository for flex scanners?, Prev: ERASEME56, Up: FAQ + +ERASEME57 +========= + + To: "Marty Leisner" + Subject: Re: flex limitations + In-reply-to: Your message of Sat, 06 Sep 1997 11:27:21 PDT. + Date: Mon, 08 Sep 1997 11:38:08 PDT + From: Vern Paxson + + > %% + > [a-zA-Z]+ /* skip a line */ + > { printf("got %s\n", yytext); } + > %% + + What version of flex are you using? If I feed this to 2.5.4, it complains: + + "bug.l", line 5: EOF encountered inside an action + "bug.l", line 5: unrecognized rule + "bug.l", line 5: fatal parse error + + Not the world's greatest error message, but it manages to flag the problem. + + (With the introduction of start condition scopes, flex can't accommodate + an action on a separate line, since it's ambiguous with an indented rule.) + + You can get 2.5.4 from ftp.ee.lbl.gov. + + Vern + + +File: flex.info, Node: Is there a repository for flex scanners?, Next: How can I conditionally compile or preprocess my flex input file?, Prev: ERASEME57, Up: FAQ + +Is there a repository for flex scanners? +======================================== + +Not that we know of. You might try asking on comp.compilers. + + +File: flex.info, Node: How can I conditionally compile or preprocess my flex input file?, Next: Where can I find grammars for lex and yacc?, Prev: Is there a repository for flex scanners?, Up: FAQ + +How can I conditionally compile or preprocess my flex input file? +================================================================= + +Flex doesn't have a preprocessor like C does. You might try using m4, +or the C preprocessor plus a sed script to clean up the result. + + +File: flex.info, Node: Where can I find grammars for lex and yacc?, Next: I get an end-of-buffer message for each character scanned., Prev: How can I conditionally compile or preprocess my flex input file?, Up: FAQ + +Where can I find grammars for lex and yacc? +=========================================== + +In the sources for flex and bison. + + +File: flex.info, Node: I get an end-of-buffer message for each character scanned., Next: unnamed-faq-62, Prev: Where can I find grammars for lex and yacc?, Up: FAQ + +I get an end-of-buffer message for each character scanned. +========================================================== + +This will happen if your LexerInput() function returns only one +character at a time, which can happen either if you're scanner is +"interactive", or if the streams library on your platform always returns +1 for yyin->gcount(). + + Solution: override LexerInput() with a version that returns whole +buffers. + + +File: flex.info, Node: unnamed-faq-62, Next: unnamed-faq-63, Prev: I get an end-of-buffer message for each character scanned., Up: FAQ + +unnamed-faq-62 +============== + + To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE + Subject: Re: Flex maximums + In-reply-to: Your message of Mon, 17 Nov 1997 17:16:06 PST. + Date: Mon, 17 Nov 1997 17:16:15 PST + From: Vern Paxson + + > I took a quick look into the flex-sources and altered some #defines in + > flexdefs.h: + > + > #define INITIAL_MNS 64000 + > #define MNS_INCREMENT 1024000 + > #define MAXIMUM_MNS 64000 + + The things to fix are to add a couple of zeroes to: + + #define JAMSTATE -32766 /* marks a reference to the state that always jams */ + #define MAXIMUM_MNS 31999 + #define BAD_SUBSCRIPT -32767 + #define MAX_SHORT 32700 + + and, if you get complaints about too many rules, make the following change too: + + #define YY_TRAILING_MASK 0x200000 + #define YY_TRAILING_HEAD_MASK 0x400000 + + - Vern + + +File: flex.info, Node: unnamed-faq-63, Next: unnamed-faq-64, Prev: unnamed-faq-62, Up: FAQ + +unnamed-faq-63 +============== + + To: jimmey@lexis-nexis.com (Jimmey Todd) + Subject: Re: FLEX question regarding istream vs ifstream + In-reply-to: Your message of Mon, 08 Dec 1997 15:54:15 PST. + Date: Mon, 15 Dec 1997 13:21:35 PST + From: Vern Paxson + + > stdin_handle = YY_CURRENT_BUFFER; + > ifstream fin( "aFile" ); + > yy_switch_to_buffer( yy_create_buffer( fin, YY_BUF_SIZE ) ); + > + > What I'm wanting to do, is pass the contents of a file thru one set + > of rules and then pass stdin thru another set... It works great if, I + > don't use the C++ classes. But since everything else that I'm doing is + > in C++, I thought I'd be consistent. + > + > The problem is that 'yy_create_buffer' is expecting an istream* as it's + > first argument (as stated in the man page). However, fin is a ifstream + > object. Any ideas on what I might be doing wrong? Any help would be + > appreciated. Thanks!! + + You need to pass &fin, to turn it into an ifstream* instead of an ifstream. + Then its type will be compatible with the expected istream*, because ifstream + is derived from istream. + + Vern + + +File: flex.info, Node: unnamed-faq-64, Next: unnamed-faq-65, Prev: unnamed-faq-63, Up: FAQ + +unnamed-faq-64 +============== + + To: Enda Fadian + Subject: Re: Question related to Flex man page? + In-reply-to: Your message of Tue, 16 Dec 1997 15:17:34 PST. + Date: Tue, 16 Dec 1997 14:17:09 PST + From: Vern Paxson + + > Can you explain to me what is ment by a long-jump in relation to flex? + + Using the longjmp() function while inside yylex() or a routine called by it. + + > what is the flex activation frame. + + Just yylex()'s stack frame. + + > As far as I can see yyrestart will bring me back to the sart of the input + > file and using flex++ isnot really an option! + + No, yyrestart() doesn't imply a rewind, even though its name might sound + like it does. It tells the scanner to flush its internal buffers and + start reading from the given file at its present location. + + Vern + + +File: flex.info, Node: unnamed-faq-65, Next: unnamed-faq-66, Prev: unnamed-faq-64, Up: FAQ + +unnamed-faq-65 +============== + + To: hassan@larc.info.uqam.ca (Hassan Alaoui) + Subject: Re: Need urgent Help + In-reply-to: Your message of Sat, 20 Dec 1997 19:38:19 PST. + Date: Sun, 21 Dec 1997 21:30:46 PST + From: Vern Paxson + + > /usr/lib/yaccpar: In function `int yyparse()': + > /usr/lib/yaccpar:184: warning: implicit declaration of function `int yylex(...)' + > + > ld: Undefined symbol + > _yylex + > _yyparse + > _yyin + + This is a known problem with Solaris C++ (and/or Solaris yacc). I believe + the fix is to explicitly insert some 'extern "C"' statements for the + corresponding routines/symbols. + + Vern + + +File: flex.info, Node: unnamed-faq-66, Next: unnamed-faq-67, Prev: unnamed-faq-65, Up: FAQ + +unnamed-faq-66 +============== + + To: mc0307@mclink.it + Cc: gnu@prep.ai.mit.edu + Subject: Re: [mc0307@mclink.it: Help request] + In-reply-to: Your message of Fri, 12 Dec 1997 17:57:29 PST. + Date: Sun, 21 Dec 1997 22:33:37 PST + From: Vern Paxson + + > This is my definition for float and integer types: + > . . . + > NZD [1-9] + > ... + > I've tested my program on other lex version (on UNIX Sun Solaris an HP + > UNIX) and it work well, so I think that my definitions are correct. + > There are any differences between Lex and Flex? + + There are indeed differences, as discussed in the man page. The one + you are probably running into is that when flex expands a name definition, + it puts parentheses around the expansion, while lex does not. There's + an example in the man page of how this can lead to different matching. + Flex's behavior complies with the POSIX standard (or at least with the + last POSIX draft I saw). + + Vern + + +File: flex.info, Node: unnamed-faq-67, Next: unnamed-faq-68, Prev: unnamed-faq-66, Up: FAQ + +unnamed-faq-67 +============== + + To: hassan@larc.info.uqam.ca (Hassan Alaoui) + Subject: Re: Thanks + In-reply-to: Your message of Mon, 22 Dec 1997 16:06:35 PST. + Date: Mon, 22 Dec 1997 14:35:05 PST + From: Vern Paxson + + > Thank you very much for your help. I compile and link well with C++ while + > declaring 'yylex ...' extern, But a little problem remains. I get a + > segmentation default when executing ( I linked with lfl library) while it + > works well when using LEX instead of flex. Do you have some ideas about the + > reason for this ? + + The one possible reason for this that comes to mind is if you've defined + yytext as "extern char yytext[]" (which is what lex uses) instead of + "extern char *yytext" (which is what flex uses). If it's not that, then + I'm afraid I don't know what the problem might be. + + Vern + + +File: flex.info, Node: unnamed-faq-68, Next: unnamed-faq-69, Prev: unnamed-faq-67, Up: FAQ + +unnamed-faq-68 +============== + + To: "Bart Niswonger" + Subject: Re: flex 2.5: c++ scanners & start conditions + In-reply-to: Your message of Tue, 06 Jan 1998 10:34:21 PST. + Date: Tue, 06 Jan 1998 19:19:30 PST + From: Vern Paxson + + > The problem is that when I do this (using %option c++) start + > conditions seem to not apply. + + The BEGIN macro modifies the yy_start variable. For C scanners, this + is a static with scope visible through the whole file. For C++ scanners, + it's a member variable, so it only has visible scope within a member + function. Your lexbegin() routine is not a member function when you + build a C++ scanner, so it's not modifying the correct yy_start. The + diagnostic that indicates this is that you found you needed to add + a declaration of yy_start in order to get your scanner to compile when + using C++; instead, the correct fix is to make lexbegin() a member + function (by deriving from yyFlexLexer). + + Vern + + +File: flex.info, Node: unnamed-faq-69, Next: unnamed-faq-70, Prev: unnamed-faq-68, Up: FAQ + +unnamed-faq-69 +============== + + To: "Boris Zinin" + Subject: Re: current position in flex buffer + In-reply-to: Your message of Mon, 12 Jan 1998 18:58:23 PST. + Date: Mon, 12 Jan 1998 12:03:15 PST + From: Vern Paxson + + > The problem is how to determine the current position in flex active + > buffer when a rule is matched.... + + You will need to keep track of this explicitly, such as by redefining + YY_USER_ACTION to count the number of characters matched. + + The latest flex release, by the way, is 2.5.4, available from ftp.ee.lbl.gov. + + Vern + + +File: flex.info, Node: unnamed-faq-70, Next: unnamed-faq-71, Prev: unnamed-faq-69, Up: FAQ + +unnamed-faq-70 +============== + + To: Bik.Dhaliwal@bis.org + Subject: Re: Flex question + In-reply-to: Your message of Mon, 26 Jan 1998 13:05:35 PST. + Date: Tue, 27 Jan 1998 22:41:52 PST + From: Vern Paxson + + > That requirement involves knowing + > the character position at which a particular token was matched + > in the lexer. + + The way you have to do this is by explicitly keeping track of where + you are in the file, by counting the number of characters scanned + for each token (available in yyleng). It may prove convenient to + do this by redefining YY_USER_ACTION, as described in the manual. + + Vern + + +File: flex.info, Node: unnamed-faq-71, Next: unnamed-faq-72, Prev: unnamed-faq-70, Up: FAQ + +unnamed-faq-71 +============== + + To: Vladimir Alexiev + Subject: Re: flex: how to control start condition from parser? + In-reply-to: Your message of Mon, 26 Jan 1998 05:50:16 PST. + Date: Tue, 27 Jan 1998 22:45:37 PST + From: Vern Paxson + + > It seems useful for the parser to be able to tell the lexer about such + > context dependencies, because then they don't have to be limited to + > local or sequential context. + + One way to do this is to have the parser call a stub routine that's + included in the scanner's .l file, and consequently that has access ot + BEGIN. The only ugliness is that the parser can't pass in the state + it wants, because those aren't visible - but if you don't have many + such states, then using a different set of names doesn't seem like + to much of a burden. + + While generating a .h file like you suggests is certainly cleaner, + flex development has come to a virtual stand-still :-(, so a workaround + like the above is much more pragmatic than waiting for a new feature. + + Vern + + +File: flex.info, Node: unnamed-faq-72, Next: unnamed-faq-73, Prev: unnamed-faq-71, Up: FAQ + +unnamed-faq-72 +============== + + To: Barbara Denny + Subject: Re: freebsd flex bug? + In-reply-to: Your message of Fri, 30 Jan 1998 12:00:43 PST. + Date: Fri, 30 Jan 1998 12:42:32 PST + From: Vern Paxson + + > lex.yy.c:1996: parse error before `=' + + This is the key, identifying this error. (It may help to pinpoint + it by using flex -L, so it doesn't generate #line directives in its + output.) I will bet you heavy money that you have a start condition + name that is also a variable name, or something like that; flex spits + out #define's for each start condition name, mapping them to a number, + so you can wind up with: + + %x foo + %% + ... + %% + void bar() + { + int foo = 3; + } + + and the penultimate will turn into "int 1 = 3" after C preprocessing, + since flex will put "#define foo 1" in the generated scanner. + + Vern + + +File: flex.info, Node: unnamed-faq-73, Next: unnamed-faq-74, Prev: unnamed-faq-72, Up: FAQ + +unnamed-faq-73 +============== + + To: Maurice Petrie + Subject: Re: Lost flex .l file + In-reply-to: Your message of Mon, 02 Feb 1998 14:10:01 PST. + Date: Mon, 02 Feb 1998 11:15:12 PST + From: Vern Paxson + + > I am curious as to + > whether there is a simple way to backtrack from the generated source to + > reproduce the lost list of tokens we are searching on. + + In theory, it's straight-forward to go from the DFA representation + back to a regular-expression representation - the two are isomorphic. + In practice, a huge headache, because you have to unpack all the tables + back into a single DFA representation, and then write a program to munch + on that and translate it into an RE. + + Sorry for the less-than-happy news ... + + Vern + + +File: flex.info, Node: unnamed-faq-74, Next: unnamed-faq-75, Prev: unnamed-faq-73, Up: FAQ + +unnamed-faq-74 +============== + + To: jimmey@lexis-nexis.com (Jimmey Todd) + Subject: Re: Flex performance question + In-reply-to: Your message of Thu, 19 Feb 1998 11:01:17 PST. + Date: Thu, 19 Feb 1998 08:48:51 PST + From: Vern Paxson + + > What I have found, is that the smaller the data chunk, the faster the + > program executes. This is the opposite of what I expected. Should this be + > happening this way? + + This is exactly what will happen if your input file has embedded NULs. + From the man page: + + A final note: flex is slow when matching NUL's, particularly + when a token contains multiple NUL's. It's best to write + rules which match short amounts of text if it's anticipated + that the text will often include NUL's. + + So that's the first thing to look for. + + Vern + + +File: flex.info, Node: unnamed-faq-75, Next: unnamed-faq-76, Prev: unnamed-faq-74, Up: FAQ + +unnamed-faq-75 +============== + + To: jimmey@lexis-nexis.com (Jimmey Todd) + Subject: Re: Flex performance question + In-reply-to: Your message of Thu, 19 Feb 1998 11:01:17 PST. + Date: Thu, 19 Feb 1998 15:42:25 PST + From: Vern Paxson + + So there are several problems. + + First, to go fast, you want to match as much text as possible, which + your scanners don't in the case that what they're scanning is *not* + a tag. So you want a rule like: + + [^<]+ + + Second, C++ scanners are particularly slow if they're interactive, + which they are by default. Using -B speeds it up by a factor of 3-4 + on my workstation. + + Third, C++ scanners that use the istream interface are slow, because + of how poorly implemented istream's are. I built two versions of + the following scanner: + + %% + .*\n + .* + %% + + and the C version inhales a 2.5MB file on my workstation in 0.8 seconds. + The C++ istream version, using -B, takes 3.8 seconds. + + Vern + + +File: flex.info, Node: unnamed-faq-76, Next: unnamed-faq-77, Prev: unnamed-faq-75, Up: FAQ + +unnamed-faq-76 +============== + + To: "Frescatore, David (CRD, TAD)" + Subject: Re: FLEX 2.5 & THE YEAR 2000 + In-reply-to: Your message of Wed, 03 Jun 1998 11:26:22 PDT. + Date: Wed, 03 Jun 1998 10:22:26 PDT + From: Vern Paxson + + > I am researching the Y2K problem with General Electric R&D + > and need to know if there are any known issues concerning + > the above mentioned software and Y2K regardless of version. + + There shouldn't be, all it ever does with the date is ask the system + for it and then print it out. + + Vern + + +File: flex.info, Node: unnamed-faq-77, Next: unnamed-faq-78, Prev: unnamed-faq-76, Up: FAQ + +unnamed-faq-77 +============== + + To: "Hans Dermot Doran" + Subject: Re: flex problem + In-reply-to: Your message of Wed, 15 Jul 1998 21:30:13 PDT. + Date: Tue, 21 Jul 1998 14:23:34 PDT + From: Vern Paxson + + > To overcome this, I gets() the stdin into a string and lex the string. The + > string is lexed OK except that the end of string isn't lexed properly + > (yy_scan_string()), that is the lexer dosn't recognise the end of string. + + Flex doesn't contain mechanisms for recognizing buffer endpoints. But if + you use fgets instead (which you should anyway, to protect against buffer + overflows), then the final \n will be preserved in the string, and you can + scan that in order to find the end of the string. + + Vern + + +File: flex.info, Node: unnamed-faq-78, Next: unnamed-faq-79, Prev: unnamed-faq-77, Up: FAQ + +unnamed-faq-78 +============== + + To: soumen@almaden.ibm.com + Subject: Re: Flex++ 2.5.3 instance member vs. static member + In-reply-to: Your message of Mon, 27 Jul 1998 02:10:04 PDT. + Date: Tue, 28 Jul 1998 01:10:34 PDT + From: Vern Paxson + + > %{ + > int mylineno = 0; + > %} + > ws [ \t]+ + > alpha [A-Za-z] + > dig [0-9] + > %% + > + > Now you'd expect mylineno to be a member of each instance of class + > yyFlexLexer, but is this the case? A look at the lex.yy.cc file seems to + > indicate otherwise; unless I am missing something the declaration of + > mylineno seems to be outside any class scope. + > + > How will this work if I want to run a multi-threaded application with each + > thread creating a FlexLexer instance? + + Derive your own subclass and make mylineno a member variable of it. + + Vern + + +File: flex.info, Node: unnamed-faq-79, Next: unnamed-faq-80, Prev: unnamed-faq-78, Up: FAQ + +unnamed-faq-79 +============== + + To: Adoram Rogel + Subject: Re: More than 32K states change hangs + In-reply-to: Your message of Tue, 04 Aug 1998 16:55:39 PDT. + Date: Tue, 04 Aug 1998 22:28:45 PDT + From: Vern Paxson + + > Vern Paxson, + > + > I followed your advice, posted on Usenet bu you, and emailed to me + > personally by you, on how to overcome the 32K states limit. I'm running + > on Linux machines. + > I took the full source of version 2.5.4 and did the following changes in + > flexdef.h: + > #define JAMSTATE -327660 + > #define MAXIMUM_MNS 319990 + > #define BAD_SUBSCRIPT -327670 + > #define MAX_SHORT 327000 + > + > and compiled. + > All looked fine, including check and bigcheck, so I installed. + + Hmmm, you shouldn't increase MAX_SHORT, though looking through my email + archives I see that I did indeed recommend doing so. Try setting it back + to 32700; that should suffice that you no longer need -Ca. If it still + hangs, then the interesting question is - where? + + > Compiling the same hanged program with a out-of-the-box (RedHat 4.2 + > distribution of Linux) + > flex 2.5.4 binary works. + + Since Linux comes with source code, you should diff it against what + you have to see what problems they missed. + + > Should I always compile with the -Ca option now ? even short and simple + > filters ? + + No, definitely not. It's meant to be for those situations where you + absolutely must squeeze every last cycle out of your scanner. + + Vern + + +File: flex.info, Node: unnamed-faq-80, Next: unnamed-faq-81, Prev: unnamed-faq-79, Up: FAQ + +unnamed-faq-80 +============== + + To: "Schmackpfeffer, Craig" + Subject: Re: flex output for static code portion + In-reply-to: Your message of Tue, 11 Aug 1998 11:55:30 PDT. + Date: Mon, 17 Aug 1998 23:57:42 PDT + From: Vern Paxson + + > I would like to use flex under the hood to generate a binary file + > containing the data structures that control the parse. + + This has been on the wish-list for a long time. In principle it's + straight-forward - you redirect mkdata() et al's I/O to another file, + and modify the skeleton to have a start-up function that slurps these + into dynamic arrays. The concerns are (1) the scanner generation code + is hairy and full of corner cases, so it's easy to get surprised when + going down this path :-( ; and (2) being careful about buffering so + that when the tables change you make sure the scanner starts in the + correct state and reading at the right point in the input file. + + > I was wondering if you know of anyone who has used flex in this way. + + I don't - but it seems like a reasonable project to undertake (unlike + numerous other flex tweaks :-). + + Vern + + +File: flex.info, Node: unnamed-faq-81, Next: unnamed-faq-82, Prev: unnamed-faq-80, Up: FAQ + +unnamed-faq-81 +============== + + Received: from 131.173.17.11 (131.173.17.11 [131.173.17.11]) + by ee.lbl.gov (8.9.1/8.9.1) with ESMTP id AAA03838 + for ; Thu, 20 Aug 1998 00:47:57 -0700 (PDT) + Received: from hal.cl-ki.uni-osnabrueck.de (hal.cl-ki.Uni-Osnabrueck.DE [131.173.141.2]) + by deimos.rz.uni-osnabrueck.de (8.8.7/8.8.8) with ESMTP id JAA34694 + for ; Thu, 20 Aug 1998 09:47:55 +0200 + Received: (from georg@localhost) by hal.cl-ki.uni-osnabrueck.de (8.6.12/8.6.12) id JAA34834 for vern@ee.lbl.gov; Thu, 20 Aug 1998 09:47:54 +0200 + From: Georg Rehm + Message-Id: <199808200747.JAA34834@hal.cl-ki.uni-osnabrueck.de> + Subject: "flex scanner push-back overflow" + To: vern@ee.lbl.gov + Date: Thu, 20 Aug 1998 09:47:54 +0200 (MEST) + Reply-To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE + X-NoJunk: Do NOT send commercial mail, spam or ads to this address! + X-URL: http://www.cl-ki.uni-osnabrueck.de/~georg/ + X-Mailer: ELM [version 2.4ME+ PL28 (25)] + MIME-Version: 1.0 + Content-Type: text/plain; charset=US-ASCII + Content-Transfer-Encoding: 7bit + + Hi Vern, + + Yesterday, I encountered a strange problem: I use the macro processor m4 + to include some lengthy lists into a .l file. Following is a flex macro + definition that causes some serious pain in my neck: + + AUTHOR ("A. Boucard / L. Boucard"|"A. Dastarac / M. Levent"|"A.Boucaud / L.Boucaud"|"Abderrahim Lamchichi"|"Achmat Dangor"|"Adeline Toullier"|"Adewale Maja-Pearce"|"Ahmed Ziri"|"Akram Ellyas"|"Alain Bihr"|"Alain Gresh"|"Alain Guillemoles"|"Alain Joxe"|"Alain Morice"|"Alain Renon"|"Alain Zecchini"|"Albert Memmi"|"Alberto Manguel"|"Alex De Waal"|"Alfonso Artico"| [...]) + + The complete list contains about 10kB. When I try to "flex" this file + (on a Solaris 2.6 machine, using a modified flex 2.5.4 (I only increased + some of the predefined values in flexdefs.h) I get the error: + + myflex/flex -8 sentag.tmp.l + flex scanner push-back overflow + + When I remove the slashes in the macro definition everything works fine. + As I understand it, the double quotes escape the slash-character so it + really means "/" and not "trailing context". Furthermore, I tried to + escape the slashes with backslashes, but with no use, the same error message + appeared when flexing the code. + + Do you have an idea what's going on here? + + Greetings from Germany, + Georg + -- + Georg Rehm georg@cl-ki.uni-osnabrueck.de + Institute for Semantic Information Processing, University of Osnabrueck, FRG + + +File: flex.info, Node: unnamed-faq-82, Next: unnamed-faq-83, Prev: unnamed-faq-81, Up: FAQ + +unnamed-faq-82 +============== + + To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE + Subject: Re: "flex scanner push-back overflow" + In-reply-to: Your message of Thu, 20 Aug 1998 09:47:54 PDT. + Date: Thu, 20 Aug 1998 07:05:35 PDT + From: Vern Paxson + + > myflex/flex -8 sentag.tmp.l + > flex scanner push-back overflow + + Flex itself uses a flex scanner. That scanner is running out of buffer + space when it tries to unput() the humongous macro you've defined. When + you remove the '/'s, you make it small enough so that it fits in the buffer; + removing spaces would do the same thing. + + The fix is to either rethink how come you're using such a big macro and + perhaps there's another/better way to do it; or to rebuild flex's own + scan.c with a larger value for + + #define YY_BUF_SIZE 16384 + + - Vern + + +File: flex.info, Node: unnamed-faq-83, Next: unnamed-faq-84, Prev: unnamed-faq-82, Up: FAQ + +unnamed-faq-83 +============== + + To: Jan Kort + Subject: Re: Flex + In-reply-to: Your message of Fri, 04 Sep 1998 12:18:43 +0200. + Date: Sat, 05 Sep 1998 00:59:49 PDT + From: Vern Paxson + + > %% + > + > "TEST1\n" { fprintf(stderr, "TEST1\n"); yyless(5); } + > ^\n { fprintf(stderr, "empty line\n"); } + > . { } + > \n { fprintf(stderr, "new line\n"); } + > + > %% + > -- input --------------------------------------- + > TEST1 + > -- output -------------------------------------- + > TEST1 + > empty line + > ------------------------------------------------ + + IMHO, it's not clear whether or not this is in fact a bug. It depends + on whether you view yyless() as backing up in the input stream, or as + pushing new characters onto the beginning of the input stream. Flex + interprets it as the latter (for implementation convenience, I'll admit), + and so considers the newline as in fact matching at the beginning of a + line, as after all the last token scanned an entire line and so the + scanner is now at the beginning of a new line. + + I agree that this is counter-intuitive for yyless(), given its + functional description (it's less so for unput(), depending on whether + you're unput()'ing new text or scanned text). But I don't plan to + change it any time soon, as it's a pain to do so. Consequently, + you do indeed need to use yy_set_bol() and YY_AT_BOL() to tweak + your scanner into the behavior you desire. + + Sorry for the less-than-completely-satisfactory answer. + + Vern + + +File: flex.info, Node: unnamed-faq-84, Next: unnamed-faq-85, Prev: unnamed-faq-83, Up: FAQ + +unnamed-faq-84 +============== + + To: Patrick Krusenotto + Subject: Re: Problems with restarting flex-2.5.2-generated scanner + In-reply-to: Your message of Thu, 24 Sep 1998 10:14:07 PDT. + Date: Thu, 24 Sep 1998 23:28:43 PDT + From: Vern Paxson + + > I am using flex-2.5.2 and bison 1.25 for Solaris and I am desperately + > trying to make my scanner restart with a new file after my parser stops + > with a parse error. When my compiler restarts, the parser always + > receives the token after the token (in the old file!) that caused the + > parser error. + + I suspect the problem is that your parser has read ahead in order + to attempt to resolve an ambiguity, and when it's restarted it picks + up with that token rather than reading a fresh one. If you're using + yacc, then the special "error" production can sometimes be used to + consume tokens in an attempt to get the parser into a consistent state. + + Vern + + +File: flex.info, Node: unnamed-faq-85, Next: unnamed-faq-86, Prev: unnamed-faq-84, Up: FAQ + +unnamed-faq-85 +============== + + To: Henric Jungheim + Subject: Re: flex 2.5.4a + In-reply-to: Your message of Tue, 27 Oct 1998 16:41:42 PST. + Date: Tue, 27 Oct 1998 16:50:14 PST + From: Vern Paxson + + > This brings up a feature request: How about a command line + > option to specify the filename when reading from stdin? That way one + > doesn't need to create a temporary file in order to get the "#line" + > directives to make sense. + + Use -o combined with -t (per the man page description of -o). + + > P.S., Is there any simple way to use non-blocking IO to parse multiple + > streams? + + Simple, no. + + One approach might be to return a magic character on EWOULDBLOCK and + have a rule + + .* // put back .*, eat magic character + + This is off the top of my head, not sure it'll work. + + Vern + + +File: flex.info, Node: unnamed-faq-86, Next: unnamed-faq-87, Prev: unnamed-faq-85, Up: FAQ + +unnamed-faq-86 +============== + + To: "Repko, Billy D" + Subject: Re: Compiling scanners + In-reply-to: Your message of Wed, 13 Jan 1999 10:52:47 PST. + Date: Thu, 14 Jan 1999 00:25:30 PST + From: Vern Paxson + + > It appears that maybe it cannot find the lfl library. + + The Makefile in the distribution builds it, so you should have it. + It's exceedingly trivial, just a main() that calls yylex() and + a yyrap() that always returns 1. + + > %% + > \n ++num_lines; ++num_chars; + > . ++num_chars; + + You can't indent your rules like this - that's where the errors are coming + from. Flex copies indented text to the output file, it's how you do things + like + + int num_lines_seen = 0; + + to declare local variables. + + Vern + + +File: flex.info, Node: unnamed-faq-87, Next: unnamed-faq-88, Prev: unnamed-faq-86, Up: FAQ + +unnamed-faq-87 +============== + + To: Erick Branderhorst + Subject: Re: flex input buffer + In-reply-to: Your message of Tue, 09 Feb 1999 13:53:46 PST. + Date: Tue, 09 Feb 1999 21:03:37 PST + From: Vern Paxson + + > In the flex.skl file the size of the default input buffers is set. Can you + > explain why this size is set and why it is such a high number. + + It's large to optimize performance when scanning large files. You can + safely make it a lot lower if needed. + + Vern + + +File: flex.info, Node: unnamed-faq-88, Next: unnamed-faq-90, Prev: unnamed-faq-87, Up: FAQ + +unnamed-faq-88 +============== + + To: "Guido Minnen" + Subject: Re: Flex error message + In-reply-to: Your message of Wed, 24 Feb 1999 15:31:46 PST. + Date: Thu, 25 Feb 1999 00:11:31 PST + From: Vern Paxson + + > I'm extending a larger scanner written in Flex and I keep running into + > problems. More specifically, I get the error message: + > "flex: input rules are too complicated (>= 32000 NFA states)" + + Increase the definitions in flexdef.h for: + + #define JAMSTATE -32766 /* marks a reference to the state that always j + ams */ + #define MAXIMUM_MNS 31999 + #define BAD_SUBSCRIPT -32767 + + recompile everything, and it should all work. + + Vern + + +File: flex.info, Node: unnamed-faq-90, Next: unnamed-faq-91, Prev: unnamed-faq-88, Up: FAQ + +unnamed-faq-90 +============== + + To: "Dmitriy Goldobin" + Subject: Re: FLEX trouble + In-reply-to: Your message of Mon, 31 May 1999 18:44:49 PDT. + Date: Tue, 01 Jun 1999 00:15:07 PDT + From: Vern Paxson + + > I have a trouble with FLEX. Why rule "/*".*"*/" work properly,=20 + > but rule "/*"(.|\n)*"*/" don't work ? + + The second of these will have to scan the entire input stream (because + "(.|\n)*" matches an arbitrary amount of any text) in order to see if + it ends with "*/", terminating the comment. That potentially will overflow + the input buffer. + + > More complex rule "/*"([^*]|(\*/[^/]))*"*/ give an error + > 'unrecognized rule'. + + You can't use the '/' operator inside parentheses. It's not clear + what "(a/b)*" actually means. + + > I now use workaround with state , but single-rule is + > better, i think. + + Single-rule is nice but will always have the problem of either setting + restrictions on comments (like not allowing multi-line comments) and/or + running the risk of consuming the entire input stream, as noted above. + + Vern + + +File: flex.info, Node: unnamed-faq-91, Next: unnamed-faq-92, Prev: unnamed-faq-90, Up: FAQ + +unnamed-faq-91 +============== + + Received: from mc-qout4.whowhere.com (mc-qout4.whowhere.com [209.185.123.18]) + by ee.lbl.gov (8.9.3/8.9.3) with SMTP id IAA05100 + for ; Tue, 15 Jun 1999 08:56:06 -0700 (PDT) + Received: from Unknown/Local ([?.?.?.?]) by my-deja.com; Tue Jun 15 08:55:43 1999 + To: vern@ee.lbl.gov + Date: Tue, 15 Jun 1999 08:55:43 -0700 + From: "Aki Niimura" + Message-ID: + Mime-Version: 1.0 + Cc: + X-Sent-Mail: on + Reply-To: + X-Mailer: MailCity Service + Subject: A question on flex C++ scanner + X-Sender-Ip: 12.72.207.61 + Organization: My Deja Email (http://www.my-deja.com:80) + Content-Type: text/plain; charset=us-ascii + Content-Transfer-Encoding: 7bit + + Dear Dr. Paxon, + + I have been using flex for years. + It works very well on many projects. + Most case, I used it to generate a scanner on C language. + However, one project I needed to generate a scanner + on C++ lanuage. Thanks to your enhancement, flex did + the job. + + Currently, I'm working on enhancing my previous project. + I need to deal with multiple input streams (recursive + inclusion) in this scanner (C++). + I did similar thing for another scanner (C) as you + explained in your documentation. + + The generated scanner (C++) has necessary methods: + - switch_to_buffer(struct yy_buffer_state *b) + - yy_create_buffer(istream *is, int sz) + - yy_delete_buffer(struct yy_buffer_state *b) + + However, I couldn't figure out how to access current + buffer (yy_current_buffer). + + yy_current_buffer is a protected member of yyFlexLexer. + I can't access it directly. + Then, I thought yy_create_buffer() with is = 0 might + return current stream buffer. But it seems not as far + as I checked the source. (flex 2.5.4) + + I went through the Web in addition to Flex documentation. + However, it hasn't been successful, so far. + + It is not my intention to bother you, but, can you + comment about how to obtain the current stream buffer? + + Your response would be highly appreciated. + + Best regards, + Aki Niimura + + --== Sent via Deja.com http://www.deja.com/ ==-- + Share what you know. Learn what you don't. + + +File: flex.info, Node: unnamed-faq-92, Next: unnamed-faq-93, Prev: unnamed-faq-91, Up: FAQ + +unnamed-faq-92 +============== + + To: neko@my-deja.com + Subject: Re: A question on flex C++ scanner + In-reply-to: Your message of Tue, 15 Jun 1999 08:55:43 PDT. + Date: Tue, 15 Jun 1999 09:04:24 PDT + From: Vern Paxson + + > However, I couldn't figure out how to access current + > buffer (yy_current_buffer). + + Derive your own subclass from yyFlexLexer. + + Vern + + +File: flex.info, Node: unnamed-faq-93, Next: unnamed-faq-94, Prev: unnamed-faq-92, Up: FAQ + +unnamed-faq-93 +============== + + To: "Stones, Darren" + Subject: Re: You're the man to see? + In-reply-to: Your message of Wed, 23 Jun 1999 11:10:29 PDT. + Date: Wed, 23 Jun 1999 09:01:40 PDT + From: Vern Paxson + + > I hope you can help me. I am using Flex and Bison to produce an interpreted + > language. However all goes well until I try to implement an IF statement or + > a WHILE. I cannot get this to work as the parser parses all the conditions + > eg. the TRUE and FALSE conditons to check for a rule match. So I cannot + > make a decision!! + + You need to use the parser to build a parse tree (= abstract syntax trwee), + and when that's all done you recursively evaluate the tree, binding variables + to values at that time. + + Vern + + +File: flex.info, Node: unnamed-faq-94, Next: unnamed-faq-95, Prev: unnamed-faq-93, Up: FAQ + +unnamed-faq-94 +============== + + To: Petr Danecek + Subject: Re: flex - question + In-reply-to: Your message of Mon, 28 Jun 1999 19:21:41 PDT. + Date: Fri, 02 Jul 1999 16:52:13 PDT + From: Vern Paxson + + > file, it takes an enormous amount of time. It is funny, because the + > source code has only 12 rules!!! I think it looks like an exponencial + > growth. + + Right, that's the problem - some patterns (those with a lot of + ambiguity, where yours has because at any given time the scanner can + be in the middle of all sorts of combinations of the different + rules) blow up exponentially. + + For your rules, there is an easy fix. Change the ".*" that comes fater + the directory name to "[^ ]*". With that in place, the rules are no + longer nearly so ambiguous, because then once one of the directories + has been matched, no other can be matched (since they all require a + leading blank). + + If that's not an acceptable solution, then you can enter a start state + to pick up the .*\n after each directory is matched. + + Also note that for speed, you'll want to add a ".*" rule at the end, + otherwise rules that don't match any of the patterns will be matched + very slowly, a character at a time. + + Vern + + +File: flex.info, Node: unnamed-faq-95, Next: unnamed-faq-96, Prev: unnamed-faq-94, Up: FAQ + +unnamed-faq-95 +============== + + To: Tielman Koekemoer + Subject: Re: Please help. + In-reply-to: Your message of Thu, 08 Jul 1999 13:20:37 PDT. + Date: Thu, 08 Jul 1999 08:20:39 PDT + From: Vern Paxson + + > I was hoping you could help me with my problem. + > + > I tried compiling (gnu)flex on a Solaris 2.4 machine + > but when I ran make (after configure) I got an error. + > + > -------------------------------------------------------------- + > gcc -c -I. -I. -g -O parse.c + > ./flex -t -p ./scan.l >scan.c + > sh: ./flex: not found + > *** Error code 1 + > make: Fatal error: Command failed for target `scan.c' + > ------------------------------------------------------------- + > + > What's strange to me is that I'm only + > trying to install flex now. I then edited the Makefile to + > and changed where it says "FLEX = flex" to "FLEX = lex" + > ( lex: the native Solaris one ) but then it complains about + > the "-p" option. Is there any way I can compile flex without + > using flex or lex? + > + > Thanks so much for your time. + + You managed to step on the bootstrap sequence, which first copies + initscan.c to scan.c in order to build flex. Try fetching a fresh + distribution from ftp.ee.lbl.gov. (Or you can first try removing + ".bootstrap" and doing a make again.) + + Vern + + +File: flex.info, Node: unnamed-faq-96, Next: unnamed-faq-97, Prev: unnamed-faq-95, Up: FAQ + +unnamed-faq-96 +============== + + To: Tielman Koekemoer + Subject: Re: Please help. + In-reply-to: Your message of Fri, 09 Jul 1999 09:16:14 PDT. + Date: Fri, 09 Jul 1999 00:27:20 PDT + From: Vern Paxson + + > First I removed .bootstrap (and ran make) - no luck. I downloaded the + > software but I still have the same problem. Is there anything else I + > could try. + + Try: + + cp initscan.c scan.c + touch scan.c + make scan.o + + If this last tries to first build scan.c from scan.l using ./flex, then + your "make" is broken, in which case compile scan.c to scan.o by hand. + + Vern + + +File: flex.info, Node: unnamed-faq-97, Next: unnamed-faq-98, Prev: unnamed-faq-96, Up: FAQ + +unnamed-faq-97 +============== + + To: Sumanth Kamenani + Subject: Re: Error + In-reply-to: Your message of Mon, 19 Jul 1999 23:08:41 PDT. + Date: Tue, 20 Jul 1999 00:18:26 PDT + From: Vern Paxson + + > I am getting a compilation error. The error is given as "unknown symbol- yylex". + + The parser relies on calling yylex(), but you're instead using the C++ scanning + class, so you need to supply a yylex() "glue" function that calls an instance + scanner of the scanner (e.g., "scanner->yylex()"). + + Vern + + +File: flex.info, Node: unnamed-faq-98, Next: unnamed-faq-99, Prev: unnamed-faq-97, Up: FAQ + +unnamed-faq-98 +============== + + To: daniel@synchrods.synchrods.COM (Daniel Senderowicz) + Subject: Re: lex + In-reply-to: Your message of Mon, 22 Nov 1999 11:19:04 PST. + Date: Tue, 23 Nov 1999 15:54:30 PST + From: Vern Paxson + + Well, your problem is the + + switch (yybgin-yysvec-1) { /* witchcraft */ + + at the beginning of lex rules. "witchcraft" == "non-portable". It's + assuming knowledge of the AT&T lex's internal variables. + + For flex, you can probably do the equivalent using a switch on YYSTATE. + + Vern + + +File: flex.info, Node: unnamed-faq-99, Next: unnamed-faq-100, Prev: unnamed-faq-98, Up: FAQ + +unnamed-faq-99 +============== + + To: archow@hss.hns.com + Subject: Re: Regarding distribution of flex and yacc based grammars + In-reply-to: Your message of Sun, 19 Dec 1999 17:50:24 +0530. + Date: Wed, 22 Dec 1999 01:56:24 PST + From: Vern Paxson + + > When we provide the customer with an object code distribution, is it + > necessary for us to provide source + > for the generated C files from flex and bison since they are generated by + > flex and bison ? + + For flex, no. I don't know what the current state of this is for bison. + + > Also, is there any requrirement for us to neccessarily provide source for + > the grammar files which are fed into flex and bison ? + + Again, for flex, no. + + See the file "COPYING" in the flex distribution for the legalese. + + Vern + + +File: flex.info, Node: unnamed-faq-100, Next: unnamed-faq-101, Prev: unnamed-faq-99, Up: FAQ + +unnamed-faq-100 +=============== + + To: Martin Gallwey + Subject: Re: Flex, and self referencing rules + In-reply-to: Your message of Sun, 20 Feb 2000 01:01:21 PST. + Date: Sat, 19 Feb 2000 18:33:16 PST + From: Vern Paxson + + > However, I do not use unput anywhere. I do use self-referencing + > rules like this: + > + > UnaryExpr ({UnionExpr})|("-"{UnaryExpr}) + + You can't do this - flex is *not* a parser like yacc (which does indeed + allow recursion), it is a scanner that's confined to regular expressions. + + Vern + + +File: flex.info, Node: unnamed-faq-101, Next: What is the difference between YYLEX_PARAM and YY_DECL?, Prev: unnamed-faq-100, Up: FAQ + +unnamed-faq-101 +=============== + + To: slg3@lehigh.edu (SAMUEL L. GULDEN) + Subject: Re: Flex problem + In-reply-to: Your message of Thu, 02 Mar 2000 12:29:04 PST. + Date: Thu, 02 Mar 2000 23:00:46 PST + From: Vern Paxson + + If this is exactly your program: + + > digit [0-9] + > digits {digit}+ + > whitespace [ \t\n]+ + > + > %% + > "[" { printf("open_brac\n");} + > "]" { printf("close_brac\n");} + > "+" { printf("addop\n");} + > "*" { printf("multop\n");} + > {digits} { printf("NUMBER = %s\n", yytext);} + > whitespace ; + + then the problem is that the last rule needs to be "{whitespace}" ! + + Vern + + +File: flex.info, Node: What is the difference between YYLEX_PARAM and YY_DECL?, Next: Why do I get "conflicting types for yylex" error?, Prev: unnamed-faq-101, Up: FAQ + +What is the difference between YYLEX_PARAM and YY_DECL? +======================================================= + +YYLEX_PARAM is not a flex symbol. It is for Bison. It tells Bison to +pass extra params when it calls yylex() from the parser. + + YY_DECL is the Flex declaration of yylex. The default is similar to +this: + + #define int yy_lex () + + +File: flex.info, Node: Why do I get "conflicting types for yylex" error?, Next: How do I access the values set in a Flex action from within a Bison action?, Prev: What is the difference between YYLEX_PARAM and YY_DECL?, Up: FAQ + +Why do I get "conflicting types for yylex" error? +================================================= + +This is a compiler error regarding a generated Bison parser, not a Flex +scanner. It means you need a prototype of yylex() in the top of the +Bison file. Be sure the prototype matches YY_DECL. + + +File: flex.info, Node: How do I access the values set in a Flex action from within a Bison action?, Prev: Why do I get "conflicting types for yylex" error?, Up: FAQ + +How do I access the values set in a Flex action from within a Bison action? +=========================================================================== + +With $1, $2, $3, etc. These are called "Semantic Values" in the Bison +manual. See *note (bison)Top::. + + +File: flex.info, Node: Appendices, Next: Indices, Prev: FAQ, Up: Top + +Appendix A Appendices +********************* + +* Menu: + +* Makefiles and Flex:: +* Bison Bridge:: +* M4 Dependency:: +* Common Patterns:: + + +File: flex.info, Node: Makefiles and Flex, Next: Bison Bridge, Prev: Appendices, Up: Appendices + +A.1 Makefiles and Flex +====================== + +In this appendix, we provide tips for writing Makefiles to build your +scanners. + + In a traditional build environment, we say that the '.c' files are +the sources, and the '.o' files are the intermediate files. When using +'flex', however, the '.l' files are the sources, and the generated '.c' +files (along with the '.o' files) are the intermediate files. This +requires you to carefully plan your Makefile. + + Modern 'make' programs understand that 'foo.l' is intended to +generate 'lex.yy.c' or 'foo.c', and will behave accordingly(1)(2). The +following Makefile does not explicitly instruct 'make' how to build +'foo.c' from 'foo.l'. Instead, it relies on the implicit rules of the +'make' program to build the intermediate file, 'scan.c': + + # Basic Makefile -- relies on implicit rules + # Creates "myprogram" from "scan.l" and "myprogram.c" + # + LEX=flex + myprogram: scan.o myprogram.o + scan.o: scan.l + + + For simple cases, the above may be sufficient. For other cases, you +may have to explicitly instruct 'make' how to build your scanner. The +following is an example of a Makefile containing explicit rules: + + # Basic Makefile -- provides explicit rules + # Creates "myprogram" from "scan.l" and "myprogram.c" + # + LEX=flex + myprogram: scan.o myprogram.o + $(CC) -o $@ $(LDFLAGS) $^ + + myprogram.o: myprogram.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ + + scan.o: scan.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^ + + scan.c: scan.l + $(LEX) $(LFLAGS) -o $@ $^ + + clean: + $(RM) *.o scan.c + + + Notice in the above example that 'scan.c' is in the 'clean' target. +This is because we consider the file 'scan.c' to be an intermediate +file. + + Finally, we provide a realistic example of a 'flex' scanner used with +a 'bison' parser(3). There is a tricky problem we have to deal with. +Since a 'flex' scanner will typically include a header file (e.g., +'y.tab.h') generated by the parser, we need to be sure that the header +file is generated BEFORE the scanner is compiled. We handle this case +in the following example: + + # Makefile example -- scanner and parser. + # Creates "myprogram" from "scan.l", "parse.y", and "myprogram.c" + # + LEX = flex + YACC = bison -y + YFLAGS = -d + objects = scan.o parse.o myprogram.o + + myprogram: $(objects) + scan.o: scan.l parse.c + parse.o: parse.y + myprogram.o: myprogram.c + + + In the above example, notice the line, + + scan.o: scan.l parse.c + + , which lists the file 'parse.c' (the generated parser) as a +dependency of 'scan.o'. We want to ensure that the parser is created +before the scanner is compiled, and the above line seems to do the +trick. Feel free to experiment with your specific implementation of +'make'. + + For more details on writing Makefiles, see *note (make)Top::. + + ---------- Footnotes ---------- + + (1) GNU 'make' and GNU 'automake' are two such programs that provide +implicit rules for flex-generated scanners. + + (2) GNU 'automake' may generate code to execute flex in +lex-compatible mode, or to stdout. If this is not what you want, then +you should provide an explicit rule in your Makefile.am + + (3) This example also applies to yacc parsers. + + +File: flex.info, Node: Bison Bridge, Next: M4 Dependency, Prev: Makefiles and Flex, Up: Appendices + +A.2 C Scanners with Bison Parsers +================================= + +This section describes the 'flex' features useful when integrating +'flex' with 'GNU bison'(1). Skip this section if you are not using +'bison' with your scanner. Here we discuss only the 'flex' half of the +'flex' and 'bison' pair. We do not discuss 'bison' in any detail. For +more information about generating 'bison' parsers, see *note +(bison)Top::. + + A compatible 'bison' scanner is generated by declaring '%option +bison-bridge' or by supplying '--bison-bridge' when invoking 'flex' from +the command line. This instructs 'flex' that the macro 'yylval' may be +used. The data type for 'yylval', 'YYSTYPE', is typically defined in a +header file, included in section 1 of the 'flex' input file. For a list +of functions and macros available, *Note bison-functions::. + + The declaration of yylex becomes, + + int yylex ( YYSTYPE * lvalp, yyscan_t scanner ); + + If '%option bison-locations' is specified, then the declaration +becomes, + + int yylex ( YYSTYPE * lvalp, YYLTYPE * llocp, yyscan_t scanner ); + + Note that the macros 'yylval' and 'yylloc' evaluate to pointers. +Support for 'yylloc' is optional in 'bison', so it is optional in 'flex' +as well. The following is an example of a 'flex' scanner that is +compatible with 'bison'. + + /* Scanner for "C" assignment statements... sort of. */ + %{ + #include "y.tab.h" /* Generated by bison. */ + %} + + %option bison-bridge bison-locations + % + + [[:digit:]]+ { yylval->num = atoi(yytext); return NUMBER;} + [[:alnum:]]+ { yylval->str = strdup(yytext); return STRING;} + "="|";" { return yytext[0];} + . {} + % + + As you can see, there really is no magic here. We just use 'yylval' +as we would any other variable. The data type of 'yylval' is generated +by 'bison', and included in the file 'y.tab.h'. Here is the +corresponding 'bison' parser: + + /* Parser to convert "C" assignments to lisp. */ + %{ + /* Pass the argument to yyparse through to yylex. */ + #define YYPARSE_PARAM scanner + #define YYLEX_PARAM scanner + %} + %locations + %pure_parser + %union { + int num; + char* str; + } + %token STRING + %token NUMBER + %% + assignment: + STRING '=' NUMBER ';' { + printf( "(setf %s %d)", $1, $3 ); + } + ; + + ---------- Footnotes ---------- + + (1) The features described here are purely optional, and are by no +means the only way to use flex with bison. We merely provide some glue +to ease development of your parser-scanner pair. + + +File: flex.info, Node: M4 Dependency, Next: Common Patterns, Prev: Bison Bridge, Up: Appendices + +A.3 M4 Dependency +================= + +The macro processor 'm4'(1) must be installed wherever flex is +installed. 'flex' invokes 'm4', found by searching the directories in +the 'PATH' environment variable. Any code you place in section 1 or in +the actions will be sent through m4. Please follow these rules to +protect your code from unwanted 'm4' processing. + + * Do not use symbols that begin with, 'm4_', such as, 'm4_define', or + 'm4_include', since those are reserved for 'm4' macro names. If + for some reason you need m4_ as a prefix, use a preprocessor + #define to get your symbol past m4 unmangled. + + * Do not use the strings '[[' or ']]' anywhere in your code. The + former is not valid in C, except within comments and strings, but + the latter is valid in code such as 'x[y[z]]'. The solution is + simple. To get the literal string '"]]"', use '"]""]"'. To get + the array notation 'x[y[z]]', use 'x[y[z] ]'. Flex will attempt to + detect these sequences in user code, and escape them. However, + it's best to avoid this complexity where possible, by removing such + sequences from your code. + + 'm4' is only required at the time you run 'flex'. The generated +scanner is ordinary C or C++, and does _not_ require 'm4'. + + ---------- Footnotes ---------- + + (1) The use of m4 is subject to change in future revisions of flex. +It is not part of the public API of flex. Do not depend on it. + + +File: flex.info, Node: Common Patterns, Prev: M4 Dependency, Up: Appendices + +A.4 Common Patterns +=================== + +This appendix provides examples of common regular expressions you might +use in your scanner. + +* Menu: + +* Numbers:: +* Identifiers:: +* Quoted Constructs:: +* Addresses:: + + +File: flex.info, Node: Numbers, Next: Identifiers, Up: Common Patterns + +A.4.1 Numbers +------------- + +C99 decimal constant + '([[:digit:]]{-}[0])[[:digit:]]*' + +C99 hexadecimal constant + '0[xX][[:xdigit:]]+' + +C99 octal constant + '0[01234567]*' + +C99 floating point constant + {dseq} ([[:digit:]]+) + {dseq_opt} ([[:digit:]]*) + {frac} (({dseq_opt}"."{dseq})|{dseq}".") + {exp} ([eE][+-]?{dseq}) + {exp_opt} ({exp}?) + {fsuff} [flFL] + {fsuff_opt} ({fsuff}?) + {hpref} (0[xX]) + {hdseq} ([[:xdigit:]]+) + {hdseq_opt} ([[:xdigit:]]*) + {hfrac} (({hdseq_opt}"."{hdseq})|({hdseq}".")) + {bexp} ([pP][+-]?{dseq}) + {dfc} (({frac}{exp_opt}{fsuff_opt})|({dseq}{exp}{fsuff_opt})) + {hfc} (({hpref}{hfrac}{bexp}{fsuff_opt})|({hpref}{hdseq}{bexp}{fsuff_opt})) + + {c99_floating_point_constant} ({dfc}|{hfc}) + + See C99 section 6.4.4.2 for the gory details. + + +File: flex.info, Node: Identifiers, Next: Quoted Constructs, Prev: Numbers, Up: Common Patterns + +A.4.2 Identifiers +----------------- + +C99 Identifier + ucn ((\\u([[:xdigit:]]{4}))|(\\U([[:xdigit:]]{8}))) + nondigit [_[:alpha:]] + c99_id ([_[:alpha:]]|{ucn})([_[:alnum:]]|{ucn})* + + Technically, the above pattern does not encompass all possible C99 + identifiers, since C99 allows for "implementation-defined" + characters. In practice, C compilers follow the above pattern, + with the addition of the '$' character. + +UTF-8 Encoded Unicode Code Point + [\x09\x0A\x0D\x20-\x7E]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF]([\x80-\xBF]{2})|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF]([\x80-\xBF]{2})|[\xF1-\xF3]([\x80-\xBF]{3})|\xF4[\x80-\x8F]([\x80-\xBF]{2}) + + +File: flex.info, Node: Quoted Constructs, Next: Addresses, Prev: Identifiers, Up: Common Patterns + +A.4.3 Quoted Constructs +----------------------- + +C99 String Literal + 'L?\"([^\"\\\n]|(\\['\"?\\abfnrtv])|(\\([0123456]{1,3}))|(\\x[[:xdigit:]]+)|(\\u([[:xdigit:]]{4}))|(\\U([[:xdigit:]]{8})))*\"' + +C99 Comment + '("/*"([^*]|"*"[^/])*"*/")|("/"(\\\n)*"/"[^\n]*)' + + Note that in C99, a '//'-style comment may be split across lines, + and, contrary to popular belief, does not include the trailing '\n' + character. + + A better way to scan '/* */' comments is by line, rather than + matching possibly huge comments all at once. This will allow you + to scan comments of unlimited length, as long as line breaks appear + at sane intervals. This is also more efficient when used with + automatic line number processing. *Note option-yylineno::. + + { + "/*" BEGIN(COMMENT); + } + { + "*/" BEGIN(0); + [^*\n]+ ; + "*"[^/] ; + \n ; + } + + +File: flex.info, Node: Addresses, Prev: Quoted Constructs, Up: Common Patterns + +A.4.4 Addresses +--------------- + +IPv4 Address + dec-octet [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5] + IPv4address {dec-octet}\.{dec-octet}\.{dec-octet}\.{dec-octet} + +IPv6 Address + h16 [0-9A-Fa-f]{1,4} + ls32 {h16}:{h16}|{IPv4address} + IPv6address ({h16}:){6}{ls32}| + ::({h16}:){5}{ls32}| + ({h16})?::({h16}:){4}{ls32}| + (({h16}:){0,1}{h16})?::({h16}:){3}{ls32}| + (({h16}:){0,2}{h16})?::({h16}:){2}{ls32}| + (({h16}:){0,3}{h16})?::{h16}:{ls32}| + (({h16}:){0,4}{h16})?::{ls32}| + (({h16}:){0,5}{h16})?::{h16}| + (({h16}:){0,6}{h16})?:: + + See RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt) for details. + Note that you have to fold the definition of 'IPv6address' into one + line and that it also matches the "unspecified address" "::". + +URI + '(([^:/?#]+):)?("//"([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?' + + This pattern is nearly useless, since it allows just about any + character to appear in a URI, including spaces and control + characters. See RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) for + details. + + +File: flex.info, Node: Indices, Prev: Appendices, Up: Top + +Indices +******* + +* Menu: + +* Concept Index:: +* Index of Functions and Macros:: +* Index of Variables:: +* Index of Data Types:: +* Index of Hooks:: +* Index of Scanner Options:: + + +File: flex.info, Node: Concept Index, Next: Index of Functions and Macros, Prev: Indices, Up: Indices + +Concept Index +============= + +[index] +* Menu: + +* $ as normal character in patterns: Patterns. (line 275) +* %array, advantages of: Matching. (line 43) +* %array, use of: Matching. (line 29) +* %array, with C++: Matching. (line 65) +* %option noyywrapp: Generated Scanner. (line 93) +* %pointer, and unput(): Actions. (line 162) +* %pointer, use of: Matching. (line 29) +* %top: Definitions Section. (line 44) +* %{ and %}, in Definitions Section: Definitions Section. (line 40) +* %{ and %}, in Rules Section: Actions. (line 26) +* <>, use of: EOF. (line 33) +* [] in patterns: Patterns. (line 15) +* ^ as non-special character in patterns: Patterns. (line 275) +* |, in actions: Actions. (line 33) +* |, use of: Actions. (line 83) +* accessor functions, use of: Accessor Methods. (line 18) +* actions: Actions. (line 6) +* actions, embedded C strings: Actions. (line 26) +* actions, redefining YY_BREAK: Misc Macros. (line 49) +* actions, use of { and }: Actions. (line 26) +* aliases, how to define: Definitions Section. (line 10) +* arguments, command-line: Scanner Options. (line 6) +* array, default size for yytext: User Values. (line 13) +* backing up, eliminating: Performance. (line 54) +* backing up, eliminating by adding error rules: Performance. (line 104) +* backing up, eliminating with catch-all rule: Performance. (line 118) +* backing up, example of eliminating: Performance. (line 49) +* BEGIN: Actions. (line 57) +* BEGIN, explanation: Start Conditions. (line 84) +* beginning of line, in patterns: Patterns. (line 127) +* bison, bridging with flex: Bison Bridge. (line 6) +* bison, parser: Bison Bridge. (line 53) +* bison, scanner to be called from bison: Bison Bridge. (line 34) +* BOL, checking the BOL flag: Misc Macros. (line 46) +* BOL, in patterns: Patterns. (line 127) +* BOL, setting it: Misc Macros. (line 40) +* braces in patterns: Patterns. (line 42) +* bugs, reporting: Reporting Bugs. (line 6) +* C code in flex input: Definitions Section. (line 40) +* C++: Cxx. (line 9) +* C++ and %array: User Values. (line 23) +* C++ I/O, customizing: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* C++ scanners, including multiple scanners: Cxx. (line 197) +* C++ scanners, use of: Cxx. (line 128) +* c++, experimental form of scanner class: Cxx. (line 6) +* C++, multiple different scanners: Cxx. (line 192) +* C-strings, in actions: Actions. (line 26) +* case-insensitive, effect on character classes: Patterns. (line 216) +* character classes in patterns: Patterns. (line 186) +* character classes in patterns, syntax of: Patterns. (line 15) +* character classes, equivalence of: Patterns. (line 205) +* clearing an input buffer: Multiple Input Buffers. + (line 66) +* command-line options: Scanner Options. (line 6) +* comments in flex input: Definitions Section. (line 37) +* comments in the input: Comments in the Input. + (line 24) +* comments, discarding: Actions. (line 176) +* comments, example of scanning C comments: Start Conditions. (line 140) +* comments, in actions: Actions. (line 26) +* comments, in rules section: Comments in the Input. + (line 11) +* comments, syntax of: Comments in the Input. + (line 6) +* comments, valid uses of: Comments in the Input. + (line 24) +* compressing whitespace: Actions. (line 22) +* concatenation, in patterns: Patterns. (line 111) +* copyright of flex: Copyright. (line 6) +* counting characters and lines: Simple Examples. (line 23) +* customizing I/O in C++ scanners: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* default rule: Simple Examples. (line 15) +* default rule <1>: Matching. (line 20) +* defining pattern aliases: Definitions Section. (line 21) +* Definitions, in flex input: Definitions Section. (line 6) +* deleting lines from input: Actions. (line 13) +* discarding C comments: Actions. (line 176) +* distributing flex: Copyright. (line 6) +* ECHO: Actions. (line 54) +* ECHO, and yyout: Generated Scanner. (line 101) +* embedding C code in flex input: Definitions Section. (line 40) +* end of file, in patterns: Patterns. (line 150) +* end of line, in negated character classes: Patterns. (line 237) +* end of line, in patterns: Patterns. (line 131) +* end-of-file, and yyrestart(): Generated Scanner. (line 42) +* EOF and yyrestart(): Generated Scanner. (line 42) +* EOF in patterns, syntax of: Patterns. (line 150) +* EOF, example using multiple input buffers: Multiple Input Buffers. + (line 81) +* EOF, explanation: EOF. (line 6) +* EOF, pushing back: Actions. (line 170) +* EOL, in negated character classes: Patterns. (line 237) +* EOL, in patterns: Patterns. (line 131) +* error messages, end of buffer missed: Lex and Posix. (line 50) +* error reporting, diagnostic messages: Diagnostics. (line 6) +* error reporting, in C++: Cxx. (line 112) +* error rules, to eliminate backing up: Performance. (line 102) +* escape sequences in patterns, syntax of: Patterns. (line 57) +* exiting with yyterminate(): Actions. (line 212) +* experimental form of c++ scanner class: Cxx. (line 6) +* extended scope of start conditions: Start Conditions. (line 270) +* file format: Format. (line 6) +* file format, serialized tables: Tables File Format. (line 6) +* flushing an input buffer: Multiple Input Buffers. + (line 66) +* flushing the internal buffer: Actions. (line 206) +* format of flex input: Format. (line 6) +* format of input file: Format. (line 9) +* freeing tables: Loading and Unloading Serialized Tables. + (line 6) +* getting current start state with YY_START: Start Conditions. + (line 189) +* halting with yyterminate(): Actions. (line 212) +* handling include files with multiple input buffers: Multiple Input Buffers. + (line 87) +* handling include files with multiple input buffers <1>: Multiple Input Buffers. + (line 122) +* header files, with C++: Cxx. (line 197) +* include files, with C++: Cxx. (line 197) +* input file, Definitions section: Definitions Section. (line 6) +* input file, Rules Section: Rules Section. (line 6) +* input file, user code Section: User Code Section. (line 6) +* input(): Actions. (line 173) +* input(), and C++: Actions. (line 202) +* input, format of: Format. (line 6) +* input, matching: Matching. (line 6) +* keywords, for performance: Performance. (line 200) +* lex (traditional) and POSIX: Lex and Posix. (line 6) +* LexerInput, overriding: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* LexerOutput, overriding: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* limitations of flex: Limitations. (line 6) +* literal text in patterns, syntax of: Patterns. (line 54) +* loading tables at runtime: Loading and Unloading Serialized Tables. + (line 6) +* m4: M4 Dependency. (line 6) +* Makefile, example of implicit rules: Makefiles and Flex. (line 21) +* Makefile, explicit example: Makefiles and Flex. (line 33) +* Makefile, syntax: Makefiles and Flex. (line 6) +* matching C-style double-quoted strings: Start Conditions. (line 203) +* matching, and trailing context: Matching. (line 6) +* matching, length of: Matching. (line 6) +* matching, multiple matches: Matching. (line 6) +* member functions, C++: Cxx. (line 9) +* memory management: Memory Management. (line 6) +* memory, allocating input buffers: Multiple Input Buffers. + (line 19) +* memory, considerations for reentrant scanners: Init and Destroy Functions. + (line 6) +* memory, deleting input buffers: Multiple Input Buffers. + (line 46) +* memory, for start condition stacks: Start Conditions. (line 301) +* memory, serialized tables: Serialized Tables. (line 6) +* memory, serialized tables <1>: Loading and Unloading Serialized Tables. + (line 6) +* methods, c++: Cxx. (line 9) +* minimal scanner: Matching. (line 24) +* multiple input streams: Multiple Input Buffers. + (line 6) +* name definitions, not POSIX: Lex and Posix. (line 75) +* negating ranges in patterns: Patterns. (line 23) +* newline, matching in patterns: Patterns. (line 135) +* non-POSIX features of flex: Lex and Posix. (line 142) +* noyywrap, %option: Generated Scanner. (line 93) +* NULL character in patterns, syntax of: Patterns. (line 62) +* octal characters in patterns: Patterns. (line 65) +* options, command-line: Scanner Options. (line 6) +* overriding LexerInput: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* overriding LexerOutput: How do I use my own I/O classes in a C++ scanner?. + (line 9) +* overriding the memory routines: Overriding The Default Memory Management. + (line 38) +* Pascal-like language: Simple Examples. (line 49) +* pattern aliases, defining: Definitions Section. (line 21) +* pattern aliases, expansion of: Patterns. (line 51) +* pattern aliases, how to define: Definitions Section. (line 10) +* pattern aliases, use of: Definitions Section. (line 28) +* patterns and actions on different lines: Lex and Posix. (line 101) +* patterns, character class equivalence: Patterns. (line 205) +* patterns, common: Common Patterns. (line 6) +* patterns, end of line: Patterns. (line 300) +* patterns, grouping and precedence: Patterns. (line 167) +* patterns, in rules section: Patterns. (line 6) +* patterns, invalid trailing context: Patterns. (line 285) +* patterns, matching: Matching. (line 6) +* patterns, precedence of operators: Patterns. (line 161) +* patterns, repetitions with grouping: Patterns. (line 184) +* patterns, special characters treated as non-special: Patterns. + (line 293) +* patterns, syntax: Patterns. (line 9) +* patterns, syntax <1>: Patterns. (line 9) +* patterns, tuning for performance: Performance. (line 49) +* patterns, valid character classes: Patterns. (line 192) +* performance optimization, matching longer tokens: Performance. + (line 167) +* performance optimization, recognizing keywords: Performance. + (line 205) +* performance, backing up: Performance. (line 49) +* performance, considerations: Performance. (line 6) +* performance, using keywords: Performance. (line 200) +* popping an input buffer: Multiple Input Buffers. + (line 60) +* POSIX and lex: Lex and Posix. (line 6) +* POSIX comp;compliance: Lex and Posix. (line 142) +* POSIX, character classes in patterns, syntax of: Patterns. (line 15) +* preprocessor macros, for use in actions: Actions. (line 50) +* pushing an input buffer: Multiple Input Buffers. + (line 52) +* pushing back characters with unput: Actions. (line 143) +* pushing back characters with unput(): Actions. (line 147) +* pushing back characters with yyless: Actions. (line 131) +* pushing back EOF: Actions. (line 170) +* ranges in patterns: Patterns. (line 19) +* ranges in patterns, negating: Patterns. (line 23) +* recognizing C comments: Start Conditions. (line 143) +* reentrant scanners, multiple interleaved scanners: Reentrant Uses. + (line 10) +* reentrant scanners, recursive invocation: Reentrant Uses. (line 30) +* reentrant, accessing flex variables: Global Replacement. (line 6) +* reentrant, accessor functions: Accessor Methods. (line 6) +* reentrant, API explanation: Reentrant Overview. (line 6) +* reentrant, calling functions: Extra Reentrant Argument. + (line 6) +* reentrant, example of: Reentrant Example. (line 6) +* reentrant, explanation: Reentrant. (line 6) +* reentrant, extra data: Extra Data. (line 6) +* reentrant, initialization: Init and Destroy Functions. + (line 6) +* regular expressions, in patterns: Patterns. (line 6) +* REJECT: Actions. (line 61) +* REJECT, calling multiple times: Actions. (line 83) +* REJECT, performance costs: Performance. (line 12) +* reporting bugs: Reporting Bugs. (line 6) +* restarting the scanner: Lex and Posix. (line 54) +* RETURN, within actions: Generated Scanner. (line 57) +* rules, default: Simple Examples. (line 15) +* rules, in flex input: Rules Section. (line 6) +* scanner, definition of: Introduction. (line 6) +* sections of flex input: Format. (line 6) +* serialization: Serialized Tables. (line 6) +* serialization of tables: Creating Serialized Tables. + (line 6) +* serialized tables, multiple scanners: Creating Serialized Tables. + (line 26) +* stack, input buffer pop: Multiple Input Buffers. + (line 60) +* stack, input buffer push: Multiple Input Buffers. + (line 52) +* stacks, routines for manipulating: Start Conditions. (line 286) +* start condition, applying to multiple patterns: Start Conditions. + (line 258) +* start conditions: Start Conditions. (line 6) +* start conditions, behavior of default rule: Start Conditions. + (line 82) +* start conditions, exclusive: Start Conditions. (line 53) +* start conditions, for different interpretations of same input: Start Conditions. + (line 112) +* start conditions, in patterns: Patterns. (line 140) +* start conditions, inclusive: Start Conditions. (line 44) +* start conditions, inclusive v.s. exclusive: Start Conditions. + (line 24) +* start conditions, integer values: Start Conditions. (line 163) +* start conditions, multiple: Start Conditions. (line 17) +* start conditions, special wildcard condition: Start Conditions. + (line 68) +* start conditions, use of a stack: Start Conditions. (line 286) +* start conditions, use of wildcard condition (<*>): Start Conditions. + (line 72) +* start conditions, using BEGIN: Start Conditions. (line 95) +* stdin, default for yyin: Generated Scanner. (line 37) +* stdout, as default for yyout: Generated Scanner. (line 101) +* strings, scanning strings instead of files: Multiple Input Buffers. + (line 175) +* tables, creating serialized: Creating Serialized Tables. + (line 6) +* tables, file format: Tables File Format. (line 6) +* tables, freeing: Loading and Unloading Serialized Tables. + (line 6) +* tables, loading and unloading: Loading and Unloading Serialized Tables. + (line 6) +* terminating with yyterminate(): Actions. (line 212) +* token: Matching. (line 14) +* trailing context, in patterns: Patterns. (line 118) +* trailing context, limits of: Patterns. (line 275) +* trailing context, matching: Matching. (line 6) +* trailing context, performance costs: Performance. (line 12) +* trailing context, variable length: Performance. (line 141) +* unput(): Actions. (line 143) +* unput(), and %pointer: Actions. (line 162) +* unput(), pushing back characters: Actions. (line 147) +* user code, in flex input: User Code Section. (line 6) +* username expansion: Simple Examples. (line 8) +* using integer values of start condition names: Start Conditions. + (line 163) +* verbatim text in patterns, syntax of: Patterns. (line 54) +* warning, dangerous trailing context: Limitations. (line 20) +* warning, rule cannot be matched: Diagnostics. (line 14) +* warnings, diagnostic messages: Diagnostics. (line 6) +* whitespace, compressing: Actions. (line 22) +* yacc interface: Yacc. (line 17) +* yacc, interface: Yacc. (line 6) +* yyalloc, overriding: Overriding The Default Memory Management. + (line 6) +* yyfree, overriding: Overriding The Default Memory Management. + (line 6) +* yyin: Generated Scanner. (line 37) +* yyinput(): Actions. (line 202) +* yyleng: Matching. (line 14) +* yyleng, modification of: Actions. (line 47) +* yyless(): Actions. (line 125) +* yyless(), pushing back characters: Actions. (line 131) +* yylex(), in generated scanner: Generated Scanner. (line 6) +* yylex(), overriding: Generated Scanner. (line 16) +* yylex, overriding the prototype of: Generated Scanner. (line 20) +* yylineno, in a reentrant scanner: Reentrant Functions. (line 36) +* yylineno, performance costs: Performance. (line 12) +* yymore(): Actions. (line 104) +* yymore() to append token to previous token: Actions. (line 110) +* yymore(), mega-kludge: Actions. (line 110) +* yymore, and yyleng: Actions. (line 47) +* yymore, performance penalty of: Actions. (line 119) +* yyout: Generated Scanner. (line 101) +* yyrealloc, overriding: Overriding The Default Memory Management. + (line 6) +* yyrestart(): Generated Scanner. (line 42) +* yyterminate(): Actions. (line 212) +* yytext: Matching. (line 14) +* yytext, default array size: User Values. (line 13) +* yytext, memory considerations: A Note About yytext And Memory. + (line 6) +* yytext, modification of: Actions. (line 42) +* yytext, two types of: Matching. (line 29) +* yywrap(): Generated Scanner. (line 85) +* yywrap, default for: Generated Scanner. (line 93) +* YY_CURRENT_BUFFER, and multiple buffers Finally, the macro: Multiple Input Buffers. + (line 78) +* YY_EXTRA_TYPE, defining your own type: Extra Data. (line 33) +* YY_FLUSH_BUFFER: Actions. (line 206) +* YY_INPUT: Generated Scanner. (line 61) +* YY_INPUT, overriding: Generated Scanner. (line 71) +* YY_START, example: Start Conditions. (line 185) +* YY_USER_ACTION to track each time a rule is matched: Misc Macros. + (line 14) + diff --git a/platform/dbops/binaries/build/share/info/flex.info-2 b/platform/dbops/binaries/build/share/info/flex.info-2 new file mode 100644 index 0000000000000000000000000000000000000000..32356d6fc0372ccb14e9b7b3b82578325222f051 Binary files /dev/null and b/platform/dbops/binaries/build/share/info/flex.info-2 differ diff --git a/platform/dbops/binaries/build/share/info/m4.info b/platform/dbops/binaries/build/share/info/m4.info new file mode 100644 index 0000000000000000000000000000000000000000..7e33514223186571712bb3aeef53252ab3466736 --- /dev/null +++ b/platform/dbops/binaries/build/share/info/m4.info @@ -0,0 +1,139 @@ +This is m4.info, produced by makeinfo version 6.7 from m4.texi. + +This manual (28 May 2021) is for GNU M4 (version 1.4.19), a package +containing an implementation of the m4 macro language. + + Copyright © 1989–1994, 2004–2014, 2016–2017, 2020–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled “GNU Free Documentation License.” +INFO-DIR-SECTION Text creation and manipulation +START-INFO-DIR-ENTRY +* M4: (m4). A powerful macro processor. +END-INFO-DIR-ENTRY + + +Indirect: +m4.info-1: 840 +m4.info-2: 310227 + +Tag Table: +(Indirect) +Node: Top840 +Node: Preliminaries9797 +Node: Intro10503 +Node: History12194 +Node: Bugs16281 +Node: Manual17556 +Node: Invoking m421066 +Node: Operation modes23270 +Node: Preprocessor features26369 +Node: Limits control29539 +Node: Frozen state33550 +Node: Debugging options34389 +Node: Command line files36441 +Node: Syntax38092 +Node: Names39247 +Node: Quoted strings39729 +Node: Comments40396 +Node: Other tokens41300 +Node: Input processing41894 +Ref: Input processing-Footnote-150337 +Node: Macros50534 +Node: Invocation51028 +Node: Inhibiting Invocation51829 +Node: Macro Arguments56077 +Node: Quoting Arguments59199 +Node: Macro expansion61339 +Node: Definitions62059 +Node: Define62844 +Node: Arguments65365 +Node: Pseudo Arguments69132 +Node: Undefine72762 +Node: Defn73924 +Node: Pushdef78479 +Node: Indir81221 +Node: Builtin83393 +Node: Conditionals85669 +Node: Ifdef86615 +Node: Ifelse87498 +Node: Shift90887 +Node: Forloop101719 +Node: Foreach104402 +Node: Stacks110026 +Node: Composition113163 +Node: Debugging119258 +Node: Dumpdef119851 +Node: Trace121223 +Node: Debug Levels124877 +Node: Debug Output129752 +Node: Input Control131066 +Node: Dnl131607 +Node: Changequote133553 +Node: Changecom139947 +Node: Changeword143840 +Node: M4wrap149443 +Node: File Inclusion153534 +Node: Include153855 +Node: Search Path156674 +Node: Diversions157623 +Node: Divert159332 +Node: Undivert161905 +Node: Divnum165291 +Node: Cleardivert165764 +Node: Text handling166986 +Node: Len167713 +Node: Index macro168108 +Node: Regexp169002 +Node: Substr171590 +Node: Translit172649 +Node: Patsubst175449 +Node: Format180080 +Node: Arithmetic183491 +Node: Incr183944 +Node: Eval184739 +Node: Shell commands192948 +Node: Platform macros193886 +Node: Syscmd196088 +Node: Esyscmd198464 +Node: Sysval200048 +Node: Mkstemp201993 +Node: Miscellaneous206052 +Node: Errprint206489 +Node: Location207742 +Node: M4exit210623 +Node: Frozen files212757 +Node: Using frozen files213557 +Node: Frozen file format216938 +Node: Compatibility220088 +Node: Extensions221170 +Node: Incompatibilities225224 +Node: Other Incompatibilities234528 +Node: Answers237258 +Node: Improved exch238072 +Node: Improved forloop238625 +Node: Improved foreach244081 +Node: Improved copy257459 +Node: Improved m4wrap261518 +Node: Improved cleardivert264014 +Node: Improved capitalize265012 +Node: Improved fatal_error270048 +Node: Copying This Package271145 +Node: GNU General Public License271624 +Node: Copying This Manual310227 +Node: GNU Free Documentation License310751 +Node: Indices336068 +Node: Macro index336352 +Node: Concept index342743 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/platform/dbops/binaries/build/share/info/m4.info-1 b/platform/dbops/binaries/build/share/info/m4.info-1 new file mode 100644 index 0000000000000000000000000000000000000000..ec6d71f79cbf6eecd8d0b21bca038da8e7d6f13a --- /dev/null +++ b/platform/dbops/binaries/build/share/info/m4.info-1 @@ -0,0 +1,7845 @@ +This is m4.info, produced by makeinfo version 6.7 from m4.texi. + +This manual (28 May 2021) is for GNU M4 (version 1.4.19), a package +containing an implementation of the m4 macro language. + + Copyright © 1989–1994, 2004–2014, 2016–2017, 2020–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled “GNU Free Documentation License.” +INFO-DIR-SECTION Text creation and manipulation +START-INFO-DIR-ENTRY +* M4: (m4). A powerful macro processor. +END-INFO-DIR-ENTRY + + +File: m4.info, Node: Top, Next: Preliminaries, Up: (dir) + +GNU M4 +****** + +This manual (28 May 2021) is for GNU M4 (version 1.4.19), a package +containing an implementation of the m4 macro language. + + Copyright © 1989–1994, 2004–2014, 2016–2017, 2020–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled “GNU Free Documentation License.” + + GNU ‘m4’ is an implementation of the traditional UNIX macro +processor. It is mostly SVR4 compatible, although it has some +extensions (for example, handling more than 9 positional parameters to +macros). ‘m4’ also has builtin functions for including files, running +shell commands, doing arithmetic, etc. Autoconf needs GNU ‘m4’ for +generating ‘configure’ scripts, but not for running them. + + GNU ‘m4’ was originally written by René Seindal, with subsequent +changes by François Pinard and other volunteers on the Internet. All +names and email addresses can be found in the files ‘m4-1.4.19/AUTHORS’ +and ‘m4-1.4.19/THANKS’ from the GNU M4 distribution. + + This is release 1.4.19. It is now considered stable: future releases +in the 1.4.x series are only meant to fix bugs, increase speed, or +improve documentation. However... + + An experimental feature, which would improve ‘m4’ usefulness, allows +for changing the syntax for what is a “word” in ‘m4’. You should use: + ./configure --enable-changeword +if you want this feature compiled in. The current implementation slows +down ‘m4’ considerably and is hardly acceptable. In the future, ‘m4’ +2.0 will come with a different set of new features that provide similar +capabilities, but without the inefficiencies, so changeword will go away +and _you should not count on it_. + +* Menu: + +* Preliminaries:: Introduction and preliminaries +* Invoking m4:: Invoking ‘m4’ +* Syntax:: Lexical and syntactic conventions + +* Macros:: How to invoke macros +* Definitions:: How to define new macros +* Conditionals:: Conditionals, loops, and recursion + +* Debugging:: How to debug macros and input + +* Input Control:: Input control +* File Inclusion:: File inclusion +* Diversions:: Diverting and undiverting output + +* Text handling:: Macros for text handling +* Arithmetic:: Macros for doing arithmetic +* Shell commands:: Macros for running shell commands +* Miscellaneous:: Miscellaneous builtin macros +* Frozen files:: Fast loading of frozen state + +* Compatibility:: Compatibility with other versions of ‘m4’ +* Answers:: Correct version of some examples + +* Copying This Package:: How to make copies of the overall M4 package +* Copying This Manual:: How to make copies of this manual +* Indices:: Indices of concepts and macros + + — The Detailed Node Listing — + +Introduction and preliminaries + +* Intro:: Introduction to ‘m4’ +* History:: Historical references +* Bugs:: Problems and bugs +* Manual:: Using this manual + +Invoking ‘m4’ + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + +Lexical and syntactic conventions + +* Names:: Macro names +* Quoted strings:: Quoting input to ‘m4’ +* Comments:: Comments in ‘m4’ input +* Other tokens:: Other kinds of input tokens +* Input processing:: How ‘m4’ copies input to output + +How to invoke macros + +* Invocation:: Macro invocation +* Inhibiting Invocation:: Preventing macro invocation +* Macro Arguments:: Macro arguments +* Quoting Arguments:: On Quoting Arguments to macros +* Macro expansion:: Expanding macros + +How to define new macros + +* Define:: Defining a new macro +* Arguments:: Arguments to macros +* Pseudo Arguments:: Special arguments to macros +* Undefine:: Deleting a macro +* Defn:: Renaming macros +* Pushdef:: Temporarily redefining macros + +* Indir:: Indirect call of macros +* Builtin:: Indirect call of builtins + +Conditionals, loops, and recursion + +* Ifdef:: Testing if a macro is defined +* Ifelse:: If-else construct, or multibranch +* Shift:: Recursion in ‘m4’ +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents +* Stacks:: Working with definition stacks +* Composition:: Building macros with macros + +How to debug macros and input + +* Dumpdef:: Displaying macro definitions +* Trace:: Tracing macro calls +* Debug Levels:: Controlling debugging output +* Debug Output:: Saving debugging output + +Input control + +* Dnl:: Deleting whitespace in input +* Changequote:: Changing the quote characters +* Changecom:: Changing the comment delimiters +* Changeword:: Changing the lexical structure of words +* M4wrap:: Saving text until end of input + +File inclusion + +* Include:: Including named files +* Search Path:: Searching for include files + +Diverting and undiverting output + +* Divert:: Diverting output +* Undivert:: Undiverting output +* Divnum:: Diversion numbers +* Cleardivert:: Discarding diverted text + +Macros for text handling + +* Len:: Calculating length of strings +* Index macro:: Searching for substrings +* Regexp:: Searching for regular expressions +* Substr:: Extracting substrings +* Translit:: Translating characters +* Patsubst:: Substituting text by regular expression +* Format:: Formatting strings (printf-like) + +Macros for doing arithmetic + +* Incr:: Decrement and increment operators +* Eval:: Evaluating integer expressions + +Macros for running shell commands + +* Platform macros:: Determining the platform +* Syscmd:: Executing simple commands +* Esyscmd:: Reading the output of commands +* Sysval:: Exit status +* Mkstemp:: Making temporary files + +Miscellaneous builtin macros + +* Errprint:: Printing error messages +* Location:: Printing current location +* M4exit:: Exiting from ‘m4’ + +Fast loading of frozen state + +* Using frozen files:: Using frozen files +* Frozen file format:: Frozen file format + +Compatibility with other versions of ‘m4’ + +* Extensions:: Extensions in GNU M4 +* Incompatibilities:: Facilities in System V m4 not in GNU M4 +* Other Incompatibilities:: Other incompatibilities + +Correct version of some examples + +* Improved exch:: Solution for ‘exch’ +* Improved forloop:: Solution for ‘forloop’ +* Improved foreach:: Solution for ‘foreach’ +* Improved copy:: Solution for ‘copy’ +* Improved m4wrap:: Solution for ‘m4wrap’ +* Improved cleardivert:: Solution for ‘cleardivert’ +* Improved capitalize:: Solution for ‘capitalize’ +* Improved fatal_error:: Solution for ‘fatal_error’ + +How to make copies of the overall M4 package + +* GNU General Public License:: License for copying the M4 package + +How to make copies of this manual + +* GNU Free Documentation License:: License for copying this manual + +Indices of concepts and macros + +* Macro index:: Index for all ‘m4’ macros +* Concept index:: Index for many concepts + + + +File: m4.info, Node: Preliminaries, Next: Invoking m4, Prev: Top, Up: Top + +1 Introduction and preliminaries +******************************** + +This first chapter explains what GNU ‘m4’ is, where ‘m4’ comes from, how +to read and use this documentation, how to call the ‘m4’ program, and +how to report bugs about it. It concludes by giving tips for reading +the remainder of the manual. + + The following chapters then detail all the features of the ‘m4’ +language. + +* Menu: + +* Intro:: Introduction to ‘m4’ +* History:: Historical references +* Bugs:: Problems and bugs +* Manual:: Using this manual + + +File: m4.info, Node: Intro, Next: History, Up: Preliminaries + +1.1 Introduction to ‘m4’ +======================== + +‘m4’ is a macro processor, in the sense that it copies its input to the +output, expanding macros as it goes. Macros are either builtin or +user-defined, and can take any number of arguments. Besides just doing +macro expansion, ‘m4’ has builtin functions for including named files, +running shell commands, doing integer arithmetic, manipulating text in +various ways, performing recursion, etc.... ‘m4’ can be used either as a +front-end to a compiler, or as a macro processor in its own right. + + The ‘m4’ macro processor is widely available on all UNIXes, and has +been standardized by POSIX. Usually, only a small percentage of users +are aware of its existence. However, those who find it often become +committed users. The popularity of GNU Autoconf, which requires GNU +‘m4’ for _generating_ ‘configure’ scripts, is an incentive for many to +install it, while these people will not themselves program in ‘m4’. GNU +‘m4’ is mostly compatible with the System V, Release 4 version, except +for some minor differences. *Note Compatibility::, for more details. + + Some people find ‘m4’ to be fairly addictive. They first use ‘m4’ +for simple problems, then take bigger and bigger challenges, learning +how to write complex sets of ‘m4’ macros along the way. Once really +addicted, users pursue writing of sophisticated ‘m4’ applications even +to solve simple problems, devoting more time debugging their ‘m4’ +scripts than doing real work. Beware that ‘m4’ may be dangerous for the +health of compulsive programmers. + + +File: m4.info, Node: History, Next: Bugs, Prev: Intro, Up: Preliminaries + +1.2 Historical references +========================= + +Macro languages were invented early in the history of computing. In the +1950s Alan Perlis suggested that the macro language be independent of +the language being processed. Techniques such as conditional and +recursive macros, and using macros to define other macros, were +described by Doug McIlroy of Bell Labs in “Macro Instruction Extensions +of Compiler Languages”, _Communications of the ACM_ 3, 4 (1960), 214–20, +. + + An important precursor of ‘m4’ was GPM; see C. Strachey, “A general +purpose macrogenerator”, _Computer Journal_ 8, 3 (1965), 225–41, +. GPM is also +succinctly described in David Gries’s book _Compiler Construction for +Digital Computers_, Wiley (1971). Strachey was a brilliant programmer: +GPM fit into 250 machine instructions! + + Inspired by GPM while visiting Strachey’s Lab in 1968, McIlroy wrote +a model preprocessor in that fit into a page of Snobol 3 code, and +McIlroy and Robert Morris developed a series of further models at Bell +Labs. Andrew D. Hall followed up with M6, a general purpose macro +processor used to port the Fortran source code of the Altran computer +algebra system; see Hall’s “The M6 Macro Processor”, Computing Science +Technical Report #2, Bell Labs (1972), +. M6’s source code consisted +of about 600 Fortran statements. Its name was the first of the ‘m4’ +line. + + The Brian Kernighan and P.J. Plauger book _Software Tools_, +Addison-Wesley (1976), describes and implements a Unix macro-processor +language, which inspired Dennis Ritchie to write ‘m3’, a macro processor +for the AP-3 minicomputer. + + Kernighan and Ritchie then joined forces to develop the original +‘m4’, described in “The M4 Macro Processor”, Bell Laboratories (1977), +. It had only +21 builtin macros. + + While ‘GPM’ was more _pure_, ‘m4’ is meant to deal with the true +intricacies of real life: macros can be recognized without being +pre-announced, skipping whitespace or end-of-lines is easier, more +constructs are builtin instead of derived, etc. + + Originally, the Kernighan and Plauger macro-processor, and then ‘m3’, +formed the engine for the Rational FORTRAN preprocessor, that is, the +‘Ratfor’ equivalent of ‘cpp’. Later, ‘m4’ was used as a front-end for +‘Ratfor’, ‘C’ and ‘Cobol’. + + René Seindal released his implementation of ‘m4’, GNU ‘m4’, in 1990, +with the aim of removing the artificial limitations in many of the +traditional ‘m4’ implementations, such as maximum line length, macro +size, or number of macros. + + The late Professor A. Dain Samples described and implemented a +further evolution in the form of ‘M5’: “User’s Guide to the M5 Macro +Language: 2nd edition”, Electronic Announcement on comp.compilers +newsgroup (1992). + + François Pinard took over maintenance of GNU ‘m4’ in 1992, until 1994 +when he released GNU ‘m4’ 1.4, which was the stable release for 10 +years. It was at this time that GNU Autoconf decided to require GNU +‘m4’ as its underlying engine, since all other implementations of ‘m4’ +had too many limitations. + + More recently, in 2004, Paul Eggert released 1.4.1 and 1.4.2 which +addressed some long standing bugs in the venerable 1.4 release. Then in +2005, Gary V. Vaughan collected together the many patches to GNU ‘m4’ +1.4 that were floating around the net and released 1.4.3 and 1.4.4. And +in 2006, Eric Blake joined the team and prepared patches for the release +of 1.4.5, with subsequent releases through intervening years, as recent +as 1.4.18 in 2016. + + Meanwhile, development has continued on new features for ‘m4’, such +as dynamic module loading and additional builtins. When complete, GNU +‘m4’ 2.0 will start a new series of releases. + + +File: m4.info, Node: Bugs, Next: Manual, Prev: History, Up: Preliminaries + +1.3 Problems and bugs +===================== + +If you have problems with GNU M4 or think you’ve found a bug, please +report it. Before reporting a bug, make sure you’ve actually found a +real bug. Carefully reread the documentation and see if it really says +you can do what you’re trying to do. If it’s not clear whether you +should be able to do something or not, report that too; it’s a bug in +the documentation! + + Before reporting a bug or trying to fix it yourself, try to isolate +it to the smallest possible input file that reproduces the problem. +Then send us the input file and the exact results ‘m4’ gave you. Also +say what you expected to occur; this will help us decide whether the +problem was really in the documentation. + + Once you’ve got a precise problem, send e-mail to . +Please include the version number of ‘m4’ you are using. You can get +this information with the command ‘m4 --version’. Also provide details +about the platform you are executing on. + + Non-bug suggestions are always welcome as well. If you have +questions about things that are unclear in the documentation or are just +obscure features, please report them too. + + +File: m4.info, Node: Manual, Prev: Bugs, Up: Preliminaries + +1.4 Using this manual +===================== + +This manual contains a number of examples of ‘m4’ input and output, and +a simple notation is used to distinguish input, output and error +messages from ‘m4’. Examples are set out from the normal text, and +shown in a fixed width font, like this + + This is an example of an example! + + To distinguish input from output, all output from ‘m4’ is prefixed by +the string ‘⇒’, and all error messages by the string ‘error→’. When +showing how command line options affect matters, the command line is +shown with a prompt ‘$ ‘like this’’, otherwise, you can assume that a +simple ‘m4’ invocation will work. Thus: + + $ command line to invoke m4 + Example of input line + ⇒Output line from m4 + error→and an error message + + The sequence ‘^D’ in an example indicates the end of the input file. +The sequence ‘’ refers to the newline character. The majority of +these examples are self-contained, and you can run them with similar +results by invoking ‘m4 -d’. In fact, the testsuite that is bundled in +the GNU M4 package consists of the examples in this document! Some of +the examples assume that your current directory is located where you +unpacked the installation, so if you plan on following along, you may +find it helpful to do this now: + + $ cd m4-1.4.19 + + As each of the predefined macros in ‘m4’ is described, a prototype +call of the macro will be shown, giving descriptive names to the +arguments, e.g., + + -- Composite: example (STRING, [COUNT = ‘1’], [ARGUMENT]...) + This is a sample prototype. There is not really a macro named + ‘example’, but this documents that if there were, it would be a + Composite macro, rather than a Builtin. It requires at least one + argument, STRING. Remember that in ‘m4’, there must not be a space + between the macro name and the opening parenthesis, unless it was + intended to call the macro without any arguments. The brackets + around COUNT and ARGUMENT show that these arguments are optional. + If COUNT is omitted, the macro behaves as if count were ‘1’, + whereas if ARGUMENT is omitted, the macro behaves as if it were the + empty string. A blank argument is not the same as an omitted + argument. For example, ‘example(`a')’, ‘example(`a',`1')’, and + ‘example(`a',`1',)’ would behave identically with COUNT set to ‘1’; + while ‘example(`a',)’ and ‘example(`a',`')’ would explicitly pass + the empty string for COUNT. The ellipses (‘...’) show that the + macro processes additional arguments after ARGUMENT, rather than + ignoring them. + + All macro arguments in ‘m4’ are strings, but some are given special +interpretation, e.g., as numbers, file names, regular expressions, etc. +The documentation for each macro will state how the parameters are +interpreted, and what happens if the argument cannot be parsed according +to the desired interpretation. Unless specified otherwise, a parameter +specified to be a number is parsed as a decimal, even if the argument +has leading zeros; and parsing the empty string as a number results in 0 +rather than an error, although a warning will be issued. + + This document consistently writes and uses “builtin”, without a +hyphen, as if it were an English word. This is how the ‘builtin’ +primitive is spelled within ‘m4’. + + +File: m4.info, Node: Invoking m4, Next: Syntax, Prev: Preliminaries, Up: Top + +2 Invoking ‘m4’ +*************** + +The format of the ‘m4’ command is: + + m4 [OPTION...] [FILE...] + + All options begin with ‘-’, or if long option names are used, with +‘--’. A long option name need not be written completely, any +unambiguous prefix is sufficient. POSIX requires ‘m4’ to recognize +arguments intermixed with files, even when ‘POSIXLY_CORRECT’ is set in +the environment. Most options take effect at startup regardless of +their position, but some are documented below as taking effect after any +files that occurred earlier in the command line. The argument ‘--’ is a +marker to denote the end of options. + + With short options, options that do not take arguments may be +combined into a single command line argument with subsequent options, +options with mandatory arguments may be provided either as a single +command line argument or as two arguments, and options with optional +arguments must be provided as a single argument. In other words, ‘m4 +-QPDfoo -d a -df’ is equivalent to ‘m4 -Q -P -D foo -d -df -- ./a’, +although the latter form is considered canonical. + + With long options, options with mandatory arguments may be provided +with an equal sign (‘=’) in a single argument, or as two arguments, and +options with optional arguments must be provided as a single argument. +In other words, ‘m4 --def foo --debug a’ is equivalent to ‘m4 +--define=foo --debug= -- ./a’, although the latter form is considered +canonical (not to mention more robust, in case a future version of ‘m4’ +introduces an option named ‘--default’). + + ‘m4’ understands the following options, grouped by functionality. + +* Menu: + +* Operation modes:: Command line options for operation modes +* Preprocessor features:: Command line options for preprocessor features +* Limits control:: Command line options for limits control +* Frozen state:: Command line options for frozen state +* Debugging options:: Command line options for debugging +* Command line files:: Specifying input files on the command line + + +File: m4.info, Node: Operation modes, Next: Preprocessor features, Up: Invoking m4 + +2.1 Command line options for operation modes +============================================ + +Several options control the overall operation of ‘m4’: + +‘--help’ + Print a help summary on standard output, then immediately exit ‘m4’ + without reading any input files or performing any other actions. + +‘--version’ + Print the version number of the program on standard output, then + immediately exit ‘m4’ without reading any input files or performing + any other actions. + +‘-E’ +‘--fatal-warnings’ + Controls the effect of warnings. If unspecified, then execution + continues and exit status is unaffected when a warning is printed. + If specified exactly once, warnings become fatal; when one is + issued, execution continues, but the exit status will be non-zero. + If specified multiple times, then execution halts with non-zero + status the first time a warning is issued. The introduction of + behavior levels is new to M4 1.4.9; for behavior consistent with + earlier versions, you should specify ‘-E’ twice. + +‘-i’ +‘--interactive’ +‘-e’ + Makes this invocation of ‘m4’ interactive. This means that all + output will be unbuffered, and interrupts will be ignored. The + spelling ‘-e’ exists for compatibility with other ‘m4’ + implementations, and issues a warning because it may be withdrawn + in a future version of GNU M4. + +‘-P’ +‘--prefix-builtins’ + Internally modify _all_ builtin macro names so they all start with + the prefix ‘m4_’. For example, using this option, one should write + ‘m4_define’ instead of ‘define’, and ‘m4___file__’ instead of + ‘__file__’. This option has no effect if ‘-R’ is also specified. + +‘-Q’ +‘--quiet’ +‘--silent’ + Suppress warnings, such as missing or superfluous arguments in + macro calls, or treating the empty string as zero. + +‘--warn-macro-sequence[=REGEXP]’ + Issue a warning if the regular expression REGEXP has a non-empty + match in any macro definition (either by ‘define’ or ‘pushdef’). + Empty matches are ignored; therefore, supplying the empty string as + REGEXP disables any warning. If the optional REGEXP is not + supplied, then the default regular expression is + ‘\$\({[^}]*}\|[0-9][0-9]+\)’ (a literal ‘$’ followed by multiple + digits or by an open brace), since these sequences will change + semantics in the default operation of GNU M4 2.0 (due to a change + in how more than 9 arguments in a macro definition will be handled, + *note Arguments::). Providing an alternate regular expression can + provide a useful reverse lookup feature of finding where a macro is + defined to have a given definition. + +‘-W REGEXP’ +‘--word-regexp=REGEXP’ + Use REGEXP as an alternative syntax for macro names. This + experimental option will not be present in all GNU ‘m4’ + implementations (*note Changeword::). + + +File: m4.info, Node: Preprocessor features, Next: Limits control, Prev: Operation modes, Up: Invoking m4 + +2.2 Command line options for preprocessor features +================================================== + +Several options allow ‘m4’ to behave more like a preprocessor. Macro +definitions and deletions can be made on the command line, the search +path can be altered, and the output file can track where the input came +from. These features occur with the following options: + +‘-D NAME[=VALUE]’ +‘--define=NAME[=VALUE]’ + This enters NAME into the symbol table. If ‘=VALUE’ is missing, + the value is taken to be the empty string. The VALUE can be any + string, and the macro can be defined to take arguments, just as if + it was defined from within the input. This option may be given + more than once; order with respect to file names is significant, + and redefining the same NAME loses the previous value. + +‘-I DIRECTORY’ +‘--include=DIRECTORY’ + Make ‘m4’ search DIRECTORY for included files that are not found in + the current working directory. *Note Search Path::, for more + details. This option may be given more than once. + +‘-s’ +‘--synclines’ + Generate synchronization lines, for use by the C preprocessor or + other similar tools. Order is significant with respect to file + names. This option is useful, for example, when ‘m4’ is used as a + front end to a compiler. Source file name and line number + information is conveyed by directives of the form ‘#line LINENUM + "FILE"’, which are inserted as needed into the middle of the + output. Such directives mean that the following line originated or + was expanded from the contents of input file FILE at line LINENUM. + The ‘"FILE"’ part is often omitted when the file name did not + change from the previous directive. + + Synchronization directives are always given on complete lines by + themselves. When a synchronization discrepancy occurs in the + middle of an output line, the associated synchronization directive + is delayed until the next newline that does not occur in the middle + of a quoted string or comment. + + define(`twoline', `1 + 2') + ⇒#line 2 "stdin" + ⇒ + changecom(`/*', `*/') + ⇒ + define(`comment', `/*1 + 2*/') + ⇒#line 5 + ⇒ + dnl no line + hello + ⇒#line 7 + ⇒hello + twoline + ⇒1 + ⇒#line 8 + ⇒2 + comment + ⇒/*1 + ⇒2*/ + one comment `two + three' + ⇒#line 10 + ⇒one /*1 + ⇒2*/ two + ⇒three + goodbye + ⇒#line 12 + ⇒goodbye + +‘-U NAME’ +‘--undefine=NAME’ + This deletes any predefined meaning NAME might have. Obviously, + only predefined macros can be deleted in this way. This option may + be given more than once; undefining a NAME that does not have a + definition is silently ignored. Order is significant with respect + to file names. + + +File: m4.info, Node: Limits control, Next: Frozen state, Prev: Preprocessor features, Up: Invoking m4 + +2.3 Command line options for limits control +=========================================== + +There are some limits within ‘m4’ that can be tuned. For compatibility, +‘m4’ also accepts some options that control limits in other +implementations, but which are automatically unbounded (limited only by +your hardware and operating system constraints) in GNU ‘m4’. + +‘-g’ +‘--gnu’ + Enable all the extensions in this implementation. In this release + of M4, this option is always on by default; it is currently only + useful when overriding a prior use of ‘--traditional’. However, + having GNU behavior as default makes it impossible to write a + strictly POSIX-compliant client that avoids all incompatible GNU M4 + extensions, since such a client would have to use the non-POSIX + command-line option to force full POSIX behavior. Thus, a future + version of M4 will be changed to implicitly use the option + ‘--traditional’ if the environment variable ‘POSIXLY_CORRECT’ is + set. Projects that intentionally use GNU extensions should + consider using ‘--gnu’ to state their intentions, so that the + project will not mysteriously break if the user upgrades to a newer + M4 and has ‘POSIXLY_CORRECT’ set in their environment. + +‘-G’ +‘--traditional’ + Suppress all the extensions made in this implementation, compared + to the System V version. *Note Compatibility::, for a list of + these. + +‘-H NUM’ +‘--hashsize=NUM’ + Make the internal hash table for symbol lookup be NUM entries big. + For better performance, the number should be prime, but this is not + checked. The default is 65537 entries. It should not be necessary + to increase this value, unless you define an excessive number of + macros. + +‘-L NUM’ +‘--nesting-limit=NUM’ + Artificially limit the nesting of macro calls to NUM levels, + stopping program execution if this limit is ever exceeded. When + not specified, nesting defaults to unlimited on platforms that can + detect stack overflow, and to 1024 levels otherwise. A value of + zero means unlimited; but then heavily nested code could + potentially cause a stack overflow. + + The precise effect of this option is more correctly associated with + textual nesting than dynamic recursion. It has been useful when + some complex ‘m4’ input was generated by mechanical means, and also + in diagnosing recursive algorithms that do not scale well. Most + users never need to change this option from its default. + + This option does _not_ have the ability to break endless rescanning + loops, since these do not necessarily consume much memory or stack + space. Through clever usage of rescanning loops, one can request + complex, time-consuming computations from ‘m4’ with useful results. + Putting limitations in this area would break ‘m4’ power. There are + many pathological cases: ‘define(`a', `a')a’ is only the simplest + example (but *note Compatibility::). Expecting GNU ‘m4’ to detect + these would be a little like expecting a compiler system to detect + and diagnose endless loops: it is a quite _hard_ problem in + general, if not undecidable! + +‘-B NUM’ +‘-S NUM’ +‘-T NUM’ + These options are present for compatibility with System V ‘m4’, but + do nothing in this implementation. They may disappear in future + releases, and issue a warning to that effect. + +‘-N NUM’ +‘--diversions=NUM’ + These options are present only for compatibility with previous + versions of GNU ‘m4’, and were controlling the number of possible + diversions which could be used at the same time. They do nothing, + because there is no fixed limit anymore. They may disappear in + future releases, and issue a warning to that effect. + + +File: m4.info, Node: Frozen state, Next: Debugging options, Prev: Limits control, Up: Invoking m4 + +2.4 Command line options for frozen state +========================================= + +GNU ‘m4’ comes with a feature of freezing internal state (*note Frozen +files::). This can be used to speed up ‘m4’ execution when reusing a +common initialization script. + +‘-F FILE’ +‘--freeze-state=FILE’ + Once execution is finished, write out the frozen state on the + specified FILE. It is conventional, but not required, for FILE to + end in ‘.m4f’. + +‘-R FILE’ +‘--reload-state=FILE’ + Before execution starts, recover the internal state from the + specified frozen FILE. The options ‘-D’, ‘-U’, and ‘-t’ take + effect after state is reloaded, but before the input files are + read. + + +File: m4.info, Node: Debugging options, Next: Command line files, Prev: Frozen state, Up: Invoking m4 + +2.5 Command line options for debugging +====================================== + +Finally, there are several options for aiding in debugging ‘m4’ scripts. + +‘-d[FLAGS]’ +‘--debug[=FLAGS]’ + Set the debug-level according to the flags FLAGS. The debug-level + controls the format and amount of information presented by the + debugging functions. *Note Debug Levels::, for more details on the + format and meaning of FLAGS. If omitted, FLAGS defaults to ‘aeq’. + +‘--debugfile[=FILE]’ +‘-o FILE’ +‘--error-output=FILE’ + Redirect ‘dumpdef’ output, debug messages, and trace output to the + named FILE. Warnings, error messages, and ‘errprint’ output are + still printed to standard error. If these options are not used, or + if FILE is unspecified (only possible for ‘--debugfile’), debug + output goes to standard error; if FILE is the empty string, debug + output is discarded. *Note Debug Output::, for more details. The + option ‘--debugfile’ may be given more than once, and order is + significant with respect to file names. The spellings ‘-o’ and + ‘--error-output’ are misleading and inconsistent with other GNU + tools; for now they are silently accepted as synonyms of + ‘--debugfile’ and only recognized once, but in a future version of + M4, using them will cause a warning to be issued. + +‘-l NUM’ +‘--arglength=NUM’ + Restrict the size of the output generated by macro tracing to NUM + characters per trace line. If unspecified or zero, output is + unlimited. *Note Debug Levels::, for more details. + +‘-t NAME’ +‘--trace=NAME’ + This enables tracing for the macro NAME, at any point where it is + defined. NAME need not be defined when this option is given. This + option may be given more than once, and order is significant with + respect to file names. *Note Trace::, for more details. + + +File: m4.info, Node: Command line files, Prev: Debugging options, Up: Invoking m4 + +2.6 Specifying input files on the command line +============================================== + +The remaining arguments on the command line are taken to be input file +names. If no names are present, standard input is read. A file name of +‘-’ is taken to mean standard input. It is conventional, but not +required, for input files to end in ‘.m4’. + + The input files are read in the sequence given. Standard input can +be read more than once, so the file name ‘-’ may appear multiple times +on the command line; this makes a difference when input is from a +terminal or other special file type. It is an error if an input file +ends in the middle of argument collection, a comment, or a quoted +string. + + The options ‘--define’ (‘-D’), ‘--undefine’ (‘-U’), ‘--synclines’ +(‘-s’), and ‘--trace’ (‘-t’) only take effect after processing input +from any file names that occur earlier on the command line. For +example, assume the file ‘foo’ contains: + + $ cat foo + bar + + The text ‘bar’ can then be redefined over multiple uses of ‘foo’: + + $ m4 -Dbar=hello foo -Dbar=world foo + ⇒hello + ⇒world + + If none of the input files invoked ‘m4exit’ (*note M4exit::), the +exit status of ‘m4’ will be 0 for success, 1 for general failure (such +as problems with reading an input file), and 63 for version mismatch +(*note Using frozen files::). + + If you need to read a file whose name starts with a ‘-’, you can +specify it as ‘./-file’, or use ‘--’ to mark the end of options. + + +File: m4.info, Node: Syntax, Next: Macros, Prev: Invoking m4, Up: Top + +3 Lexical and syntactic conventions +*********************************** + +As ‘m4’ reads its input, it separates it into “tokens”. A token is +either a name, a quoted string, or any single character, that is not a +part of either a name or a string. Input to ‘m4’ can also contain +comments. GNU ‘m4’ does not yet understand multibyte locales; all +operations are byte-oriented rather than character-oriented (although if +your locale uses a single byte encoding, such as ISO-8859-1, you will +not notice a difference). However, ‘m4’ is eight-bit clean, so you can +use non-ASCII characters in quoted strings (*note Changequote::), +comments (*note Changecom::), and macro names (*note Indir::), with the +exception of the NUL character (the zero byte ‘'\0'’). + +* Menu: + +* Names:: Macro names +* Quoted strings:: Quoting input to ‘m4’ +* Comments:: Comments in ‘m4’ input +* Other tokens:: Other kinds of input tokens +* Input processing:: How ‘m4’ copies input to output + + +File: m4.info, Node: Names, Next: Quoted strings, Up: Syntax + +3.1 Macro names +=============== + +A name is any sequence of letters, digits, and the character ‘_’ +(underscore), where the first character is not a digit. ‘m4’ will use +the longest such sequence found in the input. If a name has a macro +definition, it will be subject to macro expansion (*note Macros::). +Names are case-sensitive. + + Examples of legal names are: ‘foo’, ‘_tmp’, and ‘name01’. + + +File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax + +3.2 Quoting input to ‘m4’ +========================= + +A quoted string is a sequence of characters surrounded by quote strings, +defaulting to ‘`’ and ‘'’, where the nested begin and end quotes within +the string are balanced. The value of a string token is the text, with +one level of quotes stripped off. Thus + + `' + ⇒ + +is the empty string, and double-quoting turns into single-quoting. + + ``quoted'' + ⇒`quoted' + + The quote characters can be changed at any time, using the builtin +macro ‘changequote’. *Note Changequote::, for more information. + + +File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax + +3.3 Comments in ‘m4’ input +========================== + +Comments in ‘m4’ are normally delimited by the characters ‘#’ and +newline. All characters between the comment delimiters are ignored, but +the entire comment (including the delimiters) is passed through to the +output—comments are _not_ discarded by ‘m4’. + + Comments cannot be nested, so the first newline after a ‘#’ ends the +comment. The commenting effect of the begin-comment string can be +inhibited by quoting it. + + $ m4 + `quoted text' # `commented text' + ⇒quoted text # `commented text' + `quoting inhibits' `#' `comments' + ⇒quoting inhibits # comments + + The comment delimiters can be changed to any string at any time, +using the builtin macro ‘changecom’. *Note Changecom::, for more +information. + + +File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax + +3.4 Other kinds of input tokens +=============================== + +Any character, that is neither a part of a name, nor of a quoted string, +nor a comment, is a token by itself. When not in the context of macro +expansion, all of these tokens are just copied to output. However, +during macro expansion, whitespace characters (space, tab, newline, +formfeed, carriage return, vertical tab), parentheses (‘(’ and ‘)’), +comma (‘,’), and dollar (‘$’) have additional roles, explained later. + + +File: m4.info, Node: Input processing, Prev: Other tokens, Up: Syntax + +3.5 How ‘m4’ copies input to output +=================================== + +As ‘m4’ reads the input token by token, it will copy each token directly +to the output immediately. + + The exception is when it finds a word with a macro definition. In +that case ‘m4’ will calculate the macro’s expansion, possibly reading +more input to get the arguments. It then inserts the expansion in front +of the remaining input. In other words, the resulting text from a macro +call will be read and parsed into tokens again. + + ‘m4’ expands a macro as soon as possible. If it finds a macro call +when collecting the arguments to another, it will expand the second call +first. This process continues until there are no more macro calls to +expand and all the input has been consumed. + + For a running example, examine how ‘m4’ handles this input: + + format(`Result is %d', eval(`2**15')) + +First, ‘m4’ sees that the token ‘format’ is a macro name, so it collects +the tokens ‘(’, ‘`Result is %d'’, ‘,’, and ‘ ’, before encountering +another potential macro. Sure enough, ‘eval’ is a macro name, so the +nested argument collection picks up ‘(’, ‘`2**15'’, and ‘)’, invoking +the eval macro with the lone argument of ‘2**15’. The expansion of +‘eval(2**15)’ is ‘32768’, which is then rescanned as the five tokens +‘3’, ‘2’, ‘7’, ‘6’, and ‘8’; and combined with the next ‘)’, the format +macro now has all its arguments, as if the user had typed: + + format(`Result is %d', 32768) + +The format macro expands to ‘Result is 32768’, and we have another round +of scanning for the tokens ‘Result’, ‘ ’, ‘is’, ‘ ’, ‘3’, ‘2’, ‘7’, ‘6’, +and ‘8’. None of these are macros, so the final output is + + ⇒Result is 32768 + + As a more complicated example, we will contrast an actual code +example from the Gnulib project(1), showing both a buggy approach and +the desired results. The user desires to output a shell assignment +statement that takes its argument and turns it into a shell variable by +converting it to uppercase and prepending a prefix. The original +attempt looks like this: + + changequote([,])dnl + define([gl_STRING_MODULE_INDICATOR], + [ + dnl comment + GNULIB_]translit([$1],[a-z],[A-Z])[=1 + ])dnl + gl_STRING_MODULE_INDICATOR([strcase]) + ⇒ + ⇒ GNULIB_strcase=1 + ⇒ + + Oops – the argument did not get capitalized. And although the manual +is not able to easily show it, both lines that appear empty actually +contain two trailing spaces. By stepping through the parse, it is easy +to see what happened. First, ‘m4’ sees the token ‘changequote’, which +it recognizes as a macro, followed by ‘(’, ‘[’, ‘,’, ‘]’, and ‘)’ to +form the argument list. The macro expands to the empty string, but +changes the quoting characters to something more useful for generating +shell code (unbalanced ‘`’ and ‘'’ appear all the time in shell scripts, +but unbalanced ‘[]’ tend to be rare). Also in the first line, ‘m4’ sees +the token ‘dnl’, which it recognizes as a builtin macro that consumes +the rest of the line, resulting in no output for that line. + + The second line starts a macro definition. ‘m4’ sees the token +‘define’, which it recognizes as a macro, followed by a ‘(’, +‘[gl_STRING_MODULE_INDICATOR]’, and ‘,’. Because an unquoted comma was +encountered, the first argument is known to be the expansion of the +single-quoted string token, or ‘gl_STRING_MODULE_INDICATOR’. Next, ‘m4’ +sees ‘’, ‘ ’, and ‘ ’, but this whitespace is discarded as part of +argument collection. Then comes a rather lengthy single-quoted string +token, ‘[ dnl comment GNULIB_]’. This is followed by the +token ‘translit’, which ‘m4’ recognizes as a macro name, so a nested +macro expansion has started. + + The arguments to the ‘translit’ are found by the tokens ‘(’, ‘[$1]’, +‘,’, ‘[a-z]’, ‘,’, ‘[A-Z]’, and finally ‘)’. All three string arguments +are expanded (or in other words, the quotes are stripped), and since +neither ‘$’ nor ‘1’ need capitalization, the result of the macro is +‘$1’. This expansion is rescanned, resulting in the two literal +characters ‘$’ and ‘1’. + + Scanning of the outer macro resumes, and picks up with ‘[=1 ]’, +and finally ‘)’. The collected pieces of expanded text are +concatenated, with the end result that the macro +‘gl_STRING_MODULE_INDICATOR’ is now defined to be the sequence +‘ dnl comment GNULIB_$1=1 ’. Once again, ‘dnl’ is +recognized and avoids a newline in the output. + + The final line is then parsed, beginning with ‘ ’ and ‘ ’ that are +output literally. Then ‘gl_STRING_MODULE_INDICATOR’ is recognized as a +macro name, with an argument list of ‘(’, ‘[strcase]’, and ‘)’. Since +the definition of the macro contains the sequence ‘$1’, that sequence is +replaced with the argument ‘strcase’ prior to starting the rescan. The +rescan sees ‘’ and four spaces, which are output literally, then +‘dnl’, which discards the text ‘ comment’. Next comes four more +spaces, also output literally, and the token ‘GNULIB_strcase’, which +resulted from the earlier parameter substitution. Since that is not a +macro name, it is output literally, followed by the literal tokens ‘=’, +‘1’, ‘’, and two more spaces. Finally, the original ‘’ seen +after the macro invocation is scanned and output literally. + + Now for a corrected approach. This rearranges the use of newlines +and whitespace so that less whitespace is output (which, although +harmless to shell scripts, can be visually unappealing), and fixes the +quoting issues so that the capitalization occurs when the macro +‘gl_STRING_MODULE_INDICATOR’ is invoked, rather then when it is defined. +It also adds another layer of quoting to the first argument of +‘translit’, to ensure that the output will be rescanned as a string +rather than a potential uppercase macro name needing further expansion. + + changequote([,])dnl + define([gl_STRING_MODULE_INDICATOR], + [dnl comment + GNULIB_[]translit([[$1]], [a-z], [A-Z])=1dnl + ])dnl + gl_STRING_MODULE_INDICATOR([strcase]) + ⇒ GNULIB_STRCASE=1 + + The parsing of the first line is unchanged. The second line sees the +name of the macro to define, then sees the discarded ‘’ and two +spaces, as before. But this time, the next token is ‘[dnl +comment GNULIB_[]translit([[$1]], [a-z], [A-Z])=1dnl]’, which +includes nested quotes, followed by ‘)’ to end the macro definition and +‘dnl’ to skip the newline. No early expansion of ‘translit’ occurs, so +the entire string becomes the definition of the macro. + + The final line is then parsed, beginning with two spaces that are +output literally, and an invocation of ‘gl_STRING_MODULE_INDICATOR’ with +the argument ‘strcase’. Again, the ‘$1’ in the macro definition is +substituted prior to rescanning. Rescanning first encounters ‘dnl’, and +discards ‘ comment’. Then two spaces are output literally. Next +comes the token ‘GNULIB_’, but that is not a macro, so it is output +literally. The token ‘[]’ is an empty string, so it does not affect +output. Then the token ‘translit’ is encountered. + + This time, the arguments to ‘translit’ are parsed as ‘(’, +‘[[strcase]]’, ‘,’, ‘ ’, ‘[a-z]’, ‘,’, ‘ ’, ‘[A-Z]’, and ‘)’. The two +spaces are discarded, and the translit results in the desired result +‘[STRCASE]’. This is rescanned, but since it is a string, the quotes +are stripped and the only output is a literal ‘STRCASE’. Then the +scanner sees ‘=’ and ‘1’, which are output literally, followed by ‘dnl’ +which discards the rest of the definition of +‘gl_STRING_MODULE_INDICATOR’. The newline at the end of output is the +literal ‘’ that appeared after the invocation of the macro. + + The order in which ‘m4’ expands the macros can be further explored +using the trace facilities of GNU ‘m4’ (*note Trace::). + + ---------- Footnotes ---------- + + (1) Derived from a patch in +, +and a followup patch in + + + +File: m4.info, Node: Macros, Next: Definitions, Prev: Syntax, Up: Top + +4 How to invoke macros +********************** + +This chapter covers macro invocation, macro arguments and how macro +expansion is treated. + +* Menu: + +* Invocation:: Macro invocation +* Inhibiting Invocation:: Preventing macro invocation +* Macro Arguments:: Macro arguments +* Quoting Arguments:: On Quoting Arguments to macros +* Macro expansion:: Expanding macros + + +File: m4.info, Node: Invocation, Next: Inhibiting Invocation, Up: Macros + +4.1 Macro invocation +==================== + +Macro invocations has one of the forms + + name + +which is a macro invocation without any arguments, or + + name(arg1, arg2, ..., argN) + +which is a macro invocation with N arguments. Macros can have any +number of arguments. All arguments are strings, but different macros +might interpret the arguments in different ways. + + The opening parenthesis _must_ follow the NAME directly, with no +spaces in between. If it does not, the macro is called with no +arguments at all. + + For a macro call to have no arguments, the parentheses _must_ be left +out. The macro call + + name() + +is a macro call with one argument, which is the empty string, not a call +with no arguments. + + +File: m4.info, Node: Inhibiting Invocation, Next: Macro Arguments, Prev: Invocation, Up: Macros + +4.2 Preventing macro invocation +=============================== + +An innovation of the ‘m4’ language, compared to some of its predecessors +(like Strachey’s ‘GPM’, for example), is the ability to recognize macro +calls without resorting to any special, prefixed invocation character. +While generally useful, this feature might sometimes be the source of +spurious, unwanted macro calls. So, GNU ‘m4’ offers several mechanisms +or techniques for inhibiting the recognition of names as macro calls. + + First of all, many builtin macros cannot meaningfully be called +without arguments. As a GNU extension, for any of these macros, +whenever an opening parenthesis does not immediately follow their name, +the builtin macro call is not triggered. This solves the most usual +cases, like for ‘include’ or ‘eval’. Later in this document, the +sentence “This macro is recognized only with parameters” refers to this +specific provision of GNU M4, also known as a blind builtin macro. For +the builtins defined by POSIX that bear this disclaimer, POSIX +specifically states that invoking those builtins without arguments is +unspecified, because many other implementations simply invoke the +builtin as though it were given one empty argument instead. + + $ m4 + eval + ⇒eval + eval(`1') + ⇒1 + + There is also a command line option (‘--prefix-builtins’, or ‘-P’, +*note Invoking m4: Operation modes.) that renames all builtin macros +with a prefix of ‘m4_’ at startup. The option has no effect whatsoever +on user defined macros. For example, with this option, one has to write +‘m4_dnl’ and even ‘m4_m4exit’. It also has no effect on whether a macro +requires parameters. + + $ m4 -P + eval + ⇒eval + eval(`1') + ⇒eval(1) + m4_eval + ⇒m4_eval + m4_eval(`1') + ⇒1 + + Another alternative is to redefine problematic macros to a name less +likely to cause conflicts, using *note Definitions::. + + If your version of GNU ‘m4’ has the ‘changeword’ feature compiled in, +it offers far more flexibility in specifying the syntax of macro names, +both builtin or user-defined. *Note Changeword::, for more information +on this experimental feature. + + Of course, the simplest way to prevent a name from being interpreted +as a call to an existing macro is to quote it. The remainder of this +section studies a little more deeply how quoting affects macro +invocation, and how quoting can be used to inhibit macro invocation. + + Even if quoting is usually done over the whole macro name, it can +also be done over only a few characters of this name (provided, of +course, that the unquoted portions are not also a macro). It is also +possible to quote the empty string, but this works only _inside_ the +name. For example: + + `divert' + ⇒divert + `d'ivert + ⇒divert + di`ver't + ⇒divert + div`'ert + ⇒divert + +all yield the string ‘divert’. While in both: + + `'divert + ⇒ + divert`' + ⇒ + +the ‘divert’ builtin macro will be called, which expands to the empty +string. + + The output of macro evaluations is always rescanned. In the +following example, the input ‘x`'y’ yields the string ‘bCD’, exactly as +if ‘m4’ has been given ‘substr(ab`'cde, `1', `3')’ as input: + + define(`cde', `CDE') + ⇒ + define(`x', `substr(ab') + ⇒ + define(`y', `cde, `1', `3')') + ⇒ + x`'y + ⇒bCD + + Unquoted strings on either side of a quoted string are subject to +being recognized as macro names. In the following example, quoting the +empty string allows for the second ‘macro’ to be recognized as such: + + define(`macro', `m') + ⇒ + macro(`m')macro + ⇒mmacro + macro(`m')`'macro + ⇒mm + + Quoting may prevent recognizing as a macro name the concatenation of +a macro expansion with the surrounding characters. In this example: + + define(`macro', `di$1') + ⇒ + macro(`v')`ert' + ⇒divert + macro(`v')ert + ⇒ + +the input will produce the string ‘divert’. When the quotes were +removed, the ‘divert’ builtin was called instead. + + +File: m4.info, Node: Macro Arguments, Next: Quoting Arguments, Prev: Inhibiting Invocation, Up: Macros + +4.3 Macro arguments +=================== + +When a name is seen, and it has a macro definition, it will be expanded +as a macro. + + If the name is followed by an opening parenthesis, the arguments will +be collected before the macro is called. If too few arguments are +supplied, the missing arguments are taken to be the empty string. +However, some builtins are documented to behave differently for a +missing optional argument than for an explicit empty string. If there +are too many arguments, the excess arguments are ignored. Unquoted +leading whitespace is stripped off all arguments, but whitespace +generated by a macro expansion or occurring after a macro that expanded +to an empty string remains intact. Whitespace includes space, tab, +newline, carriage return, vertical tab, and formfeed. + + define(`macro', `$1') + ⇒ + macro( unquoted leading space lost) + ⇒unquoted leading space lost + macro(` quoted leading space kept') + ⇒ quoted leading space kept + macro( + divert `unquoted space kept after expansion') + ⇒ unquoted space kept after expansion + macro(macro(` + ')`whitespace from expansion kept') + ⇒ + ⇒whitespace from expansion kept + macro(`unquoted trailing whitespace kept' + ) + ⇒unquoted trailing whitespace kept + ⇒ + + Normally ‘m4’ will issue warnings if a builtin macro is called with +an inappropriate number of arguments, but it can be suppressed with the +‘--quiet’ command line option (or ‘--silent’, or ‘-Q’, *note Invoking +m4: Operation modes.). For user defined macros, there is no check of +the number of arguments given. + + $ m4 + index(`abc') + error→m4:stdin:1: Warning: too few arguments to builtin `index' + ⇒0 + index(`abc',) + ⇒0 + index(`abc', `b', `ignored') + error→m4:stdin:3: Warning: excess arguments to builtin `index' ignored + ⇒1 + + $ m4 -Q + index(`abc') + ⇒0 + index(`abc',) + ⇒0 + index(`abc', `b', `ignored') + ⇒1 + + Macros are expanded normally during argument collection, and whatever +commas, quotes and parentheses that might show up in the resulting +expanded text will serve to define the arguments as well. Thus, if FOO +expands to ‘, b, c’, the macro call + + bar(a foo, d) + +is a macro call with four arguments, which are ‘a ’, ‘b’, ‘c’ and ‘d’. +To understand why the first argument contains whitespace, remember that +unquoted leading whitespace is never part of an argument, but trailing +whitespace always is. + + It is possible for a macro’s definition to change during argument +collection, in which case the expansion uses the definition that was in +effect at the time the opening ‘(’ was seen. + + define(`f', `1') + ⇒ + f(define(`f', `2')) + ⇒1 + f + ⇒2 + + It is an error if the end of file occurs while collecting arguments. + + hello world + ⇒hello world + define( + ^D + error→m4:stdin:2: ERROR: end of file in argument list + + +File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros + +4.4 On Quoting Arguments to macros +================================== + +Each argument has unquoted leading whitespace removed. Within each +argument, all unquoted parentheses must match. For example, if FOO is a +macro, + + foo(() (`(') `(') + +is a macro call, with one argument, whose value is ‘() (() (’. Commas +separate arguments, except when they occur inside quotes, comments, or +unquoted parentheses. *Note Pseudo Arguments::, for examples. + + It is common practice to quote all arguments to macros, unless you +are sure you want the arguments expanded. Thus, in the above example +with the parentheses, the ‘right’ way to do it is like this: + + foo(`() (() (') + + It is, however, in certain cases necessary (because nested expansion +must occur to create the arguments for the outer macro) or convenient +(because it uses fewer characters) to leave out quotes for some +arguments, and there is nothing wrong in doing it. It just makes life a +bit harder, if you are not careful to follow a consistent quoting style. +For consistency, this manual follows the rule of thumb that each layer +of parentheses introduces another layer of single quoting, except when +showing the consequences of quoting rules. This is done even when the +quoted string cannot be a macro, such as with integers when you have not +changed the syntax via ‘changeword’ (*note Changeword::). + + The quoting rule of thumb of one level of quoting per parentheses has +a nice property: when a macro name appears inside parentheses, you can +determine when it will be expanded. If it is not quoted, it will be +expanded prior to the outer macro, so that its expansion becomes the +argument. If it is single-quoted, it will be expanded after the outer +macro. And if it is double-quoted, it will be used as literal text +instead of a macro name. + + define(`active', `ACT, IVE') + ⇒ + define(`show', `$1 $1') + ⇒ + show(active) + ⇒ACT ACT + show(`active') + ⇒ACT, IVE ACT, IVE + show(``active'') + ⇒active active + + +File: m4.info, Node: Macro expansion, Prev: Quoting Arguments, Up: Macros + +4.5 Macro expansion +=================== + +When the arguments, if any, to a macro call have been collected, the +macro is expanded, and the expansion text is pushed back onto the input +(unquoted), and reread. The expansion text from one macro call might +therefore result in more macros being called, if the calls are included, +completely or partially, in the first macro calls’ expansion. + + Taking a very simple example, if FOO expands to ‘bar’, and BAR +expands to ‘Hello’, the input + + $ m4 -Dbar=Hello -Dfoo=bar + foo + ⇒Hello + +will expand first to ‘bar’, and when this is reread and expanded, into +‘Hello’. + + +File: m4.info, Node: Definitions, Next: Conditionals, Prev: Macros, Up: Top + +5 How to define new macros +************************** + +Macros can be defined, redefined and deleted in several different ways. +Also, it is possible to redefine a macro without losing a previous +value, and bring back the original value at a later time. + +* Menu: + +* Define:: Defining a new macro +* Arguments:: Arguments to macros +* Pseudo Arguments:: Special arguments to macros +* Undefine:: Deleting a macro +* Defn:: Renaming macros +* Pushdef:: Temporarily redefining macros + +* Indir:: Indirect call of macros +* Builtin:: Indirect call of builtins + + +File: m4.info, Node: Define, Next: Arguments, Up: Definitions + +5.1 Defining a macro +==================== + +The normal way to define or redefine macros is to use the builtin +‘define’: + + -- Builtin: define (NAME, [EXPANSION]) + Defines NAME to expand to EXPANSION. If EXPANSION is not given, it + is taken to be empty. + + The expansion of ‘define’ is void. The macro ‘define’ is + recognized only with parameters. + + The following example defines the macro FOO to expand to the text +‘Hello World.’. + + define(`foo', `Hello world.') + ⇒ + foo + ⇒Hello world. + + The empty line in the output is there because the newline is not a +part of the macro definition, and it is consequently copied to the +output. This can be avoided by use of the macro ‘dnl’. *Note Dnl::, +for details. + + The first argument to ‘define’ should be quoted; otherwise, if the +macro is already defined, you will be defining a different macro. This +example shows the problems with underquoting, since we did not want to +redefine ‘one’: + + define(foo, one) + ⇒ + define(foo, two) + ⇒ + one + ⇒two + + GNU ‘m4’ normally replaces only the _topmost_ definition of a macro +if it has several definitions from ‘pushdef’ (*note Pushdef::). Some +other implementations of ‘m4’ replace all definitions of a macro with +‘define’. *Note Incompatibilities::, for more details. + + As a GNU extension, the first argument to ‘define’ does not have to +be a simple word. It can be any text string, even the empty string. A +macro with a non-standard name cannot be invoked in the normal way, as +the name is not recognized. It can only be referenced by the builtins +‘indir’ (*note Indir::) and ‘defn’ (*note Defn::). + + Arrays and associative arrays can be simulated by using non-standard +macro names. + + -- Composite: array (INDEX) + -- Composite: array_set (INDEX, [VALUE]) + Provide access to entries within an array. ‘array’ reads the entry + at location INDEX, and ‘array_set’ assigns VALUE to location INDEX. + + define(`array', `defn(format(``array[%d]'', `$1'))') + ⇒ + define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') + ⇒ + array_set(`4', `array element no. 4') + ⇒ + array_set(`17', `array element no. 17') + ⇒ + array(`4') + ⇒array element no. 4 + array(eval(`10 + 7')) + ⇒array element no. 17 + + Change the ‘%d’ to ‘%s’ and it is an associative array. + + +File: m4.info, Node: Arguments, Next: Pseudo Arguments, Prev: Define, Up: Definitions + +5.2 Arguments to macros +======================= + +Macros can have arguments. The Nth argument is denoted by ‘$n’ in the +expansion text, and is replaced by the Nth actual argument, when the +macro is expanded. Replacement of arguments happens before rescanning, +regardless of how many nesting levels of quoting appear in the +expansion. Here is an example of a macro with two arguments. + + -- Composite: exch (ARG1, ARG2) + Expands to ARG2 followed by ARG1, effectively exchanging their + order. + + define(`exch', `$2, $1') + ⇒ + exch(`arg1', `arg2') + ⇒arg2, arg1 + + This can be used, for example, if you like the arguments to ‘define’ +to be reversed. + + define(`exch', `$2, $1') + ⇒ + define(exch(``expansion text'', ``macro'')) + ⇒ + macro + ⇒expansion text + + *Note Quoting Arguments::, for an explanation of the double quotes. +(You should try and improve this example so that clients of ‘exch’ do +not have to double quote; or *note Answers: Improved exch.). + + As a special case, the zeroth argument, ‘$0’, is always the name of +the macro being expanded. + + define(`test', ``Macro name: $0'') + ⇒ + test + ⇒Macro name: test + + If you want quoted text to appear as part of the expansion text, +remember that quotes can be nested in quoted strings. Thus, in + + define(`foo', `This is macro `foo'.') + ⇒ + foo + ⇒This is macro foo. + +The ‘foo’ in the expansion text is _not_ expanded, since it is a quoted +string, and not a name. + + GNU ‘m4’ allows the number following the ‘$’ to consist of one or +more digits, allowing macros to have any number of arguments. The +extension of accepting multiple digits is incompatible with POSIX, and +is different than traditional implementations of ‘m4’, which only +recognize one digit. Therefore, future versions of GNU M4 will phase +out this feature. To portably access beyond the ninth argument, you can +use the ‘argn’ macro documented later (*note Shift::). + + POSIX also states that ‘$’ followed immediately by ‘{’ in a macro +definition is implementation-defined. This version of M4 passes the +literal characters ‘${’ through unchanged, but M4 2.0 will implement an +optional feature similar to ‘sh’, where ‘${11}’ expands to the eleventh +argument, to replace the current recognition of ‘$11’. Meanwhile, if +you want to guarantee that you will get a literal ‘${’ in output when +expanding a macro, even when you upgrade to M4 2.0, you can use nested +quoting to your advantage: + + define(`foo', `single quoted $`'{1} output') + ⇒ + define(`bar', ``double quoted $'`{2} output'') + ⇒ + foo(`a', `b') + ⇒single quoted ${1} output + bar(`a', `b') + ⇒double quoted ${2} output + + To help you detect places in your M4 input files that might change in +behavior due to the changed behavior of M4 2.0, you can use the +‘--warn-macro-sequence’ command-line option (*note Invoking m4: +Operation modes.) with the default regular expression. This will add a +warning any time a macro definition includes ‘$’ followed by multiple +digits, or by ‘{’. The warning is not enabled by default, because it +triggers a number of warnings in Autoconf 2.61 (and Autoconf uses ‘-E’ +to treat warnings as errors), and because it will still be possible to +restore older behavior in M4 2.0. + + $ m4 --warn-macro-sequence + define(`foo', `$001 ${1} $1') + error→m4:stdin:1: Warning: definition of `foo' contains sequence `$001' + error→m4:stdin:1: Warning: definition of `foo' contains sequence `${1}' + ⇒ + foo(`bar') + ⇒bar ${1} bar + + +File: m4.info, Node: Pseudo Arguments, Next: Undefine, Prev: Arguments, Up: Definitions + +5.3 Special arguments to macros +=============================== + +There is a special notation for the number of actual arguments supplied, +and for all the actual arguments. + + The number of actual arguments in a macro call is denoted by ‘$#’ in +the expansion text. + + -- Composite: nargs (...) + Expands to a count of the number of arguments supplied. + + define(`nargs', `$#') + ⇒ + nargs + ⇒0 + nargs() + ⇒1 + nargs(`arg1', `arg2', `arg3') + ⇒3 + nargs(`commas can be quoted, like this') + ⇒1 + nargs(arg1#inside comments, commas do not separate arguments + still arg1) + ⇒1 + nargs((unquoted parentheses, like this, group arguments)) + ⇒1 + + Remember that ‘#’ defaults to the comment character; if you forget +quotes to inhibit the comment behavior, your macro definition may not +end where you expected. + + dnl Attempt to define a macro to just `$#' + define(underquoted, $#) + oops) + ⇒ + underquoted + ⇒0) + ⇒oops + + The notation ‘$*’ can be used in the expansion text to denote all the +actual arguments, unquoted, with commas in between. For example + + define(`echo', `$*') + ⇒ + echo(arg1, arg2, arg3 , arg4) + ⇒arg1,arg2,arg3 ,arg4 + + Often each argument should be quoted, and the notation ‘$@’ handles +that. It is just like ‘$*’, except that it quotes each argument. A +simple example of that is: + + define(`echo', `$@') + ⇒ + echo(arg1, arg2, arg3 , arg4) + ⇒arg1,arg2,arg3 ,arg4 + + Where did the quotes go? Of course, they were eaten, when the +expanded text were reread by ‘m4’. To show the difference, try + + define(`echo1', `$*') + ⇒ + define(`echo2', `$@') + ⇒ + define(`foo', `This is macro `foo'.') + ⇒ + echo1(foo) + ⇒This is macro This is macro foo.. + echo1(`foo') + ⇒This is macro foo. + echo2(foo) + ⇒This is macro foo. + echo2(`foo') + ⇒foo + +*Note Trace::, if you do not understand this. As another example of the +difference, remember that comments encountered in arguments are passed +untouched to the macro, and that quoting disables comments. + + define(`echo1', `$*') + ⇒ + define(`echo2', `$@') + ⇒ + define(`foo', `bar') + ⇒ + echo1(#foo'foo + foo) + ⇒#foo'foo + ⇒bar + echo2(#foo'foo + foo) + ⇒#foobar + ⇒bar' + + A ‘$’ sign in the expansion text, that is not followed by anything +‘m4’ understands, is simply copied to the macro expansion, as any other +text is. + + define(`foo', `$$$ hello $$$') + ⇒ + foo + ⇒$$$ hello $$$ + + If you want a macro to expand to something like ‘$12’, the judicious +use of nested quoting can put a safe character between the ‘$’ and the +next character, relying on the rescanning to remove the nested quote. +This will prevent ‘m4’ from interpreting the ‘$’ sign as a reference to +an argument. + + define(`foo', `no nested quote: $1') + ⇒ + foo(`arg') + ⇒no nested quote: arg + define(`foo', `nested quote around $: `$'1') + ⇒ + foo(`arg') + ⇒nested quote around $: $1 + define(`foo', `nested empty quote after $: $`'1') + ⇒ + foo(`arg') + ⇒nested empty quote after $: $1 + define(`foo', `nested quote around next character: $`1'') + ⇒ + foo(`arg') + ⇒nested quote around next character: $1 + define(`foo', `nested quote around both: `$1'') + ⇒ + foo(`arg') + ⇒nested quote around both: arg + + +File: m4.info, Node: Undefine, Next: Defn, Prev: Pseudo Arguments, Up: Definitions + +5.4 Deleting a macro +==================== + +A macro definition can be removed with ‘undefine’: + + -- Builtin: undefine (NAME...) + For each argument, remove the macro NAME. The macro names must + necessarily be quoted, since they will be expanded otherwise. + + The expansion of ‘undefine’ is void. The macro ‘undefine’ is + recognized only with parameters. + + foo bar blah + ⇒foo bar blah + define(`foo', `some')define(`bar', `other')define(`blah', `text') + ⇒ + foo bar blah + ⇒some other text + undefine(`foo') + ⇒ + foo bar blah + ⇒foo other text + undefine(`bar', `blah') + ⇒ + foo bar blah + ⇒foo bar blah + + Undefining a macro inside that macro’s expansion is safe; the macro +still expands to the definition that was in effect at the ‘(’. + + define(`f', ``$0':$1') + ⇒ + f(f(f(undefine(`f')`hello world'))) + ⇒f:f:f:hello world + f(`bye') + ⇒f(bye) + + It is not an error for NAME to have no macro definition. In that +case, ‘undefine’ does nothing. + + +File: m4.info, Node: Defn, Next: Pushdef, Prev: Undefine, Up: Definitions + +5.5 Renaming macros +=================== + +It is possible to rename an already defined macro. To do this, you need +the builtin ‘defn’: + + -- Builtin: defn (NAME...) + Expands to the _quoted definition_ of each NAME. If an argument is + not a defined macro, the expansion for that argument is empty. + + If NAME is a user-defined macro, the quoted definition is simply + the quoted expansion text. If, instead, there is only one NAME and + it is a builtin, the expansion is a special token, which points to + the builtin’s internal definition. This token is only meaningful + as the second argument to ‘define’ (and ‘pushdef’), and is silently + converted to an empty string in most other contexts. Combining a + builtin with anything else is not supported; a warning is issued + and the builtin is omitted from the final expansion. + + The macro ‘defn’ is recognized only with parameters. + + Its normal use is best understood through an example, which shows how +to rename ‘undefine’ to ‘zap’: + + define(`zap', defn(`undefine')) + ⇒ + zap(`undefine') + ⇒ + undefine(`zap') + ⇒undefine(zap) + + In this way, ‘defn’ can be used to copy macro definitions, and also +definitions of builtin macros. Even if the original macro is removed, +the other name can still be used to access the definition. + + The fact that macro definitions can be transferred also explains why +you should use ‘$0’, rather than retyping a macro’s name in its +definition: + + define(`foo', `This is `$0'') + ⇒ + define(`bar', defn(`foo')) + ⇒ + bar + ⇒This is bar + + Macros used as string variables should be referred through ‘defn’, to +avoid unwanted expansion of the text: + + define(`string', `The macro dnl is very useful + ') + ⇒ + string + ⇒The macro + defn(`string') + ⇒The macro dnl is very useful + ⇒ + + However, it is important to remember that ‘m4’ rescanning is purely +textual. If an unbalanced end-quote string occurs in a macro +definition, the rescan will see that embedded quote as the termination +of the quoted string, and the remainder of the macro’s definition will +be rescanned unquoted. Thus it is a good idea to avoid unbalanced +end-quotes in macro definitions or arguments to macros. + + define(`foo', a'a) + ⇒ + define(`a', `A') + ⇒ + define(`echo', `$@') + ⇒ + foo + ⇒A'A + defn(`foo') + ⇒aA' + echo(foo) + ⇒AA' + + On the other hand, it is possible to exploit the fact that ‘defn’ can +concatenate multiple macros prior to the rescanning phase, in order to +join the definitions of macros that, in isolation, have unbalanced +quotes. This is particularly useful when one has used several macros to +accumulate text that M4 should rescan as a whole. In the example below, +note how the use of ‘defn’ on ‘l’ in isolation opens a string, which is +not closed until the next line; but used on ‘l’ and ‘r’ together results +in nested quoting. + + define(`l', `<[>')define(`r', `<]>') + ⇒ + changequote(`[', `]') + ⇒ + defn([l])defn([r]) + ]) + ⇒<[>]defn([r]) + ⇒) + defn([l], [r]) + ⇒<[>][<]> + + Using ‘defn’ to generate special tokens for builtin macros outside of +expected contexts can sometimes trigger warnings. But most of the time, +such tokens are silently converted to the empty string. + + $ m4 -d + defn(`defn') + ⇒ + define(defn(`divnum'), `cannot redefine a builtin token') + error→m4:stdin:2: Warning: define: invalid macro name ignored + ⇒ + divnum + ⇒0 + len(defn(`divnum')) + ⇒0 + + Also note that ‘defn’ with multiple arguments can only join text +macros, not builtins, although a future version of GNU M4 may lift this +restriction. + + $ m4 -d + define(`a', `A')define(`AA', `b') + ⇒ + traceon(`defn', `define') + ⇒ + defn(`a', `divnum', `a') + error→m4:stdin:3: Warning: cannot concatenate builtin `divnum' + error→m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A'' + ⇒AA + define(`mydivnum', defn(`divnum', `divnum'))mydivnum + error→m4:stdin:4: Warning: cannot concatenate builtin `divnum' + error→m4:stdin:4: Warning: cannot concatenate builtin `divnum' + error→m4trace: -2- defn(`divnum', `divnum') + error→m4trace: -1- define(`mydivnum', `') + ⇒ + traceoff(`defn', `define') + ⇒ + + +File: m4.info, Node: Pushdef, Next: Indir, Prev: Defn, Up: Definitions + +5.6 Temporarily redefining macros +================================= + +It is possible to redefine a macro temporarily, reverting to the +previous definition at a later time. This is done with the builtins +‘pushdef’ and ‘popdef’: + + -- Builtin: pushdef (NAME, [EXPANSION]) + -- Builtin: popdef (NAME...) + Analogous to ‘define’ and ‘undefine’. + + These macros work in a stack-like fashion. A macro is temporarily + redefined with ‘pushdef’, which replaces an existing definition of + NAME, while saving the previous definition, before the new one is + installed. If there is no previous definition, ‘pushdef’ behaves + exactly like ‘define’. + + If a macro has several definitions (of which only one is + accessible), the topmost definition can be removed with ‘popdef’. + If there is no previous definition, ‘popdef’ behaves like + ‘undefine’. + + The expansion of both ‘pushdef’ and ‘popdef’ is void. The macros + ‘pushdef’ and ‘popdef’ are recognized only with parameters. + + define(`foo', `Expansion one.') + ⇒ + foo + ⇒Expansion one. + pushdef(`foo', `Expansion two.') + ⇒ + foo + ⇒Expansion two. + pushdef(`foo', `Expansion three.') + ⇒ + pushdef(`foo', `Expansion four.') + ⇒ + popdef(`foo') + ⇒ + foo + ⇒Expansion three. + popdef(`foo', `foo') + ⇒ + foo + ⇒Expansion one. + popdef(`foo') + ⇒ + foo + ⇒foo + + If a macro with several definitions is redefined with ‘define’, the +topmost definition is _replaced_ with the new definition. If it is +removed with ‘undefine’, _all_ the definitions are removed, and not only +the topmost one. However, POSIX allows other implementations that treat +‘define’ as replacing an entire stack of definitions with a single new +definition, so to be portable to other implementations, it may be worth +explicitly using ‘popdef’ and ‘pushdef’ rather than relying on the GNU +behavior of ‘define’. + + define(`foo', `Expansion one.') + ⇒ + foo + ⇒Expansion one. + pushdef(`foo', `Expansion two.') + ⇒ + foo + ⇒Expansion two. + define(`foo', `Second expansion two.') + ⇒ + foo + ⇒Second expansion two. + undefine(`foo') + ⇒ + foo + ⇒foo + + Local variables within macros are made with ‘pushdef’ and ‘popdef’. +At the start of the macro a new definition is pushed, within the macro +it is manipulated and at the end it is popped, revealing the former +definition. + + It is possible to temporarily redefine a builtin with ‘pushdef’ and +‘defn’. + + +File: m4.info, Node: Indir, Next: Builtin, Prev: Pushdef, Up: Definitions + +5.7 Indirect call of macros +=========================== + +Any macro can be called indirectly with ‘indir’: + + -- Builtin: indir (NAME, [ARGS...]) + Results in a call to the macro NAME, which is passed the rest of + the arguments ARGS. If NAME is not defined, an error message is + printed, and the expansion is void. + + The macro ‘indir’ is recognized only with parameters. + + This can be used to call macros with computed or “invalid” names +(‘define’ allows such names to be defined): + + define(`$$internal$macro', `Internal macro (name `$0')') + ⇒ + $$internal$macro + ⇒$$internal$macro + indir(`$$internal$macro') + ⇒Internal macro (name $$internal$macro) + + The point is, here, that larger macro packages can have private +macros defined, that will not be called by accident. They can _only_ be +called through the builtin ‘indir’. + + One other point to observe is that argument collection occurs before +‘indir’ invokes NAME, so if argument collection changes the value of +NAME, that will be reflected in the final expansion. This is different +than the behavior when invoking macros directly, where the definition +that was in effect before argument collection is used. + + $ m4 -d + define(`f', `1') + ⇒ + f(define(`f', `2')) + ⇒1 + indir(`f', define(`f', `3')) + ⇒3 + indir(`f', undefine(`f')) + error→m4:stdin:4: undefined macro `f' + ⇒ + + When handed the result of ‘defn’ (*note Defn::) as one of its +arguments, ‘indir’ defers to the invoked NAME for whether a token +representing a builtin is recognized or flattened to the empty string. + + $ m4 -d + indir(defn(`defn'), `divnum') + error→m4:stdin:1: Warning: indir: invalid macro name ignored + ⇒ + indir(`define', defn(`defn'), `divnum') + error→m4:stdin:2: Warning: define: invalid macro name ignored + ⇒ + indir(`define', `foo', defn(`divnum')) + ⇒ + foo + ⇒0 + indir(`divert', defn(`foo')) + error→m4:stdin:5: empty string treated as 0 in builtin `divert' + ⇒ + + +File: m4.info, Node: Builtin, Prev: Indir, Up: Definitions + +5.8 Indirect call of builtins +============================= + +Builtin macros can be called indirectly with ‘builtin’: + + -- Builtin: builtin (NAME, [ARGS...]) + Results in a call to the builtin NAME, which is passed the rest of + the arguments ARGS. If NAME does not name a builtin, an error + message is printed, and the expansion is void. + + The macro ‘builtin’ is recognized only with parameters. + + This can be used even if NAME has been given another definition that +has covered the original, or been undefined so that no macro maps to the +builtin. + + pushdef(`define', `hidden') + ⇒ + undefine(`undefine') + ⇒ + define(`foo', `bar') + ⇒hidden + foo + ⇒foo + builtin(`define', `foo', defn(`divnum')) + ⇒ + foo + ⇒0 + builtin(`define', `foo', `BAR') + ⇒ + foo + ⇒BAR + undefine(`foo') + ⇒undefine(foo) + foo + ⇒BAR + builtin(`undefine', `foo') + ⇒ + foo + ⇒foo + + The NAME argument only matches the original name of the builtin, even +when the ‘--prefix-builtins’ option (or ‘-P’, *note Invoking m4: +Operation modes.) is in effect. This is different from ‘indir’, which +only tracks current macro names. + + $ m4 -P + m4_builtin(`divnum') + ⇒0 + m4_builtin(`m4_divnum') + error→m4:stdin:2: undefined builtin `m4_divnum' + ⇒ + m4_indir(`divnum') + error→m4:stdin:3: undefined macro `divnum' + ⇒ + m4_indir(`m4_divnum') + ⇒0 + + Note that ‘indir’ and ‘builtin’ can be used to invoke builtins +without arguments, even when they normally require parameters to be +recognized; but it will provoke a warning, and result in a void +expansion. + + builtin + ⇒builtin + builtin() + error→m4:stdin:2: undefined builtin `' + ⇒ + builtin(`builtin') + error→m4:stdin:3: Warning: too few arguments to builtin `builtin' + ⇒ + builtin(`builtin',) + error→m4:stdin:4: undefined builtin `' + ⇒ + builtin(`builtin', ``' + ') + error→m4:stdin:5: undefined builtin ``' + error→' + ⇒ + indir(`index') + error→m4:stdin:7: Warning: too few arguments to builtin `index' + ⇒ + + +File: m4.info, Node: Conditionals, Next: Debugging, Prev: Definitions, Up: Top + +6 Conditionals, loops, and recursion +************************************ + +Macros, expanding to plain text, perhaps with arguments, are not quite +enough. We would like to have macros expand to different things, based +on decisions taken at run-time. For that, we need some kind of +conditionals. Also, we would like to have some kind of loop construct, +so we could do something a number of times, or while some condition is +true. + +* Menu: + +* Ifdef:: Testing if a macro is defined +* Ifelse:: If-else construct, or multibranch +* Shift:: Recursion in ‘m4’ +* Forloop:: Iteration by counting +* Foreach:: Iteration by list contents +* Stacks:: Working with definition stacks +* Composition:: Building macros with macros + + +File: m4.info, Node: Ifdef, Next: Ifelse, Up: Conditionals + +6.1 Testing if a macro is defined +================================= + +There are two different builtin conditionals in ‘m4’. The first is +‘ifdef’: + + -- Builtin: ifdef (NAME, STRING-1, [STRING-2]) + If NAME is defined as a macro, ‘ifdef’ expands to STRING-1, + otherwise to STRING-2. If STRING-2 is omitted, it is taken to be + the empty string (according to the normal rules). + + The macro ‘ifdef’ is recognized only with parameters. + + ifdef(`foo', ``foo' is defined', ``foo' is not defined') + ⇒foo is not defined + define(`foo', `') + ⇒ + ifdef(`foo', ``foo' is defined', ``foo' is not defined') + ⇒foo is defined + ifdef(`no_such_macro', `yes', `no', `extra argument') + error→m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored + ⇒no + + +File: m4.info, Node: Ifelse, Next: Shift, Prev: Ifdef, Up: Conditionals + +6.2 If-else construct, or multibranch +===================================== + +The other conditional, ‘ifelse’, is much more powerful. It can be used +as a way to introduce a long comment, as an if-else construct, or as a +multibranch, depending on the number of arguments supplied: + + -- Builtin: ifelse (COMMENT) + -- Builtin: ifelse (STRING-1, STRING-2, EQUAL, [NOT-EQUAL]) + -- Builtin: ifelse (STRING-1, STRING-2, EQUAL-1, STRING-3, STRING-4, + EQUAL-2, ..., [NOT-EQUAL]) + Used with only one argument, the ‘ifelse’ simply discards it and + produces no output. + + If called with three or four arguments, ‘ifelse’ expands into + EQUAL, if STRING-1 and STRING-2 are equal (character for + character), otherwise it expands to NOT-EQUAL. A final fifth + argument is ignored, after triggering a warning. + + If called with six or more arguments, and STRING-1 and STRING-2 are + equal, ‘ifelse’ expands into EQUAL-1, otherwise the first three + arguments are discarded and the processing starts again. + + The macro ‘ifelse’ is recognized only with parameters. + + Using only one argument is a common ‘m4’ idiom for introducing a +block comment, as an alternative to repeatedly using ‘dnl’. This +special usage is recognized by GNU ‘m4’, so that in this case, the +warning about missing arguments is never triggered. + + ifelse(`some comments') + ⇒ + ifelse(`foo', `bar') + error→m4:stdin:2: Warning: too few arguments to builtin `ifelse' + ⇒ + + Using three or four arguments provides decision points. + + ifelse(`foo', `bar', `true') + ⇒ + ifelse(`foo', `foo', `true') + ⇒true + define(`foo', `bar') + ⇒ + ifelse(foo, `bar', `true', `false') + ⇒true + ifelse(foo, `foo', `true', `false') + ⇒false + + Notice how the first argument was used unquoted; it is common to +compare the expansion of a macro with a string. With this macro, you +can now reproduce the behavior of blind builtins, where the macro is +recognized only with arguments. + + define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') + ⇒ + foo + ⇒foo + foo() + ⇒arguments:1 + foo(`a', `b', `c') + ⇒arguments:3 + + For an example of a way to make defining blind macros easier, see +*note Composition::. + + The macro ‘ifelse’ can take more than four arguments. If given more +than four arguments, ‘ifelse’ works like a ‘case’ or ‘switch’ statement +in traditional programming languages. If STRING-1 and STRING-2 are +equal, ‘ifelse’ expands into EQUAL-1, otherwise the procedure is +repeated with the first three arguments discarded. This calls for an +example: + + ifelse(`foo', `bar', `third', `gnu', `gnats') + error→m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored + ⇒gnu + ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') + ⇒ + ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') + ⇒seventh + ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') + error→m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored + ⇒7 + + Naturally, the normal case will be slightly more advanced than these +examples. A common use of ‘ifelse’ is in macros implementing loops of +various kinds. + + +File: m4.info, Node: Shift, Next: Forloop, Prev: Ifelse, Up: Conditionals + +6.3 Recursion in ‘m4’ +===================== + +There is no direct support for loops in ‘m4’, but macros can be +recursive. There is no limit on the number of recursion levels, other +than those enforced by your hardware and operating system. + + Loops can be programmed using recursion and the conditionals +described previously. + + There is a builtin macro, ‘shift’, which can, among other things, be +used for iterating through the actual arguments to a macro: + + -- Builtin: shift (ARG1, ...) + Takes any number of arguments, and expands to all its arguments + except ARG1, separated by commas, with each argument quoted. + + The macro ‘shift’ is recognized only with parameters. + + shift + ⇒shift + shift(`bar') + ⇒ + shift(`foo', `bar', `baz') + ⇒bar,baz + + An example of the use of ‘shift’ is this macro: + + -- Composite: reverse (...) + Takes any number of arguments, and reverses their order. + + It is implemented as: + + define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') + ⇒ + reverse + ⇒ + reverse(`foo') + ⇒foo + reverse(`foo', `bar', `gnats', `and gnus') + ⇒and gnus, gnats, bar, foo + + While not a very interesting macro, it does show how simple loops can +be made with ‘shift’, ‘ifelse’ and recursion. It also shows that +‘shift’ is usually used with ‘$@’. Another example of this is an +implementation of a short-circuiting conditional operator. + + -- Composite: cond (TEST-1, STRING-1, EQUAL-1, [TEST-2], [STRING-2], + [EQUAL-2], ..., [NOT-EQUAL]) + Similar to ‘ifelse’, where an equal comparison between the first + two strings results in the third, otherwise the first three + arguments are discarded and the process repeats. The difference is + that each TEST- is expanded only when it is encountered. This + means that every third argument to ‘cond’ is normally given one + more level of quoting than the corresponding argument to ‘ifelse’. + + Here is the implementation of ‘cond’, along with a demonstration of +how it can short-circuit the side effects in ‘side’. Notice how all the +unquoted side effects happen regardless of how many comparisons are made +with ‘ifelse’, compared with only the relevant effects with ‘cond’. + + define(`cond', + `ifelse(`$#', `1', `$1', + `ifelse($1, `$2', `$3', + `$0(shift(shift(shift($@))))')')')dnl + define(`side', `define(`counter', incr(counter))$1')dnl + define(`example1', + `define(`counter', `0')dnl + ifelse(side(`$1'), `yes', `one comparison: ', + side(`$1'), `no', `two comparisons: ', + side(`$1'), `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl + define(`example2', + `define(`counter', `0')dnl + cond(`side(`$1')', `yes', `one comparison: ', + `side(`$1')', `no', `two comparisons: ', + `side(`$1')', `maybe', `three comparisons: ', + `side(`default answer: ')')counter')dnl + example1(`yes') + ⇒one comparison: 3 + example1(`no') + ⇒two comparisons: 3 + example1(`maybe') + ⇒three comparisons: 3 + example1(`feeling rather indecisive today') + ⇒default answer: 4 + example2(`yes') + ⇒one comparison: 1 + example2(`no') + ⇒two comparisons: 2 + example2(`maybe') + ⇒three comparisons: 3 + example2(`feeling rather indecisive today') + ⇒default answer: 4 + + Another common task that requires iteration is joining a list of +arguments into a single string. + + -- Composite: join ([SEPARATOR], [ARGS...]) + -- Composite: joinall ([SEPARATOR], [ARGS...]) + Generate a single-quoted string, consisting of each ARG separated + by SEPARATOR. While ‘joinall’ always outputs a SEPARATOR between + arguments, ‘join’ avoids the SEPARATOR for an empty ARG. + + Here are some examples of its usage, based on the implementation +‘m4-1.4.19/examples/join.m4’ distributed in this package: + + $ m4 -I examples + include(`join.m4') + ⇒ + join,join(`-'),join(`-', `'),join(`-', `', `') + ⇒,,, + joinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `') + ⇒,,,- + join(`-', `1') + ⇒1 + join(`-', `1', `2', `3') + ⇒1-2-3 + join(`', `1', `2', `3') + ⇒123 + join(`-', `', `1', `', `', `2', `') + ⇒1-2 + joinall(`-', `', `1', `', `', `2', `') + ⇒-1---2- + join(`,', `1', `2', `3') + ⇒1,2,3 + define(`nargs', `$#')dnl + nargs(join(`,', `1', `2', `3')) + ⇒1 + + Examining the implementation shows some interesting points about +several m4 programming idioms. + + $ m4 -I examples + undivert(`join.m4')dnl + ⇒divert(`-1') + ⇒# join(sep, args) - join each non-empty ARG into a single + ⇒# string, with each element separated by SEP + ⇒define(`join', + ⇒`ifelse(`$#', `2', ``$2'', + ⇒ `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@)))')') + ⇒define(`_join', + ⇒`ifelse(`$#$2', `2', `', + ⇒ `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')') + ⇒# joinall(sep, args) - join each ARG, including empty ones, + ⇒# into a single string, with each element separated by SEP + ⇒define(`joinall', ``$2'_$0(`$1', shift($@))') + ⇒define(`_joinall', + ⇒`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')') + ⇒divert`'dnl + + First, notice that this implementation creates helper macros ‘_join’ +and ‘_joinall’. This division of labor makes it easier to output the +correct number of SEPARATOR instances: ‘join’ and ‘joinall’ are +responsible for the first argument, without a separator, while ‘_join’ +and ‘_joinall’ are responsible for all remaining arguments, always +outputting a separator when outputting an argument. + + Next, observe how ‘join’ decides to iterate to itself, because the +first ARG was empty, or to output the argument and swap over to ‘_join’. +If the argument is non-empty, then the nested ‘ifelse’ results in an +unquoted ‘_’, which is concatenated with the ‘$0’ to form the next macro +name to invoke. The ‘joinall’ implementation is simpler since it does +not have to suppress empty ARG; it always executes once then defers to +‘_joinall’. + + Another important idiom is the idea that SEPARATOR is reused for each +iteration. Each iteration has one less argument, but rather than +discarding ‘$1’ by iterating with ‘$0(shift($@))’, the macro discards +‘$2’ by using ‘$0(`$1', shift(shift($@)))’. + + Next, notice that it is possible to compare more than one condition +in a single ‘ifelse’ test. The test of ‘$#$2’ against ‘2’ allows +‘_join’ to iterate for two separate reasons—either there are still more +than two arguments, or there are exactly two arguments but the last +argument is not empty. + + Finally, notice that these macros require exactly two arguments to +terminate recursion, but that they still correctly result in empty +output when given no ARGS (i.e., zero or one macro argument). On the +first pass when there are too few arguments, the ‘shift’ results in no +output, but leaves an empty string to serve as the required second +argument for the second pass. Put another way, ‘`$1', shift($@)’ is not +the same as ‘$@’, since only the former guarantees at least two +arguments. + + Sometimes, a recursive algorithm requires adding quotes to each +element, or treating multiple arguments as a single element: + + -- Composite: quote (...) + -- Composite: dquote (...) + -- Composite: dquote_elt (...) + Takes any number of arguments, and adds quoting. With ‘quote’, + only one level of quoting is added, effectively removing whitespace + after commas and turning multiple arguments into a single string. + With ‘dquote’, two levels of quoting are added, one around each + element, and one around the list. And with ‘dquote_elt’, two + levels of quoting are added around each element. + + An actual implementation of these three macros is distributed as +‘m4-1.4.19/examples/quote.m4’ in this package. First, let’s examine +their usage: + + $ m4 -I examples + include(`quote.m4') + ⇒ + -quote-dquote-dquote_elt- + ⇒---- + -quote()-dquote()-dquote_elt()- + ⇒--`'-`'- + -quote(`1')-dquote(`1')-dquote_elt(`1')- + ⇒-1-`1'-`1'- + -quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- + ⇒-1,2-`1',`2'-`1',`2'- + define(`n', `$#')dnl + -n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- + ⇒-1-1-2- + dquote(dquote_elt(`1', `2')) + ⇒``1'',``2'' + dquote_elt(dquote(`1', `2')) + ⇒``1',`2'' + + The last two lines show that when given two arguments, ‘dquote’ +results in one string, while ‘dquote_elt’ results in two. Now, examine +the implementation. Note that ‘quote’ and ‘dquote_elt’ make decisions +based on their number of arguments, so that when called without +arguments, they result in nothing instead of a quoted empty string; this +is so that it is possible to distinguish between no arguments and an +empty first argument. ‘dquote’, on the other hand, results in a string +no matter what, since it is still possible to tell whether it was +invoked without arguments based on the resulting string. + + $ m4 -I examples + undivert(`quote.m4')dnl + ⇒divert(`-1') + ⇒# quote(args) - convert args to single-quoted string + ⇒define(`quote', `ifelse(`$#', `0', `', ``$*'')') + ⇒# dquote(args) - convert args to quoted list of quoted strings + ⇒define(`dquote', ``$@'') + ⇒# dquote_elt(args) - convert args to list of double-quoted strings + ⇒define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', + ⇒ ```$1'',$0(shift($@))')') + ⇒divert`'dnl + + It is worth pointing out that ‘quote(ARGS)’ is more efficient than +‘joinall(`,', ARGS)’ for producing the same output. + + One more useful macro based on ‘shift’ allows portably selecting an +arbitrary argument (usually greater than the ninth argument), without +relying on the GNU extension of multi-digit arguments (*note +Arguments::). + + -- Composite: argn (N, ...) + Expands to argument N out of the remaining arguments. N must be a + positive number. Usually invoked as ‘argn(`N',$@)’. + + It is implemented as: + + define(`argn', `ifelse(`$1', 1, ``$2'', + `argn(decr(`$1'), shift(shift($@)))')') + ⇒ + argn(`1', `a') + ⇒a + define(`foo', `argn(`11', $@)') + ⇒ + foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') + ⇒k + + +File: m4.info, Node: Forloop, Next: Foreach, Prev: Shift, Up: Conditionals + +6.4 Iteration by counting +========================= + +Here is an example of a loop macro that implements a simple for loop. + + -- Composite: forloop (ITERATOR, START, END, TEXT) + Takes the name in ITERATOR, which must be a valid macro name, and + successively assign it each integer value from START to END, + inclusive. For each assignment to ITERATOR, append TEXT to the + expansion of the ‘forloop’. TEXT may refer to ITERATOR. Any + definition of ITERATOR prior to this invocation is restored. + + It can, for example, be used for simple counting: + + $ m4 -I examples + include(`forloop.m4') + ⇒ + forloop(`i', `1', `8', `i ') + ⇒1 2 3 4 5 6 7 8 + + For-loops can be nested, like: + + $ m4 -I examples + include(`forloop.m4') + ⇒ + forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') + ') + ⇒ (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) + ⇒ (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) + ⇒ (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) + ⇒ (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) + ⇒ + + The implementation of the ‘forloop’ macro is fairly straightforward. +The ‘forloop’ macro itself is simply a wrapper, which saves the previous +definition of the first argument, calls the internal macro ‘_forloop’, +and re-establishes the saved definition of the first argument. + + The macro ‘_forloop’ expands the fourth argument once, and tests to +see if the iterator has reached the final value. If it has not +finished, it increments the iterator (using the predefined macro ‘incr’, +*note Incr::), and recurses. + + Here is an actual implementation of ‘forloop’, distributed as +‘m4-1.4.19/examples/forloop.m4’ in this package: + + $ m4 -I examples + undivert(`forloop.m4')dnl + ⇒divert(`-1') + ⇒# forloop(var, from, to, stmt) - simple version + ⇒define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') + ⇒define(`_forloop', + ⇒ `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') + ⇒divert`'dnl + + Notice the careful use of quotes. Certain macro arguments are left +unquoted, each for its own reason. Try to find out _why_ these +arguments are left unquoted, and see what happens if they are quoted. +(As presented, these two macros are useful but not very robust for +general use. They lack even basic error handling for cases like START +less than END, END not numeric, or ITERATOR not being a macro name. See +if you can improve these macros; or *note Answers: Improved forloop.). + + +File: m4.info, Node: Foreach, Next: Stacks, Prev: Forloop, Up: Conditionals + +6.5 Iteration by list contents +============================== + +Here is an example of a loop macro that implements list iteration. + + -- Composite: foreach (ITERATOR, PAREN-LIST, TEXT) + -- Composite: foreachq (ITERATOR, QUOTE-LIST, TEXT) + Takes the name in ITERATOR, which must be a valid macro name, and + successively assign it each value from PAREN-LIST or QUOTE-LIST. + In ‘foreach’, PAREN-LIST is a comma-separated list of elements + contained in parentheses. In ‘foreachq’, QUOTE-LIST is a + comma-separated list of elements contained in a quoted string. For + each assignment to ITERATOR, append TEXT to the overall expansion. + TEXT may refer to ITERATOR. Any definition of ITERATOR prior to + this invocation is restored. + + As an example, this displays each word in a list inside of a +sentence, using an implementation of ‘foreach’ distributed as +‘m4-1.4.19/examples/foreach.m4’, and ‘foreachq’ in +‘m4-1.4.19/examples/foreachq.m4’. + + $ m4 -I examples + include(`foreach.m4') + ⇒ + foreach(`x', (foo, bar, foobar), `Word was: x + ')dnl + ⇒Word was: foo + ⇒Word was: bar + ⇒Word was: foobar + include(`foreachq.m4') + ⇒ + foreachq(`x', `foo, bar, foobar', `Word was: x + ')dnl + ⇒Word was: foo + ⇒Word was: bar + ⇒Word was: foobar + + It is possible to be more complex; each element of the PAREN-LIST or +QUOTE-LIST can itself be a list, to pass as further arguments to a +helper macro. This example generates a shell case statement: + + $ m4 -I examples + include(`foreach.m4') + ⇒ + define(`_case', ` $1) + $2=" $1";; + ')dnl + define(`_cat', `$1$2')dnl + case $`'1 in + ⇒case $1 in + foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl + ⇒ a) + ⇒ vara=" a";; + ⇒ b) + ⇒ varb=" b";; + ⇒ c) + ⇒ varc=" c";; + esac + ⇒esac + + The implementation of the ‘foreach’ macro is a bit more involved; it +is a wrapper around two helper macros. First, ‘_arg1’ is needed to grab +the first element of a list. Second, ‘_foreach’ implements the +recursion, successively walking through the original list. Here is a +simple implementation of ‘foreach’: + + $ m4 -I examples + undivert(`foreach.m4')dnl + ⇒divert(`-1') + ⇒# foreach(x, (item_1, item_2, ..., item_n), stmt) + ⇒# parenthesized list, simple version + ⇒define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') + ⇒define(`_arg1', `$1') + ⇒define(`_foreach', `ifelse(`$2', `()', `', + ⇒ `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') + ⇒divert`'dnl + + Unfortunately, that implementation is not robust to macro names as +list elements. Each iteration of ‘_foreach’ is stripping another layer +of quotes, leading to erratic results if list elements are not already +fully expanded. The first cut at implementing ‘foreachq’ takes this +into account. Also, when using quoted elements in a PAREN-LIST, the +overall list must be quoted. A QUOTE-LIST has the nice property of +requiring fewer characters to create a list containing the same quoted +elements. To see the difference between the two macros, we attempt to +pass double-quoted macro names in a list, expecting the macro name on +output after one layer of quotes is removed during list iteration and +the final layer removed during the final rescan: + + $ m4 -I examples + define(`a', `1')define(`b', `2')define(`c', `3') + ⇒ + include(`foreach.m4') + ⇒ + include(`foreachq.m4') + ⇒ + foreach(`x', `(``a'', ``(b'', ``c)'')', `x + ') + ⇒1 + ⇒(2)1 + ⇒ + ⇒, x + ⇒) + foreachq(`x', ```a'', ``(b'', ``c)''', `x + ')dnl + ⇒a + ⇒(b + ⇒c) + + Obviously, ‘foreachq’ did a better job; here is its implementation: + + $ m4 -I examples + undivert(`foreachq.m4')dnl + ⇒include(`quote.m4')dnl + ⇒divert(`-1') + ⇒# foreachq(x, `item_1, item_2, ..., item_n', stmt) + ⇒# quoted list, simple version + ⇒define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') + ⇒define(`_arg1', `$1') + ⇒define(`_foreachq', `ifelse(quote($2), `', `', + ⇒ `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') + ⇒divert`'dnl + + Notice that ‘_foreachq’ had to use the helper macro ‘quote’ defined +earlier (*note Shift::), to ensure that the embedded ‘ifelse’ call does +not go haywire if a list element contains a comma. Unfortunately, this +implementation of ‘foreachq’ has its own severe flaw. Whereas the +‘foreach’ implementation was linear, this macro is quadratic in the +number of list elements, and is much more likely to trip up the limit +set by the command line option ‘--nesting-limit’ (or ‘-L’, *note +Invoking m4: Limits control.). Additionally, this implementation does +not expand ‘defn(`ITERATOR')’ very well, when compared with ‘foreach’. + + $ m4 -I examples + include(`foreach.m4')include(`foreachq.m4') + ⇒ + foreach(`name', `(`a', `b')', ` defn(`name')') + ⇒ a b + foreachq(`name', ``a', `b'', ` defn(`name')') + ⇒ _arg1(`a', `b') _arg1(shift(`a', `b')) + + It is possible to have robust iteration with linear behavior and sane +ITERATOR contents for either list style. See if you can learn from the +best elements of both of these implementations to create robust macros +(or *note Answers: Improved foreach.). + + +File: m4.info, Node: Stacks, Next: Composition, Prev: Foreach, Up: Conditionals + +6.6 Working with definition stacks +================================== + +Thanks to ‘pushdef’, manipulation of a stack is an intrinsic operation +in ‘m4’. Normally, only the topmost definition in a stack is important, +but sometimes, it is desirable to manipulate the entire definition +stack. + + -- Composite: stack_foreach (MACRO, ACTION) + -- Composite: stack_foreach_lifo (MACRO, ACTION) + For each of the ‘pushdef’ definitions associated with MACRO, invoke + the macro ACTION with a single argument of that definition. + ‘stack_foreach’ visits the oldest definition first, while + ‘stack_foreach_lifo’ visits the current definition first. ACTION + should not modify or dereference MACRO. There are a few special + macros, such as ‘defn’, which cannot be used as the MACRO + parameter. + + A sample implementation of these macros is distributed in the file +‘m4-1.4.19/examples/stack.m4’. + + $ m4 -I examples + include(`stack.m4') + ⇒ + pushdef(`a', `1')pushdef(`a', `2')pushdef(`a', `3') + ⇒ + define(`show', ``$1' + ') + ⇒ + stack_foreach(`a', `show')dnl + ⇒1 + ⇒2 + ⇒3 + stack_foreach_lifo(`a', `show')dnl + ⇒3 + ⇒2 + ⇒1 + + Now for the implementation. Note the definition of a helper macro, +‘_stack_reverse’, which destructively swaps the contents of one stack of +definitions into the reverse order in the temporary macro ‘tmp-$1’. By +calling the helper twice, the original order is restored back into the +macro ‘$1’; since the operation is destructive, this explains why ‘$1’ +must not be modified or dereferenced during the traversal. The caller +can then inject additional code to pass the definition currently being +visited to ‘$2’. The choice of helper names is intentional; since ‘-’ +is not valid as part of a macro name, there is no risk of conflict with +a valid macro name, and the code is guaranteed to use ‘defn’ where +necessary. Finally, note that any macro used in the traversal of a +‘pushdef’ stack, such as ‘pushdef’ or ‘defn’, cannot be handled by +‘stack_foreach’, since the macro would temporarily be undefined during +the algorithm. + + $ m4 -I examples + undivert(`stack.m4')dnl + ⇒divert(`-1') + ⇒# stack_foreach(macro, action) + ⇒# Invoke ACTION with a single argument of each definition + ⇒# from the definition stack of MACRO, starting with the oldest. + ⇒define(`stack_foreach', + ⇒`_stack_reverse(`$1', `tmp-$1')'dnl + ⇒`_stack_reverse(`tmp-$1', `$1', `$2(defn(`$1'))')') + ⇒# stack_foreach_lifo(macro, action) + ⇒# Invoke ACTION with a single argument of each definition + ⇒# from the definition stack of MACRO, starting with the newest. + ⇒define(`stack_foreach_lifo', + ⇒`_stack_reverse(`$1', `tmp-$1', `$2(defn(`$1'))')'dnl + ⇒`_stack_reverse(`tmp-$1', `$1')') + ⇒define(`_stack_reverse', + ⇒`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0($@)')') + ⇒divert`'dnl + + +File: m4.info, Node: Composition, Prev: Stacks, Up: Conditionals + +6.7 Building macros with macros +=============================== + +Since m4 is a macro language, it is possible to write macros that can +build other macros. First on the list is a way to automate the creation +of blind macros. + + -- Composite: define_blind (NAME, [VALUE]) + Defines NAME as a blind macro, such that NAME will expand to VALUE + only when given explicit arguments. VALUE should not be the result + of ‘defn’ (*note Defn::). This macro is only recognized with + parameters, and results in an empty string. + + Defining a macro to define another macro can be a bit tricky. We +want to use a literal ‘$#’ in the argument to the nested ‘define’. +However, if ‘$’ and ‘#’ are adjacent in the definition of +‘define_blind’, then it would be expanded as the number of arguments to +‘define_blind’ rather than the intended number of arguments to NAME. +The solution is to pass the difficult characters through extra arguments +to a helper macro ‘_define_blind’. When composing macros, it is a +common idiom to need a helper macro to concatenate text that forms +parameters in the composed macro, rather than interpreting the text as a +parameter of the composing macro. + + As for the limitation against using ‘defn’, there are two reasons. +If a macro was previously defined with ‘define_blind’, then it can +safely be renamed to a new blind macro using plain ‘define’; using +‘define_blind’ to rename it just adds another layer of ‘ifelse’, +occupying memory and slowing down execution. And if a macro is a +builtin, then it would result in an attempt to define a macro consisting +of both text and a builtin token; this is not supported, and the builtin +token is flattened to an empty string. + + With that explanation, here’s the definition, and some sample usage. +Notice that ‘define_blind’ is itself a blind macro. + + $ m4 -d + define(`define_blind', `ifelse(`$#', `0', ``$0'', + `_$0(`$1', `$2', `$'`#', `$'`0')')') + ⇒ + define(`_define_blind', `define(`$1', + `ifelse(`$3', `0', ``$4'', `$2')')') + ⇒ + define_blind + ⇒define_blind + define_blind(`foo', `arguments were $*') + ⇒ + foo + ⇒foo + foo(`bar') + ⇒arguments were bar + define(`blah', defn(`foo')) + ⇒ + blah + ⇒blah + blah(`a', `b') + ⇒arguments were a,b + defn(`blah') + ⇒ifelse(`$#', `0', ``$0'', `arguments were $*') + + Another interesting composition tactic is argument “currying”, or +factoring a macro that takes multiple arguments for use in a context +that provides exactly one argument. + + -- Composite: curry (MACRO, ...) + Expand to a macro call that takes exactly one argument, then + appends that argument to the original arguments and invokes MACRO + with the resulting list of arguments. + + A demonstration of currying makes the intent of this macro a little +more obvious. The macro ‘stack_foreach’ mentioned earlier is an example +of a context that provides exactly one argument to a macro name. But +coupled with currying, we can invoke ‘reverse’ with two arguments for +each definition of a macro stack. This example uses the file +‘m4-1.4.19/examples/curry.m4’ included in the distribution. + + $ m4 -I examples + include(`curry.m4')include(`stack.m4') + ⇒ + define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') + ⇒ + pushdef(`a', `1')pushdef(`a', `2')pushdef(`a', `3') + ⇒ + stack_foreach(`a', `:curry(`reverse', `4')') + ⇒:1, 4:2, 4:3, 4 + curry(`curry', `reverse', `1')(`2')(`3') + ⇒3, 2, 1 + + Now for the implementation. Notice how ‘curry’ leaves off with a +macro name but no open parenthesis, while still in the middle of +collecting arguments for ‘$1’. The macro ‘_curry’ is the helper macro +that takes one argument, then adds it to the list and finally supplies +the closing parenthesis. The use of a comma inside the ‘shift’ call +allows currying to also work for a macro that takes one argument, +although it often makes more sense to invoke that macro directly rather +than going through ‘curry’. + + $ m4 -I examples + undivert(`curry.m4')dnl + ⇒divert(`-1') + ⇒# curry(macro, args) + ⇒# Expand to a macro call that takes one argument, then invoke + ⇒# macro(args, extra). + ⇒define(`curry', `$1(shift($@,)_$0') + ⇒define(`_curry', ``$1')') + ⇒divert`'dnl + + Unfortunately, with M4 1.4.x, ‘curry’ is unable to handle builtin +tokens, which are silently flattened to the empty string when passed +through another text macro. This limitation will be lifted in a future +release of M4. + + Putting the last few concepts together, it is possible to copy or +rename an entire stack of macro definitions. + + -- Composite: copy (SOURCE, DEST) + -- Composite: rename (SOURCE, DEST) + Ensure that DEST is undefined, then define it to the same stack of + definitions currently in SOURCE. ‘copy’ leaves SOURCE unchanged, + while ‘rename’ undefines SOURCE. There are only a few macros, such + as ‘copy’ or ‘defn’, which cannot be copied via this macro. + + The implementation is relatively straightforward (although since it +uses ‘curry’, it is unable to copy builtin macros, such as the second +definition of ‘a’ as a synonym for ‘divnum’. See if you can design a +version that works around this limitation, or *note Answers: Improved +copy.). + + $ m4 -I examples + include(`curry.m4')include(`stack.m4') + ⇒ + define(`rename', `copy($@)undefine(`$1')')dnl + define(`copy', `ifdef(`$2', `errprint(`$2 already defined + ')m4exit(`1')', + `stack_foreach(`$1', `curry(`pushdef', `$2')')')')dnl + pushdef(`a', `1')pushdef(`a', defn(`divnum'))pushdef(`a', `2') + ⇒ + copy(`a', `b') + ⇒ + rename(`b', `c') + ⇒ + a b c + ⇒2 b 2 + popdef(`a', `c')c a + ⇒ 0 + popdef(`a', `c')a c + ⇒1 1 + + +File: m4.info, Node: Debugging, Next: Input Control, Prev: Conditionals, Up: Top + +7 How to debug macros and input +******************************* + +When writing macros for ‘m4’, they often do not work as intended on the +first try (as is the case with most programming languages). +Fortunately, there is support for macro debugging in ‘m4’. + +* Menu: + +* Dumpdef:: Displaying macro definitions +* Trace:: Tracing macro calls +* Debug Levels:: Controlling debugging output +* Debug Output:: Saving debugging output + + +File: m4.info, Node: Dumpdef, Next: Trace, Up: Debugging + +7.1 Displaying macro definitions +================================ + +If you want to see what a name expands into, you can use the builtin +‘dumpdef’: + + -- Builtin: dumpdef ([NAMES...]) + Accepts any number of arguments. If called without any arguments, + it displays the definitions of all known names, otherwise it + displays the definitions of the NAMES given. The output is printed + to the current debug file (usually standard error), and is sorted + by name. If an unknown name is encountered, a warning is printed. + + The expansion of ‘dumpdef’ is void. + + $ m4 -d + define(`foo', `Hello world.') + ⇒ + dumpdef(`foo') + error→foo: ⇒ + dumpdef(`define') + error→define: ⇒ + + The last example shows how builtin macros definitions are displayed. +The definition that is dumped corresponds to what would occur if the +macro were to be called at that point, even if other definitions are +still live due to redefining a macro during argument collection. + + $ m4 -d + pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') + ⇒ + f(popdef(`f')dumpdef(`f')) + error→f: ⇒f2 + f(popdef(`f')dumpdef(`f')) + error→m4:stdin:3: undefined macro `f' + ⇒f1 + + *Note Debug Levels::, for information on controlling the details of +the display. + + +File: m4.info, Node: Trace, Next: Debug Levels, Prev: Dumpdef, Up: Debugging + +7.2 Tracing macro calls +======================= + +It is possible to trace macro calls and expansions through the builtins +‘traceon’ and ‘traceoff’: + + -- Builtin: traceon ([NAMES...]) + -- Builtin: traceoff ([NAMES...]) + When called without any arguments, ‘traceon’ and ‘traceoff’ will + turn tracing on and off, respectively, for all currently defined + macros. + + When called with arguments, only the macros listed in NAMES are + affected, whether or not they are currently defined. + + The expansion of ‘traceon’ and ‘traceoff’ is void. + + Whenever a traced macro is called and the arguments have been +collected, the call is displayed. If the expansion of the macro call is +not void, the expansion can be displayed after the call. The output is +printed to the current debug file (defaulting to standard error, *note +Debug Output::). + + $ m4 -d + define(`foo', `Hello World.') + ⇒ + define(`echo', `$@') + ⇒ + traceon(`foo', `echo') + ⇒ + foo + error→m4trace: -1- foo -> `Hello World.' + ⇒Hello World. + echo(`gnus', `and gnats') + error→m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' + ⇒gnus,and gnats + + The number between dashes is the depth of the expansion. It is one +most of the time, signifying an expansion at the outermost level, but it +increases when macro arguments contain unquoted macro calls. The +maximum number that will appear between dashes is controlled by the +option ‘--nesting-limit’ (or ‘-L’, *note Invoking m4: Limits control.). +Additionally, the option ‘--trace’ (or ‘-t’) can be used to invoke +‘traceon(NAME)’ before parsing input. + + $ m4 -L 3 -t ifelse + ifelse(`one level') + error→m4trace: -1- ifelse + ⇒ + ifelse(ifelse(ifelse(`three levels'))) + error→m4trace: -3- ifelse + error→m4trace: -2- ifelse + error→m4trace: -1- ifelse + ⇒ + ifelse(ifelse(ifelse(ifelse(`four levels')))) + error→m4:stdin:3: recursion limit of 3 exceeded, use -L to change it + + Tracing by name is an attribute that is preserved whether the macro +is defined or not. This allows the selection of macros to trace before +those macros are defined. + + $ m4 -d + traceoff(`foo') + ⇒ + traceon(`foo') + ⇒ + foo + ⇒foo + defn(`foo') + ⇒ + define(`foo', `bar') + ⇒ + foo + error→m4trace: -1- foo -> `bar' + ⇒bar + undefine(`foo') + ⇒ + ifdef(`foo', `yes', `no') + ⇒no + indir(`foo') + error→m4:stdin:9: undefined macro `foo' + ⇒ + define(`foo', `blah') + ⇒ + foo + error→m4trace: -1- foo -> `blah' + ⇒blah + traceoff + ⇒ + foo + ⇒blah + + Tracing even works on builtins. However, ‘defn’ (*note Defn::) does +not transfer tracing status. + + $ m4 -d + traceon(`traceon') + ⇒ + traceon(`traceoff') + error→m4trace: -1- traceon(`traceoff') + ⇒ + traceoff(`traceoff') + error→m4trace: -1- traceoff(`traceoff') + ⇒ + traceoff(`traceon') + ⇒ + traceon(`eval', `m4_divnum') + ⇒ + define(`m4_eval', defn(`eval')) + ⇒ + define(`m4_divnum', defn(`divnum')) + ⇒ + eval(divnum) + error→m4trace: -1- eval(`0') -> `0' + ⇒0 + m4_eval(m4_divnum) + error→m4trace: -2- m4_divnum -> `0' + ⇒0 + + *Note Debug Levels::, for information on controlling the details of +the display. The format of the trace output is not specified by POSIX, +and varies between implementations of ‘m4’. + + +File: m4.info, Node: Debug Levels, Next: Debug Output, Prev: Trace, Up: Debugging + +7.3 Controlling debugging output +================================ + +The ‘-d’ option to ‘m4’ (or ‘--debug’, *note Invoking m4: Debugging +options.) controls the amount of details presented in three categories +of output. Trace output is requested by ‘traceon’ (*note Trace::), and +each line is prefixed by ‘m4trace:’ in relation to a macro invocation. +Debug output tracks useful events not associated with a macro +invocation, and each line is prefixed by ‘m4debug:’. Finally, ‘dumpdef’ +(*note Dumpdef::) output is affected, with no prefix added to the output +lines. + + The FLAGS following the option can be one or more of the following: + +‘a’ + In trace output, show the actual arguments that were collected + before invoking the macro. This applies to all macro calls if the + ‘t’ flag is used, otherwise only the macros covered by calls of + ‘traceon’. Arguments are subject to length truncation specified by + the command line option ‘--arglength’ (or ‘-l’). + +‘c’ + In trace output, show several trace lines for each macro call. A + line is shown when the macro is seen, but before the arguments are + collected; a second line when the arguments have been collected and + a third line after the call has completed. + +‘e’ + In trace output, show the expansion of each macro call, if it is + not void. This applies to all macro calls if the ‘t’ flag is used, + otherwise only the macros covered by calls of ‘traceon’. The + expansion is subject to length truncation specified by the command + line option ‘--arglength’ (or ‘-l’). + +‘f’ + In debug and trace output, include the name of the current input + file in the output line. + +‘i’ + In debug output, print a message each time the current input file + is changed. + +‘l’ + In debug and trace output, include the current input line number in + the output line. + +‘p’ + In debug output, print a message when a named file is found through + the path search mechanism (*note Search Path::), giving the actual + file name used. + +‘q’ + In trace and dumpdef output, quote actual arguments and macro + expansions in the display with the current quotes. This is useful + in connection with the ‘a’ and ‘e’ flags above. + +‘t’ + In trace output, trace all macro calls made in this invocation of + ‘m4’, regardless of the settings of ‘traceon’. + +‘x’ + In trace output, add a unique ‘macro call id’ to each line of the + trace output. This is useful in connection with the ‘c’ flag + above. + +‘V’ + A shorthand for all of the above flags. + + If no flags are specified with the ‘-d’ option, the default is ‘aeq’. +The examples throughout this manual assume the default flags. + + There is a builtin macro ‘debugmode’, which allows on-the-fly control +of the debugging output format: + + -- Builtin: debugmode ([FLAGS]) + The argument FLAGS should be a subset of the letters listed above. + As special cases, if the argument starts with a ‘+’, the flags are + added to the current debug flags, and if it starts with a ‘-’, they + are removed. If no argument is present, all debugging flags are + cleared (as if no ‘-d’ was given), and with an empty argument the + flags are reset to the default of ‘aeq’. + + The expansion of ‘debugmode’ is void. + + $ m4 + define(`foo', `FOO') + ⇒ + traceon(`foo') + ⇒ + debugmode() + ⇒ + foo + error→m4trace: -1- foo -> `FOO' + ⇒FOO + debugmode + ⇒ + foo + error→m4trace: -1- foo + ⇒FOO + debugmode(`+l') + ⇒ + foo + error→m4trace:8: -1- foo + ⇒FOO + + The following example demonstrates the behavior of length truncation, +when specified on the command line. Note that each argument and the +final result are individually truncated. Also, the special tokens for +builtin functions are not truncated. + + $ m4 -d -l 6 + define(`echo', `$@')debugmode(`+t') + ⇒ + echo(`1', `long string') + error→m4trace: -1- echo(`1', `long s...') -> ``1',`l...' + ⇒1,long string + indir(`echo', defn(`changequote')) + error→m4trace: -2- defn(`change...') + error→m4trace: -1- indir(`echo', ) -> ``'' + ⇒ + + This example shows the effects of the debug flags that are not +related to macro tracing. + + $ m4 -dip -I examples + error→m4debug: input read from stdin + include(`foo')dnl + error→m4debug: path search for `foo' found `examples/foo' + error→m4debug: input read from examples/foo + ⇒bar + error→m4debug: input reverted to stdin, line 1 + ^D + error→m4debug: input exhausted + + +File: m4.info, Node: Debug Output, Prev: Debug Levels, Up: Debugging + +7.4 Saving debugging output +=========================== + +Debug and tracing output can be redirected to files using either the +‘--debugfile’ option to ‘m4’ (*note Invoking m4: Debugging options.), or +with the builtin macro ‘debugfile’: + + -- Builtin: debugfile ([FILE]) + Sends all further debug and trace output to FILE, opened in append + mode. If FILE is the empty string, debug and trace output are + discarded. If ‘debugfile’ is called without any arguments, debug + and trace output are sent to standard error. This does not affect + warnings, error messages, or ‘errprint’ output, which are always + sent to standard error. If FILE cannot be opened, the current + debug file is unchanged, and an error is issued. + + The expansion of ‘debugfile’ is void. + + $ m4 -d + traceon(`divnum') + ⇒ + divnum(`extra') + error→m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored + error→m4trace: -1- divnum(`extra') -> `0' + ⇒0 + debugfile() + ⇒ + divnum(`extra') + error→m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored + ⇒0 + debugfile + ⇒ + divnum + error→m4trace: -1- divnum -> `0' + ⇒0 + + +File: m4.info, Node: Input Control, Next: File Inclusion, Prev: Debugging, Up: Top + +8 Input control +*************** + +This chapter describes various builtin macros for controlling the input +to ‘m4’. + +* Menu: + +* Dnl:: Deleting whitespace in input +* Changequote:: Changing the quote characters +* Changecom:: Changing the comment delimiters +* Changeword:: Changing the lexical structure of words +* M4wrap:: Saving text until end of input + + +File: m4.info, Node: Dnl, Next: Changequote, Up: Input Control + +8.1 Deleting whitespace in input +================================ + +The builtin ‘dnl’ stands for “Discard to Next Line”: + + -- Builtin: dnl + All characters, up to and including the next newline, are discarded + without performing any macro expansion. A warning is issued if the + end of the file is encountered without a newline. + + The expansion of ‘dnl’ is void. + + It is often used in connection with ‘define’, to remove the newline +that follows the call to ‘define’. Thus + + define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. + foo + ⇒Macro foo. + + The input up to and including the next newline is discarded, as +opposed to the way comments are treated (*note Comments::). + + Usually, ‘dnl’ is immediately followed by an end of line or some +other whitespace. GNU ‘m4’ will produce a warning diagnostic if ‘dnl’ +is followed by an open parenthesis. In this case, ‘dnl’ will collect +and process all arguments, looking for a matching close parenthesis. +All predictable side effects resulting from this collection will take +place. ‘dnl’ will return no output. The input following the matching +close parenthesis up to and including the next newline, on whatever line +containing it, will still be discarded. + + dnl(`args are ignored, but side effects occur', + define(`foo', `like this')) while this text is ignored: undefine(`foo') + error→m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored + See how `foo' was defined, foo? + ⇒See how foo was defined, like this? + + If the end of file is encountered without a newline character, a +warning is issued and dnl stops consuming input. + + m4wrap(`m4wrap(`2 hi + ')0 hi dnl 1 hi') + ⇒ + define(`hi', `HI') + ⇒ + ^D + error→m4:stdin:1: Warning: end of file treated as newline + ⇒0 HI 2 HI + + +File: m4.info, Node: Changequote, Next: Changecom, Prev: Dnl, Up: Input Control + +8.2 Changing the quote characters +================================= + +The default quote delimiters can be changed with the builtin +‘changequote’: + + -- Builtin: changequote ([START = ‘`’], [END = ‘'’]) + This sets START as the new begin-quote delimiter and END as the new + end-quote delimiter. If both arguments are missing, the default + quotes (‘`’ and ‘'’) are used. If START is void, then quoting is + disabled. Otherwise, if END is missing or void, the default + end-quote delimiter (‘'’) is used. The quote delimiters can be of + any length. + + The expansion of ‘changequote’ is void. + + changequote(`[', `]') + ⇒ + define([foo], [Macro [foo].]) + ⇒ + foo + ⇒Macro foo. + + The quotation strings can safely contain non-ASCII characters. + + define(`a', `b') + ⇒ + «a» + ⇒«b» + changequote(`«', `»') + ⇒ + «a» + ⇒a + + If no single character is appropriate, START and END can be of any +length. Other implementations cap the delimiter length to five +characters, but GNU has no inherent limit. + + changequote(`[[[', `]]]') + ⇒ + define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) + ⇒ + foo + ⇒Macro [[foo]]. + + Calling ‘changequote’ with START as the empty string will effectively +disable the quoting mechanism, leaving no way to quote text. However, +using an empty string is not portable, as some other implementations of +‘m4’ revert to the default quoting, while others preserve the prior +non-empty delimiter. If START is not empty, then an empty END will use +the default end-quote delimiter of ‘'’, as otherwise, it would be +impossible to end a quoted string. Again, this is not portable, as some +other ‘m4’ implementations reuse START as the end-quote delimiter, while +others preserve the previous non-empty value. Omitting both arguments +restores the default begin-quote and end-quote delimiters; fortunately +this behavior is portable to all implementations of ‘m4’. + + define(`foo', `Macro `FOO'.') + ⇒ + changequote(`', `') + ⇒ + foo + ⇒Macro `FOO'. + `foo' + ⇒`Macro `FOO'.' + changequote(`,) + ⇒ + foo + ⇒Macro FOO. + + There is no way in ‘m4’ to quote a string containing an unmatched +begin-quote, except using ‘changequote’ to change the current quotes. + + If the quotes should be changed from, say, ‘[’ to ‘[[’, temporary +quote characters have to be defined. To achieve this, two calls of +‘changequote’ must be made, one for the temporary quotes and one for the +new quotes. + + Macros are recognized in preference to the begin-quote string, so if +a prefix of START can be recognized as part of a potential macro name, +the quoting mechanism is effectively disabled. Unless you use +‘changeword’ (*note Changeword::), this means that START should not +begin with a letter, digit, or ‘_’ (underscore). However, even though +quoted strings are not recognized, the quote characters can still be +discerned in macro expansion and in trace output. + + define(`echo', `$@') + ⇒ + define(`hi', `HI') + ⇒ + changequote(`q', `Q') + ⇒ + q hi Q hi + ⇒q HI Q HI + echo(hi) + ⇒qHIQ + changequote + ⇒ + changequote(`-', `EOF') + ⇒ + - hi EOF hi + ⇒ hi HI + changequote + ⇒ + changequote(`1', `2') + ⇒ + hi1hi2 + ⇒hi1hi2 + hi 1hi2 + ⇒HI hi + + Quotes are recognized in preference to argument collection. In +particular, if START is a single ‘(’, then argument collection is +effectively disabled. For portability with other implementations, it is +a good idea to avoid ‘(’, ‘,’, and ‘)’ as the first character in START. + + define(`echo', `$#:$@:') + ⇒ + define(`hi', `HI') + ⇒ + changequote(`(',`)') + ⇒ + echo(hi) + ⇒0::hi + changequote + ⇒ + changequote(`((', `))') + ⇒ + echo(hi) + ⇒1:HI: + echo((hi)) + ⇒0::hi + changequote + ⇒ + changequote(`,', `)') + ⇒ + echo(hi,hi)bye) + ⇒1:HIhibye: + + However, if you are not worried about portability, using ‘(’ and ‘)’ +as quoting characters has an interesting property—you can use it to +compute a quoted string containing the expansion of any quoted text, as +long as the expansion results in both balanced quotes and balanced +parentheses. The trick is realizing ‘expand’ uses ‘$1’ unquoted, to +trigger its expansion using the normal quoting characters, but uses +extra parentheses to group unquoted commas that occur in the expansion +without consuming whitespace following those commas. Then ‘_expand’ +uses ‘changequote’ to convert the extra parentheses back into quoting +characters. Note that it takes two more ‘changequote’ invocations to +restore the original quotes. Contrast the behavior on whitespace when +using ‘$*’, via ‘quote’, to attempt the same task. + + changequote(`[', `]')dnl + define([a], [1, (b)])dnl + define([b], [2])dnl + define([quote], [[$*]])dnl + define([expand], [_$0(($1))])dnl + define([_expand], + [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl + expand([a, a, [a, a], [[a, a]]]) + ⇒1, (2), 1, (2), a, a, [a, a] + quote(a, a, [a, a], [[a, a]]) + ⇒1,(2),1,(2),a, a,[a, a] + + If END is a prefix of START, the end-quote will be recognized in +preference to a nested begin-quote. In particular, changing the quotes +to have the same string for START and END disables nesting of quotes. +When quote nesting is disabled, it is impossible to double-quote strings +across macro expansions, so using the same string is not done very +often. + + define(`hi', `HI') + ⇒ + changequote(`""', `"') + ⇒ + ""hi"""hi" + ⇒hihi + ""hi" ""hi" + ⇒hi hi + ""hi"" "hi" + ⇒hi" "HI" + changequote + ⇒ + `hi`hi'hi' + ⇒hi`hi'hi + changequote(`"', `"') + ⇒ + "hi"hi"hi" + ⇒hiHIhi + + It is an error if the end of file occurs within a quoted string. + + `hello world' + ⇒hello world + `dangling quote + ^D + error→m4:stdin:2: ERROR: end of file in string + + ifelse(`dangling quote + ^D + error→m4:stdin:1: ERROR: end of file in string + + +File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control + +8.3 Changing the comment delimiters +=================================== + +The default comment delimiters can be changed with the builtin macro +‘changecom’: + + -- Builtin: changecom ([START], [END = ‘’]) + This sets START as the new begin-comment delimiter and END as the + new end-comment delimiter. If both arguments are missing, or START + is void, then comments are disabled. Otherwise, if END is missing + or void, the default end-comment delimiter of newline is used. The + comment delimiters can be of any length. + + The expansion of ‘changecom’ is void. + + define(`comment', `COMMENT') + ⇒ + # A normal comment + ⇒# A normal comment + changecom(`/*', `*/') + ⇒ + # Not a comment anymore + ⇒# Not a COMMENT anymore + But: /* this is a comment now */ while this is not a comment + ⇒But: /* this is a comment now */ while this is not a COMMENT + + Note how comments are copied to the output, much as if they were +quoted strings. If you want the text inside a comment expanded, quote +the begin-comment delimiter. + + Calling ‘changecom’ without any arguments, or with START as the empty +string, will effectively disable the commenting mechanism. To restore +the original comment start of ‘#’, you must explicitly ask for it. If +START is not empty, then an empty END will use the default end-comment +delimiter of newline, as otherwise, it would be impossible to end a +comment. However, this is not portable, as some other ‘m4’ +implementations preserve the previous non-empty delimiters instead. + + define(`comment', `COMMENT') + ⇒ + changecom + ⇒ + # Not a comment anymore + ⇒# Not a COMMENT anymore + changecom(`#', `') + ⇒ + # comment again + ⇒# comment again + + The comment strings can safely contain non-ASCII characters. + + define(`a', `b') + ⇒ + «a» + ⇒«b» + changecom(`«', `»') + ⇒ + «a» + ⇒«a» + + If no single character is appropriate, START and END can be of any +length. Other implementations cap the delimiter length to five +characters, but GNU has no inherent limit. + + Comments are recognized in preference to macros. However, this is +not compatible with other implementations, where macros and even quoting +takes precedence over comments, so it may change in a future release. +For portability, this means that START should not begin with a letter, +digit, or ‘_’ (underscore), and that neither the start-quote nor the +start-comment string should be a prefix of the other. + + define(`hi', `HI') + ⇒ + define(`hi1hi2', `hello') + ⇒ + changecom(`q', `Q') + ⇒ + q hi Q hi + ⇒q hi Q HI + changecom(`1', `2') + ⇒ + hi1hi2 + ⇒hello + hi 1hi2 + ⇒HI 1hi2 + + Comments are recognized in preference to argument collection. In +particular, if START is a single ‘(’, then argument collection is +effectively disabled. For portability with other implementations, it is +a good idea to avoid ‘(’, ‘,’, and ‘)’ as the first character in START. + + define(`echo', `$#:$*:$@:') + ⇒ + define(`hi', `HI') + ⇒ + changecom(`(',`)') + ⇒ + echo(hi) + ⇒0:::(hi) + changecom + ⇒ + changecom(`((', `))') + ⇒ + echo(hi) + ⇒1:HI:HI: + echo((hi)) + ⇒0:::((hi)) + changecom(`,', `)') + ⇒ + echo(hi,hi)bye) + ⇒1:HI,hi)bye:HI,hi)bye: + changecom + ⇒ + echo(hi,`,`'hi',hi) + ⇒3:HI,,HI,HI:HI,,`'hi,HI: + echo(hi,`,`'hi',hi`'changecom(`,,', `hi')) + ⇒3:HI,,`'hi,HI:HI,,`'hi,HI: + + It is an error if the end of file occurs within a comment. + + changecom(`/*', `*/') + ⇒ + /*dangling comment + ^D + error→m4:stdin:2: ERROR: end of file in comment + + +File: m4.info, Node: Changeword, Next: M4wrap, Prev: Changecom, Up: Input Control + +8.4 Changing the lexical structure of words +=========================================== + + The macro ‘changeword’ and all associated functionality is + experimental. It is only available if the ‘--enable-changeword’ + option was given to ‘configure’, at GNU ‘m4’ installation time. + The functionality will go away in the future, to be replaced by + other new features that are more efficient at providing the same + capabilities. _Do not rely on it_. Please direct your comments + about it the same way you would do for bugs. + + A file being processed by ‘m4’ is split into quoted strings, words +(potential macro names) and simple tokens (any other single character). +Initially a word is defined by the following regular expression: + + [_a-zA-Z][_a-zA-Z0-9]* + + Using ‘changeword’, you can change this regular expression: + + -- Optional builtin: changeword (REGEX) + Changes the regular expression for recognizing macro names to be + REGEX. If REGEX is empty, use ‘[_a-zA-Z][_a-zA-Z0-9]*’. REGEX + must obey the constraint that every prefix of the desired final + pattern is also accepted by the regular expression. If REGEX + contains grouping parentheses, the macro invoked is the portion + that matched the first group, rather than the entire matching + string. + + The expansion of ‘changeword’ is void. The macro ‘changeword’ is + recognized only with parameters. + + Relaxing the lexical rules of ‘m4’ might be useful (for example) if +you wanted to apply translations to a file of numbers: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + changeword(`[_a-zA-Z0-9]+') + ⇒ + define(`1', `0')1 + ⇒0 + + Tightening the lexical rules is less useful, because it will +generally make some of the builtins unavailable. You could use it to +prevent accidental call of builtins, for example: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`_indir', defn(`indir')) + ⇒ + changeword(`_[_a-zA-Z0-9]*') + ⇒ + esyscmd(`foo') + ⇒esyscmd(foo) + _indir(`esyscmd', `echo hi') + ⇒hi + ⇒ + + Because ‘m4’ constructs its words a character at a time, there is a +restriction on the regular expressions that may be passed to +‘changeword’. This is that if your regular expression accepts ‘foo’, it +must also accept ‘f’ and ‘fo’. + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`foo + ', `bar + ') + ⇒ + dnl This example wants to recognize changeword, dnl, and `foo\n'. + dnl First, we check that our regexp will match. + regexp(`changeword', `[cd][a-z]*\|foo[ + ]') + ⇒0 + regexp(`foo + ', `[cd][a-z]*\|foo[ + ]') + ⇒0 + regexp(`f', `[cd][a-z]*\|foo[ + ]') + ⇒-1 + foo + ⇒foo + changeword(`[cd][a-z]*\|foo[ + ]') + ⇒ + dnl Even though `foo\n' matches, we forgot to allow `f'. + foo + ⇒foo + changeword(`[cd][a-z]*\|fo*[ + ]?') + ⇒ + dnl Now we can call `foo\n'. + foo + ⇒bar + + ‘changeword’ has another function. If the regular expression +supplied contains any grouped subexpressions, then text outside the +first of these is discarded before symbol lookup. So: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl + changecom(`/*', `*/')dnl + define(`foo', `bar')dnl + changeword(`#\([_a-zA-Z0-9]*\)') + ⇒ + #esyscmd(`echo foo \#foo') + ⇒foo bar + ⇒ + + ‘m4’ now requires a ‘#’ mark at the beginning of every macro +invocation, so one can use ‘m4’ to preprocess plain text without losing +various words like ‘divert’. + + In ‘m4’, macro substitution is based on text, while in TeX, it is +based on tokens. ‘changeword’ can throw this difference into relief. +For example, here is the same idea represented in TeX and ‘m4’. First, +the TeX version: + + \def\a{\message{Hello}} + \catcode`\@=0 + \catcode`\\=12 + @a + @bye + ⇒Hello + +Then, the ‘m4’ version: + + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`a', `errprint(`Hello')')dnl + changeword(`@\([_a-zA-Z0-9]*\)') + ⇒ + @a + ⇒errprint(Hello) + + In the TeX example, the first line defines a macro ‘a’ to print the +message ‘Hello’. The second line defines <@> to be usable instead of +<\> as an escape character. The third line defines <\> to be a normal +printing character, not an escape. The fourth line invokes the macro +‘a’. So, when TeX is run on this file, it displays the message ‘Hello’. + + When the ‘m4’ example is passed through ‘m4’, it outputs +‘errprint(Hello)’. The reason for this is that TeX does lexical +analysis of macro definition when the macro is _defined_. ‘m4’ just +stores the text, postponing the lexical analysis until the macro is +_used_. + + You should note that using ‘changeword’ will slow ‘m4’ down by a +factor of about seven, once it is changed to something other than the +default regular expression. You can invoke ‘changeword’ with the empty +string to restore the default word definition, and regain the parsing +speed. + + +File: m4.info, Node: M4wrap, Prev: Changeword, Up: Input Control + +8.5 Saving text until end of input +================================== + +It is possible to ‘save’ some text until the end of the normal input has +been seen. Text can be saved, to be read again by ‘m4’ when the normal +input has been exhausted. This feature is normally used to initiate +cleanup actions before normal exit, e.g., deleting temporary files. + + To save input text, use the builtin ‘m4wrap’: + + -- Builtin: m4wrap (STRING, ...) + Stores STRING in a safe place, to be reread when end of input is + reached. As a GNU extension, additional arguments are concatenated + with a space to the STRING. + + The expansion of ‘m4wrap’ is void. The macro ‘m4wrap’ is + recognized only with parameters. + + define(`cleanup', `This is the `cleanup' action. + ') + ⇒ + m4wrap(`cleanup') + ⇒ + This is the first and last normal input line. + ⇒This is the first and last normal input line. + ^D + ⇒This is the cleanup action. + + The saved input is only reread when the end of normal input is seen, +and not if ‘m4exit’ is used to exit ‘m4’. + + It is safe to call ‘m4wrap’ from saved text, but then the order in +which the saved text is reread is undefined. If ‘m4wrap’ is not used +recursively, the saved pieces of text are reread in the opposite order +in which they were saved (LIFO—last in, first out). However, this +behavior is likely to change in a future release, to match POSIX, so you +should not depend on this order. + + It is possible to emulate POSIX behavior even with older versions of +GNU M4 by including the file ‘m4-1.4.19/examples/wrapfifo.m4’ from the +distribution: + + $ m4 -I examples + undivert(`wrapfifo.m4')dnl + ⇒dnl Redefine m4wrap to have FIFO semantics. + ⇒define(`_m4wrap_level', `0')dnl + ⇒define(`m4wrap', + ⇒`ifdef(`m4wrap'_m4wrap_level, + ⇒ `define(`m4wrap'_m4wrap_level, + ⇒ defn(`m4wrap'_m4wrap_level)`$1')', + ⇒ `builtin(`m4wrap', `define(`_m4wrap_level', + ⇒ incr(_m4wrap_level))dnl + ⇒m4wrap'_m4wrap_level)dnl + ⇒define(`m4wrap'_m4wrap_level, `$1')')')dnl + include(`wrapfifo.m4') + ⇒ + m4wrap(`a`'m4wrap(`c + ', `d')')m4wrap(`b') + ⇒ + ^D + ⇒abc + + It is likewise possible to emulate LIFO behavior without resorting to +the GNU M4 extension of ‘builtin’, by including the file +‘m4-1.4.19/examples/wraplifo.m4’ from the distribution. (Unfortunately, +both examples shown here share some subtle bugs. See if you can find +and correct them; or *note Answers: Improved m4wrap.). + + $ m4 -I examples + undivert(`wraplifo.m4')dnl + ⇒dnl Redefine m4wrap to have LIFO semantics. + ⇒define(`_m4wrap_level', `0')dnl + ⇒define(`_m4wrap', defn(`m4wrap'))dnl + ⇒define(`m4wrap', + ⇒`ifdef(`m4wrap'_m4wrap_level, + ⇒ `define(`m4wrap'_m4wrap_level, + ⇒ `$1'defn(`m4wrap'_m4wrap_level))', + ⇒ `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl + ⇒m4wrap'_m4wrap_level)dnl + ⇒define(`m4wrap'_m4wrap_level, `$1')')')dnl + include(`wraplifo.m4') + ⇒ + m4wrap(`a`'m4wrap(`c + ', `d')')m4wrap(`b') + ⇒ + ^D + ⇒bac + + Here is an example of implementing a factorial function using +‘m4wrap’: + + define(`f', `ifelse(`$1', `0', `Answer: 0!=1 + ', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') + ', `m4wrap(`f(decr(`$1'), `$2$1*')')')') + ⇒ + f(`10') + ⇒ + ^D + ⇒Answer: 10*9*8*7*6*5*4*3*2*1=3628800 + + Invocations of ‘m4wrap’ at the same recursion level are concatenated +and rescanned as usual: + + define(`aa', `AA + ') + ⇒ + m4wrap(`a')m4wrap(`a') + ⇒ + ^D + ⇒AA + +however, the transition between recursion levels behaves like an end of +file condition between two input files. + + m4wrap(`m4wrap(`)')len(abc') + ⇒ + ^D + error→m4:stdin:1: ERROR: end of file in argument list + + +File: m4.info, Node: File Inclusion, Next: Diversions, Prev: Input Control, Up: Top + +9 File inclusion +**************** + +‘m4’ allows you to include named files at any point in the input. + +* Menu: + +* Include:: Including named files +* Search Path:: Searching for include files + + +File: m4.info, Node: Include, Next: Search Path, Up: File Inclusion + +9.1 Including named files +========================= + +There are two builtin macros in ‘m4’ for including files: + + -- Builtin: include (FILE) + -- Builtin: sinclude (FILE) + Both macros cause the file named FILE to be read by ‘m4’. When the + end of the file is reached, input is resumed from the previous + input file. + + The expansion of ‘include’ and ‘sinclude’ is therefore the contents + of FILE. + + If FILE does not exist, is a directory, or cannot otherwise be + read, the expansion is void, and ‘include’ will fail with an error + while ‘sinclude’ is silent. The empty string counts as a file that + does not exist. + + The macros ‘include’ and ‘sinclude’ are recognized only with + parameters. + + include(`none') + error→m4:stdin:1: cannot open `none': No such file or directory + ⇒ + include() + error→m4:stdin:2: cannot open `': No such file or directory + ⇒ + sinclude(`none') + ⇒ + sinclude() + ⇒ + + The rest of this section assumes that ‘m4’ is invoked with the ‘-I’ +option (*note Invoking m4: Preprocessor features.) pointing to the +‘m4-1.4.19/examples’ directory shipped as part of the GNU ‘m4’ package. +The file ‘m4-1.4.19/examples/incl.m4’ in the distribution contains the +lines: + + $ cat examples/incl.m4 + ⇒Include file start + ⇒foo + ⇒Include file end + + Normally file inclusion is used to insert the contents of a file into +the input stream. The contents of the file will be read by ‘m4’ and +macro calls in the file will be expanded: + + $ m4 -I examples + define(`foo', `FOO') + ⇒ + include(`incl.m4') + ⇒Include file start + ⇒FOO + ⇒Include file end + ⇒ + + The fact that ‘include’ and ‘sinclude’ expand to the contents of the +file can be used to define macros that operate on entire files. Here is +an example, which defines ‘bar’ to expand to the contents of ‘incl.m4’: + + $ m4 -I examples + define(`bar', include(`incl.m4')) + ⇒ + This is `bar': >>bar<< + ⇒This is bar: >>Include file start + ⇒foo + ⇒Include file end + ⇒<< + + This use of ‘include’ is not trivial, though, as files can contain +quotes, commas, and parentheses, which can interfere with the way the +‘m4’ parser works. GNU ‘m4’ seamlessly concatenates the file contents +with the next character, even if the included file ended in the middle +of a comment, string, or macro call. These conditions are only treated +as end of file errors if specified as input files on the command line. + + In GNU ‘m4’, an alternative method of reading files is using +‘undivert’ (*note Undivert::) on a named file. + + +File: m4.info, Node: Search Path, Prev: Include, Up: File Inclusion + +9.2 Searching for include files +=============================== + +GNU ‘m4’ allows included files to be found in other directories than the +current working directory. + + If the ‘--prepend-include’ or ‘-B’ command-line option was provided +(*note Invoking m4: Preprocessor features.), those directories are +searched first, in reverse order that those options were listed on the +command line. Then ‘m4’ looks in the current working directory. Next +comes the directories specified with the ‘--include’ or ‘-I’ option, in +the order found on the command line. Finally, if the ‘M4PATH’ +environment variable is set, it is expected to contain a colon-separated +list of directories, which will be searched in order. + + If the automatic search for include-files causes trouble, the ‘p’ +debug flag (*note Debug Levels::) can help isolate the problem. + + +File: m4.info, Node: Diversions, Next: Text handling, Prev: File Inclusion, Up: Top + +10 Diverting and undiverting output +*********************************** + +Diversions are a way of temporarily saving output. The output of ‘m4’ +can at any time be diverted to a temporary file, and be reinserted into +the output stream, “undiverted”, again at a later time. + + Numbered diversions are counted from 0 upwards, diversion number 0 +being the normal output stream. GNU ‘m4’ tries to keep diversions in +memory. However, there is a limit to the overall memory usable by all +diversions taken together (512K, currently). When this maximum is about +to be exceeded, a temporary file is opened to receive the contents of +the biggest diversion still in memory, freeing this memory for other +diversions. When creating the temporary file, ‘m4’ honors the value of +the environment variable ‘TMPDIR’, and falls back to ‘/tmp’. Thus, the +amount of available disk space provides the only real limit on the +number and aggregate size of diversions. + + Diversions make it possible to generate output in a different order +than the input was read. It is possible to implement topological +sorting dependencies. For example, GNU Autoconf makes use of diversions +under the hood to ensure that the expansion of a prerequisite macro +appears in the output prior to the expansion of a dependent macro, +regardless of which order the two macros were invoked in the user’s +input file. + +* Menu: + +* Divert:: Diverting output +* Undivert:: Undiverting output +* Divnum:: Diversion numbers +* Cleardivert:: Discarding diverted text + + +File: m4.info, Node: Divert, Next: Undivert, Up: Diversions + +10.1 Diverting output +===================== + +Output is diverted using ‘divert’: + + -- Builtin: divert ([NUMBER = ‘0’]) + The current diversion is changed to NUMBER. If NUMBER is left out + or empty, it is assumed to be zero. If NUMBER cannot be parsed, + the diversion is unchanged. + + The expansion of ‘divert’ is void. + + When all the ‘m4’ input will have been processed, all existing +diversions are automatically undiverted, in numerical order. + + divert(`1') + This text is diverted. + divert + ⇒ + This text is not diverted. + ⇒This text is not diverted. + ^D + ⇒ + ⇒This text is diverted. + + Several calls of ‘divert’ with the same argument do not overwrite the +previous diverted text, but append to it. Diversions are printed after +any wrapped text is expanded. + + define(`text', `TEXT') + ⇒ + divert(`1')`diverted text.' + divert + ⇒ + m4wrap(`Wrapped text precedes ') + ⇒ + ^D + ⇒Wrapped TEXT precedes diverted text. + + If output is diverted to a negative diversion, it is simply +discarded. This can be used to suppress unwanted output. A common +example of unwanted output is the trailing newlines after macro +definitions. Here is a common programming idiom in ‘m4’ for avoiding +them. + + divert(`-1') + define(`foo', `Macro `foo'.') + define(`bar', `Macro `bar'.') + divert + ⇒ + + Traditional implementations only supported ten diversions. But as a +GNU extension, diversion numbers can be as large as positive integers +will allow, rather than treating a multi-digit diversion number as a +request to discard text. + + divert(eval(`1<<28'))world + divert(`2')hello + ^D + ⇒hello + ⇒world + + Note that ‘divert’ is an English word, but also an active macro +without arguments. When processing plain text, the word might appear in +normal text and be unintentionally swallowed as a macro invocation. One +way to avoid this is to use the ‘-P’ option to rename all builtins +(*note Invoking m4: Operation modes.). Another is to write a wrapper +that requires a parameter to be recognized. + + We decided to divert the stream for irrigation. + ⇒We decided to the stream for irrigation. + define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') + ⇒ + divert(`-1') + Ignored text. + divert(`0') + ⇒ + We decided to divert the stream for irrigation. + ⇒We decided to divert the stream for irrigation. + + +File: m4.info, Node: Undivert, Next: Divnum, Prev: Divert, Up: Diversions + +10.2 Undiverting output +======================= + +Diverted text can be undiverted explicitly using the builtin ‘undivert’: + + -- Builtin: undivert ([DIVERSIONS...]) + Undiverts the numeric DIVERSIONS given by the arguments, in the + order given. If no arguments are supplied, all diversions are + undiverted, in numerical order. + + As a GNU extension, DIVERSIONS may contain non-numeric strings, + which are treated as the names of files to copy into the output + without expansion. A warning is issued if a file could not be + opened. + + The expansion of ‘undivert’ is void. + + divert(`1') + This text is diverted. + divert + ⇒ + This text is not diverted. + ⇒This text is not diverted. + undivert(`1') + ⇒ + ⇒This text is diverted. + ⇒ + + Notice the last two blank lines. One of them comes from the newline +following ‘undivert’, the other from the newline that followed the +‘divert’! A diversion often starts with a blank line like this. + + When diverted text is undiverted, it is _not_ reread by ‘m4’, but +rather copied directly to the current output, and it is therefore not an +error to undivert into a diversion. Undiverting the empty string is the +same as specifying diversion 0; in either case nothing happens since the +output has already been flushed. + + divert(`1')diverted text + divert + ⇒ + undivert() + ⇒ + undivert(`0') + ⇒ + undivert + ⇒diverted text + ⇒ + divert(`1')more + divert(`2')undivert(`1')diverted text`'divert + ⇒ + undivert(`1') + ⇒ + undivert(`2') + ⇒more + ⇒diverted text + + When a diversion has been undiverted, the diverted text is discarded, +and it is not possible to bring back diverted text more than once. + + divert(`1') + This text is diverted first. + divert(`0')undivert(`1')dnl + ⇒ + ⇒This text is diverted first. + undivert(`1') + ⇒ + divert(`1') + This text is also diverted but not appended. + divert(`0')undivert(`1')dnl + ⇒ + ⇒This text is also diverted but not appended. + + Attempts to undivert the current diversion are silently ignored. +Thus, when the current diversion is not 0, the current diversion does +not get rearranged among the other diversions. + + divert(`1')one + divert(`2')two + divert(`3')three + divert(`2')undivert`'dnl + divert`'undivert`'dnl + ⇒two + ⇒one + ⇒three + + GNU ‘m4’ allows named files to be undiverted. Given a non-numeric +argument, the contents of the file named will be copied, uninterpreted, +to the current output. This complements the builtin ‘include’ (*note +Include::). To illustrate the difference, assume the file ‘foo’ +contains: + + $ cat foo + bar + +then + + define(`bar', `BAR') + ⇒ + undivert(`foo') + ⇒bar + ⇒ + include(`foo') + ⇒BAR + ⇒ + + If the file is not found (or cannot be read), an error message is +issued, and the expansion is void. It is possible to intermix files and +diversion numbers. + + divert(`1')diversion one + divert(`2')undivert(`foo')dnl + divert(`3')diversion three + divert`'dnl + undivert(`1', `2', `foo', `3')dnl + ⇒diversion one + ⇒bar + ⇒bar + ⇒diversion three + + +File: m4.info, Node: Divnum, Next: Cleardivert, Prev: Undivert, Up: Diversions + +10.3 Diversion numbers +====================== + +The current diversion is tracked by the builtin ‘divnum’: + + -- Builtin: divnum + Expands to the number of the current diversion. + + Initial divnum + ⇒Initial 0 + divert(`1') + Diversion one: divnum + divert(`2') + Diversion two: divnum + ^D + ⇒ + ⇒Diversion one: 1 + ⇒ + ⇒Diversion two: 2 + + +File: m4.info, Node: Cleardivert, Prev: Divnum, Up: Diversions + +10.4 Discarding diverted text +============================= + +Often it is not known, when output is diverted, whether the diverted +text is actually needed. Since all non-empty diversion are brought back +on the main output stream when the end of input is seen, a method of +discarding a diversion is needed. If all diversions should be +discarded, the easiest is to end the input to ‘m4’ with ‘divert(`-1')’ +followed by an explicit ‘undivert’: + + divert(`1') + Diversion one: divnum + divert(`2') + Diversion two: divnum + divert(`-1') + undivert + ^D + +No output is produced at all. + + Clearing selected diversions can be done with the following macro: + + -- Composite: cleardivert ([DIVERSIONS...]) + Discard the contents of each of the listed numeric DIVERSIONS. + + define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') + ⇒ + + It is called just like ‘undivert’, but the effect is to clear the +diversions, given by the arguments. (This macro has a nasty bug! You +should try to see if you can find it and correct it; or *note Answers: +Improved cleardivert.). + + +File: m4.info, Node: Text handling, Next: Arithmetic, Prev: Diversions, Up: Top + +11 Macros for text handling +*************************** + +There are a number of builtins in ‘m4’ for manipulating text in various +ways, extracting substrings, searching, substituting, and so on. + +* Menu: + +* Len:: Calculating length of strings +* Index macro:: Searching for substrings +* Regexp:: Searching for regular expressions +* Substr:: Extracting substrings +* Translit:: Translating characters +* Patsubst:: Substituting text by regular expression +* Format:: Formatting strings (printf-like) + + +File: m4.info, Node: Len, Next: Index macro, Up: Text handling + +11.1 Calculating length of strings +================================== + +The length of a string can be calculated by ‘len’: + + -- Builtin: len (STRING) + Expands to the length of STRING, as a decimal number. + + The macro ‘len’ is recognized only with parameters. + + len() + ⇒0 + len(`abcdef') + ⇒6 + + +File: m4.info, Node: Index macro, Next: Regexp, Prev: Len, Up: Text handling + +11.2 Searching for substrings +============================= + +Searching for substrings is done with ‘index’: + + -- Builtin: index (STRING, SUBSTRING) + Expands to the index of the first occurrence of SUBSTRING in + STRING. The first character in STRING has index 0. If SUBSTRING + does not occur in STRING, ‘index’ expands to ‘-1’. + + The macro ‘index’ is recognized only with parameters. + + index(`gnus, gnats, and armadillos', `nat') + ⇒7 + index(`gnus, gnats, and armadillos', `dag') + ⇒-1 + + Omitting SUBSTRING evokes a warning, but still produces output; +contrast this with an empty SUBSTRING. + + index(`abc') + error→m4:stdin:1: Warning: too few arguments to builtin `index' + ⇒0 + index(`abc', `') + ⇒0 + index(`abc', `b') + ⇒1 + + +File: m4.info, Node: Regexp, Next: Substr, Prev: Index macro, Up: Text handling + +11.3 Searching for regular expressions +====================================== + +Searching for regular expressions is done with the builtin ‘regexp’: + + -- Builtin: regexp (STRING, REGEXP, [REPLACEMENT]) + Searches for REGEXP in STRING. The syntax for regular expressions + is the same as in GNU Emacs, which is similar to BRE, Basic Regular + Expressions in POSIX. *Note Syntax of Regular Expressions: + (emacs)Regexps. Support for ERE, Extended Regular Expressions is + not available, but will be added in GNU M4 2.0. + + If REPLACEMENT is omitted, ‘regexp’ expands to the index of the + first match of REGEXP in STRING. If REGEXP does not match anywhere + in STRING, it expands to -1. + + If REPLACEMENT is supplied, and there was a match, ‘regexp’ changes + the expansion to this argument, with ‘\N’ substituted by the text + matched by the Nth parenthesized sub-expression of REGEXP, up to + nine sub-expressions. The escape ‘\&’ is replaced by the text of + the entire regular expression matched. For all other characters, + ‘\’ treats the next character literally. A warning is issued if + there were fewer sub-expressions than the ‘\N’ requested, or if + there is a trailing ‘\’. If there was no match, ‘regexp’ expands + to the empty string. + + The macro ‘regexp’ is recognized only with parameters. + + regexp(`GNUs not Unix', `\<[a-z]\w+') + ⇒5 + regexp(`GNUs not Unix', `\a-c-a') + ⇒<;>abcba + translit(`abcdef', `aabdef', `bcged') + ⇒bgced + + In the ASCII encoding, the first example deletes all uppercase +letters, the second converts lowercase to uppercase, and the third +‘mirrors’ all uppercase letters, while converting them to lowercase. +The two first cases are by far the most common, even though they are not +portable to EBCDIC or other encodings. The fourth example shows a range +ending in ‘-’, as well as back-to-back ranges. The final example shows +that ‘a’ is mapped to ‘b’, not ‘c’; the resulting ‘b’ is not further +remapped to ‘g’; the ‘d’ and ‘e’ are swapped, and the ‘f’ is discarded. + + Omitting CHARS evokes a warning, but still produces output. + + translit(`abc') + error→m4:stdin:1: Warning: too few arguments to builtin `translit' + ⇒abc + + +File: m4.info, Node: Patsubst, Next: Format, Prev: Translit, Up: Text handling + +11.6 Substituting text by regular expression +============================================ + +Global substitution in a string is done by ‘patsubst’: + + -- Builtin: patsubst (STRING, REGEXP, [REPLACEMENT]) + Searches STRING for matches of REGEXP, and substitutes REPLACEMENT + for each match. The syntax for regular expressions is the same as + in GNU Emacs (*note Regexp::). + + The parts of STRING that are not covered by any match of REGEXP are + copied to the expansion. Whenever a match is found, the search + proceeds from the end of the match, so a character from STRING will + never be substituted twice. If REGEXP matches a string of zero + length, the start position for the search is incremented, to avoid + infinite loops. + + When a replacement is to be made, REPLACEMENT is inserted into the + expansion, with ‘\N’ substituted by the text matched by the Nth + parenthesized sub-expression of PATSUBST, for up to nine + sub-expressions. The escape ‘\&’ is replaced by the text of the + entire regular expression matched. For all other characters, ‘\’ + treats the next character literally. A warning is issued if there + were fewer sub-expressions than the ‘\N’ requested, or if there is + a trailing ‘\’. + + The REPLACEMENT argument can be omitted, in which case the text + matched by REGEXP is deleted. + + The macro ‘patsubst’ is recognized only with parameters. + + patsubst(`GNUs not Unix', `^', `OBS: ') + ⇒OBS: GNUs not Unix + patsubst(`GNUs not Unix', `\<', `OBS: ') + ⇒OBS: GNUs OBS: not OBS: Unix + patsubst(`GNUs not Unix', `\w*', `(\&)') + ⇒(GNUs)() (not)() (Unix)() + patsubst(`GNUs not Unix', `\w+', `(\&)') + ⇒(GNUs) (not) (Unix) + patsubst(`GNUs not Unix', `[A-Z][a-z]+') + ⇒GN not + patsubst(`GNUs not Unix', `not', `NOT\') + error→m4:stdin:6: Warning: trailing \ ignored in replacement + ⇒GNUs NOT Unix + + Here is a slightly more realistic example, which capitalizes +individual words or whole sentences, by substituting calls of the macros +‘upcase’ and ‘downcase’ into the strings. + + -- Composite: upcase (TEXT) + -- Composite: downcase (TEXT) + -- Composite: capitalize (TEXT) + Expand to TEXT, but with capitalization changed: ‘upcase’ changes + all letters to upper case, ‘downcase’ changes all letters to lower + case, and ‘capitalize’ changes the first character of each word to + upper case and the remaining characters to lower case. + + First, an example of their usage, using implementations distributed +in ‘m4-1.4.19/examples/capitalize.m4’. + + $ m4 -I examples + include(`capitalize.m4') + ⇒ + upcase(`GNUs not Unix') + ⇒GNUS NOT UNIX + downcase(`GNUs not Unix') + ⇒gnus not unix + capitalize(`GNUs not Unix') + ⇒Gnus Not Unix + + Now for the implementation. There is a helper macro ‘_capitalize’ +which puts only its first word in mixed case. Then ‘capitalize’ merely +parses out the words, and replaces them with an invocation of +‘_capitalize’. (As presented here, the ‘capitalize’ macro has some +subtle flaws. You should try to see if you can find and correct them; +or *note Answers: Improved capitalize.). + + $ m4 -I examples + undivert(`capitalize.m4')dnl + ⇒divert(`-1') + ⇒# upcase(text) + ⇒# downcase(text) + ⇒# capitalize(text) + ⇒# change case of text, simple version + ⇒define(`upcase', `translit(`$*', `a-z', `A-Z')') + ⇒define(`downcase', `translit(`$*', `A-Z', `a-z')') + ⇒define(`_capitalize', + ⇒ `regexp(`$1', `^\(\w\)\(\w*\)', + ⇒ `upcase(`\1')`'downcase(`\2')')') + ⇒define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') + ⇒divert`'dnl + + While ‘regexp’ replaces the whole input with the replacement as soon +as there is a match, ‘patsubst’ replaces each _occurrence_ of a match +and preserves non-matching pieces: + + define(`patreg', + `patsubst($@) + regexp($@)')dnl + patreg(`bar foo baz Foo', `foo\|Foo', `FOO') + ⇒bar FOO baz FOO + ⇒FOO + patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') + ⇒bab abb 212 + ⇒bab + + Omitting REGEXP evokes a warning, but still produces output; contrast +this with an empty REGEXP argument. + + patsubst(`abc') + error→m4:stdin:1: Warning: too few arguments to builtin `patsubst' + ⇒abc + patsubst(`abc', `') + ⇒abc + patsubst(`abc', `', `\\-') + ⇒\-a\-b\-c\- + + +File: m4.info, Node: Format, Prev: Patsubst, Up: Text handling + +11.7 Formatting strings (printf-like) +===================================== + +Formatted output can be made with ‘format’: + + -- Builtin: format (FORMAT-STRING, ...) + Works much like the C function ‘printf’. The first argument + FORMAT-STRING can contain ‘%’ specifications which are satisfied by + additional arguments, and the expansion of ‘format’ is the + formatted string. + + The macro ‘format’ is recognized only with parameters. + + Its use is best described by a few examples: + + define(`foo', `The brown fox jumped over the lazy dog') + ⇒ + format(`The string "%s" uses %d characters', foo, len(foo)) + ⇒The string "The brown fox jumped over the lazy dog" uses 38 characters + format(`%*.*d', `-1', `-1', `1') + ⇒1 + format(`%.0f', `56789.9876') + ⇒56790 + len(format(`%-*X', `5000', `1')) + ⇒5000 + ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) + ⇒success + ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) + ⇒success + format(`%g', `0xa.P+1') + ⇒20 + + Using the ‘forloop’ macro defined earlier (*note Forloop::), this +example shows how ‘format’ can be used to produce tabular output. + + $ m4 -I examples + include(`forloop.m4') + ⇒ + forloop(`i', `1', `10', `format(`%6d squared is %10d + ', i, eval(i**2))') + ⇒ 1 squared is 1 + ⇒ 2 squared is 4 + ⇒ 3 squared is 9 + ⇒ 4 squared is 16 + ⇒ 5 squared is 25 + ⇒ 6 squared is 36 + ⇒ 7 squared is 49 + ⇒ 8 squared is 64 + ⇒ 9 squared is 81 + ⇒ 10 squared is 100 + ⇒ + + The builtin ‘format’ is modeled after the ANSI C ‘printf’ function, +and supports these ‘%’ specifiers: ‘c’, ‘s’, ‘d’, ‘o’, ‘x’, ‘X’, ‘u’, +‘a’, ‘A’, ‘e’, ‘E’, ‘f’, ‘F’, ‘g’, ‘G’, and ‘%’; it supports field +widths and precisions, and the flags ‘+’, ‘-’, ‘ ’, ‘0’, ‘#’, and ‘'’. +For integer specifiers, the width modifiers ‘hh’, ‘h’, and ‘l’ are +recognized, and for floating point specifiers, the width modifier ‘l’ is +recognized. Items not yet supported include positional arguments, the +‘n’, ‘p’, ‘S’, and ‘C’ specifiers, the ‘z’, ‘t’, ‘j’, ‘L’ and ‘ll’ +modifiers, and any platform extensions available in the native ‘printf’. +For more details on the functioning of ‘printf’, see the C Library +Manual, or the POSIX specification (for example, ‘%a’ is supported even +on platforms that haven’t yet implemented C99 hexadecimal floating point +output natively). + + Unrecognized specifiers result in a warning. It is anticipated that +a future release of GNU ‘m4’ will support more specifiers, and give +better warnings when various problems such as overflow are encountered. +Likewise, escape sequences are not yet recognized. + + format(`%p', `0') + error→m4:stdin:1: Warning: unrecognized specifier in `%p' + ⇒ + + +File: m4.info, Node: Arithmetic, Next: Shell commands, Prev: Text handling, Up: Top + +12 Macros for doing arithmetic +****************************** + +Integer arithmetic is included in ‘m4’, with a C-like syntax. As +convenient shorthands, there are builtins for simple increment and +decrement operations. + +* Menu: + +* Incr:: Decrement and increment operators +* Eval:: Evaluating integer expressions + + +File: m4.info, Node: Incr, Next: Eval, Up: Arithmetic + +12.1 Decrement and increment operators +====================================== + +Increment and decrement of integers are supported using the builtins +‘incr’ and ‘decr’: + + -- Builtin: incr (NUMBER) + -- Builtin: decr (NUMBER) + Expand to the numerical value of NUMBER, incremented or + decremented, respectively, by one. Except for the empty string, + the expansion is empty if NUMBER could not be parsed. + + The macros ‘incr’ and ‘decr’ are recognized only with parameters. + + incr(`4') + ⇒5 + decr(`7') + ⇒6 + incr() + error→m4:stdin:3: empty string treated as 0 in builtin `incr' + ⇒1 + decr() + error→m4:stdin:4: empty string treated as 0 in builtin `decr' + ⇒-1 + + +File: m4.info, Node: Eval, Prev: Incr, Up: Arithmetic + +12.2 Evaluating integer expressions +=================================== + +Integer expressions are evaluated with ‘eval’: + + -- Builtin: eval (EXPRESSION, [RADIX = ‘10’], [WIDTH]) + Expands to the value of EXPRESSION. The expansion is empty if a + problem is encountered while parsing the arguments. If specified, + RADIX and WIDTH control the format of the output. + + Calculations are done with 32-bit signed numbers. Overflow + silently results in wraparound. A warning is issued if division by + zero is attempted, or if EXPRESSION could not be parsed. + + Expressions can contain the following operators, listed in order of + decreasing precedence. + + ‘()’ + Parentheses + ‘+ - ~ !’ + Unary plus and minus, and bitwise and logical negation + ‘**’ + Exponentiation + ‘* / %’ + Multiplication, division, and modulo + ‘+ -’ + Addition and subtraction + ‘<< >>’ + Shift left or right + ‘> >= < <=’ + Relational operators + ‘== !=’ + Equality operators + ‘&’ + Bitwise and + ‘^’ + Bitwise exclusive-or + ‘|’ + Bitwise or + ‘&&’ + Logical and + ‘||’ + Logical or + + The macro ‘eval’ is recognized only with parameters. + + All binary operators, except exponentiation, are left associative. C +operators that perform variable assignment, such as ‘+=’ or ‘--’, are +not implemented, since ‘eval’ only operates on constants, not variables. +Attempting to use them results in an error. However, since traditional +implementations treated ‘=’ as an undocumented alias for ‘==’ as opposed +to an assignment operator, this usage is supported as a special case. +Be aware that a future version of GNU M4 may support assignment +semantics as an extension when POSIX mode is not requested, and that +using ‘=’ to check equality is not portable. + + eval(`2 = 2') + error→m4:stdin:1: Warning: recommend ==, not =, for equality operator + ⇒1 + eval(`++0') + error→m4:stdin:2: invalid operator in eval: ++0 + ⇒ + eval(`0 |= 1') + error→m4:stdin:3: invalid operator in eval: 0 |= 1 + ⇒ + + Note that some older ‘m4’ implementations use ‘^’ as an alternate +operator for the exponentiation, although POSIX requires the C behavior +of bitwise exclusive-or. The precedence of the negation operators, ‘~’ +and ‘!’, was traditionally lower than equality. The unary operators +could not be used reliably more than once on the same term without +intervening parentheses. The traditional precedence of the equality +operators ‘==’ and ‘!=’ was identical instead of lower than the +relational operators such as ‘<’, even through GNU M4 1.4.8. Starting +with version 1.4.9, GNU M4 correctly follows POSIX precedence rules. M4 +scripts designed to be portable between releases must be aware that +parentheses may be required to enforce C precedence rules. Likewise, +division by zero, even in the unused branch of a short-circuiting +operator, is not always well-defined in other implementations. + + Following are some examples where the current version of M4 follows C +precedence rules, but where older versions and some other +implementations of ‘m4’ require explicit parentheses to get the correct +result: + + eval(`1 == 2 > 0') + ⇒1 + eval(`(1 == 2) > 0') + ⇒0 + eval(`! 0 * 2') + ⇒2 + eval(`! (0 * 2)') + ⇒1 + eval(`1 | 1 ^ 1') + ⇒1 + eval(`(1 | 1) ^ 1') + ⇒0 + eval(`+ + - ~ ! ~ 0') + ⇒1 + eval(`2 || 1 / 0') + ⇒1 + eval(`0 || 1 / 0') + error→m4:stdin:9: divide by zero in eval: 0 || 1 / 0 + ⇒ + eval(`0 && 1 % 0') + ⇒0 + eval(`2 && 1 % 0') + error→m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 + ⇒ + + As a GNU extension, the operator ‘**’ performs integral +exponentiation. The operator is right-associative, and if evaluated, +the exponent must be non-negative, and at least one of the arguments +must be non-zero, or a warning is issued. + + eval(`2 ** 3 ** 2') + ⇒512 + eval(`(2 ** 3) ** 2') + ⇒64 + eval(`0 ** 1') + ⇒0 + eval(`2 ** 0') + ⇒1 + eval(`0 ** 0') + ⇒ + error→m4:stdin:5: divide by zero in eval: 0 ** 0 + eval(`4 ** -2') + error→m4:stdin:6: negative exponent in eval: 4 ** -2 + ⇒ + + Within EXPRESSION, (but not RADIX or WIDTH), numbers without a +special prefix are decimal. A simple ‘0’ prefix introduces an octal +number. ‘0x’ introduces a hexadecimal number. As GNU extensions, ‘0b’ +introduces a binary number. ‘0r’ introduces a number expressed in any +radix between 1 and 36: the prefix should be immediately followed by the +decimal expression of the radix, a colon, then the digits making the +number. For radix 1, leading zeros are ignored, and all remaining +digits must be ‘1’; for all other radices, the digits are ‘0’, ‘1’, ‘2’, +.... Beyond ‘9’, the digits are ‘a’, ‘b’ ... up to ‘z’. Lower and +upper case letters can be used interchangeably in numbers prefixes and +as number digits. + + Parentheses may be used to group subexpressions whenever needed. For +the relational operators, a true relation returns ‘1’, and a false +relation return ‘0’. + + Here are a few examples of use of ‘eval’. + + eval(`-3 * 5') + ⇒-15 + eval(`-99 / 10') + ⇒-9 + eval(`-99 % 10') + ⇒-9 + eval(`99 % -10') + ⇒9 + eval(index(`Hello world', `llo') >= 0) + ⇒1 + eval(`0r1:0111 + 0b100 + 0r3:12') + ⇒12 + define(`square', `eval(`($1) ** 2')') + ⇒ + square(`9') + ⇒81 + square(square(`5')` + 1') + ⇒676 + define(`foo', `666') + ⇒ + eval(`foo / 6') + error→m4:stdin:11: bad expression in eval: foo / 6 + ⇒ + eval(foo / 6) + ⇒111 + + As the last two lines show, ‘eval’ does not handle macro names, even +if they expand to a valid expression (or part of a valid expression). +Therefore all macros must be expanded before they are passed to ‘eval’. + + Some calculations are not portable to other implementations, since +they have undefined semantics in C, but GNU ‘m4’ has well-defined +behavior on overflow. When shifting, an out-of-range shift amount is +implicitly brought into the range of 32-bit signed integers using an +implicit bit-wise and with 0x1f). + + define(`max_int', eval(`0x7fffffff')) + ⇒ + define(`min_int', incr(max_int)) + ⇒ + eval(min_int` < 0') + ⇒1 + eval(max_int` > 0') + ⇒1 + ifelse(eval(min_int` / -1'), min_int, `overflow occurred') + ⇒overflow occurred + min_int + ⇒-2147483648 + eval(`0x80000000 % -1') + ⇒0 + eval(`-4 >> 1') + ⇒-2 + eval(`-4 >> 33') + ⇒-2 + + If RADIX is specified, it specifies the radix to be used in the +expansion. The default radix is 10; this is also the case if RADIX is +the empty string. A warning results if the radix is outside the range +of 1 through 36, inclusive. The result of ‘eval’ is always taken to be +signed. No radix prefix is output, and for radices greater than 10, the +digits are lower case. The WIDTH argument specifies the minimum output +width, excluding any negative sign. The result is zero-padded to extend +the expansion to the requested width. A warning results if the width is +negative. If RADIX or WIDTH is out of bounds, the expansion of ‘eval’ +is empty. + + eval(`666', `10') + ⇒666 + eval(`666', `11') + ⇒556 + eval(`666', `6') + ⇒3030 + eval(`666', `6', `10') + ⇒0000003030 + eval(`-666', `6', `10') + ⇒-0000003030 + eval(`10', `', `0') + ⇒10 + `0r1:'eval(`10', `1', `11') + ⇒0r1:01111111111 + eval(`10', `16') + ⇒a + eval(`1', `37') + error→m4:stdin:9: radix 37 in builtin `eval' out of range + ⇒ + eval(`1', , `-1') + error→m4:stdin:10: negative width to builtin `eval' + ⇒ + eval() + error→m4:stdin:11: empty string treated as 0 in builtin `eval' + ⇒0 + + +File: m4.info, Node: Shell commands, Next: Miscellaneous, Prev: Arithmetic, Up: Top + +13 Macros for running shell commands +************************************ + +There are a few builtin macros in ‘m4’ that allow you to run shell +commands from within ‘m4’. + + Note that the definition of a valid shell command is system +dependent. On UNIX systems, this is the typical ‘/bin/sh’. But on +other systems, such as native Windows, the shell has a different syntax +of commands that it understands. Some examples in this chapter assume +‘/bin/sh’, and also demonstrate how to quit early with a known exit +value if this is not the case. + +* Menu: + +* Platform macros:: Determining the platform +* Syscmd:: Executing simple commands +* Esyscmd:: Reading the output of commands +* Sysval:: Exit status +* Mkstemp:: Making temporary files + + +File: m4.info, Node: Platform macros, Next: Syscmd, Up: Shell commands + +13.1 Determining the platform +============================= + +Sometimes it is desirable for an input file to know which platform ‘m4’ +is running on. GNU ‘m4’ provides several macros that are predefined to +expand to the empty string; checking for their existence will confirm +platform details. + + -- Optional builtin: __gnu__ + -- Optional builtin: __os2__ + -- Optional builtin: os2 + -- Optional builtin: __unix__ + -- Optional builtin: unix + -- Optional builtin: __windows__ + -- Optional builtin: windows + Each of these macros is conditionally defined as needed to describe + the environment of ‘m4’. If defined, each macro expands to the + empty string. For now, these macros silently ignore all arguments, + but in a future release of M4, they might warn if arguments are + present. + + When GNU extensions are in effect (that is, when you did not use the +‘-G’ option, *note Invoking m4: Limits control.), GNU ‘m4’ will define +the macro ‘__gnu__’ to expand to the empty string. + + $ m4 + __gnu__ + ⇒ + __gnu__(`ignored') + ⇒ + Extensions are ifdef(`__gnu__', `active', `inactive') + ⇒Extensions are active + + $ m4 -G + __gnu__ + ⇒__gnu__ + __gnu__(`ignored') + ⇒__gnu__(ignored) + Extensions are ifdef(`__gnu__', `active', `inactive') + ⇒Extensions are inactive + + On UNIX systems, GNU ‘m4’ will define ‘__unix__’ by default, or +‘unix’ when the ‘-G’ option is specified. + + On native Windows systems, GNU ‘m4’ will define ‘__windows__’ by +default, or ‘windows’ when the ‘-G’ option is specified. + + On OS/2 systems, GNU ‘m4’ will define ‘__os2__’ by default, or ‘os2’ +when the ‘-G’ option is specified. + + If GNU ‘m4’ does not provide a platform macro for your system, please +report that as a bug. + + define(`provided', `0') + ⇒ + ifdef(`__unix__', `define(`provided', incr(provided))') + ⇒ + ifdef(`__windows__', `define(`provided', incr(provided))') + ⇒ + ifdef(`__os2__', `define(`provided', incr(provided))') + ⇒ + provided + ⇒1 + + +File: m4.info, Node: Syscmd, Next: Esyscmd, Prev: Platform macros, Up: Shell commands + +13.2 Executing simple commands +============================== + +Any shell command can be executed, using ‘syscmd’: + + -- Builtin: syscmd (SHELL-COMMAND) + Executes SHELL-COMMAND as a shell command. + + The expansion of ‘syscmd’ is void, _not_ the output from + SHELL-COMMAND! Output or error messages from SHELL-COMMAND are not + read by ‘m4’. *Note Esyscmd::, if you need to process the command + output. + + Prior to executing the command, ‘m4’ flushes its buffers. The + default standard input, output and error of SHELL-COMMAND are the + same as those of ‘m4’. + + By default, the SHELL-COMMAND will be used as the argument to the + ‘-c’ option of the ‘/bin/sh’ shell (or the version of ‘sh’ + specified by ‘command -p getconf PATH’, if your system supports + that). If you prefer a different shell, the ‘configure’ script can + be given the option ‘--with-syscmd-shell=LOCATION’ to set the + location of an alternative shell at GNU ‘m4’ installation; the + alternative shell must still support ‘-c’. + + The macro ‘syscmd’ is recognized only with parameters. + + define(`foo', `FOO') + ⇒ + syscmd(`echo foo') + ⇒foo + ⇒ + + Note how the expansion of ‘syscmd’ keeps the trailing newline of the +command, as well as using the newline that appeared after the macro. + + The following is an example of SHELL-COMMAND using the same standard +input as ‘m4’: + + $ echo "m4wrap(\`syscmd(\`cat')')" | m4 + ⇒ + + It tells ‘m4’ to read all of its input before executing the wrapped +text, then hand a valid (albeit emptied) pipe as standard input for the +‘cat’ subcommand. Therefore, you should be careful when using standard +input (either by specifying no files, or by passing ‘-’ as a file name +on the command line, *note Invoking m4: Command line files.), and also +invoking subcommands via ‘syscmd’ or ‘esyscmd’ that consume data from +standard input. When standard input is a seekable file, the subprocess +will pick up with the next character not yet processed by ‘m4’; when it +is a pipe or other non-seekable file, there is no guarantee how much +data will already be buffered by ‘m4’ and thus unavailable to the child. + + +File: m4.info, Node: Esyscmd, Next: Sysval, Prev: Syscmd, Up: Shell commands + +13.3 Reading the output of commands +=================================== + +If you want ‘m4’ to read the output of a shell command, use ‘esyscmd’: + + -- Builtin: esyscmd (SHELL-COMMAND) + Expands to the standard output of the shell command SHELL-COMMAND. + + Prior to executing the command, ‘m4’ flushes its buffers. The + default standard input and standard error of SHELL-COMMAND are the + same as those of ‘m4’. The error output of SHELL-COMMAND is not a + part of the expansion: it will appear along with the error output + of ‘m4’. + + By default, the SHELL-COMMAND will be used as the argument to the + ‘-c’ option of the ‘/bin/sh’ shell (or the version of ‘sh’ + specified by ‘command -p getconf PATH’, if your system supports + that). If you prefer a different shell, the ‘configure’ script can + be given the option ‘--with-syscmd-shell=LOCATION’ to set the + location of an alternative shell at GNU ‘m4’ installation; the + alternative shell must still support ‘-c’. + + The macro ‘esyscmd’ is recognized only with parameters. + + define(`foo', `FOO') + ⇒ + esyscmd(`echo foo') + ⇒FOO + ⇒ + + Note how the expansion of ‘esyscmd’ keeps the trailing newline of the +command, as well as using the newline that appeared after the macro. + + Just as with ‘syscmd’, care must be exercised when sharing standard +input between ‘m4’ and the child process of ‘esyscmd’. + + +File: m4.info, Node: Sysval, Next: Mkstemp, Prev: Esyscmd, Up: Shell commands + +13.4 Exit status +================ + +To see whether a shell command succeeded, use ‘sysval’: + + -- Builtin: sysval + Expands to the exit status of the last shell command run with + ‘syscmd’ or ‘esyscmd’. Expands to 0 if no command has been run + yet. + + sysval + ⇒0 + syscmd(`false') + ⇒ + ifelse(sysval, `0', `zero', `non-zero') + ⇒non-zero + syscmd(`exit 2') + ⇒ + sysval + ⇒2 + syscmd(`true') + ⇒ + sysval + ⇒0 + esyscmd(`false') + ⇒ + ifelse(sysval, `0', `zero', `non-zero') + ⇒non-zero + esyscmd(`echo dnl && exit 127') + ⇒ + sysval + ⇒127 + esyscmd(`true') + ⇒ + sysval + ⇒0 + + ‘sysval’ results in 127 if there was a problem executing the command, +for example, if the system-imposed argument length is exceeded, or if +there were not enough resources to fork. It is not possible to +distinguish between failed execution and successful execution that had +an exit status of 127, unless there was output from the child process. + + On UNIX platforms, where it is possible to detect when command +execution is terminated by a signal, rather than a normal exit, the +result is the signal number shifted left by eight bits. + + dnl This test assumes kill is a shell builtin, and that signals are + dnl recognizable. + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl + changequote(`[', `]') + ⇒ + syscmd([/bin/sh -c 'kill -9 $$'; st=$?; test $st = 137 || test $st = 265]) + ⇒ + ifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9 + ])m4exit([77])])dnl + syscmd([kill -9 $$]) + ⇒ + sysval + ⇒2304 + syscmd() + ⇒ + sysval + ⇒0 + esyscmd([kill -9 $$]) + ⇒ + sysval + ⇒2304 + + +File: m4.info, Node: Mkstemp, Prev: Sysval, Up: Shell commands + +13.5 Making temporary files +=========================== + +Commands specified to ‘syscmd’ or ‘esyscmd’ might need a temporary file, +for output or for some other purpose. There is a builtin macro, +‘mkstemp’, for making a temporary file: + + -- Builtin: mkstemp (TEMPLATE) + -- Builtin: maketemp (TEMPLATE) + Expands to the quoted name of a new, empty file, made from the + string TEMPLATE, which should end with the string ‘XXXXXX’. The + six ‘X’ characters are then replaced with random characters + matching the regular expression ‘[a-zA-Z0-9._-]’, in order to make + the file name unique. If fewer than six ‘X’ characters are found + at the end of ‘template’, the result will be longer than the + template. The created file will have access permissions as if by + ‘chmod =rw,go=’, meaning that the current umask of the ‘m4’ process + is taken into account, and at most only the current user can read + and write the file. + + The traditional behavior, standardized by POSIX, is that ‘maketemp’ + merely replaces the trailing ‘X’ with the process id, without + creating a file or quoting the expansion, and without ensuring that + the resulting string is a unique file name. In part, this means + that using the same TEMPLATE twice in the same input file will + result in the same expansion. This behavior is a security hole, as + it is very easy for another process to guess the name that will be + generated, and thus interfere with a subsequent use of ‘syscmd’ + trying to manipulate that file name. Hence, POSIX has recommended + that all new implementations of ‘m4’ provide the secure ‘mkstemp’ + builtin, and that users of ‘m4’ check for its existence. + + The expansion is void and an error issued if a temporary file could + not be created. + + The macros ‘mkstemp’ and ‘maketemp’ are recognized only with + parameters. + + If you try this next example, you will most likely get different +output for the two file names, since the replacement characters are +randomly chosen: + + $ m4 + define(`tmp', `oops') + ⇒ + maketemp(`/tmp/fooXXXXXX') + ⇒/tmp/fooa07346 + ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', + `define(`mkstemp', defn(`maketemp'))dnl + errprint(`warning: potentially insecure maketemp implementation + ')') + ⇒ + mkstemp(`doc') + ⇒docQv83Uw + + Unless you use the ‘--traditional’ command line option (or ‘-G’, +*note Invoking m4: Limits control.), the GNU version of ‘maketemp’ is +secure. This means that using the same template to multiple calls will +generate multiple files. However, we recommend that you use the new +‘mkstemp’ macro, introduced in GNU M4 1.4.8, which is secure even in +traditional mode. Also, as of M4 1.4.11, the secure implementation +quotes the resulting file name, so that you are guaranteed to know what +file was created even if the random file name happens to match an +existing macro. Notice that this example is careful to use ‘defn’ to +avoid unintended expansion of ‘foo’. + + $ m4 + define(`foo', `errprint(`oops')') + ⇒ + syscmd(`rm -f foo-??????')sysval + ⇒0 + define(`file1', maketemp(`foo-XXXXXX'))dnl + ifelse(esyscmd(`echo \` foo-?????? \''), ` foo-?????? ', + `no file', `created') + ⇒created + define(`file2', maketemp(`foo-XX'))dnl + define(`file3', mkstemp(`foo-XXXXXX'))dnl + ifelse(len(defn(`file1')), len(defn(`file2')), + `same length', `different') + ⇒same length + ifelse(defn(`file1'), defn(`file2'), `same', `different file') + ⇒different file + ifelse(defn(`file2'), defn(`file3'), `same', `different file') + ⇒different file + ifelse(defn(`file1'), defn(`file3'), `same', `different file') + ⇒different file + syscmd(`rm 'defn(`file1') defn(`file2') defn(`file3')) + ⇒ + sysval + ⇒0 + + +File: m4.info, Node: Miscellaneous, Next: Frozen files, Prev: Shell commands, Up: Top + +14 Miscellaneous builtin macros +******************************* + +This chapter describes various builtins, that do not really belong in +any of the previous chapters. + +* Menu: + +* Errprint:: Printing error messages +* Location:: Printing current location +* M4exit:: Exiting from ‘m4’ + + +File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous + +14.1 Printing error messages +============================ + +You can print error messages using ‘errprint’: + + -- Builtin: errprint (MESSAGE, ...) + Prints MESSAGE and the rest of the arguments to standard error, + separated by spaces. Standard error is used, regardless of the + ‘--debugfile’ option (*note Invoking m4: Debugging options.). + + The expansion of ‘errprint’ is void. The macro ‘errprint’ is + recognized only with parameters. + + errprint(`Invalid arguments to forloop + ') + error→Invalid arguments to forloop + ⇒ + errprint(`1')errprint(`2',`3 + ') + error→12 3 + ⇒ + + A trailing newline is _not_ printed automatically, so it should be +supplied as part of the argument, as in the example. Unfortunately, the +exact output of ‘errprint’ is not very portable to other ‘m4’ +implementations: POSIX requires that all arguments be printed, but some +implementations of ‘m4’ only print the first. Furthermore, some BSD +implementations always append a newline for each ‘errprint’ call, +regardless of whether the last argument already had one, and POSIX is +silent on whether this is acceptable. + + +File: m4.info, Node: Location, Next: M4exit, Prev: Errprint, Up: Miscellaneous + +14.2 Printing current location +============================== + +To make it possible to specify the location of an error, three utility +builtins exist: + + -- Builtin: __file__ + -- Builtin: __line__ + -- Builtin: __program__ + Expand to the quoted name of the current input file, the current + input line number in that file, and the quoted name of the current + invocation of ‘m4’. + + errprint(__program__:__file__:__line__: `input error + ') + error→m4:stdin:1: input error + ⇒ + + Line numbers start at 1 for each file. If the file was found due to +the ‘-I’ option or ‘M4PATH’ environment variable, that is reflected in +the file name. The syncline option (‘-s’, *note Invoking m4: +Preprocessor features.), and the ‘f’ and ‘l’ flags of ‘debugmode’ (*note +Debug Levels::), also use this notion of current file and line. +Redefining the three location macros has no effect on syncline, debug, +warning, or error message output. + + This example reuses the file ‘incl.m4’ mentioned earlier (*note +Include::): + + $ m4 -I examples + define(`foo', ``$0' called at __file__:__line__') + ⇒ + foo + ⇒foo called at stdin:2 + include(`incl.m4') + ⇒Include file start + ⇒foo called at examples/incl.m4:2 + ⇒Include file end + ⇒ + + The location of macros invoked during the rescanning of macro +expansion text corresponds to the location in the file where the +expansion was triggered, regardless of how many newline characters the +expansion text contains. As of GNU M4 1.4.8, the location of text +wrapped with ‘m4wrap’ (*note M4wrap::) is the point at which the +‘m4wrap’ was invoked. Previous versions, however, behaved as though +wrapped text came from line 0 of the file “”. + + define(`echo', `$@') + ⇒ + define(`foo', `echo(__line__ + __line__)') + ⇒ + echo(__line__ + __line__) + ⇒4 + ⇒5 + m4wrap(`foo + ') + ⇒ + foo(errprint(__line__ + __line__ + )) + error→8 + error→9 + ⇒8 + ⇒8 + __line__ + ⇒11 + m4wrap(`__line__ + ') + ⇒ + ^D + ⇒12 + ⇒6 + ⇒6 + + The ‘__program__’ macro behaves like ‘$0’ in shell terminology. If +you invoke ‘m4’ through an absolute path or a link with a different +spelling, rather than by relying on a ‘PATH’ search for plain ‘m4’, it +will affect how ‘__program__’ expands. The intent is that you can use +it to produce error messages with the same formatting that ‘m4’ produces +internally. It can also be used within ‘syscmd’ (*note Syscmd::) to +pick the same version of ‘m4’ that is currently running, rather than +whatever version of ‘m4’ happens to be first in ‘PATH’. It was first +introduced in GNU M4 1.4.6. + + +File: m4.info, Node: M4exit, Prev: Location, Up: Miscellaneous + +14.3 Exiting from ‘m4’ +====================== + +If you need to exit from ‘m4’ before the entire input has been read, you +can use ‘m4exit’: + + -- Builtin: m4exit ([CODE = ‘0’]) + Causes ‘m4’ to exit, with exit status CODE. If CODE is left out, + the exit status is zero. If CODE cannot be parsed, or is outside + the range of 0 to 255, the exit status is one. No further input is + read, and all wrapped and diverted text is discarded. + + m4wrap(`This text is lost due to `m4exit'.') + ⇒ + divert(`1') So is this. + divert + ⇒ + m4exit And this is never read. + + A common use of this is to abort processing: + + -- Composite: fatal_error (MESSAGE) + Abort processing with an error message and non-zero status. Prefix + MESSAGE with details about where the error occurred, and print the + resulting string to standard error. + + define(`fatal_error', + `errprint(__program__:__file__:__line__`: fatal error: $* + ')m4exit(`1')') + ⇒ + fatal_error(`this is a BAD one, buster') + error→m4:stdin:4: fatal error: this is a BAD one, buster + + After this macro call, ‘m4’ will exit with exit status 1. This macro +is only intended for error exits, since the normal exit procedures are +not followed, i.e., diverted text is not undiverted, and saved text +(*note M4wrap::) is not reread. (This macro could be made more robust +to earlier versions of ‘m4’. You should try to see if you can find +weaknesses and correct them; or *note Answers: Improved fatal_error.). + + Note that it is still possible for the exit status to be different +than what was requested by ‘m4exit’. If ‘m4’ detects some other error, +such as a write error on standard output, the exit status will be +non-zero even if ‘m4exit’ requested zero. + + If standard input is seekable, then the file will be positioned at +the next unread character. If it is a pipe or other non-seekable file, +then there are no guarantees how much data ‘m4’ might have read into +buffers, and thus discarded. + + +File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top + +15 Fast loading of frozen state +******************************* + +Some bigger ‘m4’ applications may be built over a common base containing +hundreds of definitions and other costly initializations. Usually, the +common base is kept in one or more declarative files, which files are +listed on each ‘m4’ invocation prior to the user’s input file, or else +each input file uses ‘include’. + + Reading the common base of a big application, over and over again, +may be time consuming. GNU ‘m4’ offers some machinery to speed up the +start of an application using lengthy common bases. + +* Menu: + +* Using frozen files:: Using frozen files +* Frozen file format:: Frozen file format + + +File: m4.info, Node: Using frozen files, Next: Frozen file format, Up: Frozen files + +15.1 Using frozen files +======================= + +Suppose a user has a library of ‘m4’ initializations in ‘base.m4’, which +is then used with multiple input files: + + $ m4 base.m4 input1.m4 + $ m4 base.m4 input2.m4 + $ m4 base.m4 input3.m4 + + Rather than spending time parsing the fixed contents of ‘base.m4’ +every time, the user might rather execute: + + $ m4 -F base.m4f base.m4 + +once, and further execute, as often as needed: + + $ m4 -R base.m4f input1.m4 + $ m4 -R base.m4f input2.m4 + $ m4 -R base.m4f input3.m4 + +with the varying input. The first call, containing the ‘-F’ option, +only reads and executes file ‘base.m4’, defining various application +macros and computing other initializations. Once the input file +‘base.m4’ has been completely processed, GNU ‘m4’ produces in ‘base.m4f’ +a “frozen” file, that is, a file which contains a kind of snapshot of +the ‘m4’ internal state. + + Later calls, containing the ‘-R’ option, are able to reload the +internal state of ‘m4’, from ‘base.m4f’, _prior_ to reading any other +input files. This means instead of starting with a virgin copy of ‘m4’, +input will be read after having effectively recovered the effect of a +prior run. In our example, the effect is the same as if file ‘base.m4’ +has been read anew. However, this effect is achieved a lot faster. + + Only one frozen file may be created or read in any one ‘m4’ +invocation. It is not possible to recover two frozen files at once. +However, frozen files may be updated incrementally, through using ‘-R’ +and ‘-F’ options simultaneously. For example, if some care is taken, +the command: + + $ m4 file1.m4 file2.m4 file3.m4 file4.m4 + +could be broken down in the following sequence, accumulating the same +output: + + $ m4 -F file1.m4f file1.m4 + $ m4 -R file1.m4f -F file2.m4f file2.m4 + $ m4 -R file2.m4f -F file3.m4f file3.m4 + $ m4 -R file3.m4f file4.m4 + + Some care is necessary because not every effort has been made for +this to work in all cases. In particular, the trace attribute of macros +is not handled, nor the current setting of ‘changeword’. Currently, +‘m4wrap’ and ‘sysval’ also have problems. Also, interactions for some +options of ‘m4’, being used in one call and not in the next, have not +been fully analyzed yet. On the other end, you may be confident that +stacks of ‘pushdef’ definitions are handled correctly, as well as +undefined or renamed builtins, and changed strings for quotes or +comments. And future releases of GNU M4 will improve on the utility of +frozen files. + + When an ‘m4’ run is to be frozen, the automatic undiversion which +takes place at end of execution is inhibited. Instead, all positively +numbered diversions are saved into the frozen file. The active +diversion number is also transmitted. + + A frozen file to be reloaded need not reside in the current +directory. It is looked up the same way as an ‘include’ file (*note +Search Path::). + + If the frozen file was generated with a newer version of ‘m4’, and +contains directives that an older ‘m4’ cannot parse, attempting to load +the frozen file with option ‘-R’ will cause ‘m4’ to exit with status 63 +to indicate version mismatch. + + +File: m4.info, Node: Frozen file format, Prev: Using frozen files, Up: Frozen files + +15.2 Frozen file format +======================= + +Frozen files are sharable across architectures. It is safe to write a +frozen file on one machine and read it on another, given that the second +machine uses the same or newer version of GNU ‘m4’. It is conventional, +but not required, to give a frozen file the suffix of ‘.m4f’. + + These are simple (editable) text files, made up of directives, each +starting with a capital letter and ending with a newline (). +Wherever a directive is expected, the character ‘#’ introduces a comment +line; empty lines are also ignored if they are not part of an embedded +string. In the following descriptions, each LEN refers to the length of +the corresponding strings STR in the next line of input. Numbers are +always expressed in decimal. There are no escape characters. The +directives are: + +‘C LEN1 , LEN2 STR1 STR2 ’ + Uses STR1 and STR2 as the begin-comment and end-comment strings. + If omitted, then ‘#’ and are the comment delimiters. + +‘D NUMBER, LEN STR ’ + Selects diversion NUMBER, making it current, then copy STR in the + current diversion. NUMBER may be a negative number for a + non-existing diversion. To merely specify an active selection, use + this command with an empty STR. With 0 as the diversion NUMBER, + STR will be issued on standard output at reload time. GNU ‘m4’ + will not produce the ‘D’ directive with non-zero length for + diversion 0, but this can be done with manual edits. This + directive may appear more than once for the same diversion, in + which case the diversion is the concatenation of the various uses. + If omitted, then diversion 0 is current. + +‘F LEN1 , LEN2 STR1 STR2 ’ + Defines, through ‘pushdef’, a definition for STR1 expanding to the + function whose builtin name is STR2. If the builtin does not exist + (for example, if the frozen file was produced by a copy of ‘m4’ + compiled with changeword support, but the version of ‘m4’ reloading + was compiled without it), the reload is silent, but any subsequent + use of the definition of STR1 will result in a warning. This + directive may appear more than once for the same name, and its + order, along with ‘T’, is important. If omitted, you will have no + access to any builtins. + +‘Q LEN1 , LEN2 STR1 STR2 ’ + Uses STR1 and STR2 as the begin-quote and end-quote strings. If + omitted, then ‘`’ and ‘'’ are the quote delimiters. + +‘T LEN1 , LEN2 STR1 STR2 ’ + Defines, though ‘pushdef’, a definition for STR1 expanding to the + text given by STR2. This directive may appear more than once for + the same name, and its order, along with ‘F’, is important. + +‘V NUMBER ’ + Confirms the format of the file. ‘m4’ 1.4.19 only creates and + understands frozen files where NUMBER is 1. This directive must be + the first non-comment in the file, and may not appear more than + once. + + +File: m4.info, Node: Compatibility, Next: Answers, Prev: Frozen files, Up: Top + +16 Compatibility with other versions of ‘m4’ +******************************************** + +This chapter describes the many of the differences between this +implementation of ‘m4’, and of other implementations found under UNIX, +such as System V Release 4, Solaris, and BSD flavors. In particular, it +lists the known differences and extensions to POSIX. However, the list +is not necessarily comprehensive. + + At the time of this writing, POSIX 2001 (also known as IEEE Std +1003.1-2001) is the latest standard, although a new version of POSIX is +under development and includes several proposals for modifying what ‘m4’ +is required to do. The requirements for ‘m4’ are shared between SUSv3 +and POSIX, and can be viewed at +. + +* Menu: + +* Extensions:: Extensions in GNU M4 +* Incompatibilities:: Facilities in System V m4 not in GNU M4 +* Other Incompatibilities:: Other incompatibilities + + +File: m4.info, Node: Extensions, Next: Incompatibilities, Up: Compatibility + +16.1 Extensions in GNU M4 +========================= + +This version of ‘m4’ contains a few facilities that do not exist in +System V ‘m4’. These extra facilities are all suppressed by using the +‘-G’ command line option (*note Invoking m4: Limits control.), unless +overridden by other command line options. + + • In the ‘$N’ notation for macro arguments, N can contain several + digits, while the System V ‘m4’ only accepts one digit. This + allows macros in GNU ‘m4’ to take any number of arguments, and not + only nine (*note Arguments::). + + This means that ‘define(`foo', `$11')’ is ambiguous between + implementations. To portably choose between grabbing the first + parameter and appending 1 to the expansion, or grabbing the + eleventh parameter, you can do the following: + + define(`a1', `A1') + ⇒ + dnl First argument, concatenated with 1 + define(`_1', `$1')define(`first1', `_1($@)1') + ⇒ + dnl Eleventh argument, portable + define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') + ⇒ + dnl Eleventh argument, GNU style + define(`Eleventh', `$11') + ⇒ + first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + ⇒A1 + eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + ⇒k + Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') + ⇒k + + Also see the ‘argn’ macro (*note Shift::). + + • The ‘divert’ (*note Divert::) macro can manage more than 9 + diversions. GNU ‘m4’ treats all positive numbers as valid + diversions, rather than discarding diversions greater than 9. + + • Files included with ‘include’ and ‘sinclude’ are sought in a user + specified search path, if they are not found in the working + directory. The search path is specified by the ‘-I’ option and the + ‘M4PATH’ environment variable (*note Search Path::). + + • Arguments to ‘undivert’ can be non-numeric, in which case the named + file will be included uninterpreted in the output (*note + Undivert::). + + • Formatted output is supported through the ‘format’ builtin, which + is modeled after the C library function ‘printf’ (*note Format::). + + • Searches and text substitution through basic regular expressions + are supported by the ‘regexp’ (*note Regexp::) and ‘patsubst’ + (*note Patsubst::) builtins. Some BSD implementations use extended + regular expressions instead. + + • The output of shell commands can be read into ‘m4’ with ‘esyscmd’ + (*note Esyscmd::). + + • There is indirect access to any builtin macro with ‘builtin’ (*note + Builtin::). + + • Macros can be called indirectly through ‘indir’ (*note Indir::). + + • The name of the program, the current input file, and the current + input line number are accessible through the builtins + ‘__program__’, ‘__file__’, and ‘__line__’ (*note Location::). + + • The format of the output from ‘dumpdef’ and macro tracing can be + controlled with ‘debugmode’ (*note Debug Levels::). + + • The destination of trace and debug output can be controlled with + ‘debugfile’ (*note Debug Output::). + + • The ‘maketemp’ (*note Mkstemp::) macro behaves like ‘mkstemp’, + creating a new file with a unique name on every invocation, rather + than following the insecure behavior of replacing the trailing ‘X’ + characters with the ‘m4’ process id. + + • POSIX only requires support for the command line options ‘-s’, + ‘-D’, and ‘-U’, so all other options accepted by GNU M4 are + extensions. *Note Invoking m4::, for a description of these + options. + + The debugging and tracing facilities in GNU ‘m4’ are much more + extensive than in most other versions of ‘m4’. + + +File: m4.info, Node: Incompatibilities, Next: Other Incompatibilities, Prev: Extensions, Up: Compatibility + +16.2 Facilities in System V ‘m4’ not in GNU ‘m4’ +================================================ + +The version of ‘m4’ from System V contains a few facilities that have +not been implemented in GNU ‘m4’ yet. Additionally, POSIX requires some +behaviors that GNU ‘m4’ has not implemented yet. Relying on these +behaviors is non-portable, as a future release of GNU ‘m4’ may change. + + • POSIX requires support for multiple arguments to ‘defn’, without + any clarification on how ‘defn’ behaves when one of the multiple + arguments names a builtin. System V ‘m4’ and some other + implementations allow mixing builtins and text macros into a single + macro. GNU ‘m4’ only supports joining multiple text arguments, + although a future implementation may lift this restriction to + behave more like System V. The only portable way to join text + macros with builtins is via helper macros and implicit + concatenation of macro results. + + • POSIX requires an application to exit with non-zero status if it + wrote an error message to stderr. This has not yet been + consistently implemented for the various builtins that are required + to issue an error (such as ‘eval’ (*note Eval::) when an argument + cannot be parsed). + + • Some traditional implementations only allow reading standard input + once, but GNU ‘m4’ correctly handles multiple instances of ‘-’ on + the command line. + + • POSIX requires ‘m4wrap’ (*note M4wrap::) to act in FIFO (first-in, + first-out) order, but GNU ‘m4’ currently uses LIFO order. + Furthermore, POSIX states that only the first argument to ‘m4wrap’ + is saved for later evaluation, but GNU ‘m4’ saves and processes all + arguments, with output separated by spaces. + + • POSIX states that builtins that require arguments, but are called + without arguments, have undefined behavior. Traditional + implementations simply behave as though empty strings had been + passed. For example, ‘a`'define`'b’ would expand to ‘ab’. But GNU + ‘m4’ ignores certain builtins if they have missing arguments, + giving ‘adefineb’ for the above example. + + • Traditional implementations handle ‘define(`f',`1')’ (*note + Define::) by undefining the entire stack of previous definitions, + and if doing ‘undefine(`f')’ first. GNU ‘m4’ replaces just the top + definition on the stack, as if doing ‘popdef(`f')’ followed by + ‘pushdef(`f',`1')’. POSIX allows either behavior. + + • POSIX 2001 requires ‘syscmd’ (*note Syscmd::) to evaluate command + output for macro expansion, but this was a mistake that is + anticipated to be corrected in the next version of POSIX. GNU ‘m4’ + follows traditional behavior in ‘syscmd’ where output is not + rescanned, and provides the extension ‘esyscmd’ that does scan the + output. + + • At one point, POSIX required ‘changequote(ARG)’ (*note + Changequote::) to use newline as the close quote, but this was a + bug, and the next version of POSIX is anticipated to state that + using empty strings or just one argument is unspecified. + Meanwhile, the GNU ‘m4’ behavior of treating an empty end-quote + delimiter as ‘'’ is not portable, as Solaris treats it as repeating + the start-quote delimiter, and BSD treats it as leaving the + previous end-quote delimiter unchanged. For predictable results, + never call changequote with just one argument, or with empty + strings for arguments. + + • At one point, POSIX required ‘changecom(ARG,)’ (*note Changecom::) + to make it impossible to end a comment, but this is a bug, and the + next version of POSIX is anticipated to state that using empty + strings is unspecified. Meanwhile, the GNU ‘m4’ behavior of + treating an empty end-comment delimiter as newline is not portable, + as BSD treats it as leaving the previous end-comment delimiter + unchanged. It is also impossible in BSD implementations to disable + comments, even though that is required by POSIX. For predictable + results, never call changecom with empty strings for arguments. + + • Most implementations of ‘m4’ give macros a higher precedence than + comments when parsing, meaning that if the start delimiter given to + ‘changecom’ (*note Changecom::) starts with a macro name, comments + are effectively disabled. POSIX does not specify what the + precedence is, so this version of GNU ‘m4’ parser recognizes + comments, then macros, then quoted strings. + + • Traditional implementations allow argument collection, but not + string and comment processing, to span file boundaries. Thus, if + ‘a.m4’ contains ‘len(’, and ‘b.m4’ contains ‘abc)’, ‘m4 a.m4 b.m4’ + outputs ‘3’ with traditional ‘m4’, but gives an error message that + the end of file was encountered inside a macro with GNU ‘m4’. On + the other hand, traditional implementations do end of file + processing for files included with ‘include’ or ‘sinclude’ (*note + Include::), while GNU ‘m4’ seamlessly integrates the content of + those files. Thus ‘include(`a.m4')include(`b.m4')’ will output ‘3’ + instead of giving an error. + + • Traditional ‘m4’ treats ‘traceon’ (*note Trace::) without arguments + as a global variable, independent of named macro tracing. Also, + once a macro is undefined, named tracing of that macro is lost. On + the other hand, when GNU ‘m4’ encounters ‘traceon’ without + arguments, it turns tracing on for all existing definitions at the + time, but does not trace future definitions; ‘traceoff’ without + arguments turns tracing off for all definitions regardless of + whether they were also traced by name; and tracing by name, such as + with ‘-tfoo’ at the command line or ‘traceon(`foo')’ in the input, + is an attribute that is preserved even if the macro is currently + undefined. + + Additionally, while POSIX requires trace output, it makes no + demands on the formatting of that output. Parsing trace output is + not guaranteed to be reliable, even between different releases of + GNU M4; however, the intent is that any future changes in trace + output will only occur under the direction of additional + ‘debugmode’ flags (*note Debug Levels::). + + • POSIX requires ‘eval’ (*note Eval::) to treat all operators with + the same precedence as C. However, earlier versions of GNU ‘m4’ + followed the traditional behavior of other ‘m4’ implementations, + where bitwise and logical negation (‘~’ and ‘!’) have lower + precedence than equality operators; and where equality operators + (‘==’ and ‘!=’) had the same precedence as relational operators + (such as ‘<’). Use explicit parentheses to ensure proper + precedence. As extensions to POSIX, GNU ‘m4’ gives well-defined + semantics to operations that C leaves undefined, such as when + overflow occurs, when shifting negative numbers, or when performing + division by zero. POSIX also requires ‘=’ to cause an error, but + many traditional implementations allowed it as an alias for ‘==’. + + • POSIX 2001 requires ‘translit’ (*note Translit::) to treat each + character of the second and third arguments literally. However, it + is anticipated that the next version of POSIX will allow the GNU + ‘m4’ behavior of treating ‘-’ as a range operator. + + • POSIX requires ‘m4’ to honor the locale environment variables of + ‘LANG’, ‘LC_ALL’, ‘LC_CTYPE’, ‘LC_MESSAGES’, and ‘NLSPATH’, but + this has not yet been implemented in GNU ‘m4’. + + • POSIX states that only unquoted leading newlines and blanks (that + is, space and tab) are ignored when collecting macro arguments. + However, this appears to be a bug in POSIX, since most traditional + implementations also ignore all whitespace (formfeed, carriage + return, and vertical tab). GNU ‘m4’ follows tradition and ignores + all leading unquoted whitespace. + + • A strictly-compliant POSIX client is not allowed to use + command-line arguments not specified by POSIX. However, since this + version of M4 ignores ‘POSIXLY_CORRECT’ and enables the option + ‘--gnu’ by default (*note Invoking m4: Limits control.), a client + desiring to be strictly compliant has no way to disable GNU + extensions that conflict with POSIX when directly invoking the + compiled ‘m4’. A future version of ‘GNU’ M4 will honor the + environment variable ‘POSIXLY_CORRECT’, implicitly enabling + ‘--traditional’ if it is set, in order to allow a + strictly-compliant client. In the meantime, a client needing + strict POSIX compliance can use the workaround of invoking a shell + script wrapper, where the wrapper then adds ‘--traditional’ to the + arguments passed to the compiled ‘m4’. + + +File: m4.info, Node: Other Incompatibilities, Prev: Incompatibilities, Up: Compatibility + +16.3 Other incompatibilities +============================ + +There are a few other incompatibilities between this implementation of +‘m4’, and the System V version. + + • GNU ‘m4’ implements sync lines differently from System V ‘m4’, when + text is being diverted. GNU ‘m4’ outputs the sync lines when the + text is being diverted, and System V ‘m4’ when the diverted text is + being brought back. + + The problem is which lines and file names should be attached to + text that is being, or has been, diverted. System V ‘m4’ regards + all the diverted text as being generated by the source line + containing the ‘undivert’ call, whereas GNU ‘m4’ regards the + diverted text as being generated at the time it is diverted. + + The sync line option is used mostly when using ‘m4’ as a front end + to a compiler. If a diverted line causes a compiler error, the + error messages should most probably refer to the place where the + diversion was made, and not where it was inserted again. + + divert(2)2 + divert(1)1 + divert`'0 + ⇒#line 3 "stdin" + ⇒0 + ^D + ⇒#line 2 "stdin" + ⇒1 + ⇒#line 1 "stdin" + ⇒2 + + The current ‘m4’ implementation has a limitation that the syncline + output at the start of each diversion occurs no matter what, even + if the previous diversion did not end with a newline. This goes + contrary to the claim that synclines appear on a line by + themselves, so this limitation may be corrected in a future version + of ‘m4’. In the meantime, when using ‘-s’, it is wisest to make + sure all diversions end with newline. + + • GNU ‘m4’ makes no attempt at prohibiting self-referential + definitions like: + + define(`x', `x') + ⇒ + define(`x', `x ') + ⇒ + + There is nothing inherently wrong with defining ‘x’ to return ‘x’. + The wrong thing is to expand ‘x’ unquoted, because that would cause + an infinite rescan loop. In ‘m4’, one might use macros to hold + strings, as we do for variables in other programming languages, + further checking them with: + + ifelse(defn(`HOLDER'), `VALUE', ...) + + In cases like this one, an interdiction for a macro to hold its own + name would be a useless limitation. Of course, this leaves more + rope for the GNU ‘m4’ user to hang himself! Rescanning hangs may + be avoided through careful programming, a little like for endless + loops in traditional programming languages. + + +File: m4.info, Node: Answers, Next: Copying This Package, Prev: Compatibility, Up: Top + +17 Correct version of some examples +*********************************** + +Some of the examples in this manuals are buggy or not very robust, for +demonstration purposes. Improved versions of these composite macros are +presented here. + +* Menu: + +* Improved exch:: Solution for ‘exch’ +* Improved forloop:: Solution for ‘forloop’ +* Improved foreach:: Solution for ‘foreach’ +* Improved copy:: Solution for ‘copy’ +* Improved m4wrap:: Solution for ‘m4wrap’ +* Improved cleardivert:: Solution for ‘cleardivert’ +* Improved capitalize:: Solution for ‘capitalize’ +* Improved fatal_error:: Solution for ‘fatal_error’ + + +File: m4.info, Node: Improved exch, Next: Improved forloop, Up: Answers + +17.1 Solution for ‘exch’ +======================== + +The ‘exch’ macro (*note Arguments::) as presented requires clients to +double quote their arguments. A nicer definition, which lets clients +follow the rule of thumb of one level of quoting per level of +parentheses, involves adding quotes in the definition of ‘exch’, as +follows: + + define(`exch', ``$2', `$1'') + ⇒ + define(exch(`expansion text', `macro')) + ⇒ + macro + ⇒expansion text + + +File: m4.info, Node: Improved forloop, Next: Improved foreach, Prev: Improved exch, Up: Answers + +17.2 Solution for ‘forloop’ +=========================== + +The ‘forloop’ macro (*note Forloop::) as presented earlier can go into +an infinite loop if given an iterator that is not parsed as a macro +name. It does not do any sanity checking on its numeric bounds, and +only permits decimal numbers for bounds. Here is an improved version, +shipped as ‘m4-1.4.19/examples/forloop2.m4’; this version also optimizes +overhead by calling four macros instead of six per iteration (excluding +those in TEXT), by not dereferencing the ITERATOR in the helper +‘_forloop’. + + $ m4 -d -I examples + undivert(`forloop2.m4')dnl + ⇒divert(`-1') + ⇒# forloop(var, from, to, stmt) - improved version: + ⇒# works even if VAR is not a strict macro name + ⇒# performs sanity check that FROM is larger than TO + ⇒# allows complex numerical expressions in TO and FROM + ⇒define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1', + ⇒ `pushdef(`$1')_$0(`$1', eval(`$2'), + ⇒ eval(`$3'), `$4')popdef(`$1')')') + ⇒define(`_forloop', + ⇒ `define(`$1', `$2')$4`'ifelse(`$2', `$3', `', + ⇒ `$0(`$1', incr(`$2'), `$3', `$4')')') + ⇒divert`'dnl + include(`forloop2.m4') + ⇒ + forloop(`i', `2', `1', `no iteration occurs') + ⇒ + forloop(`', `1', `2', ` odd iterator name') + ⇒ odd iterator name odd iterator name + forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') + ⇒ 0xa 0xb 0xc + forloop(`i', `a', `b', `non-numeric bounds') + error→m4:stdin:6: bad expression in eval (bad input): (a) <= (b) + ⇒ + + One other change to notice is that the improved version used ‘_$0’ +rather than ‘_foreach’ to invoke the helper routine. In general, this +is a good practice to follow, because then the set of macros can be +uniformly transformed. The following example shows a transformation +that doubles the current quoting and appends a suffix ‘2’ to each +transformed macro. If ‘foreach’ refers to the literal ‘_foreach’, then +‘foreach2’ invokes ‘_foreach’ instead of the intended ‘_foreach2’, and +the mixing of quoting paradigms leads to an infinite recursion loop in +this example. + + $ m4 -d -L 9 -I examples + define(`arg1', `$1')include(`forloop2.m4')include(`quote.m4') + ⇒ + define(`double', `define(`$1'`2', + arg1(patsubst(dquote(defn(`$1')), `[`']', `\&\&')))') + ⇒ + double(`forloop')double(`_forloop')defn(`forloop2') + ⇒ifelse(eval(``($2) <= ($3)''), ``1'', + ⇒ ``pushdef(``$1'')_$0(``$1'', eval(``$2''), + ⇒ eval(``$3''), ``$4'')popdef(``$1'')'') + forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') + ⇒ + changequote(`[', `]')changequote([``], ['']) + ⇒ + forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') + ⇒ + changequote`'include(`forloop.m4') + ⇒ + double(`forloop')double(`_forloop')defn(`forloop2') + ⇒pushdef(``$1'', ``$2'')_forloop($@)popdef(``$1'') + forloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)') + ⇒ + changequote(`[', `]')changequote([``], ['']) + ⇒ + forloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'') + error→m4:stdin:12: recursion limit of 9 exceeded, use -L to change it + + One more optimization is still possible. Instead of repeatedly +assigning a variable then invoking or dereferencing it, it is possible +to pass the current iterator value as a single argument. Coupled with +‘curry’ if other arguments are needed (*note Composition::), or with +helper macros if the argument is needed in more than one place in the +expansion, the output can be generated with three, rather than four, +macros of overhead per iteration. Notice how the file +‘m4-1.4.19/examples/forloop3.m4’ rearranges the arguments of the helper +‘_forloop’ to take two arguments that are placed around the current +value. By splitting a balanced set of parantheses across multiple +arguments, the helper macro can now be shared by ‘forloop’ and the new +‘forloop_arg’. + + $ m4 -I examples + include(`forloop3.m4') + ⇒ + undivert(`forloop3.m4')dnl + ⇒divert(`-1') + ⇒# forloop_arg(from, to, macro) - invoke MACRO(value) for + ⇒# each value between FROM and TO, without define overhead + ⇒define(`forloop_arg', `ifelse(eval(`($1) <= ($2)'), `1', + ⇒ `_forloop(`$1', eval(`$2'), `$3(', `)')')') + ⇒# forloop(var, from, to, stmt) - refactored to share code + ⇒define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1', + ⇒ `pushdef(`$1')_forloop(eval(`$2'), eval(`$3'), + ⇒ `define(`$1',', `)$4')popdef(`$1')')') + ⇒define(`_forloop', + ⇒ `$3`$1'$4`'ifelse(`$1', `$2', `', + ⇒ `$0(incr(`$1'), `$2', `$3', `$4')')') + ⇒divert`'dnl + forloop(`i', `1', `3', ` i') + ⇒ 1 2 3 + define(`echo', `$@') + ⇒ + forloop_arg(`1', `3', ` echo') + ⇒ 1 2 3 + include(`curry.m4') + ⇒ + forloop_arg(`1', `3', `curry(`pushdef', `a')') + ⇒ + a + ⇒3 + popdef(`a')a + ⇒2 + popdef(`a')a + ⇒1 + popdef(`a')a + ⇒a + + Of course, it is possible to make even more improvements, such as +adding an optional step argument, or allowing iteration through +descending sequences. GNU Autoconf provides some of these additional +bells and whistles in its ‘m4_for’ macro. + + +File: m4.info, Node: Improved foreach, Next: Improved copy, Prev: Improved forloop, Up: Answers + +17.3 Solution for ‘foreach’ +=========================== + +The ‘foreach’ and ‘foreachq’ macros (*note Foreach::) as presented +earlier each have flaws. First, we will examine and fix the quadratic +behavior of ‘foreachq’: + + $ m4 -I examples + include(`foreachq.m4') + ⇒ + traceon(`shift')debugmode(`aq') + ⇒ + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + ⇒1 + error→m4trace: -3- shift(`1', `2', `3', `4') + error→m4trace: -2- shift(`1', `2', `3', `4') + ⇒2 + error→m4trace: -4- shift(`1', `2', `3', `4') + error→m4trace: -3- shift(`2', `3', `4') + error→m4trace: -3- shift(`1', `2', `3', `4') + error→m4trace: -2- shift(`2', `3', `4') + ⇒3 + error→m4trace: -5- shift(`1', `2', `3', `4') + error→m4trace: -4- shift(`2', `3', `4') + error→m4trace: -3- shift(`3', `4') + error→m4trace: -4- shift(`1', `2', `3', `4') + error→m4trace: -3- shift(`2', `3', `4') + error→m4trace: -2- shift(`3', `4') + ⇒4 + error→m4trace: -6- shift(`1', `2', `3', `4') + error→m4trace: -5- shift(`2', `3', `4') + error→m4trace: -4- shift(`3', `4') + error→m4trace: -3- shift(`4') + + Each successive iteration was adding more quoted ‘shift’ invocations, +and the entire list contents were passing through every iteration. In +general, when recursing, it is a good idea to make the recursion use +fewer arguments, rather than adding additional quoted uses of ‘shift’. +By doing so, ‘m4’ uses less memory, invokes fewer macros, is less likely +to run into machine limits, and most importantly, performs faster. The +fixed version of ‘foreachq’ can be found in +‘m4-1.4.19/examples/foreachq2.m4’: + + $ m4 -I examples + include(`foreachq2.m4') + ⇒ + undivert(`foreachq2.m4')dnl + ⇒include(`quote.m4')dnl + ⇒divert(`-1') + ⇒# foreachq(x, `item_1, item_2, ..., item_n', stmt) + ⇒# quoted list, improved version + ⇒define(`foreachq', `pushdef(`$1')_$0($@)popdef(`$1')') + ⇒define(`_arg1q', ``$1'') + ⇒define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') + ⇒define(`_foreachq', `ifelse(`$2', `', `', + ⇒ `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') + ⇒divert`'dnl + traceon(`shift')debugmode(`aq') + ⇒ + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + ⇒1 + error→m4trace: -3- shift(`1', `2', `3', `4') + ⇒2 + error→m4trace: -3- shift(`2', `3', `4') + ⇒3 + error→m4trace: -3- shift(`3', `4') + ⇒4 + + Note that the fixed version calls unquoted helper macros in +‘_foreachq’ to trim elements immediately; those helper macros in turn +must re-supply the layer of quotes lost in the macro invocation. +Contrast the use of ‘_arg1q’, which quotes the first list element, with +‘_arg1’ of the earlier implementation that returned the first list +element directly. Additionally, by calling the helper method +immediately, the ‘defn(`ITERATOR')’ no longer contains unexpanded +macros. + + The astute m4 programmer might notice that the solution above still +uses more memory and macro invocations, and thus more time, than +strictly necessary. Note that ‘$2’, which contains an arbitrarily long +quoted list, is expanded and rescanned three times per iteration of +‘_foreachq’. Furthermore, every iteration of the algorithm effectively +unboxes then reboxes the list, which costs a couple of macro +invocations. It is possible to rewrite the algorithm for a bit more +speed by swapping the order of the arguments to ‘_foreachq’ in order to +operate on an unboxed list in the first place, and by using the +fixed-length ‘$#’ instead of an arbitrary length list as the key to end +recursion. The result is an overhead of six macro invocations per loop +(excluding any macros in TEXT), instead of eight. This alternative +approach is available as ‘m4-1.4.19/examples/foreach3.m4’: + + $ m4 -I examples + include(`foreachq3.m4') + ⇒ + undivert(`foreachq3.m4')dnl + ⇒divert(`-1') + ⇒# foreachq(x, `item_1, item_2, ..., item_n', stmt) + ⇒# quoted list, alternate improved version + ⇒define(`foreachq', `ifelse(`$2', `', `', + ⇒ `pushdef(`$1')_$0(`$1', `$3', `', $2)popdef(`$1')')') + ⇒define(`_foreachq', `ifelse(`$#', `3', `', + ⇒ `define(`$1', `$4')$2`'$0(`$1', `$2', + ⇒ shift(shift(shift($@))))')') + ⇒divert`'dnl + traceon(`shift')debugmode(`aq') + ⇒ + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + ⇒1 + error→m4trace: -4- shift(`x', `x + error→', `', `1', `2', `3', `4') + error→m4trace: -3- shift(`x + error→', `', `1', `2', `3', `4') + error→m4trace: -2- shift(`', `1', `2', `3', `4') + ⇒2 + error→m4trace: -4- shift(`x', `x + error→', `1', `2', `3', `4') + error→m4trace: -3- shift(`x + error→', `1', `2', `3', `4') + error→m4trace: -2- shift(`1', `2', `3', `4') + ⇒3 + error→m4trace: -4- shift(`x', `x + error→', `2', `3', `4') + error→m4trace: -3- shift(`x + error→', `2', `3', `4') + error→m4trace: -2- shift(`2', `3', `4') + ⇒4 + error→m4trace: -4- shift(`x', `x + error→', `3', `4') + error→m4trace: -3- shift(`x + error→', `3', `4') + error→m4trace: -2- shift(`3', `4') + + In the current version of M4, every instance of ‘$@’ is rescanned as +it is encountered. Thus, the ‘foreachq3.m4’ alternative uses much less +memory than ‘foreachq2.m4’, and executes as much as 10% faster, since +each iteration encounters fewer ‘$@’. However, the implementation of +rescanning every byte in ‘$@’ is quadratic in the number of bytes +scanned (for example, making the broken version in ‘foreachq.m4’ cubic, +rather than quadratic, in behavior). A future release of M4 will +improve the underlying implementation by reusing results of previous +scans, so that both styles of ‘foreachq’ can become linear in the number +of bytes scanned. Notice how the implementation injects an empty +argument prior to expanding ‘$2’ within ‘foreachq’; the helper macro +‘_foreachq’ then ignores the third argument altogether, and ends +recursion when there are three arguments left because there was nothing +left to pass through ‘shift’. Thus, each iteration only needs one +‘ifelse’, rather than the two conditionals used in the version from +‘foreachq2.m4’. + + So far, all of the implementations of ‘foreachq’ presented have been +quadratic with M4 1.4.x. But ‘forloop’ is linear, because each +iteration parses a constant amount of arguments. So, it is possible to +design a variant that uses ‘forloop’ to do the iteration, then uses ‘$@’ +only once at the end, giving a linear result even with older M4 +implementations. This implementation relies on the GNU extension that +‘$10’ expands to the tenth argument rather than the first argument +concatenated with ‘0’. The trick is to define an intermediate macro +that repeats the text ‘m4_define(`$1', `$N')$2`'’, with ‘n’ set to +successive integers corresponding to each argument. The helper macro +‘_foreachq_’ is needed in order to generate the literal sequences such +as ‘$1’ into the intermediate macro, rather than expanding them as the +arguments of ‘_foreachq’. With this approach, no ‘shift’ calls are even +needed! Even though there are seven macros of overhead per iteration +instead of six in ‘foreachq3.m4’, the linear scaling is apparent at +relatively small list sizes. However, this approach will need +adjustment when a future version of M4 follows POSIX by no longer +treating ‘$10’ as the tenth argument; the anticipation is that ‘${10}’ +can be used instead, although that alternative syntax is not yet +supported. + + $ m4 -I examples + include(`foreachq4.m4') + ⇒ + undivert(`foreachq4.m4')dnl + ⇒include(`forloop2.m4')dnl + ⇒divert(`-1') + ⇒# foreachq(x, `item_1, item_2, ..., item_n', stmt) + ⇒# quoted list, version based on forloop + ⇒define(`foreachq', + ⇒`ifelse(`$2', `', `', `_$0(`$1', `$3', $2)')') + ⇒define(`_foreachq', + ⇒`pushdef(`$1', forloop(`$1', `3', `$#', + ⇒ `$0_(`1', `2', indir(`$1'))')`popdef( + ⇒ `$1')')indir(`$1', $@)') + ⇒define(`_foreachq_', + ⇒``define(`$$1', `$$3')$$2`''') + ⇒divert`'dnl + traceon(`shift')debugmode(`aq') + ⇒ + foreachq(`x', ``1', `2', `3', `4'', `x + ')dnl + ⇒1 + ⇒2 + ⇒3 + ⇒4 + + For yet another approach, the improved version of ‘foreach’, +available in ‘m4-1.4.19/examples/foreach2.m4’, simply overquotes the +arguments to ‘_foreach’ to begin with, using ‘dquote_elt’. Then +‘_foreach’ can just use ‘_arg1’ to remove the extra layer of quoting +that was added up front: + + $ m4 -I examples + include(`foreach2.m4') + ⇒ + undivert(`foreach2.m4')dnl + ⇒include(`quote.m4')dnl + ⇒divert(`-1') + ⇒# foreach(x, (item_1, item_2, ..., item_n), stmt) + ⇒# parenthesized list, improved version + ⇒define(`foreach', `pushdef(`$1')_$0(`$1', + ⇒ (dquote(dquote_elt$2)), `$3')popdef(`$1')') + ⇒define(`_arg1', `$1') + ⇒define(`_foreach', `ifelse(`$2', `(`')', `', + ⇒ `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') + ⇒divert`'dnl + traceon(`shift')debugmode(`aq') + ⇒ + foreach(`x', `(`1', `2', `3', `4')', `x + ')dnl + error→m4trace: -4- shift(`1', `2', `3', `4') + error→m4trace: -4- shift(`2', `3', `4') + error→m4trace: -4- shift(`3', `4') + ⇒1 + error→m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') + ⇒2 + error→m4trace: -3- shift(``2'', ``3'', ``4'') + ⇒3 + error→m4trace: -3- shift(``3'', ``4'') + ⇒4 + error→m4trace: -3- shift(``4'') + + It is likewise possible to write a variant of ‘foreach’ that performs +in linear time on M4 1.4.x; the easiest method is probably writing a +version of ‘foreach’ that unboxes its list, then invokes ‘_foreachq’ as +previously defined in ‘foreachq4.m4’. + + In summary, recursion over list elements is trickier than it appeared +at first glance, but provides a powerful idiom within ‘m4’ processing. +As a final demonstration, both list styles are now able to handle +several scenarios that would wreak havoc on one or both of the original +implementations. This points out one other difference between the list +styles. ‘foreach’ evaluates unquoted list elements only once, in +preparation for calling ‘_foreach’, similary for ‘foreachq’ as provided +by ‘foreachq3.m4’ or ‘foreachq4.m4’. But ‘foreachq’, as provided by +‘foreachq2.m4’, evaluates unquoted list elements twice while visiting +the first list element, once in ‘_arg1q’ and once in ‘_rest’. When +deciding which list style to use, one must take into account whether +repeating the side effects of unquoted list elements will have any +detrimental effects. + + $ m4 -I examples + include(`foreach2.m4') + ⇒ + include(`foreachq2.m4') + ⇒ + dnl 0-element list: + foreach(`x', `', `') / foreachq(`x', `', `') + ⇒ / + dnl 1-element list of empty element + foreach(`x', `()', `') / foreachq(`x', ``'', `') + ⇒<> / <> + dnl 2-element list of empty elements + foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') + ⇒<><> / <><> + dnl 1-element list of a comma + foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') + ⇒<,> / <,> + dnl 2-element list of unbalanced parentheses + foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') + ⇒<(><)> / <(><)> + define(`ab', `oops')dnl using defn(`iterator') + foreach(`x', `(`a', `b')', `defn(`x')') /dnl + foreachq(`x', ``a', `b'', `defn(`x')') + ⇒ab / ab + define(`active', `ACT, IVE') + ⇒ + traceon(`active') + ⇒ + dnl list of unquoted macros; expansion occurs before recursion + foreach(`x', `(active, active)', ` + ')dnl + error→m4trace: -4- active -> `ACT, IVE' + error→m4trace: -4- active -> `ACT, IVE' + ⇒ + ⇒ + ⇒ + ⇒ + foreachq(`x', `active, active', ` + ')dnl + error→m4trace: -3- active -> `ACT, IVE' + error→m4trace: -3- active -> `ACT, IVE' + ⇒ + error→m4trace: -3- active -> `ACT, IVE' + error→m4trace: -3- active -> `ACT, IVE' + ⇒ + ⇒ + ⇒ + dnl list of quoted macros; expansion occurs during recursion + foreach(`x', `(`active', `active')', ` + ')dnl + error→m4trace: -1- active -> `ACT, IVE' + ⇒ + error→m4trace: -1- active -> `ACT, IVE' + ⇒ + foreachq(`x', ``active', `active'', ` + ')dnl + error→m4trace: -1- active -> `ACT, IVE' + ⇒ + error→m4trace: -1- active -> `ACT, IVE' + ⇒ + dnl list of double-quoted macro names; no expansion + foreach(`x', `(``active'', ``active'')', ` + ')dnl + ⇒ + ⇒ + foreachq(`x', ```active'', ``active''', ` + ')dnl + ⇒ + ⇒ + + +File: m4.info, Node: Improved copy, Next: Improved m4wrap, Prev: Improved foreach, Up: Answers + +17.4 Solution for ‘copy’ +======================== + +The macro ‘copy’ presented above is unable to handle builtin tokens with +M4 1.4.x, because it tries to pass the builtin token through the macro +‘curry’, where it is silently flattened to an empty string (*note +Composition::). Rather than using the problematic ‘curry’ to work +around the limitation that ‘stack_foreach’ expects to invoke a macro +that takes exactly one argument, we can write a new macro that lets us +form the exact two-argument ‘pushdef’ call sequence needed, so that we +are no longer passing a builtin token through a text macro. + + -- Composite: stack_foreach_sep (MACRO, PRE, POST, SEP) + -- Composite: stack_foreach_sep_lifo (MACRO, PRE, POST, SEP) + For each of the ‘pushdef’ definitions associated with MACRO, expand + the sequence ‘PRE`'definition`'POST’. Additionally, expand SEP + between definitions. ‘stack_foreach_sep’ visits the oldest + definition first, while ‘stack_foreach_sep_lifo’ visits the current + definition first. The expansion may dereference MACRO, but should + not modify it. There are a few special macros, such as ‘defn’, + which cannot be used as the MACRO parameter. + + Note that ‘stack_foreach(`MACRO', `ACTION')’ is equivalent to +‘stack_foreach_sep(`MACRO', `ACTION(', `)')’. By supplying explicit +parentheses, split among the PRE and POST arguments to +‘stack_foreach_sep’, it is now possible to construct macro calls with +more than one argument, without passing builtin tokens through a macro +call. It is likewise possible to directly reference the stack +definitions without a macro call, by leaving PRE and POST empty. Thus, +in addition to fixing ‘copy’ on builtin tokens, it also executes with +fewer macro invocations. + + The new macro also adds a separator that is only output after the +first iteration of the helper ‘_stack_reverse_sep’, implemented by +prepending the original SEP to PRE and omitting a SEP argument in +subsequent iterations. Note that the empty string that separates SEP +from PRE is provided as part of the fourth argument when originally +calling ‘_stack_reverse_sep’, and not by writing ‘$4`'$3’ as the third +argument in the recursive call; while the other approach would give the +same output, it does so at the expense of increasing the argument size +on each iteration of ‘_stack_reverse_sep’, which results in quadratic +instead of linear execution time. The improved stack walking macros are +available in ‘m4-1.4.19/examples/stack_sep.m4’: + + $ m4 -I examples + include(`stack_sep.m4') + ⇒ + define(`copy', `ifdef(`$2', `errprint(`$2 already defined + ')m4exit(`1')', + `stack_foreach_sep(`$1', `pushdef(`$2',', `)')')')dnl + pushdef(`a', `1')pushdef(`a', defn(`divnum')) + ⇒ + copy(`a', `b') + ⇒ + b + ⇒0 + popdef(`b') + ⇒ + b + ⇒1 + pushdef(`c', `1')pushdef(`c', `2') + ⇒ + stack_foreach_sep_lifo(`c', `', `', `, ') + ⇒2, 1 + undivert(`stack_sep.m4')dnl + ⇒divert(`-1') + ⇒# stack_foreach_sep(macro, pre, post, sep) + ⇒# Invoke PRE`'defn`'POST with a single argument of each definition + ⇒# from the definition stack of MACRO, starting with the oldest, and + ⇒# separated by SEP between definitions. + ⇒define(`stack_foreach_sep', + ⇒`_stack_reverse_sep(`$1', `tmp-$1')'dnl + ⇒`_stack_reverse_sep(`tmp-$1', `$1', `$2`'defn(`$1')$3', `$4`'')') + ⇒# stack_foreach_sep_lifo(macro, pre, post, sep) + ⇒# Like stack_foreach_sep, but starting with the newest definition. + ⇒define(`stack_foreach_sep_lifo', + ⇒`_stack_reverse_sep(`$1', `tmp-$1', `$2`'defn(`$1')$3', `$4`'')'dnl + ⇒`_stack_reverse_sep(`tmp-$1', `$1')') + ⇒define(`_stack_reverse_sep', + ⇒`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0( + ⇒ `$1', `$2', `$4$3')')') + ⇒divert`'dnl + + +File: m4.info, Node: Improved m4wrap, Next: Improved cleardivert, Prev: Improved copy, Up: Answers + +17.5 Solution for ‘m4wrap’ +========================== + +The replacement ‘m4wrap’ versions presented above, designed to guarantee +FIFO or LIFO order regardless of the underlying M4 implementation, share +a bug when dealing with wrapped text that looks like parameter +expansion. Note how the invocation of ‘m4wrapN’ interprets these +parameters, while using the builtin preserves them for their intended +use. + + $ m4 -I examples + include(`wraplifo.m4') + ⇒ + m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') + ') + ⇒ + builtin(`m4wrap', ``'define(`bar', ``$0:'-$1-$*-$#-')bar(`a', `b') + ') + ⇒ + ^D + ⇒bar:-a-a,b-2- + ⇒m4wrap0:---0- + + Additionally, the computation of ‘_m4wrap_level’ and creation of +multiple ‘m4wrapN’ placeholders in the original examples is more +expensive in time and memory than strictly necessary. Notice how the +improved version grabs the wrapped text via ‘defn’ to avoid parameter +expansion, then undefines ‘_m4wrap_text’, before stripping a level of +quotes with ‘_arg1’ to expand the text. That way, each level of +wrapping reuses the single placeholder, which starts each nesting level +in an undefined state. + + Finally, it is worth emulating the GNU M4 extension of saving all +arguments to ‘m4wrap’, separated by a space, rather than saving just the +first argument. This is done with the ‘join’ macro documented +previously (*note Shift::). The improved LIFO example is shipped as +‘m4-1.4.19/examples/wraplifo2.m4’, and can easily be converted to a FIFO +solution by swapping the adjacent invocations of ‘joinall’ and ‘defn’. + + $ m4 -I examples + include(`wraplifo2.m4') + ⇒ + undivert(`wraplifo2.m4')dnl + ⇒dnl Redefine m4wrap to have LIFO semantics, improved example. + ⇒include(`join.m4')dnl + ⇒define(`_m4wrap', defn(`m4wrap'))dnl + ⇒define(`_arg1', `$1')dnl + ⇒define(`m4wrap', + ⇒`ifdef(`_$0_text', + ⇒ `define(`_$0_text', joinall(` ', $@)defn(`_$0_text'))', + ⇒ `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl + ⇒define(`_$0_text', joinall(` ', $@))')')dnl + m4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b') + ') + ⇒ + m4wrap(`lifo text + m4wrap(`nested', `', `$@ + ')') + ⇒ + ^D + ⇒lifo text + ⇒foo:-a-a,b-2- + ⇒nested $@ + + +File: m4.info, Node: Improved cleardivert, Next: Improved capitalize, Prev: Improved m4wrap, Up: Answers + +17.6 Solution for ‘cleardivert’ +=============================== + +The ‘cleardivert’ macro (*note Cleardivert::) cannot, as it stands, be +called without arguments to clear all pending diversions. That is +because using undivert with an empty string for an argument is different +than using it with no arguments at all. Compare the earlier definition +with one that takes the number of arguments into account: + + define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') + ⇒ + divert(`1')one + divert + ⇒ + cleardivert + ⇒ + undivert + ⇒one + ⇒ + define(`cleardivert', + `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', + `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') + ⇒ + divert(`2')two + divert + ⇒ + cleardivert + ⇒ + undivert + ⇒ + + +File: m4.info, Node: Improved capitalize, Next: Improved fatal_error, Prev: Improved cleardivert, Up: Answers + +17.7 Solution for ‘capitalize’ +============================== + +The ‘capitalize’ macro (*note Patsubst::) as presented earlier does not +allow clients to follow the quoting rule of thumb. Consider the three +macros ‘active’, ‘Active’, and ‘ACTIVE’, and the difference between +calling ‘capitalize’ with the expansion of a macro, expanding the result +of a case change, and changing the case of a double-quoted string: + + $ m4 -I examples + include(`capitalize.m4')dnl + define(`active', `act1, ive')dnl + define(`Active', `Act2, Ive')dnl + define(`ACTIVE', `ACT3, IVE')dnl + upcase(active) + ⇒ACT1,IVE + upcase(`active') + ⇒ACT3, IVE + upcase(``active'') + ⇒ACTIVE + downcase(ACTIVE) + ⇒act3,ive + downcase(`ACTIVE') + ⇒act1, ive + downcase(``ACTIVE'') + ⇒active + capitalize(active) + ⇒Act1 + capitalize(`active') + ⇒Active + capitalize(``active'') + ⇒_capitalize(`active') + define(`A', `OOPS') + ⇒ + capitalize(active) + ⇒OOPSct1 + capitalize(`active') + ⇒OOPSctive + + First, when ‘capitalize’ is called with more than one argument, it +was throwing away later arguments, whereas ‘upcase’ and ‘downcase’ used +‘$*’ to collect them all. The fix is simple: use ‘$*’ consistently. + + Next, with single-quoting, ‘capitalize’ outputs a single character, a +set of quotes, then the rest of the characters, making it impossible to +invoke ‘Active’ after the fact, and allowing the alternate macro ‘A’ to +interfere. Here, the solution is to use additional quoting in the +helper macros, then pass the final over-quoted output string through +‘_arg1’ to remove the extra quoting and finally invoke the concatenated +portions as a single string. + + Finally, when passed a double-quoted string, the nested macro +‘_capitalize’ is never invoked because it ended up nested inside quotes. +This one is the toughest to fix. In short, we have no idea how many +levels of quotes are in effect on the substring being altered by +‘patsubst’. If the replacement string cannot be expressed entirely in +terms of literal text and backslash substitutions, then we need a +mechanism to guarantee that the helper macros are invoked outside of +quotes. In other words, this sounds like a job for ‘changequote’ (*note +Changequote::). By changing the active quoting characters, we can +guarantee that replacement text injected by ‘patsubst’ always occurs in +the middle of a string that has exactly one level of over-quoting using +alternate quotes; so the replacement text closes the quoted string, +invokes the helper macros, then reopens the quoted string. In turn, +that means the replacement text has unbalanced quotes, necessitating +another round of ‘changequote’. + + In the fixed version below, (also shipped as +‘m4-1.4.19/examples/capitalize2.m4’), ‘capitalize’ uses the alternate +quotes of ‘<<[’ and ‘]>>’ (the longer strings are chosen so as to be +less likely to appear in the text being converted). The helpers +‘_to_alt’ and ‘_from_alt’ merely reduce the number of characters +required to perform a ‘changequote’, since the definition changes twice. +The outermost pair means that ‘patsubst’ and ‘_capitalize_alt’ are +invoked with alternate quoting; the innermost pair is used so that the +third argument to ‘patsubst’ can contain an unbalanced ‘]>>’/‘<<[’ pair. +Note that ‘upcase’ and ‘downcase’ must be redefined as ‘_upcase_alt’ and +‘_downcase_alt’, since they contain nested quotes but are invoked with +the alternate quoting scheme in effect. + + $ m4 -I examples + include(`capitalize2.m4')dnl + define(`active', `act1, ive')dnl + define(`Active', `Act2, Ive')dnl + define(`ACTIVE', `ACT3, IVE')dnl + define(`A', `OOPS')dnl + capitalize(active; `active'; ``active''; ```actIVE''') + ⇒Act1,Ive; Act2, Ive; Active; `Active' + undivert(`capitalize2.m4')dnl + ⇒divert(`-1') + ⇒# upcase(text) + ⇒# downcase(text) + ⇒# capitalize(text) + ⇒# change case of text, improved version + ⇒define(`upcase', `translit(`$*', `a-z', `A-Z')') + ⇒define(`downcase', `translit(`$*', `A-Z', `a-z')') + ⇒define(`_arg1', `$1') + ⇒define(`_to_alt', `changequote(`<<[', `]>>')') + ⇒define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') + ⇒define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') + ⇒define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') + ⇒define(`_capitalize_alt', + ⇒ `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, + ⇒ <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') + ⇒define(`capitalize', + ⇒ `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, + ⇒ _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') + ⇒divert`'dnl + + +File: m4.info, Node: Improved fatal_error, Prev: Improved capitalize, Up: Answers + +17.8 Solution for ‘fatal_error’ +=============================== + +The ‘fatal_error’ macro (*note M4exit::) is not robust to versions of +GNU M4 earlier than 1.4.8, where invoking ‘__file__’ (*note Location::) +inside ‘m4wrap’ would result in an empty string, and ‘__line__’ resulted +in ‘0’ even though all files start at line 1. Furthermore, versions +earlier than 1.4.6 did not support the ‘__program__’ macro. If you want +‘fatal_error’ to work across the entire 1.4.x release series, a better +implementation would be: + + define(`fatal_error', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl + `:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* + ')m4exit(`1')') + ⇒ + m4wrap(`divnum(`demo of internal message') + fatal_error(`inside wrapped text')') + ⇒ + ^D + error→m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored + ⇒0 + error→m4:stdin:6: fatal error: inside wrapped text + + +File: m4.info, Node: Copying This Package, Next: Copying This Manual, Prev: Answers, Up: Top + +Appendix A How to make copies of the overall M4 package +******************************************************* + +This appendix covers the license for copying the source code of the +overall M4 package. This manual is under a different set of +restrictions, covered later (*note Copying This Manual::). + +* Menu: + +* GNU General Public License:: License for copying the M4 package + + +File: m4.info, Node: GNU General Public License, Up: Copying This Package + +A.1 License for copying the M4 package +====================================== + + Version 3, 29 June 2007 + + Copyright © 2007 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + +Preamble +======== + +The GNU General Public License is a free, copyleft license for software +and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program—to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers’ and authors’ protection, the GPL clearly explains +that there is no warranty for this free software. For both users’ and +authors’ sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users’ freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS +==================== + + 0. Definitions. + + “This License” refers to version 3 of the GNU General Public + License. + + “Copyright” also means copyright-like laws that apply to other + kinds of works, such as semiconductor masks. + + “The Program” refers to any copyrightable work licensed under this + License. Each licensee is addressed as “you”. “Licensees” and + “recipients” may be individuals or organizations. + + To “modify” a work means to copy from or adapt all or part of the + work in a fashion requiring copyright permission, other than the + making of an exact copy. The resulting work is called a “modified + version” of the earlier work or a work “based on” the earlier work. + + A “covered work” means either the unmodified Program or a work + based on the Program. + + To “propagate” a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it on + a computer or modifying a private copy. Propagation includes + copying, distribution (with or without modification), making + available to the public, and in some countries other activities as + well. + + To “convey” a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user + through a computer network, with no transfer of a copy, is not + conveying. + + An interactive user interface displays “Appropriate Legal Notices” + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to + the extent that warranties are provided), that licensees may convey + the work under this License, and how to view a copy of this + License. If the interface presents a list of user commands or + options, such as a menu, a prominent item in the list meets this + criterion. + + 1. Source Code. + + The “source code” for a work means the preferred form of the work + for making modifications to it. “Object code” means any non-source + form of a work. + + A “Standard Interface” means an interface that either is an + official standard defined by a recognized standards body, or, in + the case of interfaces specified for a particular programming + language, one that is widely used among developers working in that + language. + + The “System Libraries” of an executable work include anything, + other than the work as a whole, that (a) is included in the normal + form of packaging a Major Component, but which is not part of that + Major Component, and (b) serves only to enable use of the work with + that Major Component, or to implement a Standard Interface for + which an implementation is available to the public in source code + form. A “Major Component”, in this context, means a major + essential component (kernel, window system, and so on) of the + specific operating system (if any) on which the executable work + runs, or a compiler used to produce the work, or an object code + interpreter used to run it. + + The “Corresponding Source” for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including scripts + to control those activities. However, it does not include the + work’s System Libraries, or general-purpose tools or generally + available free programs which are used unmodified in performing + those activities but which are not part of the work. For example, + Corresponding Source includes interface definition files associated + with source files for the work, and the source code for shared + libraries and dynamically linked subprograms that the work is + specifically designed to require, such as by intimate data + communication or control flow between those subprograms and other + parts of the work. + + The Corresponding Source need not include anything that users can + regenerate automatically from other parts of the Corresponding + Source. + + The Corresponding Source for a work in source code form is that + same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running + a covered work is covered by this License only if the output, given + its content, constitutes a covered work. This License acknowledges + your rights of fair use or other equivalent, as provided by + copyright law. + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise + remains in force. You may convey covered works to others for the + sole purpose of having them make modifications exclusively for you, + or provide you with facilities for running those works, provided + that you comply with the terms of this License in conveying all + material for which you do not control copyright. Those thus making + or running the covered works for you must do so exclusively on your + behalf, under your direction and control, on terms that prohibit + them from making any copies of your copyrighted material outside + their relationship with you. + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section + 10 makes it unnecessary. + + 3. Protecting Users’ Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under + article 11 of the WIPO copyright treaty adopted on 20 December + 1996, or similar laws prohibiting or restricting circumvention of + such measures. + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such + circumvention is effected by exercising rights under this License + with respect to the covered work, and you disclaim any intention to + limit operation or modification of the work as a means of + enforcing, against the work’s users, your or third parties’ legal + rights to forbid circumvention of technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program’s source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the + code; keep intact all notices of the absence of any warranty; and + give all recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these + conditions: + + a. The work must carry prominent notices stating that you + modified it, and giving a relevant date. + + b. The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in + section 4 to “keep intact all notices”. + + c. You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable + section 7 additional terms, to the whole of the work, and all + its parts, regardless of how they are packaged. This License + gives no permission to license the work in any other way, but + it does not invalidate such permission if you have separately + received it. + + d. If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has + interactive interfaces that do not display Appropriate Legal + Notices, your work need not make them do so. + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered + work, and which are not combined with it such as to form a larger + program, in or on a volume of a storage or distribution medium, is + called an “aggregate” if the compilation and its resulting + copyright are not used to limit the access or legal rights of the + compilation’s users beyond what the individual works permit. + Inclusion of a covered work in an aggregate does not cause this + License to apply to the other parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this + License, in one of these ways: + + a. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b. Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that + product model, to give anyone who possesses the object code + either (1) a copy of the Corresponding Source for all the + software in the product that is covered by this License, on a + durable physical medium customarily used for software + interchange, for a price no more than your reasonable cost of + physically performing this conveying of source, or (2) access + to copy the Corresponding Source from a network server at no + charge. + + c. Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, + and only if you received the object code with such an offer, + in accord with subsection 6b. + + d. Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to + the Corresponding Source in the same way through the same + place at no further charge. You need not require recipients + to copy the Corresponding Source along with the object code. + If the place to copy the object code is a network server, the + Corresponding Source may be on a different server (operated by + you or a third party) that supports equivalent copying + facilities, provided you maintain clear directions next to the + object code saying where to find the Corresponding Source. + Regardless of what server hosts the Corresponding Source, you + remain obligated to ensure that it is available for as long as + needed to satisfy these requirements. + + e. Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the + general public at no charge under subsection 6d. + + A separable portion of the object code, whose source code is + excluded from the Corresponding Source as a System Library, need + not be included in conveying the object code work. + + A “User Product” is either (1) a “consumer product”, which means + any tangible personal property which is normally used for personal, + family, or household purposes, or (2) anything designed or sold for + incorporation into a dwelling. In determining whether a product is + a consumer product, doubtful cases shall be resolved in favor of + coverage. For a particular product received by a particular user, + “normally used” refers to a typical or common use of that class of + product, regardless of the status of the particular user or of the + way in which the particular user actually uses, or expects or is + expected to use, the product. A product is a consumer product + regardless of whether the product has substantial commercial, + industrial or non-consumer uses, unless such uses represent the + only significant mode of use of the product. + + “Installation Information” for a User Product means any methods, + procedures, authorization keys, or other information required to + install and execute modified versions of a covered work in that + User Product from a modified version of its Corresponding Source. + The information must suffice to ensure that the continued + functioning of the modified object code is in no case prevented or + interfered with solely because modification has been made. + + If you convey an object code work under this section in, or with, + or specifically for use in, a User Product, and the conveying + occurs as part of a transaction in which the right of possession + and use of the User Product is transferred to the recipient in + perpetuity or for a fixed term (regardless of how the transaction + is characterized), the Corresponding Source conveyed under this + section must be accompanied by the Installation Information. But + this requirement does not apply if neither you nor any third party + retains the ability to install modified object code on the User + Product (for example, the work has been installed in ROM). + + The requirement to provide Installation Information does not + include a requirement to continue to provide support service, + warranty, or updates for a work that has been modified or installed + by the recipient, or for the User Product in which it has been + modified or installed. Access to a network may be denied when the + modification itself materially and adversely affects the operation + of the network or violates the rules and protocols for + communication across the network. + + Corresponding Source conveyed, and Installation Information + provided, in accord with this section must be in a format that is + publicly documented (and with an implementation available to the + public in source code form), and must require no special password + or key for unpacking, reading or copying. + + 7. Additional Terms. + + “Additional permissions” are terms that supplement the terms of + this License by making exceptions from one or more of its + conditions. Additional permissions that are applicable to the + entire Program shall be treated as though they were included in + this License, to the extent that they are valid under applicable + law. If additional permissions apply only to part of the Program, + that part may be used separately under those permissions, but the + entire Program remains governed by this License without regard to + the additional permissions. + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part + of it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material + you add to a covered work, you may (if authorized by the copyright + holders of that material) supplement the terms of this License with + terms: + + a. Disclaiming warranty or limiting liability differently from + the terms of sections 15 and 16 of this License; or + + b. Requiring preservation of specified reasonable legal notices + or author attributions in that material or in the Appropriate + Legal Notices displayed by works containing it; or + + c. Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked + in reasonable ways as different from the original version; or + + d. Limiting the use for publicity purposes of names of licensors + or authors of the material; or + + e. Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f. Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified + versions of it) with contractual assumptions of liability to + the recipient, for any liability that these contractual + assumptions directly impose on those licensors and authors. + + All other non-permissive additional terms are considered “further + restrictions” within the meaning of section 10. If the Program as + you received it, or any part of it, contains a notice stating that + it is governed by this License along with a term that is a further + restriction, you may remove that term. If a license document + contains a further restriction but permits relicensing or conveying + under this License, you may add to a covered work material governed + by the terms of that license document, provided that the further + restriction does not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in + the form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights + under this License (including any patent licenses granted under the + third paragraph of section 11). + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, you do not qualify to receive new licenses + for the same material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer + transmission to receive a copy likewise does not require + acceptance. However, nothing other than this License grants you + permission to propagate or modify any covered work. These actions + infringe copyright if you do not accept this License. Therefore, + by modifying or propagating a covered work, you indicate your + acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not + responsible for enforcing compliance by third parties with this + License. + + An “entity transaction” is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a + covered work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party’s predecessor in interest had or + could give under the previous paragraph, plus a right to possession + of the Corresponding Source of the work from the predecessor in + interest, if the predecessor has it or can get it with reasonable + efforts. + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you + may not impose a license fee, royalty, or other charge for exercise + of rights granted under this License, and you may not initiate + litigation (including a cross-claim or counterclaim in a lawsuit) + alleging that any patent claim is infringed by making, using, + selling, offering for sale, or importing the Program or any portion + of it. + + 11. Patents. + + A “contributor” is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. + The work thus licensed is called the contributor’s “contributor + version”. + + A contributor’s “essential patent claims” are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, + permitted by this License, of making, using, or selling its + contributor version, but do not include claims that would be + infringed only as a consequence of further modification of the + contributor version. For purposes of this definition, “control” + includes the right to grant patent sublicenses in a manner + consistent with the requirements of this License. + + Each contributor grants you a non-exclusive, worldwide, + royalty-free patent license under the contributor’s essential + patent claims, to make, use, sell, offer for sale, import and + otherwise run, modify and propagate the contents of its contributor + version. + + In the following three paragraphs, a “patent license” is any + express agreement or commitment, however denominated, not to + enforce a patent (such as an express permission to practice a + patent or covenant not to sue for patent infringement). To “grant” + such a patent license to a party means to make such an agreement or + commitment not to enforce a patent against the party. + + If you convey a covered work, knowingly relying on a patent + license, and the Corresponding Source of the work is not available + for anyone to copy, free of charge and under the terms of this + License, through a publicly available network server or other + readily accessible means, then you must either (1) cause the + Corresponding Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this particular + work, or (3) arrange, in a manner consistent with the requirements + of this License, to extend the patent license to downstream + recipients. “Knowingly relying” means you have actual knowledge + that, but for the patent license, your conveying the covered work + in a country, or your recipient’s use of the covered work in a + country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, + modify or convey a specific copy of the covered work, then the + patent license you grant is automatically extended to all + recipients of the covered work and works based on it. + + A patent license is “discriminatory” if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that + are specifically granted under this License. You may not convey a + covered work if you are a party to an arrangement with a third + party that is in the business of distributing software, under which + you make payment to the third party based on the extent of your + activity of conveying the work, and under which the third party + grants, to any of the parties who would receive the covered work + from you, a discriminatory patent license (a) in connection with + copies of the covered work conveyed by you (or copies made from + those copies), or (b) primarily for and in connection with specific + products or compilations that contain the covered work, unless you + entered into that arrangement, or that patent license was granted, + prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + 12. No Surrender of Others’ Freedom. + + If conditions are imposed on you (whether by court order, agreement + or otherwise) that contradict the conditions of this License, they + do not excuse you from the conditions of this License. If you + cannot convey a covered work so as to satisfy simultaneously your + obligations under this License and any other pertinent obligations, + then as a consequence you may not convey it at all. For example, + if you agree to terms that obligate you to collect a royalty for + further conveying from those to whom you convey the Program, the + only way you could satisfy both those terms and this License would + be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a + single combined work, and to convey the resulting work. The terms + of this License will continue to apply to the part which is the + covered work, but the special requirements of the GNU Affero + General Public License, section 13, concerning interaction through + a network will apply to the combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new + versions of the GNU General Public License from time to time. Such + new versions will be similar in spirit to the present version, but + may differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU + General Public License “or any later version” applies to it, you + have the option of following the terms and conditions either of + that numbered version or of any later version published by the Free + Software Foundation. If the Program does not specify a version + number of the GNU General Public License, you may choose any + version ever published by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Program. + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE + COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE + RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. + SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES + AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE + THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA + BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF + THE POSSIBILITY OF SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely + approximates an absolute waiver of all civil liability in + connection with the Program, unless a warranty or assumption of + liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS +=========================== + +How to Apply These Terms to Your New Programs +============================================= + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least the +“copyright” line and a pointer to where the full notice is found. + + ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. + Copyright (C) YEAR NAME OF AUTHOR + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Also add information on how to contact you by electronic and paper +mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + PROGRAM Copyright (C) YEAR NAME OF AUTHOR + This program comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’. + This is free software, and you are welcome to redistribute it + under certain conditions; type ‘show c’ for details. + + The hypothetical commands ‘show w’ and ‘show c’ should show the +appropriate parts of the General Public License. Of course, your +program’s commands might be different; for a GUI interface, you would +use an “about box”. + + You should also get your employer (if you work as a programmer) or +school, if any, to sign a “copyright disclaimer” for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + + The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . + diff --git a/platform/dbops/binaries/build/share/info/m4.info-2 b/platform/dbops/binaries/build/share/info/m4.info-2 new file mode 100644 index 0000000000000000000000000000000000000000..75442a2bf469ca8157cd6f2c0201a55dfe27e07f --- /dev/null +++ b/platform/dbops/binaries/build/share/info/m4.info-2 @@ -0,0 +1,924 @@ +This is m4.info, produced by makeinfo version 6.7 from m4.texi. + +This manual (28 May 2021) is for GNU M4 (version 1.4.19), a package +containing an implementation of the m4 macro language. + + Copyright © 1989–1994, 2004–2014, 2016–2017, 2020–2021 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled “GNU Free Documentation License.” +INFO-DIR-SECTION Text creation and manipulation +START-INFO-DIR-ENTRY +* M4: (m4). A powerful macro processor. +END-INFO-DIR-ENTRY + + +File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Copying This Package, Up: Top + +Appendix B How to make copies of this manual +******************************************** + +This appendix covers the license for copying this manual. Note that +some of the longer examples in this manual are also distributed in the +directory ‘m4-1.4.19/examples/’, where a more permissive license is in +effect when copying just the examples. + +* Menu: + +* GNU Free Documentation License:: License for copying this manual + + +File: m4.info, Node: GNU Free Documentation License, Up: Copying This Manual + +B.1 License for copying this manual +=================================== + + Version 1.3, 3 November 2008 + + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document “free” in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of “copyleft”, which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. We + recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it can + be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + “Document”, below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as “you”. You accept + the license if you copy, modify or distribute the work in a way + requiring permission under copyright law. + + A “Modified Version” of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A “Secondary Section” is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document’s overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The “Invariant Sections” are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this License. + If a section does not fit the above definition of Secondary then it + is not allowed to be designated as Invariant. The Document may + contain zero Invariant Sections. If the Document does not identify + any Invariant Sections then there are none. + + The “Cover Texts” are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A “Transparent” copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images composed + of pixels) generic paint programs or (for drawings) some widely + available drawing editor, and that is suitable for input to text + formatters or for automatic translation to a variety of formats + suitable for input to text formatters. A copy made in an otherwise + Transparent file format whose markup, or absence of markup, has + been arranged to thwart or discourage subsequent modification by + readers is not Transparent. An image format is not Transparent if + used for any substantial amount of text. A copy that is not + “Transparent” is called “Opaque”. + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and standard-conforming + simple HTML, PostScript or PDF designed for human modification. + Examples of transparent image formats include PNG, XCF and JPG. + Opaque formats include proprietary formats that can be read and + edited only by proprietary word processors, SGML or XML for which + the DTD and/or processing tools are not generally available, and + the machine-generated HTML, PostScript or PDF produced by some word + processors for output purposes only. + + The “Title Page” means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, “Title + Page” means the text near the most prominent appearance of the + work’s title, preceding the beginning of the body of the text. + + The “publisher” means any person or entity that distributes copies + of the Document to the public. + + A section “Entitled XYZ” means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) + To “Preserve the Title” of such a section when you modify the + Document means that it remains a section “Entitled XYZ” according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow the + conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document’s license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the title + equally prominent and visible. You may add other material on the + covers in addition. Copying with changes limited to the covers, as + long as they preserve the title of the Document and satisfy these + conditions, can be treated as verbatim copying in other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a machine-readable + Transparent copy along with each Opaque copy, or state in or with + each Opaque copy a computer-network location from which the general + network-using public has access to download using public-standard + network protocols a complete Transparent copy of the Document, free + of added material. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of copies, + to give them a chance to provide you with an updated version of the + Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus licensing + distribution and modification of the Modified Version to whoever + possesses a copy of it. In addition, you must do these things in + the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that + version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document’s + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled “History”, Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on the + Title Page. If there is no section Entitled “History” in the + Document, create one stating the title, year, authors, and + publisher of the Document as given on its Title Page, then add + an item describing the Modified Version as stated in the + previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + “History” section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + + K. For any section Entitled “Acknowledgements” or “Dedications”, + Preserve the Title of the section, and preserve in the section + all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, unaltered + in their text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. + + M. Delete any section Entitled “Endorsements”. Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + “Endorsements” or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option designate + some or all of these sections as invariant. To do this, add their + titles to the list of Invariant Sections in the Modified Version’s + license notice. These titles must be distinct from any other + section titles. + + You may add a section Entitled “Endorsements”, provided it contains + nothing but endorsements of your Modified Version by various + parties—for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition of + a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts in the Modified Version. Only one passage + of Front-Cover Text and one of Back-Cover Text may be added by (or + through arrangements made by) any one entity. If the Document + already includes a cover text for the same cover, previously added + by you or by arrangement made by the same entity you are acting on + behalf of, you may not add another; but you may replace the old + one, on explicit permission from the previous publisher that added + the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination all + of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + “History” in the various original documents, forming one section + Entitled “History”; likewise combine any sections Entitled + “Acknowledgements”, and any sections Entitled “Dedications”. You + must delete all sections Entitled “Endorsements.” + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the documents + in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow this + License in all other respects regarding verbatim copying of that + document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of a + storage or distribution medium, is called an “aggregate” if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation’s users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document’s Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled “Acknowledgements”, + “Dedications”, or “History”, the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense, or distribute it is void, + and will automatically terminate your rights under this License. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, receipt of a copy of some or all of the + same material does not give you any rights to use it. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + . + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License “or any later version” applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If the + Document does not specify a version number of this License, you may + choose any version ever published (not as a draft) by the Free + Software Foundation. If the Document specifies that a proxy can + decide which future versions of this License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Document. + + 11. RELICENSING + + “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any + World Wide Web server that publishes copyrightable works and also + provides prominent facilities for anybody to edit those works. A + public wiki that anybody can edit is an example of such a server. + A “Massive Multiauthor Collaboration” (or “MMC”) contained in the + site means any set of copyrightable works thus published on the MMC + site. + + “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 + license published by Creative Commons Corporation, a not-for-profit + corporation with a principal place of business in San Francisco, + California, as well as future copyleft versions of that license + published by that same organization. + + “Incorporate” means to publish or republish a Document, in whole or + in part, as part of another Document. + + An MMC is “eligible for relicensing” if it is licensed under this + License, and if all works that were first published under this + License somewhere other than this MMC, and subsequently + incorporated in whole or in part into the MMC, (1) had no cover + texts or invariant sections, and (2) were thus incorporated prior + to November 1, 2008. + + The operator of an MMC Site may republish an MMC contained in the + site under CC-BY-SA on the same site at any time before August 1, + 2009, provided the MMC is eligible for relicensing. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the “with...Texts.” line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of free +software license, such as the GNU General Public License, to permit +their use in free software. + + +File: m4.info, Node: Indices, Prev: Copying This Manual, Up: Top + +Appendix C Indices of concepts and macros +***************************************** + +* Menu: + +* Macro index:: Index for all ‘m4’ macros +* Concept index:: Index for many concepts + + +File: m4.info, Node: Macro index, Next: Concept index, Up: Indices + +C.1 Index for all ‘m4’ macros +============================= + +This index covers all ‘m4’ builtins, as well as several useful composite +macros. References are exclusively to the places where a macro is +introduced the first time. + +[index] +* Menu: + +* __file__: Location. (line 9) +* __gnu__: Platform macros. (line 11) +* __line__: Location. (line 10) +* __os2__: Platform macros. (line 12) +* __program__: Location. (line 11) +* __unix__: Platform macros. (line 14) +* __windows__: Platform macros. (line 16) +* argn: Shift. (line 256) +* array: Define. (line 55) +* array_set: Define. (line 56) +* builtin: Builtin. (line 8) +* capitalize: Patsubst. (line 54) +* changecom: Changecom. (line 9) +* changequote: Changequote. (line 9) +* changeword: Changeword. (line 22) +* cleardivert: Cleardivert. (line 25) +* cond: Shift. (line 51) +* copy: Composition. (line 119) +* curry: Composition. (line 67) +* debugfile: Debug Output. (line 10) +* debugmode: Debug Levels. (line 77) +* decr: Incr. (line 10) +* define: Define. (line 9) +* define_blind: Composition. (line 10) +* defn: Defn. (line 9) +* divert: Divert. (line 8) +* divnum: Divnum. (line 8) +* dnl: Dnl. (line 8) +* downcase: Patsubst. (line 53) +* dquote: Shift. (line 194) +* dquote_elt: Shift. (line 195) +* dumpdef: Dumpdef. (line 9) +* errprint: Errprint. (line 8) +* esyscmd: Esyscmd. (line 8) +* eval: Eval. (line 8) +* example: Manual. (line 39) +* exch: Arguments. (line 12) +* fatal_error: M4exit. (line 24) +* foreach: Foreach. (line 8) +* foreachq: Foreach. (line 9) +* forloop: Forloop. (line 8) +* format: Format. (line 8) +* ifdef: Ifdef. (line 9) +* ifelse: Ifelse. (line 10) +* ifelse <1>: Ifelse. (line 11) +* ifelse <2>: Ifelse. (line 12) +* include: Include. (line 8) +* incr: Incr. (line 9) +* index: Index macro. (line 8) +* indir: Indir. (line 8) +* join: Shift. (line 102) +* joinall: Shift. (line 103) +* len: Len. (line 8) +* m4exit: M4exit. (line 9) +* m4wrap: M4wrap. (line 13) +* maketemp: Mkstemp. (line 11) +* mkstemp: Mkstemp. (line 10) +* nargs: Pseudo Arguments. (line 12) +* os2: Platform macros. (line 13) +* patsubst: Patsubst. (line 8) +* popdef: Pushdef. (line 11) +* pushdef: Pushdef. (line 10) +* quote: Shift. (line 193) +* regexp: Regexp. (line 8) +* rename: Composition. (line 120) +* reverse: Shift. (line 31) +* shift: Shift. (line 16) +* sinclude: Include. (line 9) +* stack_foreach: Stacks. (line 11) +* stack_foreach_lifo: Stacks. (line 12) +* stack_foreach_sep: Improved copy. (line 15) +* stack_foreach_sep_lifo: Improved copy. (line 16) +* substr: Substr. (line 8) +* syscmd: Syscmd. (line 8) +* sysval: Sysval. (line 8) +* traceoff: Trace. (line 10) +* traceon: Trace. (line 9) +* translit: Translit. (line 8) +* undefine: Undefine. (line 8) +* undivert: Undivert. (line 8) +* unix: Platform macros. (line 15) +* upcase: Patsubst. (line 52) +* windows: Platform macros. (line 17) + + +File: m4.info, Node: Concept index, Prev: Macro index, Up: Indices + +C.2 Index for many concepts +=========================== + +[index] +* Menu: + +* argument currying: Composition. (line 63) +* arguments to macros: Macro Arguments. (line 6) +* arguments to macros <1>: Arguments. (line 6) +* arguments to macros, special: Pseudo Arguments. (line 6) +* arguments, joining: Shift. (line 99) +* arguments, more than nine: Arguments. (line 54) +* arguments, more than nine <1>: Shift. (line 251) +* arguments, more than nine <2>: Improved foreach. (line 157) +* arguments, quoted macro: Quoting Arguments. (line 6) +* arguments, reversing: Shift. (line 31) +* arithmetic: Arithmetic. (line 6) +* arrays: Define. (line 52) +* avoiding quadratic behavior: Improved foreach. (line 38) +* basic regular expressions: Regexp. (line 6) +* basic regular expressions <1>: Patsubst. (line 6) +* blind macro: Inhibiting Invocation. + (line 13) +* blind macro <1>: Ifelse. (line 52) +* blind macro <2>: Composition. (line 10) +* bug reports: Bugs. (line 6) +* builtins, indirect call of: Builtin. (line 6) +* builtins, special tokens: Defn. (line 101) +* call of builtins, indirect: Builtin. (line 6) +* call of macros, indirect: Indir. (line 6) +* case statement: Ifelse. (line 69) +* changing comment delimiters: Changecom. (line 6) +* changing quote delimiters: Changequote. (line 6) +* changing syntax: Changeword. (line 6) +* characters, translating: Translit. (line 6) +* command line: Invoking m4. (line 6) +* command line, file names on the: Command line files. (line 6) +* command line, macro definitions on the: Preprocessor features. + (line 6) +* command line, options: Invoking m4. (line 10) +* commands, exit status from shell: Sysval. (line 6) +* commands, running shell: Shell commands. (line 6) +* comment delimiters, changing: Changecom. (line 6) +* comments: Comments. (line 6) +* comments, copied to output: Changecom. (line 29) +* comparing strings: Ifelse. (line 6) +* compatibility: Compatibility. (line 6) +* composing macros: Composition. (line 6) +* concatenating arguments: Shift. (line 99) +* conditional, short-circuiting: Shift. (line 51) +* conditionals: Ifdef. (line 6) +* controlling debugging output: Debug Levels. (line 6) +* copying macros: Composition. (line 116) +* counting loops: Forloop. (line 6) +* currying arguments: Composition. (line 63) +* debugging macros: Debugging. (line 6) +* debugging output, controlling: Debug Levels. (line 6) +* debugging output, saving: Debug Output. (line 6) +* decrement operator: Incr. (line 6) +* deferring expansion: M4wrap. (line 6) +* deferring output: Diversions. (line 6) +* defining new macros: Definitions. (line 6) +* definition stack: Pushdef. (line 6) +* definition stack <1>: Stacks. (line 6) +* definitions, displaying macro: Defn. (line 6) +* definitions, displaying macro <1>: Dumpdef. (line 6) +* deleting macros: Undefine. (line 6) +* deleting whitespace in input: Dnl. (line 6) +* delimiters, changing: Changequote. (line 6) +* delimiters, changing <1>: Changecom. (line 6) +* discarding diverted text: Cleardivert. (line 6) +* discarding input: Ifelse. (line 6) +* discarding input <1>: Dnl. (line 6) +* discarding input <2>: Divert. (line 42) +* displaying macro definitions: Dumpdef. (line 6) +* diversion numbers: Divnum. (line 6) +* diverted text, discarding: Cleardivert. (line 6) +* diverting output to files: Divert. (line 6) +* dumping into frozen file: Using frozen files. (line 6) +* error messages, printing: Errprint. (line 6) +* errors, fatal: Operation modes. (line 19) +* evaluation, of integer expressions: Eval. (line 6) +* examples, understanding: Manual. (line 6) +* executing shell commands: Shell commands. (line 6) +* exit status from shell commands: Sysval. (line 6) +* exiting from m4: M4exit. (line 6) +* expansion of macros: Macro expansion. (line 6) +* expansion, deferring: M4wrap. (line 6) +* expansion, tracing macro: Trace. (line 6) +* expressions, evaluation of integer: Eval. (line 6) +* expressions, regular: Regexp. (line 6) +* expressions, regular <1>: Patsubst. (line 6) +* extracting substrings: Substr. (line 6) +* fast loading of frozen files: Using frozen files. (line 6) +* fatal errors: Operation modes. (line 19) +* FDL, GNU Free Documentation License: GNU Free Documentation License. + (line 6) +* file format, frozen file: Frozen file format. (line 6) +* file inclusion: File Inclusion. (line 6) +* file inclusion <1>: Undivert. (line 13) +* file inclusion <2>: Undivert. (line 89) +* file names, on the command line: Command line files. (line 6) +* files, diverting output to: Divert. (line 6) +* files, names of temporary: Mkstemp. (line 6) +* for each loops: Foreach. (line 6) +* for loops: Forloop. (line 6) +* formatted output: Format. (line 6) +* Free Documentation License (FDL), GNU: GNU Free Documentation License. + (line 6) +* frozen file format: Frozen file format. (line 6) +* frozen files for fast loading: Using frozen files. (line 6) +* General Public License (GPL), GNU: GNU General Public License. + (line 6) +* GNU extensions: Inhibiting Invocation. + (line 13) +* GNU extensions <1>: Define. (line 41) +* GNU extensions <2>: Arguments. (line 54) +* GNU extensions <3>: Indir. (line 6) +* GNU extensions <4>: Builtin. (line 6) +* GNU extensions <5>: Debug Levels. (line 74) +* GNU extensions <6>: Debug Output. (line 6) +* GNU extensions <7>: Search Path. (line 6) +* GNU extensions <8>: Divert. (line 54) +* GNU extensions <9>: Undivert. (line 13) +* GNU extensions <10>: Undivert. (line 89) +* GNU extensions <11>: Regexp. (line 6) +* GNU extensions <12>: Patsubst. (line 6) +* GNU extensions <13>: Format. (line 6) +* GNU extensions <14>: Eval. (line 113) +* GNU extensions <15>: Esyscmd. (line 6) +* GNU extensions <16>: Mkstemp. (line 58) +* GNU extensions <17>: Using frozen files. (line 6) +* GNU extensions <18>: Extensions. (line 6) +* GNU Free Documentation License: GNU Free Documentation License. + (line 6) +* GNU General Public License: GNU General Public License. + (line 6) +* GNU M4, history of: History. (line 6) +* GPL, GNU General Public License: GNU General Public License. + (line 6) +* history of m4: History. (line 6) +* included files, search path for: Search Path. (line 6) +* inclusion, of files: File Inclusion. (line 6) +* inclusion, of files <1>: Undivert. (line 13) +* inclusion, of files <2>: Undivert. (line 89) +* increment operator: Incr. (line 6) +* indirect call of builtins: Builtin. (line 6) +* indirect call of macros: Indir. (line 6) +* initialization, frozen state: Using frozen files. (line 6) +* input location: Preprocessor features. + (line 28) +* input location <1>: Location. (line 6) +* input tokens: Syntax. (line 6) +* input, discarding: Ifelse. (line 6) +* input, discarding <1>: Dnl. (line 6) +* input, discarding <2>: Divert. (line 42) +* input, saving: M4wrap. (line 6) +* integer arithmetic: Arithmetic. (line 6) +* integer expression evaluation: Eval. (line 6) +* invoking m4: Invoking m4. (line 6) +* invoking macros: Invocation. (line 6) +* iterating over lists: Foreach. (line 6) +* joining arguments: Shift. (line 99) +* length of strings: Len. (line 6) +* lexical structure of words: Changeword. (line 6) +* License, code: Copying This Package. + (line 6) +* License, manual: Copying This Manual. (line 6) +* limit, nesting: Limits control. (line 43) +* literal output: Pseudo Arguments. (line 106) +* local variables: Pushdef. (line 79) +* location, input: Preprocessor features. + (line 28) +* location, input <1>: Location. (line 6) +* loops: Shift. (line 10) +* loops, counting: Forloop. (line 6) +* loops, list iteration: Foreach. (line 6) +* M4PATH: Search Path. (line 9) +* macro composition: Composition. (line 6) +* macro definitions, on the command line: Preprocessor features. + (line 6) +* macro expansion, tracing: Trace. (line 6) +* macro invocation: Invocation. (line 6) +* macro, blind: Inhibiting Invocation. + (line 13) +* macro, blind <1>: Ifelse. (line 52) +* macro, blind <2>: Composition. (line 10) +* macros, arguments to: Macro Arguments. (line 6) +* macros, arguments to <1>: Arguments. (line 6) +* macros, copying: Composition. (line 116) +* macros, debugging: Debugging. (line 6) +* macros, displaying definitions: Defn. (line 6) +* macros, displaying definitions <1>: Dumpdef. (line 6) +* macros, expansion of: Macro expansion. (line 6) +* macros, how to define new: Definitions. (line 6) +* macros, how to delete: Undefine. (line 6) +* macros, how to rename: Defn. (line 6) +* macros, indirect call of: Indir. (line 6) +* macros, quoted arguments to: Quoting Arguments. (line 6) +* macros, recursive: Shift. (line 6) +* macros, special arguments to: Pseudo Arguments. (line 6) +* macros, temporary redefinition of: Pushdef. (line 6) +* manipulating quotes: Shift. (line 190) +* messages, printing error: Errprint. (line 6) +* more than nine arguments: Arguments. (line 54) +* more than nine arguments <1>: Shift. (line 251) +* more than nine arguments <2>: Improved foreach. (line 157) +* multibranches: Ifelse. (line 69) +* names: Names. (line 6) +* nesting limit: Limits control. (line 43) +* nine arguments, more than: Arguments. (line 54) +* nine arguments, more than <1>: Shift. (line 251) +* nine arguments, more than <2>: Improved foreach. (line 157) +* numbers: Manual. (line 57) +* options, command line: Invoking m4. (line 10) +* output, diverting to files: Divert. (line 6) +* output, formatted: Format. (line 6) +* output, literal: Pseudo Arguments. (line 106) +* output, saving debugging: Debug Output. (line 6) +* overview of m4: Intro. (line 6) +* pattern substitution: Patsubst. (line 6) +* platform macros: Platform macros. (line 6) +* positional parameters, more than nine: Arguments. (line 54) +* POSIX: Extensions. (line 6) +* POSIXLY_CORRECT: Invoking m4. (line 10) +* POSIXLY_CORRECT <1>: Incompatibilities. (line 144) +* preprocessor features: Preprocessor features. + (line 6) +* printing error messages: Errprint. (line 6) +* pushdef stack: Pushdef. (line 6) +* pushdef stack <1>: Stacks. (line 6) +* quadratic behavior, avoiding: Improved foreach. (line 38) +* quote delimiters, changing: Changequote. (line 6) +* quote manipulation: Shift. (line 190) +* quoted macro arguments: Quoting Arguments. (line 6) +* quoted string: Quoted strings. (line 6) +* quoting rule of thumb: Quoting Arguments. (line 22) +* recursive macros: Shift. (line 6) +* redefinition of macros, temporary: Pushdef. (line 6) +* regular expressions: Changeword. (line 6) +* regular expressions <1>: Regexp. (line 6) +* regular expressions <2>: Patsubst. (line 6) +* reloading a frozen file: Using frozen files. (line 6) +* renaming macros: Defn. (line 6) +* renaming macros <1>: Composition. (line 116) +* reporting bugs: Bugs. (line 6) +* rescanning: Limits control. (line 56) +* rescanning <1>: Inhibiting Invocation. + (line 86) +* rescanning <2>: Pseudo Arguments. (line 106) +* rescanning <3>: Defn. (line 61) +* rescanning <4>: Other Incompatibilities. + (line 52) +* reversing arguments: Shift. (line 31) +* rule of thumb, quoting: Quoting Arguments. (line 22) +* running shell commands: Shell commands. (line 6) +* saving debugging output: Debug Output. (line 6) +* saving input: M4wrap. (line 6) +* search path for included files: Search Path. (line 6) +* shell commands, exit status from: Sysval. (line 6) +* shell commands, running: Shell commands. (line 6) +* short-circuiting conditional: Shift. (line 51) +* special arguments to macros: Pseudo Arguments. (line 6) +* stack, macro definition: Pushdef. (line 6) +* stack, macro definition <1>: Stacks. (line 6) +* standard error, output to: Dumpdef. (line 6) +* standard error, output to <1>: Trace. (line 6) +* standard error, output to <2>: Errprint. (line 6) +* status of shell commands: Sysval. (line 6) +* status, setting m4 exit: M4exit. (line 6) +* string, quoted: Quoted strings. (line 6) +* strings, length of: Len. (line 6) +* substitution by regular expression: Patsubst. (line 6) +* substrings, extracting: Substr. (line 6) +* substrings, locating: Index macro. (line 6) +* suggestions, reporting: Bugs. (line 6) +* suppressing warnings: Macro Arguments. (line 38) +* switch statement: Ifelse. (line 69) +* synchronization lines: Preprocessor features. + (line 28) +* syntax, changing: Changeword. (line 6) +* temporary file names: Mkstemp. (line 6) +* temporary redefinition of macros: Pushdef. (line 6) +* TMPDIR: Diversions. (line 10) +* tokens: Syntax. (line 6) +* tokens, builtin macro: Defn. (line 101) +* tokens, special: Other tokens. (line 6) +* tracing macro expansion: Trace. (line 6) +* translating characters: Translit. (line 6) +* undefining macros: Undefine. (line 6) +* UNIX commands, exit status from: Sysval. (line 6) +* UNIX commands, running: Shell commands. (line 6) +* variables, local: Pushdef. (line 79) +* warnings, suppressing: Macro Arguments. (line 38) +* words: Names. (line 6) +* words, lexical structure of: Changeword. (line 6) + diff --git a/platform/dbops/binaries/build/share/locale/af/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/af/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..35ea37a674349220b10d20836a78c632722a70c0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/af/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ast/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ast/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..4594419f6caf19547c7330b3477d4e8bd7ca7888 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ast/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/be/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/be/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..74010aa20c38d0f6e66810029686e1872bc8d85e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/be/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..d362b6f38ef4dde9a436a2c5ace37c09ed19d855 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..a96b5e1bcd22b86b51f64cebed39be6603924ccb Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..ad51ccc4e6d618617c4eecb1c67bcafd0abbb351 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..4660b39febbcdfd904f76d70451aa39fe8a659df Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/bg/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..b504421a2b326390004281c5a1841a03f5253ac0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..0f6d5d1aef20c0a5d2d0b85e72c7716ee9a67e14 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..e4d61b4cfb21fdae206c9eec6fa9b16daab502aa Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..c87a2b3df37e14c5252fdbad7e1fd0005e04fe40 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ca/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..85a18e67e949ec61f05d043fa0bcfc9ec0343081 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..937e265291fd4cfc19a2f86c2dd5864872191f64 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/cs/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..21bf376b08790d201859e9a98487acf8bf3df172 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..537ecb5ddcf8e4de3910bc5c8bfce33413a5657e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..3a677b44c9d3448b29a8ab412a5a040348ff94f8 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..612ffe8272a2490d9fc7aaf10b88ef25e3bcf287 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..f2f7da66e308095c7fc1fed207bc7dc8e8ff60d1 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/da/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..3c5d21ea6ce2f8853582a57ac371067df108c696 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..59b796cf7e720cf5d21a1ef79956e2fdc1398d64 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..2e5ae2b61f0ba41dcdf7957ecdd9d9b2ceaa7226 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..bc5224472fe5ec05bc49aef4c140b6bd6f8d1d6c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..af52200a2a7793419b948508059286fe2e05ede7 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/de/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..e651d62fa350754168587a6bf1b8f274ebf6ad71 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..1345f84ce4418b285582d8a1e63a0af0bdd529d6 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..50ff3d19f27093de45080d467b6a59486e8d8c1f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..4e6443d46f3846ebca32eb23cbf8384bfa4331f3 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/el/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..ff16a4de3f90e861bf56437ce87b0925deed0a36 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..d2ed819859d80820eb9fbca0a05f0a46361d104c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..87c1922fb6949bde9a5e710cdfecd7f77505eb2c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..6b7429936910cb92430b41a79ac5839b727d1c85 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..bbb7284f8ed5eb43b608df08842138b926e29471 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eo/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..986ccfc1e52e5f4d064dae27a7a812ed5d7f3b84 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..762d03e118c3e6c8674219746855c5370c36eb17 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..8e6e0b0855ecfac862831458d159f76d1ac89e40 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..707243f3c5a6268b1dd5bf9f5e3d51f4c9952402 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..8de490f6c104159b0f4a23b1912bccb32a6bf029 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/es/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..2cdba0a5092036cc6c7416ac3fc09d50f1917771 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..e34b9f5a5e8986d1e13cde09093b46d7970b867f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..a133aa0f05086807a2add32698767b74127b5f8b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/et/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/eu/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/eu/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..91bb4d734014fd0ec7f8c683dc66f8712bde4b59 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/eu/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..42386eefba29e8be2c26247e1eb5ec27b89a0c9c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..0a64937eb412aa1b7b872ce9994ab2f4a9a9ca46 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..c0cb971b4ddcc1e7be3809fe411927fd3ecdbdd9 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..80076adcee9333b07d165ff68d8ac8a301594a99 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..d4d7b9c521a5b6ebdeec51595b4362d943028f40 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fi/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..bb5a94a42dcfa2db5ad0742c906e36a6492b9bda Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..c247c6def036525988ba2cb55170b442371a39fb Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..8ecd98b1667f5cfea3c94933d333279e3cbcdfec Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..185f0168ce1e4b8181844690c860adf359dfe22a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..1566e02fcb63d7017f51bebbf3e60e6550a62512 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/fr/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..075543680776139c51c50783d91fc37335af1db7 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..ad33af81087cd29d9a723a1b375fa07c807dc802 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..7df73e5ac47197fc64d64b1be8196a89de03ac58 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..85eaf911cff49abb9b50a238afd40071680f7494 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..0e671d2f6ee86c77f2ec8935e4730860dd479eb4 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ga/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..d6994f2edddd119cc788835097238e025a620fcc Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..5bf941fad88bfcedd3dd2d86d3c314389315688f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..e57a571cc00db054efd2176283425c403c4a101b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/gl/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..16f604ae91fa0a12239d0fa853b3b863b78861be Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..449282c1fd23a06af61652b250a06cc50bd6362f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..81e3aefa0b1db2ec0338c8e9712416fec487f588 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..3cd133ca5c8b909dbf723bd46daccbc6556e82b2 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hr/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..988ae6b11f8d057348638000a578056ba6d1fb67 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..5753573e8bc29045fda8daf47b9f6ba45e33f631 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/hu/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ia/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ia/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..45d44b032a93458788f83de37e13dfbb52e5c4c0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ia/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..cfd65f4038c43958a935b4fdf765452d2f4921b6 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..fdc255704a1e47ccb663bec41d635479171a0119 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..4e27509111297a472858c26d630f695e51f150d0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/id/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..122196c3b3c017ed1e259d3bcd3a3c20e5fb9eba Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..3b7c3d5db994684d32dda4e9d3bd918ddafa837a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..5ce0fa543ff3a5a71c0c381be436801960ebf0c2 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/it/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..c8dbc11de2ddb01f2a6e0e28ada3782ba33ccb76 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..f944e36f46df11459e13e5a785947448fc88a63e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..f6f4b579b3e3788d826fb6f935cda9331884d11c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..c4654360613feb5d79dc8e06a71e689f6991ad93 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ja/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..b500faa9e5a3908280c28bf9fbd9e5fa433097d5 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..32fb888a936d52e855a830eb2d04ec3e0be9e9dc Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..18f5fac5701e28704f552aab2236831363f2163e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ko/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ky/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ky/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..5b8384fa64eb0df92397a20644754b0d4c97712e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ky/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/lt/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/lt/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..5c26c3441fe19dcd01a2de29ac46c4c3dd632268 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/lt/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/lv/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/lv/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..c4596ee092f80af9807d7bd069a1c2b57afba560 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/lv/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..4f02d72106f8d8a11ad16baba5a0e6e3f410cc6e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..d5689c31cc19b8b5ab12ef74be485c45b96284d8 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..3bf06464a8c9405c5ca0bbe5699df5f91f7902ad Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ms/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..67c677b8153a3215f9fed0a7b51959ffa99199f9 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..57f5f0e801a9e95d84dc5ea592c30f4c5175dfbf Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..116023b8ae1d64385b820efd94eec684ee8c0adf Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nb/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..24544b2a68414754719f416d8c166fca3f97ff7e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..39f7a60af90e462468aa02da039373541cd98c30 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..9497e79b2ff447fa10b1acfab585bb25287a1095 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..0c50a8d8b19fae91005d7975c582bbfb53bc4337 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..443e39c54dc9bc22e2ca81c9a357f21430d30f2e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/nl/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..e8f3026714f4a4c4ab87f7bccaf0dd568e0b8109 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..28da36f999462d141abe7c2e654d529bd35b51e5 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..73cff93214d1eefda14d6b92ac2390bf6dd3e714 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..182bf8feca60c844fe21d5c8c83315b86341d952 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..55461a6a958bb53997788bec966a83b7a4ecdbf6 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pl/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..1b26c93365aeb33307a9f1a23f6f6ab2c68253e1 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..a2bc3ea597448a8d98e89269a0ce180dd7c1c2d6 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..64935dd2c20df3f63dc74461518c5d941012df3d Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..c1ffbe27d05af468b8b031dc14ccc83e3d2fb51f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..e3dfdffb299b872f23c2ce53377be050fce0a10a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..c00b845d3c4ce7ee7db95e47553f4dbbcd831b63 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..cd3789fc0812dd6cadbb881f23969105ffbbb690 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..f10106f7e2192c0bcc068adb4268f7261a3d8d4c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/pt_BR/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..8ddabb378c45f338bfc371259071a4a0d4f34348 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..bdddd081dff46994bb74d245c52579752923c608 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..408b465e9b7ed45b333dd60af5bd1c43871d14e2 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..a324a038250d568ccab8e5947dec9e31d283cdd1 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..86abca14c6c35d13c2ad8ad0a99c0a131cca6569 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ro/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..7ca0091d5952863eb53b00f15c558d05a227f248 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..1c9da6ea8eed42d200449e14d34361c90ddf623a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..3044a88a2b64247def8efaadc6953c258d0af1c0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..8a303cc94789f754b4c97d35906ccb4ebc03e672 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..e5905db2a05b5c6ee6013209b8c3554479cc99c9 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ru/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/rw/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/rw/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..d25f680cfcb19cad2a1faefc2b2f3bdf4fa50902 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/rw/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sk/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/sk/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..27bc7aca9b7d8b080b4e49e2662a3b1883dbb66e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sk/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..c1e018543cf3ed0fee8db9d1ea675827e90af475 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..fbd9328a14b333240c0931d50542d66f84b0f189 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sl/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sq/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/sq/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..cdeb0aa426a7025f210b966116ec30cd5f628497 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sq/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..ffcd19589d6767e79fafa4554606aba638d33bb2 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..3da5e7421afbe1ec7697a023ceb5d476f2a88450 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..e238529f63bacd56c5243d9b910328cff3873f8b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..9f36fb991f6c809f4a2cfc97a15e77e74345fff0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..72482156f8b670abfa07ef3dcdf005d5baca098e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sr/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..7ff949cf617ea4ed8597f319911e0fcc4cab6195 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..d0588c70dfd97a438d605accfaea0a5fcc253061 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..e280d46f12fc804e773151aef3be7208aec90e4a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..7461ce70f8c94eef09e9c6a73228dad2518e2599 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..fe8f7b5a25c1ce7d5c18762b82f0c9b4ac0bd86b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/sv/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/ta/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/ta/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..b76db2a8c41e1a6241e1cee4c635766c3b155683 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/ta/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/th/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/th/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..73ef2affa5e6e3ba66b7e98a6484c39d3c157f33 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/th/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..327fb8ef8e6be946ebd9e0889d17e042d917adeb Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..a4c65c00009e293437aaec99de03d42839309bf8 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..de5d2242e16314bd2585b54978427199c29b601a Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..9bf07d6f621dfdfc4fe84724784ee5dc7b663b5e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/tr/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..dc0440f15d7c37b99214222f9514b1db260d107e Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..4adc0085e92be86c99ed2c9d9b1a22b5b66f74e1 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..635dde9bf48aac17448d5f623a96d45e3832142b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..26b6bbf202d95ed00c234a9f184f71225268e781 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/uk/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..4aa160671aa625c152ae52920d4f15fcbddfbc39 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..4bc0bce47b9eb1a7d144aa3c8eec1c3d5857dbb5 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..fa5d51b9ab7337b2c8002301efe686444a54625c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..33df582e8eff57c1969e53611f09026e060bb7a0 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..b893a6052d55f19023be4ae8d77a005590e8ab1c Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/vi/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..7599a9c774d4e42ada2434c12dabd0ef45dda50f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..7f252b37df35e60d636cc303f4d9978265176e47 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..cc34ee414615ee7cb27a180d2f8c988193c19c5f Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..9db64993df745839cce0f843520ce5e78271216b Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..60dcbed8b22ef607f6c5667b4b814acd01b2c012 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_CN/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-gnulib.mo b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-gnulib.mo new file mode 100644 index 0000000000000000000000000000000000000000..42de81407b97ccdee1428f210a20e523cb0cb209 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-gnulib.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-runtime.mo b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-runtime.mo new file mode 100644 index 0000000000000000000000000000000000000000..23c9a25deed19b288b2d5fc75a54d09fe3777b97 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison-runtime.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison.mo b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison.mo new file mode 100644 index 0000000000000000000000000000000000000000..0bcb8766a5580dbac39a5d3eeead3b9f8db16268 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/bison.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/flex.mo b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/flex.mo new file mode 100644 index 0000000000000000000000000000000000000000..57d8ae46dbb78d44e02e8edbf9c861915955f5fe Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/flex.mo differ diff --git a/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/m4.mo b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/m4.mo new file mode 100644 index 0000000000000000000000000000000000000000..17eee197f442a5cfb885212992a2036ac60496e6 Binary files /dev/null and b/platform/dbops/binaries/build/share/locale/zh_TW/LC_MESSAGES/m4.mo differ diff --git a/platform/dbops/binaries/build/share/man/man1/bison.1 b/platform/dbops/binaries/build/share/man/man1/bison.1 new file mode 100644 index 0000000000000000000000000000000000000000..c1bb7a236392fb4f4aa688c0e4559a6ac067eeff --- /dev/null +++ b/platform/dbops/binaries/build/share/man/man1/bison.1 @@ -0,0 +1,285 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.4. +.TH BISON "1" "September 2021" "GNU Bison 3.8.2" "User Commands" +.SH NAME +bison \- GNU Project parser generator (yacc replacement) +.SH SYNOPSIS +.B bison +[\fI\,OPTION\/\fR]... \fI\,FILE\/\fR +.SH DESCRIPTION +.I Bison +is a parser generator in the style of +.IR yacc (1). +It should be upwardly compatible with input files designed +for +.IR yacc . +.PP +Input files should follow the +.I yacc +convention of ending in +.BR .y . +Unlike +.IR yacc , +the generated files do not have fixed names, but instead use the prefix +of the input file. +Moreover, if you need to put +.I C++ +code in the input file, you can end his name by a C++-like extension +(.ypp or .y++), then bison will follow your extension to name the +output file (.cpp or .c++). +For instance, a grammar description file named +.B parse.yxx +would produce the generated parser in a file named +.BR parse.tab.cxx , +instead of +.IR yacc 's +.B y.tab.c +or old +.I Bison +version's +.BR parse.tab.c . +.PP +This description of the options that can be given to +.I bison +is adapted from the node +.B Invocation +in the +.B bison.texi +manual, which should be taken as authoritative. +.PP +.I Bison +supports both traditional single-letter options and mnemonic long +option names. Long option names are indicated with +.B \-\- +instead of +.BR \- . +Abbreviations for option names are allowed as long as they +are unique. When a long option takes an argument, like +.BR \-\-file-prefix , +connect the option name and the argument with +.BR = . +.PP +Generate a deterministic LR or generalized LR (GLR) parser employing +LALR(1), IELR(1), or canonical LR(1) parser tables. +.PP +Mandatory arguments to long options are mandatory for short options too. +The same is true for optional arguments. +.SS "Operation Modes:" +.TP +\fB\-h\fR, \fB\-\-help\fR +display this help and exit +.TP +\fB\-V\fR, \fB\-\-version\fR +output version information and exit +.TP +\fB\-\-print\-localedir\fR +output directory containing locale\-dependent data +and exit +.TP +\fB\-\-print\-datadir\fR +output directory containing skeletons and XSLT +and exit +.TP +\fB\-u\fR, \fB\-\-update\fR +apply fixes to the source grammar file and exit +.TP +\fB\-f\fR, \fB\-\-feature\fR[=\fI\,FEATURES\/\fR] +activate miscellaneous features +.SS "FEATURES is a list of comma separated words that can include:" +.TP +caret, diagnostics\-show\-caret +show errors with carets +.TP +fixit, diagnostics\-parseable\-fixits +show machine\-readable fixes +.TP +syntax\-only +do not generate any file +.TP +all +all of the above +.TP +none +disable all of the above +.SS "Diagnostics:" +.TP +\fB\-W\fR, \fB\-\-warnings\fR[=\fI\,CATEGORY\/\fR] +report the warnings falling in CATEGORY +.TP +\fB\-\-color\fR[=\fI\,WHEN\/\fR] +whether to colorize the diagnostics +.TP +\fB\-\-style\fR=\fI\,FILE\/\fR +specify the CSS FILE for colorizer diagnostics +.SS "Warning categories include:" +.TP +conflicts\-sr +S/R conflicts (enabled by default) +.TP +conflicts\-rr +R/R conflicts (enabled by default) +.TP +counterexamples, cex +generate conflict counterexamples +.TP +dangling\-alias +string aliases not attached to a symbol +.TP +deprecated +obsolete constructs +.TP +empty\-rule +empty rules without %empty +.TP +midrule\-values +unset or unused midrule values +.TP +precedence +useless precedence and associativity +.TP +yacc +incompatibilities with POSIX Yacc +.TP +other +all other warnings (enabled by default) +.TP +all +all the warnings except 'counterexamples', 'dangling\-alias' and 'yacc' +.TP +no\-CATEGORY +turn off warnings in CATEGORY +.TP +none +turn off all the warnings +.TP +error[=CATEGORY] +treat warnings as errors +.SS "WHEN can be one of the following:" +.TP +always, yes +colorize the output +.TP +never, no +don't colorize the output +.TP +auto, tty +colorize if the output device is a tty +.SS "Tuning the Parser:" +.TP +\fB\-L\fR, \fB\-\-language\fR=\fI\,LANGUAGE\/\fR +specify the output programming language +.TP +\fB\-S\fR, \fB\-\-skeleton\fR=\fI\,FILE\/\fR +specify the skeleton to use +.TP +\fB\-t\fR, \fB\-\-debug\fR +instrument the parser for tracing +same as '\-Dparse.trace' +.TP +\fB\-\-locations\fR +enable location support +.TP +\fB\-D\fR, \fB\-\-define=NAME\fR[=\fI\,VALUE\/\fR] +similar to '%define NAME VALUE' +.TP +\fB\-F\fR, \fB\-\-force\-define=NAME\fR[=\fI\,VALUE\/\fR] +override '%define NAME VALUE' +.TP +\fB\-p\fR, \fB\-\-name\-prefix\fR=\fI\,PREFIX\/\fR +prepend PREFIX to the external symbols +deprecated by '\-Dapi.prefix={PREFIX}' +.TP +\fB\-l\fR, \fB\-\-no\-lines\fR +don't generate '#line' directives +.TP +\fB\-k\fR, \fB\-\-token\-table\fR +include a table of token names +.TP +\fB\-y\fR, \fB\-\-yacc\fR +emulate POSIX Yacc +.SS "Output Files:" +.TP +\fB\-H\fR, \fB\-\-header\fR=\fI\,[FILE]\/\fR +also produce a header file +.TP +\fB\-d\fR +likewise but cannot specify FILE (for POSIX Yacc) +.TP +\fB\-r\fR, \fB\-\-report\fR=\fI\,THINGS\/\fR +also produce details on the automaton +.TP +\fB\-\-report\-file\fR=\fI\,FILE\/\fR +write report to FILE +.TP +\fB\-v\fR, \fB\-\-verbose\fR +same as '\-\-report=state' +.TP +\fB\-b\fR, \fB\-\-file\-prefix\fR=\fI\,PREFIX\/\fR +specify a PREFIX for output files +.TP +\fB\-o\fR, \fB\-\-output\fR=\fI\,FILE\/\fR +leave output to FILE +.TP +\fB\-g\fR, \fB\-\-graph\fR[=\fI\,FILE\/\fR] +also output a graph of the automaton +.TP +\fB\-\-html\fR[=\fI\,FILE\/\fR] +also output an HTML report of the automaton +.TP +\fB\-x\fR, \fB\-\-xml\fR[=\fI\,FILE\/\fR] +also output an XML report of the automaton +.TP +\fB\-M\fR, \fB\-\-file\-prefix\-map\fR=\fI\,OLD=NEW\/\fR replace prefix OLD with NEW when writing file paths +in output files +.SS "THINGS is a list of comma separated words that can include:" +.TP +states +describe the states +.TP +itemsets +complete the core item sets with their closure +.TP +lookaheads +explicitly associate lookahead tokens to items +.TP +solved +describe shift/reduce conflicts solving +.TP +counterexamples, cex +generate conflict counterexamples +.TP +all +include all the above information +.TP +none +disable the report +.SH AUTHOR +Written by Robert Corbett and Richard Stallman. +.SH "REPORTING BUGS" +Report bugs to . +.br +GNU Bison home page: . +.br +General help using GNU software: . +.br +For complete documentation, run: info bison. +.SH COPYRIGHT +Copyright \(co 2021 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR lex (1), +.BR flex (1), +.BR yacc (1). +.PP +The full documentation for +.B bison +is maintained as a Texinfo manual. If the +.B info +and +.B bison +programs are properly installed at your site, the command +.IP +.B info bison +.PP +should give you access to the complete manual. diff --git a/platform/dbops/binaries/build/share/man/man1/flex.1 b/platform/dbops/binaries/build/share/man/man1/flex.1 new file mode 100644 index 0000000000000000000000000000000000000000..a1cd26921debbdc9cd03693556602f6680f1bd18 --- /dev/null +++ b/platform/dbops/binaries/build/share/man/man1/flex.1 @@ -0,0 +1,163 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. +.TH FLEX "1" "May 2017" "The Flex Project" "Programming" +.SH NAME +flex \- the fast lexical analyser generator +.SH SYNOPSIS +.B flex +[\fI\,OPTIONS\/\fR] [\fI\,FILE\/\fR]... +.SH DESCRIPTION +Generates programs that perform pattern\-matching on text. +.SS "Table Compression:" +.TP +\fB\-Ca\fR, \fB\-\-align\fR +trade off larger tables for better memory alignment +.TP +\fB\-Ce\fR, \fB\-\-ecs\fR +construct equivalence classes +.TP +\fB\-Cf\fR +do not compress tables; use \fB\-f\fR representation +.TP +\fB\-CF\fR +do not compress tables; use \fB\-F\fR representation +.TP +\fB\-Cm\fR, \fB\-\-meta\-ecs\fR +construct meta\-equivalence classes +.TP +\fB\-Cr\fR, \fB\-\-read\fR +use read() instead of stdio for scanner input +.TP +\fB\-f\fR, \fB\-\-full\fR +generate fast, large scanner. Same as \fB\-Cfr\fR +.TP +\fB\-F\fR, \fB\-\-fast\fR +use alternate table representation. Same as \fB\-CFr\fR +.TP +\fB\-Cem\fR +default compression (same as \fB\-\-ecs\fR \fB\-\-meta\-ecs\fR) +.SS "Debugging:" +.TP +\fB\-d\fR, \fB\-\-debug\fR +enable debug mode in scanner +.TP +\fB\-b\fR, \fB\-\-backup\fR +write backing\-up information to lex.backup +.TP +\fB\-p\fR, \fB\-\-perf\-report\fR +write performance report to stderr +.TP +\fB\-s\fR, \fB\-\-nodefault\fR +suppress default rule to ECHO unmatched text +.TP +\fB\-T\fR, \fB\-\-trace\fR +flex should run in trace mode +.TP +\fB\-w\fR, \fB\-\-nowarn\fR +do not generate warnings +.TP +\fB\-v\fR, \fB\-\-verbose\fR +write summary of scanner statistics to stdout +.TP +\fB\-\-hex\fR +use hexadecimal numbers instead of octal in debug outputs +.SH FILES +.TP +\fB\-o\fR, \fB\-\-outfile\fR=\fI\,FILE\/\fR +specify output filename +.TP +\fB\-S\fR, \fB\-\-skel\fR=\fI\,FILE\/\fR +specify skeleton file +.TP +\fB\-t\fR, \fB\-\-stdout\fR +write scanner on stdout instead of lex.yy.c +.TP +\fB\-\-yyclass\fR=\fI\,NAME\/\fR +name of C++ class +.TP +\fB\-\-header\-file\fR=\fI\,FILE\/\fR +create a C header file in addition to the scanner +.HP +\fB\-\-tables\-file\fR[=\fI\,FILE\/\fR] write tables to FILE +.SS "Scanner behavior:" +.TP +\fB\-7\fR, \fB\-\-7bit\fR +generate 7\-bit scanner +.TP +\fB\-8\fR, \fB\-\-8bit\fR +generate 8\-bit scanner +.TP +\fB\-B\fR, \fB\-\-batch\fR +generate batch scanner (opposite of \fB\-I\fR) +.TP +\fB\-i\fR, \fB\-\-case\-insensitive\fR +ignore case in patterns +.TP +\fB\-l\fR, \fB\-\-lex\-compat\fR +maximal compatibility with original lex +.TP +\fB\-X\fR, \fB\-\-posix\-compat\fR +maximal compatibility with POSIX lex +.TP +\fB\-I\fR, \fB\-\-interactive\fR +generate interactive scanner (opposite of \fB\-B\fR) +.TP +\fB\-\-yylineno\fR +track line count in yylineno +.SS "Generated code:" +.TP +\-+, \fB\-\-c\fR++ +generate C++ scanner class +.TP +\fB\-Dmacro\fR[=\fI\,defn\/\fR] +#define macro defn (default defn is '1') +.TP +\fB\-L\fR, \fB\-\-noline\fR +suppress #line directives in scanner +.TP +\fB\-P\fR, \fB\-\-prefix\fR=\fI\,STRING\/\fR +use STRING as prefix instead of "yy" +.TP +\fB\-R\fR, \fB\-\-reentrant\fR +generate a reentrant C scanner +.TP +\fB\-\-bison\-bridge\fR +scanner for bison pure parser. +.TP +\fB\-\-bison\-locations\fR +include yylloc support. +.TP +\fB\-\-stdinit\fR +initialize yyin/yyout to stdin/stdout +.TP +\fB\-\-nounistd\fR +do not include +.TP +\fB\-\-noFUNCTION\fR +do not generate a particular FUNCTION +.SS "Miscellaneous:" +.TP +\fB\-c\fR +do\-nothing POSIX option +.TP +\fB\-n\fR +do\-nothing POSIX option +.HP +\-? +.TP +\fB\-h\fR, \fB\-\-help\fR +produce this help message +.TP +\fB\-V\fR, \fB\-\-version\fR +report flex version +.SH "SEE ALSO" +The full documentation for +.B flex +is maintained as a Texinfo manual. If the +.B info +and +.B flex +programs are properly installed at your site, the command +.IP +.B info flex +.PP +should give you access to the complete manual. diff --git a/platform/dbops/binaries/build/share/man/man1/m4.1 b/platform/dbops/binaries/build/share/man/man1/m4.1 new file mode 100644 index 0000000000000000000000000000000000000000..536f289f9a6ede89b6ed3f8c04f0b9508ff9b869 --- /dev/null +++ b/platform/dbops/binaries/build/share/man/man1/m4.1 @@ -0,0 +1,154 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.3. +.TH M4 "1" "May 2021" "GNU M4 1.4.19" "User Commands" +.SH NAME +m4 \- macro processor +.SH SYNOPSIS +.B m4 +[\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR]... +.SH DESCRIPTION +Process macros in FILEs. If no FILE or if FILE is `\-', standard input +is read. +.PP +Mandatory or optional arguments to long options are mandatory or optional +for short options too. +.SS "Operation modes:" +.TP +\fB\-\-help\fR +display this help and exit +.TP +\fB\-\-version\fR +output version information and exit +.TP +\fB\-E\fR, \fB\-\-fatal\-warnings\fR +once: warnings become errors, twice: stop +execution at first error +.TP +\fB\-i\fR, \fB\-\-interactive\fR +unbuffer output, ignore interrupts +.TP +\fB\-P\fR, \fB\-\-prefix\-builtins\fR +force a `m4_' prefix to all builtins +.TP +\fB\-Q\fR, \fB\-\-quiet\fR, \fB\-\-silent\fR +suppress some warnings for builtins +.TP +\fB\-\-warn\-macro\-sequence\fR[=\fI\,REGEXP\/\fR] +warn if macro definition matches REGEXP, +.IP +default \e$\e({[^}]*}\e|[0\-9][0\-9]+\e) +.TP +\fB\-W\fR, \fB\-\-word\-regexp\fR=\fI\,REGEXP\/\fR +use REGEXP for macro name syntax +.SS "Preprocessor features:" +.TP +\fB\-D\fR, \fB\-\-define=NAME\fR[=\fI\,VALUE\/\fR] +define NAME as having VALUE, or empty +.TP +\fB\-I\fR, \fB\-\-include\fR=\fI\,DIRECTORY\/\fR +append DIRECTORY to include path +.TP +\fB\-s\fR, \fB\-\-synclines\fR +generate `#line NUM "FILE"' lines +.TP +\fB\-U\fR, \fB\-\-undefine\fR=\fI\,NAME\/\fR +undefine NAME +.SS "Limits control:" +.TP +\fB\-g\fR, \fB\-\-gnu\fR +override \fB\-G\fR to re\-enable GNU extensions +.TP +\fB\-G\fR, \fB\-\-traditional\fR +suppress all GNU extensions +.TP +\fB\-H\fR, \fB\-\-hashsize\fR=\fI\,PRIME\/\fR +set symbol lookup hash table size [509] +.TP +\fB\-L\fR, \fB\-\-nesting\-limit\fR=\fI\,NUMBER\/\fR +change nesting limit, 0 for unlimited [0] +.SS "Frozen state files:" +.TP +\fB\-F\fR, \fB\-\-freeze\-state\fR=\fI\,FILE\/\fR +produce a frozen state on FILE at end +.TP +\fB\-R\fR, \fB\-\-reload\-state\fR=\fI\,FILE\/\fR +reload a frozen state from FILE at start +.SS "Debugging:" +.TP +\fB\-d\fR, \fB\-\-debug\fR[=\fI\,FLAGS\/\fR] +set debug level (no FLAGS implies `aeq') +.TP +\fB\-\-debugfile\fR[=\fI\,FILE\/\fR] +redirect debug and trace output to FILE +(default stderr, discard if empty string) +.TP +\fB\-l\fR, \fB\-\-arglength\fR=\fI\,NUM\/\fR +restrict macro tracing size +.TP +\fB\-t\fR, \fB\-\-trace\fR=\fI\,NAME\/\fR +trace NAME when it is defined +.SS "FLAGS is any of:" +.TP +a +show actual arguments +.TP +c +show before collect, after collect and after call +.TP +e +show expansion +.TP +f +say current input file name +.TP +i +show changes in input files +.TP +l +say current input line number +.TP +p +show results of path searches +.TP +q +quote values as necessary, with a or e flag +.TP +t +trace for all macro calls, not only traceon'ed +.TP +x +add a unique macro call id, useful with c flag +.TP +V +shorthand for all of the above flags +.PP +If defined, the environment variable `M4PATH' is a colon\-separated list +of directories included after any specified by `\-I'. +.PP +Exit status is 0 for success, 1 for failure, 63 for frozen file version +mismatch, or whatever value was passed to the m4exit macro. +.SH AUTHOR +Written by Rene' Seindal. +.SH "REPORTING BUGS" +Report bugs to: bug\-m4@gnu.org +.br +GNU M4 home page: +.br +General help using GNU software: +.SH COPYRIGHT +Copyright \(co 2021 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later . +.br +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.SH "SEE ALSO" +The full documentation for +.B m4 +is maintained as a Texinfo manual. If the +.B info +and +.B m4 +programs are properly installed at your site, the command +.IP +.B info m4 +.PP +should give you access to the complete manual. diff --git a/platform/dbops/binaries/build/share/man/man1/yacc.1 b/platform/dbops/binaries/build/share/man/man1/yacc.1 new file mode 100644 index 0000000000000000000000000000000000000000..d911bf88d30f88dc3a1825171f688ff87180dfb5 --- /dev/null +++ b/platform/dbops/binaries/build/share/man/man1/yacc.1 @@ -0,0 +1,41 @@ +.TH YACC "1" "November 2007" "GNU Bison 3.8.2" "User Commands" +.SH NAME +yacc \- GNU Project parser generator +.SH SYNOPSIS +.B yacc +[\fIOPTION\fR]... \fIFILE\fR +.SH DESCRIPTION +.I Yacc +(Yet Another Compiler Compiler) is a parser generator. This +version is a simple wrapper around +.IR bison (1). +It passes option +\fB\-y\fR, \fB\-\-yacc\fR +to activate the upward compatibility mode. See +.IR bison (1) +for more information. +.SH AUTHOR +Written by Paul Eggert. +.SH "REPORTING BUGS" +Report bugs to . +.SH COPYRIGHT +Copyright \(co 2021 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR lex (1), +.BR flex (1), +.BR bison (1). +.PP +The full documentation for +.B bison +is maintained as a Texinfo manual. If the +.B info +and +.B bison +programs are properly installed at your site, the command +.IP +.B info bison +.PP +should give you access to the complete manual. diff --git a/platform/dbops/binaries/postgres/include/informix/esql/datetime.h b/platform/dbops/binaries/postgres/include/informix/esql/datetime.h new file mode 100644 index 0000000000000000000000000000000000000000..44b24227e55a5b477fa454892d088e70a9227c74 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/informix/esql/datetime.h @@ -0,0 +1,14 @@ +/* src/interfaces/ecpg/include/datetime.h */ + +#ifndef _ECPG_DATETIME_H +#define _ECPG_DATETIME_H + +#include + +/* source created by ecpg which defines these symbols */ +#ifndef _ECPGLIB_H +typedef timestamp dtime_t; +typedef interval intrvl_t; +#endif /* ndef _ECPGLIB_H */ + +#endif /* ndef _ECPG_DATETIME_H */ diff --git a/platform/dbops/binaries/postgres/include/informix/esql/decimal.h b/platform/dbops/binaries/postgres/include/informix/esql/decimal.h new file mode 100644 index 0000000000000000000000000000000000000000..6ac296253043600ca5b03165c62a9a3e1ede9b46 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/informix/esql/decimal.h @@ -0,0 +1,13 @@ +/* src/interfaces/ecpg/include/decimal.h */ + +#ifndef _ECPG_DECIMAL_H +#define _ECPG_DECIMAL_H + +#include + +/* source created by ecpg which defines this */ +#ifndef _ECPGLIB_H +typedef decimal dec_t; +#endif /* ndef _ECPGLIB_H */ + +#endif /* ndef _ECPG_DECIMAL_H */ diff --git a/platform/dbops/binaries/postgres/include/informix/esql/sqltypes.h b/platform/dbops/binaries/postgres/include/informix/esql/sqltypes.h new file mode 100644 index 0000000000000000000000000000000000000000..e7cbfa479567de6324fc68b24278416663f77dee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/informix/esql/sqltypes.h @@ -0,0 +1,57 @@ +#ifndef ECPG_SQLTYPES_H +#define ECPG_SQLTYPES_H + +#include + +#define CCHARTYPE ECPGt_char +#define CSHORTTYPE ECPGt_short +#define CINTTYPE ECPGt_int +#define CLONGTYPE ECPGt_long +#define CFLOATTYPE ECPGt_float +#define CDOUBLETYPE ECPGt_double +#define CDECIMALTYPE ECPGt_decimal +#define CFIXCHARTYPE 108 +#define CSTRINGTYPE ECPGt_char +#define CDATETYPE ECPGt_date +#define CMONEYTYPE 111 +#define CDTIMETYPE ECPGt_timestamp +#define CLOCATORTYPE 113 +#define CVCHARTYPE ECPGt_varchar +#define CINVTYPE 115 +#define CFILETYPE 116 +#define CINT8TYPE ECPGt_long_long +#define CCOLLTYPE 118 +#define CLVCHARTYPE 119 +#define CFIXBINTYPE 120 +#define CVARBINTYPE 121 +#define CBOOLTYPE ECPGt_bool +#define CROWTYPE 123 +#define CLVCHARPTRTYPE 124 +#define CTYPEMAX 25 + +/* + * Values used in sqlda->sqlvar[i]->sqltype + */ +#define SQLCHAR ECPGt_char +#define SQLSMINT ECPGt_short +#define SQLINT ECPGt_int +#define SQLFLOAT ECPGt_double +#define SQLSMFLOAT ECPGt_float +#define SQLDECIMAL ECPGt_decimal +#define SQLSERIAL ECPGt_int +#define SQLDATE ECPGt_date +#define SQLDTIME ECPGt_timestamp +#define SQLTEXT ECPGt_char +#define SQLVCHAR ECPGt_char +#define SQLINTERVAL ECPGt_interval +#define SQLNCHAR ECPGt_char +#define SQLNVCHAR ECPGt_char +#ifdef HAVE_LONG_LONG_INT_64 +#define SQLINT8 ECPGt_long_long +#define SQLSERIAL8 ECPGt_long_long +#else +#define SQLINT8 ECPGt_long +#define SQLSERIAL8 ECPGt_long +#endif + +#endif /* ndef ECPG_SQLTYPES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/hio.h b/platform/dbops/binaries/postgres/include/server/access/hio.h new file mode 100644 index 0000000000000000000000000000000000000000..24621cf22b21ddd306bee007af00c3a31b5d019a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/hio.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * hio.h + * POSTGRES heap access method input/output definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/hio.h + * + *------------------------------------------------------------------------- + */ +#ifndef HIO_H +#define HIO_H + +#include "access/htup.h" +#include "storage/buf.h" +#include "utils/relcache.h" + +/* + * state for bulk inserts --- private to heapam.c and hio.c + * + * If current_buf isn't InvalidBuffer, then we are holding an extra pin + * on that buffer. + * + * "typedef struct BulkInsertStateData *BulkInsertState" is in heapam.h + */ +typedef struct BulkInsertStateData +{ + BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ + Buffer current_buf; /* current insertion target page */ + + /* + * State for bulk extensions. + * + * last_free..next_free are further pages that were unused at the time of + * the last extension. They might be in use by the time we use them + * though, so rechecks are needed. + * + * XXX: Eventually these should probably live in RelationData instead, + * alongside targetblock. + * + * already_extended_by is the number of pages that this bulk inserted + * extended by. If we already extended by a significant number of pages, + * we can be more aggressive about extending going forward. + */ + BlockNumber next_free; + BlockNumber last_free; + uint32 already_extended_by; +} BulkInsertStateData; + + +extern void RelationPutHeapTuple(Relation relation, Buffer buffer, + HeapTuple tuple, bool token); +extern Buffer RelationGetBufferForTuple(Relation relation, Size len, + Buffer otherBuffer, int options, + BulkInsertStateData *bistate, + Buffer *vmbuffer, Buffer *vmbuffer_other, + int num_pages); + +#endif /* HIO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/htup.h b/platform/dbops/binaries/postgres/include/server/access/htup.h new file mode 100644 index 0000000000000000000000000000000000000000..116cb1bb27315082022f267a47872a197a096f55 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/htup.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * htup.h + * POSTGRES heap tuple definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/htup.h + * + *------------------------------------------------------------------------- + */ +#ifndef HTUP_H +#define HTUP_H + +#include "storage/itemptr.h" + +/* typedefs and forward declarations for structs defined in htup_details.h */ + +typedef struct HeapTupleHeaderData HeapTupleHeaderData; + +typedef HeapTupleHeaderData *HeapTupleHeader; + +typedef struct MinimalTupleData MinimalTupleData; + +typedef MinimalTupleData *MinimalTuple; + + +/* + * HeapTupleData is an in-memory data structure that points to a tuple. + * + * There are several ways in which this data structure is used: + * + * * Pointer to a tuple in a disk buffer: t_data points directly into the + * buffer (which the code had better be holding a pin on, but this is not + * reflected in HeapTupleData itself). + * + * * Pointer to nothing: t_data is NULL. This is used as a failure indication + * in some functions. + * + * * Part of a palloc'd tuple: the HeapTupleData itself and the tuple + * form a single palloc'd chunk. t_data points to the memory location + * immediately following the HeapTupleData struct (at offset HEAPTUPLESIZE). + * This is the output format of heap_form_tuple and related routines. + * + * * Separately allocated tuple: t_data points to a palloc'd chunk that + * is not adjacent to the HeapTupleData. (This case is deprecated since + * it's difficult to tell apart from case #1. It should be used only in + * limited contexts where the code knows that case #1 will never apply.) + * + * * Separately allocated minimal tuple: t_data points MINIMAL_TUPLE_OFFSET + * bytes before the start of a MinimalTuple. As with the previous case, + * this can't be told apart from case #1 by inspection; code setting up + * or destroying this representation has to know what it's doing. + * + * t_len should always be valid, except in the pointer-to-nothing case. + * t_self and t_tableOid should be valid if the HeapTupleData points to + * a disk buffer, or if it represents a copy of a tuple on disk. They + * should be explicitly set invalid in manufactured tuples. + */ +typedef struct HeapTupleData +{ + uint32 t_len; /* length of *t_data */ + ItemPointerData t_self; /* SelfItemPointer */ + Oid t_tableOid; /* table the tuple came from */ +#define FIELDNO_HEAPTUPLEDATA_DATA 3 + HeapTupleHeader t_data; /* -> tuple header and data */ +} HeapTupleData; + +typedef HeapTupleData *HeapTuple; + +#define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData)) + +/* + * Accessor macros to be used with HeapTuple pointers. + */ +#define HeapTupleIsValid(tuple) PointerIsValid(tuple) + +/* HeapTupleHeader functions implemented in utils/time/combocid.c */ +extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup); +extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup); +extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup, + CommandId *cmax, bool *iscombo); + +/* Prototype for HeapTupleHeader accessors in heapam.c */ +extern TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple); + +#endif /* HTUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/htup_details.h b/platform/dbops/binaries/postgres/include/server/access/htup_details.h new file mode 100644 index 0000000000000000000000000000000000000000..5e38ef869697ace7567dec9c648bfb4884f8b6a7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/htup_details.h @@ -0,0 +1,811 @@ +/*------------------------------------------------------------------------- + * + * htup_details.h + * POSTGRES heap tuple header definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/htup_details.h + * + *------------------------------------------------------------------------- + */ +#ifndef HTUP_DETAILS_H +#define HTUP_DETAILS_H + +#include "access/htup.h" +#include "access/transam.h" +#include "access/tupdesc.h" +#include "access/tupmacs.h" +#include "storage/bufpage.h" +#include "varatt.h" + +/* + * MaxTupleAttributeNumber limits the number of (user) columns in a tuple. + * The key limit on this value is that the size of the fixed overhead for + * a tuple, plus the size of the null-values bitmap (at 1 bit per column), + * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most + * machines the upper limit without making t_hoff wider would be a little + * over 1700. We use round numbers here and for MaxHeapAttributeNumber + * so that alterations in HeapTupleHeaderData layout won't change the + * supported max number of columns. + */ +#define MaxTupleAttributeNumber 1664 /* 8 * 208 */ + +/* + * MaxHeapAttributeNumber limits the number of (user) columns in a table. + * This should be somewhat less than MaxTupleAttributeNumber. It must be + * at least one less, else we will fail to do UPDATEs on a maximal-width + * table (because UPDATE has to form working tuples that include CTID). + * In practice we want some additional daylight so that we can gracefully + * support operations that add hidden "resjunk" columns, for example + * SELECT * FROM wide_table ORDER BY foo, bar, baz. + * In any case, depending on column data types you will likely be running + * into the disk-block-based limit on overall tuple size if you have more + * than a thousand or so columns. TOAST won't help. + */ +#define MaxHeapAttributeNumber 1600 /* 8 * 200 */ + +/* + * Heap tuple header. To avoid wasting space, the fields should be + * laid out in such a way as to avoid structure padding. + * + * Datums of composite types (row types) share the same general structure + * as on-disk tuples, so that the same routines can be used to build and + * examine them. However the requirements are slightly different: a Datum + * does not need any transaction visibility information, and it does need + * a length word and some embedded type information. We can achieve this + * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple + * with the fields needed in the Datum case. Typically, all tuples built + * in-memory will be initialized with the Datum fields; but when a tuple is + * about to be inserted in a table, the transaction fields will be filled, + * overwriting the datum fields. + * + * The overall structure of a heap tuple looks like: + * fixed fields (HeapTupleHeaderData struct) + * nulls bitmap (if HEAP_HASNULL is set in t_infomask) + * alignment padding (as needed to make user data MAXALIGN'd) + * object ID (if HEAP_HASOID_OLD is set in t_infomask, not created + * anymore) + * user data fields + * + * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three + * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax + * and Xvac share a field. This works because we know that Cmin and Cmax + * are only interesting for the lifetime of the inserting and deleting + * transaction respectively. If a tuple is inserted and deleted in the same + * transaction, we store a "combo" command id that can be mapped to the real + * cmin and cmax, but only by use of local state within the originating + * backend. See combocid.c for more details. Meanwhile, Xvac is only set by + * old-style VACUUM FULL, which does not have any command sub-structure and so + * does not need either Cmin or Cmax. (This requires that old-style VACUUM + * FULL never try to move a tuple whose Cmin or Cmax is still interesting, + * ie, an insert-in-progress or delete-in-progress tuple.) + * + * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid + * is initialized with its own TID (location). If the tuple is ever updated, + * its t_ctid is changed to point to the replacement version of the tuple. Or + * if the tuple is moved from one partition to another, due to an update of + * the partition key, t_ctid is set to a special value to indicate that + * (see ItemPointerSetMovedPartitions). Thus, a tuple is the latest version + * of its row iff XMAX is invalid or + * t_ctid points to itself (in which case, if XMAX is valid, the tuple is + * either locked or deleted). One can follow the chain of t_ctid links + * to find the newest version of the row, unless it was moved to a different + * partition. Beware however that VACUUM might + * erase the pointed-to (newer) tuple before erasing the pointing (older) + * tuple. Hence, when following a t_ctid link, it is necessary to check + * to see if the referenced slot is empty or contains an unrelated tuple. + * Check that the referenced tuple has XMIN equal to the referencing tuple's + * XMAX to verify that it is actually the descendant version and not an + * unrelated tuple stored into a slot recently freed by VACUUM. If either + * check fails, one may assume that there is no live descendant version. + * + * t_ctid is sometimes used to store a speculative insertion token, instead + * of a real TID. A speculative token is set on a tuple that's being + * inserted, until the inserter is sure that it wants to go ahead with the + * insertion. Hence a token should only be seen on a tuple with an XMAX + * that's still in-progress, or invalid/aborted. The token is replaced with + * the tuple's real TID when the insertion is confirmed. One should never + * see a speculative insertion token while following a chain of t_ctid links, + * because they are not used on updates, only insertions. + * + * Following the fixed header fields, the nulls bitmap is stored (beginning + * at t_bits). The bitmap is *not* stored if t_infomask shows that there + * are no nulls in the tuple. If an OID field is present (as indicated by + * t_infomask), then it is stored just before the user data, which begins at + * the offset shown by t_hoff. Note that t_hoff must be a multiple of + * MAXALIGN. + */ + +typedef struct HeapTupleFields +{ + TransactionId t_xmin; /* inserting xact ID */ + TransactionId t_xmax; /* deleting or locking xact ID */ + + union + { + CommandId t_cid; /* inserting or deleting command ID, or both */ + TransactionId t_xvac; /* old-style VACUUM FULL xact ID */ + } t_field3; +} HeapTupleFields; + +typedef struct DatumTupleFields +{ + int32 datum_len_; /* varlena header (do not touch directly!) */ + + int32 datum_typmod; /* -1, or identifier of a record type */ + + Oid datum_typeid; /* composite type OID, or RECORDOID */ + + /* + * datum_typeid cannot be a domain over composite, only plain composite, + * even if the datum is meant as a value of a domain-over-composite type. + * This is in line with the general principle that CoerceToDomain does not + * change the physical representation of the base type value. + * + * Note: field ordering is chosen with thought that Oid might someday + * widen to 64 bits. + */ +} DatumTupleFields; + +struct HeapTupleHeaderData +{ + union + { + HeapTupleFields t_heap; + DatumTupleFields t_datum; + } t_choice; + + ItemPointerData t_ctid; /* current TID of this or newer tuple (or a + * speculative insertion token) */ + + /* Fields below here must match MinimalTupleData! */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2 2 + uint16 t_infomask2; /* number of attributes + various flags */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK 3 + uint16 t_infomask; /* various flag bits, see below */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_HOFF 4 + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + +#define FIELDNO_HEAPTUPLEHEADERDATA_BITS 5 + bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in htup.h */ + +#define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits) + +/* + * information stored in t_infomask: + */ +#define HEAP_HASNULL 0x0001 /* has null attribute(s) */ +#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */ +#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */ +#define HEAP_HASOID_OLD 0x0008 /* has an object-id field */ +#define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */ +#define HEAP_COMBOCID 0x0020 /* t_cid is a combo CID */ +#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */ +#define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */ + + /* xmax is a shared locker */ +#define HEAP_XMAX_SHR_LOCK (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK) + +#define HEAP_LOCK_MASK (HEAP_XMAX_SHR_LOCK | HEAP_XMAX_EXCL_LOCK | \ + HEAP_XMAX_KEYSHR_LOCK) +#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */ +#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */ +#define HEAP_XMIN_FROZEN (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID) +#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */ +#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */ +#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */ +#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */ +#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0 + * VACUUM FULL; kept for binary + * upgrade support */ +#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN) + +#define HEAP_XACT_MASK 0xFFF0 /* visibility-related bits */ + +/* + * A tuple is only locked (i.e. not updated by its Xmax) if the + * HEAP_XMAX_LOCK_ONLY bit is set; or, for pg_upgrade's sake, if the Xmax is + * not a multi and the EXCL_LOCK bit is set. + * + * See also HeapTupleHeaderIsOnlyLocked, which also checks for a possible + * aborted updater transaction. + * + * Beware of multiple evaluations of the argument. + */ +#define HEAP_XMAX_IS_LOCKED_ONLY(infomask) \ + (((infomask) & HEAP_XMAX_LOCK_ONLY) || \ + (((infomask) & (HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK)) == HEAP_XMAX_EXCL_LOCK)) + +/* + * A tuple that has HEAP_XMAX_IS_MULTI and HEAP_XMAX_LOCK_ONLY but neither of + * HEAP_XMAX_EXCL_LOCK and HEAP_XMAX_KEYSHR_LOCK must come from a tuple that was + * share-locked in 9.2 or earlier and then pg_upgrade'd. + * + * In 9.2 and prior, HEAP_XMAX_IS_MULTI was only set when there were multiple + * FOR SHARE lockers of that tuple. That set HEAP_XMAX_LOCK_ONLY (with a + * different name back then) but neither of HEAP_XMAX_EXCL_LOCK and + * HEAP_XMAX_KEYSHR_LOCK. That combination is no longer possible in 9.3 and + * up, so if we see that combination we know for certain that the tuple was + * locked in an earlier release; since all such lockers are gone (they cannot + * survive through pg_upgrade), such tuples can safely be considered not + * locked. + * + * We must not resolve such multixacts locally, because the result would be + * bogus, regardless of where they stand with respect to the current valid + * multixact range. + */ +#define HEAP_LOCKED_UPGRADED(infomask) \ +( \ + ((infomask) & HEAP_XMAX_IS_MULTI) != 0 && \ + ((infomask) & HEAP_XMAX_LOCK_ONLY) != 0 && \ + (((infomask) & (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)) == 0) \ +) + +/* + * Use these to test whether a particular lock is applied to a tuple + */ +#define HEAP_XMAX_IS_SHR_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_SHR_LOCK) +#define HEAP_XMAX_IS_EXCL_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_EXCL_LOCK) +#define HEAP_XMAX_IS_KEYSHR_LOCKED(infomask) \ + (((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_KEYSHR_LOCK) + +/* turn these all off when Xmax is to change */ +#define HEAP_XMAX_BITS (HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID | \ + HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK | HEAP_XMAX_LOCK_ONLY) + +/* + * information stored in t_infomask2: + */ +#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ +/* bits 0x1800 are available */ +#define HEAP_KEYS_UPDATED 0x2000 /* tuple was updated and key cols + * modified, or tuple deleted */ +#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ +#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ + +#define HEAP2_XACT_MASK 0xE000 /* visibility-related bits */ + +/* + * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is + * only used in tuples that are in the hash table, and those don't need + * any visibility information, so we can overlay it on a visibility flag + * instead of using up a dedicated bit. + */ +#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */ + +/* + * HeapTupleHeader accessor macros + * + * Note: beware of multiple evaluations of "tup" argument. But the Set + * macros evaluate their other argument only once. + */ + +/* + * HeapTupleHeaderGetRawXmin returns the "raw" xmin field, which is the xid + * originally used to insert the tuple. However, the tuple might actually + * be frozen (via HeapTupleHeaderSetXminFrozen) in which case the tuple's xmin + * is visible to every snapshot. Prior to PostgreSQL 9.4, we actually changed + * the xmin to FrozenTransactionId, and that value may still be encountered + * on disk. + */ +#define HeapTupleHeaderGetRawXmin(tup) \ +( \ + (tup)->t_choice.t_heap.t_xmin \ +) + +#define HeapTupleHeaderGetXmin(tup) \ +( \ + HeapTupleHeaderXminFrozen(tup) ? \ + FrozenTransactionId : HeapTupleHeaderGetRawXmin(tup) \ +) + +#define HeapTupleHeaderSetXmin(tup, xid) \ +( \ + (tup)->t_choice.t_heap.t_xmin = (xid) \ +) + +#define HeapTupleHeaderXminCommitted(tup) \ +( \ + ((tup)->t_infomask & HEAP_XMIN_COMMITTED) != 0 \ +) + +#define HeapTupleHeaderXminInvalid(tup) \ +( \ + ((tup)->t_infomask & (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)) == \ + HEAP_XMIN_INVALID \ +) + +#define HeapTupleHeaderXminFrozen(tup) \ +( \ + ((tup)->t_infomask & (HEAP_XMIN_FROZEN)) == HEAP_XMIN_FROZEN \ +) + +#define HeapTupleHeaderSetXminCommitted(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_COMMITTED) \ +) + +#define HeapTupleHeaderSetXminInvalid(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminCommitted(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_INVALID) \ +) + +#define HeapTupleHeaderSetXminFrozen(tup) \ +( \ + AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \ + ((tup)->t_infomask |= HEAP_XMIN_FROZEN) \ +) + +/* + * HeapTupleHeaderGetRawXmax gets you the raw Xmax field. To find out the Xid + * that updated a tuple, you might need to resolve the MultiXactId if certain + * bits are set. HeapTupleHeaderGetUpdateXid checks those bits and takes care + * to resolve the MultiXactId if necessary. This might involve multixact I/O, + * so it should only be used if absolutely necessary. + */ +#define HeapTupleHeaderGetUpdateXid(tup) \ +( \ + (!((tup)->t_infomask & HEAP_XMAX_INVALID) && \ + ((tup)->t_infomask & HEAP_XMAX_IS_MULTI) && \ + !((tup)->t_infomask & HEAP_XMAX_LOCK_ONLY)) ? \ + HeapTupleGetUpdateXid(tup) \ + : \ + HeapTupleHeaderGetRawXmax(tup) \ +) + +#define HeapTupleHeaderGetRawXmax(tup) \ +( \ + (tup)->t_choice.t_heap.t_xmax \ +) + +#define HeapTupleHeaderSetXmax(tup, xid) \ +( \ + (tup)->t_choice.t_heap.t_xmax = (xid) \ +) + +/* + * HeapTupleHeaderGetRawCommandId will give you what's in the header whether + * it is useful or not. Most code should use HeapTupleHeaderGetCmin or + * HeapTupleHeaderGetCmax instead, but note that those Assert that you can + * get a legitimate result, ie you are in the originating transaction! + */ +#define HeapTupleHeaderGetRawCommandId(tup) \ +( \ + (tup)->t_choice.t_heap.t_field3.t_cid \ +) + +/* SetCmin is reasonably simple since we never need a combo CID */ +#define HeapTupleHeaderSetCmin(tup, cid) \ +do { \ + Assert(!((tup)->t_infomask & HEAP_MOVED)); \ + (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ + (tup)->t_infomask &= ~HEAP_COMBOCID; \ +} while (0) + +/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */ +#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \ +do { \ + Assert(!((tup)->t_infomask & HEAP_MOVED)); \ + (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \ + if (iscombo) \ + (tup)->t_infomask |= HEAP_COMBOCID; \ + else \ + (tup)->t_infomask &= ~HEAP_COMBOCID; \ +} while (0) + +#define HeapTupleHeaderGetXvac(tup) \ +( \ + ((tup)->t_infomask & HEAP_MOVED) ? \ + (tup)->t_choice.t_heap.t_field3.t_xvac \ + : \ + InvalidTransactionId \ +) + +#define HeapTupleHeaderSetXvac(tup, xid) \ +do { \ + Assert((tup)->t_infomask & HEAP_MOVED); \ + (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \ +} while (0) + +StaticAssertDecl(MaxOffsetNumber < SpecTokenOffsetNumber, + "invalid speculative token constant"); + +#define HeapTupleHeaderIsSpeculative(tup) \ +( \ + (ItemPointerGetOffsetNumberNoCheck(&(tup)->t_ctid) == SpecTokenOffsetNumber) \ +) + +#define HeapTupleHeaderGetSpeculativeToken(tup) \ +( \ + AssertMacro(HeapTupleHeaderIsSpeculative(tup)), \ + ItemPointerGetBlockNumber(&(tup)->t_ctid) \ +) + +#define HeapTupleHeaderSetSpeculativeToken(tup, token) \ +( \ + ItemPointerSet(&(tup)->t_ctid, token, SpecTokenOffsetNumber) \ +) + +#define HeapTupleHeaderIndicatesMovedPartitions(tup) \ + ItemPointerIndicatesMovedPartitions(&(tup)->t_ctid) + +#define HeapTupleHeaderSetMovedPartitions(tup) \ + ItemPointerSetMovedPartitions(&(tup)->t_ctid) + +#define HeapTupleHeaderGetDatumLength(tup) \ + VARSIZE(tup) + +#define HeapTupleHeaderSetDatumLength(tup, len) \ + SET_VARSIZE(tup, len) + +#define HeapTupleHeaderGetTypeId(tup) \ +( \ + (tup)->t_choice.t_datum.datum_typeid \ +) + +#define HeapTupleHeaderSetTypeId(tup, typeid) \ +( \ + (tup)->t_choice.t_datum.datum_typeid = (typeid) \ +) + +#define HeapTupleHeaderGetTypMod(tup) \ +( \ + (tup)->t_choice.t_datum.datum_typmod \ +) + +#define HeapTupleHeaderSetTypMod(tup, typmod) \ +( \ + (tup)->t_choice.t_datum.datum_typmod = (typmod) \ +) + +/* + * Note that we stop considering a tuple HOT-updated as soon as it is known + * aborted or the would-be updating transaction is known aborted. For best + * efficiency, check tuple visibility before using this macro, so that the + * INVALID bits will be as up to date as possible. + */ +#define HeapTupleHeaderIsHotUpdated(tup) \ +( \ + ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \ + ((tup)->t_infomask & HEAP_XMAX_INVALID) == 0 && \ + !HeapTupleHeaderXminInvalid(tup) \ +) + +#define HeapTupleHeaderSetHotUpdated(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_HOT_UPDATED \ +) + +#define HeapTupleHeaderClearHotUpdated(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \ +) + +#define HeapTupleHeaderIsHeapOnly(tup) \ +( \ + ((tup)->t_infomask2 & HEAP_ONLY_TUPLE) != 0 \ +) + +#define HeapTupleHeaderSetHeapOnly(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \ +) + +#define HeapTupleHeaderClearHeapOnly(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \ +) + +#define HeapTupleHeaderHasMatch(tup) \ +( \ + ((tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0 \ +) + +#define HeapTupleHeaderSetMatch(tup) \ +( \ + (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \ +) + +#define HeapTupleHeaderClearMatch(tup) \ +( \ + (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \ +) + +#define HeapTupleHeaderGetNatts(tup) \ + ((tup)->t_infomask2 & HEAP_NATTS_MASK) + +#define HeapTupleHeaderSetNatts(tup, natts) \ +( \ + (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \ +) + +#define HeapTupleHeaderHasExternal(tup) \ + (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0) + + +/* + * BITMAPLEN(NATTS) - + * Computes size of null bitmap given number of data columns. + */ +#define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8) + +/* + * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including + * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the + * other stuff that has to be on a disk page. Since heap pages use no + * "special space", there's no deduction for that. + * + * NOTE: we allow for the ItemId that must point to the tuple, ensuring that + * an otherwise-empty page can indeed hold a tuple of this size. Because + * ItemIds and tuples have different alignment requirements, don't assume that + * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page. + */ +#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))) +#define MinHeapTupleSize MAXALIGN(SizeofHeapTupleHeader) + +/* + * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can + * fit on one heap page. (Note that indexes could have more, because they + * use a smaller tuple header.) We arrive at the divisor because each tuple + * must be maxaligned, and it must have an associated line pointer. + * + * Note: with HOT, there could theoretically be more line pointers (not actual + * tuples) than this on a heap page. However we constrain the number of line + * pointers to this anyway, to avoid excessive line-pointer bloat and not + * require increases in the size of work arrays. + */ +#define MaxHeapTuplesPerPage \ + ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ + (MAXALIGN(SizeofHeapTupleHeader) + sizeof(ItemIdData)))) + +/* + * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of + * data fields of char(n) and similar types. It need not have anything + * directly to do with the *actual* upper limit of varlena values, which + * is currently 1Gb (see TOAST structures in postgres.h). I've set it + * at 10Mb which seems like a reasonable number --- tgl 8/6/00. + */ +#define MaxAttrSize (10 * 1024 * 1024) + + +/* + * MinimalTuple is an alternative representation that is used for transient + * tuples inside the executor, in places where transaction status information + * is not required, the tuple rowtype is known, and shaving off a few bytes + * is worthwhile because we need to store many tuples. The representation + * is chosen so that tuple access routines can work with either full or + * minimal tuples via a HeapTupleData pointer structure. The access routines + * see no difference, except that they must not access the transaction status + * or t_ctid fields because those aren't there. + * + * For the most part, MinimalTuples should be accessed via TupleTableSlot + * routines. These routines will prevent access to the "system columns" + * and thereby prevent accidental use of the nonexistent fields. + * + * MinimalTupleData contains a length word, some padding, and fields matching + * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so + * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both + * structs. This makes data alignment rules equivalent in both cases. + * + * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is + * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the + * minimal tuple --- that is, where a full tuple matching the minimal tuple's + * data would start. This trick is what makes the structs seem equivalent. + * + * Note that t_hoff is computed the same as in a full tuple, hence it includes + * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. + * + * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data + * other than the length word. tuplesort.c and tuplestore.c use this to avoid + * writing the padding to disk. + */ +#define MINIMAL_TUPLE_OFFSET \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_PADDING \ + ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF) +#define MINIMAL_TUPLE_DATA_OFFSET \ + offsetof(MinimalTupleData, t_infomask2) + +struct MinimalTupleData +{ + uint32 t_len; /* actual length of minimal tuple */ + + char mt_padding[MINIMAL_TUPLE_PADDING]; + + /* Fields below here must match HeapTupleHeaderData! */ + + uint16 t_infomask2; /* number of attributes + various flags */ + + uint16 t_infomask; /* various flag bits, see below */ + + uint8 t_hoff; /* sizeof header incl. bitmap, padding */ + + /* ^ - 23 bytes - ^ */ + + bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */ + + /* MORE DATA FOLLOWS AT END OF STRUCT */ +}; + +/* typedef appears in htup.h */ + +#define SizeofMinimalTupleHeader offsetof(MinimalTupleData, t_bits) + + +/* + * GETSTRUCT - given a HeapTuple pointer, return address of the user data + */ +#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff) + +/* + * Accessor macros to be used with HeapTuple pointers. + */ + +#define HeapTupleHasNulls(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0) + +#define HeapTupleNoNulls(tuple) \ + (!((tuple)->t_data->t_infomask & HEAP_HASNULL)) + +#define HeapTupleHasVarWidth(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0) + +#define HeapTupleAllFixed(tuple) \ + (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH)) + +#define HeapTupleHasExternal(tuple) \ + (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0) + +#define HeapTupleIsHotUpdated(tuple) \ + HeapTupleHeaderIsHotUpdated((tuple)->t_data) + +#define HeapTupleSetHotUpdated(tuple) \ + HeapTupleHeaderSetHotUpdated((tuple)->t_data) + +#define HeapTupleClearHotUpdated(tuple) \ + HeapTupleHeaderClearHotUpdated((tuple)->t_data) + +#define HeapTupleIsHeapOnly(tuple) \ + HeapTupleHeaderIsHeapOnly((tuple)->t_data) + +#define HeapTupleSetHeapOnly(tuple) \ + HeapTupleHeaderSetHeapOnly((tuple)->t_data) + +#define HeapTupleClearHeapOnly(tuple) \ + HeapTupleHeaderClearHeapOnly((tuple)->t_data) + +/* prototypes for functions in common/heaptuple.c */ +extern Size heap_compute_data_size(TupleDesc tupleDesc, + const Datum *values, const bool *isnull); +extern void heap_fill_tuple(TupleDesc tupleDesc, + const Datum *values, const bool *isnull, + char *data, Size data_size, + uint16 *infomask, bits8 *bit); +extern bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc); +extern Datum nocachegetattr(HeapTuple tup, int attnum, + TupleDesc tupleDesc); +extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, + bool *isnull); +extern Datum getmissingattr(TupleDesc tupleDesc, + int attnum, bool *isnull); +extern HeapTuple heap_copytuple(HeapTuple tuple); +extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest); +extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc); +extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull); +extern HeapTuple heap_modify_tuple(HeapTuple tuple, + TupleDesc tupleDesc, + const Datum *replValues, + const bool *replIsnull, + const bool *doReplace); +extern HeapTuple heap_modify_tuple_by_cols(HeapTuple tuple, + TupleDesc tupleDesc, + int nCols, + const int *replCols, + const Datum *replValues, + const bool *replIsnull); +extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, + Datum *values, bool *isnull); +extern void heap_freetuple(HeapTuple htup); +extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull); +extern void heap_free_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup); +extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); +extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup); +extern size_t varsize_any(void *p); +extern HeapTuple heap_expand_tuple(HeapTuple sourceTuple, TupleDesc tupleDesc); +extern MinimalTuple minimal_expand_tuple(HeapTuple sourceTuple, TupleDesc tupleDesc); + +#ifndef FRONTEND +/* + * fastgetattr + * Fetch a user attribute's value as a Datum (might be either a + * value, or a pointer into the data area of the tuple). + * + * This must not be used when a system attribute might be requested. + * Furthermore, the passed attnum MUST be valid. Use heap_getattr() + * instead, if in doubt. + * + * This gets called many times, so we macro the cacheable and NULL + * lookups, and call nocachegetattr() for the rest. + */ +static inline Datum +fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + Assert(attnum > 0); + + *isnull = false; + if (HeapTupleNoNulls(tup)) + { + Form_pg_attribute att; + + att = TupleDescAttr(tupleDesc, attnum - 1); + if (att->attcacheoff >= 0) + return fetchatt(att, (char *) tup->t_data + tup->t_data->t_hoff + + att->attcacheoff); + else + return nocachegetattr(tup, attnum, tupleDesc); + } + else + { + if (att_isnull(attnum - 1, tup->t_data->t_bits)) + { + *isnull = true; + return (Datum) NULL; + } + else + return nocachegetattr(tup, attnum, tupleDesc); + } +} + +/* + * heap_getattr + * Extract an attribute of a heap tuple and return it as a Datum. + * This works for either system or user attributes. The given attnum + * is properly range-checked. + * + * If the field in question has a NULL value, we return a zero Datum + * and set *isnull == true. Otherwise, we set *isnull == false. + * + * is the pointer to the heap tuple. is the attribute + * number of the column (field) caller wants. is a + * pointer to the structure describing the row and all its fields. + * + */ +static inline Datum +heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + if (attnum > 0) + { + if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data)) + return getmissingattr(tupleDesc, attnum, isnull); + else + return fastgetattr(tup, attnum, tupleDesc, isnull); + } + else + return heap_getsysattr(tup, attnum, tupleDesc, isnull); +} +#endif /* FRONTEND */ + +#endif /* HTUP_DETAILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/itup.h b/platform/dbops/binaries/postgres/include/server/access/itup.h new file mode 100644 index 0000000000000000000000000000000000000000..94885751e590f93eba33dc7ebfd198de9df047c2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/itup.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * itup.h + * POSTGRES index tuple definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/itup.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITUP_H +#define ITUP_H + +#include "access/tupdesc.h" +#include "access/tupmacs.h" +#include "storage/bufpage.h" +#include "storage/itemptr.h" + +/* + * Index tuple header structure + * + * All index tuples start with IndexTupleData. If the HasNulls bit is set, + * this is followed by an IndexAttributeBitMapData. The index attribute + * values follow, beginning at a MAXALIGN boundary. + * + * Note that the space allocated for the bitmap does not vary with the number + * of attributes; that is because we don't have room to store the number of + * attributes in the header. Given the MAXALIGN constraint there's no space + * savings to be had anyway, for usual values of INDEX_MAX_KEYS. + */ + +typedef struct IndexTupleData +{ + ItemPointerData t_tid; /* reference TID to heap tuple */ + + /* --------------- + * t_info is laid out in the following fashion: + * + * 15th (high) bit: has nulls + * 14th bit: has var-width attributes + * 13th bit: AM-defined meaning + * 12-0 bit: size of tuple + * --------------- + */ + + unsigned short t_info; /* various info about tuple */ + +} IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */ + +typedef IndexTupleData *IndexTuple; + +typedef struct IndexAttributeBitMapData +{ + bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8]; +} IndexAttributeBitMapData; + +typedef IndexAttributeBitMapData * IndexAttributeBitMap; + +/* + * t_info manipulation macros + */ +#define INDEX_SIZE_MASK 0x1FFF +#define INDEX_AM_RESERVED_BIT 0x2000 /* reserved for index-AM specific + * usage */ +#define INDEX_VAR_MASK 0x4000 +#define INDEX_NULL_MASK 0x8000 + +#define IndexTupleSize(itup) ((Size) ((itup)->t_info & INDEX_SIZE_MASK)) +#define IndexTupleHasNulls(itup) ((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK)) +#define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK)) + + +/* routines in indextuple.c */ +extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull); +extern IndexTuple index_form_tuple_context(TupleDesc tupleDescriptor, + const Datum *values, const bool *isnull, + MemoryContext context); +extern Datum nocache_index_getattr(IndexTuple tup, int attnum, + TupleDesc tupleDesc); +extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, + Datum *values, bool *isnull); +extern void index_deform_tuple_internal(TupleDesc tupleDescriptor, + Datum *values, bool *isnull, + char *tp, bits8 *bp, int hasnulls); +extern IndexTuple CopyIndexTuple(IndexTuple source); +extern IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor, + IndexTuple source, int leavenatts); + + +/* + * Takes an infomask as argument (primarily because this needs to be usable + * at index_form_tuple time so enough space is allocated). + */ +static inline Size +IndexInfoFindDataOffset(unsigned short t_info) +{ + if (!(t_info & INDEX_NULL_MASK)) + return MAXALIGN(sizeof(IndexTupleData)); + else + return MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)); +} + +#ifndef FRONTEND + +/* ---------------- + * index_getattr + * + * This gets called many times, so we macro the cacheable and NULL + * lookups, and call nocache_index_getattr() for the rest. + * + * ---------------- + */ +static inline Datum +index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + Assert(PointerIsValid(isnull)); + Assert(attnum > 0); + + *isnull = false; + + if (!IndexTupleHasNulls(tup)) + { + if (TupleDescAttr(tupleDesc, attnum - 1)->attcacheoff >= 0) + { + return fetchatt(TupleDescAttr(tupleDesc, attnum - 1), + (char *) tup + IndexInfoFindDataOffset(tup->t_info) + + TupleDescAttr(tupleDesc, attnum - 1)->attcacheoff); + } + else + return nocache_index_getattr(tup, attnum, tupleDesc); + } + else + { + if (att_isnull(attnum - 1, (bits8 *) tup + sizeof(IndexTupleData))) + { + *isnull = true; + return (Datum) NULL; + } + else + return nocache_index_getattr(tup, attnum, tupleDesc); + } +} + +#endif + +/* + * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can + * fit on one index page. An index tuple must have either data or a null + * bitmap, so we can safely assume it's at least 1 byte bigger than a bare + * IndexTupleData struct. We arrive at the divisor because each tuple + * must be maxaligned, and it must have an associated line pointer. + * + * To be index-type-independent, this does not account for any special space + * on the page, and is thus conservative. + * + * Note: in btree non-leaf pages, the first tuple has no key (it's implicitly + * minus infinity), thus breaking the "at least 1 byte bigger" assumption. + * On such a page, N tuples could take one MAXALIGN quantum less space than + * estimated here, seemingly allowing one more tuple than estimated here. + * But such a page always has at least MAXALIGN special space, so we're safe. + */ +#define MaxIndexTuplesPerPage \ + ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ + (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData)))) + +#endif /* ITUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/multixact.h b/platform/dbops/binaries/postgres/include/server/access/multixact.h new file mode 100644 index 0000000000000000000000000000000000000000..7ffd256c744d38c92201cef8ea734a81f5f4fe04 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/multixact.h @@ -0,0 +1,161 @@ +/* + * multixact.h + * + * PostgreSQL multi-transaction-log manager + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/multixact.h + */ +#ifndef MULTIXACT_H +#define MULTIXACT_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/sync.h" + + +/* + * The first two MultiXactId values are reserved to store the truncation Xid + * and epoch of the first segment, so we start assigning multixact values from + * 2. + */ +#define InvalidMultiXactId ((MultiXactId) 0) +#define FirstMultiXactId ((MultiXactId) 1) +#define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF) + +#define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId) + +#define MaxMultiXactOffset ((MultiXactOffset) 0xFFFFFFFF) + +/* + * Possible multixact lock modes ("status"). The first four modes are for + * tuple locks (FOR KEY SHARE, FOR SHARE, FOR NO KEY UPDATE, FOR UPDATE); the + * next two are used for update and delete modes. + */ +typedef enum +{ + MultiXactStatusForKeyShare = 0x00, + MultiXactStatusForShare = 0x01, + MultiXactStatusForNoKeyUpdate = 0x02, + MultiXactStatusForUpdate = 0x03, + /* an update that doesn't touch "key" columns */ + MultiXactStatusNoKeyUpdate = 0x04, + /* other updates, and delete */ + MultiXactStatusUpdate = 0x05, +} MultiXactStatus; + +#define MaxMultiXactStatus MultiXactStatusUpdate + +/* does a status value correspond to a tuple update? */ +#define ISUPDATE_from_mxstatus(status) \ + ((status) > MultiXactStatusForUpdate) + + +typedef struct MultiXactMember +{ + TransactionId xid; + MultiXactStatus status; +} MultiXactMember; + + +/* ---------------- + * multixact-related XLOG entries + * ---------------- + */ + +#define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00 +#define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10 +#define XLOG_MULTIXACT_CREATE_ID 0x20 +#define XLOG_MULTIXACT_TRUNCATE_ID 0x30 + +typedef struct xl_multixact_create +{ + MultiXactId mid; /* new MultiXact's ID */ + MultiXactOffset moff; /* its starting offset in members file */ + int32 nmembers; /* number of member XIDs */ + MultiXactMember members[FLEXIBLE_ARRAY_MEMBER]; +} xl_multixact_create; + +#define SizeOfMultiXactCreate (offsetof(xl_multixact_create, members)) + +typedef struct xl_multixact_truncate +{ + Oid oldestMultiDB; + + /* to-be-truncated range of multixact offsets */ + MultiXactId startTruncOff; /* just for completeness' sake */ + MultiXactId endTruncOff; + + /* to-be-truncated range of multixact members */ + MultiXactOffset startTruncMemb; + MultiXactOffset endTruncMemb; +} xl_multixact_truncate; + +#define SizeOfMultiXactTruncate (sizeof(xl_multixact_truncate)) + + +extern MultiXactId MultiXactIdCreate(TransactionId xid1, + MultiXactStatus status1, TransactionId xid2, + MultiXactStatus status2); +extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, + MultiXactStatus status); +extern MultiXactId MultiXactIdCreateFromMembers(int nmembers, + MultiXactMember *members); + +extern MultiXactId ReadNextMultiXactId(void); +extern void ReadMultiXactIdRange(MultiXactId *oldest, MultiXactId *next); +extern bool MultiXactIdIsRunning(MultiXactId multi, bool isLockOnly); +extern void MultiXactIdSetOldestMember(void); +extern int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, + bool from_pgupgrade, bool isLockOnly); +extern bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2); +extern bool MultiXactIdPrecedesOrEquals(MultiXactId multi1, + MultiXactId multi2); + +extern int multixactoffsetssyncfiletag(const FileTag *ftag, char *path); +extern int multixactmemberssyncfiletag(const FileTag *ftag, char *path); + +extern void AtEOXact_MultiXact(void); +extern void AtPrepare_MultiXact(void); +extern void PostPrepare_MultiXact(TransactionId xid); + +extern Size MultiXactShmemSize(void); +extern void MultiXactShmemInit(void); +extern void BootStrapMultiXact(void); +extern void StartupMultiXact(void); +extern void TrimMultiXact(void); +extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid, + Oid oldest_datoid, + bool is_startup); +extern void MultiXactGetCheckptMulti(bool is_shutdown, + MultiXactId *nextMulti, + MultiXactOffset *nextMultiOffset, + MultiXactId *oldestMulti, + Oid *oldestMultiDB); +extern void CheckPointMultiXact(void); +extern MultiXactId GetOldestMultiXactId(void); +extern void TruncateMultiXact(MultiXactId newOldestMulti, + Oid newOldestMultiDB); +extern void MultiXactSetNextMXact(MultiXactId nextMulti, + MultiXactOffset nextMultiOffset); +extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, + MultiXactOffset minMultiOffset); +extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB); +extern int MultiXactMemberFreezeThreshold(void); + +extern void multixact_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void multixact_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void multixact_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +extern void multixact_redo(XLogReaderState *record); +extern void multixact_desc(StringInfo buf, XLogReaderState *record); +extern const char *multixact_identify(uint8 info); +extern char *mxid_to_string(MultiXactId multi, int nmembers, + MultiXactMember *members); + +#endif /* MULTIXACT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/nbtree.h b/platform/dbops/binaries/postgres/include/server/access/nbtree.h new file mode 100644 index 0000000000000000000000000000000000000000..749304334809e759e9b6e7c1398896c5a9efee82 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/nbtree.h @@ -0,0 +1,1332 @@ +/*------------------------------------------------------------------------- + * + * nbtree.h + * header file for postgres btree access method implementation. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/nbtree.h + * + *------------------------------------------------------------------------- + */ +#ifndef NBTREE_H +#define NBTREE_H + +#include "access/amapi.h" +#include "access/itup.h" +#include "access/sdir.h" +#include "access/tableam.h" +#include "access/xlogreader.h" +#include "catalog/pg_am_d.h" +#include "catalog/pg_index.h" +#include "lib/stringinfo.h" +#include "storage/bufmgr.h" +#include "storage/shm_toc.h" + +/* There's room for a 16-bit vacuum cycle ID in BTPageOpaqueData */ +typedef uint16 BTCycleId; + +/* + * BTPageOpaqueData -- At the end of every page, we store a pointer + * to both siblings in the tree. This is used to do forward/backward + * index scans. The next-page link is also critical for recovery when + * a search has navigated to the wrong page due to concurrent page splits + * or deletions; see src/backend/access/nbtree/README for more info. + * + * In addition, we store the page's btree level (counting upwards from + * zero at a leaf page) as well as some flag bits indicating the page type + * and status. If the page is deleted, a BTDeletedPageData struct is stored + * in the page's tuple area, while a standard BTPageOpaqueData struct is + * stored in the page special area. + * + * We also store a "vacuum cycle ID". When a page is split while VACUUM is + * processing the index, a nonzero value associated with the VACUUM run is + * stored into both halves of the split page. (If VACUUM is not running, + * both pages receive zero cycleids.) This allows VACUUM to detect whether + * a page was split since it started, with a small probability of false match + * if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs + * ago. Also, during a split, the BTP_SPLIT_END flag is cleared in the left + * (original) page, and set in the right page, but only if the next page + * to its right has a different cycleid. + * + * NOTE: the BTP_LEAF flag bit is redundant since level==0 could be tested + * instead. + * + * NOTE: the btpo_level field used to be a union type in order to allow + * deleted pages to store a 32-bit safexid in the same field. We now store + * 64-bit/full safexid values using BTDeletedPageData instead. + */ + +typedef struct BTPageOpaqueData +{ + BlockNumber btpo_prev; /* left sibling, or P_NONE if leftmost */ + BlockNumber btpo_next; /* right sibling, or P_NONE if rightmost */ + uint32 btpo_level; /* tree level --- zero for leaf pages */ + uint16 btpo_flags; /* flag bits, see below */ + BTCycleId btpo_cycleid; /* vacuum cycle ID of latest split */ +} BTPageOpaqueData; + +typedef BTPageOpaqueData *BTPageOpaque; + +#define BTPageGetOpaque(page) ((BTPageOpaque) PageGetSpecialPointer(page)) + +/* Bits defined in btpo_flags */ +#define BTP_LEAF (1 << 0) /* leaf page, i.e. not internal page */ +#define BTP_ROOT (1 << 1) /* root page (has no parent) */ +#define BTP_DELETED (1 << 2) /* page has been deleted from tree */ +#define BTP_META (1 << 3) /* meta-page */ +#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */ +#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */ +#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DEAD tuples (deprecated) */ +#define BTP_INCOMPLETE_SPLIT (1 << 7) /* right sibling's downlink is missing */ +#define BTP_HAS_FULLXID (1 << 8) /* contains BTDeletedPageData */ + +/* + * The max allowed value of a cycle ID is a bit less than 64K. This is + * for convenience of pg_filedump and similar utilities: we want to use + * the last 2 bytes of special space as an index type indicator, and + * restricting cycle ID lets btree use that space for vacuum cycle IDs + * while still allowing index type to be identified. + */ +#define MAX_BT_CYCLE_ID 0xFF7F + + +/* + * The Meta page is always the first page in the btree index. + * Its primary purpose is to point to the location of the btree root page. + * We also point to the "fast" root, which is the current effective root; + * see README for discussion. + */ + +typedef struct BTMetaPageData +{ + uint32 btm_magic; /* should contain BTREE_MAGIC */ + uint32 btm_version; /* nbtree version (always <= BTREE_VERSION) */ + BlockNumber btm_root; /* current root location */ + uint32 btm_level; /* tree level of the root page */ + BlockNumber btm_fastroot; /* current "fast" root location */ + uint32 btm_fastlevel; /* tree level of the "fast" root page */ + /* remaining fields only valid when btm_version >= BTREE_NOVAC_VERSION */ + + /* number of deleted, non-recyclable pages during last cleanup */ + uint32 btm_last_cleanup_num_delpages; + /* number of heap tuples during last cleanup (deprecated) */ + float8 btm_last_cleanup_num_heap_tuples; + + bool btm_allequalimage; /* are all columns "equalimage"? */ +} BTMetaPageData; + +#define BTPageGetMeta(p) \ + ((BTMetaPageData *) PageGetContents(p)) + +/* + * The current Btree version is 4. That's what you'll get when you create + * a new index. + * + * Btree version 3 was used in PostgreSQL v11. It is mostly the same as + * version 4, but heap TIDs were not part of the keyspace. Index tuples + * with duplicate keys could be stored in any order. We continue to + * support reading and writing Btree versions 2 and 3, so that they don't + * need to be immediately re-indexed at pg_upgrade. In order to get the + * new heapkeyspace semantics, however, a REINDEX is needed. + * + * Deduplication is safe to use when the btm_allequalimage field is set to + * true. It's safe to read the btm_allequalimage field on version 3, but + * only version 4 indexes make use of deduplication. Even version 4 + * indexes created on PostgreSQL v12 will need a REINDEX to make use of + * deduplication, though, since there is no other way to set + * btm_allequalimage to true (pg_upgrade hasn't been taught to set the + * metapage field). + * + * Btree version 2 is mostly the same as version 3. There are two new + * fields in the metapage that were introduced in version 3. A version 2 + * metapage will be automatically upgraded to version 3 on the first + * insert to it. INCLUDE indexes cannot use version 2. + */ +#define BTREE_METAPAGE 0 /* first page is meta */ +#define BTREE_MAGIC 0x053162 /* magic number in metapage */ +#define BTREE_VERSION 4 /* current version number */ +#define BTREE_MIN_VERSION 2 /* minimum supported version */ +#define BTREE_NOVAC_VERSION 3 /* version with all meta fields set */ + +/* + * Maximum size of a btree index entry, including its tuple header. + * + * We actually need to be able to fit three items on every page, + * so restrict any one item to 1/3 the per-page available space. + * + * There are rare cases where _bt_truncate() will need to enlarge + * a heap index tuple to make space for a tiebreaker heap TID + * attribute, which we account for here. + */ +#define BTMaxItemSize(page) \ + (MAXALIGN_DOWN((PageGetPageSize(page) - \ + MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(BTPageOpaqueData))) / 3) - \ + MAXALIGN(sizeof(ItemPointerData))) +#define BTMaxItemSizeNoHeapTid(page) \ + MAXALIGN_DOWN((PageGetPageSize(page) - \ + MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \ + MAXALIGN(sizeof(BTPageOpaqueData))) / 3) + +/* + * MaxTIDsPerBTreePage is an upper bound on the number of heap TIDs tuples + * that may be stored on a btree leaf page. It is used to size the + * per-page temporary buffers. + * + * Note: we don't bother considering per-tuple overheads here to keep + * things simple (value is based on how many elements a single array of + * heap TIDs must have to fill the space between the page header and + * special area). The value is slightly higher (i.e. more conservative) + * than necessary as a result, which is considered acceptable. + */ +#define MaxTIDsPerBTreePage \ + (int) ((BLCKSZ - SizeOfPageHeaderData - sizeof(BTPageOpaqueData)) / \ + sizeof(ItemPointerData)) + +/* + * The leaf-page fillfactor defaults to 90% but is user-adjustable. + * For pages above the leaf level, we use a fixed 70% fillfactor. + * The fillfactor is applied during index build and when splitting + * a rightmost page; when splitting non-rightmost pages we try to + * divide the data equally. When splitting a page that's entirely + * filled with a single value (duplicates), the effective leaf-page + * fillfactor is 96%, regardless of whether the page is a rightmost + * page. + */ +#define BTREE_MIN_FILLFACTOR 10 +#define BTREE_DEFAULT_FILLFACTOR 90 +#define BTREE_NONLEAF_FILLFACTOR 70 +#define BTREE_SINGLEVAL_FILLFACTOR 96 + +/* + * In general, the btree code tries to localize its knowledge about + * page layout to a couple of routines. However, we need a special + * value to indicate "no page number" in those places where we expect + * page numbers. We can use zero for this because we never need to + * make a pointer to the metadata page. + */ + +#define P_NONE 0 + +/* + * Macros to test whether a page is leftmost or rightmost on its tree level, + * as well as other state info kept in the opaque data. + */ +#define P_LEFTMOST(opaque) ((opaque)->btpo_prev == P_NONE) +#define P_RIGHTMOST(opaque) ((opaque)->btpo_next == P_NONE) +#define P_ISLEAF(opaque) (((opaque)->btpo_flags & BTP_LEAF) != 0) +#define P_ISROOT(opaque) (((opaque)->btpo_flags & BTP_ROOT) != 0) +#define P_ISDELETED(opaque) (((opaque)->btpo_flags & BTP_DELETED) != 0) +#define P_ISMETA(opaque) (((opaque)->btpo_flags & BTP_META) != 0) +#define P_ISHALFDEAD(opaque) (((opaque)->btpo_flags & BTP_HALF_DEAD) != 0) +#define P_IGNORE(opaque) (((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) != 0) +#define P_HAS_GARBAGE(opaque) (((opaque)->btpo_flags & BTP_HAS_GARBAGE) != 0) +#define P_INCOMPLETE_SPLIT(opaque) (((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0) +#define P_HAS_FULLXID(opaque) (((opaque)->btpo_flags & BTP_HAS_FULLXID) != 0) + +/* + * BTDeletedPageData is the page contents of a deleted page + */ +typedef struct BTDeletedPageData +{ + FullTransactionId safexid; /* See BTPageIsRecyclable() */ +} BTDeletedPageData; + +static inline void +BTPageSetDeleted(Page page, FullTransactionId safexid) +{ + BTPageOpaque opaque; + PageHeader header; + BTDeletedPageData *contents; + + opaque = BTPageGetOpaque(page); + header = ((PageHeader) page); + + opaque->btpo_flags &= ~BTP_HALF_DEAD; + opaque->btpo_flags |= BTP_DELETED | BTP_HAS_FULLXID; + header->pd_lower = MAXALIGN(SizeOfPageHeaderData) + + sizeof(BTDeletedPageData); + header->pd_upper = header->pd_special; + + /* Set safexid in deleted page */ + contents = ((BTDeletedPageData *) PageGetContents(page)); + contents->safexid = safexid; +} + +static inline FullTransactionId +BTPageGetDeleteXid(Page page) +{ + BTPageOpaque opaque; + BTDeletedPageData *contents; + + /* We only expect to be called with a deleted page */ + Assert(!PageIsNew(page)); + opaque = BTPageGetOpaque(page); + Assert(P_ISDELETED(opaque)); + + /* pg_upgrade'd deleted page -- must be safe to recycle now */ + if (!P_HAS_FULLXID(opaque)) + return FirstNormalFullTransactionId; + + /* Get safexid from deleted page */ + contents = ((BTDeletedPageData *) PageGetContents(page)); + return contents->safexid; +} + +/* + * Is an existing page recyclable? + * + * This exists to centralize the policy on which deleted pages are now safe to + * re-use. However, _bt_pendingfsm_finalize() duplicates some of the same + * logic because it doesn't work directly with pages -- keep the two in sync. + * + * Note: PageIsNew() pages are always safe to recycle, but we can't deal with + * them here (caller is responsible for that case themselves). Caller might + * well need special handling for new pages anyway. + */ +static inline bool +BTPageIsRecyclable(Page page, Relation heaprel) +{ + BTPageOpaque opaque; + + Assert(!PageIsNew(page)); + Assert(heaprel != NULL); + + /* Recycling okay iff page is deleted and safexid is old enough */ + opaque = BTPageGetOpaque(page); + if (P_ISDELETED(opaque)) + { + FullTransactionId safexid = BTPageGetDeleteXid(page); + + /* + * The page was deleted, but when? If it was just deleted, a scan + * might have seen the downlink to it, and will read the page later. + * As long as that can happen, we must keep the deleted page around as + * a tombstone. + * + * For that check if the deletion XID could still be visible to + * anyone. If not, then no scan that's still in progress could have + * seen its downlink, and we can recycle it. + */ + return GlobalVisCheckRemovableFullXid(heaprel, safexid); + } + + return false; +} + +/* + * BTVacState and BTPendingFSM are private nbtree.c state used during VACUUM. + * They are exported for use by page deletion related code in nbtpage.c. + */ +typedef struct BTPendingFSM +{ + BlockNumber target; /* Page deleted by current VACUUM */ + FullTransactionId safexid; /* Page's BTDeletedPageData.safexid */ +} BTPendingFSM; + +typedef struct BTVacState +{ + IndexVacuumInfo *info; + IndexBulkDeleteResult *stats; + IndexBulkDeleteCallback callback; + void *callback_state; + BTCycleId cycleid; + MemoryContext pagedelcontext; + + /* + * _bt_pendingfsm_finalize() state + */ + int bufsize; /* pendingpages space (in # elements) */ + int maxbufsize; /* max bufsize that respects work_mem */ + BTPendingFSM *pendingpages; /* One entry per newly deleted page */ + int npendingpages; /* current # valid pendingpages */ +} BTVacState; + +/* + * Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost + * page. The high key is not a tuple that is used to visit the heap. It is + * a pivot tuple (see "Notes on B-Tree tuple format" below for definition). + * The high key on a page is required to be greater than or equal to any + * other key that appears on the page. If we find ourselves trying to + * insert a key that is strictly > high key, we know we need to move right + * (this should only happen if the page was split since we examined the + * parent page). + * + * Our insertion algorithm guarantees that we can use the initial least key + * on our right sibling as the high key. Once a page is created, its high + * key changes only if the page is split. + * + * On a non-rightmost page, the high key lives in item 1 and data items + * start in item 2. Rightmost pages have no high key, so we store data + * items beginning in item 1. + */ + +#define P_HIKEY ((OffsetNumber) 1) +#define P_FIRSTKEY ((OffsetNumber) 2) +#define P_FIRSTDATAKEY(opaque) (P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY) + +/* + * Notes on B-Tree tuple format, and key and non-key attributes: + * + * INCLUDE B-Tree indexes have non-key attributes. These are extra + * attributes that may be returned by index-only scans, but do not influence + * the order of items in the index (formally, non-key attributes are not + * considered to be part of the key space). Non-key attributes are only + * present in leaf index tuples whose item pointers actually point to heap + * tuples (non-pivot tuples). _bt_check_natts() enforces the rules + * described here. + * + * Non-pivot tuple format (plain/non-posting variant): + * + * t_tid | t_info | key values | INCLUDE columns, if any + * + * t_tid points to the heap TID, which is a tiebreaker key column as of + * BTREE_VERSION 4. + * + * Non-pivot tuples complement pivot tuples, which only have key columns. + * The sole purpose of pivot tuples is to represent how the key space is + * separated. In general, any B-Tree index that has more than one level + * (i.e. any index that does not just consist of a metapage and a single + * leaf root page) must have some number of pivot tuples, since pivot + * tuples are used for traversing the tree. Suffix truncation can omit + * trailing key columns when a new pivot is formed, which makes minus + * infinity their logical value. Since BTREE_VERSION 4 indexes treat heap + * TID as a trailing key column that ensures that all index tuples are + * physically unique, it is necessary to represent heap TID as a trailing + * key column in pivot tuples, though very often this can be truncated + * away, just like any other key column. (Actually, the heap TID is + * omitted rather than truncated, since its representation is different to + * the non-pivot representation.) + * + * Pivot tuple format: + * + * t_tid | t_info | key values | [heap TID] + * + * We store the number of columns present inside pivot tuples by abusing + * their t_tid offset field, since pivot tuples never need to store a real + * offset (pivot tuples generally store a downlink in t_tid, though). The + * offset field only stores the number of columns/attributes when the + * INDEX_ALT_TID_MASK bit is set, which doesn't count the trailing heap + * TID column sometimes stored in pivot tuples -- that's represented by + * the presence of BT_PIVOT_HEAP_TID_ATTR. The INDEX_ALT_TID_MASK bit in + * t_info is always set on BTREE_VERSION 4 pivot tuples, since + * BTreeTupleIsPivot() must work reliably on heapkeyspace versions. + * + * In version 2 or version 3 (!heapkeyspace) indexes, INDEX_ALT_TID_MASK + * might not be set in pivot tuples. BTreeTupleIsPivot() won't work + * reliably as a result. The number of columns stored is implicitly the + * same as the number of columns in the index, just like any non-pivot + * tuple. (The number of columns stored should not vary, since suffix + * truncation of key columns is unsafe within any !heapkeyspace index.) + * + * The 12 least significant bits from t_tid's offset number are used to + * represent the number of key columns within a pivot tuple. This leaves 4 + * status bits (BT_STATUS_OFFSET_MASK bits), which are shared by all tuples + * that have the INDEX_ALT_TID_MASK bit set (set in t_info) to store basic + * tuple metadata. BTreeTupleIsPivot() and BTreeTupleIsPosting() use the + * BT_STATUS_OFFSET_MASK bits. + * + * Sometimes non-pivot tuples also use a representation that repurposes + * t_tid to store metadata rather than a TID. PostgreSQL v13 introduced a + * new non-pivot tuple format to support deduplication: posting list + * tuples. Deduplication merges together multiple equal non-pivot tuples + * into a logically equivalent, space efficient representation. A posting + * list is an array of ItemPointerData elements. Non-pivot tuples are + * merged together to form posting list tuples lazily, at the point where + * we'd otherwise have to split a leaf page. + * + * Posting tuple format (alternative non-pivot tuple representation): + * + * t_tid | t_info | key values | posting list (TID array) + * + * Posting list tuples are recognized as such by having the + * INDEX_ALT_TID_MASK status bit set in t_info and the BT_IS_POSTING status + * bit set in t_tid's offset number. These flags redefine the content of + * the posting tuple's t_tid to store the location of the posting list + * (instead of a block number), as well as the total number of heap TIDs + * present in the tuple (instead of a real offset number). + * + * The 12 least significant bits from t_tid's offset number are used to + * represent the number of heap TIDs present in the tuple, leaving 4 status + * bits (the BT_STATUS_OFFSET_MASK bits). Like any non-pivot tuple, the + * number of columns stored is always implicitly the total number in the + * index (in practice there can never be non-key columns stored, since + * deduplication is not supported with INCLUDE indexes). + */ +#define INDEX_ALT_TID_MASK INDEX_AM_RESERVED_BIT + +/* Item pointer offset bit masks */ +#define BT_OFFSET_MASK 0x0FFF +#define BT_STATUS_OFFSET_MASK 0xF000 +/* BT_STATUS_OFFSET_MASK status bits */ +#define BT_PIVOT_HEAP_TID_ATTR 0x1000 +#define BT_IS_POSTING 0x2000 + +/* + * Mask allocated for number of keys in index tuple must be able to fit + * maximum possible number of index attributes + */ +StaticAssertDecl(BT_OFFSET_MASK >= INDEX_MAX_KEYS, + "BT_OFFSET_MASK can't fit INDEX_MAX_KEYS"); + +/* + * Note: BTreeTupleIsPivot() can have false negatives (but not false + * positives) when used with !heapkeyspace indexes + */ +static inline bool +BTreeTupleIsPivot(IndexTuple itup) +{ + if ((itup->t_info & INDEX_ALT_TID_MASK) == 0) + return false; + /* absence of BT_IS_POSTING in offset number indicates pivot tuple */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & BT_IS_POSTING) != 0) + return false; + + return true; +} + +static inline bool +BTreeTupleIsPosting(IndexTuple itup) +{ + if ((itup->t_info & INDEX_ALT_TID_MASK) == 0) + return false; + /* presence of BT_IS_POSTING in offset number indicates posting tuple */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & BT_IS_POSTING) == 0) + return false; + + return true; +} + +static inline void +BTreeTupleSetPosting(IndexTuple itup, uint16 nhtids, int postingoffset) +{ + Assert(nhtids > 1); + Assert((nhtids & BT_STATUS_OFFSET_MASK) == 0); + Assert((size_t) postingoffset == MAXALIGN(postingoffset)); + Assert(postingoffset < INDEX_SIZE_MASK); + Assert(!BTreeTupleIsPivot(itup)); + + itup->t_info |= INDEX_ALT_TID_MASK; + ItemPointerSetOffsetNumber(&itup->t_tid, (nhtids | BT_IS_POSTING)); + ItemPointerSetBlockNumber(&itup->t_tid, postingoffset); +} + +static inline uint16 +BTreeTupleGetNPosting(IndexTuple posting) +{ + OffsetNumber existing; + + Assert(BTreeTupleIsPosting(posting)); + + existing = ItemPointerGetOffsetNumberNoCheck(&posting->t_tid); + return (existing & BT_OFFSET_MASK); +} + +static inline uint32 +BTreeTupleGetPostingOffset(IndexTuple posting) +{ + Assert(BTreeTupleIsPosting(posting)); + + return ItemPointerGetBlockNumberNoCheck(&posting->t_tid); +} + +static inline ItemPointer +BTreeTupleGetPosting(IndexTuple posting) +{ + return (ItemPointer) ((char *) posting + + BTreeTupleGetPostingOffset(posting)); +} + +static inline ItemPointer +BTreeTupleGetPostingN(IndexTuple posting, int n) +{ + return BTreeTupleGetPosting(posting) + n; +} + +/* + * Get/set downlink block number in pivot tuple. + * + * Note: Cannot assert that tuple is a pivot tuple. If we did so then + * !heapkeyspace indexes would exhibit false positive assertion failures. + */ +static inline BlockNumber +BTreeTupleGetDownLink(IndexTuple pivot) +{ + return ItemPointerGetBlockNumberNoCheck(&pivot->t_tid); +} + +static inline void +BTreeTupleSetDownLink(IndexTuple pivot, BlockNumber blkno) +{ + ItemPointerSetBlockNumber(&pivot->t_tid, blkno); +} + +/* + * Get number of attributes within tuple. + * + * Note that this does not include an implicit tiebreaker heap TID + * attribute, if any. Note also that the number of key attributes must be + * explicitly represented in all heapkeyspace pivot tuples. + * + * Note: This is defined as a macro rather than an inline function to + * avoid including rel.h. + */ +#define BTreeTupleGetNAtts(itup, rel) \ + ( \ + (BTreeTupleIsPivot(itup)) ? \ + ( \ + ItemPointerGetOffsetNumberNoCheck(&(itup)->t_tid) & BT_OFFSET_MASK \ + ) \ + : \ + IndexRelationGetNumberOfAttributes(rel) \ + ) + +/* + * Set number of key attributes in tuple. + * + * The heap TID tiebreaker attribute bit may also be set here, indicating that + * a heap TID value will be stored at the end of the tuple (i.e. using the + * special pivot tuple representation). + */ +static inline void +BTreeTupleSetNAtts(IndexTuple itup, uint16 nkeyatts, bool heaptid) +{ + Assert(nkeyatts <= INDEX_MAX_KEYS); + Assert((nkeyatts & BT_STATUS_OFFSET_MASK) == 0); + Assert(!heaptid || nkeyatts > 0); + Assert(!BTreeTupleIsPivot(itup) || nkeyatts == 0); + + itup->t_info |= INDEX_ALT_TID_MASK; + + if (heaptid) + nkeyatts |= BT_PIVOT_HEAP_TID_ATTR; + + /* BT_IS_POSTING bit is deliberately unset here */ + ItemPointerSetOffsetNumber(&itup->t_tid, nkeyatts); + Assert(BTreeTupleIsPivot(itup)); +} + +/* + * Get/set leaf page's "top parent" link from its high key. Used during page + * deletion. + * + * Note: Cannot assert that tuple is a pivot tuple. If we did so then + * !heapkeyspace indexes would exhibit false positive assertion failures. + */ +static inline BlockNumber +BTreeTupleGetTopParent(IndexTuple leafhikey) +{ + return ItemPointerGetBlockNumberNoCheck(&leafhikey->t_tid); +} + +static inline void +BTreeTupleSetTopParent(IndexTuple leafhikey, BlockNumber blkno) +{ + ItemPointerSetBlockNumber(&leafhikey->t_tid, blkno); + BTreeTupleSetNAtts(leafhikey, 0, false); +} + +/* + * Get tiebreaker heap TID attribute, if any. + * + * This returns the first/lowest heap TID in the case of a posting list tuple. + */ +static inline ItemPointer +BTreeTupleGetHeapTID(IndexTuple itup) +{ + if (BTreeTupleIsPivot(itup)) + { + /* Pivot tuple heap TID representation? */ + if ((ItemPointerGetOffsetNumberNoCheck(&itup->t_tid) & + BT_PIVOT_HEAP_TID_ATTR) != 0) + return (ItemPointer) ((char *) itup + IndexTupleSize(itup) - + sizeof(ItemPointerData)); + + /* Heap TID attribute was truncated */ + return NULL; + } + else if (BTreeTupleIsPosting(itup)) + return BTreeTupleGetPosting(itup); + + return &itup->t_tid; +} + +/* + * Get maximum heap TID attribute, which could be the only TID in the case of + * a non-pivot tuple that does not have a posting list. + * + * Works with non-pivot tuples only. + */ +static inline ItemPointer +BTreeTupleGetMaxHeapTID(IndexTuple itup) +{ + Assert(!BTreeTupleIsPivot(itup)); + + if (BTreeTupleIsPosting(itup)) + { + uint16 nposting = BTreeTupleGetNPosting(itup); + + return BTreeTupleGetPostingN(itup, nposting - 1); + } + + return &itup->t_tid; +} + +/* + * Operator strategy numbers for B-tree have been moved to access/stratnum.h, + * because many places need to use them in ScanKeyInit() calls. + * + * The strategy numbers are chosen so that we can commute them by + * subtraction, thus: + */ +#define BTCommuteStrategyNumber(strat) (BTMaxStrategyNumber + 1 - (strat)) + +/* + * When a new operator class is declared, we require that the user + * supply us with an amproc procedure (BTORDER_PROC) for determining + * whether, for two keys a and b, a < b, a = b, or a > b. This routine + * must return < 0, 0, > 0, respectively, in these three cases. + * + * To facilitate accelerated sorting, an operator class may choose to + * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see + * src/include/utils/sortsupport.h. + * + * To support window frames defined by "RANGE offset PRECEDING/FOLLOWING", + * an operator class may choose to offer a third amproc procedure + * (BTINRANGE_PROC), independently of whether it offers sortsupport. + * For full details, see doc/src/sgml/btree.sgml. + * + * To facilitate B-Tree deduplication, an operator class may choose to + * offer a forth amproc procedure (BTEQUALIMAGE_PROC). For full details, + * see doc/src/sgml/btree.sgml. + */ + +#define BTORDER_PROC 1 +#define BTSORTSUPPORT_PROC 2 +#define BTINRANGE_PROC 3 +#define BTEQUALIMAGE_PROC 4 +#define BTOPTIONS_PROC 5 +#define BTNProcs 5 + +/* + * We need to be able to tell the difference between read and write + * requests for pages, in order to do locking correctly. + */ + +#define BT_READ BUFFER_LOCK_SHARE +#define BT_WRITE BUFFER_LOCK_EXCLUSIVE + +/* + * BTStackData -- As we descend a tree, we push the location of pivot + * tuples whose downlink we are about to follow onto a private stack. If + * we split a leaf, we use this stack to walk back up the tree and insert + * data into its parent page at the correct location. We also have to + * recursively insert into the grandparent page if and when the parent page + * splits. Our private stack can become stale due to concurrent page + * splits and page deletions, but it should never give us an irredeemably + * bad picture. + */ +typedef struct BTStackData +{ + BlockNumber bts_blkno; + OffsetNumber bts_offset; + struct BTStackData *bts_parent; +} BTStackData; + +typedef BTStackData *BTStack; + +/* + * BTScanInsertData is the btree-private state needed to find an initial + * position for an indexscan, or to insert new tuples -- an "insertion + * scankey" (not to be confused with a search scankey). It's used to descend + * a B-Tree using _bt_search. + * + * heapkeyspace indicates if we expect all keys in the index to be physically + * unique because heap TID is used as a tiebreaker attribute, and if index may + * have truncated key attributes in pivot tuples. This is actually a property + * of the index relation itself (not an indexscan). heapkeyspace indexes are + * indexes whose version is >= version 4. It's convenient to keep this close + * by, rather than accessing the metapage repeatedly. + * + * allequalimage is set to indicate that deduplication is safe for the index. + * This is also a property of the index relation rather than an indexscan. + * + * anynullkeys indicates if any of the keys had NULL value when scankey was + * built from index tuple (note that already-truncated tuple key attributes + * set NULL as a placeholder key value, which also affects value of + * anynullkeys). This is a convenience for unique index non-pivot tuple + * insertion, which usually temporarily unsets scantid, but shouldn't iff + * anynullkeys is true. Value generally matches non-pivot tuple's HasNulls + * bit, but may not when inserting into an INCLUDE index (tuple header value + * is affected by the NULL-ness of both key and non-key attributes). + * + * See comments in _bt_first for an explanation of the nextkey and backward + * fields. + * + * scantid is the heap TID that is used as a final tiebreaker attribute. It + * is set to NULL when index scan doesn't need to find a position for a + * specific physical tuple. Must be set when inserting new tuples into + * heapkeyspace indexes, since every tuple in the tree unambiguously belongs + * in one exact position (it's never set with !heapkeyspace indexes, though). + * Despite the representational difference, nbtree search code considers + * scantid to be just another insertion scankey attribute. + * + * scankeys is an array of scan key entries for attributes that are compared + * before scantid (user-visible attributes). keysz is the size of the array. + * During insertion, there must be a scan key for every attribute, but when + * starting a regular index scan some can be omitted. The array is used as a + * flexible array member, though it's sized in a way that makes it possible to + * use stack allocations. See nbtree/README for full details. + */ +typedef struct BTScanInsertData +{ + bool heapkeyspace; + bool allequalimage; + bool anynullkeys; + bool nextkey; + bool backward; /* backward index scan? */ + ItemPointer scantid; /* tiebreaker for scankeys */ + int keysz; /* Size of scankeys array */ + ScanKeyData scankeys[INDEX_MAX_KEYS]; /* Must appear last */ +} BTScanInsertData; + +typedef BTScanInsertData *BTScanInsert; + +/* + * BTInsertStateData is a working area used during insertion. + * + * This is filled in after descending the tree to the first leaf page the new + * tuple might belong on. Tracks the current position while performing + * uniqueness check, before we have determined which exact page to insert + * to. + * + * (This should be private to nbtinsert.c, but it's also used by + * _bt_binsrch_insert) + */ +typedef struct BTInsertStateData +{ + IndexTuple itup; /* Item we're inserting */ + Size itemsz; /* Size of itup -- should be MAXALIGN()'d */ + BTScanInsert itup_key; /* Insertion scankey */ + + /* Buffer containing leaf page we're likely to insert itup on */ + Buffer buf; + + /* + * Cache of bounds within the current buffer. Only used for insertions + * where _bt_check_unique is called. See _bt_binsrch_insert and + * _bt_findinsertloc for details. + */ + bool bounds_valid; + OffsetNumber low; + OffsetNumber stricthigh; + + /* + * if _bt_binsrch_insert found the location inside existing posting list, + * save the position inside the list. -1 sentinel value indicates overlap + * with an existing posting list tuple that has its LP_DEAD bit set. + */ + int postingoff; +} BTInsertStateData; + +typedef BTInsertStateData *BTInsertState; + +/* + * State used to representing an individual pending tuple during + * deduplication. + */ +typedef struct BTDedupInterval +{ + OffsetNumber baseoff; + uint16 nitems; +} BTDedupInterval; + +/* + * BTDedupStateData is a working area used during deduplication. + * + * The status info fields track the state of a whole-page deduplication pass. + * State about the current pending posting list is also tracked. + * + * A pending posting list is comprised of a contiguous group of equal items + * from the page, starting from page offset number 'baseoff'. This is the + * offset number of the "base" tuple for new posting list. 'nitems' is the + * current total number of existing items from the page that will be merged to + * make a new posting list tuple, including the base tuple item. (Existing + * items may themselves be posting list tuples, or regular non-pivot tuples.) + * + * The total size of the existing tuples to be freed when pending posting list + * is processed gets tracked by 'phystupsize'. This information allows + * deduplication to calculate the space saving for each new posting list + * tuple, and for the entire pass over the page as a whole. + */ +typedef struct BTDedupStateData +{ + /* Deduplication status info for entire pass over page */ + bool deduplicate; /* Still deduplicating page? */ + int nmaxitems; /* Number of max-sized tuples so far */ + Size maxpostingsize; /* Limit on size of final tuple */ + + /* Metadata about base tuple of current pending posting list */ + IndexTuple base; /* Use to form new posting list */ + OffsetNumber baseoff; /* page offset of base */ + Size basetupsize; /* base size without original posting list */ + + /* Other metadata about pending posting list */ + ItemPointer htids; /* Heap TIDs in pending posting list */ + int nhtids; /* Number of heap TIDs in htids array */ + int nitems; /* Number of existing tuples/line pointers */ + Size phystupsize; /* Includes line pointer overhead */ + + /* + * Array of tuples to go on new version of the page. Contains one entry + * for each group of consecutive items. Note that existing tuples that + * will not become posting list tuples do not appear in the array (they + * are implicitly unchanged by deduplication pass). + */ + int nintervals; /* current number of intervals in array */ + BTDedupInterval intervals[MaxIndexTuplesPerPage]; +} BTDedupStateData; + +typedef BTDedupStateData *BTDedupState; + +/* + * BTVacuumPostingData is state that represents how to VACUUM (or delete) a + * posting list tuple when some (though not all) of its TIDs are to be + * deleted. + * + * Convention is that itup field is the original posting list tuple on input, + * and palloc()'d final tuple used to overwrite existing tuple on output. + */ +typedef struct BTVacuumPostingData +{ + /* Tuple that will be/was updated */ + IndexTuple itup; + OffsetNumber updatedoffset; + + /* State needed to describe final itup in WAL */ + uint16 ndeletedtids; + uint16 deletetids[FLEXIBLE_ARRAY_MEMBER]; +} BTVacuumPostingData; + +typedef BTVacuumPostingData *BTVacuumPosting; + +/* + * BTScanOpaqueData is the btree-private state needed for an indexscan. + * This consists of preprocessed scan keys (see _bt_preprocess_keys() for + * details of the preprocessing), information about the current location + * of the scan, and information about the marked location, if any. (We use + * BTScanPosData to represent the data needed for each of current and marked + * locations.) In addition we can remember some known-killed index entries + * that must be marked before we can move off the current page. + * + * Index scans work a page at a time: we pin and read-lock the page, identify + * all the matching items on the page and save them in BTScanPosData, then + * release the read-lock while returning the items to the caller for + * processing. This approach minimizes lock/unlock traffic. Note that we + * keep the pin on the index page until the caller is done with all the items + * (this is needed for VACUUM synchronization, see nbtree/README). When we + * are ready to step to the next page, if the caller has told us any of the + * items were killed, we re-lock the page to mark them killed, then unlock. + * Finally we drop the pin and step to the next page in the appropriate + * direction. + * + * If we are doing an index-only scan, we save the entire IndexTuple for each + * matched item, otherwise only its heap TID and offset. The IndexTuples go + * into a separate workspace array; each BTScanPosItem stores its tuple's + * offset within that array. Posting list tuples store a "base" tuple once, + * allowing the same key to be returned for each TID in the posting list + * tuple. + */ + +typedef struct BTScanPosItem /* what we remember about each match */ +{ + ItemPointerData heapTid; /* TID of referenced heap item */ + OffsetNumber indexOffset; /* index item's location within page */ + LocationIndex tupleOffset; /* IndexTuple's offset in workspace, if any */ +} BTScanPosItem; + +typedef struct BTScanPosData +{ + Buffer buf; /* if valid, the buffer is pinned */ + + XLogRecPtr lsn; /* pos in the WAL stream when page was read */ + BlockNumber currPage; /* page referenced by items array */ + BlockNumber nextPage; /* page's right link when we scanned it */ + + /* + * moreLeft and moreRight track whether we think there may be matching + * index entries to the left and right of the current page, respectively. + * We can clear the appropriate one of these flags when _bt_checkkeys() + * sets BTReadPageState.continuescan = false. + */ + bool moreLeft; + bool moreRight; + + /* + * Direction of the scan at the time that _bt_readpage was called. + * + * Used by btrestrpos to "restore" the scan's array keys by resetting each + * array to its first element's value (first in this scan direction). This + * avoids the need to directly track the array keys in btmarkpos. + */ + ScanDirection dir; + + /* + * If we are doing an index-only scan, nextTupleOffset is the first free + * location in the associated tuple storage workspace. + */ + int nextTupleOffset; + + /* + * The items array is always ordered in index order (ie, increasing + * indexoffset). When scanning backwards it is convenient to fill the + * array back-to-front, so we start at the last slot and fill downwards. + * Hence we need both a first-valid-entry and a last-valid-entry counter. + * itemIndex is a cursor showing which entry was last returned to caller. + */ + int firstItem; /* first valid index in items[] */ + int lastItem; /* last valid index in items[] */ + int itemIndex; /* current index in items[] */ + + BTScanPosItem items[MaxTIDsPerBTreePage]; /* MUST BE LAST */ +} BTScanPosData; + +typedef BTScanPosData *BTScanPos; + +#define BTScanPosIsPinned(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BufferIsValid((scanpos).buf) \ +) +#define BTScanPosUnpin(scanpos) \ + do { \ + ReleaseBuffer((scanpos).buf); \ + (scanpos).buf = InvalidBuffer; \ + } while (0) +#define BTScanPosUnpinIfPinned(scanpos) \ + do { \ + if (BTScanPosIsPinned(scanpos)) \ + BTScanPosUnpin(scanpos); \ + } while (0) + +#define BTScanPosIsValid(scanpos) \ +( \ + AssertMacro(BlockNumberIsValid((scanpos).currPage) || \ + !BufferIsValid((scanpos).buf)), \ + BlockNumberIsValid((scanpos).currPage) \ +) +#define BTScanPosInvalidate(scanpos) \ + do { \ + (scanpos).currPage = InvalidBlockNumber; \ + (scanpos).nextPage = InvalidBlockNumber; \ + (scanpos).buf = InvalidBuffer; \ + (scanpos).lsn = InvalidXLogRecPtr; \ + (scanpos).nextTupleOffset = 0; \ + } while (0) + +/* We need one of these for each equality-type SK_SEARCHARRAY scan key */ +typedef struct BTArrayKeyInfo +{ + int scan_key; /* index of associated key in keyData */ + int cur_elem; /* index of current element in elem_values */ + int num_elems; /* number of elems in current array value */ + Datum *elem_values; /* array of num_elems Datums */ +} BTArrayKeyInfo; + +typedef struct BTScanOpaqueData +{ + /* these fields are set by _bt_preprocess_keys(): */ + bool qual_ok; /* false if qual can never be satisfied */ + int numberOfKeys; /* number of preprocessed scan keys */ + ScanKey keyData; /* array of preprocessed scan keys */ + + /* workspace for SK_SEARCHARRAY support */ + int numArrayKeys; /* number of equality-type array keys */ + bool needPrimScan; /* New prim scan to continue in current dir? */ + bool scanBehind; /* Last array advancement matched -inf attr? */ + BTArrayKeyInfo *arrayKeys; /* info about each equality-type array key */ + FmgrInfo *orderProcs; /* ORDER procs for required equality keys */ + MemoryContext arrayContext; /* scan-lifespan context for array data */ + + /* info about killed items if any (killedItems is NULL if never used) */ + int *killedItems; /* currPos.items indexes of killed items */ + int numKilled; /* number of currently stored items */ + + /* + * If we are doing an index-only scan, these are the tuple storage + * workspaces for the currPos and markPos respectively. Each is of size + * BLCKSZ, so it can hold as much as a full page's worth of tuples. + */ + char *currTuples; /* tuple storage for currPos */ + char *markTuples; /* tuple storage for markPos */ + + /* + * If the marked position is on the same page as current position, we + * don't use markPos, but just keep the marked itemIndex in markItemIndex + * (all the rest of currPos is valid for the mark position). Hence, to + * determine if there is a mark, first look at markItemIndex, then at + * markPos. + */ + int markItemIndex; /* itemIndex, or -1 if not valid */ + + /* keep these last in struct for efficiency */ + BTScanPosData currPos; /* current position data */ + BTScanPosData markPos; /* marked position, if any */ +} BTScanOpaqueData; + +typedef BTScanOpaqueData *BTScanOpaque; + +/* + * _bt_readpage state used across _bt_checkkeys calls for a page + */ +typedef struct BTReadPageState +{ + /* Input parameters, set by _bt_readpage for _bt_checkkeys */ + ScanDirection dir; /* current scan direction */ + OffsetNumber minoff; /* Lowest non-pivot tuple's offset */ + OffsetNumber maxoff; /* Highest non-pivot tuple's offset */ + IndexTuple finaltup; /* Needed by scans with array keys */ + BlockNumber prev_scan_page; /* previous _bt_parallel_release block */ + Page page; /* Page being read */ + + /* Per-tuple input parameters, set by _bt_readpage for _bt_checkkeys */ + OffsetNumber offnum; /* current tuple's page offset number */ + + /* Output parameter, set by _bt_checkkeys for _bt_readpage */ + OffsetNumber skip; /* Array keys "look ahead" skip offnum */ + bool continuescan; /* Terminate ongoing (primitive) index scan? */ + + /* + * Input and output parameters, set and unset by both _bt_readpage and + * _bt_checkkeys to manage precheck optimizations + */ + bool prechecked; /* precheck set continuescan to 'true'? */ + bool firstmatch; /* at least one match so far? */ + + /* + * Private _bt_checkkeys state used to manage "look ahead" optimization + * (only used during scans with array keys) + */ + int16 rechecks; + int16 targetdistance; + +} BTReadPageState; + +/* + * We use some private sk_flags bits in preprocessed scan keys. We're allowed + * to use bits 16-31 (see skey.h). The uppermost bits are copied from the + * index's indoption[] array entry for the index attribute. + */ +#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ +#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ +#define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ +#define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) +#define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) + +typedef struct BTOptions +{ + int32 varlena_header_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ + float8 vacuum_cleanup_index_scale_factor; /* deprecated */ + bool deduplicate_items; /* Try to deduplicate items? */ +} BTOptions; + +#define BTGetFillFactor(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BTREE_AM_OID), \ + (relation)->rd_options ? \ + ((BTOptions *) (relation)->rd_options)->fillfactor : \ + BTREE_DEFAULT_FILLFACTOR) +#define BTGetTargetPageFreeSpace(relation) \ + (BLCKSZ * (100 - BTGetFillFactor(relation)) / 100) +#define BTGetDeduplicateItems(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == BTREE_AM_OID), \ + ((relation)->rd_options ? \ + ((BTOptions *) (relation)->rd_options)->deduplicate_items : true)) + +/* + * Constant definition for progress reporting. Phase numbers must match + * btbuildphasename. + */ +/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 (see progress.h) */ +#define PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN 2 +#define PROGRESS_BTREE_PHASE_PERFORMSORT_1 3 +#define PROGRESS_BTREE_PHASE_PERFORMSORT_2 4 +#define PROGRESS_BTREE_PHASE_LEAF_LOAD 5 + +/* + * external entry points for btree, in nbtree.c + */ +extern void btbuildempty(Relation index); +extern bool btinsert(Relation rel, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); +extern IndexScanDesc btbeginscan(Relation rel, int nkeys, int norderbys); +extern Size btestimateparallelscan(int nkeys, int norderbys); +extern void btinitparallelscan(void *target); +extern bool btgettuple(IndexScanDesc scan, ScanDirection dir); +extern int64 btgetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern void btrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern void btparallelrescan(IndexScanDesc scan); +extern void btendscan(IndexScanDesc scan); +extern void btmarkpos(IndexScanDesc scan); +extern void btrestrpos(IndexScanDesc scan); +extern IndexBulkDeleteResult *btbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *btvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); +extern bool btcanreturn(Relation index, int attno); + +/* + * prototypes for internal functions in nbtree.c + */ +extern bool _bt_parallel_seize(IndexScanDesc scan, BlockNumber *pageno, + bool first); +extern void _bt_parallel_release(IndexScanDesc scan, BlockNumber scan_page); +extern void _bt_parallel_done(IndexScanDesc scan); +extern void _bt_parallel_primscan_schedule(IndexScanDesc scan, + BlockNumber prev_scan_page); + +/* + * prototypes for functions in nbtdedup.c + */ +extern void _bt_dedup_pass(Relation rel, Buffer buf, IndexTuple newitem, + Size newitemsz, bool bottomupdedup); +extern bool _bt_bottomupdel_pass(Relation rel, Buffer buf, Relation heapRel, + Size newitemsz); +extern void _bt_dedup_start_pending(BTDedupState state, IndexTuple base, + OffsetNumber baseoff); +extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup); +extern Size _bt_dedup_finish_pending(Page newpage, BTDedupState state); +extern IndexTuple _bt_form_posting(IndexTuple base, ItemPointer htids, + int nhtids); +extern void _bt_update_posting(BTVacuumPosting vacposting); +extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting, + int postingoff); + +/* + * prototypes for functions in nbtinsert.c + */ +extern bool _bt_doinsert(Relation rel, IndexTuple itup, + IndexUniqueCheck checkUnique, bool indexUnchanged, + Relation heapRel); +extern void _bt_finish_split(Relation rel, Relation heaprel, Buffer lbuf, + BTStack stack); +extern Buffer _bt_getstackbuf(Relation rel, Relation heaprel, BTStack stack, + BlockNumber child); + +/* + * prototypes for functions in nbtsplitloc.c + */ +extern OffsetNumber _bt_findsplitloc(Relation rel, Page origpage, + OffsetNumber newitemoff, Size newitemsz, IndexTuple newitem, + bool *newitemonleft); + +/* + * prototypes for functions in nbtpage.c + */ +extern void _bt_initmetapage(Page page, BlockNumber rootbknum, uint32 level, + bool allequalimage); +extern bool _bt_vacuum_needs_cleanup(Relation rel); +extern void _bt_set_cleanup_info(Relation rel, BlockNumber num_delpages); +extern void _bt_upgrademetapage(Page page); +extern Buffer _bt_getroot(Relation rel, Relation heaprel, int access); +extern Buffer _bt_gettrueroot(Relation rel); +extern int _bt_getrootheight(Relation rel); +extern void _bt_metaversion(Relation rel, bool *heapkeyspace, + bool *allequalimage); +extern void _bt_checkpage(Relation rel, Buffer buf); +extern Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access); +extern Buffer _bt_allocbuf(Relation rel, Relation heaprel); +extern Buffer _bt_relandgetbuf(Relation rel, Buffer obuf, + BlockNumber blkno, int access); +extern void _bt_relbuf(Relation rel, Buffer buf); +extern void _bt_lockbuf(Relation rel, Buffer buf, int access); +extern void _bt_unlockbuf(Relation rel, Buffer buf); +extern bool _bt_conditionallockbuf(Relation rel, Buffer buf); +extern void _bt_upgradelockbufcleanup(Relation rel, Buffer buf); +extern void _bt_pageinit(Page page, Size size); +extern void _bt_delitems_vacuum(Relation rel, Buffer buf, + OffsetNumber *deletable, int ndeletable, + BTVacuumPosting *updatable, int nupdatable); +extern void _bt_delitems_delete_check(Relation rel, Buffer buf, + Relation heapRel, + TM_IndexDeleteOp *delstate); +extern void _bt_pagedel(Relation rel, Buffer leafbuf, BTVacState *vstate); +extern void _bt_pendingfsm_init(Relation rel, BTVacState *vstate, + bool cleanuponly); +extern void _bt_pendingfsm_finalize(Relation rel, BTVacState *vstate); + +/* + * prototypes for functions in nbtsearch.c + */ +extern BTStack _bt_search(Relation rel, Relation heaprel, BTScanInsert key, + Buffer *bufP, int access); +extern Buffer _bt_moveright(Relation rel, Relation heaprel, BTScanInsert key, + Buffer buf, bool forupdate, BTStack stack, + int access); +extern OffsetNumber _bt_binsrch_insert(Relation rel, BTInsertState insertstate); +extern int32 _bt_compare(Relation rel, BTScanInsert key, Page page, OffsetNumber offnum); +extern bool _bt_first(IndexScanDesc scan, ScanDirection dir); +extern bool _bt_next(IndexScanDesc scan, ScanDirection dir); +extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost); + +/* + * prototypes for functions in nbtutils.c + */ +extern BTScanInsert _bt_mkscankey(Relation rel, IndexTuple itup); +extern void _bt_freestack(BTStack stack); +extern bool _bt_start_prim_scan(IndexScanDesc scan, ScanDirection dir); +extern void _bt_start_array_keys(IndexScanDesc scan, ScanDirection dir); +extern void _bt_preprocess_keys(IndexScanDesc scan); +extern bool _bt_checkkeys(IndexScanDesc scan, BTReadPageState *pstate, bool arrayKeys, + IndexTuple tuple, int tupnatts); +extern void _bt_killitems(IndexScanDesc scan); +extern BTCycleId _bt_vacuum_cycleid(Relation rel); +extern BTCycleId _bt_start_vacuum(Relation rel); +extern void _bt_end_vacuum(Relation rel); +extern void _bt_end_vacuum_callback(int code, Datum arg); +extern Size BTreeShmemSize(void); +extern void BTreeShmemInit(void); +extern bytea *btoptions(Datum reloptions, bool validate); +extern bool btproperty(Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); +extern char *btbuildphasename(int64 phasenum); +extern IndexTuple _bt_truncate(Relation rel, IndexTuple lastleft, + IndexTuple firstright, BTScanInsert itup_key); +extern int _bt_keep_natts_fast(Relation rel, IndexTuple lastleft, + IndexTuple firstright); +extern bool _bt_check_natts(Relation rel, bool heapkeyspace, Page page, + OffsetNumber offnum); +extern void _bt_check_third_page(Relation rel, Relation heap, + bool needheaptidspace, Page page, IndexTuple newtup); +extern bool _bt_allequalimage(Relation rel, bool debugmessage); + +/* + * prototypes for functions in nbtvalidate.c + */ +extern bool btvalidate(Oid opclassoid); +extern void btadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +/* + * prototypes for functions in nbtsort.c + */ +extern IndexBuildResult *btbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc); + +#endif /* NBTREE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/nbtxlog.h b/platform/dbops/binaries/postgres/include/server/access/nbtxlog.h new file mode 100644 index 0000000000000000000000000000000000000000..e42ac1611cddcbbb9825a075745b018c21c5975a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/nbtxlog.h @@ -0,0 +1,367 @@ +/*------------------------------------------------------------------------- + * + * nbtxlog.h + * header file for postgres btree xlog routines + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/nbtxlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef NBTXLOG_H +#define NBTXLOG_H + +#include "access/transam.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +/* + * XLOG records for btree operations + * + * XLOG allows to store some information in high 4 bits of log + * record xl_info field + */ +#define XLOG_BTREE_INSERT_LEAF 0x00 /* add index tuple without split */ +#define XLOG_BTREE_INSERT_UPPER 0x10 /* same, on a non-leaf page */ +#define XLOG_BTREE_INSERT_META 0x20 /* same, plus update metapage */ +#define XLOG_BTREE_SPLIT_L 0x30 /* add index tuple with split */ +#define XLOG_BTREE_SPLIT_R 0x40 /* as above, new item on right */ +#define XLOG_BTREE_INSERT_POST 0x50 /* add index tuple with posting split */ +#define XLOG_BTREE_DEDUP 0x60 /* deduplicate tuples for a page */ +#define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */ +#define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */ +#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */ +#define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ +#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */ +#define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during + * vacuum */ +#define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from + * FSM */ +#define XLOG_BTREE_META_CLEANUP 0xE0 /* update cleanup-related data in the + * metapage */ + +/* + * All that we need to regenerate the meta-data page + */ +typedef struct xl_btree_metadata +{ + uint32 version; + BlockNumber root; + uint32 level; + BlockNumber fastroot; + uint32 fastlevel; + uint32 last_cleanup_num_delpages; + bool allequalimage; +} xl_btree_metadata; + +/* + * This is what we need to know about simple (without split) insert. + * + * This data record is used for INSERT_LEAF, INSERT_UPPER, INSERT_META, and + * INSERT_POST. Note that INSERT_META and INSERT_UPPER implies it's not a + * leaf page, while INSERT_POST and INSERT_LEAF imply that it must be a leaf + * page. + * + * Backup Blk 0: original page + * Backup Blk 1: child's left sibling, if INSERT_UPPER or INSERT_META + * Backup Blk 2: xl_btree_metadata, if INSERT_META + * + * Note: The new tuple is actually the "original" new item in the posting + * list split insert case (i.e. the INSERT_POST case). A split offset for + * the posting list is logged before the original new item. Recovery needs + * both, since it must do an in-place update of the existing posting list + * that was split as an extra step. Also, recovery generates a "final" + * newitem. See _bt_swap_posting() for details on posting list splits. + */ +typedef struct xl_btree_insert +{ + OffsetNumber offnum; + + /* POSTING SPLIT OFFSET FOLLOWS (INSERT_POST case) */ + /* NEW TUPLE ALWAYS FOLLOWS AT THE END */ +} xl_btree_insert; + +#define SizeOfBtreeInsert (offsetof(xl_btree_insert, offnum) + sizeof(OffsetNumber)) + +/* + * On insert with split, we save all the items going into the right sibling + * so that we can restore it completely from the log record. This way takes + * less xlog space than the normal approach, because if we did it standardly, + * XLogInsert would almost always think the right page is new and store its + * whole page image. The left page, however, is handled in the normal + * incremental-update fashion. + * + * Note: XLOG_BTREE_SPLIT_L and XLOG_BTREE_SPLIT_R share this data record. + * There are two variants to indicate whether the inserted tuple went into the + * left or right split page (and thus, whether the new item is stored or not). + * We always log the left page high key because suffix truncation can generate + * a new leaf high key using user-defined code. This is also necessary on + * internal pages, since the firstright item that the left page's high key was + * based on will have been truncated to zero attributes in the right page (the + * separator key is unavailable from the right page). + * + * Backup Blk 0: original page / new left page + * + * The left page's data portion contains the new item, if it's the _L variant. + * _R variant split records generally do not have a newitem (_R variant leaf + * page split records that must deal with a posting list split will include an + * explicit newitem, though it is never used on the right page -- it is + * actually an orignewitem needed to update existing posting list). The new + * high key of the left/original page appears last of all (and must always be + * present). + * + * Page split records that need the REDO routine to deal with a posting list + * split directly will have an explicit newitem, which is actually an + * orignewitem (the newitem as it was before the posting list split, not + * after). A posting list split always has a newitem that comes immediately + * after the posting list being split (which would have overlapped with + * orignewitem prior to split). Usually REDO must deal with posting list + * splits with an _L variant page split record, and usually both the new + * posting list and the final newitem go on the left page (the existing + * posting list will be inserted instead of the old, and the final newitem + * will be inserted next to that). However, _R variant split records will + * include an orignewitem when the split point for the page happens to have a + * lastleft tuple that is also the posting list being split (leaving newitem + * as the page split's firstright tuple). The existence of this corner case + * does not change the basic fact about newitem/orignewitem for the REDO + * routine: it is always state used for the left page alone. (This is why the + * record's postingoff field isn't a reliable indicator of whether or not a + * posting list split occurred during the page split; a non-zero value merely + * indicates that the REDO routine must reconstruct a new posting list tuple + * that is needed for the left page.) + * + * This posting list split handling is equivalent to the xl_btree_insert REDO + * routine's INSERT_POST handling. While the details are more complicated + * here, the concept and goals are exactly the same. See _bt_swap_posting() + * for details on posting list splits. + * + * Backup Blk 1: new right page + * + * The right page's data portion contains the right page's tuples in the form + * used by _bt_restore_page. This includes the new item, if it's the _R + * variant. The right page's tuples also include the right page's high key + * with either variant (moved from the left/original page during the split), + * unless the split happened to be of the rightmost page on its level, where + * there is no high key for new right page. + * + * Backup Blk 2: next block (orig page's rightlink), if any + * Backup Blk 3: child's left sibling, if non-leaf split + */ +typedef struct xl_btree_split +{ + uint32 level; /* tree level of page being split */ + OffsetNumber firstrightoff; /* first origpage item on rightpage */ + OffsetNumber newitemoff; /* new item's offset */ + uint16 postingoff; /* offset inside orig posting tuple */ +} xl_btree_split; + +#define SizeOfBtreeSplit (offsetof(xl_btree_split, postingoff) + sizeof(uint16)) + +/* + * When page is deduplicated, consecutive groups of tuples with equal keys are + * merged together into posting list tuples. + * + * The WAL record represents a deduplication pass for a leaf page. An array + * of BTDedupInterval structs follows. + */ +typedef struct xl_btree_dedup +{ + uint16 nintervals; + + /* DEDUPLICATION INTERVALS FOLLOW */ +} xl_btree_dedup; + +#define SizeOfBtreeDedup (offsetof(xl_btree_dedup, nintervals) + sizeof(uint16)) + +/* + * This is what we need to know about page reuse within btree. This record + * only exists to generate a conflict point for Hot Standby. + * + * Note that we must include a RelFileLocator in the record because we don't + * actually register the buffer with the record. + */ +typedef struct xl_btree_reuse_page +{ + RelFileLocator locator; + BlockNumber block; + FullTransactionId snapshotConflictHorizon; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ +} xl_btree_reuse_page; + +#define SizeOfBtreeReusePage (offsetof(xl_btree_reuse_page, isCatalogRel) + sizeof(bool)) + +/* + * xl_btree_vacuum and xl_btree_delete records describe deletion of index + * tuples on a leaf page. The former variant is used by VACUUM, while the + * latter variant is used by the ad-hoc deletions that sometimes take place + * when btinsert() is called. + * + * The records are very similar. The only difference is that xl_btree_delete + * have snapshotConflictHorizon/isCatalogRel fields for recovery conflicts. + * (VACUUM operations can just rely on earlier conflicts generated during + * pruning of the table whose TIDs the to-be-deleted index tuples point to. + * There are also small differences between each REDO routine that we don't go + * into here.) + * + * xl_btree_vacuum and xl_btree_delete both represent deletion of any number + * of index tuples on a single leaf page using page offset numbers. Both also + * support "updates" of index tuples, which is how deletes of a subset of TIDs + * contained in an existing posting list tuple are implemented. + * + * Updated posting list tuples are represented using xl_btree_update metadata. + * The REDO routines each use the xl_btree_update entries (plus each + * corresponding original index tuple from the target leaf page) to generate + * the final updated tuple. + * + * Updates are only used when there will be some remaining TIDs left by the + * REDO routine. Otherwise the posting list tuple just gets deleted outright. + */ +typedef struct xl_btree_vacuum +{ + uint16 ndeleted; + uint16 nupdated; + + /*---- + * In payload of blk 0 : + * - DELETED TARGET OFFSET NUMBERS + * - UPDATED TARGET OFFSET NUMBERS + * - UPDATED TUPLES METADATA (xl_btree_update) ITEMS + *---- + */ +} xl_btree_vacuum; + +#define SizeOfBtreeVacuum (offsetof(xl_btree_vacuum, nupdated) + sizeof(uint16)) + +typedef struct xl_btree_delete +{ + TransactionId snapshotConflictHorizon; + uint16 ndeleted; + uint16 nupdated; + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /*---- + * In payload of blk 0 : + * - DELETED TARGET OFFSET NUMBERS + * - UPDATED TARGET OFFSET NUMBERS + * - UPDATED TUPLES METADATA (xl_btree_update) ITEMS + *---- + */ +} xl_btree_delete; + +#define SizeOfBtreeDelete (offsetof(xl_btree_delete, isCatalogRel) + sizeof(bool)) + +/* + * The offsets that appear in xl_btree_update metadata are offsets into the + * original posting list from tuple, not page offset numbers. These are + * 0-based. The page offset number for the original posting list tuple comes + * from the main xl_btree_vacuum/xl_btree_delete record. + */ +typedef struct xl_btree_update +{ + uint16 ndeletedtids; + + /* POSTING LIST uint16 OFFSETS TO A DELETED TID FOLLOW */ +} xl_btree_update; + +#define SizeOfBtreeUpdate (offsetof(xl_btree_update, ndeletedtids) + sizeof(uint16)) + +/* + * This is what we need to know about marking an empty subtree for deletion. + * The target identifies the tuple removed from the parent page (note that we + * remove this tuple's downlink and the *following* tuple's key). Note that + * the leaf page is empty, so we don't need to store its content --- it is + * just reinitialized during recovery using the rest of the fields. + * + * Backup Blk 0: leaf block + * Backup Blk 1: top parent + */ +typedef struct xl_btree_mark_page_halfdead +{ + OffsetNumber poffset; /* deleted tuple id in parent page */ + + /* information needed to recreate the leaf page: */ + BlockNumber leafblk; /* leaf block ultimately being deleted */ + BlockNumber leftblk; /* leaf block's left sibling, if any */ + BlockNumber rightblk; /* leaf block's right sibling */ + BlockNumber topparent; /* topmost internal page in the subtree */ +} xl_btree_mark_page_halfdead; + +#define SizeOfBtreeMarkPageHalfDead (offsetof(xl_btree_mark_page_halfdead, topparent) + sizeof(BlockNumber)) + +/* + * This is what we need to know about deletion of a btree page. Note that we + * only leave behind a small amount of bookkeeping information in deleted + * pages (deleted pages must be kept around as tombstones for a while). It is + * convenient for the REDO routine to regenerate its target page from scratch. + * This is why WAL record describes certain details that are actually directly + * available from the target page. + * + * Backup Blk 0: target block being deleted + * Backup Blk 1: target block's left sibling, if any + * Backup Blk 2: target block's right sibling + * Backup Blk 3: leaf block (if different from target) + * Backup Blk 4: metapage (if rightsib becomes new fast root) + */ +typedef struct xl_btree_unlink_page +{ + BlockNumber leftsib; /* target block's left sibling, if any */ + BlockNumber rightsib; /* target block's right sibling */ + uint32 level; /* target block's level */ + FullTransactionId safexid; /* target block's BTPageSetDeleted() XID */ + + /* + * Information needed to recreate a half-dead leaf page with correct + * topparent link. The fields are only used when deletion operation's + * target page is an internal page. REDO routine creates half-dead page + * from scratch to keep things simple (this is the same convenient + * approach used for the target page itself). + */ + BlockNumber leafleftsib; + BlockNumber leafrightsib; + BlockNumber leaftopparent; /* next child down in the subtree */ + + /* xl_btree_metadata FOLLOWS IF XLOG_BTREE_UNLINK_PAGE_META */ +} xl_btree_unlink_page; + +#define SizeOfBtreeUnlinkPage (offsetof(xl_btree_unlink_page, leaftopparent) + sizeof(BlockNumber)) + +/* + * New root log record. There are zero tuples if this is to establish an + * empty root, or two if it is the result of splitting an old root. + * + * Note that although this implies rewriting the metadata page, we don't need + * an xl_btree_metadata record --- the rootblk and level are sufficient. + * + * Backup Blk 0: new root page (2 tuples as payload, if splitting old root) + * Backup Blk 1: left child (if splitting an old root) + * Backup Blk 2: metapage + */ +typedef struct xl_btree_newroot +{ + BlockNumber rootblk; /* location of new root (redundant with blk 0) */ + uint32 level; /* its tree level */ +} xl_btree_newroot; + +#define SizeOfBtreeNewroot (offsetof(xl_btree_newroot, level) + sizeof(uint32)) + + +/* + * prototypes for functions in nbtxlog.c + */ +extern void btree_redo(XLogReaderState *record); +extern void btree_xlog_startup(void); +extern void btree_xlog_cleanup(void); +extern void btree_mask(char *pagedata, BlockNumber blkno); + +/* + * prototypes for functions in nbtdesc.c + */ +extern void btree_desc(StringInfo buf, XLogReaderState *record); +extern const char *btree_identify(uint8 info); + +#endif /* NBTXLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/parallel.h b/platform/dbops/binaries/postgres/include/server/access/parallel.h new file mode 100644 index 0000000000000000000000000000000000000000..69ffe5498f9e72730fcb194b2cb1931d2e044517 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/parallel.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * parallel.h + * Infrastructure for launching parallel workers + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/parallel.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARALLEL_H +#define PARALLEL_H + +#include "access/xlogdefs.h" +#include "lib/ilist.h" +#include "postmaster/bgworker.h" +#include "storage/shm_mq.h" +#include "storage/shm_toc.h" + +typedef void (*parallel_worker_main_type) (dsm_segment *seg, shm_toc *toc); + +typedef struct ParallelWorkerInfo +{ + BackgroundWorkerHandle *bgwhandle; + shm_mq_handle *error_mqh; +} ParallelWorkerInfo; + +typedef struct ParallelContext +{ + dlist_node node; + SubTransactionId subid; + int nworkers; /* Maximum number of workers to launch */ + int nworkers_to_launch; /* Actual number of workers to launch */ + int nworkers_launched; + char *library_name; + char *function_name; + ErrorContextCallback *error_context_stack; + shm_toc_estimator estimator; + dsm_segment *seg; + void *private_memory; + shm_toc *toc; + ParallelWorkerInfo *worker; + int nknown_attached_workers; + bool *known_attached_workers; +} ParallelContext; + +typedef struct ParallelWorkerContext +{ + dsm_segment *seg; + shm_toc *toc; +} ParallelWorkerContext; + +extern PGDLLIMPORT volatile sig_atomic_t ParallelMessagePending; +extern PGDLLIMPORT int ParallelWorkerNumber; +extern PGDLLIMPORT bool InitializingParallelWorker; + +#define IsParallelWorker() (ParallelWorkerNumber >= 0) + +extern ParallelContext *CreateParallelContext(const char *library_name, + const char *function_name, int nworkers); +extern void InitializeParallelDSM(ParallelContext *pcxt); +extern void ReinitializeParallelDSM(ParallelContext *pcxt); +extern void ReinitializeParallelWorkers(ParallelContext *pcxt, int nworkers_to_launch); +extern void LaunchParallelWorkers(ParallelContext *pcxt); +extern void WaitForParallelWorkersToAttach(ParallelContext *pcxt); +extern void WaitForParallelWorkersToFinish(ParallelContext *pcxt); +extern void DestroyParallelContext(ParallelContext *pcxt); +extern bool ParallelContextActive(void); + +extern void HandleParallelMessageInterrupt(void); +extern void HandleParallelMessages(void); +extern void AtEOXact_Parallel(bool isCommit); +extern void AtEOSubXact_Parallel(bool isCommit, SubTransactionId mySubId); +extern void ParallelWorkerReportLastRecEnd(XLogRecPtr last_xlog_end); + +extern void ParallelWorkerMain(Datum main_arg); + +#endif /* PARALLEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/printsimple.h b/platform/dbops/binaries/postgres/include/server/access/printsimple.h new file mode 100644 index 0000000000000000000000000000000000000000..5c549dc5164ae5e9ae88aa74ae7d924827badcbb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/printsimple.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * printsimple.h + * print simple tuples without catalog access + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/printsimple.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PRINTSIMPLE_H +#define PRINTSIMPLE_H + +#include "tcop/dest.h" + +extern bool printsimple(TupleTableSlot *slot, DestReceiver *self); +extern void printsimple_startup(DestReceiver *self, int operation, + TupleDesc tupdesc); + +#endif /* PRINTSIMPLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/printtup.h b/platform/dbops/binaries/postgres/include/server/access/printtup.h new file mode 100644 index 0000000000000000000000000000000000000000..b1fecf873b4139857b778a9da5446c15c8c6ceca --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/printtup.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * printtup.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/printtup.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINTTUP_H +#define PRINTTUP_H + +#include "utils/portal.h" + +extern DestReceiver *printtup_create_DR(CommandDest dest); + +extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal); + +extern void SendRowDescriptionMessage(StringInfo buf, + TupleDesc typeinfo, List *targetlist, int16 *formats); + +extern void debugStartup(DestReceiver *self, int operation, + TupleDesc typeinfo); +extern bool debugtup(TupleTableSlot *slot, DestReceiver *self); + +/* XXX these are really in executor/spi.c */ +extern void spi_dest_startup(DestReceiver *self, int operation, + TupleDesc typeinfo); +extern bool spi_printtup(TupleTableSlot *slot, DestReceiver *self); + +#endif /* PRINTTUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/relation.h b/platform/dbops/binaries/postgres/include/server/access/relation.h new file mode 100644 index 0000000000000000000000000000000000000000..aa5ccadc36ccae59bac07328ba741c9056fd49b5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/relation.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * relation.h + * Generic relation related routines. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/relation.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACCESS_RELATION_H +#define ACCESS_RELATION_H + +#include "nodes/primnodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation relation_open(Oid relationId, LOCKMODE lockmode); +extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode); +extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode); +extern Relation relation_openrv_extended(const RangeVar *relation, + LOCKMODE lockmode, bool missing_ok); +extern void relation_close(Relation relation, LOCKMODE lockmode); + +#endif /* ACCESS_RELATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/reloptions.h b/platform/dbops/binaries/postgres/include/server/access/reloptions.h new file mode 100644 index 0000000000000000000000000000000000000000..81829b8270a79b9788a855d9242b45054559c601 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/reloptions.h @@ -0,0 +1,247 @@ +/*------------------------------------------------------------------------- + * + * reloptions.h + * Core support for relation and tablespace options (pg_class.reloptions + * and pg_tablespace.spcoptions) + * + * Note: the functions dealing with text-array reloptions values declare + * them as Datum, not ArrayType *, to avoid needing to include array.h + * into a lot of low-level code. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/reloptions.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELOPTIONS_H +#define RELOPTIONS_H + +#include "access/amapi.h" +#include "access/htup.h" +#include "access/tupdesc.h" +#include "nodes/pg_list.h" +#include "storage/lock.h" + +/* types supported by reloptions */ +typedef enum relopt_type +{ + RELOPT_TYPE_BOOL, + RELOPT_TYPE_INT, + RELOPT_TYPE_REAL, + RELOPT_TYPE_ENUM, + RELOPT_TYPE_STRING, +} relopt_type; + +/* kinds supported by reloptions */ +typedef enum relopt_kind +{ + RELOPT_KIND_LOCAL = 0, + RELOPT_KIND_HEAP = (1 << 0), + RELOPT_KIND_TOAST = (1 << 1), + RELOPT_KIND_BTREE = (1 << 2), + RELOPT_KIND_HASH = (1 << 3), + RELOPT_KIND_GIN = (1 << 4), + RELOPT_KIND_GIST = (1 << 5), + RELOPT_KIND_ATTRIBUTE = (1 << 6), + RELOPT_KIND_TABLESPACE = (1 << 7), + RELOPT_KIND_SPGIST = (1 << 8), + RELOPT_KIND_VIEW = (1 << 9), + RELOPT_KIND_BRIN = (1 << 10), + RELOPT_KIND_PARTITIONED = (1 << 11), + /* if you add a new kind, make sure you update "last_default" too */ + RELOPT_KIND_LAST_DEFAULT = RELOPT_KIND_PARTITIONED, + /* some compilers treat enums as signed ints, so we can't use 1 << 31 */ + RELOPT_KIND_MAX = (1 << 30) +} relopt_kind; + +/* reloption namespaces allowed for heaps -- currently only TOAST */ +#define HEAP_RELOPT_NAMESPACES { "toast", NULL } + +/* generic struct to hold shared data */ +typedef struct relopt_gen +{ + const char *name; /* must be first (used as list termination + * marker) */ + const char *desc; + bits32 kinds; + LOCKMODE lockmode; + int namelen; + relopt_type type; +} relopt_gen; + +/* holds a parsed value */ +typedef struct relopt_value +{ + relopt_gen *gen; + bool isset; + union + { + bool bool_val; + int int_val; + double real_val; + int enum_val; + char *string_val; /* allocated separately */ + } values; +} relopt_value; + +/* reloptions records for specific variable types */ +typedef struct relopt_bool +{ + relopt_gen gen; + bool default_val; +} relopt_bool; + +typedef struct relopt_int +{ + relopt_gen gen; + int default_val; + int min; + int max; +} relopt_int; + +typedef struct relopt_real +{ + relopt_gen gen; + double default_val; + double min; + double max; +} relopt_real; + +/* + * relopt_enum_elt_def -- One member of the array of acceptable values + * of an enum reloption. + */ +typedef struct relopt_enum_elt_def +{ + const char *string_val; + int symbol_val; +} relopt_enum_elt_def; + +typedef struct relopt_enum +{ + relopt_gen gen; + relopt_enum_elt_def *members; + int default_val; + const char *detailmsg; + /* null-terminated array of members */ +} relopt_enum; + +/* validation routines for strings */ +typedef void (*validate_string_relopt) (const char *value); +typedef Size (*fill_string_relopt) (const char *value, void *ptr); + +/* validation routine for the whole option set */ +typedef void (*relopts_validator) (void *parsed_options, relopt_value *vals, int nvals); + +typedef struct relopt_string +{ + relopt_gen gen; + int default_len; + bool default_isnull; + validate_string_relopt validate_cb; + fill_string_relopt fill_cb; + char *default_val; +} relopt_string; + +/* This is the table datatype for build_reloptions() */ +typedef struct +{ + const char *optname; /* option's name */ + relopt_type opttype; /* option's datatype */ + int offset; /* offset of field in result struct */ +} relopt_parse_elt; + +/* Local reloption definition */ +typedef struct local_relopt +{ + relopt_gen *option; /* option definition */ + int offset; /* offset of parsed value in bytea structure */ +} local_relopt; + +/* Structure to hold local reloption data for build_local_reloptions() */ +typedef struct local_relopts +{ + List *options; /* list of local_relopt definitions */ + List *validators; /* list of relopts_validator callbacks */ + Size relopt_struct_size; /* size of parsed bytea structure */ +} local_relopts; + +/* + * Utility macro to get a value for a string reloption once the options + * are parsed. This gets a pointer to the string value itself. "optstruct" + * is the StdRdOptions struct or equivalent, "member" is the struct member + * corresponding to the string option. + */ +#define GET_STRING_RELOPTION(optstruct, member) \ + ((optstruct)->member == 0 ? NULL : \ + (char *)(optstruct) + (optstruct)->member) + +extern relopt_kind add_reloption_kind(void); +extern void add_bool_reloption(bits32 kinds, const char *name, const char *desc, + bool default_val, LOCKMODE lockmode); +extern void add_int_reloption(bits32 kinds, const char *name, const char *desc, + int default_val, int min_val, int max_val, + LOCKMODE lockmode); +extern void add_real_reloption(bits32 kinds, const char *name, const char *desc, + double default_val, double min_val, double max_val, + LOCKMODE lockmode); +extern void add_enum_reloption(bits32 kinds, const char *name, const char *desc, + relopt_enum_elt_def *members, int default_val, + const char *detailmsg, LOCKMODE lockmode); +extern void add_string_reloption(bits32 kinds, const char *name, const char *desc, + const char *default_val, validate_string_relopt validator, + LOCKMODE lockmode); + +extern void init_local_reloptions(local_relopts *relopts, Size relopt_struct_size); +extern void register_reloptions_validator(local_relopts *relopts, + relopts_validator validator); +extern void add_local_bool_reloption(local_relopts *relopts, const char *name, + const char *desc, bool default_val, + int offset); +extern void add_local_int_reloption(local_relopts *relopts, const char *name, + const char *desc, int default_val, + int min_val, int max_val, int offset); +extern void add_local_real_reloption(local_relopts *relopts, const char *name, + const char *desc, double default_val, + double min_val, double max_val, + int offset); +extern void add_local_enum_reloption(local_relopts *relopts, + const char *name, const char *desc, + relopt_enum_elt_def *members, + int default_val, const char *detailmsg, + int offset); +extern void add_local_string_reloption(local_relopts *relopts, const char *name, + const char *desc, + const char *default_val, + validate_string_relopt validator, + fill_string_relopt filler, int offset); + +extern Datum transformRelOptions(Datum oldOptions, List *defList, + const char *namspace, char *validnsps[], + bool acceptOidsOff, bool isReset); +extern List *untransformRelOptions(Datum options); +extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, + amoptions_function amoptions); +extern void *build_reloptions(Datum reloptions, bool validate, + relopt_kind kind, + Size relopt_struct_size, + const relopt_parse_elt *relopt_elems, + int num_relopt_elems); +extern void *build_local_reloptions(local_relopts *relopts, Datum options, + bool validate); + +extern bytea *default_reloptions(Datum reloptions, bool validate, + relopt_kind kind); +extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate); +extern bytea *view_reloptions(Datum reloptions, bool validate); +extern bytea *partitioned_table_reloptions(Datum reloptions, bool validate); +extern bytea *index_reloptions(amoptions_function amoptions, Datum reloptions, + bool validate); +extern bytea *attribute_reloptions(Datum reloptions, bool validate); +extern bytea *tablespace_reloptions(Datum reloptions, bool validate); +extern LOCKMODE AlterTableGetRelOptionsLockLevel(List *defList); + +#endif /* RELOPTIONS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/relscan.h b/platform/dbops/binaries/postgres/include/server/access/relscan.h new file mode 100644 index 0000000000000000000000000000000000000000..521043304abb93318d24ce72857f3a602d897c43 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/relscan.h @@ -0,0 +1,191 @@ +/*------------------------------------------------------------------------- + * + * relscan.h + * POSTGRES relation scan descriptor definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/relscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELSCAN_H +#define RELSCAN_H + +#include "access/htup_details.h" +#include "access/itup.h" +#include "port/atomics.h" +#include "storage/buf.h" +#include "storage/spin.h" +#include "utils/relcache.h" + + +struct ParallelTableScanDescData; + +/* + * Generic descriptor for table scans. This is the base-class for table scans, + * which needs to be embedded in the scans of individual AMs. + */ +typedef struct TableScanDescData +{ + /* scan parameters */ + Relation rs_rd; /* heap relation descriptor */ + struct SnapshotData *rs_snapshot; /* snapshot to see */ + int rs_nkeys; /* number of scan keys */ + struct ScanKeyData *rs_key; /* array of scan key descriptors */ + + /* Range of ItemPointers for table_scan_getnextslot_tidrange() to scan. */ + ItemPointerData rs_mintid; + ItemPointerData rs_maxtid; + + /* + * Information about type and behaviour of the scan, a bitmask of members + * of the ScanOptions enum (see tableam.h). + */ + uint32 rs_flags; + + struct ParallelTableScanDescData *rs_parallel; /* parallel scan + * information */ +} TableScanDescData; +typedef struct TableScanDescData *TableScanDesc; + +/* + * Shared state for parallel table scan. + * + * Each backend participating in a parallel table scan has its own + * TableScanDesc in backend-private memory, and those objects all contain a + * pointer to this structure. The information here must be sufficient to + * properly initialize each new TableScanDesc as workers join the scan, and it + * must act as a information what to scan for those workers. + */ +typedef struct ParallelTableScanDescData +{ + Oid phs_relid; /* OID of relation to scan */ + bool phs_syncscan; /* report location to syncscan logic? */ + bool phs_snapshot_any; /* SnapshotAny, not phs_snapshot_data? */ + Size phs_snapshot_off; /* data for snapshot */ +} ParallelTableScanDescData; +typedef struct ParallelTableScanDescData *ParallelTableScanDesc; + +/* + * Shared state for parallel table scans, for block oriented storage. + */ +typedef struct ParallelBlockTableScanDescData +{ + ParallelTableScanDescData base; + + BlockNumber phs_nblocks; /* # blocks in relation at start of scan */ + slock_t phs_mutex; /* mutual exclusion for setting startblock */ + BlockNumber phs_startblock; /* starting block number */ + pg_atomic_uint64 phs_nallocated; /* number of blocks allocated to + * workers so far. */ +} ParallelBlockTableScanDescData; +typedef struct ParallelBlockTableScanDescData *ParallelBlockTableScanDesc; + +/* + * Per backend state for parallel table scan, for block-oriented storage. + */ +typedef struct ParallelBlockTableScanWorkerData +{ + uint64 phsw_nallocated; /* Current # of blocks into the scan */ + uint32 phsw_chunk_remaining; /* # blocks left in this chunk */ + uint32 phsw_chunk_size; /* The number of blocks to allocate in + * each I/O chunk for the scan */ +} ParallelBlockTableScanWorkerData; +typedef struct ParallelBlockTableScanWorkerData *ParallelBlockTableScanWorker; + +/* + * Base class for fetches from a table via an index. This is the base-class + * for such scans, which needs to be embedded in the respective struct for + * individual AMs. + */ +typedef struct IndexFetchTableData +{ + Relation rel; +} IndexFetchTableData; + +/* + * We use the same IndexScanDescData structure for both amgettuple-based + * and amgetbitmap-based index scans. Some fields are only relevant in + * amgettuple-based scans. + */ +typedef struct IndexScanDescData +{ + /* scan parameters */ + Relation heapRelation; /* heap relation descriptor, or NULL */ + Relation indexRelation; /* index relation descriptor */ + struct SnapshotData *xs_snapshot; /* snapshot to see */ + int numberOfKeys; /* number of index qualifier conditions */ + int numberOfOrderBys; /* number of ordering operators */ + struct ScanKeyData *keyData; /* array of index qualifier descriptors */ + struct ScanKeyData *orderByData; /* array of ordering op descriptors */ + bool xs_want_itup; /* caller requests index tuples */ + bool xs_temp_snap; /* unregister snapshot at scan end? */ + + /* signaling to index AM about killing index tuples */ + bool kill_prior_tuple; /* last-returned tuple is dead */ + bool ignore_killed_tuples; /* do not return killed entries */ + bool xactStartedInRecovery; /* prevents killing/seeing killed + * tuples */ + + /* index access method's private state */ + void *opaque; /* access-method-specific info */ + + /* + * In an index-only scan, a successful amgettuple call must fill either + * xs_itup (and xs_itupdesc) or xs_hitup (and xs_hitupdesc) to provide the + * data returned by the scan. It can fill both, in which case the heap + * format will be used. + */ + IndexTuple xs_itup; /* index tuple returned by AM */ + struct TupleDescData *xs_itupdesc; /* rowtype descriptor of xs_itup */ + HeapTuple xs_hitup; /* index data returned by AM, as HeapTuple */ + struct TupleDescData *xs_hitupdesc; /* rowtype descriptor of xs_hitup */ + + ItemPointerData xs_heaptid; /* result */ + bool xs_heap_continue; /* T if must keep walking, potential + * further results */ + IndexFetchTableData *xs_heapfetch; + + bool xs_recheck; /* T means scan keys must be rechecked */ + + /* + * When fetching with an ordering operator, the values of the ORDER BY + * expressions of the last returned tuple, according to the index. If + * xs_recheckorderby is true, these need to be rechecked just like the + * scan keys, and the values returned here are a lower-bound on the actual + * values. + */ + Datum *xs_orderbyvals; + bool *xs_orderbynulls; + bool xs_recheckorderby; + + /* parallel index scan information, in shared memory */ + struct ParallelIndexScanDescData *parallel_scan; +} IndexScanDescData; + +/* Generic structure for parallel scans */ +typedef struct ParallelIndexScanDescData +{ + Oid ps_relid; + Oid ps_indexid; + Size ps_offset; /* Offset in bytes of am specific structure */ + char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER]; +} ParallelIndexScanDescData; + +struct TupleTableSlot; + +/* Struct for storage-or-index scans of system tables */ +typedef struct SysScanDescData +{ + Relation heap_rel; /* catalog being scanned */ + Relation irel; /* NULL if doing heap scan */ + struct TableScanDescData *scan; /* only valid in storage-scan case */ + struct IndexScanDescData *iscan; /* only valid in index-scan case */ + struct SnapshotData *snapshot; /* snapshot to unregister at end of scan */ + struct TupleTableSlot *slot; +} SysScanDescData; + +#endif /* RELSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/rewriteheap.h b/platform/dbops/binaries/postgres/include/server/access/rewriteheap.h new file mode 100644 index 0000000000000000000000000000000000000000..5866a26bdddf08abef5da8c99c0012cb3e606f95 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/rewriteheap.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * rewriteheap.h + * Declarations for heap rewrite support functions + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/access/rewriteheap.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITE_HEAP_H +#define REWRITE_HEAP_H + +#include "access/htup.h" +#include "storage/itemptr.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* struct definition is private to rewriteheap.c */ +typedef struct RewriteStateData *RewriteState; + +extern RewriteState begin_heap_rewrite(Relation old_heap, Relation new_heap, + TransactionId oldest_xmin, TransactionId freeze_xid, + MultiXactId cutoff_multi); +extern void end_heap_rewrite(RewriteState state); +extern void rewrite_heap_tuple(RewriteState state, HeapTuple old_tuple, + HeapTuple new_tuple); +extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple); + +/* + * On-Disk data format for an individual logical rewrite mapping. + */ +typedef struct LogicalRewriteMappingData +{ + RelFileLocator old_locator; + RelFileLocator new_locator; + ItemPointerData old_tid; + ItemPointerData new_tid; +} LogicalRewriteMappingData; + +/* --- + * The filename consists of the following, dash separated, + * components: + * 1) database oid or InvalidOid for shared relations + * 2) the oid of the relation + * 3) upper 32bit of the LSN at which a rewrite started + * 4) lower 32bit of the LSN at which a rewrite started + * 5) xid we are mapping for + * 6) xid of the xact performing the mapping + * --- + */ +#define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x" +extern void CheckPointLogicalRewriteHeap(void); + +#endif /* REWRITE_HEAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/rmgr.h b/platform/dbops/binaries/postgres/include/server/access/rmgr.h new file mode 100644 index 0000000000000000000000000000000000000000..3b6a497e1b40558eac70d6578e4898da92afe8a2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/rmgr.h @@ -0,0 +1,62 @@ +/* + * rmgr.h + * + * Resource managers definition + * + * src/include/access/rmgr.h + */ +#ifndef RMGR_H +#define RMGR_H + +typedef uint8 RmgrId; + +/* + * Built-in resource managers + * + * The actual numerical values for each rmgr ID are defined by the order + * of entries in rmgrlist.h. + * + * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG + * file format. + */ +#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \ + symname, + +typedef enum RmgrIds +{ +#include "access/rmgrlist.h" + RM_NEXT_ID +} RmgrIds; + +#undef PG_RMGR + +#define RM_MAX_ID UINT8_MAX +#define RM_MAX_BUILTIN_ID (RM_NEXT_ID - 1) +#define RM_MIN_CUSTOM_ID 128 +#define RM_MAX_CUSTOM_ID UINT8_MAX +#define RM_N_IDS (UINT8_MAX + 1) +#define RM_N_BUILTIN_IDS (RM_MAX_BUILTIN_ID + 1) +#define RM_N_CUSTOM_IDS (RM_MAX_CUSTOM_ID - RM_MIN_CUSTOM_ID + 1) + +static inline bool +RmgrIdIsBuiltin(int rmid) +{ + return rmid <= RM_MAX_BUILTIN_ID; +} + +static inline bool +RmgrIdIsCustom(int rmid) +{ + return rmid >= RM_MIN_CUSTOM_ID && rmid <= RM_MAX_CUSTOM_ID; +} + +#define RmgrIdIsValid(rmid) (RmgrIdIsBuiltin((rmid)) || RmgrIdIsCustom((rmid))) + +/* + * RmgrId to use for extensions that require an RmgrId, but are still in + * development and have not reserved their own unique RmgrId yet. See: + * https://wiki.postgresql.org/wiki/CustomWALResourceManagers + */ +#define RM_EXPERIMENTAL_ID 128 + +#endif /* RMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/rmgrdesc_utils.h b/platform/dbops/binaries/postgres/include/server/access/rmgrdesc_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..fcf214309c332fdc8f3494719189b2e8f1198199 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/rmgrdesc_utils.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * rmgrdesc_utils.h + * Support functions for rmgrdesc routines + * + * Copyright (c) 2023-2024, PostgreSQL Global Development Group + * + * src/include/access/rmgrdesc_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef RMGRDESC_UTILS_H_ +#define RMGRDESC_UTILS_H_ + +extern void array_desc(StringInfo buf, void *array, size_t elem_size, int count, + void (*elem_desc) (StringInfo buf, void *elem, void *data), + void *data); +extern void offset_elem_desc(StringInfo buf, void *offset, void *data); +extern void redirect_elem_desc(StringInfo buf, void *offset, void *data); +extern void oid_elem_desc(StringInfo buf, void *relid, void *data); + +#endif /* RMGRDESC_UTILS_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/access/rmgrlist.h b/platform/dbops/binaries/postgres/include/server/access/rmgrlist.h new file mode 100644 index 0000000000000000000000000000000000000000..78e6b908c6e764a919a75f0d828af6fe49f7c202 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/rmgrlist.h @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------- + * rmgrlist.h + * + * The resource manager list is kept in its own source file for possible + * use by automatic tools. The exact representation of a rmgr is determined + * by the PG_RMGR macro, which is not defined in this file; it can be + * defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/rmgrlist.h + *--------------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef RMGRLIST_H here */ + +/* + * List of resource manager entries. Note that order of entries defines the + * numerical values of each rmgr's ID, which is stored in WAL records. New + * entries should be added at the end, to avoid changing IDs of existing + * entries. + * + * Changes to this list possibly need an XLOG_PAGE_MAGIC bump. + */ + +/* symbol name, textual name, redo, desc, identify, startup, cleanup, mask, decode */ +PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, xlog_identify, NULL, NULL, NULL, xlog_decode) +PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, xact_identify, NULL, NULL, NULL, xact_decode) +PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, smgr_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, clog_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, dbase_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, tblspc_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, multixact_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, relmap_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, standby_identify, NULL, NULL, NULL, standby_decode) +PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, heap2_identify, NULL, NULL, heap_mask, heap2_decode) +PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, heap_identify, NULL, NULL, heap_mask, heap_decode) +PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, btree_identify, btree_xlog_startup, btree_xlog_cleanup, btree_mask, NULL) +PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, hash_identify, NULL, NULL, hash_mask, NULL) +PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_identify, gin_xlog_startup, gin_xlog_cleanup, gin_mask, NULL) +PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_identify, gist_xlog_startup, gist_xlog_cleanup, gist_mask, NULL) +PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, seq_identify, NULL, NULL, seq_mask, NULL) +PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_identify, spg_xlog_startup, spg_xlog_cleanup, spg_mask, NULL) +PG_RMGR(RM_BRIN_ID, "BRIN", brin_redo, brin_desc, brin_identify, NULL, NULL, brin_mask, NULL) +PG_RMGR(RM_COMMIT_TS_ID, "CommitTs", commit_ts_redo, commit_ts_desc, commit_ts_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_REPLORIGIN_ID, "ReplicationOrigin", replorigin_redo, replorigin_desc, replorigin_identify, NULL, NULL, NULL, NULL) +PG_RMGR(RM_GENERIC_ID, "Generic", generic_redo, generic_desc, generic_identify, NULL, NULL, generic_mask, NULL) +PG_RMGR(RM_LOGICALMSG_ID, "LogicalMessage", logicalmsg_redo, logicalmsg_desc, logicalmsg_identify, NULL, NULL, NULL, logicalmsg_decode) diff --git a/platform/dbops/binaries/postgres/include/server/access/sdir.h b/platform/dbops/binaries/postgres/include/server/access/sdir.h new file mode 100644 index 0000000000000000000000000000000000000000..d40d809bd2308da6cb23f10cf14c1939d38c3774 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/sdir.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * sdir.h + * POSTGRES scan direction definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sdir.h + * + *------------------------------------------------------------------------- + */ +#ifndef SDIR_H +#define SDIR_H + + +/* + * Defines the direction for scanning a table or an index. Scans are never + * invoked using NoMovementScanDirectionScans. For convenience, we use the + * values -1 and 1 for backward and forward scans. This allows us to perform + * a few mathematical tricks such as what is done in ScanDirectionCombine. + */ +typedef enum ScanDirection +{ + BackwardScanDirection = -1, + NoMovementScanDirection = 0, + ForwardScanDirection = 1 +} ScanDirection; + +/* + * Determine the net effect of two direction specifications. + * This relies on having ForwardScanDirection = +1, BackwardScanDirection = -1, + * and will probably not do what you want if applied to any other values. + */ +#define ScanDirectionCombine(a, b) ((a) * (b)) + +/* + * ScanDirectionIsValid + * True iff scan direction is valid. + */ +#define ScanDirectionIsValid(direction) \ + ((bool) (BackwardScanDirection <= (direction) && \ + (direction) <= ForwardScanDirection)) + +/* + * ScanDirectionIsBackward + * True iff scan direction is backward. + */ +#define ScanDirectionIsBackward(direction) \ + ((bool) ((direction) == BackwardScanDirection)) + +/* + * ScanDirectionIsNoMovement + * True iff scan direction indicates no movement. + */ +#define ScanDirectionIsNoMovement(direction) \ + ((bool) ((direction) == NoMovementScanDirection)) + +/* + * ScanDirectionIsForward + * True iff scan direction is forward. + */ +#define ScanDirectionIsForward(direction) \ + ((bool) ((direction) == ForwardScanDirection)) + +#endif /* SDIR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/sequence.h b/platform/dbops/binaries/postgres/include/server/access/sequence.h new file mode 100644 index 0000000000000000000000000000000000000000..fb8708861b5523c0cce76b25eaf60345bf1bf241 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/sequence.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * sequence.h + * Generic routines for sequence-related code. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sequence.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACCESS_SEQUENCE_H +#define ACCESS_SEQUENCE_H + +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation sequence_open(Oid relationId, LOCKMODE lockmode); +extern void sequence_close(Relation relation, LOCKMODE lockmode); + +#endif /* ACCESS_SEQUENCE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/session.h b/platform/dbops/binaries/postgres/include/server/access/session.h new file mode 100644 index 0000000000000000000000000000000000000000..ce48449a87195b2f8f627698abc29ca082da90f1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/session.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * session.h + * Encapsulation of user session. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/access/session.h + * + *------------------------------------------------------------------------- + */ +#ifndef SESSION_H +#define SESSION_H + +#include "lib/dshash.h" + +/* Avoid including typcache.h */ +struct SharedRecordTypmodRegistry; + +/* + * A struct encapsulating some elements of a user's session. For now this + * manages state that applies to parallel query, but in principle it could + * include other things that are currently global variables. + */ +typedef struct Session +{ + dsm_segment *segment; /* The session-scoped DSM segment. */ + dsa_area *area; /* The session-scoped DSA area. */ + + /* State managed by typcache.c. */ + struct SharedRecordTypmodRegistry *shared_typmod_registry; + dshash_table *shared_record_table; + dshash_table *shared_typmod_table; +} Session; + +extern void InitializeSession(void); +extern dsm_handle GetSessionDsmHandle(void); +extern void AttachSession(dsm_handle handle); +extern void DetachSession(void); + +/* The current session, or NULL for none. */ +extern PGDLLIMPORT Session *CurrentSession; + +#endif /* SESSION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/skey.h b/platform/dbops/binaries/postgres/include/server/access/skey.h new file mode 100644 index 0000000000000000000000000000000000000000..8054d3edce456b937725601a594a94f83cd2a0c9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/skey.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * skey.h + * POSTGRES scan key definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/skey.h + * + *------------------------------------------------------------------------- + */ +#ifndef SKEY_H +#define SKEY_H + +#include "access/attnum.h" +#include "access/stratnum.h" +#include "fmgr.h" + + +/* + * A ScanKey represents the application of a comparison operator between + * a table or index column and a constant. When it's part of an array of + * ScanKeys, the comparison conditions are implicitly ANDed. The index + * column is the left argument of the operator, if it's a binary operator. + * (The data structure can support unary indexable operators too; in that + * case sk_argument would go unused. This is not currently implemented.) + * + * For an index scan, sk_strategy and sk_subtype must be set correctly for + * the operator. When using a ScanKey in a heap scan, these fields are not + * used and may be set to InvalidStrategy/InvalidOid. + * + * If the operator is collation-sensitive, sk_collation must be set + * correctly as well. + * + * A ScanKey can also represent a ScalarArrayOpExpr, that is a condition + * "column op ANY(ARRAY[...])". This is signaled by the SK_SEARCHARRAY + * flag bit. The sk_argument is not a value of the operator's right-hand + * argument type, but rather an array of such values, and the per-element + * comparisons are to be ORed together. + * + * A ScanKey can also represent a condition "column IS NULL" or "column + * IS NOT NULL"; these cases are signaled by the SK_SEARCHNULL and + * SK_SEARCHNOTNULL flag bits respectively. The argument is always NULL, + * and the sk_strategy, sk_subtype, sk_collation, and sk_func fields are + * not used (unless set by the index AM). + * + * SK_SEARCHARRAY, SK_SEARCHNULL and SK_SEARCHNOTNULL are supported only + * for index scans, not heap scans; and not all index AMs support them, + * only those that set amsearcharray or amsearchnulls respectively. + * + * A ScanKey can also represent an ordering operator invocation, that is + * an ordering requirement "ORDER BY indexedcol op constant". This looks + * the same as a comparison operator, except that the operator doesn't + * (usually) yield boolean. We mark such ScanKeys with SK_ORDER_BY. + * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. + * + * Note: in some places, ScanKeys are used as a convenient representation + * for the invocation of an access method support procedure. In this case + * sk_strategy/sk_subtype are not meaningful (but sk_collation can be); and + * sk_func may refer to a function that returns something other than boolean. + */ +typedef struct ScanKeyData +{ + int sk_flags; /* flags, see below */ + AttrNumber sk_attno; /* table or index column number */ + StrategyNumber sk_strategy; /* operator strategy number */ + Oid sk_subtype; /* strategy subtype */ + Oid sk_collation; /* collation to use, if needed */ + FmgrInfo sk_func; /* lookup info for function to call */ + Datum sk_argument; /* data to compare */ +} ScanKeyData; + +typedef ScanKeyData *ScanKey; + +/* + * About row comparisons: + * + * The ScanKey data structure also supports row comparisons, that is ordered + * tuple comparisons like (x, y) > (c1, c2), having the SQL-spec semantics + * "x > c1 OR (x = c1 AND y > c2)". Note that this is currently only + * implemented for btree index searches, not for heapscans or any other index + * type. A row comparison is represented by a "header" ScanKey entry plus + * a separate array of ScanKeys, one for each column of the row comparison. + * The header entry has these properties: + * sk_flags = SK_ROW_HEADER + * sk_attno = index column number for leading column of row comparison + * sk_strategy = btree strategy code for semantics of row comparison + * (ie, < <= > or >=) + * sk_subtype, sk_collation, sk_func: not used + * sk_argument: pointer to subsidiary ScanKey array + * If the header is part of a ScanKey array that's sorted by attno, it + * must be sorted according to the leading column number. + * + * The subsidiary ScanKey array appears in logical column order of the row + * comparison, which may be different from index column order. The array + * elements are like a normal ScanKey array except that: + * sk_flags must include SK_ROW_MEMBER, plus SK_ROW_END in the last + * element (needed since row header does not include a count) + * sk_func points to the btree comparison support function for the + * opclass, NOT the operator's implementation function. + * sk_strategy must be the same in all elements of the subsidiary array, + * that is, the same as in the header entry. + * SK_SEARCHARRAY, SK_SEARCHNULL, SK_SEARCHNOTNULL cannot be used here. + */ + +/* + * ScanKeyData sk_flags + * + * sk_flags bits 0-15 are reserved for system-wide use (symbols for those + * bits should be defined here). Bits 16-31 are reserved for use within + * individual index access methods. + */ +#define SK_ISNULL 0x0001 /* sk_argument is NULL */ +#define SK_UNARY 0x0002 /* unary operator (not supported!) */ +#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ +#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ +#define SK_ROW_END 0x0010 /* last row comparison member */ +#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ +#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ +#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT NULL" */ +#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ + + +/* + * prototypes for functions in access/common/scankey.c + */ +extern void ScanKeyInit(ScanKey entry, + AttrNumber attributeNumber, + StrategyNumber strategy, + RegProcedure procedure, + Datum argument); +extern void ScanKeyEntryInitialize(ScanKey entry, + int flags, + AttrNumber attributeNumber, + StrategyNumber strategy, + Oid subtype, + Oid collation, + RegProcedure procedure, + Datum argument); +extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, + int flags, + AttrNumber attributeNumber, + StrategyNumber strategy, + Oid subtype, + Oid collation, + FmgrInfo *finfo, + Datum argument); + +#endif /* SKEY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/slru.h b/platform/dbops/binaries/postgres/include/server/access/slru.h new file mode 100644 index 0000000000000000000000000000000000000000..02fcb3bca5473df7746c00d2b57cf7e3b71cd130 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/slru.h @@ -0,0 +1,218 @@ +/*------------------------------------------------------------------------- + * + * slru.h + * Simple LRU buffering for transaction status logfiles + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/slru.h + * + *------------------------------------------------------------------------- + */ +#ifndef SLRU_H +#define SLRU_H + +#include "access/xlogdefs.h" +#include "storage/lwlock.h" +#include "storage/sync.h" + +/* + * To avoid overflowing internal arithmetic and the size_t data type, the + * number of buffers must not exceed this number. + */ +#define SLRU_MAX_ALLOWED_BUFFERS ((1024 * 1024 * 1024) / BLCKSZ) + +/* + * Define SLRU segment size. A page is the same BLCKSZ as is used everywhere + * else in Postgres. The segment size can be chosen somewhat arbitrarily; + * we make it 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG + * or 64K transactions for SUBTRANS. + * + * Note: because TransactionIds are 32 bits and wrap around at 0xFFFFFFFF, + * page numbering also wraps around at 0xFFFFFFFF/xxxx_XACTS_PER_PAGE (where + * xxxx is CLOG or SUBTRANS, respectively), and segment numbering at + * 0xFFFFFFFF/xxxx_XACTS_PER_PAGE/SLRU_PAGES_PER_SEGMENT. We need + * take no explicit notice of that fact in slru.c, except when comparing + * segment and page numbers in SimpleLruTruncate (see PagePrecedes()). + */ +#define SLRU_PAGES_PER_SEGMENT 32 + +/* + * Page status codes. Note that these do not include the "dirty" bit. + * page_dirty can be true only in the VALID or WRITE_IN_PROGRESS states; + * in the latter case it implies that the page has been re-dirtied since + * the write started. + */ +typedef enum +{ + SLRU_PAGE_EMPTY, /* buffer is not in use */ + SLRU_PAGE_READ_IN_PROGRESS, /* page is being read in */ + SLRU_PAGE_VALID, /* page is valid and not being written */ + SLRU_PAGE_WRITE_IN_PROGRESS, /* page is being written out */ +} SlruPageStatus; + +/* + * Shared-memory state + * + * ControlLock is used to protect access to the other fields, except + * latest_page_number, which uses atomics; see comment in slru.c. + */ +typedef struct SlruSharedData +{ + /* Number of buffers managed by this SLRU structure */ + int num_slots; + + /* + * Arrays holding info for each buffer slot. Page number is undefined + * when status is EMPTY, as is page_lru_count. + */ + char **page_buffer; + SlruPageStatus *page_status; + bool *page_dirty; + int64 *page_number; + int *page_lru_count; + + /* The buffer_locks protects the I/O on each buffer slots */ + LWLockPadded *buffer_locks; + + /* Locks to protect the in memory buffer slot access in SLRU bank. */ + LWLockPadded *bank_locks; + + /*---------- + * A bank-wise LRU counter is maintained because we do a victim buffer + * search within a bank. Furthermore, manipulating an individual bank + * counter avoids frequent cache invalidation since we update it every time + * we access the page. + * + * We mark a page "most recently used" by setting + * page_lru_count[slotno] = ++bank_cur_lru_count[bankno]; + * The oldest page in the bank is therefore the one with the highest value + * of + * bank_cur_lru_count[bankno] - page_lru_count[slotno] + * The counts will eventually wrap around, but this calculation still + * works as long as no page's age exceeds INT_MAX counts. + *---------- + */ + int *bank_cur_lru_count; + + /* + * Optional array of WAL flush LSNs associated with entries in the SLRU + * pages. If not zero/NULL, we must flush WAL before writing pages (true + * for pg_xact, false for everything else). group_lsn[] has + * lsn_groups_per_page entries per buffer slot, each containing the + * highest LSN known for a contiguous group of SLRU entries on that slot's + * page. + */ + XLogRecPtr *group_lsn; + int lsn_groups_per_page; + + /* + * latest_page_number is the page number of the current end of the log; + * this is not critical data, since we use it only to avoid swapping out + * the latest page. + */ + pg_atomic_uint64 latest_page_number; + + /* SLRU's index for statistics purposes (might not be unique) */ + int slru_stats_idx; +} SlruSharedData; + +typedef SlruSharedData *SlruShared; + +/* + * SlruCtlData is an unshared structure that points to the active information + * in shared memory. + */ +typedef struct SlruCtlData +{ + SlruShared shared; + + /* Number of banks in this SLRU. */ + uint16 nbanks; + + /* + * If true, use long segment file names. Otherwise, use short file names. + * + * For details about the file name format, see SlruFileName(). + */ + bool long_segment_names; + + /* + * Which sync handler function to use when handing sync requests over to + * the checkpointer. SYNC_HANDLER_NONE to disable fsync (eg pg_notify). + */ + SyncRequestHandler sync_handler; + + /* + * Decide whether a page is "older" for truncation and as a hint for + * evicting pages in LRU order. Return true if every entry of the first + * argument is older than every entry of the second argument. Note that + * !PagePrecedes(a,b) && !PagePrecedes(b,a) need not imply a==b; it also + * arises when some entries are older and some are not. For SLRUs using + * SimpleLruTruncate(), this must use modular arithmetic. (For others, + * the behavior of this callback has no functional implications.) Use + * SlruPagePrecedesUnitTests() in SLRUs meeting its criteria. + */ + bool (*PagePrecedes) (int64, int64); + + /* + * Dir is set during SimpleLruInit and does not change thereafter. Since + * it's always the same, it doesn't need to be in shared memory. + */ + char Dir[64]; +} SlruCtlData; + +typedef SlruCtlData *SlruCtl; + +/* + * Get the SLRU bank lock for given SlruCtl and the pageno. + * + * This lock needs to be acquired to access the slru buffer slots in the + * respective bank. + */ +static inline LWLock * +SimpleLruGetBankLock(SlruCtl ctl, int64 pageno) +{ + int bankno; + + bankno = pageno % ctl->nbanks; + return &(ctl->shared->bank_locks[bankno].lock); +} + +extern Size SimpleLruShmemSize(int nslots, int nlsns); +extern int SimpleLruAutotuneBuffers(int divisor, int max); +extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, + const char *subdir, int buffer_tranche_id, + int bank_tranche_id, SyncRequestHandler sync_handler, + bool long_segment_names); +extern int SimpleLruZeroPage(SlruCtl ctl, int64 pageno); +extern int SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok, + TransactionId xid); +extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int64 pageno, + TransactionId xid); +extern void SimpleLruWritePage(SlruCtl ctl, int slotno); +extern void SimpleLruWriteAll(SlruCtl ctl, bool allow_redirtied); +#ifdef USE_ASSERT_CHECKING +extern void SlruPagePrecedesUnitTests(SlruCtl ctl, int per_page); +#else +#define SlruPagePrecedesUnitTests(ctl, per_page) do {} while (0) +#endif +extern void SimpleLruTruncate(SlruCtl ctl, int64 cutoffPage); +extern bool SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int64 pageno); + +typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int64 segpage, + void *data); +extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data); +extern void SlruDeleteSegment(SlruCtl ctl, int64 segno); + +extern int SlruSyncFileTag(SlruCtl ctl, const FileTag *ftag, char *path); + +/* SlruScanDirectory public callbacks */ +extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, + int64 segpage, void *data); +extern bool SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int64 segpage, + void *data); +extern bool check_slru_buffers(const char *name, int *newval); + +#endif /* SLRU_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/spgist.h b/platform/dbops/binaries/postgres/include/server/access/spgist.h new file mode 100644 index 0000000000000000000000000000000000000000..d6a49531200743942802ff128d47f610fd063b30 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/spgist.h @@ -0,0 +1,229 @@ +/*------------------------------------------------------------------------- + * + * spgist.h + * Public header file for SP-GiST access method. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgist.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGIST_H +#define SPGIST_H + +#include "access/amapi.h" +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + + +/* SPGiST opclass support function numbers */ +#define SPGIST_CONFIG_PROC 1 +#define SPGIST_CHOOSE_PROC 2 +#define SPGIST_PICKSPLIT_PROC 3 +#define SPGIST_INNER_CONSISTENT_PROC 4 +#define SPGIST_LEAF_CONSISTENT_PROC 5 +#define SPGIST_COMPRESS_PROC 6 +#define SPGIST_OPTIONS_PROC 7 +#define SPGISTNRequiredProc 5 +#define SPGISTNProc 7 + +/* + * Argument structs for spg_config method + */ +typedef struct spgConfigIn +{ + Oid attType; /* Data type to be indexed */ +} spgConfigIn; + +typedef struct spgConfigOut +{ + Oid prefixType; /* Data type of inner-tuple prefixes */ + Oid labelType; /* Data type of inner-tuple node labels */ + Oid leafType; /* Data type of leaf-tuple values */ + bool canReturnData; /* Opclass can reconstruct original data */ + bool longValuesOK; /* Opclass can cope with values > 1 page */ +} spgConfigOut; + +/* + * Argument structs for spg_choose method + */ +typedef struct spgChooseIn +{ + Datum datum; /* original datum to be indexed */ + Datum leafDatum; /* current datum to be stored at leaf */ + int level; /* current level (counting from zero) */ + + /* Data from current inner tuple */ + bool allTheSame; /* tuple is marked all-the-same? */ + bool hasPrefix; /* tuple has a prefix? */ + Datum prefixDatum; /* if so, the prefix value */ + int nNodes; /* number of nodes in the inner tuple */ + Datum *nodeLabels; /* node label values (NULL if none) */ +} spgChooseIn; + +typedef enum spgChooseResultType +{ + spgMatchNode = 1, /* descend into existing node */ + spgAddNode, /* add a node to the inner tuple */ + spgSplitTuple, /* split inner tuple (change its prefix) */ +} spgChooseResultType; + +typedef struct spgChooseOut +{ + spgChooseResultType resultType; /* action code, see above */ + union + { + struct /* results for spgMatchNode */ + { + int nodeN; /* descend to this node (index from 0) */ + int levelAdd; /* increment level by this much */ + Datum restDatum; /* new leaf datum */ + } matchNode; + struct /* results for spgAddNode */ + { + Datum nodeLabel; /* new node's label */ + int nodeN; /* where to insert it (index from 0) */ + } addNode; + struct /* results for spgSplitTuple */ + { + /* Info to form new upper-level inner tuple with one child tuple */ + bool prefixHasPrefix; /* tuple should have a prefix? */ + Datum prefixPrefixDatum; /* if so, its value */ + int prefixNNodes; /* number of nodes */ + Datum *prefixNodeLabels; /* their labels (or NULL for no + * labels) */ + int childNodeN; /* which node gets child tuple */ + + /* Info to form new lower-level inner tuple with all old nodes */ + bool postfixHasPrefix; /* tuple should have a prefix? */ + Datum postfixPrefixDatum; /* if so, its value */ + } splitTuple; + } result; +} spgChooseOut; + +/* + * Argument structs for spg_picksplit method + */ +typedef struct spgPickSplitIn +{ + int nTuples; /* number of leaf tuples */ + Datum *datums; /* their datums (array of length nTuples) */ + int level; /* current level (counting from zero) */ +} spgPickSplitIn; + +typedef struct spgPickSplitOut +{ + bool hasPrefix; /* new inner tuple should have a prefix? */ + Datum prefixDatum; /* if so, its value */ + + int nNodes; /* number of nodes for new inner tuple */ + Datum *nodeLabels; /* their labels (or NULL for no labels) */ + + int *mapTuplesToNodes; /* node index for each leaf tuple */ + Datum *leafTupleDatums; /* datum to store in each new leaf tuple */ +} spgPickSplitOut; + +/* + * Argument structs for spg_inner_consistent method + */ +typedef struct spgInnerConsistentIn +{ + ScanKey scankeys; /* array of operators and comparison values */ + ScanKey orderbys; /* array of ordering operators and comparison + * values */ + int nkeys; /* length of scankeys array */ + int norderbys; /* length of orderbys array */ + + Datum reconstructedValue; /* value reconstructed at parent */ + void *traversalValue; /* opclass-specific traverse value */ + MemoryContext traversalMemoryContext; /* put new traverse values here */ + int level; /* current level (counting from zero) */ + bool returnData; /* original data must be returned? */ + + /* Data from current inner tuple */ + bool allTheSame; /* tuple is marked all-the-same? */ + bool hasPrefix; /* tuple has a prefix? */ + Datum prefixDatum; /* if so, the prefix value */ + int nNodes; /* number of nodes in the inner tuple */ + Datum *nodeLabels; /* node label values (NULL if none) */ +} spgInnerConsistentIn; + +typedef struct spgInnerConsistentOut +{ + int nNodes; /* number of child nodes to be visited */ + int *nodeNumbers; /* their indexes in the node array */ + int *levelAdds; /* increment level by this much for each */ + Datum *reconstructedValues; /* associated reconstructed values */ + void **traversalValues; /* opclass-specific traverse values */ + double **distances; /* associated distances */ +} spgInnerConsistentOut; + +/* + * Argument structs for spg_leaf_consistent method + */ +typedef struct spgLeafConsistentIn +{ + ScanKey scankeys; /* array of operators and comparison values */ + ScanKey orderbys; /* array of ordering operators and comparison + * values */ + int nkeys; /* length of scankeys array */ + int norderbys; /* length of orderbys array */ + + Datum reconstructedValue; /* value reconstructed at parent */ + void *traversalValue; /* opclass-specific traverse value */ + int level; /* current level (counting from zero) */ + bool returnData; /* original data must be returned? */ + + Datum leafDatum; /* datum in leaf tuple */ +} spgLeafConsistentIn; + +typedef struct spgLeafConsistentOut +{ + Datum leafValue; /* reconstructed original data, if any */ + bool recheck; /* set true if operator must be rechecked */ + bool recheckDistances; /* set true if distances must be rechecked */ + double *distances; /* associated distances */ +} spgLeafConsistentOut; + + +/* spgutils.c */ +extern bytea *spgoptions(Datum reloptions, bool validate); + +/* spginsert.c */ +extern IndexBuildResult *spgbuild(Relation heap, Relation index, + struct IndexInfo *indexInfo); +extern void spgbuildempty(Relation index); +extern bool spginsert(Relation index, Datum *values, bool *isnull, + ItemPointer ht_ctid, Relation heapRel, + IndexUniqueCheck checkUnique, + bool indexUnchanged, + struct IndexInfo *indexInfo); + +/* spgscan.c */ +extern IndexScanDesc spgbeginscan(Relation rel, int keysz, int orderbysz); +extern void spgendscan(IndexScanDesc scan); +extern void spgrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, + ScanKey orderbys, int norderbys); +extern int64 spggetbitmap(IndexScanDesc scan, TIDBitmap *tbm); +extern bool spggettuple(IndexScanDesc scan, ScanDirection dir); +extern bool spgcanreturn(Relation index, int attno); + +/* spgvacuum.c */ +extern IndexBulkDeleteResult *spgbulkdelete(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); +extern IndexBulkDeleteResult *spgvacuumcleanup(IndexVacuumInfo *info, + IndexBulkDeleteResult *stats); + +/* spgvalidate.c */ +extern bool spgvalidate(Oid opclassoid); +extern void spgadjustmembers(Oid opfamilyoid, + Oid opclassoid, + List *operators, + List *functions); + +#endif /* SPGIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/spgist_private.h b/platform/dbops/binaries/postgres/include/server/access/spgist_private.h new file mode 100644 index 0000000000000000000000000000000000000000..e7cbe10a89b5ca1b3e68272da62221f1089c8162 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/spgist_private.h @@ -0,0 +1,549 @@ +/*------------------------------------------------------------------------- + * + * spgist_private.h + * Private declarations for SP-GiST access method. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgist_private.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGIST_PRIVATE_H +#define SPGIST_PRIVATE_H + +#include "access/itup.h" +#include "access/spgist.h" +#include "catalog/pg_am_d.h" +#include "nodes/tidbitmap.h" +#include "storage/buf.h" +#include "utils/geo_decls.h" +#include "utils/relcache.h" + + +typedef struct SpGistOptions +{ + int32 varlena_header_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ +} SpGistOptions; + +#define SpGistGetFillFactor(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_INDEX && \ + relation->rd_rel->relam == SPGIST_AM_OID), \ + (relation)->rd_options ? \ + ((SpGistOptions *) (relation)->rd_options)->fillfactor : \ + SPGIST_DEFAULT_FILLFACTOR) +#define SpGistGetTargetPageFreeSpace(relation) \ + (BLCKSZ * (100 - SpGistGetFillFactor(relation)) / 100) + + +/* SPGiST leaf tuples have one key column, optionally have included columns */ +#define spgKeyColumn 0 +#define spgFirstIncludeColumn 1 + +/* Page numbers of fixed-location pages */ +#define SPGIST_METAPAGE_BLKNO (0) /* metapage */ +#define SPGIST_ROOT_BLKNO (1) /* root for normal entries */ +#define SPGIST_NULL_BLKNO (2) /* root for null-value entries */ +#define SPGIST_LAST_FIXED_BLKNO SPGIST_NULL_BLKNO + +#define SpGistBlockIsRoot(blkno) \ + ((blkno) == SPGIST_ROOT_BLKNO || (blkno) == SPGIST_NULL_BLKNO) +#define SpGistBlockIsFixed(blkno) \ + ((BlockNumber) (blkno) <= (BlockNumber) SPGIST_LAST_FIXED_BLKNO) + +/* + * Contents of page special space on SPGiST index pages + */ +typedef struct SpGistPageOpaqueData +{ + uint16 flags; /* see bit definitions below */ + uint16 nRedirection; /* number of redirection tuples on page */ + uint16 nPlaceholder; /* number of placeholder tuples on page */ + /* note there's no count of either LIVE or DEAD tuples ... */ + uint16 spgist_page_id; /* for identification of SP-GiST indexes */ +} SpGistPageOpaqueData; + +typedef SpGistPageOpaqueData *SpGistPageOpaque; + +/* Flag bits in page special space */ +#define SPGIST_META (1<<0) +#define SPGIST_DELETED (1<<1) /* never set, but keep for backwards + * compatibility */ +#define SPGIST_LEAF (1<<2) +#define SPGIST_NULLS (1<<3) + +#define SpGistPageGetOpaque(page) ((SpGistPageOpaque) PageGetSpecialPointer(page)) +#define SpGistPageIsMeta(page) (SpGistPageGetOpaque(page)->flags & SPGIST_META) +#define SpGistPageIsDeleted(page) (SpGistPageGetOpaque(page)->flags & SPGIST_DELETED) +#define SpGistPageIsLeaf(page) (SpGistPageGetOpaque(page)->flags & SPGIST_LEAF) +#define SpGistPageStoresNulls(page) (SpGistPageGetOpaque(page)->flags & SPGIST_NULLS) + +/* + * The page ID is for the convenience of pg_filedump and similar utilities, + * which otherwise would have a hard time telling pages of different index + * types apart. It should be the last 2 bytes on the page. This is more or + * less "free" due to alignment considerations. + * + * See comments above GinPageOpaqueData. + */ +#define SPGIST_PAGE_ID 0xFF82 + +/* + * Each backend keeps a cache of last-used page info in its index->rd_amcache + * area. This is initialized from, and occasionally written back to, + * shared storage in the index metapage. + */ +typedef struct SpGistLastUsedPage +{ + BlockNumber blkno; /* block number, or InvalidBlockNumber */ + int freeSpace; /* page's free space (could be obsolete!) */ +} SpGistLastUsedPage; + +/* Note: indexes in cachedPage[] match flag assignments for SpGistGetBuffer */ +#define SPGIST_CACHED_PAGES 8 + +typedef struct SpGistLUPCache +{ + SpGistLastUsedPage cachedPage[SPGIST_CACHED_PAGES]; +} SpGistLUPCache; + +/* + * metapage + */ +typedef struct SpGistMetaPageData +{ + uint32 magicNumber; /* for identity cross-check */ + SpGistLUPCache lastUsedPages; /* shared storage of last-used info */ +} SpGistMetaPageData; + +#define SPGIST_MAGIC_NUMBER (0xBA0BABEE) + +#define SpGistPageGetMeta(p) \ + ((SpGistMetaPageData *) PageGetContents(p)) + +/* + * Private state of index AM. SpGistState is common to both insert and + * search code; SpGistScanOpaque is for searches only. + */ + +typedef struct SpGistLeafTupleData *SpGistLeafTuple; /* forward reference */ + +/* Per-datatype info needed in SpGistState */ +typedef struct SpGistTypeDesc +{ + Oid type; + int16 attlen; + bool attbyval; + char attalign; + char attstorage; +} SpGistTypeDesc; + +typedef struct SpGistState +{ + Relation index; /* index we're working with */ + + spgConfigOut config; /* filled in by opclass config method */ + + SpGistTypeDesc attType; /* type of values to be indexed/restored */ + SpGistTypeDesc attLeafType; /* type of leaf-tuple values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attLabelType; /* type of node label values */ + + /* leafTupDesc typically points to index's tupdesc, but not always */ + TupleDesc leafTupDesc; /* descriptor for leaf-level tuples */ + + char *deadTupleStorage; /* workspace for spgFormDeadTuple */ + + TransactionId redirectXid; /* XID to use when creating a redirect tuple */ + bool isBuild; /* true if doing index build */ +} SpGistState; + +/* Item to be re-examined later during a search */ +typedef struct SpGistSearchItem +{ + pairingheap_node phNode; /* pairing heap node */ + Datum value; /* value reconstructed from parent, or + * leafValue if isLeaf */ + SpGistLeafTuple leafTuple; /* whole leaf tuple, if needed */ + void *traversalValue; /* opclass-specific traverse value */ + int level; /* level of items on this page */ + ItemPointerData heapPtr; /* heap info, if heap tuple */ + bool isNull; /* SearchItem is NULL item */ + bool isLeaf; /* SearchItem is heap item */ + bool recheck; /* qual recheck is needed */ + bool recheckDistances; /* distance recheck is needed */ + + /* array with numberOfOrderBys entries */ + double distances[FLEXIBLE_ARRAY_MEMBER]; +} SpGistSearchItem; + +#define SizeOfSpGistSearchItem(n_distances) \ + (offsetof(SpGistSearchItem, distances) + sizeof(double) * (n_distances)) + +/* + * Private state of an index scan + */ +typedef struct SpGistScanOpaqueData +{ + SpGistState state; /* see above */ + pairingheap *scanQueue; /* queue of to be visited items */ + MemoryContext tempCxt; /* short-lived memory context */ + MemoryContext traversalCxt; /* single scan lifetime memory context */ + + /* Control flags showing whether to search nulls and/or non-nulls */ + bool searchNulls; /* scan matches (all) null entries */ + bool searchNonNulls; /* scan matches (some) non-null entries */ + + /* Index quals to be passed to opclass (null-related quals removed) */ + int numberOfKeys; /* number of index qualifier conditions */ + ScanKey keyData; /* array of index qualifier descriptors */ + int numberOfOrderBys; /* number of ordering operators */ + int numberOfNonNullOrderBys; /* number of ordering operators + * with non-NULL arguments */ + ScanKey orderByData; /* array of ordering op descriptors */ + Oid *orderByTypes; /* array of ordering op return types */ + int *nonNullOrderByOffsets; /* array of offset of non-NULL + * ordering keys in the original array */ + Oid indexCollation; /* collation of index column */ + + /* Opclass defined functions: */ + FmgrInfo innerConsistentFn; + FmgrInfo leafConsistentFn; + + /* Pre-allocated workspace arrays: */ + double *zeroDistances; + double *infDistances; + + /* These fields are only used in amgetbitmap scans: */ + TIDBitmap *tbm; /* bitmap being filled */ + int64 ntids; /* number of TIDs passed to bitmap */ + + /* These fields are only used in amgettuple scans: */ + bool want_itup; /* are we reconstructing tuples? */ + TupleDesc reconTupDesc; /* if so, descriptor for reconstructed tuples */ + int nPtrs; /* number of TIDs found on current page */ + int iPtr; /* index for scanning through same */ + ItemPointerData heapPtrs[MaxIndexTuplesPerPage]; /* TIDs from cur page */ + bool recheck[MaxIndexTuplesPerPage]; /* their recheck flags */ + bool recheckDistances[MaxIndexTuplesPerPage]; /* distance recheck + * flags */ + HeapTuple reconTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */ + + /* distances (for recheck) */ + IndexOrderByDistance *distances[MaxIndexTuplesPerPage]; + + /* + * Note: using MaxIndexTuplesPerPage above is a bit hokey since + * SpGistLeafTuples aren't exactly IndexTuples; however, they are larger, + * so this is safe. + */ +} SpGistScanOpaqueData; + +typedef SpGistScanOpaqueData *SpGistScanOpaque; + +/* + * This struct is what we actually keep in index->rd_amcache. It includes + * static configuration information as well as the lastUsedPages cache. + */ +typedef struct SpGistCache +{ + spgConfigOut config; /* filled in by opclass config method */ + + SpGistTypeDesc attType; /* type of values to be indexed/restored */ + SpGistTypeDesc attLeafType; /* type of leaf-tuple values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attLabelType; /* type of node label values */ + + SpGistLUPCache lastUsedPages; /* local storage of last-used info */ +} SpGistCache; + + +/* + * SPGiST tuple types. Note: inner, leaf, and dead tuple structs + * must have the same tupstate field in the same position! Real inner and + * leaf tuples always have tupstate = LIVE; if the state is something else, + * use the SpGistDeadTuple struct to inspect the tuple. + */ + +/* values of tupstate (see README for more info) */ +#define SPGIST_LIVE 0 /* normal live tuple (either inner or leaf) */ +#define SPGIST_REDIRECT 1 /* temporary redirection placeholder */ +#define SPGIST_DEAD 2 /* dead, cannot be removed because of links */ +#define SPGIST_PLACEHOLDER 3 /* placeholder, used to preserve offsets */ + +/* + * SPGiST inner tuple: list of "nodes" that subdivide a set of tuples + * + * Inner tuple layout: + * header/optional prefix/array of nodes, which are SpGistNodeTuples + * + * size and prefixSize must be multiples of MAXALIGN + * + * If the prefix datum is of a pass-by-value type, it is stored in its + * Datum representation, that is its on-disk representation is of length + * sizeof(Datum). This is a fairly unfortunate choice, because in no other + * place does Postgres use Datum as an on-disk representation; it creates + * an unnecessary incompatibility between 32-bit and 64-bit builds. But the + * compatibility loss is mostly theoretical since MAXIMUM_ALIGNOF typically + * differs between such builds, too. Anyway we're stuck with it now. + */ +typedef struct SpGistInnerTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + allTheSame:1, /* all nodes in tuple are equivalent */ + nNodes:13, /* number of nodes within inner tuple */ + prefixSize:16; /* size of prefix, or 0 if none */ + uint16 size; /* total size of inner tuple */ + /* On most machines there will be a couple of wasted bytes here */ + /* prefix datum follows, then nodes */ +} SpGistInnerTupleData; + +typedef SpGistInnerTupleData *SpGistInnerTuple; + +/* these must match largest values that fit in bit fields declared above */ +#define SGITMAXNNODES 0x1FFF +#define SGITMAXPREFIXSIZE 0xFFFF +#define SGITMAXSIZE 0xFFFF + +#define SGITHDRSZ MAXALIGN(sizeof(SpGistInnerTupleData)) +#define _SGITDATA(x) (((char *) (x)) + SGITHDRSZ) +#define SGITDATAPTR(x) ((x)->prefixSize ? _SGITDATA(x) : NULL) +#define SGITDATUM(x, s) ((x)->prefixSize ? \ + ((s)->attPrefixType.attbyval ? \ + *(Datum *) _SGITDATA(x) : \ + PointerGetDatum(_SGITDATA(x))) \ + : (Datum) 0) +#define SGITNODEPTR(x) ((SpGistNodeTuple) (_SGITDATA(x) + (x)->prefixSize)) + +/* Macro for iterating through the nodes of an inner tuple */ +#define SGITITERATE(x, i, nt) \ + for ((i) = 0, (nt) = SGITNODEPTR(x); \ + (i) < (x)->nNodes; \ + (i)++, (nt) = (SpGistNodeTuple) (((char *) (nt)) + IndexTupleSize(nt))) + +/* + * SPGiST node tuple: one node within an inner tuple + * + * Node tuples use the same header as ordinary Postgres IndexTuples, but + * we do not use a null bitmap, because we know there is only one column + * so the INDEX_NULL_MASK bit suffices. Also, pass-by-value datums are + * stored in Datum form, the same convention as for inner tuple prefixes. + */ + +typedef IndexTupleData SpGistNodeTupleData; + +typedef SpGistNodeTupleData *SpGistNodeTuple; + +#define SGNTHDRSZ MAXALIGN(sizeof(SpGistNodeTupleData)) +#define SGNTDATAPTR(x) (((char *) (x)) + SGNTHDRSZ) +#define SGNTDATUM(x, s) ((s)->attLabelType.attbyval ? \ + *(Datum *) SGNTDATAPTR(x) : \ + PointerGetDatum(SGNTDATAPTR(x))) + +/* + * SPGiST leaf tuple: carries a leaf datum and a heap tuple TID, + * and optionally some "included" columns. + * + * In the simplest case, the leaf datum is the same as the indexed value; + * but it could also be a suffix or some other sort of delta that permits + * reconstruction given knowledge of the prefix path traversed to get here. + * Any included columns are stored without modification. + * + * A nulls bitmap is present if there are included columns AND any of the + * datums are NULL. We do not need a nulls bitmap for the case of a null + * leaf datum without included columns, as we can infer whether the leaf + * datum is null from whether the tuple is stored on a nulls page. (This + * provision is mostly for backwards compatibility, but it does save space + * on 32-bit machines.) As with other PG index tuple designs, if the nulls + * bitmap exists then it's of size INDEX_MAX_KEYS bits regardless of the + * actual number of attributes. For the usual choice of INDEX_MAX_KEYS, + * this costs nothing because of alignment considerations. + * + * The size field is wider than could possibly be needed for an on-disk leaf + * tuple, but this allows us to form leaf tuples even when the datum is too + * wide to be stored immediately, and it costs nothing because of alignment + * considerations. + * + * t_info holds the nextOffset field (14 bits wide, enough for supported + * page sizes) plus the has-nulls-bitmap flag bit; another flag bit is free. + * + * Normally, nextOffset links to the next tuple belonging to the same parent + * node (which must be on the same page), or it's 0 if there is no next tuple. + * But when the root page is a leaf page, we don't chain its tuples, + * so nextOffset is always 0 on the root. + * + * size must be a multiple of MAXALIGN; also, it must be at least SGDTSIZE + * so that the tuple can be converted to REDIRECT status later. (This + * restriction only adds bytes for a NULL leaf datum stored on a 32-bit + * machine; otherwise alignment restrictions force it anyway.) + */ +typedef struct SpGistLeafTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + size:30; /* large enough for any palloc'able value */ + uint16 t_info; /* nextOffset, which links to the next tuple + * in chain, plus two flag bits */ + ItemPointerData heapPtr; /* TID of represented heap tuple */ + /* nulls bitmap follows if the flag bit for it is set */ + /* leaf datum, then any included datums, follows on a MAXALIGN boundary */ +} SpGistLeafTupleData; + +/* Macros to access nextOffset and bit fields inside t_info */ +#define SGLT_GET_NEXTOFFSET(spgLeafTuple) \ + ((spgLeafTuple)->t_info & 0x3FFF) +#define SGLT_GET_HASNULLMASK(spgLeafTuple) \ + (((spgLeafTuple)->t_info & 0x8000) ? true : false) +#define SGLT_SET_NEXTOFFSET(spgLeafTuple, offsetNumber) \ + ((spgLeafTuple)->t_info = \ + ((spgLeafTuple)->t_info & 0xC000) | ((offsetNumber) & 0x3FFF)) +#define SGLT_SET_HASNULLMASK(spgLeafTuple, hasnulls) \ + ((spgLeafTuple)->t_info = \ + ((spgLeafTuple)->t_info & 0x7FFF) | ((hasnulls) ? 0x8000 : 0)) + +#define SGLTHDRSZ(hasnulls) \ + ((hasnulls) ? MAXALIGN(sizeof(SpGistLeafTupleData) + \ + sizeof(IndexAttributeBitMapData)) : \ + MAXALIGN(sizeof(SpGistLeafTupleData))) +#define SGLTDATAPTR(x) (((char *) (x)) + SGLTHDRSZ(SGLT_GET_HASNULLMASK(x))) +#define SGLTDATUM(x, s) fetch_att(SGLTDATAPTR(x), \ + (s)->attLeafType.attbyval, \ + (s)->attLeafType.attlen) + +/* + * SPGiST dead tuple: declaration for examining non-live tuples + * + * The tupstate field of this struct must match those of regular inner and + * leaf tuples, and its size field must match a leaf tuple's. + * Also, the pointer field must be in the same place as a leaf tuple's heapPtr + * field, to satisfy some Asserts that we make when replacing a leaf tuple + * with a dead tuple. + * We don't use t_info, but it's needed to align the pointer field. + * pointer and xid are only valid when tupstate = REDIRECT, and in some + * cases xid can be InvalidTransactionId even then; see initSpGistState. + */ +typedef struct SpGistDeadTupleData +{ + unsigned int tupstate:2, /* LIVE/REDIRECT/DEAD/PLACEHOLDER */ + size:30; + uint16 t_info; /* not used in dead tuples */ + ItemPointerData pointer; /* redirection inside index */ + TransactionId xid; /* ID of xact that inserted this tuple */ +} SpGistDeadTupleData; + +typedef SpGistDeadTupleData *SpGistDeadTuple; + +#define SGDTSIZE MAXALIGN(sizeof(SpGistDeadTupleData)) + +/* + * Macros for doing free-space calculations. Note that when adding up the + * space needed for tuples, we always consider each tuple to need the tuple's + * size plus sizeof(ItemIdData) (for the line pointer). This works correctly + * so long as tuple sizes are always maxaligned. + */ + +/* Page capacity after allowing for fixed header and special space */ +#define SPGIST_PAGE_CAPACITY \ + MAXALIGN_DOWN(BLCKSZ - \ + SizeOfPageHeaderData - \ + MAXALIGN(sizeof(SpGistPageOpaqueData))) + +/* + * Compute free space on page, assuming that up to n placeholders can be + * recycled if present (n should be the number of tuples to be inserted) + */ +#define SpGistPageGetFreeSpace(p, n) \ + (PageGetExactFreeSpace(p) + \ + Min(SpGistPageGetOpaque(p)->nPlaceholder, n) * \ + (SGDTSIZE + sizeof(ItemIdData))) + +/* + * XLOG stuff + */ + +#define STORE_STATE(s, d) \ + do { \ + (d).redirectXid = (s)->redirectXid; \ + (d).isBuild = (s)->isBuild; \ + } while(0) + +/* + * The "flags" argument for SpGistGetBuffer should be either GBUF_LEAF to + * get a leaf page, or GBUF_INNER_PARITY(blockNumber) to get an inner + * page in the same triple-parity group as the specified block number. + * (Typically, this should be GBUF_INNER_PARITY(parentBlockNumber + 1) + * to follow the rule described in spgist/README.) + * In addition, GBUF_NULLS can be OR'd in to get a page for storage of + * null-valued tuples. + * + * Note: these flag values are used as indexes into lastUsedPages. + */ +#define GBUF_LEAF 0x03 +#define GBUF_INNER_PARITY(x) ((x) % 3) +#define GBUF_NULLS 0x04 + +#define GBUF_PARITY_MASK 0x03 +#define GBUF_REQ_LEAF(flags) (((flags) & GBUF_PARITY_MASK) == GBUF_LEAF) +#define GBUF_REQ_NULLS(flags) ((flags) & GBUF_NULLS) + +/* spgutils.c */ + +/* reloption parameters */ +#define SPGIST_MIN_FILLFACTOR 10 +#define SPGIST_DEFAULT_FILLFACTOR 80 + +extern SpGistCache *spgGetCache(Relation index); +extern TupleDesc getSpGistTupleDesc(Relation index, SpGistTypeDesc *keyType); +extern void initSpGistState(SpGistState *state, Relation index); +extern Buffer SpGistNewBuffer(Relation index); +extern void SpGistUpdateMetaPage(Relation index); +extern Buffer SpGistGetBuffer(Relation index, int flags, + int needSpace, bool *isNew); +extern void SpGistSetLastUsedPage(Relation index, Buffer buffer); +extern void SpGistInitPage(Page page, uint16 f); +extern void SpGistInitBuffer(Buffer b, uint16 f); +extern void SpGistInitMetapage(Page page); +extern unsigned int SpGistGetInnerTypeSize(SpGistTypeDesc *att, Datum datum); +extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor, + const Datum *datums, const bool *isnulls); +extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state, + ItemPointer heapPtr, + const Datum *datums, const bool *isnulls); +extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state, + Datum label, bool isnull); +extern SpGistInnerTuple spgFormInnerTuple(SpGistState *state, + bool hasPrefix, Datum prefix, + int nNodes, SpGistNodeTuple *nodes); +extern SpGistDeadTuple spgFormDeadTuple(SpGistState *state, int tupstate, + BlockNumber blkno, OffsetNumber offnum); +extern void spgDeformLeafTuple(SpGistLeafTuple tup, TupleDesc tupleDescriptor, + Datum *datums, bool *isnulls, + bool keyColumnIsNull); +extern Datum *spgExtractNodeLabels(SpGistState *state, + SpGistInnerTuple innerTuple); +extern OffsetNumber SpGistPageAddNewItem(SpGistState *state, Page page, + Item item, Size size, + OffsetNumber *startOffset, + bool errorOK); +extern bool spgproperty(Oid index_oid, int attno, + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); + +/* spgdoinsert.c */ +extern void spgUpdateNodeLink(SpGistInnerTuple tup, int nodeN, + BlockNumber blkno, OffsetNumber offset); +extern void spgPageIndexMultiDelete(SpGistState *state, Page page, + OffsetNumber *itemnos, int nitems, + int firststate, int reststate, + BlockNumber blkno, OffsetNumber offnum); +extern bool spgdoinsert(Relation index, SpGistState *state, + ItemPointer heapPtr, Datum *datums, bool *isnulls); + +/* spgproc.c */ +extern double *spg_key_orderbys_distances(Datum key, bool isLeaf, + ScanKey orderbys, int norderbys); +extern BOX *box_copy(BOX *orig); + +#endif /* SPGIST_PRIVATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/spgxlog.h b/platform/dbops/binaries/postgres/include/server/access/spgxlog.h new file mode 100644 index 0000000000000000000000000000000000000000..16cc73500129c173dd740edd0e21c2f81e1d6593 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/spgxlog.h @@ -0,0 +1,259 @@ +/*------------------------------------------------------------------------- + * + * spgxlog.h + * xlog declarations for SP-GiST access method. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/spgxlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPGXLOG_H +#define SPGXLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/off.h" + +/* XLOG record types for SPGiST */ + /* #define XLOG_SPGIST_CREATE_INDEX 0x00 */ /* not used anymore */ +#define XLOG_SPGIST_ADD_LEAF 0x10 +#define XLOG_SPGIST_MOVE_LEAFS 0x20 +#define XLOG_SPGIST_ADD_NODE 0x30 +#define XLOG_SPGIST_SPLIT_TUPLE 0x40 +#define XLOG_SPGIST_PICKSPLIT 0x50 +#define XLOG_SPGIST_VACUUM_LEAF 0x60 +#define XLOG_SPGIST_VACUUM_ROOT 0x70 +#define XLOG_SPGIST_VACUUM_REDIRECT 0x80 + +/* + * Some redo functions need an SpGistState, although only a few of its fields + * need to be valid. spgxlogState carries the required info in xlog records. + * (See fillFakeState in spgxlog.c for more comments.) + */ +typedef struct spgxlogState +{ + TransactionId redirectXid; + bool isBuild; +} spgxlogState; + +/* + * Backup Blk 0: destination page for leaf tuple + * Backup Blk 1: parent page (if any) + */ +typedef struct spgxlogAddLeaf +{ + bool newPage; /* init dest page? */ + bool storesNulls; /* page is in the nulls tree? */ + OffsetNumber offnumLeaf; /* offset where leaf tuple gets placed */ + OffsetNumber offnumHeadLeaf; /* offset of head tuple in chain, if any */ + + OffsetNumber offnumParent; /* where the parent downlink is, if any */ + uint16 nodeI; + + /* new leaf tuple follows (unaligned!) */ +} spgxlogAddLeaf; + +/* + * Backup Blk 0: source leaf page + * Backup Blk 1: destination leaf page + * Backup Blk 2: parent page + */ +typedef struct spgxlogMoveLeafs +{ + uint16 nMoves; /* number of tuples moved from source page */ + bool newPage; /* init dest page? */ + bool replaceDead; /* are we replacing a DEAD source tuple? */ + bool storesNulls; /* pages are in the nulls tree? */ + + /* where the parent downlink is */ + OffsetNumber offnumParent; + uint16 nodeI; + + spgxlogState stateSrc; + + /*---------- + * data follows: + * array of deleted tuple numbers, length nMoves + * array of inserted tuple numbers, length nMoves + 1 or 1 + * list of leaf tuples, length nMoves + 1 or 1 (unaligned!) + * + * Note: if replaceDead is true then there is only one inserted tuple + * number and only one leaf tuple in the data, because we are not copying + * the dead tuple from the source + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogMoveLeafs; + +#define SizeOfSpgxlogMoveLeafs offsetof(spgxlogMoveLeafs, offsets) + +/* + * Backup Blk 0: original page + * Backup Blk 1: where new tuple goes, if not same place + * Backup Blk 2: where parent downlink is, if updated and different from + * the old and new + */ +typedef struct spgxlogAddNode +{ + /* + * Offset of the original inner tuple, in the original page (on backup + * block 0). + */ + OffsetNumber offnum; + + /* + * Offset of the new tuple, on the new page (on backup block 1). Invalid, + * if we overwrote the old tuple in the original page). + */ + OffsetNumber offnumNew; + bool newPage; /* init new page? */ + + /*---- + * Where is the parent downlink? parentBlk indicates which page it's on, + * and offnumParent is the offset within the page. The possible values for + * parentBlk are: + * + * 0: parent == original page + * 1: parent == new page + * 2: parent == different page (blk ref 2) + * -1: parent not updated + *---- + */ + int8 parentBlk; + OffsetNumber offnumParent; /* offset within the parent page */ + + uint16 nodeI; + + spgxlogState stateSrc; + + /* + * updated inner tuple follows (unaligned!) + */ +} spgxlogAddNode; + +/* + * Backup Blk 0: where the prefix tuple goes + * Backup Blk 1: where the postfix tuple goes (if different page) + */ +typedef struct spgxlogSplitTuple +{ + /* where the prefix tuple goes */ + OffsetNumber offnumPrefix; + + /* where the postfix tuple goes */ + OffsetNumber offnumPostfix; + bool newPage; /* need to init that page? */ + bool postfixBlkSame; /* was postfix tuple put on same page as + * prefix? */ + + /* + * new prefix inner tuple follows, then new postfix inner tuple (both are + * unaligned!) + */ +} spgxlogSplitTuple; + +/* + * Buffer references in the rdata array are: + * Backup Blk 0: Src page (only if not root) + * Backup Blk 1: Dest page (if used) + * Backup Blk 2: Inner page + * Backup Blk 3: Parent page (if any, and different from Inner) + */ +typedef struct spgxlogPickSplit +{ + bool isRootSplit; + + uint16 nDelete; /* n to delete from Src */ + uint16 nInsert; /* n to insert on Src and/or Dest */ + bool initSrc; /* re-init the Src page? */ + bool initDest; /* re-init the Dest page? */ + + /* where to put new inner tuple */ + OffsetNumber offnumInner; + bool initInner; /* re-init the Inner page? */ + + bool storesNulls; /* pages are in the nulls tree? */ + + /* where the parent downlink is, if any */ + bool innerIsParent; /* is parent the same as inner page? */ + OffsetNumber offnumParent; + uint16 nodeI; + + spgxlogState stateSrc; + + /*---------- + * data follows: + * array of deleted tuple numbers, length nDelete + * array of inserted tuple numbers, length nInsert + * array of page selector bytes for inserted tuples, length nInsert + * new inner tuple (unaligned!) + * list of leaf tuples, length nInsert (unaligned!) + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogPickSplit; + +#define SizeOfSpgxlogPickSplit offsetof(spgxlogPickSplit, offsets) + +typedef struct spgxlogVacuumLeaf +{ + uint16 nDead; /* number of tuples to become DEAD */ + uint16 nPlaceholder; /* number of tuples to become PLACEHOLDER */ + uint16 nMove; /* number of tuples to move */ + uint16 nChain; /* number of tuples to re-chain */ + + spgxlogState stateSrc; + + /*---------- + * data follows: + * tuple numbers to become DEAD + * tuple numbers to become PLACEHOLDER + * tuple numbers to move from (and replace with PLACEHOLDER) + * tuple numbers to move to (replacing what is there) + * tuple numbers to update nextOffset links of + * tuple numbers to insert in nextOffset links + *---------- + */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumLeaf; + +#define SizeOfSpgxlogVacuumLeaf offsetof(spgxlogVacuumLeaf, offsets) + +typedef struct spgxlogVacuumRoot +{ + /* vacuum a root page when it is also a leaf */ + uint16 nDelete; /* number of tuples to delete */ + + spgxlogState stateSrc; + + /* offsets of tuples to delete follow */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumRoot; + +#define SizeOfSpgxlogVacuumRoot offsetof(spgxlogVacuumRoot, offsets) + +typedef struct spgxlogVacuumRedirect +{ + uint16 nToPlaceholder; /* number of redirects to make placeholders */ + OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ + TransactionId snapshotConflictHorizon; /* newest XID of removed redirects */ + bool isCatalogRel; /* to handle recovery conflict during logical + * decoding on standby */ + + /* offsets of redirect tuples to make placeholders follow */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} spgxlogVacuumRedirect; + +#define SizeOfSpgxlogVacuumRedirect offsetof(spgxlogVacuumRedirect, offsets) + +extern void spg_redo(XLogReaderState *record); +extern void spg_desc(StringInfo buf, XLogReaderState *record); +extern const char *spg_identify(uint8 info); +extern void spg_xlog_startup(void); +extern void spg_xlog_cleanup(void); +extern void spg_mask(char *pagedata, BlockNumber blkno); + +#endif /* SPGXLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/stratnum.h b/platform/dbops/binaries/postgres/include/server/access/stratnum.h new file mode 100644 index 0000000000000000000000000000000000000000..8a47d3c9ec8072069b50e95fdab87ee90f766b3e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/stratnum.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * stratnum.h + * POSTGRES strategy number definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/stratnum.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRATNUM_H +#define STRATNUM_H + +/* + * Strategy numbers identify the semantics that particular operators have + * with respect to particular operator classes. In some cases a strategy + * subtype (an OID) is used as further information. + */ +typedef uint16 StrategyNumber; + +#define InvalidStrategy ((StrategyNumber) 0) + +/* + * Strategy numbers for B-tree indexes. + */ +#define BTLessStrategyNumber 1 +#define BTLessEqualStrategyNumber 2 +#define BTEqualStrategyNumber 3 +#define BTGreaterEqualStrategyNumber 4 +#define BTGreaterStrategyNumber 5 + +#define BTMaxStrategyNumber 5 + +/* + * Strategy numbers for hash indexes. There's only one valid strategy for + * hashing: equality. + */ +#define HTEqualStrategyNumber 1 + +#define HTMaxStrategyNumber 1 + +/* + * Strategy numbers common to (some) GiST, SP-GiST and BRIN opclasses. + * + * The first few of these come from the R-Tree indexing method (hence the + * names); the others have been added over time as they have been needed. + */ +#define RTLeftStrategyNumber 1 /* for << */ +#define RTOverLeftStrategyNumber 2 /* for &< */ +#define RTOverlapStrategyNumber 3 /* for && */ +#define RTOverRightStrategyNumber 4 /* for &> */ +#define RTRightStrategyNumber 5 /* for >> */ +#define RTSameStrategyNumber 6 /* for ~= */ +#define RTContainsStrategyNumber 7 /* for @> */ +#define RTContainedByStrategyNumber 8 /* for <@ */ +#define RTOverBelowStrategyNumber 9 /* for &<| */ +#define RTBelowStrategyNumber 10 /* for <<| */ +#define RTAboveStrategyNumber 11 /* for |>> */ +#define RTOverAboveStrategyNumber 12 /* for |&> */ +#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */ +#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */ +#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */ +#define RTContainsElemStrategyNumber 16 /* for range types @> elem */ +#define RTAdjacentStrategyNumber 17 /* for -|- */ +#define RTEqualStrategyNumber 18 /* for = */ +#define RTNotEqualStrategyNumber 19 /* for != */ +#define RTLessStrategyNumber 20 /* for < */ +#define RTLessEqualStrategyNumber 21 /* for <= */ +#define RTGreaterStrategyNumber 22 /* for > */ +#define RTGreaterEqualStrategyNumber 23 /* for >= */ +#define RTSubStrategyNumber 24 /* for inet >> */ +#define RTSubEqualStrategyNumber 25 /* for inet <<= */ +#define RTSuperStrategyNumber 26 /* for inet << */ +#define RTSuperEqualStrategyNumber 27 /* for inet >>= */ +#define RTPrefixStrategyNumber 28 /* for text ^@ */ +#define RTOldBelowStrategyNumber 29 /* for old spelling of <<| */ +#define RTOldAboveStrategyNumber 30 /* for old spelling of |>> */ + +#define RTMaxStrategyNumber 30 + + +#endif /* STRATNUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/subtrans.h b/platform/dbops/binaries/postgres/include/server/access/subtrans.h new file mode 100644 index 0000000000000000000000000000000000000000..e2213cf3fd2efcb0c91f9fe05ee6027a05b5a07f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/subtrans.h @@ -0,0 +1,26 @@ +/* + * subtrans.h + * + * PostgreSQL subtransaction-log manager + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/subtrans.h + */ +#ifndef SUBTRANS_H +#define SUBTRANS_H + +extern void SubTransSetParent(TransactionId xid, TransactionId parent); +extern TransactionId SubTransGetParent(TransactionId xid); +extern TransactionId SubTransGetTopmostTransaction(TransactionId xid); + +extern Size SUBTRANSShmemSize(void); +extern void SUBTRANSShmemInit(void); +extern void BootStrapSUBTRANS(void); +extern void StartupSUBTRANS(TransactionId oldestActiveXID); +extern void CheckPointSUBTRANS(void); +extern void ExtendSUBTRANS(TransactionId newestXact); +extern void TruncateSUBTRANS(TransactionId oldestXact); + +#endif /* SUBTRANS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/syncscan.h b/platform/dbops/binaries/postgres/include/server/access/syncscan.h new file mode 100644 index 0000000000000000000000000000000000000000..00b6c0dfc635d3734525ba0fecdca36aac2fef20 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/syncscan.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * syncscan.h + * POSTGRES synchronous scan support functions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/syncscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYNCSCAN_H +#define SYNCSCAN_H + +#include "storage/block.h" +#include "utils/relcache.h" + +extern void ss_report_location(Relation rel, BlockNumber location); +extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks); +extern void SyncScanShmemInit(void); +extern Size SyncScanShmemSize(void); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/access/sysattr.h b/platform/dbops/binaries/postgres/include/server/access/sysattr.h new file mode 100644 index 0000000000000000000000000000000000000000..e88dec71ee94ffc496f2e710e946b30b72f31ed4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/sysattr.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * sysattr.h + * POSTGRES system attribute definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/sysattr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYSATTR_H +#define SYSATTR_H + + +/* + * Attribute numbers for the system-defined attributes + */ +#define SelfItemPointerAttributeNumber (-1) +#define MinTransactionIdAttributeNumber (-2) +#define MinCommandIdAttributeNumber (-3) +#define MaxTransactionIdAttributeNumber (-4) +#define MaxCommandIdAttributeNumber (-5) +#define TableOidAttributeNumber (-6) +#define FirstLowInvalidHeapAttributeNumber (-7) + +#endif /* SYSATTR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/table.h b/platform/dbops/binaries/postgres/include/server/access/table.h new file mode 100644 index 0000000000000000000000000000000000000000..1c0bee79fd8b290c00bfd494ef4c11f85cb08ac5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/table.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * table.h + * Generic routines for table related code. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/table.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLE_H +#define TABLE_H + +#include "nodes/primnodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +extern Relation table_open(Oid relationId, LOCKMODE lockmode); +extern Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode); +extern Relation table_openrv_extended(const RangeVar *relation, + LOCKMODE lockmode, bool missing_ok); +extern Relation try_table_open(Oid relationId, LOCKMODE lockmode); +extern void table_close(Relation relation, LOCKMODE lockmode); + +#endif /* TABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tableam.h b/platform/dbops/binaries/postgres/include/server/access/tableam.h new file mode 100644 index 0000000000000000000000000000000000000000..7be7887b4a846031876fcb969086576a9c5815d8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tableam.h @@ -0,0 +1,2110 @@ +/*------------------------------------------------------------------------- + * + * tableam.h + * POSTGRES table access method definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tableam.h + * + * NOTES + * See tableam.sgml for higher level documentation. + * + *------------------------------------------------------------------------- + */ +#ifndef TABLEAM_H +#define TABLEAM_H + +#include "access/relscan.h" +#include "access/sdir.h" +#include "access/xact.h" +#include "executor/tuptable.h" +#include "storage/read_stream.h" +#include "utils/rel.h" +#include "utils/snapshot.h" + + +#define DEFAULT_TABLE_ACCESS_METHOD "heap" + +/* GUCs */ +extern PGDLLIMPORT char *default_table_access_method; +extern PGDLLIMPORT bool synchronize_seqscans; + + +struct BulkInsertStateData; +struct IndexInfo; +struct SampleScanState; +struct TBMIterateResult; +struct VacuumParams; +struct ValidateIndexState; + +/* + * Bitmask values for the flags argument to the scan_begin callback. + */ +typedef enum ScanOptions +{ + /* one of SO_TYPE_* may be specified */ + SO_TYPE_SEQSCAN = 1 << 0, + SO_TYPE_BITMAPSCAN = 1 << 1, + SO_TYPE_SAMPLESCAN = 1 << 2, + SO_TYPE_TIDSCAN = 1 << 3, + SO_TYPE_TIDRANGESCAN = 1 << 4, + SO_TYPE_ANALYZE = 1 << 5, + + /* several of SO_ALLOW_* may be specified */ + /* allow or disallow use of access strategy */ + SO_ALLOW_STRAT = 1 << 6, + /* report location to syncscan logic? */ + SO_ALLOW_SYNC = 1 << 7, + /* verify visibility page-at-a-time? */ + SO_ALLOW_PAGEMODE = 1 << 8, + + /* unregister snapshot at scan end? */ + SO_TEMP_SNAPSHOT = 1 << 9, + + /* + * At the discretion of the table AM, bitmap table scans may be able to + * skip fetching a block from the table if none of the table data is + * needed. If table data may be needed, set SO_NEED_TUPLES. + */ + SO_NEED_TUPLES = 1 << 10, +} ScanOptions; + +/* + * Result codes for table_{update,delete,lock_tuple}, and for visibility + * routines inside table AMs. + */ +typedef enum TM_Result +{ + /* + * Signals that the action succeeded (i.e. update/delete performed, lock + * was acquired) + */ + TM_Ok, + + /* The affected tuple wasn't visible to the relevant snapshot */ + TM_Invisible, + + /* The affected tuple was already modified by the calling backend */ + TM_SelfModified, + + /* + * The affected tuple was updated by another transaction. This includes + * the case where tuple was moved to another partition. + */ + TM_Updated, + + /* The affected tuple was deleted by another transaction */ + TM_Deleted, + + /* + * The affected tuple is currently being modified by another session. This + * will only be returned if table_(update/delete/lock_tuple) are + * instructed not to wait. + */ + TM_BeingModified, + + /* lock couldn't be acquired, action skipped. Only used by lock_tuple */ + TM_WouldBlock, +} TM_Result; + +/* + * Result codes for table_update(..., update_indexes*..). + * Used to determine which indexes to update. + */ +typedef enum TU_UpdateIndexes +{ + /* No indexed columns were updated (incl. TID addressing of tuple) */ + TU_None, + + /* A non-summarizing indexed column was updated, or the TID has changed */ + TU_All, + + /* Only summarized columns were updated, TID is unchanged */ + TU_Summarizing, +} TU_UpdateIndexes; + +/* + * When table_tuple_update, table_tuple_delete, or table_tuple_lock fail + * because the target tuple is already outdated, they fill in this struct to + * provide information to the caller about what happened. + * + * ctid is the target's ctid link: it is the same as the target's TID if the + * target was deleted, or the location of the replacement tuple if the target + * was updated. + * + * xmax is the outdating transaction's XID. If the caller wants to visit the + * replacement tuple, it must check that this matches before believing the + * replacement is really a match. This is InvalidTransactionId if the target + * was !LP_NORMAL (expected only for a TID retrieved from syscache). + * + * cmax is the outdating command's CID, but only when the failure code is + * TM_SelfModified (i.e., something in the current transaction outdated the + * tuple); otherwise cmax is zero. (We make this restriction because + * HeapTupleHeaderGetCmax doesn't work for tuples outdated in other + * transactions.) + */ +typedef struct TM_FailureData +{ + ItemPointerData ctid; + TransactionId xmax; + CommandId cmax; + bool traversed; +} TM_FailureData; + +/* + * State used when calling table_index_delete_tuples(). + * + * Represents the status of table tuples, referenced by table TID and taken by + * index AM from index tuples. State consists of high level parameters of the + * deletion operation, plus two mutable palloc()'d arrays for information + * about the status of individual table tuples. These are conceptually one + * single array. Using two arrays keeps the TM_IndexDelete struct small, + * which makes sorting the first array (the deltids array) fast. + * + * Some index AM callers perform simple index tuple deletion (by specifying + * bottomup = false), and include only known-dead deltids. These known-dead + * entries are all marked knowndeletable = true directly (typically these are + * TIDs from LP_DEAD-marked index tuples), but that isn't strictly required. + * + * Callers that specify bottomup = true are "bottom-up index deletion" + * callers. The considerations for the tableam are more subtle with these + * callers because they ask the tableam to perform highly speculative work, + * and might only expect the tableam to check a small fraction of all entries. + * Caller is not allowed to specify knowndeletable = true for any entry + * because everything is highly speculative. Bottom-up caller provides + * context and hints to tableam -- see comments below for details on how index + * AMs and tableams should coordinate during bottom-up index deletion. + * + * Simple index deletion callers may ask the tableam to perform speculative + * work, too. This is a little like bottom-up deletion, but not too much. + * The tableam will only perform speculative work when it's practically free + * to do so in passing for simple deletion caller (while always performing + * whatever work is needed to enable knowndeletable/LP_DEAD index tuples to + * be deleted within index AM). This is the real reason why it's possible for + * simple index deletion caller to specify knowndeletable = false up front + * (this means "check if it's possible for me to delete corresponding index + * tuple when it's cheap to do so in passing"). The index AM should only + * include "extra" entries for index tuples whose TIDs point to a table block + * that tableam is expected to have to visit anyway (in the event of a block + * orientated tableam). The tableam isn't strictly obligated to check these + * "extra" TIDs, but a block-based AM should always manage to do so in + * practice. + * + * The final contents of the deltids/status arrays are interesting to callers + * that ask tableam to perform speculative work (i.e. when _any_ items have + * knowndeletable set to false up front). These index AM callers will + * naturally need to consult final state to determine which index tuples are + * in fact deletable. + * + * The index AM can keep track of which index tuple relates to which deltid by + * setting idxoffnum (and/or relying on each entry being uniquely identifiable + * using tid), which is important when the final contents of the array will + * need to be interpreted -- the array can shrink from initial size after + * tableam processing and/or have entries in a new order (tableam may sort + * deltids array for its own reasons). Bottom-up callers may find that final + * ndeltids is 0 on return from call to tableam, in which case no index tuple + * deletions are possible. Simple deletion callers can rely on any entries + * they know to be deletable appearing in the final array as deletable. + */ +typedef struct TM_IndexDelete +{ + ItemPointerData tid; /* table TID from index tuple */ + int16 id; /* Offset into TM_IndexStatus array */ +} TM_IndexDelete; + +typedef struct TM_IndexStatus +{ + OffsetNumber idxoffnum; /* Index am page offset number */ + bool knowndeletable; /* Currently known to be deletable? */ + + /* Bottom-up index deletion specific fields follow */ + bool promising; /* Promising (duplicate) index tuple? */ + int16 freespace; /* Space freed in index if deleted */ +} TM_IndexStatus; + +/* + * Index AM/tableam coordination is central to the design of bottom-up index + * deletion. The index AM provides hints about where to look to the tableam + * by marking some entries as "promising". Index AM does this with duplicate + * index tuples that are strongly suspected to be old versions left behind by + * UPDATEs that did not logically modify indexed values. Index AM may find it + * helpful to only mark entries as promising when they're thought to have been + * affected by such an UPDATE in the recent past. + * + * Bottom-up index deletion casts a wide net at first, usually by including + * all TIDs on a target index page. It is up to the tableam to worry about + * the cost of checking transaction status information. The tableam is in + * control, but needs careful guidance from the index AM. Index AM requests + * that bottomupfreespace target be met, while tableam measures progress + * towards that goal by tallying the per-entry freespace value for known + * deletable entries. (All !bottomup callers can just set these space related + * fields to zero.) + */ +typedef struct TM_IndexDeleteOp +{ + Relation irel; /* Target index relation */ + BlockNumber iblknum; /* Index block number (for error reports) */ + bool bottomup; /* Bottom-up (not simple) deletion? */ + int bottomupfreespace; /* Bottom-up space target */ + + /* Mutable per-TID information follows (index AM initializes entries) */ + int ndeltids; /* Current # of deltids/status elements */ + TM_IndexDelete *deltids; + TM_IndexStatus *status; +} TM_IndexDeleteOp; + +/* "options" flag bits for table_tuple_insert */ +/* TABLE_INSERT_SKIP_WAL was 0x0001; RelationNeedsWAL() now governs */ +#define TABLE_INSERT_SKIP_FSM 0x0002 +#define TABLE_INSERT_FROZEN 0x0004 +#define TABLE_INSERT_NO_LOGICAL 0x0008 + +/* flag bits for table_tuple_lock */ +/* Follow tuples whose update is in progress if lock modes don't conflict */ +#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS (1 << 0) +/* Follow update chain and lock latest version of tuple */ +#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION (1 << 1) + + +/* Typedef for callback function for table_index_build_scan */ +typedef void (*IndexBuildCallback) (Relation index, + ItemPointer tid, + Datum *values, + bool *isnull, + bool tupleIsAlive, + void *state); + +/* + * API struct for a table AM. Note this must be allocated in a + * server-lifetime manner, typically as a static const struct, which then gets + * returned by FormData_pg_am.amhandler. + * + * In most cases it's not appropriate to call the callbacks directly, use the + * table_* wrapper functions instead. + * + * GetTableAmRoutine() asserts that required callbacks are filled in, remember + * to update when adding a callback. + */ +typedef struct TableAmRoutine +{ + /* this must be set to T_TableAmRoutine */ + NodeTag type; + + + /* ------------------------------------------------------------------------ + * Slot related callbacks. + * ------------------------------------------------------------------------ + */ + + /* + * Return slot implementation suitable for storing a tuple of this AM. + */ + const TupleTableSlotOps *(*slot_callbacks) (Relation rel); + + + /* ------------------------------------------------------------------------ + * Table scan callbacks. + * ------------------------------------------------------------------------ + */ + + /* + * Start a scan of `rel`. The callback has to return a TableScanDesc, + * which will typically be embedded in a larger, AM specific, struct. + * + * If nkeys != 0, the results need to be filtered by those scan keys. + * + * pscan, if not NULL, will have already been initialized with + * parallelscan_initialize(), and has to be for the same relation. Will + * only be set coming from table_beginscan_parallel(). + * + * `flags` is a bitmask indicating the type of scan (ScanOptions's + * SO_TYPE_*, currently only one may be specified), options controlling + * the scan's behaviour (ScanOptions's SO_ALLOW_*, several may be + * specified, an AM may ignore unsupported ones) and whether the snapshot + * needs to be deallocated at scan_end (ScanOptions's SO_TEMP_SNAPSHOT). + */ + TableScanDesc (*scan_begin) (Relation rel, + Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + ParallelTableScanDesc pscan, + uint32 flags); + + /* + * Release resources and deallocate scan. If TableScanDesc.temp_snap, + * TableScanDesc.rs_snapshot needs to be unregistered. + */ + void (*scan_end) (TableScanDesc scan); + + /* + * Restart relation scan. If set_params is set to true, allow_{strat, + * sync, pagemode} (see scan_begin) changes should be taken into account. + */ + void (*scan_rescan) (TableScanDesc scan, struct ScanKeyData *key, + bool set_params, bool allow_strat, + bool allow_sync, bool allow_pagemode); + + /* + * Return next tuple from `scan`, store in slot. + */ + bool (*scan_getnextslot) (TableScanDesc scan, + ScanDirection direction, + TupleTableSlot *slot); + + /*----------- + * Optional functions to provide scanning for ranges of ItemPointers. + * Implementations must either provide both of these functions, or neither + * of them. + * + * Implementations of scan_set_tidrange must themselves handle + * ItemPointers of any value. i.e, they must handle each of the following: + * + * 1) mintid or maxtid is beyond the end of the table; and + * 2) mintid is above maxtid; and + * 3) item offset for mintid or maxtid is beyond the maximum offset + * allowed by the AM. + * + * Implementations can assume that scan_set_tidrange is always called + * before scan_getnextslot_tidrange or after scan_rescan and before any + * further calls to scan_getnextslot_tidrange. + */ + void (*scan_set_tidrange) (TableScanDesc scan, + ItemPointer mintid, + ItemPointer maxtid); + + /* + * Return next tuple from `scan` that's in the range of TIDs defined by + * scan_set_tidrange. + */ + bool (*scan_getnextslot_tidrange) (TableScanDesc scan, + ScanDirection direction, + TupleTableSlot *slot); + + /* ------------------------------------------------------------------------ + * Parallel table scan related functions. + * ------------------------------------------------------------------------ + */ + + /* + * Estimate the size of shared memory needed for a parallel scan of this + * relation. The snapshot does not need to be accounted for. + */ + Size (*parallelscan_estimate) (Relation rel); + + /* + * Initialize ParallelTableScanDesc for a parallel scan of this relation. + * `pscan` will be sized according to parallelscan_estimate() for the same + * relation. + */ + Size (*parallelscan_initialize) (Relation rel, + ParallelTableScanDesc pscan); + + /* + * Reinitialize `pscan` for a new scan. `rel` will be the same relation as + * when `pscan` was initialized by parallelscan_initialize. + */ + void (*parallelscan_reinitialize) (Relation rel, + ParallelTableScanDesc pscan); + + + /* ------------------------------------------------------------------------ + * Index Scan Callbacks + * ------------------------------------------------------------------------ + */ + + /* + * Prepare to fetch tuples from the relation, as needed when fetching + * tuples for an index scan. The callback has to return an + * IndexFetchTableData, which the AM will typically embed in a larger + * structure with additional information. + * + * Tuples for an index scan can then be fetched via index_fetch_tuple. + */ + struct IndexFetchTableData *(*index_fetch_begin) (Relation rel); + + /* + * Reset index fetch. Typically this will release cross index fetch + * resources held in IndexFetchTableData. + */ + void (*index_fetch_reset) (struct IndexFetchTableData *data); + + /* + * Release resources and deallocate index fetch. + */ + void (*index_fetch_end) (struct IndexFetchTableData *data); + + /* + * Fetch tuple at `tid` into `slot`, after doing a visibility test + * according to `snapshot`. If a tuple was found and passed the visibility + * test, return true, false otherwise. + * + * Note that AMs that do not necessarily update indexes when indexed + * columns do not change, need to return the current/correct version of + * the tuple that is visible to the snapshot, even if the tid points to an + * older version of the tuple. + * + * *call_again is false on the first call to index_fetch_tuple for a tid. + * If there potentially is another tuple matching the tid, *call_again + * needs to be set to true by index_fetch_tuple, signaling to the caller + * that index_fetch_tuple should be called again for the same tid. + * + * *all_dead, if all_dead is not NULL, should be set to true by + * index_fetch_tuple iff it is guaranteed that no backend needs to see + * that tuple. Index AMs can use that to avoid returning that tid in + * future searches. + */ + bool (*index_fetch_tuple) (struct IndexFetchTableData *scan, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + bool *call_again, bool *all_dead); + + + /* ------------------------------------------------------------------------ + * Callbacks for non-modifying operations on individual tuples + * ------------------------------------------------------------------------ + */ + + /* + * Fetch tuple at `tid` into `slot`, after doing a visibility test + * according to `snapshot`. If a tuple was found and passed the visibility + * test, returns true, false otherwise. + */ + bool (*tuple_fetch_row_version) (Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot); + + /* + * Is tid valid for a scan of this relation. + */ + bool (*tuple_tid_valid) (TableScanDesc scan, + ItemPointer tid); + + /* + * Return the latest version of the tuple at `tid`, by updating `tid` to + * point at the newest version. + */ + void (*tuple_get_latest_tid) (TableScanDesc scan, + ItemPointer tid); + + /* + * Does the tuple in `slot` satisfy `snapshot`? The slot needs to be of + * the appropriate type for the AM. + */ + bool (*tuple_satisfies_snapshot) (Relation rel, + TupleTableSlot *slot, + Snapshot snapshot); + + /* see table_index_delete_tuples() */ + TransactionId (*index_delete_tuples) (Relation rel, + TM_IndexDeleteOp *delstate); + + + /* ------------------------------------------------------------------------ + * Manipulations of physical tuples. + * ------------------------------------------------------------------------ + */ + + /* see table_tuple_insert() for reference about parameters */ + void (*tuple_insert) (Relation rel, TupleTableSlot *slot, + CommandId cid, int options, + struct BulkInsertStateData *bistate); + + /* see table_tuple_insert_speculative() for reference about parameters */ + void (*tuple_insert_speculative) (Relation rel, + TupleTableSlot *slot, + CommandId cid, + int options, + struct BulkInsertStateData *bistate, + uint32 specToken); + + /* see table_tuple_complete_speculative() for reference about parameters */ + void (*tuple_complete_speculative) (Relation rel, + TupleTableSlot *slot, + uint32 specToken, + bool succeeded); + + /* see table_multi_insert() for reference about parameters */ + void (*multi_insert) (Relation rel, TupleTableSlot **slots, int nslots, + CommandId cid, int options, struct BulkInsertStateData *bistate); + + /* see table_tuple_delete() for reference about parameters */ + TM_Result (*tuple_delete) (Relation rel, + ItemPointer tid, + CommandId cid, + Snapshot snapshot, + Snapshot crosscheck, + bool wait, + TM_FailureData *tmfd, + bool changingPart); + + /* see table_tuple_update() for reference about parameters */ + TM_Result (*tuple_update) (Relation rel, + ItemPointer otid, + TupleTableSlot *slot, + CommandId cid, + Snapshot snapshot, + Snapshot crosscheck, + bool wait, + TM_FailureData *tmfd, + LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes); + + /* see table_tuple_lock() for reference about parameters */ + TM_Result (*tuple_lock) (Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + CommandId cid, + LockTupleMode mode, + LockWaitPolicy wait_policy, + uint8 flags, + TM_FailureData *tmfd); + + /* + * Perform operations necessary to complete insertions made via + * tuple_insert and multi_insert with a BulkInsertState specified. In-tree + * access methods ceased to use this. + * + * Typically callers of tuple_insert and multi_insert will just pass all + * the flags that apply to them, and each AM has to decide which of them + * make sense for it, and then only take actions in finish_bulk_insert for + * those flags, and ignore others. + * + * Optional callback. + */ + void (*finish_bulk_insert) (Relation rel, int options); + + + /* ------------------------------------------------------------------------ + * DDL related functionality. + * ------------------------------------------------------------------------ + */ + + /* + * This callback needs to create new relation storage for `rel`, with + * appropriate durability behaviour for `persistence`. + * + * Note that only the subset of the relcache filled by + * RelationBuildLocalRelation() can be relied upon and that the relation's + * catalog entries will either not yet exist (new relation), or will still + * reference the old relfilelocator. + * + * As output *freezeXid, *minmulti must be set to the values appropriate + * for pg_class.{relfrozenxid, relminmxid}. For AMs that don't need those + * fields to be filled they can be set to InvalidTransactionId and + * InvalidMultiXactId, respectively. + * + * See also table_relation_set_new_filelocator(). + */ + void (*relation_set_new_filelocator) (Relation rel, + const RelFileLocator *newrlocator, + char persistence, + TransactionId *freezeXid, + MultiXactId *minmulti); + + /* + * This callback needs to remove all contents from `rel`'s current + * relfilelocator. No provisions for transactional behaviour need to be + * made. Often this can be implemented by truncating the underlying + * storage to its minimal size. + * + * See also table_relation_nontransactional_truncate(). + */ + void (*relation_nontransactional_truncate) (Relation rel); + + /* + * See table_relation_copy_data(). + * + * This can typically be implemented by directly copying the underlying + * storage, unless it contains references to the tablespace internally. + */ + void (*relation_copy_data) (Relation rel, + const RelFileLocator *newrlocator); + + /* See table_relation_copy_for_cluster() */ + void (*relation_copy_for_cluster) (Relation OldTable, + Relation NewTable, + Relation OldIndex, + bool use_sort, + TransactionId OldestXmin, + TransactionId *xid_cutoff, + MultiXactId *multi_cutoff, + double *num_tuples, + double *tups_vacuumed, + double *tups_recently_dead); + + /* + * React to VACUUM command on the relation. The VACUUM can be triggered by + * a user or by autovacuum. The specific actions performed by the AM will + * depend heavily on the individual AM. + * + * On entry a transaction is already established, and the relation is + * locked with a ShareUpdateExclusive lock. + * + * Note that neither VACUUM FULL (and CLUSTER), nor ANALYZE go through + * this routine, even if (for ANALYZE) it is part of the same VACUUM + * command. + * + * There probably, in the future, needs to be a separate callback to + * integrate with autovacuum's scheduling. + */ + void (*relation_vacuum) (Relation rel, + struct VacuumParams *params, + BufferAccessStrategy bstrategy); + + /* + * Prepare to analyze block `blockno` of `scan`. The scan has been started + * with table_beginscan_analyze(). See also + * table_scan_analyze_next_block(). + * + * The callback may acquire resources like locks that are held until + * table_scan_analyze_next_tuple() returns false. It e.g. can make sense + * to hold a lock until all tuples on a block have been analyzed by + * scan_analyze_next_tuple. + * + * The callback can return false if the block is not suitable for + * sampling, e.g. because it's a metapage that could never contain tuples. + * + * XXX: This obviously is primarily suited for block-based AMs. It's not + * clear what a good interface for non block based AMs would be, so there + * isn't one yet. + */ + bool (*scan_analyze_next_block) (TableScanDesc scan, + ReadStream *stream); + + /* + * See table_scan_analyze_next_tuple(). + * + * Not every AM might have a meaningful concept of dead rows, in which + * case it's OK to not increment *deadrows - but note that that may + * influence autovacuum scheduling (see comment for relation_vacuum + * callback). + */ + bool (*scan_analyze_next_tuple) (TableScanDesc scan, + TransactionId OldestXmin, + double *liverows, + double *deadrows, + TupleTableSlot *slot); + + /* see table_index_build_range_scan for reference about parameters */ + double (*index_build_range_scan) (Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool anyvisible, + bool progress, + BlockNumber start_blockno, + BlockNumber numblocks, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan); + + /* see table_index_validate_scan for reference about parameters */ + void (*index_validate_scan) (Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + Snapshot snapshot, + struct ValidateIndexState *state); + + + /* ------------------------------------------------------------------------ + * Miscellaneous functions. + * ------------------------------------------------------------------------ + */ + + /* + * See table_relation_size(). + * + * Note that currently a few callers use the MAIN_FORKNUM size to figure + * out the range of potentially interesting blocks (brin, analyze). It's + * probable that we'll need to revise the interface for those at some + * point. + */ + uint64 (*relation_size) (Relation rel, ForkNumber forkNumber); + + + /* + * This callback should return true if the relation requires a TOAST table + * and false if it does not. It may wish to examine the relation's tuple + * descriptor before making a decision, but if it uses some other method + * of storing large values (or if it does not support them) it can simply + * return false. + */ + bool (*relation_needs_toast_table) (Relation rel); + + /* + * This callback should return the OID of the table AM that implements + * TOAST tables for this AM. If the relation_needs_toast_table callback + * always returns false, this callback is not required. + */ + Oid (*relation_toast_am) (Relation rel); + + /* + * This callback is invoked when detoasting a value stored in a toast + * table implemented by this AM. See table_relation_fetch_toast_slice() + * for more details. + */ + void (*relation_fetch_toast_slice) (Relation toastrel, Oid valueid, + int32 attrsize, + int32 sliceoffset, + int32 slicelength, + struct varlena *result); + + + /* ------------------------------------------------------------------------ + * Planner related functions. + * ------------------------------------------------------------------------ + */ + + /* + * See table_relation_estimate_size(). + * + * While block oriented, it shouldn't be too hard for an AM that doesn't + * internally use blocks to convert into a usable representation. + * + * This differs from the relation_size callback by returning size + * estimates (both relation size and tuple count) for planning purposes, + * rather than returning a currently correct estimate. + */ + void (*relation_estimate_size) (Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, + double *allvisfrac); + + + /* ------------------------------------------------------------------------ + * Executor related functions. + * ------------------------------------------------------------------------ + */ + + /* + * Prepare to fetch / check / return tuples from `tbmres->blockno` as part + * of a bitmap table scan. `scan` was started via table_beginscan_bm(). + * Return false if there are no tuples to be found on the page, true + * otherwise. + * + * This will typically read and pin the target block, and do the necessary + * work to allow scan_bitmap_next_tuple() to return tuples (e.g. it might + * make sense to perform tuple visibility checks at this time). For some + * AMs it will make more sense to do all the work referencing `tbmres` + * contents here, for others it might be better to defer more work to + * scan_bitmap_next_tuple. + * + * If `tbmres->blockno` is -1, this is a lossy scan and all visible tuples + * on the page have to be returned, otherwise the tuples at offsets in + * `tbmres->offsets` need to be returned. + * + * XXX: Currently this may only be implemented if the AM uses md.c as its + * storage manager, and uses ItemPointer->ip_blkid in a manner that maps + * blockids directly to the underlying storage. nodeBitmapHeapscan.c + * performs prefetching directly using that interface. This probably + * needs to be rectified at a later point. + * + * XXX: Currently this may only be implemented if the AM uses the + * visibilitymap, as nodeBitmapHeapscan.c unconditionally accesses it to + * perform prefetching. This probably needs to be rectified at a later + * point. + * + * Optional callback, but either both scan_bitmap_next_block and + * scan_bitmap_next_tuple need to exist, or neither. + */ + bool (*scan_bitmap_next_block) (TableScanDesc scan, + struct TBMIterateResult *tbmres); + + /* + * Fetch the next tuple of a bitmap table scan into `slot` and return true + * if a visible tuple was found, false otherwise. + * + * For some AMs it will make more sense to do all the work referencing + * `tbmres` contents in scan_bitmap_next_block, for others it might be + * better to defer more work to this callback. + * + * Optional callback, but either both scan_bitmap_next_block and + * scan_bitmap_next_tuple need to exist, or neither. + */ + bool (*scan_bitmap_next_tuple) (TableScanDesc scan, + struct TBMIterateResult *tbmres, + TupleTableSlot *slot); + + /* + * Prepare to fetch tuples from the next block in a sample scan. Return + * false if the sample scan is finished, true otherwise. `scan` was + * started via table_beginscan_sampling(). + * + * Typically this will first determine the target block by calling the + * TsmRoutine's NextSampleBlock() callback if not NULL, or alternatively + * perform a sequential scan over all blocks. The determined block is + * then typically read and pinned. + * + * As the TsmRoutine interface is block based, a block needs to be passed + * to NextSampleBlock(). If that's not appropriate for an AM, it + * internally needs to perform mapping between the internal and a block + * based representation. + * + * Note that it's not acceptable to hold deadlock prone resources such as + * lwlocks until scan_sample_next_tuple() has exhausted the tuples on the + * block - the tuple is likely to be returned to an upper query node, and + * the next call could be off a long while. Holding buffer pins and such + * is obviously OK. + * + * Currently it is required to implement this interface, as there's no + * alternative way (contrary e.g. to bitmap scans) to implement sample + * scans. If infeasible to implement, the AM may raise an error. + */ + bool (*scan_sample_next_block) (TableScanDesc scan, + struct SampleScanState *scanstate); + + /* + * This callback, only called after scan_sample_next_block has returned + * true, should determine the next tuple to be returned from the selected + * block using the TsmRoutine's NextSampleTuple() callback. + * + * The callback needs to perform visibility checks, and only return + * visible tuples. That obviously can mean calling NextSampleTuple() + * multiple times. + * + * The TsmRoutine interface assumes that there's a maximum offset on a + * given page, so if that doesn't apply to an AM, it needs to emulate that + * assumption somehow. + */ + bool (*scan_sample_next_tuple) (TableScanDesc scan, + struct SampleScanState *scanstate, + TupleTableSlot *slot); + +} TableAmRoutine; + + +/* ---------------------------------------------------------------------------- + * Slot functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Returns slot callbacks suitable for holding tuples of the appropriate type + * for the relation. Works for tables, views, foreign tables and partitioned + * tables. + */ +extern const TupleTableSlotOps *table_slot_callbacks(Relation relation); + +/* + * Returns slot using the callbacks returned by table_slot_callbacks(), and + * registers it on *reglist. + */ +extern TupleTableSlot *table_slot_create(Relation relation, List **reglist); + + +/* ---------------------------------------------------------------------------- + * Table scan functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Start a scan of `rel`. Returned tuples pass a visibility test of + * `snapshot`, and if nkeys != 0, the results are filtered by those scan keys. + */ +static inline TableScanDesc +table_beginscan(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key) +{ + uint32 flags = SO_TYPE_SEQSCAN | + SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * Like table_beginscan(), but for scanning catalog. It'll automatically use a + * snapshot appropriate for scanning catalog relations. + */ +extern TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, + struct ScanKeyData *key); + +/* + * Like table_beginscan(), but table_beginscan_strat() offers an extended API + * that lets the caller control whether a nondefault buffer access strategy + * can be used, and whether syncscan can be chosen (possibly resulting in the + * scan not starting from block zero). Both of these default to true with + * plain table_beginscan. + */ +static inline TableScanDesc +table_beginscan_strat(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + bool allow_strat, bool allow_sync) +{ + uint32 flags = SO_TYPE_SEQSCAN | SO_ALLOW_PAGEMODE; + + if (allow_strat) + flags |= SO_ALLOW_STRAT; + if (allow_sync) + flags |= SO_ALLOW_SYNC; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * table_beginscan_bm is an alternative entry point for setting up a + * TableScanDesc for a bitmap heap scan. Although that scan technology is + * really quite unlike a standard seqscan, there is just enough commonality to + * make it worth using the same data structure. + */ +static inline TableScanDesc +table_beginscan_bm(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key, bool need_tuple) +{ + uint32 flags = SO_TYPE_BITMAPSCAN | SO_ALLOW_PAGEMODE; + + if (need_tuple) + flags |= SO_NEED_TUPLES; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * table_beginscan_sampling is an alternative entry point for setting up a + * TableScanDesc for a TABLESAMPLE scan. As with bitmap scans, it's worth + * using the same data structure although the behavior is rather different. + * In addition to the options offered by table_beginscan_strat, this call + * also allows control of whether page-mode visibility checking is used. + */ +static inline TableScanDesc +table_beginscan_sampling(Relation rel, Snapshot snapshot, + int nkeys, struct ScanKeyData *key, + bool allow_strat, bool allow_sync, + bool allow_pagemode) +{ + uint32 flags = SO_TYPE_SAMPLESCAN; + + if (allow_strat) + flags |= SO_ALLOW_STRAT; + if (allow_sync) + flags |= SO_ALLOW_SYNC; + if (allow_pagemode) + flags |= SO_ALLOW_PAGEMODE; + + return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags); +} + +/* + * table_beginscan_tid is an alternative entry point for setting up a + * TableScanDesc for a Tid scan. As with bitmap scans, it's worth using + * the same data structure although the behavior is rather different. + */ +static inline TableScanDesc +table_beginscan_tid(Relation rel, Snapshot snapshot) +{ + uint32 flags = SO_TYPE_TIDSCAN; + + return rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags); +} + +/* + * table_beginscan_analyze is an alternative entry point for setting up a + * TableScanDesc for an ANALYZE scan. As with bitmap scans, it's worth using + * the same data structure although the behavior is rather different. + */ +static inline TableScanDesc +table_beginscan_analyze(Relation rel) +{ + uint32 flags = SO_TYPE_ANALYZE; + + return rel->rd_tableam->scan_begin(rel, NULL, 0, NULL, NULL, flags); +} + +/* + * End relation scan. + */ +static inline void +table_endscan(TableScanDesc scan) +{ + scan->rs_rd->rd_tableam->scan_end(scan); +} + +/* + * Restart a relation scan. + */ +static inline void +table_rescan(TableScanDesc scan, + struct ScanKeyData *key) +{ + scan->rs_rd->rd_tableam->scan_rescan(scan, key, false, false, false, false); +} + +/* + * Restart a relation scan after changing params. + * + * This call allows changing the buffer strategy, syncscan, and pagemode + * options before starting a fresh scan. Note that although the actual use of + * syncscan might change (effectively, enabling or disabling reporting), the + * previously selected startblock will be kept. + */ +static inline void +table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, + bool allow_strat, bool allow_sync, bool allow_pagemode) +{ + scan->rs_rd->rd_tableam->scan_rescan(scan, key, true, + allow_strat, allow_sync, + allow_pagemode); +} + +/* + * Return next tuple from `scan`, store in slot. + */ +static inline bool +table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot) +{ + slot->tts_tableOid = RelationGetRelid(sscan->rs_rd); + + /* We don't expect actual scans using NoMovementScanDirection */ + Assert(direction == ForwardScanDirection || + direction == BackwardScanDirection); + + /* + * We don't expect direct calls to table_scan_getnextslot with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_getnextslot call during logical decoding"); + + return sscan->rs_rd->rd_tableam->scan_getnextslot(sscan, direction, slot); +} + +/* ---------------------------------------------------------------------------- + * TID Range scanning related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * table_beginscan_tidrange is the entry point for setting up a TableScanDesc + * for a TID range scan. + */ +static inline TableScanDesc +table_beginscan_tidrange(Relation rel, Snapshot snapshot, + ItemPointer mintid, + ItemPointer maxtid) +{ + TableScanDesc sscan; + uint32 flags = SO_TYPE_TIDRANGESCAN | SO_ALLOW_PAGEMODE; + + sscan = rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags); + + /* Set the range of TIDs to scan */ + sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid); + + return sscan; +} + +/* + * table_rescan_tidrange resets the scan position and sets the minimum and + * maximum TID range to scan for a TableScanDesc created by + * table_beginscan_tidrange. + */ +static inline void +table_rescan_tidrange(TableScanDesc sscan, ItemPointer mintid, + ItemPointer maxtid) +{ + /* Ensure table_beginscan_tidrange() was used. */ + Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0); + + sscan->rs_rd->rd_tableam->scan_rescan(sscan, NULL, false, false, false, false); + sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid); +} + +/* + * Fetch the next tuple from `sscan` for a TID range scan created by + * table_beginscan_tidrange(). Stores the tuple in `slot` and returns true, + * or returns false if no more tuples exist in the range. + */ +static inline bool +table_scan_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, + TupleTableSlot *slot) +{ + /* Ensure table_beginscan_tidrange() was used. */ + Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0); + + /* We don't expect actual scans using NoMovementScanDirection */ + Assert(direction == ForwardScanDirection || + direction == BackwardScanDirection); + + return sscan->rs_rd->rd_tableam->scan_getnextslot_tidrange(sscan, + direction, + slot); +} + + +/* ---------------------------------------------------------------------------- + * Parallel table scan related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Estimate the size of shared memory needed for a parallel scan of this + * relation. + */ +extern Size table_parallelscan_estimate(Relation rel, Snapshot snapshot); + +/* + * Initialize ParallelTableScanDesc for a parallel scan of this + * relation. `pscan` needs to be sized according to parallelscan_estimate() + * for the same relation. Call this just once in the leader process; then, + * individual workers attach via table_beginscan_parallel. + */ +extern void table_parallelscan_initialize(Relation rel, + ParallelTableScanDesc pscan, + Snapshot snapshot); + +/* + * Begin a parallel scan. `pscan` needs to have been initialized with + * table_parallelscan_initialize(), for the same relation. The initialization + * does not need to have happened in this backend. + * + * Caller must hold a suitable lock on the relation. + */ +extern TableScanDesc table_beginscan_parallel(Relation relation, + ParallelTableScanDesc pscan); + +/* + * Restart a parallel scan. Call this in the leader process. Caller is + * responsible for making sure that all workers have finished the scan + * beforehand. + */ +static inline void +table_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan) +{ + rel->rd_tableam->parallelscan_reinitialize(rel, pscan); +} + + +/* ---------------------------------------------------------------------------- + * Index scan related functions. + * ---------------------------------------------------------------------------- + */ + +/* + * Prepare to fetch tuples from the relation, as needed when fetching tuples + * for an index scan. + * + * Tuples for an index scan can then be fetched via table_index_fetch_tuple(). + */ +static inline IndexFetchTableData * +table_index_fetch_begin(Relation rel) +{ + return rel->rd_tableam->index_fetch_begin(rel); +} + +/* + * Reset index fetch. Typically this will release cross index fetch resources + * held in IndexFetchTableData. + */ +static inline void +table_index_fetch_reset(struct IndexFetchTableData *scan) +{ + scan->rel->rd_tableam->index_fetch_reset(scan); +} + +/* + * Release resources and deallocate index fetch. + */ +static inline void +table_index_fetch_end(struct IndexFetchTableData *scan) +{ + scan->rel->rd_tableam->index_fetch_end(scan); +} + +/* + * Fetches, as part of an index scan, tuple at `tid` into `slot`, after doing + * a visibility test according to `snapshot`. If a tuple was found and passed + * the visibility test, returns true, false otherwise. Note that *tid may be + * modified when we return true (see later remarks on multiple row versions + * reachable via a single index entry). + * + * *call_again needs to be false on the first call to table_index_fetch_tuple() for + * a tid. If there potentially is another tuple matching the tid, *call_again + * will be set to true, signaling that table_index_fetch_tuple() should be called + * again for the same tid. + * + * *all_dead, if all_dead is not NULL, will be set to true by + * table_index_fetch_tuple() iff it is guaranteed that no backend needs to see + * that tuple. Index AMs can use that to avoid returning that tid in future + * searches. + * + * The difference between this function and table_tuple_fetch_row_version() + * is that this function returns the currently visible version of a row if + * the AM supports storing multiple row versions reachable via a single index + * entry (like heap's HOT). Whereas table_tuple_fetch_row_version() only + * evaluates the tuple exactly at `tid`. Outside of index entry ->table tuple + * lookups, table_tuple_fetch_row_version() is what's usually needed. + */ +static inline bool +table_index_fetch_tuple(struct IndexFetchTableData *scan, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot, + bool *call_again, bool *all_dead) +{ + /* + * We don't expect direct calls to table_index_fetch_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_index_fetch_tuple call during logical decoding"); + + return scan->rel->rd_tableam->index_fetch_tuple(scan, tid, snapshot, + slot, call_again, + all_dead); +} + +/* + * This is a convenience wrapper around table_index_fetch_tuple() which + * returns whether there are table tuple items corresponding to an index + * entry. This likely is only useful to verify if there's a conflict in a + * unique index. + */ +extern bool table_index_fetch_tuple_check(Relation rel, + ItemPointer tid, + Snapshot snapshot, + bool *all_dead); + + +/* ------------------------------------------------------------------------ + * Functions for non-modifying operations on individual tuples + * ------------------------------------------------------------------------ + */ + + +/* + * Fetch tuple at `tid` into `slot`, after doing a visibility test according to + * `snapshot`. If a tuple was found and passed the visibility test, returns + * true, false otherwise. + * + * See table_index_fetch_tuple's comment about what the difference between + * these functions is. It is correct to use this function outside of index + * entry->table tuple lookups. + */ +static inline bool +table_tuple_fetch_row_version(Relation rel, + ItemPointer tid, + Snapshot snapshot, + TupleTableSlot *slot) +{ + /* + * We don't expect direct calls to table_tuple_fetch_row_version with + * valid CheckXidAlive for catalog or regular tables. See detailed + * comments in xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_tuple_fetch_row_version call during logical decoding"); + + return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot); +} + +/* + * Verify that `tid` is a potentially valid tuple identifier. That doesn't + * mean that the pointed to row needs to exist or be visible, but that + * attempting to fetch the row (e.g. with table_tuple_get_latest_tid() or + * table_tuple_fetch_row_version()) should not error out if called with that + * tid. + * + * `scan` needs to have been started via table_beginscan(). + */ +static inline bool +table_tuple_tid_valid(TableScanDesc scan, ItemPointer tid) +{ + return scan->rs_rd->rd_tableam->tuple_tid_valid(scan, tid); +} + +/* + * Return the latest version of the tuple at `tid`, by updating `tid` to + * point at the newest version. + */ +extern void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid); + +/* + * Return true iff tuple in slot satisfies the snapshot. + * + * This assumes the slot's tuple is valid, and of the appropriate type for the + * AM. + * + * Some AMs might modify the data underlying the tuple as a side-effect. If so + * they ought to mark the relevant buffer dirty. + */ +static inline bool +table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot, + Snapshot snapshot) +{ + return rel->rd_tableam->tuple_satisfies_snapshot(rel, slot, snapshot); +} + +/* + * Determine which index tuples are safe to delete based on their table TID. + * + * Determines which entries from index AM caller's TM_IndexDeleteOp state + * point to vacuumable table tuples. Entries that are found by tableam to be + * vacuumable are naturally safe for index AM to delete, and so get directly + * marked as deletable. See comments above TM_IndexDelete and comments above + * TM_IndexDeleteOp for full details. + * + * Returns a snapshotConflictHorizon transaction ID that caller places in + * its index deletion WAL record. This might be used during subsequent REDO + * of the WAL record when in Hot Standby mode -- a recovery conflict for the + * index deletion operation might be required on the standby. + */ +static inline TransactionId +table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate) +{ + return rel->rd_tableam->index_delete_tuples(rel, delstate); +} + + +/* ---------------------------------------------------------------------------- + * Functions for manipulations of physical tuples. + * ---------------------------------------------------------------------------- + */ + +/* + * Insert a tuple from a slot into table AM routine. + * + * The options bitmask allows the caller to specify options that may change the + * behaviour of the AM. The AM will ignore options that it does not support. + * + * If the TABLE_INSERT_SKIP_FSM option is specified, AMs are free to not reuse + * free space in the relation. This can save some cycles when we know the + * relation is new and doesn't contain useful amounts of free space. + * TABLE_INSERT_SKIP_FSM is commonly passed directly to + * RelationGetBufferForTuple. See that method for more information. + * + * TABLE_INSERT_FROZEN should only be specified for inserts into + * relation storage created during the current subtransaction and when + * there are no prior snapshots or pre-existing portals open. + * This causes rows to be frozen, which is an MVCC violation and + * requires explicit options chosen by user. + * + * TABLE_INSERT_NO_LOGICAL force-disables the emitting of logical decoding + * information for the tuple. This should solely be used during table rewrites + * where RelationIsLogicallyLogged(relation) is not yet accurate for the new + * relation. + * + * Note that most of these options will be applied when inserting into the + * heap's TOAST table, too, if the tuple requires any out-of-line data. + * + * The BulkInsertState object (if any; bistate can be NULL for default + * behavior) is also just passed through to RelationGetBufferForTuple. If + * `bistate` is provided, table_finish_bulk_insert() needs to be called. + * + * On return the slot's tts_tid and tts_tableOid are updated to reflect the + * insertion. But note that any toasting of fields within the slot is NOT + * reflected in the slots contents. + */ +static inline void +table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, + int options, struct BulkInsertStateData *bistate) +{ + rel->rd_tableam->tuple_insert(rel, slot, cid, options, + bistate); +} + +/* + * Perform a "speculative insertion". These can be backed out afterwards + * without aborting the whole transaction. Other sessions can wait for the + * speculative insertion to be confirmed, turning it into a regular tuple, or + * aborted, as if it never existed. Speculatively inserted tuples behave as + * "value locks" of short duration, used to implement INSERT .. ON CONFLICT. + * + * A transaction having performed a speculative insertion has to either abort, + * or finish the speculative insertion with + * table_tuple_complete_speculative(succeeded = ...). + */ +static inline void +table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, + CommandId cid, int options, + struct BulkInsertStateData *bistate, + uint32 specToken) +{ + rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options, + bistate, specToken); +} + +/* + * Complete "speculative insertion" started in the same transaction. If + * succeeded is true, the tuple is fully inserted, if false, it's removed. + */ +static inline void +table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, + uint32 specToken, bool succeeded) +{ + rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken, + succeeded); +} + +/* + * Insert multiple tuples into a table. + * + * This is like table_tuple_insert(), but inserts multiple tuples in one + * operation. That's often faster than calling table_tuple_insert() in a loop, + * because e.g. the AM can reduce WAL logging and page locking overhead. + * + * Except for taking `nslots` tuples as input, and an array of TupleTableSlots + * in `slots`, the parameters for table_multi_insert() are the same as for + * table_tuple_insert(). + * + * Note: this leaks memory into the current memory context. You can create a + * temporary context before calling this, if that's a problem. + */ +static inline void +table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, + CommandId cid, int options, struct BulkInsertStateData *bistate) +{ + rel->rd_tableam->multi_insert(rel, slots, nslots, + cid, options, bistate); +} + +/* + * Delete a tuple. + * + * NB: do not call this directly unless prepared to deal with + * concurrent-update conditions. Use simple_table_tuple_delete instead. + * + * Input parameters: + * relation - table to be modified (caller must hold suitable lock) + * tid - TID of tuple to be deleted + * cid - delete command ID (used for visibility test, and stored into + * cmax if successful) + * crosscheck - if not InvalidSnapshot, also check tuple against this + * wait - true if should wait for any conflicting update to commit/abort + * Output parameters: + * tmfd - filled in failure cases (see below) + * changingPart - true iff the tuple is being moved to another partition + * table due to an update of the partition key. Otherwise, false. + * + * Normal, successful return value is TM_Ok, which means we did actually + * delete it. Failure return codes are TM_SelfModified, TM_Updated, and + * TM_BeingModified (the last only possible if wait == false). + * + * In the failure cases, the routine fills *tmfd with the tuple's t_ctid, + * t_xmax, and, if possible, t_cmax. See comments for struct + * TM_FailureData for additional info. + */ +static inline TM_Result +table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, + Snapshot snapshot, Snapshot crosscheck, bool wait, + TM_FailureData *tmfd, bool changingPart) +{ + return rel->rd_tableam->tuple_delete(rel, tid, cid, + snapshot, crosscheck, + wait, tmfd, changingPart); +} + +/* + * Update a tuple. + * + * NB: do not call this directly unless you are prepared to deal with + * concurrent-update conditions. Use simple_table_tuple_update instead. + * + * Input parameters: + * relation - table to be modified (caller must hold suitable lock) + * otid - TID of old tuple to be replaced + * slot - newly constructed tuple data to store + * cid - update command ID (used for visibility test, and stored into + * cmax/cmin if successful) + * crosscheck - if not InvalidSnapshot, also check old tuple against this + * wait - true if should wait for any conflicting update to commit/abort + * Output parameters: + * tmfd - filled in failure cases (see below) + * lockmode - filled with lock mode acquired on tuple + * update_indexes - in success cases this is set to true if new index entries + * are required for this tuple + * + * Normal, successful return value is TM_Ok, which means we did actually + * update it. Failure return codes are TM_SelfModified, TM_Updated, and + * TM_BeingModified (the last only possible if wait == false). + * + * On success, the slot's tts_tid and tts_tableOid are updated to match the new + * stored tuple; in particular, slot->tts_tid is set to the TID where the + * new tuple was inserted, and its HEAP_ONLY_TUPLE flag is set iff a HOT + * update was done. However, any TOAST changes in the new tuple's + * data are not reflected into *newtup. + * + * In the failure cases, the routine fills *tmfd with the tuple's t_ctid, + * t_xmax, and, if possible, t_cmax. See comments for struct TM_FailureData + * for additional info. + */ +static inline TM_Result +table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, + CommandId cid, Snapshot snapshot, Snapshot crosscheck, + bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes) +{ + return rel->rd_tableam->tuple_update(rel, otid, slot, + cid, snapshot, crosscheck, + wait, tmfd, + lockmode, update_indexes); +} + +/* + * Lock a tuple in the specified mode. + * + * Input parameters: + * relation: relation containing tuple (caller must hold suitable lock) + * tid: TID of tuple to lock + * snapshot: snapshot to use for visibility determinations + * cid: current command ID (used for visibility test, and stored into + * tuple's cmax if lock is successful) + * mode: lock mode desired + * wait_policy: what to do if tuple lock is not available + * flags: + * If TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS, follow the update chain to + * also lock descendant tuples if lock modes don't conflict. + * If TUPLE_LOCK_FLAG_FIND_LAST_VERSION, follow the update chain and lock + * latest version. + * + * Output parameters: + * *slot: contains the target tuple + * *tmfd: filled in failure cases (see below) + * + * Function result may be: + * TM_Ok: lock was successfully acquired + * TM_Invisible: lock failed because tuple was never visible to us + * TM_SelfModified: lock failed because tuple updated by self + * TM_Updated: lock failed because tuple updated by other xact + * TM_Deleted: lock failed because tuple deleted by other xact + * TM_WouldBlock: lock couldn't be acquired and wait_policy is skip + * + * In the failure cases other than TM_Invisible and TM_Deleted, the routine + * fills *tmfd with the tuple's t_ctid, t_xmax, and, if possible, t_cmax. See + * comments for struct TM_FailureData for additional info. + */ +static inline TM_Result +table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot, + TupleTableSlot *slot, CommandId cid, LockTupleMode mode, + LockWaitPolicy wait_policy, uint8 flags, + TM_FailureData *tmfd) +{ + return rel->rd_tableam->tuple_lock(rel, tid, snapshot, slot, + cid, mode, wait_policy, + flags, tmfd); +} + +/* + * Perform operations necessary to complete insertions made via + * tuple_insert and multi_insert with a BulkInsertState specified. + */ +static inline void +table_finish_bulk_insert(Relation rel, int options) +{ + /* optional callback */ + if (rel->rd_tableam && rel->rd_tableam->finish_bulk_insert) + rel->rd_tableam->finish_bulk_insert(rel, options); +} + + +/* ------------------------------------------------------------------------ + * DDL related functionality. + * ------------------------------------------------------------------------ + */ + +/* + * Create storage for `rel` in `newrlocator`, with persistence set to + * `persistence`. + * + * This is used both during relation creation and various DDL operations to + * create new rel storage that can be filled from scratch. When creating + * new storage for an existing relfilelocator, this should be called before the + * relcache entry has been updated. + * + * *freezeXid, *minmulti are set to the xid / multixact horizon for the table + * that pg_class.{relfrozenxid, relminmxid} have to be set to. + */ +static inline void +table_relation_set_new_filelocator(Relation rel, + const RelFileLocator *newrlocator, + char persistence, + TransactionId *freezeXid, + MultiXactId *minmulti) +{ + rel->rd_tableam->relation_set_new_filelocator(rel, newrlocator, + persistence, freezeXid, + minmulti); +} + +/* + * Remove all table contents from `rel`, in a non-transactional manner. + * Non-transactional meaning that there's no need to support rollbacks. This + * commonly only is used to perform truncations for relation storage created in + * the current transaction. + */ +static inline void +table_relation_nontransactional_truncate(Relation rel) +{ + rel->rd_tableam->relation_nontransactional_truncate(rel); +} + +/* + * Copy data from `rel` into the new relfilelocator `newrlocator`. The new + * relfilelocator may not have storage associated before this function is + * called. This is only supposed to be used for low level operations like + * changing a relation's tablespace. + */ +static inline void +table_relation_copy_data(Relation rel, const RelFileLocator *newrlocator) +{ + rel->rd_tableam->relation_copy_data(rel, newrlocator); +} + +/* + * Copy data from `OldTable` into `NewTable`, as part of a CLUSTER or VACUUM + * FULL. + * + * Additional Input parameters: + * - use_sort - if true, the table contents are sorted appropriate for + * `OldIndex`; if false and OldIndex is not InvalidOid, the data is copied + * in that index's order; if false and OldIndex is InvalidOid, no sorting is + * performed + * - OldIndex - see use_sort + * - OldestXmin - computed by vacuum_get_cutoffs(), even when + * not needed for the relation's AM + * - *xid_cutoff - ditto + * - *multi_cutoff - ditto + * + * Output parameters: + * - *xid_cutoff - rel's new relfrozenxid value, may be invalid + * - *multi_cutoff - rel's new relminmxid value, may be invalid + * - *tups_vacuumed - stats, for logging, if appropriate for AM + * - *tups_recently_dead - stats, for logging, if appropriate for AM + */ +static inline void +table_relation_copy_for_cluster(Relation OldTable, Relation NewTable, + Relation OldIndex, + bool use_sort, + TransactionId OldestXmin, + TransactionId *xid_cutoff, + MultiXactId *multi_cutoff, + double *num_tuples, + double *tups_vacuumed, + double *tups_recently_dead) +{ + OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable, OldIndex, + use_sort, OldestXmin, + xid_cutoff, multi_cutoff, + num_tuples, tups_vacuumed, + tups_recently_dead); +} + +/* + * Perform VACUUM on the relation. The VACUUM can be triggered by a user or by + * autovacuum. The specific actions performed by the AM will depend heavily on + * the individual AM. + * + * On entry a transaction needs to already been established, and the + * table is locked with a ShareUpdateExclusive lock. + * + * Note that neither VACUUM FULL (and CLUSTER), nor ANALYZE go through this + * routine, even if (for ANALYZE) it is part of the same VACUUM command. + */ +static inline void +table_relation_vacuum(Relation rel, struct VacuumParams *params, + BufferAccessStrategy bstrategy) +{ + rel->rd_tableam->relation_vacuum(rel, params, bstrategy); +} + +/* + * Prepare to analyze the next block in the read stream. The scan needs to + * have been started with table_beginscan_analyze(). Note that this routine + * might acquire resources like locks that are held until + * table_scan_analyze_next_tuple() returns false. + * + * Returns false if block is unsuitable for sampling, true otherwise. + */ +static inline bool +table_scan_analyze_next_block(TableScanDesc scan, ReadStream *stream) +{ + return scan->rs_rd->rd_tableam->scan_analyze_next_block(scan, stream); +} + +/* + * Iterate over tuples in the block selected with + * table_scan_analyze_next_block() (which needs to have returned true, and + * this routine may not have returned false for the same block before). If a + * tuple that's suitable for sampling is found, true is returned and a tuple + * is stored in `slot`. + * + * *liverows and *deadrows are incremented according to the encountered + * tuples. + */ +static inline bool +table_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin, + double *liverows, double *deadrows, + TupleTableSlot *slot) +{ + return scan->rs_rd->rd_tableam->scan_analyze_next_tuple(scan, OldestXmin, + liverows, deadrows, + slot); +} + +/* + * table_index_build_scan - scan the table to find tuples to be indexed + * + * This is called back from an access-method-specific index build procedure + * after the AM has done whatever setup it needs. The parent table relation + * is scanned to find tuples that should be entered into the index. Each + * such tuple is passed to the AM's callback routine, which does the right + * things to add it to the new index. After we return, the AM's index + * build procedure does whatever cleanup it needs. + * + * The total count of live tuples is returned. This is for updating pg_class + * statistics. (It's annoying not to be able to do that here, but we want to + * merge that update with others; see index_update_stats.) Note that the + * index AM itself must keep track of the number of index tuples; we don't do + * so here because the AM might reject some of the tuples for its own reasons, + * such as being unable to store NULLs. + * + * If 'progress', the PROGRESS_SCAN_BLOCKS_TOTAL counter is updated when + * starting the scan, and PROGRESS_SCAN_BLOCKS_DONE is updated as we go along. + * + * A side effect is to set indexInfo->ii_BrokenHotChain to true if we detect + * any potentially broken HOT chains. Currently, we set this if there are any + * RECENTLY_DEAD or DELETE_IN_PROGRESS entries in a HOT chain, without trying + * very hard to detect whether they're really incompatible with the chain tip. + * This only really makes sense for heap AM, it might need to be generalized + * for other AMs later. + */ +static inline double +table_index_build_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool progress, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan) +{ + return table_rel->rd_tableam->index_build_range_scan(table_rel, + index_rel, + index_info, + allow_sync, + false, + progress, + 0, + InvalidBlockNumber, + callback, + callback_state, + scan); +} + +/* + * As table_index_build_scan(), except that instead of scanning the complete + * table, only the given number of blocks are scanned. Scan to end-of-rel can + * be signaled by passing InvalidBlockNumber as numblocks. Note that + * restricting the range to scan cannot be done when requesting syncscan. + * + * When "anyvisible" mode is requested, all tuples visible to any transaction + * are indexed and counted as live, including those inserted or deleted by + * transactions that are still in progress. + */ +static inline double +table_index_build_range_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + bool allow_sync, + bool anyvisible, + bool progress, + BlockNumber start_blockno, + BlockNumber numblocks, + IndexBuildCallback callback, + void *callback_state, + TableScanDesc scan) +{ + return table_rel->rd_tableam->index_build_range_scan(table_rel, + index_rel, + index_info, + allow_sync, + anyvisible, + progress, + start_blockno, + numblocks, + callback, + callback_state, + scan); +} + +/* + * table_index_validate_scan - second table scan for concurrent index build + * + * See validate_index() for an explanation. + */ +static inline void +table_index_validate_scan(Relation table_rel, + Relation index_rel, + struct IndexInfo *index_info, + Snapshot snapshot, + struct ValidateIndexState *state) +{ + table_rel->rd_tableam->index_validate_scan(table_rel, + index_rel, + index_info, + snapshot, + state); +} + + +/* ---------------------------------------------------------------------------- + * Miscellaneous functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Return the current size of `rel` in bytes. If `forkNumber` is + * InvalidForkNumber, return the relation's overall size, otherwise the size + * for the indicated fork. + * + * Note that the overall size might not be the equivalent of the sum of sizes + * for the individual forks for some AMs, e.g. because the AMs storage does + * not neatly map onto the builtin types of forks. + */ +static inline uint64 +table_relation_size(Relation rel, ForkNumber forkNumber) +{ + return rel->rd_tableam->relation_size(rel, forkNumber); +} + +/* + * table_relation_needs_toast_table - does this relation need a toast table? + */ +static inline bool +table_relation_needs_toast_table(Relation rel) +{ + return rel->rd_tableam->relation_needs_toast_table(rel); +} + +/* + * Return the OID of the AM that should be used to implement the TOAST table + * for this relation. + */ +static inline Oid +table_relation_toast_am(Relation rel) +{ + return rel->rd_tableam->relation_toast_am(rel); +} + +/* + * Fetch all or part of a TOAST value from a TOAST table. + * + * If this AM is never used to implement a TOAST table, then this callback + * is not needed. But, if toasted values are ever stored in a table of this + * type, then you will need this callback. + * + * toastrel is the relation in which the toasted value is stored. + * + * valueid identifies which toast value is to be fetched. For the heap, + * this corresponds to the values stored in the chunk_id column. + * + * attrsize is the total size of the toast value to be fetched. + * + * sliceoffset is the offset within the toast value of the first byte that + * should be fetched. + * + * slicelength is the number of bytes from the toast value that should be + * fetched. + * + * result is caller-allocated space into which the fetched bytes should be + * stored. + */ +static inline void +table_relation_fetch_toast_slice(Relation toastrel, Oid valueid, + int32 attrsize, int32 sliceoffset, + int32 slicelength, struct varlena *result) +{ + toastrel->rd_tableam->relation_fetch_toast_slice(toastrel, valueid, + attrsize, + sliceoffset, slicelength, + result); +} + + +/* ---------------------------------------------------------------------------- + * Planner related functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Estimate the current size of the relation, as an AM specific workhorse for + * estimate_rel_size(). Look there for an explanation of the parameters. + */ +static inline void +table_relation_estimate_size(Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, + double *allvisfrac) +{ + rel->rd_tableam->relation_estimate_size(rel, attr_widths, pages, tuples, + allvisfrac); +} + + +/* ---------------------------------------------------------------------------- + * Executor related functionality + * ---------------------------------------------------------------------------- + */ + +/* + * Prepare to fetch / check / return tuples from `tbmres->blockno` as part of + * a bitmap table scan. `scan` needs to have been started via + * table_beginscan_bm(). Returns false if there are no tuples to be found on + * the page, true otherwise. + * + * Note, this is an optionally implemented function, therefore should only be + * used after verifying the presence (at plan time or such). + */ +static inline bool +table_scan_bitmap_next_block(TableScanDesc scan, + struct TBMIterateResult *tbmres) +{ + /* + * We don't expect direct calls to table_scan_bitmap_next_block with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_bitmap_next_block call during logical decoding"); + + return scan->rs_rd->rd_tableam->scan_bitmap_next_block(scan, + tbmres); +} + +/* + * Fetch the next tuple of a bitmap table scan into `slot` and return true if + * a visible tuple was found, false otherwise. + * table_scan_bitmap_next_block() needs to previously have selected a + * block (i.e. returned true), and no previous + * table_scan_bitmap_next_tuple() for the same block may have + * returned false. + */ +static inline bool +table_scan_bitmap_next_tuple(TableScanDesc scan, + struct TBMIterateResult *tbmres, + TupleTableSlot *slot) +{ + /* + * We don't expect direct calls to table_scan_bitmap_next_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding"); + + return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan, + tbmres, + slot); +} + +/* + * Prepare to fetch tuples from the next block in a sample scan. Returns false + * if the sample scan is finished, true otherwise. `scan` needs to have been + * started via table_beginscan_sampling(). + * + * This will call the TsmRoutine's NextSampleBlock() callback if necessary + * (i.e. NextSampleBlock is not NULL), or perform a sequential scan over the + * underlying relation. + */ +static inline bool +table_scan_sample_next_block(TableScanDesc scan, + struct SampleScanState *scanstate) +{ + /* + * We don't expect direct calls to table_scan_sample_next_block with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_sample_next_block call during logical decoding"); + return scan->rs_rd->rd_tableam->scan_sample_next_block(scan, scanstate); +} + +/* + * Fetch the next sample tuple into `slot` and return true if a visible tuple + * was found, false otherwise. table_scan_sample_next_block() needs to + * previously have selected a block (i.e. returned true), and no previous + * table_scan_sample_next_tuple() for the same block may have returned false. + * + * This will call the TsmRoutine's NextSampleTuple() callback. + */ +static inline bool +table_scan_sample_next_tuple(TableScanDesc scan, + struct SampleScanState *scanstate, + TupleTableSlot *slot) +{ + /* + * We don't expect direct calls to table_scan_sample_next_tuple with valid + * CheckXidAlive for catalog or regular tables. See detailed comments in + * xact.c where these variables are declared. + */ + if (unlikely(TransactionIdIsValid(CheckXidAlive) && !bsysscan)) + elog(ERROR, "unexpected table_scan_sample_next_tuple call during logical decoding"); + return scan->rs_rd->rd_tableam->scan_sample_next_tuple(scan, scanstate, + slot); +} + + +/* ---------------------------------------------------------------------------- + * Functions to make modifications a bit simpler. + * ---------------------------------------------------------------------------- + */ + +extern void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot); +extern void simple_table_tuple_delete(Relation rel, ItemPointer tid, + Snapshot snapshot); +extern void simple_table_tuple_update(Relation rel, ItemPointer otid, + TupleTableSlot *slot, Snapshot snapshot, + TU_UpdateIndexes *update_indexes); + + +/* ---------------------------------------------------------------------------- + * Helper functions to implement parallel scans for block oriented AMs. + * ---------------------------------------------------------------------------- + */ + +extern Size table_block_parallelscan_estimate(Relation rel); +extern Size table_block_parallelscan_initialize(Relation rel, + ParallelTableScanDesc pscan); +extern void table_block_parallelscan_reinitialize(Relation rel, + ParallelTableScanDesc pscan); +extern BlockNumber table_block_parallelscan_nextpage(Relation rel, + ParallelBlockTableScanWorker pbscanwork, + ParallelBlockTableScanDesc pbscan); +extern void table_block_parallelscan_startblock_init(Relation rel, + ParallelBlockTableScanWorker pbscanwork, + ParallelBlockTableScanDesc pbscan); + + +/* ---------------------------------------------------------------------------- + * Helper functions to implement relation sizing for block oriented AMs. + * ---------------------------------------------------------------------------- + */ + +extern uint64 table_block_relation_size(Relation rel, ForkNumber forkNumber); +extern void table_block_relation_estimate_size(Relation rel, + int32 *attr_widths, + BlockNumber *pages, + double *tuples, + double *allvisfrac, + Size overhead_bytes_per_tuple, + Size usable_bytes_per_page); + +/* ---------------------------------------------------------------------------- + * Functions in tableamapi.c + * ---------------------------------------------------------------------------- + */ + +extern const TableAmRoutine *GetTableAmRoutine(Oid amhandler); + +/* ---------------------------------------------------------------------------- + * Functions in heapam_handler.c + * ---------------------------------------------------------------------------- + */ + +extern const TableAmRoutine *GetHeapamTableAmRoutine(void); + +#endif /* TABLEAM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tidstore.h b/platform/dbops/binaries/postgres/include/server/access/tidstore.h new file mode 100644 index 0000000000000000000000000000000000000000..32aa9995193fa54e26ea31afb1fa7f3d89aaf6be --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tidstore.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * tidstore.h + * TidStore interface. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tidstore.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIDSTORE_H +#define TIDSTORE_H + +#include "storage/itemptr.h" +#include "utils/dsa.h" + +typedef struct TidStore TidStore; +typedef struct TidStoreIter TidStoreIter; + +/* Result struct for TidStoreIterateNext */ +typedef struct TidStoreIterResult +{ + BlockNumber blkno; + int max_offset; + int num_offsets; + OffsetNumber *offsets; +} TidStoreIterResult; + +extern TidStore *TidStoreCreateLocal(size_t max_bytes, bool insert_only); +extern TidStore *TidStoreCreateShared(size_t max_bytes, int tranche_id); +extern TidStore *TidStoreAttach(dsa_handle area_handle, dsa_pointer handle); +extern void TidStoreDetach(TidStore *ts); +extern void TidStoreLockExclusive(TidStore *ts); +extern void TidStoreLockShare(TidStore *ts); +extern void TidStoreUnlock(TidStore *ts); +extern void TidStoreDestroy(TidStore *ts); +extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, + int num_offsets); +extern bool TidStoreIsMember(TidStore *ts, ItemPointer tid); +extern TidStoreIter *TidStoreBeginIterate(TidStore *ts); +extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter); +extern void TidStoreEndIterate(TidStoreIter *iter); +extern size_t TidStoreMemoryUsage(TidStore *ts); +extern dsa_pointer TidStoreGetHandle(TidStore *ts); +extern dsa_area *TidStoreGetDSA(TidStore *ts); + +#endif /* TIDSTORE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/timeline.h b/platform/dbops/binaries/postgres/include/server/access/timeline.h new file mode 100644 index 0000000000000000000000000000000000000000..d4356ec120c91c6fe59c06d1ac4ce6422566ab72 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/timeline.h @@ -0,0 +1,44 @@ +/* + * timeline.h + * + * Functions for reading and writing timeline history files. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/timeline.h + */ +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +/* + * A list of these structs describes the timeline history of the server. Each + * TimeLineHistoryEntry represents a piece of WAL belonging to the history, + * from newest to oldest. All WAL locations between 'begin' and 'end' belong to + * the timeline represented by the entry. Together the 'begin' and 'end' + * pointers of all the entries form a contiguous line from beginning of time + * to infinity. + */ +typedef struct +{ + TimeLineID tli; + XLogRecPtr begin; /* inclusive */ + XLogRecPtr end; /* exclusive, InvalidXLogRecPtr means infinity */ +} TimeLineHistoryEntry; + +extern List *readTimeLineHistory(TimeLineID targetTLI); +extern bool existsTimeLineHistory(TimeLineID probeTLI); +extern TimeLineID findNewestTimeLine(TimeLineID startTLI); +extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, + XLogRecPtr switchpoint, char *reason); +extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size); +extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end); +extern bool tliInHistory(TimeLineID tli, List *expectedTLEs); +extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history); +extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, + TimeLineID *nextTLI); + +#endif /* TIMELINE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/toast_compression.h b/platform/dbops/binaries/postgres/include/server/access/toast_compression.h new file mode 100644 index 0000000000000000000000000000000000000000..64d5e079fa9dd85d056fe6b7722bb565c27687a7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/toast_compression.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * toast_compression.h + * Functions for toast compression. + * + * Copyright (c) 2021-2024, PostgreSQL Global Development Group + * + * src/include/access/toast_compression.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TOAST_COMPRESSION_H +#define TOAST_COMPRESSION_H + +/* + * GUC support. + * + * default_toast_compression is an integer for purposes of the GUC machinery, + * but the value is one of the char values defined below, as they appear in + * pg_attribute.attcompression, e.g. TOAST_PGLZ_COMPRESSION. + */ +extern PGDLLIMPORT int default_toast_compression; + +/* + * Built-in compression method ID. The toast compression header will store + * this in the first 2 bits of the raw length. These built-in compression + * method IDs are directly mapped to the built-in compression methods. + * + * Don't use these values for anything other than understanding the meaning + * of the raw bits from a varlena; in particular, if the goal is to identify + * a compression method, use the constants TOAST_PGLZ_COMPRESSION, etc. + * below. We might someday support more than 4 compression methods, but + * we can never have more than 4 values in this enum, because there are + * only 2 bits available in the places where this is stored. + */ +typedef enum ToastCompressionId +{ + TOAST_PGLZ_COMPRESSION_ID = 0, + TOAST_LZ4_COMPRESSION_ID = 1, + TOAST_INVALID_COMPRESSION_ID = 2, +} ToastCompressionId; + +/* + * Built-in compression methods. pg_attribute will store these in the + * attcompression column. In attcompression, InvalidCompressionMethod + * denotes the default behavior. + */ +#define TOAST_PGLZ_COMPRESSION 'p' +#define TOAST_LZ4_COMPRESSION 'l' +#define InvalidCompressionMethod '\0' + +#define CompressionMethodIsValid(cm) ((cm) != InvalidCompressionMethod) + + +/* pglz compression/decompression routines */ +extern struct varlena *pglz_compress_datum(const struct varlena *value); +extern struct varlena *pglz_decompress_datum(const struct varlena *value); +extern struct varlena *pglz_decompress_datum_slice(const struct varlena *value, + int32 slicelength); + +/* lz4 compression/decompression routines */ +extern struct varlena *lz4_compress_datum(const struct varlena *value); +extern struct varlena *lz4_decompress_datum(const struct varlena *value); +extern struct varlena *lz4_decompress_datum_slice(const struct varlena *value, + int32 slicelength); + +/* other stuff */ +extern ToastCompressionId toast_get_compression_id(struct varlena *attr); +extern char CompressionNameToMethod(const char *compression); +extern const char *GetCompressionMethodName(char method); + +#endif /* TOAST_COMPRESSION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/toast_helper.h b/platform/dbops/binaries/postgres/include/server/access/toast_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..349a513f77dd5c44296a177bac9e6d4723316145 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/toast_helper.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * toast_helper.h + * Helper functions for table AMs implementing compressed or + * out-of-line storage of varlena attributes. + * + * Copyright (c) 2000-2024, PostgreSQL Global Development Group + * + * src/include/access/toast_helper.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TOAST_HELPER_H +#define TOAST_HELPER_H + +#include "utils/rel.h" + +/* + * Information about one column of a tuple being toasted. + * + * NOTE: toast_action[i] can have these values: + * ' ' default handling + * TYPSTORAGE_PLAIN already processed --- don't touch it + * TYPSTORAGE_EXTENDED incompressible, but OK to move off + * + * NOTE: toast_attr[i].tai_size is only made valid for varlena attributes with + * toast_action[i] different from TYPSTORAGE_PLAIN. + */ +typedef struct +{ + struct varlena *tai_oldexternal; + int32 tai_size; + uint8 tai_colflags; + char tai_compression; +} ToastAttrInfo; + +/* + * Information about one tuple being toasted. + */ +typedef struct +{ + /* + * Before calling toast_tuple_init, the caller must initialize the + * following fields. Each array must have a length equal to + * ttc_rel->rd_att->natts. The ttc_oldvalues and ttc_oldisnull fields + * should be NULL in the case of an insert. + */ + Relation ttc_rel; /* the relation that contains the tuple */ + Datum *ttc_values; /* values from the tuple columns */ + bool *ttc_isnull; /* null flags for the tuple columns */ + Datum *ttc_oldvalues; /* values from previous tuple */ + bool *ttc_oldisnull; /* null flags from previous tuple */ + + /* + * Before calling toast_tuple_init, the caller should set ttc_attr to + * point to an array of ToastAttrInfo structures of a length equal to + * ttc_rel->rd_att->natts. The contents of the array need not be + * initialized. ttc_flags also does not need to be initialized. + */ + uint8 ttc_flags; + ToastAttrInfo *ttc_attr; +} ToastTupleContext; + +/* + * Flags indicating the overall state of a TOAST operation. + * + * TOAST_NEEDS_DELETE_OLD indicates that one or more old TOAST datums need + * to be deleted. + * + * TOAST_NEEDS_FREE indicates that one or more TOAST values need to be freed. + * + * TOAST_HAS_NULLS indicates that nulls were found in the tuple being toasted. + * + * TOAST_NEEDS_CHANGE indicates that a new tuple needs to built; in other + * words, the toaster did something. + */ +#define TOAST_NEEDS_DELETE_OLD 0x0001 +#define TOAST_NEEDS_FREE 0x0002 +#define TOAST_HAS_NULLS 0x0004 +#define TOAST_NEEDS_CHANGE 0x0008 + +/* + * Flags indicating the status of a TOAST operation with respect to a + * particular column. + * + * TOASTCOL_NEEDS_DELETE_OLD indicates that the old TOAST datums for this + * column need to be deleted. + * + * TOASTCOL_NEEDS_FREE indicates that the value for this column needs to + * be freed. + * + * TOASTCOL_IGNORE indicates that the toaster should not further process + * this column. + * + * TOASTCOL_INCOMPRESSIBLE indicates that this column has been found to + * be incompressible, but could be moved out-of-line. + */ +#define TOASTCOL_NEEDS_DELETE_OLD TOAST_NEEDS_DELETE_OLD +#define TOASTCOL_NEEDS_FREE TOAST_NEEDS_FREE +#define TOASTCOL_IGNORE 0x0010 +#define TOASTCOL_INCOMPRESSIBLE 0x0020 + +extern void toast_tuple_init(ToastTupleContext *ttc); +extern int toast_tuple_find_biggest_attribute(ToastTupleContext *ttc, + bool for_compression, + bool check_main); +extern void toast_tuple_try_compression(ToastTupleContext *ttc, int attribute); +extern void toast_tuple_externalize(ToastTupleContext *ttc, int attribute, + int options); +extern void toast_tuple_cleanup(ToastTupleContext *ttc); + +extern void toast_delete_external(Relation rel, const Datum *values, const bool *isnull, + bool is_speculative); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/access/toast_internals.h b/platform/dbops/binaries/postgres/include/server/access/toast_internals.h new file mode 100644 index 0000000000000000000000000000000000000000..0eeefe59fec08641a927245616907aa918ac1594 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/toast_internals.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * toast_internals.h + * Internal definitions for the TOAST system. + * + * Copyright (c) 2000-2024, PostgreSQL Global Development Group + * + * src/include/access/toast_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef TOAST_INTERNALS_H +#define TOAST_INTERNALS_H + +#include "access/toast_compression.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* + * The information at the start of the compressed toast data. + */ +typedef struct toast_compress_header +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 tcinfo; /* 2 bits for compression method and 30 bits + * external size; see va_extinfo */ +} toast_compress_header; + +/* + * Utilities for manipulation of header information for compressed + * toast entries. + */ +#define TOAST_COMPRESS_EXTSIZE(ptr) \ + (((toast_compress_header *) (ptr))->tcinfo & VARLENA_EXTSIZE_MASK) +#define TOAST_COMPRESS_METHOD(ptr) \ + (((toast_compress_header *) (ptr))->tcinfo >> VARLENA_EXTSIZE_BITS) + +#define TOAST_COMPRESS_SET_SIZE_AND_COMPRESS_METHOD(ptr, len, cm_method) \ + do { \ + Assert((len) > 0 && (len) <= VARLENA_EXTSIZE_MASK); \ + Assert((cm_method) == TOAST_PGLZ_COMPRESSION_ID || \ + (cm_method) == TOAST_LZ4_COMPRESSION_ID); \ + ((toast_compress_header *) (ptr))->tcinfo = \ + (len) | ((uint32) (cm_method) << VARLENA_EXTSIZE_BITS); \ + } while (0) + +extern Datum toast_compress_datum(Datum value, char cmethod); +extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock); + +extern void toast_delete_datum(Relation rel, Datum value, bool is_speculative); +extern Datum toast_save_datum(Relation rel, Datum value, + struct varlena *oldexternal, int options); + +extern int toast_open_indexes(Relation toastrel, + LOCKMODE lock, + Relation **toastidxs, + int *num_indexes); +extern void toast_close_indexes(Relation *toastidxs, int num_indexes, + LOCKMODE lock); +extern void init_toast_snapshot(Snapshot toast_snapshot); + +#endif /* TOAST_INTERNALS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/transam.h b/platform/dbops/binaries/postgres/include/server/access/transam.h new file mode 100644 index 0000000000000000000000000000000000000000..07b9be6cdfcbdfe00e4c19f4c066f43a00c57cef --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/transam.h @@ -0,0 +1,418 @@ +/*------------------------------------------------------------------------- + * + * transam.h + * postgres transaction access method support code + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/transam.h + * + *------------------------------------------------------------------------- + */ +#ifndef TRANSAM_H +#define TRANSAM_H + +#include "access/xlogdefs.h" + + +/* ---------------- + * Special transaction ID values + * + * BootstrapTransactionId is the XID for "bootstrap" operations, and + * FrozenTransactionId is used for very old tuples. Both should + * always be considered valid. + * + * FirstNormalTransactionId is the first "normal" transaction id. + * Note: if you need to change it, you must change pg_class.h as well. + * ---------------- + */ +#define InvalidTransactionId ((TransactionId) 0) +#define BootstrapTransactionId ((TransactionId) 1) +#define FrozenTransactionId ((TransactionId) 2) +#define FirstNormalTransactionId ((TransactionId) 3) +#define MaxTransactionId ((TransactionId) 0xFFFFFFFF) + +/* ---------------- + * transaction ID manipulation macros + * ---------------- + */ +#define TransactionIdIsValid(xid) ((xid) != InvalidTransactionId) +#define TransactionIdIsNormal(xid) ((xid) >= FirstNormalTransactionId) +#define TransactionIdEquals(id1, id2) ((id1) == (id2)) +#define TransactionIdStore(xid, dest) (*(dest) = (xid)) +#define StoreInvalidTransactionId(dest) (*(dest) = InvalidTransactionId) + +#define EpochFromFullTransactionId(x) ((uint32) ((x).value >> 32)) +#define XidFromFullTransactionId(x) ((uint32) (x).value) +#define U64FromFullTransactionId(x) ((x).value) +#define FullTransactionIdEquals(a, b) ((a).value == (b).value) +#define FullTransactionIdPrecedes(a, b) ((a).value < (b).value) +#define FullTransactionIdPrecedesOrEquals(a, b) ((a).value <= (b).value) +#define FullTransactionIdFollows(a, b) ((a).value > (b).value) +#define FullTransactionIdFollowsOrEquals(a, b) ((a).value >= (b).value) +#define FullTransactionIdIsValid(x) TransactionIdIsValid(XidFromFullTransactionId(x)) +#define InvalidFullTransactionId FullTransactionIdFromEpochAndXid(0, InvalidTransactionId) +#define FirstNormalFullTransactionId FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId) +#define FullTransactionIdIsNormal(x) FullTransactionIdFollowsOrEquals(x, FirstNormalFullTransactionId) + +/* + * A 64 bit value that contains an epoch and a TransactionId. This is + * wrapped in a struct to prevent implicit conversion to/from TransactionId. + * Not all values represent valid normal XIDs. + */ +typedef struct FullTransactionId +{ + uint64 value; +} FullTransactionId; + +static inline FullTransactionId +FullTransactionIdFromEpochAndXid(uint32 epoch, TransactionId xid) +{ + FullTransactionId result; + + result.value = ((uint64) epoch) << 32 | xid; + + return result; +} + +static inline FullTransactionId +FullTransactionIdFromU64(uint64 value) +{ + FullTransactionId result; + + result.value = value; + + return result; +} + +/* advance a transaction ID variable, handling wraparound correctly */ +#define TransactionIdAdvance(dest) \ + do { \ + (dest)++; \ + if ((dest) < FirstNormalTransactionId) \ + (dest) = FirstNormalTransactionId; \ + } while(0) + +/* + * Retreat a FullTransactionId variable, stepping over xids that would appear + * to be special only when viewed as 32bit XIDs. + */ +static inline void +FullTransactionIdRetreat(FullTransactionId *dest) +{ + dest->value--; + + /* + * In contrast to 32bit XIDs don't step over the "actual" special xids. + * For 64bit xids these can't be reached as part of a wraparound as they + * can in the 32bit case. + */ + if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) + return; + + /* + * But we do need to step over XIDs that'd appear special only for 32bit + * XIDs. + */ + while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) + dest->value--; +} + +/* + * Advance a FullTransactionId variable, stepping over xids that would appear + * to be special only when viewed as 32bit XIDs. + */ +static inline void +FullTransactionIdAdvance(FullTransactionId *dest) +{ + dest->value++; + + /* see FullTransactionIdAdvance() */ + if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) + return; + + while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) + dest->value++; +} + +/* back up a transaction ID variable, handling wraparound correctly */ +#define TransactionIdRetreat(dest) \ + do { \ + (dest)--; \ + } while ((dest) < FirstNormalTransactionId) + +/* compare two XIDs already known to be normal; this is a macro for speed */ +#define NormalTransactionIdPrecedes(id1, id2) \ + (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ + (int32) ((id1) - (id2)) < 0) + +/* compare two XIDs already known to be normal; this is a macro for speed */ +#define NormalTransactionIdFollows(id1, id2) \ + (AssertMacro(TransactionIdIsNormal(id1) && TransactionIdIsNormal(id2)), \ + (int32) ((id1) - (id2)) > 0) + +/* ---------- + * Object ID (OID) zero is InvalidOid. + * + * OIDs 1-9999 are reserved for manual assignment (see .dat files in + * src/include/catalog/). Of these, 8000-9999 are reserved for + * development purposes (such as in-progress patches and forks); + * they should not appear in released versions. + * + * OIDs 10000-11999 are reserved for assignment by genbki.pl, for use + * when the .dat files in src/include/catalog/ do not specify an OID + * for a catalog entry that requires one. Note that genbki.pl assigns + * these OIDs independently in each catalog, so they're not guaranteed + * to be globally unique. Furthermore, the bootstrap backend and + * initdb's post-bootstrap processing can also assign OIDs in this range. + * The normal OID-generation logic takes care of any OID conflicts that + * might arise from that. + * + * OIDs 12000-16383 are reserved for unpinned objects created by initdb's + * post-bootstrap processing. initdb forces the OID generator up to + * 12000 as soon as it's made the pinned objects it's responsible for. + * + * OIDs beginning at 16384 are assigned from the OID generator + * during normal multiuser operation. (We force the generator up to + * 16384 as soon as we are in normal operation.) + * + * The choices of 8000, 10000 and 12000 are completely arbitrary, and can be + * moved if we run low on OIDs in any category. Changing the macros below, + * and updating relevant documentation (see bki.sgml and RELEASE_CHANGES), + * should be sufficient to do this. Moving the 16384 boundary between + * initdb-assigned OIDs and user-defined objects would be substantially + * more painful, however, since some user-defined OIDs will appear in + * on-disk data; such a change would probably break pg_upgrade. + * + * NOTE: if the OID generator wraps around, we skip over OIDs 0-16383 + * and resume with 16384. This minimizes the odds of OID conflict, by not + * reassigning OIDs that might have been assigned during initdb. Critically, + * it also ensures that no user-created object will be considered pinned. + * ---------- + */ +#define FirstGenbkiObjectId 10000 +#define FirstUnpinnedObjectId 12000 +#define FirstNormalObjectId 16384 + +/* + * TransamVariables is a data structure in shared memory that is used to track + * OID and XID assignment state. For largely historical reasons, there is + * just one struct with different fields that are protected by different + * LWLocks. + * + * Note: xidWrapLimit and oldestXidDB are not "active" values, but are + * used just to generate useful messages when xidWarnLimit or xidStopLimit + * are exceeded. + */ +typedef struct TransamVariablesData +{ + /* + * These fields are protected by OidGenLock. + */ + Oid nextOid; /* next OID to assign */ + uint32 oidCount; /* OIDs available before must do XLOG work */ + + /* + * These fields are protected by XidGenLock. + */ + FullTransactionId nextXid; /* next XID to assign */ + + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + TransactionId xidVacLimit; /* start forcing autovacuums here */ + TransactionId xidWarnLimit; /* start complaining here */ + TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */ + TransactionId xidWrapLimit; /* where the world ends */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + + /* + * These fields are protected by CommitTsLock + */ + TransactionId oldestCommitTsXid; + TransactionId newestCommitTsXid; + + /* + * These fields are protected by ProcArrayLock. + */ + FullTransactionId latestCompletedXid; /* newest full XID that has + * committed or aborted */ + + /* + * Number of top-level transactions with xids (i.e. which may have + * modified the database) that completed in some form since the start of + * the server. This currently is solely used to check whether + * GetSnapshotData() needs to recompute the contents of the snapshot, or + * not. There are likely other users of this. Always above 1. + */ + uint64 xactCompletionCount; + + /* + * These fields are protected by XactTruncationLock + */ + TransactionId oldestClogXid; /* oldest it's safe to look up in clog */ + +} TransamVariablesData; + + +/* ---------------- + * extern declarations + * ---------------- + */ + +/* in transam/xact.c */ +extern bool TransactionStartedDuringRecovery(void); + +/* in transam/varsup.c */ +extern PGDLLIMPORT TransamVariablesData *TransamVariables; + +/* + * prototypes for functions in transam/transam.c + */ +extern bool TransactionIdDidCommit(TransactionId transactionId); +extern bool TransactionIdDidAbort(TransactionId transactionId); +extern void TransactionIdCommitTree(TransactionId xid, int nxids, TransactionId *xids); +extern void TransactionIdAsyncCommitTree(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn); +extern void TransactionIdAbortTree(TransactionId xid, int nxids, TransactionId *xids); +extern bool TransactionIdPrecedes(TransactionId id1, TransactionId id2); +extern bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollows(TransactionId id1, TransactionId id2); +extern bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2); +extern TransactionId TransactionIdLatest(TransactionId mainxid, + int nxids, const TransactionId *xids); +extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid); + +/* in transam/varsup.c */ +extern Size VarsupShmemSize(void); +extern void VarsupShmemInit(void); +extern FullTransactionId GetNewTransactionId(bool isSubXact); +extern void AdvanceNextFullTransactionIdPastXid(TransactionId xid); +extern FullTransactionId ReadNextFullTransactionId(void); +extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid, + Oid oldest_datoid); +extern void AdvanceOldestClogXid(TransactionId oldest_datfrozenxid); +extern bool ForceTransactionIdLimitUpdate(void); +extern Oid GetNewObjectId(void); +extern void StopGeneratingPinnedObjectIds(void); + +#ifdef USE_ASSERT_CHECKING +extern void AssertTransactionIdInAllowableRange(TransactionId xid); +#else +#define AssertTransactionIdInAllowableRange(xid) ((void)true) +#endif + +/* + * Some frontend programs include this header. For compilers that emit static + * inline functions even when they're unused, that leads to unsatisfied + * external references; hence hide them with #ifndef FRONTEND. + */ +#ifndef FRONTEND + +/* + * For callers that just need the XID part of the next transaction ID. + */ +static inline TransactionId +ReadNextTransactionId(void) +{ + return XidFromFullTransactionId(ReadNextFullTransactionId()); +} + +/* return transaction ID backed up by amount, handling wraparound correctly */ +static inline TransactionId +TransactionIdRetreatedBy(TransactionId xid, uint32 amount) +{ + xid -= amount; + + while (xid < FirstNormalTransactionId) + xid--; + + return xid; +} + +/* return the older of the two IDs */ +static inline TransactionId +TransactionIdOlder(TransactionId a, TransactionId b) +{ + if (!TransactionIdIsValid(a)) + return b; + + if (!TransactionIdIsValid(b)) + return a; + + if (TransactionIdPrecedes(a, b)) + return a; + return b; +} + +/* return the older of the two IDs, assuming they're both normal */ +static inline TransactionId +NormalTransactionIdOlder(TransactionId a, TransactionId b) +{ + Assert(TransactionIdIsNormal(a)); + Assert(TransactionIdIsNormal(b)); + if (NormalTransactionIdPrecedes(a, b)) + return a; + return b; +} + +/* return the newer of the two IDs */ +static inline FullTransactionId +FullTransactionIdNewer(FullTransactionId a, FullTransactionId b) +{ + if (!FullTransactionIdIsValid(a)) + return b; + + if (!FullTransactionIdIsValid(b)) + return a; + + if (FullTransactionIdFollows(a, b)) + return a; + return b; +} + +/* + * Compute FullTransactionId for the given TransactionId, assuming xid was + * between [oldestXid, nextXid] at the time when TransamVariables->nextXid was + * nextFullXid. When adding calls, evaluate what prevents xid from preceding + * oldestXid if SetTransactionIdLimit() runs between the collection of xid and + * the collection of nextFullXid. + */ +static inline FullTransactionId +FullTransactionIdFromAllowableAt(FullTransactionId nextFullXid, + TransactionId xid) +{ + uint32 epoch; + + /* Special transaction ID. */ + if (!TransactionIdIsNormal(xid)) + return FullTransactionIdFromEpochAndXid(0, xid); + + Assert(TransactionIdPrecedesOrEquals(xid, + XidFromFullTransactionId(nextFullXid))); + + /* + * The 64 bit result must be <= nextFullXid, since nextFullXid hadn't been + * issued yet when xid was in the past. The xid must therefore be from + * the epoch of nextFullXid or the epoch before. We know this because we + * must remove (by freezing) an XID before assigning the XID half an epoch + * ahead of it. + * + * The unlikely() branch hint is dubious. It's perfect for the first 2^32 + * XIDs of a cluster's life. Right at 2^32 XIDs, misprediction shoots to + * 100%, then improves until perfection returns 2^31 XIDs later. Since + * current callers pass relatively-recent XIDs, expect >90% prediction + * accuracy overall. This favors average latency over tail latency. + */ + epoch = EpochFromFullTransactionId(nextFullXid); + if (unlikely(xid > XidFromFullTransactionId(nextFullXid))) + { + Assert(epoch != 0); + epoch--; + } + + return FullTransactionIdFromEpochAndXid(epoch, xid); +} + +#endif /* FRONTEND */ + +#endif /* TRANSAM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tsmapi.h b/platform/dbops/binaries/postgres/include/server/access/tsmapi.h new file mode 100644 index 0000000000000000000000000000000000000000..da9a6c38cd9ad378c58b2cb82f0d2dc858e4c91c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tsmapi.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * tsmapi.h + * API for tablesample methods + * + * Copyright (c) 2015-2024, PostgreSQL Global Development Group + * + * src/include/access/tsmapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef TSMAPI_H +#define TSMAPI_H + +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" + + +/* + * Callback function signatures --- see tablesample-method.sgml for more info. + */ + +typedef void (*SampleScanGetSampleSize_function) (PlannerInfo *root, + RelOptInfo *baserel, + List *paramexprs, + BlockNumber *pages, + double *tuples); + +typedef void (*InitSampleScan_function) (SampleScanState *node, + int eflags); + +typedef void (*BeginSampleScan_function) (SampleScanState *node, + Datum *params, + int nparams, + uint32 seed); + +typedef BlockNumber (*NextSampleBlock_function) (SampleScanState *node, + BlockNumber nblocks); + +typedef OffsetNumber (*NextSampleTuple_function) (SampleScanState *node, + BlockNumber blockno, + OffsetNumber maxoffset); + +typedef void (*EndSampleScan_function) (SampleScanState *node); + +/* + * TsmRoutine is the struct returned by a tablesample method's handler + * function. It provides pointers to the callback functions needed by the + * planner and executor, as well as additional information about the method. + * + * More function pointers are likely to be added in the future. + * Therefore it's recommended that the handler initialize the struct with + * makeNode(TsmRoutine) so that all fields are set to NULL. This will + * ensure that no fields are accidentally left undefined. + */ +typedef struct TsmRoutine +{ + NodeTag type; + + /* List of datatype OIDs for the arguments of the TABLESAMPLE clause */ + List *parameterTypes; + + /* Can method produce repeatable samples across, or even within, queries? */ + bool repeatable_across_queries; + bool repeatable_across_scans; + + /* Functions for planning a SampleScan on a physical table */ + SampleScanGetSampleSize_function SampleScanGetSampleSize; + + /* Functions for executing a SampleScan on a physical table */ + InitSampleScan_function InitSampleScan; /* can be NULL */ + BeginSampleScan_function BeginSampleScan; + NextSampleBlock_function NextSampleBlock; /* can be NULL */ + NextSampleTuple_function NextSampleTuple; + EndSampleScan_function EndSampleScan; /* can be NULL */ +} TsmRoutine; + + +/* Functions in access/tablesample/tablesample.c */ +extern TsmRoutine *GetTsmRoutine(Oid tsmhandler); + +#endif /* TSMAPI_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tupconvert.h b/platform/dbops/binaries/postgres/include/server/access/tupconvert.h new file mode 100644 index 0000000000000000000000000000000000000000..62a6d127613c9a7c02320b12f0a8ee09d38aefb0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tupconvert.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * tupconvert.h + * Tuple conversion support. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupconvert.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPCONVERT_H +#define TUPCONVERT_H + +#include "access/attmap.h" +#include "access/htup.h" +#include "access/tupdesc.h" +#include "executor/tuptable.h" +#include "nodes/bitmapset.h" + + +typedef struct TupleConversionMap +{ + TupleDesc indesc; /* tupdesc for source rowtype */ + TupleDesc outdesc; /* tupdesc for result rowtype */ + AttrMap *attrMap; /* indexes of input fields, or 0 for null */ + Datum *invalues; /* workspace for deconstructing source */ + bool *inisnull; + Datum *outvalues; /* workspace for constructing result */ + bool *outisnull; +} TupleConversionMap; + + +extern TupleConversionMap *convert_tuples_by_position(TupleDesc indesc, + TupleDesc outdesc, + const char *msg); + +extern TupleConversionMap *convert_tuples_by_name(TupleDesc indesc, + TupleDesc outdesc); +extern TupleConversionMap *convert_tuples_by_name_attrmap(TupleDesc indesc, + TupleDesc outdesc, + AttrMap *attrMap); + +extern HeapTuple execute_attr_map_tuple(HeapTuple tuple, TupleConversionMap *map); +extern TupleTableSlot *execute_attr_map_slot(AttrMap *attrMap, + TupleTableSlot *in_slot, + TupleTableSlot *out_slot); +extern Bitmapset *execute_attr_map_cols(AttrMap *attrMap, Bitmapset *in_cols); + +extern void free_conversion_map(TupleConversionMap *map); + +#endif /* TUPCONVERT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tupdesc.h b/platform/dbops/binaries/postgres/include/server/access/tupdesc.h new file mode 100644 index 0000000000000000000000000000000000000000..8930a28d6602eaa37120b33b51549122a6357a1c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tupdesc.h @@ -0,0 +1,154 @@ +/*------------------------------------------------------------------------- + * + * tupdesc.h + * POSTGRES tuple descriptor definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupdesc.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPDESC_H +#define TUPDESC_H + +#include "access/attnum.h" +#include "catalog/pg_attribute.h" +#include "nodes/pg_list.h" + + +typedef struct AttrDefault +{ + AttrNumber adnum; + char *adbin; /* nodeToString representation of expr */ +} AttrDefault; + +typedef struct ConstrCheck +{ + char *ccname; + char *ccbin; /* nodeToString representation of expr */ + bool ccvalid; + bool ccnoinherit; /* this is a non-inheritable constraint */ +} ConstrCheck; + +/* This structure contains constraints of a tuple */ +typedef struct TupleConstr +{ + AttrDefault *defval; /* array */ + ConstrCheck *check; /* array */ + struct AttrMissing *missing; /* missing attributes values, NULL if none */ + uint16 num_defval; + uint16 num_check; + bool has_not_null; + bool has_generated_stored; +} TupleConstr; + +/* + * This struct is passed around within the backend to describe the structure + * of tuples. For tuples coming from on-disk relations, the information is + * collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs. + * Transient row types (such as the result of a join query) have anonymous + * TupleDesc structs that generally omit any constraint info; therefore the + * structure is designed to let the constraints be omitted efficiently. + * + * Note that only user attributes, not system attributes, are mentioned in + * TupleDesc. + * + * If the tupdesc is known to correspond to a named rowtype (such as a table's + * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise + * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous + * row type, or a value >= 0 to allow the rowtype to be looked up in the + * typcache.c type cache. + * + * Note that tdtypeid is never the OID of a domain over composite, even if + * we are dealing with values that are known (at some higher level) to be of + * a domain-over-composite type. This is because tdtypeid/tdtypmod need to + * match up with the type labeling of composite Datums, and those are never + * explicitly marked as being of a domain type, either. + * + * Tuple descriptors that live in caches (relcache or typcache, at present) + * are reference-counted: they can be deleted when their reference count goes + * to zero. Tuple descriptors created by the executor need no reference + * counting, however: they are simply created in the appropriate memory + * context and go away when the context is freed. We set the tdrefcount + * field of such a descriptor to -1, while reference-counted descriptors + * always have tdrefcount >= 0. + */ +typedef struct TupleDescData +{ + int natts; /* number of attributes in the tuple */ + Oid tdtypeid; /* composite type ID for tuple type */ + int32 tdtypmod; /* typmod for tuple type */ + int tdrefcount; /* reference count, or -1 if not counting */ + TupleConstr *constr; /* constraints, or NULL if none */ + /* attrs[N] is the description of Attribute Number N+1 */ + FormData_pg_attribute attrs[FLEXIBLE_ARRAY_MEMBER]; +} TupleDescData; +typedef struct TupleDescData *TupleDesc; + +/* Accessor for the i'th attribute of tupdesc. */ +#define TupleDescAttr(tupdesc, i) (&(tupdesc)->attrs[(i)]) + +extern TupleDesc CreateTemplateTupleDesc(int natts); + +extern TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs); + +extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc); + +extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc); + +#define TupleDescSize(src) \ + (offsetof(struct TupleDescData, attrs) + \ + (src)->natts * sizeof(FormData_pg_attribute)) + +extern void TupleDescCopy(TupleDesc dst, TupleDesc src); + +extern void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno, + TupleDesc src, AttrNumber srcAttno); + +extern void FreeTupleDesc(TupleDesc tupdesc); + +extern void IncrTupleDescRefCount(TupleDesc tupdesc); +extern void DecrTupleDescRefCount(TupleDesc tupdesc); + +#define PinTupleDesc(tupdesc) \ + do { \ + if ((tupdesc)->tdrefcount >= 0) \ + IncrTupleDescRefCount(tupdesc); \ + } while (0) + +#define ReleaseTupleDesc(tupdesc) \ + do { \ + if ((tupdesc)->tdrefcount >= 0) \ + DecrTupleDescRefCount(tupdesc); \ + } while (0) + +extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2); +extern bool equalRowTypes(TupleDesc tupdesc1, TupleDesc tupdesc2); +extern uint32 hashRowType(TupleDesc desc); + +extern void TupleDescInitEntry(TupleDesc desc, + AttrNumber attributeNumber, + const char *attributeName, + Oid oidtypeid, + int32 typmod, + int attdim); + +extern void TupleDescInitBuiltinEntry(TupleDesc desc, + AttrNumber attributeNumber, + const char *attributeName, + Oid oidtypeid, + int32 typmod, + int attdim); + +extern void TupleDescInitEntryCollation(TupleDesc desc, + AttrNumber attributeNumber, + Oid collationid); + +extern TupleDesc BuildDescFromLists(const List *names, const List *types, const List *typmods, const List *collations); + +extern Node *TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum); + +#endif /* TUPDESC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tupdesc_details.h b/platform/dbops/binaries/postgres/include/server/access/tupdesc_details.h new file mode 100644 index 0000000000000000000000000000000000000000..cc8ff5149a63c597e3afb9065e0cf8b26d39e393 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tupdesc_details.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * tupdesc_details.h + * POSTGRES tuple descriptor definitions we can't include everywhere + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupdesc_details.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TUPDESC_DETAILS_H +#define TUPDESC_DETAILS_H + +/* + * Structure used to represent value to be used when the attribute is not + * present at all in a tuple, i.e. when the column was created after the tuple + */ +typedef struct AttrMissing +{ + bool am_present; /* true if non-NULL missing value exists */ + Datum am_value; /* value when attribute is missing */ +} AttrMissing; + +#endif /* TUPDESC_DETAILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/tupmacs.h b/platform/dbops/binaries/postgres/include/server/access/tupmacs.h new file mode 100644 index 0000000000000000000000000000000000000000..58b3a58cfd06c064a2071609ca43ba1ea9eaf167 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/tupmacs.h @@ -0,0 +1,207 @@ +/*------------------------------------------------------------------------- + * + * tupmacs.h + * Tuple macros used by both index tuples and heap tuples. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/tupmacs.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPMACS_H +#define TUPMACS_H + +#include "catalog/pg_type_d.h" /* for TYPALIGN macros */ + + +/* + * Check a tuple's null bitmap to determine whether the attribute is null. + * Note that a 0 in the null bitmap indicates a null, while 1 indicates + * non-null. + */ +static inline bool +att_isnull(int ATT, const bits8 *BITS) +{ + return !(BITS[ATT >> 3] & (1 << (ATT & 0x07))); +} + +#ifndef FRONTEND +/* + * Given a Form_pg_attribute and a pointer into a tuple's data area, + * return the correct value or pointer. + * + * We return a Datum value in all cases. If the attribute has "byval" false, + * we return the same pointer into the tuple data area that we're passed. + * Otherwise, we return the correct number of bytes fetched from the data + * area and extended to Datum form. + * + * On machines where Datum is 8 bytes, we support fetching 8-byte byval + * attributes; otherwise, only 1, 2, and 4-byte values are supported. + * + * Note that T must already be properly aligned for this to work correctly. + */ +#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen) + +/* + * Same, but work from byval/len parameters rather than Form_pg_attribute. + */ +static inline Datum +fetch_att(const void *T, bool attbyval, int attlen) +{ + if (attbyval) + { + switch (attlen) + { + case sizeof(char): + return CharGetDatum(*((const char *) T)); + case sizeof(int16): + return Int16GetDatum(*((const int16 *) T)); + case sizeof(int32): + return Int32GetDatum(*((const int32 *) T)); +#if SIZEOF_DATUM == 8 + case sizeof(Datum): + return *((const Datum *) T); +#endif + default: + elog(ERROR, "unsupported byval length: %d", attlen); + return 0; + } + } + else + return PointerGetDatum(T); +} +#endif /* FRONTEND */ + +/* + * att_align_datum aligns the given offset as needed for a datum of alignment + * requirement attalign and typlen attlen. attdatum is the Datum variable + * we intend to pack into a tuple (it's only accessed if we are dealing with + * a varlena type). Note that this assumes the Datum will be stored as-is; + * callers that are intending to convert non-short varlena datums to short + * format have to account for that themselves. + */ +#define att_align_datum(cur_offset, attalign, attlen, attdatum) \ +( \ + ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \ + (uintptr_t) (cur_offset) : \ + att_align_nominal(cur_offset, attalign) \ +) + +/* + * att_align_pointer performs the same calculation as att_align_datum, + * but is used when walking a tuple. attptr is the current actual data + * pointer; when accessing a varlena field we have to "peek" to see if we + * are looking at a pad byte or the first byte of a 1-byte-header datum. + * (A zero byte must be either a pad byte, or the first byte of a correctly + * aligned 4-byte length word; in either case we can align safely. A non-zero + * byte must be either a 1-byte length word, or the first byte of a correctly + * aligned 4-byte length word; in either case we need not align.) + * + * Note: some callers pass a "char *" pointer for cur_offset. This is + * a bit of a hack but should work all right as long as uintptr_t is the + * correct width. + */ +#define att_align_pointer(cur_offset, attalign, attlen, attptr) \ +( \ + ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \ + (uintptr_t) (cur_offset) : \ + att_align_nominal(cur_offset, attalign) \ +) + +/* + * att_align_nominal aligns the given offset as needed for a datum of alignment + * requirement attalign, ignoring any consideration of packed varlena datums. + * There are three main use cases for using this macro directly: + * * we know that the att in question is not varlena (attlen != -1); + * in this case it is cheaper than the above macros and just as good. + * * we need to estimate alignment padding cost abstractly, ie without + * reference to a real tuple. We must assume the worst case that + * all varlenas are aligned. + * * within arrays and multiranges, we unconditionally align varlenas (XXX this + * should be revisited, probably). + * + * The attalign cases are tested in what is hopefully something like their + * frequency of occurrence. + */ +#define att_align_nominal(cur_offset, attalign) \ +( \ + ((attalign) == TYPALIGN_INT) ? INTALIGN(cur_offset) : \ + (((attalign) == TYPALIGN_CHAR) ? (uintptr_t) (cur_offset) : \ + (((attalign) == TYPALIGN_DOUBLE) ? DOUBLEALIGN(cur_offset) : \ + ( \ + AssertMacro((attalign) == TYPALIGN_SHORT), \ + SHORTALIGN(cur_offset) \ + ))) \ +) + +/* + * att_addlength_datum increments the given offset by the space needed for + * the given Datum variable. attdatum is only accessed if we are dealing + * with a variable-length attribute. + */ +#define att_addlength_datum(cur_offset, attlen, attdatum) \ + att_addlength_pointer(cur_offset, attlen, DatumGetPointer(attdatum)) + +/* + * att_addlength_pointer performs the same calculation as att_addlength_datum, + * but is used when walking a tuple --- attptr is the pointer to the field + * within the tuple. + * + * Note: some callers pass a "char *" pointer for cur_offset. This is + * actually perfectly OK, but probably should be cleaned up along with + * the same practice for att_align_pointer. + */ +#define att_addlength_pointer(cur_offset, attlen, attptr) \ +( \ + ((attlen) > 0) ? \ + ( \ + (cur_offset) + (attlen) \ + ) \ + : (((attlen) == -1) ? \ + ( \ + (cur_offset) + VARSIZE_ANY(attptr) \ + ) \ + : \ + ( \ + AssertMacro((attlen) == -2), \ + (cur_offset) + (strlen((char *) (attptr)) + 1) \ + )) \ +) + +#ifndef FRONTEND +/* + * store_att_byval is a partial inverse of fetch_att: store a given Datum + * value into a tuple data area at the specified address. However, it only + * handles the byval case, because in typical usage the caller needs to + * distinguish by-val and by-ref cases anyway, and so a do-it-all function + * wouldn't be convenient. + */ +static inline void +store_att_byval(void *T, Datum newdatum, int attlen) +{ + switch (attlen) + { + case sizeof(char): + *(char *) T = DatumGetChar(newdatum); + break; + case sizeof(int16): + *(int16 *) T = DatumGetInt16(newdatum); + break; + case sizeof(int32): + *(int32 *) T = DatumGetInt32(newdatum); + break; +#if SIZEOF_DATUM == 8 + case sizeof(Datum): + *(Datum *) T = newdatum; + break; +#endif + default: + elog(ERROR, "unsupported byval length: %d", attlen); + } +} +#endif /* FRONTEND */ + +#endif /* TUPMACS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/twophase.h b/platform/dbops/binaries/postgres/include/server/access/twophase.h new file mode 100644 index 0000000000000000000000000000000000000000..56248c0006317d38a45f664557e4a00774badcf0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/twophase.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * twophase.h + * Two-phase-commit related declarations. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/twophase.h + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_H +#define TWOPHASE_H + +#include "access/xact.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "storage/lock.h" + +/* + * GlobalTransactionData is defined in twophase.c; other places have no + * business knowing the internal definition. + */ +typedef struct GlobalTransactionData *GlobalTransaction; + +/* GUC variable */ +extern PGDLLIMPORT int max_prepared_xacts; + +extern Size TwoPhaseShmemSize(void); +extern void TwoPhaseShmemInit(void); + +extern void AtAbort_Twophase(void); +extern void PostPrepare_Twophase(void); + +extern TransactionId TwoPhaseGetXidByVirtualXID(VirtualTransactionId vxid, + bool *have_more); +extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid, bool lock_held); +extern int TwoPhaseGetDummyProcNumber(TransactionId xid, bool lock_held); + +extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, + TimestampTz prepared_at, + Oid owner, Oid databaseid); + +extern void StartPrepare(GlobalTransaction gxact); +extern void EndPrepare(GlobalTransaction gxact); +extern bool StandbyTransactionIdIsPrepared(TransactionId xid); + +extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p, + int *nxids_p); +extern void StandbyRecoverPreparedTransactions(void); +extern void RecoverPreparedTransactions(void); + +extern void CheckPointTwoPhase(XLogRecPtr redo_horizon); + +extern void FinishPreparedTransaction(const char *gid, bool isCommit); + +extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn, + XLogRecPtr end_lsn, RepOriginId origin_id); +extern void PrepareRedoRemove(TransactionId xid, bool giveWarning); +extern void restoreTwoPhaseData(void); +extern bool LookupGXact(const char *gid, XLogRecPtr prepare_end_lsn, + TimestampTz origin_prepare_timestamp); +#endif /* TWOPHASE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/twophase_rmgr.h b/platform/dbops/binaries/postgres/include/server/access/twophase_rmgr.h new file mode 100644 index 0000000000000000000000000000000000000000..bdd2cb7b3399851ae277528a2fbf34d12b6e436e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/twophase_rmgr.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * twophase_rmgr.h + * Two-phase-commit resource managers definition + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/twophase_rmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef TWOPHASE_RMGR_H +#define TWOPHASE_RMGR_H + +typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info, + void *recdata, uint32 len); +typedef uint8 TwoPhaseRmgrId; + +/* + * Built-in resource managers + */ +#define TWOPHASE_RM_END_ID 0 +#define TWOPHASE_RM_LOCK_ID 1 +#define TWOPHASE_RM_PGSTAT_ID 2 +#define TWOPHASE_RM_MULTIXACT_ID 3 +#define TWOPHASE_RM_PREDICATELOCK_ID 4 +#define TWOPHASE_RM_MAX_ID TWOPHASE_RM_PREDICATELOCK_ID + +extern PGDLLIMPORT const TwoPhaseCallback twophase_recover_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_postcommit_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_postabort_callbacks[]; +extern PGDLLIMPORT const TwoPhaseCallback twophase_standby_recover_callbacks[]; + + +extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, + const void *data, uint32 len); + +#endif /* TWOPHASE_RMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/valid.h b/platform/dbops/binaries/postgres/include/server/access/valid.h new file mode 100644 index 0000000000000000000000000000000000000000..78c5f023ac420d3e03a6c0218a28e55aeb5c29dd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/valid.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * valid.h + * POSTGRES tuple qualification validity definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/valid.h + * + *------------------------------------------------------------------------- + */ +#ifndef VALID_H +#define VALID_H + +#include "access/htup.h" +#include "access/htup_details.h" +#include "access/skey.h" +#include "access/tupdesc.h" + +/* + * HeapKeyTest + * + * Test a heap tuple to see if it satisfies a scan key. + */ +static inline bool +HeapKeyTest(HeapTuple tuple, TupleDesc tupdesc, int nkeys, ScanKey keys) +{ + int cur_nkeys = nkeys; + ScanKey cur_key = keys; + + for (; cur_nkeys--; cur_key++) + { + Datum atp; + bool isnull; + Datum test; + + if (cur_key->sk_flags & SK_ISNULL) + return false; + + atp = heap_getattr(tuple, cur_key->sk_attno, tupdesc, &isnull); + + if (isnull) + return false; + + test = FunctionCall2Coll(&cur_key->sk_func, + cur_key->sk_collation, + atp, cur_key->sk_argument); + + if (!DatumGetBool(test)) + return false; + } + + return true; +} + +#endif /* VALID_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/visibilitymap.h b/platform/dbops/binaries/postgres/include/server/access/visibilitymap.h new file mode 100644 index 0000000000000000000000000000000000000000..1a4d467e6f02fce0f857c22f586f6e3207233518 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/visibilitymap.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * visibilitymap.h + * visibility map interface + * + * + * Portions Copyright (c) 2007-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/visibilitymap.h + * + *------------------------------------------------------------------------- + */ +#ifndef VISIBILITYMAP_H +#define VISIBILITYMAP_H + +#include "access/visibilitymapdefs.h" +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "utils/relcache.h" + +/* Macros for visibilitymap test */ +#define VM_ALL_VISIBLE(r, b, v) \ + ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_VISIBLE) != 0) +#define VM_ALL_FROZEN(r, b, v) \ + ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_FROZEN) != 0) + +extern bool visibilitymap_clear(Relation rel, BlockNumber heapBlk, + Buffer vmbuf, uint8 flags); +extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk, + Buffer *vmbuf); +extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf); +extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, + XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid, + uint8 flags); +extern uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); +extern void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen); +extern BlockNumber visibilitymap_prepare_truncate(Relation rel, + BlockNumber nheapblocks); + +#endif /* VISIBILITYMAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/visibilitymapdefs.h b/platform/dbops/binaries/postgres/include/server/access/visibilitymapdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..472200f29d025c6ec2a826b113277d6cbc6124b7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/visibilitymapdefs.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * visibilitymapdefs.h + * macros for accessing contents of visibility map pages + * + * + * Copyright (c) 2021-2024, PostgreSQL Global Development Group + * + * src/include/access/visibilitymapdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef VISIBILITYMAPDEFS_H +#define VISIBILITYMAPDEFS_H + +/* Number of bits for one heap page */ +#define BITS_PER_HEAPBLOCK 2 + +/* Flags for bit map */ +#define VISIBILITYMAP_ALL_VISIBLE 0x01 +#define VISIBILITYMAP_ALL_FROZEN 0x02 +#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid visibilitymap + * flags bits */ +/* + * To detect recovery conflicts during logical decoding on a standby, we need + * to know if a table is a user catalog table. For that we add an additional + * bit into xl_heap_visible.flags, in addition to the above. + * + * NB: VISIBILITYMAP_XLOG_* may not be passed to visibilitymap_set(). + */ +#define VISIBILITYMAP_XLOG_CATALOG_REL 0x04 +#define VISIBILITYMAP_XLOG_VALID_BITS (VISIBILITYMAP_VALID_BITS | VISIBILITYMAP_XLOG_CATALOG_REL) + +#endif /* VISIBILITYMAPDEFS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xact.h b/platform/dbops/binaries/postgres/include/server/access/xact.h new file mode 100644 index 0000000000000000000000000000000000000000..6d4439f0524ee8fad7160b4d672b0eb198643e18 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xact.h @@ -0,0 +1,530 @@ +/*------------------------------------------------------------------------- + * + * xact.h + * postgres transaction system definitions + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xact.h + * + *------------------------------------------------------------------------- + */ +#ifndef XACT_H +#define XACT_H + +#include "access/transam.h" +#include "access/xlogreader.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" +#include "storage/relfilelocator.h" +#include "storage/sinval.h" + +/* + * Maximum size of Global Transaction ID (including '\0'). + * + * Note that the max value of GIDSIZE must fit in the uint16 gidlen, + * specified in TwoPhaseFileHeader. + */ +#define GIDSIZE 200 + +/* + * Xact isolation levels + */ +#define XACT_READ_UNCOMMITTED 0 +#define XACT_READ_COMMITTED 1 +#define XACT_REPEATABLE_READ 2 +#define XACT_SERIALIZABLE 3 + +extern PGDLLIMPORT int DefaultXactIsoLevel; +extern PGDLLIMPORT int XactIsoLevel; + +/* + * We implement three isolation levels internally. + * The two stronger ones use one snapshot per database transaction; + * the others use one snapshot per statement. + * Serializable uses predicate locks in addition to snapshots. + * These macros should be used to check which isolation level is selected. + */ +#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ) +#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE) + +/* Xact read-only state */ +extern PGDLLIMPORT bool DefaultXactReadOnly; +extern PGDLLIMPORT bool XactReadOnly; + +/* flag for logging statements in this transaction */ +extern PGDLLIMPORT bool xact_is_sampled; + +/* + * Xact is deferrable -- only meaningful (currently) for read only + * SERIALIZABLE transactions + */ +extern PGDLLIMPORT bool DefaultXactDeferrable; +extern PGDLLIMPORT bool XactDeferrable; + +typedef enum +{ + SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */ + SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */ + SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote + * write */ + SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */ + SYNCHRONOUS_COMMIT_REMOTE_APPLY, /* wait for local and remote flush and + * remote apply */ +} SyncCommitLevel; + +/* Define the default setting for synchronous_commit */ +#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH + +/* Synchronous commit level */ +extern PGDLLIMPORT int synchronous_commit; + +/* used during logical streaming of a transaction */ +extern PGDLLIMPORT TransactionId CheckXidAlive; +extern PGDLLIMPORT bool bsysscan; + +/* + * Miscellaneous flag bits to record events which occur on the top level + * transaction. These flags are only persisted in MyXactFlags and are intended + * so we remember to do certain things later in the transaction. This is + * globally accessible, so can be set from anywhere in the code which requires + * recording flags. + */ +extern PGDLLIMPORT int MyXactFlags; + +/* + * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed. + * We don't allow PREPARE TRANSACTION in that case. + */ +#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 0) + +/* + * XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK - records whether the top level xact + * logged any Access Exclusive Locks. + */ +#define XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK (1U << 1) + +/* + * XACT_FLAGS_NEEDIMMEDIATECOMMIT - records whether the top level statement + * is one that requires immediate commit, such as CREATE DATABASE. + */ +#define XACT_FLAGS_NEEDIMMEDIATECOMMIT (1U << 2) + +/* + * XACT_FLAGS_PIPELINING - set when we complete an extended-query-protocol + * Execute message. This is useful for detecting that an implicit transaction + * block has been created via pipelining. + */ +#define XACT_FLAGS_PIPELINING (1U << 3) + +/* + * start- and end-of-transaction callbacks for dynamically loaded modules + */ +typedef enum +{ + XACT_EVENT_COMMIT, + XACT_EVENT_PARALLEL_COMMIT, + XACT_EVENT_ABORT, + XACT_EVENT_PARALLEL_ABORT, + XACT_EVENT_PREPARE, + XACT_EVENT_PRE_COMMIT, + XACT_EVENT_PARALLEL_PRE_COMMIT, + XACT_EVENT_PRE_PREPARE, +} XactEvent; + +typedef void (*XactCallback) (XactEvent event, void *arg); + +typedef enum +{ + SUBXACT_EVENT_START_SUB, + SUBXACT_EVENT_COMMIT_SUB, + SUBXACT_EVENT_ABORT_SUB, + SUBXACT_EVENT_PRE_COMMIT_SUB, +} SubXactEvent; + +typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, + SubTransactionId parentSubid, void *arg); + +/* Data structure for Save/RestoreTransactionCharacteristics */ +typedef struct SavedTransactionCharacteristics +{ + int save_XactIsoLevel; + bool save_XactReadOnly; + bool save_XactDeferrable; +} SavedTransactionCharacteristics; + + +/* ---------------- + * transaction-related XLOG entries + * ---------------- + */ + +/* + * XLOG allows to store some information in high 4 bits of log record xl_info + * field. We use 3 for the opcode, and one about an optional flag variable. + */ +#define XLOG_XACT_COMMIT 0x00 +#define XLOG_XACT_PREPARE 0x10 +#define XLOG_XACT_ABORT 0x20 +#define XLOG_XACT_COMMIT_PREPARED 0x30 +#define XLOG_XACT_ABORT_PREPARED 0x40 +#define XLOG_XACT_ASSIGNMENT 0x50 +#define XLOG_XACT_INVALIDATIONS 0x60 +/* free opcode 0x70 */ + +/* mask for filtering opcodes out of xl_info */ +#define XLOG_XACT_OPMASK 0x70 + +/* does this record have a 'xinfo' field or not */ +#define XLOG_XACT_HAS_INFO 0x80 + +/* + * The following flags, stored in xinfo, determine which information is + * contained in commit/abort records. + */ +#define XACT_XINFO_HAS_DBINFO (1U << 0) +#define XACT_XINFO_HAS_SUBXACTS (1U << 1) +#define XACT_XINFO_HAS_RELFILELOCATORS (1U << 2) +#define XACT_XINFO_HAS_INVALS (1U << 3) +#define XACT_XINFO_HAS_TWOPHASE (1U << 4) +#define XACT_XINFO_HAS_ORIGIN (1U << 5) +#define XACT_XINFO_HAS_AE_LOCKS (1U << 6) +#define XACT_XINFO_HAS_GID (1U << 7) +#define XACT_XINFO_HAS_DROPPED_STATS (1U << 8) + +/* + * Also stored in xinfo, these indicating a variety of additional actions that + * need to occur when emulating transaction effects during recovery. + * + * They are named XactCompletion... to differentiate them from + * EOXact... routines which run at the end of the original transaction + * completion. + */ +#define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29) +#define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30) +#define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31) + +/* Access macros for above flags */ +#define XactCompletionApplyFeedback(xinfo) \ + ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0) +#define XactCompletionRelcacheInitFileInval(xinfo) \ + ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0) +#define XactCompletionForceSyncCommit(xinfo) \ + ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0) + +typedef struct xl_xact_assignment +{ + TransactionId xtop; /* assigned XID's top-level XID */ + int nsubxacts; /* number of subtransaction XIDs */ + TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */ +} xl_xact_assignment; + +#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub) + +/* + * Commit and abort records can contain a lot of information. But a large + * portion of the records won't need all possible pieces of information. So we + * only include what's needed. + * + * A minimal commit/abort record only consists of a xl_xact_commit/abort + * struct. The presence of additional information is indicated by bits set in + * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled + * by a set XLOG_XACT_HAS_INFO bit in the xl_info field. + * + * NB: All the individual data chunks should be sized to multiples of + * sizeof(int) and only require int32 alignment. If they require bigger + * alignment, they need to be copied upon reading. + */ + +/* sub-records for commit/abort */ + +typedef struct xl_xact_xinfo +{ + /* + * Even though we right now only require two bytes of space in xinfo we + * use four so following records don't have to care about alignment. + * Commit records can be large, so copying large portions isn't + * attractive. + */ + uint32 xinfo; +} xl_xact_xinfo; + +typedef struct xl_xact_dbinfo +{ + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ +} xl_xact_dbinfo; + +typedef struct xl_xact_subxacts +{ + int nsubxacts; /* number of subtransaction XIDs */ + TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_subxacts; +#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts) + +typedef struct xl_xact_relfilelocators +{ + int nrels; /* number of relations */ + RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_relfilelocators; +#define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, xlocators) + +/* + * A transactionally dropped statistics entry. + * + * Declared here rather than pgstat.h because pgstat.h can't be included from + * frontend code, but the WAL format needs to be readable by frontend + * programs. + */ +typedef struct xl_xact_stats_item +{ + int kind; + Oid dboid; + Oid objoid; +} xl_xact_stats_item; + +typedef struct xl_xact_stats_items +{ + int nitems; + xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_stats_items; +#define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items) + +typedef struct xl_xact_invals +{ + int nmsgs; /* number of shared inval msgs */ + SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; +} xl_xact_invals; +#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs) + +typedef struct xl_xact_twophase +{ + TransactionId xid; +} xl_xact_twophase; + +typedef struct xl_xact_origin +{ + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_origin; + +typedef struct xl_xact_commit +{ + TimestampTz xact_time; /* time of commit */ + + /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */ + /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */ + /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */ + /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */ + /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */ + /* xl_xact_invals follows if XINFO_HAS_INVALS */ + /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */ + /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */ + /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */ +} xl_xact_commit; +#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz)) + +typedef struct xl_xact_abort +{ + TimestampTz xact_time; /* time of abort */ + + /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */ + /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */ + /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */ + /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */ + /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */ + /* No invalidation messages needed. */ + /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */ + /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */ + /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */ +} xl_xact_abort; +#define MinSizeOfXactAbort sizeof(xl_xact_abort) + +typedef struct xl_xact_prepare +{ + uint32 magic; /* format identifier */ + uint32 total_len; /* actual file length */ + TransactionId xid; /* original transaction XID */ + Oid database; /* OID of database it was in */ + TimestampTz prepared_at; /* time of preparation */ + Oid owner; /* user running the transaction */ + int32 nsubxacts; /* number of following subxact XIDs */ + int32 ncommitrels; /* number of delete-on-commit rels */ + int32 nabortrels; /* number of delete-on-abort rels */ + int32 ncommitstats; /* number of stats to drop on commit */ + int32 nabortstats; /* number of stats to drop on abort */ + int32 ninvalmsgs; /* number of cache invalidation messages */ + bool initfileinval; /* does relcache init file need invalidation? */ + uint16 gidlen; /* length of the GID - GID follows the header */ + XLogRecPtr origin_lsn; /* lsn of this record at origin node */ + TimestampTz origin_timestamp; /* time of prepare at origin node */ +} xl_xact_prepare; + +/* + * Commit/Abort records in the above form are a bit verbose to parse, so + * there's a deconstructed versions generated by ParseCommit/AbortRecord() for + * easier consumption. + */ +typedef struct xl_xact_parsed_commit +{ + TimestampTz xact_time; + uint32 xinfo; + + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + + int nsubxacts; + TransactionId *subxacts; + + int nrels; + RelFileLocator *xlocators; + + int nstats; + xl_xact_stats_item *stats; + + int nmsgs; + SharedInvalidationMessage *msgs; + + TransactionId twophase_xid; /* only for 2PC */ + char twophase_gid[GIDSIZE]; /* only for 2PC */ + int nabortrels; /* only for 2PC */ + RelFileLocator *abortlocators; /* only for 2PC */ + int nabortstats; /* only for 2PC */ + xl_xact_stats_item *abortstats; /* only for 2PC */ + + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_parsed_commit; + +typedef xl_xact_parsed_commit xl_xact_parsed_prepare; + +typedef struct xl_xact_parsed_abort +{ + TimestampTz xact_time; + uint32 xinfo; + + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + + int nsubxacts; + TransactionId *subxacts; + + int nrels; + RelFileLocator *xlocators; + + int nstats; + xl_xact_stats_item *stats; + + TransactionId twophase_xid; /* only for 2PC */ + char twophase_gid[GIDSIZE]; /* only for 2PC */ + + XLogRecPtr origin_lsn; + TimestampTz origin_timestamp; +} xl_xact_parsed_abort; + + +/* ---------------- + * extern definitions + * ---------------- + */ +extern bool IsTransactionState(void); +extern bool IsAbortedTransactionBlockState(void); +extern TransactionId GetTopTransactionId(void); +extern TransactionId GetTopTransactionIdIfAny(void); +extern TransactionId GetCurrentTransactionId(void); +extern TransactionId GetCurrentTransactionIdIfAny(void); +extern TransactionId GetStableLatestTransactionId(void); +extern SubTransactionId GetCurrentSubTransactionId(void); +extern FullTransactionId GetTopFullTransactionId(void); +extern FullTransactionId GetTopFullTransactionIdIfAny(void); +extern FullTransactionId GetCurrentFullTransactionId(void); +extern FullTransactionId GetCurrentFullTransactionIdIfAny(void); +extern void MarkCurrentTransactionIdLoggedIfAny(void); +extern bool SubTransactionIsActive(SubTransactionId subxid); +extern CommandId GetCurrentCommandId(bool used); +extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts); +extern TimestampTz GetCurrentTransactionStartTimestamp(void); +extern TimestampTz GetCurrentStatementStartTimestamp(void); +extern TimestampTz GetCurrentTransactionStopTimestamp(void); +extern void SetCurrentStatementStartTimestamp(void); +extern int GetCurrentTransactionNestLevel(void); +extern bool TransactionIdIsCurrentTransactionId(TransactionId xid); +extern void CommandCounterIncrement(void); +extern void ForceSyncCommit(void); +extern void StartTransactionCommand(void); +extern void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s); +extern void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s); +extern void CommitTransactionCommand(void); +extern void AbortCurrentTransaction(void); +extern void BeginTransactionBlock(void); +extern bool EndTransactionBlock(bool chain); +extern bool PrepareTransactionBlock(const char *gid); +extern void UserAbortTransactionBlock(bool chain); +extern void BeginImplicitTransactionBlock(void); +extern void EndImplicitTransactionBlock(void); +extern void ReleaseSavepoint(const char *name); +extern void DefineSavepoint(const char *name); +extern void RollbackToSavepoint(const char *name); +extern void BeginInternalSubTransaction(const char *name); +extern void ReleaseCurrentSubTransaction(void); +extern void RollbackAndReleaseCurrentSubTransaction(void); +extern bool IsSubTransaction(void); +extern Size EstimateTransactionStateSpace(void); +extern void SerializeTransactionState(Size maxsize, char *start_address); +extern void StartParallelWorkerTransaction(char *tstatespace); +extern void EndParallelWorkerTransaction(void); +extern bool IsTransactionBlock(void); +extern bool IsTransactionOrTransactionBlock(void); +extern char TransactionBlockStatusCode(void); +extern void AbortOutOfAnyTransaction(void); +extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType); +extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType); +extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType); +extern bool IsInTransactionBlock(bool isTopLevel); +extern void RegisterXactCallback(XactCallback callback, void *arg); +extern void UnregisterXactCallback(XactCallback callback, void *arg); +extern void RegisterSubXactCallback(SubXactCallback callback, void *arg); +extern void UnregisterSubXactCallback(SubXactCallback callback, void *arg); + +extern bool IsSubxactTopXidLogPending(void); +extern void MarkSubxactTopXidLogged(void); + +extern int xactGetCommittedChildren(TransactionId **ptr); + +extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time, + int nsubxacts, TransactionId *subxacts, + int nrels, RelFileLocator *rels, + int ndroppedstats, + xl_xact_stats_item *droppedstats, + int nmsgs, SharedInvalidationMessage *msgs, + bool relcacheInval, + int xactflags, + TransactionId twophase_xid, + const char *twophase_gid); + +extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time, + int nsubxacts, TransactionId *subxacts, + int nrels, RelFileLocator *rels, + int ndroppedstats, + xl_xact_stats_item *droppedstats, + int xactflags, TransactionId twophase_xid, + const char *twophase_gid); +extern void xact_redo(XLogReaderState *record); + +/* xactdesc.c */ +extern void xact_desc(StringInfo buf, XLogReaderState *record); +extern const char *xact_identify(uint8 info); + +/* also in xactdesc.c, so they can be shared between front/backend code */ +extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed); +extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed); +extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed); + +extern void EnterParallelMode(void); +extern void ExitParallelMode(void); +extern bool IsInParallelMode(void); + +#endif /* XACT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlog.h b/platform/dbops/binaries/postgres/include/server/access/xlog.h new file mode 100644 index 0000000000000000000000000000000000000000..2c507ea618c379c8dd7ff44d97ba10a3e50ef3af --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlog.h @@ -0,0 +1,310 @@ +/* + * xlog.h + * + * PostgreSQL write-ahead log manager + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlog.h + */ +#ifndef XLOG_H +#define XLOG_H + +#include "access/xlogbackup.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "nodes/pg_list.h" + + +/* Sync methods */ +enum WalSyncMethod +{ + WAL_SYNC_METHOD_FSYNC = 0, + WAL_SYNC_METHOD_FDATASYNC, + WAL_SYNC_METHOD_OPEN, /* for O_SYNC */ + WAL_SYNC_METHOD_FSYNC_WRITETHROUGH, + WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */ +}; +extern PGDLLIMPORT int wal_sync_method; + +extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr; +extern PGDLLIMPORT XLogRecPtr XactLastRecEnd; +extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd; + +/* these variables are GUC parameters related to XLOG */ +extern PGDLLIMPORT int wal_segment_size; +extern PGDLLIMPORT int min_wal_size_mb; +extern PGDLLIMPORT int max_wal_size_mb; +extern PGDLLIMPORT int wal_keep_size_mb; +extern PGDLLIMPORT int max_slot_wal_keep_size_mb; +extern PGDLLIMPORT int XLOGbuffers; +extern PGDLLIMPORT int XLogArchiveTimeout; +extern PGDLLIMPORT int wal_retrieve_retry_interval; +extern PGDLLIMPORT char *XLogArchiveCommand; +extern PGDLLIMPORT bool EnableHotStandby; +extern PGDLLIMPORT bool fullPageWrites; +extern PGDLLIMPORT bool wal_log_hints; +extern PGDLLIMPORT int wal_compression; +extern PGDLLIMPORT bool wal_init_zero; +extern PGDLLIMPORT bool wal_recycle; +extern PGDLLIMPORT bool *wal_consistency_checking; +extern PGDLLIMPORT char *wal_consistency_checking_string; +extern PGDLLIMPORT bool log_checkpoints; +extern PGDLLIMPORT bool track_wal_io_timing; +extern PGDLLIMPORT int wal_decode_buffer_size; + +extern PGDLLIMPORT int CheckPointSegments; + +/* Archive modes */ +typedef enum ArchiveMode +{ + ARCHIVE_MODE_OFF = 0, /* disabled */ + ARCHIVE_MODE_ON, /* enabled while server is running normally */ + ARCHIVE_MODE_ALWAYS, /* enabled always (even during recovery) */ +} ArchiveMode; +extern PGDLLIMPORT int XLogArchiveMode; + +/* WAL levels */ +typedef enum WalLevel +{ + WAL_LEVEL_MINIMAL = 0, + WAL_LEVEL_REPLICA, + WAL_LEVEL_LOGICAL, +} WalLevel; + +/* Compression algorithms for WAL */ +typedef enum WalCompression +{ + WAL_COMPRESSION_NONE = 0, + WAL_COMPRESSION_PGLZ, + WAL_COMPRESSION_LZ4, + WAL_COMPRESSION_ZSTD, +} WalCompression; + +/* Recovery states */ +typedef enum RecoveryState +{ + RECOVERY_STATE_CRASH = 0, /* crash recovery */ + RECOVERY_STATE_ARCHIVE, /* archive recovery */ + RECOVERY_STATE_DONE, /* currently in production */ +} RecoveryState; + +extern PGDLLIMPORT int wal_level; + +/* Is WAL archiving enabled (always or only while server is running normally)? */ +#define XLogArchivingActive() \ + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode > ARCHIVE_MODE_OFF) +/* Is WAL archiving enabled always (even during recovery)? */ +#define XLogArchivingAlways() \ + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode == ARCHIVE_MODE_ALWAYS) + +/* + * Is WAL-logging necessary for archival or log-shipping, or can we skip + * WAL-logging if we fsync() the data before committing instead? + */ +#define XLogIsNeeded() (wal_level >= WAL_LEVEL_REPLICA) + +/* + * Is a full-page image needed for hint bit updates? + * + * Normally, we don't WAL-log hint bit updates, but if checksums are enabled, + * we have to protect them against torn page writes. When you only set + * individual bits on a page, it's still consistent no matter what combination + * of the bits make it to disk, but the checksum wouldn't match. Also WAL-log + * them if forced by wal_log_hints=on. + */ +#define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints) + +/* Do we need to WAL-log information required only for Hot Standby and logical replication? */ +#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_REPLICA) + +/* Do we need to WAL-log information required only for logical replication? */ +#define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL) + +#ifdef WAL_DEBUG +extern PGDLLIMPORT bool XLOG_DEBUG; +#endif + +/* + * OR-able request flag bits for checkpoints. The "cause" bits are used only + * for logging purposes. Note: the flags must be defined so that it's + * sensible to OR together request flags arising from different requestors. + */ + +/* These directly affect the behavior of CreateCheckPoint and subsidiaries */ +#define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */ +#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, but + * issued at end of WAL recovery */ +#define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */ +#define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */ +#define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those + * belonging to unlogged tables */ +/* These are important to RequestCheckpoint */ +#define CHECKPOINT_WAIT 0x0020 /* Wait for completion */ +#define CHECKPOINT_REQUESTED 0x0040 /* Checkpoint request has been made */ +/* These indicate the cause of a checkpoint request */ +#define CHECKPOINT_CAUSE_XLOG 0x0080 /* XLOG consumption */ +#define CHECKPOINT_CAUSE_TIME 0x0100 /* Elapsed time */ + +/* + * Flag bits for the record being inserted, set using XLogSetRecordFlags(). + */ +#define XLOG_INCLUDE_ORIGIN 0x01 /* include the replication origin */ +#define XLOG_MARK_UNIMPORTANT 0x02 /* record not important for durability */ + + +/* Checkpoint statistics */ +typedef struct CheckpointStatsData +{ + TimestampTz ckpt_start_t; /* start of checkpoint */ + TimestampTz ckpt_write_t; /* start of flushing buffers */ + TimestampTz ckpt_sync_t; /* start of fsyncs */ + TimestampTz ckpt_sync_end_t; /* end of fsyncs */ + TimestampTz ckpt_end_t; /* end of checkpoint */ + + int ckpt_bufs_written; /* # of buffers written */ + + int ckpt_segs_added; /* # of new xlog segments created */ + int ckpt_segs_removed; /* # of xlog segments deleted */ + int ckpt_segs_recycled; /* # of xlog segments recycled */ + + int ckpt_sync_rels; /* # of relations synced */ + uint64 ckpt_longest_sync; /* Longest sync for one relation */ + uint64 ckpt_agg_sync_time; /* The sum of all the individual sync + * times, which is not necessarily the + * same as the total elapsed time for the + * entire sync phase. */ +} CheckpointStatsData; + +extern PGDLLIMPORT CheckpointStatsData CheckpointStats; + +/* + * GetWALAvailability return codes + */ +typedef enum WALAvailability +{ + WALAVAIL_INVALID_LSN, /* parameter error */ + WALAVAIL_RESERVED, /* WAL segment is within max_wal_size */ + WALAVAIL_EXTENDED, /* WAL segment is reserved by a slot or + * wal_keep_size */ + WALAVAIL_UNRESERVED, /* no longer reserved, but not removed yet */ + WALAVAIL_REMOVED, /* WAL segment has been removed */ +} WALAvailability; + +struct XLogRecData; +struct XLogReaderState; + +extern XLogRecPtr XLogInsertRecord(struct XLogRecData *rdata, + XLogRecPtr fpw_lsn, + uint8 flags, + int num_fpi, + bool topxid_included); +extern void XLogFlush(XLogRecPtr record); +extern bool XLogBackgroundFlush(void); +extern bool XLogNeedsFlush(XLogRecPtr record); +extern int XLogFileInit(XLogSegNo logsegno, TimeLineID logtli); +extern int XLogFileOpen(XLogSegNo segno, TimeLineID tli); + +extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli); +extern XLogSegNo XLogGetLastRemovedSegno(void); +extern XLogSegNo XLogGetOldestSegno(TimeLineID tli); +extern void XLogSetAsyncXactLSN(XLogRecPtr asyncXactLSN); +extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn); + +extern void xlog_redo(struct XLogReaderState *record); +extern void xlog_desc(StringInfo buf, struct XLogReaderState *record); +extern const char *xlog_identify(uint8 info); + +extern void issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli); + +extern bool RecoveryInProgress(void); +extern RecoveryState GetRecoveryState(void); +extern bool XLogInsertAllowed(void); +extern XLogRecPtr GetXLogInsertRecPtr(void); +extern XLogRecPtr GetXLogWriteRecPtr(void); + +extern uint64 GetSystemIdentifier(void); +extern char *GetMockAuthenticationNonce(void); +extern bool DataChecksumsEnabled(void); +extern XLogRecPtr GetFakeLSNForUnloggedRel(void); +extern Size XLOGShmemSize(void); +extern void XLOGShmemInit(void); +extern void BootStrapXLOG(void); +extern void InitializeWalConsistencyChecking(void); +extern void LocalProcessControlFile(bool reset); +extern WalLevel GetActiveWalLevelOnStandby(void); +extern void StartupXLOG(void); +extern void ShutdownXLOG(int code, Datum arg); +extern void CreateCheckPoint(int flags); +extern bool CreateRestartPoint(int flags); +extern WALAvailability GetWALAvailability(XLogRecPtr targetLSN); +extern void XLogPutNextOid(Oid nextOid); +extern XLogRecPtr XLogRestorePoint(const char *rpName); +extern void UpdateFullPageWrites(void); +extern void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p); +extern XLogRecPtr GetRedoRecPtr(void); +extern XLogRecPtr GetInsertRecPtr(void); +extern XLogRecPtr GetFlushRecPtr(TimeLineID *insertTLI); +extern TimeLineID GetWALInsertionTimeLine(void); +extern TimeLineID GetWALInsertionTimeLineIfSet(void); +extern XLogRecPtr GetLastImportantRecPtr(void); + +extern void SetWalWriterSleeping(bool sleeping); + +extern Size WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count, + TimeLineID tli); + +/* + * Routines used by xlogrecovery.c to call back into xlog.c during recovery. + */ +extern void RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI); +extern bool XLogCheckpointNeeded(XLogSegNo new_segno); +extern void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI); +extern void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli); +extern void SetInstallXLogFileSegmentActive(void); +extern bool IsInstallXLogFileSegmentActive(void); +extern void XLogShutdownWalRcv(void); + +/* + * Routines to start, stop, and get status of a base backup. + */ + +/* + * Session-level status of base backups + * + * This is used in parallel with the shared memory status to control parallel + * execution of base backup functions for a given session, be it a backend + * dedicated to replication or a normal backend connected to a database. The + * update of the session-level status happens at the same time as the shared + * memory counters to keep a consistent global and local state of the backups + * running. + */ +typedef enum SessionBackupState +{ + SESSION_BACKUP_NONE, + SESSION_BACKUP_RUNNING, +} SessionBackupState; + +extern void do_pg_backup_start(const char *backupidstr, bool fast, + List **tablespaces, BackupState *state, + StringInfo tblspcmapfile); +extern void do_pg_backup_stop(BackupState *state, bool waitforarchive); +extern void do_pg_abort_backup(int code, Datum arg); +extern void register_persistent_abort_backup_handler(void); +extern SessionBackupState get_backup_status(void); + +/* File path names (all relative to $PGDATA) */ +#define RECOVERY_SIGNAL_FILE "recovery.signal" +#define STANDBY_SIGNAL_FILE "standby.signal" +#define BACKUP_LABEL_FILE "backup_label" +#define BACKUP_LABEL_OLD "backup_label.old" + +#define TABLESPACE_MAP "tablespace_map" +#define TABLESPACE_MAP_OLD "tablespace_map.old" + +/* files to signal promotion to primary */ +#define PROMOTE_SIGNAL_FILE "promote" + +#endif /* XLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlog_internal.h b/platform/dbops/binaries/postgres/include/server/access/xlog_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..c6a91fb4560553c8b5148d64bc10cc61469ebee7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlog_internal.h @@ -0,0 +1,405 @@ +/* + * xlog_internal.h + * + * PostgreSQL write-ahead log internal declarations + * + * NOTE: this file is intended to contain declarations useful for + * manipulating the XLOG files directly, but it is not supposed to be + * needed by rmgr routines (redo support for individual record types). + * So the XLogRecord typedef and associated stuff appear in xlogrecord.h. + * + * Note: This file must be includable in both frontend and backend contexts, + * to allow stand-alone tools like pg_receivewal to deal with WAL files. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlog_internal.h + */ +#ifndef XLOG_INTERNAL_H +#define XLOG_INTERNAL_H + +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "datatype/timestamp.h" +#include "lib/stringinfo.h" +#include "pgtime.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + + +/* + * Each page of XLOG file has a header like this: + */ +#define XLOG_PAGE_MAGIC 0xD116 /* can be used as WAL version indicator */ + +typedef struct XLogPageHeaderData +{ + uint16 xlp_magic; /* magic value for correctness checks */ + uint16 xlp_info; /* flag bits, see below */ + TimeLineID xlp_tli; /* TimeLineID of first record on page */ + XLogRecPtr xlp_pageaddr; /* XLOG address of this page */ + + /* + * When there is not enough space on current page for whole record, we + * continue on the next page. xlp_rem_len is the number of bytes + * remaining from a previous page; it tracks xl_tot_len in the initial + * header. Note that the continuation data isn't necessarily aligned. + */ + uint32 xlp_rem_len; /* total len of remaining data for record */ +} XLogPageHeaderData; + +#define SizeOfXLogShortPHD MAXALIGN(sizeof(XLogPageHeaderData)) + +typedef XLogPageHeaderData *XLogPageHeader; + +/* + * When the XLP_LONG_HEADER flag is set, we store additional fields in the + * page header. (This is ordinarily done just in the first page of an + * XLOG file.) The additional fields serve to identify the file accurately. + */ +typedef struct XLogLongPageHeaderData +{ + XLogPageHeaderData std; /* standard header fields */ + uint64 xlp_sysid; /* system identifier from pg_control */ + uint32 xlp_seg_size; /* just as a cross-check */ + uint32 xlp_xlog_blcksz; /* just as a cross-check */ +} XLogLongPageHeaderData; + +#define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData)) + +typedef XLogLongPageHeaderData *XLogLongPageHeader; + +/* When record crosses page boundary, set this flag in new page's header */ +#define XLP_FIRST_IS_CONTRECORD 0x0001 +/* This flag indicates a "long" page header */ +#define XLP_LONG_HEADER 0x0002 +/* This flag indicates backup blocks starting in this page are optional */ +#define XLP_BKP_REMOVABLE 0x0004 +/* Replaces a missing contrecord; see CreateOverwriteContrecordRecord */ +#define XLP_FIRST_IS_OVERWRITE_CONTRECORD 0x0008 +/* All defined flag bits in xlp_info (used for validity checking of header) */ +#define XLP_ALL_FLAGS 0x000F + +#define XLogPageHeaderSize(hdr) \ + (((hdr)->xlp_info & XLP_LONG_HEADER) ? SizeOfXLogLongPHD : SizeOfXLogShortPHD) + +/* wal_segment_size can range from 1MB to 1GB */ +#define WalSegMinSize 1024 * 1024 +#define WalSegMaxSize 1024 * 1024 * 1024 +/* default number of min and max wal segments */ +#define DEFAULT_MIN_WAL_SEGS 5 +#define DEFAULT_MAX_WAL_SEGS 64 + +/* check that the given size is a valid wal_segment_size */ +#define IsPowerOf2(x) (x > 0 && ((x) & ((x)-1)) == 0) +#define IsValidWalSegSize(size) \ + (IsPowerOf2(size) && \ + ((size) >= WalSegMinSize && (size) <= WalSegMaxSize)) + +#define XLogSegmentsPerXLogId(wal_segsz_bytes) \ + (UINT64CONST(0x100000000) / (wal_segsz_bytes)) + +#define XLogSegNoOffsetToRecPtr(segno, offset, wal_segsz_bytes, dest) \ + (dest) = (segno) * (wal_segsz_bytes) + (offset) + +#define XLogSegmentOffset(xlogptr, wal_segsz_bytes) \ + ((xlogptr) & ((wal_segsz_bytes) - 1)) + +/* + * Compute a segment number from an XLogRecPtr. + * + * For XLByteToSeg, do the computation at face value. For XLByteToPrevSeg, + * a boundary byte is taken to be in the previous segment. This is suitable + * for deciding which segment to write given a pointer to a record end, + * for example. + */ +#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes) \ + logSegNo = (xlrp) / (wal_segsz_bytes) + +#define XLByteToPrevSeg(xlrp, logSegNo, wal_segsz_bytes) \ + logSegNo = ((xlrp) - 1) / (wal_segsz_bytes) + +/* + * Convert values of GUCs measured in megabytes to equiv. segment count. + * Rounds down. + */ +#define XLogMBVarToSegs(mbvar, wal_segsz_bytes) \ + ((mbvar) / ((wal_segsz_bytes) / (1024 * 1024))) + +/* + * Is an XLogRecPtr within a particular XLOG segment? + * + * For XLByteInSeg, do the computation at face value. For XLByteInPrevSeg, + * a boundary byte is taken to be in the previous segment. + */ +#define XLByteInSeg(xlrp, logSegNo, wal_segsz_bytes) \ + (((xlrp) / (wal_segsz_bytes)) == (logSegNo)) + +#define XLByteInPrevSeg(xlrp, logSegNo, wal_segsz_bytes) \ + ((((xlrp) - 1) / (wal_segsz_bytes)) == (logSegNo)) + +/* Check if an XLogRecPtr value is in a plausible range */ +#define XRecOffIsValid(xlrp) \ + ((xlrp) % XLOG_BLCKSZ >= SizeOfXLogShortPHD) + +/* + * The XLog directory and control file (relative to $PGDATA) + */ +#define XLOGDIR "pg_wal" +#define XLOG_CONTROL_FILE "global/pg_control" + +/* + * These macros encapsulate knowledge about the exact layout of XLog file + * names, timeline history file names, and archive-status file names. + */ +#define MAXFNAMELEN 64 + +/* Length of XLog file name */ +#define XLOG_FNAME_LEN 24 + +/* + * Generate a WAL segment file name. Do not use this function in a helper + * function allocating the result generated. + */ +static inline void +XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes))); +} + +static inline void +XLogFileNameById(char *fname, TimeLineID tli, uint32 log, uint32 seg) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, log, seg); +} + +static inline bool +IsXLogFileName(const char *fname) +{ + return (strlen(fname) == XLOG_FNAME_LEN && \ + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN); +} + +/* + * XLOG segment with .partial suffix. Used by pg_receivewal and at end of + * archive recovery, when we want to archive a WAL segment but it might not + * be complete yet. + */ +static inline bool +IsPartialXLogFileName(const char *fname) +{ + return (strlen(fname) == XLOG_FNAME_LEN + strlen(".partial") && + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && + strcmp(fname + XLOG_FNAME_LEN, ".partial") == 0); +} + +static inline void +XLogFromFileName(const char *fname, TimeLineID *tli, XLogSegNo *logSegNo, int wal_segsz_bytes) +{ + uint32 log; + uint32 seg; + + sscanf(fname, "%08X%08X%08X", tli, &log, &seg); + *logSegNo = (uint64) log * XLogSegmentsPerXLogId(wal_segsz_bytes) + seg; +} + +static inline void +XLogFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes))); +} + +static inline void +TLHistoryFileName(char *fname, TimeLineID tli) +{ + snprintf(fname, MAXFNAMELEN, "%08X.history", tli); +} + +static inline bool +IsTLHistoryFileName(const char *fname) +{ + return (strlen(fname) == 8 + strlen(".history") && + strspn(fname, "0123456789ABCDEF") == 8 && + strcmp(fname + 8, ".history") == 0); +} + +static inline void +TLHistoryFilePath(char *path, TimeLineID tli) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X.history", tli); +} + +static inline void +StatusFilePath(char *path, const char *xlog, const char *suffix) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/archive_status/%s%s", xlog, suffix); +} + +static inline void +BackupHistoryFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes) +{ + snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (XLogSegmentOffset(startpoint, wal_segsz_bytes))); +} + +static inline bool +IsBackupHistoryFileName(const char *fname) +{ + return (strlen(fname) > XLOG_FNAME_LEN && + strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && + strcmp(fname + strlen(fname) - strlen(".backup"), ".backup") == 0); +} + +static inline void +BackupHistoryFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes) +{ + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, + (uint32) (logSegNo / XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (logSegNo % XLogSegmentsPerXLogId(wal_segsz_bytes)), + (uint32) (XLogSegmentOffset((startpoint), wal_segsz_bytes))); +} + +/* + * Information logged when we detect a change in one of the parameters + * important for Hot Standby. + */ +typedef struct xl_parameter_change +{ + int MaxConnections; + int max_worker_processes; + int max_wal_senders; + int max_prepared_xacts; + int max_locks_per_xact; + int wal_level; + bool wal_log_hints; + bool track_commit_timestamp; +} xl_parameter_change; + +/* logs restore point */ +typedef struct xl_restore_point +{ + TimestampTz rp_time; + char rp_name[MAXFNAMELEN]; +} xl_restore_point; + +/* Overwrite of prior contrecord */ +typedef struct xl_overwrite_contrecord +{ + XLogRecPtr overwritten_lsn; + TimestampTz overwrite_time; +} xl_overwrite_contrecord; + +/* End of recovery mark, when we don't do an END_OF_RECOVERY checkpoint */ +typedef struct xl_end_of_recovery +{ + TimestampTz end_time; + TimeLineID ThisTimeLineID; /* new TLI */ + TimeLineID PrevTimeLineID; /* previous TLI we forked off from */ + int wal_level; +} xl_end_of_recovery; + +/* + * The functions in xloginsert.c construct a chain of XLogRecData structs + * to represent the final WAL record. + */ +typedef struct XLogRecData +{ + struct XLogRecData *next; /* next struct in chain, or NULL */ + char *data; /* start of rmgr data to include */ + uint32 len; /* length of rmgr data to include */ +} XLogRecData; + +/* + * Recovery target action. + */ +typedef enum +{ + RECOVERY_TARGET_ACTION_PAUSE, + RECOVERY_TARGET_ACTION_PROMOTE, + RECOVERY_TARGET_ACTION_SHUTDOWN, +} RecoveryTargetAction; + +struct LogicalDecodingContext; +struct XLogRecordBuffer; + +/* + * Method table for resource managers. + * + * This struct must be kept in sync with the PG_RMGR definition in + * rmgr.c. + * + * rm_identify must return a name for the record based on xl_info (without + * reference to the rmid). For example, XLOG_BTREE_VACUUM would be named + * "VACUUM". rm_desc can then be called to obtain additional detail for the + * record, if available (e.g. the last block). + * + * rm_mask takes as input a page modified by the resource manager and masks + * out bits that shouldn't be flagged by wal_consistency_checking. + * + * RmgrTable[] is indexed by RmgrId values (see rmgrlist.h). If rm_name is + * NULL, the corresponding RmgrTable entry is considered invalid. + */ +typedef struct RmgrData +{ + const char *rm_name; + void (*rm_redo) (XLogReaderState *record); + void (*rm_desc) (StringInfo buf, XLogReaderState *record); + const char *(*rm_identify) (uint8 info); + void (*rm_startup) (void); + void (*rm_cleanup) (void); + void (*rm_mask) (char *pagedata, BlockNumber blkno); + void (*rm_decode) (struct LogicalDecodingContext *ctx, + struct XLogRecordBuffer *buf); +} RmgrData; + +extern PGDLLIMPORT RmgrData RmgrTable[]; +extern void RmgrStartup(void); +extern void RmgrCleanup(void); +extern void RmgrNotFound(RmgrId rmid); +extern void RegisterCustomRmgr(RmgrId rmid, const RmgrData *rmgr); + +#ifndef FRONTEND +static inline bool +RmgrIdExists(RmgrId rmid) +{ + return RmgrTable[rmid].rm_name != NULL; +} + +static inline RmgrData +GetRmgr(RmgrId rmid) +{ + if (unlikely(!RmgrIdExists(rmid))) + RmgrNotFound(rmid); + return RmgrTable[rmid]; +} +#endif + +/* + * Exported to support xlog switching from checkpointer + */ +extern pg_time_t GetLastSegSwitchData(XLogRecPtr *lastSwitchLSN); +extern XLogRecPtr RequestXLogSwitch(bool mark_unimportant); + +extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli); + +extern void XLogRecGetBlockRefInfo(XLogReaderState *record, bool pretty, + bool detailed_format, StringInfo buf, + uint32 *fpi_len); + +/* + * Exported for the functions in timeline.c and xlogarchive.c. Only valid + * in the startup process. + */ +extern PGDLLIMPORT bool ArchiveRecoveryRequested; +extern PGDLLIMPORT bool InArchiveRecovery; +extern PGDLLIMPORT bool StandbyMode; +extern PGDLLIMPORT char *recoveryRestoreCommand; + +#endif /* XLOG_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogarchive.h b/platform/dbops/binaries/postgres/include/server/access/xlogarchive.h new file mode 100644 index 0000000000000000000000000000000000000000..0701475fb40c90a0a5df70c7eac3e6959350f78f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogarchive.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------ + * + * xlogarchive.h + * Prototypes for WAL archives in the backend + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogarchive.h + * + *------------------------------------------------------------------------ + */ + +#ifndef XLOG_ARCHIVE_H +#define XLOG_ARCHIVE_H + +#include "access/xlogdefs.h" + +extern bool RestoreArchivedFile(char *path, const char *xlogfname, + const char *recovername, off_t expectedSize, + bool cleanupEnabled); +extern void ExecuteRecoveryCommand(const char *command, const char *commandName, + bool failOnSignal, uint32 wait_event_info); +extern void KeepFileRestoredFromArchive(const char *path, const char *xlogfname); +extern void XLogArchiveNotify(const char *xlog); +extern void XLogArchiveNotifySeg(XLogSegNo segno, TimeLineID tli); +extern void XLogArchiveForceDone(const char *xlog); +extern bool XLogArchiveCheckDone(const char *xlog); +extern bool XLogArchiveIsBusy(const char *xlog); +extern bool XLogArchiveIsReady(const char *xlog); +extern bool XLogArchiveIsReadyOrDone(const char *xlog); +extern void XLogArchiveCleanup(const char *xlog); + +#endif /* XLOG_ARCHIVE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogbackup.h b/platform/dbops/binaries/postgres/include/server/access/xlogbackup.h new file mode 100644 index 0000000000000000000000000000000000000000..c30d4a599159feb2ad6ce65831a648fa3bdb9bca --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogbackup.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * xlogbackup.h + * Definitions for internals of base backups. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogbackup.h + *------------------------------------------------------------------------- + */ + +#ifndef XLOG_BACKUP_H +#define XLOG_BACKUP_H + +#include "access/xlogdefs.h" +#include "pgtime.h" + +/* Structure to hold backup state. */ +typedef struct BackupState +{ + /* Fields saved at backup start */ + /* Backup label name one extra byte for null-termination */ + char name[MAXPGPATH + 1]; + XLogRecPtr startpoint; /* backup start WAL location */ + TimeLineID starttli; /* backup start TLI */ + XLogRecPtr checkpointloc; /* last checkpoint location */ + pg_time_t starttime; /* backup start time */ + bool started_in_recovery; /* backup started in recovery? */ + XLogRecPtr istartpoint; /* incremental based on backup at this LSN */ + TimeLineID istarttli; /* incremental based on backup on this TLI */ + + /* Fields saved at the end of backup */ + XLogRecPtr stoppoint; /* backup stop WAL location */ + TimeLineID stoptli; /* backup stop TLI */ + pg_time_t stoptime; /* backup stop time */ +} BackupState; + +extern char *build_backup_content(BackupState *state, + bool ishistoryfile); + +#endif /* XLOG_BACKUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogdefs.h b/platform/dbops/binaries/postgres/include/server/access/xlogdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..30097989521bc44f249e2d053beed2b63792637d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogdefs.h @@ -0,0 +1,82 @@ +/* + * xlogdefs.h + * + * Postgres write-ahead log manager record pointer and + * timeline number definitions + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogdefs.h + */ +#ifndef XLOG_DEFS_H +#define XLOG_DEFS_H + +#include /* need open() flags */ + +/* + * Pointer to a location in the XLOG. These pointers are 64 bits wide, + * because we don't want them ever to overflow. + */ +typedef uint64 XLogRecPtr; + +/* + * Zero is used indicate an invalid pointer. Bootstrap skips the first possible + * WAL segment, initializing the first WAL page at WAL segment size, so no XLOG + * record can begin at zero. + */ +#define InvalidXLogRecPtr 0 +#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr) + +/* + * First LSN to use for "fake" LSNs. + * + * Values smaller than this can be used for special per-AM purposes. + */ +#define FirstNormalUnloggedLSN ((XLogRecPtr) 1000) + +/* + * Handy macro for printing XLogRecPtr in conventional format, e.g., + * + * printf("%X/%X", LSN_FORMAT_ARGS(lsn)); + */ +#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn)) + +/* + * XLogSegNo - physical log file sequence number. + */ +typedef uint64 XLogSegNo; + +/* + * TimeLineID (TLI) - identifies different database histories to prevent + * confusion after restoring a prior state of a database installation. + * TLI does not change in a normal stop/restart of the database (including + * crash-and-recover cases); but we must assign a new TLI after doing + * a recovery to a prior state, a/k/a point-in-time recovery. This makes + * the new WAL logfile sequence we generate distinguishable from the + * sequence that was generated in the previous incarnation. + */ +typedef uint32 TimeLineID; + +/* + * Replication origin id - this is located in this file to avoid having to + * include origin.h in a bunch of xlog related places. + */ +typedef uint16 RepOriginId; + +/* + * This chunk of hackery attempts to determine which file sync methods + * are available on the current platform, and to choose an appropriate + * default method. + * + * Note that we define our own O_DSYNC on Windows, but not O_SYNC. + */ +#if defined(PLATFORM_DEFAULT_WAL_SYNC_METHOD) +#define DEFAULT_WAL_SYNC_METHOD PLATFORM_DEFAULT_WAL_SYNC_METHOD +#elif defined(O_DSYNC) && (!defined(O_SYNC) || O_DSYNC != O_SYNC) +#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_OPEN_DSYNC +#else +#define DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC +#endif + +#endif /* XLOG_DEFS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xloginsert.h b/platform/dbops/binaries/postgres/include/server/access/xloginsert.h new file mode 100644 index 0000000000000000000000000000000000000000..b44fa29eac515331c5293c01cb9a8c1636283929 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xloginsert.h @@ -0,0 +1,67 @@ +/* + * xloginsert.h + * + * Functions for generating WAL records + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xloginsert.h + */ +#ifndef XLOGINSERT_H +#define XLOGINSERT_H + +#include "access/rmgr.h" +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* + * The minimum size of the WAL construction working area. If you need to + * register more than XLR_NORMAL_MAX_BLOCK_ID block references or have more + * than XLR_NORMAL_RDATAS data chunks in a single WAL record, you must call + * XLogEnsureRecordSpace() first to allocate more working memory. + */ +#define XLR_NORMAL_MAX_BLOCK_ID 4 +#define XLR_NORMAL_RDATAS 20 + +/* flags for XLogRegisterBuffer */ +#define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */ +#define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */ +#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized at + * replay (implies NO_IMAGE) */ +#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout, + * (data between pd_lower and pd_upper + * will be skipped) */ +#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image + * is taken */ +#define REGBUF_NO_CHANGE 0x20 /* intentionally register clean buffer */ + +/* prototypes for public functions in xloginsert.c: */ +extern void XLogBeginInsert(void); +extern void XLogSetRecordFlags(uint8 flags); +extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info); +extern void XLogEnsureRecordSpace(int max_block_id, int ndatas); +extern void XLogRegisterData(char *data, uint32 len); +extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags); +extern void XLogRegisterBlock(uint8 block_id, RelFileLocator *rlocator, + ForkNumber forknum, BlockNumber blknum, char *page, + uint8 flags); +extern void XLogRegisterBufData(uint8 block_id, char *data, uint32 len); +extern void XLogResetInsertion(void); +extern bool XLogCheckBufferNeedsBackup(Buffer buffer); + +extern XLogRecPtr log_newpage(RelFileLocator *rlocator, ForkNumber forknum, + BlockNumber blkno, char *page, bool page_std); +extern void log_newpages(RelFileLocator *rlocator, ForkNumber forknum, int num_pages, + BlockNumber *blknos, char **pages, bool page_std); +extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std); +extern void log_newpage_range(Relation rel, ForkNumber forknum, + BlockNumber startblk, BlockNumber endblk, bool page_std); +extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std); + +extern void InitXLogInsert(void); + +#endif /* XLOGINSERT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogprefetcher.h b/platform/dbops/binaries/postgres/include/server/access/xlogprefetcher.h new file mode 100644 index 0000000000000000000000000000000000000000..98cf990103bc78869dc648ca6bd091595f8bbb36 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogprefetcher.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * xlogprefetcher.h + * Declarations for the recovery prefetching module. + * + * Portions Copyright (c) 2022-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/access/xlogprefetcher.h + *------------------------------------------------------------------------- + */ +#ifndef XLOGPREFETCHER_H +#define XLOGPREFETCHER_H + +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "access/xlogrecord.h" + +/* GUCs */ +extern PGDLLIMPORT int recovery_prefetch; + +/* Possible values for recovery_prefetch */ +typedef enum +{ + RECOVERY_PREFETCH_OFF, + RECOVERY_PREFETCH_ON, + RECOVERY_PREFETCH_TRY, +} RecoveryPrefetchValue; + +struct XLogPrefetcher; +typedef struct XLogPrefetcher XLogPrefetcher; + + +extern void XLogPrefetchReconfigure(void); + +extern size_t XLogPrefetchShmemSize(void); +extern void XLogPrefetchShmemInit(void); + +extern void XLogPrefetchResetStats(void); + +extern XLogPrefetcher *XLogPrefetcherAllocate(XLogReaderState *reader); +extern void XLogPrefetcherFree(XLogPrefetcher *prefetcher); + +extern XLogReaderState *XLogPrefetcherGetReader(XLogPrefetcher *prefetcher); + +extern void XLogPrefetcherBeginRead(XLogPrefetcher *prefetcher, + XLogRecPtr recPtr); + +extern XLogRecord *XLogPrefetcherReadRecord(XLogPrefetcher *prefetcher, + char **errmsg); + +extern void XLogPrefetcherComputeStats(XLogPrefetcher *prefetcher); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogreader.h b/platform/dbops/binaries/postgres/include/server/access/xlogreader.h new file mode 100644 index 0000000000000000000000000000000000000000..2e9e5f43eb2de1ca9ba81afe76d21357065c61aa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogreader.h @@ -0,0 +1,444 @@ +/*------------------------------------------------------------------------- + * + * xlogreader.h + * Definitions for the generic XLog reading facility + * + * Portions Copyright (c) 2013-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/access/xlogreader.h + * + * NOTES + * See the definition of the XLogReaderState struct for instructions on + * how to use the XLogReader infrastructure. + * + * The basic idea is to allocate an XLogReaderState via + * XLogReaderAllocate(), position the reader to the first record with + * XLogBeginRead() or XLogFindNextRecord(), and call XLogReadRecord() + * until it returns NULL. + * + * Callers supply a page_read callback if they want to call + * XLogReadRecord or XLogFindNextRecord; it can be passed in as NULL + * otherwise. The WALRead function can be used as a helper to write + * page_read callbacks, but it is not mandatory; callers that use it, + * must supply segment_open callbacks. The segment_close callback + * must always be supplied. + * + * After reading a record with XLogReadRecord(), it's decomposed into + * the per-block and main data parts, and the parts can be accessed + * with the XLogRec* macros and functions. You can also decode a + * record that's already constructed in memory, without reading from + * disk, by calling the DecodeXLogRecord() function. + *------------------------------------------------------------------------- + */ +#ifndef XLOGREADER_H +#define XLOGREADER_H + +#ifndef FRONTEND +#include "access/transam.h" +#endif + +#include "access/xlogrecord.h" +#include "storage/buf.h" + +/* WALOpenSegment represents a WAL segment being read. */ +typedef struct WALOpenSegment +{ + int ws_file; /* segment file descriptor */ + XLogSegNo ws_segno; /* segment number */ + TimeLineID ws_tli; /* timeline ID of the currently open file */ +} WALOpenSegment; + +/* WALSegmentContext carries context information about WAL segments to read */ +typedef struct WALSegmentContext +{ + char ws_dir[MAXPGPATH]; + int ws_segsize; +} WALSegmentContext; + +typedef struct XLogReaderState XLogReaderState; + +/* Function type definitions for various xlogreader interactions */ +typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader, + XLogRecPtr targetPagePtr, + int reqLen, + XLogRecPtr targetRecPtr, + char *readBuf); +typedef void (*WALSegmentOpenCB) (XLogReaderState *xlogreader, + XLogSegNo nextSegNo, + TimeLineID *tli_p); +typedef void (*WALSegmentCloseCB) (XLogReaderState *xlogreader); + +typedef struct XLogReaderRoutine +{ + /* + * Data input callback + * + * This callback shall read at least reqLen valid bytes of the xlog page + * starting at targetPagePtr, and store them in readBuf. The callback + * shall return the number of bytes read (never more than XLOG_BLCKSZ), or + * -1 on failure. The callback shall sleep, if necessary, to wait for the + * requested bytes to become available. The callback will not be invoked + * again for the same page unless more than the returned number of bytes + * are needed. + * + * targetRecPtr is the position of the WAL record we're reading. Usually + * it is equal to targetPagePtr + reqLen, but sometimes xlogreader needs + * to read and verify the page or segment header, before it reads the + * actual WAL record it's interested in. In that case, targetRecPtr can + * be used to determine which timeline to read the page from. + * + * The callback shall set ->seg.ws_tli to the TLI of the file the page was + * read from. + */ + XLogPageReadCB page_read; + + /* + * Callback to open the specified WAL segment for reading. ->seg.ws_file + * shall be set to the file descriptor of the opened segment. In case of + * failure, an error shall be raised by the callback and it shall not + * return. + * + * "nextSegNo" is the number of the segment to be opened. + * + * "tli_p" is an input/output argument. WALRead() uses it to pass the + * timeline in which the new segment should be found, but the callback can + * use it to return the TLI that it actually opened. + */ + WALSegmentOpenCB segment_open; + + /* + * WAL segment close callback. ->seg.ws_file shall be set to a negative + * number. + */ + WALSegmentCloseCB segment_close; +} XLogReaderRoutine; + +#define XL_ROUTINE(...) &(XLogReaderRoutine){__VA_ARGS__} + +typedef struct +{ + /* Is this block ref in use? */ + bool in_use; + + /* Identify the block this refers to */ + RelFileLocator rlocator; + ForkNumber forknum; + BlockNumber blkno; + + /* Prefetching workspace. */ + Buffer prefetch_buffer; + + /* copy of the fork_flags field from the XLogRecordBlockHeader */ + uint8 flags; + + /* Information on full-page image, if any */ + bool has_image; /* has image, even for consistency checking */ + bool apply_image; /* has image that should be restored */ + char *bkp_image; + uint16 hole_offset; + uint16 hole_length; + uint16 bimg_len; + uint8 bimg_info; + + /* Buffer holding the rmgr-specific data associated with this block */ + bool has_data; + char *data; + uint16 data_len; + uint16 data_bufsz; +} DecodedBkpBlock; + +/* + * The decoded contents of a record. This occupies a contiguous region of + * memory, with main_data and blocks[n].data pointing to memory after the + * members declared here. + */ +typedef struct DecodedXLogRecord +{ + /* Private member used for resource management. */ + size_t size; /* total size of decoded record */ + bool oversized; /* outside the regular decode buffer? */ + struct DecodedXLogRecord *next; /* decoded record queue link */ + + /* Public members. */ + XLogRecPtr lsn; /* location */ + XLogRecPtr next_lsn; /* location of next record */ + XLogRecord header; /* header */ + RepOriginId record_origin; + TransactionId toplevel_xid; /* XID of top-level transaction */ + char *main_data; /* record's main data portion */ + uint32 main_data_len; /* main data portion's length */ + int max_block_id; /* highest block_id in use (-1 if none) */ + DecodedBkpBlock blocks[FLEXIBLE_ARRAY_MEMBER]; +} DecodedXLogRecord; + +struct XLogReaderState +{ + /* + * Operational callbacks + */ + XLogReaderRoutine routine; + + /* ---------------------------------------- + * Public parameters + * ---------------------------------------- + */ + + /* + * System identifier of the xlog files we're about to read. Set to zero + * (the default value) if unknown or unimportant. + */ + uint64 system_identifier; + + /* + * Opaque data for callbacks to use. Not used by XLogReader. + */ + void *private_data; + + /* + * Start and end point of last record read. EndRecPtr is also used as the + * position to read next. Calling XLogBeginRead() sets EndRecPtr to the + * starting position and ReadRecPtr to invalid. + * + * Start and end point of last record returned by XLogReadRecord(). These + * are also available as record->lsn and record->next_lsn. + */ + XLogRecPtr ReadRecPtr; /* start of last record read */ + XLogRecPtr EndRecPtr; /* end+1 of last record read */ + + /* + * Set at the end of recovery: the start point of a partial record at the + * end of WAL (InvalidXLogRecPtr if there wasn't one), and the start + * location of its first contrecord that went missing. + */ + XLogRecPtr abortedRecPtr; + XLogRecPtr missingContrecPtr; + /* Set when XLP_FIRST_IS_OVERWRITE_CONTRECORD is found */ + XLogRecPtr overwrittenRecPtr; + + + /* ---------------------------------------- + * Decoded representation of current record + * + * Use XLogRecGet* functions to investigate the record; these fields + * should not be accessed directly. + * ---------------------------------------- + * Start and end point of the last record read and decoded by + * XLogReadRecordInternal(). NextRecPtr is also used as the position to + * decode next. Calling XLogBeginRead() sets NextRecPtr and EndRecPtr to + * the requested starting position. + */ + XLogRecPtr DecodeRecPtr; /* start of last record decoded */ + XLogRecPtr NextRecPtr; /* end+1 of last record decoded */ + XLogRecPtr PrevRecPtr; /* start of previous record decoded */ + + /* Last record returned by XLogReadRecord(). */ + DecodedXLogRecord *record; + + /* ---------------------------------------- + * private/internal state + * ---------------------------------------- + */ + + /* + * Buffer for decoded records. This is a circular buffer, though + * individual records can't be split in the middle, so some space is often + * wasted at the end. Oversized records that don't fit in this space are + * allocated separately. + */ + char *decode_buffer; + size_t decode_buffer_size; + bool free_decode_buffer; /* need to free? */ + char *decode_buffer_head; /* data is read from the head */ + char *decode_buffer_tail; /* new data is written at the tail */ + + /* + * Queue of records that have been decoded. This is a linked list that + * usually consists of consecutive records in decode_buffer, but may also + * contain oversized records allocated with palloc(). + */ + DecodedXLogRecord *decode_queue_head; /* oldest decoded record */ + DecodedXLogRecord *decode_queue_tail; /* newest decoded record */ + + /* + * Buffer for currently read page (XLOG_BLCKSZ bytes, valid up to at least + * readLen bytes) + */ + char *readBuf; + uint32 readLen; + + /* last read XLOG position for data currently in readBuf */ + WALSegmentContext segcxt; + WALOpenSegment seg; + uint32 segoff; + + /* + * beginning of prior page read, and its TLI. Doesn't necessarily + * correspond to what's in readBuf; used for timeline sanity checks. + */ + XLogRecPtr latestPagePtr; + TimeLineID latestPageTLI; + + /* beginning of the WAL record being read. */ + XLogRecPtr currRecPtr; + /* timeline to read it from, 0 if a lookup is required */ + TimeLineID currTLI; + + /* + * Safe point to read to in currTLI if current TLI is historical + * (tliSwitchPoint) or InvalidXLogRecPtr if on current timeline. + * + * Actually set to the start of the segment containing the timeline switch + * that ends currTLI's validity, not the LSN of the switch its self, since + * we can't assume the old segment will be present. + */ + XLogRecPtr currTLIValidUntil; + + /* + * If currTLI is not the most recent known timeline, the next timeline to + * read from when currTLIValidUntil is reached. + */ + TimeLineID nextTLI; + + /* + * Buffer for current ReadRecord result (expandable), used when a record + * crosses a page boundary. + */ + char *readRecordBuf; + uint32 readRecordBufSize; + + /* Buffer to hold error message */ + char *errormsg_buf; + bool errormsg_deferred; + + /* + * Flag to indicate to XLogPageReadCB that it should not block waiting for + * data. + */ + bool nonblocking; +}; + +/* + * Check if XLogNextRecord() has any more queued records or an error to return. + */ +static inline bool +XLogReaderHasQueuedRecordOrError(XLogReaderState *state) +{ + return (state->decode_queue_head != NULL) || state->errormsg_deferred; +} + +/* Get a new XLogReader */ +extern XLogReaderState *XLogReaderAllocate(int wal_segment_size, + const char *waldir, + XLogReaderRoutine *routine, + void *private_data); + +/* Free an XLogReader */ +extern void XLogReaderFree(XLogReaderState *state); + +/* Optionally provide a circular decoding buffer to allow readahead. */ +extern void XLogReaderSetDecodeBuffer(XLogReaderState *state, + void *buffer, + size_t size); + +/* Position the XLogReader to given record */ +extern void XLogBeginRead(XLogReaderState *state, XLogRecPtr RecPtr); +extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr); + +/* Return values from XLogPageReadCB. */ +typedef enum XLogPageReadResult +{ + XLREAD_SUCCESS = 0, /* record is successfully read */ + XLREAD_FAIL = -1, /* failed during reading a record */ + XLREAD_WOULDBLOCK = -2, /* nonblocking mode only, no data */ +} XLogPageReadResult; + +/* Read the next XLog record. Returns NULL on end-of-WAL or failure */ +extern struct XLogRecord *XLogReadRecord(XLogReaderState *state, + char **errormsg); + +/* Consume the next record or error. */ +extern DecodedXLogRecord *XLogNextRecord(XLogReaderState *state, + char **errormsg); + +/* Release the previously returned record, if necessary. */ +extern XLogRecPtr XLogReleasePreviousRecord(XLogReaderState *state); + +/* Try to read ahead, if there is data and space. */ +extern DecodedXLogRecord *XLogReadAhead(XLogReaderState *state, + bool nonblocking); + +/* Validate a page */ +extern bool XLogReaderValidatePageHeader(XLogReaderState *state, + XLogRecPtr recptr, char *phdr); + +/* Forget error produced by XLogReaderValidatePageHeader(). */ +extern void XLogReaderResetError(XLogReaderState *state); + +/* + * Error information from WALRead that both backend and frontend caller can + * process. Currently only errors from pg_pread can be reported. + */ +typedef struct WALReadError +{ + int wre_errno; /* errno set by the last pg_pread() */ + int wre_off; /* Offset we tried to read from. */ + int wre_req; /* Bytes requested to be read. */ + int wre_read; /* Bytes read by the last read(). */ + WALOpenSegment wre_seg; /* Segment we tried to read from. */ +} WALReadError; + +extern bool WALRead(XLogReaderState *state, + char *buf, XLogRecPtr startptr, Size count, + TimeLineID tli, WALReadError *errinfo); + +/* Functions for decoding an XLogRecord */ + +extern size_t DecodeXLogRecordRequiredSpace(size_t xl_tot_len); +extern bool DecodeXLogRecord(XLogReaderState *state, + DecodedXLogRecord *decoded, + XLogRecord *record, + XLogRecPtr lsn, + char **errormsg); + +/* + * Macros that provide access to parts of the record most recently returned by + * XLogReadRecord() or XLogNextRecord(). + */ +#define XLogRecGetTotalLen(decoder) ((decoder)->record->header.xl_tot_len) +#define XLogRecGetPrev(decoder) ((decoder)->record->header.xl_prev) +#define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info) +#define XLogRecGetRmid(decoder) ((decoder)->record->header.xl_rmid) +#define XLogRecGetXid(decoder) ((decoder)->record->header.xl_xid) +#define XLogRecGetOrigin(decoder) ((decoder)->record->record_origin) +#define XLogRecGetTopXid(decoder) ((decoder)->record->toplevel_xid) +#define XLogRecGetData(decoder) ((decoder)->record->main_data) +#define XLogRecGetDataLen(decoder) ((decoder)->record->main_data_len) +#define XLogRecHasAnyBlockRefs(decoder) ((decoder)->record->max_block_id >= 0) +#define XLogRecMaxBlockId(decoder) ((decoder)->record->max_block_id) +#define XLogRecGetBlock(decoder, i) (&(decoder)->record->blocks[(i)]) +#define XLogRecHasBlockRef(decoder, block_id) \ + (((decoder)->record->max_block_id >= (block_id)) && \ + ((decoder)->record->blocks[block_id].in_use)) +#define XLogRecHasBlockImage(decoder, block_id) \ + ((decoder)->record->blocks[block_id].has_image) +#define XLogRecBlockImageApply(decoder, block_id) \ + ((decoder)->record->blocks[block_id].apply_image) +#define XLogRecHasBlockData(decoder, block_id) \ + ((decoder)->record->blocks[block_id].has_data) + +#ifndef FRONTEND +extern FullTransactionId XLogRecGetFullXid(XLogReaderState *record); +#endif + +extern bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page); +extern char *XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len); +extern void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, + RelFileLocator *rlocator, ForkNumber *forknum, + BlockNumber *blknum); +extern bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, + RelFileLocator *rlocator, ForkNumber *forknum, + BlockNumber *blknum, + Buffer *prefetch_buffer); + +#endif /* XLOGREADER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogrecord.h b/platform/dbops/binaries/postgres/include/server/access/xlogrecord.h new file mode 100644 index 0000000000000000000000000000000000000000..b9e5c59fae34d5cf34cc3ba03ba25e9f9170b7e5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogrecord.h @@ -0,0 +1,248 @@ +/* + * xlogrecord.h + * + * Definitions for the WAL record format. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogrecord.h + */ +#ifndef XLOGRECORD_H +#define XLOGRECORD_H + +#include "access/rmgr.h" +#include "access/xlogdefs.h" +#include "port/pg_crc32c.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * The overall layout of an XLOG record is: + * Fixed-size header (XLogRecord struct) + * XLogRecordBlockHeader struct + * XLogRecordBlockHeader struct + * ... + * XLogRecordDataHeader[Short|Long] struct + * block data + * block data + * ... + * main data + * + * There can be zero or more XLogRecordBlockHeaders, and 0 or more bytes of + * rmgr-specific data not associated with a block. XLogRecord structs + * always start on MAXALIGN boundaries in the WAL files, but the rest of + * the fields are not aligned. + * + * The XLogRecordBlockHeader, XLogRecordDataHeaderShort and + * XLogRecordDataHeaderLong structs all begin with a single 'id' byte. It's + * used to distinguish between block references, and the main data structs. + */ +typedef struct XLogRecord +{ + uint32 xl_tot_len; /* total len of entire record */ + TransactionId xl_xid; /* xact id */ + XLogRecPtr xl_prev; /* ptr to previous record in log */ + uint8 xl_info; /* flag bits, see below */ + RmgrId xl_rmid; /* resource manager for this record */ + /* 2 bytes of padding here, initialize to zero */ + pg_crc32c xl_crc; /* CRC for this record */ + + /* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */ + +} XLogRecord; + +#define SizeOfXLogRecord (offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c)) + +/* + * The high 4 bits in xl_info may be used freely by rmgr. The + * XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY bits can be passed by + * XLogInsert caller. The rest are set internally by XLogInsert. + */ +#define XLR_INFO_MASK 0x0F +#define XLR_RMGR_INFO_MASK 0xF0 + +/* + * XLogReader needs to allocate all the data of a WAL record in a single + * chunk. This means that a single XLogRecord cannot exceed MaxAllocSize + * in length if we ignore any allocation overhead of the XLogReader. + * + * To accommodate some overhead, this value allows for 4M of allocation + * overhead, that should be plenty enough for what the XLogReader + * infrastructure expects as extra. + */ +#define XLogRecordMaxSize (1020 * 1024 * 1024) + +/* + * If a WAL record modifies any relation files, in ways not covered by the + * usual block references, this flag is set. This is not used for anything + * by PostgreSQL itself, but it allows external tools that read WAL and keep + * track of modified blocks to recognize such special record types. + */ +#define XLR_SPECIAL_REL_UPDATE 0x01 + +/* + * Enforces consistency checks of replayed WAL at recovery. If enabled, + * each record will log a full-page write for each block modified by the + * record and will reuse it afterwards for consistency checks. The caller + * of XLogInsert can use this value if necessary, but if + * wal_consistency_checking is enabled for a rmgr this is set unconditionally. + */ +#define XLR_CHECK_CONSISTENCY 0x02 + +/* + * Header info for block data appended to an XLOG record. + * + * 'data_length' is the length of the rmgr-specific payload data associated + * with this block. It does not include the possible full page image, nor + * XLogRecordBlockHeader struct itself. + * + * Note that we don't attempt to align the XLogRecordBlockHeader struct! + * So, the struct must be copied to aligned local storage before use. + */ +typedef struct XLogRecordBlockHeader +{ + uint8 id; /* block reference ID */ + uint8 fork_flags; /* fork within the relation, and flags */ + uint16 data_length; /* number of payload bytes (not including page + * image) */ + + /* If BKPBLOCK_HAS_IMAGE, an XLogRecordBlockImageHeader struct follows */ + /* If BKPBLOCK_SAME_REL is not set, a RelFileLocator follows */ + /* BlockNumber follows */ +} XLogRecordBlockHeader; + +#define SizeOfXLogRecordBlockHeader (offsetof(XLogRecordBlockHeader, data_length) + sizeof(uint16)) + +/* + * Additional header information when a full-page image is included + * (i.e. when BKPBLOCK_HAS_IMAGE is set). + * + * The XLOG code is aware that PG data pages usually contain an unused "hole" + * in the middle, which contains only zero bytes. Since we know that the + * "hole" is all zeros, we remove it from the stored data (and it's not counted + * in the XLOG record's CRC, either). Hence, the amount of block data actually + * present is (BLCKSZ - ). + * + * Additionally, when wal_compression is enabled, we will try to compress full + * page images using one of the supported algorithms, after removing the + * "hole". This can reduce the WAL volume, but at some extra cost of CPU spent + * on the compression during WAL logging. In this case, since the "hole" + * length cannot be calculated by subtracting the number of page image bytes + * from BLCKSZ, basically it needs to be stored as an extra information. + * But when no "hole" exists, we can assume that the "hole" length is zero + * and no such an extra information needs to be stored. Note that + * the original version of page image is stored in WAL instead of the + * compressed one if the number of bytes saved by compression is less than + * the length of extra information. Hence, when a page image is successfully + * compressed, the amount of block data actually present is less than + * BLCKSZ - the length of "hole" bytes - the length of extra information. + */ +typedef struct XLogRecordBlockImageHeader +{ + uint16 length; /* number of page image bytes */ + uint16 hole_offset; /* number of bytes before "hole" */ + uint8 bimg_info; /* flag bits, see below */ + + /* + * If BKPIMAGE_HAS_HOLE and BKPIMAGE_COMPRESSED(), an + * XLogRecordBlockCompressHeader struct follows. + */ +} XLogRecordBlockImageHeader; + +#define SizeOfXLogRecordBlockImageHeader \ + (offsetof(XLogRecordBlockImageHeader, bimg_info) + sizeof(uint8)) + +/* Information stored in bimg_info */ +#define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */ +#define BKPIMAGE_APPLY 0x02 /* page image should be restored + * during replay */ +/* compression methods supported */ +#define BKPIMAGE_COMPRESS_PGLZ 0x04 +#define BKPIMAGE_COMPRESS_LZ4 0x08 +#define BKPIMAGE_COMPRESS_ZSTD 0x10 + +#define BKPIMAGE_COMPRESSED(info) \ + ((info & (BKPIMAGE_COMPRESS_PGLZ | BKPIMAGE_COMPRESS_LZ4 | \ + BKPIMAGE_COMPRESS_ZSTD)) != 0) + +/* + * Extra header information used when page image has "hole" and + * is compressed. + */ +typedef struct XLogRecordBlockCompressHeader +{ + uint16 hole_length; /* number of bytes in "hole" */ +} XLogRecordBlockCompressHeader; + +#define SizeOfXLogRecordBlockCompressHeader \ + sizeof(XLogRecordBlockCompressHeader) + +/* + * Maximum size of the header for a block reference. This is used to size a + * temporary buffer for constructing the header. + */ +#define MaxSizeOfXLogRecordBlockHeader \ + (SizeOfXLogRecordBlockHeader + \ + SizeOfXLogRecordBlockImageHeader + \ + SizeOfXLogRecordBlockCompressHeader + \ + sizeof(RelFileLocator) + \ + sizeof(BlockNumber)) + +/* + * The fork number fits in the lower 4 bits in the fork_flags field. The upper + * bits are used for flags. + */ +#define BKPBLOCK_FORK_MASK 0x0F +#define BKPBLOCK_FLAG_MASK 0xF0 +#define BKPBLOCK_HAS_IMAGE 0x10 /* block data is an XLogRecordBlockImage */ +#define BKPBLOCK_HAS_DATA 0x20 +#define BKPBLOCK_WILL_INIT 0x40 /* redo will re-init the page */ +#define BKPBLOCK_SAME_REL 0x80 /* RelFileLocator omitted, same as + * previous */ + +/* + * XLogRecordDataHeaderShort/Long are used for the "main data" portion of + * the record. If the length of the data is less than 256 bytes, the short + * form is used, with a single byte to hold the length. Otherwise the long + * form is used. + * + * (These structs are currently not used in the code, they are here just for + * documentation purposes). + */ +typedef struct XLogRecordDataHeaderShort +{ + uint8 id; /* XLR_BLOCK_ID_DATA_SHORT */ + uint8 data_length; /* number of payload bytes */ +} XLogRecordDataHeaderShort; + +#define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2) + +typedef struct XLogRecordDataHeaderLong +{ + uint8 id; /* XLR_BLOCK_ID_DATA_LONG */ + /* followed by uint32 data_length, unaligned */ +} XLogRecordDataHeaderLong; + +#define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32)) + +/* + * Block IDs used to distinguish different kinds of record fragments. Block + * references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use + * any ID number in that range (although you should stick to small numbers, + * because the WAL machinery is optimized for that case). A few ID + * numbers are reserved to denote the "main" data portion of the record, + * as well as replication-supporting transaction metadata. + * + * The maximum is currently set at 32, quite arbitrarily. Most records only + * need a handful of block references, but there are a few exceptions that + * need more. + */ +#define XLR_MAX_BLOCK_ID 32 + +#define XLR_BLOCK_ID_DATA_SHORT 255 +#define XLR_BLOCK_ID_DATA_LONG 254 +#define XLR_BLOCK_ID_ORIGIN 253 +#define XLR_BLOCK_ID_TOPLEVEL_XID 252 + +#endif /* XLOGRECORD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogrecovery.h b/platform/dbops/binaries/postgres/include/server/access/xlogrecovery.h new file mode 100644 index 0000000000000000000000000000000000000000..c423464e8bc1567dd53b5c7789f3d58474b869ed --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogrecovery.h @@ -0,0 +1,158 @@ +/* + * xlogrecovery.h + * + * Functions for WAL recovery and standby mode + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogrecovery.h + */ +#ifndef XLOGRECOVERY_H +#define XLOGRECOVERY_H + +#include "access/xlogreader.h" +#include "catalog/pg_control.h" +#include "lib/stringinfo.h" +#include "utils/timestamp.h" + +/* + * Recovery target type. + * Only set during a Point in Time recovery, not when in standby mode. + */ +typedef enum +{ + RECOVERY_TARGET_UNSET, + RECOVERY_TARGET_XID, + RECOVERY_TARGET_TIME, + RECOVERY_TARGET_NAME, + RECOVERY_TARGET_LSN, + RECOVERY_TARGET_IMMEDIATE, +} RecoveryTargetType; + +/* + * Recovery target TimeLine goal + */ +typedef enum +{ + RECOVERY_TARGET_TIMELINE_CONTROLFILE, + RECOVERY_TARGET_TIMELINE_LATEST, + RECOVERY_TARGET_TIMELINE_NUMERIC, +} RecoveryTargetTimeLineGoal; + +/* Recovery pause states */ +typedef enum RecoveryPauseState +{ + RECOVERY_NOT_PAUSED, /* pause not requested */ + RECOVERY_PAUSE_REQUESTED, /* pause requested, but not yet paused */ + RECOVERY_PAUSED, /* recovery is paused */ +} RecoveryPauseState; + +/* User-settable GUC parameters */ +extern PGDLLIMPORT bool recoveryTargetInclusive; +extern PGDLLIMPORT int recoveryTargetAction; +extern PGDLLIMPORT int recovery_min_apply_delay; +extern PGDLLIMPORT char *PrimaryConnInfo; +extern PGDLLIMPORT char *PrimarySlotName; +extern PGDLLIMPORT char *recoveryRestoreCommand; +extern PGDLLIMPORT char *recoveryEndCommand; +extern PGDLLIMPORT char *archiveCleanupCommand; + +/* indirectly set via GUC system */ +extern PGDLLIMPORT TransactionId recoveryTargetXid; +extern PGDLLIMPORT char *recovery_target_time_string; +extern PGDLLIMPORT TimestampTz recoveryTargetTime; +extern PGDLLIMPORT const char *recoveryTargetName; +extern PGDLLIMPORT XLogRecPtr recoveryTargetLSN; +extern PGDLLIMPORT RecoveryTargetType recoveryTarget; +extern PGDLLIMPORT bool wal_receiver_create_temp_slot; +extern PGDLLIMPORT RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal; +extern PGDLLIMPORT TimeLineID recoveryTargetTLIRequested; +extern PGDLLIMPORT TimeLineID recoveryTargetTLI; + +/* Have we already reached a consistent database state? */ +extern PGDLLIMPORT bool reachedConsistency; + +/* Are we currently in standby mode? */ +extern PGDLLIMPORT bool StandbyMode; + +extern Size XLogRecoveryShmemSize(void); +extern void XLogRecoveryShmemInit(void); + +extern void InitWalRecovery(ControlFileData *ControlFile, + bool *wasShutdown_ptr, bool *haveBackupLabel_ptr, + bool *haveTblspcMap_ptr); +extern void PerformWalRecovery(void); + +/* + * FinishWalRecovery() returns this. It contains information about the point + * where recovery ended, and why it ended. + */ +typedef struct +{ + /* + * Information about the last valid or applied record, after which new WAL + * can be appended. 'lastRec' is the position where the last record + * starts, and 'endOfLog' is its end. 'lastPage' is a copy of the last + * partial page that contains endOfLog (or NULL if endOfLog is exactly at + * page boundary). 'lastPageBeginPtr' is the position where the last page + * begins. + * + * endOfLogTLI is the TLI in the filename of the XLOG segment containing + * the last applied record. It could be different from lastRecTLI, if + * there was a timeline switch in that segment, and we were reading the + * old WAL from a segment belonging to a higher timeline. + */ + XLogRecPtr lastRec; /* start of last valid or applied record */ + TimeLineID lastRecTLI; + XLogRecPtr endOfLog; /* end of last valid or applied record */ + TimeLineID endOfLogTLI; + + XLogRecPtr lastPageBeginPtr; /* LSN of page that contains endOfLog */ + char *lastPage; /* copy of the last page, up to endOfLog */ + + /* + * abortedRecPtr is the start pointer of a broken record at end of WAL + * when recovery completes; missingContrecPtr is the location of the first + * contrecord that went missing. See CreateOverwriteContrecordRecord for + * details. + */ + XLogRecPtr abortedRecPtr; + XLogRecPtr missingContrecPtr; + + /* short human-readable string describing why recovery ended */ + char *recoveryStopReason; + + /* + * If standby or recovery signal file was found, these flags are set + * accordingly. + */ + bool standby_signal_file_found; + bool recovery_signal_file_found; +} EndOfWalRecoveryInfo; + +extern EndOfWalRecoveryInfo *FinishWalRecovery(void); +extern void ShutdownWalRecovery(void); +extern void RemovePromoteSignalFiles(void); + +extern bool HotStandbyActive(void); +extern XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI); +extern RecoveryPauseState GetRecoveryPauseState(void); +extern void SetRecoveryPause(bool recoveryPause); +extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream); +extern TimestampTz GetLatestXTime(void); +extern TimestampTz GetCurrentChunkReplayStartTime(void); +extern XLogRecPtr GetCurrentReplayRecPtr(TimeLineID *replayEndTLI); + +extern bool PromoteIsTriggered(void); +extern bool CheckPromoteSignal(void); +extern void WakeupRecovery(void); + +extern void StartupRequestWalReceiverRestart(void); +extern void XLogRequestWalReceiverReply(void); + +extern void RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue); + +extern void xlog_outdesc(StringInfo buf, XLogReaderState *record); + +#endif /* XLOGRECOVERY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogstats.h b/platform/dbops/binaries/postgres/include/server/access/xlogstats.h new file mode 100644 index 0000000000000000000000000000000000000000..35bc5c974c687c51ca02ecd0db55f700e341c838 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogstats.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * xlogstats.h + * Definitions for WAL Statitstics + * + * Copyright (c) 2022-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/access/xlogstats.h + * + *------------------------------------------------------------------------- + */ +#ifndef XLOGSTATS_H +#define XLOGSTATS_H + +#include "access/rmgr.h" +#include "access/xlogreader.h" + +#define MAX_XLINFO_TYPES 16 + +typedef struct XLogRecStats +{ + uint64 count; + uint64 rec_len; + uint64 fpi_len; +} XLogRecStats; + +typedef struct XLogStats +{ + uint64 count; +#ifdef FRONTEND + XLogRecPtr startptr; + XLogRecPtr endptr; +#endif + XLogRecStats rmgr_stats[RM_MAX_ID + 1]; + XLogRecStats record_stats[RM_MAX_ID + 1][MAX_XLINFO_TYPES]; +} XLogStats; + +extern void XLogRecGetLen(XLogReaderState *record, uint32 *rec_len, + uint32 *fpi_len); +extern void XLogRecStoreStats(XLogStats *stats, XLogReaderState *record); + +#endif /* XLOGSTATS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/access/xlogutils.h b/platform/dbops/binaries/postgres/include/server/access/xlogutils.h new file mode 100644 index 0000000000000000000000000000000000000000..e24613e8f8174a9b7ba0393753dcdaecd58bb389 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/access/xlogutils.h @@ -0,0 +1,118 @@ +/* + * xlogutils.h + * + * Utilities for replaying WAL records. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/xlogutils.h + */ +#ifndef XLOG_UTILS_H +#define XLOG_UTILS_H + +#include "access/xlogreader.h" +#include "storage/bufmgr.h" + +/* + * Prior to 8.4, all activity during recovery was carried out by the startup + * process. This local variable continues to be used in many parts of the + * code to indicate actions taken by RecoveryManagers. Other processes that + * potentially perform work during recovery should check RecoveryInProgress(). + * See XLogCtl notes in xlog.c. + */ +extern PGDLLIMPORT bool InRecovery; + +/* + * Like InRecovery, standbyState is only valid in the startup process. + * In all other processes it will have the value STANDBY_DISABLED (so + * InHotStandby will read as false). + * + * In DISABLED state, we're performing crash recovery or hot standby was + * disabled in postgresql.conf. + * + * In INITIALIZED state, we've run InitRecoveryTransactionEnvironment, but + * we haven't yet processed a RUNNING_XACTS or shutdown-checkpoint WAL record + * to initialize our primary-transaction tracking system. + * + * When the transaction tracking is initialized, we enter the SNAPSHOT_PENDING + * state. The tracked information might still be incomplete, so we can't allow + * connections yet, but redo functions must update the in-memory state when + * appropriate. + * + * In SNAPSHOT_READY mode, we have full knowledge of transactions that are + * (or were) running on the primary at the current WAL location. Snapshots + * can be taken, and read-only queries can be run. + */ +typedef enum +{ + STANDBY_DISABLED, + STANDBY_INITIALIZED, + STANDBY_SNAPSHOT_PENDING, + STANDBY_SNAPSHOT_READY, +} HotStandbyState; + +extern PGDLLIMPORT HotStandbyState standbyState; + +#define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING) + + +extern bool XLogHaveInvalidPages(void); +extern void XLogCheckInvalidPages(void); + +extern void XLogDropRelation(RelFileLocator rlocator, ForkNumber forknum); +extern void XLogDropDatabase(Oid dbid); +extern void XLogTruncateRelation(RelFileLocator rlocator, ForkNumber forkNum, + BlockNumber nblocks); + +/* Result codes for XLogReadBufferForRedo[Extended] */ +typedef enum +{ + BLK_NEEDS_REDO, /* changes from WAL record need to be applied */ + BLK_DONE, /* block is already up-to-date */ + BLK_RESTORED, /* block was restored from a full-page image */ + BLK_NOTFOUND, /* block was not found (and hence does not + * need to be replayed) */ +} XLogRedoAction; + +/* Private data of the read_local_xlog_page_no_wait callback. */ +typedef struct ReadLocalXLogPageNoWaitPrivate +{ + bool end_of_wal; /* true, when end of WAL is reached */ +} ReadLocalXLogPageNoWaitPrivate; + +extern XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, + uint8 block_id, Buffer *buf); +extern Buffer XLogInitBufferForRedo(XLogReaderState *record, uint8 block_id); +extern XLogRedoAction XLogReadBufferForRedoExtended(XLogReaderState *record, + uint8 block_id, + ReadBufferMode mode, bool get_cleanup_lock, + Buffer *buf); + +extern Buffer XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum, + BlockNumber blkno, ReadBufferMode mode, + Buffer recent_buffer); + +extern Relation CreateFakeRelcacheEntry(RelFileLocator rlocator); +extern void FreeFakeRelcacheEntry(Relation fakerel); + +extern int read_local_xlog_page(XLogReaderState *state, + XLogRecPtr targetPagePtr, int reqLen, + XLogRecPtr targetRecPtr, char *cur_page); +extern int read_local_xlog_page_no_wait(XLogReaderState *state, + XLogRecPtr targetPagePtr, int reqLen, + XLogRecPtr targetRecPtr, + char *cur_page); +extern void wal_segment_open(XLogReaderState *state, + XLogSegNo nextSegNo, + TimeLineID *tli_p); +extern void wal_segment_close(XLogReaderState *state); + +extern void XLogReadDetermineTimeline(XLogReaderState *state, + XLogRecPtr wantPage, + uint32 wantLength, + TimeLineID currTLI); + +extern void WALReadRaiseError(WALReadError *errinfo); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/archive/archive_module.h b/platform/dbops/binaries/postgres/include/server/archive/archive_module.h new file mode 100644 index 0000000000000000000000000000000000000000..763af76e542c7f136ab187d059ec779610b36fb2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/archive/archive_module.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * archive_module.h + * Exports for archive modules. + * + * Copyright (c) 2022-2024, PostgreSQL Global Development Group + * + * src/include/archive/archive_module.h + * + *------------------------------------------------------------------------- + */ +#ifndef _ARCHIVE_MODULE_H +#define _ARCHIVE_MODULE_H + +/* + * The value of the archive_library GUC. + */ +extern PGDLLIMPORT char *XLogArchiveLibrary; + +typedef struct ArchiveModuleState +{ + /* + * Private data pointer for use by an archive module. This can be used to + * store state for the module that will be passed to each of its + * callbacks. + */ + void *private_data; +} ArchiveModuleState; + +/* + * Archive module callbacks + * + * These callback functions should be defined by archive libraries and returned + * via _PG_archive_module_init(). ArchiveFileCB is the only required callback. + * For more information about the purpose of each callback, refer to the + * archive modules documentation. + */ +typedef void (*ArchiveStartupCB) (ArchiveModuleState *state); +typedef bool (*ArchiveCheckConfiguredCB) (ArchiveModuleState *state); +typedef bool (*ArchiveFileCB) (ArchiveModuleState *state, const char *file, const char *path); +typedef void (*ArchiveShutdownCB) (ArchiveModuleState *state); + +typedef struct ArchiveModuleCallbacks +{ + ArchiveStartupCB startup_cb; + ArchiveCheckConfiguredCB check_configured_cb; + ArchiveFileCB archive_file_cb; + ArchiveShutdownCB shutdown_cb; +} ArchiveModuleCallbacks; + +/* + * Type of the shared library symbol _PG_archive_module_init that is looked + * up when loading an archive library. + */ +typedef const ArchiveModuleCallbacks *(*ArchiveModuleInit) (void); + +extern PGDLLEXPORT const ArchiveModuleCallbacks *_PG_archive_module_init(void); + +/* Support for messages reported from archive module callbacks. */ + +extern PGDLLIMPORT char *arch_module_check_errdetail_string; + +#define arch_module_check_errdetail \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + arch_module_check_errdetail_string = format_elog_string + +#endif /* _ARCHIVE_MODULE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/archive/shell_archive.h b/platform/dbops/binaries/postgres/include/server/archive/shell_archive.h new file mode 100644 index 0000000000000000000000000000000000000000..6f2e92aa9b1386cd14f079ac27d6e5ced948eef1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/archive/shell_archive.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * shell_archive.h + * Exports for archiving via shell. + * + * Copyright (c) 2022-2024, PostgreSQL Global Development Group + * + * src/include/archive/shell_archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SHELL_ARCHIVE_H +#define _SHELL_ARCHIVE_H + +#include "archive/archive_module.h" + +/* + * Since the logic for archiving via a shell command is in the core server + * and does not need to be loaded via a shared library, it has a special + * initialization function. + */ +extern const ArchiveModuleCallbacks *shell_archive_init(void); + +#endif /* _SHELL_ARCHIVE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/bootstrap/bootstrap.h b/platform/dbops/binaries/postgres/include/server/bootstrap/bootstrap.h new file mode 100644 index 0000000000000000000000000000000000000000..73b78b31335d39f833068b31131253fbe0af3762 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/bootstrap/bootstrap.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * bootstrap.h + * include file for the bootstrapping code + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/bootstrap/bootstrap.h + * + *------------------------------------------------------------------------- + */ +#ifndef BOOTSTRAP_H +#define BOOTSTRAP_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + + +/* + * MAXATTR is the maximum number of attributes in a relation supported + * at bootstrap time (i.e., the max possible in a system table). + */ +#define MAXATTR 40 + +#define BOOTCOL_NULL_AUTO 1 +#define BOOTCOL_NULL_FORCE_NULL 2 +#define BOOTCOL_NULL_FORCE_NOT_NULL 3 + +extern PGDLLIMPORT Relation boot_reldesc; +extern PGDLLIMPORT Form_pg_attribute attrtypes[MAXATTR]; +extern PGDLLIMPORT int numattr; + + +extern void BootstrapModeMain(int argc, char *argv[], bool check_only) pg_attribute_noreturn(); + +extern void closerel(char *relname); +extern void boot_openrel(char *relname); + +extern void DefineAttr(char *name, char *type, int attnum, int nullness); +extern void InsertOneTuple(void); +extern void InsertOneValue(char *value, int i); +extern void InsertOneNull(int i); + +extern void index_register(Oid heap, Oid ind, const IndexInfo *indexInfo); +extern void build_indices(void); + +extern void boot_get_type_io_data(Oid typid, + int16 *typlen, + bool *typbyval, + char *typalign, + char *typdelim, + Oid *typioparam, + Oid *typinput, + Oid *typoutput); + +extern int boot_yyparse(void); + +extern int boot_yylex(void); +extern void boot_yyerror(const char *message) pg_attribute_noreturn(); + +#endif /* BOOTSTRAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/binary_upgrade.h b/platform/dbops/binaries/postgres/include/server/catalog/binary_upgrade.h new file mode 100644 index 0000000000000000000000000000000000000000..1d5826195e2734bf1cd7108157453adc95750e05 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/binary_upgrade.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * binary_upgrade.h + * variables used for binary upgrades + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/binary_upgrade.h + * + *------------------------------------------------------------------------- + */ +#ifndef BINARY_UPGRADE_H +#define BINARY_UPGRADE_H + +#include "common/relpath.h" + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_tablespace_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_mrng_pg_type_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_mrng_array_pg_type_oid; + +extern PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_heap_pg_class_relfilenumber; +extern PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_index_pg_class_relfilenumber; +extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid; +extern PGDLLIMPORT RelFileNumber binary_upgrade_next_toast_pg_class_relfilenumber; + +extern PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid; +extern PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; + +extern PGDLLIMPORT bool binary_upgrade_record_init_privs; + +#endif /* BINARY_UPGRADE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/catalog.h b/platform/dbops/binaries/postgres/include/server/catalog/catalog.h new file mode 100644 index 0000000000000000000000000000000000000000..a8dd304b1ad0d8b8b5d80b29cddb17322290dcb8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/catalog.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * catalog.h + * prototypes for functions in backend/catalog/catalog.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/catalog.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATALOG_H +#define CATALOG_H + +#include "catalog/pg_class.h" +#include "utils/relcache.h" + + +extern bool IsSystemRelation(Relation relation); +extern bool IsToastRelation(Relation relation); +extern bool IsCatalogRelation(Relation relation); +extern bool IsInplaceUpdateRelation(Relation relation); + +extern bool IsSystemClass(Oid relid, Form_pg_class reltuple); +extern bool IsToastClass(Form_pg_class reltuple); + +extern bool IsCatalogRelationOid(Oid relid); +extern bool IsInplaceUpdateOid(Oid relid); + +extern bool IsCatalogNamespace(Oid namespaceId); +extern bool IsToastNamespace(Oid namespaceId); + +extern bool IsReservedName(const char *name); + +extern bool IsSharedRelation(Oid relationId); + +extern bool IsPinnedObject(Oid classId, Oid objectId); + +extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, + AttrNumber oidcolumn); +extern RelFileNumber GetNewRelFileNumber(Oid reltablespace, + Relation pg_class, + char relpersistence); + +#endif /* CATALOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/catversion.h b/platform/dbops/binaries/postgres/include/server/catalog/catversion.h new file mode 100644 index 0000000000000000000000000000000000000000..9b4442eb181a30f42232b1d6f22bc84928e5da97 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/catversion.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * catversion.h + * "Catalog version number" for PostgreSQL. + * + * The catalog version number is used to flag incompatible changes in + * the PostgreSQL system catalogs. Whenever anyone changes the format of + * a system catalog relation, or adds, deletes, or modifies standard + * catalog entries in such a way that an updated backend wouldn't work + * with an old database (or vice versa), the catalog version number + * should be changed. The version number stored in pg_control by initdb + * is checked against the version number compiled into the backend at + * startup time, so that a backend can refuse to run in an incompatible + * database. + * + * The point of this feature is to provide a finer grain of compatibility + * checking than is possible from looking at the major version number + * stored in PG_VERSION. It shouldn't matter to end users, but during + * development cycles we usually make quite a few incompatible changes + * to the contents of the system catalogs, and we don't want to bump the + * major version number for each one. What we can do instead is bump + * this internal version number. This should save some grief for + * developers who might otherwise waste time tracking down "bugs" that + * are really just code-vs-database incompatibilities. + * + * The rule for developers is: if you commit a change that requires + * an initdb, you should update the catalog version number (as well as + * notifying the pgsql-hackers mailing list, which has been the + * informal practice for a long time). + * + * The catalog version number is placed here since modifying files in + * include/catalog is the most common kind of initdb-forcing change. + * But it could be used to protect any kind of incompatible change in + * database contents or layout, such as altering tuple headers. + * Another common reason for a catversion update is a change in parsetree + * external representation, since serialized parsetrees appear in stored + * rules and new-style SQL functions. Almost any change in primnodes.h or + * parsenodes.h will warrant a catversion update. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/catversion.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATVERSION_H +#define CATVERSION_H + +/* + * We could use anything we wanted for version numbers, but I recommend + * following the "YYYYMMDDN" style often used for DNS zone serial numbers. + * YYYYMMDD are the date of the change, and N is the number of the change + * on that day. (Hopefully we'll never commit ten independent sets of + * catalog changes on the same day...) + */ + +/* yyyymmddN */ +#define CATALOG_VERSION_NO 202406281 + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/catalog/dependency.h b/platform/dbops/binaries/postgres/include/server/catalog/dependency.h new file mode 100644 index 0000000000000000000000000000000000000000..6908ca7180ae120dc43d87a95a89ff689890fbe3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/dependency.h @@ -0,0 +1,228 @@ +/*------------------------------------------------------------------------- + * + * dependency.h + * Routines to support inter-object dependencies. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/dependency.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEPENDENCY_H +#define DEPENDENCY_H + +#include "catalog/objectaddress.h" + + +/* + * Precise semantics of a dependency relationship are specified by the + * DependencyType code (which is stored in a "char" field in pg_depend, + * so we assign ASCII-code values to the enumeration members). + * + * In all cases, a dependency relationship indicates that the referenced + * object may not be dropped without also dropping the dependent object. + * However, there are several subflavors; see the description of pg_depend + * in catalogs.sgml for details. + */ + +typedef enum DependencyType +{ + DEPENDENCY_NORMAL = 'n', + DEPENDENCY_AUTO = 'a', + DEPENDENCY_INTERNAL = 'i', + DEPENDENCY_PARTITION_PRI = 'P', + DEPENDENCY_PARTITION_SEC = 'S', + DEPENDENCY_EXTENSION = 'e', + DEPENDENCY_AUTO_EXTENSION = 'x', +} DependencyType; + +/* + * There is also a SharedDependencyType enum type that determines the exact + * semantics of an entry in pg_shdepend. Just like regular dependency entries, + * any pg_shdepend entry means that the referenced object cannot be dropped + * unless the dependent object is dropped at the same time. There are some + * additional rules however: + * + * (a) a SHARED_DEPENDENCY_OWNER entry means that the referenced object is + * the role owning the dependent object. The referenced object must be + * a pg_authid entry. + * + * (b) a SHARED_DEPENDENCY_ACL entry means that the referenced object is + * a role mentioned in the ACL field of the dependent object. The referenced + * object must be a pg_authid entry. (SHARED_DEPENDENCY_ACL entries are not + * created for the owner of an object; hence two objects may be linked by + * one or the other, but not both, of these dependency types.) + * + * (c) a SHARED_DEPENDENCY_INITACL entry means that the referenced object is + * a role mentioned in a pg_init_privs entry for the dependent object. + * The referenced object must be a pg_authid entry. (Unlike the case for + * SHARED_DEPENDENCY_ACL, we make an entry for such a role whether or not + * it is the object's owner.) + * + * (d) a SHARED_DEPENDENCY_POLICY entry means that the referenced object is + * a role mentioned in a policy object. The referenced object must be a + * pg_authid entry. + * + * (e) a SHARED_DEPENDENCY_TABLESPACE entry means that the referenced + * object is a tablespace mentioned in a relation without storage. The + * referenced object must be a pg_tablespace entry. (Relations that have + * storage don't need this: they are protected by the existence of a physical + * file in the tablespace.) + * + * SHARED_DEPENDENCY_INVALID is a value used as a parameter in internal + * routines, and is not valid in the catalog itself. + */ +typedef enum SharedDependencyType +{ + SHARED_DEPENDENCY_OWNER = 'o', + SHARED_DEPENDENCY_ACL = 'a', + SHARED_DEPENDENCY_INITACL = 'i', + SHARED_DEPENDENCY_POLICY = 'r', + SHARED_DEPENDENCY_TABLESPACE = 't', + SHARED_DEPENDENCY_INVALID = 0, +} SharedDependencyType; + +/* expansible list of ObjectAddresses (private in dependency.c) */ +typedef struct ObjectAddresses ObjectAddresses; + +/* flag bits for performDeletion/performMultipleDeletions: */ +#define PERFORM_DELETION_INTERNAL 0x0001 /* internal action */ +#define PERFORM_DELETION_CONCURRENTLY 0x0002 /* concurrent drop */ +#define PERFORM_DELETION_QUIETLY 0x0004 /* suppress notices */ +#define PERFORM_DELETION_SKIP_ORIGINAL 0x0008 /* keep original obj */ +#define PERFORM_DELETION_SKIP_EXTENSIONS 0x0010 /* keep extensions */ +#define PERFORM_DELETION_CONCURRENT_LOCK 0x0020 /* normal drop with + * concurrent lock mode */ + + +/* in dependency.c */ + +extern void AcquireDeletionLock(const ObjectAddress *object, int flags); + +extern void ReleaseDeletionLock(const ObjectAddress *object); + +extern void performDeletion(const ObjectAddress *object, + DropBehavior behavior, int flags); + +extern void performMultipleDeletions(const ObjectAddresses *objects, + DropBehavior behavior, int flags); + +extern void recordDependencyOnExpr(const ObjectAddress *depender, + Node *expr, List *rtable, + DependencyType behavior); + +extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, + Node *expr, Oid relId, + DependencyType behavior, + DependencyType self_behavior, + bool reverse_self); + +extern ObjectAddresses *new_object_addresses(void); + +extern void add_exact_object_address(const ObjectAddress *object, + ObjectAddresses *addrs); + +extern bool object_address_present(const ObjectAddress *object, + const ObjectAddresses *addrs); + +extern void record_object_address_dependencies(const ObjectAddress *depender, + ObjectAddresses *referenced, + DependencyType behavior); + +extern void sort_object_addresses(ObjectAddresses *addrs); + +extern void free_object_addresses(ObjectAddresses *addrs); + +/* in pg_depend.c */ + +extern void recordDependencyOn(const ObjectAddress *depender, + const ObjectAddress *referenced, + DependencyType behavior); + +extern void recordMultipleDependencies(const ObjectAddress *depender, + const ObjectAddress *referenced, + int nreferenced, + DependencyType behavior); + +extern void recordDependencyOnCurrentExtension(const ObjectAddress *object, + bool isReplace); + +extern void checkMembershipInCurrentExtension(const ObjectAddress *object); + +extern long deleteDependencyRecordsFor(Oid classId, Oid objectId, + bool skipExtensionDeps); + +extern long deleteDependencyRecordsForClass(Oid classId, Oid objectId, + Oid refclassId, char deptype); + +extern long deleteDependencyRecordsForSpecific(Oid classId, Oid objectId, + char deptype, + Oid refclassId, Oid refobjectId); + +extern long changeDependencyFor(Oid classId, Oid objectId, + Oid refClassId, Oid oldRefObjectId, + Oid newRefObjectId); + +extern long changeDependenciesOf(Oid classId, Oid oldObjectId, + Oid newObjectId); + +extern long changeDependenciesOn(Oid refClassId, Oid oldRefObjectId, + Oid newRefObjectId); + +extern Oid getExtensionOfObject(Oid classId, Oid objectId); +extern List *getAutoExtensionsOfObject(Oid classId, Oid objectId); + +extern bool sequenceIsOwned(Oid seqId, char deptype, Oid *tableId, int32 *colId); +extern List *getOwnedSequences(Oid relid); +extern Oid getIdentitySequence(Relation rel, AttrNumber attnum, bool missing_ok); + +extern Oid get_index_constraint(Oid indexId); + +extern List *get_index_ref_constraints(Oid indexId); + +/* in pg_shdepend.c */ + +extern void recordSharedDependencyOn(ObjectAddress *depender, + ObjectAddress *referenced, + SharedDependencyType deptype); + +extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, + int32 objectSubId); + +extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner); + +extern void changeDependencyOnOwner(Oid classId, Oid objectId, + Oid newOwnerId); + +extern void recordDependencyOnTablespace(Oid classId, Oid objectId, + Oid tablespace); + +extern void changeDependencyOnTablespace(Oid classId, Oid objectId, + Oid newTablespaceId); + +extern void updateAclDependencies(Oid classId, Oid objectId, int32 objsubId, + Oid ownerId, + int noldmembers, Oid *oldmembers, + int nnewmembers, Oid *newmembers); + +extern void updateInitAclDependencies(Oid classId, Oid objectId, int32 objsubId, + int noldmembers, Oid *oldmembers, + int nnewmembers, Oid *newmembers); + +extern bool checkSharedDependencies(Oid classId, Oid objectId, + char **detail_msg, char **detail_log_msg); + +extern void shdepLockAndCheckObject(Oid classId, Oid objectId); + +extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId); + +extern void dropDatabaseDependencies(Oid databaseId); + +extern void shdepDropOwned(List *roleids, DropBehavior behavior); + +extern void shdepReassignOwned(List *roleids, Oid newrole); + +#endif /* DEPENDENCY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/genbki.h b/platform/dbops/binaries/postgres/include/server/catalog/genbki.h new file mode 100644 index 0000000000000000000000000000000000000000..201c8c7ef9b76a817a1bfd43be87bb7a8a74a4f7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/genbki.h @@ -0,0 +1,149 @@ +/*------------------------------------------------------------------------- + * + * genbki.h + * Required include file for all POSTGRES catalog header files + * + * genbki.h defines CATALOG(), BKI_BOOTSTRAP and related macros + * so that the catalog header files can be read by the C compiler. + * (These same words are recognized by genbki.pl to build the BKI + * bootstrap file from these header files.) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/genbki.h + * + *------------------------------------------------------------------------- + */ +#ifndef GENBKI_H +#define GENBKI_H + +/* Introduces a catalog's structure definition */ +#define CATALOG(name,oid,oidmacro) typedef struct CppConcat(FormData_,name) + +/* Options that may appear after CATALOG (on the same line) */ +#define BKI_BOOTSTRAP +#define BKI_SHARED_RELATION +#define BKI_ROWTYPE_OID(oid,oidmacro) +#define BKI_SCHEMA_MACRO + +/* Options that may appear after an attribute (on the same line) */ +#define BKI_FORCE_NULL +#define BKI_FORCE_NOT_NULL +/* Specifies a default value for a catalog field */ +#define BKI_DEFAULT(value) +/* Specifies a default value for auto-generated array types */ +#define BKI_ARRAY_DEFAULT(value) +/* + * Indicates that the attribute contains OIDs referencing the named catalog; + * can be applied to columns of oid, regproc, oid[], or oidvector type. + * genbki.pl uses this to know how to perform name lookups in the initial + * data (if any), and it also feeds into regression-test validity checks. + * The _OPT suffix indicates that values can be zero instead of + * a valid OID reference. + */ +#define BKI_LOOKUP(catalog) +#define BKI_LOOKUP_OPT(catalog) + +/* + * These lines are processed by genbki.pl to create the statements + * the bootstrap parser will turn into BootstrapToastTable commands. + * Each line specifies the system catalog that needs a toast table, + * the OID to assign to the toast table, and the OID to assign to the + * toast table's index. The reason we hard-wire these OIDs is that we + * need stable OIDs for shared relations, and that includes toast tables + * of shared relations. + * + * The DECLARE_TOAST_WITH_MACRO variant is used when C macros are needed + * for the toast table/index OIDs (usually only for shared catalogs). + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable +#define DECLARE_TOAST_WITH_MACRO(name,toastoid,indexoid,toastoidmacro,indexoidmacro) extern int no_such_variable + +/* + * These lines are processed by genbki.pl to create the statements + * the bootstrap parser will turn into DefineIndex calls. + * + * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX or + * DECLARE_UNIQUE_INDEX_PKEY. ("PKEY" marks the index as being the catalog's + * primary key; currently this is only cosmetically different from a regular + * unique index. By convention, we usually make a catalog's OID column its + * pkey, if it has one.) + * + * The first two arguments are the index's name and OID. The third argument + * is the name of a #define to generate for its OID. References to the index + * in the C code should always use these #defines, not the actual index name + * (much less the numeric OID). The fourth argument is the table name. The + * rest is much like a standard 'create index' SQL command. + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_INDEX(name,oid,oidmacro,tblname,decl) extern int no_such_variable +#define DECLARE_UNIQUE_INDEX(name,oid,oidmacro,tblname,decl) extern int no_such_variable +#define DECLARE_UNIQUE_INDEX_PKEY(name,oid,oidmacro,tblname,decl) extern int no_such_variable + +/* + * These lines inform genbki.pl about manually-assigned OIDs that do not + * correspond to any entry in the catalog *.dat files, but should be subject + * to uniqueness verification and renumber_oids.pl renumbering. A C macro + * to #define the given name is emitted into the corresponding *_d.h file. + */ +#define DECLARE_OID_DEFINING_MACRO(name,oid) extern int no_such_variable + +/* + * These lines are processed by genbki.pl to create a table for use + * by the pg_get_catalog_foreign_keys() function. We do not have any + * mechanism that actually enforces foreign-key relationships in the + * system catalogs, but it is still useful to record the intended + * relationships in a machine-readable form. + * + * The keyword is DECLARE_FOREIGN_KEY[_OPT] or DECLARE_ARRAY_FOREIGN_KEY[_OPT]. + * The first argument is a parenthesized list of the referencing columns; + * the second, the name of the referenced table; the third, a parenthesized + * list of the referenced columns. Use of the ARRAY macros means that the + * last referencing column is an array, each of whose elements is supposed + * to match some entry in the last referenced column. Use of the OPT suffix + * indicates that the referencing column(s) can be zero instead of a valid + * reference. + * + * Columns that are marked with a BKI_LOOKUP rule do not need an explicit + * DECLARE_FOREIGN_KEY macro, as genbki.pl can infer the FK relationship + * from that. Thus, these macros are only needed in special cases. + * + * The macro definitions are just to keep the C compiler from spitting up. + */ +#define DECLARE_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_ARRAY_FOREIGN_KEY(cols,reftbl,refcols) extern int no_such_variable +#define DECLARE_ARRAY_FOREIGN_KEY_OPT(cols,reftbl,refcols) extern int no_such_variable + +/* + * Create a syscache with the given name, index, and bucket size. See + * syscache.c. + */ +#define MAKE_SYSCACHE(name,idxname,nbuckets) extern int no_such_variable + +/* The following are never defined; they are here only for documentation. */ + +/* + * Variable-length catalog fields (except possibly the first not nullable one) + * should not be visible in C structures, so they are made invisible by #ifdefs + * of an undefined symbol. See also the BOOTCOL_NULL_AUTO code in bootstrap.c + * for how this is handled. + */ +#undef CATALOG_VARLEN + +/* + * There is code in some catalog headers that needs to be visible to clients, + * but we don't want clients to include the full header because of safety + * issues with other code in the header. To handle that, surround code that + * should be visible to clients with "#ifdef EXPOSE_TO_CLIENT_CODE". That + * instructs genbki.pl to copy the section when generating the corresponding + * "_d" header, which can be included by both client and backend code. + */ +#undef EXPOSE_TO_CLIENT_CODE + +#endif /* GENBKI_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/heap.h b/platform/dbops/binaries/postgres/include/server/catalog/heap.h new file mode 100644 index 0000000000000000000000000000000000000000..c512824cd1cc1027cc07c2b6d6a70c3cbb07a606 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/heap.h @@ -0,0 +1,159 @@ +/*------------------------------------------------------------------------- + * + * heap.h + * prototypes for functions in backend/catalog/heap.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/heap.h + * + *------------------------------------------------------------------------- + */ +#ifndef HEAP_H +#define HEAP_H + +#include "catalog/indexing.h" +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + + +/* flag bits for CheckAttributeType/CheckAttributeNamesTypes */ +#define CHKATYPE_ANYARRAY 0x01 /* allow ANYARRAY */ +#define CHKATYPE_ANYRECORD 0x02 /* allow RECORD and RECORD[] */ +#define CHKATYPE_IS_PARTKEY 0x04 /* attname is part key # not column */ + +typedef struct RawColumnDefault +{ + AttrNumber attnum; /* attribute to attach default to */ + Node *raw_default; /* default value (untransformed parse tree) */ + bool missingMode; /* true if part of add column processing */ + char generated; /* attgenerated setting */ +} RawColumnDefault; + +typedef struct CookedConstraint +{ + ConstrType contype; /* CONSTR_DEFAULT or CONSTR_CHECK */ + Oid conoid; /* constr OID if created, otherwise Invalid */ + char *name; /* name, or NULL if none */ + AttrNumber attnum; /* which attr (only for DEFAULT) */ + Node *expr; /* transformed default or check expr */ + bool skip_validation; /* skip validation? (only for CHECK) */ + bool is_local; /* constraint has local (non-inherited) def */ + int inhcount; /* number of times constraint is inherited */ + bool is_no_inherit; /* constraint has local def and cannot be + * inherited */ +} CookedConstraint; + +extern Relation heap_create(const char *relname, + Oid relnamespace, + Oid reltablespace, + Oid relid, + RelFileNumber relfilenumber, + Oid accessmtd, + TupleDesc tupDesc, + char relkind, + char relpersistence, + bool shared_relation, + bool mapped_relation, + bool allow_system_table_mods, + TransactionId *relfrozenxid, + MultiXactId *relminmxid, + bool create_storage); + +extern Oid heap_create_with_catalog(const char *relname, + Oid relnamespace, + Oid reltablespace, + Oid relid, + Oid reltypeid, + Oid reloftypeid, + Oid ownerid, + Oid accessmtd, + TupleDesc tupdesc, + List *cooked_constraints, + char relkind, + char relpersistence, + bool shared_relation, + bool mapped_relation, + OnCommitAction oncommit, + Datum reloptions, + bool use_user_acl, + bool allow_system_table_mods, + bool is_internal, + Oid relrewrite, + ObjectAddress *typaddress); + +extern void heap_drop_with_catalog(Oid relid); + +extern void heap_truncate(List *relids); + +extern void heap_truncate_one_rel(Relation rel); + +extern void heap_truncate_check_FKs(List *relations, bool tempTables); + +extern List *heap_truncate_find_FKs(List *relationIds); + +extern void InsertPgAttributeTuples(Relation pg_attribute_rel, + TupleDesc tupdesc, + Oid new_rel_oid, + const FormExtraData_pg_attribute tupdesc_extra[], + CatalogIndexState indstate); + +extern void InsertPgClassTuple(Relation pg_class_desc, + Relation new_rel_desc, + Oid new_rel_oid, + Datum relacl, + Datum reloptions); + +extern List *AddRelationNewConstraints(Relation rel, + List *newColDefaults, + List *newConstraints, + bool allow_merge, + bool is_local, + bool is_internal, + const char *queryString); + +extern void RelationClearMissing(Relation rel); +extern void SetAttrMissing(Oid relid, char *attname, char *value); + +extern Node *cookDefault(ParseState *pstate, + Node *raw_default, + Oid atttypid, + int32 atttypmod, + const char *attname, + char attgenerated); + +extern void DeleteRelationTuple(Oid relid); +extern void DeleteAttributeTuples(Oid relid); +extern void DeleteSystemAttributeTuples(Oid relid); +extern void RemoveAttributeById(Oid relid, AttrNumber attnum); + +extern void CopyStatistics(Oid fromrelid, Oid torelid); +extern void RemoveStatistics(Oid relid, AttrNumber attnum); + +extern const FormData_pg_attribute *SystemAttributeDefinition(AttrNumber attno); + +extern const FormData_pg_attribute *SystemAttributeByName(const char *attname); + +extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, + int flags); + +extern void CheckAttributeType(const char *attname, + Oid atttypid, Oid attcollation, + List *containing_rowtypes, + int flags); + +/* pg_partitioned_table catalog manipulation functions */ +extern void StorePartitionKey(Relation rel, + char strategy, + int16 partnatts, + AttrNumber *partattrs, + List *partexprs, + Oid *partopclass, + Oid *partcollation); +extern void RemovePartitionKeyByRelId(Oid relid); +extern void StorePartitionBound(Relation rel, Relation parent, + PartitionBoundSpec *bound); + +#endif /* HEAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/index.h b/platform/dbops/binaries/postgres/include/server/catalog/index.h new file mode 100644 index 0000000000000000000000000000000000000000..7d434f8e65354a2ac89b9af78a3161d0addd32c1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/index.h @@ -0,0 +1,218 @@ +/*------------------------------------------------------------------------- + * + * index.h + * prototypes for catalog/index.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/index.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEX_H +#define INDEX_H + +#include "catalog/objectaddress.h" +#include "nodes/execnodes.h" + + +#define DEFAULT_INDEX_TYPE "btree" + +/* Action code for index_set_state_flags */ +typedef enum +{ + INDEX_CREATE_SET_READY, + INDEX_CREATE_SET_VALID, + INDEX_DROP_CLEAR_VALID, + INDEX_DROP_SET_DEAD, +} IndexStateFlagsAction; + +/* options for REINDEX */ +typedef struct ReindexParams +{ + bits32 options; /* bitmask of REINDEXOPT_* */ + Oid tablespaceOid; /* New tablespace to move indexes to. + * InvalidOid to do nothing. */ +} ReindexParams; + +/* flag bits for ReindexParams->flags */ +#define REINDEXOPT_VERBOSE 0x01 /* print progress info */ +#define REINDEXOPT_REPORT_PROGRESS 0x02 /* report pgstat progress */ +#define REINDEXOPT_MISSING_OK 0x04 /* skip missing relations */ +#define REINDEXOPT_CONCURRENTLY 0x08 /* concurrent mode */ + +/* state info for validate_index bulkdelete callback */ +typedef struct ValidateIndexState +{ + Tuplesortstate *tuplesort; /* for sorting the index TIDs */ + /* statistics (for debug purposes only): */ + double htups, + itups, + tups_inserted; +} ValidateIndexState; + +extern void index_check_primary_key(Relation heapRel, + const IndexInfo *indexInfo, + bool is_alter_table, + const IndexStmt *stmt); + +#define INDEX_CREATE_IS_PRIMARY (1 << 0) +#define INDEX_CREATE_ADD_CONSTRAINT (1 << 1) +#define INDEX_CREATE_SKIP_BUILD (1 << 2) +#define INDEX_CREATE_CONCURRENT (1 << 3) +#define INDEX_CREATE_IF_NOT_EXISTS (1 << 4) +#define INDEX_CREATE_PARTITIONED (1 << 5) +#define INDEX_CREATE_INVALID (1 << 6) + +extern Oid index_create(Relation heapRelation, + const char *indexRelationName, + Oid indexRelationId, + Oid parentIndexRelid, + Oid parentConstraintId, + RelFileNumber relFileNumber, + IndexInfo *indexInfo, + const List *indexColNames, + Oid accessMethodId, + Oid tableSpaceId, + const Oid *collationIds, + const Oid *opclassIds, + const Datum *opclassOptions, + const int16 *coloptions, + const NullableDatum *stattargets, + Datum reloptions, + bits16 flags, + bits16 constr_flags, + bool allow_system_table_mods, + bool is_internal, + Oid *constraintId); + +#define INDEX_CONSTR_CREATE_MARK_AS_PRIMARY (1 << 0) +#define INDEX_CONSTR_CREATE_DEFERRABLE (1 << 1) +#define INDEX_CONSTR_CREATE_INIT_DEFERRED (1 << 2) +#define INDEX_CONSTR_CREATE_UPDATE_INDEX (1 << 3) +#define INDEX_CONSTR_CREATE_REMOVE_OLD_DEPS (1 << 4) + +extern Oid index_concurrently_create_copy(Relation heapRelation, + Oid oldIndexId, + Oid tablespaceOid, + const char *newName); + +extern void index_concurrently_build(Oid heapRelationId, + Oid indexRelationId); + +extern void index_concurrently_swap(Oid newIndexId, + Oid oldIndexId, + const char *oldName); + +extern void index_concurrently_set_dead(Oid heapId, + Oid indexId); + +extern ObjectAddress index_constraint_create(Relation heapRelation, + Oid indexRelationId, + Oid parentConstraintId, + const IndexInfo *indexInfo, + const char *constraintName, + char constraintType, + bits16 constr_flags, + bool allow_system_table_mods, + bool is_internal); + +extern void index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode); + +extern IndexInfo *BuildIndexInfo(Relation index); + +extern IndexInfo *BuildDummyIndexInfo(Relation index); + +extern bool CompareIndexInfo(const IndexInfo *info1, const IndexInfo *info2, + const Oid *collations1, const Oid *collations2, + const Oid *opfamilies1, const Oid *opfamilies2, + const AttrMap *attmap); + +extern void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii); + +extern void FormIndexDatum(IndexInfo *indexInfo, + TupleTableSlot *slot, + EState *estate, + Datum *values, + bool *isnull); + +extern void index_build(Relation heapRelation, + Relation indexRelation, + IndexInfo *indexInfo, + bool isreindex, + bool parallel); + +extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot); + +extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action); + +extern Oid IndexGetRelation(Oid indexId, bool missing_ok); + +extern void reindex_index(const ReindexStmt *stmt, Oid indexId, + bool skip_constraint_checks, char persistence, + const ReindexParams *params); + +/* Flag bits for reindex_relation(): */ +#define REINDEX_REL_PROCESS_TOAST 0x01 +#define REINDEX_REL_SUPPRESS_INDEX_USE 0x02 +#define REINDEX_REL_CHECK_CONSTRAINTS 0x04 +#define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08 +#define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10 + +extern bool reindex_relation(const ReindexStmt *stmt, Oid relid, int flags, + const ReindexParams *params); + +extern bool ReindexIsProcessingHeap(Oid heapOid); +extern bool ReindexIsProcessingIndex(Oid indexOid); + +extern void ResetReindexState(int nestLevel); +extern Size EstimateReindexStateSpace(void); +extern void SerializeReindexState(Size maxsize, char *start_address); +extern void RestoreReindexState(const void *reindexstate); + +extern void IndexSetParentIndex(Relation partitionIdx, Oid parentOid); + + +/* + * itemptr_encode - Encode ItemPointer as int64/int8 + * + * This representation must produce values encoded as int64 that sort in the + * same order as their corresponding original TID values would (using the + * default int8 opclass to produce a result equivalent to the default TID + * opclass). + * + * As noted in validate_index(), this can be significantly faster. + */ +static inline int64 +itemptr_encode(ItemPointer itemptr) +{ + BlockNumber block = ItemPointerGetBlockNumber(itemptr); + OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr); + int64 encoded; + + /* + * Use the 16 least significant bits for the offset. 32 adjacent bits are + * used for the block number. Since remaining bits are unused, there + * cannot be negative encoded values (We assume a two's complement + * representation). + */ + encoded = ((uint64) block << 16) | (uint16) offset; + + return encoded; +} + +/* + * itemptr_decode - Decode int64/int8 representation back to ItemPointer + */ +static inline void +itemptr_decode(ItemPointer itemptr, int64 encoded) +{ + BlockNumber block = (BlockNumber) (encoded >> 16); + OffsetNumber offset = (OffsetNumber) (encoded & 0xFFFF); + + ItemPointerSet(itemptr, block, offset); +} + +#endif /* INDEX_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/indexing.h b/platform/dbops/binaries/postgres/include/server/catalog/indexing.h new file mode 100644 index 0000000000000000000000000000000000000000..30b535005996560fb5dcaa442b881467a5a1de69 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/indexing.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * indexing.h + * This file provides some definitions to support indexing + * on system catalogs + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/indexing.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEXING_H +#define INDEXING_H + +#include "access/htup.h" +#include "nodes/execnodes.h" +#include "utils/relcache.h" + +/* + * The state object used by CatalogOpenIndexes and friends is actually the + * same as the executor's ResultRelInfo, but we give it another type name + * to decouple callers from that fact. + */ +typedef struct ResultRelInfo *CatalogIndexState; + +/* + * Cap the maximum amount of bytes allocated for multi-inserts with system + * catalogs, limiting the number of slots used. + */ +#define MAX_CATALOG_MULTI_INSERT_BYTES 65535 + +/* + * indexing.c prototypes + */ +extern CatalogIndexState CatalogOpenIndexes(Relation heapRel); +extern void CatalogCloseIndexes(CatalogIndexState indstate); +extern void CatalogTupleInsert(Relation heapRel, HeapTuple tup); +extern void CatalogTupleInsertWithInfo(Relation heapRel, HeapTuple tup, + CatalogIndexState indstate); +extern void CatalogTuplesMultiInsertWithInfo(Relation heapRel, + TupleTableSlot **slot, + int ntuples, + CatalogIndexState indstate); +extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, + HeapTuple tup); +extern void CatalogTupleUpdateWithInfo(Relation heapRel, + ItemPointer otid, HeapTuple tup, + CatalogIndexState indstate); +extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid); + +#endif /* INDEXING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/namespace.h b/platform/dbops/binaries/postgres/include/server/catalog/namespace.h new file mode 100644 index 0000000000000000000000000000000000000000..8d434d48d573a51a45cd674b2faf4ea6bd5eb9ee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/namespace.h @@ -0,0 +1,189 @@ +/*------------------------------------------------------------------------- + * + * namespace.h + * prototypes for functions in backend/catalog/namespace.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/namespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef NAMESPACE_H +#define NAMESPACE_H + +#include "nodes/primnodes.h" +#include "storage/lock.h" +#include "storage/procnumber.h" + + +/* + * This structure holds a list of possible functions or operators + * found by namespace lookup. Each function/operator is identified + * by OID and by argument types; the list must be pruned by type + * resolution rules that are embodied in the parser, not here. + * See FuncnameGetCandidates's comments for more info. + */ +typedef struct _FuncCandidateList +{ + struct _FuncCandidateList *next; + int pathpos; /* for internal use of namespace lookup */ + Oid oid; /* the function or operator's OID */ + int nominalnargs; /* either pronargs or length(proallargtypes) */ + int nargs; /* number of arg types returned */ + int nvargs; /* number of args to become variadic array */ + int ndargs; /* number of defaulted args */ + int *argnumbers; /* args' positional indexes, if named call */ + Oid args[FLEXIBLE_ARRAY_MEMBER]; /* arg types */ +} *FuncCandidateList; + +/* + * Result of checkTempNamespaceStatus + */ +typedef enum TempNamespaceStatus +{ + TEMP_NAMESPACE_NOT_TEMP, /* nonexistent, or non-temp namespace */ + TEMP_NAMESPACE_IDLE, /* exists, belongs to no active session */ + TEMP_NAMESPACE_IN_USE, /* belongs to some active session */ +} TempNamespaceStatus; + +/* + * Structure for xxxSearchPathMatcher functions + * + * The generation counter is private to namespace.c and shouldn't be touched + * by other code. It can be initialized to zero if necessary (that means + * "not known equal to the current active path"). + */ +typedef struct SearchPathMatcher +{ + List *schemas; /* OIDs of explicitly named schemas */ + bool addCatalog; /* implicitly prepend pg_catalog? */ + bool addTemp; /* implicitly prepend temp schema? */ + uint64 generation; /* for quick detection of equality to active */ +} SearchPathMatcher; + +/* + * Option flag bits for RangeVarGetRelidExtended(). + */ +typedef enum RVROption +{ + RVR_MISSING_OK = 1 << 0, /* don't error if relation doesn't exist */ + RVR_NOWAIT = 1 << 1, /* error if relation cannot be locked */ + RVR_SKIP_LOCKED = 1 << 2, /* skip if relation cannot be locked */ +} RVROption; + +typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId, + Oid oldRelId, void *callback_arg); + +#define RangeVarGetRelid(relation, lockmode, missing_ok) \ + RangeVarGetRelidExtended(relation, lockmode, \ + (missing_ok) ? RVR_MISSING_OK : 0, NULL, NULL) + +extern Oid RangeVarGetRelidExtended(const RangeVar *relation, + LOCKMODE lockmode, uint32 flags, + RangeVarGetRelidCallback callback, + void *callback_arg); +extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation); +extern Oid RangeVarGetAndCheckCreationNamespace(RangeVar *relation, + LOCKMODE lockmode, + Oid *existing_relation_id); +extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid); +extern Oid RelnameGetRelid(const char *relname); +extern bool RelationIsVisible(Oid relid); + +extern Oid TypenameGetTypid(const char *typname); +extern Oid TypenameGetTypidExtended(const char *typname, bool temp_ok); +extern bool TypeIsVisible(Oid typid); + +extern FuncCandidateList FuncnameGetCandidates(List *names, + int nargs, List *argnames, + bool expand_variadic, + bool expand_defaults, + bool include_out_arguments, + bool missing_ok); +extern bool FunctionIsVisible(Oid funcid); + +extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright); +extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind, + bool missing_schema_ok); +extern bool OperatorIsVisible(Oid oprid); + +extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname); +extern bool OpclassIsVisible(Oid opcid); + +extern Oid OpfamilynameGetOpfid(Oid amid, const char *opfname); +extern bool OpfamilyIsVisible(Oid opfid); + +extern Oid CollationGetCollid(const char *collname); +extern bool CollationIsVisible(Oid collid); + +extern Oid ConversionGetConid(const char *conname); +extern bool ConversionIsVisible(Oid conid); + +extern Oid get_statistics_object_oid(List *names, bool missing_ok); +extern bool StatisticsObjIsVisible(Oid stxid); + +extern Oid get_ts_parser_oid(List *names, bool missing_ok); +extern bool TSParserIsVisible(Oid prsId); + +extern Oid get_ts_dict_oid(List *names, bool missing_ok); +extern bool TSDictionaryIsVisible(Oid dictId); + +extern Oid get_ts_template_oid(List *names, bool missing_ok); +extern bool TSTemplateIsVisible(Oid tmplId); + +extern Oid get_ts_config_oid(List *names, bool missing_ok); +extern bool TSConfigIsVisible(Oid cfgid); + +extern void DeconstructQualifiedName(const List *names, + char **nspname_p, + char **objname_p); +extern Oid LookupNamespaceNoError(const char *nspname); +extern Oid LookupExplicitNamespace(const char *nspname, bool missing_ok); +extern Oid get_namespace_oid(const char *nspname, bool missing_ok); + +extern Oid LookupCreationNamespace(const char *nspname); +extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid); +extern Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p); +extern RangeVar *makeRangeVarFromNameList(const List *names); +extern char *NameListToString(const List *names); +extern char *NameListToQuotedString(const List *names); + +extern bool isTempNamespace(Oid namespaceId); +extern bool isTempToastNamespace(Oid namespaceId); +extern bool isTempOrTempToastNamespace(Oid namespaceId); +extern bool isAnyTempNamespace(Oid namespaceId); +extern bool isOtherTempNamespace(Oid namespaceId); +extern TempNamespaceStatus checkTempNamespaceStatus(Oid namespaceId); +extern ProcNumber GetTempNamespaceProcNumber(Oid namespaceId); +extern Oid GetTempToastNamespace(void); +extern void GetTempNamespaceState(Oid *tempNamespaceId, + Oid *tempToastNamespaceId); +extern void SetTempNamespaceState(Oid tempNamespaceId, + Oid tempToastNamespaceId); +extern void ResetTempTableNamespace(void); + +extern SearchPathMatcher *GetSearchPathMatcher(MemoryContext context); +extern SearchPathMatcher *CopySearchPathMatcher(SearchPathMatcher *path); +extern bool SearchPathMatchesCurrentEnvironment(SearchPathMatcher *path); + +extern Oid get_collation_oid(List *collname, bool missing_ok); +extern Oid get_conversion_oid(List *conname, bool missing_ok); +extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding); + + +/* initialization & transaction cleanup code */ +extern void InitializeSearchPath(void); +extern void AtEOXact_Namespace(bool isCommit, bool parallel); +extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +/* stuff for search_path GUC variable */ +extern PGDLLIMPORT char *namespace_search_path; + +extern List *fetch_search_path(bool includeImplicit); +extern int fetch_search_path_array(Oid *sarray, int sarray_len); + +#endif /* NAMESPACE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/objectaccess.h b/platform/dbops/binaries/postgres/include/server/catalog/objectaccess.h new file mode 100644 index 0000000000000000000000000000000000000000..88387feb2c32218f1d8daf07be77937d62327393 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/objectaccess.h @@ -0,0 +1,267 @@ +/* + * objectaccess.h + * + * Object access hooks. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + */ + +#ifndef OBJECTACCESS_H +#define OBJECTACCESS_H + +/* + * Object access hooks are intended to be called just before or just after + * performing certain actions on a SQL object. This is intended as + * infrastructure for security or logging plugins. + * + * OAT_POST_CREATE should be invoked just after the object is created. + * Typically, this is done after inserting the primary catalog records and + * associated dependencies. The command counter may or may not be incremented + * at the time the hook is invoked; if not, the extension can use SnapshotSelf + * to get the new version of the tuple. + * + * OAT_DROP should be invoked just before deletion of objects; typically + * deleteOneObject(). Its arguments are packed within ObjectAccessDrop. + * + * OAT_POST_ALTER should be invoked just after the object is altered, + * but before the command counter is incremented. An extension using the + * hook can use a current MVCC snapshot to get the old version of the tuple, + * and can use SnapshotSelf to get the new version of the tuple. + * + * OAT_NAMESPACE_SEARCH should be invoked prior to object name lookup under + * a particular namespace. This event is equivalent to usage permission + * on a schema under the default access control mechanism. + * + * OAT_FUNCTION_EXECUTE should be invoked prior to function execution. + * This event is almost equivalent to execute permission on functions, + * except for the case when execute permission is checked during object + * creation or altering, because OAT_POST_CREATE or OAT_POST_ALTER are + * sufficient for extensions to track these kind of checks. + * + * OAT_TRUNCATE should be invoked just before truncation of objects. This + * event is equivalent to truncate permission on a relation under the + * default access control mechanism. + * + * Other types may be added in the future. + */ +typedef enum ObjectAccessType +{ + OAT_POST_CREATE, + OAT_DROP, + OAT_POST_ALTER, + OAT_NAMESPACE_SEARCH, + OAT_FUNCTION_EXECUTE, + OAT_TRUNCATE, +} ObjectAccessType; + +/* + * Arguments of OAT_POST_CREATE event + */ +typedef struct +{ + /* + * This flag informs extensions whether the context of this creation is + * invoked by user's operations, or not. E.g, it shall be dealt as + * internal stuff on toast tables or indexes due to type changes. + */ + bool is_internal; +} ObjectAccessPostCreate; + +/* + * Arguments of OAT_DROP event + */ +typedef struct +{ + /* + * Flags to inform extensions the context of this deletion. Also see + * PERFORM_DELETION_* in dependency.h + */ + int dropflags; +} ObjectAccessDrop; + +/* + * Arguments of OAT_POST_ALTER event + */ +typedef struct +{ + /* + * This identifier is used when system catalog takes two IDs to identify a + * particular tuple of the catalog. It is only used when the caller want + * to identify an entry of pg_inherits, pg_db_role_setting or + * pg_user_mapping. Elsewhere, InvalidOid should be set. + */ + Oid auxiliary_id; + + /* + * If this flag is set, the user hasn't requested that the object be + * altered, but we're doing it anyway for some internal reason. + * Permissions-checking hooks may want to skip checks if, say, we're alter + * the constraints of a temporary heap during CLUSTER. + */ + bool is_internal; +} ObjectAccessPostAlter; + +/* + * Arguments of OAT_NAMESPACE_SEARCH + */ +typedef struct +{ + /* + * If true, hook should report an error when permission to search this + * schema is denied. + */ + bool ereport_on_violation; + + /* + * This is, in essence, an out parameter. Core code should initialize + * this to true, and any extension that wants to deny access should reset + * it to false. But an extension should be careful never to store a true + * value here, so that in case there are multiple extensions access is + * only allowed if all extensions agree. + */ + bool result; +} ObjectAccessNamespaceSearch; + +/* Plugin provides a hook function matching one or both of these signatures. */ +typedef void (*object_access_hook_type) (ObjectAccessType access, + Oid classId, + Oid objectId, + int subId, + void *arg); + +typedef void (*object_access_hook_type_str) (ObjectAccessType access, + Oid classId, + const char *objectStr, + int subId, + void *arg); + +/* Plugin sets this variable to a suitable hook function. */ +extern PGDLLIMPORT object_access_hook_type object_access_hook; +extern PGDLLIMPORT object_access_hook_type_str object_access_hook_str; + + +/* Core code uses these functions to call the hook (see macros below). */ +extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId, + bool is_internal); +extern void RunObjectDropHook(Oid classId, Oid objectId, int subId, + int dropflags); +extern void RunObjectTruncateHook(Oid objectId); +extern void RunObjectPostAlterHook(Oid classId, Oid objectId, int subId, + Oid auxiliaryId, bool is_internal); +extern bool RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation); +extern void RunFunctionExecuteHook(Oid objectId); + +/* String versions */ +extern void RunObjectPostCreateHookStr(Oid classId, const char *objectName, int subId, + bool is_internal); +extern void RunObjectDropHookStr(Oid classId, const char *objectName, int subId, + int dropflags); +extern void RunObjectTruncateHookStr(const char *objectName); +extern void RunObjectPostAlterHookStr(Oid classId, const char *objectName, int subId, + Oid auxiliaryId, bool is_internal); +extern bool RunNamespaceSearchHookStr(const char *objectName, bool ereport_on_violation); +extern void RunFunctionExecuteHookStr(const char *objectName); + + +/* + * The following macros are wrappers around the functions above; these should + * normally be used to invoke the hook in lieu of calling the above functions + * directly. + */ + +#define InvokeObjectPostCreateHook(classId,objectId,subId) \ + InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false) +#define InvokeObjectPostCreateHookArg(classId,objectId,subId,is_internal) \ + do { \ + if (object_access_hook) \ + RunObjectPostCreateHook((classId),(objectId),(subId), \ + (is_internal)); \ + } while(0) + +#define InvokeObjectDropHook(classId,objectId,subId) \ + InvokeObjectDropHookArg((classId),(objectId),(subId),0) +#define InvokeObjectDropHookArg(classId,objectId,subId,dropflags) \ + do { \ + if (object_access_hook) \ + RunObjectDropHook((classId),(objectId),(subId), \ + (dropflags)); \ + } while(0) + +#define InvokeObjectTruncateHook(objectId) \ + do { \ + if (object_access_hook) \ + RunObjectTruncateHook(objectId); \ + } while(0) + +#define InvokeObjectPostAlterHook(classId,objectId,subId) \ + InvokeObjectPostAlterHookArg((classId),(objectId),(subId), \ + InvalidOid,false) +#define InvokeObjectPostAlterHookArg(classId,objectId,subId, \ + auxiliaryId,is_internal) \ + do { \ + if (object_access_hook) \ + RunObjectPostAlterHook((classId),(objectId),(subId), \ + (auxiliaryId),(is_internal)); \ + } while(0) + +#define InvokeNamespaceSearchHook(objectId, ereport_on_violation) \ + (!object_access_hook \ + ? true \ + : RunNamespaceSearchHook((objectId), (ereport_on_violation))) + +#define InvokeFunctionExecuteHook(objectId) \ + do { \ + if (object_access_hook) \ + RunFunctionExecuteHook(objectId); \ + } while(0) + + +#define InvokeObjectPostCreateHookStr(classId,objectName,subId) \ + InvokeObjectPostCreateHookArgStr((classId),(objectName),(subId),false) +#define InvokeObjectPostCreateHookArgStr(classId,objectName,subId,is_internal) \ + do { \ + if (object_access_hook_str) \ + RunObjectPostCreateHookStr((classId),(objectName),(subId), \ + (is_internal)); \ + } while(0) + +#define InvokeObjectDropHookStr(classId,objectName,subId) \ + InvokeObjectDropHookArgStr((classId),(objectName),(subId),0) +#define InvokeObjectDropHookArgStr(classId,objectName,subId,dropflags) \ + do { \ + if (object_access_hook_str) \ + RunObjectDropHookStr((classId),(objectName),(subId), \ + (dropflags)); \ + } while(0) + +#define InvokeObjectTruncateHookStr(objectName) \ + do { \ + if (object_access_hook_str) \ + RunObjectTruncateHookStr(objectName); \ + } while(0) + +#define InvokeObjectPostAlterHookStr(classId,objectName,subId) \ + InvokeObjectPostAlterHookArgStr((classId),(objectName),(subId), \ + InvalidOid,false) +#define InvokeObjectPostAlterHookArgStr(classId,objectName,subId, \ + auxiliaryId,is_internal) \ + do { \ + if (object_access_hook_str) \ + RunObjectPostAlterHookStr((classId),(objectName),(subId), \ + (auxiliaryId),(is_internal)); \ + } while(0) + +#define InvokeNamespaceSearchHookStr(objectName, ereport_on_violation) \ + (!object_access_hook_str \ + ? true \ + : RunNamespaceSearchHookStr((objectName), (ereport_on_violation))) + +#define InvokeFunctionExecuteHookStr(objectName) \ + do { \ + if (object_access_hook_str) \ + RunFunctionExecuteHookStr(objectName); \ + } while(0) + + +#endif /* OBJECTACCESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/objectaddress.h b/platform/dbops/binaries/postgres/include/server/catalog/objectaddress.h new file mode 100644 index 0000000000000000000000000000000000000000..c4ba1cb2b32933aa52516ce9906ab1e053e49f07 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/objectaddress.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * objectaddress.h + * functions for working with object addresses + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/objectaddress.h + * + *------------------------------------------------------------------------- + */ +#ifndef OBJECTADDRESS_H +#define OBJECTADDRESS_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "storage/lockdefs.h" +#include "utils/relcache.h" + +/* + * An ObjectAddress represents a database object of any type. + */ +typedef struct ObjectAddress +{ + Oid classId; /* Class Id from pg_class */ + Oid objectId; /* OID of the object */ + int32 objectSubId; /* Subitem within object (eg column), or 0 */ +} ObjectAddress; + +extern PGDLLIMPORT const ObjectAddress InvalidObjectAddress; + +#define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \ + do { \ + (addr).classId = (class_id); \ + (addr).objectId = (object_id); \ + (addr).objectSubId = (object_sub_id); \ + } while (0) + +#define ObjectAddressSet(addr, class_id, object_id) \ + ObjectAddressSubSet(addr, class_id, object_id, 0) + +extern ObjectAddress get_object_address(ObjectType objtype, Node *object, + Relation *relp, + LOCKMODE lockmode, bool missing_ok); + +extern ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel, + List *object, Relation *relp, + LOCKMODE lockmode, bool missing_ok); + +extern void check_object_ownership(Oid roleid, + ObjectType objtype, ObjectAddress address, + Node *object, Relation relation); + +extern Oid get_object_namespace(const ObjectAddress *address); + +extern bool is_objectclass_supported(Oid class_id); +extern const char *get_object_class_descr(Oid class_id); +extern Oid get_object_oid_index(Oid class_id); +extern int get_object_catcache_oid(Oid class_id); +extern int get_object_catcache_name(Oid class_id); +extern AttrNumber get_object_attnum_oid(Oid class_id); +extern AttrNumber get_object_attnum_name(Oid class_id); +extern AttrNumber get_object_attnum_namespace(Oid class_id); +extern AttrNumber get_object_attnum_owner(Oid class_id); +extern AttrNumber get_object_attnum_acl(Oid class_id); +extern ObjectType get_object_type(Oid class_id, Oid object_id); +extern bool get_object_namensp_unique(Oid class_id); + +extern HeapTuple get_catalog_object_by_oid(Relation catalog, + AttrNumber oidcol, Oid objectId); +extern HeapTuple get_catalog_object_by_oid_extended(Relation catalog, + AttrNumber oidcol, + Oid objectId, + bool locktup); + +extern char *getObjectDescription(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectDescriptionOids(Oid classid, Oid objid); + +extern int read_objtype_from_string(const char *objtype); +extern char *getObjectTypeDescription(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectIdentity(const ObjectAddress *object, + bool missing_ok); +extern char *getObjectIdentityParts(const ObjectAddress *object, + List **objname, List **objargs, + bool missing_ok); +extern struct ArrayType *strlist_to_textarray(List *list); + +extern ObjectType get_relkind_objtype(char relkind); + +#endif /* OBJECTADDRESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/partition.h b/platform/dbops/binaries/postgres/include/server/catalog/partition.h new file mode 100644 index 0000000000000000000000000000000000000000..1540fccf4be3b5a92de20479c0982858eb032eca --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/partition.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * partition.h + * Header file for structures and utility functions related to + * partitioning + * + * Copyright (c) 2007-2024, PostgreSQL Global Development Group + * + * src/include/catalog/partition.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTITION_H +#define PARTITION_H + +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* Seed for the extended hash function */ +#define HASH_PARTITION_SEED UINT64CONST(0x7A5B22367996DCFD) + +extern Oid get_partition_parent(Oid relid, bool even_if_detached); +extern List *get_partition_ancestors(Oid relid); +extern Oid index_get_partition(Relation partition, Oid indexId); +extern List *map_partition_varattnos(List *expr, int fromrel_varno, + Relation to_rel, Relation from_rel); +extern bool has_partition_attrs(Relation rel, Bitmapset *attnums, + bool *used_in_expr); + +extern Oid get_default_partition_oid(Oid parentId); +extern void update_default_partition_oid(Oid parentId, Oid defaultPartId); +extern List *get_proposed_default_constraint(List *new_part_constraints); + +#endif /* PARTITION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate.h new file mode 100644 index 0000000000000000000000000000000000000000..490f64546956ed6206a5db105dcdfed2b931a122 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate.h @@ -0,0 +1,182 @@ +/*------------------------------------------------------------------------- + * + * pg_aggregate.h + * definition of the "aggregate" system catalog (pg_aggregate) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_aggregate.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AGGREGATE_H +#define PG_AGGREGATE_H + +#include "catalog/genbki.h" +#include "catalog/pg_aggregate_d.h" + +#include "catalog/objectaddress.h" +#include "nodes/pg_list.h" + +/* ---------------------------------------------------------------- + * pg_aggregate definition. + * cpp turns this into typedef struct FormData_pg_aggregate + * ---------------------------------------------------------------- + */ +CATALOG(pg_aggregate,2600,AggregateRelationId) +{ + /* pg_proc OID of the aggregate itself */ + regproc aggfnoid BKI_LOOKUP(pg_proc); + + /* aggregate kind, see AGGKIND_ categories below */ + char aggkind BKI_DEFAULT(n); + + /* number of arguments that are "direct" arguments */ + int16 aggnumdirectargs BKI_DEFAULT(0); + + /* transition function */ + regproc aggtransfn BKI_LOOKUP(pg_proc); + + /* final function (0 if none) */ + regproc aggfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* combine function (0 if none) */ + regproc aggcombinefn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* function to convert transtype to bytea (0 if none) */ + regproc aggserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* function to convert bytea to transtype (0 if none) */ + regproc aggdeserialfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* forward function for moving-aggregate mode (0 if none) */ + regproc aggmtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* inverse function for moving-aggregate mode (0 if none) */ + regproc aggminvtransfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* final function for moving-aggregate mode (0 if none) */ + regproc aggmfinalfn BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* true to pass extra dummy arguments to aggfinalfn */ + bool aggfinalextra BKI_DEFAULT(f); + + /* true to pass extra dummy arguments to aggmfinalfn */ + bool aggmfinalextra BKI_DEFAULT(f); + + /* tells whether aggfinalfn modifies transition state */ + char aggfinalmodify BKI_DEFAULT(r); + + /* tells whether aggmfinalfn modifies transition state */ + char aggmfinalmodify BKI_DEFAULT(r); + + /* associated sort operator (0 if none) */ + Oid aggsortop BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* type of aggregate's transition (state) data */ + Oid aggtranstype BKI_LOOKUP(pg_type); + + /* estimated size of state data (0 for default estimate) */ + int32 aggtransspace BKI_DEFAULT(0); + + /* type of moving-aggregate state data (0 if none) */ + Oid aggmtranstype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* estimated size of moving-agg state (0 for default est) */ + int32 aggmtransspace BKI_DEFAULT(0); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* initial value for transition state (can be NULL) */ + text agginitval BKI_DEFAULT(_null_); + + /* initial value for moving-agg state (can be NULL) */ + text aggminitval BKI_DEFAULT(_null_); +#endif +} FormData_pg_aggregate; + +/* ---------------- + * Form_pg_aggregate corresponds to a pointer to a tuple with + * the format of pg_aggregate relation. + * ---------------- + */ +typedef FormData_pg_aggregate *Form_pg_aggregate; + +DECLARE_TOAST(pg_aggregate, 4159, 4160); + +DECLARE_UNIQUE_INDEX_PKEY(pg_aggregate_fnoid_index, 2650, AggregateFnoidIndexId, pg_aggregate, btree(aggfnoid oid_ops)); + +MAKE_SYSCACHE(AGGFNOID, pg_aggregate_fnoid_index, 16); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Symbolic values for aggkind column. We distinguish normal aggregates + * from ordered-set aggregates (which have two sets of arguments, namely + * direct and aggregated arguments) and from hypothetical-set aggregates + * (which are a subclass of ordered-set aggregates in which the last + * direct arguments have to match up in number and datatypes with the + * aggregated arguments). + */ +#define AGGKIND_NORMAL 'n' +#define AGGKIND_ORDERED_SET 'o' +#define AGGKIND_HYPOTHETICAL 'h' + +/* Use this macro to test for "ordered-set agg including hypothetical case" */ +#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL) + +/* + * Symbolic values for aggfinalmodify and aggmfinalmodify columns. + * Preferably, finalfns do not modify the transition state value at all, + * but in some cases that would cost too much performance. We distinguish + * "pure read only" and "trashes it arbitrarily" cases, as well as the + * intermediate case where multiple finalfn calls are allowed but the + * transfn cannot be applied anymore after the first finalfn call. + */ +#define AGGMODIFY_READ_ONLY 'r' +#define AGGMODIFY_SHAREABLE 's' +#define AGGMODIFY_READ_WRITE 'w' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress AggregateCreate(const char *aggName, + Oid aggNamespace, + bool replace, + char aggKind, + int numArgs, + int numDirectArgs, + oidvector *parameterTypes, + Datum allParameterTypes, + Datum parameterModes, + Datum parameterNames, + List *parameterDefaults, + Oid variadicArgType, + List *aggtransfnName, + List *aggfinalfnName, + List *aggcombinefnName, + List *aggserialfnName, + List *aggdeserialfnName, + List *aggmtransfnName, + List *aggminvtransfnName, + List *aggmfinalfnName, + bool finalfnExtraArgs, + bool mfinalfnExtraArgs, + char finalfnModify, + char mfinalfnModify, + List *aggsortopName, + Oid aggTransType, + int32 aggTransSpace, + Oid aggmTransType, + int32 aggmTransSpace, + const char *agginitval, + const char *aggminitval, + char proparallel); + +#endif /* PG_AGGREGATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c6ca1dce33df75fe276439a516138ef271afb4d5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_aggregate_d.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------- + * + * pg_aggregate_d.h + * Macro definitions for pg_aggregate + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AGGREGATE_D_H +#define PG_AGGREGATE_D_H + +#define AggregateRelationId 2600 +#define AggregateFnoidIndexId 2650 + +#define Anum_pg_aggregate_aggfnoid 1 +#define Anum_pg_aggregate_aggkind 2 +#define Anum_pg_aggregate_aggnumdirectargs 3 +#define Anum_pg_aggregate_aggtransfn 4 +#define Anum_pg_aggregate_aggfinalfn 5 +#define Anum_pg_aggregate_aggcombinefn 6 +#define Anum_pg_aggregate_aggserialfn 7 +#define Anum_pg_aggregate_aggdeserialfn 8 +#define Anum_pg_aggregate_aggmtransfn 9 +#define Anum_pg_aggregate_aggminvtransfn 10 +#define Anum_pg_aggregate_aggmfinalfn 11 +#define Anum_pg_aggregate_aggfinalextra 12 +#define Anum_pg_aggregate_aggmfinalextra 13 +#define Anum_pg_aggregate_aggfinalmodify 14 +#define Anum_pg_aggregate_aggmfinalmodify 15 +#define Anum_pg_aggregate_aggsortop 16 +#define Anum_pg_aggregate_aggtranstype 17 +#define Anum_pg_aggregate_aggtransspace 18 +#define Anum_pg_aggregate_aggmtranstype 19 +#define Anum_pg_aggregate_aggmtransspace 20 +#define Anum_pg_aggregate_agginitval 21 +#define Anum_pg_aggregate_aggminitval 22 + +#define Natts_pg_aggregate 22 + + +/* + * Symbolic values for aggkind column. We distinguish normal aggregates + * from ordered-set aggregates (which have two sets of arguments, namely + * direct and aggregated arguments) and from hypothetical-set aggregates + * (which are a subclass of ordered-set aggregates in which the last + * direct arguments have to match up in number and datatypes with the + * aggregated arguments). + */ +#define AGGKIND_NORMAL 'n' +#define AGGKIND_ORDERED_SET 'o' +#define AGGKIND_HYPOTHETICAL 'h' + +/* Use this macro to test for "ordered-set agg including hypothetical case" */ +#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL) + +/* + * Symbolic values for aggfinalmodify and aggmfinalmodify columns. + * Preferably, finalfns do not modify the transition state value at all, + * but in some cases that would cost too much performance. We distinguish + * "pure read only" and "trashes it arbitrarily" cases, as well as the + * intermediate case where multiple finalfn calls are allowed but the + * transfn cannot be applied anymore after the first finalfn call. + */ +#define AGGMODIFY_READ_ONLY 'r' +#define AGGMODIFY_SHAREABLE 's' +#define AGGMODIFY_READ_WRITE 'w' + + +#endif /* PG_AGGREGATE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_am.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_am.h new file mode 100644 index 0000000000000000000000000000000000000000..475593fad4cab6fd9cebddfcc4dddc937bfd463c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_am.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * pg_am.h + * definition of the "access method" system catalog (pg_am) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_am.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_H +#define PG_AM_H + +#include "catalog/genbki.h" +#include "catalog/pg_am_d.h" + +/* ---------------- + * pg_am definition. cpp turns this into + * typedef struct FormData_pg_am + * ---------------- + */ +CATALOG(pg_am,2601,AccessMethodRelationId) +{ + Oid oid; /* oid */ + + /* access method name */ + NameData amname; + + /* handler function */ + regproc amhandler BKI_LOOKUP(pg_proc); + + /* see AMTYPE_xxx constants below */ + char amtype; +} FormData_pg_am; + +/* ---------------- + * Form_pg_am corresponds to a pointer to a tuple with + * the format of pg_am relation. + * ---------------- + */ +typedef FormData_pg_am *Form_pg_am; + +DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, AmNameIndexId, pg_am, btree(amname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_am_oid_index, 2652, AmOidIndexId, pg_am, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMNAME, pg_am_name_index, 4); +MAKE_SYSCACHE(AMOID, pg_am_oid_index, 4); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Allowed values for amtype + */ +#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_TABLE 't' /* table access method */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_AM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_am_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_am_d.h new file mode 100644 index 0000000000000000000000000000000000000000..d0e5e24d011a3927d873b07e7a637967e4c4067c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_am_d.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * pg_am_d.h + * Macro definitions for pg_am + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_D_H +#define PG_AM_D_H + +#define AccessMethodRelationId 2601 +#define AmNameIndexId 2651 +#define AmOidIndexId 2652 + +#define Anum_pg_am_oid 1 +#define Anum_pg_am_amname 2 +#define Anum_pg_am_amhandler 3 +#define Anum_pg_am_amtype 4 + +#define Natts_pg_am 4 + + +/* + * Allowed values for amtype + */ +#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_TABLE 't' /* table access method */ + +#define HEAP_TABLE_AM_OID 2 +#define BTREE_AM_OID 403 +#define HASH_AM_OID 405 +#define GIST_AM_OID 783 +#define GIN_AM_OID 2742 +#define SPGIST_AM_OID 4000 +#define BRIN_AM_OID 3580 + +#endif /* PG_AM_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_amop.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_amop.h new file mode 100644 index 0000000000000000000000000000000000000000..570100fad418d0667e84194a0bc4325d41afb6e7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_amop.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * pg_amop.h + * definition of the "access method operator" system catalog (pg_amop) + * + * The amop table identifies the operators associated with each index operator + * family and operator class (classes are subsets of families). An associated + * operator can be either a search operator or an ordering operator, as + * identified by amoppurpose. + * + * The primary key for this table is . amoplefttype and amoprighttype are just copies of the + * operator's oprleft/oprright, ie its declared input data types. The + * "default" operators for a particular opclass within the family are those + * with amoplefttype = amoprighttype = opclass's opcintype. An opfamily may + * also contain other operators, typically cross-data-type operators. All the + * operators within a family are supposed to be compatible, in a way that is + * defined by each individual index AM. + * + * We also keep a unique index on , so that + * we can use a syscache to quickly answer questions of the form "is this + * operator in this opfamily, and if so what are its semantics with respect to + * the family?" This implies that the same operator cannot be listed for + * multiple strategy numbers within a single opfamily, with the exception that + * it's possible to list it for both search and ordering purposes (with + * different strategy numbers for the two purposes). + * + * amopmethod is a copy of the owning opfamily's opfmethod field. This is an + * intentional denormalization of the catalogs to buy lookup speed. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_amop.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMOP_H +#define PG_AMOP_H + +#include "catalog/genbki.h" +#include "catalog/pg_amop_d.h" + +/* ---------------- + * pg_amop definition. cpp turns this into + * typedef struct FormData_pg_amop + * ---------------- + */ +CATALOG(pg_amop,2602,AccessMethodOperatorRelationId) +{ + Oid oid; /* oid */ + + /* the index opfamily this entry is for */ + Oid amopfamily BKI_LOOKUP(pg_opfamily); + + /* operator's left input data type */ + Oid amoplefttype BKI_LOOKUP(pg_type); + + /* operator's right input data type */ + Oid amoprighttype BKI_LOOKUP(pg_type); + + /* operator strategy number */ + int16 amopstrategy; + + /* is operator for 's'earch or 'o'rdering? */ + char amoppurpose BKI_DEFAULT(s); + + /* the operator's pg_operator OID */ + Oid amopopr BKI_LOOKUP(pg_operator); + + /* the index access method this entry is for */ + Oid amopmethod BKI_LOOKUP(pg_am); + + /* ordering opfamily OID, or 0 if search op */ + Oid amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_opfamily); +} FormData_pg_amop; + +/* ---------------- + * Form_pg_amop corresponds to a pointer to a tuple with + * the format of pg_amop relation. + * ---------------- + */ +typedef FormData_pg_amop *Form_pg_amop; + +DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, AccessMethodStrategyIndexId, pg_amop, btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops)); +DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, AccessMethodOperatorIndexId, pg_amop, btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_amop_oid_index, 2756, AccessMethodOperatorOidIndexId, pg_amop, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMOPSTRATEGY, pg_amop_fam_strat_index, 64); +MAKE_SYSCACHE(AMOPOPID, pg_amop_opr_fam_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* allowed values of amoppurpose: */ +#define AMOP_SEARCH 's' /* operator is for search */ +#define AMOP_ORDER 'o' /* operator is for ordering */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_AMOP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_amop_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_amop_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c7b3418e12b3035e759fe3cf008da65116d5d10a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_amop_d.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_amop_d.h + * Macro definitions for pg_amop + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMOP_D_H +#define PG_AMOP_D_H + +#define AccessMethodOperatorRelationId 2602 +#define AccessMethodStrategyIndexId 2653 +#define AccessMethodOperatorIndexId 2654 +#define AccessMethodOperatorOidIndexId 2756 + +#define Anum_pg_amop_oid 1 +#define Anum_pg_amop_amopfamily 2 +#define Anum_pg_amop_amoplefttype 3 +#define Anum_pg_amop_amoprighttype 4 +#define Anum_pg_amop_amopstrategy 5 +#define Anum_pg_amop_amoppurpose 6 +#define Anum_pg_amop_amopopr 7 +#define Anum_pg_amop_amopmethod 8 +#define Anum_pg_amop_amopsortfamily 9 + +#define Natts_pg_amop 9 + + +/* allowed values of amoppurpose: */ +#define AMOP_SEARCH 's' /* operator is for search */ +#define AMOP_ORDER 'o' /* operator is for ordering */ + + +#endif /* PG_AMOP_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc.h new file mode 100644 index 0000000000000000000000000000000000000000..1dbebeca1752c19f3555d5605ed4e6d6dc6839c3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_amproc.h + * definition of the "access method procedure" system catalog (pg_amproc) + * + * The amproc table identifies support procedures associated with index + * operator families and classes. These procedures can't be listed in pg_amop + * since they are not the implementation of any indexable operator. + * + * The primary key for this table is . The "default" support functions for a + * particular opclass within the family are those with amproclefttype = + * amprocrighttype = opclass's opcintype. These are the ones loaded into the + * relcache for an index and typically used for internal index operations. + * Other support functions are typically used to handle cross-type indexable + * operators with oprleft/oprright matching the entry's amproclefttype and + * amprocrighttype. The exact behavior depends on the index AM, however, and + * some don't pay attention to non-default functions at all. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_amproc.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMPROC_H +#define PG_AMPROC_H + +#include "catalog/genbki.h" +#include "catalog/pg_amproc_d.h" + +/* ---------------- + * pg_amproc definition. cpp turns this into + * typedef struct FormData_pg_amproc + * ---------------- + */ +CATALOG(pg_amproc,2603,AccessMethodProcedureRelationId) +{ + Oid oid; /* oid */ + + /* the index opfamily this entry is for */ + Oid amprocfamily BKI_LOOKUP(pg_opfamily); + + /* procedure's left input data type */ + Oid amproclefttype BKI_LOOKUP(pg_type); + + /* procedure's right input data type */ + Oid amprocrighttype BKI_LOOKUP(pg_type); + + /* support procedure index */ + int16 amprocnum; + + /* OID of the proc */ + regproc amproc BKI_LOOKUP(pg_proc); +} FormData_pg_amproc; + +/* ---------------- + * Form_pg_amproc corresponds to a pointer to a tuple with + * the format of pg_amproc relation. + * ---------------- + */ +typedef FormData_pg_amproc *Form_pg_amproc; + +DECLARE_UNIQUE_INDEX(pg_amproc_fam_proc_index, 2655, AccessMethodProcedureIndexId, pg_amproc, btree(amprocfamily oid_ops, amproclefttype oid_ops, amprocrighttype oid_ops, amprocnum int2_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_amproc_oid_index, 2757, AccessMethodProcedureOidIndexId, pg_amproc, btree(oid oid_ops)); + +MAKE_SYSCACHE(AMPROCNUM, pg_amproc_fam_proc_index, 16); + +#endif /* PG_AMPROC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc_d.h new file mode 100644 index 0000000000000000000000000000000000000000..0cde5b781d7115f28e728980c49991193a6712f2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_amproc_d.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * pg_amproc_d.h + * Macro definitions for pg_amproc + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMPROC_D_H +#define PG_AMPROC_D_H + +#define AccessMethodProcedureRelationId 2603 +#define AccessMethodProcedureIndexId 2655 +#define AccessMethodProcedureOidIndexId 2757 + +#define Anum_pg_amproc_oid 1 +#define Anum_pg_amproc_amprocfamily 2 +#define Anum_pg_amproc_amproclefttype 3 +#define Anum_pg_amproc_amprocrighttype 4 +#define Anum_pg_amproc_amprocnum 5 +#define Anum_pg_amproc_amproc 6 + +#define Natts_pg_amproc 6 + + +#endif /* PG_AMPROC_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef.h new file mode 100644 index 0000000000000000000000000000000000000000..14f034a3b52e3e4e1c1e4d8b3aad754d506bf0e0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * pg_attrdef.h + * definition of the "attribute defaults" system catalog (pg_attrdef) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_attrdef.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRDEF_H +#define PG_ATTRDEF_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_attrdef_d.h" + +/* ---------------- + * pg_attrdef definition. cpp turns this into + * typedef struct FormData_pg_attrdef + * ---------------- + */ +CATALOG(pg_attrdef,2604,AttrDefaultRelationId) +{ + Oid oid; /* oid */ + + Oid adrelid BKI_LOOKUP(pg_class); /* OID of table containing + * attribute */ + int16 adnum; /* attnum of attribute */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree adbin BKI_FORCE_NOT_NULL; /* nodeToString representation of + * default */ +#endif +} FormData_pg_attrdef; + +/* ---------------- + * Form_pg_attrdef corresponds to a pointer to a tuple with + * the format of pg_attrdef relation. + * ---------------- + */ +typedef FormData_pg_attrdef *Form_pg_attrdef; + +DECLARE_TOAST(pg_attrdef, 2830, 2831); + +DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, AttrDefaultIndexId, pg_attrdef, btree(adrelid oid_ops, adnum int2_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, AttrDefaultOidIndexId, pg_attrdef, btree(oid oid_ops)); + +DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute, (attrelid, attnum)); + + +extern Oid StoreAttrDefault(Relation rel, AttrNumber attnum, + Node *expr, bool is_internal, + bool add_column_mode); +extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, + DropBehavior behavior, + bool complain, bool internal); +extern void RemoveAttrDefaultById(Oid attrdefId); + +extern Oid GetAttrDefaultOid(Oid relid, AttrNumber attnum); +extern ObjectAddress GetAttrDefaultColumnAddress(Oid attrdefoid); + +#endif /* PG_ATTRDEF_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c45b331ac4692ef75e1a4f9e349246b210510679 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_attrdef_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_attrdef_d.h + * Macro definitions for pg_attrdef + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRDEF_D_H +#define PG_ATTRDEF_D_H + +#define AttrDefaultRelationId 2604 +#define AttrDefaultIndexId 2656 +#define AttrDefaultOidIndexId 2657 + +#define Anum_pg_attrdef_oid 1 +#define Anum_pg_attrdef_adrelid 2 +#define Anum_pg_attrdef_adnum 3 +#define Anum_pg_attrdef_adbin 4 + +#define Natts_pg_attrdef 4 + + +#endif /* PG_ATTRDEF_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute.h new file mode 100644 index 0000000000000000000000000000000000000000..1c62b8bfcb58e244e45d45bd57f923e6a0d23bba --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute.h @@ -0,0 +1,240 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute.h + * definition of the "attribute" system catalog (pg_attribute) + * + * The initial contents of pg_attribute are generated at compile time by + * genbki.pl, so there is no pg_attribute.dat file. Only "bootstrapped" + * relations need be included. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_attribute.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_H +#define PG_ATTRIBUTE_H + +#include "catalog/genbki.h" +#include "catalog/pg_attribute_d.h" + +/* ---------------- + * pg_attribute definition. cpp turns this into + * typedef struct FormData_pg_attribute + * + * If you change the following, make sure you change the structs for + * system attributes in catalog/heap.c also. + * You may need to change catalog/genbki.pl as well. + * ---------------- + */ +CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75,AttributeRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid attrelid BKI_LOOKUP(pg_class); /* OID of relation containing + * this attribute */ + NameData attname; /* name of attribute */ + + /* + * atttypid is the OID of the instance in Catalog Class pg_type that + * defines the data type of this attribute (e.g. int4). Information in + * that instance is redundant with the attlen, attbyval, and attalign + * attributes of this instance, so they had better match or Postgres will + * fail. In an entry for a dropped column, this field is set to zero + * since the pg_type entry may no longer exist; but we rely on attlen, + * attbyval, and attalign to still tell us how large the values in the + * table are. + */ + Oid atttypid BKI_LOOKUP_OPT(pg_type); + + /* + * attlen is a copy of the typlen field from pg_type for this attribute. + * See atttypid comments above. + */ + int16 attlen; + + /* + * attnum is the "attribute number" for the attribute: A value that + * uniquely identifies this attribute within its class. For user + * attributes, Attribute numbers are greater than 0 and not greater than + * the number of attributes in the class. I.e. if the Class pg_class says + * that Class XYZ has 10 attributes, then the user attribute numbers in + * Class pg_attribute must be 1-10. + * + * System attributes have attribute numbers less than 0 that are unique + * within the class, but not constrained to any particular range. + * + * Note that (attnum - 1) is often used as the index to an array. + */ + int16 attnum; + + /* + * fastgetattr() uses attcacheoff to cache byte offsets of attributes in + * heap tuples. The value actually stored in pg_attribute (-1) indicates + * no cached value. But when we copy these tuples into a tuple + * descriptor, we may then update attcacheoff in the copies. This speeds + * up the attribute walking process. + */ + int32 attcacheoff BKI_DEFAULT(-1); + + /* + * atttypmod records type-specific data supplied at table creation time + * (for example, the max length of a varchar field). It is passed to + * type-specific input and output functions as the third argument. The + * value will generally be -1 for types that do not need typmod. + */ + int32 atttypmod BKI_DEFAULT(-1); + + /* + * attndims is the declared number of dimensions, if an array type, + * otherwise zero. + */ + int16 attndims; + + /* + * attbyval is a copy of the typbyval field from pg_type for this + * attribute. See atttypid comments above. + */ + bool attbyval; + + /* + * attalign is a copy of the typalign field from pg_type for this + * attribute. See atttypid comments above. + */ + char attalign; + + /*---------- + * attstorage tells for VARLENA attributes, what the heap access + * methods can do to it if a given tuple doesn't fit into a page. + * Possible values are as for pg_type.typstorage (see TYPSTORAGE macros). + *---------- + */ + char attstorage; + + /* + * attcompression sets the current compression method of the attribute. + * Typically this is InvalidCompressionMethod ('\0') to specify use of the + * current default setting (see default_toast_compression). Otherwise, + * 'p' selects pglz compression, while 'l' selects LZ4 compression. + * However, this field is ignored whenever attstorage does not allow + * compression. + */ + char attcompression BKI_DEFAULT('\0'); + + /* This flag represents the "NOT NULL" constraint */ + bool attnotnull; + + /* Has DEFAULT value or not */ + bool atthasdef BKI_DEFAULT(f); + + /* Has a missing value or not */ + bool atthasmissing BKI_DEFAULT(f); + + /* One of the ATTRIBUTE_IDENTITY_* constants below, or '\0' */ + char attidentity BKI_DEFAULT('\0'); + + /* One of the ATTRIBUTE_GENERATED_* constants below, or '\0' */ + char attgenerated BKI_DEFAULT('\0'); + + /* Is dropped (ie, logically invisible) or not */ + bool attisdropped BKI_DEFAULT(f); + + /* + * This flag specifies whether this column has ever had a local + * definition. It is set for normal non-inherited columns, but also for + * columns that are inherited from parents if also explicitly listed in + * CREATE TABLE INHERITS. It is also set when inheritance is removed from + * a table with ALTER TABLE NO INHERIT. If the flag is set, the column is + * not dropped by a parent's DROP COLUMN even if this causes the column's + * attinhcount to become zero. + */ + bool attislocal BKI_DEFAULT(t); + + /* Number of times inherited from direct parent relation(s) */ + int16 attinhcount BKI_DEFAULT(0); + + /* attribute's collation, if any */ + Oid attcollation BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length/nullable fields start here */ + /* NOTE: The following fields are not present in tuple descriptors. */ + + /* + * attstattarget is the target number of statistics datapoints to collect + * during VACUUM ANALYZE of this column. A zero here indicates that we do + * not wish to collect any stats about this column. A null value here + * indicates that no value has been explicitly set for this column, so + * ANALYZE should use the default setting. + * + * int16 is sufficient for the current max value (MAX_STATISTICS_TARGET). + */ + int16 attstattarget BKI_DEFAULT(_null_) BKI_FORCE_NULL; + + /* Column-level access permissions */ + aclitem attacl[1] BKI_DEFAULT(_null_); + + /* Column-level options */ + text attoptions[1] BKI_DEFAULT(_null_); + + /* Column-level FDW options */ + text attfdwoptions[1] BKI_DEFAULT(_null_); + + /* + * Missing value for added columns. This is a one element array which lets + * us store a value of the attribute type here. + */ + anyarray attmissingval BKI_DEFAULT(_null_); +#endif +} FormData_pg_attribute; + +/* + * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout, + * guaranteed-not-null part of a pg_attribute row. This is in fact as much + * of the row as gets copied into tuple descriptors, so don't expect you + * can access the variable-length fields except in a real tuple! + */ +#define ATTRIBUTE_FIXED_PART_SIZE \ + (offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid)) + +/* ---------------- + * Form_pg_attribute corresponds to a pointer to a tuple with + * the format of pg_attribute relation. + * ---------------- + */ +typedef FormData_pg_attribute *Form_pg_attribute; + +/* + * FormExtraData_pg_attribute contains (some of) the fields that are not in + * FormData_pg_attribute because they are excluded by CATALOG_VARLEN. It is + * meant to be used by DDL code so that the combination of + * FormData_pg_attribute (often via tuple descriptor) and + * FormExtraData_pg_attribute can be used to pass around all the information + * about an attribute. Fields can be included here as needed. + */ +typedef struct FormExtraData_pg_attribute +{ + NullableDatum attstattarget; + NullableDatum attoptions; +} FormExtraData_pg_attribute; + +DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, AttributeRelidNameIndexId, pg_attribute, btree(attrelid oid_ops, attname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_attribute_relid_attnum_index, 2659, AttributeRelidNumIndexId, pg_attribute, btree(attrelid oid_ops, attnum int2_ops)); + +MAKE_SYSCACHE(ATTNAME, pg_attribute_relid_attnam_index, 32); +MAKE_SYSCACHE(ATTNUM, pg_attribute_relid_attnum_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define ATTRIBUTE_IDENTITY_ALWAYS 'a' +#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' + +#define ATTRIBUTE_GENERATED_STORED 's' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_ATTRIBUTE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute_d.h new file mode 100644 index 0000000000000000000000000000000000000000..b22824585dc26f7b59c133bf406bf53f8d4f968f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_attribute_d.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute_d.h + * Macro definitions for pg_attribute + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_D_H +#define PG_ATTRIBUTE_D_H + +#define AttributeRelationId 1249 +#define AttributeRelation_Rowtype_Id 75 +#define AttributeRelidNameIndexId 2658 +#define AttributeRelidNumIndexId 2659 + +#define Anum_pg_attribute_attrelid 1 +#define Anum_pg_attribute_attname 2 +#define Anum_pg_attribute_atttypid 3 +#define Anum_pg_attribute_attlen 4 +#define Anum_pg_attribute_attnum 5 +#define Anum_pg_attribute_attcacheoff 6 +#define Anum_pg_attribute_atttypmod 7 +#define Anum_pg_attribute_attndims 8 +#define Anum_pg_attribute_attbyval 9 +#define Anum_pg_attribute_attalign 10 +#define Anum_pg_attribute_attstorage 11 +#define Anum_pg_attribute_attcompression 12 +#define Anum_pg_attribute_attnotnull 13 +#define Anum_pg_attribute_atthasdef 14 +#define Anum_pg_attribute_atthasmissing 15 +#define Anum_pg_attribute_attidentity 16 +#define Anum_pg_attribute_attgenerated 17 +#define Anum_pg_attribute_attisdropped 18 +#define Anum_pg_attribute_attislocal 19 +#define Anum_pg_attribute_attinhcount 20 +#define Anum_pg_attribute_attcollation 21 +#define Anum_pg_attribute_attstattarget 22 +#define Anum_pg_attribute_attacl 23 +#define Anum_pg_attribute_attoptions 24 +#define Anum_pg_attribute_attfdwoptions 25 +#define Anum_pg_attribute_attmissingval 26 + +#define Natts_pg_attribute 26 + + +#define ATTRIBUTE_IDENTITY_ALWAYS 'a' +#define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' + +#define ATTRIBUTE_GENERATED_STORED 's' + + +#endif /* PG_ATTRIBUTE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members.h new file mode 100644 index 0000000000000000000000000000000000000000..5f4b30756ca658b2d45414f4df66d40bb4682724 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_auth_members.h + * definition of the "authorization identifier members" system catalog + * (pg_auth_members). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_auth_members.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTH_MEMBERS_H +#define PG_AUTH_MEMBERS_H + +#include "catalog/genbki.h" +#include "catalog/pg_auth_members_d.h" + +/* ---------------- + * pg_auth_members definition. cpp turns this into + * typedef struct FormData_pg_auth_members + * ---------------- + */ +CATALOG(pg_auth_members,1261,AuthMemRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2843,AuthMemRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + Oid roleid BKI_LOOKUP(pg_authid); /* ID of a role */ + Oid member BKI_LOOKUP(pg_authid); /* ID of a member of that role */ + Oid grantor BKI_LOOKUP(pg_authid); /* who granted the membership */ + bool admin_option; /* granted with admin option? */ + bool inherit_option; /* exercise privileges without SET ROLE? */ + bool set_option; /* use SET ROLE to the target role? */ +} FormData_pg_auth_members; + +/* ---------------- + * Form_pg_auth_members corresponds to a pointer to a tuple with + * the format of pg_auth_members relation. + * ---------------- + */ +typedef FormData_pg_auth_members *Form_pg_auth_members; + +DECLARE_UNIQUE_INDEX_PKEY(pg_auth_members_oid_index, 6303, AuthMemOidIndexId, pg_auth_members, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, AuthMemRoleMemIndexId, pg_auth_members, btree(roleid oid_ops, member oid_ops, grantor oid_ops)); +DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, AuthMemMemRoleIndexId, pg_auth_members, btree(member oid_ops, roleid oid_ops, grantor oid_ops)); +DECLARE_INDEX(pg_auth_members_grantor_index, 6302, AuthMemGrantorIndexId, pg_auth_members, btree(grantor oid_ops)); + +MAKE_SYSCACHE(AUTHMEMROLEMEM, pg_auth_members_role_member_index, 8); +MAKE_SYSCACHE(AUTHMEMMEMROLE, pg_auth_members_member_role_index, 8); + +#endif /* PG_AUTH_MEMBERS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members_d.h new file mode 100644 index 0000000000000000000000000000000000000000..bacdec64d2e132de1f1d965e6fff209611f32b1e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_auth_members_d.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * pg_auth_members_d.h + * Macro definitions for pg_auth_members + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTH_MEMBERS_D_H +#define PG_AUTH_MEMBERS_D_H + +#define AuthMemRelationId 1261 +#define AuthMemRelation_Rowtype_Id 2843 +#define AuthMemOidIndexId 6303 +#define AuthMemRoleMemIndexId 2694 +#define AuthMemMemRoleIndexId 2695 +#define AuthMemGrantorIndexId 6302 + +#define Anum_pg_auth_members_oid 1 +#define Anum_pg_auth_members_roleid 2 +#define Anum_pg_auth_members_member 3 +#define Anum_pg_auth_members_grantor 4 +#define Anum_pg_auth_members_admin_option 5 +#define Anum_pg_auth_members_inherit_option 6 +#define Anum_pg_auth_members_set_option 7 + +#define Natts_pg_auth_members 7 + + +#endif /* PG_AUTH_MEMBERS_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_authid.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_authid.h new file mode 100644 index 0000000000000000000000000000000000000000..e08863f78abde5cdb4c34fd8939a03aec2919e22 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_authid.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * pg_authid.h + * definition of the "authorization identifier" system catalog (pg_authid) + * + * pg_shadow and pg_group are now publicly accessible views on pg_authid. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_authid.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTHID_H +#define PG_AUTHID_H + +#include "catalog/genbki.h" +#include "catalog/pg_authid_d.h" + +/* ---------------- + * pg_authid definition. cpp turns this into + * typedef struct FormData_pg_authid + * ---------------- + */ +CATALOG(pg_authid,1260,AuthIdRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842,AuthIdRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + NameData rolname; /* name of role */ + bool rolsuper; /* read this field via superuser() only! */ + bool rolinherit; /* inherit privileges from other roles? */ + bool rolcreaterole; /* allowed to create more roles? */ + bool rolcreatedb; /* allowed to create databases? */ + bool rolcanlogin; /* allowed to log in as session user? */ + bool rolreplication; /* role used for streaming replication */ + bool rolbypassrls; /* bypasses row-level security? */ + int32 rolconnlimit; /* max connections allowed (-1=no limit) */ + + /* remaining fields may be null; use heap_getattr to read them! */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text rolpassword; /* password, if any */ + timestamptz rolvaliduntil; /* password expiration time, if any */ +#endif +} FormData_pg_authid; + +/* ---------------- + * Form_pg_authid corresponds to a pointer to a tuple with + * the format of pg_authid relation. + * ---------------- + */ +typedef FormData_pg_authid *Form_pg_authid; + +DECLARE_TOAST_WITH_MACRO(pg_authid, 4175, 4176, PgAuthidToastTable, PgAuthidToastIndex); + +DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, AuthIdRolnameIndexId, pg_authid, btree(rolname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_authid_oid_index, 2677, AuthIdOidIndexId, pg_authid, btree(oid oid_ops)); + +MAKE_SYSCACHE(AUTHNAME, pg_authid_rolname_index, 8); +MAKE_SYSCACHE(AUTHOID, pg_authid_oid_index, 8); + +#endif /* PG_AUTHID_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_authid_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_authid_d.h new file mode 100644 index 0000000000000000000000000000000000000000..4e1da124c2cd59a9c357835053cd9c8bacd8c51a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_authid_d.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_authid_d.h + * Macro definitions for pg_authid + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTHID_D_H +#define PG_AUTHID_D_H + +#define AuthIdRelationId 1260 +#define AuthIdRelation_Rowtype_Id 2842 +#define PgAuthidToastTable 4175 +#define PgAuthidToastIndex 4176 +#define AuthIdRolnameIndexId 2676 +#define AuthIdOidIndexId 2677 + +#define Anum_pg_authid_oid 1 +#define Anum_pg_authid_rolname 2 +#define Anum_pg_authid_rolsuper 3 +#define Anum_pg_authid_rolinherit 4 +#define Anum_pg_authid_rolcreaterole 5 +#define Anum_pg_authid_rolcreatedb 6 +#define Anum_pg_authid_rolcanlogin 7 +#define Anum_pg_authid_rolreplication 8 +#define Anum_pg_authid_rolbypassrls 9 +#define Anum_pg_authid_rolconnlimit 10 +#define Anum_pg_authid_rolpassword 11 +#define Anum_pg_authid_rolvaliduntil 12 + +#define Natts_pg_authid 12 + +#define BOOTSTRAP_SUPERUSERID 10 +#define ROLE_PG_DATABASE_OWNER 6171 +#define ROLE_PG_READ_ALL_DATA 6181 +#define ROLE_PG_WRITE_ALL_DATA 6182 +#define ROLE_PG_MONITOR 3373 +#define ROLE_PG_READ_ALL_SETTINGS 3374 +#define ROLE_PG_READ_ALL_STATS 3375 +#define ROLE_PG_STAT_SCAN_TABLES 3377 +#define ROLE_PG_READ_SERVER_FILES 4569 +#define ROLE_PG_WRITE_SERVER_FILES 4570 +#define ROLE_PG_EXECUTE_SERVER_PROGRAM 4571 +#define ROLE_PG_SIGNAL_BACKEND 4200 +#define ROLE_PG_CHECKPOINT 4544 +#define ROLE_PG_MAINTAIN 6337 +#define ROLE_PG_USE_RESERVED_CONNECTIONS 4550 +#define ROLE_PG_CREATE_SUBSCRIPTION 6304 + +#endif /* PG_AUTHID_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_cast.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_cast.h new file mode 100644 index 0000000000000000000000000000000000000000..6c995509bc38866db61fad4fc97cb1ae4c8e90d4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_cast.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * + * pg_cast.h + * definition of the "type casts" system catalog (pg_cast) + * + * As of Postgres 8.0, pg_cast describes not only type coercion functions + * but also length coercion functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_cast.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CAST_H +#define PG_CAST_H + +#include "catalog/dependency.h" +#include "catalog/genbki.h" +#include "catalog/pg_cast_d.h" + +/* ---------------- + * pg_cast definition. cpp turns this into + * typedef struct FormData_pg_cast + * ---------------- + */ +CATALOG(pg_cast,2605,CastRelationId) +{ + Oid oid; /* oid */ + + /* source datatype for cast */ + Oid castsource BKI_LOOKUP(pg_type); + + /* destination datatype for cast */ + Oid casttarget BKI_LOOKUP(pg_type); + + /* cast function; 0 = binary coercible */ + Oid castfunc BKI_LOOKUP_OPT(pg_proc); + + /* contexts in which cast can be used */ + char castcontext; + + /* cast method */ + char castmethod; +} FormData_pg_cast; + +/* ---------------- + * Form_pg_cast corresponds to a pointer to a tuple with + * the format of pg_cast relation. + * ---------------- + */ +typedef FormData_pg_cast *Form_pg_cast; + +DECLARE_UNIQUE_INDEX_PKEY(pg_cast_oid_index, 2660, CastOidIndexId, pg_cast, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, CastSourceTargetIndexId, pg_cast, btree(castsource oid_ops, casttarget oid_ops)); + +MAKE_SYSCACHE(CASTSOURCETARGET, pg_cast_source_target_index, 256); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * The allowable values for pg_cast.castcontext are specified by this enum. + * Since castcontext is stored as a "char", we use ASCII codes for human + * convenience in reading the table. Note that internally to the backend, + * these values are converted to the CoercionContext enum (see primnodes.h), + * which is defined to sort in a convenient order; the ASCII codes don't + * have to sort in any special order. + */ + +typedef enum CoercionCodes +{ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_EXPLICIT = 'e', /* explicit cast operation */ +} CoercionCodes; + +/* + * The allowable values for pg_cast.castmethod are specified by this enum. + * Since castmethod is stored as a "char", we use ASCII codes for human + * convenience in reading the table. + */ +typedef enum CoercionMethod +{ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_INOUT = 'i', /* use input/output functions */ +} CoercionMethod; + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress CastCreate(Oid sourcetypeid, + Oid targettypeid, + Oid funcid, + Oid incastid, + Oid outcastid, + char castcontext, + char castmethod, + DependencyType behavior); + +#endif /* PG_CAST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_cast_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_cast_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c96cfb20ef2f9f34c6458feaf1e82062741f1bfa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_cast_d.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pg_cast_d.h + * Macro definitions for pg_cast + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CAST_D_H +#define PG_CAST_D_H + +#define CastRelationId 2605 +#define CastOidIndexId 2660 +#define CastSourceTargetIndexId 2661 + +#define Anum_pg_cast_oid 1 +#define Anum_pg_cast_castsource 2 +#define Anum_pg_cast_casttarget 3 +#define Anum_pg_cast_castfunc 4 +#define Anum_pg_cast_castcontext 5 +#define Anum_pg_cast_castmethod 6 + +#define Natts_pg_cast 6 + + +/* + * The allowable values for pg_cast.castcontext are specified by this enum. + * Since castcontext is stored as a "char", we use ASCII codes for human + * convenience in reading the table. Note that internally to the backend, + * these values are converted to the CoercionContext enum (see primnodes.h), + * which is defined to sort in a convenient order; the ASCII codes don't + * have to sort in any special order. + */ + +typedef enum CoercionCodes +{ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_EXPLICIT = 'e', /* explicit cast operation */ +} CoercionCodes; + +/* + * The allowable values for pg_cast.castmethod are specified by this enum. + * Since castmethod is stored as a "char", we use ASCII codes for human + * convenience in reading the table. + */ +typedef enum CoercionMethod +{ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_INOUT = 'i', /* use input/output functions */ +} CoercionMethod; + + +#endif /* PG_CAST_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_class.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_class.h new file mode 100644 index 0000000000000000000000000000000000000000..0fc2c093b0d4e315f26fca0522e1ea837e405fe1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_class.h @@ -0,0 +1,235 @@ +/*------------------------------------------------------------------------- + * + * pg_class.h + * definition of the "relation" system catalog (pg_class) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_class.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CLASS_H +#define PG_CLASS_H + +#include "catalog/genbki.h" +#include "catalog/pg_class_d.h" + +/* ---------------- + * pg_class definition. cpp turns this into + * typedef struct FormData_pg_class + * + * Note that the BKI_DEFAULT values below are only used for rows describing + * BKI_BOOTSTRAP catalogs, since only those rows appear in pg_class.dat. + * ---------------- + */ +CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + /* oid */ + Oid oid; + + /* class name */ + NameData relname; + + /* OID of namespace containing this class */ + Oid relnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* OID of entry in pg_type for relation's implicit row type, if any */ + Oid reltype BKI_LOOKUP_OPT(pg_type); + + /* OID of entry in pg_type for underlying composite type, if any */ + Oid reloftype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* class owner */ + Oid relowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* access method; 0 if not a table / index */ + Oid relam BKI_DEFAULT(heap) BKI_LOOKUP_OPT(pg_am); + + /* identifier of physical storage file */ + /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */ + Oid relfilenode BKI_DEFAULT(0); + + /* identifier of table space for relation (0 means default for database) */ + Oid reltablespace BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_tablespace); + + /* # of blocks (not always up-to-date) */ + int32 relpages BKI_DEFAULT(0); + + /* # of tuples (not always up-to-date; -1 means "unknown") */ + float4 reltuples BKI_DEFAULT(-1); + + /* # of all-visible blocks (not always up-to-date) */ + int32 relallvisible BKI_DEFAULT(0); + + /* OID of toast table; 0 if none */ + Oid reltoastrelid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* T if has (or has had) any indexes */ + bool relhasindex BKI_DEFAULT(f); + + /* T if shared across databases */ + bool relisshared BKI_DEFAULT(f); + + /* see RELPERSISTENCE_xxx constants below */ + char relpersistence BKI_DEFAULT(p); + + /* see RELKIND_xxx constants below */ + char relkind BKI_DEFAULT(r); + + /* number of user attributes */ + int16 relnatts BKI_DEFAULT(0); /* genbki.pl will fill this in */ + + /* + * Class pg_attribute must contain exactly "relnatts" user attributes + * (with attnums ranging from 1 to relnatts) for this class. It may also + * contain entries with negative attnums for system attributes. + */ + + /* # of CHECK constraints for class */ + int16 relchecks BKI_DEFAULT(0); + + /* has (or has had) any rules */ + bool relhasrules BKI_DEFAULT(f); + + /* has (or has had) any TRIGGERs */ + bool relhastriggers BKI_DEFAULT(f); + + /* has (or has had) child tables or indexes */ + bool relhassubclass BKI_DEFAULT(f); + + /* row security is enabled or not */ + bool relrowsecurity BKI_DEFAULT(f); + + /* row security forced for owners or not */ + bool relforcerowsecurity BKI_DEFAULT(f); + + /* matview currently holds query results */ + bool relispopulated BKI_DEFAULT(t); + + /* see REPLICA_IDENTITY_xxx constants */ + char relreplident BKI_DEFAULT(n); + + /* is relation a partition? */ + bool relispartition BKI_DEFAULT(f); + + /* link to original rel during table rewrite; otherwise 0 */ + Oid relrewrite BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* all Xids < this are frozen in this rel */ + TransactionId relfrozenxid BKI_DEFAULT(3); /* FirstNormalTransactionId */ + + /* all multixacts in this rel are >= this; it is really a MultiXactId */ + TransactionId relminmxid BKI_DEFAULT(1); /* FirstMultiXactId */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* NOTE: These fields are not present in a relcache entry's rd_rel field. */ + /* access permissions */ + aclitem relacl[1] BKI_DEFAULT(_null_); + + /* access-method-specific options */ + text reloptions[1] BKI_DEFAULT(_null_); + + /* partition bound node tree */ + pg_node_tree relpartbound BKI_DEFAULT(_null_); +#endif +} FormData_pg_class; + +/* Size of fixed part of pg_class tuples, not counting var-length fields */ +#define CLASS_TUPLE_SIZE \ + (offsetof(FormData_pg_class,relminmxid) + sizeof(TransactionId)) + +/* ---------------- + * Form_pg_class corresponds to a pointer to a tuple with + * the format of pg_class relation. + * ---------------- + */ +typedef FormData_pg_class *Form_pg_class; + +DECLARE_UNIQUE_INDEX_PKEY(pg_class_oid_index, 2662, ClassOidIndexId, pg_class, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, ClassNameNspIndexId, pg_class, btree(relname name_ops, relnamespace oid_ops)); +DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, ClassTblspcRelfilenodeIndexId, pg_class, btree(reltablespace oid_ops, relfilenode oid_ops)); + +MAKE_SYSCACHE(RELOID, pg_class_oid_index, 128); +MAKE_SYSCACHE(RELNAMENSP, pg_class_relname_nsp_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define RELKIND_RELATION 'r' /* ordinary table */ +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_SEQUENCE 'S' /* sequence object */ +#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ +#define RELKIND_VIEW 'v' /* view */ +#define RELKIND_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ +#define RELKIND_PARTITIONED_INDEX 'I' /* partitioned index */ + +#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ +#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ +#define RELPERSISTENCE_TEMP 't' /* temporary table */ + +/* default selection for replica identity (primary key or nothing) */ +#define REPLICA_IDENTITY_DEFAULT 'd' +/* no replica identity is logged for this relation */ +#define REPLICA_IDENTITY_NOTHING 'n' +/* all columns are logged as replica identity */ +#define REPLICA_IDENTITY_FULL 'f' +/* + * an explicitly chosen candidate key's columns are used as replica identity. + * Note this will still be set if the index has been dropped; in that case it + * has the same meaning as 'n'. + */ +#define REPLICA_IDENTITY_INDEX 'i' + +/* + * Relation kinds that have physical storage. These relations normally have + * relfilenode set to non-zero, but it can also be zero if the relation is + * mapped. + */ +#define RELKIND_HAS_STORAGE(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_INDEX || \ + (relkind) == RELKIND_SEQUENCE || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +#define RELKIND_HAS_PARTITIONS(relkind) \ + ((relkind) == RELKIND_PARTITIONED_TABLE || \ + (relkind) == RELKIND_PARTITIONED_INDEX) + +/* + * Relation kinds that support tablespaces: All relation kinds with storage + * support tablespaces, except that we don't support moving sequences around + * into different tablespaces. Partitioned tables and indexes don't have + * physical storage, but they have a tablespace settings so that their + * children can inherit it. + */ +#define RELKIND_HAS_TABLESPACE(relkind) \ + ((RELKIND_HAS_STORAGE(relkind) || RELKIND_HAS_PARTITIONS(relkind)) \ + && (relkind) != RELKIND_SEQUENCE) + +/* + * Relation kinds with a table access method (rd_tableam). Although sequences + * use the heap table AM, they are enough of a special case in most uses that + * they are not included here. Likewise, partitioned tables can have an access + * method defined so that their partitions can inherit it, but they do not set + * rd_tableam; hence, this is handled specially outside of this macro. + */ +#define RELKIND_HAS_TABLE_AM(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +extern int errdetail_relkind_not_supported(char relkind); + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_CLASS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_class_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_class_d.h new file mode 100644 index 0000000000000000000000000000000000000000..fc850451fb991b16e1775953138446668a5555b6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_class_d.h @@ -0,0 +1,134 @@ +/*------------------------------------------------------------------------- + * + * pg_class_d.h + * Macro definitions for pg_class + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CLASS_D_H +#define PG_CLASS_D_H + +#define RelationRelationId 1259 +#define RelationRelation_Rowtype_Id 83 +#define ClassOidIndexId 2662 +#define ClassNameNspIndexId 2663 +#define ClassTblspcRelfilenodeIndexId 3455 + +#define Anum_pg_class_oid 1 +#define Anum_pg_class_relname 2 +#define Anum_pg_class_relnamespace 3 +#define Anum_pg_class_reltype 4 +#define Anum_pg_class_reloftype 5 +#define Anum_pg_class_relowner 6 +#define Anum_pg_class_relam 7 +#define Anum_pg_class_relfilenode 8 +#define Anum_pg_class_reltablespace 9 +#define Anum_pg_class_relpages 10 +#define Anum_pg_class_reltuples 11 +#define Anum_pg_class_relallvisible 12 +#define Anum_pg_class_reltoastrelid 13 +#define Anum_pg_class_relhasindex 14 +#define Anum_pg_class_relisshared 15 +#define Anum_pg_class_relpersistence 16 +#define Anum_pg_class_relkind 17 +#define Anum_pg_class_relnatts 18 +#define Anum_pg_class_relchecks 19 +#define Anum_pg_class_relhasrules 20 +#define Anum_pg_class_relhastriggers 21 +#define Anum_pg_class_relhassubclass 22 +#define Anum_pg_class_relrowsecurity 23 +#define Anum_pg_class_relforcerowsecurity 24 +#define Anum_pg_class_relispopulated 25 +#define Anum_pg_class_relreplident 26 +#define Anum_pg_class_relispartition 27 +#define Anum_pg_class_relrewrite 28 +#define Anum_pg_class_relfrozenxid 29 +#define Anum_pg_class_relminmxid 30 +#define Anum_pg_class_relacl 31 +#define Anum_pg_class_reloptions 32 +#define Anum_pg_class_relpartbound 33 + +#define Natts_pg_class 33 + + +#define RELKIND_RELATION 'r' /* ordinary table */ +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_SEQUENCE 'S' /* sequence object */ +#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ +#define RELKIND_VIEW 'v' /* view */ +#define RELKIND_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ +#define RELKIND_PARTITIONED_INDEX 'I' /* partitioned index */ + +#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ +#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ +#define RELPERSISTENCE_TEMP 't' /* temporary table */ + +/* default selection for replica identity (primary key or nothing) */ +#define REPLICA_IDENTITY_DEFAULT 'd' +/* no replica identity is logged for this relation */ +#define REPLICA_IDENTITY_NOTHING 'n' +/* all columns are logged as replica identity */ +#define REPLICA_IDENTITY_FULL 'f' +/* + * an explicitly chosen candidate key's columns are used as replica identity. + * Note this will still be set if the index has been dropped; in that case it + * has the same meaning as 'n'. + */ +#define REPLICA_IDENTITY_INDEX 'i' + +/* + * Relation kinds that have physical storage. These relations normally have + * relfilenode set to non-zero, but it can also be zero if the relation is + * mapped. + */ +#define RELKIND_HAS_STORAGE(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_INDEX || \ + (relkind) == RELKIND_SEQUENCE || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +#define RELKIND_HAS_PARTITIONS(relkind) \ + ((relkind) == RELKIND_PARTITIONED_TABLE || \ + (relkind) == RELKIND_PARTITIONED_INDEX) + +/* + * Relation kinds that support tablespaces: All relation kinds with storage + * support tablespaces, except that we don't support moving sequences around + * into different tablespaces. Partitioned tables and indexes don't have + * physical storage, but they have a tablespace settings so that their + * children can inherit it. + */ +#define RELKIND_HAS_TABLESPACE(relkind) \ + ((RELKIND_HAS_STORAGE(relkind) || RELKIND_HAS_PARTITIONS(relkind)) \ + && (relkind) != RELKIND_SEQUENCE) + +/* + * Relation kinds with a table access method (rd_tableam). Although sequences + * use the heap table AM, they are enough of a special case in most uses that + * they are not included here. Likewise, partitioned tables can have an access + * method defined so that their partitions can inherit it, but they do not set + * rd_tableam; hence, this is handled specially outside of this macro. + */ +#define RELKIND_HAS_TABLE_AM(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) + +extern int errdetail_relkind_not_supported(char relkind); + + +#endif /* PG_CLASS_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_collation.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_collation.h new file mode 100644 index 0000000000000000000000000000000000000000..5ce289d74bd0ee2bd3dca731cbc02b1f50251e77 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_collation.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * + * pg_collation.h + * definition of the "collation" system catalog (pg_collation) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_collation.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_COLLATION_H +#define PG_COLLATION_H + +#include "catalog/genbki.h" +#include "catalog/pg_collation_d.h" + +/* ---------------- + * pg_collation definition. cpp turns this into + * typedef struct FormData_pg_collation + * ---------------- + */ +CATALOG(pg_collation,3456,CollationRelationId) +{ + Oid oid; /* oid */ + NameData collname; /* collation name */ + + /* OID of namespace containing this collation */ + Oid collnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner of collation */ + Oid collowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + char collprovider; /* see constants below */ + bool collisdeterministic BKI_DEFAULT(t); + int32 collencoding; /* encoding for this collation; -1 = "all" */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text collcollate BKI_DEFAULT(_null_); /* LC_COLLATE setting */ + text collctype BKI_DEFAULT(_null_); /* LC_CTYPE setting */ + text colllocale BKI_DEFAULT(_null_); /* locale ID */ + text collicurules BKI_DEFAULT(_null_); /* ICU collation rules */ + text collversion BKI_DEFAULT(_null_); /* provider-dependent + * version of collation + * data */ +#endif +} FormData_pg_collation; + +/* ---------------- + * Form_pg_collation corresponds to a pointer to a row with + * the format of pg_collation relation. + * ---------------- + */ +typedef FormData_pg_collation *Form_pg_collation; + +DECLARE_TOAST(pg_collation, 6175, 6176); + +DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, CollationNameEncNspIndexId, pg_collation, btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, CollationOidIndexId, pg_collation, btree(oid oid_ops)); + +MAKE_SYSCACHE(COLLNAMEENCNSP, pg_collation_name_enc_nsp_index, 8); +MAKE_SYSCACHE(COLLOID, pg_collation_oid_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define COLLPROVIDER_DEFAULT 'd' +#define COLLPROVIDER_BUILTIN 'b' +#define COLLPROVIDER_ICU 'i' +#define COLLPROVIDER_LIBC 'c' + +static inline const char * +collprovider_name(char c) +{ + switch (c) + { + case COLLPROVIDER_BUILTIN: + return "builtin"; + case COLLPROVIDER_ICU: + return "icu"; + case COLLPROVIDER_LIBC: + return "libc"; + default: + return "???"; + } +} + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern Oid CollationCreate(const char *collname, Oid collnamespace, + Oid collowner, + char collprovider, + bool collisdeterministic, + int32 collencoding, + const char *collcollate, const char *collctype, + const char *colllocale, + const char *collicurules, + const char *collversion, + bool if_not_exists, + bool quiet); + +#endif /* PG_COLLATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_collation_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_collation_d.h new file mode 100644 index 0000000000000000000000000000000000000000..1e19f8f264cdf385479bb966ba5baaca0e64c485 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_collation_d.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * pg_collation_d.h + * Macro definitions for pg_collation + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_COLLATION_D_H +#define PG_COLLATION_D_H + +#define CollationRelationId 3456 +#define CollationNameEncNspIndexId 3164 +#define CollationOidIndexId 3085 + +#define Anum_pg_collation_oid 1 +#define Anum_pg_collation_collname 2 +#define Anum_pg_collation_collnamespace 3 +#define Anum_pg_collation_collowner 4 +#define Anum_pg_collation_collprovider 5 +#define Anum_pg_collation_collisdeterministic 6 +#define Anum_pg_collation_collencoding 7 +#define Anum_pg_collation_collcollate 8 +#define Anum_pg_collation_collctype 9 +#define Anum_pg_collation_colllocale 10 +#define Anum_pg_collation_collicurules 11 +#define Anum_pg_collation_collversion 12 + +#define Natts_pg_collation 12 + + +#define COLLPROVIDER_DEFAULT 'd' +#define COLLPROVIDER_BUILTIN 'b' +#define COLLPROVIDER_ICU 'i' +#define COLLPROVIDER_LIBC 'c' + +static inline const char * +collprovider_name(char c) +{ + switch (c) + { + case COLLPROVIDER_BUILTIN: + return "builtin"; + case COLLPROVIDER_ICU: + return "icu"; + case COLLPROVIDER_LIBC: + return "libc"; + default: + return "???"; + } +} + +#define DEFAULT_COLLATION_OID 100 +#define C_COLLATION_OID 950 +#define POSIX_COLLATION_OID 951 + +#endif /* PG_COLLATION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint.h new file mode 100644 index 0000000000000000000000000000000000000000..7a8017f15b5dfd22c842b007f90d3e18b2cd5e08 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint.h @@ -0,0 +1,278 @@ +/*------------------------------------------------------------------------- + * + * pg_constraint.h + * definition of the "constraint" system catalog (pg_constraint) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_constraint.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONSTRAINT_H +#define PG_CONSTRAINT_H + +#include "catalog/dependency.h" +#include "catalog/genbki.h" +#include "catalog/pg_constraint_d.h" +#include "nodes/pg_list.h" + +/* ---------------- + * pg_constraint definition. cpp turns this into + * typedef struct FormData_pg_constraint + * ---------------- + */ +CATALOG(pg_constraint,2606,ConstraintRelationId) +{ + Oid oid; /* oid */ + + /* + * conname + connamespace is deliberately not unique; we allow, for + * example, the same name to be used for constraints of different + * relations. This is partly for backwards compatibility with past + * Postgres practice, and partly because we don't want to have to obtain a + * global lock to generate a globally unique name for a nameless + * constraint. We associate a namespace with constraint names only for + * SQL-spec compatibility. + * + * However, we do require conname to be unique among the constraints of a + * single relation or domain. This is enforced by a unique index on + * conrelid + contypid + conname. + */ + NameData conname; /* name of this constraint */ + Oid connamespace BKI_LOOKUP(pg_namespace); /* OID of namespace + * containing constraint */ + char contype; /* constraint type; see codes below */ + bool condeferrable; /* deferrable constraint? */ + bool condeferred; /* deferred by default? */ + bool convalidated; /* constraint has been validated? */ + + /* + * conrelid and conkey are only meaningful if the constraint applies to a + * specific relation (this excludes domain constraints and assertions). + * Otherwise conrelid is 0 and conkey is NULL. + */ + Oid conrelid BKI_LOOKUP_OPT(pg_class); /* relation this + * constraint constrains */ + + /* + * contypid links to the pg_type row for a domain if this is a domain + * constraint. Otherwise it's 0. + * + * For SQL-style global ASSERTIONs, both conrelid and contypid would be + * zero. This is not presently supported, however. + */ + Oid contypid BKI_LOOKUP_OPT(pg_type); /* domain this constraint + * constrains */ + + /* + * conindid links to the index supporting the constraint, if any; + * otherwise it's 0. This is used for unique, primary-key, and exclusion + * constraints, and less obviously for foreign-key constraints (where the + * index is a unique index on the referenced relation's referenced + * columns). Notice that the index is on conrelid in the first case but + * confrelid in the second. + */ + Oid conindid BKI_LOOKUP_OPT(pg_class); /* index supporting this + * constraint */ + + /* + * If this constraint is on a partition inherited from a partitioned + * table, this is the OID of the corresponding constraint in the parent. + */ + Oid conparentid BKI_LOOKUP_OPT(pg_constraint); + + /* + * These fields, plus confkey, are only meaningful for a foreign-key + * constraint. Otherwise confrelid is 0 and the char fields are spaces. + */ + Oid confrelid BKI_LOOKUP_OPT(pg_class); /* relation referenced by + * foreign key */ + char confupdtype; /* foreign key's ON UPDATE action */ + char confdeltype; /* foreign key's ON DELETE action */ + char confmatchtype; /* foreign key's match type */ + + /* Has a local definition (hence, do not drop when coninhcount is 0) */ + bool conislocal; + + /* Number of times inherited from direct parent relation(s) */ + int16 coninhcount; + + /* Has a local definition and cannot be inherited */ + bool connoinherit; + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* + * Columns of conrelid that the constraint applies to, if known (this is + * NULL for trigger constraints) + */ + int16 conkey[1]; + + /* + * If a foreign key, the referenced columns of confrelid + */ + int16 confkey[1]; + + /* + * If a foreign key, the OIDs of the PK = FK equality operators for each + * column of the constraint + */ + Oid conpfeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key, the OIDs of the PK = PK equality operators for each + * column of the constraint (i.e., equality for the referenced columns) + */ + Oid conppeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key, the OIDs of the FK = FK equality operators for each + * column of the constraint (i.e., equality for the referencing columns) + */ + Oid conffeqop[1] BKI_LOOKUP(pg_operator); + + /* + * If a foreign key with an ON DELETE SET NULL/DEFAULT action, the subset + * of conkey to updated. If null, all columns are updated. + */ + int16 confdelsetcols[1]; + + /* + * If an exclusion constraint, the OIDs of the exclusion operators for + * each column of the constraint + */ + Oid conexclop[1] BKI_LOOKUP(pg_operator); + + /* + * If a check constraint, nodeToString representation of expression + */ + pg_node_tree conbin; +#endif +} FormData_pg_constraint; + +/* ---------------- + * Form_pg_constraint corresponds to a pointer to a tuple with + * the format of pg_constraint relation. + * ---------------- + */ +typedef FormData_pg_constraint *Form_pg_constraint; + +DECLARE_TOAST(pg_constraint, 2832, 2833); + +DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, pg_constraint, btree(conname name_ops, connamespace oid_ops)); +DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, pg_constraint, btree(conrelid oid_ops, contypid oid_ops, conname name_ops)); +DECLARE_INDEX(pg_constraint_contypid_index, 2666, ConstraintTypidIndexId, pg_constraint, btree(contypid oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, ConstraintOidIndexId, pg_constraint, btree(oid oid_ops)); +DECLARE_INDEX(pg_constraint_conparentid_index, 2579, ConstraintParentIndexId, pg_constraint, btree(conparentid oid_ops)); + +MAKE_SYSCACHE(CONSTROID, pg_constraint_oid_index, 16); + +/* conkey can contain zero (InvalidAttrNumber) if a whole-row Var is used */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((conrelid, conkey), pg_attribute, (attrelid, attnum)); +DECLARE_ARRAY_FOREIGN_KEY((confrelid, confkey), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* Valid values for contype */ +#define CONSTRAINT_CHECK 'c' +#define CONSTRAINT_FOREIGN 'f' +#define CONSTRAINT_NOTNULL 'n' +#define CONSTRAINT_PRIMARY 'p' +#define CONSTRAINT_UNIQUE 'u' +#define CONSTRAINT_TRIGGER 't' +#define CONSTRAINT_EXCLUSION 'x' + +/* + * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx + * constants defined in parsenodes.h. Valid values for confmatchtype are + * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. + */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +/* + * Identify constraint type for lookup purposes + */ +typedef enum ConstraintCategory +{ + CONSTRAINT_RELATION, + CONSTRAINT_DOMAIN, + CONSTRAINT_ASSERTION, /* for future expansion */ +} ConstraintCategory; + + +extern Oid CreateConstraintEntry(const char *constraintName, + Oid constraintNamespace, + char constraintType, + bool isDeferrable, + bool isDeferred, + bool isValidated, + Oid parentConstrId, + Oid relId, + const int16 *constraintKey, + int constraintNKeys, + int constraintNTotalKeys, + Oid domainId, + Oid indexRelId, + Oid foreignRelId, + const int16 *foreignKey, + const Oid *pfEqOp, + const Oid *ppEqOp, + const Oid *ffEqOp, + int foreignNKeys, + char foreignUpdateType, + char foreignDeleteType, + const int16 *fkDeleteSetCols, + int numFkDeleteSetCols, + char foreignMatchType, + const Oid *exclOp, + Node *conExpr, + const char *conBin, + bool conIsLocal, + int conInhCount, + bool conNoInherit, + bool is_internal); + +extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, + const char *conname); +extern bool ConstraintNameExists(const char *conname, Oid namespaceid); +extern char *ChooseConstraintName(const char *name1, const char *name2, + const char *label, Oid namespaceid, + List *others); + +extern HeapTuple findDomainNotNullConstraint(Oid typid); + +extern void RemoveConstraintById(Oid conId); +extern void RenameConstraintById(Oid conId, const char *newname); + +extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, + Oid newNspId, bool isType, ObjectAddresses *objsMoved); +extern void ConstraintSetParentConstraint(Oid childConstrId, + Oid parentConstrId, + Oid childTableId); +extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok); +extern Bitmapset *get_relation_constraint_attnos(Oid relid, const char *conname, + bool missing_ok, Oid *constraintOid); +extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok); +extern Oid get_relation_idx_constraint_oid(Oid relationId, Oid indexId); + +extern Bitmapset *get_primary_key_attnos(Oid relid, bool deferrableOk, + Oid *constraintOid); +extern void DeconstructFkConstraintRow(HeapTuple tuple, int *numfks, + AttrNumber *conkey, AttrNumber *confkey, + Oid *pf_eq_oprs, Oid *pp_eq_oprs, Oid *ff_eq_oprs, + int *num_fk_del_set_cols, AttrNumber *fk_del_set_cols); + +extern bool check_functional_grouping(Oid relid, + Index varno, Index varlevelsup, + List *grouping_columns, + List **constraintDeps); + +#endif /* PG_CONSTRAINT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint_d.h new file mode 100644 index 0000000000000000000000000000000000000000..dd91d4e3cd2365244744a0c66214c460ae59dc3c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_constraint_d.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * pg_constraint_d.h + * Macro definitions for pg_constraint + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONSTRAINT_D_H +#define PG_CONSTRAINT_D_H + +#define ConstraintRelationId 2606 +#define ConstraintNameNspIndexId 2664 +#define ConstraintRelidTypidNameIndexId 2665 +#define ConstraintTypidIndexId 2666 +#define ConstraintOidIndexId 2667 +#define ConstraintParentIndexId 2579 + +#define Anum_pg_constraint_oid 1 +#define Anum_pg_constraint_conname 2 +#define Anum_pg_constraint_connamespace 3 +#define Anum_pg_constraint_contype 4 +#define Anum_pg_constraint_condeferrable 5 +#define Anum_pg_constraint_condeferred 6 +#define Anum_pg_constraint_convalidated 7 +#define Anum_pg_constraint_conrelid 8 +#define Anum_pg_constraint_contypid 9 +#define Anum_pg_constraint_conindid 10 +#define Anum_pg_constraint_conparentid 11 +#define Anum_pg_constraint_confrelid 12 +#define Anum_pg_constraint_confupdtype 13 +#define Anum_pg_constraint_confdeltype 14 +#define Anum_pg_constraint_confmatchtype 15 +#define Anum_pg_constraint_conislocal 16 +#define Anum_pg_constraint_coninhcount 17 +#define Anum_pg_constraint_connoinherit 18 +#define Anum_pg_constraint_conkey 19 +#define Anum_pg_constraint_confkey 20 +#define Anum_pg_constraint_conpfeqop 21 +#define Anum_pg_constraint_conppeqop 22 +#define Anum_pg_constraint_conffeqop 23 +#define Anum_pg_constraint_confdelsetcols 24 +#define Anum_pg_constraint_conexclop 25 +#define Anum_pg_constraint_conbin 26 + +#define Natts_pg_constraint 26 + + +/* Valid values for contype */ +#define CONSTRAINT_CHECK 'c' +#define CONSTRAINT_FOREIGN 'f' +#define CONSTRAINT_NOTNULL 'n' +#define CONSTRAINT_PRIMARY 'p' +#define CONSTRAINT_UNIQUE 'u' +#define CONSTRAINT_TRIGGER 't' +#define CONSTRAINT_EXCLUSION 'x' + +/* + * Valid values for confupdtype and confdeltype are the FKCONSTR_ACTION_xxx + * constants defined in parsenodes.h. Valid values for confmatchtype are + * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. + */ + + +#endif /* PG_CONSTRAINT_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_control.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_control.h new file mode 100644 index 0000000000000000000000000000000000000000..e80ff8e4140a893bc7f267483a201506cc212370 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_control.h @@ -0,0 +1,260 @@ +/*------------------------------------------------------------------------- + * + * pg_control.h + * The system control file "pg_control" is not a heap relation. + * However, we define it here so that the format is documented. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_control.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONTROL_H +#define PG_CONTROL_H + +#include "access/transam.h" +#include "access/xlogdefs.h" +#include "pgtime.h" /* for pg_time_t */ +#include "port/pg_crc32c.h" + + +/* Version identifier for this pg_control format */ +#define PG_CONTROL_VERSION 1700 + +/* Nonce key length, see below */ +#define MOCK_AUTH_NONCE_LEN 32 + +/* + * Body of CheckPoint XLOG records. This is declared here because we keep + * a copy of the latest one in pg_control for possible disaster recovery. + * Changing this struct requires a PG_CONTROL_VERSION bump. + */ +typedef struct CheckPoint +{ + XLogRecPtr redo; /* next RecPtr available when we began to + * create CheckPoint (i.e. REDO start point) */ + TimeLineID ThisTimeLineID; /* current TLI */ + TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new + * timeline (equals ThisTimeLineID otherwise) */ + bool fullPageWrites; /* current full_page_writes */ + int wal_level; /* current wal_level */ + FullTransactionId nextXid; /* next free transaction ID */ + Oid nextOid; /* next free OID */ + MultiXactId nextMulti; /* next free MultiXactId */ + MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ + TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ + Oid oldestXidDB; /* database with minimum datfrozenxid */ + MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */ + Oid oldestMultiDB; /* database with minimum datminmxid */ + pg_time_t time; /* time stamp of checkpoint */ + TransactionId oldestCommitTsXid; /* oldest Xid with valid commit + * timestamp */ + TransactionId newestCommitTsXid; /* newest Xid with valid commit + * timestamp */ + + /* + * Oldest XID still running. This is only needed to initialize hot standby + * mode from an online checkpoint, so we only bother calculating this for + * online checkpoints and only when wal_level is replica. Otherwise it's + * set to InvalidTransactionId. + */ + TransactionId oldestActiveXid; +} CheckPoint; + +/* XLOG info values for XLOG rmgr */ +#define XLOG_CHECKPOINT_SHUTDOWN 0x00 +#define XLOG_CHECKPOINT_ONLINE 0x10 +#define XLOG_NOOP 0x20 +#define XLOG_NEXTOID 0x30 +#define XLOG_SWITCH 0x40 +#define XLOG_BACKUP_END 0x50 +#define XLOG_PARAMETER_CHANGE 0x60 +#define XLOG_RESTORE_POINT 0x70 +#define XLOG_FPW_CHANGE 0x80 +#define XLOG_END_OF_RECOVERY 0x90 +#define XLOG_FPI_FOR_HINT 0xA0 +#define XLOG_FPI 0xB0 +/* 0xC0 is used in Postgres 9.5-11 */ +#define XLOG_OVERWRITE_CONTRECORD 0xD0 +#define XLOG_CHECKPOINT_REDO 0xE0 + + +/* + * System status indicator. Note this is stored in pg_control; if you change + * it, you must bump PG_CONTROL_VERSION + */ +typedef enum DBState +{ + DB_STARTUP = 0, + DB_SHUTDOWNED, + DB_SHUTDOWNED_IN_RECOVERY, + DB_SHUTDOWNING, + DB_IN_CRASH_RECOVERY, + DB_IN_ARCHIVE_RECOVERY, + DB_IN_PRODUCTION, +} DBState; + +/* + * Contents of pg_control. + */ + +typedef struct ControlFileData +{ + /* + * Unique system identifier --- to ensure we match up xlog files with the + * installation that produced them. + */ + uint64 system_identifier; + + /* + * Version identifier information. Keep these fields at the same offset, + * especially pg_control_version; they won't be real useful if they move + * around. (For historical reasons they must be 8 bytes into the file + * rather than immediately at the front.) + * + * pg_control_version identifies the format of pg_control itself. + * catalog_version_no identifies the format of the system catalogs. + * + * There are additional version identifiers in individual files; for + * example, WAL logs contain per-page magic numbers that can serve as + * version cues for the WAL log. + */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ + + /* + * System status data + */ + DBState state; /* see enum above */ + pg_time_t time; /* time stamp of last pg_control update */ + XLogRecPtr checkPoint; /* last check point record ptr */ + + CheckPoint checkPointCopy; /* copy of last check point record */ + + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + + /* + * These two values determine the minimum point we must recover up to + * before starting up: + * + * minRecoveryPoint is updated to the latest replayed LSN whenever we + * flush a data change during archive recovery. That guards against + * starting archive recovery, aborting it, and restarting with an earlier + * stop location. If we've already flushed data changes from WAL record X + * to disk, we mustn't start up until we reach X again. Zero when not + * doing archive recovery. + * + * backupStartPoint is the redo pointer of the backup start checkpoint, if + * we are recovering from an online backup and haven't reached the end of + * backup yet. It is reset to zero when the end of backup is reached, and + * we mustn't start up before that. A boolean would suffice otherwise, but + * we use the redo pointer as a cross-check when we see an end-of-backup + * record, to make sure the end-of-backup record corresponds the base + * backup we're recovering from. + * + * backupEndPoint is the backup end location, if we are recovering from an + * online backup which was taken from the standby and haven't reached the + * end of backup yet. It is initialized to the minimum recovery point in + * pg_control which was backed up last. It is reset to zero when the end + * of backup is reached, and we mustn't start up before that. + * + * If backupEndRequired is true, we know for sure that we're restoring + * from a backup, and must see a backup-end record before we can safely + * start up. + */ + XLogRecPtr minRecoveryPoint; + TimeLineID minRecoveryPointTLI; + XLogRecPtr backupStartPoint; + XLogRecPtr backupEndPoint; + bool backupEndRequired; + + /* + * Parameter settings that determine if the WAL can be used for archival + * or hot standby. + */ + int wal_level; + bool wal_log_hints; + int MaxConnections; + int max_worker_processes; + int max_wal_senders; + int max_prepared_xacts; + int max_locks_per_xact; + bool track_commit_timestamp; + + /* + * This data is used to check for hardware-architecture compatibility of + * the database and the backend executable. We need not check endianness + * explicitly, since the pg_control version will surely look wrong to a + * machine of different endianness, but we do need to worry about MAXALIGN + * and floating-point format. (Note: storage layout nominally also + * depends on SHORTALIGN and INTALIGN, but in practice these are the same + * on all architectures of interest.) + * + * Testing just one double value is not a very bulletproof test for + * floating-point compatibility, but it will catch most cases. + */ + uint32 maxAlign; /* alignment requirement for tuples */ + double floatFormat; /* constant 1234567.0 */ +#define FLOATFORMAT_VALUE 1234567.0 + + /* + * This data is used to make sure that configuration of this database is + * compatible with the backend executable. + */ + uint32 blcksz; /* data block size for this DB */ + uint32 relseg_size; /* blocks per segment of large relation */ + + uint32 xlog_blcksz; /* block size within WAL files */ + uint32 xlog_seg_size; /* size of each WAL segment */ + + uint32 nameDataLen; /* catalog name field width */ + uint32 indexMaxKeys; /* max number of columns in an index */ + + uint32 toast_max_chunk_size; /* chunk size in TOAST tables */ + uint32 loblksize; /* chunk size in pg_largeobject */ + + bool float8ByVal; /* float8, int8, etc pass-by-value? */ + + /* Are data pages protected by checksums? Zero if no checksum version */ + uint32 data_checksum_version; + + /* + * Random nonce, used in authentication requests that need to proceed + * based on values that are cluster-unique, like a SASL exchange that + * failed at an early stage. + */ + char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]; + + /* CRC of all above ... MUST BE LAST! */ + pg_crc32c crc; +} ControlFileData; + +/* + * Maximum safe value of sizeof(ControlFileData). For reliability's sake, + * it's critical that pg_control updates be atomic writes. That generally + * means the active data can't be more than one disk sector, which is 512 + * bytes on common hardware. Be very careful about raising this limit. + */ +#define PG_CONTROL_MAX_SAFE_SIZE 512 + +/* + * Physical size of the pg_control file. Note that this is considerably + * bigger than the actually used size (ie, sizeof(ControlFileData)). + * The idea is to keep the physical size constant independent of format + * changes, so that ReadControlFile will deliver a suitable wrong-version + * message instead of a read error if it's looking at an incompatible file. + */ +#define PG_CONTROL_FILE_SIZE 8192 + +/* + * Ensure that the size of the pg_control data structure is sane. + */ +StaticAssertDecl(sizeof(ControlFileData) <= PG_CONTROL_MAX_SAFE_SIZE, + "pg_control is too large for atomic disk writes"); +StaticAssertDecl(sizeof(ControlFileData) <= PG_CONTROL_FILE_SIZE, + "sizeof(ControlFileData) exceeds PG_CONTROL_FILE_SIZE"); + +#endif /* PG_CONTROL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion.h new file mode 100644 index 0000000000000000000000000000000000000000..d94f022967256715d1801b589a152f1490447b0d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------------------- + * + * pg_conversion.h + * definition of the "conversion" system catalog (pg_conversion) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_conversion.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONVERSION_H +#define PG_CONVERSION_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_conversion_d.h" + +/* ---------------- + * pg_conversion definition. cpp turns this into + * typedef struct FormData_pg_conversion + * ---------------- + */ +CATALOG(pg_conversion,2607,ConversionRelationId) +{ + /* oid */ + Oid oid; + + /* name of the conversion */ + NameData conname; + + /* namespace that the conversion belongs to */ + Oid connamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner of the conversion */ + Oid conowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* FOR encoding id */ + int32 conforencoding BKI_LOOKUP(encoding); + + /* TO encoding id */ + int32 contoencoding BKI_LOOKUP(encoding); + + /* OID of the conversion proc */ + regproc conproc BKI_LOOKUP(pg_proc); + + /* true if this is a default conversion */ + bool condefault BKI_DEFAULT(t); +} FormData_pg_conversion; + +/* ---------------- + * Form_pg_conversion corresponds to a pointer to a tuple with + * the format of pg_conversion relation. + * ---------------- + */ +typedef FormData_pg_conversion *Form_pg_conversion; + +DECLARE_UNIQUE_INDEX(pg_conversion_default_index, 2668, ConversionDefaultIndexId, pg_conversion, btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, ConversionNameNspIndexId, pg_conversion, btree(conname name_ops, connamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_conversion_oid_index, 2670, ConversionOidIndexId, pg_conversion, btree(oid oid_ops)); + +MAKE_SYSCACHE(CONDEFAULT, pg_conversion_default_index, 8); +MAKE_SYSCACHE(CONNAMENSP, pg_conversion_name_nsp_index, 8); +MAKE_SYSCACHE(CONVOID, pg_conversion_oid_index, 8); + + +extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace, + Oid conowner, + int32 conforencoding, int32 contoencoding, + Oid conproc, bool def); +extern Oid FindDefaultConversion(Oid name_space, int32 for_encoding, + int32 to_encoding); + +#endif /* PG_CONVERSION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion_d.h new file mode 100644 index 0000000000000000000000000000000000000000..b106c743a29cdcdd030703b059e168bf0d7f4dd7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_conversion_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_conversion_d.h + * Macro definitions for pg_conversion + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CONVERSION_D_H +#define PG_CONVERSION_D_H + +#define ConversionRelationId 2607 +#define ConversionDefaultIndexId 2668 +#define ConversionNameNspIndexId 2669 +#define ConversionOidIndexId 2670 + +#define Anum_pg_conversion_oid 1 +#define Anum_pg_conversion_conname 2 +#define Anum_pg_conversion_connamespace 3 +#define Anum_pg_conversion_conowner 4 +#define Anum_pg_conversion_conforencoding 5 +#define Anum_pg_conversion_contoencoding 6 +#define Anum_pg_conversion_conproc 7 +#define Anum_pg_conversion_condefault 8 + +#define Natts_pg_conversion 8 + + +#endif /* PG_CONVERSION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_database.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_database.h new file mode 100644 index 0000000000000000000000000000000000000000..dbd4379ffa5b743fcc49234996078c86c5cce59b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_database.h @@ -0,0 +1,129 @@ +/*------------------------------------------------------------------------- + * + * pg_database.h + * definition of the "database" system catalog (pg_database) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_database.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DATABASE_H +#define PG_DATABASE_H + +#include "catalog/genbki.h" +#include "catalog/pg_database_d.h" + +/* ---------------- + * pg_database definition. cpp turns this into + * typedef struct FormData_pg_database + * ---------------- + */ +CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + /* oid */ + Oid oid; + + /* database name */ + NameData datname; + + /* owner of database */ + Oid datdba BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* character encoding */ + int32 encoding; + + /* locale provider, see pg_collation.collprovider */ + char datlocprovider; + + /* allowed as CREATE DATABASE template? */ + bool datistemplate; + + /* new connections allowed? */ + bool datallowconn; + + /* database has login event triggers? */ + bool dathasloginevt; + + /* + * Max connections allowed. Negative values have special meaning, see + * DATCONNLIMIT_* defines below. + */ + int32 datconnlimit; + + /* all Xids < this are frozen in this DB */ + TransactionId datfrozenxid; + + /* all multixacts in the DB are >= this */ + TransactionId datminmxid; + + /* default table space for this DB */ + Oid dattablespace BKI_LOOKUP(pg_tablespace); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* LC_COLLATE setting */ + text datcollate BKI_FORCE_NOT_NULL; + + /* LC_CTYPE setting */ + text datctype BKI_FORCE_NOT_NULL; + + /* ICU locale ID */ + text datlocale; + + /* ICU collation rules */ + text daticurules; + + /* provider-dependent version of collation data */ + text datcollversion BKI_DEFAULT(_null_); + + /* access permissions */ + aclitem datacl[1]; +#endif +} FormData_pg_database; + +/* ---------------- + * Form_pg_database corresponds to a pointer to a tuple with + * the format of pg_database relation. + * ---------------- + */ +typedef FormData_pg_database *Form_pg_database; + +DECLARE_TOAST_WITH_MACRO(pg_database, 4177, 4178, PgDatabaseToastTable, PgDatabaseToastIndex); + +DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, DatabaseNameIndexId, pg_database, btree(datname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_database_oid_index, 2672, DatabaseOidIndexId, pg_database, btree(oid oid_ops)); + +MAKE_SYSCACHE(DATABASEOID, pg_database_oid_index, 4); + +/* + * pg_database.dat contains an entry for template1, but not for the template0 + * or postgres databases, because those are created later in initdb. + * However, we still want to manually assign the OIDs for template0 and + * postgres, so declare those here. + */ +DECLARE_OID_DEFINING_MACRO(Template0DbOid, 4); +DECLARE_OID_DEFINING_MACRO(PostgresDbOid, 5); + +/* + * Special values for pg_database.datconnlimit. Normal values are >= 0. + */ +#define DATCONNLIMIT_UNLIMITED -1 /* no limit */ + +/* + * A database is set to invalid partway through being dropped. Using + * datconnlimit=-2 for this purpose isn't particularly clean, but is + * backpatchable. + */ +#define DATCONNLIMIT_INVALID_DB -2 + +extern bool database_is_invalid_form(Form_pg_database datform); +extern bool database_is_invalid_oid(Oid dboid); + +#endif /* PG_DATABASE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_database_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_database_d.h new file mode 100644 index 0000000000000000000000000000000000000000..553263ff1339d0d2d9679370ab9d10d3ad0715f7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_database_d.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * pg_database_d.h + * Macro definitions for pg_database + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DATABASE_D_H +#define PG_DATABASE_D_H + +#define DatabaseRelationId 1262 +#define DatabaseRelation_Rowtype_Id 1248 +#define PgDatabaseToastTable 4177 +#define PgDatabaseToastIndex 4178 +#define DatabaseNameIndexId 2671 +#define DatabaseOidIndexId 2672 +#define Template0DbOid 4 +#define PostgresDbOid 5 + +#define Anum_pg_database_oid 1 +#define Anum_pg_database_datname 2 +#define Anum_pg_database_datdba 3 +#define Anum_pg_database_encoding 4 +#define Anum_pg_database_datlocprovider 5 +#define Anum_pg_database_datistemplate 6 +#define Anum_pg_database_datallowconn 7 +#define Anum_pg_database_dathasloginevt 8 +#define Anum_pg_database_datconnlimit 9 +#define Anum_pg_database_datfrozenxid 10 +#define Anum_pg_database_datminmxid 11 +#define Anum_pg_database_dattablespace 12 +#define Anum_pg_database_datcollate 13 +#define Anum_pg_database_datctype 14 +#define Anum_pg_database_datlocale 15 +#define Anum_pg_database_daticurules 16 +#define Anum_pg_database_datcollversion 17 +#define Anum_pg_database_datacl 18 + +#define Natts_pg_database 18 + +#define Template1DbOid 1 + +#endif /* PG_DATABASE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting.h new file mode 100644 index 0000000000000000000000000000000000000000..7e1a652381f9a1adc814304bd500e5fa4c922d52 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_db_role_setting.h + * definition of the system catalog for per-database/per-user + * configuration settings (pg_db_role_setting) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_db_role_setting.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DB_ROLE_SETTING_H +#define PG_DB_ROLE_SETTING_H + +#include "catalog/genbki.h" +#include "catalog/pg_db_role_setting_d.h" + +#include "utils/guc.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + +/* ---------------- + * pg_db_role_setting definition. cpp turns this into + * typedef struct FormData_pg_db_role_setting + * ---------------- + */ +CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION +{ + /* database, or 0 for a role-specific setting */ + Oid setdatabase BKI_LOOKUP_OPT(pg_database); + + /* role, or 0 for a database-specific setting */ + Oid setrole BKI_LOOKUP_OPT(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text setconfig[1]; /* GUC settings to apply at login */ +#endif +} FormData_pg_db_role_setting; + +typedef FormData_pg_db_role_setting * Form_pg_db_role_setting; + +DECLARE_TOAST_WITH_MACRO(pg_db_role_setting, 2966, 2967, PgDbRoleSettingToastTable, PgDbRoleSettingToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_db_role_setting_databaseid_rol_index, 2965, DbRoleSettingDatidRolidIndexId, pg_db_role_setting, btree(setdatabase oid_ops, setrole oid_ops)); + +/* + * prototypes for functions in pg_db_role_setting.c + */ +extern void AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt); +extern void DropSetting(Oid databaseid, Oid roleid); +extern void ApplySetting(Snapshot snapshot, Oid databaseid, Oid roleid, + Relation relsetting, GucSource source); + +#endif /* PG_DB_ROLE_SETTING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting_d.h new file mode 100644 index 0000000000000000000000000000000000000000..8046b7b3450058da39e7892075625b6bc16ee470 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_db_role_setting_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_db_role_setting_d.h + * Macro definitions for pg_db_role_setting + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DB_ROLE_SETTING_D_H +#define PG_DB_ROLE_SETTING_D_H + +#define DbRoleSettingRelationId 2964 +#define PgDbRoleSettingToastTable 2966 +#define PgDbRoleSettingToastIndex 2967 +#define DbRoleSettingDatidRolidIndexId 2965 + +#define Anum_pg_db_role_setting_setdatabase 1 +#define Anum_pg_db_role_setting_setrole 2 +#define Anum_pg_db_role_setting_setconfig 3 + +#define Natts_pg_db_role_setting 3 + + +#endif /* PG_DB_ROLE_SETTING_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl.h new file mode 100644 index 0000000000000000000000000000000000000000..d272cdf08b476d60e1cd4aeab549a4fb9b46bfee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * pg_default_acl.h + * definition of the system catalog for default ACLs of new objects + * (pg_default_acl) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_default_acl.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULT_ACL_H +#define PG_DEFAULT_ACL_H + +#include "catalog/genbki.h" +#include "catalog/pg_default_acl_d.h" + +/* ---------------- + * pg_default_acl definition. cpp turns this into + * typedef struct FormData_pg_default_acl + * ---------------- + */ +CATALOG(pg_default_acl,826,DefaultAclRelationId) +{ + Oid oid; /* oid */ + Oid defaclrole BKI_LOOKUP(pg_authid); /* OID of role owning this + * ACL */ + Oid defaclnamespace BKI_LOOKUP_OPT(pg_namespace); /* OID of namespace, or + * 0 for all */ + char defaclobjtype; /* see DEFACLOBJ_xxx constants below */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem defaclacl[1] BKI_FORCE_NOT_NULL; /* permissions to add at + * CREATE time */ +#endif +} FormData_pg_default_acl; + +/* ---------------- + * Form_pg_default_acl corresponds to a pointer to a tuple with + * the format of pg_default_acl relation. + * ---------------- + */ +typedef FormData_pg_default_acl *Form_pg_default_acl; + +DECLARE_TOAST(pg_default_acl, 4143, 4144); + +DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, DefaultAclRoleNspObjIndexId, pg_default_acl, btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_default_acl_oid_index, 828, DefaultAclOidIndexId, pg_default_acl, btree(oid oid_ops)); + +MAKE_SYSCACHE(DEFACLROLENSPOBJ, pg_default_acl_role_nsp_obj_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Types of objects for which the user is allowed to specify default + * permissions through pg_default_acl. These codes are used in the + * defaclobjtype column. + */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_DEFAULT_ACL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl_d.h new file mode 100644 index 0000000000000000000000000000000000000000..667266079004bebca301c7f93379a5e26ab6883c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_default_acl_d.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * pg_default_acl_d.h + * Macro definitions for pg_default_acl + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULT_ACL_D_H +#define PG_DEFAULT_ACL_D_H + +#define DefaultAclRelationId 826 +#define DefaultAclRoleNspObjIndexId 827 +#define DefaultAclOidIndexId 828 + +#define Anum_pg_default_acl_oid 1 +#define Anum_pg_default_acl_defaclrole 2 +#define Anum_pg_default_acl_defaclnamespace 3 +#define Anum_pg_default_acl_defaclobjtype 4 +#define Anum_pg_default_acl_defaclacl 5 + +#define Natts_pg_default_acl 5 + + +/* + * Types of objects for which the user is allowed to specify default + * permissions through pg_default_acl. These codes are used in the + * defaclobjtype column. + */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ + + +#endif /* PG_DEFAULT_ACL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_depend.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_depend.h new file mode 100644 index 0000000000000000000000000000000000000000..eb1ee43b012ebc8aa2192827013d5961f122d9ad --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_depend.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * pg_depend.h + * definition of the "dependency" system catalog (pg_depend) + * + * pg_depend has no preloaded contents, so there is no pg_depend.dat + * file; dependencies for system-defined objects are loaded into it + * on-the-fly during initdb. Most built-in objects are pinned anyway, + * and hence need no explicit entries in pg_depend. + * + * NOTE: we do not represent all possible dependency pairs in pg_depend; + * for example, there's not much value in creating an explicit dependency + * from an attribute to its relation. Usually we make a dependency for + * cases where the relationship is conditional rather than essential + * (for example, not all triggers are dependent on constraints, but all + * attributes are dependent on relations) or where the dependency is not + * convenient to find from the contents of other catalogs. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_depend.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEPEND_H +#define PG_DEPEND_H + +#include "catalog/genbki.h" +#include "catalog/pg_depend_d.h" + +/* ---------------- + * pg_depend definition. cpp turns this into + * typedef struct FormData_pg_depend + * ---------------- + */ +CATALOG(pg_depend,2608,DependRelationId) +{ + /* + * Identification of the dependent (referencing) object. + */ + Oid classid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid objid; /* OID of object itself */ + int32 objsubid; /* column number, or 0 if not used */ + + /* + * Identification of the independent (referenced) object. + */ + Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid refobjid; /* OID of object itself */ + int32 refobjsubid; /* column number, or 0 if not used */ + + /* + * Precise semantics of the relationship are specified by the deptype + * field. See DependencyType in catalog/dependency.h. + */ + char deptype; /* see codes in dependency.h */ +} FormData_pg_depend; + +/* ---------------- + * Form_pg_depend corresponds to a pointer to a row with + * the format of pg_depend relation. + * ---------------- + */ +typedef FormData_pg_depend *Form_pg_depend; + +DECLARE_INDEX(pg_depend_depender_index, 2673, DependDependerIndexId, pg_depend, btree(classid oid_ops, objid oid_ops, objsubid int4_ops)); +DECLARE_INDEX(pg_depend_reference_index, 2674, DependReferenceIndexId, pg_depend, btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops)); + +#endif /* PG_DEPEND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_depend_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_depend_d.h new file mode 100644 index 0000000000000000000000000000000000000000..18d3cb3a05d31b0ba524262e3c3a68bb36f6e452 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_depend_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_depend_d.h + * Macro definitions for pg_depend + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEPEND_D_H +#define PG_DEPEND_D_H + +#define DependRelationId 2608 +#define DependDependerIndexId 2673 +#define DependReferenceIndexId 2674 + +#define Anum_pg_depend_classid 1 +#define Anum_pg_depend_objid 2 +#define Anum_pg_depend_objsubid 3 +#define Anum_pg_depend_refclassid 4 +#define Anum_pg_depend_refobjid 5 +#define Anum_pg_depend_refobjsubid 6 +#define Anum_pg_depend_deptype 7 + +#define Natts_pg_depend 7 + + +#endif /* PG_DEPEND_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_description.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_description.h new file mode 100644 index 0000000000000000000000000000000000000000..e30a6976beb04d8663ba2d567bce51d7f3698028 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_description.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * pg_description.h + * definition of the "description" system catalog (pg_description) + * + * Because the contents of this table are taken from the *.dat files + * of other catalogs, there is no pg_description.dat file. The initial + * contents are assembled by genbki.pl and loaded during initdb. + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a function is identified by the OID of its pg_proc row + * plus the pg_class OID of table pg_proc. This allows unique identification + * of objects without assuming that OIDs are unique across tables. + * + * Since attributes don't have OIDs of their own, we identify an attribute + * comment by the objoid+classoid of its parent table, plus an "objsubid" + * giving the attribute column number. "objsubid" must be zero in a comment + * for a table itself, so that it is distinct from any column comment. + * Currently, objsubid is unused and zero for all other kinds of objects, + * but perhaps it might be useful someday to associate comments with + * constituent elements of other kinds of objects (arguments of a function, + * for example). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_description.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DESCRIPTION_H +#define PG_DESCRIPTION_H + +#include "catalog/genbki.h" +#include "catalog/pg_description_d.h" + +/* ---------------- + * pg_description definition. cpp turns this into + * typedef struct FormData_pg_description + * ---------------- + */ +CATALOG(pg_description,2609,DescriptionRelationId) +{ + Oid objoid; /* OID of object itself */ + Oid classoid; /* OID of table containing object */ + int32 objsubid; /* column number, or 0 if not used */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text description BKI_FORCE_NOT_NULL; /* description of object */ +#endif +} FormData_pg_description; + +/* ---------------- + * Form_pg_description corresponds to a pointer to a tuple with + * the format of pg_description relation. + * ---------------- + */ +typedef FormData_pg_description * Form_pg_description; + +DECLARE_TOAST(pg_description, 2834, 2835); + +DECLARE_UNIQUE_INDEX_PKEY(pg_description_o_c_o_index, 2675, DescriptionObjIndexId, pg_description, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); + +/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */ +DECLARE_FOREIGN_KEY((classoid), pg_class, (oid)); + +#endif /* PG_DESCRIPTION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_description_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_description_d.h new file mode 100644 index 0000000000000000000000000000000000000000..6680095dab1d4bcabdc8bf562f152d49856b09ce --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_description_d.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * pg_description_d.h + * Macro definitions for pg_description + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DESCRIPTION_D_H +#define PG_DESCRIPTION_D_H + +#define DescriptionRelationId 2609 +#define DescriptionObjIndexId 2675 + +#define Anum_pg_description_objoid 1 +#define Anum_pg_description_classoid 2 +#define Anum_pg_description_objsubid 3 +#define Anum_pg_description_description 4 + +#define Natts_pg_description 4 + + +#endif /* PG_DESCRIPTION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_enum.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_enum.h new file mode 100644 index 0000000000000000000000000000000000000000..4d9a241d34890b5ba1c45ce3a88eaa6ea82b24f8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_enum.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * pg_enum.h + * definition of the "enum" system catalog (pg_enum) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_enum.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ENUM_H +#define PG_ENUM_H + +#include "catalog/genbki.h" +#include "catalog/pg_enum_d.h" + +#include "nodes/pg_list.h" + +/* ---------------- + * pg_enum definition. cpp turns this into + * typedef struct FormData_pg_enum + * ---------------- + */ +CATALOG(pg_enum,3501,EnumRelationId) +{ + Oid oid; /* oid */ + Oid enumtypid BKI_LOOKUP(pg_type); /* OID of owning enum type */ + float4 enumsortorder; /* sort position of this enum value */ + NameData enumlabel; /* text representation of enum value */ +} FormData_pg_enum; + +/* ---------------- + * Form_pg_enum corresponds to a pointer to a tuple with + * the format of pg_enum relation. + * ---------------- + */ +typedef FormData_pg_enum *Form_pg_enum; + +DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, pg_enum, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, pg_enum, btree(enumtypid oid_ops, enumlabel name_ops)); +DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, EnumTypIdSortOrderIndexId, pg_enum, btree(enumtypid oid_ops, enumsortorder float4_ops)); + +MAKE_SYSCACHE(ENUMOID, pg_enum_oid_index, 8); +MAKE_SYSCACHE(ENUMTYPOIDNAME, pg_enum_typid_label_index, 8); + +/* + * prototypes for functions in pg_enum.c + */ +extern void EnumValuesCreate(Oid enumTypeOid, List *vals); +extern void EnumValuesDelete(Oid enumTypeOid); +extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, + const char *neighbor, bool newValIsAfter, + bool skipIfExists); +extern void RenameEnumLabel(Oid enumTypeOid, + const char *oldVal, const char *newVal); +extern bool EnumUncommitted(Oid enum_id); +extern Size EstimateUncommittedEnumsSpace(void); +extern void SerializeUncommittedEnums(void *space, Size size); +extern void RestoreUncommittedEnums(void *space); +extern void AtEOXact_Enum(void); + +#endif /* PG_ENUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_enum_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_enum_d.h new file mode 100644 index 0000000000000000000000000000000000000000..777fb97314831a2cc72b5ab1c3a784d1061e8210 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_enum_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_enum_d.h + * Macro definitions for pg_enum + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ENUM_D_H +#define PG_ENUM_D_H + +#define EnumRelationId 3501 +#define EnumOidIndexId 3502 +#define EnumTypIdLabelIndexId 3503 +#define EnumTypIdSortOrderIndexId 3534 + +#define Anum_pg_enum_oid 1 +#define Anum_pg_enum_enumtypid 2 +#define Anum_pg_enum_enumsortorder 3 +#define Anum_pg_enum_enumlabel 4 + +#define Natts_pg_enum 4 + + +#endif /* PG_ENUM_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger.h new file mode 100644 index 0000000000000000000000000000000000000000..9170a4ddfe80fc0e1cc8a09dbe8bdb638a3acf6f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_event_trigger.h + * definition of the "event trigger" system catalog (pg_event_trigger) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_event_trigger.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EVENT_TRIGGER_H +#define PG_EVENT_TRIGGER_H + +#include "catalog/genbki.h" +#include "catalog/pg_event_trigger_d.h" + +/* ---------------- + * pg_event_trigger definition. cpp turns this into + * typedef struct FormData_pg_event_trigger + * ---------------- + */ +CATALOG(pg_event_trigger,3466,EventTriggerRelationId) +{ + Oid oid; /* oid */ + NameData evtname; /* trigger's name */ + NameData evtevent; /* trigger's event */ + Oid evtowner BKI_LOOKUP(pg_authid); /* trigger's owner */ + Oid evtfoid BKI_LOOKUP(pg_proc); /* OID of function to be + * called */ + char evtenabled; /* trigger's firing configuration WRT + * session_replication_role */ + +#ifdef CATALOG_VARLEN + text evttags[1]; /* command TAGs this event trigger targets */ +#endif +} FormData_pg_event_trigger; + +/* ---------------- + * Form_pg_event_trigger corresponds to a pointer to a tuple with + * the format of pg_event_trigger relation. + * ---------------- + */ +typedef FormData_pg_event_trigger *Form_pg_event_trigger; + +DECLARE_TOAST(pg_event_trigger, 4145, 4146); + +DECLARE_UNIQUE_INDEX(pg_event_trigger_evtname_index, 3467, EventTriggerNameIndexId, pg_event_trigger, btree(evtname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_event_trigger_oid_index, 3468, EventTriggerOidIndexId, pg_event_trigger, btree(oid oid_ops)); + +MAKE_SYSCACHE(EVENTTRIGGERNAME, pg_event_trigger_evtname_index, 8); +MAKE_SYSCACHE(EVENTTRIGGEROID, pg_event_trigger_oid_index, 8); + +#endif /* PG_EVENT_TRIGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger_d.h new file mode 100644 index 0000000000000000000000000000000000000000..b66869ccc9b2f2d925b85710bfe22b1d9affc708 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_event_trigger_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_event_trigger_d.h + * Macro definitions for pg_event_trigger + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EVENT_TRIGGER_D_H +#define PG_EVENT_TRIGGER_D_H + +#define EventTriggerRelationId 3466 +#define EventTriggerNameIndexId 3467 +#define EventTriggerOidIndexId 3468 + +#define Anum_pg_event_trigger_oid 1 +#define Anum_pg_event_trigger_evtname 2 +#define Anum_pg_event_trigger_evtevent 3 +#define Anum_pg_event_trigger_evtowner 4 +#define Anum_pg_event_trigger_evtfoid 5 +#define Anum_pg_event_trigger_evtenabled 6 +#define Anum_pg_event_trigger_evttags 7 + +#define Natts_pg_event_trigger 7 + + +#endif /* PG_EVENT_TRIGGER_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_extension.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_extension.h new file mode 100644 index 0000000000000000000000000000000000000000..cdfacc09303648e92de9b4b87ac4af7447164126 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_extension.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * pg_extension.h + * definition of the "extension" system catalog (pg_extension) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_extension.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EXTENSION_H +#define PG_EXTENSION_H + +#include "catalog/genbki.h" +#include "catalog/pg_extension_d.h" + +/* ---------------- + * pg_extension definition. cpp turns this into + * typedef struct FormData_pg_extension + * ---------------- + */ +CATALOG(pg_extension,3079,ExtensionRelationId) +{ + Oid oid; /* oid */ + NameData extname; /* extension name */ + Oid extowner BKI_LOOKUP(pg_authid); /* extension owner */ + Oid extnamespace BKI_LOOKUP(pg_namespace); /* namespace of + * contained objects */ + bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* extversion may never be null, but the others can be. */ + text extversion BKI_FORCE_NOT_NULL; /* extension version name */ + Oid extconfig[1] BKI_LOOKUP(pg_class); /* dumpable configuration + * tables */ + text extcondition[1]; /* WHERE clauses for config tables */ +#endif +} FormData_pg_extension; + +/* ---------------- + * Form_pg_extension corresponds to a pointer to a tuple with + * the format of pg_extension relation. + * ---------------- + */ +typedef FormData_pg_extension *Form_pg_extension; + +DECLARE_TOAST(pg_extension, 4147, 4148); + +DECLARE_UNIQUE_INDEX_PKEY(pg_extension_oid_index, 3080, ExtensionOidIndexId, pg_extension, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, ExtensionNameIndexId, pg_extension, btree(extname name_ops)); + +#endif /* PG_EXTENSION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_extension_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_extension_d.h new file mode 100644 index 0000000000000000000000000000000000000000..9891dd5645a77ab5317b7229730ff2e60774d7cc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_extension_d.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * pg_extension_d.h + * Macro definitions for pg_extension + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_EXTENSION_D_H +#define PG_EXTENSION_D_H + +#define ExtensionRelationId 3079 +#define ExtensionOidIndexId 3080 +#define ExtensionNameIndexId 3081 + +#define Anum_pg_extension_oid 1 +#define Anum_pg_extension_extname 2 +#define Anum_pg_extension_extowner 3 +#define Anum_pg_extension_extnamespace 4 +#define Anum_pg_extension_extrelocatable 5 +#define Anum_pg_extension_extversion 6 +#define Anum_pg_extension_extconfig 7 +#define Anum_pg_extension_extcondition 8 + +#define Natts_pg_extension 8 + + +#endif /* PG_EXTENSION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..0d8759d3fd3852703e67713334ddad729ae3ee0e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_data_wrapper.h + * definition of the "foreign-data wrapper" system catalog (pg_foreign_data_wrapper) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_data_wrapper.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_DATA_WRAPPER_H +#define PG_FOREIGN_DATA_WRAPPER_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_data_wrapper_d.h" + +/* ---------------- + * pg_foreign_data_wrapper definition. cpp turns this into + * typedef struct FormData_pg_foreign_data_wrapper + * ---------------- + */ +CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId) +{ + Oid oid; /* oid */ + NameData fdwname; /* foreign-data wrapper name */ + Oid fdwowner BKI_LOOKUP(pg_authid); /* FDW owner */ + Oid fdwhandler BKI_LOOKUP_OPT(pg_proc); /* handler function, or 0 + * if none */ + Oid fdwvalidator BKI_LOOKUP_OPT(pg_proc); /* option validation + * function, or 0 if + * none */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem fdwacl[1]; /* access permissions */ + text fdwoptions[1]; /* FDW options */ +#endif +} FormData_pg_foreign_data_wrapper; + +/* ---------------- + * Form_pg_foreign_data_wrapper corresponds to a pointer to a tuple with + * the format of pg_foreign_data_wrapper relation. + * ---------------- + */ +typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; + +DECLARE_TOAST(pg_foreign_data_wrapper, 4149, 4150); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_data_wrapper_oid_index, 112, ForeignDataWrapperOidIndexId, pg_foreign_data_wrapper, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, ForeignDataWrapperNameIndexId, pg_foreign_data_wrapper, btree(fdwname name_ops)); + +MAKE_SYSCACHE(FOREIGNDATAWRAPPEROID, pg_foreign_data_wrapper_oid_index, 2); +MAKE_SYSCACHE(FOREIGNDATAWRAPPERNAME, pg_foreign_data_wrapper_name_index, 2); + +#endif /* PG_FOREIGN_DATA_WRAPPER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper_d.h new file mode 100644 index 0000000000000000000000000000000000000000..7a27c8837afe8950e182aa6d489e479ae7844986 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_data_wrapper_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_data_wrapper_d.h + * Macro definitions for pg_foreign_data_wrapper + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_DATA_WRAPPER_D_H +#define PG_FOREIGN_DATA_WRAPPER_D_H + +#define ForeignDataWrapperRelationId 2328 +#define ForeignDataWrapperOidIndexId 112 +#define ForeignDataWrapperNameIndexId 548 + +#define Anum_pg_foreign_data_wrapper_oid 1 +#define Anum_pg_foreign_data_wrapper_fdwname 2 +#define Anum_pg_foreign_data_wrapper_fdwowner 3 +#define Anum_pg_foreign_data_wrapper_fdwhandler 4 +#define Anum_pg_foreign_data_wrapper_fdwvalidator 5 +#define Anum_pg_foreign_data_wrapper_fdwacl 6 +#define Anum_pg_foreign_data_wrapper_fdwoptions 7 + +#define Natts_pg_foreign_data_wrapper 7 + + +#endif /* PG_FOREIGN_DATA_WRAPPER_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server.h new file mode 100644 index 0000000000000000000000000000000000000000..a4b81936b0954d42d7e81120c7fcb59d1d778337 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_server.h + * definition of the "foreign server" system catalog (pg_foreign_server) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_server.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_SERVER_H +#define PG_FOREIGN_SERVER_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_server_d.h" + +/* ---------------- + * pg_foreign_server definition. cpp turns this into + * typedef struct FormData_pg_foreign_server + * ---------------- + */ +CATALOG(pg_foreign_server,1417,ForeignServerRelationId) +{ + Oid oid; /* oid */ + NameData srvname; /* foreign server name */ + Oid srvowner BKI_LOOKUP(pg_authid); /* server owner */ + Oid srvfdw BKI_LOOKUP(pg_foreign_data_wrapper); /* server FDW */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text srvtype; + text srvversion; + aclitem srvacl[1]; /* access permissions */ + text srvoptions[1]; /* FDW-specific options */ +#endif +} FormData_pg_foreign_server; + +/* ---------------- + * Form_pg_foreign_server corresponds to a pointer to a tuple with + * the format of pg_foreign_server relation. + * ---------------- + */ +typedef FormData_pg_foreign_server *Form_pg_foreign_server; + +DECLARE_TOAST(pg_foreign_server, 4151, 4152); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_server_oid_index, 113, ForeignServerOidIndexId, pg_foreign_server, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, ForeignServerNameIndexId, pg_foreign_server, btree(srvname name_ops)); + +MAKE_SYSCACHE(FOREIGNSERVEROID, pg_foreign_server_oid_index, 2); +MAKE_SYSCACHE(FOREIGNSERVERNAME, pg_foreign_server_name_index, 2); + +#endif /* PG_FOREIGN_SERVER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server_d.h new file mode 100644 index 0000000000000000000000000000000000000000..e365e09ab17cab087380451dc20f52ed74f84281 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_server_d.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_server_d.h + * Macro definitions for pg_foreign_server + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_SERVER_D_H +#define PG_FOREIGN_SERVER_D_H + +#define ForeignServerRelationId 1417 +#define ForeignServerOidIndexId 113 +#define ForeignServerNameIndexId 549 + +#define Anum_pg_foreign_server_oid 1 +#define Anum_pg_foreign_server_srvname 2 +#define Anum_pg_foreign_server_srvowner 3 +#define Anum_pg_foreign_server_srvfdw 4 +#define Anum_pg_foreign_server_srvtype 5 +#define Anum_pg_foreign_server_srvversion 6 +#define Anum_pg_foreign_server_srvacl 7 +#define Anum_pg_foreign_server_srvoptions 8 + +#define Natts_pg_foreign_server 8 + + +#endif /* PG_FOREIGN_SERVER_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table.h new file mode 100644 index 0000000000000000000000000000000000000000..d17ff0e76e18bd356d5ff299c181646892407202 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_table.h + * definition of the "foreign table" system catalog (pg_foreign_table) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_table.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_TABLE_H +#define PG_FOREIGN_TABLE_H + +#include "catalog/genbki.h" +#include "catalog/pg_foreign_table_d.h" + +/* ---------------- + * pg_foreign_table definition. cpp turns this into + * typedef struct FormData_pg_foreign_table + * ---------------- + */ +CATALOG(pg_foreign_table,3118,ForeignTableRelationId) +{ + Oid ftrelid BKI_LOOKUP(pg_class); /* OID of foreign table */ + Oid ftserver BKI_LOOKUP(pg_foreign_server); /* OID of foreign server */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text ftoptions[1]; /* FDW-specific options */ +#endif +} FormData_pg_foreign_table; + +/* ---------------- + * Form_pg_foreign_table corresponds to a pointer to a tuple with + * the format of pg_foreign_table relation. + * ---------------- + */ +typedef FormData_pg_foreign_table *Form_pg_foreign_table; + +DECLARE_TOAST(pg_foreign_table, 4153, 4154); + +DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_table_relid_index, 3119, ForeignTableRelidIndexId, pg_foreign_table, btree(ftrelid oid_ops)); + +MAKE_SYSCACHE(FOREIGNTABLEREL, pg_foreign_table_relid_index, 4); + +#endif /* PG_FOREIGN_TABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table_d.h new file mode 100644 index 0000000000000000000000000000000000000000..51e4d2b068da47a1d152f17d5b9a0381e0c928c1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_foreign_table_d.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_table_d.h + * Macro definitions for pg_foreign_table + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_TABLE_D_H +#define PG_FOREIGN_TABLE_D_H + +#define ForeignTableRelationId 3118 +#define ForeignTableRelidIndexId 3119 + +#define Anum_pg_foreign_table_ftrelid 1 +#define Anum_pg_foreign_table_ftserver 2 +#define Anum_pg_foreign_table_ftoptions 3 + +#define Natts_pg_foreign_table 3 + + +#endif /* PG_FOREIGN_TABLE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_index.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_index.h new file mode 100644 index 0000000000000000000000000000000000000000..3462572eb55bbcfb9a6c4fad8d37c50322a4f519 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_index.h @@ -0,0 +1,92 @@ +/*------------------------------------------------------------------------- + * + * pg_index.h + * definition of the "index" system catalog (pg_index) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_index.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INDEX_H +#define PG_INDEX_H + +#include "catalog/genbki.h" +#include "catalog/pg_index_d.h" + +/* ---------------- + * pg_index definition. cpp turns this into + * typedef struct FormData_pg_index. + * ---------------- + */ +CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO +{ + Oid indexrelid BKI_LOOKUP(pg_class); /* OID of the index */ + Oid indrelid BKI_LOOKUP(pg_class); /* OID of the relation it + * indexes */ + int16 indnatts; /* total number of columns in index */ + int16 indnkeyatts; /* number of key columns in index */ + bool indisunique; /* is this a unique index? */ + bool indnullsnotdistinct; /* null treatment in unique index */ + bool indisprimary; /* is this index for primary key? */ + bool indisexclusion; /* is this index for exclusion constraint? */ + bool indimmediate; /* is uniqueness enforced immediately? */ + bool indisclustered; /* is this the index last clustered by? */ + bool indisvalid; /* is this index valid for use by queries? */ + bool indcheckxmin; /* must we wait for xmin to be old? */ + bool indisready; /* is this index ready for inserts? */ + bool indislive; /* is this index alive at all? */ + bool indisreplident; /* is this index the identity for replication? */ + + /* variable-length fields start here, but we allow direct access to indkey */ + int2vector indkey BKI_FORCE_NOT_NULL; /* column numbers of indexed cols, + * or 0 */ + +#ifdef CATALOG_VARLEN + oidvector indcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* collation identifiers */ + oidvector indclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* opclass identifiers */ + int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags + * (AM-specific meanings) */ + pg_node_tree indexprs; /* expression trees for index attributes that + * are not simple column references; one for + * each zero entry in indkey[] */ + pg_node_tree indpred; /* expression tree for predicate, if a partial + * index; else NULL */ +#endif +} FormData_pg_index; + +/* ---------------- + * Form_pg_index corresponds to a pointer to a tuple with + * the format of pg_index relation. + * ---------------- + */ +typedef FormData_pg_index *Form_pg_index; + +DECLARE_INDEX(pg_index_indrelid_index, 2678, IndexIndrelidIndexId, pg_index, btree(indrelid oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, IndexRelidIndexId, pg_index, btree(indexrelid oid_ops)); + +MAKE_SYSCACHE(INDEXRELID, pg_index_indexrelid_index, 64); + +/* indkey can contain zero (InvalidAttrNumber) to represent expressions */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((indrelid, indkey), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Index AMs that support ordered scans must support these two indoption + * bits. Otherwise, the content of the per-column indoption fields is + * open for future definition. + */ +#define INDOPTION_DESC 0x0001 /* values are in reverse order */ +#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_INDEX_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_index_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_index_d.h new file mode 100644 index 0000000000000000000000000000000000000000..cc0e6bd0d502dd32d20ecaa992ae886f517bea9c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_index_d.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * pg_index_d.h + * Macro definitions for pg_index + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INDEX_D_H +#define PG_INDEX_D_H + +#define IndexRelationId 2610 +#define IndexIndrelidIndexId 2678 +#define IndexRelidIndexId 2679 + +#define Anum_pg_index_indexrelid 1 +#define Anum_pg_index_indrelid 2 +#define Anum_pg_index_indnatts 3 +#define Anum_pg_index_indnkeyatts 4 +#define Anum_pg_index_indisunique 5 +#define Anum_pg_index_indnullsnotdistinct 6 +#define Anum_pg_index_indisprimary 7 +#define Anum_pg_index_indisexclusion 8 +#define Anum_pg_index_indimmediate 9 +#define Anum_pg_index_indisclustered 10 +#define Anum_pg_index_indisvalid 11 +#define Anum_pg_index_indcheckxmin 12 +#define Anum_pg_index_indisready 13 +#define Anum_pg_index_indislive 14 +#define Anum_pg_index_indisreplident 15 +#define Anum_pg_index_indkey 16 +#define Anum_pg_index_indcollation 17 +#define Anum_pg_index_indclass 18 +#define Anum_pg_index_indoption 19 +#define Anum_pg_index_indexprs 20 +#define Anum_pg_index_indpred 21 + +#define Natts_pg_index 21 + + +/* + * Index AMs that support ordered scans must support these two indoption + * bits. Otherwise, the content of the per-column indoption fields is + * open for future definition. + */ +#define INDOPTION_DESC 0x0001 /* values are in reverse order */ +#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */ + + +#endif /* PG_INDEX_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits.h new file mode 100644 index 0000000000000000000000000000000000000000..b3da78c24bd6b428ecb95e30343104c38cc94c18 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_inherits.h + * definition of the "inherits" system catalog (pg_inherits) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_inherits.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITS_H +#define PG_INHERITS_H + +#include "catalog/genbki.h" +#include "catalog/pg_inherits_d.h" + +#include "nodes/pg_list.h" +#include "storage/lock.h" + +/* ---------------- + * pg_inherits definition. cpp turns this into + * typedef struct FormData_pg_inherits + * ---------------- + */ +CATALOG(pg_inherits,2611,InheritsRelationId) +{ + Oid inhrelid BKI_LOOKUP(pg_class); + Oid inhparent BKI_LOOKUP(pg_class); + int32 inhseqno; + bool inhdetachpending; +} FormData_pg_inherits; + +/* ---------------- + * Form_pg_inherits corresponds to a pointer to a tuple with + * the format of pg_inherits relation. + * ---------------- + */ +typedef FormData_pg_inherits *Form_pg_inherits; + +DECLARE_UNIQUE_INDEX_PKEY(pg_inherits_relid_seqno_index, 2680, InheritsRelidSeqnoIndexId, pg_inherits, btree(inhrelid oid_ops, inhseqno int4_ops)); +DECLARE_INDEX(pg_inherits_parent_index, 2187, InheritsParentIndexId, pg_inherits, btree(inhparent oid_ops)); + + +extern List *find_inheritance_children(Oid parentrelId, LOCKMODE lockmode); +extern List *find_inheritance_children_extended(Oid parentrelId, bool omit_detached, + LOCKMODE lockmode, bool *detached_exist, TransactionId *detached_xmin); + +extern List *find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, + List **numparents); +extern bool has_subclass(Oid relationId); +extern bool has_superclass(Oid relationId); +extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); +extern void StoreSingleInheritance(Oid relationId, Oid parentOid, + int32 seqNumber); +extern bool DeleteInheritsTuple(Oid inhrelid, Oid inhparent, + bool expect_detach_pending, + const char *childname); +extern bool PartitionHasPendingDetach(Oid partoid); + +#endif /* PG_INHERITS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits_d.h new file mode 100644 index 0000000000000000000000000000000000000000..6d2e4e63c2aace9b0cfaa261cfc9638ed042d2b5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_inherits_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_inherits_d.h + * Macro definitions for pg_inherits + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITS_D_H +#define PG_INHERITS_D_H + +#define InheritsRelationId 2611 +#define InheritsRelidSeqnoIndexId 2680 +#define InheritsParentIndexId 2187 + +#define Anum_pg_inherits_inhrelid 1 +#define Anum_pg_inherits_inhparent 2 +#define Anum_pg_inherits_inhseqno 3 +#define Anum_pg_inherits_inhdetachpending 4 + +#define Natts_pg_inherits 4 + + +#endif /* PG_INHERITS_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd5d0812b7c58cd0cb727efca72d8e2f25a3a39 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------------------- + * + * pg_init_privs.h + * definition of the "initial privileges" system catalog (pg_init_privs) + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a function is identified by the OID of its pg_proc row + * plus the pg_class OID of table pg_proc. This allows unique identification + * of objects without assuming that OIDs are unique across tables. + * + * Since attributes don't have OIDs of their own, we identify an attribute + * privilege by the objoid+classoid of its parent table, plus an "objsubid" + * giving the attribute column number. "objsubid" must be zero in a privilege + * for a table itself, so that it is distinct from any column privilege. + * Currently, objsubid is unused and zero for all other kinds of objects. + * + * Because the contents of this table depend on what is done with the other + * objects in the system (and, in particular, may change due to changes in + * system_views.sql), there is no pg_init_privs.dat file. The initial contents + * are loaded near the end of initdb. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_init_privs.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INIT_PRIVS_H +#define PG_INIT_PRIVS_H + +#include "catalog/genbki.h" +#include "catalog/pg_init_privs_d.h" + +/* ---------------- + * pg_init_privs definition. cpp turns this into + * typedef struct FormData_pg_init_privs + * ---------------- + */ +CATALOG(pg_init_privs,3394,InitPrivsRelationId) +{ + Oid objoid; /* OID of object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + int32 objsubid; /* column number, or 0 if not used */ + char privtype; /* from initdb or extension? */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on object */ +#endif +} FormData_pg_init_privs; + +/* ---------------- + * Form_pg_init_privs corresponds to a pointer to a tuple with + * the format of pg_init_privs relation. + * ---------------- + */ +typedef FormData_pg_init_privs * Form_pg_init_privs; + +DECLARE_TOAST(pg_init_privs, 4155, 4156); + +DECLARE_UNIQUE_INDEX_PKEY(pg_init_privs_o_c_o_index, 3395, InitPrivsObjIndexId, pg_init_privs, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); + +/* + * It is important to know if the initial privileges are from initdb or from an + * extension. This enum is used to provide that differentiation and the two + * places which populate this table (initdb and during CREATE EXTENSION, see + * recordExtensionInitPriv()) know to use the correct values. + */ + +typedef enum InitPrivsType +{ + INITPRIVS_INITDB = 'i', + INITPRIVS_EXTENSION = 'e', +} InitPrivsType; + +#endif /* PG_INIT_PRIVS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs_d.h new file mode 100644 index 0000000000000000000000000000000000000000..8d58963e6741f7c258ce02f3e6b405de8c5baf3c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_init_privs_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_init_privs_d.h + * Macro definitions for pg_init_privs + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INIT_PRIVS_D_H +#define PG_INIT_PRIVS_D_H + +#define InitPrivsRelationId 3394 +#define InitPrivsObjIndexId 3395 + +#define Anum_pg_init_privs_objoid 1 +#define Anum_pg_init_privs_classoid 2 +#define Anum_pg_init_privs_objsubid 3 +#define Anum_pg_init_privs_privtype 4 +#define Anum_pg_init_privs_initprivs 5 + +#define Natts_pg_init_privs 5 + + +#endif /* PG_INIT_PRIVS_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_language.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_language.h new file mode 100644 index 0000000000000000000000000000000000000000..7256908a95c8aa17bc7ca46d68dd76dee4ffbd81 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_language.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_language.h + * definition of the "language" system catalog (pg_language) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_language.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LANGUAGE_H +#define PG_LANGUAGE_H + +#include "catalog/genbki.h" +#include "catalog/pg_language_d.h" + +/* ---------------- + * pg_language definition. cpp turns this into + * typedef struct FormData_pg_language + * ---------------- + */ +CATALOG(pg_language,2612,LanguageRelationId) +{ + Oid oid; /* oid */ + + /* Language name */ + NameData lanname; + + /* Language's owner */ + Oid lanowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* Is a procedural language */ + bool lanispl BKI_DEFAULT(f); + + /* PL is trusted */ + bool lanpltrusted BKI_DEFAULT(f); + + /* Call handler, if it's a PL */ + Oid lanplcallfoid BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* Optional anonymous-block handler function */ + Oid laninline BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* Optional validation function */ + Oid lanvalidator BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* Access privileges */ + aclitem lanacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_language; + +/* ---------------- + * Form_pg_language corresponds to a pointer to a tuple with + * the format of pg_language relation. + * ---------------- + */ +typedef FormData_pg_language *Form_pg_language; + +DECLARE_TOAST(pg_language, 4157, 4158); + +DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, LanguageNameIndexId, pg_language, btree(lanname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_language_oid_index, 2682, LanguageOidIndexId, pg_language, btree(oid oid_ops)); + +MAKE_SYSCACHE(LANGNAME, pg_language_name_index, 4); +MAKE_SYSCACHE(LANGOID, pg_language_oid_index, 4); + +#endif /* PG_LANGUAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_language_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_language_d.h new file mode 100644 index 0000000000000000000000000000000000000000..8ab48b0574b103141228d4cacdd06223576100cf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_language_d.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_language_d.h + * Macro definitions for pg_language + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LANGUAGE_D_H +#define PG_LANGUAGE_D_H + +#define LanguageRelationId 2612 +#define LanguageNameIndexId 2681 +#define LanguageOidIndexId 2682 + +#define Anum_pg_language_oid 1 +#define Anum_pg_language_lanname 2 +#define Anum_pg_language_lanowner 3 +#define Anum_pg_language_lanispl 4 +#define Anum_pg_language_lanpltrusted 5 +#define Anum_pg_language_lanplcallfoid 6 +#define Anum_pg_language_laninline 7 +#define Anum_pg_language_lanvalidator 8 +#define Anum_pg_language_lanacl 9 + +#define Natts_pg_language 9 + +#define INTERNALlanguageId 12 +#define ClanguageId 13 +#define SQLlanguageId 14 + +#endif /* PG_LANGUAGE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject.h new file mode 100644 index 0000000000000000000000000000000000000000..b40c90b749db3a2d75cc2109f86be879f8d9fcf5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject.h + * definition of the "large object" system catalog (pg_largeobject) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_largeobject.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_H +#define PG_LARGEOBJECT_H + +#include "catalog/genbki.h" +#include "catalog/pg_largeobject_d.h" + +/* ---------------- + * pg_largeobject definition. cpp turns this into + * typedef struct FormData_pg_largeobject + * ---------------- + */ +CATALOG(pg_largeobject,2613,LargeObjectRelationId) +{ + Oid loid BKI_LOOKUP(pg_largeobject_metadata); /* Identifier of large + * object */ + int32 pageno; /* Page number (starting from 0) */ + + /* data has variable length, but we allow direct access; see inv_api.c */ + bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be + * zero-length) */ +} FormData_pg_largeobject; + +/* ---------------- + * Form_pg_largeobject corresponds to a pointer to a tuple with + * the format of pg_largeobject relation. + * ---------------- + */ +typedef FormData_pg_largeobject *Form_pg_largeobject; + +DECLARE_UNIQUE_INDEX_PKEY(pg_largeobject_loid_pn_index, 2683, LargeObjectLOidPNIndexId, pg_largeobject, btree(loid oid_ops, pageno int4_ops)); + +extern Oid LargeObjectCreate(Oid loid); +extern void LargeObjectDrop(Oid loid); +extern bool LargeObjectExists(Oid loid); + +#endif /* PG_LARGEOBJECT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_d.h new file mode 100644 index 0000000000000000000000000000000000000000..9008b4cfd54c64b2da6abbb421f1c0d7ed6d2132 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_d.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_d.h + * Macro definitions for pg_largeobject + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_D_H +#define PG_LARGEOBJECT_D_H + +#define LargeObjectRelationId 2613 +#define LargeObjectLOidPNIndexId 2683 + +#define Anum_pg_largeobject_loid 1 +#define Anum_pg_largeobject_pageno 2 +#define Anum_pg_largeobject_data 3 + +#define Natts_pg_largeobject 3 + + +#endif /* PG_LARGEOBJECT_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata.h new file mode 100644 index 0000000000000000000000000000000000000000..8a8274421870d5229316c33858d4774d96a5bda6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_metadata.h + * definition of the "large object metadata" system catalog + * (pg_largeobject_metadata) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_largeobject_metadata.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_METADATA_H +#define PG_LARGEOBJECT_METADATA_H + +#include "catalog/genbki.h" +#include "catalog/pg_largeobject_metadata_d.h" + +/* ---------------- + * pg_largeobject_metadata definition. cpp turns this into + * typedef struct FormData_pg_largeobject_metadata + * ---------------- + */ +CATALOG(pg_largeobject_metadata,2995,LargeObjectMetadataRelationId) +{ + Oid oid; /* oid */ + + Oid lomowner BKI_LOOKUP(pg_authid); /* OID of the largeobject + * owner */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem lomacl[1]; /* access permissions */ +#endif +} FormData_pg_largeobject_metadata; + +/* ---------------- + * Form_pg_largeobject_metadata corresponds to a pointer to a tuple + * with the format of pg_largeobject_metadata relation. + * ---------------- + */ +typedef FormData_pg_largeobject_metadata *Form_pg_largeobject_metadata; + +DECLARE_UNIQUE_INDEX_PKEY(pg_largeobject_metadata_oid_index, 2996, LargeObjectMetadataOidIndexId, pg_largeobject_metadata, btree(oid oid_ops)); + +#endif /* PG_LARGEOBJECT_METADATA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata_d.h new file mode 100644 index 0000000000000000000000000000000000000000..3d41b527cb83be506d248b5d92bb2843e0362dc6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_largeobject_metadata_d.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * pg_largeobject_metadata_d.h + * Macro definitions for pg_largeobject_metadata + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LARGEOBJECT_METADATA_D_H +#define PG_LARGEOBJECT_METADATA_D_H + +#define LargeObjectMetadataRelationId 2995 +#define LargeObjectMetadataOidIndexId 2996 + +#define Anum_pg_largeobject_metadata_oid 1 +#define Anum_pg_largeobject_metadata_lomowner 2 +#define Anum_pg_largeobject_metadata_lomacl 3 + +#define Natts_pg_largeobject_metadata 3 + + +#endif /* PG_LARGEOBJECT_METADATA_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace.h new file mode 100644 index 0000000000000000000000000000000000000000..e101808ae1e0b621b93ab495711a8f38f9f0493d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_namespace.h + * definition of the "namespace" system catalog (pg_namespace) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_namespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_NAMESPACE_H +#define PG_NAMESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_namespace_d.h" +#include "utils/acl.h" + +/* ---------------------------------------------------------------- + * pg_namespace definition. + * + * cpp turns this into typedef struct FormData_pg_namespace + * + * nspname name of the namespace + * nspowner owner (creator) of the namespace + * nspacl access privilege list + * ---------------------------------------------------------------- + */ +CATALOG(pg_namespace,2615,NamespaceRelationId) +{ + Oid oid; /* oid */ + + NameData nspname; + Oid nspowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem nspacl[1]; +#endif +} FormData_pg_namespace; + +/* ---------------- + * Form_pg_namespace corresponds to a pointer to a tuple with + * the format of pg_namespace relation. + * ---------------- + */ +typedef FormData_pg_namespace *Form_pg_namespace; + +DECLARE_TOAST(pg_namespace, 4163, 4164); + +DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, NamespaceNameIndexId, pg_namespace, btree(nspname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_namespace_oid_index, 2685, NamespaceOidIndexId, pg_namespace, btree(oid oid_ops)); + +MAKE_SYSCACHE(NAMESPACENAME, pg_namespace_nspname_index, 4); +MAKE_SYSCACHE(NAMESPACEOID, pg_namespace_oid_index, 16); + +/* + * prototypes for functions in pg_namespace.c + */ +extern Oid NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp); + +#endif /* PG_NAMESPACE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace_d.h new file mode 100644 index 0000000000000000000000000000000000000000..13f248130f16d272d8cde6a25ac3d66a2a78007f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_namespace_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_namespace_d.h + * Macro definitions for pg_namespace + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_NAMESPACE_D_H +#define PG_NAMESPACE_D_H + +#define NamespaceRelationId 2615 +#define NamespaceNameIndexId 2684 +#define NamespaceOidIndexId 2685 + +#define Anum_pg_namespace_oid 1 +#define Anum_pg_namespace_nspname 2 +#define Anum_pg_namespace_nspowner 3 +#define Anum_pg_namespace_nspacl 4 + +#define Natts_pg_namespace 4 + +#define PG_CATALOG_NAMESPACE 11 +#define PG_TOAST_NAMESPACE 99 +#define PG_PUBLIC_NAMESPACE 2200 + +#endif /* PG_NAMESPACE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass.h new file mode 100644 index 0000000000000000000000000000000000000000..05867d08f9312c01f038e6914d5abb4c5edb2d00 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * pg_opclass.h + * definition of the "operator class" system catalog (pg_opclass) + * + * The primary key for this table is --- + * that is, there is a row for each valid combination of opclass name and + * index access method type. This row specifies the expected input data type + * for the opclass (the type of the heap column, or the expression output type + * in the case of an index expression). Note that types binary-coercible to + * the specified type will be accepted too. + * + * For a given pair, there can be at most one row that + * has opcdefault = true; this row is the default opclass for such data in + * such an index. (This is not currently enforced by an index, because we + * don't support partial indexes on system catalogs.) + * + * Normally opckeytype = InvalidOid (zero), indicating that the data stored + * in the index is the same as the data in the indexed column. If opckeytype + * is nonzero then it indicates that a conversion step is needed to produce + * the stored index data, which will be of type opckeytype (which might be + * the same or different from the input datatype). Performing such a + * conversion is the responsibility of the index access method --- not all + * AMs support this. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_opclass.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPCLASS_H +#define PG_OPCLASS_H + +#include "catalog/genbki.h" +#include "catalog/pg_opclass_d.h" + +/* ---------------- + * pg_opclass definition. cpp turns this into + * typedef struct FormData_pg_opclass + * ---------------- + */ +CATALOG(pg_opclass,2616,OperatorClassRelationId) +{ + Oid oid; /* oid */ + + /* index access method opclass is for */ + Oid opcmethod BKI_LOOKUP(pg_am); + + /* name of this opclass */ + NameData opcname; + + /* namespace of this opclass */ + Oid opcnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* opclass owner */ + Oid opcowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* containing operator family */ + Oid opcfamily BKI_LOOKUP(pg_opfamily); + + /* type of data indexed by opclass */ + Oid opcintype BKI_LOOKUP(pg_type); + + /* T if opclass is default for opcintype */ + bool opcdefault BKI_DEFAULT(t); + + /* type of data in index, or InvalidOid if same as input column type */ + Oid opckeytype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); +} FormData_pg_opclass; + +/* ---------------- + * Form_pg_opclass corresponds to a pointer to a tuple with + * the format of pg_opclass relation. + * ---------------- + */ +typedef FormData_pg_opclass *Form_pg_opclass; + +DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, OpclassAmNameNspIndexId, pg_opclass, btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_opclass_oid_index, 2687, OpclassOidIndexId, pg_opclass, btree(oid oid_ops)); + +MAKE_SYSCACHE(CLAAMNAMENSP, pg_opclass_am_name_nsp_index, 8); +MAKE_SYSCACHE(CLAOID, pg_opclass_oid_index, 8); + +#endif /* PG_OPCLASS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass_d.h new file mode 100644 index 0000000000000000000000000000000000000000..706d76687cb45ac0fb78c263c1042af44a24cb0b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_opclass_d.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_opclass_d.h + * Macro definitions for pg_opclass + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPCLASS_D_H +#define PG_OPCLASS_D_H + +#define OperatorClassRelationId 2616 +#define OpclassAmNameNspIndexId 2686 +#define OpclassOidIndexId 2687 + +#define Anum_pg_opclass_oid 1 +#define Anum_pg_opclass_opcmethod 2 +#define Anum_pg_opclass_opcname 3 +#define Anum_pg_opclass_opcnamespace 4 +#define Anum_pg_opclass_opcowner 5 +#define Anum_pg_opclass_opcfamily 6 +#define Anum_pg_opclass_opcintype 7 +#define Anum_pg_opclass_opcdefault 8 +#define Anum_pg_opclass_opckeytype 9 + +#define Natts_pg_opclass 9 + +#define DATE_BTREE_OPS_OID 3122 +#define FLOAT8_BTREE_OPS_OID 3123 +#define INT2_BTREE_OPS_OID 1979 +#define INT4_BTREE_OPS_OID 1978 +#define INT8_BTREE_OPS_OID 3124 +#define NUMERIC_BTREE_OPS_OID 3125 +#define OID_BTREE_OPS_OID 1981 +#define TEXT_BTREE_OPS_OID 3126 +#define TIMESTAMPTZ_BTREE_OPS_OID 3127 +#define TIMESTAMP_BTREE_OPS_OID 3128 +#define TEXT_BTREE_PATTERN_OPS_OID 4217 +#define VARCHAR_BTREE_PATTERN_OPS_OID 4218 +#define BPCHAR_BTREE_PATTERN_OPS_OID 4219 + +#endif /* PG_OPCLASS_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_operator.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_operator.h new file mode 100644 index 0000000000000000000000000000000000000000..3ff1acc37ef9e9216db8e3e06019003baa0b6610 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_operator.h @@ -0,0 +1,124 @@ +/*------------------------------------------------------------------------- + * + * pg_operator.h + * definition of the "operator" system catalog (pg_operator) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_operator.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPERATOR_H +#define PG_OPERATOR_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_operator_d.h" +#include "nodes/pg_list.h" + +/* ---------------- + * pg_operator definition. cpp turns this into + * typedef struct FormData_pg_operator + * ---------------- + */ +CATALOG(pg_operator,2617,OperatorRelationId) +{ + Oid oid; /* oid */ + + /* name of operator */ + NameData oprname; + + /* OID of namespace containing this oper */ + Oid oprnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* operator owner */ + Oid oprowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* 'l' for prefix or 'b' for infix */ + char oprkind BKI_DEFAULT(b); + + /* can be used in merge join? */ + bool oprcanmerge BKI_DEFAULT(f); + + /* can be used in hash join? */ + bool oprcanhash BKI_DEFAULT(f); + + /* left arg type, or 0 if prefix operator */ + Oid oprleft BKI_LOOKUP_OPT(pg_type); + + /* right arg type */ + Oid oprright BKI_LOOKUP(pg_type); + + /* result datatype; can be 0 in a "shell" operator */ + Oid oprresult BKI_LOOKUP_OPT(pg_type); + + /* OID of commutator oper, or 0 if none */ + Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* OID of negator oper, or 0 if none */ + Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator); + + /* OID of underlying function; can be 0 in a "shell" operator */ + regproc oprcode BKI_LOOKUP_OPT(pg_proc); + + /* OID of restriction estimator, or 0 */ + regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* OID of join estimator, or 0 */ + regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_operator; + +/* ---------------- + * Form_pg_operator corresponds to a pointer to a tuple with + * the format of pg_operator relation. + * ---------------- + */ +typedef FormData_pg_operator *Form_pg_operator; + +DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index, 2688, OperatorOidIndexId, pg_operator, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, OperatorNameNspIndexId, pg_operator, btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops)); + +MAKE_SYSCACHE(OPEROID, pg_operator_oid_index, 32); +MAKE_SYSCACHE(OPERNAMENSP, pg_operator_oprname_l_r_n_index, 256); + +extern Oid OperatorLookup(List *operatorName, + Oid leftObjectId, + Oid rightObjectId, + bool *defined); + +extern ObjectAddress OperatorCreate(const char *operatorName, + Oid operatorNamespace, + Oid leftTypeId, + Oid rightTypeId, + Oid procedureId, + List *commutatorName, + List *negatorName, + Oid restrictionId, + Oid joinId, + bool canMerge, + bool canHash); + +extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, + bool makeExtensionDep, + bool isUpdate); + +extern void OperatorValidateParams(Oid leftTypeId, + Oid rightTypeId, + Oid operResultType, + bool hasCommutator, + bool hasNegator, + bool hasRestrictionSelectivity, + bool hasJoinSelectivity, + bool canMerge, + bool canHash); + +extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete); + +#endif /* PG_OPERATOR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_operator_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_operator_d.h new file mode 100644 index 0000000000000000000000000000000000000000..44e876cb4ba578fbb39adba841512fe4856b6301 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_operator_d.h @@ -0,0 +1,142 @@ +/*------------------------------------------------------------------------- + * + * pg_operator_d.h + * Macro definitions for pg_operator + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPERATOR_D_H +#define PG_OPERATOR_D_H + +#define OperatorRelationId 2617 +#define OperatorOidIndexId 2688 +#define OperatorNameNspIndexId 2689 + +#define Anum_pg_operator_oid 1 +#define Anum_pg_operator_oprname 2 +#define Anum_pg_operator_oprnamespace 3 +#define Anum_pg_operator_oprowner 4 +#define Anum_pg_operator_oprkind 5 +#define Anum_pg_operator_oprcanmerge 6 +#define Anum_pg_operator_oprcanhash 7 +#define Anum_pg_operator_oprleft 8 +#define Anum_pg_operator_oprright 9 +#define Anum_pg_operator_oprresult 10 +#define Anum_pg_operator_oprcom 11 +#define Anum_pg_operator_oprnegate 12 +#define Anum_pg_operator_oprcode 13 +#define Anum_pg_operator_oprrest 14 +#define Anum_pg_operator_oprjoin 15 + +#define Natts_pg_operator 15 + +#define BooleanNotEqualOperator 85 +#define BooleanEqualOperator 91 +#define Int4EqualOperator 96 +#define Int4LessOperator 97 +#define TextEqualOperator 98 +#define TextPrefixOperator 3877 +#define NameEqualTextOperator 254 +#define NameLessTextOperator 255 +#define NameGreaterEqualTextOperator 257 +#define TIDEqualOperator 387 +#define TIDLessOperator 2799 +#define TIDGreaterOperator 2800 +#define TIDLessEqOperator 2801 +#define TIDGreaterEqOperator 2802 +#define Int8LessOperator 412 +#define OID_NAME_REGEXEQ_OP 639 +#define OID_TEXT_REGEXEQ_OP 641 +#define TextLessOperator 664 +#define TextGreaterEqualOperator 667 +#define Float8LessOperator 672 +#define BpcharEqualOperator 1054 +#define OID_BPCHAR_REGEXEQ_OP 1055 +#define BpcharLessOperator 1058 +#define BpcharGreaterEqualOperator 1061 +#define ARRAY_EQ_OP 1070 +#define ARRAY_LT_OP 1072 +#define ARRAY_GT_OP 1073 +#define OID_NAME_LIKE_OP 1207 +#define OID_TEXT_LIKE_OP 1209 +#define OID_BPCHAR_LIKE_OP 1211 +#define OID_NAME_ICREGEXEQ_OP 1226 +#define OID_TEXT_ICREGEXEQ_OP 1228 +#define OID_BPCHAR_ICREGEXEQ_OP 1234 +#define OID_INET_SUB_OP 931 +#define OID_INET_SUBEQ_OP 932 +#define OID_INET_SUP_OP 933 +#define OID_INET_SUPEQ_OP 934 +#define OID_INET_OVERLAP_OP 3552 +#define OID_NAME_ICLIKE_OP 1625 +#define OID_TEXT_ICLIKE_OP 1627 +#define OID_BPCHAR_ICLIKE_OP 1629 +#define ByteaEqualOperator 1955 +#define ByteaLessOperator 1957 +#define ByteaGreaterEqualOperator 1960 +#define OID_BYTEA_LIKE_OP 2016 +#define TextPatternLessOperator 2314 +#define TextPatternGreaterEqualOperator 2317 +#define BpcharPatternLessOperator 2326 +#define BpcharPatternGreaterEqualOperator 2329 +#define OID_ARRAY_OVERLAP_OP 2750 +#define OID_ARRAY_CONTAINS_OP 2751 +#define OID_ARRAY_CONTAINED_OP 2752 +#define RECORD_EQ_OP 2988 +#define RECORD_LT_OP 2990 +#define RECORD_GT_OP 2991 +#define OID_RANGE_LESS_OP 3884 +#define OID_RANGE_LESS_EQUAL_OP 3885 +#define OID_RANGE_GREATER_EQUAL_OP 3886 +#define OID_RANGE_GREATER_OP 3887 +#define OID_RANGE_OVERLAP_OP 3888 +#define OID_RANGE_CONTAINS_ELEM_OP 3889 +#define OID_RANGE_CONTAINS_OP 3890 +#define OID_RANGE_ELEM_CONTAINED_OP 3891 +#define OID_RANGE_CONTAINED_OP 3892 +#define OID_RANGE_LEFT_OP 3893 +#define OID_RANGE_RIGHT_OP 3894 +#define OID_RANGE_OVERLAPS_LEFT_OP 3895 +#define OID_RANGE_OVERLAPS_RIGHT_OP 3896 +#define OID_MULTIRANGE_LESS_OP 2862 +#define OID_MULTIRANGE_LESS_EQUAL_OP 2863 +#define OID_MULTIRANGE_GREATER_EQUAL_OP 2864 +#define OID_MULTIRANGE_GREATER_OP 2865 +#define OID_RANGE_OVERLAPS_MULTIRANGE_OP 2866 +#define OID_MULTIRANGE_OVERLAPS_RANGE_OP 2867 +#define OID_MULTIRANGE_OVERLAPS_MULTIRANGE_OP 2868 +#define OID_MULTIRANGE_CONTAINS_ELEM_OP 2869 +#define OID_MULTIRANGE_CONTAINS_RANGE_OP 2870 +#define OID_MULTIRANGE_CONTAINS_MULTIRANGE_OP 2871 +#define OID_MULTIRANGE_ELEM_CONTAINED_OP 2872 +#define OID_MULTIRANGE_RANGE_CONTAINED_OP 2873 +#define OID_MULTIRANGE_MULTIRANGE_CONTAINED_OP 2874 +#define OID_RANGE_CONTAINS_MULTIRANGE_OP 4539 +#define OID_RANGE_MULTIRANGE_CONTAINED_OP 4540 +#define OID_RANGE_OVERLAPS_LEFT_MULTIRANGE_OP 2875 +#define OID_MULTIRANGE_OVERLAPS_LEFT_RANGE_OP 2876 +#define OID_MULTIRANGE_OVERLAPS_LEFT_MULTIRANGE_OP 2877 +#define OID_RANGE_OVERLAPS_RIGHT_MULTIRANGE_OP 3585 +#define OID_MULTIRANGE_OVERLAPS_RIGHT_RANGE_OP 4035 +#define OID_MULTIRANGE_OVERLAPS_RIGHT_MULTIRANGE_OP 4142 +#define OID_RANGE_ADJACENT_MULTIRANGE_OP 4179 +#define OID_MULTIRANGE_ADJACENT_RANGE_OP 4180 +#define OID_MULTIRANGE_ADJACENT_MULTIRANGE_OP 4198 +#define OID_RANGE_LEFT_MULTIRANGE_OP 4395 +#define OID_MULTIRANGE_LEFT_RANGE_OP 4396 +#define OID_MULTIRANGE_LEFT_MULTIRANGE_OP 4397 +#define OID_RANGE_RIGHT_MULTIRANGE_OP 4398 +#define OID_MULTIRANGE_RIGHT_RANGE_OP 4399 +#define OID_MULTIRANGE_RIGHT_MULTIRANGE_OP 4400 + +#endif /* PG_OPERATOR_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily.h new file mode 100644 index 0000000000000000000000000000000000000000..52f9c4acf976bdfb345a4766234d8e6a4c4dc22c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * pg_opfamily.h + * definition of the "operator family" system catalog (pg_opfamily) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_opfamily.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPFAMILY_H +#define PG_OPFAMILY_H + +#include "catalog/genbki.h" +#include "catalog/pg_opfamily_d.h" + +/* ---------------- + * pg_opfamily definition. cpp turns this into + * typedef struct FormData_pg_opfamily + * ---------------- + */ +CATALOG(pg_opfamily,2753,OperatorFamilyRelationId) +{ + Oid oid; /* oid */ + + /* index access method opfamily is for */ + Oid opfmethod BKI_LOOKUP(pg_am); + + /* name of this opfamily */ + NameData opfname; + + /* namespace of this opfamily */ + Oid opfnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* opfamily owner */ + Oid opfowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); +} FormData_pg_opfamily; + +/* ---------------- + * Form_pg_opfamily corresponds to a pointer to a tuple with + * the format of pg_opfamily relation. + * ---------------- + */ +typedef FormData_pg_opfamily *Form_pg_opfamily; + +DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, OpfamilyAmNameNspIndexId, pg_opfamily, btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_opfamily_oid_index, 2755, OpfamilyOidIndexId, pg_opfamily, btree(oid oid_ops)); + +MAKE_SYSCACHE(OPFAMILYAMNAMENSP, pg_opfamily_am_name_nsp_index, 8); +MAKE_SYSCACHE(OPFAMILYOID, pg_opfamily_oid_index, 8); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* This does not account for non-core opfamilies that might accept boolean */ +#define IsBuiltinBooleanOpfamily(opfamily) \ + ((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID) + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_OPFAMILY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily_d.h new file mode 100644 index 0000000000000000000000000000000000000000..9b9c723e41bf76e395ce8ec54fe1fd23bbe19167 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_opfamily_d.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_opfamily_d.h + * Macro definitions for pg_opfamily + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPFAMILY_D_H +#define PG_OPFAMILY_D_H + +#define OperatorFamilyRelationId 2753 +#define OpfamilyAmNameNspIndexId 2754 +#define OpfamilyOidIndexId 2755 + +#define Anum_pg_opfamily_oid 1 +#define Anum_pg_opfamily_opfmethod 2 +#define Anum_pg_opfamily_opfname 3 +#define Anum_pg_opfamily_opfnamespace 4 +#define Anum_pg_opfamily_opfowner 5 + +#define Natts_pg_opfamily 5 + + +/* This does not account for non-core opfamilies that might accept boolean */ +#define IsBuiltinBooleanOpfamily(opfamily) \ + ((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID) + +#define BOOL_BTREE_FAM_OID 424 +#define BPCHAR_BTREE_FAM_OID 426 +#define BYTEA_BTREE_FAM_OID 428 +#define NETWORK_BTREE_FAM_OID 1974 +#define INTEGER_BTREE_FAM_OID 1976 +#define INTERVAL_BTREE_FAM_OID 1982 +#define OID_BTREE_FAM_OID 1989 +#define TEXT_BTREE_FAM_OID 1994 +#define TEXT_PATTERN_BTREE_FAM_OID 2095 +#define BPCHAR_PATTERN_BTREE_FAM_OID 2097 +#define BOOL_HASH_FAM_OID 2222 +#define TEXT_SPGIST_FAM_OID 4017 + +#endif /* PG_OPFAMILY_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl.h new file mode 100644 index 0000000000000000000000000000000000000000..8f6b6f92b3e6ea2b18c33331525fd006bafa6027 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_parameter_acl.h + * definition of the "configuration parameter ACL" system catalog + * (pg_parameter_acl). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_parameter_acl.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARAMETER_ACL_H +#define PG_PARAMETER_ACL_H + +#include "catalog/genbki.h" +#include "catalog/pg_parameter_acl_d.h" + +/* ---------------- + * pg_parameter_acl definition. cpp turns this into + * typedef struct FormData_pg_parameter_acl + * ---------------- + */ +CATALOG(pg_parameter_acl,6243,ParameterAclRelationId) BKI_SHARED_RELATION +{ + Oid oid; /* oid */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* name of parameter */ + text parname BKI_FORCE_NOT_NULL; + + /* access permissions */ + aclitem paracl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_parameter_acl; + + +/* ---------------- + * Form_pg_parameter_acl corresponds to a pointer to a tuple with + * the format of pg_parameter_acl relation. + * ---------------- + */ +typedef FormData_pg_parameter_acl * Form_pg_parameter_acl; + +DECLARE_TOAST_WITH_MACRO(pg_parameter_acl, 6244, 6245, PgParameterAclToastTable, PgParameterAclToastIndex); + +DECLARE_UNIQUE_INDEX(pg_parameter_acl_parname_index, 6246, ParameterAclParnameIndexId, pg_parameter_acl, btree(parname text_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_parameter_acl_oid_index, 6247, ParameterAclOidIndexId, pg_parameter_acl, btree(oid oid_ops)); + +MAKE_SYSCACHE(PARAMETERACLNAME, pg_parameter_acl_parname_index, 4); +MAKE_SYSCACHE(PARAMETERACLOID, pg_parameter_acl_oid_index, 4); + +extern Oid ParameterAclLookup(const char *parameter, bool missing_ok); +extern Oid ParameterAclCreate(const char *parameter); + +#endif /* PG_PARAMETER_ACL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl_d.h new file mode 100644 index 0000000000000000000000000000000000000000..e1e5cd4faee095af3af0e6c547e93a25b8ab2c03 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_parameter_acl_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_parameter_acl_d.h + * Macro definitions for pg_parameter_acl + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARAMETER_ACL_D_H +#define PG_PARAMETER_ACL_D_H + +#define ParameterAclRelationId 6243 +#define PgParameterAclToastTable 6244 +#define PgParameterAclToastIndex 6245 +#define ParameterAclParnameIndexId 6246 +#define ParameterAclOidIndexId 6247 + +#define Anum_pg_parameter_acl_oid 1 +#define Anum_pg_parameter_acl_parname 2 +#define Anum_pg_parameter_acl_paracl 3 + +#define Natts_pg_parameter_acl 3 + + +#endif /* PG_PARAMETER_ACL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table.h new file mode 100644 index 0000000000000000000000000000000000000000..daf57008b6963d849e52e2fd86a5c2efea567f64 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------------------- + * + * pg_partitioned_table.h + * definition of the "partitioned table" system catalog + * (pg_partitioned_table) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_partitioned_table.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARTITIONED_TABLE_H +#define PG_PARTITIONED_TABLE_H + +#include "catalog/genbki.h" +#include "catalog/pg_partitioned_table_d.h" + +/* ---------------- + * pg_partitioned_table definition. cpp turns this into + * typedef struct FormData_pg_partitioned_table + * ---------------- + */ +CATALOG(pg_partitioned_table,3350,PartitionedRelationId) +{ + Oid partrelid BKI_LOOKUP(pg_class); /* partitioned table oid */ + char partstrat; /* partitioning strategy */ + int16 partnatts; /* number of partition key columns */ + Oid partdefid BKI_LOOKUP_OPT(pg_class); /* default partition oid; + * 0 if there isn't one */ + + /* + * variable-length fields start here, but we allow direct access to + * partattrs via the C struct. That's because the first variable-length + * field of a heap tuple can be reliably accessed using its C struct + * offset, as previous fields are all non-nullable fixed-length fields. + */ + int2vector partattrs BKI_FORCE_NOT_NULL; /* each member of the array is + * the attribute number of a + * partition key column, or 0 + * if the column is actually + * an expression */ + +#ifdef CATALOG_VARLEN + oidvector partclass BKI_LOOKUP(pg_opclass) BKI_FORCE_NOT_NULL; /* operator class to + * compare keys */ + oidvector partcollation BKI_LOOKUP_OPT(pg_collation) BKI_FORCE_NOT_NULL; /* user-specified + * collation for keys */ + pg_node_tree partexprs; /* list of expressions in the partition key; + * one item for each zero entry in partattrs[] */ +#endif +} FormData_pg_partitioned_table; + +/* ---------------- + * Form_pg_partitioned_table corresponds to a pointer to a tuple with + * the format of pg_partitioned_table relation. + * ---------------- + */ +typedef FormData_pg_partitioned_table *Form_pg_partitioned_table; + +DECLARE_TOAST(pg_partitioned_table, 4165, 4166); + +DECLARE_UNIQUE_INDEX_PKEY(pg_partitioned_table_partrelid_index, 3351, PartitionedRelidIndexId, pg_partitioned_table, btree(partrelid oid_ops)); + +MAKE_SYSCACHE(PARTRELID, pg_partitioned_table_partrelid_index, 32); + +/* partattrs can contain zero (InvalidAttrNumber) to represent expressions */ +DECLARE_ARRAY_FOREIGN_KEY_OPT((partrelid, partattrs), pg_attribute, (attrelid, attnum)); + +#endif /* PG_PARTITIONED_TABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table_d.h new file mode 100644 index 0000000000000000000000000000000000000000..aa52304c3ebb961481e08a6b0e5ac5ff1f8dfd08 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_partitioned_table_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_partitioned_table_d.h + * Macro definitions for pg_partitioned_table + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARTITIONED_TABLE_D_H +#define PG_PARTITIONED_TABLE_D_H + +#define PartitionedRelationId 3350 +#define PartitionedRelidIndexId 3351 + +#define Anum_pg_partitioned_table_partrelid 1 +#define Anum_pg_partitioned_table_partstrat 2 +#define Anum_pg_partitioned_table_partnatts 3 +#define Anum_pg_partitioned_table_partdefid 4 +#define Anum_pg_partitioned_table_partattrs 5 +#define Anum_pg_partitioned_table_partclass 6 +#define Anum_pg_partitioned_table_partcollation 7 +#define Anum_pg_partitioned_table_partexprs 8 + +#define Natts_pg_partitioned_table 8 + + +#endif /* PG_PARTITIONED_TABLE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_policy.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_policy.h new file mode 100644 index 0000000000000000000000000000000000000000..05d6398f7b865edda44d128c51a955442d6e8004 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_policy.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_policy.h + * definition of the "policy" system catalog (pg_policy) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_policy.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_POLICY_H +#define PG_POLICY_H + +#include "catalog/genbki.h" +#include "catalog/pg_policy_d.h" + +/* ---------------- + * pg_policy definition. cpp turns this into + * typedef struct FormData_pg_policy + * ---------------- + */ +CATALOG(pg_policy,3256,PolicyRelationId) +{ + Oid oid; /* oid */ + NameData polname; /* Policy name. */ + Oid polrelid BKI_LOOKUP(pg_class); /* Oid of the relation with + * policy. */ + char polcmd; /* One of ACL_*_CHR, or '*' for all */ + bool polpermissive; /* restrictive or permissive policy */ + +#ifdef CATALOG_VARLEN + /* Roles to which the policy is applied; zero means PUBLIC */ + Oid polroles[1] BKI_LOOKUP_OPT(pg_authid) BKI_FORCE_NOT_NULL; + pg_node_tree polqual; /* Policy quals. */ + pg_node_tree polwithcheck; /* WITH CHECK quals. */ +#endif +} FormData_pg_policy; + +/* ---------------- + * Form_pg_policy corresponds to a pointer to a row with + * the format of pg_policy relation. + * ---------------- + */ +typedef FormData_pg_policy *Form_pg_policy; + +DECLARE_TOAST(pg_policy, 4167, 4168); + +DECLARE_UNIQUE_INDEX_PKEY(pg_policy_oid_index, 3257, PolicyOidIndexId, pg_policy, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_policy_polrelid_polname_index, 3258, PolicyPolrelidPolnameIndexId, pg_policy, btree(polrelid oid_ops, polname name_ops)); + +#endif /* PG_POLICY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_policy_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_policy_d.h new file mode 100644 index 0000000000000000000000000000000000000000..e603b4d6aab61be0b75e8c1bb86ef52d52811d3f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_policy_d.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * pg_policy_d.h + * Macro definitions for pg_policy + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_POLICY_D_H +#define PG_POLICY_D_H + +#define PolicyRelationId 3256 +#define PolicyOidIndexId 3257 +#define PolicyPolrelidPolnameIndexId 3258 + +#define Anum_pg_policy_oid 1 +#define Anum_pg_policy_polname 2 +#define Anum_pg_policy_polrelid 3 +#define Anum_pg_policy_polcmd 4 +#define Anum_pg_policy_polpermissive 5 +#define Anum_pg_policy_polroles 6 +#define Anum_pg_policy_polqual 7 +#define Anum_pg_policy_polwithcheck 8 + +#define Natts_pg_policy 8 + + +#endif /* PG_POLICY_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_proc.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_proc.h new file mode 100644 index 0000000000000000000000000000000000000000..51f43092415e972a63537a0066bc02001c68b84f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_proc.h @@ -0,0 +1,223 @@ +/*------------------------------------------------------------------------- + * + * pg_proc.h + * definition of the "procedure" system catalog (pg_proc) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_proc.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PROC_H +#define PG_PROC_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_proc_d.h" +#include "nodes/pg_list.h" + +/* ---------------- + * pg_proc definition. cpp turns this into + * typedef struct FormData_pg_proc + * ---------------- + */ +CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,ProcedureRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + /* procedure name */ + NameData proname; + + /* OID of namespace containing this proc */ + Oid pronamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* procedure owner */ + Oid proowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* OID of pg_language entry */ + Oid prolang BKI_DEFAULT(internal) BKI_LOOKUP(pg_language); + + /* estimated execution cost */ + float4 procost BKI_DEFAULT(1); + + /* estimated # of rows out (if proretset) */ + float4 prorows BKI_DEFAULT(0); + + /* element type of variadic array, or 0 if not variadic */ + Oid provariadic BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* planner support function for this function, or 0 if none */ + regproc prosupport BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_proc); + + /* see PROKIND_ categories below */ + char prokind BKI_DEFAULT(f); + + /* security definer */ + bool prosecdef BKI_DEFAULT(f); + + /* is it a leak-proof function? */ + bool proleakproof BKI_DEFAULT(f); + + /* strict with respect to NULLs? */ + bool proisstrict BKI_DEFAULT(t); + + /* returns a set? */ + bool proretset BKI_DEFAULT(f); + + /* see PROVOLATILE_ categories below */ + char provolatile BKI_DEFAULT(i); + + /* see PROPARALLEL_ categories below */ + char proparallel BKI_DEFAULT(s); + + /* number of arguments */ + /* Note: need not be given in pg_proc.dat; genbki.pl will compute it */ + int16 pronargs; + + /* number of arguments with defaults */ + int16 pronargdefaults BKI_DEFAULT(0); + + /* OID of result type */ + Oid prorettype BKI_LOOKUP(pg_type); + + /* + * variable-length fields start here, but we allow direct access to + * proargtypes + */ + + /* parameter types (excludes OUT params) */ + oidvector proargtypes BKI_LOOKUP(pg_type) BKI_FORCE_NOT_NULL; + +#ifdef CATALOG_VARLEN + + /* all param types (NULL if IN only) */ + Oid proallargtypes[1] BKI_DEFAULT(_null_) BKI_LOOKUP(pg_type); + + /* parameter modes (NULL if IN only) */ + char proargmodes[1] BKI_DEFAULT(_null_); + + /* parameter names (NULL if no names) */ + text proargnames[1] BKI_DEFAULT(_null_); + + /* list of expression trees for argument defaults (NULL if none) */ + pg_node_tree proargdefaults BKI_DEFAULT(_null_); + + /* types for which to apply transforms */ + Oid protrftypes[1] BKI_DEFAULT(_null_) BKI_LOOKUP(pg_type); + + /* procedure source text */ + text prosrc BKI_FORCE_NOT_NULL; + + /* secondary procedure info (can be NULL) */ + text probin BKI_DEFAULT(_null_); + + /* pre-parsed SQL function body */ + pg_node_tree prosqlbody BKI_DEFAULT(_null_); + + /* procedure-local GUC settings */ + text proconfig[1] BKI_DEFAULT(_null_); + + /* access permissions */ + aclitem proacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_proc; + +/* ---------------- + * Form_pg_proc corresponds to a pointer to a tuple with + * the format of pg_proc relation. + * ---------------- + */ +typedef FormData_pg_proc *Form_pg_proc; + +DECLARE_TOAST(pg_proc, 2836, 2837); + +DECLARE_UNIQUE_INDEX_PKEY(pg_proc_oid_index, 2690, ProcedureOidIndexId, pg_proc, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, ProcedureNameArgsNspIndexId, pg_proc, btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops)); + +MAKE_SYSCACHE(PROCOID, pg_proc_oid_index, 128); +MAKE_SYSCACHE(PROCNAMEARGSNSP, pg_proc_proname_args_nsp_index, 128); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Symbolic values for prokind column + */ +#define PROKIND_FUNCTION 'f' +#define PROKIND_AGGREGATE 'a' +#define PROKIND_WINDOW 'w' +#define PROKIND_PROCEDURE 'p' + +/* + * Symbolic values for provolatile column: these indicate whether the result + * of a function is dependent *only* on the values of its explicit arguments, + * or can change due to outside factors (such as parameter variables or + * table contents). NOTE: functions having side-effects, such as setval(), + * must be labeled volatile to ensure they will not get optimized away, + * even if the actual return value is not changeable. + */ +#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ +#define PROVOLATILE_STABLE 's' /* does not change within a scan */ +#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ + +/* + * Symbolic values for proparallel column: these indicate whether a function + * can be safely be run in a parallel backend, during parallelism but + * necessarily in the leader, or only in non-parallel mode. + */ +#define PROPARALLEL_SAFE 's' /* can run in worker or leader */ +#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel leader only */ +#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ + +/* + * Symbolic values for proargmodes column. Note that these must agree with + * the FunctionParameterMode enum in parsenodes.h; we declare them here to + * be accessible from either header. + */ +#define PROARGMODE_IN 'i' +#define PROARGMODE_OUT 'o' +#define PROARGMODE_INOUT 'b' +#define PROARGMODE_VARIADIC 'v' +#define PROARGMODE_TABLE 't' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress ProcedureCreate(const char *procedureName, + Oid procNamespace, + bool replace, + bool returnsSet, + Oid returnType, + Oid proowner, + Oid languageObjectId, + Oid languageValidator, + const char *prosrc, + const char *probin, + Node *prosqlbody, + char prokind, + bool security_definer, + bool isLeakProof, + bool isStrict, + char volatility, + char parallel, + oidvector *parameterTypes, + Datum allParameterTypes, + Datum parameterModes, + Datum parameterNames, + List *parameterDefaults, + Datum trftypes, + Datum proconfig, + Oid prosupport, + float4 procost, + float4 prorows); + +extern bool function_parse_error_transpose(const char *prosrc); + +extern List *oid_array_to_list(Datum datum); + +#endif /* PG_PROC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_proc_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_proc_d.h new file mode 100644 index 0000000000000000000000000000000000000000..dc17bd9d28ded01b964324283cfb86d279d514e1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_proc_d.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * pg_proc_d.h + * Macro definitions for pg_proc + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PROC_D_H +#define PG_PROC_D_H + +#define ProcedureRelationId 1255 +#define ProcedureRelation_Rowtype_Id 81 +#define ProcedureOidIndexId 2690 +#define ProcedureNameArgsNspIndexId 2691 + +#define Anum_pg_proc_oid 1 +#define Anum_pg_proc_proname 2 +#define Anum_pg_proc_pronamespace 3 +#define Anum_pg_proc_proowner 4 +#define Anum_pg_proc_prolang 5 +#define Anum_pg_proc_procost 6 +#define Anum_pg_proc_prorows 7 +#define Anum_pg_proc_provariadic 8 +#define Anum_pg_proc_prosupport 9 +#define Anum_pg_proc_prokind 10 +#define Anum_pg_proc_prosecdef 11 +#define Anum_pg_proc_proleakproof 12 +#define Anum_pg_proc_proisstrict 13 +#define Anum_pg_proc_proretset 14 +#define Anum_pg_proc_provolatile 15 +#define Anum_pg_proc_proparallel 16 +#define Anum_pg_proc_pronargs 17 +#define Anum_pg_proc_pronargdefaults 18 +#define Anum_pg_proc_prorettype 19 +#define Anum_pg_proc_proargtypes 20 +#define Anum_pg_proc_proallargtypes 21 +#define Anum_pg_proc_proargmodes 22 +#define Anum_pg_proc_proargnames 23 +#define Anum_pg_proc_proargdefaults 24 +#define Anum_pg_proc_protrftypes 25 +#define Anum_pg_proc_prosrc 26 +#define Anum_pg_proc_probin 27 +#define Anum_pg_proc_prosqlbody 28 +#define Anum_pg_proc_proconfig 29 +#define Anum_pg_proc_proacl 30 + +#define Natts_pg_proc 30 + + +/* + * Symbolic values for prokind column + */ +#define PROKIND_FUNCTION 'f' +#define PROKIND_AGGREGATE 'a' +#define PROKIND_WINDOW 'w' +#define PROKIND_PROCEDURE 'p' + +/* + * Symbolic values for provolatile column: these indicate whether the result + * of a function is dependent *only* on the values of its explicit arguments, + * or can change due to outside factors (such as parameter variables or + * table contents). NOTE: functions having side-effects, such as setval(), + * must be labeled volatile to ensure they will not get optimized away, + * even if the actual return value is not changeable. + */ +#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ +#define PROVOLATILE_STABLE 's' /* does not change within a scan */ +#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ + +/* + * Symbolic values for proparallel column: these indicate whether a function + * can be safely be run in a parallel backend, during parallelism but + * necessarily in the leader, or only in non-parallel mode. + */ +#define PROPARALLEL_SAFE 's' /* can run in worker or leader */ +#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel leader only */ +#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ + +/* + * Symbolic values for proargmodes column. Note that these must agree with + * the FunctionParameterMode enum in parsenodes.h; we declare them here to + * be accessible from either header. + */ +#define PROARGMODE_IN 'i' +#define PROARGMODE_OUT 'o' +#define PROARGMODE_INOUT 'b' +#define PROARGMODE_VARIADIC 'v' +#define PROARGMODE_TABLE 't' + + +#endif /* PG_PROC_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication.h new file mode 100644 index 0000000000000000000000000000000000000000..2f1b6abbfa7c68ad194ce93880e3a0f34f30382c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication.h @@ -0,0 +1,161 @@ +/*------------------------------------------------------------------------- + * + * pg_publication.h + * definition of the "publication" system catalog (pg_publication) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_H +#define PG_PUBLICATION_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_publication_d.h" + +/* ---------------- + * pg_publication definition. cpp turns this into + * typedef struct FormData_pg_publication + * ---------------- + */ +CATALOG(pg_publication,6104,PublicationRelationId) +{ + Oid oid; /* oid */ + + NameData pubname; /* name of the publication */ + + Oid pubowner BKI_LOOKUP(pg_authid); /* publication owner */ + + /* + * indicates that this is special publication which should encompass all + * tables in the database (except for the unlogged and temp ones) + */ + bool puballtables; + + /* true if inserts are published */ + bool pubinsert; + + /* true if updates are published */ + bool pubupdate; + + /* true if deletes are published */ + bool pubdelete; + + /* true if truncates are published */ + bool pubtruncate; + + /* true if partition changes are published using root schema */ + bool pubviaroot; +} FormData_pg_publication; + +/* ---------------- + * Form_pg_publication corresponds to a pointer to a tuple with + * the format of pg_publication relation. + * ---------------- + */ +typedef FormData_pg_publication *Form_pg_publication; + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_oid_index, 6110, PublicationObjectIndexId, pg_publication, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_pubname_index, 6111, PublicationNameIndexId, pg_publication, btree(pubname name_ops)); + +MAKE_SYSCACHE(PUBLICATIONOID, pg_publication_oid_index, 8); +MAKE_SYSCACHE(PUBLICATIONNAME, pg_publication_pubname_index, 8); + +typedef struct PublicationActions +{ + bool pubinsert; + bool pubupdate; + bool pubdelete; + bool pubtruncate; +} PublicationActions; + +typedef struct PublicationDesc +{ + PublicationActions pubactions; + + /* + * true if the columns referenced in row filters which are used for UPDATE + * or DELETE are part of the replica identity or the publication actions + * do not include UPDATE or DELETE. + */ + bool rf_valid_for_update; + bool rf_valid_for_delete; + + /* + * true if the columns are part of the replica identity or the publication + * actions do not include UPDATE or DELETE. + */ + bool cols_valid_for_update; + bool cols_valid_for_delete; +} PublicationDesc; + +typedef struct Publication +{ + Oid oid; + char *name; + bool alltables; + bool pubviaroot; + PublicationActions pubactions; +} Publication; + +typedef struct PublicationRelInfo +{ + Relation relation; + Node *whereClause; + List *columns; +} PublicationRelInfo; + +extern Publication *GetPublication(Oid pubid); +extern Publication *GetPublicationByName(const char *pubname, bool missing_ok); +extern List *GetRelationPublications(Oid relid); + +/*--------- + * Expected values for pub_partopt parameter of GetRelationPublications(), + * which allows callers to specify which partitions of partitioned tables + * mentioned in the publication they expect to see. + * + * ROOT: only the table explicitly mentioned in the publication + * LEAF: only leaf partitions in given tree + * ALL: all partitions in given tree + */ +typedef enum PublicationPartOpt +{ + PUBLICATION_PART_ROOT, + PUBLICATION_PART_LEAF, + PUBLICATION_PART_ALL, +} PublicationPartOpt; + +extern List *GetPublicationRelations(Oid pubid, PublicationPartOpt pub_partopt); +extern List *GetAllTablesPublications(void); +extern List *GetAllTablesPublicationRelations(bool pubviaroot); +extern List *GetPublicationSchemas(Oid pubid); +extern List *GetSchemaPublications(Oid schemaid); +extern List *GetSchemaPublicationRelations(Oid schemaid, + PublicationPartOpt pub_partopt); +extern List *GetAllSchemaPublicationRelations(Oid pubid, + PublicationPartOpt pub_partopt); +extern List *GetPubPartitionOptionRelations(List *result, + PublicationPartOpt pub_partopt, + Oid relid); +extern Oid GetTopMostAncestorInPublication(Oid puboid, List *ancestors, + int *ancestor_level); + +extern bool is_publishable_relation(Relation rel); +extern bool is_schema_publication(Oid pubid); +extern ObjectAddress publication_add_relation(Oid pubid, PublicationRelInfo *pri, + bool if_not_exists); +extern ObjectAddress publication_add_schema(Oid pubid, Oid schemaid, + bool if_not_exists); + +extern Bitmapset *pub_collist_to_bitmapset(Bitmapset *columns, Datum pubcols, + MemoryContext mcxt); + +#endif /* PG_PUBLICATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_d.h new file mode 100644 index 0000000000000000000000000000000000000000..18f167aec43dcfb4d198ec54334ace3470690bce --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_d.h + * Macro definitions for pg_publication + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_D_H +#define PG_PUBLICATION_D_H + +#define PublicationRelationId 6104 +#define PublicationObjectIndexId 6110 +#define PublicationNameIndexId 6111 + +#define Anum_pg_publication_oid 1 +#define Anum_pg_publication_pubname 2 +#define Anum_pg_publication_pubowner 3 +#define Anum_pg_publication_puballtables 4 +#define Anum_pg_publication_pubinsert 5 +#define Anum_pg_publication_pubupdate 6 +#define Anum_pg_publication_pubdelete 7 +#define Anum_pg_publication_pubtruncate 8 +#define Anum_pg_publication_pubviaroot 9 + +#define Natts_pg_publication 9 + + +#endif /* PG_PUBLICATION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace.h new file mode 100644 index 0000000000000000000000000000000000000000..1cfb557684f9f42ace85d1cd1774dbbe029cbb01 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_namespace.h + * definition of the system catalog for mappings between schemas and + * publications (pg_publication_namespace) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication_namespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_NAMESPACE_H +#define PG_PUBLICATION_NAMESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_publication_namespace_d.h" + + +/* ---------------- + * pg_publication_namespace definition. cpp turns this into + * typedef struct FormData_pg_publication_namespace + * ---------------- + */ +CATALOG(pg_publication_namespace,6237,PublicationNamespaceRelationId) +{ + Oid oid; /* oid */ + Oid pnpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */ + Oid pnnspid BKI_LOOKUP(pg_namespace); /* Oid of the schema */ +} FormData_pg_publication_namespace; + +/* ---------------- + * Form_pg_publication_namespace corresponds to a pointer to a tuple with + * the format of pg_publication_namespace relation. + * ---------------- + */ +typedef FormData_pg_publication_namespace *Form_pg_publication_namespace; + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_namespace_oid_index, 6238, PublicationNamespaceObjectIndexId, pg_publication_namespace, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_namespace_pnnspid_pnpubid_index, 6239, PublicationNamespacePnnspidPnpubidIndexId, pg_publication_namespace, btree(pnnspid oid_ops, pnpubid oid_ops)); + +MAKE_SYSCACHE(PUBLICATIONNAMESPACE, pg_publication_namespace_oid_index, 64); +MAKE_SYSCACHE(PUBLICATIONNAMESPACEMAP, pg_publication_namespace_pnnspid_pnpubid_index, 64); + +#endif /* PG_PUBLICATION_NAMESPACE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace_d.h new file mode 100644 index 0000000000000000000000000000000000000000..cf219239e43a40246d5401867a434927a7cddf55 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_namespace_d.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_namespace_d.h + * Macro definitions for pg_publication_namespace + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_NAMESPACE_D_H +#define PG_PUBLICATION_NAMESPACE_D_H + +#define PublicationNamespaceRelationId 6237 +#define PublicationNamespaceObjectIndexId 6238 +#define PublicationNamespacePnnspidPnpubidIndexId 6239 + +#define Anum_pg_publication_namespace_oid 1 +#define Anum_pg_publication_namespace_pnpubid 2 +#define Anum_pg_publication_namespace_pnnspid 3 + +#define Natts_pg_publication_namespace 3 + + +#endif /* PG_PUBLICATION_NAMESPACE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel.h new file mode 100644 index 0000000000000000000000000000000000000000..25fa630675aaa3d7ebd81867f58f36c7a69c4c2a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_rel.h + * definition of the system catalog for mappings between relations and + * publications (pg_publication_rel) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_publication_rel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_REL_H +#define PG_PUBLICATION_REL_H + +#include "catalog/genbki.h" +#include "catalog/pg_publication_rel_d.h" + +/* ---------------- + * pg_publication_rel definition. cpp turns this into + * typedef struct FormData_pg_publication_rel + * ---------------- + */ +CATALOG(pg_publication_rel,6106,PublicationRelRelationId) +{ + Oid oid; /* oid */ + Oid prpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */ + Oid prrelid BKI_LOOKUP(pg_class); /* Oid of the relation */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree prqual; /* qualifications */ + int2vector prattrs; /* columns to replicate */ +#endif +} FormData_pg_publication_rel; + +/* ---------------- + * Form_pg_publication_rel corresponds to a pointer to a tuple with + * the format of pg_publication_rel relation. + * ---------------- + */ +typedef FormData_pg_publication_rel *Form_pg_publication_rel; + +DECLARE_TOAST(pg_publication_rel, 6228, 6229); + +DECLARE_UNIQUE_INDEX_PKEY(pg_publication_rel_oid_index, 6112, PublicationRelObjectIndexId, pg_publication_rel, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_publication_rel_prrelid_prpubid_index, 6113, PublicationRelPrrelidPrpubidIndexId, pg_publication_rel, btree(prrelid oid_ops, prpubid oid_ops)); +DECLARE_INDEX(pg_publication_rel_prpubid_index, 6116, PublicationRelPrpubidIndexId, pg_publication_rel, btree(prpubid oid_ops)); + +MAKE_SYSCACHE(PUBLICATIONREL, pg_publication_rel_oid_index, 64); +MAKE_SYSCACHE(PUBLICATIONRELMAP, pg_publication_rel_prrelid_prpubid_index, 64); + +#endif /* PG_PUBLICATION_REL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel_d.h new file mode 100644 index 0000000000000000000000000000000000000000..551d6a59a72f31307591376845c0e19090fc5837 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_publication_rel_d.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * pg_publication_rel_d.h + * Macro definitions for pg_publication_rel + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PUBLICATION_REL_D_H +#define PG_PUBLICATION_REL_D_H + +#define PublicationRelRelationId 6106 +#define PublicationRelObjectIndexId 6112 +#define PublicationRelPrrelidPrpubidIndexId 6113 +#define PublicationRelPrpubidIndexId 6116 + +#define Anum_pg_publication_rel_oid 1 +#define Anum_pg_publication_rel_prpubid 2 +#define Anum_pg_publication_rel_prrelid 3 +#define Anum_pg_publication_rel_prqual 4 +#define Anum_pg_publication_rel_prattrs 5 + +#define Natts_pg_publication_rel 5 + + +#endif /* PG_PUBLICATION_REL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_range.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_range.h new file mode 100644 index 0000000000000000000000000000000000000000..0bd3ab688bd8561a77d4be8e3b15854a74f28250 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_range.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_range.h + * definition of the "range type" system catalog (pg_range) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_range.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RANGE_H +#define PG_RANGE_H + +#include "catalog/genbki.h" +#include "catalog/pg_range_d.h" + +/* ---------------- + * pg_range definition. cpp turns this into + * typedef struct FormData_pg_range + * ---------------- + */ +CATALOG(pg_range,3541,RangeRelationId) +{ + /* OID of owning range type */ + Oid rngtypid BKI_LOOKUP(pg_type); + + /* OID of range's element type (subtype) */ + Oid rngsubtype BKI_LOOKUP(pg_type); + + /* OID of the range's multirange type */ + Oid rngmultitypid BKI_LOOKUP(pg_type); + + /* collation for this range type, or 0 */ + Oid rngcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation); + + /* subtype's btree opclass */ + Oid rngsubopc BKI_LOOKUP(pg_opclass); + + /* canonicalize range, or 0 */ + regproc rngcanonical BKI_LOOKUP_OPT(pg_proc); + + /* subtype difference as a float8, or 0 */ + regproc rngsubdiff BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_range; + +/* ---------------- + * Form_pg_range corresponds to a pointer to a tuple with + * the format of pg_range relation. + * ---------------- + */ +typedef FormData_pg_range *Form_pg_range; + +DECLARE_UNIQUE_INDEX_PKEY(pg_range_rngtypid_index, 3542, RangeTypidIndexId, pg_range, btree(rngtypid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_range_rngmultitypid_index, 2228, RangeMultirangeTypidIndexId, pg_range, btree(rngmultitypid oid_ops)); + +MAKE_SYSCACHE(RANGETYPE, pg_range_rngtypid_index, 4); +MAKE_SYSCACHE(RANGEMULTIRANGE, pg_range_rngmultitypid_index, 4); + +/* + * prototypes for functions in pg_range.c + */ + +extern void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, + Oid rangeSubOpclass, RegProcedure rangeCanonical, + RegProcedure rangeSubDiff, Oid multirangeTypeOid); +extern void RangeDelete(Oid rangeTypeOid); + +#endif /* PG_RANGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_range_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_range_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c5c42a2beac96b0808e00d6e96043af4f55e743b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_range_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_range_d.h + * Macro definitions for pg_range + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RANGE_D_H +#define PG_RANGE_D_H + +#define RangeRelationId 3541 +#define RangeTypidIndexId 3542 +#define RangeMultirangeTypidIndexId 2228 + +#define Anum_pg_range_rngtypid 1 +#define Anum_pg_range_rngsubtype 2 +#define Anum_pg_range_rngmultitypid 3 +#define Anum_pg_range_rngcollation 4 +#define Anum_pg_range_rngsubopc 5 +#define Anum_pg_range_rngcanonical 6 +#define Anum_pg_range_rngsubdiff 7 + +#define Natts_pg_range 7 + + +#endif /* PG_RANGE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin.h new file mode 100644 index 0000000000000000000000000000000000000000..e9bc0209c2667ef6294e54802d9c7100c4811714 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * pg_replication_origin.h + * definition of the "replication origin" system catalog + * (pg_replication_origin) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_replication_origin.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REPLICATION_ORIGIN_H +#define PG_REPLICATION_ORIGIN_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_replication_origin_d.h" + +/* ---------------- + * pg_replication_origin. cpp turns this into + * typedef struct FormData_pg_replication_origin + * ---------------- + */ +CATALOG(pg_replication_origin,6000,ReplicationOriginRelationId) BKI_SHARED_RELATION +{ + /* + * Locally known id that get included into WAL. + * + * This should never leave the system. + * + * Needs to fit into an uint16, so we don't waste too much space in WAL + * records. For this reason we don't use a normal Oid column here, since + * we need to handle allocation of new values manually. + */ + Oid roident; + + /* + * Variable-length fields start here, but we allow direct access to + * roname. + */ + + /* external, free-format, name */ + text roname BKI_FORCE_NOT_NULL; + +#ifdef CATALOG_VARLEN /* further variable-length fields */ +#endif +} FormData_pg_replication_origin; + +typedef FormData_pg_replication_origin *Form_pg_replication_origin; + +DECLARE_TOAST_WITH_MACRO(pg_replication_origin, 4181, 4182, PgReplicationOriginToastTable, PgReplicationOriginToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_replication_origin_roiident_index, 6001, ReplicationOriginIdentIndex, pg_replication_origin, btree(roident oid_ops)); +DECLARE_UNIQUE_INDEX(pg_replication_origin_roname_index, 6002, ReplicationOriginNameIndex, pg_replication_origin, btree(roname text_ops)); + +MAKE_SYSCACHE(REPLORIGIDENT, pg_replication_origin_roiident_index, 16); +MAKE_SYSCACHE(REPLORIGNAME, pg_replication_origin_roname_index, 16); + +#endif /* PG_REPLICATION_ORIGIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin_d.h new file mode 100644 index 0000000000000000000000000000000000000000..bd23f9661ad54f7acb3f4b402d8178c0b81458e5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_replication_origin_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_replication_origin_d.h + * Macro definitions for pg_replication_origin + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REPLICATION_ORIGIN_D_H +#define PG_REPLICATION_ORIGIN_D_H + +#define ReplicationOriginRelationId 6000 +#define PgReplicationOriginToastTable 4181 +#define PgReplicationOriginToastIndex 4182 +#define ReplicationOriginIdentIndex 6001 +#define ReplicationOriginNameIndex 6002 + +#define Anum_pg_replication_origin_roident 1 +#define Anum_pg_replication_origin_roname 2 + +#define Natts_pg_replication_origin 2 + + +#endif /* PG_REPLICATION_ORIGIN_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite.h new file mode 100644 index 0000000000000000000000000000000000000000..e42ff73d29c3260e968351bc0ed46efb3f88f63a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_rewrite.h + * definition of the "rewrite rule" system catalog (pg_rewrite) + * + * As of Postgres 7.3, the primary key for this table is + * --- ie, rule names are only unique among the rules of a given table. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_rewrite.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REWRITE_H +#define PG_REWRITE_H + +#include "catalog/genbki.h" +#include "catalog/pg_rewrite_d.h" + +/* ---------------- + * pg_rewrite definition. cpp turns this into + * typedef struct FormData_pg_rewrite + * ---------------- + */ +CATALOG(pg_rewrite,2618,RewriteRelationId) +{ + Oid oid; /* oid */ + NameData rulename; + Oid ev_class BKI_LOOKUP(pg_class); + char ev_type; + char ev_enabled; + bool is_instead; + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + pg_node_tree ev_qual BKI_FORCE_NOT_NULL; + pg_node_tree ev_action BKI_FORCE_NOT_NULL; +#endif +} FormData_pg_rewrite; + +/* ---------------- + * Form_pg_rewrite corresponds to a pointer to a tuple with + * the format of pg_rewrite relation. + * ---------------- + */ +typedef FormData_pg_rewrite *Form_pg_rewrite; + +DECLARE_TOAST(pg_rewrite, 2838, 2839); + +DECLARE_UNIQUE_INDEX_PKEY(pg_rewrite_oid_index, 2692, RewriteOidIndexId, pg_rewrite, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, RewriteRelRulenameIndexId, pg_rewrite, btree(ev_class oid_ops, rulename name_ops)); + +MAKE_SYSCACHE(RULERELNAME, pg_rewrite_rel_rulename_index, 8); + +#endif /* PG_REWRITE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite_d.h new file mode 100644 index 0000000000000000000000000000000000000000..314d28fc73e55c1b3f58d4ad9399a75c431ca75b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_rewrite_d.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * pg_rewrite_d.h + * Macro definitions for pg_rewrite + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REWRITE_D_H +#define PG_REWRITE_D_H + +#define RewriteRelationId 2618 +#define RewriteOidIndexId 2692 +#define RewriteRelRulenameIndexId 2693 + +#define Anum_pg_rewrite_oid 1 +#define Anum_pg_rewrite_rulename 2 +#define Anum_pg_rewrite_ev_class 3 +#define Anum_pg_rewrite_ev_type 4 +#define Anum_pg_rewrite_ev_enabled 5 +#define Anum_pg_rewrite_is_instead 6 +#define Anum_pg_rewrite_ev_qual 7 +#define Anum_pg_rewrite_ev_action 8 + +#define Natts_pg_rewrite 8 + + +#endif /* PG_REWRITE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel.h new file mode 100644 index 0000000000000000000000000000000000000000..5f6f5c9c059869aec811162f00a4c673218afc4e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel.h @@ -0,0 +1,45 @@ +/* ------------------------------------------------------------------------- + * + * pg_seclabel.h + * definition of the "security label" system catalog (pg_seclabel) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_seclabel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SECLABEL_H +#define PG_SECLABEL_H + +#include "catalog/genbki.h" +#include "catalog/pg_seclabel_d.h" + +/* ---------------- + * pg_seclabel definition. cpp turns this into + * typedef struct FormData_pg_seclabel + * ---------------- + */ +CATALOG(pg_seclabel,3596,SecLabelRelationId) +{ + Oid objoid; /* OID of the object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the + * object */ + int32 objsubid; /* column number, or 0 if not used */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ +#endif +} FormData_pg_seclabel; + +DECLARE_TOAST(pg_seclabel, 3598, 3599); + +DECLARE_UNIQUE_INDEX_PKEY(pg_seclabel_object_index, 3597, SecLabelObjectIndexId, pg_seclabel, btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops, provider text_ops)); + +#endif /* PG_SECLABEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel_d.h new file mode 100644 index 0000000000000000000000000000000000000000..51ab3ac4b40f8144161964a63c1a7c0bde35be82 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_seclabel_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_seclabel_d.h + * Macro definitions for pg_seclabel + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SECLABEL_D_H +#define PG_SECLABEL_D_H + +#define SecLabelRelationId 3596 +#define SecLabelObjectIndexId 3597 + +#define Anum_pg_seclabel_objoid 1 +#define Anum_pg_seclabel_classoid 2 +#define Anum_pg_seclabel_objsubid 3 +#define Anum_pg_seclabel_provider 4 +#define Anum_pg_seclabel_label 5 + +#define Natts_pg_seclabel 5 + + +#endif /* PG_SECLABEL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence.h new file mode 100644 index 0000000000000000000000000000000000000000..8c3f0dd1ab897ff650596a0db608e2992d28b8a5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence.h @@ -0,0 +1,46 @@ +/* ------------------------------------------------------------------------- + * + * pg_sequence.h + * definition of the "sequence" system catalog (pg_sequence) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_sequence.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SEQUENCE_H +#define PG_SEQUENCE_H + +#include "catalog/genbki.h" +#include "catalog/pg_sequence_d.h" + +CATALOG(pg_sequence,2224,SequenceRelationId) +{ + Oid seqrelid BKI_LOOKUP(pg_class); + Oid seqtypid BKI_LOOKUP(pg_type); + int64 seqstart; + int64 seqincrement; + int64 seqmax; + int64 seqmin; + int64 seqcache; + bool seqcycle; +} FormData_pg_sequence; + +/* ---------------- + * Form_pg_sequence corresponds to a pointer to a tuple with + * the format of pg_sequence relation. + * ---------------- + */ +typedef FormData_pg_sequence *Form_pg_sequence; + +DECLARE_UNIQUE_INDEX_PKEY(pg_sequence_seqrelid_index, 5002, SequenceRelidIndexId, pg_sequence, btree(seqrelid oid_ops)); + +MAKE_SYSCACHE(SEQRELID, pg_sequence_seqrelid_index, 32); + +#endif /* PG_SEQUENCE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence_d.h new file mode 100644 index 0000000000000000000000000000000000000000..fd4af1fc830b28afb0966e6aad73508ac8aabd8b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_sequence_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_sequence_d.h + * Macro definitions for pg_sequence + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SEQUENCE_D_H +#define PG_SEQUENCE_D_H + +#define SequenceRelationId 2224 +#define SequenceRelidIndexId 5002 + +#define Anum_pg_sequence_seqrelid 1 +#define Anum_pg_sequence_seqtypid 2 +#define Anum_pg_sequence_seqstart 3 +#define Anum_pg_sequence_seqincrement 4 +#define Anum_pg_sequence_seqmax 5 +#define Anum_pg_sequence_seqmin 6 +#define Anum_pg_sequence_seqcache 7 +#define Anum_pg_sequence_seqcycle 8 + +#define Natts_pg_sequence 8 + + +#endif /* PG_SEQUENCE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend.h new file mode 100644 index 0000000000000000000000000000000000000000..7bd48ab97cbcc28a36a597234a1c9195e23c1ef6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend.h @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------- + * + * pg_shdepend.h + * definition of the "shared dependency" system catalog (pg_shdepend) + * + * pg_shdepend has no preloaded contents, so there is no pg_shdepend.dat + * file; dependencies for system-defined objects are loaded into it + * on-the-fly during initdb. Most built-in objects are pinned anyway, + * and hence need no explicit entries in pg_shdepend. + * + * NOTE: we do not represent all possible dependency pairs in pg_shdepend; + * for example, there's not much value in creating an explicit dependency + * from a relation to its database. Currently, only dependencies on roles + * are explicitly stored in pg_shdepend. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shdepend.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDEPEND_H +#define PG_SHDEPEND_H + +#include "catalog/genbki.h" +#include "catalog/pg_shdepend_d.h" + +/* ---------------- + * pg_shdepend definition. cpp turns this into + * typedef struct FormData_pg_shdepend + * ---------------- + */ +CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION +{ + /* + * Identification of the dependent (referencing) object. + * + * Note that dbid can be zero to denote a shared object. + */ + Oid dbid BKI_LOOKUP_OPT(pg_database); /* OID of database + * containing object */ + Oid classid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid objid; /* OID of object itself */ + int32 objsubid; /* column number, or 0 if not used */ + + /* + * Identification of the independent (referenced) object. This is always + * a shared object, so we need no database ID field. We don't bother with + * a sub-object ID either. + */ + Oid refclassid BKI_LOOKUP(pg_class); /* OID of table containing + * object */ + Oid refobjid; /* OID of object itself */ + + /* + * Precise semantics of the relationship are specified by the deptype + * field. See SharedDependencyType in catalog/dependency.h. + */ + char deptype; /* see codes in dependency.h */ +} FormData_pg_shdepend; + +/* ---------------- + * Form_pg_shdepend corresponds to a pointer to a row with + * the format of pg_shdepend relation. + * ---------------- + */ +typedef FormData_pg_shdepend *Form_pg_shdepend; + +DECLARE_INDEX(pg_shdepend_depender_index, 1232, SharedDependDependerIndexId, pg_shdepend, btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops)); +DECLARE_INDEX(pg_shdepend_reference_index, 1233, SharedDependReferenceIndexId, pg_shdepend, btree(refclassid oid_ops, refobjid oid_ops)); + +#endif /* PG_SHDEPEND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend_d.h new file mode 100644 index 0000000000000000000000000000000000000000..ee496531311e0216250b2d6e502a1667006eec62 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdepend_d.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pg_shdepend_d.h + * Macro definitions for pg_shdepend + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDEPEND_D_H +#define PG_SHDEPEND_D_H + +#define SharedDependRelationId 1214 +#define SharedDependDependerIndexId 1232 +#define SharedDependReferenceIndexId 1233 + +#define Anum_pg_shdepend_dbid 1 +#define Anum_pg_shdepend_classid 2 +#define Anum_pg_shdepend_objid 3 +#define Anum_pg_shdepend_objsubid 4 +#define Anum_pg_shdepend_refclassid 5 +#define Anum_pg_shdepend_refobjid 6 +#define Anum_pg_shdepend_deptype 7 + +#define Natts_pg_shdepend 7 + + +#endif /* PG_SHDEPEND_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription.h new file mode 100644 index 0000000000000000000000000000000000000000..c9433d229ef47c085c78abe708bc2abbbd2ce8ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * pg_shdescription.h + * definition of the "shared description" system catalog + * (pg_shdescription) + * + * Because the contents of this table are taken from the *.dat files + * of other catalogs, there is no pg_shdescription.dat file. The initial + * contents are assembled by genbki.pl and loaded during initdb. + * + * NOTE: an object is identified by the OID of the row that primarily + * defines the object, plus the OID of the table that that row appears in. + * For example, a database is identified by the OID of its pg_database row + * plus the pg_class OID of table pg_database. This allows unique + * identification of objects without assuming that OIDs are unique + * across tables. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shdescription.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDESCRIPTION_H +#define PG_SHDESCRIPTION_H + +#include "catalog/genbki.h" +#include "catalog/pg_shdescription_d.h" + +/* ---------------- + * pg_shdescription definition. cpp turns this into + * typedef struct FormData_pg_shdescription + * ---------------- + */ +CATALOG(pg_shdescription,2396,SharedDescriptionRelationId) BKI_SHARED_RELATION +{ + Oid objoid; /* OID of object itself */ + Oid classoid; /* OID of table containing object */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text description BKI_FORCE_NOT_NULL; /* description of object */ +#endif +} FormData_pg_shdescription; + +/* ---------------- + * Form_pg_shdescription corresponds to a pointer to a tuple with + * the format of pg_shdescription relation. + * ---------------- + */ +typedef FormData_pg_shdescription * Form_pg_shdescription; + +DECLARE_TOAST_WITH_MACRO(pg_shdescription, 2846, 2847, PgShdescriptionToastTable, PgShdescriptionToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_shdescription_o_c_index, 2397, SharedDescriptionObjIndexId, pg_shdescription, btree(objoid oid_ops, classoid oid_ops)); + +/* We do not use BKI_LOOKUP here because it causes problems for genbki.pl */ +DECLARE_FOREIGN_KEY((classoid), pg_class, (oid)); + +#endif /* PG_SHDESCRIPTION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription_d.h new file mode 100644 index 0000000000000000000000000000000000000000..eda2ebfc3f570065deafa565b3fa3027d24d5fb6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shdescription_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_shdescription_d.h + * Macro definitions for pg_shdescription + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHDESCRIPTION_D_H +#define PG_SHDESCRIPTION_D_H + +#define SharedDescriptionRelationId 2396 +#define PgShdescriptionToastTable 2846 +#define PgShdescriptionToastIndex 2847 +#define SharedDescriptionObjIndexId 2397 + +#define Anum_pg_shdescription_objoid 1 +#define Anum_pg_shdescription_classoid 2 +#define Anum_pg_shdescription_description 3 + +#define Natts_pg_shdescription 3 + + +#endif /* PG_SHDESCRIPTION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel.h new file mode 100644 index 0000000000000000000000000000000000000000..478d46969c0b8bb7f54061139ff9a7d00924fa75 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel.h @@ -0,0 +1,46 @@ +/* ------------------------------------------------------------------------- + * + * pg_shseclabel.h + * definition of the "shared security label" system catalog (pg_shseclabel) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_shseclabel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SHSECLABEL_H +#define PG_SHSECLABEL_H + +#include "catalog/genbki.h" +#include "catalog/pg_shseclabel_d.h" + +/* ---------------- + * pg_shseclabel definition. cpp turns this into + * typedef struct FormData_pg_shseclabel + * ---------------- + */ +CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066,SharedSecLabelRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid objoid; /* OID of the shared object itself */ + Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing the + * shared object */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ +#endif +} FormData_pg_shseclabel; + +typedef FormData_pg_shseclabel * Form_pg_shseclabel; + +DECLARE_TOAST_WITH_MACRO(pg_shseclabel, 4060, 4061, PgShseclabelToastTable, PgShseclabelToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_shseclabel_object_index, 3593, SharedSecLabelObjectIndexId, pg_shseclabel, btree(objoid oid_ops, classoid oid_ops, provider text_ops)); + +#endif /* PG_SHSECLABEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel_d.h new file mode 100644 index 0000000000000000000000000000000000000000..f88d62c6951b17b573d6f23ea01b7ebebe223990 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_shseclabel_d.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * pg_shseclabel_d.h + * Macro definitions for pg_shseclabel + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHSECLABEL_D_H +#define PG_SHSECLABEL_D_H + +#define SharedSecLabelRelationId 3592 +#define SharedSecLabelRelation_Rowtype_Id 4066 +#define PgShseclabelToastTable 4060 +#define PgShseclabelToastIndex 4061 +#define SharedSecLabelObjectIndexId 3593 + +#define Anum_pg_shseclabel_objoid 1 +#define Anum_pg_shseclabel_classoid 2 +#define Anum_pg_shseclabel_provider 3 +#define Anum_pg_shseclabel_label 4 + +#define Natts_pg_shseclabel 4 + + +#endif /* PG_SHSECLABEL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic.h new file mode 100644 index 0000000000000000000000000000000000000000..041e626390a1551ffb3dc131cb08031016a88dd3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic.h @@ -0,0 +1,288 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic.h + * definition of the "statistics" system catalog (pg_statistic) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_H +#define PG_STATISTIC_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_d.h" + +/* ---------------- + * pg_statistic definition. cpp turns this into + * typedef struct FormData_pg_statistic + * ---------------- + */ +CATALOG(pg_statistic,2619,StatisticRelationId) +{ + /* These fields form the unique key for the entry: */ + Oid starelid BKI_LOOKUP(pg_class); /* relation containing + * attribute */ + int16 staattnum; /* attribute (column) stats are for */ + bool stainherit; /* true if inheritance children are included */ + + /* the fraction of the column's entries that are NULL: */ + float4 stanullfrac; + + /* + * stawidth is the average width in bytes of non-null entries. For + * fixed-width datatypes this is of course the same as the typlen, but for + * var-width types it is more useful. Note that this is the average width + * of the data as actually stored, post-TOASTing (eg, for a + * moved-out-of-line value, only the size of the pointer object is + * counted). This is the appropriate definition for the primary use of + * the statistic, which is to estimate sizes of in-memory hash tables of + * tuples. + */ + int32 stawidth; + + /* ---------------- + * stadistinct indicates the (approximate) number of distinct non-null + * data values in the column. The interpretation is: + * 0 unknown or not computed + * > 0 actual number of distinct values + * < 0 negative of multiplier for number of rows + * The special negative case allows us to cope with columns that are + * unique (stadistinct = -1) or nearly so (for example, a column in which + * non-null values appear about twice on the average could be represented + * by stadistinct = -0.5 if there are no nulls, or -0.4 if 20% of the + * column is nulls). Because the number-of-rows statistic in pg_class may + * be updated more frequently than pg_statistic is, it's important to be + * able to describe such situations as a multiple of the number of rows, + * rather than a fixed number of distinct values. But in other cases a + * fixed number is correct (eg, a boolean column). + * ---------------- + */ + float4 stadistinct; + + /* ---------------- + * To allow keeping statistics on different kinds of datatypes, + * we do not hard-wire any particular meaning for the remaining + * statistical fields. Instead, we provide several "slots" in which + * statistical data can be placed. Each slot includes: + * kind integer code identifying kind of data (see below) + * op OID of associated operator, if needed + * coll OID of relevant collation, or 0 if none + * numbers float4 array (for statistical values) + * values anyarray (for representations of data values) + * The ID, operator, and collation fields are never NULL; they are zeroes + * in an unused slot. The numbers and values fields are NULL in an + * unused slot, and might also be NULL in a used slot if the slot kind + * has no need for one or the other. + * ---------------- + */ + + int16 stakind1; + int16 stakind2; + int16 stakind3; + int16 stakind4; + int16 stakind5; + + Oid staop1 BKI_LOOKUP_OPT(pg_operator); + Oid staop2 BKI_LOOKUP_OPT(pg_operator); + Oid staop3 BKI_LOOKUP_OPT(pg_operator); + Oid staop4 BKI_LOOKUP_OPT(pg_operator); + Oid staop5 BKI_LOOKUP_OPT(pg_operator); + + Oid stacoll1 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll2 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll3 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll4 BKI_LOOKUP_OPT(pg_collation); + Oid stacoll5 BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + float4 stanumbers1[1]; + float4 stanumbers2[1]; + float4 stanumbers3[1]; + float4 stanumbers4[1]; + float4 stanumbers5[1]; + + /* + * Values in these arrays are values of the column's data type, or of some + * related type such as an array element type. We presently have to cheat + * quite a bit to allow polymorphic arrays of this kind, but perhaps + * someday it'll be a less bogus facility. + */ + anyarray stavalues1; + anyarray stavalues2; + anyarray stavalues3; + anyarray stavalues4; + anyarray stavalues5; +#endif +} FormData_pg_statistic; + +#define STATISTIC_NUM_SLOTS 5 + + +/* ---------------- + * Form_pg_statistic corresponds to a pointer to a tuple with + * the format of pg_statistic relation. + * ---------------- + */ +typedef FormData_pg_statistic *Form_pg_statistic; + +DECLARE_TOAST(pg_statistic, 2840, 2841); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_relid_att_inh_index, 2696, StatisticRelidAttnumInhIndexId, pg_statistic, btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops)); + +MAKE_SYSCACHE(STATRELATTINH, pg_statistic_relid_att_inh_index, 128); + +DECLARE_FOREIGN_KEY((starelid, staattnum), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * Several statistical slot "kinds" are defined by core PostgreSQL, as + * documented below. Also, custom data types can define their own "kind" + * codes by mutual agreement between a custom typanalyze routine and the + * selectivity estimation functions of the type's operators. + * + * Code reading the pg_statistic relation should not assume that a particular + * data "kind" will appear in any particular slot. Instead, search the + * stakind fields to see if the desired data is available. (The standard + * function get_attstatsslot() may be used for this.) + * + * Note: The pg_stats view needs to be modified whenever a new slot kind is + * added to core. + */ + +/* + * The present allocation of "kind" codes is: + * + * 1-99: reserved for assignment by the core PostgreSQL project + * (values in this range will be documented in this file) + * 100-199: reserved for assignment by the PostGIS project + * (values to be documented in PostGIS documentation) + * 200-299: reserved for assignment by the ESRI ST_Geometry project + * (values to be documented in ESRI ST_Geometry documentation) + * 300-9999: reserved for future public assignments + * + * For private use you may choose a "kind" code at random in the range + * 10000-30000. However, for code that is to be widely disseminated it is + * better to obtain a publicly defined "kind" code by request from the + * PostgreSQL Global Development Group. + */ + +/* + * In a "most common values" slot, staop is the OID of the "=" operator + * used to decide whether values are the same or not, and stacoll is the + * collation used (same as column's collation). stavalues contains + * the K most common non-null values appearing in the column, and stanumbers + * contains their frequencies (fractions of total row count). The values + * shall be ordered in decreasing frequency. Note that since the arrays are + * variable-size, K may be chosen may be chosen at ANALYZE time. Values should + * not appear in MCV unless they have been observed to occur more than once; + * a unique column will have no MCV slot. + */ +#define STATISTIC_KIND_MCV 1 + +/* + * A "histogram" slot describes the distribution of scalar data. staop is + * the OID of the "<" operator that describes the sort ordering, and stacoll + * is the relevant collation. (In theory more than one histogram could appear, + * if a datatype has more than one useful sort operator or we care about more + * than one collation. Currently the collation will always be that of the + * underlying column.) stavalues contains M (>=2) non-null values that + * divide the non-null column data values into M-1 bins of approximately equal + * population. The first stavalues item is the MIN and the last is the MAX. + * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV + * slot is also provided, then the histogram describes the data distribution + * *after removing the values listed in MCV* (thus, it's a "compressed + * histogram" in the technical parlance). This allows a more accurate + * representation of the distribution of a column with some very-common + * values. In a column with only a few distinct values, it's possible that + * the MCV list describes the entire data population; in this case the + * histogram reduces to empty and should be omitted. + */ +#define STATISTIC_KIND_HISTOGRAM 2 + +/* + * A "correlation" slot describes the correlation between the physical order + * of table tuples and the ordering of data values of this column, as seen + * by the "<" operator identified by staop with the collation identified by + * stacoll. (As with the histogram, more than one entry could theoretically + * appear.) stavalues is not used and should be NULL. stanumbers contains + * a single entry, the correlation coefficient between the sequence of data + * values and the sequence of their actual tuple positions. The coefficient + * ranges from +1 to -1. + */ +#define STATISTIC_KIND_CORRELATION 3 + +/* + * A "most common elements" slot is similar to a "most common values" slot, + * except that it stores the most common non-null *elements* of the column + * values. This is useful when the column datatype is an array or some other + * type with identifiable elements (for instance, tsvector). staop contains + * the equality operator appropriate to the element type, and stacoll + * contains the collation to use with it. stavalues contains + * the most common element values, and stanumbers their frequencies. Unlike + * MCV slots, frequencies are measured as the fraction of non-null rows the + * element value appears in, not the frequency of all rows. Also unlike + * MCV slots, the values are sorted into the element type's default order + * (to support binary search for a particular value). Since this puts the + * minimum and maximum frequencies at unpredictable spots in stanumbers, + * there are two extra members of stanumbers, holding copies of the minimum + * and maximum frequencies. Optionally, there can be a third extra member, + * which holds the frequency of null elements (expressed in the same terms: + * the fraction of non-null rows that contain at least one null element). If + * this member is omitted, the column is presumed to contain no null elements. + * + * Note: in current usage for tsvector columns, the stavalues elements are of + * type text, even though their representation within tsvector is not + * exactly text. + */ +#define STATISTIC_KIND_MCELEM 4 + +/* + * A "distinct elements count histogram" slot describes the distribution of + * the number of distinct element values present in each row of an array-type + * column. Only non-null rows are considered, and only non-null elements. + * staop contains the equality operator appropriate to the element type, + * and stacoll contains the collation to use with it. + * stavalues is not used and should be NULL. The last member of stanumbers is + * the average count of distinct element values over all non-null rows. The + * preceding M (>=2) members form a histogram that divides the population of + * distinct-elements counts into M-1 bins of approximately equal population. + * The first of these is the minimum observed count, and the last the maximum. + */ +#define STATISTIC_KIND_DECHIST 5 + +/* + * A "length histogram" slot describes the distribution of range lengths in + * rows of a range-type column. stanumbers contains a single entry, the + * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in + * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range + * values that divide the column data values into M-1 bins of approximately + * equal population. The lengths are stored as float8s, as measured by the + * range type's subdiff function. Only non-null, non-empty rows are + * considered. + */ +#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM 6 + +/* + * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for + * a range-type column. stavalues contains M (>=2) range values that divide + * the column data values into M-1 bins of approximately equal population. + * Unlike a regular scalar histogram, this is actually two histograms combined + * into a single array, with the lower bounds of each value forming a + * histogram of lower bounds, and the upper bounds a histogram of upper + * bounds. Only non-NULL, non-empty ranges are included. + */ +#define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_STATISTIC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_d.h new file mode 100644 index 0000000000000000000000000000000000000000..55de6b69589c30e1e407c65e5d2e1d1006ce4bb0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_d.h @@ -0,0 +1,199 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_d.h + * Macro definitions for pg_statistic + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_D_H +#define PG_STATISTIC_D_H + +#define StatisticRelationId 2619 +#define StatisticRelidAttnumInhIndexId 2696 + +#define Anum_pg_statistic_starelid 1 +#define Anum_pg_statistic_staattnum 2 +#define Anum_pg_statistic_stainherit 3 +#define Anum_pg_statistic_stanullfrac 4 +#define Anum_pg_statistic_stawidth 5 +#define Anum_pg_statistic_stadistinct 6 +#define Anum_pg_statistic_stakind1 7 +#define Anum_pg_statistic_stakind2 8 +#define Anum_pg_statistic_stakind3 9 +#define Anum_pg_statistic_stakind4 10 +#define Anum_pg_statistic_stakind5 11 +#define Anum_pg_statistic_staop1 12 +#define Anum_pg_statistic_staop2 13 +#define Anum_pg_statistic_staop3 14 +#define Anum_pg_statistic_staop4 15 +#define Anum_pg_statistic_staop5 16 +#define Anum_pg_statistic_stacoll1 17 +#define Anum_pg_statistic_stacoll2 18 +#define Anum_pg_statistic_stacoll3 19 +#define Anum_pg_statistic_stacoll4 20 +#define Anum_pg_statistic_stacoll5 21 +#define Anum_pg_statistic_stanumbers1 22 +#define Anum_pg_statistic_stanumbers2 23 +#define Anum_pg_statistic_stanumbers3 24 +#define Anum_pg_statistic_stanumbers4 25 +#define Anum_pg_statistic_stanumbers5 26 +#define Anum_pg_statistic_stavalues1 27 +#define Anum_pg_statistic_stavalues2 28 +#define Anum_pg_statistic_stavalues3 29 +#define Anum_pg_statistic_stavalues4 30 +#define Anum_pg_statistic_stavalues5 31 + +#define Natts_pg_statistic 31 + + +/* + * Several statistical slot "kinds" are defined by core PostgreSQL, as + * documented below. Also, custom data types can define their own "kind" + * codes by mutual agreement between a custom typanalyze routine and the + * selectivity estimation functions of the type's operators. + * + * Code reading the pg_statistic relation should not assume that a particular + * data "kind" will appear in any particular slot. Instead, search the + * stakind fields to see if the desired data is available. (The standard + * function get_attstatsslot() may be used for this.) + * + * Note: The pg_stats view needs to be modified whenever a new slot kind is + * added to core. + */ + +/* + * The present allocation of "kind" codes is: + * + * 1-99: reserved for assignment by the core PostgreSQL project + * (values in this range will be documented in this file) + * 100-199: reserved for assignment by the PostGIS project + * (values to be documented in PostGIS documentation) + * 200-299: reserved for assignment by the ESRI ST_Geometry project + * (values to be documented in ESRI ST_Geometry documentation) + * 300-9999: reserved for future public assignments + * + * For private use you may choose a "kind" code at random in the range + * 10000-30000. However, for code that is to be widely disseminated it is + * better to obtain a publicly defined "kind" code by request from the + * PostgreSQL Global Development Group. + */ + +/* + * In a "most common values" slot, staop is the OID of the "=" operator + * used to decide whether values are the same or not, and stacoll is the + * collation used (same as column's collation). stavalues contains + * the K most common non-null values appearing in the column, and stanumbers + * contains their frequencies (fractions of total row count). The values + * shall be ordered in decreasing frequency. Note that since the arrays are + * variable-size, K may be chosen may be chosen at ANALYZE time. Values should + * not appear in MCV unless they have been observed to occur more than once; + * a unique column will have no MCV slot. + */ +#define STATISTIC_KIND_MCV 1 + +/* + * A "histogram" slot describes the distribution of scalar data. staop is + * the OID of the "<" operator that describes the sort ordering, and stacoll + * is the relevant collation. (In theory more than one histogram could appear, + * if a datatype has more than one useful sort operator or we care about more + * than one collation. Currently the collation will always be that of the + * underlying column.) stavalues contains M (>=2) non-null values that + * divide the non-null column data values into M-1 bins of approximately equal + * population. The first stavalues item is the MIN and the last is the MAX. + * stanumbers is not used and should be NULL. IMPORTANT POINT: if an MCV + * slot is also provided, then the histogram describes the data distribution + * *after removing the values listed in MCV* (thus, it's a "compressed + * histogram" in the technical parlance). This allows a more accurate + * representation of the distribution of a column with some very-common + * values. In a column with only a few distinct values, it's possible that + * the MCV list describes the entire data population; in this case the + * histogram reduces to empty and should be omitted. + */ +#define STATISTIC_KIND_HISTOGRAM 2 + +/* + * A "correlation" slot describes the correlation between the physical order + * of table tuples and the ordering of data values of this column, as seen + * by the "<" operator identified by staop with the collation identified by + * stacoll. (As with the histogram, more than one entry could theoretically + * appear.) stavalues is not used and should be NULL. stanumbers contains + * a single entry, the correlation coefficient between the sequence of data + * values and the sequence of their actual tuple positions. The coefficient + * ranges from +1 to -1. + */ +#define STATISTIC_KIND_CORRELATION 3 + +/* + * A "most common elements" slot is similar to a "most common values" slot, + * except that it stores the most common non-null *elements* of the column + * values. This is useful when the column datatype is an array or some other + * type with identifiable elements (for instance, tsvector). staop contains + * the equality operator appropriate to the element type, and stacoll + * contains the collation to use with it. stavalues contains + * the most common element values, and stanumbers their frequencies. Unlike + * MCV slots, frequencies are measured as the fraction of non-null rows the + * element value appears in, not the frequency of all rows. Also unlike + * MCV slots, the values are sorted into the element type's default order + * (to support binary search for a particular value). Since this puts the + * minimum and maximum frequencies at unpredictable spots in stanumbers, + * there are two extra members of stanumbers, holding copies of the minimum + * and maximum frequencies. Optionally, there can be a third extra member, + * which holds the frequency of null elements (expressed in the same terms: + * the fraction of non-null rows that contain at least one null element). If + * this member is omitted, the column is presumed to contain no null elements. + * + * Note: in current usage for tsvector columns, the stavalues elements are of + * type text, even though their representation within tsvector is not + * exactly text. + */ +#define STATISTIC_KIND_MCELEM 4 + +/* + * A "distinct elements count histogram" slot describes the distribution of + * the number of distinct element values present in each row of an array-type + * column. Only non-null rows are considered, and only non-null elements. + * staop contains the equality operator appropriate to the element type, + * and stacoll contains the collation to use with it. + * stavalues is not used and should be NULL. The last member of stanumbers is + * the average count of distinct element values over all non-null rows. The + * preceding M (>=2) members form a histogram that divides the population of + * distinct-elements counts into M-1 bins of approximately equal population. + * The first of these is the minimum observed count, and the last the maximum. + */ +#define STATISTIC_KIND_DECHIST 5 + +/* + * A "length histogram" slot describes the distribution of range lengths in + * rows of a range-type column. stanumbers contains a single entry, the + * fraction of empty ranges. stavalues is a histogram of non-empty lengths, in + * a format similar to STATISTIC_KIND_HISTOGRAM: it contains M (>=2) range + * values that divide the column data values into M-1 bins of approximately + * equal population. The lengths are stored as float8s, as measured by the + * range type's subdiff function. Only non-null, non-empty rows are + * considered. + */ +#define STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM 6 + +/* + * A "bounds histogram" slot is similar to STATISTIC_KIND_HISTOGRAM, but for + * a range-type column. stavalues contains M (>=2) range values that divide + * the column data values into M-1 bins of approximately equal population. + * Unlike a regular scalar histogram, this is actually two histograms combined + * into a single array, with the lower bounds of each value forming a + * histogram of lower bounds, and the upper bounds a histogram of upper + * bounds. Only non-NULL, non-empty ranges are included. + */ +#define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 + + +#endif /* PG_STATISTIC_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext.h new file mode 100644 index 0000000000000000000000000000000000000000..50a5c021edf53a54033aa8f5386e5dd4e7982806 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext.h + * definition of the "extended statistics" system catalog + * (pg_statistic_ext) + * + * Note that pg_statistic_ext contains the definitions of extended statistics + * objects, created by CREATE STATISTICS, but not the actual statistical data, + * created by running ANALYZE. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic_ext.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_H +#define PG_STATISTIC_EXT_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_ext_d.h" + +/* ---------------- + * pg_statistic_ext definition. cpp turns this into + * typedef struct FormData_pg_statistic_ext + * ---------------- + */ +CATALOG(pg_statistic_ext,3381,StatisticExtRelationId) +{ + Oid oid; /* oid */ + + Oid stxrelid BKI_LOOKUP(pg_class); /* relation containing + * attributes */ + + /* These two fields form the unique key for the entry: */ + NameData stxname; /* statistics object name */ + Oid stxnamespace BKI_LOOKUP(pg_namespace); /* OID of statistics + * object's namespace */ + + Oid stxowner BKI_LOOKUP(pg_authid); /* statistics object's owner */ + + /* + * variable-length/nullable fields start here, but we allow direct access + * to stxkeys + */ + int2vector stxkeys BKI_FORCE_NOT_NULL; /* array of column keys */ + +#ifdef CATALOG_VARLEN + int16 stxstattarget BKI_DEFAULT(_null_) BKI_FORCE_NULL; /* statistics target */ + char stxkind[1] BKI_FORCE_NOT_NULL; /* statistics kinds requested + * to build */ + pg_node_tree stxexprs; /* A list of expression trees for stats + * attributes that are not simple column + * references. */ +#endif + +} FormData_pg_statistic_ext; + +/* ---------------- + * Form_pg_statistic_ext corresponds to a pointer to a tuple with + * the format of pg_statistic_ext relation. + * ---------------- + */ +typedef FormData_pg_statistic_ext *Form_pg_statistic_ext; + +DECLARE_TOAST(pg_statistic_ext, 3439, 3440); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_oid_index, 3380, StatisticExtOidIndexId, pg_statistic_ext, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_statistic_ext_name_index, 3997, StatisticExtNameIndexId, pg_statistic_ext, btree(stxname name_ops, stxnamespace oid_ops)); +DECLARE_INDEX(pg_statistic_ext_relid_index, 3379, StatisticExtRelidIndexId, pg_statistic_ext, btree(stxrelid oid_ops)); + +MAKE_SYSCACHE(STATEXTOID, pg_statistic_ext_oid_index, 4); +MAKE_SYSCACHE(STATEXTNAMENSP, pg_statistic_ext_name_index, 4); + +DECLARE_ARRAY_FOREIGN_KEY((stxrelid, stxkeys), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +#define STATS_EXT_NDISTINCT 'd' +#define STATS_EXT_DEPENDENCIES 'f' +#define STATS_EXT_MCV 'm' +#define STATS_EXT_EXPRESSIONS 'e' + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_STATISTIC_EXT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_d.h new file mode 100644 index 0000000000000000000000000000000000000000..f1868a7846a0828b63cac373fc85350a5b4a412b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_d.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_d.h + * Macro definitions for pg_statistic_ext + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_D_H +#define PG_STATISTIC_EXT_D_H + +#define StatisticExtRelationId 3381 +#define StatisticExtOidIndexId 3380 +#define StatisticExtNameIndexId 3997 +#define StatisticExtRelidIndexId 3379 + +#define Anum_pg_statistic_ext_oid 1 +#define Anum_pg_statistic_ext_stxrelid 2 +#define Anum_pg_statistic_ext_stxname 3 +#define Anum_pg_statistic_ext_stxnamespace 4 +#define Anum_pg_statistic_ext_stxowner 5 +#define Anum_pg_statistic_ext_stxkeys 6 +#define Anum_pg_statistic_ext_stxstattarget 7 +#define Anum_pg_statistic_ext_stxkind 8 +#define Anum_pg_statistic_ext_stxexprs 9 + +#define Natts_pg_statistic_ext 9 + + +#define STATS_EXT_NDISTINCT 'd' +#define STATS_EXT_DEPENDENCIES 'f' +#define STATS_EXT_MCV 'm' +#define STATS_EXT_EXPRESSIONS 'e' + + +#endif /* PG_STATISTIC_EXT_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data.h new file mode 100644 index 0000000000000000000000000000000000000000..18b00ce8b526a4bab77707a0c65a263f4cf019bc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_data.h + * definition of the "extended statistics data" system catalog + * (pg_statistic_ext_data) + * + * This catalog stores the statistical data for extended statistics objects. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_statistic_ext_data.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_DATA_H +#define PG_STATISTIC_EXT_DATA_H + +#include "catalog/genbki.h" +#include "catalog/pg_statistic_ext_data_d.h" + +/* ---------------- + * pg_statistic_ext_data definition. cpp turns this into + * typedef struct FormData_pg_statistic_ext_data + * ---------------- + */ +CATALOG(pg_statistic_ext_data,3429,StatisticExtDataRelationId) +{ + Oid stxoid BKI_LOOKUP(pg_statistic_ext); /* statistics object + * this data is for */ + bool stxdinherit; /* true if inheritance children are included */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + pg_ndistinct stxdndistinct; /* ndistinct coefficients (serialized) */ + pg_dependencies stxddependencies; /* dependencies (serialized) */ + pg_mcv_list stxdmcv; /* MCV (serialized) */ + pg_statistic stxdexpr[1]; /* stats for expressions */ + +#endif + +} FormData_pg_statistic_ext_data; + +/* ---------------- + * Form_pg_statistic_ext_data corresponds to a pointer to a tuple with + * the format of pg_statistic_ext_data relation. + * ---------------- + */ +typedef FormData_pg_statistic_ext_data *Form_pg_statistic_ext_data; + +DECLARE_TOAST(pg_statistic_ext_data, 3430, 3431); + +DECLARE_UNIQUE_INDEX_PKEY(pg_statistic_ext_data_stxoid_inh_index, 3433, StatisticExtDataStxoidInhIndexId, pg_statistic_ext_data, btree(stxoid oid_ops, stxdinherit bool_ops)); + +MAKE_SYSCACHE(STATEXTDATASTXOID, pg_statistic_ext_data_stxoid_inh_index, 4); + +#endif /* PG_STATISTIC_EXT_DATA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data_d.h new file mode 100644 index 0000000000000000000000000000000000000000..931d0fa51c40fda8dc0b8e43193bea8763ad6765 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_statistic_ext_data_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic_ext_data_d.h + * Macro definitions for pg_statistic_ext_data + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_EXT_DATA_D_H +#define PG_STATISTIC_EXT_DATA_D_H + +#define StatisticExtDataRelationId 3429 +#define StatisticExtDataStxoidInhIndexId 3433 + +#define Anum_pg_statistic_ext_data_stxoid 1 +#define Anum_pg_statistic_ext_data_stxdinherit 2 +#define Anum_pg_statistic_ext_data_stxdndistinct 3 +#define Anum_pg_statistic_ext_data_stxddependencies 4 +#define Anum_pg_statistic_ext_data_stxdmcv 5 +#define Anum_pg_statistic_ext_data_stxdexpr 6 + +#define Natts_pg_statistic_ext_data 6 + + +#endif /* PG_STATISTIC_EXT_DATA_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription.h new file mode 100644 index 0000000000000000000000000000000000000000..0aa14ec4a27ed168180648b5bc6874bfd49118db --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription.h @@ -0,0 +1,183 @@ +/* ------------------------------------------------------------------------- + * + * pg_subscription.h + * definition of the "subscription" system catalog (pg_subscription) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_subscription.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_H +#define PG_SUBSCRIPTION_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_subscription_d.h" + +#include "nodes/pg_list.h" + +/* + * two_phase tri-state values. See comments atop worker.c to know more about + * these states. + */ +#define LOGICALREP_TWOPHASE_STATE_DISABLED 'd' +#define LOGICALREP_TWOPHASE_STATE_PENDING 'p' +#define LOGICALREP_TWOPHASE_STATE_ENABLED 'e' + +/* + * The subscription will request the publisher to only send changes that do not + * have any origin. + */ +#define LOGICALREP_ORIGIN_NONE "none" + +/* + * The subscription will request the publisher to send changes regardless + * of their origin. + */ +#define LOGICALREP_ORIGIN_ANY "any" + +/* ---------------- + * pg_subscription definition. cpp turns this into + * typedef struct FormData_pg_subscription + * ---------------- + */ + +/* + * Technically, the subscriptions live inside the database, so a shared catalog + * seems weird, but the replication launcher process needs to access all of + * them to be able to start the workers, so we have to put them in a shared, + * nailed catalog. + * + * CAUTION: There is a GRANT in system_views.sql to grant public select + * access on all columns except subconninfo. When you add a new column + * here, be sure to update that (or, if the new column is not to be publicly + * readable, update associated comments and catalogs.sgml instead). + */ +CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + Oid subdbid BKI_LOOKUP(pg_database); /* Database the + * subscription is in. */ + + XLogRecPtr subskiplsn; /* All changes finished at this LSN are + * skipped */ + + NameData subname; /* Name of the subscription */ + + Oid subowner BKI_LOOKUP(pg_authid); /* Owner of the subscription */ + + bool subenabled; /* True if the subscription is enabled (the + * worker should be running) */ + + bool subbinary; /* True if the subscription wants the + * publisher to send data in binary */ + + char substream; /* Stream in-progress transactions. See + * LOGICALREP_STREAM_xxx constants. */ + + char subtwophasestate; /* Stream two-phase transactions */ + + bool subdisableonerr; /* True if a worker error should cause the + * subscription to be disabled */ + + bool subpasswordrequired; /* Must connection use a password? */ + + bool subrunasowner; /* True if replication should execute as the + * subscription owner */ + + bool subfailover; /* True if the associated replication slots + * (i.e. the main slot and the table sync + * slots) in the upstream database are enabled + * to be synchronized to the standbys. */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* Connection string to the publisher */ + text subconninfo BKI_FORCE_NOT_NULL; + + /* Slot name on publisher */ + NameData subslotname BKI_FORCE_NULL; + + /* Synchronous commit setting for worker */ + text subsynccommit BKI_FORCE_NOT_NULL; + + /* List of publications subscribed to */ + text subpublications[1] BKI_FORCE_NOT_NULL; + + /* Only publish data originating from the specified origin */ + text suborigin BKI_DEFAULT(LOGICALREP_ORIGIN_ANY); +#endif +} FormData_pg_subscription; + +typedef FormData_pg_subscription *Form_pg_subscription; + +DECLARE_TOAST_WITH_MACRO(pg_subscription, 4183, 4184, PgSubscriptionToastTable, PgSubscriptionToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_oid_index, 6114, SubscriptionObjectIndexId, pg_subscription, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_subscription_subname_index, 6115, SubscriptionNameIndexId, pg_subscription, btree(subdbid oid_ops, subname name_ops)); + +MAKE_SYSCACHE(SUBSCRIPTIONOID, pg_subscription_oid_index, 4); +MAKE_SYSCACHE(SUBSCRIPTIONNAME, pg_subscription_subname_index, 4); + +typedef struct Subscription +{ + Oid oid; /* Oid of the subscription */ + Oid dbid; /* Oid of the database which subscription is + * in */ + XLogRecPtr skiplsn; /* All changes finished at this LSN are + * skipped */ + char *name; /* Name of the subscription */ + Oid owner; /* Oid of the subscription owner */ + bool ownersuperuser; /* Is the subscription owner a superuser? */ + bool enabled; /* Indicates if the subscription is enabled */ + bool binary; /* Indicates if the subscription wants data in + * binary format */ + char stream; /* Allow streaming in-progress transactions. + * See LOGICALREP_STREAM_xxx constants. */ + char twophasestate; /* Allow streaming two-phase transactions */ + bool disableonerr; /* Indicates if the subscription should be + * automatically disabled if a worker error + * occurs */ + bool passwordrequired; /* Must connection use a password? */ + bool runasowner; /* Run replication as subscription owner */ + bool failover; /* True if the associated replication slots + * (i.e. the main slot and the table sync + * slots) in the upstream database are enabled + * to be synchronized to the standbys. */ + char *conninfo; /* Connection string to the publisher */ + char *slotname; /* Name of the replication slot */ + char *synccommit; /* Synchronous commit setting for worker */ + List *publications; /* List of publication names to subscribe to */ + char *origin; /* Only publish data originating from the + * specified origin */ +} Subscription; + +/* Disallow streaming in-progress transactions. */ +#define LOGICALREP_STREAM_OFF 'f' + +/* + * Streaming in-progress transactions are written to a temporary file and + * applied only after the transaction is committed on upstream. + */ +#define LOGICALREP_STREAM_ON 't' + +/* + * Streaming in-progress transactions are applied immediately via a parallel + * apply worker. + */ +#define LOGICALREP_STREAM_PARALLEL 'p' + +extern Subscription *GetSubscription(Oid subid, bool missing_ok); +extern void FreeSubscription(Subscription *sub); +extern void DisableSubscription(Oid subid); + +extern int CountDBSubscriptions(Oid dbid); + +#endif /* PG_SUBSCRIPTION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_d.h new file mode 100644 index 0000000000000000000000000000000000000000..a64531365df2f2c03885699a63190513e4d7a629 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_d.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * pg_subscription_d.h + * Macro definitions for pg_subscription + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_D_H +#define PG_SUBSCRIPTION_D_H + +#define SubscriptionRelationId 6100 +#define SubscriptionRelation_Rowtype_Id 6101 +#define PgSubscriptionToastTable 4183 +#define PgSubscriptionToastIndex 4184 +#define SubscriptionObjectIndexId 6114 +#define SubscriptionNameIndexId 6115 + +#define Anum_pg_subscription_oid 1 +#define Anum_pg_subscription_subdbid 2 +#define Anum_pg_subscription_subskiplsn 3 +#define Anum_pg_subscription_subname 4 +#define Anum_pg_subscription_subowner 5 +#define Anum_pg_subscription_subenabled 6 +#define Anum_pg_subscription_subbinary 7 +#define Anum_pg_subscription_substream 8 +#define Anum_pg_subscription_subtwophasestate 9 +#define Anum_pg_subscription_subdisableonerr 10 +#define Anum_pg_subscription_subpasswordrequired 11 +#define Anum_pg_subscription_subrunasowner 12 +#define Anum_pg_subscription_subfailover 13 +#define Anum_pg_subscription_subconninfo 14 +#define Anum_pg_subscription_subslotname 15 +#define Anum_pg_subscription_subsynccommit 16 +#define Anum_pg_subscription_subpublications 17 +#define Anum_pg_subscription_suborigin 18 + +#define Natts_pg_subscription 18 + + +#endif /* PG_SUBSCRIPTION_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel.h new file mode 100644 index 0000000000000000000000000000000000000000..8244ad537aea9d3989125e877fbc7ef5ad91fc6e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel.h @@ -0,0 +1,95 @@ +/* ------------------------------------------------------------------------- + * + * pg_subscription_rel.h + * definition of the system catalog containing the state for each + * replicated table in each subscription (pg_subscription_rel) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_subscription_rel.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + * ------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_REL_H +#define PG_SUBSCRIPTION_REL_H + +#include "access/xlogdefs.h" +#include "catalog/genbki.h" +#include "catalog/pg_subscription_rel_d.h" +#include "nodes/pg_list.h" + +/* ---------------- + * pg_subscription_rel definition. cpp turns this into + * typedef struct FormData_pg_subscription_rel + * ---------------- + */ +CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId) +{ + Oid srsubid BKI_LOOKUP(pg_subscription); /* Oid of subscription */ + Oid srrelid BKI_LOOKUP(pg_class); /* Oid of relation */ + char srsubstate; /* state of the relation in subscription */ + + /* + * Although srsublsn is a fixed-width type, it is allowed to be NULL, so + * we prevent direct C code access to it just as for a varlena field. + */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + XLogRecPtr srsublsn BKI_FORCE_NULL; /* remote LSN of the state change + * used for synchronization + * coordination, or NULL if not + * valid */ +#endif +} FormData_pg_subscription_rel; + +typedef FormData_pg_subscription_rel *Form_pg_subscription_rel; + +DECLARE_UNIQUE_INDEX_PKEY(pg_subscription_rel_srrelid_srsubid_index, 6117, SubscriptionRelSrrelidSrsubidIndexId, pg_subscription_rel, btree(srrelid oid_ops, srsubid oid_ops)); + +MAKE_SYSCACHE(SUBSCRIPTIONRELMAP, pg_subscription_rel_srrelid_srsubid_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* ---------------- + * substate constants + * ---------------- + */ +#define SUBREL_STATE_INIT 'i' /* initializing (sublsn NULL) */ +#define SUBREL_STATE_DATASYNC 'd' /* data is being synchronized (sublsn + * NULL) */ +#define SUBREL_STATE_FINISHEDCOPY 'f' /* tablesync copy phase is completed + * (sublsn NULL) */ +#define SUBREL_STATE_SYNCDONE 's' /* synchronization finished in front of + * apply (sublsn set) */ +#define SUBREL_STATE_READY 'r' /* ready (sublsn set) */ + +/* These are never stored in the catalog, we only use them for IPC. */ +#define SUBREL_STATE_UNKNOWN '\0' /* unknown state */ +#define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */ +#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +typedef struct SubscriptionRelState +{ + Oid relid; + XLogRecPtr lsn; + char state; +} SubscriptionRelState; + +extern void AddSubscriptionRelState(Oid subid, Oid relid, char state, + XLogRecPtr sublsn, bool retain_lock); +extern void UpdateSubscriptionRelState(Oid subid, Oid relid, char state, + XLogRecPtr sublsn); +extern char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn); +extern void RemoveSubscriptionRel(Oid subid, Oid relid); + +extern bool HasSubscriptionRelations(Oid subid); +extern List *GetSubscriptionRelations(Oid subid, bool not_ready); + +#endif /* PG_SUBSCRIPTION_REL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel_d.h new file mode 100644 index 0000000000000000000000000000000000000000..226058dbc02f6aa50fc0b402a02e47ae755e7aa1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_subscription_rel_d.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_subscription_rel_d.h + * Macro definitions for pg_subscription_rel + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SUBSCRIPTION_REL_D_H +#define PG_SUBSCRIPTION_REL_D_H + +#define SubscriptionRelRelationId 6102 +#define SubscriptionRelSrrelidSrsubidIndexId 6117 + +#define Anum_pg_subscription_rel_srsubid 1 +#define Anum_pg_subscription_rel_srrelid 2 +#define Anum_pg_subscription_rel_srsubstate 3 +#define Anum_pg_subscription_rel_srsublsn 4 + +#define Natts_pg_subscription_rel 4 + + +/* ---------------- + * substate constants + * ---------------- + */ +#define SUBREL_STATE_INIT 'i' /* initializing (sublsn NULL) */ +#define SUBREL_STATE_DATASYNC 'd' /* data is being synchronized (sublsn + * NULL) */ +#define SUBREL_STATE_FINISHEDCOPY 'f' /* tablesync copy phase is completed + * (sublsn NULL) */ +#define SUBREL_STATE_SYNCDONE 's' /* synchronization finished in front of + * apply (sublsn set) */ +#define SUBREL_STATE_READY 'r' /* ready (sublsn set) */ + +/* These are never stored in the catalog, we only use them for IPC. */ +#define SUBREL_STATE_UNKNOWN '\0' /* unknown state */ +#define SUBREL_STATE_SYNCWAIT 'w' /* waiting for sync */ +#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ + + +#endif /* PG_SUBSCRIPTION_REL_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace.h new file mode 100644 index 0000000000000000000000000000000000000000..6b9bdcf8b05ecc56411b7bc590c4ac0212a3ff5c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_tablespace.h + * definition of the "tablespace" system catalog (pg_tablespace) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_tablespace.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TABLESPACE_H +#define PG_TABLESPACE_H + +#include "catalog/genbki.h" +#include "catalog/pg_tablespace_d.h" + +/* ---------------- + * pg_tablespace definition. cpp turns this into + * typedef struct FormData_pg_tablespace + * ---------------- + */ +CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION +{ + Oid oid; /* oid */ + NameData spcname; /* tablespace name */ + + /* owner of tablespace */ + Oid spcowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + aclitem spcacl[1]; /* access permissions */ + text spcoptions[1]; /* per-tablespace options */ +#endif +} FormData_pg_tablespace; + +/* ---------------- + * Form_pg_tablespace corresponds to a pointer to a tuple with + * the format of pg_tablespace relation. + * ---------------- + */ +typedef FormData_pg_tablespace *Form_pg_tablespace; + +DECLARE_TOAST_WITH_MACRO(pg_tablespace, 4185, 4186, PgTablespaceToastTable, PgTablespaceToastIndex); + +DECLARE_UNIQUE_INDEX_PKEY(pg_tablespace_oid_index, 2697, TablespaceOidIndexId, pg_tablespace, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, TablespaceNameIndexId, pg_tablespace, btree(spcname name_ops)); + +MAKE_SYSCACHE(TABLESPACEOID, pg_tablespace_oid_index, 4); + +#endif /* PG_TABLESPACE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace_d.h new file mode 100644 index 0000000000000000000000000000000000000000..be39f1db3da28559184327ffbf4956733b07d6a9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_tablespace_d.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_tablespace_d.h + * Macro definitions for pg_tablespace + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TABLESPACE_D_H +#define PG_TABLESPACE_D_H + +#define TableSpaceRelationId 1213 +#define PgTablespaceToastTable 4185 +#define PgTablespaceToastIndex 4186 +#define TablespaceOidIndexId 2697 +#define TablespaceNameIndexId 2698 + +#define Anum_pg_tablespace_oid 1 +#define Anum_pg_tablespace_spcname 2 +#define Anum_pg_tablespace_spcowner 3 +#define Anum_pg_tablespace_spcacl 4 +#define Anum_pg_tablespace_spcoptions 5 + +#define Natts_pg_tablespace 5 + +#define DEFAULTTABLESPACE_OID 1663 +#define GLOBALTABLESPACE_OID 1664 + +#endif /* PG_TABLESPACE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_transform.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_transform.h new file mode 100644 index 0000000000000000000000000000000000000000..3b69960af60462140e550d6b6e7c080b3ad0dc26 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_transform.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_transform.h + * definition of the "transform" system catalog (pg_transform) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_transform.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRANSFORM_H +#define PG_TRANSFORM_H + +#include "catalog/genbki.h" +#include "catalog/pg_transform_d.h" + +/* ---------------- + * pg_transform definition. cpp turns this into + * typedef struct FormData_pg_transform + * ---------------- + */ +CATALOG(pg_transform,3576,TransformRelationId) +{ + Oid oid; /* oid */ + Oid trftype BKI_LOOKUP(pg_type); + Oid trflang BKI_LOOKUP(pg_language); + regproc trffromsql BKI_LOOKUP_OPT(pg_proc); + regproc trftosql BKI_LOOKUP_OPT(pg_proc); +} FormData_pg_transform; + +/* ---------------- + * Form_pg_transform corresponds to a pointer to a tuple with + * the format of pg_transform relation. + * ---------------- + */ +typedef FormData_pg_transform *Form_pg_transform; + +DECLARE_UNIQUE_INDEX_PKEY(pg_transform_oid_index, 3574, TransformOidIndexId, pg_transform, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_transform_type_lang_index, 3575, TransformTypeLangIndexId, pg_transform, btree(trftype oid_ops, trflang oid_ops)); + +MAKE_SYSCACHE(TRFOID, pg_transform_oid_index, 16); +MAKE_SYSCACHE(TRFTYPELANG, pg_transform_type_lang_index, 16); + +#endif /* PG_TRANSFORM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_transform_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_transform_d.h new file mode 100644 index 0000000000000000000000000000000000000000..fc4aa45a6b68f9cd0140ac05a0fb51bff1c682d6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_transform_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_transform_d.h + * Macro definitions for pg_transform + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRANSFORM_D_H +#define PG_TRANSFORM_D_H + +#define TransformRelationId 3576 +#define TransformOidIndexId 3574 +#define TransformTypeLangIndexId 3575 + +#define Anum_pg_transform_oid 1 +#define Anum_pg_transform_trftype 2 +#define Anum_pg_transform_trflang 3 +#define Anum_pg_transform_trffromsql 4 +#define Anum_pg_transform_trftosql 5 + +#define Natts_pg_transform 5 + + +#endif /* PG_TRANSFORM_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger.h new file mode 100644 index 0000000000000000000000000000000000000000..7fdff1611840566f0bca45ebf5f169ba9f5a5360 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger.h @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------- + * + * pg_trigger.h + * definition of the "trigger" system catalog (pg_trigger) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_trigger.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRIGGER_H +#define PG_TRIGGER_H + +#include "catalog/genbki.h" +#include "catalog/pg_trigger_d.h" + +/* ---------------- + * pg_trigger definition. cpp turns this into + * typedef struct FormData_pg_trigger + * + * Note: when tgconstraint is nonzero, tgconstrrelid, tgconstrindid, + * tgdeferrable, and tginitdeferred are largely redundant with the referenced + * pg_constraint entry. However, it is possible for a non-deferrable trigger + * to be associated with a deferrable constraint. + * ---------------- + */ +CATALOG(pg_trigger,2620,TriggerRelationId) +{ + Oid oid; /* oid */ + Oid tgrelid BKI_LOOKUP(pg_class); /* relation trigger is + * attached to */ + Oid tgparentid BKI_LOOKUP_OPT(pg_trigger); /* OID of parent + * trigger, if any */ + NameData tgname; /* trigger's name */ + Oid tgfoid BKI_LOOKUP(pg_proc); /* OID of function to be called */ + int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT, + * ROW/STATEMENT; see below */ + char tgenabled; /* trigger's firing configuration WRT + * session_replication_role */ + bool tgisinternal; /* trigger is system-generated */ + Oid tgconstrrelid BKI_LOOKUP_OPT(pg_class); /* constraint's FROM + * table, if any */ + Oid tgconstrindid BKI_LOOKUP_OPT(pg_class); /* constraint's + * supporting index, if + * any */ + Oid tgconstraint BKI_LOOKUP_OPT(pg_constraint); /* associated + * pg_constraint entry, + * if any */ + bool tgdeferrable; /* constraint trigger is deferrable */ + bool tginitdeferred; /* constraint trigger is deferred initially */ + int16 tgnargs; /* # of extra arguments in tgargs */ + + /* + * Variable-length fields start here, but we allow direct access to + * tgattr. Note: tgattr and tgargs must not be null. + */ + int2vector tgattr BKI_FORCE_NOT_NULL; /* column numbers, if trigger is + * on columns */ + +#ifdef CATALOG_VARLEN + bytea tgargs BKI_FORCE_NOT_NULL; /* first\000second\000tgnargs\000 */ + pg_node_tree tgqual; /* WHEN expression, or NULL if none */ + NameData tgoldtable; /* old transition table, or NULL if none */ + NameData tgnewtable; /* new transition table, or NULL if none */ +#endif +} FormData_pg_trigger; + +/* ---------------- + * Form_pg_trigger corresponds to a pointer to a tuple with + * the format of pg_trigger relation. + * ---------------- + */ +typedef FormData_pg_trigger *Form_pg_trigger; + +DECLARE_TOAST(pg_trigger, 2336, 2337); + +DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, TriggerConstraintIndexId, pg_trigger, btree(tgconstraint oid_ops)); +DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, TriggerRelidNameIndexId, pg_trigger, btree(tgrelid oid_ops, tgname name_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_trigger_oid_index, 2702, TriggerOidIndexId, pg_trigger, btree(oid oid_ops)); + +DECLARE_ARRAY_FOREIGN_KEY((tgrelid, tgattr), pg_attribute, (attrelid, attnum)); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* Bits within tgtype */ +#define TRIGGER_TYPE_ROW (1 << 0) +#define TRIGGER_TYPE_BEFORE (1 << 1) +#define TRIGGER_TYPE_INSERT (1 << 2) +#define TRIGGER_TYPE_DELETE (1 << 3) +#define TRIGGER_TYPE_UPDATE (1 << 4) +#define TRIGGER_TYPE_TRUNCATE (1 << 5) +#define TRIGGER_TYPE_INSTEAD (1 << 6) + +#define TRIGGER_TYPE_LEVEL_MASK (TRIGGER_TYPE_ROW) +#define TRIGGER_TYPE_STATEMENT 0 + +/* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */ +#define TRIGGER_TYPE_TIMING_MASK \ + (TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD) +#define TRIGGER_TYPE_AFTER 0 + +#define TRIGGER_TYPE_EVENT_MASK \ + (TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE) + +/* Macros for manipulating tgtype */ +#define TRIGGER_CLEAR_TYPE(type) ((type) = 0) + +#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) +#define TRIGGER_SETT_STATEMENT(type) ((type) |= TRIGGER_TYPE_STATEMENT) +#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) +#define TRIGGER_SETT_AFTER(type) ((type) |= TRIGGER_TYPE_AFTER) +#define TRIGGER_SETT_INSTEAD(type) ((type) |= TRIGGER_TYPE_INSTEAD) +#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) +#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) +#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) +#define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE) + +#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) +#define TRIGGER_FOR_BEFORE(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE) +#define TRIGGER_FOR_AFTER(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER) +#define TRIGGER_FOR_INSTEAD(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD) +#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) +#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) +#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) +#define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE) + +/* + * Efficient macro for checking if tgtype matches a particular level + * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE, + * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT, + * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE). Note + * that a tgtype can match more than one event, but only one level or timing. + */ +#define TRIGGER_TYPE_MATCHES(type, level, timing, event) \ + (((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event))) + +/* + * Macro to determine whether tgnewtable or tgoldtable has been specified for + * a trigger. + */ +#define TRIGGER_USES_TRANSITION_TABLE(namepointer) \ + ((namepointer) != (char *) NULL) + +#endif /* EXPOSE_TO_CLIENT_CODE */ + +#endif /* PG_TRIGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger_d.h new file mode 100644 index 0000000000000000000000000000000000000000..9fdf780f59e7f09dfb8c7a9c1b96d412bb59ffcf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_trigger_d.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------------------- + * + * pg_trigger_d.h + * Macro definitions for pg_trigger + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TRIGGER_D_H +#define PG_TRIGGER_D_H + +#define TriggerRelationId 2620 +#define TriggerConstraintIndexId 2699 +#define TriggerRelidNameIndexId 2701 +#define TriggerOidIndexId 2702 + +#define Anum_pg_trigger_oid 1 +#define Anum_pg_trigger_tgrelid 2 +#define Anum_pg_trigger_tgparentid 3 +#define Anum_pg_trigger_tgname 4 +#define Anum_pg_trigger_tgfoid 5 +#define Anum_pg_trigger_tgtype 6 +#define Anum_pg_trigger_tgenabled 7 +#define Anum_pg_trigger_tgisinternal 8 +#define Anum_pg_trigger_tgconstrrelid 9 +#define Anum_pg_trigger_tgconstrindid 10 +#define Anum_pg_trigger_tgconstraint 11 +#define Anum_pg_trigger_tgdeferrable 12 +#define Anum_pg_trigger_tginitdeferred 13 +#define Anum_pg_trigger_tgnargs 14 +#define Anum_pg_trigger_tgattr 15 +#define Anum_pg_trigger_tgargs 16 +#define Anum_pg_trigger_tgqual 17 +#define Anum_pg_trigger_tgoldtable 18 +#define Anum_pg_trigger_tgnewtable 19 + +#define Natts_pg_trigger 19 + + +/* Bits within tgtype */ +#define TRIGGER_TYPE_ROW (1 << 0) +#define TRIGGER_TYPE_BEFORE (1 << 1) +#define TRIGGER_TYPE_INSERT (1 << 2) +#define TRIGGER_TYPE_DELETE (1 << 3) +#define TRIGGER_TYPE_UPDATE (1 << 4) +#define TRIGGER_TYPE_TRUNCATE (1 << 5) +#define TRIGGER_TYPE_INSTEAD (1 << 6) + +#define TRIGGER_TYPE_LEVEL_MASK (TRIGGER_TYPE_ROW) +#define TRIGGER_TYPE_STATEMENT 0 + +/* Note bits within TRIGGER_TYPE_TIMING_MASK aren't adjacent */ +#define TRIGGER_TYPE_TIMING_MASK \ + (TRIGGER_TYPE_BEFORE | TRIGGER_TYPE_INSTEAD) +#define TRIGGER_TYPE_AFTER 0 + +#define TRIGGER_TYPE_EVENT_MASK \ + (TRIGGER_TYPE_INSERT | TRIGGER_TYPE_DELETE | TRIGGER_TYPE_UPDATE | TRIGGER_TYPE_TRUNCATE) + +/* Macros for manipulating tgtype */ +#define TRIGGER_CLEAR_TYPE(type) ((type) = 0) + +#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) +#define TRIGGER_SETT_STATEMENT(type) ((type) |= TRIGGER_TYPE_STATEMENT) +#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) +#define TRIGGER_SETT_AFTER(type) ((type) |= TRIGGER_TYPE_AFTER) +#define TRIGGER_SETT_INSTEAD(type) ((type) |= TRIGGER_TYPE_INSTEAD) +#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) +#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) +#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) +#define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE) + +#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) +#define TRIGGER_FOR_BEFORE(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_BEFORE) +#define TRIGGER_FOR_AFTER(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_AFTER) +#define TRIGGER_FOR_INSTEAD(type) (((type) & TRIGGER_TYPE_TIMING_MASK) == TRIGGER_TYPE_INSTEAD) +#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) +#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) +#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) +#define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE) + +/* + * Efficient macro for checking if tgtype matches a particular level + * (TRIGGER_TYPE_ROW or TRIGGER_TYPE_STATEMENT), timing (TRIGGER_TYPE_BEFORE, + * TRIGGER_TYPE_AFTER or TRIGGER_TYPE_INSTEAD), and event (TRIGGER_TYPE_INSERT, + * TRIGGER_TYPE_DELETE, TRIGGER_TYPE_UPDATE, or TRIGGER_TYPE_TRUNCATE). Note + * that a tgtype can match more than one event, but only one level or timing. + */ +#define TRIGGER_TYPE_MATCHES(type, level, timing, event) \ + (((type) & (TRIGGER_TYPE_LEVEL_MASK | TRIGGER_TYPE_TIMING_MASK | (event))) == ((level) | (timing) | (event))) + +/* + * Macro to determine whether tgnewtable or tgoldtable has been specified for + * a trigger. + */ +#define TRIGGER_USES_TRANSITION_TABLE(namepointer) \ + ((namepointer) != (char *) NULL) + + +#endif /* PG_TRIGGER_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config.h new file mode 100644 index 0000000000000000000000000000000000000000..fc0bf447b1d078987c2a22f16f37b3f6794f4310 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config.h + * definition of the "text search configuration" system catalog + * (pg_ts_config) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_config.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_H +#define PG_TS_CONFIG_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_config_d.h" + +/* ---------------- + * pg_ts_config definition. cpp turns this into + * typedef struct FormData_pg_ts_config + * ---------------- + */ +CATALOG(pg_ts_config,3602,TSConfigRelationId) +{ + /* oid */ + Oid oid; + + /* name of configuration */ + NameData cfgname; + + /* name space */ + Oid cfgnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner */ + Oid cfgowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* OID of parser */ + Oid cfgparser BKI_LOOKUP(pg_ts_parser); +} FormData_pg_ts_config; + +typedef FormData_pg_ts_config *Form_pg_ts_config; + +DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, TSConfigNameNspIndexId, pg_ts_config, btree(cfgname name_ops, cfgnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_config_oid_index, 3712, TSConfigOidIndexId, pg_ts_config, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSCONFIGNAMENSP, pg_ts_config_cfgname_index, 2); +MAKE_SYSCACHE(TSCONFIGOID, pg_ts_config_oid_index, 2); + +#endif /* PG_TS_CONFIG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_d.h new file mode 100644 index 0000000000000000000000000000000000000000..01da60644d38afbbf6d5ad566d3f12127b64a5ee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_d.h + * Macro definitions for pg_ts_config + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_D_H +#define PG_TS_CONFIG_D_H + +#define TSConfigRelationId 3602 +#define TSConfigNameNspIndexId 3608 +#define TSConfigOidIndexId 3712 + +#define Anum_pg_ts_config_oid 1 +#define Anum_pg_ts_config_cfgname 2 +#define Anum_pg_ts_config_cfgnamespace 3 +#define Anum_pg_ts_config_cfgowner 4 +#define Anum_pg_ts_config_cfgparser 5 + +#define Natts_pg_ts_config 5 + + +#endif /* PG_TS_CONFIG_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map.h new file mode 100644 index 0000000000000000000000000000000000000000..efced44941dd6a5b07ad0ecf60472f1bdc99893d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_map.h + * definition of the system catalog for text search token mappings + * (pg_ts_config_map) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_config_map.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_MAP_H +#define PG_TS_CONFIG_MAP_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_config_map_d.h" + +/* ---------------- + * pg_ts_config_map definition. cpp turns this into + * typedef struct FormData_pg_ts_config_map + * ---------------- + */ +CATALOG(pg_ts_config_map,3603,TSConfigMapRelationId) +{ + /* OID of configuration owning this entry */ + Oid mapcfg BKI_LOOKUP(pg_ts_config); + + /* token type from parser */ + int32 maptokentype; + + /* order in which to consult dictionaries */ + int32 mapseqno; + + /* dictionary to consult */ + Oid mapdict BKI_LOOKUP(pg_ts_dict); +} FormData_pg_ts_config_map; + +typedef FormData_pg_ts_config_map *Form_pg_ts_config_map; + +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_config_map_index, 3609, TSConfigMapIndexId, pg_ts_config_map, btree(mapcfg oid_ops, maptokentype int4_ops, mapseqno int4_ops)); + +MAKE_SYSCACHE(TSCONFIGMAP, pg_ts_config_map_index, 2); + +#endif /* PG_TS_CONFIG_MAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map_d.h new file mode 100644 index 0000000000000000000000000000000000000000..f3d394c6f3102a40c92db8f94442facea0162e9d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_config_map_d.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_config_map_d.h + * Macro definitions for pg_ts_config_map + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_CONFIG_MAP_D_H +#define PG_TS_CONFIG_MAP_D_H + +#define TSConfigMapRelationId 3603 +#define TSConfigMapIndexId 3609 + +#define Anum_pg_ts_config_map_mapcfg 1 +#define Anum_pg_ts_config_map_maptokentype 2 +#define Anum_pg_ts_config_map_mapseqno 3 +#define Anum_pg_ts_config_map_mapdict 4 + +#define Natts_pg_ts_config_map 4 + + +#endif /* PG_TS_CONFIG_MAP_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict.h new file mode 100644 index 0000000000000000000000000000000000000000..1320468de0e1d968c0b5464cece4cee329c750d7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_dict.h + * definition of the "text search dictionary" system catalog (pg_ts_dict) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_dict.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_DICT_H +#define PG_TS_DICT_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_dict_d.h" + +/* ---------------- + * pg_ts_dict definition. cpp turns this into + * typedef struct FormData_pg_ts_dict + * ---------------- + */ +CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) +{ + /* oid */ + Oid oid; + + /* dictionary name */ + NameData dictname; + + /* name space */ + Oid dictnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* owner */ + Oid dictowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* dictionary's template */ + Oid dicttemplate BKI_LOOKUP(pg_ts_template); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + /* options passed to dict_init() */ + text dictinitoption; +#endif +} FormData_pg_ts_dict; + +typedef FormData_pg_ts_dict *Form_pg_ts_dict; + +DECLARE_TOAST(pg_ts_dict, 4169, 4170); + +DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, TSDictionaryNameNspIndexId, pg_ts_dict, btree(dictname name_ops, dictnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_dict_oid_index, 3605, TSDictionaryOidIndexId, pg_ts_dict, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSDICTNAMENSP, pg_ts_dict_dictname_index, 2); +MAKE_SYSCACHE(TSDICTOID, pg_ts_dict_oid_index, 2); + +#endif /* PG_TS_DICT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict_d.h new file mode 100644 index 0000000000000000000000000000000000000000..73f18e8d80f8b5247894c5053e5d4343d64f6b3d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_dict_d.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_dict_d.h + * Macro definitions for pg_ts_dict + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_DICT_D_H +#define PG_TS_DICT_D_H + +#define TSDictionaryRelationId 3600 +#define TSDictionaryNameNspIndexId 3604 +#define TSDictionaryOidIndexId 3605 + +#define Anum_pg_ts_dict_oid 1 +#define Anum_pg_ts_dict_dictname 2 +#define Anum_pg_ts_dict_dictnamespace 3 +#define Anum_pg_ts_dict_dictowner 4 +#define Anum_pg_ts_dict_dicttemplate 5 +#define Anum_pg_ts_dict_dictinitoption 6 + +#define Natts_pg_ts_dict 6 + + +#endif /* PG_TS_DICT_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser.h new file mode 100644 index 0000000000000000000000000000000000000000..909644c96f2ecad0696312a54d2114756de6bd9f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_parser.h + * definition of the "text search parser" system catalog (pg_ts_parser) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_parser.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_PARSER_H +#define PG_TS_PARSER_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_parser_d.h" + +/* ---------------- + * pg_ts_parser definition. cpp turns this into + * typedef struct FormData_pg_ts_parser + * ---------------- + */ +CATALOG(pg_ts_parser,3601,TSParserRelationId) +{ + Oid oid; /* oid */ + + /* parser's name */ + NameData prsname; + + /* name space */ + Oid prsnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* init parsing session */ + regproc prsstart BKI_LOOKUP(pg_proc); + + /* return next token */ + regproc prstoken BKI_LOOKUP(pg_proc); + + /* finalize parsing session */ + regproc prsend BKI_LOOKUP(pg_proc); + + /* return data for headline creation */ + regproc prsheadline BKI_LOOKUP_OPT(pg_proc); + + /* return descriptions of lexeme's types */ + regproc prslextype BKI_LOOKUP(pg_proc); +} FormData_pg_ts_parser; + +typedef FormData_pg_ts_parser *Form_pg_ts_parser; + +DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, TSParserNameNspIndexId, pg_ts_parser, btree(prsname name_ops, prsnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_parser_oid_index, 3607, TSParserOidIndexId, pg_ts_parser, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSPARSERNAMENSP, pg_ts_parser_prsname_index, 2); +MAKE_SYSCACHE(TSPARSEROID, pg_ts_parser_oid_index, 2); + +#endif /* PG_TS_PARSER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser_d.h new file mode 100644 index 0000000000000000000000000000000000000000..c9125c386ce781c12ee94b0cc1f61925b4bc7345 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_parser_d.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_parser_d.h + * Macro definitions for pg_ts_parser + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_PARSER_D_H +#define PG_TS_PARSER_D_H + +#define TSParserRelationId 3601 +#define TSParserNameNspIndexId 3606 +#define TSParserOidIndexId 3607 + +#define Anum_pg_ts_parser_oid 1 +#define Anum_pg_ts_parser_prsname 2 +#define Anum_pg_ts_parser_prsnamespace 3 +#define Anum_pg_ts_parser_prsstart 4 +#define Anum_pg_ts_parser_prstoken 5 +#define Anum_pg_ts_parser_prsend 6 +#define Anum_pg_ts_parser_prsheadline 7 +#define Anum_pg_ts_parser_prslextype 8 + +#define Natts_pg_ts_parser 8 + + +#endif /* PG_TS_PARSER_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template.h new file mode 100644 index 0000000000000000000000000000000000000000..0562a4a7583b9846a095c4b0f6fb5fc6a54c5172 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_template.h + * definition of the "text search template" system catalog (pg_ts_template) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_ts_template.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_TEMPLATE_H +#define PG_TS_TEMPLATE_H + +#include "catalog/genbki.h" +#include "catalog/pg_ts_template_d.h" + +/* ---------------- + * pg_ts_template definition. cpp turns this into + * typedef struct FormData_pg_ts_template + * ---------------- + */ +CATALOG(pg_ts_template,3764,TSTemplateRelationId) +{ + Oid oid; /* oid */ + + /* template name */ + NameData tmplname; + + /* name space */ + Oid tmplnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* initialization method of dict (may be 0) */ + regproc tmplinit BKI_LOOKUP_OPT(pg_proc); + + /* base method of dictionary */ + regproc tmpllexize BKI_LOOKUP(pg_proc); +} FormData_pg_ts_template; + +typedef FormData_pg_ts_template *Form_pg_ts_template; + +DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, TSTemplateNameNspIndexId, pg_ts_template, btree(tmplname name_ops, tmplnamespace oid_ops)); +DECLARE_UNIQUE_INDEX_PKEY(pg_ts_template_oid_index, 3767, TSTemplateOidIndexId, pg_ts_template, btree(oid oid_ops)); + +MAKE_SYSCACHE(TSTEMPLATENAMENSP, pg_ts_template_tmplname_index, 2); +MAKE_SYSCACHE(TSTEMPLATEOID, pg_ts_template_oid_index, 2); + +#endif /* PG_TS_TEMPLATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template_d.h new file mode 100644 index 0000000000000000000000000000000000000000..fa6cd107537227b75d0bc3af88e519fca74907e8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_ts_template_d.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * pg_ts_template_d.h + * Macro definitions for pg_ts_template + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TS_TEMPLATE_D_H +#define PG_TS_TEMPLATE_D_H + +#define TSTemplateRelationId 3764 +#define TSTemplateNameNspIndexId 3766 +#define TSTemplateOidIndexId 3767 + +#define Anum_pg_ts_template_oid 1 +#define Anum_pg_ts_template_tmplname 2 +#define Anum_pg_ts_template_tmplnamespace 3 +#define Anum_pg_ts_template_tmplinit 4 +#define Anum_pg_ts_template_tmpllexize 5 + +#define Natts_pg_ts_template 5 + + +#endif /* PG_TS_TEMPLATE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_type.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_type.h new file mode 100644 index 0000000000000000000000000000000000000000..e9259697321dae6519f38db1390561adf35eec5a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_type.h @@ -0,0 +1,407 @@ +/*------------------------------------------------------------------------- + * + * pg_type.h + * definition of the "type" system catalog (pg_type) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_type.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_H +#define PG_TYPE_H + +#include "catalog/genbki.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_type_d.h" +#include "nodes/nodes.h" + +/* ---------------- + * pg_type definition. cpp turns this into + * typedef struct FormData_pg_type + * + * Some of the values in a pg_type instance are copied into + * pg_attribute instances. Some parts of Postgres use the pg_type copy, + * while others use the pg_attribute copy, so they must match. + * See struct FormData_pg_attribute for details. + * ---------------- + */ +CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelation_Rowtype_Id) BKI_SCHEMA_MACRO +{ + Oid oid; /* oid */ + + /* type name */ + NameData typname; + + /* OID of namespace containing this type */ + Oid typnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace); + + /* type owner */ + Oid typowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid); + + /* + * For a fixed-size type, typlen is the number of bytes we use to + * represent a value of this type, e.g. 4 for an int4. But for a + * variable-length type, typlen is negative. We use -1 to indicate a + * "varlena" type (one that has a length word), -2 to indicate a + * null-terminated C string. + */ + int16 typlen BKI_ARRAY_DEFAULT(-1); + + /* + * typbyval determines whether internal Postgres routines pass a value of + * this type by value or by reference. typbyval had better be false if + * the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines). + * Variable-length types are always passed by reference. Note that + * typbyval can be false even if the length would allow pass-by-value; for + * example, type macaddr8 is pass-by-ref even when Datum is 8 bytes. + */ + bool typbyval BKI_ARRAY_DEFAULT(f); + + /* + * typtype is 'b' for a base type, 'c' for a composite type (e.g., a + * table's rowtype), 'd' for a domain, 'e' for an enum type, 'p' for a + * pseudo-type, or 'r' for a range type. (Use the TYPTYPE macros below.) + * + * If typtype is 'c', typrelid is the OID of the class' entry in pg_class. + */ + char typtype BKI_DEFAULT(b) BKI_ARRAY_DEFAULT(b); + + /* + * typcategory and typispreferred help the parser distinguish preferred + * and non-preferred coercions. The category can be any single ASCII + * character (but not \0). The categories used for built-in types are + * identified by the TYPCATEGORY macros below. + */ + + /* arbitrary type classification */ + char typcategory BKI_ARRAY_DEFAULT(A); + + /* is type "preferred" within its category? */ + bool typispreferred BKI_DEFAULT(f) BKI_ARRAY_DEFAULT(f); + + /* + * If typisdefined is false, the entry is only a placeholder (forward + * reference). We know the type's name and owner, but not yet anything + * else about it. + */ + bool typisdefined BKI_DEFAULT(t); + + /* delimiter for arrays of this type */ + char typdelim BKI_DEFAULT(','); + + /* associated pg_class OID if a composite type, else 0 */ + Oid typrelid BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_class); + + /* + * Type-specific subscripting handler. If typsubscript is 0, it means + * that this type doesn't support subscripting. Note that various parts + * of the system deem types to be "true" array types only if their + * typsubscript is array_subscript_handler. + */ + regproc typsubscript BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_subscript_handler) BKI_LOOKUP_OPT(pg_proc); + + /* + * If typelem is not 0 then it identifies another row in pg_type, defining + * the type yielded by subscripting. This should be 0 if typsubscript is + * 0. However, it can be 0 when typsubscript isn't 0, if the handler + * doesn't need typelem to determine the subscripting result type. Note + * that a typelem dependency is considered to imply physical containment + * of the element type in this type; so DDL changes on the element type + * might be restricted by the presence of this type. + */ + Oid typelem BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * If there is a "true" array type having this type as element type, + * typarray links to it. Zero if no associated "true" array type. + */ + Oid typarray BKI_DEFAULT(0) BKI_ARRAY_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * I/O conversion procedures for the datatype. + */ + + /* text format (required) */ + regproc typinput BKI_ARRAY_DEFAULT(array_in) BKI_LOOKUP(pg_proc); + regproc typoutput BKI_ARRAY_DEFAULT(array_out) BKI_LOOKUP(pg_proc); + + /* binary format (optional) */ + regproc typreceive BKI_ARRAY_DEFAULT(array_recv) BKI_LOOKUP_OPT(pg_proc); + regproc typsend BKI_ARRAY_DEFAULT(array_send) BKI_LOOKUP_OPT(pg_proc); + + /* + * I/O functions for optional type modifiers. + */ + regproc typmodin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + regproc typmodout BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc); + + /* + * Custom ANALYZE procedure for the datatype (0 selects the default). + */ + regproc typanalyze BKI_DEFAULT(-) BKI_ARRAY_DEFAULT(array_typanalyze) BKI_LOOKUP_OPT(pg_proc); + + /* ---------------- + * typalign is the alignment required when storing a value of this + * type. It applies to storage on disk as well as most + * representations of the value inside Postgres. When multiple values + * are stored consecutively, such as in the representation of a + * complete row on disk, padding is inserted before a datum of this + * type so that it begins on the specified boundary. The alignment + * reference is the beginning of the first datum in the sequence. + * + * 'c' = CHAR alignment, ie no alignment needed. + * 's' = SHORT alignment (2 bytes on most machines). + * 'i' = INT alignment (4 bytes on most machines). + * 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all). + * (Use the TYPALIGN macros below for these.) + * + * See include/access/tupmacs.h for the macros that compute these + * alignment requirements. Note also that we allow the nominal alignment + * to be violated when storing "packed" varlenas; the TOAST mechanism + * takes care of hiding that from most code. + * + * NOTE: for types used in system tables, it is critical that the + * size and alignment defined in pg_type agree with the way that the + * compiler will lay out the field in a struct representing a table row. + * ---------------- + */ + char typalign; + + /* ---------------- + * typstorage tells if the type is prepared for toasting and what + * the default strategy for attributes of this type should be. + * + * 'p' PLAIN type not prepared for toasting + * 'e' EXTERNAL external storage possible, don't try to compress + * 'x' EXTENDED try to compress and store external if required + * 'm' MAIN like 'x' but try to keep in main tuple + * (Use the TYPSTORAGE macros below for these.) + * + * Note that 'm' fields can also be moved out to secondary storage, + * but only as a last resort ('e' and 'x' fields are moved first). + * ---------------- + */ + char typstorage BKI_DEFAULT(p) BKI_ARRAY_DEFAULT(x); + + /* + * This flag represents a "NOT NULL" constraint against this datatype. + * + * If true, the attnotnull column for a corresponding table column using + * this datatype will always enforce the NOT NULL constraint. + * + * Used primarily for domain types. + */ + bool typnotnull BKI_DEFAULT(f); + + /* + * Domains use typbasetype to show the base (or domain) type that the + * domain is based on. Zero if the type is not a domain. + */ + Oid typbasetype BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_type); + + /* + * Domains use typtypmod to record the typmod to be applied to their base + * type (-1 if base type does not use a typmod). -1 if this type is not a + * domain. + */ + int32 typtypmod BKI_DEFAULT(-1); + + /* + * typndims is the declared number of dimensions for an array domain type + * (i.e., typbasetype is an array type). Otherwise zero. + */ + int32 typndims BKI_DEFAULT(0); + + /* + * Collation: 0 if type cannot use collations, nonzero (typically + * DEFAULT_COLLATION_OID) for collatable base types, possibly some other + * OID for domains over collatable types + */ + Oid typcollation BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_collation); + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + /* + * If typdefaultbin is not NULL, it is the nodeToString representation of + * a default expression for the type. Currently this is only used for + * domains. + */ + pg_node_tree typdefaultbin BKI_DEFAULT(_null_) BKI_ARRAY_DEFAULT(_null_); + + /* + * typdefault is NULL if the type has no associated default value. If + * typdefaultbin is not NULL, typdefault must contain a human-readable + * version of the default expression represented by typdefaultbin. If + * typdefaultbin is NULL and typdefault is not, then typdefault is the + * external representation of the type's default value, which may be fed + * to the type's input converter to produce a constant. + */ + text typdefault BKI_DEFAULT(_null_) BKI_ARRAY_DEFAULT(_null_); + + /* + * Access permissions + */ + aclitem typacl[1] BKI_DEFAULT(_null_); +#endif +} FormData_pg_type; + +/* ---------------- + * Form_pg_type corresponds to a pointer to a row with + * the format of pg_type relation. + * ---------------- + */ +typedef FormData_pg_type *Form_pg_type; + +DECLARE_TOAST(pg_type, 4171, 4172); + +DECLARE_UNIQUE_INDEX_PKEY(pg_type_oid_index, 2703, TypeOidIndexId, pg_type, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, TypeNameNspIndexId, pg_type, btree(typname name_ops, typnamespace oid_ops)); + +MAKE_SYSCACHE(TYPEOID, pg_type_oid_index, 64); +MAKE_SYSCACHE(TYPENAMENSP, pg_type_typname_nsp_index, 64); + +#ifdef EXPOSE_TO_CLIENT_CODE + +/* + * macros for values of poor-mans-enumerated-type columns + */ +#define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */ +#define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */ +#define TYPTYPE_DOMAIN 'd' /* domain over another type */ +#define TYPTYPE_ENUM 'e' /* enumerated type */ +#define TYPTYPE_MULTIRANGE 'm' /* multirange type */ +#define TYPTYPE_PSEUDO 'p' /* pseudo-type */ +#define TYPTYPE_RANGE 'r' /* range type */ + +#define TYPCATEGORY_INVALID '\0' /* not an allowed category */ +#define TYPCATEGORY_ARRAY 'A' +#define TYPCATEGORY_BOOLEAN 'B' +#define TYPCATEGORY_COMPOSITE 'C' +#define TYPCATEGORY_DATETIME 'D' +#define TYPCATEGORY_ENUM 'E' +#define TYPCATEGORY_GEOMETRIC 'G' +#define TYPCATEGORY_NETWORK 'I' /* think INET */ +#define TYPCATEGORY_NUMERIC 'N' +#define TYPCATEGORY_PSEUDOTYPE 'P' +#define TYPCATEGORY_RANGE 'R' +#define TYPCATEGORY_STRING 'S' +#define TYPCATEGORY_TIMESPAN 'T' +#define TYPCATEGORY_USER 'U' +#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ +#define TYPCATEGORY_UNKNOWN 'X' +#define TYPCATEGORY_INTERNAL 'Z' + +#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */ +#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */ +#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */ +#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */ + +#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */ +#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */ +#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */ +#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */ + +/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ +#define IsPolymorphicType(typid) \ + (IsPolymorphicTypeFamily1(typid) || \ + IsPolymorphicTypeFamily2(typid)) + +/* Code not part of polymorphic type resolution should not use these macros: */ +#define IsPolymorphicTypeFamily1(typid) \ + ((typid) == ANYELEMENTOID || \ + (typid) == ANYARRAYOID || \ + (typid) == ANYNONARRAYOID || \ + (typid) == ANYENUMOID || \ + (typid) == ANYRANGEOID || \ + (typid) == ANYMULTIRANGEOID) + +#define IsPolymorphicTypeFamily2(typid) \ + ((typid) == ANYCOMPATIBLEOID || \ + (typid) == ANYCOMPATIBLEARRAYOID || \ + (typid) == ANYCOMPATIBLENONARRAYOID || \ + (typid) == ANYCOMPATIBLERANGEOID || \ + (typid) == ANYCOMPATIBLEMULTIRANGEOID) + +/* Is this a "true" array type? (Requires fmgroids.h) */ +#define IsTrueArrayType(typeForm) \ + (OidIsValid((typeForm)->typelem) && \ + (typeForm)->typsubscript == F_ARRAY_SUBSCRIPT_HANDLER) + +/* + * Backwards compatibility for ancient random spellings of pg_type OID macros. + * Don't use these names in new code. + */ +#define CASHOID MONEYOID +#define LSNOID PG_LSNOID + +#endif /* EXPOSE_TO_CLIENT_CODE */ + + +extern ObjectAddress TypeShellMake(const char *typeName, + Oid typeNamespace, + Oid ownerId); + +extern ObjectAddress TypeCreate(Oid newTypeOid, + const char *typeName, + Oid typeNamespace, + Oid relationOid, + char relationKind, + Oid ownerId, + int16 internalSize, + char typeType, + char typeCategory, + bool typePreferred, + char typDelim, + Oid inputProcedure, + Oid outputProcedure, + Oid receiveProcedure, + Oid sendProcedure, + Oid typmodinProcedure, + Oid typmodoutProcedure, + Oid analyzeProcedure, + Oid subscriptProcedure, + Oid elementType, + bool isImplicitArray, + Oid arrayType, + Oid baseType, + const char *defaultTypeValue, + char *defaultTypeBin, + bool passedByValue, + char alignment, + char storage, + int32 typeMod, + int32 typNDims, + bool typeNotNull, + Oid typeCollation); + +extern void GenerateTypeDependencies(HeapTuple typeTuple, + Relation typeCatalog, + Node *defaultExpr, + void *typacl, + char relationKind, /* only for relation + * rowtypes */ + bool isImplicitArray, + bool isDependentType, + bool makeExtensionDep, + bool rebuild); + +extern void RenameTypeInternal(Oid typeOid, const char *newTypeName, + Oid typeNamespace); + +extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace); + +extern bool moveArrayTypeName(Oid typeOid, const char *typeName, + Oid typeNamespace); + +extern char *makeMultirangeTypeName(const char *rangeTypeName, + Oid typeNamespace); + +#endif /* PG_TYPE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_type_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_type_d.h new file mode 100644 index 0000000000000000000000000000000000000000..f8078929e65c05b99f6690d43fc3371404e76ca7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_type_d.h @@ -0,0 +1,324 @@ +/*------------------------------------------------------------------------- + * + * pg_type_d.h + * Macro definitions for pg_type + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_D_H +#define PG_TYPE_D_H + +#define TypeRelationId 1247 +#define TypeRelation_Rowtype_Id 71 +#define TypeOidIndexId 2703 +#define TypeNameNspIndexId 2704 + +#define Anum_pg_type_oid 1 +#define Anum_pg_type_typname 2 +#define Anum_pg_type_typnamespace 3 +#define Anum_pg_type_typowner 4 +#define Anum_pg_type_typlen 5 +#define Anum_pg_type_typbyval 6 +#define Anum_pg_type_typtype 7 +#define Anum_pg_type_typcategory 8 +#define Anum_pg_type_typispreferred 9 +#define Anum_pg_type_typisdefined 10 +#define Anum_pg_type_typdelim 11 +#define Anum_pg_type_typrelid 12 +#define Anum_pg_type_typsubscript 13 +#define Anum_pg_type_typelem 14 +#define Anum_pg_type_typarray 15 +#define Anum_pg_type_typinput 16 +#define Anum_pg_type_typoutput 17 +#define Anum_pg_type_typreceive 18 +#define Anum_pg_type_typsend 19 +#define Anum_pg_type_typmodin 20 +#define Anum_pg_type_typmodout 21 +#define Anum_pg_type_typanalyze 22 +#define Anum_pg_type_typalign 23 +#define Anum_pg_type_typstorage 24 +#define Anum_pg_type_typnotnull 25 +#define Anum_pg_type_typbasetype 26 +#define Anum_pg_type_typtypmod 27 +#define Anum_pg_type_typndims 28 +#define Anum_pg_type_typcollation 29 +#define Anum_pg_type_typdefaultbin 30 +#define Anum_pg_type_typdefault 31 +#define Anum_pg_type_typacl 32 + +#define Natts_pg_type 32 + + +/* + * macros for values of poor-mans-enumerated-type columns + */ +#define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */ +#define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */ +#define TYPTYPE_DOMAIN 'd' /* domain over another type */ +#define TYPTYPE_ENUM 'e' /* enumerated type */ +#define TYPTYPE_MULTIRANGE 'm' /* multirange type */ +#define TYPTYPE_PSEUDO 'p' /* pseudo-type */ +#define TYPTYPE_RANGE 'r' /* range type */ + +#define TYPCATEGORY_INVALID '\0' /* not an allowed category */ +#define TYPCATEGORY_ARRAY 'A' +#define TYPCATEGORY_BOOLEAN 'B' +#define TYPCATEGORY_COMPOSITE 'C' +#define TYPCATEGORY_DATETIME 'D' +#define TYPCATEGORY_ENUM 'E' +#define TYPCATEGORY_GEOMETRIC 'G' +#define TYPCATEGORY_NETWORK 'I' /* think INET */ +#define TYPCATEGORY_NUMERIC 'N' +#define TYPCATEGORY_PSEUDOTYPE 'P' +#define TYPCATEGORY_RANGE 'R' +#define TYPCATEGORY_STRING 'S' +#define TYPCATEGORY_TIMESPAN 'T' +#define TYPCATEGORY_USER 'U' +#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ +#define TYPCATEGORY_UNKNOWN 'X' +#define TYPCATEGORY_INTERNAL 'Z' + +#define TYPALIGN_CHAR 'c' /* char alignment (i.e. unaligned) */ +#define TYPALIGN_SHORT 's' /* short alignment (typically 2 bytes) */ +#define TYPALIGN_INT 'i' /* int alignment (typically 4 bytes) */ +#define TYPALIGN_DOUBLE 'd' /* double alignment (often 8 bytes) */ + +#define TYPSTORAGE_PLAIN 'p' /* type not prepared for toasting */ +#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */ +#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */ +#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */ + +/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ +#define IsPolymorphicType(typid) \ + (IsPolymorphicTypeFamily1(typid) || \ + IsPolymorphicTypeFamily2(typid)) + +/* Code not part of polymorphic type resolution should not use these macros: */ +#define IsPolymorphicTypeFamily1(typid) \ + ((typid) == ANYELEMENTOID || \ + (typid) == ANYARRAYOID || \ + (typid) == ANYNONARRAYOID || \ + (typid) == ANYENUMOID || \ + (typid) == ANYRANGEOID || \ + (typid) == ANYMULTIRANGEOID) + +#define IsPolymorphicTypeFamily2(typid) \ + ((typid) == ANYCOMPATIBLEOID || \ + (typid) == ANYCOMPATIBLEARRAYOID || \ + (typid) == ANYCOMPATIBLENONARRAYOID || \ + (typid) == ANYCOMPATIBLERANGEOID || \ + (typid) == ANYCOMPATIBLEMULTIRANGEOID) + +/* Is this a "true" array type? (Requires fmgroids.h) */ +#define IsTrueArrayType(typeForm) \ + (OidIsValid((typeForm)->typelem) && \ + (typeForm)->typsubscript == F_ARRAY_SUBSCRIPT_HANDLER) + +/* + * Backwards compatibility for ancient random spellings of pg_type OID macros. + * Don't use these names in new code. + */ +#define CASHOID MONEYOID +#define LSNOID PG_LSNOID + +#define BOOLOID 16 +#define BYTEAOID 17 +#define CHAROID 18 +#define NAMEOID 19 +#define INT8OID 20 +#define INT2OID 21 +#define INT2VECTOROID 22 +#define INT4OID 23 +#define REGPROCOID 24 +#define TEXTOID 25 +#define OIDOID 26 +#define TIDOID 27 +#define XIDOID 28 +#define CIDOID 29 +#define OIDVECTOROID 30 +#define JSONOID 114 +#define XMLOID 142 +#define PG_NODE_TREEOID 194 +#define PG_NDISTINCTOID 3361 +#define PG_DEPENDENCIESOID 3402 +#define PG_MCV_LISTOID 5017 +#define PG_DDL_COMMANDOID 32 +#define XID8OID 5069 +#define POINTOID 600 +#define LSEGOID 601 +#define PATHOID 602 +#define BOXOID 603 +#define POLYGONOID 604 +#define LINEOID 628 +#define FLOAT4OID 700 +#define FLOAT8OID 701 +#define UNKNOWNOID 705 +#define CIRCLEOID 718 +#define MONEYOID 790 +#define MACADDROID 829 +#define INETOID 869 +#define CIDROID 650 +#define MACADDR8OID 774 +#define ACLITEMOID 1033 +#define BPCHAROID 1042 +#define VARCHAROID 1043 +#define DATEOID 1082 +#define TIMEOID 1083 +#define TIMESTAMPOID 1114 +#define TIMESTAMPTZOID 1184 +#define INTERVALOID 1186 +#define TIMETZOID 1266 +#define BITOID 1560 +#define VARBITOID 1562 +#define NUMERICOID 1700 +#define REFCURSOROID 1790 +#define REGPROCEDUREOID 2202 +#define REGOPEROID 2203 +#define REGOPERATOROID 2204 +#define REGCLASSOID 2205 +#define REGCOLLATIONOID 4191 +#define REGTYPEOID 2206 +#define REGROLEOID 4096 +#define REGNAMESPACEOID 4089 +#define UUIDOID 2950 +#define PG_LSNOID 3220 +#define TSVECTOROID 3614 +#define GTSVECTOROID 3642 +#define TSQUERYOID 3615 +#define REGCONFIGOID 3734 +#define REGDICTIONARYOID 3769 +#define JSONBOID 3802 +#define JSONPATHOID 4072 +#define TXID_SNAPSHOTOID 2970 +#define PG_SNAPSHOTOID 5038 +#define INT4RANGEOID 3904 +#define NUMRANGEOID 3906 +#define TSRANGEOID 3908 +#define TSTZRANGEOID 3910 +#define DATERANGEOID 3912 +#define INT8RANGEOID 3926 +#define INT4MULTIRANGEOID 4451 +#define NUMMULTIRANGEOID 4532 +#define TSMULTIRANGEOID 4533 +#define TSTZMULTIRANGEOID 4534 +#define DATEMULTIRANGEOID 4535 +#define INT8MULTIRANGEOID 4536 +#define RECORDOID 2249 +#define RECORDARRAYOID 2287 +#define CSTRINGOID 2275 +#define ANYOID 2276 +#define ANYARRAYOID 2277 +#define VOIDOID 2278 +#define TRIGGEROID 2279 +#define EVENT_TRIGGEROID 3838 +#define LANGUAGE_HANDLEROID 2280 +#define INTERNALOID 2281 +#define ANYELEMENTOID 2283 +#define ANYNONARRAYOID 2776 +#define ANYENUMOID 3500 +#define FDW_HANDLEROID 3115 +#define INDEX_AM_HANDLEROID 325 +#define TSM_HANDLEROID 3310 +#define TABLE_AM_HANDLEROID 269 +#define ANYRANGEOID 3831 +#define ANYCOMPATIBLEOID 5077 +#define ANYCOMPATIBLEARRAYOID 5078 +#define ANYCOMPATIBLENONARRAYOID 5079 +#define ANYCOMPATIBLERANGEOID 5080 +#define ANYMULTIRANGEOID 4537 +#define ANYCOMPATIBLEMULTIRANGEOID 4538 +#define PG_BRIN_BLOOM_SUMMARYOID 4600 +#define PG_BRIN_MINMAX_MULTI_SUMMARYOID 4601 +#define BOOLARRAYOID 1000 +#define BYTEAARRAYOID 1001 +#define CHARARRAYOID 1002 +#define NAMEARRAYOID 1003 +#define INT8ARRAYOID 1016 +#define INT2ARRAYOID 1005 +#define INT2VECTORARRAYOID 1006 +#define INT4ARRAYOID 1007 +#define REGPROCARRAYOID 1008 +#define TEXTARRAYOID 1009 +#define OIDARRAYOID 1028 +#define TIDARRAYOID 1010 +#define XIDARRAYOID 1011 +#define CIDARRAYOID 1012 +#define OIDVECTORARRAYOID 1013 +#define PG_TYPEARRAYOID 210 +#define PG_ATTRIBUTEARRAYOID 270 +#define PG_PROCARRAYOID 272 +#define PG_CLASSARRAYOID 273 +#define JSONARRAYOID 199 +#define XMLARRAYOID 143 +#define XID8ARRAYOID 271 +#define POINTARRAYOID 1017 +#define LSEGARRAYOID 1018 +#define PATHARRAYOID 1019 +#define BOXARRAYOID 1020 +#define POLYGONARRAYOID 1027 +#define LINEARRAYOID 629 +#define FLOAT4ARRAYOID 1021 +#define FLOAT8ARRAYOID 1022 +#define CIRCLEARRAYOID 719 +#define MONEYARRAYOID 791 +#define MACADDRARRAYOID 1040 +#define INETARRAYOID 1041 +#define CIDRARRAYOID 651 +#define MACADDR8ARRAYOID 775 +#define ACLITEMARRAYOID 1034 +#define BPCHARARRAYOID 1014 +#define VARCHARARRAYOID 1015 +#define DATEARRAYOID 1182 +#define TIMEARRAYOID 1183 +#define TIMESTAMPARRAYOID 1115 +#define TIMESTAMPTZARRAYOID 1185 +#define INTERVALARRAYOID 1187 +#define TIMETZARRAYOID 1270 +#define BITARRAYOID 1561 +#define VARBITARRAYOID 1563 +#define NUMERICARRAYOID 1231 +#define REFCURSORARRAYOID 2201 +#define REGPROCEDUREARRAYOID 2207 +#define REGOPERARRAYOID 2208 +#define REGOPERATORARRAYOID 2209 +#define REGCLASSARRAYOID 2210 +#define REGCOLLATIONARRAYOID 4192 +#define REGTYPEARRAYOID 2211 +#define REGROLEARRAYOID 4097 +#define REGNAMESPACEARRAYOID 4090 +#define UUIDARRAYOID 2951 +#define PG_LSNARRAYOID 3221 +#define TSVECTORARRAYOID 3643 +#define GTSVECTORARRAYOID 3644 +#define TSQUERYARRAYOID 3645 +#define REGCONFIGARRAYOID 3735 +#define REGDICTIONARYARRAYOID 3770 +#define JSONBARRAYOID 3807 +#define JSONPATHARRAYOID 4073 +#define TXID_SNAPSHOTARRAYOID 2949 +#define PG_SNAPSHOTARRAYOID 5039 +#define INT4RANGEARRAYOID 3905 +#define NUMRANGEARRAYOID 3907 +#define TSRANGEARRAYOID 3909 +#define TSTZRANGEARRAYOID 3911 +#define DATERANGEARRAYOID 3913 +#define INT8RANGEARRAYOID 3927 +#define INT4MULTIRANGEARRAYOID 6150 +#define NUMMULTIRANGEARRAYOID 6151 +#define TSMULTIRANGEARRAYOID 6152 +#define TSTZMULTIRANGEARRAYOID 6153 +#define DATEMULTIRANGEARRAYOID 6155 +#define INT8MULTIRANGEARRAYOID 6157 +#define CSTRINGARRAYOID 1263 + +#endif /* PG_TYPE_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping.h new file mode 100644 index 0000000000000000000000000000000000000000..3632448cce0b01ac0eeed379ff1970d76fbeeefa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_user_mapping.h + * definition of the "user mapping" system catalog (pg_user_mapping) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_user_mapping.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_USER_MAPPING_H +#define PG_USER_MAPPING_H + +#include "catalog/genbki.h" +#include "catalog/pg_user_mapping_d.h" + +/* ---------------- + * pg_user_mapping definition. cpp turns this into + * typedef struct FormData_pg_user_mapping + * ---------------- + */ +CATALOG(pg_user_mapping,1418,UserMappingRelationId) +{ + Oid oid; /* oid */ + + Oid umuser BKI_LOOKUP_OPT(pg_authid); /* Id of the user, + * InvalidOid if PUBLIC is + * wanted */ + Oid umserver BKI_LOOKUP(pg_foreign_server); /* server of this + * mapping */ + +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + text umoptions[1]; /* user mapping options */ +#endif +} FormData_pg_user_mapping; + +/* ---------------- + * Form_pg_user_mapping corresponds to a pointer to a tuple with + * the format of pg_user_mapping relation. + * ---------------- + */ +typedef FormData_pg_user_mapping *Form_pg_user_mapping; + +DECLARE_TOAST(pg_user_mapping, 4173, 4174); + +DECLARE_UNIQUE_INDEX_PKEY(pg_user_mapping_oid_index, 174, UserMappingOidIndexId, pg_user_mapping, btree(oid oid_ops)); +DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, UserMappingUserServerIndexId, pg_user_mapping, btree(umuser oid_ops, umserver oid_ops)); + +MAKE_SYSCACHE(USERMAPPINGOID, pg_user_mapping_oid_index, 2); +MAKE_SYSCACHE(USERMAPPINGUSERSERVER, pg_user_mapping_user_server_index, 2); + +#endif /* PG_USER_MAPPING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping_d.h b/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping_d.h new file mode 100644 index 0000000000000000000000000000000000000000..eebbb3493dd6bf4148670c5d01b6c1e512873ea5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/pg_user_mapping_d.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pg_user_mapping_d.h + * Macro definitions for pg_user_mapping + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef PG_USER_MAPPING_D_H +#define PG_USER_MAPPING_D_H + +#define UserMappingRelationId 1418 +#define UserMappingOidIndexId 174 +#define UserMappingUserServerIndexId 175 + +#define Anum_pg_user_mapping_oid 1 +#define Anum_pg_user_mapping_umuser 2 +#define Anum_pg_user_mapping_umserver 3 +#define Anum_pg_user_mapping_umoptions 4 + +#define Natts_pg_user_mapping 4 + + +#endif /* PG_USER_MAPPING_D_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/schemapg.h b/platform/dbops/binaries/postgres/include/server/catalog/schemapg.h new file mode 100644 index 0000000000000000000000000000000000000000..75e2eda5eb31e191ab26227876a31b3ad4f70a40 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/schemapg.h @@ -0,0 +1,242 @@ +/*------------------------------------------------------------------------- + * + * schemapg.h + * Schema_pg_xxx macros for use by relcache.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef SCHEMAPG_H +#define SCHEMAPG_H + +#define Schema_pg_proc \ +{ 1255, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"pronamespace"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proowner"}, 26, 4, 4, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prolang"}, 26, 4, 5, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"procost"}, 700, 4, 6, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prorows"}, 700, 4, 7, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"provariadic"}, 26, 4, 8, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosupport"}, 24, 4, 9, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prokind"}, 18, 1, 10, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosecdef"}, 16, 1, 11, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proleakproof"}, 16, 1, 12, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proisstrict"}, 16, 1, 13, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proretset"}, 16, 1, 14, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"provolatile"}, 18, 1, 15, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proparallel"}, 18, 1, 16, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"pronargs"}, 21, 2, 17, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"pronargdefaults"}, 21, 2, 18, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prorettype"}, 26, 4, 19, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargtypes"}, 30, -1, 20, -1, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proallargtypes"}, 1028, -1, 21, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargmodes"}, 1002, -1, 22, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"proargnames"}, 1009, -1, 23, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proargdefaults"}, 194, -1, 24, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"protrftypes"}, 1028, -1, 25, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1255, {"prosrc"}, 25, -1, 26, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"probin"}, 25, -1, 27, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"prosqlbody"}, 194, -1, 28, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proconfig"}, 1009, -1, 29, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1255, {"proacl"}, 1034, -1, 30, -1, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_type \ +{ 1247, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typnamespace"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typowner"}, 26, 4, 4, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typlen"}, 21, 2, 5, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typbyval"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typtype"}, 18, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typcategory"}, 18, 1, 8, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typispreferred"}, 16, 1, 9, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typisdefined"}, 16, 1, 10, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typdelim"}, 18, 1, 11, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typrelid"}, 26, 4, 12, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typsubscript"}, 24, 4, 13, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typelem"}, 26, 4, 14, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typarray"}, 26, 4, 15, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typinput"}, 24, 4, 16, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typoutput"}, 24, 4, 17, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typreceive"}, 24, 4, 18, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typsend"}, 24, 4, 19, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typmodin"}, 24, 4, 20, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typmodout"}, 24, 4, 21, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typanalyze"}, 24, 4, 22, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typalign"}, 18, 1, 23, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typstorage"}, 18, 1, 24, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typnotnull"}, 16, 1, 25, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typbasetype"}, 26, 4, 26, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typtypmod"}, 23, 4, 27, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typndims"}, 23, 4, 28, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typcollation"}, 26, 4, 29, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1247, {"typdefaultbin"}, 194, -1, 30, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typdefault"}, 25, -1, 31, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1247, {"typacl"}, 1034, -1, 32, -1, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_attribute \ +{ 1249, {"attrelid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"atttypid"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attlen"}, 21, 2, 4, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attnum"}, 21, 2, 5, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attcacheoff"}, 23, 4, 6, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atttypmod"}, 23, 4, 7, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attndims"}, 21, 2, 8, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attbyval"}, 16, 1, 9, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attalign"}, 18, 1, 10, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attstorage"}, 18, 1, 11, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attcompression"}, 18, 1, 12, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attnotnull"}, 16, 1, 13, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atthasdef"}, 16, 1, 14, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"atthasmissing"}, 16, 1, 15, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attidentity"}, 18, 1, 16, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attgenerated"}, 18, 1, 17, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attisdropped"}, 16, 1, 18, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attislocal"}, 16, 1, 19, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attinhcount"}, 21, 2, 20, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attcollation"}, 26, 4, 21, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attstattarget"}, 21, 2, 22, -1, -1, 0, true, 's', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attacl"}, 1034, -1, 23, -1, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1249, {"attoptions"}, 1009, -1, 24, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"attfdwoptions"}, 1009, -1, 25, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1249, {"attmissingval"}, 2277, -1, 26, -1, -1, 0, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_class \ +{ 1259, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1259, {"relnamespace"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltype"}, 26, 4, 4, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reloftype"}, 26, 4, 5, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relowner"}, 26, 4, 6, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relam"}, 26, 4, 7, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relfilenode"}, 26, 4, 8, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltablespace"}, 26, 4, 9, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relpages"}, 23, 4, 10, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltuples"}, 700, 4, 11, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relallvisible"}, 23, 4, 12, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reltoastrelid"}, 26, 4, 13, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhasindex"}, 16, 1, 14, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relisshared"}, 16, 1, 15, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relpersistence"}, 18, 1, 16, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relkind"}, 18, 1, 17, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relnatts"}, 21, 2, 18, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relchecks"}, 21, 2, 19, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhasrules"}, 16, 1, 20, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhastriggers"}, 16, 1, 21, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relhassubclass"}, 16, 1, 22, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relrowsecurity"}, 16, 1, 23, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relforcerowsecurity"}, 16, 1, 24, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relispopulated"}, 16, 1, 25, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relreplident"}, 18, 1, 26, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relispartition"}, 16, 1, 27, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relrewrite"}, 26, 4, 28, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relfrozenxid"}, 28, 4, 29, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relminmxid"}, 28, 4, 30, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"relacl"}, 1034, -1, 31, -1, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1259, {"reloptions"}, 1009, -1, 32, -1, -1, 1, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1259, {"relpartbound"}, 194, -1, 33, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_index \ +{ 2610, {"indexrelid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indrelid"}, 26, 4, 2, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnatts"}, 21, 2, 3, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnkeyatts"}, 21, 2, 4, -1, -1, 0, true, 's', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisunique"}, 16, 1, 5, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indnullsnotdistinct"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisprimary"}, 16, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisexclusion"}, 16, 1, 8, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indimmediate"}, 16, 1, 9, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisclustered"}, 16, 1, 10, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisvalid"}, 16, 1, 11, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indcheckxmin"}, 16, 1, 12, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisready"}, 16, 1, 13, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indislive"}, 16, 1, 14, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indisreplident"}, 16, 1, 15, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indkey"}, 22, -1, 16, -1, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indcollation"}, 30, -1, 17, -1, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indclass"}, 30, -1, 18, -1, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indoption"}, 22, -1, 19, -1, -1, 1, false, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 2610, {"indexprs"}, 194, -1, 20, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 2610, {"indpred"}, 194, -1, 21, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_database \ +{ 1262, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datdba"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"encoding"}, 23, 4, 4, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datlocprovider"}, 18, 1, 5, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datistemplate"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datallowconn"}, 16, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"dathasloginevt"}, 16, 1, 8, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datconnlimit"}, 23, 4, 9, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datfrozenxid"}, 28, 4, 10, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datminmxid"}, 28, 4, 11, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"dattablespace"}, 26, 4, 12, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1262, {"datcollate"}, 25, -1, 13, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datctype"}, 25, -1, 14, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datlocale"}, 25, -1, 15, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"daticurules"}, 25, -1, 16, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datcollversion"}, 25, -1, 17, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1262, {"datacl"}, 1034, -1, 18, -1, -1, 1, false, 'd', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_authid \ +{ 1260, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolname"}, 19, NAMEDATALEN, 2, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1260, {"rolsuper"}, 16, 1, 3, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolinherit"}, 16, 1, 4, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcreaterole"}, 16, 1, 5, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcreatedb"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolcanlogin"}, 16, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolreplication"}, 16, 1, 8, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolbypassrls"}, 16, 1, 9, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolconnlimit"}, 23, 4, 10, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1260, {"rolpassword"}, 25, -1, 11, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 1260, {"rolvaliduntil"}, 1184, 8, 12, -1, -1, 0, FLOAT8PASSBYVAL, 'd', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_auth_members \ +{ 1261, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"roleid"}, 26, 4, 2, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"member"}, 26, 4, 3, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"grantor"}, 26, 4, 4, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"admin_option"}, 16, 1, 5, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"inherit_option"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 1261, {"set_option"}, 16, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 } + +#define Schema_pg_shseclabel \ +{ 3592, {"objoid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 3592, {"classoid"}, 26, 4, 2, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 3592, {"provider"}, 25, -1, 3, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 3592, {"label"}, 25, -1, 4, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 } + +#define Schema_pg_subscription \ +{ 6100, {"oid"}, 26, 4, 1, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subdbid"}, 26, 4, 2, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subskiplsn"}, 3220, 8, 3, -1, -1, 0, FLOAT8PASSBYVAL, 'd', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subname"}, 19, NAMEDATALEN, 4, -1, -1, 0, false, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subowner"}, 26, 4, 5, -1, -1, 0, true, 'i', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subenabled"}, 16, 1, 6, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subbinary"}, 16, 1, 7, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"substream"}, 18, 1, 8, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subtwophasestate"}, 18, 1, 9, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subdisableonerr"}, 16, 1, 10, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subpasswordrequired"}, 16, 1, 11, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subrunasowner"}, 16, 1, 12, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subfailover"}, 16, 1, 13, -1, -1, 0, true, 'c', 'p', '\0', true, false, false, '\0', '\0', false, true, 0, 0 }, \ +{ 6100, {"subconninfo"}, 25, -1, 14, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subslotname"}, 19, NAMEDATALEN, 15, -1, -1, 0, false, 'c', 'p', '\0', false, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subsynccommit"}, 25, -1, 16, -1, -1, 0, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"subpublications"}, 1009, -1, 17, -1, -1, 1, false, 'i', 'x', '\0', true, false, false, '\0', '\0', false, true, 0, 950 }, \ +{ 6100, {"suborigin"}, 25, -1, 18, -1, -1, 0, false, 'i', 'x', '\0', false, false, false, '\0', '\0', false, true, 0, 950 } + +#endif /* SCHEMAPG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/storage.h b/platform/dbops/binaries/postgres/include/server/catalog/storage.h new file mode 100644 index 0000000000000000000000000000000000000000..72ef3ee92c01228811b77b0f8b943e1ba3f61892 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/storage.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * storage.h + * prototypes for functions in backend/catalog/storage.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/storage.h + * + *------------------------------------------------------------------------- + */ +#ifndef STORAGE_H +#define STORAGE_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "utils/relcache.h" + +/* GUC variables */ +extern PGDLLIMPORT int wal_skip_threshold; + +extern SMgrRelation RelationCreateStorage(RelFileLocator rlocator, + char relpersistence, + bool register_delete); +extern void RelationDropStorage(Relation rel); +extern void RelationPreserveStorage(RelFileLocator rlocator, bool atCommit); +extern void RelationPreTruncate(Relation rel); +extern void RelationTruncate(Relation rel, BlockNumber nblocks); +extern void RelationCopyStorage(SMgrRelation src, SMgrRelation dst, + ForkNumber forkNum, char relpersistence); +extern bool RelFileLocatorSkippingWAL(RelFileLocator rlocator); +extern Size EstimatePendingSyncsSpace(void); +extern void SerializePendingSyncs(Size maxSize, char *startAddress); +extern void RestorePendingSyncs(char *startAddress); + +/* + * These functions used to be in storage/smgr/smgr.c, which explains the + * naming + */ +extern void smgrDoPendingDeletes(bool isCommit); +extern void smgrDoPendingSyncs(bool isCommit, bool isParallelWorker); +extern int smgrGetPendingDeletes(bool forCommit, RelFileLocator **ptr); +extern void AtSubCommit_smgr(void); +extern void AtSubAbort_smgr(void); +extern void PostPrepare_smgr(void); + +#endif /* STORAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/storage_xlog.h b/platform/dbops/binaries/postgres/include/server/catalog/storage_xlog.h new file mode 100644 index 0000000000000000000000000000000000000000..a490e05f88401f261bad7ee1c3c85d06fa8df833 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/storage_xlog.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * storage_xlog.h + * prototypes for XLog support for backend/catalog/storage.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/storage_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef STORAGE_XLOG_H +#define STORAGE_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * Declarations for smgr-related XLOG records + * + * Note: we log file creation and truncation here, but logging of deletion + * actions is handled by xact.c, because it is part of transaction commit. + */ + +/* XLOG gives us high 4 bits */ +#define XLOG_SMGR_CREATE 0x10 +#define XLOG_SMGR_TRUNCATE 0x20 + +typedef struct xl_smgr_create +{ + RelFileLocator rlocator; + ForkNumber forkNum; +} xl_smgr_create; + +/* flags for xl_smgr_truncate */ +#define SMGR_TRUNCATE_HEAP 0x0001 +#define SMGR_TRUNCATE_VM 0x0002 +#define SMGR_TRUNCATE_FSM 0x0004 +#define SMGR_TRUNCATE_ALL \ + (SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM) + +typedef struct xl_smgr_truncate +{ + BlockNumber blkno; + RelFileLocator rlocator; + int flags; +} xl_smgr_truncate; + +extern void log_smgrcreate(const RelFileLocator *rlocator, ForkNumber forkNum); + +extern void smgr_redo(XLogReaderState *record); +extern void smgr_desc(StringInfo buf, XLogReaderState *record); +extern const char *smgr_identify(uint8 info); + +#endif /* STORAGE_XLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/syscache_ids.h b/platform/dbops/binaries/postgres/include/server/catalog/syscache_ids.h new file mode 100644 index 0000000000000000000000000000000000000000..ea76244aea2afb8e6243e656891d454edacda945 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/syscache_ids.h @@ -0,0 +1,104 @@ +/*------------------------------------------------------------------------- + * + * syscache_ids.h + * SysCache identifiers + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +enum SysCacheIdentifier +{ + AGGFNOID, + AMNAME, + AMOID, + AMOPOPID, + AMOPSTRATEGY, + AMPROCNUM, + ATTNAME, + ATTNUM, + AUTHMEMMEMROLE, + AUTHMEMROLEMEM, + AUTHNAME, + AUTHOID, + CASTSOURCETARGET, + CLAAMNAMENSP, + CLAOID, + COLLNAMEENCNSP, + COLLOID, + CONDEFAULT, + CONNAMENSP, + CONSTROID, + CONVOID, + DATABASEOID, + DEFACLROLENSPOBJ, + ENUMOID, + ENUMTYPOIDNAME, + EVENTTRIGGERNAME, + EVENTTRIGGEROID, + FOREIGNDATAWRAPPERNAME, + FOREIGNDATAWRAPPEROID, + FOREIGNSERVERNAME, + FOREIGNSERVEROID, + FOREIGNTABLEREL, + INDEXRELID, + LANGNAME, + LANGOID, + NAMESPACENAME, + NAMESPACEOID, + OPERNAMENSP, + OPEROID, + OPFAMILYAMNAMENSP, + OPFAMILYOID, + PARAMETERACLNAME, + PARAMETERACLOID, + PARTRELID, + PROCNAMEARGSNSP, + PROCOID, + PUBLICATIONNAME, + PUBLICATIONNAMESPACE, + PUBLICATIONNAMESPACEMAP, + PUBLICATIONOID, + PUBLICATIONREL, + PUBLICATIONRELMAP, + RANGEMULTIRANGE, + RANGETYPE, + RELNAMENSP, + RELOID, + REPLORIGIDENT, + REPLORIGNAME, + RULERELNAME, + SEQRELID, + STATEXTDATASTXOID, + STATEXTNAMENSP, + STATEXTOID, + STATRELATTINH, + SUBSCRIPTIONNAME, + SUBSCRIPTIONOID, + SUBSCRIPTIONRELMAP, + TABLESPACEOID, + TRFOID, + TRFTYPELANG, + TSCONFIGMAP, + TSCONFIGNAMENSP, + TSCONFIGOID, + TSDICTNAMENSP, + TSDICTOID, + TSPARSERNAMENSP, + TSPARSEROID, + TSTEMPLATENAMENSP, + TSTEMPLATEOID, + TYPENAMENSP, + TYPEOID, + USERMAPPINGOID, + USERMAPPINGUSERSERVER, +}; +#define SysCacheSize (USERMAPPINGUSERSERVER + 1) diff --git a/platform/dbops/binaries/postgres/include/server/catalog/syscache_info.h b/platform/dbops/binaries/postgres/include/server/catalog/syscache_info.h new file mode 100644 index 0000000000000000000000000000000000000000..00e0a4a3f5d1be1f91f89ff8ba46786824a4205a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/syscache_info.h @@ -0,0 +1,568 @@ +/*------------------------------------------------------------------------- + * + * syscache_info.h + * SysCache definitions + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ + +#include "catalog/pg_aggregate_d.h" +#include "catalog/pg_am_d.h" +#include "catalog/pg_amop_d.h" +#include "catalog/pg_amproc_d.h" +#include "catalog/pg_attribute_d.h" +#include "catalog/pg_auth_members_d.h" +#include "catalog/pg_authid_d.h" +#include "catalog/pg_cast_d.h" +#include "catalog/pg_class_d.h" +#include "catalog/pg_collation_d.h" +#include "catalog/pg_constraint_d.h" +#include "catalog/pg_conversion_d.h" +#include "catalog/pg_database_d.h" +#include "catalog/pg_default_acl_d.h" +#include "catalog/pg_enum_d.h" +#include "catalog/pg_event_trigger_d.h" +#include "catalog/pg_foreign_data_wrapper_d.h" +#include "catalog/pg_foreign_server_d.h" +#include "catalog/pg_foreign_table_d.h" +#include "catalog/pg_index_d.h" +#include "catalog/pg_language_d.h" +#include "catalog/pg_namespace_d.h" +#include "catalog/pg_opclass_d.h" +#include "catalog/pg_operator_d.h" +#include "catalog/pg_opfamily_d.h" +#include "catalog/pg_parameter_acl_d.h" +#include "catalog/pg_partitioned_table_d.h" +#include "catalog/pg_proc_d.h" +#include "catalog/pg_publication_d.h" +#include "catalog/pg_publication_namespace_d.h" +#include "catalog/pg_publication_rel_d.h" +#include "catalog/pg_range_d.h" +#include "catalog/pg_replication_origin_d.h" +#include "catalog/pg_rewrite_d.h" +#include "catalog/pg_sequence_d.h" +#include "catalog/pg_statistic_d.h" +#include "catalog/pg_statistic_ext_d.h" +#include "catalog/pg_statistic_ext_data_d.h" +#include "catalog/pg_subscription_d.h" +#include "catalog/pg_subscription_rel_d.h" +#include "catalog/pg_tablespace_d.h" +#include "catalog/pg_transform_d.h" +#include "catalog/pg_ts_config_d.h" +#include "catalog/pg_ts_config_map_d.h" +#include "catalog/pg_ts_dict_d.h" +#include "catalog/pg_ts_parser_d.h" +#include "catalog/pg_ts_template_d.h" +#include "catalog/pg_type_d.h" +#include "catalog/pg_user_mapping_d.h" + +static const struct cachedesc cacheinfo[] = { + [AGGFNOID] = { + AggregateRelationId, + AggregateFnoidIndexId, + KEY(Anum_pg_aggregate_aggfnoid), + 16 + }, + [AMNAME] = { + AccessMethodRelationId, + AmNameIndexId, + KEY(Anum_pg_am_amname), + 4 + }, + [AMOID] = { + AccessMethodRelationId, + AmOidIndexId, + KEY(Anum_pg_am_oid), + 4 + }, + [AMOPOPID] = { + AccessMethodOperatorRelationId, + AccessMethodOperatorIndexId, + KEY(Anum_pg_amop_amopopr, Anum_pg_amop_amoppurpose, Anum_pg_amop_amopfamily), + 64 + }, + [AMOPSTRATEGY] = { + AccessMethodOperatorRelationId, + AccessMethodStrategyIndexId, + KEY(Anum_pg_amop_amopfamily, Anum_pg_amop_amoplefttype, Anum_pg_amop_amoprighttype, Anum_pg_amop_amopstrategy), + 64 + }, + [AMPROCNUM] = { + AccessMethodProcedureRelationId, + AccessMethodProcedureIndexId, + KEY(Anum_pg_amproc_amprocfamily, Anum_pg_amproc_amproclefttype, Anum_pg_amproc_amprocrighttype, Anum_pg_amproc_amprocnum), + 16 + }, + [ATTNAME] = { + AttributeRelationId, + AttributeRelidNameIndexId, + KEY(Anum_pg_attribute_attrelid, Anum_pg_attribute_attname), + 32 + }, + [ATTNUM] = { + AttributeRelationId, + AttributeRelidNumIndexId, + KEY(Anum_pg_attribute_attrelid, Anum_pg_attribute_attnum), + 128 + }, + [AUTHMEMMEMROLE] = { + AuthMemRelationId, + AuthMemMemRoleIndexId, + KEY(Anum_pg_auth_members_member, Anum_pg_auth_members_roleid, Anum_pg_auth_members_grantor), + 8 + }, + [AUTHMEMROLEMEM] = { + AuthMemRelationId, + AuthMemRoleMemIndexId, + KEY(Anum_pg_auth_members_roleid, Anum_pg_auth_members_member, Anum_pg_auth_members_grantor), + 8 + }, + [AUTHNAME] = { + AuthIdRelationId, + AuthIdRolnameIndexId, + KEY(Anum_pg_authid_rolname), + 8 + }, + [AUTHOID] = { + AuthIdRelationId, + AuthIdOidIndexId, + KEY(Anum_pg_authid_oid), + 8 + }, + [CASTSOURCETARGET] = { + CastRelationId, + CastSourceTargetIndexId, + KEY(Anum_pg_cast_castsource, Anum_pg_cast_casttarget), + 256 + }, + [CLAAMNAMENSP] = { + OperatorClassRelationId, + OpclassAmNameNspIndexId, + KEY(Anum_pg_opclass_opcmethod, Anum_pg_opclass_opcname, Anum_pg_opclass_opcnamespace), + 8 + }, + [CLAOID] = { + OperatorClassRelationId, + OpclassOidIndexId, + KEY(Anum_pg_opclass_oid), + 8 + }, + [COLLNAMEENCNSP] = { + CollationRelationId, + CollationNameEncNspIndexId, + KEY(Anum_pg_collation_collname, Anum_pg_collation_collencoding, Anum_pg_collation_collnamespace), + 8 + }, + [COLLOID] = { + CollationRelationId, + CollationOidIndexId, + KEY(Anum_pg_collation_oid), + 8 + }, + [CONDEFAULT] = { + ConversionRelationId, + ConversionDefaultIndexId, + KEY(Anum_pg_conversion_connamespace, Anum_pg_conversion_conforencoding, Anum_pg_conversion_contoencoding, Anum_pg_conversion_oid), + 8 + }, + [CONNAMENSP] = { + ConversionRelationId, + ConversionNameNspIndexId, + KEY(Anum_pg_conversion_conname, Anum_pg_conversion_connamespace), + 8 + }, + [CONSTROID] = { + ConstraintRelationId, + ConstraintOidIndexId, + KEY(Anum_pg_constraint_oid), + 16 + }, + [CONVOID] = { + ConversionRelationId, + ConversionOidIndexId, + KEY(Anum_pg_conversion_oid), + 8 + }, + [DATABASEOID] = { + DatabaseRelationId, + DatabaseOidIndexId, + KEY(Anum_pg_database_oid), + 4 + }, + [DEFACLROLENSPOBJ] = { + DefaultAclRelationId, + DefaultAclRoleNspObjIndexId, + KEY(Anum_pg_default_acl_defaclrole, Anum_pg_default_acl_defaclnamespace, Anum_pg_default_acl_defaclobjtype), + 8 + }, + [ENUMOID] = { + EnumRelationId, + EnumOidIndexId, + KEY(Anum_pg_enum_oid), + 8 + }, + [ENUMTYPOIDNAME] = { + EnumRelationId, + EnumTypIdLabelIndexId, + KEY(Anum_pg_enum_enumtypid, Anum_pg_enum_enumlabel), + 8 + }, + [EVENTTRIGGERNAME] = { + EventTriggerRelationId, + EventTriggerNameIndexId, + KEY(Anum_pg_event_trigger_evtname), + 8 + }, + [EVENTTRIGGEROID] = { + EventTriggerRelationId, + EventTriggerOidIndexId, + KEY(Anum_pg_event_trigger_oid), + 8 + }, + [FOREIGNDATAWRAPPERNAME] = { + ForeignDataWrapperRelationId, + ForeignDataWrapperNameIndexId, + KEY(Anum_pg_foreign_data_wrapper_fdwname), + 2 + }, + [FOREIGNDATAWRAPPEROID] = { + ForeignDataWrapperRelationId, + ForeignDataWrapperOidIndexId, + KEY(Anum_pg_foreign_data_wrapper_oid), + 2 + }, + [FOREIGNSERVERNAME] = { + ForeignServerRelationId, + ForeignServerNameIndexId, + KEY(Anum_pg_foreign_server_srvname), + 2 + }, + [FOREIGNSERVEROID] = { + ForeignServerRelationId, + ForeignServerOidIndexId, + KEY(Anum_pg_foreign_server_oid), + 2 + }, + [FOREIGNTABLEREL] = { + ForeignTableRelationId, + ForeignTableRelidIndexId, + KEY(Anum_pg_foreign_table_ftrelid), + 4 + }, + [INDEXRELID] = { + IndexRelationId, + IndexRelidIndexId, + KEY(Anum_pg_index_indexrelid), + 64 + }, + [LANGNAME] = { + LanguageRelationId, + LanguageNameIndexId, + KEY(Anum_pg_language_lanname), + 4 + }, + [LANGOID] = { + LanguageRelationId, + LanguageOidIndexId, + KEY(Anum_pg_language_oid), + 4 + }, + [NAMESPACENAME] = { + NamespaceRelationId, + NamespaceNameIndexId, + KEY(Anum_pg_namespace_nspname), + 4 + }, + [NAMESPACEOID] = { + NamespaceRelationId, + NamespaceOidIndexId, + KEY(Anum_pg_namespace_oid), + 16 + }, + [OPERNAMENSP] = { + OperatorRelationId, + OperatorNameNspIndexId, + KEY(Anum_pg_operator_oprname, Anum_pg_operator_oprleft, Anum_pg_operator_oprright, Anum_pg_operator_oprnamespace), + 256 + }, + [OPEROID] = { + OperatorRelationId, + OperatorOidIndexId, + KEY(Anum_pg_operator_oid), + 32 + }, + [OPFAMILYAMNAMENSP] = { + OperatorFamilyRelationId, + OpfamilyAmNameNspIndexId, + KEY(Anum_pg_opfamily_opfmethod, Anum_pg_opfamily_opfname, Anum_pg_opfamily_opfnamespace), + 8 + }, + [OPFAMILYOID] = { + OperatorFamilyRelationId, + OpfamilyOidIndexId, + KEY(Anum_pg_opfamily_oid), + 8 + }, + [PARAMETERACLNAME] = { + ParameterAclRelationId, + ParameterAclParnameIndexId, + KEY(Anum_pg_parameter_acl_parname), + 4 + }, + [PARAMETERACLOID] = { + ParameterAclRelationId, + ParameterAclOidIndexId, + KEY(Anum_pg_parameter_acl_oid), + 4 + }, + [PARTRELID] = { + PartitionedRelationId, + PartitionedRelidIndexId, + KEY(Anum_pg_partitioned_table_partrelid), + 32 + }, + [PROCNAMEARGSNSP] = { + ProcedureRelationId, + ProcedureNameArgsNspIndexId, + KEY(Anum_pg_proc_proname, Anum_pg_proc_proargtypes, Anum_pg_proc_pronamespace), + 128 + }, + [PROCOID] = { + ProcedureRelationId, + ProcedureOidIndexId, + KEY(Anum_pg_proc_oid), + 128 + }, + [PUBLICATIONNAME] = { + PublicationRelationId, + PublicationNameIndexId, + KEY(Anum_pg_publication_pubname), + 8 + }, + [PUBLICATIONNAMESPACE] = { + PublicationNamespaceRelationId, + PublicationNamespaceObjectIndexId, + KEY(Anum_pg_publication_namespace_oid), + 64 + }, + [PUBLICATIONNAMESPACEMAP] = { + PublicationNamespaceRelationId, + PublicationNamespacePnnspidPnpubidIndexId, + KEY(Anum_pg_publication_namespace_pnnspid, Anum_pg_publication_namespace_pnpubid), + 64 + }, + [PUBLICATIONOID] = { + PublicationRelationId, + PublicationObjectIndexId, + KEY(Anum_pg_publication_oid), + 8 + }, + [PUBLICATIONREL] = { + PublicationRelRelationId, + PublicationRelObjectIndexId, + KEY(Anum_pg_publication_rel_oid), + 64 + }, + [PUBLICATIONRELMAP] = { + PublicationRelRelationId, + PublicationRelPrrelidPrpubidIndexId, + KEY(Anum_pg_publication_rel_prrelid, Anum_pg_publication_rel_prpubid), + 64 + }, + [RANGEMULTIRANGE] = { + RangeRelationId, + RangeMultirangeTypidIndexId, + KEY(Anum_pg_range_rngmultitypid), + 4 + }, + [RANGETYPE] = { + RangeRelationId, + RangeTypidIndexId, + KEY(Anum_pg_range_rngtypid), + 4 + }, + [RELNAMENSP] = { + RelationRelationId, + ClassNameNspIndexId, + KEY(Anum_pg_class_relname, Anum_pg_class_relnamespace), + 128 + }, + [RELOID] = { + RelationRelationId, + ClassOidIndexId, + KEY(Anum_pg_class_oid), + 128 + }, + [REPLORIGIDENT] = { + ReplicationOriginRelationId, + ReplicationOriginIdentIndex, + KEY(Anum_pg_replication_origin_roident), + 16 + }, + [REPLORIGNAME] = { + ReplicationOriginRelationId, + ReplicationOriginNameIndex, + KEY(Anum_pg_replication_origin_roname), + 16 + }, + [RULERELNAME] = { + RewriteRelationId, + RewriteRelRulenameIndexId, + KEY(Anum_pg_rewrite_ev_class, Anum_pg_rewrite_rulename), + 8 + }, + [SEQRELID] = { + SequenceRelationId, + SequenceRelidIndexId, + KEY(Anum_pg_sequence_seqrelid), + 32 + }, + [STATEXTDATASTXOID] = { + StatisticExtDataRelationId, + StatisticExtDataStxoidInhIndexId, + KEY(Anum_pg_statistic_ext_data_stxoid, Anum_pg_statistic_ext_data_stxdinherit), + 4 + }, + [STATEXTNAMENSP] = { + StatisticExtRelationId, + StatisticExtNameIndexId, + KEY(Anum_pg_statistic_ext_stxname, Anum_pg_statistic_ext_stxnamespace), + 4 + }, + [STATEXTOID] = { + StatisticExtRelationId, + StatisticExtOidIndexId, + KEY(Anum_pg_statistic_ext_oid), + 4 + }, + [STATRELATTINH] = { + StatisticRelationId, + StatisticRelidAttnumInhIndexId, + KEY(Anum_pg_statistic_starelid, Anum_pg_statistic_staattnum, Anum_pg_statistic_stainherit), + 128 + }, + [SUBSCRIPTIONNAME] = { + SubscriptionRelationId, + SubscriptionNameIndexId, + KEY(Anum_pg_subscription_subdbid, Anum_pg_subscription_subname), + 4 + }, + [SUBSCRIPTIONOID] = { + SubscriptionRelationId, + SubscriptionObjectIndexId, + KEY(Anum_pg_subscription_oid), + 4 + }, + [SUBSCRIPTIONRELMAP] = { + SubscriptionRelRelationId, + SubscriptionRelSrrelidSrsubidIndexId, + KEY(Anum_pg_subscription_rel_srrelid, Anum_pg_subscription_rel_srsubid), + 64 + }, + [TABLESPACEOID] = { + TableSpaceRelationId, + TablespaceOidIndexId, + KEY(Anum_pg_tablespace_oid), + 4 + }, + [TRFOID] = { + TransformRelationId, + TransformOidIndexId, + KEY(Anum_pg_transform_oid), + 16 + }, + [TRFTYPELANG] = { + TransformRelationId, + TransformTypeLangIndexId, + KEY(Anum_pg_transform_trftype, Anum_pg_transform_trflang), + 16 + }, + [TSCONFIGMAP] = { + TSConfigMapRelationId, + TSConfigMapIndexId, + KEY(Anum_pg_ts_config_map_mapcfg, Anum_pg_ts_config_map_maptokentype, Anum_pg_ts_config_map_mapseqno), + 2 + }, + [TSCONFIGNAMENSP] = { + TSConfigRelationId, + TSConfigNameNspIndexId, + KEY(Anum_pg_ts_config_cfgname, Anum_pg_ts_config_cfgnamespace), + 2 + }, + [TSCONFIGOID] = { + TSConfigRelationId, + TSConfigOidIndexId, + KEY(Anum_pg_ts_config_oid), + 2 + }, + [TSDICTNAMENSP] = { + TSDictionaryRelationId, + TSDictionaryNameNspIndexId, + KEY(Anum_pg_ts_dict_dictname, Anum_pg_ts_dict_dictnamespace), + 2 + }, + [TSDICTOID] = { + TSDictionaryRelationId, + TSDictionaryOidIndexId, + KEY(Anum_pg_ts_dict_oid), + 2 + }, + [TSPARSERNAMENSP] = { + TSParserRelationId, + TSParserNameNspIndexId, + KEY(Anum_pg_ts_parser_prsname, Anum_pg_ts_parser_prsnamespace), + 2 + }, + [TSPARSEROID] = { + TSParserRelationId, + TSParserOidIndexId, + KEY(Anum_pg_ts_parser_oid), + 2 + }, + [TSTEMPLATENAMENSP] = { + TSTemplateRelationId, + TSTemplateNameNspIndexId, + KEY(Anum_pg_ts_template_tmplname, Anum_pg_ts_template_tmplnamespace), + 2 + }, + [TSTEMPLATEOID] = { + TSTemplateRelationId, + TSTemplateOidIndexId, + KEY(Anum_pg_ts_template_oid), + 2 + }, + [TYPENAMENSP] = { + TypeRelationId, + TypeNameNspIndexId, + KEY(Anum_pg_type_typname, Anum_pg_type_typnamespace), + 64 + }, + [TYPEOID] = { + TypeRelationId, + TypeOidIndexId, + KEY(Anum_pg_type_oid), + 64 + }, + [USERMAPPINGOID] = { + UserMappingRelationId, + UserMappingOidIndexId, + KEY(Anum_pg_user_mapping_oid), + 2 + }, + [USERMAPPINGUSERSERVER] = { + UserMappingRelationId, + UserMappingUserServerIndexId, + KEY(Anum_pg_user_mapping_umuser, Anum_pg_user_mapping_umserver), + 2 + }, +}; diff --git a/platform/dbops/binaries/postgres/include/server/catalog/system_fk_info.h b/platform/dbops/binaries/postgres/include/server/catalog/system_fk_info.h new file mode 100644 index 0000000000000000000000000000000000000000..72bc285e4065b2751991d3fa9ae4d3483584734f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/system_fk_info.h @@ -0,0 +1,253 @@ +/*------------------------------------------------------------------------- + * + * system_fk_info.h + * Data about the foreign-key relationships in the system catalogs + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/catalog/genbki.pl + * + *------------------------------------------------------------------------- + */ +#ifndef SYSTEM_FK_INFO_H +#define SYSTEM_FK_INFO_H + +typedef struct SysFKRelationship +{ + Oid fk_table; /* referencing catalog */ + Oid pk_table; /* referenced catalog */ + const char *fk_columns; /* referencing column name(s) */ + const char *pk_columns; /* referenced column name(s) */ + bool is_array; /* if true, last fk_column is an array */ + bool is_opt; /* if true, fk_column can be zero */ +} SysFKRelationship; + +static const SysFKRelationship sys_fk_relationships[] = { + { /* pg_proc */ 1255, /* pg_namespace */ 2615, "{pronamespace}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_authid */ 1260, "{proowner}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_language */ 2612, "{prolang}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{provariadic}", "{oid}", false, true}, + { /* pg_proc */ 1255, /* pg_proc */ 1255, "{prosupport}", "{oid}", false, true}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{prorettype}", "{oid}", false, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{proargtypes}", "{oid}", true, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{proallargtypes}", "{oid}", true, false}, + { /* pg_proc */ 1255, /* pg_type */ 1247, "{protrftypes}", "{oid}", true, false}, + { /* pg_type */ 1247, /* pg_namespace */ 2615, "{typnamespace}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_authid */ 1260, "{typowner}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_class */ 1259, "{typrelid}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typsubscript}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typelem}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typarray}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typinput}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typoutput}", "{oid}", false, false}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typreceive}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typsend}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typmodin}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typmodout}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_proc */ 1255, "{typanalyze}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_type */ 1247, "{typbasetype}", "{oid}", false, true}, + { /* pg_type */ 1247, /* pg_collation */ 3456, "{typcollation}", "{oid}", false, true}, + { /* pg_attribute */ 1249, /* pg_class */ 1259, "{attrelid}", "{oid}", false, false}, + { /* pg_attribute */ 1249, /* pg_type */ 1247, "{atttypid}", "{oid}", false, true}, + { /* pg_attribute */ 1249, /* pg_collation */ 3456, "{attcollation}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_namespace */ 2615, "{relnamespace}", "{oid}", false, false}, + { /* pg_class */ 1259, /* pg_type */ 1247, "{reltype}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_type */ 1247, "{reloftype}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_authid */ 1260, "{relowner}", "{oid}", false, false}, + { /* pg_class */ 1259, /* pg_am */ 2601, "{relam}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_tablespace */ 1213, "{reltablespace}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_class */ 1259, "{reltoastrelid}", "{oid}", false, true}, + { /* pg_class */ 1259, /* pg_class */ 1259, "{relrewrite}", "{oid}", false, true}, + { /* pg_attrdef */ 2604, /* pg_class */ 1259, "{adrelid}", "{oid}", false, false}, + { /* pg_attrdef */ 2604, /* pg_attribute */ 1249, "{adrelid, adnum}", "{attrelid, attnum}", false, false}, + { /* pg_constraint */ 2606, /* pg_namespace */ 2615, "{connamespace}", "{oid}", false, false}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{conrelid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_type */ 1247, "{contypid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{conindid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_constraint */ 2606, "{conparentid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_class */ 1259, "{confrelid}", "{oid}", false, true}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conpfeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conppeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conffeqop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_operator */ 2617, "{conexclop}", "{oid}", true, false}, + { /* pg_constraint */ 2606, /* pg_attribute */ 1249, "{conrelid, conkey}", "{attrelid, attnum}", true, true}, + { /* pg_constraint */ 2606, /* pg_attribute */ 1249, "{confrelid, confkey}", "{attrelid, attnum}", true, false}, + { /* pg_inherits */ 2611, /* pg_class */ 1259, "{inhrelid}", "{oid}", false, false}, + { /* pg_inherits */ 2611, /* pg_class */ 1259, "{inhparent}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_class */ 1259, "{indexrelid}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_class */ 1259, "{indrelid}", "{oid}", false, false}, + { /* pg_index */ 2610, /* pg_collation */ 3456, "{indcollation}", "{oid}", true, true}, + { /* pg_index */ 2610, /* pg_opclass */ 2616, "{indclass}", "{oid}", true, false}, + { /* pg_index */ 2610, /* pg_attribute */ 1249, "{indrelid, indkey}", "{attrelid, attnum}", true, true}, + { /* pg_operator */ 2617, /* pg_namespace */ 2615, "{oprnamespace}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_authid */ 1260, "{oprowner}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprleft}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprright}", "{oid}", false, false}, + { /* pg_operator */ 2617, /* pg_type */ 1247, "{oprresult}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_operator */ 2617, "{oprcom}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_operator */ 2617, "{oprnegate}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprcode}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprrest}", "{oid}", false, true}, + { /* pg_operator */ 2617, /* pg_proc */ 1255, "{oprjoin}", "{oid}", false, true}, + { /* pg_opfamily */ 2753, /* pg_am */ 2601, "{opfmethod}", "{oid}", false, false}, + { /* pg_opfamily */ 2753, /* pg_namespace */ 2615, "{opfnamespace}", "{oid}", false, false}, + { /* pg_opfamily */ 2753, /* pg_authid */ 1260, "{opfowner}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_am */ 2601, "{opcmethod}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_namespace */ 2615, "{opcnamespace}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_authid */ 1260, "{opcowner}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_opfamily */ 2753, "{opcfamily}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_type */ 1247, "{opcintype}", "{oid}", false, false}, + { /* pg_opclass */ 2616, /* pg_type */ 1247, "{opckeytype}", "{oid}", false, true}, + { /* pg_am */ 2601, /* pg_proc */ 1255, "{amhandler}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_opfamily */ 2753, "{amopfamily}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_type */ 1247, "{amoplefttype}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_type */ 1247, "{amoprighttype}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_operator */ 2617, "{amopopr}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_am */ 2601, "{amopmethod}", "{oid}", false, false}, + { /* pg_amop */ 2602, /* pg_opfamily */ 2753, "{amopsortfamily}", "{oid}", false, true}, + { /* pg_amproc */ 2603, /* pg_opfamily */ 2753, "{amprocfamily}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_type */ 1247, "{amproclefttype}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_type */ 1247, "{amprocrighttype}", "{oid}", false, false}, + { /* pg_amproc */ 2603, /* pg_proc */ 1255, "{amproc}", "{oid}", false, false}, + { /* pg_language */ 2612, /* pg_authid */ 1260, "{lanowner}", "{oid}", false, false}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{lanplcallfoid}", "{oid}", false, true}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{laninline}", "{oid}", false, true}, + { /* pg_language */ 2612, /* pg_proc */ 1255, "{lanvalidator}", "{oid}", false, true}, + { /* pg_largeobject_metadata */ 2995, /* pg_authid */ 1260, "{lomowner}", "{oid}", false, false}, + { /* pg_largeobject */ 2613, /* pg_largeobject_metadata */ 2995, "{loid}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggfnoid}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggtransfn}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggfinalfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggcombinefn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggserialfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggdeserialfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggmtransfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggminvtransfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_proc */ 1255, "{aggmfinalfn}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_operator */ 2617, "{aggsortop}", "{oid}", false, true}, + { /* pg_aggregate */ 2600, /* pg_type */ 1247, "{aggtranstype}", "{oid}", false, false}, + { /* pg_aggregate */ 2600, /* pg_type */ 1247, "{aggmtranstype}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_class */ 1259, "{starelid}", "{oid}", false, false}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop1}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop2}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop3}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop4}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_operator */ 2617, "{staop5}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll1}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll2}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll3}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll4}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_collation */ 3456, "{stacoll5}", "{oid}", false, true}, + { /* pg_statistic */ 2619, /* pg_attribute */ 1249, "{starelid, staattnum}", "{attrelid, attnum}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_class */ 1259, "{stxrelid}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_namespace */ 2615, "{stxnamespace}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_authid */ 1260, "{stxowner}", "{oid}", false, false}, + { /* pg_statistic_ext */ 3381, /* pg_attribute */ 1249, "{stxrelid, stxkeys}", "{attrelid, attnum}", true, false}, + { /* pg_statistic_ext_data */ 3429, /* pg_statistic_ext */ 3381, "{stxoid}", "{oid}", false, false}, + { /* pg_rewrite */ 2618, /* pg_class */ 1259, "{ev_class}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgrelid}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_trigger */ 2620, "{tgparentid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_proc */ 1255, "{tgfoid}", "{oid}", false, false}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgconstrrelid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_class */ 1259, "{tgconstrindid}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_constraint */ 2606, "{tgconstraint}", "{oid}", false, true}, + { /* pg_trigger */ 2620, /* pg_attribute */ 1249, "{tgrelid, tgattr}", "{attrelid, attnum}", true, false}, + { /* pg_event_trigger */ 3466, /* pg_authid */ 1260, "{evtowner}", "{oid}", false, false}, + { /* pg_event_trigger */ 3466, /* pg_proc */ 1255, "{evtfoid}", "{oid}", false, false}, + { /* pg_description */ 2609, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_type */ 1247, "{castsource}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_type */ 1247, "{casttarget}", "{oid}", false, false}, + { /* pg_cast */ 2605, /* pg_proc */ 1255, "{castfunc}", "{oid}", false, true}, + { /* pg_enum */ 3501, /* pg_type */ 1247, "{enumtypid}", "{oid}", false, false}, + { /* pg_namespace */ 2615, /* pg_authid */ 1260, "{nspowner}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_namespace */ 2615, "{connamespace}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_authid */ 1260, "{conowner}", "{oid}", false, false}, + { /* pg_conversion */ 2607, /* pg_proc */ 1255, "{conproc}", "{oid}", false, false}, + { /* pg_depend */ 2608, /* pg_class */ 1259, "{classid}", "{oid}", false, false}, + { /* pg_depend */ 2608, /* pg_class */ 1259, "{refclassid}", "{oid}", false, false}, + { /* pg_database */ 1262, /* pg_authid */ 1260, "{datdba}", "{oid}", false, false}, + { /* pg_database */ 1262, /* pg_tablespace */ 1213, "{dattablespace}", "{oid}", false, false}, + { /* pg_db_role_setting */ 2964, /* pg_database */ 1262, "{setdatabase}", "{oid}", false, true}, + { /* pg_db_role_setting */ 2964, /* pg_authid */ 1260, "{setrole}", "{oid}", false, true}, + { /* pg_tablespace */ 1213, /* pg_authid */ 1260, "{spcowner}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{roleid}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{member}", "{oid}", false, false}, + { /* pg_auth_members */ 1261, /* pg_authid */ 1260, "{grantor}", "{oid}", false, false}, + { /* pg_shdepend */ 1214, /* pg_database */ 1262, "{dbid}", "{oid}", false, true}, + { /* pg_shdepend */ 1214, /* pg_class */ 1259, "{classid}", "{oid}", false, false}, + { /* pg_shdepend */ 1214, /* pg_class */ 1259, "{refclassid}", "{oid}", false, false}, + { /* pg_shdescription */ 2396, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_namespace */ 2615, "{cfgnamespace}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_authid */ 1260, "{cfgowner}", "{oid}", false, false}, + { /* pg_ts_config */ 3602, /* pg_ts_parser */ 3601, "{cfgparser}", "{oid}", false, false}, + { /* pg_ts_config_map */ 3603, /* pg_ts_config */ 3602, "{mapcfg}", "{oid}", false, false}, + { /* pg_ts_config_map */ 3603, /* pg_ts_dict */ 3600, "{mapdict}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_namespace */ 2615, "{dictnamespace}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_authid */ 1260, "{dictowner}", "{oid}", false, false}, + { /* pg_ts_dict */ 3600, /* pg_ts_template */ 3764, "{dicttemplate}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_namespace */ 2615, "{prsnamespace}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsstart}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prstoken}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsend}", "{oid}", false, false}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prsheadline}", "{oid}", false, true}, + { /* pg_ts_parser */ 3601, /* pg_proc */ 1255, "{prslextype}", "{oid}", false, false}, + { /* pg_ts_template */ 3764, /* pg_namespace */ 2615, "{tmplnamespace}", "{oid}", false, false}, + { /* pg_ts_template */ 3764, /* pg_proc */ 1255, "{tmplinit}", "{oid}", false, true}, + { /* pg_ts_template */ 3764, /* pg_proc */ 1255, "{tmpllexize}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_authid */ 1260, "{extowner}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_namespace */ 2615, "{extnamespace}", "{oid}", false, false}, + { /* pg_extension */ 3079, /* pg_class */ 1259, "{extconfig}", "{oid}", true, false}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_authid */ 1260, "{fdwowner}", "{oid}", false, false}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_proc */ 1255, "{fdwhandler}", "{oid}", false, true}, + { /* pg_foreign_data_wrapper */ 2328, /* pg_proc */ 1255, "{fdwvalidator}", "{oid}", false, true}, + { /* pg_foreign_server */ 1417, /* pg_authid */ 1260, "{srvowner}", "{oid}", false, false}, + { /* pg_foreign_server */ 1417, /* pg_foreign_data_wrapper */ 2328, "{srvfdw}", "{oid}", false, false}, + { /* pg_user_mapping */ 1418, /* pg_authid */ 1260, "{umuser}", "{oid}", false, true}, + { /* pg_user_mapping */ 1418, /* pg_foreign_server */ 1417, "{umserver}", "{oid}", false, false}, + { /* pg_foreign_table */ 3118, /* pg_class */ 1259, "{ftrelid}", "{oid}", false, false}, + { /* pg_foreign_table */ 3118, /* pg_foreign_server */ 1417, "{ftserver}", "{oid}", false, false}, + { /* pg_policy */ 3256, /* pg_class */ 1259, "{polrelid}", "{oid}", false, false}, + { /* pg_policy */ 3256, /* pg_authid */ 1260, "{polroles}", "{oid}", true, true}, + { /* pg_default_acl */ 826, /* pg_authid */ 1260, "{defaclrole}", "{oid}", false, false}, + { /* pg_default_acl */ 826, /* pg_namespace */ 2615, "{defaclnamespace}", "{oid}", false, true}, + { /* pg_init_privs */ 3394, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_seclabel */ 3596, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_shseclabel */ 3592, /* pg_class */ 1259, "{classoid}", "{oid}", false, false}, + { /* pg_collation */ 3456, /* pg_namespace */ 2615, "{collnamespace}", "{oid}", false, false}, + { /* pg_collation */ 3456, /* pg_authid */ 1260, "{collowner}", "{oid}", false, false}, + { /* pg_partitioned_table */ 3350, /* pg_class */ 1259, "{partrelid}", "{oid}", false, false}, + { /* pg_partitioned_table */ 3350, /* pg_class */ 1259, "{partdefid}", "{oid}", false, true}, + { /* pg_partitioned_table */ 3350, /* pg_opclass */ 2616, "{partclass}", "{oid}", true, false}, + { /* pg_partitioned_table */ 3350, /* pg_collation */ 3456, "{partcollation}", "{oid}", true, true}, + { /* pg_partitioned_table */ 3350, /* pg_attribute */ 1249, "{partrelid, partattrs}", "{attrelid, attnum}", true, true}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngtypid}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngsubtype}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_type */ 1247, "{rngmultitypid}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_collation */ 3456, "{rngcollation}", "{oid}", false, true}, + { /* pg_range */ 3541, /* pg_opclass */ 2616, "{rngsubopc}", "{oid}", false, false}, + { /* pg_range */ 3541, /* pg_proc */ 1255, "{rngcanonical}", "{oid}", false, true}, + { /* pg_range */ 3541, /* pg_proc */ 1255, "{rngsubdiff}", "{oid}", false, true}, + { /* pg_transform */ 3576, /* pg_type */ 1247, "{trftype}", "{oid}", false, false}, + { /* pg_transform */ 3576, /* pg_language */ 2612, "{trflang}", "{oid}", false, false}, + { /* pg_transform */ 3576, /* pg_proc */ 1255, "{trffromsql}", "{oid}", false, true}, + { /* pg_transform */ 3576, /* pg_proc */ 1255, "{trftosql}", "{oid}", false, true}, + { /* pg_sequence */ 2224, /* pg_class */ 1259, "{seqrelid}", "{oid}", false, false}, + { /* pg_sequence */ 2224, /* pg_type */ 1247, "{seqtypid}", "{oid}", false, false}, + { /* pg_publication */ 6104, /* pg_authid */ 1260, "{pubowner}", "{oid}", false, false}, + { /* pg_publication_namespace */ 6237, /* pg_publication */ 6104, "{pnpubid}", "{oid}", false, false}, + { /* pg_publication_namespace */ 6237, /* pg_namespace */ 2615, "{pnnspid}", "{oid}", false, false}, + { /* pg_publication_rel */ 6106, /* pg_publication */ 6104, "{prpubid}", "{oid}", false, false}, + { /* pg_publication_rel */ 6106, /* pg_class */ 1259, "{prrelid}", "{oid}", false, false}, + { /* pg_subscription */ 6100, /* pg_database */ 1262, "{subdbid}", "{oid}", false, false}, + { /* pg_subscription */ 6100, /* pg_authid */ 1260, "{subowner}", "{oid}", false, false}, + { /* pg_subscription_rel */ 6102, /* pg_subscription */ 6100, "{srsubid}", "{oid}", false, false}, + { /* pg_subscription_rel */ 6102, /* pg_class */ 1259, "{srrelid}", "{oid}", false, false}, +}; + +#endif /* SYSTEM_FK_INFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/catalog/toasting.h b/platform/dbops/binaries/postgres/include/server/catalog/toasting.h new file mode 100644 index 0000000000000000000000000000000000000000..725f31617bbe0073625740f6afafbf68b6e339a5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/catalog/toasting.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * toasting.h + * This file provides some definitions to support creation of toast tables + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/toasting.h + * + *------------------------------------------------------------------------- + */ +#ifndef TOASTING_H +#define TOASTING_H + +#include "storage/lock.h" + +/* + * toasting.c prototypes + */ +extern void NewRelationCreateToastTable(Oid relOid, Datum reloptions); +extern void NewHeapCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode, Oid OIDOldToast); +extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions, + LOCKMODE lockmode); +extern void BootstrapToastTable(char *relName, + Oid toastOid, Oid toastIndexOid); + +#endif /* TOASTING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/alter.h b/platform/dbops/binaries/postgres/include/server/commands/alter.h new file mode 100644 index 0000000000000000000000000000000000000000..f00af75befff17108e3b51c34fd464fa85a7e20d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/alter.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * alter.h + * prototypes for commands/alter.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/alter.h + * + *------------------------------------------------------------------------- + */ +#ifndef ALTER_H +#define ALTER_H + +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress ExecRenameStmt(RenameStmt *stmt); + +extern ObjectAddress ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, + ObjectAddress *refAddress); +extern ObjectAddress ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, + ObjectAddress *oldSchemaAddr); +extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid, + ObjectAddresses *objsMoved); + +extern ObjectAddress ExecAlterOwnerStmt(AlterOwnerStmt *stmt); +extern void AlterObjectOwner_internal(Oid classId, Oid objectId, + Oid new_ownerId); + +#endif /* ALTER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/async.h b/platform/dbops/binaries/postgres/include/server/commands/async.h new file mode 100644 index 0000000000000000000000000000000000000000..78daa25fa0806166e84fb49073797ce773d39cff --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/async.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * async.h + * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/async.h + * + *------------------------------------------------------------------------- + */ +#ifndef ASYNC_H +#define ASYNC_H + +#include + +extern PGDLLIMPORT bool Trace_notify; +extern PGDLLIMPORT int max_notify_queue_pages; +extern PGDLLIMPORT volatile sig_atomic_t notifyInterruptPending; + +extern Size AsyncShmemSize(void); +extern void AsyncShmemInit(void); + +extern void NotifyMyFrontEnd(const char *channel, + const char *payload, + int32 srcPid); + +/* notify-related SQL statements */ +extern void Async_Notify(const char *channel, const char *payload); +extern void Async_Listen(const char *channel); +extern void Async_Unlisten(const char *channel); +extern void Async_UnlistenAll(void); + +/* perform (or cancel) outbound notify processing at transaction commit */ +extern void PreCommit_Notify(void); +extern void AtCommit_Notify(void); +extern void AtAbort_Notify(void); +extern void AtSubCommit_Notify(void); +extern void AtSubAbort_Notify(void); +extern void AtPrepare_Notify(void); + +/* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ +extern void HandleNotifyInterrupt(void); + +/* process interrupts */ +extern void ProcessNotifyInterrupt(bool flush); + +#endif /* ASYNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/cluster.h b/platform/dbops/binaries/postgres/include/server/commands/cluster.h new file mode 100644 index 0000000000000000000000000000000000000000..4e3238041712bfeb5f1324742a24f44449ab8084 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/cluster.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * cluster.h + * header file for postgres cluster command stuff + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/cluster.h + * + *------------------------------------------------------------------------- + */ +#ifndef CLUSTER_H +#define CLUSTER_H + +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "storage/lock.h" +#include "utils/relcache.h" + + +/* flag bits for ClusterParams->options */ +#define CLUOPT_VERBOSE 0x01 /* print progress info */ +#define CLUOPT_RECHECK 0x02 /* recheck relation state */ +#define CLUOPT_RECHECK_ISCLUSTERED 0x04 /* recheck relation state for + * indisclustered */ + +/* options for CLUSTER */ +typedef struct ClusterParams +{ + bits32 options; /* bitmask of CLUOPT_* */ +} ClusterParams; + +extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel); +extern void cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params); +extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, + LOCKMODE lockmode); +extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal); + +extern Oid make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod, + char relpersistence, LOCKMODE lockmode); +extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, + bool is_system_catalog, + bool swap_toast_by_content, + bool check_constraints, + bool is_internal, + TransactionId frozenXid, + MultiXactId cutoffMulti, + char newrelpersistence); + +#endif /* CLUSTER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/collationcmds.h b/platform/dbops/binaries/postgres/include/server/commands/collationcmds.h new file mode 100644 index 0000000000000000000000000000000000000000..718f021656b3f2b3a037d0b8d63448315871f95a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/collationcmds.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * collationcmds.h + * prototypes for collationcmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/collationcmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef COLLATIONCMDS_H +#define COLLATIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + +extern ObjectAddress DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_exists); +extern void IsThereCollationInNamespace(const char *collname, Oid nspOid); +extern ObjectAddress AlterCollation(AlterCollationStmt *stmt); + +#endif /* COLLATIONCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/comment.h b/platform/dbops/binaries/postgres/include/server/commands/comment.h new file mode 100644 index 0000000000000000000000000000000000000000..18c089de3c0697fdd60dca69e3036d0ca71190c2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/comment.h @@ -0,0 +1,45 @@ +/* + * src/include/commands/comment.h + * + *------------------------------------------------------------------------- + * + * comment.h + * + * Prototypes for functions in commands/comment.c + * + * Copyright (c) 1999-2024, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ + +#ifndef COMMENT_H +#define COMMENT_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +/*------------------------------------------------------------------ + * Function Prototypes -- + * + * The following prototypes define the public functions of the comment + * related routines. CommentObject() implements the SQL "COMMENT ON" + * command. DeleteComments() deletes all comments for an object. + * CreateComments creates (or deletes, if comment is NULL) a comment + * for a specific key. There are versions of these two methods for + * both normal and shared objects. + *------------------------------------------------------------------ + */ + +extern ObjectAddress CommentObject(CommentStmt *stmt); + +extern void DeleteComments(Oid oid, Oid classoid, int32 subid); + +extern void CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment); + +extern void DeleteSharedComments(Oid oid, Oid classoid); + +extern void CreateSharedComments(Oid oid, Oid classoid, const char *comment); + +extern char *GetComment(Oid oid, Oid classoid, int32 subid); + +#endif /* COMMENT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/conversioncmds.h b/platform/dbops/binaries/postgres/include/server/commands/conversioncmds.h new file mode 100644 index 0000000000000000000000000000000000000000..dc2a1e64ef4ae12f18f67b4e9d87a93360673b9b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/conversioncmds.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * conversioncmds.h + * prototypes for conversioncmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/conversioncmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CONVERSIONCMDS_H +#define CONVERSIONCMDS_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress CreateConversionCommand(CreateConversionStmt *stmt); + +#endif /* CONVERSIONCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/copy.h b/platform/dbops/binaries/postgres/include/server/commands/copy.h new file mode 100644 index 0000000000000000000000000000000000000000..141fd48dc10dfb30263af96625d503acc142b7a1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/copy.h @@ -0,0 +1,127 @@ +/*------------------------------------------------------------------------- + * + * copy.h + * Definitions for using the POSTGRES copy command. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/copy.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPY_H +#define COPY_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" + +/* + * Represents whether a header line should be present, and whether it must + * match the actual names (which implies "true"). + */ +typedef enum CopyHeaderChoice +{ + COPY_HEADER_FALSE = 0, + COPY_HEADER_TRUE, + COPY_HEADER_MATCH, +} CopyHeaderChoice; + +/* + * Represents where to save input processing errors. More values to be added + * in the future. + */ +typedef enum CopyOnErrorChoice +{ + COPY_ON_ERROR_STOP = 0, /* immediately throw errors, default */ + COPY_ON_ERROR_IGNORE, /* ignore errors */ +} CopyOnErrorChoice; + +/* + * Represents verbosity of logged messages by COPY command. + */ +typedef enum CopyLogVerbosityChoice +{ + COPY_LOG_VERBOSITY_DEFAULT = 0, /* logs no additional messages, default */ + COPY_LOG_VERBOSITY_VERBOSE, /* logs additional messages */ +} CopyLogVerbosityChoice; + +/* + * A struct to hold COPY options, in a parsed form. All of these are related + * to formatting, except for 'freeze', which doesn't really belong here, but + * it's expedient to parse it along with all the other options. + */ +typedef struct CopyFormatOptions +{ + /* parameters from the COPY command */ + int file_encoding; /* file or remote side's character encoding, + * -1 if not specified */ + bool binary; /* binary format? */ + bool freeze; /* freeze rows on loading? */ + bool csv_mode; /* Comma Separated Value format? */ + CopyHeaderChoice header_line; /* header line? */ + char *null_print; /* NULL marker string (server encoding!) */ + int null_print_len; /* length of same */ + char *null_print_client; /* same converted to file encoding */ + char *default_print; /* DEFAULT marker string */ + int default_print_len; /* length of same */ + char *delim; /* column delimiter (must be 1 byte) */ + char *quote; /* CSV quote char (must be 1 byte) */ + char *escape; /* CSV escape char (must be 1 byte) */ + List *force_quote; /* list of column names */ + bool force_quote_all; /* FORCE_QUOTE *? */ + bool *force_quote_flags; /* per-column CSV FQ flags */ + List *force_notnull; /* list of column names */ + bool force_notnull_all; /* FORCE_NOT_NULL *? */ + bool *force_notnull_flags; /* per-column CSV FNN flags */ + List *force_null; /* list of column names */ + bool force_null_all; /* FORCE_NULL *? */ + bool *force_null_flags; /* per-column CSV FN flags */ + bool convert_selectively; /* do selective binary conversion? */ + CopyOnErrorChoice on_error; /* what to do when error happened */ + CopyLogVerbosityChoice log_verbosity; /* verbosity of logged messages */ + List *convert_select; /* list of column names (can be NIL) */ +} CopyFormatOptions; + +/* These are private in commands/copy[from|to].c */ +typedef struct CopyFromStateData *CopyFromState; +typedef struct CopyToStateData *CopyToState; + +typedef int (*copy_data_source_cb) (void *outbuf, int minread, int maxread); +typedef void (*copy_data_dest_cb) (void *data, int len); + +extern void DoCopy(ParseState *pstate, const CopyStmt *stmt, + int stmt_location, int stmt_len, + uint64 *processed); + +extern void ProcessCopyOptions(ParseState *pstate, CopyFormatOptions *opts_out, bool is_from, List *options); +extern CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, Node *whereClause, + const char *filename, + bool is_program, copy_data_source_cb data_source_cb, List *attnamelist, List *options); +extern void EndCopyFrom(CopyFromState cstate); +extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext, + Datum *values, bool *nulls); +extern bool NextCopyFromRawFields(CopyFromState cstate, + char ***fields, int *nfields); +extern void CopyFromErrorCallback(void *arg); +extern char *CopyLimitPrintoutLength(const char *str); + +extern uint64 CopyFrom(CopyFromState cstate); + +extern DestReceiver *CreateCopyDestReceiver(void); + +/* + * internal prototypes + */ +extern CopyToState BeginCopyTo(ParseState *pstate, Relation rel, RawStmt *raw_query, + Oid queryRelId, const char *filename, bool is_program, + copy_data_dest_cb data_dest_cb, List *attnamelist, List *options); +extern void EndCopyTo(CopyToState cstate); +extern uint64 DoCopyTo(CopyToState cstate); +extern List *CopyGetAttnums(TupleDesc tupDesc, Relation rel, + List *attnamelist); + +#endif /* COPY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/copyfrom_internal.h b/platform/dbops/binaries/postgres/include/server/commands/copyfrom_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..cad52fcc78370140e27db65afd2f0233f588e88b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/copyfrom_internal.h @@ -0,0 +1,186 @@ +/*------------------------------------------------------------------------- + * + * copyfrom_internal.h + * Internal definitions for COPY FROM command. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/copyfrom_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPYFROM_INTERNAL_H +#define COPYFROM_INTERNAL_H + +#include "commands/copy.h" +#include "commands/trigger.h" +#include "nodes/miscnodes.h" + +/* + * Represents the different source cases we need to worry about at + * the bottom level + */ +typedef enum CopySource +{ + COPY_FILE, /* from file (or a piped program) */ + COPY_FRONTEND, /* from frontend */ + COPY_CALLBACK, /* from callback function */ +} CopySource; + +/* + * Represents the end-of-line terminator type of the input + */ +typedef enum EolType +{ + EOL_UNKNOWN, + EOL_NL, + EOL_CR, + EOL_CRNL, +} EolType; + +/* + * Represents the insert method to be used during COPY FROM. + */ +typedef enum CopyInsertMethod +{ + CIM_SINGLE, /* use table_tuple_insert or ExecForeignInsert */ + CIM_MULTI, /* always use table_multi_insert or + * ExecForeignBatchInsert */ + CIM_MULTI_CONDITIONAL, /* use table_multi_insert or + * ExecForeignBatchInsert only if valid */ +} CopyInsertMethod; + +/* + * This struct contains all the state variables used throughout a COPY FROM + * operation. + */ +typedef struct CopyFromStateData +{ + /* low-level state data */ + CopySource copy_src; /* type of copy source */ + FILE *copy_file; /* used if copy_src == COPY_FILE */ + StringInfo fe_msgbuf; /* used if copy_src == COPY_FRONTEND */ + + EolType eol_type; /* EOL type of input */ + int file_encoding; /* file or remote side's character encoding */ + bool need_transcoding; /* file encoding diff from server? */ + Oid conversion_proc; /* encoding conversion function */ + + /* parameters from the COPY command */ + Relation rel; /* relation to copy from */ + List *attnumlist; /* integer list of attnums to copy */ + char *filename; /* filename, or NULL for STDIN */ + bool is_program; /* is 'filename' a program to popen? */ + copy_data_source_cb data_source_cb; /* function for reading data */ + + CopyFormatOptions opts; + bool *convert_select_flags; /* per-column CSV/TEXT CS flags */ + Node *whereClause; /* WHERE condition (or NULL) */ + + /* these are just for error messages, see CopyFromErrorCallback */ + const char *cur_relname; /* table name for error messages */ + uint64 cur_lineno; /* line number for error messages */ + const char *cur_attname; /* current att for error messages */ + const char *cur_attval; /* current att value for error messages */ + bool relname_only; /* don't output line number, att, etc. */ + + /* + * Working state + */ + MemoryContext copycontext; /* per-copy execution context */ + + AttrNumber num_defaults; /* count of att that are missing and have + * default value */ + FmgrInfo *in_functions; /* array of input functions for each attrs */ + Oid *typioparams; /* array of element types for in_functions */ + ErrorSaveContext *escontext; /* soft error trapper during in_functions + * execution */ + uint64 num_errors; /* total number of rows which contained soft + * errors */ + int *defmap; /* array of default att numbers related to + * missing att */ + ExprState **defexprs; /* array of default att expressions for all + * att */ + bool *defaults; /* if DEFAULT marker was found for + * corresponding att */ + bool volatile_defexprs; /* is any of defexprs volatile? */ + List *range_table; /* single element list of RangeTblEntry */ + List *rteperminfos; /* single element list of RTEPermissionInfo */ + ExprState *qualexpr; + + TransitionCaptureState *transition_capture; + + /* + * These variables are used to reduce overhead in COPY FROM. + * + * attribute_buf holds the separated, de-escaped text for each field of + * the current line. The CopyReadAttributes functions return arrays of + * pointers into this buffer. We avoid palloc/pfree overhead by re-using + * the buffer on each cycle. + * + * In binary COPY FROM, attribute_buf holds the binary data for the + * current field, but the usage is otherwise similar. + */ + StringInfoData attribute_buf; + + /* field raw data pointers found by COPY FROM */ + + int max_fields; + char **raw_fields; + + /* + * Similarly, line_buf holds the whole input line being processed. The + * input cycle is first to read the whole line into line_buf, and then + * extract the individual attribute fields into attribute_buf. line_buf + * is preserved unmodified so that we can display it in error messages if + * appropriate. (In binary mode, line_buf is not used.) + */ + StringInfoData line_buf; + bool line_buf_valid; /* contains the row being processed? */ + + /* + * input_buf holds input data, already converted to database encoding. + * + * In text mode, CopyReadLine parses this data sufficiently to locate line + * boundaries, then transfers the data to line_buf. We guarantee that + * there is a \0 at input_buf[input_buf_len] at all times. (In binary + * mode, input_buf is not used.) + * + * If encoding conversion is not required, input_buf is not a separate + * buffer but points directly to raw_buf. In that case, input_buf_len + * tracks the number of bytes that have been verified as valid in the + * database encoding, and raw_buf_len is the total number of bytes stored + * in the buffer. + */ +#define INPUT_BUF_SIZE 65536 /* we palloc INPUT_BUF_SIZE+1 bytes */ + char *input_buf; + int input_buf_index; /* next byte to process */ + int input_buf_len; /* total # of bytes stored */ + bool input_reached_eof; /* true if we reached EOF */ + bool input_reached_error; /* true if a conversion error happened */ + /* Shorthand for number of unconsumed bytes available in input_buf */ +#define INPUT_BUF_BYTES(cstate) ((cstate)->input_buf_len - (cstate)->input_buf_index) + + /* + * raw_buf holds raw input data read from the data source (file or client + * connection), not yet converted to the database encoding. Like with + * 'input_buf', we guarantee that there is a \0 at raw_buf[raw_buf_len]. + */ +#define RAW_BUF_SIZE 65536 /* we palloc RAW_BUF_SIZE+1 bytes */ + char *raw_buf; + int raw_buf_index; /* next byte to process */ + int raw_buf_len; /* total # of bytes stored */ + bool raw_reached_eof; /* true if we reached EOF */ + + /* Shorthand for number of unconsumed bytes available in raw_buf */ +#define RAW_BUF_BYTES(cstate) ((cstate)->raw_buf_len - (cstate)->raw_buf_index) + + uint64 bytes_processed; /* number of bytes processed so far */ +} CopyFromStateData; + +extern void ReceiveCopyBegin(CopyFromState cstate); +extern void ReceiveCopyBinaryHeader(CopyFromState cstate); + +#endif /* COPYFROM_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/createas.h b/platform/dbops/binaries/postgres/include/server/commands/createas.h new file mode 100644 index 0000000000000000000000000000000000000000..94678e3834d2bfd28f0221b671f2532576fe49ee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/createas.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * createas.h + * prototypes for createas.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/createas.h + * + *------------------------------------------------------------------------- + */ +#ifndef CREATEAS_H +#define CREATEAS_H + +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" +#include "utils/queryenvironment.h" + + +extern ObjectAddress ExecCreateTableAs(ParseState *pstate, CreateTableAsStmt *stmt, + ParamListInfo params, QueryEnvironment *queryEnv, + QueryCompletion *qc); + +extern int GetIntoRelEFlags(IntoClause *intoClause); + +extern DestReceiver *CreateIntoRelDestReceiver(IntoClause *intoClause); + +extern bool CreateTableAsRelExists(CreateTableAsStmt *ctas); + +#endif /* CREATEAS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/dbcommands.h b/platform/dbops/binaries/postgres/include/server/commands/dbcommands.h new file mode 100644 index 0000000000000000000000000000000000000000..92e17c711585762aa98c14dba996448cf993b458 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/dbcommands.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * dbcommands.h + * Database management commands (create/drop database). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/dbcommands.h + * + *------------------------------------------------------------------------- + */ +#ifndef DBCOMMANDS_H +#define DBCOMMANDS_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "lib/stringinfo.h" +#include "parser/parse_node.h" + +extern Oid createdb(ParseState *pstate, const CreatedbStmt *stmt); +extern void dropdb(const char *dbname, bool missing_ok, bool force); +extern void DropDatabase(ParseState *pstate, DropdbStmt *stmt); +extern ObjectAddress RenameDatabase(const char *oldname, const char *newname); +extern Oid AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel); +extern ObjectAddress AlterDatabaseRefreshColl(AlterDatabaseRefreshCollStmt *stmt); +extern Oid AlterDatabaseSet(AlterDatabaseSetStmt *stmt); +extern ObjectAddress AlterDatabaseOwner(const char *dbname, Oid newOwnerId); + +extern Oid get_database_oid(const char *dbname, bool missing_ok); +extern char *get_database_name(Oid dbid); +extern bool have_createdb_privilege(void); + +extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype); + +#endif /* DBCOMMANDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/dbcommands_xlog.h b/platform/dbops/binaries/postgres/include/server/commands/dbcommands_xlog.h new file mode 100644 index 0000000000000000000000000000000000000000..c008b8ffea0e6aa20db0bde366c143fa6792d63d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/dbcommands_xlog.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * dbcommands_xlog.h + * Database resource manager XLOG definitions (create/drop database). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/dbcommands_xlog.h + * + *------------------------------------------------------------------------- + */ +#ifndef DBCOMMANDS_XLOG_H +#define DBCOMMANDS_XLOG_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + +/* record types */ +#define XLOG_DBASE_CREATE_FILE_COPY 0x00 +#define XLOG_DBASE_CREATE_WAL_LOG 0x10 +#define XLOG_DBASE_DROP 0x20 + +/* + * Single WAL record for an entire CREATE DATABASE operation. This is used + * by the FILE_COPY strategy. + */ +typedef struct xl_dbase_create_file_copy_rec +{ + Oid db_id; + Oid tablespace_id; + Oid src_db_id; + Oid src_tablespace_id; +} xl_dbase_create_file_copy_rec; + +/* + * WAL record for the beginning of a CREATE DATABASE operation, when the + * WAL_LOG strategy is used. Each individual block will be logged separately + * afterward. + */ +typedef struct xl_dbase_create_wal_log_rec +{ + Oid db_id; + Oid tablespace_id; +} xl_dbase_create_wal_log_rec; + +typedef struct xl_dbase_drop_rec +{ + Oid db_id; + int ntablespaces; /* number of tablespace IDs */ + Oid tablespace_ids[FLEXIBLE_ARRAY_MEMBER]; +} xl_dbase_drop_rec; +#define MinSizeOfDbaseDropRec offsetof(xl_dbase_drop_rec, tablespace_ids) + +extern void dbase_redo(XLogReaderState *record); +extern void dbase_desc(StringInfo buf, XLogReaderState *record); +extern const char *dbase_identify(uint8 info); + +#endif /* DBCOMMANDS_XLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/defrem.h b/platform/dbops/binaries/postgres/include/server/commands/defrem.h new file mode 100644 index 0000000000000000000000000000000000000000..29c511e319693bd748a8aef59f372b9c3c760d8b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/defrem.h @@ -0,0 +1,161 @@ +/*------------------------------------------------------------------------- + * + * defrem.h + * POSTGRES define and remove utility definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/defrem.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEFREM_H +#define DEFREM_H + +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "parser/parse_node.h" +#include "tcop/dest.h" +#include "utils/array.h" + +/* commands/dropcmds.c */ +extern void RemoveObjects(DropStmt *stmt); + +/* commands/indexcmds.c */ +extern ObjectAddress DefineIndex(Oid tableId, + IndexStmt *stmt, + Oid indexRelationId, + Oid parentIndexId, + Oid parentConstraintId, + int total_parts, + bool is_alter_table, + bool check_rights, + bool check_not_in_use, + bool skip_build, + bool quiet); +extern void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel); +extern char *makeObjectName(const char *name1, const char *name2, + const char *label); +extern char *ChooseRelationName(const char *name1, const char *name2, + const char *label, Oid namespaceid, + bool isconstraint); +extern bool CheckIndexCompatible(Oid oldId, + const char *accessMethodName, + const List *attributeList, + const List *exclusionOpNames); +extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); +extern Oid ResolveOpClass(const List *opclass, Oid attrType, + const char *accessMethodName, Oid accessMethodId); + +/* commands/functioncmds.c */ +extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt); +extern void RemoveFunctionById(Oid funcOid); +extern ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt); +extern ObjectAddress CreateCast(CreateCastStmt *stmt); +extern ObjectAddress CreateTransform(CreateTransformStmt *stmt); +extern void IsThereFunctionInNamespace(const char *proname, int pronargs, + oidvector *proargtypes, Oid nspOid); +extern void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic); +extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest); +extern TupleDesc CallStmtResultDesc(CallStmt *stmt); +extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok); +extern void interpret_function_parameter_list(ParseState *pstate, + List *parameters, + Oid languageOid, + ObjectType objtype, + oidvector **parameterTypes, + List **parameterTypes_list, + ArrayType **allParameterTypes, + ArrayType **parameterModes, + ArrayType **parameterNames, + List **inParameterNames_list, + List **parameterDefaults, + Oid *variadicArgType, + Oid *requiredResultType); + +/* commands/operatorcmds.c */ +extern ObjectAddress DefineOperator(List *names, List *parameters); +extern void RemoveOperatorById(Oid operOid); +extern ObjectAddress AlterOperator(AlterOperatorStmt *stmt); + +/* commands/statscmds.c */ +extern ObjectAddress CreateStatistics(CreateStatsStmt *stmt); +extern ObjectAddress AlterStatistics(AlterStatsStmt *stmt); +extern void RemoveStatisticsById(Oid statsOid); +extern void RemoveStatisticsDataById(Oid statsOid, bool inh); +extern Oid StatisticsGetRelation(Oid statId, bool missing_ok); + +/* commands/aggregatecmds.c */ +extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, + List *parameters, bool replace); + +/* commands/opclasscmds.c */ +extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt); +extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt); +extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); +extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, + Oid opcnamespace); +extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, + Oid opfnamespace); +extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); +extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); + +/* commands/tsearchcmds.c */ +extern ObjectAddress DefineTSParser(List *names, List *parameters); + +extern ObjectAddress DefineTSDictionary(List *names, List *parameters); +extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); + +extern ObjectAddress DefineTSTemplate(List *names, List *parameters); + +extern ObjectAddress DefineTSConfiguration(List *names, List *parameters, + ObjectAddress *copied); +extern void RemoveTSConfigurationById(Oid cfgId); +extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt); + +extern text *serialize_deflist(List *deflist); +extern List *deserialize_deflist(Datum txt); + +/* commands/foreigncmds.c */ +extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId); +extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); +extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); +extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); +extern ObjectAddress CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt *stmt); +extern ObjectAddress AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt); +extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt); +extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt); +extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt); +extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt); +extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); +extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); +extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt); +extern Datum transformGenericOptions(Oid catalogId, + Datum oldOptions, + List *options, + Oid fdwvalidator); + +/* commands/amcmds.c */ +extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt); +extern Oid get_index_am_oid(const char *amname, bool missing_ok); +extern Oid get_table_am_oid(const char *amname, bool missing_ok); +extern Oid get_am_oid(const char *amname, bool missing_ok); +extern char *get_am_name(Oid amOid); + +/* support routines in commands/define.c */ + +extern char *defGetString(DefElem *def); +extern double defGetNumeric(DefElem *def); +extern bool defGetBoolean(DefElem *def); +extern int32 defGetInt32(DefElem *def); +extern int64 defGetInt64(DefElem *def); +extern Oid defGetObjectId(DefElem *def); +extern List *defGetQualifiedName(DefElem *def); +extern TypeName *defGetTypeName(DefElem *def); +extern int defGetTypeLength(DefElem *def); +extern List *defGetStringList(DefElem *def); +extern void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn(); + +#endif /* DEFREM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/discard.h b/platform/dbops/binaries/postgres/include/server/commands/discard.h new file mode 100644 index 0000000000000000000000000000000000000000..c1f91d8e3f6950a18ff269dbd1b73501a6b3bf0f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/discard.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * discard.h + * prototypes for discard.c. + * + * + * Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/commands/discard.h + * + *------------------------------------------------------------------------- + */ +#ifndef DISCARD_H +#define DISCARD_H + +#include "nodes/parsenodes.h" + +extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel); + +#endif /* DISCARD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/event_trigger.h b/platform/dbops/binaries/postgres/include/server/commands/event_trigger.h new file mode 100644 index 0000000000000000000000000000000000000000..00cfb3975847825394ee2de53007960dd4afd08a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/event_trigger.h @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * + * event_trigger.h + * Declarations for command trigger handling. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/event_trigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef EVENT_TRIGGER_H +#define EVENT_TRIGGER_H + +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "catalog/pg_event_trigger.h" +#include "nodes/parsenodes.h" +#include "tcop/cmdtag.h" +#include "tcop/deparse_utility.h" +#include "utils/aclchk_internal.h" + +typedef struct EventTriggerData +{ + NodeTag type; + const char *event; /* event name */ + Node *parsetree; /* parse tree */ + CommandTag tag; +} EventTriggerData; + +extern PGDLLIMPORT bool event_triggers; + +/* + * Reasons for relation rewrites. + * + * pg_event_trigger_table_rewrite_reason() uses these values, so make sure to + * update the documentation when changing this list. + */ +#define AT_REWRITE_ALTER_PERSISTENCE 0x01 +#define AT_REWRITE_DEFAULT_VAL 0x02 +#define AT_REWRITE_COLUMN_REWRITE 0x04 +#define AT_REWRITE_ACCESS_METHOD 0x08 + +/* + * EventTriggerData is the node type that is passed as fmgr "context" info + * when a function is called by the event trigger manager. + */ +#define CALLED_AS_EVENT_TRIGGER(fcinfo) \ + ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) + +extern Oid CreateEventTrigger(CreateEventTrigStmt *stmt); +extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok); + +extern Oid AlterEventTrigger(AlterEventTrigStmt *stmt); +extern ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId); +extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId); + +extern bool EventTriggerSupportsObjectType(ObjectType obtype); +extern bool EventTriggerSupportsObject(const ObjectAddress *object); +extern void EventTriggerDDLCommandStart(Node *parsetree); +extern void EventTriggerDDLCommandEnd(Node *parsetree); +extern void EventTriggerSQLDrop(Node *parsetree); +extern void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason); +extern void EventTriggerOnLogin(void); + +extern bool EventTriggerBeginCompleteQuery(void); +extern void EventTriggerEndCompleteQuery(void); +extern bool trackDroppedObjectsNeeded(void); +extern void EventTriggerSQLDropAddObject(const ObjectAddress *object, + bool original, bool normal); + +extern void EventTriggerInhibitCommandCollection(void); +extern void EventTriggerUndoInhibitCommandCollection(void); + +extern void EventTriggerCollectSimpleCommand(ObjectAddress address, + ObjectAddress secondaryObject, + Node *parsetree); + +extern void EventTriggerAlterTableStart(Node *parsetree); +extern void EventTriggerAlterTableRelid(Oid objectId); +extern void EventTriggerCollectAlterTableSubcmd(Node *subcmd, + ObjectAddress address); +extern void EventTriggerAlterTableEnd(void); + +extern void EventTriggerCollectGrant(InternalGrant *istmt); +extern void EventTriggerCollectAlterOpFam(AlterOpFamilyStmt *stmt, + Oid opfamoid, List *operators, + List *procedures); +extern void EventTriggerCollectCreateOpClass(CreateOpClassStmt *stmt, + Oid opcoid, List *operators, + List *procedures); +extern void EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, + Oid cfgId, Oid *dictIds, int ndicts); +extern void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt); + +#endif /* EVENT_TRIGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/explain.h b/platform/dbops/binaries/postgres/include/server/commands/explain.h new file mode 100644 index 0000000000000000000000000000000000000000..9b8b351d9a218afb1792a13c61848f54fafd1ae5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/explain.h @@ -0,0 +1,145 @@ +/*------------------------------------------------------------------------- + * + * explain.h + * prototypes for explain.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_H +#define EXPLAIN_H + +#include "executor/executor.h" +#include "lib/stringinfo.h" +#include "parser/parse_node.h" + +typedef enum ExplainSerializeOption +{ + EXPLAIN_SERIALIZE_NONE, + EXPLAIN_SERIALIZE_TEXT, + EXPLAIN_SERIALIZE_BINARY, +} ExplainSerializeOption; + +typedef enum ExplainFormat +{ + EXPLAIN_FORMAT_TEXT, + EXPLAIN_FORMAT_XML, + EXPLAIN_FORMAT_JSON, + EXPLAIN_FORMAT_YAML, +} ExplainFormat; + +typedef struct ExplainWorkersState +{ + int num_workers; /* # of worker processes the plan used */ + bool *worker_inited; /* per-worker state-initialized flags */ + StringInfoData *worker_str; /* per-worker transient output buffers */ + int *worker_state_save; /* per-worker grouping state save areas */ + StringInfo prev_str; /* saved output buffer while redirecting */ +} ExplainWorkersState; + +typedef struct ExplainState +{ + StringInfo str; /* output buffer */ + /* options */ + bool verbose; /* be verbose */ + bool analyze; /* print actual times */ + bool costs; /* print estimated costs */ + bool buffers; /* print buffer usage */ + bool wal; /* print WAL usage */ + bool timing; /* print detailed node timing */ + bool summary; /* print total planning and execution timing */ + bool memory; /* print planner's memory usage information */ + bool settings; /* print modified settings */ + bool generic; /* generate a generic plan */ + ExplainSerializeOption serialize; /* serialize the query's output? */ + ExplainFormat format; /* output format */ + /* state for output formatting --- not reset for each new plan tree */ + int indent; /* current indentation level */ + List *grouping_stack; /* format-specific grouping state */ + /* state related to the current plan tree (filled by ExplainPrintPlan) */ + PlannedStmt *pstmt; /* top of plan */ + List *rtable; /* range table */ + List *rtable_names; /* alias names for RTEs */ + List *deparse_cxt; /* context list for deparsing expressions */ + Bitmapset *printed_subplans; /* ids of SubPlans we've printed */ + bool hide_workers; /* set if we find an invisible Gather */ + /* state related to the current plan node */ + ExplainWorkersState *workers_state; /* needed if parallel plan */ +} ExplainState; + +/* Hook for plugins to get control in ExplainOneQuery() */ +typedef void (*ExplainOneQuery_hook_type) (Query *query, + int cursorOptions, + IntoClause *into, + ExplainState *es, + const char *queryString, + ParamListInfo params, + QueryEnvironment *queryEnv); +extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; + +/* Hook for plugins to get control in explain_get_index_name() */ +typedef const char *(*explain_get_index_name_hook_type) (Oid indexId); +extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; + + +extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, + ParamListInfo params, DestReceiver *dest); +extern void standard_ExplainOneQuery(Query *query, int cursorOptions, + IntoClause *into, ExplainState *es, + const char *queryString, ParamListInfo params, + QueryEnvironment *queryEnv); + +extern ExplainState *NewExplainState(void); + +extern TupleDesc ExplainResultDesc(ExplainStmt *stmt); + +extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into, + ExplainState *es, const char *queryString, + ParamListInfo params, QueryEnvironment *queryEnv); + +extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, + ExplainState *es, const char *queryString, + ParamListInfo params, QueryEnvironment *queryEnv, + const instr_time *planduration, + const BufferUsage *bufusage, + const MemoryContextCounters *mem_counters); + +extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc); +extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc); + +extern void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc); + +extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); +extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen); + +extern void ExplainBeginOutput(ExplainState *es); +extern void ExplainEndOutput(ExplainState *es); +extern void ExplainSeparatePlans(ExplainState *es); + +extern void ExplainPropertyList(const char *qlabel, List *data, + ExplainState *es); +extern void ExplainPropertyListNested(const char *qlabel, List *data, + ExplainState *es); +extern void ExplainPropertyText(const char *qlabel, const char *value, + ExplainState *es); +extern void ExplainPropertyInteger(const char *qlabel, const char *unit, + int64 value, ExplainState *es); +extern void ExplainPropertyUInteger(const char *qlabel, const char *unit, + uint64 value, ExplainState *es); +extern void ExplainPropertyFloat(const char *qlabel, const char *unit, + double value, int ndigits, ExplainState *es); +extern void ExplainPropertyBool(const char *qlabel, bool value, + ExplainState *es); + +extern void ExplainOpenGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es); +extern void ExplainCloseGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es); + +extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); + +#endif /* EXPLAIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/extension.h b/platform/dbops/binaries/postgres/include/server/commands/extension.h new file mode 100644 index 0000000000000000000000000000000000000000..c6f3f867eb7c16c5bd97cda7437e7b23a56c5c58 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/extension.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * extension.h + * Extension management commands (create/drop extension). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/extension.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENSION_H +#define EXTENSION_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + + +/* + * creating_extension is only true while running a CREATE EXTENSION or ALTER + * EXTENSION UPDATE command. It instructs recordDependencyOnCurrentExtension() + * to register a dependency on the current pg_extension object for each SQL + * object created by an extension script. It also instructs performDeletion() + * to remove such dependencies without following them, so that extension + * scripts can drop member objects without having to explicitly dissociate + * them from the extension first. + */ +extern PGDLLIMPORT bool creating_extension; +extern PGDLLIMPORT Oid CurrentExtensionObject; + + +extern ObjectAddress CreateExtension(ParseState *pstate, CreateExtensionStmt *stmt); + +extern void RemoveExtensionById(Oid extId); + +extern ObjectAddress InsertExtensionTuple(const char *extName, Oid extOwner, + Oid schemaOid, bool relocatable, const char *extVersion, + Datum extConfig, Datum extCondition, + List *requiredExtensions); + +extern ObjectAddress ExecAlterExtensionStmt(ParseState *pstate, AlterExtensionStmt *stmt); + +extern ObjectAddress ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt, + ObjectAddress *objAddr); + +extern Oid get_extension_oid(const char *extname, bool missing_ok); +extern char *get_extension_name(Oid ext_oid); +extern Oid get_extension_schema(Oid ext_oid); +extern bool extension_file_exists(const char *extensionName); + +extern ObjectAddress AlterExtensionNamespace(const char *extensionName, const char *newschema, + Oid *oldschema); + +#endif /* EXTENSION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/lockcmds.h b/platform/dbops/binaries/postgres/include/server/commands/lockcmds.h new file mode 100644 index 0000000000000000000000000000000000000000..c3b2839f3f1510b9c1c787578124f0b406d8dae0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/lockcmds.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * lockcmds.h + * prototypes for lockcmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/lockcmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKCMDS_H +#define LOCKCMDS_H + +#include "nodes/parsenodes.h" + +/* + * LOCK + */ +extern void LockTableCommand(LockStmt *lockstmt); + +#endif /* LOCKCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/matview.h b/platform/dbops/binaries/postgres/include/server/commands/matview.h new file mode 100644 index 0000000000000000000000000000000000000000..a226b2e68fba5f1de74279ba9a424e0940469ad1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/matview.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * matview.h + * prototypes for matview.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/matview.h + * + *------------------------------------------------------------------------- + */ +#ifndef MATVIEW_H +#define MATVIEW_H + +#include "catalog/objectaddress.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "tcop/dest.h" +#include "utils/relcache.h" + + +extern void SetMatViewPopulatedState(Relation relation, bool newstate); + +extern ObjectAddress ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, + ParamListInfo params, QueryCompletion *qc); +extern ObjectAddress RefreshMatViewByOid(Oid matviewOid, bool skipData, bool concurrent, + const char *queryString, ParamListInfo params, + QueryCompletion *qc); + +extern DestReceiver *CreateTransientRelDestReceiver(Oid transientoid); + +extern bool MatViewIncrementalMaintenanceIsEnabled(void); + +#endif /* MATVIEW_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/policy.h b/platform/dbops/binaries/postgres/include/server/commands/policy.h new file mode 100644 index 0000000000000000000000000000000000000000..f66ef49831f9b97b8f28dab37b2c2cbc3ed57649 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/policy.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * policy.h + * prototypes for policy.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/policy.h + * + *------------------------------------------------------------------------- + */ + +#ifndef POLICY_H +#define POLICY_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +extern void RelationBuildRowSecurity(Relation relation); + +extern void RemovePolicyById(Oid policy_id); + +extern bool RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id); + +extern ObjectAddress CreatePolicy(CreatePolicyStmt *stmt); +extern ObjectAddress AlterPolicy(AlterPolicyStmt *stmt); + +extern Oid get_relation_policy_oid(Oid relid, const char *policy_name, + bool missing_ok); + +extern ObjectAddress rename_policy(RenameStmt *stmt); + +extern bool relation_has_policies(Relation rel); + +#endif /* POLICY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/portalcmds.h b/platform/dbops/binaries/postgres/include/server/commands/portalcmds.h new file mode 100644 index 0000000000000000000000000000000000000000..f09a1e17220d6ee8f9458463b802bdc0f54967e5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/portalcmds.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * portalcmds.h + * prototypes for portalcmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/portalcmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef PORTALCMDS_H +#define PORTALCMDS_H + +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/portal.h" + + +extern void PerformCursorOpen(ParseState *pstate, DeclareCursorStmt *cstmt, ParamListInfo params, + bool isTopLevel); + +extern void PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest, + QueryCompletion *qc); + +extern void PerformPortalClose(const char *name); + +extern void PortalCleanup(Portal portal); + +extern void PersistHoldablePortal(Portal portal); + +#endif /* PORTALCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/prepare.h b/platform/dbops/binaries/postgres/include/server/commands/prepare.h new file mode 100644 index 0000000000000000000000000000000000000000..61472c111d6ed0930a20a272df8f49a8c1c2cb84 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/prepare.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * prepare.h + * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage + * + * + * Copyright (c) 2002-2024, PostgreSQL Global Development Group + * + * src/include/commands/prepare.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREPARE_H +#define PREPARE_H + +#include "commands/explain.h" +#include "datatype/timestamp.h" +#include "utils/plancache.h" + +/* + * The data structure representing a prepared statement. This is now just + * a thin veneer over a plancache entry --- the main addition is that of + * a name. + * + * Note: all subsidiary storage lives in the referenced plancache entry. + */ +typedef struct +{ + /* dynahash.c requires key to be first field */ + char stmt_name[NAMEDATALEN]; + CachedPlanSource *plansource; /* the actual cached plan */ + bool from_sql; /* prepared via SQL, not FE/BE protocol? */ + TimestampTz prepare_time; /* the time when the stmt was prepared */ +} PreparedStatement; + + +/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */ +extern void PrepareQuery(ParseState *pstate, PrepareStmt *stmt, + int stmt_location, int stmt_len); +extern void ExecuteQuery(ParseState *pstate, + ExecuteStmt *stmt, IntoClause *intoClause, + ParamListInfo params, + DestReceiver *dest, QueryCompletion *qc); +extern void DeallocateQuery(DeallocateStmt *stmt); +extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into, + ExplainState *es, const char *queryString, + ParamListInfo params, QueryEnvironment *queryEnv); + +/* Low-level access to stored prepared statements */ +extern void StorePreparedStatement(const char *stmt_name, + CachedPlanSource *plansource, + bool from_sql); +extern PreparedStatement *FetchPreparedStatement(const char *stmt_name, + bool throwError); +extern void DropPreparedStatement(const char *stmt_name, bool showError); +extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt); +extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt); + +extern void DropAllPreparedStatements(void); + +#endif /* PREPARE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/proclang.h b/platform/dbops/binaries/postgres/include/server/commands/proclang.h new file mode 100644 index 0000000000000000000000000000000000000000..eebc806edc7c03fc05a9d2252df83365806ab776 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/proclang.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * proclang.h + * prototypes for proclang.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/proclang.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCLANG_H +#define PROCLANG_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress CreateProceduralLanguage(CreatePLangStmt *stmt); + +extern Oid get_language_oid(const char *langname, bool missing_ok); + +#endif /* PROCLANG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/progress.h b/platform/dbops/binaries/postgres/include/server/commands/progress.h new file mode 100644 index 0000000000000000000000000000000000000000..5616d645230ce10423367b988e3cd7086c42114d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/progress.h @@ -0,0 +1,158 @@ +/*------------------------------------------------------------------------- + * + * progress.h + * Constants used with the progress reporting facilities defined in + * backend_status.h. These are possibly interesting to extensions, so we + * expose them via this header file. Note that if you update these + * constants, you probably also need to update the views based on them + * in system_views.sql. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/progress.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROGRESS_H +#define PROGRESS_H + +/* Progress parameters for (lazy) vacuum */ +#define PROGRESS_VACUUM_PHASE 0 +#define PROGRESS_VACUUM_TOTAL_HEAP_BLKS 1 +#define PROGRESS_VACUUM_HEAP_BLKS_SCANNED 2 +#define PROGRESS_VACUUM_HEAP_BLKS_VACUUMED 3 +#define PROGRESS_VACUUM_NUM_INDEX_VACUUMS 4 +#define PROGRESS_VACUUM_MAX_DEAD_TUPLE_BYTES 5 +#define PROGRESS_VACUUM_DEAD_TUPLE_BYTES 6 +#define PROGRESS_VACUUM_NUM_DEAD_ITEM_IDS 7 +#define PROGRESS_VACUUM_INDEXES_TOTAL 8 +#define PROGRESS_VACUUM_INDEXES_PROCESSED 9 + +/* Phases of vacuum (as advertised via PROGRESS_VACUUM_PHASE) */ +#define PROGRESS_VACUUM_PHASE_SCAN_HEAP 1 +#define PROGRESS_VACUUM_PHASE_VACUUM_INDEX 2 +#define PROGRESS_VACUUM_PHASE_VACUUM_HEAP 3 +#define PROGRESS_VACUUM_PHASE_INDEX_CLEANUP 4 +#define PROGRESS_VACUUM_PHASE_TRUNCATE 5 +#define PROGRESS_VACUUM_PHASE_FINAL_CLEANUP 6 + +/* Progress parameters for analyze */ +#define PROGRESS_ANALYZE_PHASE 0 +#define PROGRESS_ANALYZE_BLOCKS_TOTAL 1 +#define PROGRESS_ANALYZE_BLOCKS_DONE 2 +#define PROGRESS_ANALYZE_EXT_STATS_TOTAL 3 +#define PROGRESS_ANALYZE_EXT_STATS_COMPUTED 4 +#define PROGRESS_ANALYZE_CHILD_TABLES_TOTAL 5 +#define PROGRESS_ANALYZE_CHILD_TABLES_DONE 6 +#define PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID 7 + +/* Phases of analyze (as advertised via PROGRESS_ANALYZE_PHASE) */ +#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS 1 +#define PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS_INH 2 +#define PROGRESS_ANALYZE_PHASE_COMPUTE_STATS 3 +#define PROGRESS_ANALYZE_PHASE_COMPUTE_EXT_STATS 4 +#define PROGRESS_ANALYZE_PHASE_FINALIZE_ANALYZE 5 + +/* Progress parameters for cluster */ +#define PROGRESS_CLUSTER_COMMAND 0 +#define PROGRESS_CLUSTER_PHASE 1 +#define PROGRESS_CLUSTER_INDEX_RELID 2 +#define PROGRESS_CLUSTER_HEAP_TUPLES_SCANNED 3 +#define PROGRESS_CLUSTER_HEAP_TUPLES_WRITTEN 4 +#define PROGRESS_CLUSTER_TOTAL_HEAP_BLKS 5 +#define PROGRESS_CLUSTER_HEAP_BLKS_SCANNED 6 +#define PROGRESS_CLUSTER_INDEX_REBUILD_COUNT 7 + +/* Phases of cluster (as advertised via PROGRESS_CLUSTER_PHASE) */ +#define PROGRESS_CLUSTER_PHASE_SEQ_SCAN_HEAP 1 +#define PROGRESS_CLUSTER_PHASE_INDEX_SCAN_HEAP 2 +#define PROGRESS_CLUSTER_PHASE_SORT_TUPLES 3 +#define PROGRESS_CLUSTER_PHASE_WRITE_NEW_HEAP 4 +#define PROGRESS_CLUSTER_PHASE_SWAP_REL_FILES 5 +#define PROGRESS_CLUSTER_PHASE_REBUILD_INDEX 6 +#define PROGRESS_CLUSTER_PHASE_FINAL_CLEANUP 7 + +/* Commands of PROGRESS_CLUSTER */ +#define PROGRESS_CLUSTER_COMMAND_CLUSTER 1 +#define PROGRESS_CLUSTER_COMMAND_VACUUM_FULL 2 + +/* Progress parameters for CREATE INDEX */ +/* 3, 4 and 5 reserved for "waitfor" metrics */ +#define PROGRESS_CREATEIDX_COMMAND 0 +#define PROGRESS_CREATEIDX_INDEX_OID 6 +#define PROGRESS_CREATEIDX_ACCESS_METHOD_OID 8 +#define PROGRESS_CREATEIDX_PHASE 9 /* AM-agnostic phase # */ +#define PROGRESS_CREATEIDX_SUBPHASE 10 /* phase # filled by AM */ +#define PROGRESS_CREATEIDX_TUPLES_TOTAL 11 +#define PROGRESS_CREATEIDX_TUPLES_DONE 12 +#define PROGRESS_CREATEIDX_PARTITIONS_TOTAL 13 +#define PROGRESS_CREATEIDX_PARTITIONS_DONE 14 +/* 15 and 16 reserved for "block number" metrics */ + +/* Phases of CREATE INDEX (as advertised via PROGRESS_CREATEIDX_PHASE) */ +#define PROGRESS_CREATEIDX_PHASE_WAIT_1 1 +#define PROGRESS_CREATEIDX_PHASE_BUILD 2 +#define PROGRESS_CREATEIDX_PHASE_WAIT_2 3 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN 4 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_SORT 5 +#define PROGRESS_CREATEIDX_PHASE_VALIDATE_TABLESCAN 6 +#define PROGRESS_CREATEIDX_PHASE_WAIT_3 7 +#define PROGRESS_CREATEIDX_PHASE_WAIT_4 8 +#define PROGRESS_CREATEIDX_PHASE_WAIT_5 9 + +/* + * Subphases of CREATE INDEX, for index_build. + */ +#define PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE 1 +/* Additional phases are defined by each AM */ + +/* Commands of PROGRESS_CREATEIDX */ +#define PROGRESS_CREATEIDX_COMMAND_CREATE 1 +#define PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY 2 +#define PROGRESS_CREATEIDX_COMMAND_REINDEX 3 +#define PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY 4 + +/* Lock holder wait counts */ +#define PROGRESS_WAITFOR_TOTAL 3 +#define PROGRESS_WAITFOR_DONE 4 +#define PROGRESS_WAITFOR_CURRENT_PID 5 + +/* Block numbers in a generic relation scan */ +#define PROGRESS_SCAN_BLOCKS_TOTAL 15 +#define PROGRESS_SCAN_BLOCKS_DONE 16 + +/* Progress parameters for pg_basebackup */ +#define PROGRESS_BASEBACKUP_PHASE 0 +#define PROGRESS_BASEBACKUP_BACKUP_TOTAL 1 +#define PROGRESS_BASEBACKUP_BACKUP_STREAMED 2 +#define PROGRESS_BASEBACKUP_TBLSPC_TOTAL 3 +#define PROGRESS_BASEBACKUP_TBLSPC_STREAMED 4 + +/* Phases of pg_basebackup (as advertised via PROGRESS_BASEBACKUP_PHASE) */ +#define PROGRESS_BASEBACKUP_PHASE_WAIT_CHECKPOINT 1 +#define PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE 2 +#define PROGRESS_BASEBACKUP_PHASE_STREAM_BACKUP 3 +#define PROGRESS_BASEBACKUP_PHASE_WAIT_WAL_ARCHIVE 4 +#define PROGRESS_BASEBACKUP_PHASE_TRANSFER_WAL 5 + +/* Progress parameters for PROGRESS_COPY */ +#define PROGRESS_COPY_BYTES_PROCESSED 0 +#define PROGRESS_COPY_BYTES_TOTAL 1 +#define PROGRESS_COPY_TUPLES_PROCESSED 2 +#define PROGRESS_COPY_TUPLES_EXCLUDED 3 +#define PROGRESS_COPY_COMMAND 4 +#define PROGRESS_COPY_TYPE 5 +#define PROGRESS_COPY_TUPLES_SKIPPED 6 + +/* Commands of COPY (as advertised via PROGRESS_COPY_COMMAND) */ +#define PROGRESS_COPY_COMMAND_FROM 1 +#define PROGRESS_COPY_COMMAND_TO 2 + +/* Types of COPY commands (as advertised via PROGRESS_COPY_TYPE) */ +#define PROGRESS_COPY_TYPE_FILE 1 +#define PROGRESS_COPY_TYPE_PROGRAM 2 +#define PROGRESS_COPY_TYPE_PIPE 3 +#define PROGRESS_COPY_TYPE_CALLBACK 4 + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/commands/publicationcmds.h b/platform/dbops/binaries/postgres/include/server/commands/publicationcmds.h new file mode 100644 index 0000000000000000000000000000000000000000..5487c571f66c73d5ee7d1e4ced9a4677896b11f1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/publicationcmds.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * publicationcmds.h + * prototypes for publicationcmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/publicationcmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PUBLICATIONCMDS_H +#define PUBLICATIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" +#include "utils/inval.h" + +/* Same as MAXNUMMESSAGES in sinvaladt.c */ +#define MAX_RELCACHE_INVAL_MSGS 4096 + +extern ObjectAddress CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt); +extern void AlterPublication(ParseState *pstate, AlterPublicationStmt *stmt); +extern void RemovePublicationById(Oid pubid); +extern void RemovePublicationRelById(Oid proid); +extern void RemovePublicationSchemaById(Oid psoid); + +extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId); +extern void AlterPublicationOwner_oid(Oid subid, Oid newOwnerId); +extern void InvalidatePublicationRels(List *relids); +extern bool pub_rf_contains_invalid_column(Oid pubid, Relation relation, + List *ancestors, bool pubviaroot); +extern bool pub_collist_contains_invalid_column(Oid pubid, Relation relation, + List *ancestors, bool pubviaroot); + +#endif /* PUBLICATIONCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/schemacmds.h b/platform/dbops/binaries/postgres/include/server/commands/schemacmds.h new file mode 100644 index 0000000000000000000000000000000000000000..5598dfa5d76651b545799b508195eefcda8a376d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/schemacmds.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * schemacmds.h + * prototypes for schemacmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/schemacmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCHEMACMDS_H +#define SCHEMACMDS_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern Oid CreateSchemaCommand(CreateSchemaStmt *stmt, + const char *queryString, + int stmt_location, int stmt_len); + +extern ObjectAddress RenameSchema(const char *oldname, const char *newname); +extern ObjectAddress AlterSchemaOwner(const char *name, Oid newOwnerId); +extern void AlterSchemaOwner_oid(Oid schemaoid, Oid newOwnerId); + +#endif /* SCHEMACMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/seclabel.h b/platform/dbops/binaries/postgres/include/server/commands/seclabel.h new file mode 100644 index 0000000000000000000000000000000000000000..89def5699a088c22267fad81db4d5e9113371f28 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/seclabel.h @@ -0,0 +1,34 @@ +/* + * seclabel.h + * + * Prototypes for functions in commands/seclabel.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + */ +#ifndef SECLABEL_H +#define SECLABEL_H + +#include "catalog/objectaddress.h" + +/* + * Internal APIs + */ +extern char *GetSecurityLabel(const ObjectAddress *object, + const char *provider); +extern void SetSecurityLabel(const ObjectAddress *object, + const char *provider, const char *label); +extern void DeleteSecurityLabel(const ObjectAddress *object); +extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId); + +/* + * Statement and ESP hook support + */ +extern ObjectAddress ExecSecLabelStmt(SecLabelStmt *stmt); + +typedef void (*check_object_relabel_type) (const ObjectAddress *object, + const char *seclabel); +extern void register_label_provider(const char *provider_name, + check_object_relabel_type hook); + +#endif /* SECLABEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/sequence.h b/platform/dbops/binaries/postgres/include/server/commands/sequence.h new file mode 100644 index 0000000000000000000000000000000000000000..e88cbee3b56bc62050c8164a6eb5ecac4f3e8000 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/sequence.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * sequence.h + * prototypes for sequence.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/sequence.h + * + *------------------------------------------------------------------------- + */ +#ifndef SEQUENCE_H +#define SEQUENCE_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "fmgr.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "storage/relfilelocator.h" + + +typedef struct FormData_pg_sequence_data +{ + int64 last_value; + int64 log_cnt; + bool is_called; +} FormData_pg_sequence_data; + +typedef FormData_pg_sequence_data *Form_pg_sequence_data; + +/* + * Columns of a sequence relation + */ + +#define SEQ_COL_LASTVAL 1 +#define SEQ_COL_LOG 2 +#define SEQ_COL_CALLED 3 + +#define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL +#define SEQ_COL_LASTCOL SEQ_COL_CALLED + +/* XLOG stuff */ +#define XLOG_SEQ_LOG 0x00 + +typedef struct xl_seq_rec +{ + RelFileLocator locator; + /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */ +} xl_seq_rec; + +extern int64 nextval_internal(Oid relid, bool check_permissions); +extern Datum nextval(PG_FUNCTION_ARGS); +extern List *sequence_options(Oid relid); + +extern ObjectAddress DefineSequence(ParseState *pstate, CreateSeqStmt *seq); +extern ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt); +extern void SequenceChangePersistence(Oid relid, char newrelpersistence); +extern void DeleteSequenceTuple(Oid relid); +extern void ResetSequence(Oid seq_relid); +extern void ResetSequenceCaches(void); + +extern void seq_redo(XLogReaderState *record); +extern void seq_desc(StringInfo buf, XLogReaderState *record); +extern const char *seq_identify(uint8 info); +extern void seq_mask(char *page, BlockNumber blkno); + +#endif /* SEQUENCE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/subscriptioncmds.h b/platform/dbops/binaries/postgres/include/server/commands/subscriptioncmds.h new file mode 100644 index 0000000000000000000000000000000000000000..6971933190b5dd8665adcf904e57c93d65c9b880 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/subscriptioncmds.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * subscriptioncmds.h + * prototypes for subscriptioncmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/subscriptioncmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SUBSCRIPTIONCMDS_H +#define SUBSCRIPTIONCMDS_H + +#include "catalog/objectaddress.h" +#include "parser/parse_node.h" + +extern ObjectAddress CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt, + bool isTopLevel); +extern ObjectAddress AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt, bool isTopLevel); +extern void DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel); + +extern ObjectAddress AlterSubscriptionOwner(const char *name, Oid newOwnerId); +extern void AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId); + +extern char defGetStreamingMode(DefElem *def); + +#endif /* SUBSCRIPTIONCMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/tablecmds.h b/platform/dbops/binaries/postgres/include/server/commands/tablecmds.h new file mode 100644 index 0000000000000000000000000000000000000000..85cbad3d0c20488373eeb16f9521ba4b2b282116 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/tablecmds.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * tablecmds.h + * prototypes for tablecmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/tablecmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLECMDS_H +#define TABLECMDS_H + +#include "access/htup.h" +#include "catalog/dependency.h" +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "storage/lock.h" +#include "utils/relcache.h" + +struct AlterTableUtilityContext; /* avoid including tcop/utility.h here */ + + +extern ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, + ObjectAddress *typaddress, const char *queryString); + +extern TupleDesc BuildDescForRelation(const List *columns); + +extern void RemoveRelations(DropStmt *drop); + +extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode); + +extern void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, + struct AlterTableUtilityContext *context); + +extern LOCKMODE AlterTableGetLockLevel(List *cmds); + +extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode); + +extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); + +extern Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt); + +extern ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, + Oid *oldschema); + +extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, + Oid nspOid, ObjectAddresses *objsMoved); + +extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, + Oid oldNspOid, Oid newNspOid, + bool hasDependEntry, + ObjectAddresses *objsMoved); + +extern void CheckTableNotInUse(Relation rel, const char *stmt); + +extern void ExecuteTruncate(TruncateStmt *stmt); +extern void ExecuteTruncateGuts(List *explicit_rels, + List *relids, + List *relids_logged, + DropBehavior behavior, + bool restart_seqs, + bool run_as_table_owner); + +extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); + +extern bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId); +extern void SetRelationTableSpace(Relation rel, Oid newTableSpaceId, + RelFileNumber newRelFilenumber); + +extern ObjectAddress renameatt(RenameStmt *stmt); + +extern ObjectAddress RenameConstraint(RenameStmt *stmt); + +extern ObjectAddress RenameRelation(RenameStmt *stmt); + +extern void RenameRelationInternal(Oid myrelid, + const char *newrelname, bool is_internal, + bool is_index); + +extern void ResetRelRewrite(Oid myrelid); + +extern void find_composite_type_dependencies(Oid typeOid, + Relation origRelation, + const char *origTypeName); + +extern void check_of_type(HeapTuple typetuple); + +extern void register_on_commit_action(Oid relid, OnCommitAction action); +extern void remove_on_commit_action(Oid relid); + +extern void PreCommit_on_commit_actions(void); +extern void AtEOXact_on_commit_actions(bool isCommit); +extern void AtEOSubXact_on_commit_actions(bool isCommit, + SubTransactionId mySubid, + SubTransactionId parentSubid); + +extern void RangeVarCallbackMaintainsTable(const RangeVar *relation, + Oid relId, Oid oldRelId, + void *arg); + +extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, + Oid relId, Oid oldRelId, void *arg); +extern bool PartConstraintImpliedByRelConstraint(Relation scanrel, + List *partConstraint); + +#endif /* TABLECMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/tablespace.h b/platform/dbops/binaries/postgres/include/server/commands/tablespace.h new file mode 100644 index 0000000000000000000000000000000000000000..b6cec632db9ad8135114745763331c0555d80620 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/tablespace.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * tablespace.h + * Tablespace management commands (create/drop tablespace). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/tablespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef TABLESPACE_H +#define TABLESPACE_H + +#include "access/xlogreader.h" +#include "catalog/objectaddress.h" +#include "lib/stringinfo.h" +#include "nodes/parsenodes.h" + +extern PGDLLIMPORT bool allow_in_place_tablespaces; + +/* XLOG stuff */ +#define XLOG_TBLSPC_CREATE 0x00 +#define XLOG_TBLSPC_DROP 0x10 + +typedef struct xl_tblspc_create_rec +{ + Oid ts_id; + char ts_path[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string */ +} xl_tblspc_create_rec; + +typedef struct xl_tblspc_drop_rec +{ + Oid ts_id; +} xl_tblspc_drop_rec; + +typedef struct TableSpaceOpts +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + float8 random_page_cost; + float8 seq_page_cost; + int effective_io_concurrency; + int maintenance_io_concurrency; +} TableSpaceOpts; + +extern Oid CreateTableSpace(CreateTableSpaceStmt *stmt); +extern void DropTableSpace(DropTableSpaceStmt *stmt); +extern ObjectAddress RenameTableSpace(const char *oldname, const char *newname); +extern Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); + +extern void TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo); + +extern Oid GetDefaultTablespace(char relpersistence, bool partitioned); + +extern void PrepareTempTablespaces(void); + +extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok); +extern char *get_tablespace_name(Oid spc_oid); + +extern bool directory_is_empty(const char *path); +extern void remove_tablespace_symlink(const char *linkloc); + +extern void tblspc_redo(XLogReaderState *record); +extern void tblspc_desc(StringInfo buf, XLogReaderState *record); +extern const char *tblspc_identify(uint8 info); + +#endif /* TABLESPACE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/trigger.h b/platform/dbops/binaries/postgres/include/server/commands/trigger.h new file mode 100644 index 0000000000000000000000000000000000000000..8a5a9fe642274a27bc9b1bcfbbef2208f7206f8e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/trigger.h @@ -0,0 +1,288 @@ +/*------------------------------------------------------------------------- + * + * trigger.h + * Declarations for trigger handling. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/trigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef TRIGGER_H +#define TRIGGER_H + +#include "access/tableam.h" +#include "catalog/objectaddress.h" +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + +/* + * TriggerData is the node type that is passed as fmgr "context" info + * when a function is called by the trigger manager. + */ + +#define CALLED_AS_TRIGGER(fcinfo) \ + ((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData)) + +typedef uint32 TriggerEvent; + +typedef struct TriggerData +{ + NodeTag type; + TriggerEvent tg_event; + Relation tg_relation; + HeapTuple tg_trigtuple; + HeapTuple tg_newtuple; + Trigger *tg_trigger; + TupleTableSlot *tg_trigslot; + TupleTableSlot *tg_newslot; + Tuplestorestate *tg_oldtable; + Tuplestorestate *tg_newtable; + const Bitmapset *tg_updatedcols; +} TriggerData; + +/* + * The state for capturing old and new tuples into transition tables for a + * single ModifyTable node (or other operation source, e.g. copyfrom.c). + * + * This is per-caller to avoid conflicts in setting + * tcs_original_insert_tuple. Note, however, that the pointed-to + * private data may be shared across multiple callers. + */ +struct AfterTriggersTableData; /* private in trigger.c */ + +typedef struct TransitionCaptureState +{ + /* + * Is there at least one trigger specifying each transition relation on + * the relation explicitly named in the DML statement or COPY command? + * Note: in current usage, these flags could be part of the private state, + * but it seems possibly useful to let callers see them. + */ + bool tcs_delete_old_table; + bool tcs_update_old_table; + bool tcs_update_new_table; + bool tcs_insert_new_table; + + /* + * For INSERT and COPY, it would be wasteful to convert tuples from child + * format to parent format after they have already been converted in the + * opposite direction during routing. In that case we bypass conversion + * and allow the inserting code (copyfrom.c and nodeModifyTable.c) to + * provide a slot containing the original tuple directly. + */ + TupleTableSlot *tcs_original_insert_tuple; + + /* + * Private data including the tuplestore(s) into which to insert tuples. + */ + struct AfterTriggersTableData *tcs_private; +} TransitionCaptureState; + +/* + * TriggerEvent bit flags + * + * Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE) + * can't be OR'd together in a single TriggerEvent. This is unlike the + * situation for pg_trigger rows, so pg_trigger.tgtype uses a different + * representation! + */ +#define TRIGGER_EVENT_INSERT 0x00000000 +#define TRIGGER_EVENT_DELETE 0x00000001 +#define TRIGGER_EVENT_UPDATE 0x00000002 +#define TRIGGER_EVENT_TRUNCATE 0x00000003 +#define TRIGGER_EVENT_OPMASK 0x00000003 + +#define TRIGGER_EVENT_ROW 0x00000004 + +#define TRIGGER_EVENT_BEFORE 0x00000008 +#define TRIGGER_EVENT_AFTER 0x00000000 +#define TRIGGER_EVENT_INSTEAD 0x00000010 +#define TRIGGER_EVENT_TIMINGMASK 0x00000018 + +/* More TriggerEvent flags, used only within trigger.c */ + +#define AFTER_TRIGGER_DEFERRABLE 0x00000020 +#define AFTER_TRIGGER_INITDEFERRED 0x00000040 + +#define TRIGGER_FIRED_BY_INSERT(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT) + +#define TRIGGER_FIRED_BY_DELETE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE) + +#define TRIGGER_FIRED_BY_UPDATE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE) + +#define TRIGGER_FIRED_BY_TRUNCATE(event) \ + (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE) + +#define TRIGGER_FIRED_FOR_ROW(event) \ + ((event) & TRIGGER_EVENT_ROW) + +#define TRIGGER_FIRED_FOR_STATEMENT(event) \ + (!TRIGGER_FIRED_FOR_ROW(event)) + +#define TRIGGER_FIRED_BEFORE(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE) + +#define TRIGGER_FIRED_AFTER(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER) + +#define TRIGGER_FIRED_INSTEAD(event) \ + (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD) + +/* + * Definitions for replication role based firing. + */ +#define SESSION_REPLICATION_ROLE_ORIGIN 0 +#define SESSION_REPLICATION_ROLE_REPLICA 1 +#define SESSION_REPLICATION_ROLE_LOCAL 2 +extern PGDLLIMPORT int SessionReplicationRole; + +/* + * States at which a trigger can be fired. These are the + * possible values for pg_trigger.tgenabled. + */ +#define TRIGGER_FIRES_ON_ORIGIN 'O' +#define TRIGGER_FIRES_ALWAYS 'A' +#define TRIGGER_FIRES_ON_REPLICA 'R' +#define TRIGGER_DISABLED 'D' + +extern ObjectAddress CreateTrigger(CreateTrigStmt *stmt, const char *queryString, + Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid, + Oid funcoid, Oid parentTriggerOid, Node *whenClause, + bool isInternal, bool in_partition); +extern ObjectAddress CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString, + Oid relOid, Oid refRelOid, Oid constraintOid, + Oid indexOid, Oid funcoid, Oid parentTriggerOid, + Node *whenClause, bool isInternal, bool in_partition, + char trigger_fires_when); + +extern void TriggerSetParentTrigger(Relation trigRel, + Oid childTrigId, + Oid parentTrigId, + Oid childTableId); +extern void RemoveTriggerById(Oid trigOid); +extern Oid get_trigger_oid(Oid relid, const char *trigname, bool missing_ok); + +extern ObjectAddress renametrig(RenameStmt *stmt); + +extern void EnableDisableTrigger(Relation rel, const char *tgname, Oid tgparent, + char fires_when, bool skip_system, bool recurse, + LOCKMODE lockmode); + +extern void RelationBuildTriggers(Relation relation); + +extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc); + +extern const char *FindTriggerIncompatibleWithInheritance(TriggerDesc *trigdesc); + +extern TransitionCaptureState *MakeTransitionCaptureState(TriggerDesc *trigdesc, + Oid relid, CmdType cmdType); + +extern void FreeTriggerDesc(TriggerDesc *trigdesc); + +extern void ExecBSInsertTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot); +extern void ExecARInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot, + List *recheckIndexes, + TransitionCaptureState *transition_capture); +extern bool ExecIRInsertTriggers(EState *estate, + ResultRelInfo *relinfo, + TupleTableSlot *slot); +extern void ExecBSDeleteTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRDeleteTriggers(EState *estate, + EPQState *epqstate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot **epqslot, + TM_Result *tmresult, + TM_FailureData *tmfd); +extern void ExecARDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TransitionCaptureState *transition_capture, + bool is_crosspart_update); +extern bool ExecIRDeleteTriggers(EState *estate, + ResultRelInfo *relinfo, + HeapTuple trigtuple); +extern void ExecBSUpdateTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + TransitionCaptureState *transition_capture); +extern bool ExecBRUpdateTriggers(EState *estate, + EPQState *epqstate, + ResultRelInfo *relinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot *newslot, + TM_Result *tmresult, + TM_FailureData *tmfd); +extern void ExecARUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + ResultRelInfo *src_partinfo, + ResultRelInfo *dst_partinfo, + ItemPointer tupleid, + HeapTuple fdw_trigtuple, + TupleTableSlot *newslot, + List *recheckIndexes, + TransitionCaptureState *transition_capture, + bool is_crosspart_update); +extern bool ExecIRUpdateTriggers(EState *estate, + ResultRelInfo *relinfo, + HeapTuple trigtuple, + TupleTableSlot *newslot); +extern void ExecBSTruncateTriggers(EState *estate, + ResultRelInfo *relinfo); +extern void ExecASTruncateTriggers(EState *estate, + ResultRelInfo *relinfo); + +extern void AfterTriggerBeginXact(void); +extern void AfterTriggerBeginQuery(void); +extern void AfterTriggerEndQuery(EState *estate); +extern void AfterTriggerFireDeferred(void); +extern void AfterTriggerEndXact(bool isCommit); +extern void AfterTriggerBeginSubXact(void); +extern void AfterTriggerEndSubXact(bool isCommit); +extern void AfterTriggerSetState(ConstraintsSetStmt *stmt); +extern bool AfterTriggerPendingOnRel(Oid relid); + + +/* + * in utils/adt/ri_triggers.c + */ +extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel, + TupleTableSlot *oldslot, TupleTableSlot *newslot); +extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, + TupleTableSlot *oldslot, TupleTableSlot *newslot); +extern bool RI_Initial_Check(Trigger *trigger, + Relation fk_rel, Relation pk_rel); +extern void RI_PartitionRemove_Check(Trigger *trigger, Relation fk_rel, + Relation pk_rel); + +/* result values for RI_FKey_trigger_type: */ +#define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */ +#define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */ +#define RI_TRIGGER_NONE 0 /* is not an RI trigger function */ + +extern int RI_FKey_trigger_type(Oid tgfoid); + +#endif /* TRIGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/typecmds.h b/platform/dbops/binaries/postgres/include/server/commands/typecmds.h new file mode 100644 index 0000000000000000000000000000000000000000..e1b02927c4bab5352ff85ef5e19d7186b1d90676 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/typecmds.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * typecmds.h + * prototypes for typecmds.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/typecmds.h + * + *------------------------------------------------------------------------- + */ +#ifndef TYPECMDS_H +#define TYPECMDS_H + +#include "access/htup.h" +#include "catalog/dependency.h" +#include "parser/parse_node.h" + + +#define DEFAULT_TYPDELIM ',' + +extern ObjectAddress DefineType(ParseState *pstate, List *names, List *parameters); +extern void RemoveTypeById(Oid typeOid); +extern ObjectAddress DefineDomain(CreateDomainStmt *stmt); +extern ObjectAddress DefineEnum(CreateEnumStmt *stmt); +extern ObjectAddress DefineRange(ParseState *pstate, CreateRangeStmt *stmt); +extern ObjectAddress AlterEnum(AlterEnumStmt *stmt); +extern ObjectAddress DefineCompositeType(RangeVar *typevar, List *coldeflist); +extern Oid AssignTypeArrayOid(void); +extern Oid AssignTypeMultirangeOid(void); +extern Oid AssignTypeMultirangeArrayOid(void); + +extern ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw); +extern ObjectAddress AlterDomainNotNull(List *names, bool notNull); +extern ObjectAddress AlterDomainAddConstraint(List *names, Node *newConstraint, + ObjectAddress *constrAddr); +extern ObjectAddress AlterDomainValidateConstraint(List *names, const char *constrName); +extern ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName, + DropBehavior behavior, bool missing_ok); + +extern void checkDomainOwner(HeapTuple tup); + +extern ObjectAddress RenameType(RenameStmt *stmt); + +extern ObjectAddress AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); +extern void AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry); +extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId); + +extern ObjectAddress AlterTypeNamespace(List *names, const char *newschema, + ObjectType objecttype, Oid *oldschema); +extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, bool ignoreDependent, + ObjectAddresses *objsMoved); +extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, + bool isImplicitArray, + bool ignoreDependent, + bool errorOnTableType, + ObjectAddresses *objsMoved); + +extern ObjectAddress AlterType(AlterTypeStmt *stmt); + +#endif /* TYPECMDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/user.h b/platform/dbops/binaries/postgres/include/server/commands/user.h new file mode 100644 index 0000000000000000000000000000000000000000..97dcb93791b89c0f676369b78b44c26003f3eb67 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/user.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * user.h + * Commands for manipulating roles (formerly called users). + * + * + * src/include/commands/user.h + * + *------------------------------------------------------------------------- + */ +#ifndef USER_H +#define USER_H + +#include "catalog/objectaddress.h" +#include "libpq/crypt.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/guc.h" + +/* GUCs */ +extern PGDLLIMPORT int Password_encryption; /* values from enum PasswordType */ +extern PGDLLIMPORT char *createrole_self_grant; + +/* Hook to check passwords in CreateRole() and AlterRole() */ +typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null); + +extern PGDLLIMPORT check_password_hook_type check_password_hook; + +extern Oid CreateRole(ParseState *pstate, CreateRoleStmt *stmt); +extern Oid AlterRole(ParseState *pstate, AlterRoleStmt *stmt); +extern Oid AlterRoleSet(AlterRoleSetStmt *stmt); +extern void DropRole(DropRoleStmt *stmt); +extern void GrantRole(ParseState *pstate, GrantRoleStmt *stmt); +extern ObjectAddress RenameRole(const char *oldname, const char *newname); +extern void DropOwnedObjects(DropOwnedStmt *stmt); +extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); +extern List *roleSpecsToIds(List *memberNames); + +extern bool check_createrole_self_grant(char **newval, void **extra, + GucSource source); +extern void assign_createrole_self_grant(const char *newval, void *extra); + +#endif /* USER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/vacuum.h b/platform/dbops/binaries/postgres/include/server/commands/vacuum.h new file mode 100644 index 0000000000000000000000000000000000000000..759f9a87d38e559c5f718b65e1c0f89dbbc16693 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/vacuum.h @@ -0,0 +1,388 @@ +/*------------------------------------------------------------------------- + * + * vacuum.h + * header file for postgres vacuum cleaner and statistics analyzer + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/vacuum.h + * + *------------------------------------------------------------------------- + */ +#ifndef VACUUM_H +#define VACUUM_H + +#include "access/htup.h" +#include "access/genam.h" +#include "access/parallel.h" +#include "access/tidstore.h" +#include "catalog/pg_class.h" +#include "catalog/pg_statistic.h" +#include "catalog/pg_type.h" +#include "parser/parse_node.h" +#include "storage/buf.h" +#include "storage/lock.h" +#include "utils/relcache.h" + +/* + * Flags for amparallelvacuumoptions to control the participation of bulkdelete + * and vacuumcleanup in parallel vacuum. + */ + +/* + * Both bulkdelete and vacuumcleanup are disabled by default. This will be + * used by IndexAM's that don't want to or cannot participate in parallel + * vacuum. For example, if an index AM doesn't have a way to communicate the + * index statistics allocated by the first ambulkdelete call to the subsequent + * ones until amvacuumcleanup, the index AM cannot participate in parallel + * vacuum. + */ +#define VACUUM_OPTION_NO_PARALLEL 0 + +/* + * bulkdelete can be performed in parallel. This option can be used by + * index AMs that need to scan indexes to delete tuples. + */ +#define VACUUM_OPTION_PARALLEL_BULKDEL (1 << 0) + +/* + * vacuumcleanup can be performed in parallel if bulkdelete is not performed + * yet. This will be used by IndexAM's that can scan the index if the + * bulkdelete is not performed. + */ +#define VACUUM_OPTION_PARALLEL_COND_CLEANUP (1 << 1) + +/* + * vacuumcleanup can be performed in parallel even if bulkdelete has already + * processed the index. This will be used by IndexAM's that scan the index + * during the cleanup phase of index irrespective of whether the index is + * already scanned or not during bulkdelete phase. + */ +#define VACUUM_OPTION_PARALLEL_CLEANUP (1 << 2) + +/* value for checking vacuum flags */ +#define VACUUM_OPTION_MAX_VALID_VALUE ((1 << 3) - 1) + +/* Abstract type for parallel vacuum state */ +typedef struct ParallelVacuumState ParallelVacuumState; + +/*---------- + * ANALYZE builds one of these structs for each attribute (column) that is + * to be analyzed. The struct and subsidiary data are in anl_context, + * so they live until the end of the ANALYZE operation. + * + * The type-specific typanalyze function is passed a pointer to this struct + * and must return true to continue analysis, false to skip analysis of this + * column. In the true case it must set the compute_stats and minrows fields, + * and can optionally set extra_data to pass additional info to compute_stats. + * minrows is its request for the minimum number of sample rows to be gathered + * (but note this request might not be honored, eg if there are fewer rows + * than that in the table). + * + * The compute_stats routine will be called after sample rows have been + * gathered. Aside from this struct, it is passed: + * fetchfunc: a function for accessing the column values from the + * sample rows + * samplerows: the number of sample tuples + * totalrows: estimated total number of rows in relation + * The fetchfunc may be called with rownum running from 0 to samplerows-1. + * It returns a Datum and an isNull flag. + * + * compute_stats should set stats_valid true if it is able to compute + * any useful statistics. If it does, the remainder of the struct holds + * the information to be stored in a pg_statistic row for the column. Be + * careful to allocate any pointed-to data in anl_context, which will NOT + * be CurrentMemoryContext when compute_stats is called. + * + * Note: all comparisons done for statistical purposes should use the + * underlying column's collation (attcollation), except in situations + * where a noncollatable container type contains a collatable type; + * in that case use the type's default collation. Be sure to record + * the appropriate collation in stacoll. + *---------- + */ +typedef struct VacAttrStats *VacAttrStatsP; + +typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum, + bool *isNull); + +typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats, + AnalyzeAttrFetchFunc fetchfunc, + int samplerows, + double totalrows); + +typedef struct VacAttrStats +{ + /* + * These fields are set up by the main ANALYZE code before invoking the + * type-specific typanalyze function. They don't necessarily match what + * is in pg_attribute, because some index opclasses store a different type + * than the underlying column/expression. Therefore, use these fields for + * information about the datatype being fed to the typanalyze function. + */ + int attstattarget; /* -1 to use default */ + Oid attrtypid; /* type of data being analyzed */ + int32 attrtypmod; /* typmod of data being analyzed */ + Form_pg_type attrtype; /* copy of pg_type row for attrtypid */ + Oid attrcollid; /* collation of data being analyzed */ + MemoryContext anl_context; /* where to save long-lived data */ + + /* + * These fields must be filled in by the typanalyze routine, unless it + * returns false. + */ + AnalyzeAttrComputeStatsFunc compute_stats; /* function pointer */ + int minrows; /* Minimum # of rows wanted for stats */ + void *extra_data; /* for extra type-specific data */ + + /* + * These fields are to be filled in by the compute_stats routine. (They + * are initialized to zero when the struct is created.) + */ + bool stats_valid; + float4 stanullfrac; /* fraction of entries that are NULL */ + int32 stawidth; /* average width of column values */ + float4 stadistinct; /* # distinct values */ + int16 stakind[STATISTIC_NUM_SLOTS]; + Oid staop[STATISTIC_NUM_SLOTS]; + Oid stacoll[STATISTIC_NUM_SLOTS]; + int numnumbers[STATISTIC_NUM_SLOTS]; + float4 *stanumbers[STATISTIC_NUM_SLOTS]; + int numvalues[STATISTIC_NUM_SLOTS]; + Datum *stavalues[STATISTIC_NUM_SLOTS]; + + /* + * These fields describe the stavalues[n] element types. They will be + * initialized to match attrtypid, but a custom typanalyze function might + * want to store an array of something other than the analyzed column's + * elements. It should then overwrite these fields. + */ + Oid statypid[STATISTIC_NUM_SLOTS]; + int16 statyplen[STATISTIC_NUM_SLOTS]; + bool statypbyval[STATISTIC_NUM_SLOTS]; + char statypalign[STATISTIC_NUM_SLOTS]; + + /* + * These fields are private to the main ANALYZE code and should not be + * looked at by type-specific functions. + */ + int tupattnum; /* attribute number within tuples */ + HeapTuple *rows; /* access info for std fetch function */ + TupleDesc tupDesc; + Datum *exprvals; /* access info for index fetch function */ + bool *exprnulls; + int rowstride; +} VacAttrStats; + +/* flag bits for VacuumParams->options */ +#define VACOPT_VACUUM 0x01 /* do VACUUM */ +#define VACOPT_ANALYZE 0x02 /* do ANALYZE */ +#define VACOPT_VERBOSE 0x04 /* output INFO instrumentation messages */ +#define VACOPT_FREEZE 0x08 /* FREEZE option */ +#define VACOPT_FULL 0x10 /* FULL (non-concurrent) vacuum */ +#define VACOPT_SKIP_LOCKED 0x20 /* skip if cannot get lock */ +#define VACOPT_PROCESS_MAIN 0x40 /* process main relation */ +#define VACOPT_PROCESS_TOAST 0x80 /* process the TOAST table, if any */ +#define VACOPT_DISABLE_PAGE_SKIPPING 0x100 /* don't skip any pages */ +#define VACOPT_SKIP_DATABASE_STATS 0x200 /* skip vac_update_datfrozenxid() */ +#define VACOPT_ONLY_DATABASE_STATS 0x400 /* only vac_update_datfrozenxid() */ + +/* + * Values used by index_cleanup and truncate params. + * + * VACOPTVALUE_UNSPECIFIED is used as an initial placeholder when VACUUM + * command has no explicit value. When that happens the final usable value + * comes from the corresponding reloption (though the reloption default is + * usually used). + */ +typedef enum VacOptValue +{ + VACOPTVALUE_UNSPECIFIED = 0, + VACOPTVALUE_AUTO, + VACOPTVALUE_DISABLED, + VACOPTVALUE_ENABLED, +} VacOptValue; + +/* + * Parameters customizing behavior of VACUUM and ANALYZE. + * + * Note that at least one of VACOPT_VACUUM and VACOPT_ANALYZE must be set + * in options. + * + * When adding a new VacuumParam member, consider adding it to vacuumdb as + * well. + */ +typedef struct VacuumParams +{ + bits32 options; /* bitmask of VACOPT_* */ + int freeze_min_age; /* min freeze age, -1 to use default */ + int freeze_table_age; /* age at which to scan whole table */ + int multixact_freeze_min_age; /* min multixact freeze age, -1 to + * use default */ + int multixact_freeze_table_age; /* multixact age at which to scan + * whole table */ + bool is_wraparound; /* force a for-wraparound vacuum */ + int log_min_duration; /* minimum execution threshold in ms at + * which autovacuum is logged, -1 to use + * default */ + VacOptValue index_cleanup; /* Do index vacuum and cleanup */ + VacOptValue truncate; /* Truncate empty pages at the end */ + Oid toast_parent; /* for privilege checks when recursing */ + + /* + * The number of parallel vacuum workers. 0 by default which means choose + * based on the number of indexes. -1 indicates parallel vacuum is + * disabled. + */ + int nworkers; +} VacuumParams; + +/* + * VacuumCutoffs is immutable state that describes the cutoffs used by VACUUM. + * Established at the beginning of each VACUUM operation. + */ +struct VacuumCutoffs +{ + /* + * Existing pg_class fields at start of VACUUM + */ + TransactionId relfrozenxid; + MultiXactId relminmxid; + + /* + * OldestXmin is the Xid below which tuples deleted by any xact (that + * committed) should be considered DEAD, not just RECENTLY_DEAD. + * + * OldestMxact is the Mxid below which MultiXacts are definitely not seen + * as visible by any running transaction. + * + * OldestXmin and OldestMxact are also the most recent values that can + * ever be passed to vac_update_relstats() as frozenxid and minmulti + * arguments at the end of VACUUM. These same values should be passed + * when it turns out that VACUUM will leave no unfrozen XIDs/MXIDs behind + * in the table. + */ + TransactionId OldestXmin; + MultiXactId OldestMxact; + + /* + * FreezeLimit is the Xid below which all Xids are definitely frozen or + * removed in pages VACUUM scans and cleanup locks. + * + * MultiXactCutoff is the value below which all MultiXactIds are + * definitely removed from Xmax in pages VACUUM scans and cleanup locks. + */ + TransactionId FreezeLimit; + MultiXactId MultiXactCutoff; +}; + +/* + * VacDeadItemsInfo stores supplemental information for dead tuple TID + * storage (i.e. TidStore). + */ +typedef struct VacDeadItemsInfo +{ + size_t max_bytes; /* the maximum bytes TidStore can use */ + int64 num_items; /* current # of entries */ +} VacDeadItemsInfo; + +/* GUC parameters */ +extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ +extern PGDLLIMPORT int vacuum_freeze_min_age; +extern PGDLLIMPORT int vacuum_freeze_table_age; +extern PGDLLIMPORT int vacuum_multixact_freeze_min_age; +extern PGDLLIMPORT int vacuum_multixact_freeze_table_age; +extern PGDLLIMPORT int vacuum_failsafe_age; +extern PGDLLIMPORT int vacuum_multixact_failsafe_age; + +/* + * Maximum value for default_statistics_target and per-column statistics + * targets. This is fairly arbitrary, mainly to prevent users from creating + * unreasonably large statistics that the system cannot handle well. + */ +#define MAX_STATISTICS_TARGET 10000 + +/* Variables for cost-based parallel vacuum */ +extern PGDLLIMPORT pg_atomic_uint32 *VacuumSharedCostBalance; +extern PGDLLIMPORT pg_atomic_uint32 *VacuumActiveNWorkers; +extern PGDLLIMPORT int VacuumCostBalanceLocal; + +extern PGDLLIMPORT bool VacuumFailsafeActive; +extern PGDLLIMPORT double vacuum_cost_delay; +extern PGDLLIMPORT int vacuum_cost_limit; + +/* in commands/vacuum.c */ +extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel); +extern void vacuum(List *relations, VacuumParams *params, + BufferAccessStrategy bstrategy, MemoryContext vac_context, + bool isTopLevel); +extern void vac_open_indexes(Relation relation, LOCKMODE lockmode, + int *nindexes, Relation **Irel); +extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode); +extern double vac_estimate_reltuples(Relation relation, + BlockNumber total_pages, + BlockNumber scanned_pages, + double scanned_tuples); +extern void vac_update_relstats(Relation relation, + BlockNumber num_pages, + double num_tuples, + BlockNumber num_all_visible_pages, + bool hasindex, + TransactionId frozenxid, + MultiXactId minmulti, + bool *frozenxid_updated, + bool *minmulti_updated, + bool in_outer_xact); +extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams *params, + struct VacuumCutoffs *cutoffs); +extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs); +extern void vac_update_datfrozenxid(void); +extern void vacuum_delay_point(void); +extern bool vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple, + bits32 options); +extern Relation vacuum_open_relation(Oid relid, RangeVar *relation, + bits32 options, bool verbose, + LOCKMODE lmode); +extern IndexBulkDeleteResult *vac_bulkdel_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat, + TidStore *dead_items, + VacDeadItemsInfo *dead_items_info); +extern IndexBulkDeleteResult *vac_cleanup_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat); + +/* In postmaster/autovacuum.c */ +extern void AutoVacuumUpdateCostLimit(void); +extern void VacuumUpdateCosts(void); + +/* in commands/vacuumparallel.c */ +extern ParallelVacuumState *parallel_vacuum_init(Relation rel, Relation *indrels, + int nindexes, int nrequested_workers, + int vac_work_mem, int elevel, + BufferAccessStrategy bstrategy); +extern void parallel_vacuum_end(ParallelVacuumState *pvs, IndexBulkDeleteResult **istats); +extern TidStore *parallel_vacuum_get_dead_items(ParallelVacuumState *pvs, + VacDeadItemsInfo **dead_items_info_p); +extern void parallel_vacuum_reset_dead_items(ParallelVacuumState *pvs); +extern void parallel_vacuum_bulkdel_all_indexes(ParallelVacuumState *pvs, + long num_table_tuples, + int num_index_scans); +extern void parallel_vacuum_cleanup_all_indexes(ParallelVacuumState *pvs, + long num_table_tuples, + int num_index_scans, + bool estimated_count); +extern void parallel_vacuum_main(dsm_segment *seg, shm_toc *toc); + +/* in commands/analyze.c */ +extern void analyze_rel(Oid relid, RangeVar *relation, + VacuumParams *params, List *va_cols, bool in_outer_xact, + BufferAccessStrategy bstrategy); +extern bool std_typanalyze(VacAttrStats *stats); + +/* in utils/misc/sampling.c --- duplicate of declarations in utils/sampling.h */ +extern double anl_random_fract(void); +extern double anl_init_selection_state(int n); +extern double anl_get_next_S(double t, int n, double *stateptr); + +#endif /* VACUUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/commands/view.h b/platform/dbops/binaries/postgres/include/server/commands/view.h new file mode 100644 index 0000000000000000000000000000000000000000..d2d8588989d1c9727fc491ad7e3ea193da0395e2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/commands/view.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * view.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/view.h + * + *------------------------------------------------------------------------- + */ +#ifndef VIEW_H +#define VIEW_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" + +extern ObjectAddress DefineView(ViewStmt *stmt, const char *queryString, + int stmt_location, int stmt_len); + +extern void StoreViewQuery(Oid viewOid, Query *viewParse, bool replace); + +#endif /* VIEW_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/archive.h b/platform/dbops/binaries/postgres/include/server/common/archive.h new file mode 100644 index 0000000000000000000000000000000000000000..f3f677ab6556cd6dfb845f076eab54ee2fff6598 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/archive.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * archive.h + * Common WAL archive routines + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARCHIVE_H +#define ARCHIVE_H + +extern char *BuildRestoreCommand(const char *restoreCommand, + const char *xlogpath, /* %p */ + const char *xlogfname, /* %f */ + const char *lastRestartPointFname); /* %r */ + +#endif /* ARCHIVE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/base64.h b/platform/dbops/binaries/postgres/include/server/common/base64.h new file mode 100644 index 0000000000000000000000000000000000000000..0d6d31b72b03dbb028ef0ed56335579fab60871e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/base64.h @@ -0,0 +1,19 @@ +/* + * base64.h + * Encoding and decoding routines for base64 without whitespace + * support. + * + * Portions Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/common/base64.h + */ +#ifndef BASE64_H +#define BASE64_H + +/* base 64 */ +extern int pg_b64_encode(const char *src, int len, char *dst, int dstlen); +extern int pg_b64_decode(const char *src, int len, char *dst, int dstlen); +extern int pg_b64_enc_len(int srclen); +extern int pg_b64_dec_len(int srclen); + +#endif /* BASE64_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/blkreftable.h b/platform/dbops/binaries/postgres/include/server/common/blkreftable.h new file mode 100644 index 0000000000000000000000000000000000000000..43b913a82ecdf27a33e011b1234261f46f6b1770 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/blkreftable.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * blkreftable.h + * Block reference tables. + * + * A block reference table is used to keep track of which blocks have + * been modified by WAL records within a certain LSN range. + * + * For each relation fork, there is a "limit block number". All existing + * blocks greater than or equal to the limit block number must be + * considered modified; for those less than the limit block number, + * we maintain a bitmap. When a relation fork is created or dropped, + * the limit block number should be set to 0. When it's truncated, + * the limit block number should be set to the length in blocks to + * which it was truncated. + * + * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * src/include/common/blkreftable.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLKREFTABLE_H +#define BLKREFTABLE_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* Magic number for serialization file format. */ +#define BLOCKREFTABLE_MAGIC 0x652b137b + +typedef struct BlockRefTable BlockRefTable; +typedef struct BlockRefTableEntry BlockRefTableEntry; +typedef struct BlockRefTableReader BlockRefTableReader; +typedef struct BlockRefTableWriter BlockRefTableWriter; + +/* + * The return value of io_callback_fn should be the number of bytes read + * or written. If an error occurs, the functions should report it and + * not return. When used as a write callback, short writes should be retried + * or treated as errors, so that if the callback returns, the return value + * is always the request length. + * + * report_error_fn should not return. + */ +typedef int (*io_callback_fn) (void *callback_arg, void *data, int length); +typedef void (*report_error_fn) (void *callback_arg, char *msg,...) pg_attribute_printf(2, 3); + + +/* + * Functions for manipulating an entire in-memory block reference table. + */ +extern BlockRefTable *CreateEmptyBlockRefTable(void); +extern void BlockRefTableSetLimitBlock(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber limit_block); +extern void BlockRefTableMarkBlockModified(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber blknum); +extern void WriteBlockRefTable(BlockRefTable *brtab, + io_callback_fn write_callback, + void *write_callback_arg); + +extern BlockRefTableEntry *BlockRefTableGetEntry(BlockRefTable *brtab, + const RelFileLocator *rlocator, + ForkNumber forknum, + BlockNumber *limit_block); +extern int BlockRefTableEntryGetBlocks(BlockRefTableEntry *entry, + BlockNumber start_blkno, + BlockNumber stop_blkno, + BlockNumber *blocks, + int nblocks); + +/* + * Functions for reading a block reference table incrementally from disk. + */ +extern BlockRefTableReader *CreateBlockRefTableReader(io_callback_fn read_callback, + void *read_callback_arg, + char *error_filename, + report_error_fn error_callback, + void *error_callback_arg); +extern bool BlockRefTableReaderNextRelation(BlockRefTableReader *reader, + RelFileLocator *rlocator, + ForkNumber *forknum, + BlockNumber *limit_block); +extern unsigned BlockRefTableReaderGetBlocks(BlockRefTableReader *reader, + BlockNumber *blocks, + int nblocks); +extern void DestroyBlockRefTableReader(BlockRefTableReader *reader); + +/* + * Functions for writing a block reference table incrementally to disk. + * + * Note that entries must be written in the proper order, that is, sorted by + * database, then tablespace, then relfilenumber, then fork number. Caller + * is responsible for supplying data in the correct order. If that seems hard, + * use an in-memory BlockRefTable instead. + */ +extern BlockRefTableWriter *CreateBlockRefTableWriter(io_callback_fn write_callback, + void *write_callback_arg); +extern void BlockRefTableWriteEntry(BlockRefTableWriter *writer, + BlockRefTableEntry *entry); +extern void DestroyBlockRefTableWriter(BlockRefTableWriter *writer); + +extern BlockRefTableEntry *CreateBlockRefTableEntry(RelFileLocator rlocator, + ForkNumber forknum); +extern void BlockRefTableEntrySetLimitBlock(BlockRefTableEntry *entry, + BlockNumber limit_block); +extern void BlockRefTableEntryMarkBlockModified(BlockRefTableEntry *entry, + ForkNumber forknum, + BlockNumber blknum); +extern void BlockRefTableFreeEntry(BlockRefTableEntry *entry); + +#endif /* BLKREFTABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/checksum_helper.h b/platform/dbops/binaries/postgres/include/server/common/checksum_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..116957d52e6abf8d0253e6465d6e335978a51308 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/checksum_helper.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------------------- + * + * checksum_helper.h + * Compute a checksum of any of various types using common routines + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/checksum_helper.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CHECKSUM_HELPER_H +#define CHECKSUM_HELPER_H + +#include "common/cryptohash.h" +#include "common/sha2.h" +#include "port/pg_crc32c.h" + +/* + * Supported checksum types. It's not necessarily the case that code using + * these functions needs a cryptographically strong checksum; it may only + * need to detect accidental modification. That's why we include CRC-32C: it's + * much faster than any of the other algorithms. On the other hand, we omit + * MD5 here because any new that does need a cryptographically strong checksum + * should use something better. + */ +typedef enum pg_checksum_type +{ + CHECKSUM_TYPE_NONE, + CHECKSUM_TYPE_CRC32C, + CHECKSUM_TYPE_SHA224, + CHECKSUM_TYPE_SHA256, + CHECKSUM_TYPE_SHA384, + CHECKSUM_TYPE_SHA512, +} pg_checksum_type; + +/* + * This is just a union of all applicable context types. + */ +typedef union pg_checksum_raw_context +{ + pg_crc32c c_crc32c; + pg_cryptohash_ctx *c_sha2; +} pg_checksum_raw_context; + +/* + * This structure provides a convenient way to pass the checksum type and the + * checksum context around together. + */ +typedef struct pg_checksum_context +{ + pg_checksum_type type; + pg_checksum_raw_context raw_context; +} pg_checksum_context; + +/* + * This is the longest possible output for any checksum algorithm supported + * by this file. + */ +#define PG_CHECKSUM_MAX_LENGTH PG_SHA512_DIGEST_LENGTH + +extern bool pg_checksum_parse_type(char *name, pg_checksum_type *); +extern char *pg_checksum_type_name(pg_checksum_type); + +extern int pg_checksum_init(pg_checksum_context *, pg_checksum_type); +extern int pg_checksum_update(pg_checksum_context *, const uint8 *input, + size_t len); +extern int pg_checksum_final(pg_checksum_context *, uint8 *output); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/common/compression.h b/platform/dbops/binaries/postgres/include/server/common/compression.h new file mode 100644 index 0000000000000000000000000000000000000000..b79bed9e245c220075d7c6970d47efc9b9a133a5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/compression.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * compression.h + * + * Shared definitions for compression methods and specifications. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/compression.h + *------------------------------------------------------------------------- + */ + +#ifndef PG_COMPRESSION_H +#define PG_COMPRESSION_H + +/* + * These values are stored in disk, for example in files generated by pg_dump. + * Create the necessary backwards compatibility layers if their order changes. + */ +typedef enum pg_compress_algorithm +{ + PG_COMPRESSION_NONE, + PG_COMPRESSION_GZIP, + PG_COMPRESSION_LZ4, + PG_COMPRESSION_ZSTD, +} pg_compress_algorithm; + +#define PG_COMPRESSION_OPTION_WORKERS (1 << 0) +#define PG_COMPRESSION_OPTION_LONG_DISTANCE (1 << 1) + +typedef struct pg_compress_specification +{ + pg_compress_algorithm algorithm; + unsigned options; /* OR of PG_COMPRESSION_OPTION constants */ + int level; + int workers; + bool long_distance; + char *parse_error; /* NULL if parsing was OK, else message */ +} pg_compress_specification; + +extern void parse_compress_options(const char *option, char **algorithm, + char **detail); +extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm); +extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm); + +extern void parse_compress_specification(pg_compress_algorithm algorithm, + char *specification, + pg_compress_specification *result); + +extern char *validate_compress_specification(pg_compress_specification *); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/common/config_info.h b/platform/dbops/binaries/postgres/include/server/common/config_info.h new file mode 100644 index 0000000000000000000000000000000000000000..76d23f8b8beb094b69819ca58900467b53814d72 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/config_info.h @@ -0,0 +1,21 @@ +/* + * config_info.h + * Common code for pg_config output + * + * Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/common/config_info.h + */ +#ifndef COMMON_CONFIG_INFO_H +#define COMMON_CONFIG_INFO_H + +typedef struct ConfigData +{ + char *name; + char *setting; +} ConfigData; + +extern ConfigData *get_configdata(const char *my_exec_path, + size_t *configdata_len); + +#endif /* COMMON_CONFIG_INFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/connect.h b/platform/dbops/binaries/postgres/include/server/common/connect.h new file mode 100644 index 0000000000000000000000000000000000000000..ddbd33a917b1d6b034c5d4581ab355537a672570 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/connect.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * Interfaces in support of FE/BE connections. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/connect.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONNECT_H +#define CONNECT_H + +/* + * This SQL statement installs an always-secure search path, so malicious + * users can't take control. CREATE of an unqualified name will fail, because + * this selects no creation schema. This does not demote pg_temp, so it is + * suitable where we control the entire FE/BE connection but not suitable in + * SECURITY DEFINER functions. This is portable to PostgreSQL 7.3, which + * introduced schemas. When connected to an older version from code that + * might work with the old server, skip this. + */ +#define ALWAYS_SECURE_SEARCH_PATH_SQL \ + "SELECT pg_catalog.set_config('search_path', '', false);" + +#endif /* CONNECT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/controldata_utils.h b/platform/dbops/binaries/postgres/include/server/common/controldata_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..6e263ce0de0ce762f13029e5aff2f381dd514f58 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/controldata_utils.h @@ -0,0 +1,21 @@ +/* + * controldata_utils.h + * Common code for pg_controldata output + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/controldata_utils.h + */ +#ifndef COMMON_CONTROLDATA_UTILS_H +#define COMMON_CONTROLDATA_UTILS_H + +#include "catalog/pg_control.h" + +extern ControlFileData *get_controlfile(const char *DataDir, bool *crc_ok_p); +extern ControlFileData *get_controlfile_by_exact_path(const char *ControlFilePath, + bool *crc_ok_p); +extern void update_controlfile(const char *DataDir, + ControlFileData *ControlFile, bool do_sync); + +#endif /* COMMON_CONTROLDATA_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/cryptohash.h b/platform/dbops/binaries/postgres/include/server/common/cryptohash.h new file mode 100644 index 0000000000000000000000000000000000000000..0fe77341232d36b6d9e38026e0b35a40349ac19f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/cryptohash.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * cryptohash.h + * Generic headers for cryptographic hash functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/cryptohash.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_CRYPTOHASH_H +#define PG_CRYPTOHASH_H + +/* Context Structures for each hash function */ +typedef enum +{ + PG_MD5 = 0, + PG_SHA1, + PG_SHA224, + PG_SHA256, + PG_SHA384, + PG_SHA512, +} pg_cryptohash_type; + +/* opaque context, private to each cryptohash implementation */ +typedef struct pg_cryptohash_ctx pg_cryptohash_ctx; + +extern pg_cryptohash_ctx *pg_cryptohash_create(pg_cryptohash_type type); +extern int pg_cryptohash_init(pg_cryptohash_ctx *ctx); +extern int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len); +extern int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len); +extern void pg_cryptohash_free(pg_cryptohash_ctx *ctx); +extern const char *pg_cryptohash_error(pg_cryptohash_ctx *ctx); + +#endif /* PG_CRYPTOHASH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/fe_memutils.h b/platform/dbops/binaries/postgres/include/server/common/fe_memutils.h new file mode 100644 index 0000000000000000000000000000000000000000..492cc97e8d19accf85a68916f75abe0b2e08f9ae --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/fe_memutils.h @@ -0,0 +1,73 @@ +/* + * fe_memutils.h + * memory management support for frontend code + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/common/fe_memutils.h + */ +#ifndef FE_MEMUTILS_H +#define FE_MEMUTILS_H + +/* + * Flags for pg_malloc_extended and palloc_extended, deliberately named + * the same as the backend flags. + */ +#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) not + * actually used for frontends */ +#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* + * "Safe" memory allocation functions --- these exit(1) on failure + * (except pg_malloc_extended with MCXT_ALLOC_NO_OOM) + */ +extern char *pg_strdup(const char *in); +extern void *pg_malloc(size_t size); +extern void *pg_malloc0(size_t size); +extern void *pg_malloc_extended(size_t size, int flags); +extern void *pg_realloc(void *ptr, size_t size); +extern void pg_free(void *ptr); + +/* + * Variants with easier notation and more type safety + */ + +/* + * Allocate space for one object of type "type" + */ +#define pg_malloc_object(type) ((type *) pg_malloc(sizeof(type))) +#define pg_malloc0_object(type) ((type *) pg_malloc0(sizeof(type))) + +/* + * Allocate space for "count" objects of type "type" + */ +#define pg_malloc_array(type, count) ((type *) pg_malloc(sizeof(type) * (count))) +#define pg_malloc0_array(type, count) ((type *) pg_malloc0(sizeof(type) * (count))) + +/* + * Change size of allocation pointed to by "pointer" to have space for "count" + * objects of type "type" + */ +#define pg_realloc_array(pointer, type, count) ((type *) pg_realloc(pointer, sizeof(type) * (count))) + +/* Equivalent functions, deliberately named the same as backend functions */ +extern char *pstrdup(const char *in); +extern char *pnstrdup(const char *in, Size size); +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *palloc_extended(Size size, int flags); +extern void *repalloc(void *pointer, Size size); +extern void pfree(void *pointer); + +#define palloc_object(type) ((type *) palloc(sizeof(type))) +#define palloc0_object(type) ((type *) palloc0(sizeof(type))) +#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count))) +#define palloc0_array(type, count) ((type *) palloc0(sizeof(type) * (count))) +#define repalloc_array(pointer, type, count) ((type *) repalloc(pointer, sizeof(type) * (count))) + +/* sprintf into a palloc'd buffer --- these are in psprintf.c */ +extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); +extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); + +#endif /* FE_MEMUTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/file_perm.h b/platform/dbops/binaries/postgres/include/server/common/file_perm.h new file mode 100644 index 0000000000000000000000000000000000000000..d1f5616793e6a32e766608a9bf11d3863454c532 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/file_perm.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * File and directory permission definitions + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/file_perm.h + * + *------------------------------------------------------------------------- + */ +#ifndef FILE_PERM_H +#define FILE_PERM_H + +#include + +/* + * Mode mask for data directory permissions that only allows the owner to + * read/write directories and files. + * + * This is the default. + */ +#define PG_MODE_MASK_OWNER (S_IRWXG | S_IRWXO) + +/* + * Mode mask for data directory permissions that also allows group read/execute. + */ +#define PG_MODE_MASK_GROUP (S_IWGRP | S_IRWXO) + +/* Default mode for creating directories */ +#define PG_DIR_MODE_OWNER S_IRWXU + +/* Mode for creating directories that allows group read/execute */ +#define PG_DIR_MODE_GROUP (S_IRWXU | S_IRGRP | S_IXGRP) + +/* Default mode for creating files */ +#define PG_FILE_MODE_OWNER (S_IRUSR | S_IWUSR) + +/* Mode for creating files that allows group read */ +#define PG_FILE_MODE_GROUP (S_IRUSR | S_IWUSR | S_IRGRP) + +/* Modes for creating directories and files in the data directory */ +extern PGDLLIMPORT int pg_dir_create_mode; +extern PGDLLIMPORT int pg_file_create_mode; + +/* Mode mask to pass to umask() */ +extern PGDLLIMPORT int pg_mode_mask; + +/* Set permissions and mask based on the provided mode */ +extern void SetDataDirectoryCreatePerm(int dataDirMode); + +/* Set permissions and mask based on the mode of the data directory */ +extern bool GetDataDirectoryCreatePerm(const char *dataDir); + +#endif /* FILE_PERM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/file_utils.h b/platform/dbops/binaries/postgres/include/server/common/file_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..e4339fb7b6c14f3c02043c0b88ff3fcdde7c585e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/file_utils.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * Assorted utility functions to work on files. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/file_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef FILE_UTILS_H +#define FILE_UTILS_H + +#include + +typedef enum PGFileType +{ + PGFILETYPE_ERROR, + PGFILETYPE_UNKNOWN, + PGFILETYPE_REG, + PGFILETYPE_DIR, + PGFILETYPE_LNK, +} PGFileType; + +typedef enum DataDirSyncMethod +{ + DATA_DIR_SYNC_METHOD_FSYNC, + DATA_DIR_SYNC_METHOD_SYNCFS, +} DataDirSyncMethod; + +struct iovec; /* avoid including port/pg_iovec.h here */ + +#ifdef FRONTEND +extern int fsync_fname(const char *fname, bool isdir); +extern void sync_pgdata(const char *pg_data, int serverVersion, + DataDirSyncMethod sync_method); +extern void sync_dir_recurse(const char *dir, DataDirSyncMethod sync_method); +extern int durable_rename(const char *oldfile, const char *newfile); +extern int fsync_parent_path(const char *fname); +#endif + +extern PGFileType get_dirent_type(const char *path, + const struct dirent *de, + bool look_through_symlinks, + int elevel); + +extern int compute_remaining_iovec(struct iovec *destination, + const struct iovec *source, + int iovcnt, + size_t transferred); + +extern ssize_t pg_pwritev_with_retry(int fd, + const struct iovec *iov, + int iovcnt, + off_t offset); + +extern ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset); + +/* Filename components */ +#define PG_TEMP_FILES_DIR "pgsql_tmp" +#define PG_TEMP_FILE_PREFIX "pgsql_tmp" + +#endif /* FILE_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/hashfn.h b/platform/dbops/binaries/postgres/include/server/common/hashfn.h new file mode 100644 index 0000000000000000000000000000000000000000..0251b30af3e80b033748a26e254dbb76916efb2b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/hashfn.h @@ -0,0 +1,119 @@ +/* + * Utilities for working with hash values. + * + * Portions Copyright (c) 2017-2024, PostgreSQL Global Development Group + */ + +#ifndef HASHFN_H +#define HASHFN_H + + +/* + * Rotate the high 32 bits and the low 32 bits separately. The standard + * hash function sometimes rotates the low 32 bits by one bit when + * combining elements. We want extended hash functions to be compatible with + * that algorithm when the seed is 0, so we can't just do a normal rotation. + * This works, though. + */ +#define ROTATE_HIGH_AND_LOW_32BITS(v) \ + ((((v) << 1) & UINT64CONST(0xfffffffefffffffe)) | \ + (((v) >> 31) & UINT64CONST(0x100000001))) + + +extern uint32 hash_bytes(const unsigned char *k, int keylen); +extern uint64 hash_bytes_extended(const unsigned char *k, + int keylen, uint64 seed); +extern uint32 hash_bytes_uint32(uint32 k); +extern uint64 hash_bytes_uint32_extended(uint32 k, uint64 seed); + +#ifndef FRONTEND +static inline Datum +hash_any(const unsigned char *k, int keylen) +{ + return UInt32GetDatum(hash_bytes(k, keylen)); +} + +static inline Datum +hash_any_extended(const unsigned char *k, int keylen, uint64 seed) +{ + return UInt64GetDatum(hash_bytes_extended(k, keylen, seed)); +} + +static inline Datum +hash_uint32(uint32 k) +{ + return UInt32GetDatum(hash_bytes_uint32(k)); +} + +static inline Datum +hash_uint32_extended(uint32 k, uint64 seed) +{ + return UInt64GetDatum(hash_bytes_uint32_extended(k, seed)); +} +#endif + +extern uint32 string_hash(const void *key, Size keysize); +extern uint32 tag_hash(const void *key, Size keysize); +extern uint32 uint32_hash(const void *key, Size keysize); + +#define oid_hash uint32_hash /* Remove me eventually */ + +/* + * Combine two 32-bit hash values, resulting in another hash value, with + * decent bit mixing. + * + * Similar to boost's hash_combine(). + */ +static inline uint32 +hash_combine(uint32 a, uint32 b) +{ + a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2); + return a; +} + +/* + * Combine two 64-bit hash values, resulting in another hash value, using the + * same kind of technique as hash_combine(). Testing shows that this also + * produces good bit mixing. + */ +static inline uint64 +hash_combine64(uint64 a, uint64 b) +{ + /* 0x49a0f4dd15e5a8e3 is 64bit random data */ + a ^= b + UINT64CONST(0x49a0f4dd15e5a8e3) + (a << 54) + (a >> 7); + return a; +} + +/* + * Simple inline murmur hash implementation hashing a 32 bit integer, for + * performance. + */ +static inline uint32 +murmurhash32(uint32 data) +{ + uint32 h = data; + + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; +} + +/* 64-bit variant */ +static inline uint64 +murmurhash64(uint64 data) +{ + uint64 h = data; + + h ^= h >> 33; + h *= 0xff51afd7ed558ccd; + h ^= h >> 33; + h *= 0xc4ceb9fe1a85ec53; + h ^= h >> 33; + + return h; +} + +#endif /* HASHFN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/hashfn_unstable.h b/platform/dbops/binaries/postgres/include/server/common/hashfn_unstable.h new file mode 100644 index 0000000000000000000000000000000000000000..e67a4d3158d0875eb4e917695cef13fda8a207ef --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/hashfn_unstable.h @@ -0,0 +1,427 @@ +/* + * hashfn_unstable.h + * + * Building blocks for creating fast inlineable hash functions. The + * functions in this file are not guaranteed to be stable between versions, + * and may differ by hardware platform. Hence they must not be used in + * indexes or other on-disk structures. See hashfn.h if you need stability. + * + * + * Portions Copyright (c) 2024, PostgreSQL Global Development Group + * + * src/include/common/hashfn_unstable.h + */ +#ifndef HASHFN_UNSTABLE_H +#define HASHFN_UNSTABLE_H + +#include "port/pg_bitutils.h" +#include "port/pg_bswap.h" + +/* + * fasthash is a modification of code taken from + * https://code.google.com/archive/p/fast-hash/source/default/source + * under the terms of the MIT license. The original copyright + * notice follows: + */ + +/* The MIT License + + Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com) + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* + * fasthash as implemented here has two interfaces: + * + * 1) Standalone functions, e.g. fasthash32() for a single value with a + * known length. These return the same hash code as the original, at + * least on little-endian machines. + * + * 2) Incremental interface. This can used for incorporating multiple + * inputs. First, initialize the hash state (here with a zero seed): + * + * fasthash_state hs; + * fasthash_init(&hs, 0); + * + * If the inputs are of types that can be trivially cast to uint64, it's + * sufficient to do: + * + * hs.accum = value1; + * fasthash_combine(&hs); + * hs.accum = value2; + * fasthash_combine(&hs); + * ... + * + * For longer or variable-length input, fasthash_accum() is a more + * flexible, but more verbose method. The standalone functions use this + * internally, so see fasthash64() for an example of this. + * + * After all inputs have been mixed in, finalize the hash: + * + * hashcode = fasthash_final32(&hs, 0); + * + * The incremental interface allows an optimization for NUL-terminated + * C strings: + * + * len = fasthash_accum_cstring(&hs, str); + * hashcode = fasthash_final32(&hs, len); + * + * By handling the terminator on-the-fly, we can avoid needing a strlen() + * call to tell us how many bytes to hash. Experimentation has found that + * SMHasher fails unless we incorporate the length, so it is passed to + * the finalizer as a tweak. + */ + + +typedef struct fasthash_state +{ + /* staging area for chunks of input */ + uint64 accum; + + uint64 hash; +} fasthash_state; + +#define FH_SIZEOF_ACCUM sizeof(uint64) + + +/* + * Initialize the hash state. + * + * 'seed' can be zero. + */ +static inline void +fasthash_init(fasthash_state *hs, uint64 seed) +{ + memset(hs, 0, sizeof(fasthash_state)); + hs->hash = seed ^ 0x880355f21e6d1965; +} + +/* both the finalizer and part of the combining step */ +static inline uint64 +fasthash_mix(uint64 h, uint64 tweak) +{ + h ^= (h >> 23) + tweak; + h *= 0x2127599bf4325c37; + h ^= h >> 47; + return h; +} + +/* combine one chunk of input into the hash */ +static inline void +fasthash_combine(fasthash_state *hs) +{ + hs->hash ^= fasthash_mix(hs->accum, 0); + hs->hash *= 0x880355f21e6d1965; +} + +/* accumulate up to 8 bytes of input and combine it into the hash */ +static inline void +fasthash_accum(fasthash_state *hs, const char *k, size_t len) +{ + uint32 lower_four; + + Assert(len <= FH_SIZEOF_ACCUM); + hs->accum = 0; + + /* + * For consistency, bytewise loads must match the platform's endianness. + */ +#ifdef WORDS_BIGENDIAN + switch (len) + { + case 8: + memcpy(&hs->accum, k, 8); + break; + case 7: + hs->accum |= (uint64) k[6] << 8; + /* FALLTHROUGH */ + case 6: + hs->accum |= (uint64) k[5] << 16; + /* FALLTHROUGH */ + case 5: + hs->accum |= (uint64) k[4] << 24; + /* FALLTHROUGH */ + case 4: + memcpy(&lower_four, k, sizeof(lower_four)); + hs->accum |= (uint64) lower_four << 32; + break; + case 3: + hs->accum |= (uint64) k[2] << 40; + /* FALLTHROUGH */ + case 2: + hs->accum |= (uint64) k[1] << 48; + /* FALLTHROUGH */ + case 1: + hs->accum |= (uint64) k[0] << 56; + break; + case 0: + return; + } +#else + switch (len) + { + case 8: + memcpy(&hs->accum, k, 8); + break; + case 7: + hs->accum |= (uint64) k[6] << 48; + /* FALLTHROUGH */ + case 6: + hs->accum |= (uint64) k[5] << 40; + /* FALLTHROUGH */ + case 5: + hs->accum |= (uint64) k[4] << 32; + /* FALLTHROUGH */ + case 4: + memcpy(&lower_four, k, sizeof(lower_four)); + hs->accum |= lower_four; + break; + case 3: + hs->accum |= (uint64) k[2] << 16; + /* FALLTHROUGH */ + case 2: + hs->accum |= (uint64) k[1] << 8; + /* FALLTHROUGH */ + case 1: + hs->accum |= (uint64) k[0]; + break; + case 0: + return; + } +#endif + + fasthash_combine(hs); +} + +/* + * Set high bit in lowest byte where the input is zero, from: + * https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord + */ +#define haszero64(v) \ + (((v) - 0x0101010101010101) & ~(v) & 0x8080808080808080) + +/* + * all-purpose workhorse for fasthash_accum_cstring + */ +static inline size_t +fasthash_accum_cstring_unaligned(fasthash_state *hs, const char *str) +{ + const char *const start = str; + + while (*str) + { + size_t chunk_len = 0; + + while (chunk_len < FH_SIZEOF_ACCUM && str[chunk_len] != '\0') + chunk_len++; + + fasthash_accum(hs, str, chunk_len); + str += chunk_len; + } + + return str - start; +} + +/* + * specialized workhorse for fasthash_accum_cstring + * + * With an aligned pointer, we consume the string a word at a time. + * Loading the word containing the NUL terminator cannot segfault since + * allocation boundaries are suitably aligned. To keep from setting + * off alarms with address sanitizers, exclude this function from + * such testing. + */ +pg_attribute_no_sanitize_address() +static inline size_t +fasthash_accum_cstring_aligned(fasthash_state *hs, const char *str) +{ + const char *const start = str; + size_t remainder; + uint64 zero_byte_low; + + Assert(PointerIsAligned(start, uint64)); + + /* + * For every chunk of input, check for zero bytes before mixing into the + * hash. The chunk with zeros must contain the NUL terminator. We arrange + * so that zero_byte_low tells us not only that a zero exists, but also + * where it is, so we can hash the remainder of the string. + * + * The haszero64 calculation will set bits corresponding to the lowest + * byte where a zero exists, so that suffices for little-endian machines. + * For big-endian machines, we would need bits set for the highest zero + * byte in the chunk, since the trailing junk past the terminator could + * contain additional zeros. haszero64 does not give us that, so we + * byteswap the chunk first. + */ + for (;;) + { + uint64 chunk = *(uint64 *) str; + +#ifdef WORDS_BIGENDIAN + zero_byte_low = haszero64(pg_bswap64(chunk)); +#else + zero_byte_low = haszero64(chunk); +#endif + if (zero_byte_low) + break; + + hs->accum = chunk; + fasthash_combine(hs); + str += FH_SIZEOF_ACCUM; + } + + /* + * The byte corresponding to the NUL will be 0x80, so the rightmost bit + * position will be in the range 7, 15, ..., 63. Turn this into byte + * position by dividing by 8. + */ + remainder = pg_rightmost_one_pos64(zero_byte_low) / BITS_PER_BYTE; + fasthash_accum(hs, str, remainder); + str += remainder; + + return str - start; +} + +/* + * Mix 'str' into the hash state and return the length of the string. + */ +static inline size_t +fasthash_accum_cstring(fasthash_state *hs, const char *str) +{ +#if SIZEOF_VOID_P >= 8 + + size_t len; +#ifdef USE_ASSERT_CHECKING + size_t len_check; + fasthash_state hs_check; + + memcpy(&hs_check, hs, sizeof(fasthash_state)); + len_check = fasthash_accum_cstring_unaligned(&hs_check, str); +#endif + if (PointerIsAligned(str, uint64)) + { + len = fasthash_accum_cstring_aligned(hs, str); + Assert(len_check == len); + Assert(hs_check.hash == hs->hash); + return len; + } +#endif /* SIZEOF_VOID_P */ + + /* + * It's not worth it to try to make the word-at-a-time optimization work + * on 32-bit platforms. + */ + return fasthash_accum_cstring_unaligned(hs, str); +} + +/* + * The finalizer + * + * 'tweak' is intended to be the input length when the caller doesn't know + * the length ahead of time, such as for NUL-terminated strings, otherwise + * zero. + */ +static inline uint64 +fasthash_final64(fasthash_state *hs, uint64 tweak) +{ + return fasthash_mix(hs->hash, tweak); +} + +/* + * Reduce a 64-bit hash to a 32-bit hash. + * + * This optional step provides a bit more additional mixing compared to + * just taking the lower 32-bits. + */ +static inline uint32 +fasthash_reduce32(uint64 h) +{ + /* + * Convert the 64-bit hashcode to Fermat residue, which shall retain + * information from both the higher and lower parts of hashcode. + */ + return h - (h >> 32); +} + +/* finalize and reduce */ +static inline uint32 +fasthash_final32(fasthash_state *hs, uint64 tweak) +{ + return fasthash_reduce32(fasthash_final64(hs, tweak)); +} + +/* + * The original fasthash64 function, re-implemented using the incremental + * interface. Returns a 64-bit hashcode. 'len' controls not only how + * many bytes to hash, but also modifies the internal seed. + * 'seed' can be zero. + */ +static inline uint64 +fasthash64(const char *k, size_t len, uint64 seed) +{ + fasthash_state hs; + + fasthash_init(&hs, 0); + + /* re-initialize the seed according to input length */ + hs.hash = seed ^ (len * 0x880355f21e6d1965); + + while (len >= FH_SIZEOF_ACCUM) + { + fasthash_accum(&hs, k, FH_SIZEOF_ACCUM); + k += FH_SIZEOF_ACCUM; + len -= FH_SIZEOF_ACCUM; + } + + fasthash_accum(&hs, k, len); + return fasthash_final64(&hs, 0); +} + +/* like fasthash64, but returns a 32-bit hashcode */ +static inline uint32 +fasthash32(const char *k, size_t len, uint64 seed) +{ + return fasthash_reduce32(fasthash64(k, len, seed)); +} + +/* + * Convenience function for hashing NUL-terminated strings + */ +static inline uint32 +hash_string(const char *s) +{ + fasthash_state hs; + size_t s_len; + + fasthash_init(&hs, 0); + + /* + * Combine string into the hash and save the length for tweaking the final + * mix. + */ + s_len = fasthash_accum_cstring(&hs, s); + + return fasthash_final32(&hs, s_len); +} + +#endif /* HASHFN_UNSTABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/hmac.h b/platform/dbops/binaries/postgres/include/server/common/hmac.h new file mode 100644 index 0000000000000000000000000000000000000000..1b93aa2892b704afcf5ff1279d015cf5db91d74a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/hmac.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * hmac.h + * Generic headers for HMAC + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/hmac.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_HMAC_H +#define PG_HMAC_H + +#include "common/cryptohash.h" + +/* opaque context, private to each HMAC implementation */ +typedef struct pg_hmac_ctx pg_hmac_ctx; + +extern pg_hmac_ctx *pg_hmac_create(pg_cryptohash_type type); +extern int pg_hmac_init(pg_hmac_ctx *ctx, const uint8 *key, size_t len); +extern int pg_hmac_update(pg_hmac_ctx *ctx, const uint8 *data, size_t len); +extern int pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len); +extern void pg_hmac_free(pg_hmac_ctx *ctx); +extern const char *pg_hmac_error(pg_hmac_ctx *ctx); + +#endif /* PG_HMAC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/int.h b/platform/dbops/binaries/postgres/include/server/common/int.h new file mode 100644 index 0000000000000000000000000000000000000000..7fc046e78afba953522d3781636eb4d04a49e194 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/int.h @@ -0,0 +1,512 @@ +/*------------------------------------------------------------------------- + * + * int.h + * Overflow-aware integer math and integer comparison routines. + * + * The routines in this file are intended to be well defined C, without + * relying on compiler flags like -fwrapv. + * + * To reduce the overhead of these routines try to use compiler intrinsics + * where available. That's not that important for the 16, 32 bit cases, but + * the 64 bit cases can be considerably faster with intrinsics. In case no + * intrinsics are available 128 bit math is used where available. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/int.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_INT_H +#define COMMON_INT_H + + +/*--------- + * The following guidelines apply to all the overflow routines: + * - If a + b overflows, return true, otherwise store the result of a + b + * into *result. The content of *result is implementation defined in case of + * overflow. + * - If a - b overflows, return true, otherwise store the result of a - b + * into *result. The content of *result is implementation defined in case of + * overflow. + * - If a * b overflows, return true, otherwise store the result of a * b + * into *result. The content of *result is implementation defined in case of + * overflow. + *--------- + */ + +/*------------------------------------------------------------------------ + * Overflow routines for signed integers + *------------------------------------------------------------------------ + */ + +/* + * INT16 + */ +static inline bool +pg_add_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + int32 res = (int32) a + (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +static inline bool +pg_sub_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + int32 res = (int32) a - (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +static inline bool +pg_mul_s16_overflow(int16 a, int16 b, int16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + int32 res = (int32) a * (int32) b; + + if (res > PG_INT16_MAX || res < PG_INT16_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int16) res; + return false; +#endif +} + +/* + * INT32 + */ +static inline bool +pg_add_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + int64 res = (int64) a + (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +static inline bool +pg_sub_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + int64 res = (int64) a - (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +static inline bool +pg_mul_s32_overflow(int32 a, int32 b, int32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + int64 res = (int64) a * (int64) b; + + if (res > PG_INT32_MAX || res < PG_INT32_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int32) res; + return false; +#endif +} + +/* + * INT64 + */ +static inline bool +pg_add_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a + (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + if ((a > 0 && b > 0 && a > PG_INT64_MAX - b) || + (a < 0 && b < 0 && a < PG_INT64_MIN - b)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a + b; + return false; +#endif +} + +static inline bool +pg_sub_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a - (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + /* + * Note: overflow is also possible when a == 0 and b < 0 (specifically, + * when b == PG_INT64_MIN). + */ + if ((a < 0 && b > 0 && a < PG_INT64_MIN + b) || + (a >= 0 && b < 0 && a > PG_INT64_MAX + b)) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_s64_overflow(int64 a, int64 b, int64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#elif defined(HAVE_INT128) + int128 res = (int128) a * (int128) b; + + if (res > PG_INT64_MAX || res < PG_INT64_MIN) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (int64) res; + return false; +#else + /* + * Overflow can only happen if at least one value is outside the range + * sqrt(min)..sqrt(max) so check that first as the division can be quite a + * bit more expensive than the multiplication. + * + * Multiplying by 0 or 1 can't overflow of course and checking for 0 + * separately avoids any risk of dividing by 0. Be careful about dividing + * INT_MIN by -1 also, note reversing the a and b to ensure we're always + * dividing it by a positive value. + * + */ + if ((a > PG_INT32_MAX || a < PG_INT32_MIN || + b > PG_INT32_MAX || b < PG_INT32_MIN) && + a != 0 && a != 1 && b != 0 && b != 1 && + ((a > 0 && b > 0 && a > PG_INT64_MAX / b) || + (a > 0 && b < 0 && b < PG_INT64_MIN / a) || + (a < 0 && b > 0 && a < PG_INT64_MIN / b) || + (a < 0 && b < 0 && a < PG_INT64_MAX / b))) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a * b; + return false; +#endif +} + +/*------------------------------------------------------------------------ + * Overflow routines for unsigned integers + *------------------------------------------------------------------------ + */ + +/* + * UINT16 + */ +static inline bool +pg_add_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint16 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u16_overflow(uint16 a, uint16 b, uint16 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + uint32 res = (uint32) a * (uint32) b; + + if (res > PG_UINT16_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint16) res; + return false; +#endif +} + +/* + * INT32 + */ +static inline bool +pg_add_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint32 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u32_overflow(uint32 a, uint32 b, uint32 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#else + uint64 res = (uint64) a * (uint64) b; + + if (res > PG_UINT32_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint32) res; + return false; +#endif +} + +/* + * UINT64 + */ +static inline bool +pg_add_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_add_overflow(a, b, result); +#else + uint64 res = a + b; + + if (res < a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +static inline bool +pg_sub_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_sub_overflow(a, b, result); +#else + if (b > a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = a - b; + return false; +#endif +} + +static inline bool +pg_mul_u64_overflow(uint64 a, uint64 b, uint64 *result) +{ +#if defined(HAVE__BUILTIN_OP_OVERFLOW) + return __builtin_mul_overflow(a, b, result); +#elif defined(HAVE_INT128) + uint128 res = (uint128) a * (uint128) b; + + if (res > PG_UINT64_MAX) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = (uint64) res; + return false; +#else + uint64 res = a * b; + + if (a != 0 && b != res / a) + { + *result = 0x5EED; /* to avoid spurious warnings */ + return true; + } + *result = res; + return false; +#endif +} + +/*------------------------------------------------------------------------ + * + * Comparison routines for integer types. + * + * These routines are primarily intended for use in qsort() comparator + * functions and therefore return a positive integer, 0, or a negative + * integer depending on whether "a" is greater than, equal to, or less + * than "b", respectively. These functions are written to be as efficient + * as possible without introducing overflow risks, thereby helping ensure + * the comparators that use them are transitive. + * + * Types with fewer than 32 bits are cast to signed integers and + * subtracted. Other types are compared using > and <, and the results of + * those comparisons (which are either (int) 0 or (int) 1 per the C + * standard) are subtracted. + * + * NB: If the comparator function is inlined, some compilers may produce + * worse code with these helper functions than with code with the + * following form: + * + * if (a < b) + * return -1; + * if (a > b) + * return 1; + * return 0; + * + *------------------------------------------------------------------------ + */ + +static inline int +pg_cmp_s16(int16 a, int16 b) +{ + return (int32) a - (int32) b; +} + +static inline int +pg_cmp_u16(uint16 a, uint16 b) +{ + return (int32) a - (int32) b; +} + +static inline int +pg_cmp_s32(int32 a, int32 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_u32(uint32 a, uint32 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_s64(int64 a, int64 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_u64(uint64 a, uint64 b) +{ + return (a > b) - (a < b); +} + +static inline int +pg_cmp_size(size_t a, size_t b) +{ + return (a > b) - (a < b); +} + +#endif /* COMMON_INT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/int128.h b/platform/dbops/binaries/postgres/include/server/common/int128.h new file mode 100644 index 0000000000000000000000000000000000000000..bb443303a84c85570324775359c0c88c8fe40f79 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/int128.h @@ -0,0 +1,276 @@ +/*------------------------------------------------------------------------- + * + * int128.h + * Roll-our-own 128-bit integer arithmetic. + * + * We make use of the native int128 type if there is one, otherwise + * implement things the hard way based on two int64 halves. + * + * See src/tools/testint128.c for a simple test harness for this file. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/int128.h + * + *------------------------------------------------------------------------- + */ +#ifndef INT128_H +#define INT128_H + +/* + * For testing purposes, use of native int128 can be switched on/off by + * predefining USE_NATIVE_INT128. + */ +#ifndef USE_NATIVE_INT128 +#ifdef HAVE_INT128 +#define USE_NATIVE_INT128 1 +#else +#define USE_NATIVE_INT128 0 +#endif +#endif + + +#if USE_NATIVE_INT128 + +typedef int128 INT128; + +/* + * Add an unsigned int64 value into an INT128 variable. + */ +static inline void +int128_add_uint64(INT128 *i128, uint64 v) +{ + *i128 += v; +} + +/* + * Add a signed int64 value into an INT128 variable. + */ +static inline void +int128_add_int64(INT128 *i128, int64 v) +{ + *i128 += v; +} + +/* + * Add the 128-bit product of two int64 values into an INT128 variable. + * + * XXX with a stupid compiler, this could actually be less efficient than + * the other implementation; maybe we should do it by hand always? + */ +static inline void +int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y) +{ + *i128 += (int128) x * (int128) y; +} + +/* + * Compare two INT128 values, return -1, 0, or +1. + */ +static inline int +int128_compare(INT128 x, INT128 y) +{ + if (x < y) + return -1; + if (x > y) + return 1; + return 0; +} + +/* + * Widen int64 to INT128. + */ +static inline INT128 +int64_to_int128(int64 v) +{ + return (INT128) v; +} + +/* + * Convert INT128 to int64 (losing any high-order bits). + * This also works fine for casting down to uint64. + */ +static inline int64 +int128_to_int64(INT128 val) +{ + return (int64) val; +} + +#else /* !USE_NATIVE_INT128 */ + +/* + * We lay out the INT128 structure with the same content and byte ordering + * that a native int128 type would (probably) have. This makes no difference + * for ordinary use of INT128, but allows union'ing INT128 with int128 for + * testing purposes. + */ +typedef struct +{ +#ifdef WORDS_BIGENDIAN + int64 hi; /* most significant 64 bits, including sign */ + uint64 lo; /* least significant 64 bits, without sign */ +#else + uint64 lo; /* least significant 64 bits, without sign */ + int64 hi; /* most significant 64 bits, including sign */ +#endif +} INT128; + +/* + * Add an unsigned int64 value into an INT128 variable. + */ +static inline void +int128_add_uint64(INT128 *i128, uint64 v) +{ + /* + * First add the value to the .lo part, then check to see if a carry needs + * to be propagated into the .hi part. A carry is needed if both inputs + * have high bits set, or if just one input has high bit set while the new + * .lo part doesn't. Remember that .lo part is unsigned; we cast to + * signed here just as a cheap way to check the high bit. + */ + uint64 oldlo = i128->lo; + + i128->lo += v; + if (((int64) v < 0 && (int64) oldlo < 0) || + (((int64) v < 0 || (int64) oldlo < 0) && (int64) i128->lo >= 0)) + i128->hi++; +} + +/* + * Add a signed int64 value into an INT128 variable. + */ +static inline void +int128_add_int64(INT128 *i128, int64 v) +{ + /* + * This is much like the above except that the carry logic differs for + * negative v. Ordinarily we'd need to subtract 1 from the .hi part + * (corresponding to adding the sign-extended bits of v to it); but if + * there is a carry out of the .lo part, that cancels and we do nothing. + */ + uint64 oldlo = i128->lo; + + i128->lo += v; + if (v >= 0) + { + if ((int64) oldlo < 0 && (int64) i128->lo >= 0) + i128->hi++; + } + else + { + if (!((int64) oldlo < 0 || (int64) i128->lo >= 0)) + i128->hi--; + } +} + +/* + * INT64_AU32 extracts the most significant 32 bits of int64 as int64, while + * INT64_AL32 extracts the least significant 32 bits as uint64. + */ +#define INT64_AU32(i64) ((i64) >> 32) +#define INT64_AL32(i64) ((i64) & UINT64CONST(0xFFFFFFFF)) + +/* + * Add the 128-bit product of two int64 values into an INT128 variable. + */ +static inline void +int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y) +{ + /* INT64_AU32 must use arithmetic right shift */ + StaticAssertDecl(((int64) -1 >> 1) == (int64) -1, + "arithmetic right shift is needed"); + + /*---------- + * Form the 128-bit product x * y using 64-bit arithmetic. + * Considering each 64-bit input as having 32-bit high and low parts, + * we can compute + * + * x * y = ((x.hi << 32) + x.lo) * (((y.hi << 32) + y.lo) + * = (x.hi * y.hi) << 64 + + * (x.hi * y.lo) << 32 + + * (x.lo * y.hi) << 32 + + * x.lo * y.lo + * + * Each individual product is of 32-bit terms so it won't overflow when + * computed in 64-bit arithmetic. Then we just have to shift it to the + * correct position while adding into the 128-bit result. We must also + * keep in mind that the "lo" parts must be treated as unsigned. + *---------- + */ + + /* No need to work hard if product must be zero */ + if (x != 0 && y != 0) + { + int64 x_u32 = INT64_AU32(x); + uint64 x_l32 = INT64_AL32(x); + int64 y_u32 = INT64_AU32(y); + uint64 y_l32 = INT64_AL32(y); + int64 tmp; + + /* the first term */ + i128->hi += x_u32 * y_u32; + + /* the second term: sign-extend it only if x is negative */ + tmp = x_u32 * y_l32; + if (x < 0) + i128->hi += INT64_AU32(tmp); + else + i128->hi += ((uint64) tmp) >> 32; + int128_add_uint64(i128, ((uint64) INT64_AL32(tmp)) << 32); + + /* the third term: sign-extend it only if y is negative */ + tmp = x_l32 * y_u32; + if (y < 0) + i128->hi += INT64_AU32(tmp); + else + i128->hi += ((uint64) tmp) >> 32; + int128_add_uint64(i128, ((uint64) INT64_AL32(tmp)) << 32); + + /* the fourth term: always unsigned */ + int128_add_uint64(i128, x_l32 * y_l32); + } +} + +/* + * Compare two INT128 values, return -1, 0, or +1. + */ +static inline int +int128_compare(INT128 x, INT128 y) +{ + if (x.hi < y.hi) + return -1; + if (x.hi > y.hi) + return 1; + if (x.lo < y.lo) + return -1; + if (x.lo > y.lo) + return 1; + return 0; +} + +/* + * Widen int64 to INT128. + */ +static inline INT128 +int64_to_int128(int64 v) +{ + INT128 val; + + val.lo = (uint64) v; + val.hi = (v < 0) ? -INT64CONST(1) : INT64CONST(0); + return val; +} + +/* + * Convert INT128 to int64 (losing any high-order bits). + * This also works fine for casting down to uint64. + */ +static inline int64 +int128_to_int64(INT128 val) +{ + return (int64) val.lo; +} + +#endif /* USE_NATIVE_INT128 */ + +#endif /* INT128_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/ip.h b/platform/dbops/binaries/postgres/include/server/common/ip.h new file mode 100644 index 0000000000000000000000000000000000000000..5648b6e52214db57fa5049d95a0942077b794392 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/ip.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * ip.h + * Definitions for IPv6-aware network access. + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/common/ip.h + * + *------------------------------------------------------------------------- + */ +#ifndef IP_H +#define IP_H + +#include +#include + +#include "libpq/pqcomm.h" /* pgrminclude ignore */ + + +extern int pg_getaddrinfo_all(const char *hostname, const char *servname, + const struct addrinfo *hintp, + struct addrinfo **result); +extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai); + +extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen, + char *node, int nodelen, + char *service, int servicelen, + int flags); + +#endif /* IP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/jsonapi.h b/platform/dbops/binaries/postgres/include/server/common/jsonapi.h new file mode 100644 index 0000000000000000000000000000000000000000..71a491d72dc0eb55baaa050085a546518a5d480e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/jsonapi.h @@ -0,0 +1,224 @@ +/*------------------------------------------------------------------------- + * + * jsonapi.h + * Declarations for JSON API support. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/jsonapi.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONAPI_H +#define JSONAPI_H + +#include "lib/stringinfo.h" + +typedef enum JsonTokenType +{ + JSON_TOKEN_INVALID, + JSON_TOKEN_STRING, + JSON_TOKEN_NUMBER, + JSON_TOKEN_OBJECT_START, + JSON_TOKEN_OBJECT_END, + JSON_TOKEN_ARRAY_START, + JSON_TOKEN_ARRAY_END, + JSON_TOKEN_COMMA, + JSON_TOKEN_COLON, + JSON_TOKEN_TRUE, + JSON_TOKEN_FALSE, + JSON_TOKEN_NULL, + JSON_TOKEN_END, +} JsonTokenType; + +typedef enum JsonParseErrorType +{ + JSON_SUCCESS, + JSON_INCOMPLETE, + JSON_INVALID_LEXER_TYPE, + JSON_NESTING_TOO_DEEP, + JSON_ESCAPING_INVALID, + JSON_ESCAPING_REQUIRED, + JSON_EXPECTED_ARRAY_FIRST, + JSON_EXPECTED_ARRAY_NEXT, + JSON_EXPECTED_COLON, + JSON_EXPECTED_END, + JSON_EXPECTED_JSON, + JSON_EXPECTED_MORE, + JSON_EXPECTED_OBJECT_FIRST, + JSON_EXPECTED_OBJECT_NEXT, + JSON_EXPECTED_STRING, + JSON_INVALID_TOKEN, + JSON_UNICODE_CODE_POINT_ZERO, + JSON_UNICODE_ESCAPE_FORMAT, + JSON_UNICODE_HIGH_ESCAPE, + JSON_UNICODE_UNTRANSLATABLE, + JSON_UNICODE_HIGH_SURROGATE, + JSON_UNICODE_LOW_SURROGATE, + JSON_SEM_ACTION_FAILED, /* error should already be reported */ +} JsonParseErrorType; + +/* Parser state private to jsonapi.c */ +typedef struct JsonParserStack JsonParserStack; +typedef struct JsonIncrementalState JsonIncrementalState; + +/* + * All the fields in this structure should be treated as read-only. + * + * If strval is not null, then it should contain the de-escaped value + * of the lexeme if it's a string. Otherwise most of these field names + * should be self-explanatory. + * + * line_number and line_start are principally for use by the parser's + * error reporting routines. + * token_terminator and prev_token_terminator point to the character + * AFTER the end of the token, i.e. where there would be a nul byte + * if we were using nul-terminated strings. + * + * The prev_token_terminator field should not be used when incremental is + * true, as the previous token might have started in a previous piece of input, + * and thus it can't be used in any pointer arithmetic or other operations in + * conjunction with token_start. + * + * JSONLEX_FREE_STRUCT/STRVAL are used to drive freeJsonLexContext. + */ +#define JSONLEX_FREE_STRUCT (1 << 0) +#define JSONLEX_FREE_STRVAL (1 << 1) +typedef struct JsonLexContext +{ + const char *input; + size_t input_length; + int input_encoding; + const char *token_start; + const char *token_terminator; + const char *prev_token_terminator; + bool incremental; + JsonTokenType token_type; + int lex_level; + bits32 flags; + int line_number; /* line number, starting from 1 */ + const char *line_start; /* where that line starts within input */ + JsonParserStack *pstack; + JsonIncrementalState *inc_state; + StringInfo strval; + StringInfo errormsg; +} JsonLexContext; + +typedef JsonParseErrorType (*json_struct_action) (void *state); +typedef JsonParseErrorType (*json_ofield_action) (void *state, char *fname, bool isnull); +typedef JsonParseErrorType (*json_aelem_action) (void *state, bool isnull); +typedef JsonParseErrorType (*json_scalar_action) (void *state, char *token, JsonTokenType tokentype); + + +/* + * Semantic Action structure for use in parsing json. + * + * Any of these actions can be NULL, in which case nothing is done at that + * point, Likewise, semstate can be NULL. Using an all-NULL structure amounts + * to doing a pure parse with no side-effects, and is therefore exactly + * what the json input routines do. + * + * The 'fname' and 'token' strings passed to these actions are palloc'd. + * They are not free'd or used further by the parser, so the action function + * is free to do what it wishes with them. + * + * All action functions return JsonParseErrorType. If the result isn't + * JSON_SUCCESS, the parse is abandoned and that error code is returned. + * If it is JSON_SEM_ACTION_FAILED, the action function is responsible + * for having reported the error in some appropriate way. + */ +typedef struct JsonSemAction +{ + void *semstate; + json_struct_action object_start; + json_struct_action object_end; + json_struct_action array_start; + json_struct_action array_end; + json_ofield_action object_field_start; + json_ofield_action object_field_end; + json_aelem_action array_element_start; + json_aelem_action array_element_end; + json_scalar_action scalar; +} JsonSemAction; + +/* + * pg_parse_json will parse the string in the lex calling the + * action functions in sem at the appropriate points. It is + * up to them to keep what state they need in semstate. If they + * need access to the state of the lexer, then its pointer + * should be passed to them as a member of whatever semstate + * points to. If the action pointers are NULL the parser + * does nothing and just continues. + */ +extern JsonParseErrorType pg_parse_json(JsonLexContext *lex, + JsonSemAction *sem); + +extern JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, + JsonSemAction *sem, + const char *json, + size_t len, + bool is_last); + +/* the null action object used for pure validation */ +extern PGDLLIMPORT JsonSemAction nullSemAction; + +/* + * json_count_array_elements performs a fast secondary parse to determine the + * number of elements in passed array lex context. It should be called from an + * array_start action. + * + * The return value indicates whether any error occurred, while the number + * of elements is stored into *elements (but only if the return value is + * JSON_SUCCESS). + */ +extern JsonParseErrorType json_count_array_elements(JsonLexContext *lex, + int *elements); + +/* + * initializer for JsonLexContext. + * + * If a valid 'lex' pointer is given, it is initialized. This can be used + * for stack-allocated structs, saving overhead. If NULL is given, a new + * struct is allocated. + * + * If need_escapes is true, ->strval stores the unescaped lexemes. + * Unescaping is expensive, so only request it when necessary. + * + * If need_escapes is true or lex was given as NULL, then the caller is + * responsible for freeing the returned struct, either by calling + * freeJsonLexContext() or (in backend environment) via memory context + * cleanup. + */ +extern JsonLexContext *makeJsonLexContextCstringLen(JsonLexContext *lex, + const char *json, + size_t len, + int encoding, + bool need_escapes); + +/* + * make a JsonLexContext suitable for incremental parsing. + * the string chunks will be handed to pg_parse_json_incremental, + * so there's no need for them here. + */ +extern JsonLexContext *makeJsonLexContextIncremental(JsonLexContext *lex, + int encoding, + bool need_escapes); + +extern void freeJsonLexContext(JsonLexContext *lex); + +/* lex one token */ +extern JsonParseErrorType json_lex(JsonLexContext *lex); + +/* construct an error detail string for a json error */ +extern char *json_errdetail(JsonParseErrorType error, JsonLexContext *lex); + +/* + * Utility function to check if a string is a valid JSON number. + * + * str argument does not need to be nul-terminated. + */ +extern bool IsValidJsonNumber(const char *str, size_t len); + +#endif /* JSONAPI_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/keywords.h b/platform/dbops/binaries/postgres/include/server/common/keywords.h new file mode 100644 index 0000000000000000000000000000000000000000..0144377ab5b3efc4c627d3738c1f5a86c2231b58 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/keywords.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * keywords.h + * PostgreSQL's list of SQL keywords + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/keywords.h + * + *------------------------------------------------------------------------- + */ +#ifndef KEYWORDS_H +#define KEYWORDS_H + +#include "common/kwlookup.h" + +/* Keyword categories --- should match lists in gram.y */ +#define UNRESERVED_KEYWORD 0 +#define COL_NAME_KEYWORD 1 +#define TYPE_FUNC_NAME_KEYWORD 2 +#define RESERVED_KEYWORD 3 + +extern PGDLLIMPORT const ScanKeywordList ScanKeywords; +extern PGDLLIMPORT const uint8 ScanKeywordCategories[]; +extern PGDLLIMPORT const bool ScanKeywordBareLabel[]; + +#endif /* KEYWORDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/kwlookup.h b/platform/dbops/binaries/postgres/include/server/common/kwlookup.h new file mode 100644 index 0000000000000000000000000000000000000000..3725e47cddab6ca71ab857b0da164038f780e2e3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/kwlookup.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * kwlookup.h + * Key word lookup for PostgreSQL + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/kwlookup.h + * + *------------------------------------------------------------------------- + */ +#ifndef KWLOOKUP_H +#define KWLOOKUP_H + +/* Hash function used by ScanKeywordLookup */ +typedef int (*ScanKeywordHashFunc) (const void *key, size_t keylen); + +/* + * This struct contains the data needed by ScanKeywordLookup to perform a + * search within a set of keywords. The contents are typically generated by + * src/tools/gen_keywordlist.pl from a header containing PG_KEYWORD macros. + */ +typedef struct ScanKeywordList +{ + const char *kw_string; /* all keywords in order, separated by \0 */ + const uint16 *kw_offsets; /* offsets to the start of each keyword */ + ScanKeywordHashFunc hash; /* perfect hash function for keywords */ + int num_keywords; /* number of keywords */ + int max_kw_len; /* length of longest keyword */ +} ScanKeywordList; + + +extern int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords); + +/* Code that wants to retrieve the text of the N'th keyword should use this. */ +static inline const char * +GetScanKeyword(int n, const ScanKeywordList *keywords) +{ + return keywords->kw_string + keywords->kw_offsets[n]; +} + +#endif /* KWLOOKUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/link-canary.h b/platform/dbops/binaries/postgres/include/server/common/link-canary.h new file mode 100644 index 0000000000000000000000000000000000000000..0c6daed0a75208c9e2f2ad8249d893da299b9614 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/link-canary.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * link-canary.h + * Detect whether src/common functions came from frontend or backend. + * + * Copyright (c) 2018-2024, PostgreSQL Global Development Group + * + * src/include/common/link-canary.h + * + *------------------------------------------------------------------------- + */ +#ifndef LINK_CANARY_H +#define LINK_CANARY_H + +extern bool pg_link_canary_is_frontend(void); + +#endif /* LINK_CANARY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/logging.h b/platform/dbops/binaries/postgres/include/server/common/logging.h new file mode 100644 index 0000000000000000000000000000000000000000..afbd9c059a9524fb23baa3845822eb6968664176 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/logging.h @@ -0,0 +1,156 @@ +/*------------------------------------------------------------------------- + * Logging framework for frontend programs + * + * Copyright (c) 2018-2024, PostgreSQL Global Development Group + * + * src/include/common/logging.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_LOGGING_H +#define COMMON_LOGGING_H + +/* + * Log levels are informational only. They do not affect program flow. + */ +enum pg_log_level +{ + /* + * Not initialized yet (not to be used as an actual message log level). + */ + PG_LOG_NOTSET = 0, + + /* + * Low level messages that are normally off by default. + */ + PG_LOG_DEBUG, + + /* + * Any program messages that go to stderr, shown by default. (The + * program's normal output should go to stdout and not use the logging + * system.) + */ + PG_LOG_INFO, + + /* + * Warnings and "almost" errors, depends on the program + */ + PG_LOG_WARNING, + + /* + * Errors + */ + PG_LOG_ERROR, + + /* + * Turn all logging off (not to be used as an actual message log level). + */ + PG_LOG_OFF, +}; + +/* + * __pg_log_level is the minimum log level that will actually be shown. + */ +extern enum pg_log_level __pg_log_level; + +/* + * A log message can have several parts. The primary message is required, + * others are optional. When emitting multiple parts, do so in the order of + * this enum, for consistency. + */ +enum pg_log_part +{ + /* + * The primary message. Try to keep it to one line; follow the backend's + * style guideline for primary messages. + */ + PG_LOG_PRIMARY, + + /* + * Additional detail. Follow the backend's style guideline for detail + * messages. + */ + PG_LOG_DETAIL, + + /* + * Hint (not guaranteed correct) about how to fix the problem. Follow the + * backend's style guideline for hint messages. + */ + PG_LOG_HINT, +}; + +/* + * Kind of a hack to be able to produce the psql output exactly as required by + * the regression tests. + */ +#define PG_LOG_FLAG_TERSE 1 + +void pg_logging_init(const char *argv0); +void pg_logging_config(int new_flags); +void pg_logging_set_level(enum pg_log_level new_level); +void pg_logging_increase_verbosity(void); +void pg_logging_set_pre_callback(void (*cb) (void)); +void pg_logging_set_locus_callback(void (*cb) (const char **filename, uint64 *lineno)); + +void pg_log_generic(enum pg_log_level level, enum pg_log_part part, + const char *pg_restrict fmt,...) + pg_attribute_printf(3, 4); +void pg_log_generic_v(enum pg_log_level level, enum pg_log_part part, + const char *pg_restrict fmt, va_list ap) + pg_attribute_printf(3, 0); + +/* + * Preferred style is to use these macros to perform logging; don't call + * pg_log_generic[_v] directly, except perhaps in error interface code. + */ +#define pg_log_error(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_error_detail(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_error_hint(...) \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_warning(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_warning_detail(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_warning_hint(...) \ + pg_log_generic(PG_LOG_WARNING, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_info(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_PRIMARY, __VA_ARGS__) + +#define pg_log_info_detail(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_DETAIL, __VA_ARGS__) + +#define pg_log_info_hint(...) \ + pg_log_generic(PG_LOG_INFO, PG_LOG_HINT, __VA_ARGS__) + +#define pg_log_debug(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_PRIMARY, __VA_ARGS__); \ + } while(0) + +#define pg_log_debug_detail(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_DETAIL, __VA_ARGS__); \ + } while(0) + +#define pg_log_debug_hint(...) do { \ + if (unlikely(__pg_log_level <= PG_LOG_DEBUG)) \ + pg_log_generic(PG_LOG_DEBUG, PG_LOG_HINT, __VA_ARGS__); \ + } while(0) + +/* + * A common shortcut: pg_log_error() and immediately exit(1). + */ +#define pg_fatal(...) do { \ + pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__); \ + exit(1); \ + } while(0) + +#endif /* COMMON_LOGGING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/md5.h b/platform/dbops/binaries/postgres/include/server/common/md5.h new file mode 100644 index 0000000000000000000000000000000000000000..6c32f10e89af2c233e8eb42de445fef2410c7ffb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/md5.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * md5.h + * Constants and common utilities related to MD5. + * + * These definitions are needed by both frontend and backend code to work + * with MD5-encrypted passwords. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/md5.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_MD5_H +#define PG_MD5_H + +/* Size of result generated by MD5 computation */ +#define MD5_DIGEST_LENGTH 16 +/* Block size for MD5 */ +#define MD5_BLOCK_SIZE 64 + +/* password-related data */ +#define MD5_PASSWD_CHARSET "0123456789abcdef" +#define MD5_PASSWD_LEN 35 + +/* Utilities common to all the MD5 implementations, as of md5_common.c */ +extern bool pg_md5_hash(const void *buff, size_t len, char *hexsum, + const char **errstr); +extern bool pg_md5_binary(const void *buff, size_t len, void *outbuf, + const char **errstr); +extern bool pg_md5_encrypt(const char *passwd, const char *salt, + size_t salt_len, char *buf, + const char **errstr); + +#endif /* PG_MD5_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/openssl.h b/platform/dbops/binaries/postgres/include/server/common/openssl.h new file mode 100644 index 0000000000000000000000000000000000000000..964d691d32de50006a4e046a2b8b54106b35ec23 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/openssl.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * openssl.h + * OpenSSL supporting functionality shared between frontend and backend + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/openssl.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMMON_OPENSSL_H +#define COMMON_OPENSSL_H + +#ifdef USE_OPENSSL +#include + +/* + * OpenSSL doesn't provide any very nice way to identify the min/max + * protocol versions the library supports, so we fake it as best we can. + * Note in particular that this doesn't account for restrictions that + * might be specified in the installation's openssl.cnf. + * + * We disable SSLv3 and older in library setup, so TLSv1 is the oldest + * protocol version of interest. + */ +#define MIN_OPENSSL_TLS_VERSION "TLSv1" + +#if defined(TLS1_3_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.3" +#elif defined(TLS1_2_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.2" +#elif defined(TLS1_1_VERSION) +#define MAX_OPENSSL_TLS_VERSION "TLSv1.1" +#else +#define MAX_OPENSSL_TLS_VERSION "TLSv1" +#endif + +/* src/common/protocol_openssl.c */ +#ifndef SSL_CTX_set_min_proto_version +extern int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version); +extern int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version); +#endif + +#endif /* USE_OPENSSL */ + +#endif /* COMMON_OPENSSL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/parse_manifest.h b/platform/dbops/binaries/postgres/include/server/common/parse_manifest.h new file mode 100644 index 0000000000000000000000000000000000000000..ce5cafa96617eb51a36ee75ca069f9e5cbcffca0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/parse_manifest.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * parse_manifest.h + * Parse a backup manifest in JSON format. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/parse_manifest.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARSE_MANIFEST_H +#define PARSE_MANIFEST_H + +#include "access/xlogdefs.h" +#include "common/checksum_helper.h" +#include "mb/pg_wchar.h" + +struct JsonManifestParseContext; +typedef struct JsonManifestParseContext JsonManifestParseContext; +typedef struct JsonManifestParseIncrementalState JsonManifestParseIncrementalState; + +typedef void (*json_manifest_version_callback) (JsonManifestParseContext *, + int manifest_version); +typedef void (*json_manifest_system_identifier_callback) (JsonManifestParseContext *, + uint64 manifest_system_identifier); +typedef void (*json_manifest_per_file_callback) (JsonManifestParseContext *, + const char *pathname, + size_t size, pg_checksum_type checksum_type, + int checksum_length, uint8 *checksum_payload); +typedef void (*json_manifest_per_wal_range_callback) (JsonManifestParseContext *, + TimeLineID tli, + XLogRecPtr start_lsn, XLogRecPtr end_lsn); +typedef void (*json_manifest_error_callback) (JsonManifestParseContext *, + const char *fmt,...) pg_attribute_printf(2, 3) + pg_attribute_noreturn(); + +struct JsonManifestParseContext +{ + void *private_data; + json_manifest_version_callback version_cb; + json_manifest_system_identifier_callback system_identifier_cb; + json_manifest_per_file_callback per_file_cb; + json_manifest_per_wal_range_callback per_wal_range_cb; + json_manifest_error_callback error_cb; +}; + +extern void json_parse_manifest(JsonManifestParseContext *context, + const char *buffer, size_t size); +extern JsonManifestParseIncrementalState *json_parse_manifest_incremental_init(JsonManifestParseContext *context); +extern void json_parse_manifest_incremental_chunk(JsonManifestParseIncrementalState *incstate, + const char *chunk, size_t size, + bool is_last); +extern void json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/common/percentrepl.h b/platform/dbops/binaries/postgres/include/server/common/percentrepl.h new file mode 100644 index 0000000000000000000000000000000000000000..fbca9c1fc901ec564ac0311fc5575e530f6c08ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/percentrepl.h @@ -0,0 +1,18 @@ +/*------------------------------------------------------------------------- + * + * percentrepl.h + * Common routines to replace percent placeholders in strings + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/percentrepl.h + * + *------------------------------------------------------------------------- + */ +#ifndef PERCENTREPL_H +#define PERCENTREPL_H + +extern char *replace_percent_placeholders(const char *instr, const char *param_name, const char *letters,...); + +#endif /* PERCENTREPL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/pg_lzcompress.h b/platform/dbops/binaries/postgres/include/server/common/pg_lzcompress.h new file mode 100644 index 0000000000000000000000000000000000000000..2a12b33a008024e1eefcafe202b97b37cdd561c0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/pg_lzcompress.h @@ -0,0 +1,93 @@ +/* ---------- + * pg_lzcompress.h - + * + * Definitions for the builtin LZ compressor + * + * src/include/common/pg_lzcompress.h + * ---------- + */ + +#ifndef _PG_LZCOMPRESS_H_ +#define _PG_LZCOMPRESS_H_ + + +/* ---------- + * PGLZ_MAX_OUTPUT - + * + * Macro to compute the buffer size required by pglz_compress(). + * We allow 4 bytes for overrun before detecting compression failure. + * ---------- + */ +#define PGLZ_MAX_OUTPUT(_dlen) ((_dlen) + 4) + + +/* ---------- + * PGLZ_Strategy - + * + * Some values that control the compression algorithm. + * + * min_input_size Minimum input data size to consider compression. + * + * max_input_size Maximum input data size to consider compression. + * + * min_comp_rate Minimum compression rate (0-99%) to require. + * Regardless of min_comp_rate, the output must be + * smaller than the input, else we don't store + * compressed. + * + * first_success_by Abandon compression if we find no compressible + * data within the first this-many bytes. + * + * match_size_good The initial GOOD match size when starting history + * lookup. When looking up the history to find a + * match that could be expressed as a tag, the + * algorithm does not always walk back entirely. + * A good match fast is usually better than the + * best possible one very late. For each iteration + * in the lookup, this value is lowered so the + * longer the lookup takes, the smaller matches + * are considered good. + * + * match_size_drop The percentage by which match_size_good is lowered + * after each history check. Allowed values are + * 0 (no change until end) to 100 (only check + * latest history entry at all). + * ---------- + */ +typedef struct PGLZ_Strategy +{ + int32 min_input_size; + int32 max_input_size; + int32 min_comp_rate; + int32 first_success_by; + int32 match_size_good; + int32 match_size_drop; +} PGLZ_Strategy; + + +/* ---------- + * The standard strategies + * + * PGLZ_strategy_default Recommended default strategy for TOAST. + * + * PGLZ_strategy_always Try to compress inputs of any length. + * Fallback to uncompressed storage only if + * output would be larger than input. + * ---------- + */ +extern PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_default; +extern PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_always; + + +/* ---------- + * Global function declarations + * ---------- + */ +extern int32 pglz_compress(const char *source, int32 slen, char *dest, + const PGLZ_Strategy *strategy); +extern int32 pglz_decompress(const char *source, int32 slen, char *dest, + int32 rawsize, bool check_complete); +extern int32 pglz_maximum_compressed_size(int32 rawsize, + int32 total_compressed_size); + +#endif /* _PG_LZCOMPRESS_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/common/pg_prng.h b/platform/dbops/binaries/postgres/include/server/common/pg_prng.h new file mode 100644 index 0000000000000000000000000000000000000000..c114c6419d009a6df4402c9a8c7388f0f8866175 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/pg_prng.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * Pseudo-Random Number Generator + * + * Copyright (c) 2021-2024, PostgreSQL Global Development Group + * + * src/include/common/pg_prng.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PRNG_H +#define PG_PRNG_H + +/* + * State vector for PRNG generation. Callers should treat this as an + * opaque typedef, but we expose its definition to allow it to be + * embedded in other structs. + */ +typedef struct pg_prng_state +{ + uint64 s0, + s1; +} pg_prng_state; + +/* + * Callers not needing local PRNG series may use this global state vector, + * after initializing it with one of the pg_prng_...seed functions. + */ +extern PGDLLIMPORT pg_prng_state pg_global_prng_state; + +extern void pg_prng_seed(pg_prng_state *state, uint64 seed); +extern void pg_prng_fseed(pg_prng_state *state, double fseed); +extern bool pg_prng_seed_check(pg_prng_state *state); + +/* + * Initialize the PRNG state from the pg_strong_random source, + * taking care that we don't produce all-zeroes. If this returns false, + * caller should initialize the PRNG state from some other random seed, + * using pg_prng_[f]seed. + * + * We implement this as a macro, so that the pg_strong_random() call is + * in the caller. If it were in pg_prng.c, programs using pg_prng.c + * but not needing strong seeding would nonetheless be forced to pull in + * pg_strong_random.c and thence OpenSSL. + */ +#define pg_prng_strong_seed(state) \ + (pg_strong_random((void *) (state), sizeof(pg_prng_state)) ? \ + pg_prng_seed_check(state) : false) + +extern uint64 pg_prng_uint64(pg_prng_state *state); +extern uint64 pg_prng_uint64_range(pg_prng_state *state, uint64 rmin, uint64 rmax); +extern int64 pg_prng_int64(pg_prng_state *state); +extern int64 pg_prng_int64p(pg_prng_state *state); +extern int64 pg_prng_int64_range(pg_prng_state *state, int64 rmin, int64 rmax); +extern uint32 pg_prng_uint32(pg_prng_state *state); +extern int32 pg_prng_int32(pg_prng_state *state); +extern int32 pg_prng_int32p(pg_prng_state *state); +extern double pg_prng_double(pg_prng_state *state); +extern double pg_prng_double_normal(pg_prng_state *state); +extern bool pg_prng_bool(pg_prng_state *state); + +#endif /* PG_PRNG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/relpath.h b/platform/dbops/binaries/postgres/include/server/common/relpath.h new file mode 100644 index 0000000000000000000000000000000000000000..6f006d5a938c504de8336999c8a2fc897c7c3feb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/relpath.h @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * + * relpath.h + * Declarations for GetRelationPath() and friends + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/relpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELPATH_H +#define RELPATH_H + +/* + * 'pgrminclude ignore' needed here because CppAsString2() does not throw + * an error if the symbol is not defined. + */ +#include "catalog/catversion.h" /* pgrminclude ignore */ + +/* + * RelFileNumber data type identifies the specific relation file name. + */ +typedef Oid RelFileNumber; +#define InvalidRelFileNumber ((RelFileNumber) InvalidOid) +#define RelFileNumberIsValid(relnumber) \ + ((bool) ((relnumber) != InvalidRelFileNumber)) + +/* + * Name of major-version-specific tablespace subdirectories + */ +#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \ + CppAsString2(CATALOG_VERSION_NO) + +/* Characters to allow for an OID in a relation path */ +#define OIDCHARS 10 /* max chars printed by %u */ + +/* + * Stuff for fork names. + * + * The physical storage of a relation consists of one or more forks. + * The main fork is always created, but in addition to that there can be + * additional forks for storing various metadata. ForkNumber is used when + * we need to refer to a specific fork in a relation. + */ +typedef enum ForkNumber +{ + InvalidForkNumber = -1, + MAIN_FORKNUM = 0, + FSM_FORKNUM, + VISIBILITYMAP_FORKNUM, + INIT_FORKNUM, + + /* + * NOTE: if you add a new fork, change MAX_FORKNUM and possibly + * FORKNAMECHARS below, and update the forkNames array in + * src/common/relpath.c + */ +} ForkNumber; + +#define MAX_FORKNUM INIT_FORKNUM + +#define FORKNAMECHARS 4 /* max chars for a fork name */ + +extern PGDLLIMPORT const char *const forkNames[]; + +extern ForkNumber forkname_to_number(const char *forkName); +extern int forkname_chars(const char *str, ForkNumber *fork); + +/* + * Stuff for computing filesystem pathnames for relations. + */ +extern char *GetDatabasePath(Oid dbOid, Oid spcOid); + +extern char *GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber, + int procNumber, ForkNumber forkNumber); + +/* + * Wrapper macros for GetRelationPath. Beware of multiple + * evaluation of the RelFileLocator or RelFileLocatorBackend argument! + */ + +/* First argument is a RelFileLocator */ +#define relpathbackend(rlocator, backend, forknum) \ + GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \ + backend, forknum) + +/* First argument is a RelFileLocator */ +#define relpathperm(rlocator, forknum) \ + relpathbackend(rlocator, INVALID_PROC_NUMBER, forknum) + +/* First argument is a RelFileLocatorBackend */ +#define relpath(rlocator, forknum) \ + relpathbackend((rlocator).locator, (rlocator).backend, forknum) + +#endif /* RELPATH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/restricted_token.h b/platform/dbops/binaries/postgres/include/server/common/restricted_token.h new file mode 100644 index 0000000000000000000000000000000000000000..aa83eb2cd0f070efe2581728254eba28cf080564 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/restricted_token.h @@ -0,0 +1,24 @@ +/* + * restricted_token.h + * helper routine to ensure restricted token on Windows + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/restricted_token.h + */ +#ifndef COMMON_RESTRICTED_TOKEN_H +#define COMMON_RESTRICTED_TOKEN_H + +/* + * On Windows make sure that we are running with a restricted token, + * On other platforms do nothing. + */ +void get_restricted_token(void); + +#ifdef WIN32 +/* Create a restricted token and execute the specified process with it. */ +HANDLE CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo); +#endif + +#endif /* COMMON_RESTRICTED_TOKEN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/saslprep.h b/platform/dbops/binaries/postgres/include/server/common/saslprep.h new file mode 100644 index 0000000000000000000000000000000000000000..aaf3e8e12cb14a8c5e11f97c87cd2203a4fdfa72 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/saslprep.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * saslprep.h + * SASLprep normalization, for SCRAM authentication + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/saslprep.h + * + *------------------------------------------------------------------------- + */ +#ifndef SASLPREP_H +#define SASLPREP_H + +/* + * Return codes for pg_saslprep() function. + */ +typedef enum +{ + SASLPREP_SUCCESS = 0, + SASLPREP_OOM = -1, /* out of memory (only in frontend) */ + SASLPREP_INVALID_UTF8 = -2, /* input is not a valid UTF-8 string */ + SASLPREP_PROHIBITED = -3, /* output would contain prohibited characters */ +} pg_saslprep_rc; + +extern pg_saslprep_rc pg_saslprep(const char *input, char **output); + +#endif /* SASLPREP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/scram-common.h b/platform/dbops/binaries/postgres/include/server/common/scram-common.h new file mode 100644 index 0000000000000000000000000000000000000000..ce848aa328df9fc797cb844e7de350d843662819 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/scram-common.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * scram-common.h + * Declarations for helper functions used for SCRAM authentication + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/scram-common.h + * + *------------------------------------------------------------------------- + */ +#ifndef SCRAM_COMMON_H +#define SCRAM_COMMON_H + +#include "common/cryptohash.h" +#include "common/sha2.h" + +/* Name of SCRAM mechanisms per IANA */ +#define SCRAM_SHA_256_NAME "SCRAM-SHA-256" +#define SCRAM_SHA_256_PLUS_NAME "SCRAM-SHA-256-PLUS" /* with channel binding */ + +/* Length of SCRAM keys (client and server) */ +#define SCRAM_SHA_256_KEY_LEN PG_SHA256_DIGEST_LENGTH + +/* + * Size of buffers used internally by SCRAM routines, that should be the + * maximum of SCRAM_SHA_*_KEY_LEN among the hash methods supported. + */ +#define SCRAM_MAX_KEY_LEN SCRAM_SHA_256_KEY_LEN + +/* + * Size of random nonce generated in the authentication exchange. This + * is in "raw" number of bytes, the actual nonces sent over the wire are + * encoded using only ASCII-printable characters. + */ +#define SCRAM_RAW_NONCE_LEN 18 + +/* + * Length of salt when generating new secrets, in bytes. (It will be stored + * and sent over the wire encoded in Base64.) 16 bytes is what the example in + * RFC 7677 uses. + */ +#define SCRAM_DEFAULT_SALT_LEN 16 + +/* + * Default number of iterations when generating secret. Should be at least + * 4096 per RFC 7677. + */ +#define SCRAM_SHA_256_DEFAULT_ITERATIONS 4096 + +extern int scram_SaltedPassword(const char *password, + pg_cryptohash_type hash_type, int key_length, + const char *salt, int saltlen, int iterations, + uint8 *result, const char **errstr); +extern int scram_H(const uint8 *input, pg_cryptohash_type hash_type, + int key_length, uint8 *result, + const char **errstr); +extern int scram_ClientKey(const uint8 *salted_password, + pg_cryptohash_type hash_type, int key_length, + uint8 *result, const char **errstr); +extern int scram_ServerKey(const uint8 *salted_password, + pg_cryptohash_type hash_type, int key_length, + uint8 *result, const char **errstr); + +extern char *scram_build_secret(pg_cryptohash_type hash_type, int key_length, + const char *salt, int saltlen, int iterations, + const char *password, const char **errstr); + +#endif /* SCRAM_COMMON_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/sha1.h b/platform/dbops/binaries/postgres/include/server/common/sha1.h new file mode 100644 index 0000000000000000000000000000000000000000..b66d9ae033c2c34656c0b413660d693920508d04 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/sha1.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * sha1.h + * Constants related to SHA1. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/sha1.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHA1_H +#define PG_SHA1_H + +/* Size of result generated by SHA1 computation */ +#define SHA1_DIGEST_LENGTH 20 +/* Block size for SHA1 */ +#define SHA1_BLOCK_SIZE 64 + +#endif /* PG_SHA1_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/sha2.h b/platform/dbops/binaries/postgres/include/server/common/sha2.h new file mode 100644 index 0000000000000000000000000000000000000000..ea040c579f32b29e97d5d1913b34680d926d16da --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/sha2.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * sha2.h + * Constants related to SHA224, 256, 384 AND 512. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/common/sha2.h + * + *------------------------------------------------------------------------- + */ + +#ifndef _PG_SHA2_H_ +#define _PG_SHA2_H_ + +/*** SHA224/256/384/512 Various Length Definitions ***********************/ +#define PG_SHA224_BLOCK_LENGTH 64 +#define PG_SHA224_DIGEST_LENGTH 28 +#define PG_SHA224_DIGEST_STRING_LENGTH (PG_SHA224_DIGEST_LENGTH * 2 + 1) +#define PG_SHA256_BLOCK_LENGTH 64 +#define PG_SHA256_DIGEST_LENGTH 32 +#define PG_SHA256_DIGEST_STRING_LENGTH (PG_SHA256_DIGEST_LENGTH * 2 + 1) +#define PG_SHA384_BLOCK_LENGTH 128 +#define PG_SHA384_DIGEST_LENGTH 48 +#define PG_SHA384_DIGEST_STRING_LENGTH (PG_SHA384_DIGEST_LENGTH * 2 + 1) +#define PG_SHA512_BLOCK_LENGTH 128 +#define PG_SHA512_DIGEST_LENGTH 64 +#define PG_SHA512_DIGEST_STRING_LENGTH (PG_SHA512_DIGEST_LENGTH * 2 + 1) + +#endif /* _PG_SHA2_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/common/shortest_dec.h b/platform/dbops/binaries/postgres/include/server/common/shortest_dec.h new file mode 100644 index 0000000000000000000000000000000000000000..d780b23eedf96802fb950ffadead70f800865f3a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/shortest_dec.h @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------- + * + * Ryu floating-point output. + * + * Portions Copyright (c) 2018-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/common/shortest_dec.h + * + * This is a modification of code taken from github.com/ulfjack/ryu under the + * terms of the Boost license (not the Apache license). The original copyright + * notice follows: + * + * Copyright 2018 Ulf Adams + * + * The contents of this file may be used under the terms of the Apache + * License, Version 2.0. + * + * (See accompanying file LICENSE-Apache or copy at + * http://www.apache.org/licenses/LICENSE-2.0) + * + * Alternatively, the contents of this file may be used under the terms of the + * Boost Software License, Version 1.0. + * + * (See accompanying file LICENSE-Boost or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Unless required by applicable law or agreed to in writing, this software is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. + * + *--------------------------------------------------------------------------- + */ +#ifndef SHORTEST_DEC_H +#define SHORTEST_DEC_H + +/*---- + * The length of 25 comes from: + * + * Case 1: -9.9999999999999999e-299 = 24 bytes, plus 1 for null + * + * Case 2: -0.00099999999999999999 = 23 bytes, plus 1 for null + */ +#define DOUBLE_SHORTEST_DECIMAL_LEN 25 + +int double_to_shortest_decimal_bufn(double f, char *result); +int double_to_shortest_decimal_buf(double f, char *result); +char *double_to_shortest_decimal(double f); + +/* + * The length of 16 comes from: + * + * Case 1: -9.99999999e+29 = 15 bytes, plus 1 for null + * + * Case 2: -0.000999999999 = 15 bytes, plus 1 for null + */ +#define FLOAT_SHORTEST_DECIMAL_LEN 16 + +int float_to_shortest_decimal_bufn(float f, char *result); +int float_to_shortest_decimal_buf(float f, char *result); +char *float_to_shortest_decimal(float f); + +#endif /* SHORTEST_DEC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/string.h b/platform/dbops/binaries/postgres/include/server/common/string.h new file mode 100644 index 0000000000000000000000000000000000000000..721aabe9dc1b68a4df4bbaa032af99a7094a592f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/string.h @@ -0,0 +1,44 @@ +/* + * string.h + * string handling helpers + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/string.h + */ +#ifndef COMMON_STRING_H +#define COMMON_STRING_H + +#include + +struct StringInfoData; /* avoid including stringinfo.h here */ + +typedef struct PromptInterruptContext +{ + /* To avoid including here, jmpbuf is declared "void *" */ + void *jmpbuf; /* existing longjmp buffer */ + volatile sig_atomic_t *enabled; /* flag that enables longjmp-on-interrupt */ + bool canceled; /* indicates whether cancellation occurred */ +} PromptInterruptContext; + +/* functions in src/common/string.c */ +extern bool pg_str_endswith(const char *str, const char *end); +extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr, + int base); +extern char *pg_clean_ascii(const char *str, int alloc_flags); +extern int pg_strip_crlf(char *str); +extern bool pg_is_ascii(const char *str); + +/* functions in src/common/pg_get_line.c */ +extern char *pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx); +extern bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf); +extern bool pg_get_line_append(FILE *stream, struct StringInfoData *buf, + PromptInterruptContext *prompt_ctx); + +/* functions in src/common/sprompt.c */ +extern char *simple_prompt(const char *prompt, bool echo); +extern char *simple_prompt_extended(const char *prompt, bool echo, + PromptInterruptContext *prompt_ctx); + +#endif /* COMMON_STRING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_case.h b/platform/dbops/binaries/postgres/include/server/common/unicode_case.h new file mode 100644 index 0000000000000000000000000000000000000000..5a65c12d45315d3791185a4cc80dfcb021e0131c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_case.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * unicode_case.h + * Routines for converting character case. + * + * These definitions can be used by both frontend and backend code. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/unicode_case.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_CASE_H +#define UNICODE_CASE_H + +#include "mb/pg_wchar.h" + +typedef size_t (*WordBoundaryNext) (void *wbstate); + +pg_wchar unicode_lowercase_simple(pg_wchar code); +pg_wchar unicode_titlecase_simple(pg_wchar code); +pg_wchar unicode_uppercase_simple(pg_wchar code); +size_t unicode_strlower(char *dst, size_t dstsize, const char *src, + ssize_t srclen); +size_t unicode_strtitle(char *dst, size_t dstsize, const char *src, + ssize_t srclen, WordBoundaryNext wbnext, + void *wbstate); +size_t unicode_strupper(char *dst, size_t dstsize, const char *src, + ssize_t srclen); + +#endif /* UNICODE_CASE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_case_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_case_table.h new file mode 100644 index 0000000000000000000000000000000000000000..eeda045839970fdafc0950c7a763e0c07ccbb212 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_case_table.h @@ -0,0 +1,3001 @@ +/*------------------------------------------------------------------------- + * + * unicode_case_table.h + * Case mapping and information table. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_case_table.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_case_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_CASE_TABLE_H + * here. + */ + +#include "common/unicode_case.h" +#include "mb/pg_wchar.h" + +typedef enum +{ + CaseLower = 0, + CaseTitle = 1, + CaseUpper = 2, + NCaseKind +} CaseKind; + +typedef struct +{ + pg_wchar codepoint; /* Unicode codepoint */ + pg_wchar simplemap[NCaseKind]; +} pg_case_map; + +/* + * Case mapping table. Dense for codepoints < 0x80 (enabling fast lookup), + * sparse for higher codepoints (requiring scan or binary search). + */ +static const pg_case_map case_map[2955] = +{ + /* begin dense entries for codepoints < 0x80 */ + {0x000000, {[CaseLower] = 0x000000,[CaseTitle] = 0x000000,[CaseUpper] = 0x000000}}, + {0x000001, {[CaseLower] = 0x000001,[CaseTitle] = 0x000001,[CaseUpper] = 0x000001}}, + {0x000002, {[CaseLower] = 0x000002,[CaseTitle] = 0x000002,[CaseUpper] = 0x000002}}, + {0x000003, {[CaseLower] = 0x000003,[CaseTitle] = 0x000003,[CaseUpper] = 0x000003}}, + {0x000004, {[CaseLower] = 0x000004,[CaseTitle] = 0x000004,[CaseUpper] = 0x000004}}, + {0x000005, {[CaseLower] = 0x000005,[CaseTitle] = 0x000005,[CaseUpper] = 0x000005}}, + {0x000006, {[CaseLower] = 0x000006,[CaseTitle] = 0x000006,[CaseUpper] = 0x000006}}, + {0x000007, {[CaseLower] = 0x000007,[CaseTitle] = 0x000007,[CaseUpper] = 0x000007}}, + {0x000008, {[CaseLower] = 0x000008,[CaseTitle] = 0x000008,[CaseUpper] = 0x000008}}, + {0x000009, {[CaseLower] = 0x000009,[CaseTitle] = 0x000009,[CaseUpper] = 0x000009}}, + {0x00000a, {[CaseLower] = 0x00000a,[CaseTitle] = 0x00000a,[CaseUpper] = 0x00000a}}, + {0x00000b, {[CaseLower] = 0x00000b,[CaseTitle] = 0x00000b,[CaseUpper] = 0x00000b}}, + {0x00000c, {[CaseLower] = 0x00000c,[CaseTitle] = 0x00000c,[CaseUpper] = 0x00000c}}, + {0x00000d, {[CaseLower] = 0x00000d,[CaseTitle] = 0x00000d,[CaseUpper] = 0x00000d}}, + {0x00000e, {[CaseLower] = 0x00000e,[CaseTitle] = 0x00000e,[CaseUpper] = 0x00000e}}, + {0x00000f, {[CaseLower] = 0x00000f,[CaseTitle] = 0x00000f,[CaseUpper] = 0x00000f}}, + {0x000010, {[CaseLower] = 0x000010,[CaseTitle] = 0x000010,[CaseUpper] = 0x000010}}, + {0x000011, {[CaseLower] = 0x000011,[CaseTitle] = 0x000011,[CaseUpper] = 0x000011}}, + {0x000012, {[CaseLower] = 0x000012,[CaseTitle] = 0x000012,[CaseUpper] = 0x000012}}, + {0x000013, {[CaseLower] = 0x000013,[CaseTitle] = 0x000013,[CaseUpper] = 0x000013}}, + {0x000014, {[CaseLower] = 0x000014,[CaseTitle] = 0x000014,[CaseUpper] = 0x000014}}, + {0x000015, {[CaseLower] = 0x000015,[CaseTitle] = 0x000015,[CaseUpper] = 0x000015}}, + {0x000016, {[CaseLower] = 0x000016,[CaseTitle] = 0x000016,[CaseUpper] = 0x000016}}, + {0x000017, {[CaseLower] = 0x000017,[CaseTitle] = 0x000017,[CaseUpper] = 0x000017}}, + {0x000018, {[CaseLower] = 0x000018,[CaseTitle] = 0x000018,[CaseUpper] = 0x000018}}, + {0x000019, {[CaseLower] = 0x000019,[CaseTitle] = 0x000019,[CaseUpper] = 0x000019}}, + {0x00001a, {[CaseLower] = 0x00001a,[CaseTitle] = 0x00001a,[CaseUpper] = 0x00001a}}, + {0x00001b, {[CaseLower] = 0x00001b,[CaseTitle] = 0x00001b,[CaseUpper] = 0x00001b}}, + {0x00001c, {[CaseLower] = 0x00001c,[CaseTitle] = 0x00001c,[CaseUpper] = 0x00001c}}, + {0x00001d, {[CaseLower] = 0x00001d,[CaseTitle] = 0x00001d,[CaseUpper] = 0x00001d}}, + {0x00001e, {[CaseLower] = 0x00001e,[CaseTitle] = 0x00001e,[CaseUpper] = 0x00001e}}, + {0x00001f, {[CaseLower] = 0x00001f,[CaseTitle] = 0x00001f,[CaseUpper] = 0x00001f}}, + {0x000020, {[CaseLower] = 0x000020,[CaseTitle] = 0x000020,[CaseUpper] = 0x000020}}, + {0x000021, {[CaseLower] = 0x000021,[CaseTitle] = 0x000021,[CaseUpper] = 0x000021}}, + {0x000022, {[CaseLower] = 0x000022,[CaseTitle] = 0x000022,[CaseUpper] = 0x000022}}, + {0x000023, {[CaseLower] = 0x000023,[CaseTitle] = 0x000023,[CaseUpper] = 0x000023}}, + {0x000024, {[CaseLower] = 0x000024,[CaseTitle] = 0x000024,[CaseUpper] = 0x000024}}, + {0x000025, {[CaseLower] = 0x000025,[CaseTitle] = 0x000025,[CaseUpper] = 0x000025}}, + {0x000026, {[CaseLower] = 0x000026,[CaseTitle] = 0x000026,[CaseUpper] = 0x000026}}, + {0x000027, {[CaseLower] = 0x000027,[CaseTitle] = 0x000027,[CaseUpper] = 0x000027}}, + {0x000028, {[CaseLower] = 0x000028,[CaseTitle] = 0x000028,[CaseUpper] = 0x000028}}, + {0x000029, {[CaseLower] = 0x000029,[CaseTitle] = 0x000029,[CaseUpper] = 0x000029}}, + {0x00002a, {[CaseLower] = 0x00002a,[CaseTitle] = 0x00002a,[CaseUpper] = 0x00002a}}, + {0x00002b, {[CaseLower] = 0x00002b,[CaseTitle] = 0x00002b,[CaseUpper] = 0x00002b}}, + {0x00002c, {[CaseLower] = 0x00002c,[CaseTitle] = 0x00002c,[CaseUpper] = 0x00002c}}, + {0x00002d, {[CaseLower] = 0x00002d,[CaseTitle] = 0x00002d,[CaseUpper] = 0x00002d}}, + {0x00002e, {[CaseLower] = 0x00002e,[CaseTitle] = 0x00002e,[CaseUpper] = 0x00002e}}, + {0x00002f, {[CaseLower] = 0x00002f,[CaseTitle] = 0x00002f,[CaseUpper] = 0x00002f}}, + {0x000030, {[CaseLower] = 0x000030,[CaseTitle] = 0x000030,[CaseUpper] = 0x000030}}, + {0x000031, {[CaseLower] = 0x000031,[CaseTitle] = 0x000031,[CaseUpper] = 0x000031}}, + {0x000032, {[CaseLower] = 0x000032,[CaseTitle] = 0x000032,[CaseUpper] = 0x000032}}, + {0x000033, {[CaseLower] = 0x000033,[CaseTitle] = 0x000033,[CaseUpper] = 0x000033}}, + {0x000034, {[CaseLower] = 0x000034,[CaseTitle] = 0x000034,[CaseUpper] = 0x000034}}, + {0x000035, {[CaseLower] = 0x000035,[CaseTitle] = 0x000035,[CaseUpper] = 0x000035}}, + {0x000036, {[CaseLower] = 0x000036,[CaseTitle] = 0x000036,[CaseUpper] = 0x000036}}, + {0x000037, {[CaseLower] = 0x000037,[CaseTitle] = 0x000037,[CaseUpper] = 0x000037}}, + {0x000038, {[CaseLower] = 0x000038,[CaseTitle] = 0x000038,[CaseUpper] = 0x000038}}, + {0x000039, {[CaseLower] = 0x000039,[CaseTitle] = 0x000039,[CaseUpper] = 0x000039}}, + {0x00003a, {[CaseLower] = 0x00003a,[CaseTitle] = 0x00003a,[CaseUpper] = 0x00003a}}, + {0x00003b, {[CaseLower] = 0x00003b,[CaseTitle] = 0x00003b,[CaseUpper] = 0x00003b}}, + {0x00003c, {[CaseLower] = 0x00003c,[CaseTitle] = 0x00003c,[CaseUpper] = 0x00003c}}, + {0x00003d, {[CaseLower] = 0x00003d,[CaseTitle] = 0x00003d,[CaseUpper] = 0x00003d}}, + {0x00003e, {[CaseLower] = 0x00003e,[CaseTitle] = 0x00003e,[CaseUpper] = 0x00003e}}, + {0x00003f, {[CaseLower] = 0x00003f,[CaseTitle] = 0x00003f,[CaseUpper] = 0x00003f}}, + {0x000040, {[CaseLower] = 0x000040,[CaseTitle] = 0x000040,[CaseUpper] = 0x000040}}, + {0x000041, {[CaseLower] = 0x000061,[CaseTitle] = 0x000041,[CaseUpper] = 0x000041}}, + {0x000042, {[CaseLower] = 0x000062,[CaseTitle] = 0x000042,[CaseUpper] = 0x000042}}, + {0x000043, {[CaseLower] = 0x000063,[CaseTitle] = 0x000043,[CaseUpper] = 0x000043}}, + {0x000044, {[CaseLower] = 0x000064,[CaseTitle] = 0x000044,[CaseUpper] = 0x000044}}, + {0x000045, {[CaseLower] = 0x000065,[CaseTitle] = 0x000045,[CaseUpper] = 0x000045}}, + {0x000046, {[CaseLower] = 0x000066,[CaseTitle] = 0x000046,[CaseUpper] = 0x000046}}, + {0x000047, {[CaseLower] = 0x000067,[CaseTitle] = 0x000047,[CaseUpper] = 0x000047}}, + {0x000048, {[CaseLower] = 0x000068,[CaseTitle] = 0x000048,[CaseUpper] = 0x000048}}, + {0x000049, {[CaseLower] = 0x000069,[CaseTitle] = 0x000049,[CaseUpper] = 0x000049}}, + {0x00004a, {[CaseLower] = 0x00006a,[CaseTitle] = 0x00004a,[CaseUpper] = 0x00004a}}, + {0x00004b, {[CaseLower] = 0x00006b,[CaseTitle] = 0x00004b,[CaseUpper] = 0x00004b}}, + {0x00004c, {[CaseLower] = 0x00006c,[CaseTitle] = 0x00004c,[CaseUpper] = 0x00004c}}, + {0x00004d, {[CaseLower] = 0x00006d,[CaseTitle] = 0x00004d,[CaseUpper] = 0x00004d}}, + {0x00004e, {[CaseLower] = 0x00006e,[CaseTitle] = 0x00004e,[CaseUpper] = 0x00004e}}, + {0x00004f, {[CaseLower] = 0x00006f,[CaseTitle] = 0x00004f,[CaseUpper] = 0x00004f}}, + {0x000050, {[CaseLower] = 0x000070,[CaseTitle] = 0x000050,[CaseUpper] = 0x000050}}, + {0x000051, {[CaseLower] = 0x000071,[CaseTitle] = 0x000051,[CaseUpper] = 0x000051}}, + {0x000052, {[CaseLower] = 0x000072,[CaseTitle] = 0x000052,[CaseUpper] = 0x000052}}, + {0x000053, {[CaseLower] = 0x000073,[CaseTitle] = 0x000053,[CaseUpper] = 0x000053}}, + {0x000054, {[CaseLower] = 0x000074,[CaseTitle] = 0x000054,[CaseUpper] = 0x000054}}, + {0x000055, {[CaseLower] = 0x000075,[CaseTitle] = 0x000055,[CaseUpper] = 0x000055}}, + {0x000056, {[CaseLower] = 0x000076,[CaseTitle] = 0x000056,[CaseUpper] = 0x000056}}, + {0x000057, {[CaseLower] = 0x000077,[CaseTitle] = 0x000057,[CaseUpper] = 0x000057}}, + {0x000058, {[CaseLower] = 0x000078,[CaseTitle] = 0x000058,[CaseUpper] = 0x000058}}, + {0x000059, {[CaseLower] = 0x000079,[CaseTitle] = 0x000059,[CaseUpper] = 0x000059}}, + {0x00005a, {[CaseLower] = 0x00007a,[CaseTitle] = 0x00005a,[CaseUpper] = 0x00005a}}, + {0x00005b, {[CaseLower] = 0x00005b,[CaseTitle] = 0x00005b,[CaseUpper] = 0x00005b}}, + {0x00005c, {[CaseLower] = 0x00005c,[CaseTitle] = 0x00005c,[CaseUpper] = 0x00005c}}, + {0x00005d, {[CaseLower] = 0x00005d,[CaseTitle] = 0x00005d,[CaseUpper] = 0x00005d}}, + {0x00005e, {[CaseLower] = 0x00005e,[CaseTitle] = 0x00005e,[CaseUpper] = 0x00005e}}, + {0x00005f, {[CaseLower] = 0x00005f,[CaseTitle] = 0x00005f,[CaseUpper] = 0x00005f}}, + {0x000060, {[CaseLower] = 0x000060,[CaseTitle] = 0x000060,[CaseUpper] = 0x000060}}, + {0x000061, {[CaseLower] = 0x000061,[CaseTitle] = 0x000041,[CaseUpper] = 0x000041}}, + {0x000062, {[CaseLower] = 0x000062,[CaseTitle] = 0x000042,[CaseUpper] = 0x000042}}, + {0x000063, {[CaseLower] = 0x000063,[CaseTitle] = 0x000043,[CaseUpper] = 0x000043}}, + {0x000064, {[CaseLower] = 0x000064,[CaseTitle] = 0x000044,[CaseUpper] = 0x000044}}, + {0x000065, {[CaseLower] = 0x000065,[CaseTitle] = 0x000045,[CaseUpper] = 0x000045}}, + {0x000066, {[CaseLower] = 0x000066,[CaseTitle] = 0x000046,[CaseUpper] = 0x000046}}, + {0x000067, {[CaseLower] = 0x000067,[CaseTitle] = 0x000047,[CaseUpper] = 0x000047}}, + {0x000068, {[CaseLower] = 0x000068,[CaseTitle] = 0x000048,[CaseUpper] = 0x000048}}, + {0x000069, {[CaseLower] = 0x000069,[CaseTitle] = 0x000049,[CaseUpper] = 0x000049}}, + {0x00006a, {[CaseLower] = 0x00006a,[CaseTitle] = 0x00004a,[CaseUpper] = 0x00004a}}, + {0x00006b, {[CaseLower] = 0x00006b,[CaseTitle] = 0x00004b,[CaseUpper] = 0x00004b}}, + {0x00006c, {[CaseLower] = 0x00006c,[CaseTitle] = 0x00004c,[CaseUpper] = 0x00004c}}, + {0x00006d, {[CaseLower] = 0x00006d,[CaseTitle] = 0x00004d,[CaseUpper] = 0x00004d}}, + {0x00006e, {[CaseLower] = 0x00006e,[CaseTitle] = 0x00004e,[CaseUpper] = 0x00004e}}, + {0x00006f, {[CaseLower] = 0x00006f,[CaseTitle] = 0x00004f,[CaseUpper] = 0x00004f}}, + {0x000070, {[CaseLower] = 0x000070,[CaseTitle] = 0x000050,[CaseUpper] = 0x000050}}, + {0x000071, {[CaseLower] = 0x000071,[CaseTitle] = 0x000051,[CaseUpper] = 0x000051}}, + {0x000072, {[CaseLower] = 0x000072,[CaseTitle] = 0x000052,[CaseUpper] = 0x000052}}, + {0x000073, {[CaseLower] = 0x000073,[CaseTitle] = 0x000053,[CaseUpper] = 0x000053}}, + {0x000074, {[CaseLower] = 0x000074,[CaseTitle] = 0x000054,[CaseUpper] = 0x000054}}, + {0x000075, {[CaseLower] = 0x000075,[CaseTitle] = 0x000055,[CaseUpper] = 0x000055}}, + {0x000076, {[CaseLower] = 0x000076,[CaseTitle] = 0x000056,[CaseUpper] = 0x000056}}, + {0x000077, {[CaseLower] = 0x000077,[CaseTitle] = 0x000057,[CaseUpper] = 0x000057}}, + {0x000078, {[CaseLower] = 0x000078,[CaseTitle] = 0x000058,[CaseUpper] = 0x000058}}, + {0x000079, {[CaseLower] = 0x000079,[CaseTitle] = 0x000059,[CaseUpper] = 0x000059}}, + {0x00007a, {[CaseLower] = 0x00007a,[CaseTitle] = 0x00005a,[CaseUpper] = 0x00005a}}, + {0x00007b, {[CaseLower] = 0x00007b,[CaseTitle] = 0x00007b,[CaseUpper] = 0x00007b}}, + {0x00007c, {[CaseLower] = 0x00007c,[CaseTitle] = 0x00007c,[CaseUpper] = 0x00007c}}, + {0x00007d, {[CaseLower] = 0x00007d,[CaseTitle] = 0x00007d,[CaseUpper] = 0x00007d}}, + {0x00007e, {[CaseLower] = 0x00007e,[CaseTitle] = 0x00007e,[CaseUpper] = 0x00007e}}, + {0x00007f, {[CaseLower] = 0x00007f,[CaseTitle] = 0x00007f,[CaseUpper] = 0x00007f}}, + + /* begin sparse entries for codepoints >= 0x80 */ + {0x0000b5, {[CaseLower] = 0x0000b5,[CaseTitle] = 0x00039c,[CaseUpper] = 0x00039c}}, + {0x0000c0, {[CaseLower] = 0x0000e0,[CaseTitle] = 0x0000c0,[CaseUpper] = 0x0000c0}}, + {0x0000c1, {[CaseLower] = 0x0000e1,[CaseTitle] = 0x0000c1,[CaseUpper] = 0x0000c1}}, + {0x0000c2, {[CaseLower] = 0x0000e2,[CaseTitle] = 0x0000c2,[CaseUpper] = 0x0000c2}}, + {0x0000c3, {[CaseLower] = 0x0000e3,[CaseTitle] = 0x0000c3,[CaseUpper] = 0x0000c3}}, + {0x0000c4, {[CaseLower] = 0x0000e4,[CaseTitle] = 0x0000c4,[CaseUpper] = 0x0000c4}}, + {0x0000c5, {[CaseLower] = 0x0000e5,[CaseTitle] = 0x0000c5,[CaseUpper] = 0x0000c5}}, + {0x0000c6, {[CaseLower] = 0x0000e6,[CaseTitle] = 0x0000c6,[CaseUpper] = 0x0000c6}}, + {0x0000c7, {[CaseLower] = 0x0000e7,[CaseTitle] = 0x0000c7,[CaseUpper] = 0x0000c7}}, + {0x0000c8, {[CaseLower] = 0x0000e8,[CaseTitle] = 0x0000c8,[CaseUpper] = 0x0000c8}}, + {0x0000c9, {[CaseLower] = 0x0000e9,[CaseTitle] = 0x0000c9,[CaseUpper] = 0x0000c9}}, + {0x0000ca, {[CaseLower] = 0x0000ea,[CaseTitle] = 0x0000ca,[CaseUpper] = 0x0000ca}}, + {0x0000cb, {[CaseLower] = 0x0000eb,[CaseTitle] = 0x0000cb,[CaseUpper] = 0x0000cb}}, + {0x0000cc, {[CaseLower] = 0x0000ec,[CaseTitle] = 0x0000cc,[CaseUpper] = 0x0000cc}}, + {0x0000cd, {[CaseLower] = 0x0000ed,[CaseTitle] = 0x0000cd,[CaseUpper] = 0x0000cd}}, + {0x0000ce, {[CaseLower] = 0x0000ee,[CaseTitle] = 0x0000ce,[CaseUpper] = 0x0000ce}}, + {0x0000cf, {[CaseLower] = 0x0000ef,[CaseTitle] = 0x0000cf,[CaseUpper] = 0x0000cf}}, + {0x0000d0, {[CaseLower] = 0x0000f0,[CaseTitle] = 0x0000d0,[CaseUpper] = 0x0000d0}}, + {0x0000d1, {[CaseLower] = 0x0000f1,[CaseTitle] = 0x0000d1,[CaseUpper] = 0x0000d1}}, + {0x0000d2, {[CaseLower] = 0x0000f2,[CaseTitle] = 0x0000d2,[CaseUpper] = 0x0000d2}}, + {0x0000d3, {[CaseLower] = 0x0000f3,[CaseTitle] = 0x0000d3,[CaseUpper] = 0x0000d3}}, + {0x0000d4, {[CaseLower] = 0x0000f4,[CaseTitle] = 0x0000d4,[CaseUpper] = 0x0000d4}}, + {0x0000d5, {[CaseLower] = 0x0000f5,[CaseTitle] = 0x0000d5,[CaseUpper] = 0x0000d5}}, + {0x0000d6, {[CaseLower] = 0x0000f6,[CaseTitle] = 0x0000d6,[CaseUpper] = 0x0000d6}}, + {0x0000d8, {[CaseLower] = 0x0000f8,[CaseTitle] = 0x0000d8,[CaseUpper] = 0x0000d8}}, + {0x0000d9, {[CaseLower] = 0x0000f9,[CaseTitle] = 0x0000d9,[CaseUpper] = 0x0000d9}}, + {0x0000da, {[CaseLower] = 0x0000fa,[CaseTitle] = 0x0000da,[CaseUpper] = 0x0000da}}, + {0x0000db, {[CaseLower] = 0x0000fb,[CaseTitle] = 0x0000db,[CaseUpper] = 0x0000db}}, + {0x0000dc, {[CaseLower] = 0x0000fc,[CaseTitle] = 0x0000dc,[CaseUpper] = 0x0000dc}}, + {0x0000dd, {[CaseLower] = 0x0000fd,[CaseTitle] = 0x0000dd,[CaseUpper] = 0x0000dd}}, + {0x0000de, {[CaseLower] = 0x0000fe,[CaseTitle] = 0x0000de,[CaseUpper] = 0x0000de}}, + {0x0000e0, {[CaseLower] = 0x0000e0,[CaseTitle] = 0x0000c0,[CaseUpper] = 0x0000c0}}, + {0x0000e1, {[CaseLower] = 0x0000e1,[CaseTitle] = 0x0000c1,[CaseUpper] = 0x0000c1}}, + {0x0000e2, {[CaseLower] = 0x0000e2,[CaseTitle] = 0x0000c2,[CaseUpper] = 0x0000c2}}, + {0x0000e3, {[CaseLower] = 0x0000e3,[CaseTitle] = 0x0000c3,[CaseUpper] = 0x0000c3}}, + {0x0000e4, {[CaseLower] = 0x0000e4,[CaseTitle] = 0x0000c4,[CaseUpper] = 0x0000c4}}, + {0x0000e5, {[CaseLower] = 0x0000e5,[CaseTitle] = 0x0000c5,[CaseUpper] = 0x0000c5}}, + {0x0000e6, {[CaseLower] = 0x0000e6,[CaseTitle] = 0x0000c6,[CaseUpper] = 0x0000c6}}, + {0x0000e7, {[CaseLower] = 0x0000e7,[CaseTitle] = 0x0000c7,[CaseUpper] = 0x0000c7}}, + {0x0000e8, {[CaseLower] = 0x0000e8,[CaseTitle] = 0x0000c8,[CaseUpper] = 0x0000c8}}, + {0x0000e9, {[CaseLower] = 0x0000e9,[CaseTitle] = 0x0000c9,[CaseUpper] = 0x0000c9}}, + {0x0000ea, {[CaseLower] = 0x0000ea,[CaseTitle] = 0x0000ca,[CaseUpper] = 0x0000ca}}, + {0x0000eb, {[CaseLower] = 0x0000eb,[CaseTitle] = 0x0000cb,[CaseUpper] = 0x0000cb}}, + {0x0000ec, {[CaseLower] = 0x0000ec,[CaseTitle] = 0x0000cc,[CaseUpper] = 0x0000cc}}, + {0x0000ed, {[CaseLower] = 0x0000ed,[CaseTitle] = 0x0000cd,[CaseUpper] = 0x0000cd}}, + {0x0000ee, {[CaseLower] = 0x0000ee,[CaseTitle] = 0x0000ce,[CaseUpper] = 0x0000ce}}, + {0x0000ef, {[CaseLower] = 0x0000ef,[CaseTitle] = 0x0000cf,[CaseUpper] = 0x0000cf}}, + {0x0000f0, {[CaseLower] = 0x0000f0,[CaseTitle] = 0x0000d0,[CaseUpper] = 0x0000d0}}, + {0x0000f1, {[CaseLower] = 0x0000f1,[CaseTitle] = 0x0000d1,[CaseUpper] = 0x0000d1}}, + {0x0000f2, {[CaseLower] = 0x0000f2,[CaseTitle] = 0x0000d2,[CaseUpper] = 0x0000d2}}, + {0x0000f3, {[CaseLower] = 0x0000f3,[CaseTitle] = 0x0000d3,[CaseUpper] = 0x0000d3}}, + {0x0000f4, {[CaseLower] = 0x0000f4,[CaseTitle] = 0x0000d4,[CaseUpper] = 0x0000d4}}, + {0x0000f5, {[CaseLower] = 0x0000f5,[CaseTitle] = 0x0000d5,[CaseUpper] = 0x0000d5}}, + {0x0000f6, {[CaseLower] = 0x0000f6,[CaseTitle] = 0x0000d6,[CaseUpper] = 0x0000d6}}, + {0x0000f8, {[CaseLower] = 0x0000f8,[CaseTitle] = 0x0000d8,[CaseUpper] = 0x0000d8}}, + {0x0000f9, {[CaseLower] = 0x0000f9,[CaseTitle] = 0x0000d9,[CaseUpper] = 0x0000d9}}, + {0x0000fa, {[CaseLower] = 0x0000fa,[CaseTitle] = 0x0000da,[CaseUpper] = 0x0000da}}, + {0x0000fb, {[CaseLower] = 0x0000fb,[CaseTitle] = 0x0000db,[CaseUpper] = 0x0000db}}, + {0x0000fc, {[CaseLower] = 0x0000fc,[CaseTitle] = 0x0000dc,[CaseUpper] = 0x0000dc}}, + {0x0000fd, {[CaseLower] = 0x0000fd,[CaseTitle] = 0x0000dd,[CaseUpper] = 0x0000dd}}, + {0x0000fe, {[CaseLower] = 0x0000fe,[CaseTitle] = 0x0000de,[CaseUpper] = 0x0000de}}, + {0x0000ff, {[CaseLower] = 0x0000ff,[CaseTitle] = 0x000178,[CaseUpper] = 0x000178}}, + {0x000100, {[CaseLower] = 0x000101,[CaseTitle] = 0x000100,[CaseUpper] = 0x000100}}, + {0x000101, {[CaseLower] = 0x000101,[CaseTitle] = 0x000100,[CaseUpper] = 0x000100}}, + {0x000102, {[CaseLower] = 0x000103,[CaseTitle] = 0x000102,[CaseUpper] = 0x000102}}, + {0x000103, {[CaseLower] = 0x000103,[CaseTitle] = 0x000102,[CaseUpper] = 0x000102}}, + {0x000104, {[CaseLower] = 0x000105,[CaseTitle] = 0x000104,[CaseUpper] = 0x000104}}, + {0x000105, {[CaseLower] = 0x000105,[CaseTitle] = 0x000104,[CaseUpper] = 0x000104}}, + {0x000106, {[CaseLower] = 0x000107,[CaseTitle] = 0x000106,[CaseUpper] = 0x000106}}, + {0x000107, {[CaseLower] = 0x000107,[CaseTitle] = 0x000106,[CaseUpper] = 0x000106}}, + {0x000108, {[CaseLower] = 0x000109,[CaseTitle] = 0x000108,[CaseUpper] = 0x000108}}, + {0x000109, {[CaseLower] = 0x000109,[CaseTitle] = 0x000108,[CaseUpper] = 0x000108}}, + {0x00010a, {[CaseLower] = 0x00010b,[CaseTitle] = 0x00010a,[CaseUpper] = 0x00010a}}, + {0x00010b, {[CaseLower] = 0x00010b,[CaseTitle] = 0x00010a,[CaseUpper] = 0x00010a}}, + {0x00010c, {[CaseLower] = 0x00010d,[CaseTitle] = 0x00010c,[CaseUpper] = 0x00010c}}, + {0x00010d, {[CaseLower] = 0x00010d,[CaseTitle] = 0x00010c,[CaseUpper] = 0x00010c}}, + {0x00010e, {[CaseLower] = 0x00010f,[CaseTitle] = 0x00010e,[CaseUpper] = 0x00010e}}, + {0x00010f, {[CaseLower] = 0x00010f,[CaseTitle] = 0x00010e,[CaseUpper] = 0x00010e}}, + {0x000110, {[CaseLower] = 0x000111,[CaseTitle] = 0x000110,[CaseUpper] = 0x000110}}, + {0x000111, {[CaseLower] = 0x000111,[CaseTitle] = 0x000110,[CaseUpper] = 0x000110}}, + {0x000112, {[CaseLower] = 0x000113,[CaseTitle] = 0x000112,[CaseUpper] = 0x000112}}, + {0x000113, {[CaseLower] = 0x000113,[CaseTitle] = 0x000112,[CaseUpper] = 0x000112}}, + {0x000114, {[CaseLower] = 0x000115,[CaseTitle] = 0x000114,[CaseUpper] = 0x000114}}, + {0x000115, {[CaseLower] = 0x000115,[CaseTitle] = 0x000114,[CaseUpper] = 0x000114}}, + {0x000116, {[CaseLower] = 0x000117,[CaseTitle] = 0x000116,[CaseUpper] = 0x000116}}, + {0x000117, {[CaseLower] = 0x000117,[CaseTitle] = 0x000116,[CaseUpper] = 0x000116}}, + {0x000118, {[CaseLower] = 0x000119,[CaseTitle] = 0x000118,[CaseUpper] = 0x000118}}, + {0x000119, {[CaseLower] = 0x000119,[CaseTitle] = 0x000118,[CaseUpper] = 0x000118}}, + {0x00011a, {[CaseLower] = 0x00011b,[CaseTitle] = 0x00011a,[CaseUpper] = 0x00011a}}, + {0x00011b, {[CaseLower] = 0x00011b,[CaseTitle] = 0x00011a,[CaseUpper] = 0x00011a}}, + {0x00011c, {[CaseLower] = 0x00011d,[CaseTitle] = 0x00011c,[CaseUpper] = 0x00011c}}, + {0x00011d, {[CaseLower] = 0x00011d,[CaseTitle] = 0x00011c,[CaseUpper] = 0x00011c}}, + {0x00011e, {[CaseLower] = 0x00011f,[CaseTitle] = 0x00011e,[CaseUpper] = 0x00011e}}, + {0x00011f, {[CaseLower] = 0x00011f,[CaseTitle] = 0x00011e,[CaseUpper] = 0x00011e}}, + {0x000120, {[CaseLower] = 0x000121,[CaseTitle] = 0x000120,[CaseUpper] = 0x000120}}, + {0x000121, {[CaseLower] = 0x000121,[CaseTitle] = 0x000120,[CaseUpper] = 0x000120}}, + {0x000122, {[CaseLower] = 0x000123,[CaseTitle] = 0x000122,[CaseUpper] = 0x000122}}, + {0x000123, {[CaseLower] = 0x000123,[CaseTitle] = 0x000122,[CaseUpper] = 0x000122}}, + {0x000124, {[CaseLower] = 0x000125,[CaseTitle] = 0x000124,[CaseUpper] = 0x000124}}, + {0x000125, {[CaseLower] = 0x000125,[CaseTitle] = 0x000124,[CaseUpper] = 0x000124}}, + {0x000126, {[CaseLower] = 0x000127,[CaseTitle] = 0x000126,[CaseUpper] = 0x000126}}, + {0x000127, {[CaseLower] = 0x000127,[CaseTitle] = 0x000126,[CaseUpper] = 0x000126}}, + {0x000128, {[CaseLower] = 0x000129,[CaseTitle] = 0x000128,[CaseUpper] = 0x000128}}, + {0x000129, {[CaseLower] = 0x000129,[CaseTitle] = 0x000128,[CaseUpper] = 0x000128}}, + {0x00012a, {[CaseLower] = 0x00012b,[CaseTitle] = 0x00012a,[CaseUpper] = 0x00012a}}, + {0x00012b, {[CaseLower] = 0x00012b,[CaseTitle] = 0x00012a,[CaseUpper] = 0x00012a}}, + {0x00012c, {[CaseLower] = 0x00012d,[CaseTitle] = 0x00012c,[CaseUpper] = 0x00012c}}, + {0x00012d, {[CaseLower] = 0x00012d,[CaseTitle] = 0x00012c,[CaseUpper] = 0x00012c}}, + {0x00012e, {[CaseLower] = 0x00012f,[CaseTitle] = 0x00012e,[CaseUpper] = 0x00012e}}, + {0x00012f, {[CaseLower] = 0x00012f,[CaseTitle] = 0x00012e,[CaseUpper] = 0x00012e}}, + {0x000130, {[CaseLower] = 0x000069,[CaseTitle] = 0x000130,[CaseUpper] = 0x000130}}, + {0x000131, {[CaseLower] = 0x000131,[CaseTitle] = 0x000049,[CaseUpper] = 0x000049}}, + {0x000132, {[CaseLower] = 0x000133,[CaseTitle] = 0x000132,[CaseUpper] = 0x000132}}, + {0x000133, {[CaseLower] = 0x000133,[CaseTitle] = 0x000132,[CaseUpper] = 0x000132}}, + {0x000134, {[CaseLower] = 0x000135,[CaseTitle] = 0x000134,[CaseUpper] = 0x000134}}, + {0x000135, {[CaseLower] = 0x000135,[CaseTitle] = 0x000134,[CaseUpper] = 0x000134}}, + {0x000136, {[CaseLower] = 0x000137,[CaseTitle] = 0x000136,[CaseUpper] = 0x000136}}, + {0x000137, {[CaseLower] = 0x000137,[CaseTitle] = 0x000136,[CaseUpper] = 0x000136}}, + {0x000139, {[CaseLower] = 0x00013a,[CaseTitle] = 0x000139,[CaseUpper] = 0x000139}}, + {0x00013a, {[CaseLower] = 0x00013a,[CaseTitle] = 0x000139,[CaseUpper] = 0x000139}}, + {0x00013b, {[CaseLower] = 0x00013c,[CaseTitle] = 0x00013b,[CaseUpper] = 0x00013b}}, + {0x00013c, {[CaseLower] = 0x00013c,[CaseTitle] = 0x00013b,[CaseUpper] = 0x00013b}}, + {0x00013d, {[CaseLower] = 0x00013e,[CaseTitle] = 0x00013d,[CaseUpper] = 0x00013d}}, + {0x00013e, {[CaseLower] = 0x00013e,[CaseTitle] = 0x00013d,[CaseUpper] = 0x00013d}}, + {0x00013f, {[CaseLower] = 0x000140,[CaseTitle] = 0x00013f,[CaseUpper] = 0x00013f}}, + {0x000140, {[CaseLower] = 0x000140,[CaseTitle] = 0x00013f,[CaseUpper] = 0x00013f}}, + {0x000141, {[CaseLower] = 0x000142,[CaseTitle] = 0x000141,[CaseUpper] = 0x000141}}, + {0x000142, {[CaseLower] = 0x000142,[CaseTitle] = 0x000141,[CaseUpper] = 0x000141}}, + {0x000143, {[CaseLower] = 0x000144,[CaseTitle] = 0x000143,[CaseUpper] = 0x000143}}, + {0x000144, {[CaseLower] = 0x000144,[CaseTitle] = 0x000143,[CaseUpper] = 0x000143}}, + {0x000145, {[CaseLower] = 0x000146,[CaseTitle] = 0x000145,[CaseUpper] = 0x000145}}, + {0x000146, {[CaseLower] = 0x000146,[CaseTitle] = 0x000145,[CaseUpper] = 0x000145}}, + {0x000147, {[CaseLower] = 0x000148,[CaseTitle] = 0x000147,[CaseUpper] = 0x000147}}, + {0x000148, {[CaseLower] = 0x000148,[CaseTitle] = 0x000147,[CaseUpper] = 0x000147}}, + {0x00014a, {[CaseLower] = 0x00014b,[CaseTitle] = 0x00014a,[CaseUpper] = 0x00014a}}, + {0x00014b, {[CaseLower] = 0x00014b,[CaseTitle] = 0x00014a,[CaseUpper] = 0x00014a}}, + {0x00014c, {[CaseLower] = 0x00014d,[CaseTitle] = 0x00014c,[CaseUpper] = 0x00014c}}, + {0x00014d, {[CaseLower] = 0x00014d,[CaseTitle] = 0x00014c,[CaseUpper] = 0x00014c}}, + {0x00014e, {[CaseLower] = 0x00014f,[CaseTitle] = 0x00014e,[CaseUpper] = 0x00014e}}, + {0x00014f, {[CaseLower] = 0x00014f,[CaseTitle] = 0x00014e,[CaseUpper] = 0x00014e}}, + {0x000150, {[CaseLower] = 0x000151,[CaseTitle] = 0x000150,[CaseUpper] = 0x000150}}, + {0x000151, {[CaseLower] = 0x000151,[CaseTitle] = 0x000150,[CaseUpper] = 0x000150}}, + {0x000152, {[CaseLower] = 0x000153,[CaseTitle] = 0x000152,[CaseUpper] = 0x000152}}, + {0x000153, {[CaseLower] = 0x000153,[CaseTitle] = 0x000152,[CaseUpper] = 0x000152}}, + {0x000154, {[CaseLower] = 0x000155,[CaseTitle] = 0x000154,[CaseUpper] = 0x000154}}, + {0x000155, {[CaseLower] = 0x000155,[CaseTitle] = 0x000154,[CaseUpper] = 0x000154}}, + {0x000156, {[CaseLower] = 0x000157,[CaseTitle] = 0x000156,[CaseUpper] = 0x000156}}, + {0x000157, {[CaseLower] = 0x000157,[CaseTitle] = 0x000156,[CaseUpper] = 0x000156}}, + {0x000158, {[CaseLower] = 0x000159,[CaseTitle] = 0x000158,[CaseUpper] = 0x000158}}, + {0x000159, {[CaseLower] = 0x000159,[CaseTitle] = 0x000158,[CaseUpper] = 0x000158}}, + {0x00015a, {[CaseLower] = 0x00015b,[CaseTitle] = 0x00015a,[CaseUpper] = 0x00015a}}, + {0x00015b, {[CaseLower] = 0x00015b,[CaseTitle] = 0x00015a,[CaseUpper] = 0x00015a}}, + {0x00015c, {[CaseLower] = 0x00015d,[CaseTitle] = 0x00015c,[CaseUpper] = 0x00015c}}, + {0x00015d, {[CaseLower] = 0x00015d,[CaseTitle] = 0x00015c,[CaseUpper] = 0x00015c}}, + {0x00015e, {[CaseLower] = 0x00015f,[CaseTitle] = 0x00015e,[CaseUpper] = 0x00015e}}, + {0x00015f, {[CaseLower] = 0x00015f,[CaseTitle] = 0x00015e,[CaseUpper] = 0x00015e}}, + {0x000160, {[CaseLower] = 0x000161,[CaseTitle] = 0x000160,[CaseUpper] = 0x000160}}, + {0x000161, {[CaseLower] = 0x000161,[CaseTitle] = 0x000160,[CaseUpper] = 0x000160}}, + {0x000162, {[CaseLower] = 0x000163,[CaseTitle] = 0x000162,[CaseUpper] = 0x000162}}, + {0x000163, {[CaseLower] = 0x000163,[CaseTitle] = 0x000162,[CaseUpper] = 0x000162}}, + {0x000164, {[CaseLower] = 0x000165,[CaseTitle] = 0x000164,[CaseUpper] = 0x000164}}, + {0x000165, {[CaseLower] = 0x000165,[CaseTitle] = 0x000164,[CaseUpper] = 0x000164}}, + {0x000166, {[CaseLower] = 0x000167,[CaseTitle] = 0x000166,[CaseUpper] = 0x000166}}, + {0x000167, {[CaseLower] = 0x000167,[CaseTitle] = 0x000166,[CaseUpper] = 0x000166}}, + {0x000168, {[CaseLower] = 0x000169,[CaseTitle] = 0x000168,[CaseUpper] = 0x000168}}, + {0x000169, {[CaseLower] = 0x000169,[CaseTitle] = 0x000168,[CaseUpper] = 0x000168}}, + {0x00016a, {[CaseLower] = 0x00016b,[CaseTitle] = 0x00016a,[CaseUpper] = 0x00016a}}, + {0x00016b, {[CaseLower] = 0x00016b,[CaseTitle] = 0x00016a,[CaseUpper] = 0x00016a}}, + {0x00016c, {[CaseLower] = 0x00016d,[CaseTitle] = 0x00016c,[CaseUpper] = 0x00016c}}, + {0x00016d, {[CaseLower] = 0x00016d,[CaseTitle] = 0x00016c,[CaseUpper] = 0x00016c}}, + {0x00016e, {[CaseLower] = 0x00016f,[CaseTitle] = 0x00016e,[CaseUpper] = 0x00016e}}, + {0x00016f, {[CaseLower] = 0x00016f,[CaseTitle] = 0x00016e,[CaseUpper] = 0x00016e}}, + {0x000170, {[CaseLower] = 0x000171,[CaseTitle] = 0x000170,[CaseUpper] = 0x000170}}, + {0x000171, {[CaseLower] = 0x000171,[CaseTitle] = 0x000170,[CaseUpper] = 0x000170}}, + {0x000172, {[CaseLower] = 0x000173,[CaseTitle] = 0x000172,[CaseUpper] = 0x000172}}, + {0x000173, {[CaseLower] = 0x000173,[CaseTitle] = 0x000172,[CaseUpper] = 0x000172}}, + {0x000174, {[CaseLower] = 0x000175,[CaseTitle] = 0x000174,[CaseUpper] = 0x000174}}, + {0x000175, {[CaseLower] = 0x000175,[CaseTitle] = 0x000174,[CaseUpper] = 0x000174}}, + {0x000176, {[CaseLower] = 0x000177,[CaseTitle] = 0x000176,[CaseUpper] = 0x000176}}, + {0x000177, {[CaseLower] = 0x000177,[CaseTitle] = 0x000176,[CaseUpper] = 0x000176}}, + {0x000178, {[CaseLower] = 0x0000ff,[CaseTitle] = 0x000178,[CaseUpper] = 0x000178}}, + {0x000179, {[CaseLower] = 0x00017a,[CaseTitle] = 0x000179,[CaseUpper] = 0x000179}}, + {0x00017a, {[CaseLower] = 0x00017a,[CaseTitle] = 0x000179,[CaseUpper] = 0x000179}}, + {0x00017b, {[CaseLower] = 0x00017c,[CaseTitle] = 0x00017b,[CaseUpper] = 0x00017b}}, + {0x00017c, {[CaseLower] = 0x00017c,[CaseTitle] = 0x00017b,[CaseUpper] = 0x00017b}}, + {0x00017d, {[CaseLower] = 0x00017e,[CaseTitle] = 0x00017d,[CaseUpper] = 0x00017d}}, + {0x00017e, {[CaseLower] = 0x00017e,[CaseTitle] = 0x00017d,[CaseUpper] = 0x00017d}}, + {0x00017f, {[CaseLower] = 0x00017f,[CaseTitle] = 0x000053,[CaseUpper] = 0x000053}}, + {0x000180, {[CaseLower] = 0x000180,[CaseTitle] = 0x000243,[CaseUpper] = 0x000243}}, + {0x000181, {[CaseLower] = 0x000253,[CaseTitle] = 0x000181,[CaseUpper] = 0x000181}}, + {0x000182, {[CaseLower] = 0x000183,[CaseTitle] = 0x000182,[CaseUpper] = 0x000182}}, + {0x000183, {[CaseLower] = 0x000183,[CaseTitle] = 0x000182,[CaseUpper] = 0x000182}}, + {0x000184, {[CaseLower] = 0x000185,[CaseTitle] = 0x000184,[CaseUpper] = 0x000184}}, + {0x000185, {[CaseLower] = 0x000185,[CaseTitle] = 0x000184,[CaseUpper] = 0x000184}}, + {0x000186, {[CaseLower] = 0x000254,[CaseTitle] = 0x000186,[CaseUpper] = 0x000186}}, + {0x000187, {[CaseLower] = 0x000188,[CaseTitle] = 0x000187,[CaseUpper] = 0x000187}}, + {0x000188, {[CaseLower] = 0x000188,[CaseTitle] = 0x000187,[CaseUpper] = 0x000187}}, + {0x000189, {[CaseLower] = 0x000256,[CaseTitle] = 0x000189,[CaseUpper] = 0x000189}}, + {0x00018a, {[CaseLower] = 0x000257,[CaseTitle] = 0x00018a,[CaseUpper] = 0x00018a}}, + {0x00018b, {[CaseLower] = 0x00018c,[CaseTitle] = 0x00018b,[CaseUpper] = 0x00018b}}, + {0x00018c, {[CaseLower] = 0x00018c,[CaseTitle] = 0x00018b,[CaseUpper] = 0x00018b}}, + {0x00018e, {[CaseLower] = 0x0001dd,[CaseTitle] = 0x00018e,[CaseUpper] = 0x00018e}}, + {0x00018f, {[CaseLower] = 0x000259,[CaseTitle] = 0x00018f,[CaseUpper] = 0x00018f}}, + {0x000190, {[CaseLower] = 0x00025b,[CaseTitle] = 0x000190,[CaseUpper] = 0x000190}}, + {0x000191, {[CaseLower] = 0x000192,[CaseTitle] = 0x000191,[CaseUpper] = 0x000191}}, + {0x000192, {[CaseLower] = 0x000192,[CaseTitle] = 0x000191,[CaseUpper] = 0x000191}}, + {0x000193, {[CaseLower] = 0x000260,[CaseTitle] = 0x000193,[CaseUpper] = 0x000193}}, + {0x000194, {[CaseLower] = 0x000263,[CaseTitle] = 0x000194,[CaseUpper] = 0x000194}}, + {0x000195, {[CaseLower] = 0x000195,[CaseTitle] = 0x0001f6,[CaseUpper] = 0x0001f6}}, + {0x000196, {[CaseLower] = 0x000269,[CaseTitle] = 0x000196,[CaseUpper] = 0x000196}}, + {0x000197, {[CaseLower] = 0x000268,[CaseTitle] = 0x000197,[CaseUpper] = 0x000197}}, + {0x000198, {[CaseLower] = 0x000199,[CaseTitle] = 0x000198,[CaseUpper] = 0x000198}}, + {0x000199, {[CaseLower] = 0x000199,[CaseTitle] = 0x000198,[CaseUpper] = 0x000198}}, + {0x00019a, {[CaseLower] = 0x00019a,[CaseTitle] = 0x00023d,[CaseUpper] = 0x00023d}}, + {0x00019c, {[CaseLower] = 0x00026f,[CaseTitle] = 0x00019c,[CaseUpper] = 0x00019c}}, + {0x00019d, {[CaseLower] = 0x000272,[CaseTitle] = 0x00019d,[CaseUpper] = 0x00019d}}, + {0x00019e, {[CaseLower] = 0x00019e,[CaseTitle] = 0x000220,[CaseUpper] = 0x000220}}, + {0x00019f, {[CaseLower] = 0x000275,[CaseTitle] = 0x00019f,[CaseUpper] = 0x00019f}}, + {0x0001a0, {[CaseLower] = 0x0001a1,[CaseTitle] = 0x0001a0,[CaseUpper] = 0x0001a0}}, + {0x0001a1, {[CaseLower] = 0x0001a1,[CaseTitle] = 0x0001a0,[CaseUpper] = 0x0001a0}}, + {0x0001a2, {[CaseLower] = 0x0001a3,[CaseTitle] = 0x0001a2,[CaseUpper] = 0x0001a2}}, + {0x0001a3, {[CaseLower] = 0x0001a3,[CaseTitle] = 0x0001a2,[CaseUpper] = 0x0001a2}}, + {0x0001a4, {[CaseLower] = 0x0001a5,[CaseTitle] = 0x0001a4,[CaseUpper] = 0x0001a4}}, + {0x0001a5, {[CaseLower] = 0x0001a5,[CaseTitle] = 0x0001a4,[CaseUpper] = 0x0001a4}}, + {0x0001a6, {[CaseLower] = 0x000280,[CaseTitle] = 0x0001a6,[CaseUpper] = 0x0001a6}}, + {0x0001a7, {[CaseLower] = 0x0001a8,[CaseTitle] = 0x0001a7,[CaseUpper] = 0x0001a7}}, + {0x0001a8, {[CaseLower] = 0x0001a8,[CaseTitle] = 0x0001a7,[CaseUpper] = 0x0001a7}}, + {0x0001a9, {[CaseLower] = 0x000283,[CaseTitle] = 0x0001a9,[CaseUpper] = 0x0001a9}}, + {0x0001ac, {[CaseLower] = 0x0001ad,[CaseTitle] = 0x0001ac,[CaseUpper] = 0x0001ac}}, + {0x0001ad, {[CaseLower] = 0x0001ad,[CaseTitle] = 0x0001ac,[CaseUpper] = 0x0001ac}}, + {0x0001ae, {[CaseLower] = 0x000288,[CaseTitle] = 0x0001ae,[CaseUpper] = 0x0001ae}}, + {0x0001af, {[CaseLower] = 0x0001b0,[CaseTitle] = 0x0001af,[CaseUpper] = 0x0001af}}, + {0x0001b0, {[CaseLower] = 0x0001b0,[CaseTitle] = 0x0001af,[CaseUpper] = 0x0001af}}, + {0x0001b1, {[CaseLower] = 0x00028a,[CaseTitle] = 0x0001b1,[CaseUpper] = 0x0001b1}}, + {0x0001b2, {[CaseLower] = 0x00028b,[CaseTitle] = 0x0001b2,[CaseUpper] = 0x0001b2}}, + {0x0001b3, {[CaseLower] = 0x0001b4,[CaseTitle] = 0x0001b3,[CaseUpper] = 0x0001b3}}, + {0x0001b4, {[CaseLower] = 0x0001b4,[CaseTitle] = 0x0001b3,[CaseUpper] = 0x0001b3}}, + {0x0001b5, {[CaseLower] = 0x0001b6,[CaseTitle] = 0x0001b5,[CaseUpper] = 0x0001b5}}, + {0x0001b6, {[CaseLower] = 0x0001b6,[CaseTitle] = 0x0001b5,[CaseUpper] = 0x0001b5}}, + {0x0001b7, {[CaseLower] = 0x000292,[CaseTitle] = 0x0001b7,[CaseUpper] = 0x0001b7}}, + {0x0001b8, {[CaseLower] = 0x0001b9,[CaseTitle] = 0x0001b8,[CaseUpper] = 0x0001b8}}, + {0x0001b9, {[CaseLower] = 0x0001b9,[CaseTitle] = 0x0001b8,[CaseUpper] = 0x0001b8}}, + {0x0001bc, {[CaseLower] = 0x0001bd,[CaseTitle] = 0x0001bc,[CaseUpper] = 0x0001bc}}, + {0x0001bd, {[CaseLower] = 0x0001bd,[CaseTitle] = 0x0001bc,[CaseUpper] = 0x0001bc}}, + {0x0001bf, {[CaseLower] = 0x0001bf,[CaseTitle] = 0x0001f7,[CaseUpper] = 0x0001f7}}, + {0x0001c4, {[CaseLower] = 0x0001c6,[CaseTitle] = 0x0001c5,[CaseUpper] = 0x0001c4}}, + {0x0001c5, {[CaseLower] = 0x0001c6,[CaseTitle] = 0x0001c5,[CaseUpper] = 0x0001c4}}, + {0x0001c6, {[CaseLower] = 0x0001c6,[CaseTitle] = 0x0001c5,[CaseUpper] = 0x0001c4}}, + {0x0001c7, {[CaseLower] = 0x0001c9,[CaseTitle] = 0x0001c8,[CaseUpper] = 0x0001c7}}, + {0x0001c8, {[CaseLower] = 0x0001c9,[CaseTitle] = 0x0001c8,[CaseUpper] = 0x0001c7}}, + {0x0001c9, {[CaseLower] = 0x0001c9,[CaseTitle] = 0x0001c8,[CaseUpper] = 0x0001c7}}, + {0x0001ca, {[CaseLower] = 0x0001cc,[CaseTitle] = 0x0001cb,[CaseUpper] = 0x0001ca}}, + {0x0001cb, {[CaseLower] = 0x0001cc,[CaseTitle] = 0x0001cb,[CaseUpper] = 0x0001ca}}, + {0x0001cc, {[CaseLower] = 0x0001cc,[CaseTitle] = 0x0001cb,[CaseUpper] = 0x0001ca}}, + {0x0001cd, {[CaseLower] = 0x0001ce,[CaseTitle] = 0x0001cd,[CaseUpper] = 0x0001cd}}, + {0x0001ce, {[CaseLower] = 0x0001ce,[CaseTitle] = 0x0001cd,[CaseUpper] = 0x0001cd}}, + {0x0001cf, {[CaseLower] = 0x0001d0,[CaseTitle] = 0x0001cf,[CaseUpper] = 0x0001cf}}, + {0x0001d0, {[CaseLower] = 0x0001d0,[CaseTitle] = 0x0001cf,[CaseUpper] = 0x0001cf}}, + {0x0001d1, {[CaseLower] = 0x0001d2,[CaseTitle] = 0x0001d1,[CaseUpper] = 0x0001d1}}, + {0x0001d2, {[CaseLower] = 0x0001d2,[CaseTitle] = 0x0001d1,[CaseUpper] = 0x0001d1}}, + {0x0001d3, {[CaseLower] = 0x0001d4,[CaseTitle] = 0x0001d3,[CaseUpper] = 0x0001d3}}, + {0x0001d4, {[CaseLower] = 0x0001d4,[CaseTitle] = 0x0001d3,[CaseUpper] = 0x0001d3}}, + {0x0001d5, {[CaseLower] = 0x0001d6,[CaseTitle] = 0x0001d5,[CaseUpper] = 0x0001d5}}, + {0x0001d6, {[CaseLower] = 0x0001d6,[CaseTitle] = 0x0001d5,[CaseUpper] = 0x0001d5}}, + {0x0001d7, {[CaseLower] = 0x0001d8,[CaseTitle] = 0x0001d7,[CaseUpper] = 0x0001d7}}, + {0x0001d8, {[CaseLower] = 0x0001d8,[CaseTitle] = 0x0001d7,[CaseUpper] = 0x0001d7}}, + {0x0001d9, {[CaseLower] = 0x0001da,[CaseTitle] = 0x0001d9,[CaseUpper] = 0x0001d9}}, + {0x0001da, {[CaseLower] = 0x0001da,[CaseTitle] = 0x0001d9,[CaseUpper] = 0x0001d9}}, + {0x0001db, {[CaseLower] = 0x0001dc,[CaseTitle] = 0x0001db,[CaseUpper] = 0x0001db}}, + {0x0001dc, {[CaseLower] = 0x0001dc,[CaseTitle] = 0x0001db,[CaseUpper] = 0x0001db}}, + {0x0001dd, {[CaseLower] = 0x0001dd,[CaseTitle] = 0x00018e,[CaseUpper] = 0x00018e}}, + {0x0001de, {[CaseLower] = 0x0001df,[CaseTitle] = 0x0001de,[CaseUpper] = 0x0001de}}, + {0x0001df, {[CaseLower] = 0x0001df,[CaseTitle] = 0x0001de,[CaseUpper] = 0x0001de}}, + {0x0001e0, {[CaseLower] = 0x0001e1,[CaseTitle] = 0x0001e0,[CaseUpper] = 0x0001e0}}, + {0x0001e1, {[CaseLower] = 0x0001e1,[CaseTitle] = 0x0001e0,[CaseUpper] = 0x0001e0}}, + {0x0001e2, {[CaseLower] = 0x0001e3,[CaseTitle] = 0x0001e2,[CaseUpper] = 0x0001e2}}, + {0x0001e3, {[CaseLower] = 0x0001e3,[CaseTitle] = 0x0001e2,[CaseUpper] = 0x0001e2}}, + {0x0001e4, {[CaseLower] = 0x0001e5,[CaseTitle] = 0x0001e4,[CaseUpper] = 0x0001e4}}, + {0x0001e5, {[CaseLower] = 0x0001e5,[CaseTitle] = 0x0001e4,[CaseUpper] = 0x0001e4}}, + {0x0001e6, {[CaseLower] = 0x0001e7,[CaseTitle] = 0x0001e6,[CaseUpper] = 0x0001e6}}, + {0x0001e7, {[CaseLower] = 0x0001e7,[CaseTitle] = 0x0001e6,[CaseUpper] = 0x0001e6}}, + {0x0001e8, {[CaseLower] = 0x0001e9,[CaseTitle] = 0x0001e8,[CaseUpper] = 0x0001e8}}, + {0x0001e9, {[CaseLower] = 0x0001e9,[CaseTitle] = 0x0001e8,[CaseUpper] = 0x0001e8}}, + {0x0001ea, {[CaseLower] = 0x0001eb,[CaseTitle] = 0x0001ea,[CaseUpper] = 0x0001ea}}, + {0x0001eb, {[CaseLower] = 0x0001eb,[CaseTitle] = 0x0001ea,[CaseUpper] = 0x0001ea}}, + {0x0001ec, {[CaseLower] = 0x0001ed,[CaseTitle] = 0x0001ec,[CaseUpper] = 0x0001ec}}, + {0x0001ed, {[CaseLower] = 0x0001ed,[CaseTitle] = 0x0001ec,[CaseUpper] = 0x0001ec}}, + {0x0001ee, {[CaseLower] = 0x0001ef,[CaseTitle] = 0x0001ee,[CaseUpper] = 0x0001ee}}, + {0x0001ef, {[CaseLower] = 0x0001ef,[CaseTitle] = 0x0001ee,[CaseUpper] = 0x0001ee}}, + {0x0001f1, {[CaseLower] = 0x0001f3,[CaseTitle] = 0x0001f2,[CaseUpper] = 0x0001f1}}, + {0x0001f2, {[CaseLower] = 0x0001f3,[CaseTitle] = 0x0001f2,[CaseUpper] = 0x0001f1}}, + {0x0001f3, {[CaseLower] = 0x0001f3,[CaseTitle] = 0x0001f2,[CaseUpper] = 0x0001f1}}, + {0x0001f4, {[CaseLower] = 0x0001f5,[CaseTitle] = 0x0001f4,[CaseUpper] = 0x0001f4}}, + {0x0001f5, {[CaseLower] = 0x0001f5,[CaseTitle] = 0x0001f4,[CaseUpper] = 0x0001f4}}, + {0x0001f6, {[CaseLower] = 0x000195,[CaseTitle] = 0x0001f6,[CaseUpper] = 0x0001f6}}, + {0x0001f7, {[CaseLower] = 0x0001bf,[CaseTitle] = 0x0001f7,[CaseUpper] = 0x0001f7}}, + {0x0001f8, {[CaseLower] = 0x0001f9,[CaseTitle] = 0x0001f8,[CaseUpper] = 0x0001f8}}, + {0x0001f9, {[CaseLower] = 0x0001f9,[CaseTitle] = 0x0001f8,[CaseUpper] = 0x0001f8}}, + {0x0001fa, {[CaseLower] = 0x0001fb,[CaseTitle] = 0x0001fa,[CaseUpper] = 0x0001fa}}, + {0x0001fb, {[CaseLower] = 0x0001fb,[CaseTitle] = 0x0001fa,[CaseUpper] = 0x0001fa}}, + {0x0001fc, {[CaseLower] = 0x0001fd,[CaseTitle] = 0x0001fc,[CaseUpper] = 0x0001fc}}, + {0x0001fd, {[CaseLower] = 0x0001fd,[CaseTitle] = 0x0001fc,[CaseUpper] = 0x0001fc}}, + {0x0001fe, {[CaseLower] = 0x0001ff,[CaseTitle] = 0x0001fe,[CaseUpper] = 0x0001fe}}, + {0x0001ff, {[CaseLower] = 0x0001ff,[CaseTitle] = 0x0001fe,[CaseUpper] = 0x0001fe}}, + {0x000200, {[CaseLower] = 0x000201,[CaseTitle] = 0x000200,[CaseUpper] = 0x000200}}, + {0x000201, {[CaseLower] = 0x000201,[CaseTitle] = 0x000200,[CaseUpper] = 0x000200}}, + {0x000202, {[CaseLower] = 0x000203,[CaseTitle] = 0x000202,[CaseUpper] = 0x000202}}, + {0x000203, {[CaseLower] = 0x000203,[CaseTitle] = 0x000202,[CaseUpper] = 0x000202}}, + {0x000204, {[CaseLower] = 0x000205,[CaseTitle] = 0x000204,[CaseUpper] = 0x000204}}, + {0x000205, {[CaseLower] = 0x000205,[CaseTitle] = 0x000204,[CaseUpper] = 0x000204}}, + {0x000206, {[CaseLower] = 0x000207,[CaseTitle] = 0x000206,[CaseUpper] = 0x000206}}, + {0x000207, {[CaseLower] = 0x000207,[CaseTitle] = 0x000206,[CaseUpper] = 0x000206}}, + {0x000208, {[CaseLower] = 0x000209,[CaseTitle] = 0x000208,[CaseUpper] = 0x000208}}, + {0x000209, {[CaseLower] = 0x000209,[CaseTitle] = 0x000208,[CaseUpper] = 0x000208}}, + {0x00020a, {[CaseLower] = 0x00020b,[CaseTitle] = 0x00020a,[CaseUpper] = 0x00020a}}, + {0x00020b, {[CaseLower] = 0x00020b,[CaseTitle] = 0x00020a,[CaseUpper] = 0x00020a}}, + {0x00020c, {[CaseLower] = 0x00020d,[CaseTitle] = 0x00020c,[CaseUpper] = 0x00020c}}, + {0x00020d, {[CaseLower] = 0x00020d,[CaseTitle] = 0x00020c,[CaseUpper] = 0x00020c}}, + {0x00020e, {[CaseLower] = 0x00020f,[CaseTitle] = 0x00020e,[CaseUpper] = 0x00020e}}, + {0x00020f, {[CaseLower] = 0x00020f,[CaseTitle] = 0x00020e,[CaseUpper] = 0x00020e}}, + {0x000210, {[CaseLower] = 0x000211,[CaseTitle] = 0x000210,[CaseUpper] = 0x000210}}, + {0x000211, {[CaseLower] = 0x000211,[CaseTitle] = 0x000210,[CaseUpper] = 0x000210}}, + {0x000212, {[CaseLower] = 0x000213,[CaseTitle] = 0x000212,[CaseUpper] = 0x000212}}, + {0x000213, {[CaseLower] = 0x000213,[CaseTitle] = 0x000212,[CaseUpper] = 0x000212}}, + {0x000214, {[CaseLower] = 0x000215,[CaseTitle] = 0x000214,[CaseUpper] = 0x000214}}, + {0x000215, {[CaseLower] = 0x000215,[CaseTitle] = 0x000214,[CaseUpper] = 0x000214}}, + {0x000216, {[CaseLower] = 0x000217,[CaseTitle] = 0x000216,[CaseUpper] = 0x000216}}, + {0x000217, {[CaseLower] = 0x000217,[CaseTitle] = 0x000216,[CaseUpper] = 0x000216}}, + {0x000218, {[CaseLower] = 0x000219,[CaseTitle] = 0x000218,[CaseUpper] = 0x000218}}, + {0x000219, {[CaseLower] = 0x000219,[CaseTitle] = 0x000218,[CaseUpper] = 0x000218}}, + {0x00021a, {[CaseLower] = 0x00021b,[CaseTitle] = 0x00021a,[CaseUpper] = 0x00021a}}, + {0x00021b, {[CaseLower] = 0x00021b,[CaseTitle] = 0x00021a,[CaseUpper] = 0x00021a}}, + {0x00021c, {[CaseLower] = 0x00021d,[CaseTitle] = 0x00021c,[CaseUpper] = 0x00021c}}, + {0x00021d, {[CaseLower] = 0x00021d,[CaseTitle] = 0x00021c,[CaseUpper] = 0x00021c}}, + {0x00021e, {[CaseLower] = 0x00021f,[CaseTitle] = 0x00021e,[CaseUpper] = 0x00021e}}, + {0x00021f, {[CaseLower] = 0x00021f,[CaseTitle] = 0x00021e,[CaseUpper] = 0x00021e}}, + {0x000220, {[CaseLower] = 0x00019e,[CaseTitle] = 0x000220,[CaseUpper] = 0x000220}}, + {0x000222, {[CaseLower] = 0x000223,[CaseTitle] = 0x000222,[CaseUpper] = 0x000222}}, + {0x000223, {[CaseLower] = 0x000223,[CaseTitle] = 0x000222,[CaseUpper] = 0x000222}}, + {0x000224, {[CaseLower] = 0x000225,[CaseTitle] = 0x000224,[CaseUpper] = 0x000224}}, + {0x000225, {[CaseLower] = 0x000225,[CaseTitle] = 0x000224,[CaseUpper] = 0x000224}}, + {0x000226, {[CaseLower] = 0x000227,[CaseTitle] = 0x000226,[CaseUpper] = 0x000226}}, + {0x000227, {[CaseLower] = 0x000227,[CaseTitle] = 0x000226,[CaseUpper] = 0x000226}}, + {0x000228, {[CaseLower] = 0x000229,[CaseTitle] = 0x000228,[CaseUpper] = 0x000228}}, + {0x000229, {[CaseLower] = 0x000229,[CaseTitle] = 0x000228,[CaseUpper] = 0x000228}}, + {0x00022a, {[CaseLower] = 0x00022b,[CaseTitle] = 0x00022a,[CaseUpper] = 0x00022a}}, + {0x00022b, {[CaseLower] = 0x00022b,[CaseTitle] = 0x00022a,[CaseUpper] = 0x00022a}}, + {0x00022c, {[CaseLower] = 0x00022d,[CaseTitle] = 0x00022c,[CaseUpper] = 0x00022c}}, + {0x00022d, {[CaseLower] = 0x00022d,[CaseTitle] = 0x00022c,[CaseUpper] = 0x00022c}}, + {0x00022e, {[CaseLower] = 0x00022f,[CaseTitle] = 0x00022e,[CaseUpper] = 0x00022e}}, + {0x00022f, {[CaseLower] = 0x00022f,[CaseTitle] = 0x00022e,[CaseUpper] = 0x00022e}}, + {0x000230, {[CaseLower] = 0x000231,[CaseTitle] = 0x000230,[CaseUpper] = 0x000230}}, + {0x000231, {[CaseLower] = 0x000231,[CaseTitle] = 0x000230,[CaseUpper] = 0x000230}}, + {0x000232, {[CaseLower] = 0x000233,[CaseTitle] = 0x000232,[CaseUpper] = 0x000232}}, + {0x000233, {[CaseLower] = 0x000233,[CaseTitle] = 0x000232,[CaseUpper] = 0x000232}}, + {0x00023a, {[CaseLower] = 0x002c65,[CaseTitle] = 0x00023a,[CaseUpper] = 0x00023a}}, + {0x00023b, {[CaseLower] = 0x00023c,[CaseTitle] = 0x00023b,[CaseUpper] = 0x00023b}}, + {0x00023c, {[CaseLower] = 0x00023c,[CaseTitle] = 0x00023b,[CaseUpper] = 0x00023b}}, + {0x00023d, {[CaseLower] = 0x00019a,[CaseTitle] = 0x00023d,[CaseUpper] = 0x00023d}}, + {0x00023e, {[CaseLower] = 0x002c66,[CaseTitle] = 0x00023e,[CaseUpper] = 0x00023e}}, + {0x00023f, {[CaseLower] = 0x00023f,[CaseTitle] = 0x002c7e,[CaseUpper] = 0x002c7e}}, + {0x000240, {[CaseLower] = 0x000240,[CaseTitle] = 0x002c7f,[CaseUpper] = 0x002c7f}}, + {0x000241, {[CaseLower] = 0x000242,[CaseTitle] = 0x000241,[CaseUpper] = 0x000241}}, + {0x000242, {[CaseLower] = 0x000242,[CaseTitle] = 0x000241,[CaseUpper] = 0x000241}}, + {0x000243, {[CaseLower] = 0x000180,[CaseTitle] = 0x000243,[CaseUpper] = 0x000243}}, + {0x000244, {[CaseLower] = 0x000289,[CaseTitle] = 0x000244,[CaseUpper] = 0x000244}}, + {0x000245, {[CaseLower] = 0x00028c,[CaseTitle] = 0x000245,[CaseUpper] = 0x000245}}, + {0x000246, {[CaseLower] = 0x000247,[CaseTitle] = 0x000246,[CaseUpper] = 0x000246}}, + {0x000247, {[CaseLower] = 0x000247,[CaseTitle] = 0x000246,[CaseUpper] = 0x000246}}, + {0x000248, {[CaseLower] = 0x000249,[CaseTitle] = 0x000248,[CaseUpper] = 0x000248}}, + {0x000249, {[CaseLower] = 0x000249,[CaseTitle] = 0x000248,[CaseUpper] = 0x000248}}, + {0x00024a, {[CaseLower] = 0x00024b,[CaseTitle] = 0x00024a,[CaseUpper] = 0x00024a}}, + {0x00024b, {[CaseLower] = 0x00024b,[CaseTitle] = 0x00024a,[CaseUpper] = 0x00024a}}, + {0x00024c, {[CaseLower] = 0x00024d,[CaseTitle] = 0x00024c,[CaseUpper] = 0x00024c}}, + {0x00024d, {[CaseLower] = 0x00024d,[CaseTitle] = 0x00024c,[CaseUpper] = 0x00024c}}, + {0x00024e, {[CaseLower] = 0x00024f,[CaseTitle] = 0x00024e,[CaseUpper] = 0x00024e}}, + {0x00024f, {[CaseLower] = 0x00024f,[CaseTitle] = 0x00024e,[CaseUpper] = 0x00024e}}, + {0x000250, {[CaseLower] = 0x000250,[CaseTitle] = 0x002c6f,[CaseUpper] = 0x002c6f}}, + {0x000251, {[CaseLower] = 0x000251,[CaseTitle] = 0x002c6d,[CaseUpper] = 0x002c6d}}, + {0x000252, {[CaseLower] = 0x000252,[CaseTitle] = 0x002c70,[CaseUpper] = 0x002c70}}, + {0x000253, {[CaseLower] = 0x000253,[CaseTitle] = 0x000181,[CaseUpper] = 0x000181}}, + {0x000254, {[CaseLower] = 0x000254,[CaseTitle] = 0x000186,[CaseUpper] = 0x000186}}, + {0x000256, {[CaseLower] = 0x000256,[CaseTitle] = 0x000189,[CaseUpper] = 0x000189}}, + {0x000257, {[CaseLower] = 0x000257,[CaseTitle] = 0x00018a,[CaseUpper] = 0x00018a}}, + {0x000259, {[CaseLower] = 0x000259,[CaseTitle] = 0x00018f,[CaseUpper] = 0x00018f}}, + {0x00025b, {[CaseLower] = 0x00025b,[CaseTitle] = 0x000190,[CaseUpper] = 0x000190}}, + {0x00025c, {[CaseLower] = 0x00025c,[CaseTitle] = 0x00a7ab,[CaseUpper] = 0x00a7ab}}, + {0x000260, {[CaseLower] = 0x000260,[CaseTitle] = 0x000193,[CaseUpper] = 0x000193}}, + {0x000261, {[CaseLower] = 0x000261,[CaseTitle] = 0x00a7ac,[CaseUpper] = 0x00a7ac}}, + {0x000263, {[CaseLower] = 0x000263,[CaseTitle] = 0x000194,[CaseUpper] = 0x000194}}, + {0x000265, {[CaseLower] = 0x000265,[CaseTitle] = 0x00a78d,[CaseUpper] = 0x00a78d}}, + {0x000266, {[CaseLower] = 0x000266,[CaseTitle] = 0x00a7aa,[CaseUpper] = 0x00a7aa}}, + {0x000268, {[CaseLower] = 0x000268,[CaseTitle] = 0x000197,[CaseUpper] = 0x000197}}, + {0x000269, {[CaseLower] = 0x000269,[CaseTitle] = 0x000196,[CaseUpper] = 0x000196}}, + {0x00026a, {[CaseLower] = 0x00026a,[CaseTitle] = 0x00a7ae,[CaseUpper] = 0x00a7ae}}, + {0x00026b, {[CaseLower] = 0x00026b,[CaseTitle] = 0x002c62,[CaseUpper] = 0x002c62}}, + {0x00026c, {[CaseLower] = 0x00026c,[CaseTitle] = 0x00a7ad,[CaseUpper] = 0x00a7ad}}, + {0x00026f, {[CaseLower] = 0x00026f,[CaseTitle] = 0x00019c,[CaseUpper] = 0x00019c}}, + {0x000271, {[CaseLower] = 0x000271,[CaseTitle] = 0x002c6e,[CaseUpper] = 0x002c6e}}, + {0x000272, {[CaseLower] = 0x000272,[CaseTitle] = 0x00019d,[CaseUpper] = 0x00019d}}, + {0x000275, {[CaseLower] = 0x000275,[CaseTitle] = 0x00019f,[CaseUpper] = 0x00019f}}, + {0x00027d, {[CaseLower] = 0x00027d,[CaseTitle] = 0x002c64,[CaseUpper] = 0x002c64}}, + {0x000280, {[CaseLower] = 0x000280,[CaseTitle] = 0x0001a6,[CaseUpper] = 0x0001a6}}, + {0x000282, {[CaseLower] = 0x000282,[CaseTitle] = 0x00a7c5,[CaseUpper] = 0x00a7c5}}, + {0x000283, {[CaseLower] = 0x000283,[CaseTitle] = 0x0001a9,[CaseUpper] = 0x0001a9}}, + {0x000287, {[CaseLower] = 0x000287,[CaseTitle] = 0x00a7b1,[CaseUpper] = 0x00a7b1}}, + {0x000288, {[CaseLower] = 0x000288,[CaseTitle] = 0x0001ae,[CaseUpper] = 0x0001ae}}, + {0x000289, {[CaseLower] = 0x000289,[CaseTitle] = 0x000244,[CaseUpper] = 0x000244}}, + {0x00028a, {[CaseLower] = 0x00028a,[CaseTitle] = 0x0001b1,[CaseUpper] = 0x0001b1}}, + {0x00028b, {[CaseLower] = 0x00028b,[CaseTitle] = 0x0001b2,[CaseUpper] = 0x0001b2}}, + {0x00028c, {[CaseLower] = 0x00028c,[CaseTitle] = 0x000245,[CaseUpper] = 0x000245}}, + {0x000292, {[CaseLower] = 0x000292,[CaseTitle] = 0x0001b7,[CaseUpper] = 0x0001b7}}, + {0x00029d, {[CaseLower] = 0x00029d,[CaseTitle] = 0x00a7b2,[CaseUpper] = 0x00a7b2}}, + {0x00029e, {[CaseLower] = 0x00029e,[CaseTitle] = 0x00a7b0,[CaseUpper] = 0x00a7b0}}, + {0x000345, {[CaseLower] = 0x000345,[CaseTitle] = 0x000399,[CaseUpper] = 0x000399}}, + {0x000370, {[CaseLower] = 0x000371,[CaseTitle] = 0x000370,[CaseUpper] = 0x000370}}, + {0x000371, {[CaseLower] = 0x000371,[CaseTitle] = 0x000370,[CaseUpper] = 0x000370}}, + {0x000372, {[CaseLower] = 0x000373,[CaseTitle] = 0x000372,[CaseUpper] = 0x000372}}, + {0x000373, {[CaseLower] = 0x000373,[CaseTitle] = 0x000372,[CaseUpper] = 0x000372}}, + {0x000376, {[CaseLower] = 0x000377,[CaseTitle] = 0x000376,[CaseUpper] = 0x000376}}, + {0x000377, {[CaseLower] = 0x000377,[CaseTitle] = 0x000376,[CaseUpper] = 0x000376}}, + {0x00037b, {[CaseLower] = 0x00037b,[CaseTitle] = 0x0003fd,[CaseUpper] = 0x0003fd}}, + {0x00037c, {[CaseLower] = 0x00037c,[CaseTitle] = 0x0003fe,[CaseUpper] = 0x0003fe}}, + {0x00037d, {[CaseLower] = 0x00037d,[CaseTitle] = 0x0003ff,[CaseUpper] = 0x0003ff}}, + {0x00037f, {[CaseLower] = 0x0003f3,[CaseTitle] = 0x00037f,[CaseUpper] = 0x00037f}}, + {0x000386, {[CaseLower] = 0x0003ac,[CaseTitle] = 0x000386,[CaseUpper] = 0x000386}}, + {0x000388, {[CaseLower] = 0x0003ad,[CaseTitle] = 0x000388,[CaseUpper] = 0x000388}}, + {0x000389, {[CaseLower] = 0x0003ae,[CaseTitle] = 0x000389,[CaseUpper] = 0x000389}}, + {0x00038a, {[CaseLower] = 0x0003af,[CaseTitle] = 0x00038a,[CaseUpper] = 0x00038a}}, + {0x00038c, {[CaseLower] = 0x0003cc,[CaseTitle] = 0x00038c,[CaseUpper] = 0x00038c}}, + {0x00038e, {[CaseLower] = 0x0003cd,[CaseTitle] = 0x00038e,[CaseUpper] = 0x00038e}}, + {0x00038f, {[CaseLower] = 0x0003ce,[CaseTitle] = 0x00038f,[CaseUpper] = 0x00038f}}, + {0x000391, {[CaseLower] = 0x0003b1,[CaseTitle] = 0x000391,[CaseUpper] = 0x000391}}, + {0x000392, {[CaseLower] = 0x0003b2,[CaseTitle] = 0x000392,[CaseUpper] = 0x000392}}, + {0x000393, {[CaseLower] = 0x0003b3,[CaseTitle] = 0x000393,[CaseUpper] = 0x000393}}, + {0x000394, {[CaseLower] = 0x0003b4,[CaseTitle] = 0x000394,[CaseUpper] = 0x000394}}, + {0x000395, {[CaseLower] = 0x0003b5,[CaseTitle] = 0x000395,[CaseUpper] = 0x000395}}, + {0x000396, {[CaseLower] = 0x0003b6,[CaseTitle] = 0x000396,[CaseUpper] = 0x000396}}, + {0x000397, {[CaseLower] = 0x0003b7,[CaseTitle] = 0x000397,[CaseUpper] = 0x000397}}, + {0x000398, {[CaseLower] = 0x0003b8,[CaseTitle] = 0x000398,[CaseUpper] = 0x000398}}, + {0x000399, {[CaseLower] = 0x0003b9,[CaseTitle] = 0x000399,[CaseUpper] = 0x000399}}, + {0x00039a, {[CaseLower] = 0x0003ba,[CaseTitle] = 0x00039a,[CaseUpper] = 0x00039a}}, + {0x00039b, {[CaseLower] = 0x0003bb,[CaseTitle] = 0x00039b,[CaseUpper] = 0x00039b}}, + {0x00039c, {[CaseLower] = 0x0003bc,[CaseTitle] = 0x00039c,[CaseUpper] = 0x00039c}}, + {0x00039d, {[CaseLower] = 0x0003bd,[CaseTitle] = 0x00039d,[CaseUpper] = 0x00039d}}, + {0x00039e, {[CaseLower] = 0x0003be,[CaseTitle] = 0x00039e,[CaseUpper] = 0x00039e}}, + {0x00039f, {[CaseLower] = 0x0003bf,[CaseTitle] = 0x00039f,[CaseUpper] = 0x00039f}}, + {0x0003a0, {[CaseLower] = 0x0003c0,[CaseTitle] = 0x0003a0,[CaseUpper] = 0x0003a0}}, + {0x0003a1, {[CaseLower] = 0x0003c1,[CaseTitle] = 0x0003a1,[CaseUpper] = 0x0003a1}}, + {0x0003a3, {[CaseLower] = 0x0003c3,[CaseTitle] = 0x0003a3,[CaseUpper] = 0x0003a3}}, + {0x0003a4, {[CaseLower] = 0x0003c4,[CaseTitle] = 0x0003a4,[CaseUpper] = 0x0003a4}}, + {0x0003a5, {[CaseLower] = 0x0003c5,[CaseTitle] = 0x0003a5,[CaseUpper] = 0x0003a5}}, + {0x0003a6, {[CaseLower] = 0x0003c6,[CaseTitle] = 0x0003a6,[CaseUpper] = 0x0003a6}}, + {0x0003a7, {[CaseLower] = 0x0003c7,[CaseTitle] = 0x0003a7,[CaseUpper] = 0x0003a7}}, + {0x0003a8, {[CaseLower] = 0x0003c8,[CaseTitle] = 0x0003a8,[CaseUpper] = 0x0003a8}}, + {0x0003a9, {[CaseLower] = 0x0003c9,[CaseTitle] = 0x0003a9,[CaseUpper] = 0x0003a9}}, + {0x0003aa, {[CaseLower] = 0x0003ca,[CaseTitle] = 0x0003aa,[CaseUpper] = 0x0003aa}}, + {0x0003ab, {[CaseLower] = 0x0003cb,[CaseTitle] = 0x0003ab,[CaseUpper] = 0x0003ab}}, + {0x0003ac, {[CaseLower] = 0x0003ac,[CaseTitle] = 0x000386,[CaseUpper] = 0x000386}}, + {0x0003ad, {[CaseLower] = 0x0003ad,[CaseTitle] = 0x000388,[CaseUpper] = 0x000388}}, + {0x0003ae, {[CaseLower] = 0x0003ae,[CaseTitle] = 0x000389,[CaseUpper] = 0x000389}}, + {0x0003af, {[CaseLower] = 0x0003af,[CaseTitle] = 0x00038a,[CaseUpper] = 0x00038a}}, + {0x0003b1, {[CaseLower] = 0x0003b1,[CaseTitle] = 0x000391,[CaseUpper] = 0x000391}}, + {0x0003b2, {[CaseLower] = 0x0003b2,[CaseTitle] = 0x000392,[CaseUpper] = 0x000392}}, + {0x0003b3, {[CaseLower] = 0x0003b3,[CaseTitle] = 0x000393,[CaseUpper] = 0x000393}}, + {0x0003b4, {[CaseLower] = 0x0003b4,[CaseTitle] = 0x000394,[CaseUpper] = 0x000394}}, + {0x0003b5, {[CaseLower] = 0x0003b5,[CaseTitle] = 0x000395,[CaseUpper] = 0x000395}}, + {0x0003b6, {[CaseLower] = 0x0003b6,[CaseTitle] = 0x000396,[CaseUpper] = 0x000396}}, + {0x0003b7, {[CaseLower] = 0x0003b7,[CaseTitle] = 0x000397,[CaseUpper] = 0x000397}}, + {0x0003b8, {[CaseLower] = 0x0003b8,[CaseTitle] = 0x000398,[CaseUpper] = 0x000398}}, + {0x0003b9, {[CaseLower] = 0x0003b9,[CaseTitle] = 0x000399,[CaseUpper] = 0x000399}}, + {0x0003ba, {[CaseLower] = 0x0003ba,[CaseTitle] = 0x00039a,[CaseUpper] = 0x00039a}}, + {0x0003bb, {[CaseLower] = 0x0003bb,[CaseTitle] = 0x00039b,[CaseUpper] = 0x00039b}}, + {0x0003bc, {[CaseLower] = 0x0003bc,[CaseTitle] = 0x00039c,[CaseUpper] = 0x00039c}}, + {0x0003bd, {[CaseLower] = 0x0003bd,[CaseTitle] = 0x00039d,[CaseUpper] = 0x00039d}}, + {0x0003be, {[CaseLower] = 0x0003be,[CaseTitle] = 0x00039e,[CaseUpper] = 0x00039e}}, + {0x0003bf, {[CaseLower] = 0x0003bf,[CaseTitle] = 0x00039f,[CaseUpper] = 0x00039f}}, + {0x0003c0, {[CaseLower] = 0x0003c0,[CaseTitle] = 0x0003a0,[CaseUpper] = 0x0003a0}}, + {0x0003c1, {[CaseLower] = 0x0003c1,[CaseTitle] = 0x0003a1,[CaseUpper] = 0x0003a1}}, + {0x0003c2, {[CaseLower] = 0x0003c2,[CaseTitle] = 0x0003a3,[CaseUpper] = 0x0003a3}}, + {0x0003c3, {[CaseLower] = 0x0003c3,[CaseTitle] = 0x0003a3,[CaseUpper] = 0x0003a3}}, + {0x0003c4, {[CaseLower] = 0x0003c4,[CaseTitle] = 0x0003a4,[CaseUpper] = 0x0003a4}}, + {0x0003c5, {[CaseLower] = 0x0003c5,[CaseTitle] = 0x0003a5,[CaseUpper] = 0x0003a5}}, + {0x0003c6, {[CaseLower] = 0x0003c6,[CaseTitle] = 0x0003a6,[CaseUpper] = 0x0003a6}}, + {0x0003c7, {[CaseLower] = 0x0003c7,[CaseTitle] = 0x0003a7,[CaseUpper] = 0x0003a7}}, + {0x0003c8, {[CaseLower] = 0x0003c8,[CaseTitle] = 0x0003a8,[CaseUpper] = 0x0003a8}}, + {0x0003c9, {[CaseLower] = 0x0003c9,[CaseTitle] = 0x0003a9,[CaseUpper] = 0x0003a9}}, + {0x0003ca, {[CaseLower] = 0x0003ca,[CaseTitle] = 0x0003aa,[CaseUpper] = 0x0003aa}}, + {0x0003cb, {[CaseLower] = 0x0003cb,[CaseTitle] = 0x0003ab,[CaseUpper] = 0x0003ab}}, + {0x0003cc, {[CaseLower] = 0x0003cc,[CaseTitle] = 0x00038c,[CaseUpper] = 0x00038c}}, + {0x0003cd, {[CaseLower] = 0x0003cd,[CaseTitle] = 0x00038e,[CaseUpper] = 0x00038e}}, + {0x0003ce, {[CaseLower] = 0x0003ce,[CaseTitle] = 0x00038f,[CaseUpper] = 0x00038f}}, + {0x0003cf, {[CaseLower] = 0x0003d7,[CaseTitle] = 0x0003cf,[CaseUpper] = 0x0003cf}}, + {0x0003d0, {[CaseLower] = 0x0003d0,[CaseTitle] = 0x000392,[CaseUpper] = 0x000392}}, + {0x0003d1, {[CaseLower] = 0x0003d1,[CaseTitle] = 0x000398,[CaseUpper] = 0x000398}}, + {0x0003d5, {[CaseLower] = 0x0003d5,[CaseTitle] = 0x0003a6,[CaseUpper] = 0x0003a6}}, + {0x0003d6, {[CaseLower] = 0x0003d6,[CaseTitle] = 0x0003a0,[CaseUpper] = 0x0003a0}}, + {0x0003d7, {[CaseLower] = 0x0003d7,[CaseTitle] = 0x0003cf,[CaseUpper] = 0x0003cf}}, + {0x0003d8, {[CaseLower] = 0x0003d9,[CaseTitle] = 0x0003d8,[CaseUpper] = 0x0003d8}}, + {0x0003d9, {[CaseLower] = 0x0003d9,[CaseTitle] = 0x0003d8,[CaseUpper] = 0x0003d8}}, + {0x0003da, {[CaseLower] = 0x0003db,[CaseTitle] = 0x0003da,[CaseUpper] = 0x0003da}}, + {0x0003db, {[CaseLower] = 0x0003db,[CaseTitle] = 0x0003da,[CaseUpper] = 0x0003da}}, + {0x0003dc, {[CaseLower] = 0x0003dd,[CaseTitle] = 0x0003dc,[CaseUpper] = 0x0003dc}}, + {0x0003dd, {[CaseLower] = 0x0003dd,[CaseTitle] = 0x0003dc,[CaseUpper] = 0x0003dc}}, + {0x0003de, {[CaseLower] = 0x0003df,[CaseTitle] = 0x0003de,[CaseUpper] = 0x0003de}}, + {0x0003df, {[CaseLower] = 0x0003df,[CaseTitle] = 0x0003de,[CaseUpper] = 0x0003de}}, + {0x0003e0, {[CaseLower] = 0x0003e1,[CaseTitle] = 0x0003e0,[CaseUpper] = 0x0003e0}}, + {0x0003e1, {[CaseLower] = 0x0003e1,[CaseTitle] = 0x0003e0,[CaseUpper] = 0x0003e0}}, + {0x0003e2, {[CaseLower] = 0x0003e3,[CaseTitle] = 0x0003e2,[CaseUpper] = 0x0003e2}}, + {0x0003e3, {[CaseLower] = 0x0003e3,[CaseTitle] = 0x0003e2,[CaseUpper] = 0x0003e2}}, + {0x0003e4, {[CaseLower] = 0x0003e5,[CaseTitle] = 0x0003e4,[CaseUpper] = 0x0003e4}}, + {0x0003e5, {[CaseLower] = 0x0003e5,[CaseTitle] = 0x0003e4,[CaseUpper] = 0x0003e4}}, + {0x0003e6, {[CaseLower] = 0x0003e7,[CaseTitle] = 0x0003e6,[CaseUpper] = 0x0003e6}}, + {0x0003e7, {[CaseLower] = 0x0003e7,[CaseTitle] = 0x0003e6,[CaseUpper] = 0x0003e6}}, + {0x0003e8, {[CaseLower] = 0x0003e9,[CaseTitle] = 0x0003e8,[CaseUpper] = 0x0003e8}}, + {0x0003e9, {[CaseLower] = 0x0003e9,[CaseTitle] = 0x0003e8,[CaseUpper] = 0x0003e8}}, + {0x0003ea, {[CaseLower] = 0x0003eb,[CaseTitle] = 0x0003ea,[CaseUpper] = 0x0003ea}}, + {0x0003eb, {[CaseLower] = 0x0003eb,[CaseTitle] = 0x0003ea,[CaseUpper] = 0x0003ea}}, + {0x0003ec, {[CaseLower] = 0x0003ed,[CaseTitle] = 0x0003ec,[CaseUpper] = 0x0003ec}}, + {0x0003ed, {[CaseLower] = 0x0003ed,[CaseTitle] = 0x0003ec,[CaseUpper] = 0x0003ec}}, + {0x0003ee, {[CaseLower] = 0x0003ef,[CaseTitle] = 0x0003ee,[CaseUpper] = 0x0003ee}}, + {0x0003ef, {[CaseLower] = 0x0003ef,[CaseTitle] = 0x0003ee,[CaseUpper] = 0x0003ee}}, + {0x0003f0, {[CaseLower] = 0x0003f0,[CaseTitle] = 0x00039a,[CaseUpper] = 0x00039a}}, + {0x0003f1, {[CaseLower] = 0x0003f1,[CaseTitle] = 0x0003a1,[CaseUpper] = 0x0003a1}}, + {0x0003f2, {[CaseLower] = 0x0003f2,[CaseTitle] = 0x0003f9,[CaseUpper] = 0x0003f9}}, + {0x0003f3, {[CaseLower] = 0x0003f3,[CaseTitle] = 0x00037f,[CaseUpper] = 0x00037f}}, + {0x0003f4, {[CaseLower] = 0x0003b8,[CaseTitle] = 0x0003f4,[CaseUpper] = 0x0003f4}}, + {0x0003f5, {[CaseLower] = 0x0003f5,[CaseTitle] = 0x000395,[CaseUpper] = 0x000395}}, + {0x0003f7, {[CaseLower] = 0x0003f8,[CaseTitle] = 0x0003f7,[CaseUpper] = 0x0003f7}}, + {0x0003f8, {[CaseLower] = 0x0003f8,[CaseTitle] = 0x0003f7,[CaseUpper] = 0x0003f7}}, + {0x0003f9, {[CaseLower] = 0x0003f2,[CaseTitle] = 0x0003f9,[CaseUpper] = 0x0003f9}}, + {0x0003fa, {[CaseLower] = 0x0003fb,[CaseTitle] = 0x0003fa,[CaseUpper] = 0x0003fa}}, + {0x0003fb, {[CaseLower] = 0x0003fb,[CaseTitle] = 0x0003fa,[CaseUpper] = 0x0003fa}}, + {0x0003fd, {[CaseLower] = 0x00037b,[CaseTitle] = 0x0003fd,[CaseUpper] = 0x0003fd}}, + {0x0003fe, {[CaseLower] = 0x00037c,[CaseTitle] = 0x0003fe,[CaseUpper] = 0x0003fe}}, + {0x0003ff, {[CaseLower] = 0x00037d,[CaseTitle] = 0x0003ff,[CaseUpper] = 0x0003ff}}, + {0x000400, {[CaseLower] = 0x000450,[CaseTitle] = 0x000400,[CaseUpper] = 0x000400}}, + {0x000401, {[CaseLower] = 0x000451,[CaseTitle] = 0x000401,[CaseUpper] = 0x000401}}, + {0x000402, {[CaseLower] = 0x000452,[CaseTitle] = 0x000402,[CaseUpper] = 0x000402}}, + {0x000403, {[CaseLower] = 0x000453,[CaseTitle] = 0x000403,[CaseUpper] = 0x000403}}, + {0x000404, {[CaseLower] = 0x000454,[CaseTitle] = 0x000404,[CaseUpper] = 0x000404}}, + {0x000405, {[CaseLower] = 0x000455,[CaseTitle] = 0x000405,[CaseUpper] = 0x000405}}, + {0x000406, {[CaseLower] = 0x000456,[CaseTitle] = 0x000406,[CaseUpper] = 0x000406}}, + {0x000407, {[CaseLower] = 0x000457,[CaseTitle] = 0x000407,[CaseUpper] = 0x000407}}, + {0x000408, {[CaseLower] = 0x000458,[CaseTitle] = 0x000408,[CaseUpper] = 0x000408}}, + {0x000409, {[CaseLower] = 0x000459,[CaseTitle] = 0x000409,[CaseUpper] = 0x000409}}, + {0x00040a, {[CaseLower] = 0x00045a,[CaseTitle] = 0x00040a,[CaseUpper] = 0x00040a}}, + {0x00040b, {[CaseLower] = 0x00045b,[CaseTitle] = 0x00040b,[CaseUpper] = 0x00040b}}, + {0x00040c, {[CaseLower] = 0x00045c,[CaseTitle] = 0x00040c,[CaseUpper] = 0x00040c}}, + {0x00040d, {[CaseLower] = 0x00045d,[CaseTitle] = 0x00040d,[CaseUpper] = 0x00040d}}, + {0x00040e, {[CaseLower] = 0x00045e,[CaseTitle] = 0x00040e,[CaseUpper] = 0x00040e}}, + {0x00040f, {[CaseLower] = 0x00045f,[CaseTitle] = 0x00040f,[CaseUpper] = 0x00040f}}, + {0x000410, {[CaseLower] = 0x000430,[CaseTitle] = 0x000410,[CaseUpper] = 0x000410}}, + {0x000411, {[CaseLower] = 0x000431,[CaseTitle] = 0x000411,[CaseUpper] = 0x000411}}, + {0x000412, {[CaseLower] = 0x000432,[CaseTitle] = 0x000412,[CaseUpper] = 0x000412}}, + {0x000413, {[CaseLower] = 0x000433,[CaseTitle] = 0x000413,[CaseUpper] = 0x000413}}, + {0x000414, {[CaseLower] = 0x000434,[CaseTitle] = 0x000414,[CaseUpper] = 0x000414}}, + {0x000415, {[CaseLower] = 0x000435,[CaseTitle] = 0x000415,[CaseUpper] = 0x000415}}, + {0x000416, {[CaseLower] = 0x000436,[CaseTitle] = 0x000416,[CaseUpper] = 0x000416}}, + {0x000417, {[CaseLower] = 0x000437,[CaseTitle] = 0x000417,[CaseUpper] = 0x000417}}, + {0x000418, {[CaseLower] = 0x000438,[CaseTitle] = 0x000418,[CaseUpper] = 0x000418}}, + {0x000419, {[CaseLower] = 0x000439,[CaseTitle] = 0x000419,[CaseUpper] = 0x000419}}, + {0x00041a, {[CaseLower] = 0x00043a,[CaseTitle] = 0x00041a,[CaseUpper] = 0x00041a}}, + {0x00041b, {[CaseLower] = 0x00043b,[CaseTitle] = 0x00041b,[CaseUpper] = 0x00041b}}, + {0x00041c, {[CaseLower] = 0x00043c,[CaseTitle] = 0x00041c,[CaseUpper] = 0x00041c}}, + {0x00041d, {[CaseLower] = 0x00043d,[CaseTitle] = 0x00041d,[CaseUpper] = 0x00041d}}, + {0x00041e, {[CaseLower] = 0x00043e,[CaseTitle] = 0x00041e,[CaseUpper] = 0x00041e}}, + {0x00041f, {[CaseLower] = 0x00043f,[CaseTitle] = 0x00041f,[CaseUpper] = 0x00041f}}, + {0x000420, {[CaseLower] = 0x000440,[CaseTitle] = 0x000420,[CaseUpper] = 0x000420}}, + {0x000421, {[CaseLower] = 0x000441,[CaseTitle] = 0x000421,[CaseUpper] = 0x000421}}, + {0x000422, {[CaseLower] = 0x000442,[CaseTitle] = 0x000422,[CaseUpper] = 0x000422}}, + {0x000423, {[CaseLower] = 0x000443,[CaseTitle] = 0x000423,[CaseUpper] = 0x000423}}, + {0x000424, {[CaseLower] = 0x000444,[CaseTitle] = 0x000424,[CaseUpper] = 0x000424}}, + {0x000425, {[CaseLower] = 0x000445,[CaseTitle] = 0x000425,[CaseUpper] = 0x000425}}, + {0x000426, {[CaseLower] = 0x000446,[CaseTitle] = 0x000426,[CaseUpper] = 0x000426}}, + {0x000427, {[CaseLower] = 0x000447,[CaseTitle] = 0x000427,[CaseUpper] = 0x000427}}, + {0x000428, {[CaseLower] = 0x000448,[CaseTitle] = 0x000428,[CaseUpper] = 0x000428}}, + {0x000429, {[CaseLower] = 0x000449,[CaseTitle] = 0x000429,[CaseUpper] = 0x000429}}, + {0x00042a, {[CaseLower] = 0x00044a,[CaseTitle] = 0x00042a,[CaseUpper] = 0x00042a}}, + {0x00042b, {[CaseLower] = 0x00044b,[CaseTitle] = 0x00042b,[CaseUpper] = 0x00042b}}, + {0x00042c, {[CaseLower] = 0x00044c,[CaseTitle] = 0x00042c,[CaseUpper] = 0x00042c}}, + {0x00042d, {[CaseLower] = 0x00044d,[CaseTitle] = 0x00042d,[CaseUpper] = 0x00042d}}, + {0x00042e, {[CaseLower] = 0x00044e,[CaseTitle] = 0x00042e,[CaseUpper] = 0x00042e}}, + {0x00042f, {[CaseLower] = 0x00044f,[CaseTitle] = 0x00042f,[CaseUpper] = 0x00042f}}, + {0x000430, {[CaseLower] = 0x000430,[CaseTitle] = 0x000410,[CaseUpper] = 0x000410}}, + {0x000431, {[CaseLower] = 0x000431,[CaseTitle] = 0x000411,[CaseUpper] = 0x000411}}, + {0x000432, {[CaseLower] = 0x000432,[CaseTitle] = 0x000412,[CaseUpper] = 0x000412}}, + {0x000433, {[CaseLower] = 0x000433,[CaseTitle] = 0x000413,[CaseUpper] = 0x000413}}, + {0x000434, {[CaseLower] = 0x000434,[CaseTitle] = 0x000414,[CaseUpper] = 0x000414}}, + {0x000435, {[CaseLower] = 0x000435,[CaseTitle] = 0x000415,[CaseUpper] = 0x000415}}, + {0x000436, {[CaseLower] = 0x000436,[CaseTitle] = 0x000416,[CaseUpper] = 0x000416}}, + {0x000437, {[CaseLower] = 0x000437,[CaseTitle] = 0x000417,[CaseUpper] = 0x000417}}, + {0x000438, {[CaseLower] = 0x000438,[CaseTitle] = 0x000418,[CaseUpper] = 0x000418}}, + {0x000439, {[CaseLower] = 0x000439,[CaseTitle] = 0x000419,[CaseUpper] = 0x000419}}, + {0x00043a, {[CaseLower] = 0x00043a,[CaseTitle] = 0x00041a,[CaseUpper] = 0x00041a}}, + {0x00043b, {[CaseLower] = 0x00043b,[CaseTitle] = 0x00041b,[CaseUpper] = 0x00041b}}, + {0x00043c, {[CaseLower] = 0x00043c,[CaseTitle] = 0x00041c,[CaseUpper] = 0x00041c}}, + {0x00043d, {[CaseLower] = 0x00043d,[CaseTitle] = 0x00041d,[CaseUpper] = 0x00041d}}, + {0x00043e, {[CaseLower] = 0x00043e,[CaseTitle] = 0x00041e,[CaseUpper] = 0x00041e}}, + {0x00043f, {[CaseLower] = 0x00043f,[CaseTitle] = 0x00041f,[CaseUpper] = 0x00041f}}, + {0x000440, {[CaseLower] = 0x000440,[CaseTitle] = 0x000420,[CaseUpper] = 0x000420}}, + {0x000441, {[CaseLower] = 0x000441,[CaseTitle] = 0x000421,[CaseUpper] = 0x000421}}, + {0x000442, {[CaseLower] = 0x000442,[CaseTitle] = 0x000422,[CaseUpper] = 0x000422}}, + {0x000443, {[CaseLower] = 0x000443,[CaseTitle] = 0x000423,[CaseUpper] = 0x000423}}, + {0x000444, {[CaseLower] = 0x000444,[CaseTitle] = 0x000424,[CaseUpper] = 0x000424}}, + {0x000445, {[CaseLower] = 0x000445,[CaseTitle] = 0x000425,[CaseUpper] = 0x000425}}, + {0x000446, {[CaseLower] = 0x000446,[CaseTitle] = 0x000426,[CaseUpper] = 0x000426}}, + {0x000447, {[CaseLower] = 0x000447,[CaseTitle] = 0x000427,[CaseUpper] = 0x000427}}, + {0x000448, {[CaseLower] = 0x000448,[CaseTitle] = 0x000428,[CaseUpper] = 0x000428}}, + {0x000449, {[CaseLower] = 0x000449,[CaseTitle] = 0x000429,[CaseUpper] = 0x000429}}, + {0x00044a, {[CaseLower] = 0x00044a,[CaseTitle] = 0x00042a,[CaseUpper] = 0x00042a}}, + {0x00044b, {[CaseLower] = 0x00044b,[CaseTitle] = 0x00042b,[CaseUpper] = 0x00042b}}, + {0x00044c, {[CaseLower] = 0x00044c,[CaseTitle] = 0x00042c,[CaseUpper] = 0x00042c}}, + {0x00044d, {[CaseLower] = 0x00044d,[CaseTitle] = 0x00042d,[CaseUpper] = 0x00042d}}, + {0x00044e, {[CaseLower] = 0x00044e,[CaseTitle] = 0x00042e,[CaseUpper] = 0x00042e}}, + {0x00044f, {[CaseLower] = 0x00044f,[CaseTitle] = 0x00042f,[CaseUpper] = 0x00042f}}, + {0x000450, {[CaseLower] = 0x000450,[CaseTitle] = 0x000400,[CaseUpper] = 0x000400}}, + {0x000451, {[CaseLower] = 0x000451,[CaseTitle] = 0x000401,[CaseUpper] = 0x000401}}, + {0x000452, {[CaseLower] = 0x000452,[CaseTitle] = 0x000402,[CaseUpper] = 0x000402}}, + {0x000453, {[CaseLower] = 0x000453,[CaseTitle] = 0x000403,[CaseUpper] = 0x000403}}, + {0x000454, {[CaseLower] = 0x000454,[CaseTitle] = 0x000404,[CaseUpper] = 0x000404}}, + {0x000455, {[CaseLower] = 0x000455,[CaseTitle] = 0x000405,[CaseUpper] = 0x000405}}, + {0x000456, {[CaseLower] = 0x000456,[CaseTitle] = 0x000406,[CaseUpper] = 0x000406}}, + {0x000457, {[CaseLower] = 0x000457,[CaseTitle] = 0x000407,[CaseUpper] = 0x000407}}, + {0x000458, {[CaseLower] = 0x000458,[CaseTitle] = 0x000408,[CaseUpper] = 0x000408}}, + {0x000459, {[CaseLower] = 0x000459,[CaseTitle] = 0x000409,[CaseUpper] = 0x000409}}, + {0x00045a, {[CaseLower] = 0x00045a,[CaseTitle] = 0x00040a,[CaseUpper] = 0x00040a}}, + {0x00045b, {[CaseLower] = 0x00045b,[CaseTitle] = 0x00040b,[CaseUpper] = 0x00040b}}, + {0x00045c, {[CaseLower] = 0x00045c,[CaseTitle] = 0x00040c,[CaseUpper] = 0x00040c}}, + {0x00045d, {[CaseLower] = 0x00045d,[CaseTitle] = 0x00040d,[CaseUpper] = 0x00040d}}, + {0x00045e, {[CaseLower] = 0x00045e,[CaseTitle] = 0x00040e,[CaseUpper] = 0x00040e}}, + {0x00045f, {[CaseLower] = 0x00045f,[CaseTitle] = 0x00040f,[CaseUpper] = 0x00040f}}, + {0x000460, {[CaseLower] = 0x000461,[CaseTitle] = 0x000460,[CaseUpper] = 0x000460}}, + {0x000461, {[CaseLower] = 0x000461,[CaseTitle] = 0x000460,[CaseUpper] = 0x000460}}, + {0x000462, {[CaseLower] = 0x000463,[CaseTitle] = 0x000462,[CaseUpper] = 0x000462}}, + {0x000463, {[CaseLower] = 0x000463,[CaseTitle] = 0x000462,[CaseUpper] = 0x000462}}, + {0x000464, {[CaseLower] = 0x000465,[CaseTitle] = 0x000464,[CaseUpper] = 0x000464}}, + {0x000465, {[CaseLower] = 0x000465,[CaseTitle] = 0x000464,[CaseUpper] = 0x000464}}, + {0x000466, {[CaseLower] = 0x000467,[CaseTitle] = 0x000466,[CaseUpper] = 0x000466}}, + {0x000467, {[CaseLower] = 0x000467,[CaseTitle] = 0x000466,[CaseUpper] = 0x000466}}, + {0x000468, {[CaseLower] = 0x000469,[CaseTitle] = 0x000468,[CaseUpper] = 0x000468}}, + {0x000469, {[CaseLower] = 0x000469,[CaseTitle] = 0x000468,[CaseUpper] = 0x000468}}, + {0x00046a, {[CaseLower] = 0x00046b,[CaseTitle] = 0x00046a,[CaseUpper] = 0x00046a}}, + {0x00046b, {[CaseLower] = 0x00046b,[CaseTitle] = 0x00046a,[CaseUpper] = 0x00046a}}, + {0x00046c, {[CaseLower] = 0x00046d,[CaseTitle] = 0x00046c,[CaseUpper] = 0x00046c}}, + {0x00046d, {[CaseLower] = 0x00046d,[CaseTitle] = 0x00046c,[CaseUpper] = 0x00046c}}, + {0x00046e, {[CaseLower] = 0x00046f,[CaseTitle] = 0x00046e,[CaseUpper] = 0x00046e}}, + {0x00046f, {[CaseLower] = 0x00046f,[CaseTitle] = 0x00046e,[CaseUpper] = 0x00046e}}, + {0x000470, {[CaseLower] = 0x000471,[CaseTitle] = 0x000470,[CaseUpper] = 0x000470}}, + {0x000471, {[CaseLower] = 0x000471,[CaseTitle] = 0x000470,[CaseUpper] = 0x000470}}, + {0x000472, {[CaseLower] = 0x000473,[CaseTitle] = 0x000472,[CaseUpper] = 0x000472}}, + {0x000473, {[CaseLower] = 0x000473,[CaseTitle] = 0x000472,[CaseUpper] = 0x000472}}, + {0x000474, {[CaseLower] = 0x000475,[CaseTitle] = 0x000474,[CaseUpper] = 0x000474}}, + {0x000475, {[CaseLower] = 0x000475,[CaseTitle] = 0x000474,[CaseUpper] = 0x000474}}, + {0x000476, {[CaseLower] = 0x000477,[CaseTitle] = 0x000476,[CaseUpper] = 0x000476}}, + {0x000477, {[CaseLower] = 0x000477,[CaseTitle] = 0x000476,[CaseUpper] = 0x000476}}, + {0x000478, {[CaseLower] = 0x000479,[CaseTitle] = 0x000478,[CaseUpper] = 0x000478}}, + {0x000479, {[CaseLower] = 0x000479,[CaseTitle] = 0x000478,[CaseUpper] = 0x000478}}, + {0x00047a, {[CaseLower] = 0x00047b,[CaseTitle] = 0x00047a,[CaseUpper] = 0x00047a}}, + {0x00047b, {[CaseLower] = 0x00047b,[CaseTitle] = 0x00047a,[CaseUpper] = 0x00047a}}, + {0x00047c, {[CaseLower] = 0x00047d,[CaseTitle] = 0x00047c,[CaseUpper] = 0x00047c}}, + {0x00047d, {[CaseLower] = 0x00047d,[CaseTitle] = 0x00047c,[CaseUpper] = 0x00047c}}, + {0x00047e, {[CaseLower] = 0x00047f,[CaseTitle] = 0x00047e,[CaseUpper] = 0x00047e}}, + {0x00047f, {[CaseLower] = 0x00047f,[CaseTitle] = 0x00047e,[CaseUpper] = 0x00047e}}, + {0x000480, {[CaseLower] = 0x000481,[CaseTitle] = 0x000480,[CaseUpper] = 0x000480}}, + {0x000481, {[CaseLower] = 0x000481,[CaseTitle] = 0x000480,[CaseUpper] = 0x000480}}, + {0x00048a, {[CaseLower] = 0x00048b,[CaseTitle] = 0x00048a,[CaseUpper] = 0x00048a}}, + {0x00048b, {[CaseLower] = 0x00048b,[CaseTitle] = 0x00048a,[CaseUpper] = 0x00048a}}, + {0x00048c, {[CaseLower] = 0x00048d,[CaseTitle] = 0x00048c,[CaseUpper] = 0x00048c}}, + {0x00048d, {[CaseLower] = 0x00048d,[CaseTitle] = 0x00048c,[CaseUpper] = 0x00048c}}, + {0x00048e, {[CaseLower] = 0x00048f,[CaseTitle] = 0x00048e,[CaseUpper] = 0x00048e}}, + {0x00048f, {[CaseLower] = 0x00048f,[CaseTitle] = 0x00048e,[CaseUpper] = 0x00048e}}, + {0x000490, {[CaseLower] = 0x000491,[CaseTitle] = 0x000490,[CaseUpper] = 0x000490}}, + {0x000491, {[CaseLower] = 0x000491,[CaseTitle] = 0x000490,[CaseUpper] = 0x000490}}, + {0x000492, {[CaseLower] = 0x000493,[CaseTitle] = 0x000492,[CaseUpper] = 0x000492}}, + {0x000493, {[CaseLower] = 0x000493,[CaseTitle] = 0x000492,[CaseUpper] = 0x000492}}, + {0x000494, {[CaseLower] = 0x000495,[CaseTitle] = 0x000494,[CaseUpper] = 0x000494}}, + {0x000495, {[CaseLower] = 0x000495,[CaseTitle] = 0x000494,[CaseUpper] = 0x000494}}, + {0x000496, {[CaseLower] = 0x000497,[CaseTitle] = 0x000496,[CaseUpper] = 0x000496}}, + {0x000497, {[CaseLower] = 0x000497,[CaseTitle] = 0x000496,[CaseUpper] = 0x000496}}, + {0x000498, {[CaseLower] = 0x000499,[CaseTitle] = 0x000498,[CaseUpper] = 0x000498}}, + {0x000499, {[CaseLower] = 0x000499,[CaseTitle] = 0x000498,[CaseUpper] = 0x000498}}, + {0x00049a, {[CaseLower] = 0x00049b,[CaseTitle] = 0x00049a,[CaseUpper] = 0x00049a}}, + {0x00049b, {[CaseLower] = 0x00049b,[CaseTitle] = 0x00049a,[CaseUpper] = 0x00049a}}, + {0x00049c, {[CaseLower] = 0x00049d,[CaseTitle] = 0x00049c,[CaseUpper] = 0x00049c}}, + {0x00049d, {[CaseLower] = 0x00049d,[CaseTitle] = 0x00049c,[CaseUpper] = 0x00049c}}, + {0x00049e, {[CaseLower] = 0x00049f,[CaseTitle] = 0x00049e,[CaseUpper] = 0x00049e}}, + {0x00049f, {[CaseLower] = 0x00049f,[CaseTitle] = 0x00049e,[CaseUpper] = 0x00049e}}, + {0x0004a0, {[CaseLower] = 0x0004a1,[CaseTitle] = 0x0004a0,[CaseUpper] = 0x0004a0}}, + {0x0004a1, {[CaseLower] = 0x0004a1,[CaseTitle] = 0x0004a0,[CaseUpper] = 0x0004a0}}, + {0x0004a2, {[CaseLower] = 0x0004a3,[CaseTitle] = 0x0004a2,[CaseUpper] = 0x0004a2}}, + {0x0004a3, {[CaseLower] = 0x0004a3,[CaseTitle] = 0x0004a2,[CaseUpper] = 0x0004a2}}, + {0x0004a4, {[CaseLower] = 0x0004a5,[CaseTitle] = 0x0004a4,[CaseUpper] = 0x0004a4}}, + {0x0004a5, {[CaseLower] = 0x0004a5,[CaseTitle] = 0x0004a4,[CaseUpper] = 0x0004a4}}, + {0x0004a6, {[CaseLower] = 0x0004a7,[CaseTitle] = 0x0004a6,[CaseUpper] = 0x0004a6}}, + {0x0004a7, {[CaseLower] = 0x0004a7,[CaseTitle] = 0x0004a6,[CaseUpper] = 0x0004a6}}, + {0x0004a8, {[CaseLower] = 0x0004a9,[CaseTitle] = 0x0004a8,[CaseUpper] = 0x0004a8}}, + {0x0004a9, {[CaseLower] = 0x0004a9,[CaseTitle] = 0x0004a8,[CaseUpper] = 0x0004a8}}, + {0x0004aa, {[CaseLower] = 0x0004ab,[CaseTitle] = 0x0004aa,[CaseUpper] = 0x0004aa}}, + {0x0004ab, {[CaseLower] = 0x0004ab,[CaseTitle] = 0x0004aa,[CaseUpper] = 0x0004aa}}, + {0x0004ac, {[CaseLower] = 0x0004ad,[CaseTitle] = 0x0004ac,[CaseUpper] = 0x0004ac}}, + {0x0004ad, {[CaseLower] = 0x0004ad,[CaseTitle] = 0x0004ac,[CaseUpper] = 0x0004ac}}, + {0x0004ae, {[CaseLower] = 0x0004af,[CaseTitle] = 0x0004ae,[CaseUpper] = 0x0004ae}}, + {0x0004af, {[CaseLower] = 0x0004af,[CaseTitle] = 0x0004ae,[CaseUpper] = 0x0004ae}}, + {0x0004b0, {[CaseLower] = 0x0004b1,[CaseTitle] = 0x0004b0,[CaseUpper] = 0x0004b0}}, + {0x0004b1, {[CaseLower] = 0x0004b1,[CaseTitle] = 0x0004b0,[CaseUpper] = 0x0004b0}}, + {0x0004b2, {[CaseLower] = 0x0004b3,[CaseTitle] = 0x0004b2,[CaseUpper] = 0x0004b2}}, + {0x0004b3, {[CaseLower] = 0x0004b3,[CaseTitle] = 0x0004b2,[CaseUpper] = 0x0004b2}}, + {0x0004b4, {[CaseLower] = 0x0004b5,[CaseTitle] = 0x0004b4,[CaseUpper] = 0x0004b4}}, + {0x0004b5, {[CaseLower] = 0x0004b5,[CaseTitle] = 0x0004b4,[CaseUpper] = 0x0004b4}}, + {0x0004b6, {[CaseLower] = 0x0004b7,[CaseTitle] = 0x0004b6,[CaseUpper] = 0x0004b6}}, + {0x0004b7, {[CaseLower] = 0x0004b7,[CaseTitle] = 0x0004b6,[CaseUpper] = 0x0004b6}}, + {0x0004b8, {[CaseLower] = 0x0004b9,[CaseTitle] = 0x0004b8,[CaseUpper] = 0x0004b8}}, + {0x0004b9, {[CaseLower] = 0x0004b9,[CaseTitle] = 0x0004b8,[CaseUpper] = 0x0004b8}}, + {0x0004ba, {[CaseLower] = 0x0004bb,[CaseTitle] = 0x0004ba,[CaseUpper] = 0x0004ba}}, + {0x0004bb, {[CaseLower] = 0x0004bb,[CaseTitle] = 0x0004ba,[CaseUpper] = 0x0004ba}}, + {0x0004bc, {[CaseLower] = 0x0004bd,[CaseTitle] = 0x0004bc,[CaseUpper] = 0x0004bc}}, + {0x0004bd, {[CaseLower] = 0x0004bd,[CaseTitle] = 0x0004bc,[CaseUpper] = 0x0004bc}}, + {0x0004be, {[CaseLower] = 0x0004bf,[CaseTitle] = 0x0004be,[CaseUpper] = 0x0004be}}, + {0x0004bf, {[CaseLower] = 0x0004bf,[CaseTitle] = 0x0004be,[CaseUpper] = 0x0004be}}, + {0x0004c0, {[CaseLower] = 0x0004cf,[CaseTitle] = 0x0004c0,[CaseUpper] = 0x0004c0}}, + {0x0004c1, {[CaseLower] = 0x0004c2,[CaseTitle] = 0x0004c1,[CaseUpper] = 0x0004c1}}, + {0x0004c2, {[CaseLower] = 0x0004c2,[CaseTitle] = 0x0004c1,[CaseUpper] = 0x0004c1}}, + {0x0004c3, {[CaseLower] = 0x0004c4,[CaseTitle] = 0x0004c3,[CaseUpper] = 0x0004c3}}, + {0x0004c4, {[CaseLower] = 0x0004c4,[CaseTitle] = 0x0004c3,[CaseUpper] = 0x0004c3}}, + {0x0004c5, {[CaseLower] = 0x0004c6,[CaseTitle] = 0x0004c5,[CaseUpper] = 0x0004c5}}, + {0x0004c6, {[CaseLower] = 0x0004c6,[CaseTitle] = 0x0004c5,[CaseUpper] = 0x0004c5}}, + {0x0004c7, {[CaseLower] = 0x0004c8,[CaseTitle] = 0x0004c7,[CaseUpper] = 0x0004c7}}, + {0x0004c8, {[CaseLower] = 0x0004c8,[CaseTitle] = 0x0004c7,[CaseUpper] = 0x0004c7}}, + {0x0004c9, {[CaseLower] = 0x0004ca,[CaseTitle] = 0x0004c9,[CaseUpper] = 0x0004c9}}, + {0x0004ca, {[CaseLower] = 0x0004ca,[CaseTitle] = 0x0004c9,[CaseUpper] = 0x0004c9}}, + {0x0004cb, {[CaseLower] = 0x0004cc,[CaseTitle] = 0x0004cb,[CaseUpper] = 0x0004cb}}, + {0x0004cc, {[CaseLower] = 0x0004cc,[CaseTitle] = 0x0004cb,[CaseUpper] = 0x0004cb}}, + {0x0004cd, {[CaseLower] = 0x0004ce,[CaseTitle] = 0x0004cd,[CaseUpper] = 0x0004cd}}, + {0x0004ce, {[CaseLower] = 0x0004ce,[CaseTitle] = 0x0004cd,[CaseUpper] = 0x0004cd}}, + {0x0004cf, {[CaseLower] = 0x0004cf,[CaseTitle] = 0x0004c0,[CaseUpper] = 0x0004c0}}, + {0x0004d0, {[CaseLower] = 0x0004d1,[CaseTitle] = 0x0004d0,[CaseUpper] = 0x0004d0}}, + {0x0004d1, {[CaseLower] = 0x0004d1,[CaseTitle] = 0x0004d0,[CaseUpper] = 0x0004d0}}, + {0x0004d2, {[CaseLower] = 0x0004d3,[CaseTitle] = 0x0004d2,[CaseUpper] = 0x0004d2}}, + {0x0004d3, {[CaseLower] = 0x0004d3,[CaseTitle] = 0x0004d2,[CaseUpper] = 0x0004d2}}, + {0x0004d4, {[CaseLower] = 0x0004d5,[CaseTitle] = 0x0004d4,[CaseUpper] = 0x0004d4}}, + {0x0004d5, {[CaseLower] = 0x0004d5,[CaseTitle] = 0x0004d4,[CaseUpper] = 0x0004d4}}, + {0x0004d6, {[CaseLower] = 0x0004d7,[CaseTitle] = 0x0004d6,[CaseUpper] = 0x0004d6}}, + {0x0004d7, {[CaseLower] = 0x0004d7,[CaseTitle] = 0x0004d6,[CaseUpper] = 0x0004d6}}, + {0x0004d8, {[CaseLower] = 0x0004d9,[CaseTitle] = 0x0004d8,[CaseUpper] = 0x0004d8}}, + {0x0004d9, {[CaseLower] = 0x0004d9,[CaseTitle] = 0x0004d8,[CaseUpper] = 0x0004d8}}, + {0x0004da, {[CaseLower] = 0x0004db,[CaseTitle] = 0x0004da,[CaseUpper] = 0x0004da}}, + {0x0004db, {[CaseLower] = 0x0004db,[CaseTitle] = 0x0004da,[CaseUpper] = 0x0004da}}, + {0x0004dc, {[CaseLower] = 0x0004dd,[CaseTitle] = 0x0004dc,[CaseUpper] = 0x0004dc}}, + {0x0004dd, {[CaseLower] = 0x0004dd,[CaseTitle] = 0x0004dc,[CaseUpper] = 0x0004dc}}, + {0x0004de, {[CaseLower] = 0x0004df,[CaseTitle] = 0x0004de,[CaseUpper] = 0x0004de}}, + {0x0004df, {[CaseLower] = 0x0004df,[CaseTitle] = 0x0004de,[CaseUpper] = 0x0004de}}, + {0x0004e0, {[CaseLower] = 0x0004e1,[CaseTitle] = 0x0004e0,[CaseUpper] = 0x0004e0}}, + {0x0004e1, {[CaseLower] = 0x0004e1,[CaseTitle] = 0x0004e0,[CaseUpper] = 0x0004e0}}, + {0x0004e2, {[CaseLower] = 0x0004e3,[CaseTitle] = 0x0004e2,[CaseUpper] = 0x0004e2}}, + {0x0004e3, {[CaseLower] = 0x0004e3,[CaseTitle] = 0x0004e2,[CaseUpper] = 0x0004e2}}, + {0x0004e4, {[CaseLower] = 0x0004e5,[CaseTitle] = 0x0004e4,[CaseUpper] = 0x0004e4}}, + {0x0004e5, {[CaseLower] = 0x0004e5,[CaseTitle] = 0x0004e4,[CaseUpper] = 0x0004e4}}, + {0x0004e6, {[CaseLower] = 0x0004e7,[CaseTitle] = 0x0004e6,[CaseUpper] = 0x0004e6}}, + {0x0004e7, {[CaseLower] = 0x0004e7,[CaseTitle] = 0x0004e6,[CaseUpper] = 0x0004e6}}, + {0x0004e8, {[CaseLower] = 0x0004e9,[CaseTitle] = 0x0004e8,[CaseUpper] = 0x0004e8}}, + {0x0004e9, {[CaseLower] = 0x0004e9,[CaseTitle] = 0x0004e8,[CaseUpper] = 0x0004e8}}, + {0x0004ea, {[CaseLower] = 0x0004eb,[CaseTitle] = 0x0004ea,[CaseUpper] = 0x0004ea}}, + {0x0004eb, {[CaseLower] = 0x0004eb,[CaseTitle] = 0x0004ea,[CaseUpper] = 0x0004ea}}, + {0x0004ec, {[CaseLower] = 0x0004ed,[CaseTitle] = 0x0004ec,[CaseUpper] = 0x0004ec}}, + {0x0004ed, {[CaseLower] = 0x0004ed,[CaseTitle] = 0x0004ec,[CaseUpper] = 0x0004ec}}, + {0x0004ee, {[CaseLower] = 0x0004ef,[CaseTitle] = 0x0004ee,[CaseUpper] = 0x0004ee}}, + {0x0004ef, {[CaseLower] = 0x0004ef,[CaseTitle] = 0x0004ee,[CaseUpper] = 0x0004ee}}, + {0x0004f0, {[CaseLower] = 0x0004f1,[CaseTitle] = 0x0004f0,[CaseUpper] = 0x0004f0}}, + {0x0004f1, {[CaseLower] = 0x0004f1,[CaseTitle] = 0x0004f0,[CaseUpper] = 0x0004f0}}, + {0x0004f2, {[CaseLower] = 0x0004f3,[CaseTitle] = 0x0004f2,[CaseUpper] = 0x0004f2}}, + {0x0004f3, {[CaseLower] = 0x0004f3,[CaseTitle] = 0x0004f2,[CaseUpper] = 0x0004f2}}, + {0x0004f4, {[CaseLower] = 0x0004f5,[CaseTitle] = 0x0004f4,[CaseUpper] = 0x0004f4}}, + {0x0004f5, {[CaseLower] = 0x0004f5,[CaseTitle] = 0x0004f4,[CaseUpper] = 0x0004f4}}, + {0x0004f6, {[CaseLower] = 0x0004f7,[CaseTitle] = 0x0004f6,[CaseUpper] = 0x0004f6}}, + {0x0004f7, {[CaseLower] = 0x0004f7,[CaseTitle] = 0x0004f6,[CaseUpper] = 0x0004f6}}, + {0x0004f8, {[CaseLower] = 0x0004f9,[CaseTitle] = 0x0004f8,[CaseUpper] = 0x0004f8}}, + {0x0004f9, {[CaseLower] = 0x0004f9,[CaseTitle] = 0x0004f8,[CaseUpper] = 0x0004f8}}, + {0x0004fa, {[CaseLower] = 0x0004fb,[CaseTitle] = 0x0004fa,[CaseUpper] = 0x0004fa}}, + {0x0004fb, {[CaseLower] = 0x0004fb,[CaseTitle] = 0x0004fa,[CaseUpper] = 0x0004fa}}, + {0x0004fc, {[CaseLower] = 0x0004fd,[CaseTitle] = 0x0004fc,[CaseUpper] = 0x0004fc}}, + {0x0004fd, {[CaseLower] = 0x0004fd,[CaseTitle] = 0x0004fc,[CaseUpper] = 0x0004fc}}, + {0x0004fe, {[CaseLower] = 0x0004ff,[CaseTitle] = 0x0004fe,[CaseUpper] = 0x0004fe}}, + {0x0004ff, {[CaseLower] = 0x0004ff,[CaseTitle] = 0x0004fe,[CaseUpper] = 0x0004fe}}, + {0x000500, {[CaseLower] = 0x000501,[CaseTitle] = 0x000500,[CaseUpper] = 0x000500}}, + {0x000501, {[CaseLower] = 0x000501,[CaseTitle] = 0x000500,[CaseUpper] = 0x000500}}, + {0x000502, {[CaseLower] = 0x000503,[CaseTitle] = 0x000502,[CaseUpper] = 0x000502}}, + {0x000503, {[CaseLower] = 0x000503,[CaseTitle] = 0x000502,[CaseUpper] = 0x000502}}, + {0x000504, {[CaseLower] = 0x000505,[CaseTitle] = 0x000504,[CaseUpper] = 0x000504}}, + {0x000505, {[CaseLower] = 0x000505,[CaseTitle] = 0x000504,[CaseUpper] = 0x000504}}, + {0x000506, {[CaseLower] = 0x000507,[CaseTitle] = 0x000506,[CaseUpper] = 0x000506}}, + {0x000507, {[CaseLower] = 0x000507,[CaseTitle] = 0x000506,[CaseUpper] = 0x000506}}, + {0x000508, {[CaseLower] = 0x000509,[CaseTitle] = 0x000508,[CaseUpper] = 0x000508}}, + {0x000509, {[CaseLower] = 0x000509,[CaseTitle] = 0x000508,[CaseUpper] = 0x000508}}, + {0x00050a, {[CaseLower] = 0x00050b,[CaseTitle] = 0x00050a,[CaseUpper] = 0x00050a}}, + {0x00050b, {[CaseLower] = 0x00050b,[CaseTitle] = 0x00050a,[CaseUpper] = 0x00050a}}, + {0x00050c, {[CaseLower] = 0x00050d,[CaseTitle] = 0x00050c,[CaseUpper] = 0x00050c}}, + {0x00050d, {[CaseLower] = 0x00050d,[CaseTitle] = 0x00050c,[CaseUpper] = 0x00050c}}, + {0x00050e, {[CaseLower] = 0x00050f,[CaseTitle] = 0x00050e,[CaseUpper] = 0x00050e}}, + {0x00050f, {[CaseLower] = 0x00050f,[CaseTitle] = 0x00050e,[CaseUpper] = 0x00050e}}, + {0x000510, {[CaseLower] = 0x000511,[CaseTitle] = 0x000510,[CaseUpper] = 0x000510}}, + {0x000511, {[CaseLower] = 0x000511,[CaseTitle] = 0x000510,[CaseUpper] = 0x000510}}, + {0x000512, {[CaseLower] = 0x000513,[CaseTitle] = 0x000512,[CaseUpper] = 0x000512}}, + {0x000513, {[CaseLower] = 0x000513,[CaseTitle] = 0x000512,[CaseUpper] = 0x000512}}, + {0x000514, {[CaseLower] = 0x000515,[CaseTitle] = 0x000514,[CaseUpper] = 0x000514}}, + {0x000515, {[CaseLower] = 0x000515,[CaseTitle] = 0x000514,[CaseUpper] = 0x000514}}, + {0x000516, {[CaseLower] = 0x000517,[CaseTitle] = 0x000516,[CaseUpper] = 0x000516}}, + {0x000517, {[CaseLower] = 0x000517,[CaseTitle] = 0x000516,[CaseUpper] = 0x000516}}, + {0x000518, {[CaseLower] = 0x000519,[CaseTitle] = 0x000518,[CaseUpper] = 0x000518}}, + {0x000519, {[CaseLower] = 0x000519,[CaseTitle] = 0x000518,[CaseUpper] = 0x000518}}, + {0x00051a, {[CaseLower] = 0x00051b,[CaseTitle] = 0x00051a,[CaseUpper] = 0x00051a}}, + {0x00051b, {[CaseLower] = 0x00051b,[CaseTitle] = 0x00051a,[CaseUpper] = 0x00051a}}, + {0x00051c, {[CaseLower] = 0x00051d,[CaseTitle] = 0x00051c,[CaseUpper] = 0x00051c}}, + {0x00051d, {[CaseLower] = 0x00051d,[CaseTitle] = 0x00051c,[CaseUpper] = 0x00051c}}, + {0x00051e, {[CaseLower] = 0x00051f,[CaseTitle] = 0x00051e,[CaseUpper] = 0x00051e}}, + {0x00051f, {[CaseLower] = 0x00051f,[CaseTitle] = 0x00051e,[CaseUpper] = 0x00051e}}, + {0x000520, {[CaseLower] = 0x000521,[CaseTitle] = 0x000520,[CaseUpper] = 0x000520}}, + {0x000521, {[CaseLower] = 0x000521,[CaseTitle] = 0x000520,[CaseUpper] = 0x000520}}, + {0x000522, {[CaseLower] = 0x000523,[CaseTitle] = 0x000522,[CaseUpper] = 0x000522}}, + {0x000523, {[CaseLower] = 0x000523,[CaseTitle] = 0x000522,[CaseUpper] = 0x000522}}, + {0x000524, {[CaseLower] = 0x000525,[CaseTitle] = 0x000524,[CaseUpper] = 0x000524}}, + {0x000525, {[CaseLower] = 0x000525,[CaseTitle] = 0x000524,[CaseUpper] = 0x000524}}, + {0x000526, {[CaseLower] = 0x000527,[CaseTitle] = 0x000526,[CaseUpper] = 0x000526}}, + {0x000527, {[CaseLower] = 0x000527,[CaseTitle] = 0x000526,[CaseUpper] = 0x000526}}, + {0x000528, {[CaseLower] = 0x000529,[CaseTitle] = 0x000528,[CaseUpper] = 0x000528}}, + {0x000529, {[CaseLower] = 0x000529,[CaseTitle] = 0x000528,[CaseUpper] = 0x000528}}, + {0x00052a, {[CaseLower] = 0x00052b,[CaseTitle] = 0x00052a,[CaseUpper] = 0x00052a}}, + {0x00052b, {[CaseLower] = 0x00052b,[CaseTitle] = 0x00052a,[CaseUpper] = 0x00052a}}, + {0x00052c, {[CaseLower] = 0x00052d,[CaseTitle] = 0x00052c,[CaseUpper] = 0x00052c}}, + {0x00052d, {[CaseLower] = 0x00052d,[CaseTitle] = 0x00052c,[CaseUpper] = 0x00052c}}, + {0x00052e, {[CaseLower] = 0x00052f,[CaseTitle] = 0x00052e,[CaseUpper] = 0x00052e}}, + {0x00052f, {[CaseLower] = 0x00052f,[CaseTitle] = 0x00052e,[CaseUpper] = 0x00052e}}, + {0x000531, {[CaseLower] = 0x000561,[CaseTitle] = 0x000531,[CaseUpper] = 0x000531}}, + {0x000532, {[CaseLower] = 0x000562,[CaseTitle] = 0x000532,[CaseUpper] = 0x000532}}, + {0x000533, {[CaseLower] = 0x000563,[CaseTitle] = 0x000533,[CaseUpper] = 0x000533}}, + {0x000534, {[CaseLower] = 0x000564,[CaseTitle] = 0x000534,[CaseUpper] = 0x000534}}, + {0x000535, {[CaseLower] = 0x000565,[CaseTitle] = 0x000535,[CaseUpper] = 0x000535}}, + {0x000536, {[CaseLower] = 0x000566,[CaseTitle] = 0x000536,[CaseUpper] = 0x000536}}, + {0x000537, {[CaseLower] = 0x000567,[CaseTitle] = 0x000537,[CaseUpper] = 0x000537}}, + {0x000538, {[CaseLower] = 0x000568,[CaseTitle] = 0x000538,[CaseUpper] = 0x000538}}, + {0x000539, {[CaseLower] = 0x000569,[CaseTitle] = 0x000539,[CaseUpper] = 0x000539}}, + {0x00053a, {[CaseLower] = 0x00056a,[CaseTitle] = 0x00053a,[CaseUpper] = 0x00053a}}, + {0x00053b, {[CaseLower] = 0x00056b,[CaseTitle] = 0x00053b,[CaseUpper] = 0x00053b}}, + {0x00053c, {[CaseLower] = 0x00056c,[CaseTitle] = 0x00053c,[CaseUpper] = 0x00053c}}, + {0x00053d, {[CaseLower] = 0x00056d,[CaseTitle] = 0x00053d,[CaseUpper] = 0x00053d}}, + {0x00053e, {[CaseLower] = 0x00056e,[CaseTitle] = 0x00053e,[CaseUpper] = 0x00053e}}, + {0x00053f, {[CaseLower] = 0x00056f,[CaseTitle] = 0x00053f,[CaseUpper] = 0x00053f}}, + {0x000540, {[CaseLower] = 0x000570,[CaseTitle] = 0x000540,[CaseUpper] = 0x000540}}, + {0x000541, {[CaseLower] = 0x000571,[CaseTitle] = 0x000541,[CaseUpper] = 0x000541}}, + {0x000542, {[CaseLower] = 0x000572,[CaseTitle] = 0x000542,[CaseUpper] = 0x000542}}, + {0x000543, {[CaseLower] = 0x000573,[CaseTitle] = 0x000543,[CaseUpper] = 0x000543}}, + {0x000544, {[CaseLower] = 0x000574,[CaseTitle] = 0x000544,[CaseUpper] = 0x000544}}, + {0x000545, {[CaseLower] = 0x000575,[CaseTitle] = 0x000545,[CaseUpper] = 0x000545}}, + {0x000546, {[CaseLower] = 0x000576,[CaseTitle] = 0x000546,[CaseUpper] = 0x000546}}, + {0x000547, {[CaseLower] = 0x000577,[CaseTitle] = 0x000547,[CaseUpper] = 0x000547}}, + {0x000548, {[CaseLower] = 0x000578,[CaseTitle] = 0x000548,[CaseUpper] = 0x000548}}, + {0x000549, {[CaseLower] = 0x000579,[CaseTitle] = 0x000549,[CaseUpper] = 0x000549}}, + {0x00054a, {[CaseLower] = 0x00057a,[CaseTitle] = 0x00054a,[CaseUpper] = 0x00054a}}, + {0x00054b, {[CaseLower] = 0x00057b,[CaseTitle] = 0x00054b,[CaseUpper] = 0x00054b}}, + {0x00054c, {[CaseLower] = 0x00057c,[CaseTitle] = 0x00054c,[CaseUpper] = 0x00054c}}, + {0x00054d, {[CaseLower] = 0x00057d,[CaseTitle] = 0x00054d,[CaseUpper] = 0x00054d}}, + {0x00054e, {[CaseLower] = 0x00057e,[CaseTitle] = 0x00054e,[CaseUpper] = 0x00054e}}, + {0x00054f, {[CaseLower] = 0x00057f,[CaseTitle] = 0x00054f,[CaseUpper] = 0x00054f}}, + {0x000550, {[CaseLower] = 0x000580,[CaseTitle] = 0x000550,[CaseUpper] = 0x000550}}, + {0x000551, {[CaseLower] = 0x000581,[CaseTitle] = 0x000551,[CaseUpper] = 0x000551}}, + {0x000552, {[CaseLower] = 0x000582,[CaseTitle] = 0x000552,[CaseUpper] = 0x000552}}, + {0x000553, {[CaseLower] = 0x000583,[CaseTitle] = 0x000553,[CaseUpper] = 0x000553}}, + {0x000554, {[CaseLower] = 0x000584,[CaseTitle] = 0x000554,[CaseUpper] = 0x000554}}, + {0x000555, {[CaseLower] = 0x000585,[CaseTitle] = 0x000555,[CaseUpper] = 0x000555}}, + {0x000556, {[CaseLower] = 0x000586,[CaseTitle] = 0x000556,[CaseUpper] = 0x000556}}, + {0x000561, {[CaseLower] = 0x000561,[CaseTitle] = 0x000531,[CaseUpper] = 0x000531}}, + {0x000562, {[CaseLower] = 0x000562,[CaseTitle] = 0x000532,[CaseUpper] = 0x000532}}, + {0x000563, {[CaseLower] = 0x000563,[CaseTitle] = 0x000533,[CaseUpper] = 0x000533}}, + {0x000564, {[CaseLower] = 0x000564,[CaseTitle] = 0x000534,[CaseUpper] = 0x000534}}, + {0x000565, {[CaseLower] = 0x000565,[CaseTitle] = 0x000535,[CaseUpper] = 0x000535}}, + {0x000566, {[CaseLower] = 0x000566,[CaseTitle] = 0x000536,[CaseUpper] = 0x000536}}, + {0x000567, {[CaseLower] = 0x000567,[CaseTitle] = 0x000537,[CaseUpper] = 0x000537}}, + {0x000568, {[CaseLower] = 0x000568,[CaseTitle] = 0x000538,[CaseUpper] = 0x000538}}, + {0x000569, {[CaseLower] = 0x000569,[CaseTitle] = 0x000539,[CaseUpper] = 0x000539}}, + {0x00056a, {[CaseLower] = 0x00056a,[CaseTitle] = 0x00053a,[CaseUpper] = 0x00053a}}, + {0x00056b, {[CaseLower] = 0x00056b,[CaseTitle] = 0x00053b,[CaseUpper] = 0x00053b}}, + {0x00056c, {[CaseLower] = 0x00056c,[CaseTitle] = 0x00053c,[CaseUpper] = 0x00053c}}, + {0x00056d, {[CaseLower] = 0x00056d,[CaseTitle] = 0x00053d,[CaseUpper] = 0x00053d}}, + {0x00056e, {[CaseLower] = 0x00056e,[CaseTitle] = 0x00053e,[CaseUpper] = 0x00053e}}, + {0x00056f, {[CaseLower] = 0x00056f,[CaseTitle] = 0x00053f,[CaseUpper] = 0x00053f}}, + {0x000570, {[CaseLower] = 0x000570,[CaseTitle] = 0x000540,[CaseUpper] = 0x000540}}, + {0x000571, {[CaseLower] = 0x000571,[CaseTitle] = 0x000541,[CaseUpper] = 0x000541}}, + {0x000572, {[CaseLower] = 0x000572,[CaseTitle] = 0x000542,[CaseUpper] = 0x000542}}, + {0x000573, {[CaseLower] = 0x000573,[CaseTitle] = 0x000543,[CaseUpper] = 0x000543}}, + {0x000574, {[CaseLower] = 0x000574,[CaseTitle] = 0x000544,[CaseUpper] = 0x000544}}, + {0x000575, {[CaseLower] = 0x000575,[CaseTitle] = 0x000545,[CaseUpper] = 0x000545}}, + {0x000576, {[CaseLower] = 0x000576,[CaseTitle] = 0x000546,[CaseUpper] = 0x000546}}, + {0x000577, {[CaseLower] = 0x000577,[CaseTitle] = 0x000547,[CaseUpper] = 0x000547}}, + {0x000578, {[CaseLower] = 0x000578,[CaseTitle] = 0x000548,[CaseUpper] = 0x000548}}, + {0x000579, {[CaseLower] = 0x000579,[CaseTitle] = 0x000549,[CaseUpper] = 0x000549}}, + {0x00057a, {[CaseLower] = 0x00057a,[CaseTitle] = 0x00054a,[CaseUpper] = 0x00054a}}, + {0x00057b, {[CaseLower] = 0x00057b,[CaseTitle] = 0x00054b,[CaseUpper] = 0x00054b}}, + {0x00057c, {[CaseLower] = 0x00057c,[CaseTitle] = 0x00054c,[CaseUpper] = 0x00054c}}, + {0x00057d, {[CaseLower] = 0x00057d,[CaseTitle] = 0x00054d,[CaseUpper] = 0x00054d}}, + {0x00057e, {[CaseLower] = 0x00057e,[CaseTitle] = 0x00054e,[CaseUpper] = 0x00054e}}, + {0x00057f, {[CaseLower] = 0x00057f,[CaseTitle] = 0x00054f,[CaseUpper] = 0x00054f}}, + {0x000580, {[CaseLower] = 0x000580,[CaseTitle] = 0x000550,[CaseUpper] = 0x000550}}, + {0x000581, {[CaseLower] = 0x000581,[CaseTitle] = 0x000551,[CaseUpper] = 0x000551}}, + {0x000582, {[CaseLower] = 0x000582,[CaseTitle] = 0x000552,[CaseUpper] = 0x000552}}, + {0x000583, {[CaseLower] = 0x000583,[CaseTitle] = 0x000553,[CaseUpper] = 0x000553}}, + {0x000584, {[CaseLower] = 0x000584,[CaseTitle] = 0x000554,[CaseUpper] = 0x000554}}, + {0x000585, {[CaseLower] = 0x000585,[CaseTitle] = 0x000555,[CaseUpper] = 0x000555}}, + {0x000586, {[CaseLower] = 0x000586,[CaseTitle] = 0x000556,[CaseUpper] = 0x000556}}, + {0x0010a0, {[CaseLower] = 0x002d00,[CaseTitle] = 0x0010a0,[CaseUpper] = 0x0010a0}}, + {0x0010a1, {[CaseLower] = 0x002d01,[CaseTitle] = 0x0010a1,[CaseUpper] = 0x0010a1}}, + {0x0010a2, {[CaseLower] = 0x002d02,[CaseTitle] = 0x0010a2,[CaseUpper] = 0x0010a2}}, + {0x0010a3, {[CaseLower] = 0x002d03,[CaseTitle] = 0x0010a3,[CaseUpper] = 0x0010a3}}, + {0x0010a4, {[CaseLower] = 0x002d04,[CaseTitle] = 0x0010a4,[CaseUpper] = 0x0010a4}}, + {0x0010a5, {[CaseLower] = 0x002d05,[CaseTitle] = 0x0010a5,[CaseUpper] = 0x0010a5}}, + {0x0010a6, {[CaseLower] = 0x002d06,[CaseTitle] = 0x0010a6,[CaseUpper] = 0x0010a6}}, + {0x0010a7, {[CaseLower] = 0x002d07,[CaseTitle] = 0x0010a7,[CaseUpper] = 0x0010a7}}, + {0x0010a8, {[CaseLower] = 0x002d08,[CaseTitle] = 0x0010a8,[CaseUpper] = 0x0010a8}}, + {0x0010a9, {[CaseLower] = 0x002d09,[CaseTitle] = 0x0010a9,[CaseUpper] = 0x0010a9}}, + {0x0010aa, {[CaseLower] = 0x002d0a,[CaseTitle] = 0x0010aa,[CaseUpper] = 0x0010aa}}, + {0x0010ab, {[CaseLower] = 0x002d0b,[CaseTitle] = 0x0010ab,[CaseUpper] = 0x0010ab}}, + {0x0010ac, {[CaseLower] = 0x002d0c,[CaseTitle] = 0x0010ac,[CaseUpper] = 0x0010ac}}, + {0x0010ad, {[CaseLower] = 0x002d0d,[CaseTitle] = 0x0010ad,[CaseUpper] = 0x0010ad}}, + {0x0010ae, {[CaseLower] = 0x002d0e,[CaseTitle] = 0x0010ae,[CaseUpper] = 0x0010ae}}, + {0x0010af, {[CaseLower] = 0x002d0f,[CaseTitle] = 0x0010af,[CaseUpper] = 0x0010af}}, + {0x0010b0, {[CaseLower] = 0x002d10,[CaseTitle] = 0x0010b0,[CaseUpper] = 0x0010b0}}, + {0x0010b1, {[CaseLower] = 0x002d11,[CaseTitle] = 0x0010b1,[CaseUpper] = 0x0010b1}}, + {0x0010b2, {[CaseLower] = 0x002d12,[CaseTitle] = 0x0010b2,[CaseUpper] = 0x0010b2}}, + {0x0010b3, {[CaseLower] = 0x002d13,[CaseTitle] = 0x0010b3,[CaseUpper] = 0x0010b3}}, + {0x0010b4, {[CaseLower] = 0x002d14,[CaseTitle] = 0x0010b4,[CaseUpper] = 0x0010b4}}, + {0x0010b5, {[CaseLower] = 0x002d15,[CaseTitle] = 0x0010b5,[CaseUpper] = 0x0010b5}}, + {0x0010b6, {[CaseLower] = 0x002d16,[CaseTitle] = 0x0010b6,[CaseUpper] = 0x0010b6}}, + {0x0010b7, {[CaseLower] = 0x002d17,[CaseTitle] = 0x0010b7,[CaseUpper] = 0x0010b7}}, + {0x0010b8, {[CaseLower] = 0x002d18,[CaseTitle] = 0x0010b8,[CaseUpper] = 0x0010b8}}, + {0x0010b9, {[CaseLower] = 0x002d19,[CaseTitle] = 0x0010b9,[CaseUpper] = 0x0010b9}}, + {0x0010ba, {[CaseLower] = 0x002d1a,[CaseTitle] = 0x0010ba,[CaseUpper] = 0x0010ba}}, + {0x0010bb, {[CaseLower] = 0x002d1b,[CaseTitle] = 0x0010bb,[CaseUpper] = 0x0010bb}}, + {0x0010bc, {[CaseLower] = 0x002d1c,[CaseTitle] = 0x0010bc,[CaseUpper] = 0x0010bc}}, + {0x0010bd, {[CaseLower] = 0x002d1d,[CaseTitle] = 0x0010bd,[CaseUpper] = 0x0010bd}}, + {0x0010be, {[CaseLower] = 0x002d1e,[CaseTitle] = 0x0010be,[CaseUpper] = 0x0010be}}, + {0x0010bf, {[CaseLower] = 0x002d1f,[CaseTitle] = 0x0010bf,[CaseUpper] = 0x0010bf}}, + {0x0010c0, {[CaseLower] = 0x002d20,[CaseTitle] = 0x0010c0,[CaseUpper] = 0x0010c0}}, + {0x0010c1, {[CaseLower] = 0x002d21,[CaseTitle] = 0x0010c1,[CaseUpper] = 0x0010c1}}, + {0x0010c2, {[CaseLower] = 0x002d22,[CaseTitle] = 0x0010c2,[CaseUpper] = 0x0010c2}}, + {0x0010c3, {[CaseLower] = 0x002d23,[CaseTitle] = 0x0010c3,[CaseUpper] = 0x0010c3}}, + {0x0010c4, {[CaseLower] = 0x002d24,[CaseTitle] = 0x0010c4,[CaseUpper] = 0x0010c4}}, + {0x0010c5, {[CaseLower] = 0x002d25,[CaseTitle] = 0x0010c5,[CaseUpper] = 0x0010c5}}, + {0x0010c7, {[CaseLower] = 0x002d27,[CaseTitle] = 0x0010c7,[CaseUpper] = 0x0010c7}}, + {0x0010cd, {[CaseLower] = 0x002d2d,[CaseTitle] = 0x0010cd,[CaseUpper] = 0x0010cd}}, + {0x0010d0, {[CaseLower] = 0x0010d0,[CaseTitle] = 0x0010d0,[CaseUpper] = 0x001c90}}, + {0x0010d1, {[CaseLower] = 0x0010d1,[CaseTitle] = 0x0010d1,[CaseUpper] = 0x001c91}}, + {0x0010d2, {[CaseLower] = 0x0010d2,[CaseTitle] = 0x0010d2,[CaseUpper] = 0x001c92}}, + {0x0010d3, {[CaseLower] = 0x0010d3,[CaseTitle] = 0x0010d3,[CaseUpper] = 0x001c93}}, + {0x0010d4, {[CaseLower] = 0x0010d4,[CaseTitle] = 0x0010d4,[CaseUpper] = 0x001c94}}, + {0x0010d5, {[CaseLower] = 0x0010d5,[CaseTitle] = 0x0010d5,[CaseUpper] = 0x001c95}}, + {0x0010d6, {[CaseLower] = 0x0010d6,[CaseTitle] = 0x0010d6,[CaseUpper] = 0x001c96}}, + {0x0010d7, {[CaseLower] = 0x0010d7,[CaseTitle] = 0x0010d7,[CaseUpper] = 0x001c97}}, + {0x0010d8, {[CaseLower] = 0x0010d8,[CaseTitle] = 0x0010d8,[CaseUpper] = 0x001c98}}, + {0x0010d9, {[CaseLower] = 0x0010d9,[CaseTitle] = 0x0010d9,[CaseUpper] = 0x001c99}}, + {0x0010da, {[CaseLower] = 0x0010da,[CaseTitle] = 0x0010da,[CaseUpper] = 0x001c9a}}, + {0x0010db, {[CaseLower] = 0x0010db,[CaseTitle] = 0x0010db,[CaseUpper] = 0x001c9b}}, + {0x0010dc, {[CaseLower] = 0x0010dc,[CaseTitle] = 0x0010dc,[CaseUpper] = 0x001c9c}}, + {0x0010dd, {[CaseLower] = 0x0010dd,[CaseTitle] = 0x0010dd,[CaseUpper] = 0x001c9d}}, + {0x0010de, {[CaseLower] = 0x0010de,[CaseTitle] = 0x0010de,[CaseUpper] = 0x001c9e}}, + {0x0010df, {[CaseLower] = 0x0010df,[CaseTitle] = 0x0010df,[CaseUpper] = 0x001c9f}}, + {0x0010e0, {[CaseLower] = 0x0010e0,[CaseTitle] = 0x0010e0,[CaseUpper] = 0x001ca0}}, + {0x0010e1, {[CaseLower] = 0x0010e1,[CaseTitle] = 0x0010e1,[CaseUpper] = 0x001ca1}}, + {0x0010e2, {[CaseLower] = 0x0010e2,[CaseTitle] = 0x0010e2,[CaseUpper] = 0x001ca2}}, + {0x0010e3, {[CaseLower] = 0x0010e3,[CaseTitle] = 0x0010e3,[CaseUpper] = 0x001ca3}}, + {0x0010e4, {[CaseLower] = 0x0010e4,[CaseTitle] = 0x0010e4,[CaseUpper] = 0x001ca4}}, + {0x0010e5, {[CaseLower] = 0x0010e5,[CaseTitle] = 0x0010e5,[CaseUpper] = 0x001ca5}}, + {0x0010e6, {[CaseLower] = 0x0010e6,[CaseTitle] = 0x0010e6,[CaseUpper] = 0x001ca6}}, + {0x0010e7, {[CaseLower] = 0x0010e7,[CaseTitle] = 0x0010e7,[CaseUpper] = 0x001ca7}}, + {0x0010e8, {[CaseLower] = 0x0010e8,[CaseTitle] = 0x0010e8,[CaseUpper] = 0x001ca8}}, + {0x0010e9, {[CaseLower] = 0x0010e9,[CaseTitle] = 0x0010e9,[CaseUpper] = 0x001ca9}}, + {0x0010ea, {[CaseLower] = 0x0010ea,[CaseTitle] = 0x0010ea,[CaseUpper] = 0x001caa}}, + {0x0010eb, {[CaseLower] = 0x0010eb,[CaseTitle] = 0x0010eb,[CaseUpper] = 0x001cab}}, + {0x0010ec, {[CaseLower] = 0x0010ec,[CaseTitle] = 0x0010ec,[CaseUpper] = 0x001cac}}, + {0x0010ed, {[CaseLower] = 0x0010ed,[CaseTitle] = 0x0010ed,[CaseUpper] = 0x001cad}}, + {0x0010ee, {[CaseLower] = 0x0010ee,[CaseTitle] = 0x0010ee,[CaseUpper] = 0x001cae}}, + {0x0010ef, {[CaseLower] = 0x0010ef,[CaseTitle] = 0x0010ef,[CaseUpper] = 0x001caf}}, + {0x0010f0, {[CaseLower] = 0x0010f0,[CaseTitle] = 0x0010f0,[CaseUpper] = 0x001cb0}}, + {0x0010f1, {[CaseLower] = 0x0010f1,[CaseTitle] = 0x0010f1,[CaseUpper] = 0x001cb1}}, + {0x0010f2, {[CaseLower] = 0x0010f2,[CaseTitle] = 0x0010f2,[CaseUpper] = 0x001cb2}}, + {0x0010f3, {[CaseLower] = 0x0010f3,[CaseTitle] = 0x0010f3,[CaseUpper] = 0x001cb3}}, + {0x0010f4, {[CaseLower] = 0x0010f4,[CaseTitle] = 0x0010f4,[CaseUpper] = 0x001cb4}}, + {0x0010f5, {[CaseLower] = 0x0010f5,[CaseTitle] = 0x0010f5,[CaseUpper] = 0x001cb5}}, + {0x0010f6, {[CaseLower] = 0x0010f6,[CaseTitle] = 0x0010f6,[CaseUpper] = 0x001cb6}}, + {0x0010f7, {[CaseLower] = 0x0010f7,[CaseTitle] = 0x0010f7,[CaseUpper] = 0x001cb7}}, + {0x0010f8, {[CaseLower] = 0x0010f8,[CaseTitle] = 0x0010f8,[CaseUpper] = 0x001cb8}}, + {0x0010f9, {[CaseLower] = 0x0010f9,[CaseTitle] = 0x0010f9,[CaseUpper] = 0x001cb9}}, + {0x0010fa, {[CaseLower] = 0x0010fa,[CaseTitle] = 0x0010fa,[CaseUpper] = 0x001cba}}, + {0x0010fd, {[CaseLower] = 0x0010fd,[CaseTitle] = 0x0010fd,[CaseUpper] = 0x001cbd}}, + {0x0010fe, {[CaseLower] = 0x0010fe,[CaseTitle] = 0x0010fe,[CaseUpper] = 0x001cbe}}, + {0x0010ff, {[CaseLower] = 0x0010ff,[CaseTitle] = 0x0010ff,[CaseUpper] = 0x001cbf}}, + {0x0013a0, {[CaseLower] = 0x00ab70,[CaseTitle] = 0x0013a0,[CaseUpper] = 0x0013a0}}, + {0x0013a1, {[CaseLower] = 0x00ab71,[CaseTitle] = 0x0013a1,[CaseUpper] = 0x0013a1}}, + {0x0013a2, {[CaseLower] = 0x00ab72,[CaseTitle] = 0x0013a2,[CaseUpper] = 0x0013a2}}, + {0x0013a3, {[CaseLower] = 0x00ab73,[CaseTitle] = 0x0013a3,[CaseUpper] = 0x0013a3}}, + {0x0013a4, {[CaseLower] = 0x00ab74,[CaseTitle] = 0x0013a4,[CaseUpper] = 0x0013a4}}, + {0x0013a5, {[CaseLower] = 0x00ab75,[CaseTitle] = 0x0013a5,[CaseUpper] = 0x0013a5}}, + {0x0013a6, {[CaseLower] = 0x00ab76,[CaseTitle] = 0x0013a6,[CaseUpper] = 0x0013a6}}, + {0x0013a7, {[CaseLower] = 0x00ab77,[CaseTitle] = 0x0013a7,[CaseUpper] = 0x0013a7}}, + {0x0013a8, {[CaseLower] = 0x00ab78,[CaseTitle] = 0x0013a8,[CaseUpper] = 0x0013a8}}, + {0x0013a9, {[CaseLower] = 0x00ab79,[CaseTitle] = 0x0013a9,[CaseUpper] = 0x0013a9}}, + {0x0013aa, {[CaseLower] = 0x00ab7a,[CaseTitle] = 0x0013aa,[CaseUpper] = 0x0013aa}}, + {0x0013ab, {[CaseLower] = 0x00ab7b,[CaseTitle] = 0x0013ab,[CaseUpper] = 0x0013ab}}, + {0x0013ac, {[CaseLower] = 0x00ab7c,[CaseTitle] = 0x0013ac,[CaseUpper] = 0x0013ac}}, + {0x0013ad, {[CaseLower] = 0x00ab7d,[CaseTitle] = 0x0013ad,[CaseUpper] = 0x0013ad}}, + {0x0013ae, {[CaseLower] = 0x00ab7e,[CaseTitle] = 0x0013ae,[CaseUpper] = 0x0013ae}}, + {0x0013af, {[CaseLower] = 0x00ab7f,[CaseTitle] = 0x0013af,[CaseUpper] = 0x0013af}}, + {0x0013b0, {[CaseLower] = 0x00ab80,[CaseTitle] = 0x0013b0,[CaseUpper] = 0x0013b0}}, + {0x0013b1, {[CaseLower] = 0x00ab81,[CaseTitle] = 0x0013b1,[CaseUpper] = 0x0013b1}}, + {0x0013b2, {[CaseLower] = 0x00ab82,[CaseTitle] = 0x0013b2,[CaseUpper] = 0x0013b2}}, + {0x0013b3, {[CaseLower] = 0x00ab83,[CaseTitle] = 0x0013b3,[CaseUpper] = 0x0013b3}}, + {0x0013b4, {[CaseLower] = 0x00ab84,[CaseTitle] = 0x0013b4,[CaseUpper] = 0x0013b4}}, + {0x0013b5, {[CaseLower] = 0x00ab85,[CaseTitle] = 0x0013b5,[CaseUpper] = 0x0013b5}}, + {0x0013b6, {[CaseLower] = 0x00ab86,[CaseTitle] = 0x0013b6,[CaseUpper] = 0x0013b6}}, + {0x0013b7, {[CaseLower] = 0x00ab87,[CaseTitle] = 0x0013b7,[CaseUpper] = 0x0013b7}}, + {0x0013b8, {[CaseLower] = 0x00ab88,[CaseTitle] = 0x0013b8,[CaseUpper] = 0x0013b8}}, + {0x0013b9, {[CaseLower] = 0x00ab89,[CaseTitle] = 0x0013b9,[CaseUpper] = 0x0013b9}}, + {0x0013ba, {[CaseLower] = 0x00ab8a,[CaseTitle] = 0x0013ba,[CaseUpper] = 0x0013ba}}, + {0x0013bb, {[CaseLower] = 0x00ab8b,[CaseTitle] = 0x0013bb,[CaseUpper] = 0x0013bb}}, + {0x0013bc, {[CaseLower] = 0x00ab8c,[CaseTitle] = 0x0013bc,[CaseUpper] = 0x0013bc}}, + {0x0013bd, {[CaseLower] = 0x00ab8d,[CaseTitle] = 0x0013bd,[CaseUpper] = 0x0013bd}}, + {0x0013be, {[CaseLower] = 0x00ab8e,[CaseTitle] = 0x0013be,[CaseUpper] = 0x0013be}}, + {0x0013bf, {[CaseLower] = 0x00ab8f,[CaseTitle] = 0x0013bf,[CaseUpper] = 0x0013bf}}, + {0x0013c0, {[CaseLower] = 0x00ab90,[CaseTitle] = 0x0013c0,[CaseUpper] = 0x0013c0}}, + {0x0013c1, {[CaseLower] = 0x00ab91,[CaseTitle] = 0x0013c1,[CaseUpper] = 0x0013c1}}, + {0x0013c2, {[CaseLower] = 0x00ab92,[CaseTitle] = 0x0013c2,[CaseUpper] = 0x0013c2}}, + {0x0013c3, {[CaseLower] = 0x00ab93,[CaseTitle] = 0x0013c3,[CaseUpper] = 0x0013c3}}, + {0x0013c4, {[CaseLower] = 0x00ab94,[CaseTitle] = 0x0013c4,[CaseUpper] = 0x0013c4}}, + {0x0013c5, {[CaseLower] = 0x00ab95,[CaseTitle] = 0x0013c5,[CaseUpper] = 0x0013c5}}, + {0x0013c6, {[CaseLower] = 0x00ab96,[CaseTitle] = 0x0013c6,[CaseUpper] = 0x0013c6}}, + {0x0013c7, {[CaseLower] = 0x00ab97,[CaseTitle] = 0x0013c7,[CaseUpper] = 0x0013c7}}, + {0x0013c8, {[CaseLower] = 0x00ab98,[CaseTitle] = 0x0013c8,[CaseUpper] = 0x0013c8}}, + {0x0013c9, {[CaseLower] = 0x00ab99,[CaseTitle] = 0x0013c9,[CaseUpper] = 0x0013c9}}, + {0x0013ca, {[CaseLower] = 0x00ab9a,[CaseTitle] = 0x0013ca,[CaseUpper] = 0x0013ca}}, + {0x0013cb, {[CaseLower] = 0x00ab9b,[CaseTitle] = 0x0013cb,[CaseUpper] = 0x0013cb}}, + {0x0013cc, {[CaseLower] = 0x00ab9c,[CaseTitle] = 0x0013cc,[CaseUpper] = 0x0013cc}}, + {0x0013cd, {[CaseLower] = 0x00ab9d,[CaseTitle] = 0x0013cd,[CaseUpper] = 0x0013cd}}, + {0x0013ce, {[CaseLower] = 0x00ab9e,[CaseTitle] = 0x0013ce,[CaseUpper] = 0x0013ce}}, + {0x0013cf, {[CaseLower] = 0x00ab9f,[CaseTitle] = 0x0013cf,[CaseUpper] = 0x0013cf}}, + {0x0013d0, {[CaseLower] = 0x00aba0,[CaseTitle] = 0x0013d0,[CaseUpper] = 0x0013d0}}, + {0x0013d1, {[CaseLower] = 0x00aba1,[CaseTitle] = 0x0013d1,[CaseUpper] = 0x0013d1}}, + {0x0013d2, {[CaseLower] = 0x00aba2,[CaseTitle] = 0x0013d2,[CaseUpper] = 0x0013d2}}, + {0x0013d3, {[CaseLower] = 0x00aba3,[CaseTitle] = 0x0013d3,[CaseUpper] = 0x0013d3}}, + {0x0013d4, {[CaseLower] = 0x00aba4,[CaseTitle] = 0x0013d4,[CaseUpper] = 0x0013d4}}, + {0x0013d5, {[CaseLower] = 0x00aba5,[CaseTitle] = 0x0013d5,[CaseUpper] = 0x0013d5}}, + {0x0013d6, {[CaseLower] = 0x00aba6,[CaseTitle] = 0x0013d6,[CaseUpper] = 0x0013d6}}, + {0x0013d7, {[CaseLower] = 0x00aba7,[CaseTitle] = 0x0013d7,[CaseUpper] = 0x0013d7}}, + {0x0013d8, {[CaseLower] = 0x00aba8,[CaseTitle] = 0x0013d8,[CaseUpper] = 0x0013d8}}, + {0x0013d9, {[CaseLower] = 0x00aba9,[CaseTitle] = 0x0013d9,[CaseUpper] = 0x0013d9}}, + {0x0013da, {[CaseLower] = 0x00abaa,[CaseTitle] = 0x0013da,[CaseUpper] = 0x0013da}}, + {0x0013db, {[CaseLower] = 0x00abab,[CaseTitle] = 0x0013db,[CaseUpper] = 0x0013db}}, + {0x0013dc, {[CaseLower] = 0x00abac,[CaseTitle] = 0x0013dc,[CaseUpper] = 0x0013dc}}, + {0x0013dd, {[CaseLower] = 0x00abad,[CaseTitle] = 0x0013dd,[CaseUpper] = 0x0013dd}}, + {0x0013de, {[CaseLower] = 0x00abae,[CaseTitle] = 0x0013de,[CaseUpper] = 0x0013de}}, + {0x0013df, {[CaseLower] = 0x00abaf,[CaseTitle] = 0x0013df,[CaseUpper] = 0x0013df}}, + {0x0013e0, {[CaseLower] = 0x00abb0,[CaseTitle] = 0x0013e0,[CaseUpper] = 0x0013e0}}, + {0x0013e1, {[CaseLower] = 0x00abb1,[CaseTitle] = 0x0013e1,[CaseUpper] = 0x0013e1}}, + {0x0013e2, {[CaseLower] = 0x00abb2,[CaseTitle] = 0x0013e2,[CaseUpper] = 0x0013e2}}, + {0x0013e3, {[CaseLower] = 0x00abb3,[CaseTitle] = 0x0013e3,[CaseUpper] = 0x0013e3}}, + {0x0013e4, {[CaseLower] = 0x00abb4,[CaseTitle] = 0x0013e4,[CaseUpper] = 0x0013e4}}, + {0x0013e5, {[CaseLower] = 0x00abb5,[CaseTitle] = 0x0013e5,[CaseUpper] = 0x0013e5}}, + {0x0013e6, {[CaseLower] = 0x00abb6,[CaseTitle] = 0x0013e6,[CaseUpper] = 0x0013e6}}, + {0x0013e7, {[CaseLower] = 0x00abb7,[CaseTitle] = 0x0013e7,[CaseUpper] = 0x0013e7}}, + {0x0013e8, {[CaseLower] = 0x00abb8,[CaseTitle] = 0x0013e8,[CaseUpper] = 0x0013e8}}, + {0x0013e9, {[CaseLower] = 0x00abb9,[CaseTitle] = 0x0013e9,[CaseUpper] = 0x0013e9}}, + {0x0013ea, {[CaseLower] = 0x00abba,[CaseTitle] = 0x0013ea,[CaseUpper] = 0x0013ea}}, + {0x0013eb, {[CaseLower] = 0x00abbb,[CaseTitle] = 0x0013eb,[CaseUpper] = 0x0013eb}}, + {0x0013ec, {[CaseLower] = 0x00abbc,[CaseTitle] = 0x0013ec,[CaseUpper] = 0x0013ec}}, + {0x0013ed, {[CaseLower] = 0x00abbd,[CaseTitle] = 0x0013ed,[CaseUpper] = 0x0013ed}}, + {0x0013ee, {[CaseLower] = 0x00abbe,[CaseTitle] = 0x0013ee,[CaseUpper] = 0x0013ee}}, + {0x0013ef, {[CaseLower] = 0x00abbf,[CaseTitle] = 0x0013ef,[CaseUpper] = 0x0013ef}}, + {0x0013f0, {[CaseLower] = 0x0013f8,[CaseTitle] = 0x0013f0,[CaseUpper] = 0x0013f0}}, + {0x0013f1, {[CaseLower] = 0x0013f9,[CaseTitle] = 0x0013f1,[CaseUpper] = 0x0013f1}}, + {0x0013f2, {[CaseLower] = 0x0013fa,[CaseTitle] = 0x0013f2,[CaseUpper] = 0x0013f2}}, + {0x0013f3, {[CaseLower] = 0x0013fb,[CaseTitle] = 0x0013f3,[CaseUpper] = 0x0013f3}}, + {0x0013f4, {[CaseLower] = 0x0013fc,[CaseTitle] = 0x0013f4,[CaseUpper] = 0x0013f4}}, + {0x0013f5, {[CaseLower] = 0x0013fd,[CaseTitle] = 0x0013f5,[CaseUpper] = 0x0013f5}}, + {0x0013f8, {[CaseLower] = 0x0013f8,[CaseTitle] = 0x0013f0,[CaseUpper] = 0x0013f0}}, + {0x0013f9, {[CaseLower] = 0x0013f9,[CaseTitle] = 0x0013f1,[CaseUpper] = 0x0013f1}}, + {0x0013fa, {[CaseLower] = 0x0013fa,[CaseTitle] = 0x0013f2,[CaseUpper] = 0x0013f2}}, + {0x0013fb, {[CaseLower] = 0x0013fb,[CaseTitle] = 0x0013f3,[CaseUpper] = 0x0013f3}}, + {0x0013fc, {[CaseLower] = 0x0013fc,[CaseTitle] = 0x0013f4,[CaseUpper] = 0x0013f4}}, + {0x0013fd, {[CaseLower] = 0x0013fd,[CaseTitle] = 0x0013f5,[CaseUpper] = 0x0013f5}}, + {0x001c80, {[CaseLower] = 0x001c80,[CaseTitle] = 0x000412,[CaseUpper] = 0x000412}}, + {0x001c81, {[CaseLower] = 0x001c81,[CaseTitle] = 0x000414,[CaseUpper] = 0x000414}}, + {0x001c82, {[CaseLower] = 0x001c82,[CaseTitle] = 0x00041e,[CaseUpper] = 0x00041e}}, + {0x001c83, {[CaseLower] = 0x001c83,[CaseTitle] = 0x000421,[CaseUpper] = 0x000421}}, + {0x001c84, {[CaseLower] = 0x001c84,[CaseTitle] = 0x000422,[CaseUpper] = 0x000422}}, + {0x001c85, {[CaseLower] = 0x001c85,[CaseTitle] = 0x000422,[CaseUpper] = 0x000422}}, + {0x001c86, {[CaseLower] = 0x001c86,[CaseTitle] = 0x00042a,[CaseUpper] = 0x00042a}}, + {0x001c87, {[CaseLower] = 0x001c87,[CaseTitle] = 0x000462,[CaseUpper] = 0x000462}}, + {0x001c88, {[CaseLower] = 0x001c88,[CaseTitle] = 0x00a64a,[CaseUpper] = 0x00a64a}}, + {0x001c90, {[CaseLower] = 0x0010d0,[CaseTitle] = 0x001c90,[CaseUpper] = 0x001c90}}, + {0x001c91, {[CaseLower] = 0x0010d1,[CaseTitle] = 0x001c91,[CaseUpper] = 0x001c91}}, + {0x001c92, {[CaseLower] = 0x0010d2,[CaseTitle] = 0x001c92,[CaseUpper] = 0x001c92}}, + {0x001c93, {[CaseLower] = 0x0010d3,[CaseTitle] = 0x001c93,[CaseUpper] = 0x001c93}}, + {0x001c94, {[CaseLower] = 0x0010d4,[CaseTitle] = 0x001c94,[CaseUpper] = 0x001c94}}, + {0x001c95, {[CaseLower] = 0x0010d5,[CaseTitle] = 0x001c95,[CaseUpper] = 0x001c95}}, + {0x001c96, {[CaseLower] = 0x0010d6,[CaseTitle] = 0x001c96,[CaseUpper] = 0x001c96}}, + {0x001c97, {[CaseLower] = 0x0010d7,[CaseTitle] = 0x001c97,[CaseUpper] = 0x001c97}}, + {0x001c98, {[CaseLower] = 0x0010d8,[CaseTitle] = 0x001c98,[CaseUpper] = 0x001c98}}, + {0x001c99, {[CaseLower] = 0x0010d9,[CaseTitle] = 0x001c99,[CaseUpper] = 0x001c99}}, + {0x001c9a, {[CaseLower] = 0x0010da,[CaseTitle] = 0x001c9a,[CaseUpper] = 0x001c9a}}, + {0x001c9b, {[CaseLower] = 0x0010db,[CaseTitle] = 0x001c9b,[CaseUpper] = 0x001c9b}}, + {0x001c9c, {[CaseLower] = 0x0010dc,[CaseTitle] = 0x001c9c,[CaseUpper] = 0x001c9c}}, + {0x001c9d, {[CaseLower] = 0x0010dd,[CaseTitle] = 0x001c9d,[CaseUpper] = 0x001c9d}}, + {0x001c9e, {[CaseLower] = 0x0010de,[CaseTitle] = 0x001c9e,[CaseUpper] = 0x001c9e}}, + {0x001c9f, {[CaseLower] = 0x0010df,[CaseTitle] = 0x001c9f,[CaseUpper] = 0x001c9f}}, + {0x001ca0, {[CaseLower] = 0x0010e0,[CaseTitle] = 0x001ca0,[CaseUpper] = 0x001ca0}}, + {0x001ca1, {[CaseLower] = 0x0010e1,[CaseTitle] = 0x001ca1,[CaseUpper] = 0x001ca1}}, + {0x001ca2, {[CaseLower] = 0x0010e2,[CaseTitle] = 0x001ca2,[CaseUpper] = 0x001ca2}}, + {0x001ca3, {[CaseLower] = 0x0010e3,[CaseTitle] = 0x001ca3,[CaseUpper] = 0x001ca3}}, + {0x001ca4, {[CaseLower] = 0x0010e4,[CaseTitle] = 0x001ca4,[CaseUpper] = 0x001ca4}}, + {0x001ca5, {[CaseLower] = 0x0010e5,[CaseTitle] = 0x001ca5,[CaseUpper] = 0x001ca5}}, + {0x001ca6, {[CaseLower] = 0x0010e6,[CaseTitle] = 0x001ca6,[CaseUpper] = 0x001ca6}}, + {0x001ca7, {[CaseLower] = 0x0010e7,[CaseTitle] = 0x001ca7,[CaseUpper] = 0x001ca7}}, + {0x001ca8, {[CaseLower] = 0x0010e8,[CaseTitle] = 0x001ca8,[CaseUpper] = 0x001ca8}}, + {0x001ca9, {[CaseLower] = 0x0010e9,[CaseTitle] = 0x001ca9,[CaseUpper] = 0x001ca9}}, + {0x001caa, {[CaseLower] = 0x0010ea,[CaseTitle] = 0x001caa,[CaseUpper] = 0x001caa}}, + {0x001cab, {[CaseLower] = 0x0010eb,[CaseTitle] = 0x001cab,[CaseUpper] = 0x001cab}}, + {0x001cac, {[CaseLower] = 0x0010ec,[CaseTitle] = 0x001cac,[CaseUpper] = 0x001cac}}, + {0x001cad, {[CaseLower] = 0x0010ed,[CaseTitle] = 0x001cad,[CaseUpper] = 0x001cad}}, + {0x001cae, {[CaseLower] = 0x0010ee,[CaseTitle] = 0x001cae,[CaseUpper] = 0x001cae}}, + {0x001caf, {[CaseLower] = 0x0010ef,[CaseTitle] = 0x001caf,[CaseUpper] = 0x001caf}}, + {0x001cb0, {[CaseLower] = 0x0010f0,[CaseTitle] = 0x001cb0,[CaseUpper] = 0x001cb0}}, + {0x001cb1, {[CaseLower] = 0x0010f1,[CaseTitle] = 0x001cb1,[CaseUpper] = 0x001cb1}}, + {0x001cb2, {[CaseLower] = 0x0010f2,[CaseTitle] = 0x001cb2,[CaseUpper] = 0x001cb2}}, + {0x001cb3, {[CaseLower] = 0x0010f3,[CaseTitle] = 0x001cb3,[CaseUpper] = 0x001cb3}}, + {0x001cb4, {[CaseLower] = 0x0010f4,[CaseTitle] = 0x001cb4,[CaseUpper] = 0x001cb4}}, + {0x001cb5, {[CaseLower] = 0x0010f5,[CaseTitle] = 0x001cb5,[CaseUpper] = 0x001cb5}}, + {0x001cb6, {[CaseLower] = 0x0010f6,[CaseTitle] = 0x001cb6,[CaseUpper] = 0x001cb6}}, + {0x001cb7, {[CaseLower] = 0x0010f7,[CaseTitle] = 0x001cb7,[CaseUpper] = 0x001cb7}}, + {0x001cb8, {[CaseLower] = 0x0010f8,[CaseTitle] = 0x001cb8,[CaseUpper] = 0x001cb8}}, + {0x001cb9, {[CaseLower] = 0x0010f9,[CaseTitle] = 0x001cb9,[CaseUpper] = 0x001cb9}}, + {0x001cba, {[CaseLower] = 0x0010fa,[CaseTitle] = 0x001cba,[CaseUpper] = 0x001cba}}, + {0x001cbd, {[CaseLower] = 0x0010fd,[CaseTitle] = 0x001cbd,[CaseUpper] = 0x001cbd}}, + {0x001cbe, {[CaseLower] = 0x0010fe,[CaseTitle] = 0x001cbe,[CaseUpper] = 0x001cbe}}, + {0x001cbf, {[CaseLower] = 0x0010ff,[CaseTitle] = 0x001cbf,[CaseUpper] = 0x001cbf}}, + {0x001d79, {[CaseLower] = 0x001d79,[CaseTitle] = 0x00a77d,[CaseUpper] = 0x00a77d}}, + {0x001d7d, {[CaseLower] = 0x001d7d,[CaseTitle] = 0x002c63,[CaseUpper] = 0x002c63}}, + {0x001d8e, {[CaseLower] = 0x001d8e,[CaseTitle] = 0x00a7c6,[CaseUpper] = 0x00a7c6}}, + {0x001e00, {[CaseLower] = 0x001e01,[CaseTitle] = 0x001e00,[CaseUpper] = 0x001e00}}, + {0x001e01, {[CaseLower] = 0x001e01,[CaseTitle] = 0x001e00,[CaseUpper] = 0x001e00}}, + {0x001e02, {[CaseLower] = 0x001e03,[CaseTitle] = 0x001e02,[CaseUpper] = 0x001e02}}, + {0x001e03, {[CaseLower] = 0x001e03,[CaseTitle] = 0x001e02,[CaseUpper] = 0x001e02}}, + {0x001e04, {[CaseLower] = 0x001e05,[CaseTitle] = 0x001e04,[CaseUpper] = 0x001e04}}, + {0x001e05, {[CaseLower] = 0x001e05,[CaseTitle] = 0x001e04,[CaseUpper] = 0x001e04}}, + {0x001e06, {[CaseLower] = 0x001e07,[CaseTitle] = 0x001e06,[CaseUpper] = 0x001e06}}, + {0x001e07, {[CaseLower] = 0x001e07,[CaseTitle] = 0x001e06,[CaseUpper] = 0x001e06}}, + {0x001e08, {[CaseLower] = 0x001e09,[CaseTitle] = 0x001e08,[CaseUpper] = 0x001e08}}, + {0x001e09, {[CaseLower] = 0x001e09,[CaseTitle] = 0x001e08,[CaseUpper] = 0x001e08}}, + {0x001e0a, {[CaseLower] = 0x001e0b,[CaseTitle] = 0x001e0a,[CaseUpper] = 0x001e0a}}, + {0x001e0b, {[CaseLower] = 0x001e0b,[CaseTitle] = 0x001e0a,[CaseUpper] = 0x001e0a}}, + {0x001e0c, {[CaseLower] = 0x001e0d,[CaseTitle] = 0x001e0c,[CaseUpper] = 0x001e0c}}, + {0x001e0d, {[CaseLower] = 0x001e0d,[CaseTitle] = 0x001e0c,[CaseUpper] = 0x001e0c}}, + {0x001e0e, {[CaseLower] = 0x001e0f,[CaseTitle] = 0x001e0e,[CaseUpper] = 0x001e0e}}, + {0x001e0f, {[CaseLower] = 0x001e0f,[CaseTitle] = 0x001e0e,[CaseUpper] = 0x001e0e}}, + {0x001e10, {[CaseLower] = 0x001e11,[CaseTitle] = 0x001e10,[CaseUpper] = 0x001e10}}, + {0x001e11, {[CaseLower] = 0x001e11,[CaseTitle] = 0x001e10,[CaseUpper] = 0x001e10}}, + {0x001e12, {[CaseLower] = 0x001e13,[CaseTitle] = 0x001e12,[CaseUpper] = 0x001e12}}, + {0x001e13, {[CaseLower] = 0x001e13,[CaseTitle] = 0x001e12,[CaseUpper] = 0x001e12}}, + {0x001e14, {[CaseLower] = 0x001e15,[CaseTitle] = 0x001e14,[CaseUpper] = 0x001e14}}, + {0x001e15, {[CaseLower] = 0x001e15,[CaseTitle] = 0x001e14,[CaseUpper] = 0x001e14}}, + {0x001e16, {[CaseLower] = 0x001e17,[CaseTitle] = 0x001e16,[CaseUpper] = 0x001e16}}, + {0x001e17, {[CaseLower] = 0x001e17,[CaseTitle] = 0x001e16,[CaseUpper] = 0x001e16}}, + {0x001e18, {[CaseLower] = 0x001e19,[CaseTitle] = 0x001e18,[CaseUpper] = 0x001e18}}, + {0x001e19, {[CaseLower] = 0x001e19,[CaseTitle] = 0x001e18,[CaseUpper] = 0x001e18}}, + {0x001e1a, {[CaseLower] = 0x001e1b,[CaseTitle] = 0x001e1a,[CaseUpper] = 0x001e1a}}, + {0x001e1b, {[CaseLower] = 0x001e1b,[CaseTitle] = 0x001e1a,[CaseUpper] = 0x001e1a}}, + {0x001e1c, {[CaseLower] = 0x001e1d,[CaseTitle] = 0x001e1c,[CaseUpper] = 0x001e1c}}, + {0x001e1d, {[CaseLower] = 0x001e1d,[CaseTitle] = 0x001e1c,[CaseUpper] = 0x001e1c}}, + {0x001e1e, {[CaseLower] = 0x001e1f,[CaseTitle] = 0x001e1e,[CaseUpper] = 0x001e1e}}, + {0x001e1f, {[CaseLower] = 0x001e1f,[CaseTitle] = 0x001e1e,[CaseUpper] = 0x001e1e}}, + {0x001e20, {[CaseLower] = 0x001e21,[CaseTitle] = 0x001e20,[CaseUpper] = 0x001e20}}, + {0x001e21, {[CaseLower] = 0x001e21,[CaseTitle] = 0x001e20,[CaseUpper] = 0x001e20}}, + {0x001e22, {[CaseLower] = 0x001e23,[CaseTitle] = 0x001e22,[CaseUpper] = 0x001e22}}, + {0x001e23, {[CaseLower] = 0x001e23,[CaseTitle] = 0x001e22,[CaseUpper] = 0x001e22}}, + {0x001e24, {[CaseLower] = 0x001e25,[CaseTitle] = 0x001e24,[CaseUpper] = 0x001e24}}, + {0x001e25, {[CaseLower] = 0x001e25,[CaseTitle] = 0x001e24,[CaseUpper] = 0x001e24}}, + {0x001e26, {[CaseLower] = 0x001e27,[CaseTitle] = 0x001e26,[CaseUpper] = 0x001e26}}, + {0x001e27, {[CaseLower] = 0x001e27,[CaseTitle] = 0x001e26,[CaseUpper] = 0x001e26}}, + {0x001e28, {[CaseLower] = 0x001e29,[CaseTitle] = 0x001e28,[CaseUpper] = 0x001e28}}, + {0x001e29, {[CaseLower] = 0x001e29,[CaseTitle] = 0x001e28,[CaseUpper] = 0x001e28}}, + {0x001e2a, {[CaseLower] = 0x001e2b,[CaseTitle] = 0x001e2a,[CaseUpper] = 0x001e2a}}, + {0x001e2b, {[CaseLower] = 0x001e2b,[CaseTitle] = 0x001e2a,[CaseUpper] = 0x001e2a}}, + {0x001e2c, {[CaseLower] = 0x001e2d,[CaseTitle] = 0x001e2c,[CaseUpper] = 0x001e2c}}, + {0x001e2d, {[CaseLower] = 0x001e2d,[CaseTitle] = 0x001e2c,[CaseUpper] = 0x001e2c}}, + {0x001e2e, {[CaseLower] = 0x001e2f,[CaseTitle] = 0x001e2e,[CaseUpper] = 0x001e2e}}, + {0x001e2f, {[CaseLower] = 0x001e2f,[CaseTitle] = 0x001e2e,[CaseUpper] = 0x001e2e}}, + {0x001e30, {[CaseLower] = 0x001e31,[CaseTitle] = 0x001e30,[CaseUpper] = 0x001e30}}, + {0x001e31, {[CaseLower] = 0x001e31,[CaseTitle] = 0x001e30,[CaseUpper] = 0x001e30}}, + {0x001e32, {[CaseLower] = 0x001e33,[CaseTitle] = 0x001e32,[CaseUpper] = 0x001e32}}, + {0x001e33, {[CaseLower] = 0x001e33,[CaseTitle] = 0x001e32,[CaseUpper] = 0x001e32}}, + {0x001e34, {[CaseLower] = 0x001e35,[CaseTitle] = 0x001e34,[CaseUpper] = 0x001e34}}, + {0x001e35, {[CaseLower] = 0x001e35,[CaseTitle] = 0x001e34,[CaseUpper] = 0x001e34}}, + {0x001e36, {[CaseLower] = 0x001e37,[CaseTitle] = 0x001e36,[CaseUpper] = 0x001e36}}, + {0x001e37, {[CaseLower] = 0x001e37,[CaseTitle] = 0x001e36,[CaseUpper] = 0x001e36}}, + {0x001e38, {[CaseLower] = 0x001e39,[CaseTitle] = 0x001e38,[CaseUpper] = 0x001e38}}, + {0x001e39, {[CaseLower] = 0x001e39,[CaseTitle] = 0x001e38,[CaseUpper] = 0x001e38}}, + {0x001e3a, {[CaseLower] = 0x001e3b,[CaseTitle] = 0x001e3a,[CaseUpper] = 0x001e3a}}, + {0x001e3b, {[CaseLower] = 0x001e3b,[CaseTitle] = 0x001e3a,[CaseUpper] = 0x001e3a}}, + {0x001e3c, {[CaseLower] = 0x001e3d,[CaseTitle] = 0x001e3c,[CaseUpper] = 0x001e3c}}, + {0x001e3d, {[CaseLower] = 0x001e3d,[CaseTitle] = 0x001e3c,[CaseUpper] = 0x001e3c}}, + {0x001e3e, {[CaseLower] = 0x001e3f,[CaseTitle] = 0x001e3e,[CaseUpper] = 0x001e3e}}, + {0x001e3f, {[CaseLower] = 0x001e3f,[CaseTitle] = 0x001e3e,[CaseUpper] = 0x001e3e}}, + {0x001e40, {[CaseLower] = 0x001e41,[CaseTitle] = 0x001e40,[CaseUpper] = 0x001e40}}, + {0x001e41, {[CaseLower] = 0x001e41,[CaseTitle] = 0x001e40,[CaseUpper] = 0x001e40}}, + {0x001e42, {[CaseLower] = 0x001e43,[CaseTitle] = 0x001e42,[CaseUpper] = 0x001e42}}, + {0x001e43, {[CaseLower] = 0x001e43,[CaseTitle] = 0x001e42,[CaseUpper] = 0x001e42}}, + {0x001e44, {[CaseLower] = 0x001e45,[CaseTitle] = 0x001e44,[CaseUpper] = 0x001e44}}, + {0x001e45, {[CaseLower] = 0x001e45,[CaseTitle] = 0x001e44,[CaseUpper] = 0x001e44}}, + {0x001e46, {[CaseLower] = 0x001e47,[CaseTitle] = 0x001e46,[CaseUpper] = 0x001e46}}, + {0x001e47, {[CaseLower] = 0x001e47,[CaseTitle] = 0x001e46,[CaseUpper] = 0x001e46}}, + {0x001e48, {[CaseLower] = 0x001e49,[CaseTitle] = 0x001e48,[CaseUpper] = 0x001e48}}, + {0x001e49, {[CaseLower] = 0x001e49,[CaseTitle] = 0x001e48,[CaseUpper] = 0x001e48}}, + {0x001e4a, {[CaseLower] = 0x001e4b,[CaseTitle] = 0x001e4a,[CaseUpper] = 0x001e4a}}, + {0x001e4b, {[CaseLower] = 0x001e4b,[CaseTitle] = 0x001e4a,[CaseUpper] = 0x001e4a}}, + {0x001e4c, {[CaseLower] = 0x001e4d,[CaseTitle] = 0x001e4c,[CaseUpper] = 0x001e4c}}, + {0x001e4d, {[CaseLower] = 0x001e4d,[CaseTitle] = 0x001e4c,[CaseUpper] = 0x001e4c}}, + {0x001e4e, {[CaseLower] = 0x001e4f,[CaseTitle] = 0x001e4e,[CaseUpper] = 0x001e4e}}, + {0x001e4f, {[CaseLower] = 0x001e4f,[CaseTitle] = 0x001e4e,[CaseUpper] = 0x001e4e}}, + {0x001e50, {[CaseLower] = 0x001e51,[CaseTitle] = 0x001e50,[CaseUpper] = 0x001e50}}, + {0x001e51, {[CaseLower] = 0x001e51,[CaseTitle] = 0x001e50,[CaseUpper] = 0x001e50}}, + {0x001e52, {[CaseLower] = 0x001e53,[CaseTitle] = 0x001e52,[CaseUpper] = 0x001e52}}, + {0x001e53, {[CaseLower] = 0x001e53,[CaseTitle] = 0x001e52,[CaseUpper] = 0x001e52}}, + {0x001e54, {[CaseLower] = 0x001e55,[CaseTitle] = 0x001e54,[CaseUpper] = 0x001e54}}, + {0x001e55, {[CaseLower] = 0x001e55,[CaseTitle] = 0x001e54,[CaseUpper] = 0x001e54}}, + {0x001e56, {[CaseLower] = 0x001e57,[CaseTitle] = 0x001e56,[CaseUpper] = 0x001e56}}, + {0x001e57, {[CaseLower] = 0x001e57,[CaseTitle] = 0x001e56,[CaseUpper] = 0x001e56}}, + {0x001e58, {[CaseLower] = 0x001e59,[CaseTitle] = 0x001e58,[CaseUpper] = 0x001e58}}, + {0x001e59, {[CaseLower] = 0x001e59,[CaseTitle] = 0x001e58,[CaseUpper] = 0x001e58}}, + {0x001e5a, {[CaseLower] = 0x001e5b,[CaseTitle] = 0x001e5a,[CaseUpper] = 0x001e5a}}, + {0x001e5b, {[CaseLower] = 0x001e5b,[CaseTitle] = 0x001e5a,[CaseUpper] = 0x001e5a}}, + {0x001e5c, {[CaseLower] = 0x001e5d,[CaseTitle] = 0x001e5c,[CaseUpper] = 0x001e5c}}, + {0x001e5d, {[CaseLower] = 0x001e5d,[CaseTitle] = 0x001e5c,[CaseUpper] = 0x001e5c}}, + {0x001e5e, {[CaseLower] = 0x001e5f,[CaseTitle] = 0x001e5e,[CaseUpper] = 0x001e5e}}, + {0x001e5f, {[CaseLower] = 0x001e5f,[CaseTitle] = 0x001e5e,[CaseUpper] = 0x001e5e}}, + {0x001e60, {[CaseLower] = 0x001e61,[CaseTitle] = 0x001e60,[CaseUpper] = 0x001e60}}, + {0x001e61, {[CaseLower] = 0x001e61,[CaseTitle] = 0x001e60,[CaseUpper] = 0x001e60}}, + {0x001e62, {[CaseLower] = 0x001e63,[CaseTitle] = 0x001e62,[CaseUpper] = 0x001e62}}, + {0x001e63, {[CaseLower] = 0x001e63,[CaseTitle] = 0x001e62,[CaseUpper] = 0x001e62}}, + {0x001e64, {[CaseLower] = 0x001e65,[CaseTitle] = 0x001e64,[CaseUpper] = 0x001e64}}, + {0x001e65, {[CaseLower] = 0x001e65,[CaseTitle] = 0x001e64,[CaseUpper] = 0x001e64}}, + {0x001e66, {[CaseLower] = 0x001e67,[CaseTitle] = 0x001e66,[CaseUpper] = 0x001e66}}, + {0x001e67, {[CaseLower] = 0x001e67,[CaseTitle] = 0x001e66,[CaseUpper] = 0x001e66}}, + {0x001e68, {[CaseLower] = 0x001e69,[CaseTitle] = 0x001e68,[CaseUpper] = 0x001e68}}, + {0x001e69, {[CaseLower] = 0x001e69,[CaseTitle] = 0x001e68,[CaseUpper] = 0x001e68}}, + {0x001e6a, {[CaseLower] = 0x001e6b,[CaseTitle] = 0x001e6a,[CaseUpper] = 0x001e6a}}, + {0x001e6b, {[CaseLower] = 0x001e6b,[CaseTitle] = 0x001e6a,[CaseUpper] = 0x001e6a}}, + {0x001e6c, {[CaseLower] = 0x001e6d,[CaseTitle] = 0x001e6c,[CaseUpper] = 0x001e6c}}, + {0x001e6d, {[CaseLower] = 0x001e6d,[CaseTitle] = 0x001e6c,[CaseUpper] = 0x001e6c}}, + {0x001e6e, {[CaseLower] = 0x001e6f,[CaseTitle] = 0x001e6e,[CaseUpper] = 0x001e6e}}, + {0x001e6f, {[CaseLower] = 0x001e6f,[CaseTitle] = 0x001e6e,[CaseUpper] = 0x001e6e}}, + {0x001e70, {[CaseLower] = 0x001e71,[CaseTitle] = 0x001e70,[CaseUpper] = 0x001e70}}, + {0x001e71, {[CaseLower] = 0x001e71,[CaseTitle] = 0x001e70,[CaseUpper] = 0x001e70}}, + {0x001e72, {[CaseLower] = 0x001e73,[CaseTitle] = 0x001e72,[CaseUpper] = 0x001e72}}, + {0x001e73, {[CaseLower] = 0x001e73,[CaseTitle] = 0x001e72,[CaseUpper] = 0x001e72}}, + {0x001e74, {[CaseLower] = 0x001e75,[CaseTitle] = 0x001e74,[CaseUpper] = 0x001e74}}, + {0x001e75, {[CaseLower] = 0x001e75,[CaseTitle] = 0x001e74,[CaseUpper] = 0x001e74}}, + {0x001e76, {[CaseLower] = 0x001e77,[CaseTitle] = 0x001e76,[CaseUpper] = 0x001e76}}, + {0x001e77, {[CaseLower] = 0x001e77,[CaseTitle] = 0x001e76,[CaseUpper] = 0x001e76}}, + {0x001e78, {[CaseLower] = 0x001e79,[CaseTitle] = 0x001e78,[CaseUpper] = 0x001e78}}, + {0x001e79, {[CaseLower] = 0x001e79,[CaseTitle] = 0x001e78,[CaseUpper] = 0x001e78}}, + {0x001e7a, {[CaseLower] = 0x001e7b,[CaseTitle] = 0x001e7a,[CaseUpper] = 0x001e7a}}, + {0x001e7b, {[CaseLower] = 0x001e7b,[CaseTitle] = 0x001e7a,[CaseUpper] = 0x001e7a}}, + {0x001e7c, {[CaseLower] = 0x001e7d,[CaseTitle] = 0x001e7c,[CaseUpper] = 0x001e7c}}, + {0x001e7d, {[CaseLower] = 0x001e7d,[CaseTitle] = 0x001e7c,[CaseUpper] = 0x001e7c}}, + {0x001e7e, {[CaseLower] = 0x001e7f,[CaseTitle] = 0x001e7e,[CaseUpper] = 0x001e7e}}, + {0x001e7f, {[CaseLower] = 0x001e7f,[CaseTitle] = 0x001e7e,[CaseUpper] = 0x001e7e}}, + {0x001e80, {[CaseLower] = 0x001e81,[CaseTitle] = 0x001e80,[CaseUpper] = 0x001e80}}, + {0x001e81, {[CaseLower] = 0x001e81,[CaseTitle] = 0x001e80,[CaseUpper] = 0x001e80}}, + {0x001e82, {[CaseLower] = 0x001e83,[CaseTitle] = 0x001e82,[CaseUpper] = 0x001e82}}, + {0x001e83, {[CaseLower] = 0x001e83,[CaseTitle] = 0x001e82,[CaseUpper] = 0x001e82}}, + {0x001e84, {[CaseLower] = 0x001e85,[CaseTitle] = 0x001e84,[CaseUpper] = 0x001e84}}, + {0x001e85, {[CaseLower] = 0x001e85,[CaseTitle] = 0x001e84,[CaseUpper] = 0x001e84}}, + {0x001e86, {[CaseLower] = 0x001e87,[CaseTitle] = 0x001e86,[CaseUpper] = 0x001e86}}, + {0x001e87, {[CaseLower] = 0x001e87,[CaseTitle] = 0x001e86,[CaseUpper] = 0x001e86}}, + {0x001e88, {[CaseLower] = 0x001e89,[CaseTitle] = 0x001e88,[CaseUpper] = 0x001e88}}, + {0x001e89, {[CaseLower] = 0x001e89,[CaseTitle] = 0x001e88,[CaseUpper] = 0x001e88}}, + {0x001e8a, {[CaseLower] = 0x001e8b,[CaseTitle] = 0x001e8a,[CaseUpper] = 0x001e8a}}, + {0x001e8b, {[CaseLower] = 0x001e8b,[CaseTitle] = 0x001e8a,[CaseUpper] = 0x001e8a}}, + {0x001e8c, {[CaseLower] = 0x001e8d,[CaseTitle] = 0x001e8c,[CaseUpper] = 0x001e8c}}, + {0x001e8d, {[CaseLower] = 0x001e8d,[CaseTitle] = 0x001e8c,[CaseUpper] = 0x001e8c}}, + {0x001e8e, {[CaseLower] = 0x001e8f,[CaseTitle] = 0x001e8e,[CaseUpper] = 0x001e8e}}, + {0x001e8f, {[CaseLower] = 0x001e8f,[CaseTitle] = 0x001e8e,[CaseUpper] = 0x001e8e}}, + {0x001e90, {[CaseLower] = 0x001e91,[CaseTitle] = 0x001e90,[CaseUpper] = 0x001e90}}, + {0x001e91, {[CaseLower] = 0x001e91,[CaseTitle] = 0x001e90,[CaseUpper] = 0x001e90}}, + {0x001e92, {[CaseLower] = 0x001e93,[CaseTitle] = 0x001e92,[CaseUpper] = 0x001e92}}, + {0x001e93, {[CaseLower] = 0x001e93,[CaseTitle] = 0x001e92,[CaseUpper] = 0x001e92}}, + {0x001e94, {[CaseLower] = 0x001e95,[CaseTitle] = 0x001e94,[CaseUpper] = 0x001e94}}, + {0x001e95, {[CaseLower] = 0x001e95,[CaseTitle] = 0x001e94,[CaseUpper] = 0x001e94}}, + {0x001e9b, {[CaseLower] = 0x001e9b,[CaseTitle] = 0x001e60,[CaseUpper] = 0x001e60}}, + {0x001e9e, {[CaseLower] = 0x0000df,[CaseTitle] = 0x001e9e,[CaseUpper] = 0x001e9e}}, + {0x001ea0, {[CaseLower] = 0x001ea1,[CaseTitle] = 0x001ea0,[CaseUpper] = 0x001ea0}}, + {0x001ea1, {[CaseLower] = 0x001ea1,[CaseTitle] = 0x001ea0,[CaseUpper] = 0x001ea0}}, + {0x001ea2, {[CaseLower] = 0x001ea3,[CaseTitle] = 0x001ea2,[CaseUpper] = 0x001ea2}}, + {0x001ea3, {[CaseLower] = 0x001ea3,[CaseTitle] = 0x001ea2,[CaseUpper] = 0x001ea2}}, + {0x001ea4, {[CaseLower] = 0x001ea5,[CaseTitle] = 0x001ea4,[CaseUpper] = 0x001ea4}}, + {0x001ea5, {[CaseLower] = 0x001ea5,[CaseTitle] = 0x001ea4,[CaseUpper] = 0x001ea4}}, + {0x001ea6, {[CaseLower] = 0x001ea7,[CaseTitle] = 0x001ea6,[CaseUpper] = 0x001ea6}}, + {0x001ea7, {[CaseLower] = 0x001ea7,[CaseTitle] = 0x001ea6,[CaseUpper] = 0x001ea6}}, + {0x001ea8, {[CaseLower] = 0x001ea9,[CaseTitle] = 0x001ea8,[CaseUpper] = 0x001ea8}}, + {0x001ea9, {[CaseLower] = 0x001ea9,[CaseTitle] = 0x001ea8,[CaseUpper] = 0x001ea8}}, + {0x001eaa, {[CaseLower] = 0x001eab,[CaseTitle] = 0x001eaa,[CaseUpper] = 0x001eaa}}, + {0x001eab, {[CaseLower] = 0x001eab,[CaseTitle] = 0x001eaa,[CaseUpper] = 0x001eaa}}, + {0x001eac, {[CaseLower] = 0x001ead,[CaseTitle] = 0x001eac,[CaseUpper] = 0x001eac}}, + {0x001ead, {[CaseLower] = 0x001ead,[CaseTitle] = 0x001eac,[CaseUpper] = 0x001eac}}, + {0x001eae, {[CaseLower] = 0x001eaf,[CaseTitle] = 0x001eae,[CaseUpper] = 0x001eae}}, + {0x001eaf, {[CaseLower] = 0x001eaf,[CaseTitle] = 0x001eae,[CaseUpper] = 0x001eae}}, + {0x001eb0, {[CaseLower] = 0x001eb1,[CaseTitle] = 0x001eb0,[CaseUpper] = 0x001eb0}}, + {0x001eb1, {[CaseLower] = 0x001eb1,[CaseTitle] = 0x001eb0,[CaseUpper] = 0x001eb0}}, + {0x001eb2, {[CaseLower] = 0x001eb3,[CaseTitle] = 0x001eb2,[CaseUpper] = 0x001eb2}}, + {0x001eb3, {[CaseLower] = 0x001eb3,[CaseTitle] = 0x001eb2,[CaseUpper] = 0x001eb2}}, + {0x001eb4, {[CaseLower] = 0x001eb5,[CaseTitle] = 0x001eb4,[CaseUpper] = 0x001eb4}}, + {0x001eb5, {[CaseLower] = 0x001eb5,[CaseTitle] = 0x001eb4,[CaseUpper] = 0x001eb4}}, + {0x001eb6, {[CaseLower] = 0x001eb7,[CaseTitle] = 0x001eb6,[CaseUpper] = 0x001eb6}}, + {0x001eb7, {[CaseLower] = 0x001eb7,[CaseTitle] = 0x001eb6,[CaseUpper] = 0x001eb6}}, + {0x001eb8, {[CaseLower] = 0x001eb9,[CaseTitle] = 0x001eb8,[CaseUpper] = 0x001eb8}}, + {0x001eb9, {[CaseLower] = 0x001eb9,[CaseTitle] = 0x001eb8,[CaseUpper] = 0x001eb8}}, + {0x001eba, {[CaseLower] = 0x001ebb,[CaseTitle] = 0x001eba,[CaseUpper] = 0x001eba}}, + {0x001ebb, {[CaseLower] = 0x001ebb,[CaseTitle] = 0x001eba,[CaseUpper] = 0x001eba}}, + {0x001ebc, {[CaseLower] = 0x001ebd,[CaseTitle] = 0x001ebc,[CaseUpper] = 0x001ebc}}, + {0x001ebd, {[CaseLower] = 0x001ebd,[CaseTitle] = 0x001ebc,[CaseUpper] = 0x001ebc}}, + {0x001ebe, {[CaseLower] = 0x001ebf,[CaseTitle] = 0x001ebe,[CaseUpper] = 0x001ebe}}, + {0x001ebf, {[CaseLower] = 0x001ebf,[CaseTitle] = 0x001ebe,[CaseUpper] = 0x001ebe}}, + {0x001ec0, {[CaseLower] = 0x001ec1,[CaseTitle] = 0x001ec0,[CaseUpper] = 0x001ec0}}, + {0x001ec1, {[CaseLower] = 0x001ec1,[CaseTitle] = 0x001ec0,[CaseUpper] = 0x001ec0}}, + {0x001ec2, {[CaseLower] = 0x001ec3,[CaseTitle] = 0x001ec2,[CaseUpper] = 0x001ec2}}, + {0x001ec3, {[CaseLower] = 0x001ec3,[CaseTitle] = 0x001ec2,[CaseUpper] = 0x001ec2}}, + {0x001ec4, {[CaseLower] = 0x001ec5,[CaseTitle] = 0x001ec4,[CaseUpper] = 0x001ec4}}, + {0x001ec5, {[CaseLower] = 0x001ec5,[CaseTitle] = 0x001ec4,[CaseUpper] = 0x001ec4}}, + {0x001ec6, {[CaseLower] = 0x001ec7,[CaseTitle] = 0x001ec6,[CaseUpper] = 0x001ec6}}, + {0x001ec7, {[CaseLower] = 0x001ec7,[CaseTitle] = 0x001ec6,[CaseUpper] = 0x001ec6}}, + {0x001ec8, {[CaseLower] = 0x001ec9,[CaseTitle] = 0x001ec8,[CaseUpper] = 0x001ec8}}, + {0x001ec9, {[CaseLower] = 0x001ec9,[CaseTitle] = 0x001ec8,[CaseUpper] = 0x001ec8}}, + {0x001eca, {[CaseLower] = 0x001ecb,[CaseTitle] = 0x001eca,[CaseUpper] = 0x001eca}}, + {0x001ecb, {[CaseLower] = 0x001ecb,[CaseTitle] = 0x001eca,[CaseUpper] = 0x001eca}}, + {0x001ecc, {[CaseLower] = 0x001ecd,[CaseTitle] = 0x001ecc,[CaseUpper] = 0x001ecc}}, + {0x001ecd, {[CaseLower] = 0x001ecd,[CaseTitle] = 0x001ecc,[CaseUpper] = 0x001ecc}}, + {0x001ece, {[CaseLower] = 0x001ecf,[CaseTitle] = 0x001ece,[CaseUpper] = 0x001ece}}, + {0x001ecf, {[CaseLower] = 0x001ecf,[CaseTitle] = 0x001ece,[CaseUpper] = 0x001ece}}, + {0x001ed0, {[CaseLower] = 0x001ed1,[CaseTitle] = 0x001ed0,[CaseUpper] = 0x001ed0}}, + {0x001ed1, {[CaseLower] = 0x001ed1,[CaseTitle] = 0x001ed0,[CaseUpper] = 0x001ed0}}, + {0x001ed2, {[CaseLower] = 0x001ed3,[CaseTitle] = 0x001ed2,[CaseUpper] = 0x001ed2}}, + {0x001ed3, {[CaseLower] = 0x001ed3,[CaseTitle] = 0x001ed2,[CaseUpper] = 0x001ed2}}, + {0x001ed4, {[CaseLower] = 0x001ed5,[CaseTitle] = 0x001ed4,[CaseUpper] = 0x001ed4}}, + {0x001ed5, {[CaseLower] = 0x001ed5,[CaseTitle] = 0x001ed4,[CaseUpper] = 0x001ed4}}, + {0x001ed6, {[CaseLower] = 0x001ed7,[CaseTitle] = 0x001ed6,[CaseUpper] = 0x001ed6}}, + {0x001ed7, {[CaseLower] = 0x001ed7,[CaseTitle] = 0x001ed6,[CaseUpper] = 0x001ed6}}, + {0x001ed8, {[CaseLower] = 0x001ed9,[CaseTitle] = 0x001ed8,[CaseUpper] = 0x001ed8}}, + {0x001ed9, {[CaseLower] = 0x001ed9,[CaseTitle] = 0x001ed8,[CaseUpper] = 0x001ed8}}, + {0x001eda, {[CaseLower] = 0x001edb,[CaseTitle] = 0x001eda,[CaseUpper] = 0x001eda}}, + {0x001edb, {[CaseLower] = 0x001edb,[CaseTitle] = 0x001eda,[CaseUpper] = 0x001eda}}, + {0x001edc, {[CaseLower] = 0x001edd,[CaseTitle] = 0x001edc,[CaseUpper] = 0x001edc}}, + {0x001edd, {[CaseLower] = 0x001edd,[CaseTitle] = 0x001edc,[CaseUpper] = 0x001edc}}, + {0x001ede, {[CaseLower] = 0x001edf,[CaseTitle] = 0x001ede,[CaseUpper] = 0x001ede}}, + {0x001edf, {[CaseLower] = 0x001edf,[CaseTitle] = 0x001ede,[CaseUpper] = 0x001ede}}, + {0x001ee0, {[CaseLower] = 0x001ee1,[CaseTitle] = 0x001ee0,[CaseUpper] = 0x001ee0}}, + {0x001ee1, {[CaseLower] = 0x001ee1,[CaseTitle] = 0x001ee0,[CaseUpper] = 0x001ee0}}, + {0x001ee2, {[CaseLower] = 0x001ee3,[CaseTitle] = 0x001ee2,[CaseUpper] = 0x001ee2}}, + {0x001ee3, {[CaseLower] = 0x001ee3,[CaseTitle] = 0x001ee2,[CaseUpper] = 0x001ee2}}, + {0x001ee4, {[CaseLower] = 0x001ee5,[CaseTitle] = 0x001ee4,[CaseUpper] = 0x001ee4}}, + {0x001ee5, {[CaseLower] = 0x001ee5,[CaseTitle] = 0x001ee4,[CaseUpper] = 0x001ee4}}, + {0x001ee6, {[CaseLower] = 0x001ee7,[CaseTitle] = 0x001ee6,[CaseUpper] = 0x001ee6}}, + {0x001ee7, {[CaseLower] = 0x001ee7,[CaseTitle] = 0x001ee6,[CaseUpper] = 0x001ee6}}, + {0x001ee8, {[CaseLower] = 0x001ee9,[CaseTitle] = 0x001ee8,[CaseUpper] = 0x001ee8}}, + {0x001ee9, {[CaseLower] = 0x001ee9,[CaseTitle] = 0x001ee8,[CaseUpper] = 0x001ee8}}, + {0x001eea, {[CaseLower] = 0x001eeb,[CaseTitle] = 0x001eea,[CaseUpper] = 0x001eea}}, + {0x001eeb, {[CaseLower] = 0x001eeb,[CaseTitle] = 0x001eea,[CaseUpper] = 0x001eea}}, + {0x001eec, {[CaseLower] = 0x001eed,[CaseTitle] = 0x001eec,[CaseUpper] = 0x001eec}}, + {0x001eed, {[CaseLower] = 0x001eed,[CaseTitle] = 0x001eec,[CaseUpper] = 0x001eec}}, + {0x001eee, {[CaseLower] = 0x001eef,[CaseTitle] = 0x001eee,[CaseUpper] = 0x001eee}}, + {0x001eef, {[CaseLower] = 0x001eef,[CaseTitle] = 0x001eee,[CaseUpper] = 0x001eee}}, + {0x001ef0, {[CaseLower] = 0x001ef1,[CaseTitle] = 0x001ef0,[CaseUpper] = 0x001ef0}}, + {0x001ef1, {[CaseLower] = 0x001ef1,[CaseTitle] = 0x001ef0,[CaseUpper] = 0x001ef0}}, + {0x001ef2, {[CaseLower] = 0x001ef3,[CaseTitle] = 0x001ef2,[CaseUpper] = 0x001ef2}}, + {0x001ef3, {[CaseLower] = 0x001ef3,[CaseTitle] = 0x001ef2,[CaseUpper] = 0x001ef2}}, + {0x001ef4, {[CaseLower] = 0x001ef5,[CaseTitle] = 0x001ef4,[CaseUpper] = 0x001ef4}}, + {0x001ef5, {[CaseLower] = 0x001ef5,[CaseTitle] = 0x001ef4,[CaseUpper] = 0x001ef4}}, + {0x001ef6, {[CaseLower] = 0x001ef7,[CaseTitle] = 0x001ef6,[CaseUpper] = 0x001ef6}}, + {0x001ef7, {[CaseLower] = 0x001ef7,[CaseTitle] = 0x001ef6,[CaseUpper] = 0x001ef6}}, + {0x001ef8, {[CaseLower] = 0x001ef9,[CaseTitle] = 0x001ef8,[CaseUpper] = 0x001ef8}}, + {0x001ef9, {[CaseLower] = 0x001ef9,[CaseTitle] = 0x001ef8,[CaseUpper] = 0x001ef8}}, + {0x001efa, {[CaseLower] = 0x001efb,[CaseTitle] = 0x001efa,[CaseUpper] = 0x001efa}}, + {0x001efb, {[CaseLower] = 0x001efb,[CaseTitle] = 0x001efa,[CaseUpper] = 0x001efa}}, + {0x001efc, {[CaseLower] = 0x001efd,[CaseTitle] = 0x001efc,[CaseUpper] = 0x001efc}}, + {0x001efd, {[CaseLower] = 0x001efd,[CaseTitle] = 0x001efc,[CaseUpper] = 0x001efc}}, + {0x001efe, {[CaseLower] = 0x001eff,[CaseTitle] = 0x001efe,[CaseUpper] = 0x001efe}}, + {0x001eff, {[CaseLower] = 0x001eff,[CaseTitle] = 0x001efe,[CaseUpper] = 0x001efe}}, + {0x001f00, {[CaseLower] = 0x001f00,[CaseTitle] = 0x001f08,[CaseUpper] = 0x001f08}}, + {0x001f01, {[CaseLower] = 0x001f01,[CaseTitle] = 0x001f09,[CaseUpper] = 0x001f09}}, + {0x001f02, {[CaseLower] = 0x001f02,[CaseTitle] = 0x001f0a,[CaseUpper] = 0x001f0a}}, + {0x001f03, {[CaseLower] = 0x001f03,[CaseTitle] = 0x001f0b,[CaseUpper] = 0x001f0b}}, + {0x001f04, {[CaseLower] = 0x001f04,[CaseTitle] = 0x001f0c,[CaseUpper] = 0x001f0c}}, + {0x001f05, {[CaseLower] = 0x001f05,[CaseTitle] = 0x001f0d,[CaseUpper] = 0x001f0d}}, + {0x001f06, {[CaseLower] = 0x001f06,[CaseTitle] = 0x001f0e,[CaseUpper] = 0x001f0e}}, + {0x001f07, {[CaseLower] = 0x001f07,[CaseTitle] = 0x001f0f,[CaseUpper] = 0x001f0f}}, + {0x001f08, {[CaseLower] = 0x001f00,[CaseTitle] = 0x001f08,[CaseUpper] = 0x001f08}}, + {0x001f09, {[CaseLower] = 0x001f01,[CaseTitle] = 0x001f09,[CaseUpper] = 0x001f09}}, + {0x001f0a, {[CaseLower] = 0x001f02,[CaseTitle] = 0x001f0a,[CaseUpper] = 0x001f0a}}, + {0x001f0b, {[CaseLower] = 0x001f03,[CaseTitle] = 0x001f0b,[CaseUpper] = 0x001f0b}}, + {0x001f0c, {[CaseLower] = 0x001f04,[CaseTitle] = 0x001f0c,[CaseUpper] = 0x001f0c}}, + {0x001f0d, {[CaseLower] = 0x001f05,[CaseTitle] = 0x001f0d,[CaseUpper] = 0x001f0d}}, + {0x001f0e, {[CaseLower] = 0x001f06,[CaseTitle] = 0x001f0e,[CaseUpper] = 0x001f0e}}, + {0x001f0f, {[CaseLower] = 0x001f07,[CaseTitle] = 0x001f0f,[CaseUpper] = 0x001f0f}}, + {0x001f10, {[CaseLower] = 0x001f10,[CaseTitle] = 0x001f18,[CaseUpper] = 0x001f18}}, + {0x001f11, {[CaseLower] = 0x001f11,[CaseTitle] = 0x001f19,[CaseUpper] = 0x001f19}}, + {0x001f12, {[CaseLower] = 0x001f12,[CaseTitle] = 0x001f1a,[CaseUpper] = 0x001f1a}}, + {0x001f13, {[CaseLower] = 0x001f13,[CaseTitle] = 0x001f1b,[CaseUpper] = 0x001f1b}}, + {0x001f14, {[CaseLower] = 0x001f14,[CaseTitle] = 0x001f1c,[CaseUpper] = 0x001f1c}}, + {0x001f15, {[CaseLower] = 0x001f15,[CaseTitle] = 0x001f1d,[CaseUpper] = 0x001f1d}}, + {0x001f18, {[CaseLower] = 0x001f10,[CaseTitle] = 0x001f18,[CaseUpper] = 0x001f18}}, + {0x001f19, {[CaseLower] = 0x001f11,[CaseTitle] = 0x001f19,[CaseUpper] = 0x001f19}}, + {0x001f1a, {[CaseLower] = 0x001f12,[CaseTitle] = 0x001f1a,[CaseUpper] = 0x001f1a}}, + {0x001f1b, {[CaseLower] = 0x001f13,[CaseTitle] = 0x001f1b,[CaseUpper] = 0x001f1b}}, + {0x001f1c, {[CaseLower] = 0x001f14,[CaseTitle] = 0x001f1c,[CaseUpper] = 0x001f1c}}, + {0x001f1d, {[CaseLower] = 0x001f15,[CaseTitle] = 0x001f1d,[CaseUpper] = 0x001f1d}}, + {0x001f20, {[CaseLower] = 0x001f20,[CaseTitle] = 0x001f28,[CaseUpper] = 0x001f28}}, + {0x001f21, {[CaseLower] = 0x001f21,[CaseTitle] = 0x001f29,[CaseUpper] = 0x001f29}}, + {0x001f22, {[CaseLower] = 0x001f22,[CaseTitle] = 0x001f2a,[CaseUpper] = 0x001f2a}}, + {0x001f23, {[CaseLower] = 0x001f23,[CaseTitle] = 0x001f2b,[CaseUpper] = 0x001f2b}}, + {0x001f24, {[CaseLower] = 0x001f24,[CaseTitle] = 0x001f2c,[CaseUpper] = 0x001f2c}}, + {0x001f25, {[CaseLower] = 0x001f25,[CaseTitle] = 0x001f2d,[CaseUpper] = 0x001f2d}}, + {0x001f26, {[CaseLower] = 0x001f26,[CaseTitle] = 0x001f2e,[CaseUpper] = 0x001f2e}}, + {0x001f27, {[CaseLower] = 0x001f27,[CaseTitle] = 0x001f2f,[CaseUpper] = 0x001f2f}}, + {0x001f28, {[CaseLower] = 0x001f20,[CaseTitle] = 0x001f28,[CaseUpper] = 0x001f28}}, + {0x001f29, {[CaseLower] = 0x001f21,[CaseTitle] = 0x001f29,[CaseUpper] = 0x001f29}}, + {0x001f2a, {[CaseLower] = 0x001f22,[CaseTitle] = 0x001f2a,[CaseUpper] = 0x001f2a}}, + {0x001f2b, {[CaseLower] = 0x001f23,[CaseTitle] = 0x001f2b,[CaseUpper] = 0x001f2b}}, + {0x001f2c, {[CaseLower] = 0x001f24,[CaseTitle] = 0x001f2c,[CaseUpper] = 0x001f2c}}, + {0x001f2d, {[CaseLower] = 0x001f25,[CaseTitle] = 0x001f2d,[CaseUpper] = 0x001f2d}}, + {0x001f2e, {[CaseLower] = 0x001f26,[CaseTitle] = 0x001f2e,[CaseUpper] = 0x001f2e}}, + {0x001f2f, {[CaseLower] = 0x001f27,[CaseTitle] = 0x001f2f,[CaseUpper] = 0x001f2f}}, + {0x001f30, {[CaseLower] = 0x001f30,[CaseTitle] = 0x001f38,[CaseUpper] = 0x001f38}}, + {0x001f31, {[CaseLower] = 0x001f31,[CaseTitle] = 0x001f39,[CaseUpper] = 0x001f39}}, + {0x001f32, {[CaseLower] = 0x001f32,[CaseTitle] = 0x001f3a,[CaseUpper] = 0x001f3a}}, + {0x001f33, {[CaseLower] = 0x001f33,[CaseTitle] = 0x001f3b,[CaseUpper] = 0x001f3b}}, + {0x001f34, {[CaseLower] = 0x001f34,[CaseTitle] = 0x001f3c,[CaseUpper] = 0x001f3c}}, + {0x001f35, {[CaseLower] = 0x001f35,[CaseTitle] = 0x001f3d,[CaseUpper] = 0x001f3d}}, + {0x001f36, {[CaseLower] = 0x001f36,[CaseTitle] = 0x001f3e,[CaseUpper] = 0x001f3e}}, + {0x001f37, {[CaseLower] = 0x001f37,[CaseTitle] = 0x001f3f,[CaseUpper] = 0x001f3f}}, + {0x001f38, {[CaseLower] = 0x001f30,[CaseTitle] = 0x001f38,[CaseUpper] = 0x001f38}}, + {0x001f39, {[CaseLower] = 0x001f31,[CaseTitle] = 0x001f39,[CaseUpper] = 0x001f39}}, + {0x001f3a, {[CaseLower] = 0x001f32,[CaseTitle] = 0x001f3a,[CaseUpper] = 0x001f3a}}, + {0x001f3b, {[CaseLower] = 0x001f33,[CaseTitle] = 0x001f3b,[CaseUpper] = 0x001f3b}}, + {0x001f3c, {[CaseLower] = 0x001f34,[CaseTitle] = 0x001f3c,[CaseUpper] = 0x001f3c}}, + {0x001f3d, {[CaseLower] = 0x001f35,[CaseTitle] = 0x001f3d,[CaseUpper] = 0x001f3d}}, + {0x001f3e, {[CaseLower] = 0x001f36,[CaseTitle] = 0x001f3e,[CaseUpper] = 0x001f3e}}, + {0x001f3f, {[CaseLower] = 0x001f37,[CaseTitle] = 0x001f3f,[CaseUpper] = 0x001f3f}}, + {0x001f40, {[CaseLower] = 0x001f40,[CaseTitle] = 0x001f48,[CaseUpper] = 0x001f48}}, + {0x001f41, {[CaseLower] = 0x001f41,[CaseTitle] = 0x001f49,[CaseUpper] = 0x001f49}}, + {0x001f42, {[CaseLower] = 0x001f42,[CaseTitle] = 0x001f4a,[CaseUpper] = 0x001f4a}}, + {0x001f43, {[CaseLower] = 0x001f43,[CaseTitle] = 0x001f4b,[CaseUpper] = 0x001f4b}}, + {0x001f44, {[CaseLower] = 0x001f44,[CaseTitle] = 0x001f4c,[CaseUpper] = 0x001f4c}}, + {0x001f45, {[CaseLower] = 0x001f45,[CaseTitle] = 0x001f4d,[CaseUpper] = 0x001f4d}}, + {0x001f48, {[CaseLower] = 0x001f40,[CaseTitle] = 0x001f48,[CaseUpper] = 0x001f48}}, + {0x001f49, {[CaseLower] = 0x001f41,[CaseTitle] = 0x001f49,[CaseUpper] = 0x001f49}}, + {0x001f4a, {[CaseLower] = 0x001f42,[CaseTitle] = 0x001f4a,[CaseUpper] = 0x001f4a}}, + {0x001f4b, {[CaseLower] = 0x001f43,[CaseTitle] = 0x001f4b,[CaseUpper] = 0x001f4b}}, + {0x001f4c, {[CaseLower] = 0x001f44,[CaseTitle] = 0x001f4c,[CaseUpper] = 0x001f4c}}, + {0x001f4d, {[CaseLower] = 0x001f45,[CaseTitle] = 0x001f4d,[CaseUpper] = 0x001f4d}}, + {0x001f51, {[CaseLower] = 0x001f51,[CaseTitle] = 0x001f59,[CaseUpper] = 0x001f59}}, + {0x001f53, {[CaseLower] = 0x001f53,[CaseTitle] = 0x001f5b,[CaseUpper] = 0x001f5b}}, + {0x001f55, {[CaseLower] = 0x001f55,[CaseTitle] = 0x001f5d,[CaseUpper] = 0x001f5d}}, + {0x001f57, {[CaseLower] = 0x001f57,[CaseTitle] = 0x001f5f,[CaseUpper] = 0x001f5f}}, + {0x001f59, {[CaseLower] = 0x001f51,[CaseTitle] = 0x001f59,[CaseUpper] = 0x001f59}}, + {0x001f5b, {[CaseLower] = 0x001f53,[CaseTitle] = 0x001f5b,[CaseUpper] = 0x001f5b}}, + {0x001f5d, {[CaseLower] = 0x001f55,[CaseTitle] = 0x001f5d,[CaseUpper] = 0x001f5d}}, + {0x001f5f, {[CaseLower] = 0x001f57,[CaseTitle] = 0x001f5f,[CaseUpper] = 0x001f5f}}, + {0x001f60, {[CaseLower] = 0x001f60,[CaseTitle] = 0x001f68,[CaseUpper] = 0x001f68}}, + {0x001f61, {[CaseLower] = 0x001f61,[CaseTitle] = 0x001f69,[CaseUpper] = 0x001f69}}, + {0x001f62, {[CaseLower] = 0x001f62,[CaseTitle] = 0x001f6a,[CaseUpper] = 0x001f6a}}, + {0x001f63, {[CaseLower] = 0x001f63,[CaseTitle] = 0x001f6b,[CaseUpper] = 0x001f6b}}, + {0x001f64, {[CaseLower] = 0x001f64,[CaseTitle] = 0x001f6c,[CaseUpper] = 0x001f6c}}, + {0x001f65, {[CaseLower] = 0x001f65,[CaseTitle] = 0x001f6d,[CaseUpper] = 0x001f6d}}, + {0x001f66, {[CaseLower] = 0x001f66,[CaseTitle] = 0x001f6e,[CaseUpper] = 0x001f6e}}, + {0x001f67, {[CaseLower] = 0x001f67,[CaseTitle] = 0x001f6f,[CaseUpper] = 0x001f6f}}, + {0x001f68, {[CaseLower] = 0x001f60,[CaseTitle] = 0x001f68,[CaseUpper] = 0x001f68}}, + {0x001f69, {[CaseLower] = 0x001f61,[CaseTitle] = 0x001f69,[CaseUpper] = 0x001f69}}, + {0x001f6a, {[CaseLower] = 0x001f62,[CaseTitle] = 0x001f6a,[CaseUpper] = 0x001f6a}}, + {0x001f6b, {[CaseLower] = 0x001f63,[CaseTitle] = 0x001f6b,[CaseUpper] = 0x001f6b}}, + {0x001f6c, {[CaseLower] = 0x001f64,[CaseTitle] = 0x001f6c,[CaseUpper] = 0x001f6c}}, + {0x001f6d, {[CaseLower] = 0x001f65,[CaseTitle] = 0x001f6d,[CaseUpper] = 0x001f6d}}, + {0x001f6e, {[CaseLower] = 0x001f66,[CaseTitle] = 0x001f6e,[CaseUpper] = 0x001f6e}}, + {0x001f6f, {[CaseLower] = 0x001f67,[CaseTitle] = 0x001f6f,[CaseUpper] = 0x001f6f}}, + {0x001f70, {[CaseLower] = 0x001f70,[CaseTitle] = 0x001fba,[CaseUpper] = 0x001fba}}, + {0x001f71, {[CaseLower] = 0x001f71,[CaseTitle] = 0x001fbb,[CaseUpper] = 0x001fbb}}, + {0x001f72, {[CaseLower] = 0x001f72,[CaseTitle] = 0x001fc8,[CaseUpper] = 0x001fc8}}, + {0x001f73, {[CaseLower] = 0x001f73,[CaseTitle] = 0x001fc9,[CaseUpper] = 0x001fc9}}, + {0x001f74, {[CaseLower] = 0x001f74,[CaseTitle] = 0x001fca,[CaseUpper] = 0x001fca}}, + {0x001f75, {[CaseLower] = 0x001f75,[CaseTitle] = 0x001fcb,[CaseUpper] = 0x001fcb}}, + {0x001f76, {[CaseLower] = 0x001f76,[CaseTitle] = 0x001fda,[CaseUpper] = 0x001fda}}, + {0x001f77, {[CaseLower] = 0x001f77,[CaseTitle] = 0x001fdb,[CaseUpper] = 0x001fdb}}, + {0x001f78, {[CaseLower] = 0x001f78,[CaseTitle] = 0x001ff8,[CaseUpper] = 0x001ff8}}, + {0x001f79, {[CaseLower] = 0x001f79,[CaseTitle] = 0x001ff9,[CaseUpper] = 0x001ff9}}, + {0x001f7a, {[CaseLower] = 0x001f7a,[CaseTitle] = 0x001fea,[CaseUpper] = 0x001fea}}, + {0x001f7b, {[CaseLower] = 0x001f7b,[CaseTitle] = 0x001feb,[CaseUpper] = 0x001feb}}, + {0x001f7c, {[CaseLower] = 0x001f7c,[CaseTitle] = 0x001ffa,[CaseUpper] = 0x001ffa}}, + {0x001f7d, {[CaseLower] = 0x001f7d,[CaseTitle] = 0x001ffb,[CaseUpper] = 0x001ffb}}, + {0x001f80, {[CaseLower] = 0x001f80,[CaseTitle] = 0x001f88,[CaseUpper] = 0x001f88}}, + {0x001f81, {[CaseLower] = 0x001f81,[CaseTitle] = 0x001f89,[CaseUpper] = 0x001f89}}, + {0x001f82, {[CaseLower] = 0x001f82,[CaseTitle] = 0x001f8a,[CaseUpper] = 0x001f8a}}, + {0x001f83, {[CaseLower] = 0x001f83,[CaseTitle] = 0x001f8b,[CaseUpper] = 0x001f8b}}, + {0x001f84, {[CaseLower] = 0x001f84,[CaseTitle] = 0x001f8c,[CaseUpper] = 0x001f8c}}, + {0x001f85, {[CaseLower] = 0x001f85,[CaseTitle] = 0x001f8d,[CaseUpper] = 0x001f8d}}, + {0x001f86, {[CaseLower] = 0x001f86,[CaseTitle] = 0x001f8e,[CaseUpper] = 0x001f8e}}, + {0x001f87, {[CaseLower] = 0x001f87,[CaseTitle] = 0x001f8f,[CaseUpper] = 0x001f8f}}, + {0x001f88, {[CaseLower] = 0x001f80,[CaseTitle] = 0x001f88,[CaseUpper] = 0x001f88}}, + {0x001f89, {[CaseLower] = 0x001f81,[CaseTitle] = 0x001f89,[CaseUpper] = 0x001f89}}, + {0x001f8a, {[CaseLower] = 0x001f82,[CaseTitle] = 0x001f8a,[CaseUpper] = 0x001f8a}}, + {0x001f8b, {[CaseLower] = 0x001f83,[CaseTitle] = 0x001f8b,[CaseUpper] = 0x001f8b}}, + {0x001f8c, {[CaseLower] = 0x001f84,[CaseTitle] = 0x001f8c,[CaseUpper] = 0x001f8c}}, + {0x001f8d, {[CaseLower] = 0x001f85,[CaseTitle] = 0x001f8d,[CaseUpper] = 0x001f8d}}, + {0x001f8e, {[CaseLower] = 0x001f86,[CaseTitle] = 0x001f8e,[CaseUpper] = 0x001f8e}}, + {0x001f8f, {[CaseLower] = 0x001f87,[CaseTitle] = 0x001f8f,[CaseUpper] = 0x001f8f}}, + {0x001f90, {[CaseLower] = 0x001f90,[CaseTitle] = 0x001f98,[CaseUpper] = 0x001f98}}, + {0x001f91, {[CaseLower] = 0x001f91,[CaseTitle] = 0x001f99,[CaseUpper] = 0x001f99}}, + {0x001f92, {[CaseLower] = 0x001f92,[CaseTitle] = 0x001f9a,[CaseUpper] = 0x001f9a}}, + {0x001f93, {[CaseLower] = 0x001f93,[CaseTitle] = 0x001f9b,[CaseUpper] = 0x001f9b}}, + {0x001f94, {[CaseLower] = 0x001f94,[CaseTitle] = 0x001f9c,[CaseUpper] = 0x001f9c}}, + {0x001f95, {[CaseLower] = 0x001f95,[CaseTitle] = 0x001f9d,[CaseUpper] = 0x001f9d}}, + {0x001f96, {[CaseLower] = 0x001f96,[CaseTitle] = 0x001f9e,[CaseUpper] = 0x001f9e}}, + {0x001f97, {[CaseLower] = 0x001f97,[CaseTitle] = 0x001f9f,[CaseUpper] = 0x001f9f}}, + {0x001f98, {[CaseLower] = 0x001f90,[CaseTitle] = 0x001f98,[CaseUpper] = 0x001f98}}, + {0x001f99, {[CaseLower] = 0x001f91,[CaseTitle] = 0x001f99,[CaseUpper] = 0x001f99}}, + {0x001f9a, {[CaseLower] = 0x001f92,[CaseTitle] = 0x001f9a,[CaseUpper] = 0x001f9a}}, + {0x001f9b, {[CaseLower] = 0x001f93,[CaseTitle] = 0x001f9b,[CaseUpper] = 0x001f9b}}, + {0x001f9c, {[CaseLower] = 0x001f94,[CaseTitle] = 0x001f9c,[CaseUpper] = 0x001f9c}}, + {0x001f9d, {[CaseLower] = 0x001f95,[CaseTitle] = 0x001f9d,[CaseUpper] = 0x001f9d}}, + {0x001f9e, {[CaseLower] = 0x001f96,[CaseTitle] = 0x001f9e,[CaseUpper] = 0x001f9e}}, + {0x001f9f, {[CaseLower] = 0x001f97,[CaseTitle] = 0x001f9f,[CaseUpper] = 0x001f9f}}, + {0x001fa0, {[CaseLower] = 0x001fa0,[CaseTitle] = 0x001fa8,[CaseUpper] = 0x001fa8}}, + {0x001fa1, {[CaseLower] = 0x001fa1,[CaseTitle] = 0x001fa9,[CaseUpper] = 0x001fa9}}, + {0x001fa2, {[CaseLower] = 0x001fa2,[CaseTitle] = 0x001faa,[CaseUpper] = 0x001faa}}, + {0x001fa3, {[CaseLower] = 0x001fa3,[CaseTitle] = 0x001fab,[CaseUpper] = 0x001fab}}, + {0x001fa4, {[CaseLower] = 0x001fa4,[CaseTitle] = 0x001fac,[CaseUpper] = 0x001fac}}, + {0x001fa5, {[CaseLower] = 0x001fa5,[CaseTitle] = 0x001fad,[CaseUpper] = 0x001fad}}, + {0x001fa6, {[CaseLower] = 0x001fa6,[CaseTitle] = 0x001fae,[CaseUpper] = 0x001fae}}, + {0x001fa7, {[CaseLower] = 0x001fa7,[CaseTitle] = 0x001faf,[CaseUpper] = 0x001faf}}, + {0x001fa8, {[CaseLower] = 0x001fa0,[CaseTitle] = 0x001fa8,[CaseUpper] = 0x001fa8}}, + {0x001fa9, {[CaseLower] = 0x001fa1,[CaseTitle] = 0x001fa9,[CaseUpper] = 0x001fa9}}, + {0x001faa, {[CaseLower] = 0x001fa2,[CaseTitle] = 0x001faa,[CaseUpper] = 0x001faa}}, + {0x001fab, {[CaseLower] = 0x001fa3,[CaseTitle] = 0x001fab,[CaseUpper] = 0x001fab}}, + {0x001fac, {[CaseLower] = 0x001fa4,[CaseTitle] = 0x001fac,[CaseUpper] = 0x001fac}}, + {0x001fad, {[CaseLower] = 0x001fa5,[CaseTitle] = 0x001fad,[CaseUpper] = 0x001fad}}, + {0x001fae, {[CaseLower] = 0x001fa6,[CaseTitle] = 0x001fae,[CaseUpper] = 0x001fae}}, + {0x001faf, {[CaseLower] = 0x001fa7,[CaseTitle] = 0x001faf,[CaseUpper] = 0x001faf}}, + {0x001fb0, {[CaseLower] = 0x001fb0,[CaseTitle] = 0x001fb8,[CaseUpper] = 0x001fb8}}, + {0x001fb1, {[CaseLower] = 0x001fb1,[CaseTitle] = 0x001fb9,[CaseUpper] = 0x001fb9}}, + {0x001fb3, {[CaseLower] = 0x001fb3,[CaseTitle] = 0x001fbc,[CaseUpper] = 0x001fbc}}, + {0x001fb8, {[CaseLower] = 0x001fb0,[CaseTitle] = 0x001fb8,[CaseUpper] = 0x001fb8}}, + {0x001fb9, {[CaseLower] = 0x001fb1,[CaseTitle] = 0x001fb9,[CaseUpper] = 0x001fb9}}, + {0x001fba, {[CaseLower] = 0x001f70,[CaseTitle] = 0x001fba,[CaseUpper] = 0x001fba}}, + {0x001fbb, {[CaseLower] = 0x001f71,[CaseTitle] = 0x001fbb,[CaseUpper] = 0x001fbb}}, + {0x001fbc, {[CaseLower] = 0x001fb3,[CaseTitle] = 0x001fbc,[CaseUpper] = 0x001fbc}}, + {0x001fbe, {[CaseLower] = 0x001fbe,[CaseTitle] = 0x000399,[CaseUpper] = 0x000399}}, + {0x001fc3, {[CaseLower] = 0x001fc3,[CaseTitle] = 0x001fcc,[CaseUpper] = 0x001fcc}}, + {0x001fc8, {[CaseLower] = 0x001f72,[CaseTitle] = 0x001fc8,[CaseUpper] = 0x001fc8}}, + {0x001fc9, {[CaseLower] = 0x001f73,[CaseTitle] = 0x001fc9,[CaseUpper] = 0x001fc9}}, + {0x001fca, {[CaseLower] = 0x001f74,[CaseTitle] = 0x001fca,[CaseUpper] = 0x001fca}}, + {0x001fcb, {[CaseLower] = 0x001f75,[CaseTitle] = 0x001fcb,[CaseUpper] = 0x001fcb}}, + {0x001fcc, {[CaseLower] = 0x001fc3,[CaseTitle] = 0x001fcc,[CaseUpper] = 0x001fcc}}, + {0x001fd0, {[CaseLower] = 0x001fd0,[CaseTitle] = 0x001fd8,[CaseUpper] = 0x001fd8}}, + {0x001fd1, {[CaseLower] = 0x001fd1,[CaseTitle] = 0x001fd9,[CaseUpper] = 0x001fd9}}, + {0x001fd8, {[CaseLower] = 0x001fd0,[CaseTitle] = 0x001fd8,[CaseUpper] = 0x001fd8}}, + {0x001fd9, {[CaseLower] = 0x001fd1,[CaseTitle] = 0x001fd9,[CaseUpper] = 0x001fd9}}, + {0x001fda, {[CaseLower] = 0x001f76,[CaseTitle] = 0x001fda,[CaseUpper] = 0x001fda}}, + {0x001fdb, {[CaseLower] = 0x001f77,[CaseTitle] = 0x001fdb,[CaseUpper] = 0x001fdb}}, + {0x001fe0, {[CaseLower] = 0x001fe0,[CaseTitle] = 0x001fe8,[CaseUpper] = 0x001fe8}}, + {0x001fe1, {[CaseLower] = 0x001fe1,[CaseTitle] = 0x001fe9,[CaseUpper] = 0x001fe9}}, + {0x001fe5, {[CaseLower] = 0x001fe5,[CaseTitle] = 0x001fec,[CaseUpper] = 0x001fec}}, + {0x001fe8, {[CaseLower] = 0x001fe0,[CaseTitle] = 0x001fe8,[CaseUpper] = 0x001fe8}}, + {0x001fe9, {[CaseLower] = 0x001fe1,[CaseTitle] = 0x001fe9,[CaseUpper] = 0x001fe9}}, + {0x001fea, {[CaseLower] = 0x001f7a,[CaseTitle] = 0x001fea,[CaseUpper] = 0x001fea}}, + {0x001feb, {[CaseLower] = 0x001f7b,[CaseTitle] = 0x001feb,[CaseUpper] = 0x001feb}}, + {0x001fec, {[CaseLower] = 0x001fe5,[CaseTitle] = 0x001fec,[CaseUpper] = 0x001fec}}, + {0x001ff3, {[CaseLower] = 0x001ff3,[CaseTitle] = 0x001ffc,[CaseUpper] = 0x001ffc}}, + {0x001ff8, {[CaseLower] = 0x001f78,[CaseTitle] = 0x001ff8,[CaseUpper] = 0x001ff8}}, + {0x001ff9, {[CaseLower] = 0x001f79,[CaseTitle] = 0x001ff9,[CaseUpper] = 0x001ff9}}, + {0x001ffa, {[CaseLower] = 0x001f7c,[CaseTitle] = 0x001ffa,[CaseUpper] = 0x001ffa}}, + {0x001ffb, {[CaseLower] = 0x001f7d,[CaseTitle] = 0x001ffb,[CaseUpper] = 0x001ffb}}, + {0x001ffc, {[CaseLower] = 0x001ff3,[CaseTitle] = 0x001ffc,[CaseUpper] = 0x001ffc}}, + {0x002126, {[CaseLower] = 0x0003c9,[CaseTitle] = 0x002126,[CaseUpper] = 0x002126}}, + {0x00212a, {[CaseLower] = 0x00006b,[CaseTitle] = 0x00212a,[CaseUpper] = 0x00212a}}, + {0x00212b, {[CaseLower] = 0x0000e5,[CaseTitle] = 0x00212b,[CaseUpper] = 0x00212b}}, + {0x002132, {[CaseLower] = 0x00214e,[CaseTitle] = 0x002132,[CaseUpper] = 0x002132}}, + {0x00214e, {[CaseLower] = 0x00214e,[CaseTitle] = 0x002132,[CaseUpper] = 0x002132}}, + {0x002160, {[CaseLower] = 0x002170,[CaseTitle] = 0x002160,[CaseUpper] = 0x002160}}, + {0x002161, {[CaseLower] = 0x002171,[CaseTitle] = 0x002161,[CaseUpper] = 0x002161}}, + {0x002162, {[CaseLower] = 0x002172,[CaseTitle] = 0x002162,[CaseUpper] = 0x002162}}, + {0x002163, {[CaseLower] = 0x002173,[CaseTitle] = 0x002163,[CaseUpper] = 0x002163}}, + {0x002164, {[CaseLower] = 0x002174,[CaseTitle] = 0x002164,[CaseUpper] = 0x002164}}, + {0x002165, {[CaseLower] = 0x002175,[CaseTitle] = 0x002165,[CaseUpper] = 0x002165}}, + {0x002166, {[CaseLower] = 0x002176,[CaseTitle] = 0x002166,[CaseUpper] = 0x002166}}, + {0x002167, {[CaseLower] = 0x002177,[CaseTitle] = 0x002167,[CaseUpper] = 0x002167}}, + {0x002168, {[CaseLower] = 0x002178,[CaseTitle] = 0x002168,[CaseUpper] = 0x002168}}, + {0x002169, {[CaseLower] = 0x002179,[CaseTitle] = 0x002169,[CaseUpper] = 0x002169}}, + {0x00216a, {[CaseLower] = 0x00217a,[CaseTitle] = 0x00216a,[CaseUpper] = 0x00216a}}, + {0x00216b, {[CaseLower] = 0x00217b,[CaseTitle] = 0x00216b,[CaseUpper] = 0x00216b}}, + {0x00216c, {[CaseLower] = 0x00217c,[CaseTitle] = 0x00216c,[CaseUpper] = 0x00216c}}, + {0x00216d, {[CaseLower] = 0x00217d,[CaseTitle] = 0x00216d,[CaseUpper] = 0x00216d}}, + {0x00216e, {[CaseLower] = 0x00217e,[CaseTitle] = 0x00216e,[CaseUpper] = 0x00216e}}, + {0x00216f, {[CaseLower] = 0x00217f,[CaseTitle] = 0x00216f,[CaseUpper] = 0x00216f}}, + {0x002170, {[CaseLower] = 0x002170,[CaseTitle] = 0x002160,[CaseUpper] = 0x002160}}, + {0x002171, {[CaseLower] = 0x002171,[CaseTitle] = 0x002161,[CaseUpper] = 0x002161}}, + {0x002172, {[CaseLower] = 0x002172,[CaseTitle] = 0x002162,[CaseUpper] = 0x002162}}, + {0x002173, {[CaseLower] = 0x002173,[CaseTitle] = 0x002163,[CaseUpper] = 0x002163}}, + {0x002174, {[CaseLower] = 0x002174,[CaseTitle] = 0x002164,[CaseUpper] = 0x002164}}, + {0x002175, {[CaseLower] = 0x002175,[CaseTitle] = 0x002165,[CaseUpper] = 0x002165}}, + {0x002176, {[CaseLower] = 0x002176,[CaseTitle] = 0x002166,[CaseUpper] = 0x002166}}, + {0x002177, {[CaseLower] = 0x002177,[CaseTitle] = 0x002167,[CaseUpper] = 0x002167}}, + {0x002178, {[CaseLower] = 0x002178,[CaseTitle] = 0x002168,[CaseUpper] = 0x002168}}, + {0x002179, {[CaseLower] = 0x002179,[CaseTitle] = 0x002169,[CaseUpper] = 0x002169}}, + {0x00217a, {[CaseLower] = 0x00217a,[CaseTitle] = 0x00216a,[CaseUpper] = 0x00216a}}, + {0x00217b, {[CaseLower] = 0x00217b,[CaseTitle] = 0x00216b,[CaseUpper] = 0x00216b}}, + {0x00217c, {[CaseLower] = 0x00217c,[CaseTitle] = 0x00216c,[CaseUpper] = 0x00216c}}, + {0x00217d, {[CaseLower] = 0x00217d,[CaseTitle] = 0x00216d,[CaseUpper] = 0x00216d}}, + {0x00217e, {[CaseLower] = 0x00217e,[CaseTitle] = 0x00216e,[CaseUpper] = 0x00216e}}, + {0x00217f, {[CaseLower] = 0x00217f,[CaseTitle] = 0x00216f,[CaseUpper] = 0x00216f}}, + {0x002183, {[CaseLower] = 0x002184,[CaseTitle] = 0x002183,[CaseUpper] = 0x002183}}, + {0x002184, {[CaseLower] = 0x002184,[CaseTitle] = 0x002183,[CaseUpper] = 0x002183}}, + {0x0024b6, {[CaseLower] = 0x0024d0,[CaseTitle] = 0x0024b6,[CaseUpper] = 0x0024b6}}, + {0x0024b7, {[CaseLower] = 0x0024d1,[CaseTitle] = 0x0024b7,[CaseUpper] = 0x0024b7}}, + {0x0024b8, {[CaseLower] = 0x0024d2,[CaseTitle] = 0x0024b8,[CaseUpper] = 0x0024b8}}, + {0x0024b9, {[CaseLower] = 0x0024d3,[CaseTitle] = 0x0024b9,[CaseUpper] = 0x0024b9}}, + {0x0024ba, {[CaseLower] = 0x0024d4,[CaseTitle] = 0x0024ba,[CaseUpper] = 0x0024ba}}, + {0x0024bb, {[CaseLower] = 0x0024d5,[CaseTitle] = 0x0024bb,[CaseUpper] = 0x0024bb}}, + {0x0024bc, {[CaseLower] = 0x0024d6,[CaseTitle] = 0x0024bc,[CaseUpper] = 0x0024bc}}, + {0x0024bd, {[CaseLower] = 0x0024d7,[CaseTitle] = 0x0024bd,[CaseUpper] = 0x0024bd}}, + {0x0024be, {[CaseLower] = 0x0024d8,[CaseTitle] = 0x0024be,[CaseUpper] = 0x0024be}}, + {0x0024bf, {[CaseLower] = 0x0024d9,[CaseTitle] = 0x0024bf,[CaseUpper] = 0x0024bf}}, + {0x0024c0, {[CaseLower] = 0x0024da,[CaseTitle] = 0x0024c0,[CaseUpper] = 0x0024c0}}, + {0x0024c1, {[CaseLower] = 0x0024db,[CaseTitle] = 0x0024c1,[CaseUpper] = 0x0024c1}}, + {0x0024c2, {[CaseLower] = 0x0024dc,[CaseTitle] = 0x0024c2,[CaseUpper] = 0x0024c2}}, + {0x0024c3, {[CaseLower] = 0x0024dd,[CaseTitle] = 0x0024c3,[CaseUpper] = 0x0024c3}}, + {0x0024c4, {[CaseLower] = 0x0024de,[CaseTitle] = 0x0024c4,[CaseUpper] = 0x0024c4}}, + {0x0024c5, {[CaseLower] = 0x0024df,[CaseTitle] = 0x0024c5,[CaseUpper] = 0x0024c5}}, + {0x0024c6, {[CaseLower] = 0x0024e0,[CaseTitle] = 0x0024c6,[CaseUpper] = 0x0024c6}}, + {0x0024c7, {[CaseLower] = 0x0024e1,[CaseTitle] = 0x0024c7,[CaseUpper] = 0x0024c7}}, + {0x0024c8, {[CaseLower] = 0x0024e2,[CaseTitle] = 0x0024c8,[CaseUpper] = 0x0024c8}}, + {0x0024c9, {[CaseLower] = 0x0024e3,[CaseTitle] = 0x0024c9,[CaseUpper] = 0x0024c9}}, + {0x0024ca, {[CaseLower] = 0x0024e4,[CaseTitle] = 0x0024ca,[CaseUpper] = 0x0024ca}}, + {0x0024cb, {[CaseLower] = 0x0024e5,[CaseTitle] = 0x0024cb,[CaseUpper] = 0x0024cb}}, + {0x0024cc, {[CaseLower] = 0x0024e6,[CaseTitle] = 0x0024cc,[CaseUpper] = 0x0024cc}}, + {0x0024cd, {[CaseLower] = 0x0024e7,[CaseTitle] = 0x0024cd,[CaseUpper] = 0x0024cd}}, + {0x0024ce, {[CaseLower] = 0x0024e8,[CaseTitle] = 0x0024ce,[CaseUpper] = 0x0024ce}}, + {0x0024cf, {[CaseLower] = 0x0024e9,[CaseTitle] = 0x0024cf,[CaseUpper] = 0x0024cf}}, + {0x0024d0, {[CaseLower] = 0x0024d0,[CaseTitle] = 0x0024b6,[CaseUpper] = 0x0024b6}}, + {0x0024d1, {[CaseLower] = 0x0024d1,[CaseTitle] = 0x0024b7,[CaseUpper] = 0x0024b7}}, + {0x0024d2, {[CaseLower] = 0x0024d2,[CaseTitle] = 0x0024b8,[CaseUpper] = 0x0024b8}}, + {0x0024d3, {[CaseLower] = 0x0024d3,[CaseTitle] = 0x0024b9,[CaseUpper] = 0x0024b9}}, + {0x0024d4, {[CaseLower] = 0x0024d4,[CaseTitle] = 0x0024ba,[CaseUpper] = 0x0024ba}}, + {0x0024d5, {[CaseLower] = 0x0024d5,[CaseTitle] = 0x0024bb,[CaseUpper] = 0x0024bb}}, + {0x0024d6, {[CaseLower] = 0x0024d6,[CaseTitle] = 0x0024bc,[CaseUpper] = 0x0024bc}}, + {0x0024d7, {[CaseLower] = 0x0024d7,[CaseTitle] = 0x0024bd,[CaseUpper] = 0x0024bd}}, + {0x0024d8, {[CaseLower] = 0x0024d8,[CaseTitle] = 0x0024be,[CaseUpper] = 0x0024be}}, + {0x0024d9, {[CaseLower] = 0x0024d9,[CaseTitle] = 0x0024bf,[CaseUpper] = 0x0024bf}}, + {0x0024da, {[CaseLower] = 0x0024da,[CaseTitle] = 0x0024c0,[CaseUpper] = 0x0024c0}}, + {0x0024db, {[CaseLower] = 0x0024db,[CaseTitle] = 0x0024c1,[CaseUpper] = 0x0024c1}}, + {0x0024dc, {[CaseLower] = 0x0024dc,[CaseTitle] = 0x0024c2,[CaseUpper] = 0x0024c2}}, + {0x0024dd, {[CaseLower] = 0x0024dd,[CaseTitle] = 0x0024c3,[CaseUpper] = 0x0024c3}}, + {0x0024de, {[CaseLower] = 0x0024de,[CaseTitle] = 0x0024c4,[CaseUpper] = 0x0024c4}}, + {0x0024df, {[CaseLower] = 0x0024df,[CaseTitle] = 0x0024c5,[CaseUpper] = 0x0024c5}}, + {0x0024e0, {[CaseLower] = 0x0024e0,[CaseTitle] = 0x0024c6,[CaseUpper] = 0x0024c6}}, + {0x0024e1, {[CaseLower] = 0x0024e1,[CaseTitle] = 0x0024c7,[CaseUpper] = 0x0024c7}}, + {0x0024e2, {[CaseLower] = 0x0024e2,[CaseTitle] = 0x0024c8,[CaseUpper] = 0x0024c8}}, + {0x0024e3, {[CaseLower] = 0x0024e3,[CaseTitle] = 0x0024c9,[CaseUpper] = 0x0024c9}}, + {0x0024e4, {[CaseLower] = 0x0024e4,[CaseTitle] = 0x0024ca,[CaseUpper] = 0x0024ca}}, + {0x0024e5, {[CaseLower] = 0x0024e5,[CaseTitle] = 0x0024cb,[CaseUpper] = 0x0024cb}}, + {0x0024e6, {[CaseLower] = 0x0024e6,[CaseTitle] = 0x0024cc,[CaseUpper] = 0x0024cc}}, + {0x0024e7, {[CaseLower] = 0x0024e7,[CaseTitle] = 0x0024cd,[CaseUpper] = 0x0024cd}}, + {0x0024e8, {[CaseLower] = 0x0024e8,[CaseTitle] = 0x0024ce,[CaseUpper] = 0x0024ce}}, + {0x0024e9, {[CaseLower] = 0x0024e9,[CaseTitle] = 0x0024cf,[CaseUpper] = 0x0024cf}}, + {0x002c00, {[CaseLower] = 0x002c30,[CaseTitle] = 0x002c00,[CaseUpper] = 0x002c00}}, + {0x002c01, {[CaseLower] = 0x002c31,[CaseTitle] = 0x002c01,[CaseUpper] = 0x002c01}}, + {0x002c02, {[CaseLower] = 0x002c32,[CaseTitle] = 0x002c02,[CaseUpper] = 0x002c02}}, + {0x002c03, {[CaseLower] = 0x002c33,[CaseTitle] = 0x002c03,[CaseUpper] = 0x002c03}}, + {0x002c04, {[CaseLower] = 0x002c34,[CaseTitle] = 0x002c04,[CaseUpper] = 0x002c04}}, + {0x002c05, {[CaseLower] = 0x002c35,[CaseTitle] = 0x002c05,[CaseUpper] = 0x002c05}}, + {0x002c06, {[CaseLower] = 0x002c36,[CaseTitle] = 0x002c06,[CaseUpper] = 0x002c06}}, + {0x002c07, {[CaseLower] = 0x002c37,[CaseTitle] = 0x002c07,[CaseUpper] = 0x002c07}}, + {0x002c08, {[CaseLower] = 0x002c38,[CaseTitle] = 0x002c08,[CaseUpper] = 0x002c08}}, + {0x002c09, {[CaseLower] = 0x002c39,[CaseTitle] = 0x002c09,[CaseUpper] = 0x002c09}}, + {0x002c0a, {[CaseLower] = 0x002c3a,[CaseTitle] = 0x002c0a,[CaseUpper] = 0x002c0a}}, + {0x002c0b, {[CaseLower] = 0x002c3b,[CaseTitle] = 0x002c0b,[CaseUpper] = 0x002c0b}}, + {0x002c0c, {[CaseLower] = 0x002c3c,[CaseTitle] = 0x002c0c,[CaseUpper] = 0x002c0c}}, + {0x002c0d, {[CaseLower] = 0x002c3d,[CaseTitle] = 0x002c0d,[CaseUpper] = 0x002c0d}}, + {0x002c0e, {[CaseLower] = 0x002c3e,[CaseTitle] = 0x002c0e,[CaseUpper] = 0x002c0e}}, + {0x002c0f, {[CaseLower] = 0x002c3f,[CaseTitle] = 0x002c0f,[CaseUpper] = 0x002c0f}}, + {0x002c10, {[CaseLower] = 0x002c40,[CaseTitle] = 0x002c10,[CaseUpper] = 0x002c10}}, + {0x002c11, {[CaseLower] = 0x002c41,[CaseTitle] = 0x002c11,[CaseUpper] = 0x002c11}}, + {0x002c12, {[CaseLower] = 0x002c42,[CaseTitle] = 0x002c12,[CaseUpper] = 0x002c12}}, + {0x002c13, {[CaseLower] = 0x002c43,[CaseTitle] = 0x002c13,[CaseUpper] = 0x002c13}}, + {0x002c14, {[CaseLower] = 0x002c44,[CaseTitle] = 0x002c14,[CaseUpper] = 0x002c14}}, + {0x002c15, {[CaseLower] = 0x002c45,[CaseTitle] = 0x002c15,[CaseUpper] = 0x002c15}}, + {0x002c16, {[CaseLower] = 0x002c46,[CaseTitle] = 0x002c16,[CaseUpper] = 0x002c16}}, + {0x002c17, {[CaseLower] = 0x002c47,[CaseTitle] = 0x002c17,[CaseUpper] = 0x002c17}}, + {0x002c18, {[CaseLower] = 0x002c48,[CaseTitle] = 0x002c18,[CaseUpper] = 0x002c18}}, + {0x002c19, {[CaseLower] = 0x002c49,[CaseTitle] = 0x002c19,[CaseUpper] = 0x002c19}}, + {0x002c1a, {[CaseLower] = 0x002c4a,[CaseTitle] = 0x002c1a,[CaseUpper] = 0x002c1a}}, + {0x002c1b, {[CaseLower] = 0x002c4b,[CaseTitle] = 0x002c1b,[CaseUpper] = 0x002c1b}}, + {0x002c1c, {[CaseLower] = 0x002c4c,[CaseTitle] = 0x002c1c,[CaseUpper] = 0x002c1c}}, + {0x002c1d, {[CaseLower] = 0x002c4d,[CaseTitle] = 0x002c1d,[CaseUpper] = 0x002c1d}}, + {0x002c1e, {[CaseLower] = 0x002c4e,[CaseTitle] = 0x002c1e,[CaseUpper] = 0x002c1e}}, + {0x002c1f, {[CaseLower] = 0x002c4f,[CaseTitle] = 0x002c1f,[CaseUpper] = 0x002c1f}}, + {0x002c20, {[CaseLower] = 0x002c50,[CaseTitle] = 0x002c20,[CaseUpper] = 0x002c20}}, + {0x002c21, {[CaseLower] = 0x002c51,[CaseTitle] = 0x002c21,[CaseUpper] = 0x002c21}}, + {0x002c22, {[CaseLower] = 0x002c52,[CaseTitle] = 0x002c22,[CaseUpper] = 0x002c22}}, + {0x002c23, {[CaseLower] = 0x002c53,[CaseTitle] = 0x002c23,[CaseUpper] = 0x002c23}}, + {0x002c24, {[CaseLower] = 0x002c54,[CaseTitle] = 0x002c24,[CaseUpper] = 0x002c24}}, + {0x002c25, {[CaseLower] = 0x002c55,[CaseTitle] = 0x002c25,[CaseUpper] = 0x002c25}}, + {0x002c26, {[CaseLower] = 0x002c56,[CaseTitle] = 0x002c26,[CaseUpper] = 0x002c26}}, + {0x002c27, {[CaseLower] = 0x002c57,[CaseTitle] = 0x002c27,[CaseUpper] = 0x002c27}}, + {0x002c28, {[CaseLower] = 0x002c58,[CaseTitle] = 0x002c28,[CaseUpper] = 0x002c28}}, + {0x002c29, {[CaseLower] = 0x002c59,[CaseTitle] = 0x002c29,[CaseUpper] = 0x002c29}}, + {0x002c2a, {[CaseLower] = 0x002c5a,[CaseTitle] = 0x002c2a,[CaseUpper] = 0x002c2a}}, + {0x002c2b, {[CaseLower] = 0x002c5b,[CaseTitle] = 0x002c2b,[CaseUpper] = 0x002c2b}}, + {0x002c2c, {[CaseLower] = 0x002c5c,[CaseTitle] = 0x002c2c,[CaseUpper] = 0x002c2c}}, + {0x002c2d, {[CaseLower] = 0x002c5d,[CaseTitle] = 0x002c2d,[CaseUpper] = 0x002c2d}}, + {0x002c2e, {[CaseLower] = 0x002c5e,[CaseTitle] = 0x002c2e,[CaseUpper] = 0x002c2e}}, + {0x002c2f, {[CaseLower] = 0x002c5f,[CaseTitle] = 0x002c2f,[CaseUpper] = 0x002c2f}}, + {0x002c30, {[CaseLower] = 0x002c30,[CaseTitle] = 0x002c00,[CaseUpper] = 0x002c00}}, + {0x002c31, {[CaseLower] = 0x002c31,[CaseTitle] = 0x002c01,[CaseUpper] = 0x002c01}}, + {0x002c32, {[CaseLower] = 0x002c32,[CaseTitle] = 0x002c02,[CaseUpper] = 0x002c02}}, + {0x002c33, {[CaseLower] = 0x002c33,[CaseTitle] = 0x002c03,[CaseUpper] = 0x002c03}}, + {0x002c34, {[CaseLower] = 0x002c34,[CaseTitle] = 0x002c04,[CaseUpper] = 0x002c04}}, + {0x002c35, {[CaseLower] = 0x002c35,[CaseTitle] = 0x002c05,[CaseUpper] = 0x002c05}}, + {0x002c36, {[CaseLower] = 0x002c36,[CaseTitle] = 0x002c06,[CaseUpper] = 0x002c06}}, + {0x002c37, {[CaseLower] = 0x002c37,[CaseTitle] = 0x002c07,[CaseUpper] = 0x002c07}}, + {0x002c38, {[CaseLower] = 0x002c38,[CaseTitle] = 0x002c08,[CaseUpper] = 0x002c08}}, + {0x002c39, {[CaseLower] = 0x002c39,[CaseTitle] = 0x002c09,[CaseUpper] = 0x002c09}}, + {0x002c3a, {[CaseLower] = 0x002c3a,[CaseTitle] = 0x002c0a,[CaseUpper] = 0x002c0a}}, + {0x002c3b, {[CaseLower] = 0x002c3b,[CaseTitle] = 0x002c0b,[CaseUpper] = 0x002c0b}}, + {0x002c3c, {[CaseLower] = 0x002c3c,[CaseTitle] = 0x002c0c,[CaseUpper] = 0x002c0c}}, + {0x002c3d, {[CaseLower] = 0x002c3d,[CaseTitle] = 0x002c0d,[CaseUpper] = 0x002c0d}}, + {0x002c3e, {[CaseLower] = 0x002c3e,[CaseTitle] = 0x002c0e,[CaseUpper] = 0x002c0e}}, + {0x002c3f, {[CaseLower] = 0x002c3f,[CaseTitle] = 0x002c0f,[CaseUpper] = 0x002c0f}}, + {0x002c40, {[CaseLower] = 0x002c40,[CaseTitle] = 0x002c10,[CaseUpper] = 0x002c10}}, + {0x002c41, {[CaseLower] = 0x002c41,[CaseTitle] = 0x002c11,[CaseUpper] = 0x002c11}}, + {0x002c42, {[CaseLower] = 0x002c42,[CaseTitle] = 0x002c12,[CaseUpper] = 0x002c12}}, + {0x002c43, {[CaseLower] = 0x002c43,[CaseTitle] = 0x002c13,[CaseUpper] = 0x002c13}}, + {0x002c44, {[CaseLower] = 0x002c44,[CaseTitle] = 0x002c14,[CaseUpper] = 0x002c14}}, + {0x002c45, {[CaseLower] = 0x002c45,[CaseTitle] = 0x002c15,[CaseUpper] = 0x002c15}}, + {0x002c46, {[CaseLower] = 0x002c46,[CaseTitle] = 0x002c16,[CaseUpper] = 0x002c16}}, + {0x002c47, {[CaseLower] = 0x002c47,[CaseTitle] = 0x002c17,[CaseUpper] = 0x002c17}}, + {0x002c48, {[CaseLower] = 0x002c48,[CaseTitle] = 0x002c18,[CaseUpper] = 0x002c18}}, + {0x002c49, {[CaseLower] = 0x002c49,[CaseTitle] = 0x002c19,[CaseUpper] = 0x002c19}}, + {0x002c4a, {[CaseLower] = 0x002c4a,[CaseTitle] = 0x002c1a,[CaseUpper] = 0x002c1a}}, + {0x002c4b, {[CaseLower] = 0x002c4b,[CaseTitle] = 0x002c1b,[CaseUpper] = 0x002c1b}}, + {0x002c4c, {[CaseLower] = 0x002c4c,[CaseTitle] = 0x002c1c,[CaseUpper] = 0x002c1c}}, + {0x002c4d, {[CaseLower] = 0x002c4d,[CaseTitle] = 0x002c1d,[CaseUpper] = 0x002c1d}}, + {0x002c4e, {[CaseLower] = 0x002c4e,[CaseTitle] = 0x002c1e,[CaseUpper] = 0x002c1e}}, + {0x002c4f, {[CaseLower] = 0x002c4f,[CaseTitle] = 0x002c1f,[CaseUpper] = 0x002c1f}}, + {0x002c50, {[CaseLower] = 0x002c50,[CaseTitle] = 0x002c20,[CaseUpper] = 0x002c20}}, + {0x002c51, {[CaseLower] = 0x002c51,[CaseTitle] = 0x002c21,[CaseUpper] = 0x002c21}}, + {0x002c52, {[CaseLower] = 0x002c52,[CaseTitle] = 0x002c22,[CaseUpper] = 0x002c22}}, + {0x002c53, {[CaseLower] = 0x002c53,[CaseTitle] = 0x002c23,[CaseUpper] = 0x002c23}}, + {0x002c54, {[CaseLower] = 0x002c54,[CaseTitle] = 0x002c24,[CaseUpper] = 0x002c24}}, + {0x002c55, {[CaseLower] = 0x002c55,[CaseTitle] = 0x002c25,[CaseUpper] = 0x002c25}}, + {0x002c56, {[CaseLower] = 0x002c56,[CaseTitle] = 0x002c26,[CaseUpper] = 0x002c26}}, + {0x002c57, {[CaseLower] = 0x002c57,[CaseTitle] = 0x002c27,[CaseUpper] = 0x002c27}}, + {0x002c58, {[CaseLower] = 0x002c58,[CaseTitle] = 0x002c28,[CaseUpper] = 0x002c28}}, + {0x002c59, {[CaseLower] = 0x002c59,[CaseTitle] = 0x002c29,[CaseUpper] = 0x002c29}}, + {0x002c5a, {[CaseLower] = 0x002c5a,[CaseTitle] = 0x002c2a,[CaseUpper] = 0x002c2a}}, + {0x002c5b, {[CaseLower] = 0x002c5b,[CaseTitle] = 0x002c2b,[CaseUpper] = 0x002c2b}}, + {0x002c5c, {[CaseLower] = 0x002c5c,[CaseTitle] = 0x002c2c,[CaseUpper] = 0x002c2c}}, + {0x002c5d, {[CaseLower] = 0x002c5d,[CaseTitle] = 0x002c2d,[CaseUpper] = 0x002c2d}}, + {0x002c5e, {[CaseLower] = 0x002c5e,[CaseTitle] = 0x002c2e,[CaseUpper] = 0x002c2e}}, + {0x002c5f, {[CaseLower] = 0x002c5f,[CaseTitle] = 0x002c2f,[CaseUpper] = 0x002c2f}}, + {0x002c60, {[CaseLower] = 0x002c61,[CaseTitle] = 0x002c60,[CaseUpper] = 0x002c60}}, + {0x002c61, {[CaseLower] = 0x002c61,[CaseTitle] = 0x002c60,[CaseUpper] = 0x002c60}}, + {0x002c62, {[CaseLower] = 0x00026b,[CaseTitle] = 0x002c62,[CaseUpper] = 0x002c62}}, + {0x002c63, {[CaseLower] = 0x001d7d,[CaseTitle] = 0x002c63,[CaseUpper] = 0x002c63}}, + {0x002c64, {[CaseLower] = 0x00027d,[CaseTitle] = 0x002c64,[CaseUpper] = 0x002c64}}, + {0x002c65, {[CaseLower] = 0x002c65,[CaseTitle] = 0x00023a,[CaseUpper] = 0x00023a}}, + {0x002c66, {[CaseLower] = 0x002c66,[CaseTitle] = 0x00023e,[CaseUpper] = 0x00023e}}, + {0x002c67, {[CaseLower] = 0x002c68,[CaseTitle] = 0x002c67,[CaseUpper] = 0x002c67}}, + {0x002c68, {[CaseLower] = 0x002c68,[CaseTitle] = 0x002c67,[CaseUpper] = 0x002c67}}, + {0x002c69, {[CaseLower] = 0x002c6a,[CaseTitle] = 0x002c69,[CaseUpper] = 0x002c69}}, + {0x002c6a, {[CaseLower] = 0x002c6a,[CaseTitle] = 0x002c69,[CaseUpper] = 0x002c69}}, + {0x002c6b, {[CaseLower] = 0x002c6c,[CaseTitle] = 0x002c6b,[CaseUpper] = 0x002c6b}}, + {0x002c6c, {[CaseLower] = 0x002c6c,[CaseTitle] = 0x002c6b,[CaseUpper] = 0x002c6b}}, + {0x002c6d, {[CaseLower] = 0x000251,[CaseTitle] = 0x002c6d,[CaseUpper] = 0x002c6d}}, + {0x002c6e, {[CaseLower] = 0x000271,[CaseTitle] = 0x002c6e,[CaseUpper] = 0x002c6e}}, + {0x002c6f, {[CaseLower] = 0x000250,[CaseTitle] = 0x002c6f,[CaseUpper] = 0x002c6f}}, + {0x002c70, {[CaseLower] = 0x000252,[CaseTitle] = 0x002c70,[CaseUpper] = 0x002c70}}, + {0x002c72, {[CaseLower] = 0x002c73,[CaseTitle] = 0x002c72,[CaseUpper] = 0x002c72}}, + {0x002c73, {[CaseLower] = 0x002c73,[CaseTitle] = 0x002c72,[CaseUpper] = 0x002c72}}, + {0x002c75, {[CaseLower] = 0x002c76,[CaseTitle] = 0x002c75,[CaseUpper] = 0x002c75}}, + {0x002c76, {[CaseLower] = 0x002c76,[CaseTitle] = 0x002c75,[CaseUpper] = 0x002c75}}, + {0x002c7e, {[CaseLower] = 0x00023f,[CaseTitle] = 0x002c7e,[CaseUpper] = 0x002c7e}}, + {0x002c7f, {[CaseLower] = 0x000240,[CaseTitle] = 0x002c7f,[CaseUpper] = 0x002c7f}}, + {0x002c80, {[CaseLower] = 0x002c81,[CaseTitle] = 0x002c80,[CaseUpper] = 0x002c80}}, + {0x002c81, {[CaseLower] = 0x002c81,[CaseTitle] = 0x002c80,[CaseUpper] = 0x002c80}}, + {0x002c82, {[CaseLower] = 0x002c83,[CaseTitle] = 0x002c82,[CaseUpper] = 0x002c82}}, + {0x002c83, {[CaseLower] = 0x002c83,[CaseTitle] = 0x002c82,[CaseUpper] = 0x002c82}}, + {0x002c84, {[CaseLower] = 0x002c85,[CaseTitle] = 0x002c84,[CaseUpper] = 0x002c84}}, + {0x002c85, {[CaseLower] = 0x002c85,[CaseTitle] = 0x002c84,[CaseUpper] = 0x002c84}}, + {0x002c86, {[CaseLower] = 0x002c87,[CaseTitle] = 0x002c86,[CaseUpper] = 0x002c86}}, + {0x002c87, {[CaseLower] = 0x002c87,[CaseTitle] = 0x002c86,[CaseUpper] = 0x002c86}}, + {0x002c88, {[CaseLower] = 0x002c89,[CaseTitle] = 0x002c88,[CaseUpper] = 0x002c88}}, + {0x002c89, {[CaseLower] = 0x002c89,[CaseTitle] = 0x002c88,[CaseUpper] = 0x002c88}}, + {0x002c8a, {[CaseLower] = 0x002c8b,[CaseTitle] = 0x002c8a,[CaseUpper] = 0x002c8a}}, + {0x002c8b, {[CaseLower] = 0x002c8b,[CaseTitle] = 0x002c8a,[CaseUpper] = 0x002c8a}}, + {0x002c8c, {[CaseLower] = 0x002c8d,[CaseTitle] = 0x002c8c,[CaseUpper] = 0x002c8c}}, + {0x002c8d, {[CaseLower] = 0x002c8d,[CaseTitle] = 0x002c8c,[CaseUpper] = 0x002c8c}}, + {0x002c8e, {[CaseLower] = 0x002c8f,[CaseTitle] = 0x002c8e,[CaseUpper] = 0x002c8e}}, + {0x002c8f, {[CaseLower] = 0x002c8f,[CaseTitle] = 0x002c8e,[CaseUpper] = 0x002c8e}}, + {0x002c90, {[CaseLower] = 0x002c91,[CaseTitle] = 0x002c90,[CaseUpper] = 0x002c90}}, + {0x002c91, {[CaseLower] = 0x002c91,[CaseTitle] = 0x002c90,[CaseUpper] = 0x002c90}}, + {0x002c92, {[CaseLower] = 0x002c93,[CaseTitle] = 0x002c92,[CaseUpper] = 0x002c92}}, + {0x002c93, {[CaseLower] = 0x002c93,[CaseTitle] = 0x002c92,[CaseUpper] = 0x002c92}}, + {0x002c94, {[CaseLower] = 0x002c95,[CaseTitle] = 0x002c94,[CaseUpper] = 0x002c94}}, + {0x002c95, {[CaseLower] = 0x002c95,[CaseTitle] = 0x002c94,[CaseUpper] = 0x002c94}}, + {0x002c96, {[CaseLower] = 0x002c97,[CaseTitle] = 0x002c96,[CaseUpper] = 0x002c96}}, + {0x002c97, {[CaseLower] = 0x002c97,[CaseTitle] = 0x002c96,[CaseUpper] = 0x002c96}}, + {0x002c98, {[CaseLower] = 0x002c99,[CaseTitle] = 0x002c98,[CaseUpper] = 0x002c98}}, + {0x002c99, {[CaseLower] = 0x002c99,[CaseTitle] = 0x002c98,[CaseUpper] = 0x002c98}}, + {0x002c9a, {[CaseLower] = 0x002c9b,[CaseTitle] = 0x002c9a,[CaseUpper] = 0x002c9a}}, + {0x002c9b, {[CaseLower] = 0x002c9b,[CaseTitle] = 0x002c9a,[CaseUpper] = 0x002c9a}}, + {0x002c9c, {[CaseLower] = 0x002c9d,[CaseTitle] = 0x002c9c,[CaseUpper] = 0x002c9c}}, + {0x002c9d, {[CaseLower] = 0x002c9d,[CaseTitle] = 0x002c9c,[CaseUpper] = 0x002c9c}}, + {0x002c9e, {[CaseLower] = 0x002c9f,[CaseTitle] = 0x002c9e,[CaseUpper] = 0x002c9e}}, + {0x002c9f, {[CaseLower] = 0x002c9f,[CaseTitle] = 0x002c9e,[CaseUpper] = 0x002c9e}}, + {0x002ca0, {[CaseLower] = 0x002ca1,[CaseTitle] = 0x002ca0,[CaseUpper] = 0x002ca0}}, + {0x002ca1, {[CaseLower] = 0x002ca1,[CaseTitle] = 0x002ca0,[CaseUpper] = 0x002ca0}}, + {0x002ca2, {[CaseLower] = 0x002ca3,[CaseTitle] = 0x002ca2,[CaseUpper] = 0x002ca2}}, + {0x002ca3, {[CaseLower] = 0x002ca3,[CaseTitle] = 0x002ca2,[CaseUpper] = 0x002ca2}}, + {0x002ca4, {[CaseLower] = 0x002ca5,[CaseTitle] = 0x002ca4,[CaseUpper] = 0x002ca4}}, + {0x002ca5, {[CaseLower] = 0x002ca5,[CaseTitle] = 0x002ca4,[CaseUpper] = 0x002ca4}}, + {0x002ca6, {[CaseLower] = 0x002ca7,[CaseTitle] = 0x002ca6,[CaseUpper] = 0x002ca6}}, + {0x002ca7, {[CaseLower] = 0x002ca7,[CaseTitle] = 0x002ca6,[CaseUpper] = 0x002ca6}}, + {0x002ca8, {[CaseLower] = 0x002ca9,[CaseTitle] = 0x002ca8,[CaseUpper] = 0x002ca8}}, + {0x002ca9, {[CaseLower] = 0x002ca9,[CaseTitle] = 0x002ca8,[CaseUpper] = 0x002ca8}}, + {0x002caa, {[CaseLower] = 0x002cab,[CaseTitle] = 0x002caa,[CaseUpper] = 0x002caa}}, + {0x002cab, {[CaseLower] = 0x002cab,[CaseTitle] = 0x002caa,[CaseUpper] = 0x002caa}}, + {0x002cac, {[CaseLower] = 0x002cad,[CaseTitle] = 0x002cac,[CaseUpper] = 0x002cac}}, + {0x002cad, {[CaseLower] = 0x002cad,[CaseTitle] = 0x002cac,[CaseUpper] = 0x002cac}}, + {0x002cae, {[CaseLower] = 0x002caf,[CaseTitle] = 0x002cae,[CaseUpper] = 0x002cae}}, + {0x002caf, {[CaseLower] = 0x002caf,[CaseTitle] = 0x002cae,[CaseUpper] = 0x002cae}}, + {0x002cb0, {[CaseLower] = 0x002cb1,[CaseTitle] = 0x002cb0,[CaseUpper] = 0x002cb0}}, + {0x002cb1, {[CaseLower] = 0x002cb1,[CaseTitle] = 0x002cb0,[CaseUpper] = 0x002cb0}}, + {0x002cb2, {[CaseLower] = 0x002cb3,[CaseTitle] = 0x002cb2,[CaseUpper] = 0x002cb2}}, + {0x002cb3, {[CaseLower] = 0x002cb3,[CaseTitle] = 0x002cb2,[CaseUpper] = 0x002cb2}}, + {0x002cb4, {[CaseLower] = 0x002cb5,[CaseTitle] = 0x002cb4,[CaseUpper] = 0x002cb4}}, + {0x002cb5, {[CaseLower] = 0x002cb5,[CaseTitle] = 0x002cb4,[CaseUpper] = 0x002cb4}}, + {0x002cb6, {[CaseLower] = 0x002cb7,[CaseTitle] = 0x002cb6,[CaseUpper] = 0x002cb6}}, + {0x002cb7, {[CaseLower] = 0x002cb7,[CaseTitle] = 0x002cb6,[CaseUpper] = 0x002cb6}}, + {0x002cb8, {[CaseLower] = 0x002cb9,[CaseTitle] = 0x002cb8,[CaseUpper] = 0x002cb8}}, + {0x002cb9, {[CaseLower] = 0x002cb9,[CaseTitle] = 0x002cb8,[CaseUpper] = 0x002cb8}}, + {0x002cba, {[CaseLower] = 0x002cbb,[CaseTitle] = 0x002cba,[CaseUpper] = 0x002cba}}, + {0x002cbb, {[CaseLower] = 0x002cbb,[CaseTitle] = 0x002cba,[CaseUpper] = 0x002cba}}, + {0x002cbc, {[CaseLower] = 0x002cbd,[CaseTitle] = 0x002cbc,[CaseUpper] = 0x002cbc}}, + {0x002cbd, {[CaseLower] = 0x002cbd,[CaseTitle] = 0x002cbc,[CaseUpper] = 0x002cbc}}, + {0x002cbe, {[CaseLower] = 0x002cbf,[CaseTitle] = 0x002cbe,[CaseUpper] = 0x002cbe}}, + {0x002cbf, {[CaseLower] = 0x002cbf,[CaseTitle] = 0x002cbe,[CaseUpper] = 0x002cbe}}, + {0x002cc0, {[CaseLower] = 0x002cc1,[CaseTitle] = 0x002cc0,[CaseUpper] = 0x002cc0}}, + {0x002cc1, {[CaseLower] = 0x002cc1,[CaseTitle] = 0x002cc0,[CaseUpper] = 0x002cc0}}, + {0x002cc2, {[CaseLower] = 0x002cc3,[CaseTitle] = 0x002cc2,[CaseUpper] = 0x002cc2}}, + {0x002cc3, {[CaseLower] = 0x002cc3,[CaseTitle] = 0x002cc2,[CaseUpper] = 0x002cc2}}, + {0x002cc4, {[CaseLower] = 0x002cc5,[CaseTitle] = 0x002cc4,[CaseUpper] = 0x002cc4}}, + {0x002cc5, {[CaseLower] = 0x002cc5,[CaseTitle] = 0x002cc4,[CaseUpper] = 0x002cc4}}, + {0x002cc6, {[CaseLower] = 0x002cc7,[CaseTitle] = 0x002cc6,[CaseUpper] = 0x002cc6}}, + {0x002cc7, {[CaseLower] = 0x002cc7,[CaseTitle] = 0x002cc6,[CaseUpper] = 0x002cc6}}, + {0x002cc8, {[CaseLower] = 0x002cc9,[CaseTitle] = 0x002cc8,[CaseUpper] = 0x002cc8}}, + {0x002cc9, {[CaseLower] = 0x002cc9,[CaseTitle] = 0x002cc8,[CaseUpper] = 0x002cc8}}, + {0x002cca, {[CaseLower] = 0x002ccb,[CaseTitle] = 0x002cca,[CaseUpper] = 0x002cca}}, + {0x002ccb, {[CaseLower] = 0x002ccb,[CaseTitle] = 0x002cca,[CaseUpper] = 0x002cca}}, + {0x002ccc, {[CaseLower] = 0x002ccd,[CaseTitle] = 0x002ccc,[CaseUpper] = 0x002ccc}}, + {0x002ccd, {[CaseLower] = 0x002ccd,[CaseTitle] = 0x002ccc,[CaseUpper] = 0x002ccc}}, + {0x002cce, {[CaseLower] = 0x002ccf,[CaseTitle] = 0x002cce,[CaseUpper] = 0x002cce}}, + {0x002ccf, {[CaseLower] = 0x002ccf,[CaseTitle] = 0x002cce,[CaseUpper] = 0x002cce}}, + {0x002cd0, {[CaseLower] = 0x002cd1,[CaseTitle] = 0x002cd0,[CaseUpper] = 0x002cd0}}, + {0x002cd1, {[CaseLower] = 0x002cd1,[CaseTitle] = 0x002cd0,[CaseUpper] = 0x002cd0}}, + {0x002cd2, {[CaseLower] = 0x002cd3,[CaseTitle] = 0x002cd2,[CaseUpper] = 0x002cd2}}, + {0x002cd3, {[CaseLower] = 0x002cd3,[CaseTitle] = 0x002cd2,[CaseUpper] = 0x002cd2}}, + {0x002cd4, {[CaseLower] = 0x002cd5,[CaseTitle] = 0x002cd4,[CaseUpper] = 0x002cd4}}, + {0x002cd5, {[CaseLower] = 0x002cd5,[CaseTitle] = 0x002cd4,[CaseUpper] = 0x002cd4}}, + {0x002cd6, {[CaseLower] = 0x002cd7,[CaseTitle] = 0x002cd6,[CaseUpper] = 0x002cd6}}, + {0x002cd7, {[CaseLower] = 0x002cd7,[CaseTitle] = 0x002cd6,[CaseUpper] = 0x002cd6}}, + {0x002cd8, {[CaseLower] = 0x002cd9,[CaseTitle] = 0x002cd8,[CaseUpper] = 0x002cd8}}, + {0x002cd9, {[CaseLower] = 0x002cd9,[CaseTitle] = 0x002cd8,[CaseUpper] = 0x002cd8}}, + {0x002cda, {[CaseLower] = 0x002cdb,[CaseTitle] = 0x002cda,[CaseUpper] = 0x002cda}}, + {0x002cdb, {[CaseLower] = 0x002cdb,[CaseTitle] = 0x002cda,[CaseUpper] = 0x002cda}}, + {0x002cdc, {[CaseLower] = 0x002cdd,[CaseTitle] = 0x002cdc,[CaseUpper] = 0x002cdc}}, + {0x002cdd, {[CaseLower] = 0x002cdd,[CaseTitle] = 0x002cdc,[CaseUpper] = 0x002cdc}}, + {0x002cde, {[CaseLower] = 0x002cdf,[CaseTitle] = 0x002cde,[CaseUpper] = 0x002cde}}, + {0x002cdf, {[CaseLower] = 0x002cdf,[CaseTitle] = 0x002cde,[CaseUpper] = 0x002cde}}, + {0x002ce0, {[CaseLower] = 0x002ce1,[CaseTitle] = 0x002ce0,[CaseUpper] = 0x002ce0}}, + {0x002ce1, {[CaseLower] = 0x002ce1,[CaseTitle] = 0x002ce0,[CaseUpper] = 0x002ce0}}, + {0x002ce2, {[CaseLower] = 0x002ce3,[CaseTitle] = 0x002ce2,[CaseUpper] = 0x002ce2}}, + {0x002ce3, {[CaseLower] = 0x002ce3,[CaseTitle] = 0x002ce2,[CaseUpper] = 0x002ce2}}, + {0x002ceb, {[CaseLower] = 0x002cec,[CaseTitle] = 0x002ceb,[CaseUpper] = 0x002ceb}}, + {0x002cec, {[CaseLower] = 0x002cec,[CaseTitle] = 0x002ceb,[CaseUpper] = 0x002ceb}}, + {0x002ced, {[CaseLower] = 0x002cee,[CaseTitle] = 0x002ced,[CaseUpper] = 0x002ced}}, + {0x002cee, {[CaseLower] = 0x002cee,[CaseTitle] = 0x002ced,[CaseUpper] = 0x002ced}}, + {0x002cf2, {[CaseLower] = 0x002cf3,[CaseTitle] = 0x002cf2,[CaseUpper] = 0x002cf2}}, + {0x002cf3, {[CaseLower] = 0x002cf3,[CaseTitle] = 0x002cf2,[CaseUpper] = 0x002cf2}}, + {0x002d00, {[CaseLower] = 0x002d00,[CaseTitle] = 0x0010a0,[CaseUpper] = 0x0010a0}}, + {0x002d01, {[CaseLower] = 0x002d01,[CaseTitle] = 0x0010a1,[CaseUpper] = 0x0010a1}}, + {0x002d02, {[CaseLower] = 0x002d02,[CaseTitle] = 0x0010a2,[CaseUpper] = 0x0010a2}}, + {0x002d03, {[CaseLower] = 0x002d03,[CaseTitle] = 0x0010a3,[CaseUpper] = 0x0010a3}}, + {0x002d04, {[CaseLower] = 0x002d04,[CaseTitle] = 0x0010a4,[CaseUpper] = 0x0010a4}}, + {0x002d05, {[CaseLower] = 0x002d05,[CaseTitle] = 0x0010a5,[CaseUpper] = 0x0010a5}}, + {0x002d06, {[CaseLower] = 0x002d06,[CaseTitle] = 0x0010a6,[CaseUpper] = 0x0010a6}}, + {0x002d07, {[CaseLower] = 0x002d07,[CaseTitle] = 0x0010a7,[CaseUpper] = 0x0010a7}}, + {0x002d08, {[CaseLower] = 0x002d08,[CaseTitle] = 0x0010a8,[CaseUpper] = 0x0010a8}}, + {0x002d09, {[CaseLower] = 0x002d09,[CaseTitle] = 0x0010a9,[CaseUpper] = 0x0010a9}}, + {0x002d0a, {[CaseLower] = 0x002d0a,[CaseTitle] = 0x0010aa,[CaseUpper] = 0x0010aa}}, + {0x002d0b, {[CaseLower] = 0x002d0b,[CaseTitle] = 0x0010ab,[CaseUpper] = 0x0010ab}}, + {0x002d0c, {[CaseLower] = 0x002d0c,[CaseTitle] = 0x0010ac,[CaseUpper] = 0x0010ac}}, + {0x002d0d, {[CaseLower] = 0x002d0d,[CaseTitle] = 0x0010ad,[CaseUpper] = 0x0010ad}}, + {0x002d0e, {[CaseLower] = 0x002d0e,[CaseTitle] = 0x0010ae,[CaseUpper] = 0x0010ae}}, + {0x002d0f, {[CaseLower] = 0x002d0f,[CaseTitle] = 0x0010af,[CaseUpper] = 0x0010af}}, + {0x002d10, {[CaseLower] = 0x002d10,[CaseTitle] = 0x0010b0,[CaseUpper] = 0x0010b0}}, + {0x002d11, {[CaseLower] = 0x002d11,[CaseTitle] = 0x0010b1,[CaseUpper] = 0x0010b1}}, + {0x002d12, {[CaseLower] = 0x002d12,[CaseTitle] = 0x0010b2,[CaseUpper] = 0x0010b2}}, + {0x002d13, {[CaseLower] = 0x002d13,[CaseTitle] = 0x0010b3,[CaseUpper] = 0x0010b3}}, + {0x002d14, {[CaseLower] = 0x002d14,[CaseTitle] = 0x0010b4,[CaseUpper] = 0x0010b4}}, + {0x002d15, {[CaseLower] = 0x002d15,[CaseTitle] = 0x0010b5,[CaseUpper] = 0x0010b5}}, + {0x002d16, {[CaseLower] = 0x002d16,[CaseTitle] = 0x0010b6,[CaseUpper] = 0x0010b6}}, + {0x002d17, {[CaseLower] = 0x002d17,[CaseTitle] = 0x0010b7,[CaseUpper] = 0x0010b7}}, + {0x002d18, {[CaseLower] = 0x002d18,[CaseTitle] = 0x0010b8,[CaseUpper] = 0x0010b8}}, + {0x002d19, {[CaseLower] = 0x002d19,[CaseTitle] = 0x0010b9,[CaseUpper] = 0x0010b9}}, + {0x002d1a, {[CaseLower] = 0x002d1a,[CaseTitle] = 0x0010ba,[CaseUpper] = 0x0010ba}}, + {0x002d1b, {[CaseLower] = 0x002d1b,[CaseTitle] = 0x0010bb,[CaseUpper] = 0x0010bb}}, + {0x002d1c, {[CaseLower] = 0x002d1c,[CaseTitle] = 0x0010bc,[CaseUpper] = 0x0010bc}}, + {0x002d1d, {[CaseLower] = 0x002d1d,[CaseTitle] = 0x0010bd,[CaseUpper] = 0x0010bd}}, + {0x002d1e, {[CaseLower] = 0x002d1e,[CaseTitle] = 0x0010be,[CaseUpper] = 0x0010be}}, + {0x002d1f, {[CaseLower] = 0x002d1f,[CaseTitle] = 0x0010bf,[CaseUpper] = 0x0010bf}}, + {0x002d20, {[CaseLower] = 0x002d20,[CaseTitle] = 0x0010c0,[CaseUpper] = 0x0010c0}}, + {0x002d21, {[CaseLower] = 0x002d21,[CaseTitle] = 0x0010c1,[CaseUpper] = 0x0010c1}}, + {0x002d22, {[CaseLower] = 0x002d22,[CaseTitle] = 0x0010c2,[CaseUpper] = 0x0010c2}}, + {0x002d23, {[CaseLower] = 0x002d23,[CaseTitle] = 0x0010c3,[CaseUpper] = 0x0010c3}}, + {0x002d24, {[CaseLower] = 0x002d24,[CaseTitle] = 0x0010c4,[CaseUpper] = 0x0010c4}}, + {0x002d25, {[CaseLower] = 0x002d25,[CaseTitle] = 0x0010c5,[CaseUpper] = 0x0010c5}}, + {0x002d27, {[CaseLower] = 0x002d27,[CaseTitle] = 0x0010c7,[CaseUpper] = 0x0010c7}}, + {0x002d2d, {[CaseLower] = 0x002d2d,[CaseTitle] = 0x0010cd,[CaseUpper] = 0x0010cd}}, + {0x00a640, {[CaseLower] = 0x00a641,[CaseTitle] = 0x00a640,[CaseUpper] = 0x00a640}}, + {0x00a641, {[CaseLower] = 0x00a641,[CaseTitle] = 0x00a640,[CaseUpper] = 0x00a640}}, + {0x00a642, {[CaseLower] = 0x00a643,[CaseTitle] = 0x00a642,[CaseUpper] = 0x00a642}}, + {0x00a643, {[CaseLower] = 0x00a643,[CaseTitle] = 0x00a642,[CaseUpper] = 0x00a642}}, + {0x00a644, {[CaseLower] = 0x00a645,[CaseTitle] = 0x00a644,[CaseUpper] = 0x00a644}}, + {0x00a645, {[CaseLower] = 0x00a645,[CaseTitle] = 0x00a644,[CaseUpper] = 0x00a644}}, + {0x00a646, {[CaseLower] = 0x00a647,[CaseTitle] = 0x00a646,[CaseUpper] = 0x00a646}}, + {0x00a647, {[CaseLower] = 0x00a647,[CaseTitle] = 0x00a646,[CaseUpper] = 0x00a646}}, + {0x00a648, {[CaseLower] = 0x00a649,[CaseTitle] = 0x00a648,[CaseUpper] = 0x00a648}}, + {0x00a649, {[CaseLower] = 0x00a649,[CaseTitle] = 0x00a648,[CaseUpper] = 0x00a648}}, + {0x00a64a, {[CaseLower] = 0x00a64b,[CaseTitle] = 0x00a64a,[CaseUpper] = 0x00a64a}}, + {0x00a64b, {[CaseLower] = 0x00a64b,[CaseTitle] = 0x00a64a,[CaseUpper] = 0x00a64a}}, + {0x00a64c, {[CaseLower] = 0x00a64d,[CaseTitle] = 0x00a64c,[CaseUpper] = 0x00a64c}}, + {0x00a64d, {[CaseLower] = 0x00a64d,[CaseTitle] = 0x00a64c,[CaseUpper] = 0x00a64c}}, + {0x00a64e, {[CaseLower] = 0x00a64f,[CaseTitle] = 0x00a64e,[CaseUpper] = 0x00a64e}}, + {0x00a64f, {[CaseLower] = 0x00a64f,[CaseTitle] = 0x00a64e,[CaseUpper] = 0x00a64e}}, + {0x00a650, {[CaseLower] = 0x00a651,[CaseTitle] = 0x00a650,[CaseUpper] = 0x00a650}}, + {0x00a651, {[CaseLower] = 0x00a651,[CaseTitle] = 0x00a650,[CaseUpper] = 0x00a650}}, + {0x00a652, {[CaseLower] = 0x00a653,[CaseTitle] = 0x00a652,[CaseUpper] = 0x00a652}}, + {0x00a653, {[CaseLower] = 0x00a653,[CaseTitle] = 0x00a652,[CaseUpper] = 0x00a652}}, + {0x00a654, {[CaseLower] = 0x00a655,[CaseTitle] = 0x00a654,[CaseUpper] = 0x00a654}}, + {0x00a655, {[CaseLower] = 0x00a655,[CaseTitle] = 0x00a654,[CaseUpper] = 0x00a654}}, + {0x00a656, {[CaseLower] = 0x00a657,[CaseTitle] = 0x00a656,[CaseUpper] = 0x00a656}}, + {0x00a657, {[CaseLower] = 0x00a657,[CaseTitle] = 0x00a656,[CaseUpper] = 0x00a656}}, + {0x00a658, {[CaseLower] = 0x00a659,[CaseTitle] = 0x00a658,[CaseUpper] = 0x00a658}}, + {0x00a659, {[CaseLower] = 0x00a659,[CaseTitle] = 0x00a658,[CaseUpper] = 0x00a658}}, + {0x00a65a, {[CaseLower] = 0x00a65b,[CaseTitle] = 0x00a65a,[CaseUpper] = 0x00a65a}}, + {0x00a65b, {[CaseLower] = 0x00a65b,[CaseTitle] = 0x00a65a,[CaseUpper] = 0x00a65a}}, + {0x00a65c, {[CaseLower] = 0x00a65d,[CaseTitle] = 0x00a65c,[CaseUpper] = 0x00a65c}}, + {0x00a65d, {[CaseLower] = 0x00a65d,[CaseTitle] = 0x00a65c,[CaseUpper] = 0x00a65c}}, + {0x00a65e, {[CaseLower] = 0x00a65f,[CaseTitle] = 0x00a65e,[CaseUpper] = 0x00a65e}}, + {0x00a65f, {[CaseLower] = 0x00a65f,[CaseTitle] = 0x00a65e,[CaseUpper] = 0x00a65e}}, + {0x00a660, {[CaseLower] = 0x00a661,[CaseTitle] = 0x00a660,[CaseUpper] = 0x00a660}}, + {0x00a661, {[CaseLower] = 0x00a661,[CaseTitle] = 0x00a660,[CaseUpper] = 0x00a660}}, + {0x00a662, {[CaseLower] = 0x00a663,[CaseTitle] = 0x00a662,[CaseUpper] = 0x00a662}}, + {0x00a663, {[CaseLower] = 0x00a663,[CaseTitle] = 0x00a662,[CaseUpper] = 0x00a662}}, + {0x00a664, {[CaseLower] = 0x00a665,[CaseTitle] = 0x00a664,[CaseUpper] = 0x00a664}}, + {0x00a665, {[CaseLower] = 0x00a665,[CaseTitle] = 0x00a664,[CaseUpper] = 0x00a664}}, + {0x00a666, {[CaseLower] = 0x00a667,[CaseTitle] = 0x00a666,[CaseUpper] = 0x00a666}}, + {0x00a667, {[CaseLower] = 0x00a667,[CaseTitle] = 0x00a666,[CaseUpper] = 0x00a666}}, + {0x00a668, {[CaseLower] = 0x00a669,[CaseTitle] = 0x00a668,[CaseUpper] = 0x00a668}}, + {0x00a669, {[CaseLower] = 0x00a669,[CaseTitle] = 0x00a668,[CaseUpper] = 0x00a668}}, + {0x00a66a, {[CaseLower] = 0x00a66b,[CaseTitle] = 0x00a66a,[CaseUpper] = 0x00a66a}}, + {0x00a66b, {[CaseLower] = 0x00a66b,[CaseTitle] = 0x00a66a,[CaseUpper] = 0x00a66a}}, + {0x00a66c, {[CaseLower] = 0x00a66d,[CaseTitle] = 0x00a66c,[CaseUpper] = 0x00a66c}}, + {0x00a66d, {[CaseLower] = 0x00a66d,[CaseTitle] = 0x00a66c,[CaseUpper] = 0x00a66c}}, + {0x00a680, {[CaseLower] = 0x00a681,[CaseTitle] = 0x00a680,[CaseUpper] = 0x00a680}}, + {0x00a681, {[CaseLower] = 0x00a681,[CaseTitle] = 0x00a680,[CaseUpper] = 0x00a680}}, + {0x00a682, {[CaseLower] = 0x00a683,[CaseTitle] = 0x00a682,[CaseUpper] = 0x00a682}}, + {0x00a683, {[CaseLower] = 0x00a683,[CaseTitle] = 0x00a682,[CaseUpper] = 0x00a682}}, + {0x00a684, {[CaseLower] = 0x00a685,[CaseTitle] = 0x00a684,[CaseUpper] = 0x00a684}}, + {0x00a685, {[CaseLower] = 0x00a685,[CaseTitle] = 0x00a684,[CaseUpper] = 0x00a684}}, + {0x00a686, {[CaseLower] = 0x00a687,[CaseTitle] = 0x00a686,[CaseUpper] = 0x00a686}}, + {0x00a687, {[CaseLower] = 0x00a687,[CaseTitle] = 0x00a686,[CaseUpper] = 0x00a686}}, + {0x00a688, {[CaseLower] = 0x00a689,[CaseTitle] = 0x00a688,[CaseUpper] = 0x00a688}}, + {0x00a689, {[CaseLower] = 0x00a689,[CaseTitle] = 0x00a688,[CaseUpper] = 0x00a688}}, + {0x00a68a, {[CaseLower] = 0x00a68b,[CaseTitle] = 0x00a68a,[CaseUpper] = 0x00a68a}}, + {0x00a68b, {[CaseLower] = 0x00a68b,[CaseTitle] = 0x00a68a,[CaseUpper] = 0x00a68a}}, + {0x00a68c, {[CaseLower] = 0x00a68d,[CaseTitle] = 0x00a68c,[CaseUpper] = 0x00a68c}}, + {0x00a68d, {[CaseLower] = 0x00a68d,[CaseTitle] = 0x00a68c,[CaseUpper] = 0x00a68c}}, + {0x00a68e, {[CaseLower] = 0x00a68f,[CaseTitle] = 0x00a68e,[CaseUpper] = 0x00a68e}}, + {0x00a68f, {[CaseLower] = 0x00a68f,[CaseTitle] = 0x00a68e,[CaseUpper] = 0x00a68e}}, + {0x00a690, {[CaseLower] = 0x00a691,[CaseTitle] = 0x00a690,[CaseUpper] = 0x00a690}}, + {0x00a691, {[CaseLower] = 0x00a691,[CaseTitle] = 0x00a690,[CaseUpper] = 0x00a690}}, + {0x00a692, {[CaseLower] = 0x00a693,[CaseTitle] = 0x00a692,[CaseUpper] = 0x00a692}}, + {0x00a693, {[CaseLower] = 0x00a693,[CaseTitle] = 0x00a692,[CaseUpper] = 0x00a692}}, + {0x00a694, {[CaseLower] = 0x00a695,[CaseTitle] = 0x00a694,[CaseUpper] = 0x00a694}}, + {0x00a695, {[CaseLower] = 0x00a695,[CaseTitle] = 0x00a694,[CaseUpper] = 0x00a694}}, + {0x00a696, {[CaseLower] = 0x00a697,[CaseTitle] = 0x00a696,[CaseUpper] = 0x00a696}}, + {0x00a697, {[CaseLower] = 0x00a697,[CaseTitle] = 0x00a696,[CaseUpper] = 0x00a696}}, + {0x00a698, {[CaseLower] = 0x00a699,[CaseTitle] = 0x00a698,[CaseUpper] = 0x00a698}}, + {0x00a699, {[CaseLower] = 0x00a699,[CaseTitle] = 0x00a698,[CaseUpper] = 0x00a698}}, + {0x00a69a, {[CaseLower] = 0x00a69b,[CaseTitle] = 0x00a69a,[CaseUpper] = 0x00a69a}}, + {0x00a69b, {[CaseLower] = 0x00a69b,[CaseTitle] = 0x00a69a,[CaseUpper] = 0x00a69a}}, + {0x00a722, {[CaseLower] = 0x00a723,[CaseTitle] = 0x00a722,[CaseUpper] = 0x00a722}}, + {0x00a723, {[CaseLower] = 0x00a723,[CaseTitle] = 0x00a722,[CaseUpper] = 0x00a722}}, + {0x00a724, {[CaseLower] = 0x00a725,[CaseTitle] = 0x00a724,[CaseUpper] = 0x00a724}}, + {0x00a725, {[CaseLower] = 0x00a725,[CaseTitle] = 0x00a724,[CaseUpper] = 0x00a724}}, + {0x00a726, {[CaseLower] = 0x00a727,[CaseTitle] = 0x00a726,[CaseUpper] = 0x00a726}}, + {0x00a727, {[CaseLower] = 0x00a727,[CaseTitle] = 0x00a726,[CaseUpper] = 0x00a726}}, + {0x00a728, {[CaseLower] = 0x00a729,[CaseTitle] = 0x00a728,[CaseUpper] = 0x00a728}}, + {0x00a729, {[CaseLower] = 0x00a729,[CaseTitle] = 0x00a728,[CaseUpper] = 0x00a728}}, + {0x00a72a, {[CaseLower] = 0x00a72b,[CaseTitle] = 0x00a72a,[CaseUpper] = 0x00a72a}}, + {0x00a72b, {[CaseLower] = 0x00a72b,[CaseTitle] = 0x00a72a,[CaseUpper] = 0x00a72a}}, + {0x00a72c, {[CaseLower] = 0x00a72d,[CaseTitle] = 0x00a72c,[CaseUpper] = 0x00a72c}}, + {0x00a72d, {[CaseLower] = 0x00a72d,[CaseTitle] = 0x00a72c,[CaseUpper] = 0x00a72c}}, + {0x00a72e, {[CaseLower] = 0x00a72f,[CaseTitle] = 0x00a72e,[CaseUpper] = 0x00a72e}}, + {0x00a72f, {[CaseLower] = 0x00a72f,[CaseTitle] = 0x00a72e,[CaseUpper] = 0x00a72e}}, + {0x00a732, {[CaseLower] = 0x00a733,[CaseTitle] = 0x00a732,[CaseUpper] = 0x00a732}}, + {0x00a733, {[CaseLower] = 0x00a733,[CaseTitle] = 0x00a732,[CaseUpper] = 0x00a732}}, + {0x00a734, {[CaseLower] = 0x00a735,[CaseTitle] = 0x00a734,[CaseUpper] = 0x00a734}}, + {0x00a735, {[CaseLower] = 0x00a735,[CaseTitle] = 0x00a734,[CaseUpper] = 0x00a734}}, + {0x00a736, {[CaseLower] = 0x00a737,[CaseTitle] = 0x00a736,[CaseUpper] = 0x00a736}}, + {0x00a737, {[CaseLower] = 0x00a737,[CaseTitle] = 0x00a736,[CaseUpper] = 0x00a736}}, + {0x00a738, {[CaseLower] = 0x00a739,[CaseTitle] = 0x00a738,[CaseUpper] = 0x00a738}}, + {0x00a739, {[CaseLower] = 0x00a739,[CaseTitle] = 0x00a738,[CaseUpper] = 0x00a738}}, + {0x00a73a, {[CaseLower] = 0x00a73b,[CaseTitle] = 0x00a73a,[CaseUpper] = 0x00a73a}}, + {0x00a73b, {[CaseLower] = 0x00a73b,[CaseTitle] = 0x00a73a,[CaseUpper] = 0x00a73a}}, + {0x00a73c, {[CaseLower] = 0x00a73d,[CaseTitle] = 0x00a73c,[CaseUpper] = 0x00a73c}}, + {0x00a73d, {[CaseLower] = 0x00a73d,[CaseTitle] = 0x00a73c,[CaseUpper] = 0x00a73c}}, + {0x00a73e, {[CaseLower] = 0x00a73f,[CaseTitle] = 0x00a73e,[CaseUpper] = 0x00a73e}}, + {0x00a73f, {[CaseLower] = 0x00a73f,[CaseTitle] = 0x00a73e,[CaseUpper] = 0x00a73e}}, + {0x00a740, {[CaseLower] = 0x00a741,[CaseTitle] = 0x00a740,[CaseUpper] = 0x00a740}}, + {0x00a741, {[CaseLower] = 0x00a741,[CaseTitle] = 0x00a740,[CaseUpper] = 0x00a740}}, + {0x00a742, {[CaseLower] = 0x00a743,[CaseTitle] = 0x00a742,[CaseUpper] = 0x00a742}}, + {0x00a743, {[CaseLower] = 0x00a743,[CaseTitle] = 0x00a742,[CaseUpper] = 0x00a742}}, + {0x00a744, {[CaseLower] = 0x00a745,[CaseTitle] = 0x00a744,[CaseUpper] = 0x00a744}}, + {0x00a745, {[CaseLower] = 0x00a745,[CaseTitle] = 0x00a744,[CaseUpper] = 0x00a744}}, + {0x00a746, {[CaseLower] = 0x00a747,[CaseTitle] = 0x00a746,[CaseUpper] = 0x00a746}}, + {0x00a747, {[CaseLower] = 0x00a747,[CaseTitle] = 0x00a746,[CaseUpper] = 0x00a746}}, + {0x00a748, {[CaseLower] = 0x00a749,[CaseTitle] = 0x00a748,[CaseUpper] = 0x00a748}}, + {0x00a749, {[CaseLower] = 0x00a749,[CaseTitle] = 0x00a748,[CaseUpper] = 0x00a748}}, + {0x00a74a, {[CaseLower] = 0x00a74b,[CaseTitle] = 0x00a74a,[CaseUpper] = 0x00a74a}}, + {0x00a74b, {[CaseLower] = 0x00a74b,[CaseTitle] = 0x00a74a,[CaseUpper] = 0x00a74a}}, + {0x00a74c, {[CaseLower] = 0x00a74d,[CaseTitle] = 0x00a74c,[CaseUpper] = 0x00a74c}}, + {0x00a74d, {[CaseLower] = 0x00a74d,[CaseTitle] = 0x00a74c,[CaseUpper] = 0x00a74c}}, + {0x00a74e, {[CaseLower] = 0x00a74f,[CaseTitle] = 0x00a74e,[CaseUpper] = 0x00a74e}}, + {0x00a74f, {[CaseLower] = 0x00a74f,[CaseTitle] = 0x00a74e,[CaseUpper] = 0x00a74e}}, + {0x00a750, {[CaseLower] = 0x00a751,[CaseTitle] = 0x00a750,[CaseUpper] = 0x00a750}}, + {0x00a751, {[CaseLower] = 0x00a751,[CaseTitle] = 0x00a750,[CaseUpper] = 0x00a750}}, + {0x00a752, {[CaseLower] = 0x00a753,[CaseTitle] = 0x00a752,[CaseUpper] = 0x00a752}}, + {0x00a753, {[CaseLower] = 0x00a753,[CaseTitle] = 0x00a752,[CaseUpper] = 0x00a752}}, + {0x00a754, {[CaseLower] = 0x00a755,[CaseTitle] = 0x00a754,[CaseUpper] = 0x00a754}}, + {0x00a755, {[CaseLower] = 0x00a755,[CaseTitle] = 0x00a754,[CaseUpper] = 0x00a754}}, + {0x00a756, {[CaseLower] = 0x00a757,[CaseTitle] = 0x00a756,[CaseUpper] = 0x00a756}}, + {0x00a757, {[CaseLower] = 0x00a757,[CaseTitle] = 0x00a756,[CaseUpper] = 0x00a756}}, + {0x00a758, {[CaseLower] = 0x00a759,[CaseTitle] = 0x00a758,[CaseUpper] = 0x00a758}}, + {0x00a759, {[CaseLower] = 0x00a759,[CaseTitle] = 0x00a758,[CaseUpper] = 0x00a758}}, + {0x00a75a, {[CaseLower] = 0x00a75b,[CaseTitle] = 0x00a75a,[CaseUpper] = 0x00a75a}}, + {0x00a75b, {[CaseLower] = 0x00a75b,[CaseTitle] = 0x00a75a,[CaseUpper] = 0x00a75a}}, + {0x00a75c, {[CaseLower] = 0x00a75d,[CaseTitle] = 0x00a75c,[CaseUpper] = 0x00a75c}}, + {0x00a75d, {[CaseLower] = 0x00a75d,[CaseTitle] = 0x00a75c,[CaseUpper] = 0x00a75c}}, + {0x00a75e, {[CaseLower] = 0x00a75f,[CaseTitle] = 0x00a75e,[CaseUpper] = 0x00a75e}}, + {0x00a75f, {[CaseLower] = 0x00a75f,[CaseTitle] = 0x00a75e,[CaseUpper] = 0x00a75e}}, + {0x00a760, {[CaseLower] = 0x00a761,[CaseTitle] = 0x00a760,[CaseUpper] = 0x00a760}}, + {0x00a761, {[CaseLower] = 0x00a761,[CaseTitle] = 0x00a760,[CaseUpper] = 0x00a760}}, + {0x00a762, {[CaseLower] = 0x00a763,[CaseTitle] = 0x00a762,[CaseUpper] = 0x00a762}}, + {0x00a763, {[CaseLower] = 0x00a763,[CaseTitle] = 0x00a762,[CaseUpper] = 0x00a762}}, + {0x00a764, {[CaseLower] = 0x00a765,[CaseTitle] = 0x00a764,[CaseUpper] = 0x00a764}}, + {0x00a765, {[CaseLower] = 0x00a765,[CaseTitle] = 0x00a764,[CaseUpper] = 0x00a764}}, + {0x00a766, {[CaseLower] = 0x00a767,[CaseTitle] = 0x00a766,[CaseUpper] = 0x00a766}}, + {0x00a767, {[CaseLower] = 0x00a767,[CaseTitle] = 0x00a766,[CaseUpper] = 0x00a766}}, + {0x00a768, {[CaseLower] = 0x00a769,[CaseTitle] = 0x00a768,[CaseUpper] = 0x00a768}}, + {0x00a769, {[CaseLower] = 0x00a769,[CaseTitle] = 0x00a768,[CaseUpper] = 0x00a768}}, + {0x00a76a, {[CaseLower] = 0x00a76b,[CaseTitle] = 0x00a76a,[CaseUpper] = 0x00a76a}}, + {0x00a76b, {[CaseLower] = 0x00a76b,[CaseTitle] = 0x00a76a,[CaseUpper] = 0x00a76a}}, + {0x00a76c, {[CaseLower] = 0x00a76d,[CaseTitle] = 0x00a76c,[CaseUpper] = 0x00a76c}}, + {0x00a76d, {[CaseLower] = 0x00a76d,[CaseTitle] = 0x00a76c,[CaseUpper] = 0x00a76c}}, + {0x00a76e, {[CaseLower] = 0x00a76f,[CaseTitle] = 0x00a76e,[CaseUpper] = 0x00a76e}}, + {0x00a76f, {[CaseLower] = 0x00a76f,[CaseTitle] = 0x00a76e,[CaseUpper] = 0x00a76e}}, + {0x00a779, {[CaseLower] = 0x00a77a,[CaseTitle] = 0x00a779,[CaseUpper] = 0x00a779}}, + {0x00a77a, {[CaseLower] = 0x00a77a,[CaseTitle] = 0x00a779,[CaseUpper] = 0x00a779}}, + {0x00a77b, {[CaseLower] = 0x00a77c,[CaseTitle] = 0x00a77b,[CaseUpper] = 0x00a77b}}, + {0x00a77c, {[CaseLower] = 0x00a77c,[CaseTitle] = 0x00a77b,[CaseUpper] = 0x00a77b}}, + {0x00a77d, {[CaseLower] = 0x001d79,[CaseTitle] = 0x00a77d,[CaseUpper] = 0x00a77d}}, + {0x00a77e, {[CaseLower] = 0x00a77f,[CaseTitle] = 0x00a77e,[CaseUpper] = 0x00a77e}}, + {0x00a77f, {[CaseLower] = 0x00a77f,[CaseTitle] = 0x00a77e,[CaseUpper] = 0x00a77e}}, + {0x00a780, {[CaseLower] = 0x00a781,[CaseTitle] = 0x00a780,[CaseUpper] = 0x00a780}}, + {0x00a781, {[CaseLower] = 0x00a781,[CaseTitle] = 0x00a780,[CaseUpper] = 0x00a780}}, + {0x00a782, {[CaseLower] = 0x00a783,[CaseTitle] = 0x00a782,[CaseUpper] = 0x00a782}}, + {0x00a783, {[CaseLower] = 0x00a783,[CaseTitle] = 0x00a782,[CaseUpper] = 0x00a782}}, + {0x00a784, {[CaseLower] = 0x00a785,[CaseTitle] = 0x00a784,[CaseUpper] = 0x00a784}}, + {0x00a785, {[CaseLower] = 0x00a785,[CaseTitle] = 0x00a784,[CaseUpper] = 0x00a784}}, + {0x00a786, {[CaseLower] = 0x00a787,[CaseTitle] = 0x00a786,[CaseUpper] = 0x00a786}}, + {0x00a787, {[CaseLower] = 0x00a787,[CaseTitle] = 0x00a786,[CaseUpper] = 0x00a786}}, + {0x00a78b, {[CaseLower] = 0x00a78c,[CaseTitle] = 0x00a78b,[CaseUpper] = 0x00a78b}}, + {0x00a78c, {[CaseLower] = 0x00a78c,[CaseTitle] = 0x00a78b,[CaseUpper] = 0x00a78b}}, + {0x00a78d, {[CaseLower] = 0x000265,[CaseTitle] = 0x00a78d,[CaseUpper] = 0x00a78d}}, + {0x00a790, {[CaseLower] = 0x00a791,[CaseTitle] = 0x00a790,[CaseUpper] = 0x00a790}}, + {0x00a791, {[CaseLower] = 0x00a791,[CaseTitle] = 0x00a790,[CaseUpper] = 0x00a790}}, + {0x00a792, {[CaseLower] = 0x00a793,[CaseTitle] = 0x00a792,[CaseUpper] = 0x00a792}}, + {0x00a793, {[CaseLower] = 0x00a793,[CaseTitle] = 0x00a792,[CaseUpper] = 0x00a792}}, + {0x00a794, {[CaseLower] = 0x00a794,[CaseTitle] = 0x00a7c4,[CaseUpper] = 0x00a7c4}}, + {0x00a796, {[CaseLower] = 0x00a797,[CaseTitle] = 0x00a796,[CaseUpper] = 0x00a796}}, + {0x00a797, {[CaseLower] = 0x00a797,[CaseTitle] = 0x00a796,[CaseUpper] = 0x00a796}}, + {0x00a798, {[CaseLower] = 0x00a799,[CaseTitle] = 0x00a798,[CaseUpper] = 0x00a798}}, + {0x00a799, {[CaseLower] = 0x00a799,[CaseTitle] = 0x00a798,[CaseUpper] = 0x00a798}}, + {0x00a79a, {[CaseLower] = 0x00a79b,[CaseTitle] = 0x00a79a,[CaseUpper] = 0x00a79a}}, + {0x00a79b, {[CaseLower] = 0x00a79b,[CaseTitle] = 0x00a79a,[CaseUpper] = 0x00a79a}}, + {0x00a79c, {[CaseLower] = 0x00a79d,[CaseTitle] = 0x00a79c,[CaseUpper] = 0x00a79c}}, + {0x00a79d, {[CaseLower] = 0x00a79d,[CaseTitle] = 0x00a79c,[CaseUpper] = 0x00a79c}}, + {0x00a79e, {[CaseLower] = 0x00a79f,[CaseTitle] = 0x00a79e,[CaseUpper] = 0x00a79e}}, + {0x00a79f, {[CaseLower] = 0x00a79f,[CaseTitle] = 0x00a79e,[CaseUpper] = 0x00a79e}}, + {0x00a7a0, {[CaseLower] = 0x00a7a1,[CaseTitle] = 0x00a7a0,[CaseUpper] = 0x00a7a0}}, + {0x00a7a1, {[CaseLower] = 0x00a7a1,[CaseTitle] = 0x00a7a0,[CaseUpper] = 0x00a7a0}}, + {0x00a7a2, {[CaseLower] = 0x00a7a3,[CaseTitle] = 0x00a7a2,[CaseUpper] = 0x00a7a2}}, + {0x00a7a3, {[CaseLower] = 0x00a7a3,[CaseTitle] = 0x00a7a2,[CaseUpper] = 0x00a7a2}}, + {0x00a7a4, {[CaseLower] = 0x00a7a5,[CaseTitle] = 0x00a7a4,[CaseUpper] = 0x00a7a4}}, + {0x00a7a5, {[CaseLower] = 0x00a7a5,[CaseTitle] = 0x00a7a4,[CaseUpper] = 0x00a7a4}}, + {0x00a7a6, {[CaseLower] = 0x00a7a7,[CaseTitle] = 0x00a7a6,[CaseUpper] = 0x00a7a6}}, + {0x00a7a7, {[CaseLower] = 0x00a7a7,[CaseTitle] = 0x00a7a6,[CaseUpper] = 0x00a7a6}}, + {0x00a7a8, {[CaseLower] = 0x00a7a9,[CaseTitle] = 0x00a7a8,[CaseUpper] = 0x00a7a8}}, + {0x00a7a9, {[CaseLower] = 0x00a7a9,[CaseTitle] = 0x00a7a8,[CaseUpper] = 0x00a7a8}}, + {0x00a7aa, {[CaseLower] = 0x000266,[CaseTitle] = 0x00a7aa,[CaseUpper] = 0x00a7aa}}, + {0x00a7ab, {[CaseLower] = 0x00025c,[CaseTitle] = 0x00a7ab,[CaseUpper] = 0x00a7ab}}, + {0x00a7ac, {[CaseLower] = 0x000261,[CaseTitle] = 0x00a7ac,[CaseUpper] = 0x00a7ac}}, + {0x00a7ad, {[CaseLower] = 0x00026c,[CaseTitle] = 0x00a7ad,[CaseUpper] = 0x00a7ad}}, + {0x00a7ae, {[CaseLower] = 0x00026a,[CaseTitle] = 0x00a7ae,[CaseUpper] = 0x00a7ae}}, + {0x00a7b0, {[CaseLower] = 0x00029e,[CaseTitle] = 0x00a7b0,[CaseUpper] = 0x00a7b0}}, + {0x00a7b1, {[CaseLower] = 0x000287,[CaseTitle] = 0x00a7b1,[CaseUpper] = 0x00a7b1}}, + {0x00a7b2, {[CaseLower] = 0x00029d,[CaseTitle] = 0x00a7b2,[CaseUpper] = 0x00a7b2}}, + {0x00a7b3, {[CaseLower] = 0x00ab53,[CaseTitle] = 0x00a7b3,[CaseUpper] = 0x00a7b3}}, + {0x00a7b4, {[CaseLower] = 0x00a7b5,[CaseTitle] = 0x00a7b4,[CaseUpper] = 0x00a7b4}}, + {0x00a7b5, {[CaseLower] = 0x00a7b5,[CaseTitle] = 0x00a7b4,[CaseUpper] = 0x00a7b4}}, + {0x00a7b6, {[CaseLower] = 0x00a7b7,[CaseTitle] = 0x00a7b6,[CaseUpper] = 0x00a7b6}}, + {0x00a7b7, {[CaseLower] = 0x00a7b7,[CaseTitle] = 0x00a7b6,[CaseUpper] = 0x00a7b6}}, + {0x00a7b8, {[CaseLower] = 0x00a7b9,[CaseTitle] = 0x00a7b8,[CaseUpper] = 0x00a7b8}}, + {0x00a7b9, {[CaseLower] = 0x00a7b9,[CaseTitle] = 0x00a7b8,[CaseUpper] = 0x00a7b8}}, + {0x00a7ba, {[CaseLower] = 0x00a7bb,[CaseTitle] = 0x00a7ba,[CaseUpper] = 0x00a7ba}}, + {0x00a7bb, {[CaseLower] = 0x00a7bb,[CaseTitle] = 0x00a7ba,[CaseUpper] = 0x00a7ba}}, + {0x00a7bc, {[CaseLower] = 0x00a7bd,[CaseTitle] = 0x00a7bc,[CaseUpper] = 0x00a7bc}}, + {0x00a7bd, {[CaseLower] = 0x00a7bd,[CaseTitle] = 0x00a7bc,[CaseUpper] = 0x00a7bc}}, + {0x00a7be, {[CaseLower] = 0x00a7bf,[CaseTitle] = 0x00a7be,[CaseUpper] = 0x00a7be}}, + {0x00a7bf, {[CaseLower] = 0x00a7bf,[CaseTitle] = 0x00a7be,[CaseUpper] = 0x00a7be}}, + {0x00a7c0, {[CaseLower] = 0x00a7c1,[CaseTitle] = 0x00a7c0,[CaseUpper] = 0x00a7c0}}, + {0x00a7c1, {[CaseLower] = 0x00a7c1,[CaseTitle] = 0x00a7c0,[CaseUpper] = 0x00a7c0}}, + {0x00a7c2, {[CaseLower] = 0x00a7c3,[CaseTitle] = 0x00a7c2,[CaseUpper] = 0x00a7c2}}, + {0x00a7c3, {[CaseLower] = 0x00a7c3,[CaseTitle] = 0x00a7c2,[CaseUpper] = 0x00a7c2}}, + {0x00a7c4, {[CaseLower] = 0x00a794,[CaseTitle] = 0x00a7c4,[CaseUpper] = 0x00a7c4}}, + {0x00a7c5, {[CaseLower] = 0x000282,[CaseTitle] = 0x00a7c5,[CaseUpper] = 0x00a7c5}}, + {0x00a7c6, {[CaseLower] = 0x001d8e,[CaseTitle] = 0x00a7c6,[CaseUpper] = 0x00a7c6}}, + {0x00a7c7, {[CaseLower] = 0x00a7c8,[CaseTitle] = 0x00a7c7,[CaseUpper] = 0x00a7c7}}, + {0x00a7c8, {[CaseLower] = 0x00a7c8,[CaseTitle] = 0x00a7c7,[CaseUpper] = 0x00a7c7}}, + {0x00a7c9, {[CaseLower] = 0x00a7ca,[CaseTitle] = 0x00a7c9,[CaseUpper] = 0x00a7c9}}, + {0x00a7ca, {[CaseLower] = 0x00a7ca,[CaseTitle] = 0x00a7c9,[CaseUpper] = 0x00a7c9}}, + {0x00a7d0, {[CaseLower] = 0x00a7d1,[CaseTitle] = 0x00a7d0,[CaseUpper] = 0x00a7d0}}, + {0x00a7d1, {[CaseLower] = 0x00a7d1,[CaseTitle] = 0x00a7d0,[CaseUpper] = 0x00a7d0}}, + {0x00a7d6, {[CaseLower] = 0x00a7d7,[CaseTitle] = 0x00a7d6,[CaseUpper] = 0x00a7d6}}, + {0x00a7d7, {[CaseLower] = 0x00a7d7,[CaseTitle] = 0x00a7d6,[CaseUpper] = 0x00a7d6}}, + {0x00a7d8, {[CaseLower] = 0x00a7d9,[CaseTitle] = 0x00a7d8,[CaseUpper] = 0x00a7d8}}, + {0x00a7d9, {[CaseLower] = 0x00a7d9,[CaseTitle] = 0x00a7d8,[CaseUpper] = 0x00a7d8}}, + {0x00a7f5, {[CaseLower] = 0x00a7f6,[CaseTitle] = 0x00a7f5,[CaseUpper] = 0x00a7f5}}, + {0x00a7f6, {[CaseLower] = 0x00a7f6,[CaseTitle] = 0x00a7f5,[CaseUpper] = 0x00a7f5}}, + {0x00ab53, {[CaseLower] = 0x00ab53,[CaseTitle] = 0x00a7b3,[CaseUpper] = 0x00a7b3}}, + {0x00ab70, {[CaseLower] = 0x00ab70,[CaseTitle] = 0x0013a0,[CaseUpper] = 0x0013a0}}, + {0x00ab71, {[CaseLower] = 0x00ab71,[CaseTitle] = 0x0013a1,[CaseUpper] = 0x0013a1}}, + {0x00ab72, {[CaseLower] = 0x00ab72,[CaseTitle] = 0x0013a2,[CaseUpper] = 0x0013a2}}, + {0x00ab73, {[CaseLower] = 0x00ab73,[CaseTitle] = 0x0013a3,[CaseUpper] = 0x0013a3}}, + {0x00ab74, {[CaseLower] = 0x00ab74,[CaseTitle] = 0x0013a4,[CaseUpper] = 0x0013a4}}, + {0x00ab75, {[CaseLower] = 0x00ab75,[CaseTitle] = 0x0013a5,[CaseUpper] = 0x0013a5}}, + {0x00ab76, {[CaseLower] = 0x00ab76,[CaseTitle] = 0x0013a6,[CaseUpper] = 0x0013a6}}, + {0x00ab77, {[CaseLower] = 0x00ab77,[CaseTitle] = 0x0013a7,[CaseUpper] = 0x0013a7}}, + {0x00ab78, {[CaseLower] = 0x00ab78,[CaseTitle] = 0x0013a8,[CaseUpper] = 0x0013a8}}, + {0x00ab79, {[CaseLower] = 0x00ab79,[CaseTitle] = 0x0013a9,[CaseUpper] = 0x0013a9}}, + {0x00ab7a, {[CaseLower] = 0x00ab7a,[CaseTitle] = 0x0013aa,[CaseUpper] = 0x0013aa}}, + {0x00ab7b, {[CaseLower] = 0x00ab7b,[CaseTitle] = 0x0013ab,[CaseUpper] = 0x0013ab}}, + {0x00ab7c, {[CaseLower] = 0x00ab7c,[CaseTitle] = 0x0013ac,[CaseUpper] = 0x0013ac}}, + {0x00ab7d, {[CaseLower] = 0x00ab7d,[CaseTitle] = 0x0013ad,[CaseUpper] = 0x0013ad}}, + {0x00ab7e, {[CaseLower] = 0x00ab7e,[CaseTitle] = 0x0013ae,[CaseUpper] = 0x0013ae}}, + {0x00ab7f, {[CaseLower] = 0x00ab7f,[CaseTitle] = 0x0013af,[CaseUpper] = 0x0013af}}, + {0x00ab80, {[CaseLower] = 0x00ab80,[CaseTitle] = 0x0013b0,[CaseUpper] = 0x0013b0}}, + {0x00ab81, {[CaseLower] = 0x00ab81,[CaseTitle] = 0x0013b1,[CaseUpper] = 0x0013b1}}, + {0x00ab82, {[CaseLower] = 0x00ab82,[CaseTitle] = 0x0013b2,[CaseUpper] = 0x0013b2}}, + {0x00ab83, {[CaseLower] = 0x00ab83,[CaseTitle] = 0x0013b3,[CaseUpper] = 0x0013b3}}, + {0x00ab84, {[CaseLower] = 0x00ab84,[CaseTitle] = 0x0013b4,[CaseUpper] = 0x0013b4}}, + {0x00ab85, {[CaseLower] = 0x00ab85,[CaseTitle] = 0x0013b5,[CaseUpper] = 0x0013b5}}, + {0x00ab86, {[CaseLower] = 0x00ab86,[CaseTitle] = 0x0013b6,[CaseUpper] = 0x0013b6}}, + {0x00ab87, {[CaseLower] = 0x00ab87,[CaseTitle] = 0x0013b7,[CaseUpper] = 0x0013b7}}, + {0x00ab88, {[CaseLower] = 0x00ab88,[CaseTitle] = 0x0013b8,[CaseUpper] = 0x0013b8}}, + {0x00ab89, {[CaseLower] = 0x00ab89,[CaseTitle] = 0x0013b9,[CaseUpper] = 0x0013b9}}, + {0x00ab8a, {[CaseLower] = 0x00ab8a,[CaseTitle] = 0x0013ba,[CaseUpper] = 0x0013ba}}, + {0x00ab8b, {[CaseLower] = 0x00ab8b,[CaseTitle] = 0x0013bb,[CaseUpper] = 0x0013bb}}, + {0x00ab8c, {[CaseLower] = 0x00ab8c,[CaseTitle] = 0x0013bc,[CaseUpper] = 0x0013bc}}, + {0x00ab8d, {[CaseLower] = 0x00ab8d,[CaseTitle] = 0x0013bd,[CaseUpper] = 0x0013bd}}, + {0x00ab8e, {[CaseLower] = 0x00ab8e,[CaseTitle] = 0x0013be,[CaseUpper] = 0x0013be}}, + {0x00ab8f, {[CaseLower] = 0x00ab8f,[CaseTitle] = 0x0013bf,[CaseUpper] = 0x0013bf}}, + {0x00ab90, {[CaseLower] = 0x00ab90,[CaseTitle] = 0x0013c0,[CaseUpper] = 0x0013c0}}, + {0x00ab91, {[CaseLower] = 0x00ab91,[CaseTitle] = 0x0013c1,[CaseUpper] = 0x0013c1}}, + {0x00ab92, {[CaseLower] = 0x00ab92,[CaseTitle] = 0x0013c2,[CaseUpper] = 0x0013c2}}, + {0x00ab93, {[CaseLower] = 0x00ab93,[CaseTitle] = 0x0013c3,[CaseUpper] = 0x0013c3}}, + {0x00ab94, {[CaseLower] = 0x00ab94,[CaseTitle] = 0x0013c4,[CaseUpper] = 0x0013c4}}, + {0x00ab95, {[CaseLower] = 0x00ab95,[CaseTitle] = 0x0013c5,[CaseUpper] = 0x0013c5}}, + {0x00ab96, {[CaseLower] = 0x00ab96,[CaseTitle] = 0x0013c6,[CaseUpper] = 0x0013c6}}, + {0x00ab97, {[CaseLower] = 0x00ab97,[CaseTitle] = 0x0013c7,[CaseUpper] = 0x0013c7}}, + {0x00ab98, {[CaseLower] = 0x00ab98,[CaseTitle] = 0x0013c8,[CaseUpper] = 0x0013c8}}, + {0x00ab99, {[CaseLower] = 0x00ab99,[CaseTitle] = 0x0013c9,[CaseUpper] = 0x0013c9}}, + {0x00ab9a, {[CaseLower] = 0x00ab9a,[CaseTitle] = 0x0013ca,[CaseUpper] = 0x0013ca}}, + {0x00ab9b, {[CaseLower] = 0x00ab9b,[CaseTitle] = 0x0013cb,[CaseUpper] = 0x0013cb}}, + {0x00ab9c, {[CaseLower] = 0x00ab9c,[CaseTitle] = 0x0013cc,[CaseUpper] = 0x0013cc}}, + {0x00ab9d, {[CaseLower] = 0x00ab9d,[CaseTitle] = 0x0013cd,[CaseUpper] = 0x0013cd}}, + {0x00ab9e, {[CaseLower] = 0x00ab9e,[CaseTitle] = 0x0013ce,[CaseUpper] = 0x0013ce}}, + {0x00ab9f, {[CaseLower] = 0x00ab9f,[CaseTitle] = 0x0013cf,[CaseUpper] = 0x0013cf}}, + {0x00aba0, {[CaseLower] = 0x00aba0,[CaseTitle] = 0x0013d0,[CaseUpper] = 0x0013d0}}, + {0x00aba1, {[CaseLower] = 0x00aba1,[CaseTitle] = 0x0013d1,[CaseUpper] = 0x0013d1}}, + {0x00aba2, {[CaseLower] = 0x00aba2,[CaseTitle] = 0x0013d2,[CaseUpper] = 0x0013d2}}, + {0x00aba3, {[CaseLower] = 0x00aba3,[CaseTitle] = 0x0013d3,[CaseUpper] = 0x0013d3}}, + {0x00aba4, {[CaseLower] = 0x00aba4,[CaseTitle] = 0x0013d4,[CaseUpper] = 0x0013d4}}, + {0x00aba5, {[CaseLower] = 0x00aba5,[CaseTitle] = 0x0013d5,[CaseUpper] = 0x0013d5}}, + {0x00aba6, {[CaseLower] = 0x00aba6,[CaseTitle] = 0x0013d6,[CaseUpper] = 0x0013d6}}, + {0x00aba7, {[CaseLower] = 0x00aba7,[CaseTitle] = 0x0013d7,[CaseUpper] = 0x0013d7}}, + {0x00aba8, {[CaseLower] = 0x00aba8,[CaseTitle] = 0x0013d8,[CaseUpper] = 0x0013d8}}, + {0x00aba9, {[CaseLower] = 0x00aba9,[CaseTitle] = 0x0013d9,[CaseUpper] = 0x0013d9}}, + {0x00abaa, {[CaseLower] = 0x00abaa,[CaseTitle] = 0x0013da,[CaseUpper] = 0x0013da}}, + {0x00abab, {[CaseLower] = 0x00abab,[CaseTitle] = 0x0013db,[CaseUpper] = 0x0013db}}, + {0x00abac, {[CaseLower] = 0x00abac,[CaseTitle] = 0x0013dc,[CaseUpper] = 0x0013dc}}, + {0x00abad, {[CaseLower] = 0x00abad,[CaseTitle] = 0x0013dd,[CaseUpper] = 0x0013dd}}, + {0x00abae, {[CaseLower] = 0x00abae,[CaseTitle] = 0x0013de,[CaseUpper] = 0x0013de}}, + {0x00abaf, {[CaseLower] = 0x00abaf,[CaseTitle] = 0x0013df,[CaseUpper] = 0x0013df}}, + {0x00abb0, {[CaseLower] = 0x00abb0,[CaseTitle] = 0x0013e0,[CaseUpper] = 0x0013e0}}, + {0x00abb1, {[CaseLower] = 0x00abb1,[CaseTitle] = 0x0013e1,[CaseUpper] = 0x0013e1}}, + {0x00abb2, {[CaseLower] = 0x00abb2,[CaseTitle] = 0x0013e2,[CaseUpper] = 0x0013e2}}, + {0x00abb3, {[CaseLower] = 0x00abb3,[CaseTitle] = 0x0013e3,[CaseUpper] = 0x0013e3}}, + {0x00abb4, {[CaseLower] = 0x00abb4,[CaseTitle] = 0x0013e4,[CaseUpper] = 0x0013e4}}, + {0x00abb5, {[CaseLower] = 0x00abb5,[CaseTitle] = 0x0013e5,[CaseUpper] = 0x0013e5}}, + {0x00abb6, {[CaseLower] = 0x00abb6,[CaseTitle] = 0x0013e6,[CaseUpper] = 0x0013e6}}, + {0x00abb7, {[CaseLower] = 0x00abb7,[CaseTitle] = 0x0013e7,[CaseUpper] = 0x0013e7}}, + {0x00abb8, {[CaseLower] = 0x00abb8,[CaseTitle] = 0x0013e8,[CaseUpper] = 0x0013e8}}, + {0x00abb9, {[CaseLower] = 0x00abb9,[CaseTitle] = 0x0013e9,[CaseUpper] = 0x0013e9}}, + {0x00abba, {[CaseLower] = 0x00abba,[CaseTitle] = 0x0013ea,[CaseUpper] = 0x0013ea}}, + {0x00abbb, {[CaseLower] = 0x00abbb,[CaseTitle] = 0x0013eb,[CaseUpper] = 0x0013eb}}, + {0x00abbc, {[CaseLower] = 0x00abbc,[CaseTitle] = 0x0013ec,[CaseUpper] = 0x0013ec}}, + {0x00abbd, {[CaseLower] = 0x00abbd,[CaseTitle] = 0x0013ed,[CaseUpper] = 0x0013ed}}, + {0x00abbe, {[CaseLower] = 0x00abbe,[CaseTitle] = 0x0013ee,[CaseUpper] = 0x0013ee}}, + {0x00abbf, {[CaseLower] = 0x00abbf,[CaseTitle] = 0x0013ef,[CaseUpper] = 0x0013ef}}, + {0x00ff21, {[CaseLower] = 0x00ff41,[CaseTitle] = 0x00ff21,[CaseUpper] = 0x00ff21}}, + {0x00ff22, {[CaseLower] = 0x00ff42,[CaseTitle] = 0x00ff22,[CaseUpper] = 0x00ff22}}, + {0x00ff23, {[CaseLower] = 0x00ff43,[CaseTitle] = 0x00ff23,[CaseUpper] = 0x00ff23}}, + {0x00ff24, {[CaseLower] = 0x00ff44,[CaseTitle] = 0x00ff24,[CaseUpper] = 0x00ff24}}, + {0x00ff25, {[CaseLower] = 0x00ff45,[CaseTitle] = 0x00ff25,[CaseUpper] = 0x00ff25}}, + {0x00ff26, {[CaseLower] = 0x00ff46,[CaseTitle] = 0x00ff26,[CaseUpper] = 0x00ff26}}, + {0x00ff27, {[CaseLower] = 0x00ff47,[CaseTitle] = 0x00ff27,[CaseUpper] = 0x00ff27}}, + {0x00ff28, {[CaseLower] = 0x00ff48,[CaseTitle] = 0x00ff28,[CaseUpper] = 0x00ff28}}, + {0x00ff29, {[CaseLower] = 0x00ff49,[CaseTitle] = 0x00ff29,[CaseUpper] = 0x00ff29}}, + {0x00ff2a, {[CaseLower] = 0x00ff4a,[CaseTitle] = 0x00ff2a,[CaseUpper] = 0x00ff2a}}, + {0x00ff2b, {[CaseLower] = 0x00ff4b,[CaseTitle] = 0x00ff2b,[CaseUpper] = 0x00ff2b}}, + {0x00ff2c, {[CaseLower] = 0x00ff4c,[CaseTitle] = 0x00ff2c,[CaseUpper] = 0x00ff2c}}, + {0x00ff2d, {[CaseLower] = 0x00ff4d,[CaseTitle] = 0x00ff2d,[CaseUpper] = 0x00ff2d}}, + {0x00ff2e, {[CaseLower] = 0x00ff4e,[CaseTitle] = 0x00ff2e,[CaseUpper] = 0x00ff2e}}, + {0x00ff2f, {[CaseLower] = 0x00ff4f,[CaseTitle] = 0x00ff2f,[CaseUpper] = 0x00ff2f}}, + {0x00ff30, {[CaseLower] = 0x00ff50,[CaseTitle] = 0x00ff30,[CaseUpper] = 0x00ff30}}, + {0x00ff31, {[CaseLower] = 0x00ff51,[CaseTitle] = 0x00ff31,[CaseUpper] = 0x00ff31}}, + {0x00ff32, {[CaseLower] = 0x00ff52,[CaseTitle] = 0x00ff32,[CaseUpper] = 0x00ff32}}, + {0x00ff33, {[CaseLower] = 0x00ff53,[CaseTitle] = 0x00ff33,[CaseUpper] = 0x00ff33}}, + {0x00ff34, {[CaseLower] = 0x00ff54,[CaseTitle] = 0x00ff34,[CaseUpper] = 0x00ff34}}, + {0x00ff35, {[CaseLower] = 0x00ff55,[CaseTitle] = 0x00ff35,[CaseUpper] = 0x00ff35}}, + {0x00ff36, {[CaseLower] = 0x00ff56,[CaseTitle] = 0x00ff36,[CaseUpper] = 0x00ff36}}, + {0x00ff37, {[CaseLower] = 0x00ff57,[CaseTitle] = 0x00ff37,[CaseUpper] = 0x00ff37}}, + {0x00ff38, {[CaseLower] = 0x00ff58,[CaseTitle] = 0x00ff38,[CaseUpper] = 0x00ff38}}, + {0x00ff39, {[CaseLower] = 0x00ff59,[CaseTitle] = 0x00ff39,[CaseUpper] = 0x00ff39}}, + {0x00ff3a, {[CaseLower] = 0x00ff5a,[CaseTitle] = 0x00ff3a,[CaseUpper] = 0x00ff3a}}, + {0x00ff41, {[CaseLower] = 0x00ff41,[CaseTitle] = 0x00ff21,[CaseUpper] = 0x00ff21}}, + {0x00ff42, {[CaseLower] = 0x00ff42,[CaseTitle] = 0x00ff22,[CaseUpper] = 0x00ff22}}, + {0x00ff43, {[CaseLower] = 0x00ff43,[CaseTitle] = 0x00ff23,[CaseUpper] = 0x00ff23}}, + {0x00ff44, {[CaseLower] = 0x00ff44,[CaseTitle] = 0x00ff24,[CaseUpper] = 0x00ff24}}, + {0x00ff45, {[CaseLower] = 0x00ff45,[CaseTitle] = 0x00ff25,[CaseUpper] = 0x00ff25}}, + {0x00ff46, {[CaseLower] = 0x00ff46,[CaseTitle] = 0x00ff26,[CaseUpper] = 0x00ff26}}, + {0x00ff47, {[CaseLower] = 0x00ff47,[CaseTitle] = 0x00ff27,[CaseUpper] = 0x00ff27}}, + {0x00ff48, {[CaseLower] = 0x00ff48,[CaseTitle] = 0x00ff28,[CaseUpper] = 0x00ff28}}, + {0x00ff49, {[CaseLower] = 0x00ff49,[CaseTitle] = 0x00ff29,[CaseUpper] = 0x00ff29}}, + {0x00ff4a, {[CaseLower] = 0x00ff4a,[CaseTitle] = 0x00ff2a,[CaseUpper] = 0x00ff2a}}, + {0x00ff4b, {[CaseLower] = 0x00ff4b,[CaseTitle] = 0x00ff2b,[CaseUpper] = 0x00ff2b}}, + {0x00ff4c, {[CaseLower] = 0x00ff4c,[CaseTitle] = 0x00ff2c,[CaseUpper] = 0x00ff2c}}, + {0x00ff4d, {[CaseLower] = 0x00ff4d,[CaseTitle] = 0x00ff2d,[CaseUpper] = 0x00ff2d}}, + {0x00ff4e, {[CaseLower] = 0x00ff4e,[CaseTitle] = 0x00ff2e,[CaseUpper] = 0x00ff2e}}, + {0x00ff4f, {[CaseLower] = 0x00ff4f,[CaseTitle] = 0x00ff2f,[CaseUpper] = 0x00ff2f}}, + {0x00ff50, {[CaseLower] = 0x00ff50,[CaseTitle] = 0x00ff30,[CaseUpper] = 0x00ff30}}, + {0x00ff51, {[CaseLower] = 0x00ff51,[CaseTitle] = 0x00ff31,[CaseUpper] = 0x00ff31}}, + {0x00ff52, {[CaseLower] = 0x00ff52,[CaseTitle] = 0x00ff32,[CaseUpper] = 0x00ff32}}, + {0x00ff53, {[CaseLower] = 0x00ff53,[CaseTitle] = 0x00ff33,[CaseUpper] = 0x00ff33}}, + {0x00ff54, {[CaseLower] = 0x00ff54,[CaseTitle] = 0x00ff34,[CaseUpper] = 0x00ff34}}, + {0x00ff55, {[CaseLower] = 0x00ff55,[CaseTitle] = 0x00ff35,[CaseUpper] = 0x00ff35}}, + {0x00ff56, {[CaseLower] = 0x00ff56,[CaseTitle] = 0x00ff36,[CaseUpper] = 0x00ff36}}, + {0x00ff57, {[CaseLower] = 0x00ff57,[CaseTitle] = 0x00ff37,[CaseUpper] = 0x00ff37}}, + {0x00ff58, {[CaseLower] = 0x00ff58,[CaseTitle] = 0x00ff38,[CaseUpper] = 0x00ff38}}, + {0x00ff59, {[CaseLower] = 0x00ff59,[CaseTitle] = 0x00ff39,[CaseUpper] = 0x00ff39}}, + {0x00ff5a, {[CaseLower] = 0x00ff5a,[CaseTitle] = 0x00ff3a,[CaseUpper] = 0x00ff3a}}, + {0x010400, {[CaseLower] = 0x010428,[CaseTitle] = 0x010400,[CaseUpper] = 0x010400}}, + {0x010401, {[CaseLower] = 0x010429,[CaseTitle] = 0x010401,[CaseUpper] = 0x010401}}, + {0x010402, {[CaseLower] = 0x01042a,[CaseTitle] = 0x010402,[CaseUpper] = 0x010402}}, + {0x010403, {[CaseLower] = 0x01042b,[CaseTitle] = 0x010403,[CaseUpper] = 0x010403}}, + {0x010404, {[CaseLower] = 0x01042c,[CaseTitle] = 0x010404,[CaseUpper] = 0x010404}}, + {0x010405, {[CaseLower] = 0x01042d,[CaseTitle] = 0x010405,[CaseUpper] = 0x010405}}, + {0x010406, {[CaseLower] = 0x01042e,[CaseTitle] = 0x010406,[CaseUpper] = 0x010406}}, + {0x010407, {[CaseLower] = 0x01042f,[CaseTitle] = 0x010407,[CaseUpper] = 0x010407}}, + {0x010408, {[CaseLower] = 0x010430,[CaseTitle] = 0x010408,[CaseUpper] = 0x010408}}, + {0x010409, {[CaseLower] = 0x010431,[CaseTitle] = 0x010409,[CaseUpper] = 0x010409}}, + {0x01040a, {[CaseLower] = 0x010432,[CaseTitle] = 0x01040a,[CaseUpper] = 0x01040a}}, + {0x01040b, {[CaseLower] = 0x010433,[CaseTitle] = 0x01040b,[CaseUpper] = 0x01040b}}, + {0x01040c, {[CaseLower] = 0x010434,[CaseTitle] = 0x01040c,[CaseUpper] = 0x01040c}}, + {0x01040d, {[CaseLower] = 0x010435,[CaseTitle] = 0x01040d,[CaseUpper] = 0x01040d}}, + {0x01040e, {[CaseLower] = 0x010436,[CaseTitle] = 0x01040e,[CaseUpper] = 0x01040e}}, + {0x01040f, {[CaseLower] = 0x010437,[CaseTitle] = 0x01040f,[CaseUpper] = 0x01040f}}, + {0x010410, {[CaseLower] = 0x010438,[CaseTitle] = 0x010410,[CaseUpper] = 0x010410}}, + {0x010411, {[CaseLower] = 0x010439,[CaseTitle] = 0x010411,[CaseUpper] = 0x010411}}, + {0x010412, {[CaseLower] = 0x01043a,[CaseTitle] = 0x010412,[CaseUpper] = 0x010412}}, + {0x010413, {[CaseLower] = 0x01043b,[CaseTitle] = 0x010413,[CaseUpper] = 0x010413}}, + {0x010414, {[CaseLower] = 0x01043c,[CaseTitle] = 0x010414,[CaseUpper] = 0x010414}}, + {0x010415, {[CaseLower] = 0x01043d,[CaseTitle] = 0x010415,[CaseUpper] = 0x010415}}, + {0x010416, {[CaseLower] = 0x01043e,[CaseTitle] = 0x010416,[CaseUpper] = 0x010416}}, + {0x010417, {[CaseLower] = 0x01043f,[CaseTitle] = 0x010417,[CaseUpper] = 0x010417}}, + {0x010418, {[CaseLower] = 0x010440,[CaseTitle] = 0x010418,[CaseUpper] = 0x010418}}, + {0x010419, {[CaseLower] = 0x010441,[CaseTitle] = 0x010419,[CaseUpper] = 0x010419}}, + {0x01041a, {[CaseLower] = 0x010442,[CaseTitle] = 0x01041a,[CaseUpper] = 0x01041a}}, + {0x01041b, {[CaseLower] = 0x010443,[CaseTitle] = 0x01041b,[CaseUpper] = 0x01041b}}, + {0x01041c, {[CaseLower] = 0x010444,[CaseTitle] = 0x01041c,[CaseUpper] = 0x01041c}}, + {0x01041d, {[CaseLower] = 0x010445,[CaseTitle] = 0x01041d,[CaseUpper] = 0x01041d}}, + {0x01041e, {[CaseLower] = 0x010446,[CaseTitle] = 0x01041e,[CaseUpper] = 0x01041e}}, + {0x01041f, {[CaseLower] = 0x010447,[CaseTitle] = 0x01041f,[CaseUpper] = 0x01041f}}, + {0x010420, {[CaseLower] = 0x010448,[CaseTitle] = 0x010420,[CaseUpper] = 0x010420}}, + {0x010421, {[CaseLower] = 0x010449,[CaseTitle] = 0x010421,[CaseUpper] = 0x010421}}, + {0x010422, {[CaseLower] = 0x01044a,[CaseTitle] = 0x010422,[CaseUpper] = 0x010422}}, + {0x010423, {[CaseLower] = 0x01044b,[CaseTitle] = 0x010423,[CaseUpper] = 0x010423}}, + {0x010424, {[CaseLower] = 0x01044c,[CaseTitle] = 0x010424,[CaseUpper] = 0x010424}}, + {0x010425, {[CaseLower] = 0x01044d,[CaseTitle] = 0x010425,[CaseUpper] = 0x010425}}, + {0x010426, {[CaseLower] = 0x01044e,[CaseTitle] = 0x010426,[CaseUpper] = 0x010426}}, + {0x010427, {[CaseLower] = 0x01044f,[CaseTitle] = 0x010427,[CaseUpper] = 0x010427}}, + {0x010428, {[CaseLower] = 0x010428,[CaseTitle] = 0x010400,[CaseUpper] = 0x010400}}, + {0x010429, {[CaseLower] = 0x010429,[CaseTitle] = 0x010401,[CaseUpper] = 0x010401}}, + {0x01042a, {[CaseLower] = 0x01042a,[CaseTitle] = 0x010402,[CaseUpper] = 0x010402}}, + {0x01042b, {[CaseLower] = 0x01042b,[CaseTitle] = 0x010403,[CaseUpper] = 0x010403}}, + {0x01042c, {[CaseLower] = 0x01042c,[CaseTitle] = 0x010404,[CaseUpper] = 0x010404}}, + {0x01042d, {[CaseLower] = 0x01042d,[CaseTitle] = 0x010405,[CaseUpper] = 0x010405}}, + {0x01042e, {[CaseLower] = 0x01042e,[CaseTitle] = 0x010406,[CaseUpper] = 0x010406}}, + {0x01042f, {[CaseLower] = 0x01042f,[CaseTitle] = 0x010407,[CaseUpper] = 0x010407}}, + {0x010430, {[CaseLower] = 0x010430,[CaseTitle] = 0x010408,[CaseUpper] = 0x010408}}, + {0x010431, {[CaseLower] = 0x010431,[CaseTitle] = 0x010409,[CaseUpper] = 0x010409}}, + {0x010432, {[CaseLower] = 0x010432,[CaseTitle] = 0x01040a,[CaseUpper] = 0x01040a}}, + {0x010433, {[CaseLower] = 0x010433,[CaseTitle] = 0x01040b,[CaseUpper] = 0x01040b}}, + {0x010434, {[CaseLower] = 0x010434,[CaseTitle] = 0x01040c,[CaseUpper] = 0x01040c}}, + {0x010435, {[CaseLower] = 0x010435,[CaseTitle] = 0x01040d,[CaseUpper] = 0x01040d}}, + {0x010436, {[CaseLower] = 0x010436,[CaseTitle] = 0x01040e,[CaseUpper] = 0x01040e}}, + {0x010437, {[CaseLower] = 0x010437,[CaseTitle] = 0x01040f,[CaseUpper] = 0x01040f}}, + {0x010438, {[CaseLower] = 0x010438,[CaseTitle] = 0x010410,[CaseUpper] = 0x010410}}, + {0x010439, {[CaseLower] = 0x010439,[CaseTitle] = 0x010411,[CaseUpper] = 0x010411}}, + {0x01043a, {[CaseLower] = 0x01043a,[CaseTitle] = 0x010412,[CaseUpper] = 0x010412}}, + {0x01043b, {[CaseLower] = 0x01043b,[CaseTitle] = 0x010413,[CaseUpper] = 0x010413}}, + {0x01043c, {[CaseLower] = 0x01043c,[CaseTitle] = 0x010414,[CaseUpper] = 0x010414}}, + {0x01043d, {[CaseLower] = 0x01043d,[CaseTitle] = 0x010415,[CaseUpper] = 0x010415}}, + {0x01043e, {[CaseLower] = 0x01043e,[CaseTitle] = 0x010416,[CaseUpper] = 0x010416}}, + {0x01043f, {[CaseLower] = 0x01043f,[CaseTitle] = 0x010417,[CaseUpper] = 0x010417}}, + {0x010440, {[CaseLower] = 0x010440,[CaseTitle] = 0x010418,[CaseUpper] = 0x010418}}, + {0x010441, {[CaseLower] = 0x010441,[CaseTitle] = 0x010419,[CaseUpper] = 0x010419}}, + {0x010442, {[CaseLower] = 0x010442,[CaseTitle] = 0x01041a,[CaseUpper] = 0x01041a}}, + {0x010443, {[CaseLower] = 0x010443,[CaseTitle] = 0x01041b,[CaseUpper] = 0x01041b}}, + {0x010444, {[CaseLower] = 0x010444,[CaseTitle] = 0x01041c,[CaseUpper] = 0x01041c}}, + {0x010445, {[CaseLower] = 0x010445,[CaseTitle] = 0x01041d,[CaseUpper] = 0x01041d}}, + {0x010446, {[CaseLower] = 0x010446,[CaseTitle] = 0x01041e,[CaseUpper] = 0x01041e}}, + {0x010447, {[CaseLower] = 0x010447,[CaseTitle] = 0x01041f,[CaseUpper] = 0x01041f}}, + {0x010448, {[CaseLower] = 0x010448,[CaseTitle] = 0x010420,[CaseUpper] = 0x010420}}, + {0x010449, {[CaseLower] = 0x010449,[CaseTitle] = 0x010421,[CaseUpper] = 0x010421}}, + {0x01044a, {[CaseLower] = 0x01044a,[CaseTitle] = 0x010422,[CaseUpper] = 0x010422}}, + {0x01044b, {[CaseLower] = 0x01044b,[CaseTitle] = 0x010423,[CaseUpper] = 0x010423}}, + {0x01044c, {[CaseLower] = 0x01044c,[CaseTitle] = 0x010424,[CaseUpper] = 0x010424}}, + {0x01044d, {[CaseLower] = 0x01044d,[CaseTitle] = 0x010425,[CaseUpper] = 0x010425}}, + {0x01044e, {[CaseLower] = 0x01044e,[CaseTitle] = 0x010426,[CaseUpper] = 0x010426}}, + {0x01044f, {[CaseLower] = 0x01044f,[CaseTitle] = 0x010427,[CaseUpper] = 0x010427}}, + {0x0104b0, {[CaseLower] = 0x0104d8,[CaseTitle] = 0x0104b0,[CaseUpper] = 0x0104b0}}, + {0x0104b1, {[CaseLower] = 0x0104d9,[CaseTitle] = 0x0104b1,[CaseUpper] = 0x0104b1}}, + {0x0104b2, {[CaseLower] = 0x0104da,[CaseTitle] = 0x0104b2,[CaseUpper] = 0x0104b2}}, + {0x0104b3, {[CaseLower] = 0x0104db,[CaseTitle] = 0x0104b3,[CaseUpper] = 0x0104b3}}, + {0x0104b4, {[CaseLower] = 0x0104dc,[CaseTitle] = 0x0104b4,[CaseUpper] = 0x0104b4}}, + {0x0104b5, {[CaseLower] = 0x0104dd,[CaseTitle] = 0x0104b5,[CaseUpper] = 0x0104b5}}, + {0x0104b6, {[CaseLower] = 0x0104de,[CaseTitle] = 0x0104b6,[CaseUpper] = 0x0104b6}}, + {0x0104b7, {[CaseLower] = 0x0104df,[CaseTitle] = 0x0104b7,[CaseUpper] = 0x0104b7}}, + {0x0104b8, {[CaseLower] = 0x0104e0,[CaseTitle] = 0x0104b8,[CaseUpper] = 0x0104b8}}, + {0x0104b9, {[CaseLower] = 0x0104e1,[CaseTitle] = 0x0104b9,[CaseUpper] = 0x0104b9}}, + {0x0104ba, {[CaseLower] = 0x0104e2,[CaseTitle] = 0x0104ba,[CaseUpper] = 0x0104ba}}, + {0x0104bb, {[CaseLower] = 0x0104e3,[CaseTitle] = 0x0104bb,[CaseUpper] = 0x0104bb}}, + {0x0104bc, {[CaseLower] = 0x0104e4,[CaseTitle] = 0x0104bc,[CaseUpper] = 0x0104bc}}, + {0x0104bd, {[CaseLower] = 0x0104e5,[CaseTitle] = 0x0104bd,[CaseUpper] = 0x0104bd}}, + {0x0104be, {[CaseLower] = 0x0104e6,[CaseTitle] = 0x0104be,[CaseUpper] = 0x0104be}}, + {0x0104bf, {[CaseLower] = 0x0104e7,[CaseTitle] = 0x0104bf,[CaseUpper] = 0x0104bf}}, + {0x0104c0, {[CaseLower] = 0x0104e8,[CaseTitle] = 0x0104c0,[CaseUpper] = 0x0104c0}}, + {0x0104c1, {[CaseLower] = 0x0104e9,[CaseTitle] = 0x0104c1,[CaseUpper] = 0x0104c1}}, + {0x0104c2, {[CaseLower] = 0x0104ea,[CaseTitle] = 0x0104c2,[CaseUpper] = 0x0104c2}}, + {0x0104c3, {[CaseLower] = 0x0104eb,[CaseTitle] = 0x0104c3,[CaseUpper] = 0x0104c3}}, + {0x0104c4, {[CaseLower] = 0x0104ec,[CaseTitle] = 0x0104c4,[CaseUpper] = 0x0104c4}}, + {0x0104c5, {[CaseLower] = 0x0104ed,[CaseTitle] = 0x0104c5,[CaseUpper] = 0x0104c5}}, + {0x0104c6, {[CaseLower] = 0x0104ee,[CaseTitle] = 0x0104c6,[CaseUpper] = 0x0104c6}}, + {0x0104c7, {[CaseLower] = 0x0104ef,[CaseTitle] = 0x0104c7,[CaseUpper] = 0x0104c7}}, + {0x0104c8, {[CaseLower] = 0x0104f0,[CaseTitle] = 0x0104c8,[CaseUpper] = 0x0104c8}}, + {0x0104c9, {[CaseLower] = 0x0104f1,[CaseTitle] = 0x0104c9,[CaseUpper] = 0x0104c9}}, + {0x0104ca, {[CaseLower] = 0x0104f2,[CaseTitle] = 0x0104ca,[CaseUpper] = 0x0104ca}}, + {0x0104cb, {[CaseLower] = 0x0104f3,[CaseTitle] = 0x0104cb,[CaseUpper] = 0x0104cb}}, + {0x0104cc, {[CaseLower] = 0x0104f4,[CaseTitle] = 0x0104cc,[CaseUpper] = 0x0104cc}}, + {0x0104cd, {[CaseLower] = 0x0104f5,[CaseTitle] = 0x0104cd,[CaseUpper] = 0x0104cd}}, + {0x0104ce, {[CaseLower] = 0x0104f6,[CaseTitle] = 0x0104ce,[CaseUpper] = 0x0104ce}}, + {0x0104cf, {[CaseLower] = 0x0104f7,[CaseTitle] = 0x0104cf,[CaseUpper] = 0x0104cf}}, + {0x0104d0, {[CaseLower] = 0x0104f8,[CaseTitle] = 0x0104d0,[CaseUpper] = 0x0104d0}}, + {0x0104d1, {[CaseLower] = 0x0104f9,[CaseTitle] = 0x0104d1,[CaseUpper] = 0x0104d1}}, + {0x0104d2, {[CaseLower] = 0x0104fa,[CaseTitle] = 0x0104d2,[CaseUpper] = 0x0104d2}}, + {0x0104d3, {[CaseLower] = 0x0104fb,[CaseTitle] = 0x0104d3,[CaseUpper] = 0x0104d3}}, + {0x0104d8, {[CaseLower] = 0x0104d8,[CaseTitle] = 0x0104b0,[CaseUpper] = 0x0104b0}}, + {0x0104d9, {[CaseLower] = 0x0104d9,[CaseTitle] = 0x0104b1,[CaseUpper] = 0x0104b1}}, + {0x0104da, {[CaseLower] = 0x0104da,[CaseTitle] = 0x0104b2,[CaseUpper] = 0x0104b2}}, + {0x0104db, {[CaseLower] = 0x0104db,[CaseTitle] = 0x0104b3,[CaseUpper] = 0x0104b3}}, + {0x0104dc, {[CaseLower] = 0x0104dc,[CaseTitle] = 0x0104b4,[CaseUpper] = 0x0104b4}}, + {0x0104dd, {[CaseLower] = 0x0104dd,[CaseTitle] = 0x0104b5,[CaseUpper] = 0x0104b5}}, + {0x0104de, {[CaseLower] = 0x0104de,[CaseTitle] = 0x0104b6,[CaseUpper] = 0x0104b6}}, + {0x0104df, {[CaseLower] = 0x0104df,[CaseTitle] = 0x0104b7,[CaseUpper] = 0x0104b7}}, + {0x0104e0, {[CaseLower] = 0x0104e0,[CaseTitle] = 0x0104b8,[CaseUpper] = 0x0104b8}}, + {0x0104e1, {[CaseLower] = 0x0104e1,[CaseTitle] = 0x0104b9,[CaseUpper] = 0x0104b9}}, + {0x0104e2, {[CaseLower] = 0x0104e2,[CaseTitle] = 0x0104ba,[CaseUpper] = 0x0104ba}}, + {0x0104e3, {[CaseLower] = 0x0104e3,[CaseTitle] = 0x0104bb,[CaseUpper] = 0x0104bb}}, + {0x0104e4, {[CaseLower] = 0x0104e4,[CaseTitle] = 0x0104bc,[CaseUpper] = 0x0104bc}}, + {0x0104e5, {[CaseLower] = 0x0104e5,[CaseTitle] = 0x0104bd,[CaseUpper] = 0x0104bd}}, + {0x0104e6, {[CaseLower] = 0x0104e6,[CaseTitle] = 0x0104be,[CaseUpper] = 0x0104be}}, + {0x0104e7, {[CaseLower] = 0x0104e7,[CaseTitle] = 0x0104bf,[CaseUpper] = 0x0104bf}}, + {0x0104e8, {[CaseLower] = 0x0104e8,[CaseTitle] = 0x0104c0,[CaseUpper] = 0x0104c0}}, + {0x0104e9, {[CaseLower] = 0x0104e9,[CaseTitle] = 0x0104c1,[CaseUpper] = 0x0104c1}}, + {0x0104ea, {[CaseLower] = 0x0104ea,[CaseTitle] = 0x0104c2,[CaseUpper] = 0x0104c2}}, + {0x0104eb, {[CaseLower] = 0x0104eb,[CaseTitle] = 0x0104c3,[CaseUpper] = 0x0104c3}}, + {0x0104ec, {[CaseLower] = 0x0104ec,[CaseTitle] = 0x0104c4,[CaseUpper] = 0x0104c4}}, + {0x0104ed, {[CaseLower] = 0x0104ed,[CaseTitle] = 0x0104c5,[CaseUpper] = 0x0104c5}}, + {0x0104ee, {[CaseLower] = 0x0104ee,[CaseTitle] = 0x0104c6,[CaseUpper] = 0x0104c6}}, + {0x0104ef, {[CaseLower] = 0x0104ef,[CaseTitle] = 0x0104c7,[CaseUpper] = 0x0104c7}}, + {0x0104f0, {[CaseLower] = 0x0104f0,[CaseTitle] = 0x0104c8,[CaseUpper] = 0x0104c8}}, + {0x0104f1, {[CaseLower] = 0x0104f1,[CaseTitle] = 0x0104c9,[CaseUpper] = 0x0104c9}}, + {0x0104f2, {[CaseLower] = 0x0104f2,[CaseTitle] = 0x0104ca,[CaseUpper] = 0x0104ca}}, + {0x0104f3, {[CaseLower] = 0x0104f3,[CaseTitle] = 0x0104cb,[CaseUpper] = 0x0104cb}}, + {0x0104f4, {[CaseLower] = 0x0104f4,[CaseTitle] = 0x0104cc,[CaseUpper] = 0x0104cc}}, + {0x0104f5, {[CaseLower] = 0x0104f5,[CaseTitle] = 0x0104cd,[CaseUpper] = 0x0104cd}}, + {0x0104f6, {[CaseLower] = 0x0104f6,[CaseTitle] = 0x0104ce,[CaseUpper] = 0x0104ce}}, + {0x0104f7, {[CaseLower] = 0x0104f7,[CaseTitle] = 0x0104cf,[CaseUpper] = 0x0104cf}}, + {0x0104f8, {[CaseLower] = 0x0104f8,[CaseTitle] = 0x0104d0,[CaseUpper] = 0x0104d0}}, + {0x0104f9, {[CaseLower] = 0x0104f9,[CaseTitle] = 0x0104d1,[CaseUpper] = 0x0104d1}}, + {0x0104fa, {[CaseLower] = 0x0104fa,[CaseTitle] = 0x0104d2,[CaseUpper] = 0x0104d2}}, + {0x0104fb, {[CaseLower] = 0x0104fb,[CaseTitle] = 0x0104d3,[CaseUpper] = 0x0104d3}}, + {0x010570, {[CaseLower] = 0x010597,[CaseTitle] = 0x010570,[CaseUpper] = 0x010570}}, + {0x010571, {[CaseLower] = 0x010598,[CaseTitle] = 0x010571,[CaseUpper] = 0x010571}}, + {0x010572, {[CaseLower] = 0x010599,[CaseTitle] = 0x010572,[CaseUpper] = 0x010572}}, + {0x010573, {[CaseLower] = 0x01059a,[CaseTitle] = 0x010573,[CaseUpper] = 0x010573}}, + {0x010574, {[CaseLower] = 0x01059b,[CaseTitle] = 0x010574,[CaseUpper] = 0x010574}}, + {0x010575, {[CaseLower] = 0x01059c,[CaseTitle] = 0x010575,[CaseUpper] = 0x010575}}, + {0x010576, {[CaseLower] = 0x01059d,[CaseTitle] = 0x010576,[CaseUpper] = 0x010576}}, + {0x010577, {[CaseLower] = 0x01059e,[CaseTitle] = 0x010577,[CaseUpper] = 0x010577}}, + {0x010578, {[CaseLower] = 0x01059f,[CaseTitle] = 0x010578,[CaseUpper] = 0x010578}}, + {0x010579, {[CaseLower] = 0x0105a0,[CaseTitle] = 0x010579,[CaseUpper] = 0x010579}}, + {0x01057a, {[CaseLower] = 0x0105a1,[CaseTitle] = 0x01057a,[CaseUpper] = 0x01057a}}, + {0x01057c, {[CaseLower] = 0x0105a3,[CaseTitle] = 0x01057c,[CaseUpper] = 0x01057c}}, + {0x01057d, {[CaseLower] = 0x0105a4,[CaseTitle] = 0x01057d,[CaseUpper] = 0x01057d}}, + {0x01057e, {[CaseLower] = 0x0105a5,[CaseTitle] = 0x01057e,[CaseUpper] = 0x01057e}}, + {0x01057f, {[CaseLower] = 0x0105a6,[CaseTitle] = 0x01057f,[CaseUpper] = 0x01057f}}, + {0x010580, {[CaseLower] = 0x0105a7,[CaseTitle] = 0x010580,[CaseUpper] = 0x010580}}, + {0x010581, {[CaseLower] = 0x0105a8,[CaseTitle] = 0x010581,[CaseUpper] = 0x010581}}, + {0x010582, {[CaseLower] = 0x0105a9,[CaseTitle] = 0x010582,[CaseUpper] = 0x010582}}, + {0x010583, {[CaseLower] = 0x0105aa,[CaseTitle] = 0x010583,[CaseUpper] = 0x010583}}, + {0x010584, {[CaseLower] = 0x0105ab,[CaseTitle] = 0x010584,[CaseUpper] = 0x010584}}, + {0x010585, {[CaseLower] = 0x0105ac,[CaseTitle] = 0x010585,[CaseUpper] = 0x010585}}, + {0x010586, {[CaseLower] = 0x0105ad,[CaseTitle] = 0x010586,[CaseUpper] = 0x010586}}, + {0x010587, {[CaseLower] = 0x0105ae,[CaseTitle] = 0x010587,[CaseUpper] = 0x010587}}, + {0x010588, {[CaseLower] = 0x0105af,[CaseTitle] = 0x010588,[CaseUpper] = 0x010588}}, + {0x010589, {[CaseLower] = 0x0105b0,[CaseTitle] = 0x010589,[CaseUpper] = 0x010589}}, + {0x01058a, {[CaseLower] = 0x0105b1,[CaseTitle] = 0x01058a,[CaseUpper] = 0x01058a}}, + {0x01058c, {[CaseLower] = 0x0105b3,[CaseTitle] = 0x01058c,[CaseUpper] = 0x01058c}}, + {0x01058d, {[CaseLower] = 0x0105b4,[CaseTitle] = 0x01058d,[CaseUpper] = 0x01058d}}, + {0x01058e, {[CaseLower] = 0x0105b5,[CaseTitle] = 0x01058e,[CaseUpper] = 0x01058e}}, + {0x01058f, {[CaseLower] = 0x0105b6,[CaseTitle] = 0x01058f,[CaseUpper] = 0x01058f}}, + {0x010590, {[CaseLower] = 0x0105b7,[CaseTitle] = 0x010590,[CaseUpper] = 0x010590}}, + {0x010591, {[CaseLower] = 0x0105b8,[CaseTitle] = 0x010591,[CaseUpper] = 0x010591}}, + {0x010592, {[CaseLower] = 0x0105b9,[CaseTitle] = 0x010592,[CaseUpper] = 0x010592}}, + {0x010594, {[CaseLower] = 0x0105bb,[CaseTitle] = 0x010594,[CaseUpper] = 0x010594}}, + {0x010595, {[CaseLower] = 0x0105bc,[CaseTitle] = 0x010595,[CaseUpper] = 0x010595}}, + {0x010597, {[CaseLower] = 0x010597,[CaseTitle] = 0x010570,[CaseUpper] = 0x010570}}, + {0x010598, {[CaseLower] = 0x010598,[CaseTitle] = 0x010571,[CaseUpper] = 0x010571}}, + {0x010599, {[CaseLower] = 0x010599,[CaseTitle] = 0x010572,[CaseUpper] = 0x010572}}, + {0x01059a, {[CaseLower] = 0x01059a,[CaseTitle] = 0x010573,[CaseUpper] = 0x010573}}, + {0x01059b, {[CaseLower] = 0x01059b,[CaseTitle] = 0x010574,[CaseUpper] = 0x010574}}, + {0x01059c, {[CaseLower] = 0x01059c,[CaseTitle] = 0x010575,[CaseUpper] = 0x010575}}, + {0x01059d, {[CaseLower] = 0x01059d,[CaseTitle] = 0x010576,[CaseUpper] = 0x010576}}, + {0x01059e, {[CaseLower] = 0x01059e,[CaseTitle] = 0x010577,[CaseUpper] = 0x010577}}, + {0x01059f, {[CaseLower] = 0x01059f,[CaseTitle] = 0x010578,[CaseUpper] = 0x010578}}, + {0x0105a0, {[CaseLower] = 0x0105a0,[CaseTitle] = 0x010579,[CaseUpper] = 0x010579}}, + {0x0105a1, {[CaseLower] = 0x0105a1,[CaseTitle] = 0x01057a,[CaseUpper] = 0x01057a}}, + {0x0105a3, {[CaseLower] = 0x0105a3,[CaseTitle] = 0x01057c,[CaseUpper] = 0x01057c}}, + {0x0105a4, {[CaseLower] = 0x0105a4,[CaseTitle] = 0x01057d,[CaseUpper] = 0x01057d}}, + {0x0105a5, {[CaseLower] = 0x0105a5,[CaseTitle] = 0x01057e,[CaseUpper] = 0x01057e}}, + {0x0105a6, {[CaseLower] = 0x0105a6,[CaseTitle] = 0x01057f,[CaseUpper] = 0x01057f}}, + {0x0105a7, {[CaseLower] = 0x0105a7,[CaseTitle] = 0x010580,[CaseUpper] = 0x010580}}, + {0x0105a8, {[CaseLower] = 0x0105a8,[CaseTitle] = 0x010581,[CaseUpper] = 0x010581}}, + {0x0105a9, {[CaseLower] = 0x0105a9,[CaseTitle] = 0x010582,[CaseUpper] = 0x010582}}, + {0x0105aa, {[CaseLower] = 0x0105aa,[CaseTitle] = 0x010583,[CaseUpper] = 0x010583}}, + {0x0105ab, {[CaseLower] = 0x0105ab,[CaseTitle] = 0x010584,[CaseUpper] = 0x010584}}, + {0x0105ac, {[CaseLower] = 0x0105ac,[CaseTitle] = 0x010585,[CaseUpper] = 0x010585}}, + {0x0105ad, {[CaseLower] = 0x0105ad,[CaseTitle] = 0x010586,[CaseUpper] = 0x010586}}, + {0x0105ae, {[CaseLower] = 0x0105ae,[CaseTitle] = 0x010587,[CaseUpper] = 0x010587}}, + {0x0105af, {[CaseLower] = 0x0105af,[CaseTitle] = 0x010588,[CaseUpper] = 0x010588}}, + {0x0105b0, {[CaseLower] = 0x0105b0,[CaseTitle] = 0x010589,[CaseUpper] = 0x010589}}, + {0x0105b1, {[CaseLower] = 0x0105b1,[CaseTitle] = 0x01058a,[CaseUpper] = 0x01058a}}, + {0x0105b3, {[CaseLower] = 0x0105b3,[CaseTitle] = 0x01058c,[CaseUpper] = 0x01058c}}, + {0x0105b4, {[CaseLower] = 0x0105b4,[CaseTitle] = 0x01058d,[CaseUpper] = 0x01058d}}, + {0x0105b5, {[CaseLower] = 0x0105b5,[CaseTitle] = 0x01058e,[CaseUpper] = 0x01058e}}, + {0x0105b6, {[CaseLower] = 0x0105b6,[CaseTitle] = 0x01058f,[CaseUpper] = 0x01058f}}, + {0x0105b7, {[CaseLower] = 0x0105b7,[CaseTitle] = 0x010590,[CaseUpper] = 0x010590}}, + {0x0105b8, {[CaseLower] = 0x0105b8,[CaseTitle] = 0x010591,[CaseUpper] = 0x010591}}, + {0x0105b9, {[CaseLower] = 0x0105b9,[CaseTitle] = 0x010592,[CaseUpper] = 0x010592}}, + {0x0105bb, {[CaseLower] = 0x0105bb,[CaseTitle] = 0x010594,[CaseUpper] = 0x010594}}, + {0x0105bc, {[CaseLower] = 0x0105bc,[CaseTitle] = 0x010595,[CaseUpper] = 0x010595}}, + {0x010c80, {[CaseLower] = 0x010cc0,[CaseTitle] = 0x010c80,[CaseUpper] = 0x010c80}}, + {0x010c81, {[CaseLower] = 0x010cc1,[CaseTitle] = 0x010c81,[CaseUpper] = 0x010c81}}, + {0x010c82, {[CaseLower] = 0x010cc2,[CaseTitle] = 0x010c82,[CaseUpper] = 0x010c82}}, + {0x010c83, {[CaseLower] = 0x010cc3,[CaseTitle] = 0x010c83,[CaseUpper] = 0x010c83}}, + {0x010c84, {[CaseLower] = 0x010cc4,[CaseTitle] = 0x010c84,[CaseUpper] = 0x010c84}}, + {0x010c85, {[CaseLower] = 0x010cc5,[CaseTitle] = 0x010c85,[CaseUpper] = 0x010c85}}, + {0x010c86, {[CaseLower] = 0x010cc6,[CaseTitle] = 0x010c86,[CaseUpper] = 0x010c86}}, + {0x010c87, {[CaseLower] = 0x010cc7,[CaseTitle] = 0x010c87,[CaseUpper] = 0x010c87}}, + {0x010c88, {[CaseLower] = 0x010cc8,[CaseTitle] = 0x010c88,[CaseUpper] = 0x010c88}}, + {0x010c89, {[CaseLower] = 0x010cc9,[CaseTitle] = 0x010c89,[CaseUpper] = 0x010c89}}, + {0x010c8a, {[CaseLower] = 0x010cca,[CaseTitle] = 0x010c8a,[CaseUpper] = 0x010c8a}}, + {0x010c8b, {[CaseLower] = 0x010ccb,[CaseTitle] = 0x010c8b,[CaseUpper] = 0x010c8b}}, + {0x010c8c, {[CaseLower] = 0x010ccc,[CaseTitle] = 0x010c8c,[CaseUpper] = 0x010c8c}}, + {0x010c8d, {[CaseLower] = 0x010ccd,[CaseTitle] = 0x010c8d,[CaseUpper] = 0x010c8d}}, + {0x010c8e, {[CaseLower] = 0x010cce,[CaseTitle] = 0x010c8e,[CaseUpper] = 0x010c8e}}, + {0x010c8f, {[CaseLower] = 0x010ccf,[CaseTitle] = 0x010c8f,[CaseUpper] = 0x010c8f}}, + {0x010c90, {[CaseLower] = 0x010cd0,[CaseTitle] = 0x010c90,[CaseUpper] = 0x010c90}}, + {0x010c91, {[CaseLower] = 0x010cd1,[CaseTitle] = 0x010c91,[CaseUpper] = 0x010c91}}, + {0x010c92, {[CaseLower] = 0x010cd2,[CaseTitle] = 0x010c92,[CaseUpper] = 0x010c92}}, + {0x010c93, {[CaseLower] = 0x010cd3,[CaseTitle] = 0x010c93,[CaseUpper] = 0x010c93}}, + {0x010c94, {[CaseLower] = 0x010cd4,[CaseTitle] = 0x010c94,[CaseUpper] = 0x010c94}}, + {0x010c95, {[CaseLower] = 0x010cd5,[CaseTitle] = 0x010c95,[CaseUpper] = 0x010c95}}, + {0x010c96, {[CaseLower] = 0x010cd6,[CaseTitle] = 0x010c96,[CaseUpper] = 0x010c96}}, + {0x010c97, {[CaseLower] = 0x010cd7,[CaseTitle] = 0x010c97,[CaseUpper] = 0x010c97}}, + {0x010c98, {[CaseLower] = 0x010cd8,[CaseTitle] = 0x010c98,[CaseUpper] = 0x010c98}}, + {0x010c99, {[CaseLower] = 0x010cd9,[CaseTitle] = 0x010c99,[CaseUpper] = 0x010c99}}, + {0x010c9a, {[CaseLower] = 0x010cda,[CaseTitle] = 0x010c9a,[CaseUpper] = 0x010c9a}}, + {0x010c9b, {[CaseLower] = 0x010cdb,[CaseTitle] = 0x010c9b,[CaseUpper] = 0x010c9b}}, + {0x010c9c, {[CaseLower] = 0x010cdc,[CaseTitle] = 0x010c9c,[CaseUpper] = 0x010c9c}}, + {0x010c9d, {[CaseLower] = 0x010cdd,[CaseTitle] = 0x010c9d,[CaseUpper] = 0x010c9d}}, + {0x010c9e, {[CaseLower] = 0x010cde,[CaseTitle] = 0x010c9e,[CaseUpper] = 0x010c9e}}, + {0x010c9f, {[CaseLower] = 0x010cdf,[CaseTitle] = 0x010c9f,[CaseUpper] = 0x010c9f}}, + {0x010ca0, {[CaseLower] = 0x010ce0,[CaseTitle] = 0x010ca0,[CaseUpper] = 0x010ca0}}, + {0x010ca1, {[CaseLower] = 0x010ce1,[CaseTitle] = 0x010ca1,[CaseUpper] = 0x010ca1}}, + {0x010ca2, {[CaseLower] = 0x010ce2,[CaseTitle] = 0x010ca2,[CaseUpper] = 0x010ca2}}, + {0x010ca3, {[CaseLower] = 0x010ce3,[CaseTitle] = 0x010ca3,[CaseUpper] = 0x010ca3}}, + {0x010ca4, {[CaseLower] = 0x010ce4,[CaseTitle] = 0x010ca4,[CaseUpper] = 0x010ca4}}, + {0x010ca5, {[CaseLower] = 0x010ce5,[CaseTitle] = 0x010ca5,[CaseUpper] = 0x010ca5}}, + {0x010ca6, {[CaseLower] = 0x010ce6,[CaseTitle] = 0x010ca6,[CaseUpper] = 0x010ca6}}, + {0x010ca7, {[CaseLower] = 0x010ce7,[CaseTitle] = 0x010ca7,[CaseUpper] = 0x010ca7}}, + {0x010ca8, {[CaseLower] = 0x010ce8,[CaseTitle] = 0x010ca8,[CaseUpper] = 0x010ca8}}, + {0x010ca9, {[CaseLower] = 0x010ce9,[CaseTitle] = 0x010ca9,[CaseUpper] = 0x010ca9}}, + {0x010caa, {[CaseLower] = 0x010cea,[CaseTitle] = 0x010caa,[CaseUpper] = 0x010caa}}, + {0x010cab, {[CaseLower] = 0x010ceb,[CaseTitle] = 0x010cab,[CaseUpper] = 0x010cab}}, + {0x010cac, {[CaseLower] = 0x010cec,[CaseTitle] = 0x010cac,[CaseUpper] = 0x010cac}}, + {0x010cad, {[CaseLower] = 0x010ced,[CaseTitle] = 0x010cad,[CaseUpper] = 0x010cad}}, + {0x010cae, {[CaseLower] = 0x010cee,[CaseTitle] = 0x010cae,[CaseUpper] = 0x010cae}}, + {0x010caf, {[CaseLower] = 0x010cef,[CaseTitle] = 0x010caf,[CaseUpper] = 0x010caf}}, + {0x010cb0, {[CaseLower] = 0x010cf0,[CaseTitle] = 0x010cb0,[CaseUpper] = 0x010cb0}}, + {0x010cb1, {[CaseLower] = 0x010cf1,[CaseTitle] = 0x010cb1,[CaseUpper] = 0x010cb1}}, + {0x010cb2, {[CaseLower] = 0x010cf2,[CaseTitle] = 0x010cb2,[CaseUpper] = 0x010cb2}}, + {0x010cc0, {[CaseLower] = 0x010cc0,[CaseTitle] = 0x010c80,[CaseUpper] = 0x010c80}}, + {0x010cc1, {[CaseLower] = 0x010cc1,[CaseTitle] = 0x010c81,[CaseUpper] = 0x010c81}}, + {0x010cc2, {[CaseLower] = 0x010cc2,[CaseTitle] = 0x010c82,[CaseUpper] = 0x010c82}}, + {0x010cc3, {[CaseLower] = 0x010cc3,[CaseTitle] = 0x010c83,[CaseUpper] = 0x010c83}}, + {0x010cc4, {[CaseLower] = 0x010cc4,[CaseTitle] = 0x010c84,[CaseUpper] = 0x010c84}}, + {0x010cc5, {[CaseLower] = 0x010cc5,[CaseTitle] = 0x010c85,[CaseUpper] = 0x010c85}}, + {0x010cc6, {[CaseLower] = 0x010cc6,[CaseTitle] = 0x010c86,[CaseUpper] = 0x010c86}}, + {0x010cc7, {[CaseLower] = 0x010cc7,[CaseTitle] = 0x010c87,[CaseUpper] = 0x010c87}}, + {0x010cc8, {[CaseLower] = 0x010cc8,[CaseTitle] = 0x010c88,[CaseUpper] = 0x010c88}}, + {0x010cc9, {[CaseLower] = 0x010cc9,[CaseTitle] = 0x010c89,[CaseUpper] = 0x010c89}}, + {0x010cca, {[CaseLower] = 0x010cca,[CaseTitle] = 0x010c8a,[CaseUpper] = 0x010c8a}}, + {0x010ccb, {[CaseLower] = 0x010ccb,[CaseTitle] = 0x010c8b,[CaseUpper] = 0x010c8b}}, + {0x010ccc, {[CaseLower] = 0x010ccc,[CaseTitle] = 0x010c8c,[CaseUpper] = 0x010c8c}}, + {0x010ccd, {[CaseLower] = 0x010ccd,[CaseTitle] = 0x010c8d,[CaseUpper] = 0x010c8d}}, + {0x010cce, {[CaseLower] = 0x010cce,[CaseTitle] = 0x010c8e,[CaseUpper] = 0x010c8e}}, + {0x010ccf, {[CaseLower] = 0x010ccf,[CaseTitle] = 0x010c8f,[CaseUpper] = 0x010c8f}}, + {0x010cd0, {[CaseLower] = 0x010cd0,[CaseTitle] = 0x010c90,[CaseUpper] = 0x010c90}}, + {0x010cd1, {[CaseLower] = 0x010cd1,[CaseTitle] = 0x010c91,[CaseUpper] = 0x010c91}}, + {0x010cd2, {[CaseLower] = 0x010cd2,[CaseTitle] = 0x010c92,[CaseUpper] = 0x010c92}}, + {0x010cd3, {[CaseLower] = 0x010cd3,[CaseTitle] = 0x010c93,[CaseUpper] = 0x010c93}}, + {0x010cd4, {[CaseLower] = 0x010cd4,[CaseTitle] = 0x010c94,[CaseUpper] = 0x010c94}}, + {0x010cd5, {[CaseLower] = 0x010cd5,[CaseTitle] = 0x010c95,[CaseUpper] = 0x010c95}}, + {0x010cd6, {[CaseLower] = 0x010cd6,[CaseTitle] = 0x010c96,[CaseUpper] = 0x010c96}}, + {0x010cd7, {[CaseLower] = 0x010cd7,[CaseTitle] = 0x010c97,[CaseUpper] = 0x010c97}}, + {0x010cd8, {[CaseLower] = 0x010cd8,[CaseTitle] = 0x010c98,[CaseUpper] = 0x010c98}}, + {0x010cd9, {[CaseLower] = 0x010cd9,[CaseTitle] = 0x010c99,[CaseUpper] = 0x010c99}}, + {0x010cda, {[CaseLower] = 0x010cda,[CaseTitle] = 0x010c9a,[CaseUpper] = 0x010c9a}}, + {0x010cdb, {[CaseLower] = 0x010cdb,[CaseTitle] = 0x010c9b,[CaseUpper] = 0x010c9b}}, + {0x010cdc, {[CaseLower] = 0x010cdc,[CaseTitle] = 0x010c9c,[CaseUpper] = 0x010c9c}}, + {0x010cdd, {[CaseLower] = 0x010cdd,[CaseTitle] = 0x010c9d,[CaseUpper] = 0x010c9d}}, + {0x010cde, {[CaseLower] = 0x010cde,[CaseTitle] = 0x010c9e,[CaseUpper] = 0x010c9e}}, + {0x010cdf, {[CaseLower] = 0x010cdf,[CaseTitle] = 0x010c9f,[CaseUpper] = 0x010c9f}}, + {0x010ce0, {[CaseLower] = 0x010ce0,[CaseTitle] = 0x010ca0,[CaseUpper] = 0x010ca0}}, + {0x010ce1, {[CaseLower] = 0x010ce1,[CaseTitle] = 0x010ca1,[CaseUpper] = 0x010ca1}}, + {0x010ce2, {[CaseLower] = 0x010ce2,[CaseTitle] = 0x010ca2,[CaseUpper] = 0x010ca2}}, + {0x010ce3, {[CaseLower] = 0x010ce3,[CaseTitle] = 0x010ca3,[CaseUpper] = 0x010ca3}}, + {0x010ce4, {[CaseLower] = 0x010ce4,[CaseTitle] = 0x010ca4,[CaseUpper] = 0x010ca4}}, + {0x010ce5, {[CaseLower] = 0x010ce5,[CaseTitle] = 0x010ca5,[CaseUpper] = 0x010ca5}}, + {0x010ce6, {[CaseLower] = 0x010ce6,[CaseTitle] = 0x010ca6,[CaseUpper] = 0x010ca6}}, + {0x010ce7, {[CaseLower] = 0x010ce7,[CaseTitle] = 0x010ca7,[CaseUpper] = 0x010ca7}}, + {0x010ce8, {[CaseLower] = 0x010ce8,[CaseTitle] = 0x010ca8,[CaseUpper] = 0x010ca8}}, + {0x010ce9, {[CaseLower] = 0x010ce9,[CaseTitle] = 0x010ca9,[CaseUpper] = 0x010ca9}}, + {0x010cea, {[CaseLower] = 0x010cea,[CaseTitle] = 0x010caa,[CaseUpper] = 0x010caa}}, + {0x010ceb, {[CaseLower] = 0x010ceb,[CaseTitle] = 0x010cab,[CaseUpper] = 0x010cab}}, + {0x010cec, {[CaseLower] = 0x010cec,[CaseTitle] = 0x010cac,[CaseUpper] = 0x010cac}}, + {0x010ced, {[CaseLower] = 0x010ced,[CaseTitle] = 0x010cad,[CaseUpper] = 0x010cad}}, + {0x010cee, {[CaseLower] = 0x010cee,[CaseTitle] = 0x010cae,[CaseUpper] = 0x010cae}}, + {0x010cef, {[CaseLower] = 0x010cef,[CaseTitle] = 0x010caf,[CaseUpper] = 0x010caf}}, + {0x010cf0, {[CaseLower] = 0x010cf0,[CaseTitle] = 0x010cb0,[CaseUpper] = 0x010cb0}}, + {0x010cf1, {[CaseLower] = 0x010cf1,[CaseTitle] = 0x010cb1,[CaseUpper] = 0x010cb1}}, + {0x010cf2, {[CaseLower] = 0x010cf2,[CaseTitle] = 0x010cb2,[CaseUpper] = 0x010cb2}}, + {0x0118a0, {[CaseLower] = 0x0118c0,[CaseTitle] = 0x0118a0,[CaseUpper] = 0x0118a0}}, + {0x0118a1, {[CaseLower] = 0x0118c1,[CaseTitle] = 0x0118a1,[CaseUpper] = 0x0118a1}}, + {0x0118a2, {[CaseLower] = 0x0118c2,[CaseTitle] = 0x0118a2,[CaseUpper] = 0x0118a2}}, + {0x0118a3, {[CaseLower] = 0x0118c3,[CaseTitle] = 0x0118a3,[CaseUpper] = 0x0118a3}}, + {0x0118a4, {[CaseLower] = 0x0118c4,[CaseTitle] = 0x0118a4,[CaseUpper] = 0x0118a4}}, + {0x0118a5, {[CaseLower] = 0x0118c5,[CaseTitle] = 0x0118a5,[CaseUpper] = 0x0118a5}}, + {0x0118a6, {[CaseLower] = 0x0118c6,[CaseTitle] = 0x0118a6,[CaseUpper] = 0x0118a6}}, + {0x0118a7, {[CaseLower] = 0x0118c7,[CaseTitle] = 0x0118a7,[CaseUpper] = 0x0118a7}}, + {0x0118a8, {[CaseLower] = 0x0118c8,[CaseTitle] = 0x0118a8,[CaseUpper] = 0x0118a8}}, + {0x0118a9, {[CaseLower] = 0x0118c9,[CaseTitle] = 0x0118a9,[CaseUpper] = 0x0118a9}}, + {0x0118aa, {[CaseLower] = 0x0118ca,[CaseTitle] = 0x0118aa,[CaseUpper] = 0x0118aa}}, + {0x0118ab, {[CaseLower] = 0x0118cb,[CaseTitle] = 0x0118ab,[CaseUpper] = 0x0118ab}}, + {0x0118ac, {[CaseLower] = 0x0118cc,[CaseTitle] = 0x0118ac,[CaseUpper] = 0x0118ac}}, + {0x0118ad, {[CaseLower] = 0x0118cd,[CaseTitle] = 0x0118ad,[CaseUpper] = 0x0118ad}}, + {0x0118ae, {[CaseLower] = 0x0118ce,[CaseTitle] = 0x0118ae,[CaseUpper] = 0x0118ae}}, + {0x0118af, {[CaseLower] = 0x0118cf,[CaseTitle] = 0x0118af,[CaseUpper] = 0x0118af}}, + {0x0118b0, {[CaseLower] = 0x0118d0,[CaseTitle] = 0x0118b0,[CaseUpper] = 0x0118b0}}, + {0x0118b1, {[CaseLower] = 0x0118d1,[CaseTitle] = 0x0118b1,[CaseUpper] = 0x0118b1}}, + {0x0118b2, {[CaseLower] = 0x0118d2,[CaseTitle] = 0x0118b2,[CaseUpper] = 0x0118b2}}, + {0x0118b3, {[CaseLower] = 0x0118d3,[CaseTitle] = 0x0118b3,[CaseUpper] = 0x0118b3}}, + {0x0118b4, {[CaseLower] = 0x0118d4,[CaseTitle] = 0x0118b4,[CaseUpper] = 0x0118b4}}, + {0x0118b5, {[CaseLower] = 0x0118d5,[CaseTitle] = 0x0118b5,[CaseUpper] = 0x0118b5}}, + {0x0118b6, {[CaseLower] = 0x0118d6,[CaseTitle] = 0x0118b6,[CaseUpper] = 0x0118b6}}, + {0x0118b7, {[CaseLower] = 0x0118d7,[CaseTitle] = 0x0118b7,[CaseUpper] = 0x0118b7}}, + {0x0118b8, {[CaseLower] = 0x0118d8,[CaseTitle] = 0x0118b8,[CaseUpper] = 0x0118b8}}, + {0x0118b9, {[CaseLower] = 0x0118d9,[CaseTitle] = 0x0118b9,[CaseUpper] = 0x0118b9}}, + {0x0118ba, {[CaseLower] = 0x0118da,[CaseTitle] = 0x0118ba,[CaseUpper] = 0x0118ba}}, + {0x0118bb, {[CaseLower] = 0x0118db,[CaseTitle] = 0x0118bb,[CaseUpper] = 0x0118bb}}, + {0x0118bc, {[CaseLower] = 0x0118dc,[CaseTitle] = 0x0118bc,[CaseUpper] = 0x0118bc}}, + {0x0118bd, {[CaseLower] = 0x0118dd,[CaseTitle] = 0x0118bd,[CaseUpper] = 0x0118bd}}, + {0x0118be, {[CaseLower] = 0x0118de,[CaseTitle] = 0x0118be,[CaseUpper] = 0x0118be}}, + {0x0118bf, {[CaseLower] = 0x0118df,[CaseTitle] = 0x0118bf,[CaseUpper] = 0x0118bf}}, + {0x0118c0, {[CaseLower] = 0x0118c0,[CaseTitle] = 0x0118a0,[CaseUpper] = 0x0118a0}}, + {0x0118c1, {[CaseLower] = 0x0118c1,[CaseTitle] = 0x0118a1,[CaseUpper] = 0x0118a1}}, + {0x0118c2, {[CaseLower] = 0x0118c2,[CaseTitle] = 0x0118a2,[CaseUpper] = 0x0118a2}}, + {0x0118c3, {[CaseLower] = 0x0118c3,[CaseTitle] = 0x0118a3,[CaseUpper] = 0x0118a3}}, + {0x0118c4, {[CaseLower] = 0x0118c4,[CaseTitle] = 0x0118a4,[CaseUpper] = 0x0118a4}}, + {0x0118c5, {[CaseLower] = 0x0118c5,[CaseTitle] = 0x0118a5,[CaseUpper] = 0x0118a5}}, + {0x0118c6, {[CaseLower] = 0x0118c6,[CaseTitle] = 0x0118a6,[CaseUpper] = 0x0118a6}}, + {0x0118c7, {[CaseLower] = 0x0118c7,[CaseTitle] = 0x0118a7,[CaseUpper] = 0x0118a7}}, + {0x0118c8, {[CaseLower] = 0x0118c8,[CaseTitle] = 0x0118a8,[CaseUpper] = 0x0118a8}}, + {0x0118c9, {[CaseLower] = 0x0118c9,[CaseTitle] = 0x0118a9,[CaseUpper] = 0x0118a9}}, + {0x0118ca, {[CaseLower] = 0x0118ca,[CaseTitle] = 0x0118aa,[CaseUpper] = 0x0118aa}}, + {0x0118cb, {[CaseLower] = 0x0118cb,[CaseTitle] = 0x0118ab,[CaseUpper] = 0x0118ab}}, + {0x0118cc, {[CaseLower] = 0x0118cc,[CaseTitle] = 0x0118ac,[CaseUpper] = 0x0118ac}}, + {0x0118cd, {[CaseLower] = 0x0118cd,[CaseTitle] = 0x0118ad,[CaseUpper] = 0x0118ad}}, + {0x0118ce, {[CaseLower] = 0x0118ce,[CaseTitle] = 0x0118ae,[CaseUpper] = 0x0118ae}}, + {0x0118cf, {[CaseLower] = 0x0118cf,[CaseTitle] = 0x0118af,[CaseUpper] = 0x0118af}}, + {0x0118d0, {[CaseLower] = 0x0118d0,[CaseTitle] = 0x0118b0,[CaseUpper] = 0x0118b0}}, + {0x0118d1, {[CaseLower] = 0x0118d1,[CaseTitle] = 0x0118b1,[CaseUpper] = 0x0118b1}}, + {0x0118d2, {[CaseLower] = 0x0118d2,[CaseTitle] = 0x0118b2,[CaseUpper] = 0x0118b2}}, + {0x0118d3, {[CaseLower] = 0x0118d3,[CaseTitle] = 0x0118b3,[CaseUpper] = 0x0118b3}}, + {0x0118d4, {[CaseLower] = 0x0118d4,[CaseTitle] = 0x0118b4,[CaseUpper] = 0x0118b4}}, + {0x0118d5, {[CaseLower] = 0x0118d5,[CaseTitle] = 0x0118b5,[CaseUpper] = 0x0118b5}}, + {0x0118d6, {[CaseLower] = 0x0118d6,[CaseTitle] = 0x0118b6,[CaseUpper] = 0x0118b6}}, + {0x0118d7, {[CaseLower] = 0x0118d7,[CaseTitle] = 0x0118b7,[CaseUpper] = 0x0118b7}}, + {0x0118d8, {[CaseLower] = 0x0118d8,[CaseTitle] = 0x0118b8,[CaseUpper] = 0x0118b8}}, + {0x0118d9, {[CaseLower] = 0x0118d9,[CaseTitle] = 0x0118b9,[CaseUpper] = 0x0118b9}}, + {0x0118da, {[CaseLower] = 0x0118da,[CaseTitle] = 0x0118ba,[CaseUpper] = 0x0118ba}}, + {0x0118db, {[CaseLower] = 0x0118db,[CaseTitle] = 0x0118bb,[CaseUpper] = 0x0118bb}}, + {0x0118dc, {[CaseLower] = 0x0118dc,[CaseTitle] = 0x0118bc,[CaseUpper] = 0x0118bc}}, + {0x0118dd, {[CaseLower] = 0x0118dd,[CaseTitle] = 0x0118bd,[CaseUpper] = 0x0118bd}}, + {0x0118de, {[CaseLower] = 0x0118de,[CaseTitle] = 0x0118be,[CaseUpper] = 0x0118be}}, + {0x0118df, {[CaseLower] = 0x0118df,[CaseTitle] = 0x0118bf,[CaseUpper] = 0x0118bf}}, + {0x016e40, {[CaseLower] = 0x016e60,[CaseTitle] = 0x016e40,[CaseUpper] = 0x016e40}}, + {0x016e41, {[CaseLower] = 0x016e61,[CaseTitle] = 0x016e41,[CaseUpper] = 0x016e41}}, + {0x016e42, {[CaseLower] = 0x016e62,[CaseTitle] = 0x016e42,[CaseUpper] = 0x016e42}}, + {0x016e43, {[CaseLower] = 0x016e63,[CaseTitle] = 0x016e43,[CaseUpper] = 0x016e43}}, + {0x016e44, {[CaseLower] = 0x016e64,[CaseTitle] = 0x016e44,[CaseUpper] = 0x016e44}}, + {0x016e45, {[CaseLower] = 0x016e65,[CaseTitle] = 0x016e45,[CaseUpper] = 0x016e45}}, + {0x016e46, {[CaseLower] = 0x016e66,[CaseTitle] = 0x016e46,[CaseUpper] = 0x016e46}}, + {0x016e47, {[CaseLower] = 0x016e67,[CaseTitle] = 0x016e47,[CaseUpper] = 0x016e47}}, + {0x016e48, {[CaseLower] = 0x016e68,[CaseTitle] = 0x016e48,[CaseUpper] = 0x016e48}}, + {0x016e49, {[CaseLower] = 0x016e69,[CaseTitle] = 0x016e49,[CaseUpper] = 0x016e49}}, + {0x016e4a, {[CaseLower] = 0x016e6a,[CaseTitle] = 0x016e4a,[CaseUpper] = 0x016e4a}}, + {0x016e4b, {[CaseLower] = 0x016e6b,[CaseTitle] = 0x016e4b,[CaseUpper] = 0x016e4b}}, + {0x016e4c, {[CaseLower] = 0x016e6c,[CaseTitle] = 0x016e4c,[CaseUpper] = 0x016e4c}}, + {0x016e4d, {[CaseLower] = 0x016e6d,[CaseTitle] = 0x016e4d,[CaseUpper] = 0x016e4d}}, + {0x016e4e, {[CaseLower] = 0x016e6e,[CaseTitle] = 0x016e4e,[CaseUpper] = 0x016e4e}}, + {0x016e4f, {[CaseLower] = 0x016e6f,[CaseTitle] = 0x016e4f,[CaseUpper] = 0x016e4f}}, + {0x016e50, {[CaseLower] = 0x016e70,[CaseTitle] = 0x016e50,[CaseUpper] = 0x016e50}}, + {0x016e51, {[CaseLower] = 0x016e71,[CaseTitle] = 0x016e51,[CaseUpper] = 0x016e51}}, + {0x016e52, {[CaseLower] = 0x016e72,[CaseTitle] = 0x016e52,[CaseUpper] = 0x016e52}}, + {0x016e53, {[CaseLower] = 0x016e73,[CaseTitle] = 0x016e53,[CaseUpper] = 0x016e53}}, + {0x016e54, {[CaseLower] = 0x016e74,[CaseTitle] = 0x016e54,[CaseUpper] = 0x016e54}}, + {0x016e55, {[CaseLower] = 0x016e75,[CaseTitle] = 0x016e55,[CaseUpper] = 0x016e55}}, + {0x016e56, {[CaseLower] = 0x016e76,[CaseTitle] = 0x016e56,[CaseUpper] = 0x016e56}}, + {0x016e57, {[CaseLower] = 0x016e77,[CaseTitle] = 0x016e57,[CaseUpper] = 0x016e57}}, + {0x016e58, {[CaseLower] = 0x016e78,[CaseTitle] = 0x016e58,[CaseUpper] = 0x016e58}}, + {0x016e59, {[CaseLower] = 0x016e79,[CaseTitle] = 0x016e59,[CaseUpper] = 0x016e59}}, + {0x016e5a, {[CaseLower] = 0x016e7a,[CaseTitle] = 0x016e5a,[CaseUpper] = 0x016e5a}}, + {0x016e5b, {[CaseLower] = 0x016e7b,[CaseTitle] = 0x016e5b,[CaseUpper] = 0x016e5b}}, + {0x016e5c, {[CaseLower] = 0x016e7c,[CaseTitle] = 0x016e5c,[CaseUpper] = 0x016e5c}}, + {0x016e5d, {[CaseLower] = 0x016e7d,[CaseTitle] = 0x016e5d,[CaseUpper] = 0x016e5d}}, + {0x016e5e, {[CaseLower] = 0x016e7e,[CaseTitle] = 0x016e5e,[CaseUpper] = 0x016e5e}}, + {0x016e5f, {[CaseLower] = 0x016e7f,[CaseTitle] = 0x016e5f,[CaseUpper] = 0x016e5f}}, + {0x016e60, {[CaseLower] = 0x016e60,[CaseTitle] = 0x016e40,[CaseUpper] = 0x016e40}}, + {0x016e61, {[CaseLower] = 0x016e61,[CaseTitle] = 0x016e41,[CaseUpper] = 0x016e41}}, + {0x016e62, {[CaseLower] = 0x016e62,[CaseTitle] = 0x016e42,[CaseUpper] = 0x016e42}}, + {0x016e63, {[CaseLower] = 0x016e63,[CaseTitle] = 0x016e43,[CaseUpper] = 0x016e43}}, + {0x016e64, {[CaseLower] = 0x016e64,[CaseTitle] = 0x016e44,[CaseUpper] = 0x016e44}}, + {0x016e65, {[CaseLower] = 0x016e65,[CaseTitle] = 0x016e45,[CaseUpper] = 0x016e45}}, + {0x016e66, {[CaseLower] = 0x016e66,[CaseTitle] = 0x016e46,[CaseUpper] = 0x016e46}}, + {0x016e67, {[CaseLower] = 0x016e67,[CaseTitle] = 0x016e47,[CaseUpper] = 0x016e47}}, + {0x016e68, {[CaseLower] = 0x016e68,[CaseTitle] = 0x016e48,[CaseUpper] = 0x016e48}}, + {0x016e69, {[CaseLower] = 0x016e69,[CaseTitle] = 0x016e49,[CaseUpper] = 0x016e49}}, + {0x016e6a, {[CaseLower] = 0x016e6a,[CaseTitle] = 0x016e4a,[CaseUpper] = 0x016e4a}}, + {0x016e6b, {[CaseLower] = 0x016e6b,[CaseTitle] = 0x016e4b,[CaseUpper] = 0x016e4b}}, + {0x016e6c, {[CaseLower] = 0x016e6c,[CaseTitle] = 0x016e4c,[CaseUpper] = 0x016e4c}}, + {0x016e6d, {[CaseLower] = 0x016e6d,[CaseTitle] = 0x016e4d,[CaseUpper] = 0x016e4d}}, + {0x016e6e, {[CaseLower] = 0x016e6e,[CaseTitle] = 0x016e4e,[CaseUpper] = 0x016e4e}}, + {0x016e6f, {[CaseLower] = 0x016e6f,[CaseTitle] = 0x016e4f,[CaseUpper] = 0x016e4f}}, + {0x016e70, {[CaseLower] = 0x016e70,[CaseTitle] = 0x016e50,[CaseUpper] = 0x016e50}}, + {0x016e71, {[CaseLower] = 0x016e71,[CaseTitle] = 0x016e51,[CaseUpper] = 0x016e51}}, + {0x016e72, {[CaseLower] = 0x016e72,[CaseTitle] = 0x016e52,[CaseUpper] = 0x016e52}}, + {0x016e73, {[CaseLower] = 0x016e73,[CaseTitle] = 0x016e53,[CaseUpper] = 0x016e53}}, + {0x016e74, {[CaseLower] = 0x016e74,[CaseTitle] = 0x016e54,[CaseUpper] = 0x016e54}}, + {0x016e75, {[CaseLower] = 0x016e75,[CaseTitle] = 0x016e55,[CaseUpper] = 0x016e55}}, + {0x016e76, {[CaseLower] = 0x016e76,[CaseTitle] = 0x016e56,[CaseUpper] = 0x016e56}}, + {0x016e77, {[CaseLower] = 0x016e77,[CaseTitle] = 0x016e57,[CaseUpper] = 0x016e57}}, + {0x016e78, {[CaseLower] = 0x016e78,[CaseTitle] = 0x016e58,[CaseUpper] = 0x016e58}}, + {0x016e79, {[CaseLower] = 0x016e79,[CaseTitle] = 0x016e59,[CaseUpper] = 0x016e59}}, + {0x016e7a, {[CaseLower] = 0x016e7a,[CaseTitle] = 0x016e5a,[CaseUpper] = 0x016e5a}}, + {0x016e7b, {[CaseLower] = 0x016e7b,[CaseTitle] = 0x016e5b,[CaseUpper] = 0x016e5b}}, + {0x016e7c, {[CaseLower] = 0x016e7c,[CaseTitle] = 0x016e5c,[CaseUpper] = 0x016e5c}}, + {0x016e7d, {[CaseLower] = 0x016e7d,[CaseTitle] = 0x016e5d,[CaseUpper] = 0x016e5d}}, + {0x016e7e, {[CaseLower] = 0x016e7e,[CaseTitle] = 0x016e5e,[CaseUpper] = 0x016e5e}}, + {0x016e7f, {[CaseLower] = 0x016e7f,[CaseTitle] = 0x016e5f,[CaseUpper] = 0x016e5f}}, + {0x01e900, {[CaseLower] = 0x01e922,[CaseTitle] = 0x01e900,[CaseUpper] = 0x01e900}}, + {0x01e901, {[CaseLower] = 0x01e923,[CaseTitle] = 0x01e901,[CaseUpper] = 0x01e901}}, + {0x01e902, {[CaseLower] = 0x01e924,[CaseTitle] = 0x01e902,[CaseUpper] = 0x01e902}}, + {0x01e903, {[CaseLower] = 0x01e925,[CaseTitle] = 0x01e903,[CaseUpper] = 0x01e903}}, + {0x01e904, {[CaseLower] = 0x01e926,[CaseTitle] = 0x01e904,[CaseUpper] = 0x01e904}}, + {0x01e905, {[CaseLower] = 0x01e927,[CaseTitle] = 0x01e905,[CaseUpper] = 0x01e905}}, + {0x01e906, {[CaseLower] = 0x01e928,[CaseTitle] = 0x01e906,[CaseUpper] = 0x01e906}}, + {0x01e907, {[CaseLower] = 0x01e929,[CaseTitle] = 0x01e907,[CaseUpper] = 0x01e907}}, + {0x01e908, {[CaseLower] = 0x01e92a,[CaseTitle] = 0x01e908,[CaseUpper] = 0x01e908}}, + {0x01e909, {[CaseLower] = 0x01e92b,[CaseTitle] = 0x01e909,[CaseUpper] = 0x01e909}}, + {0x01e90a, {[CaseLower] = 0x01e92c,[CaseTitle] = 0x01e90a,[CaseUpper] = 0x01e90a}}, + {0x01e90b, {[CaseLower] = 0x01e92d,[CaseTitle] = 0x01e90b,[CaseUpper] = 0x01e90b}}, + {0x01e90c, {[CaseLower] = 0x01e92e,[CaseTitle] = 0x01e90c,[CaseUpper] = 0x01e90c}}, + {0x01e90d, {[CaseLower] = 0x01e92f,[CaseTitle] = 0x01e90d,[CaseUpper] = 0x01e90d}}, + {0x01e90e, {[CaseLower] = 0x01e930,[CaseTitle] = 0x01e90e,[CaseUpper] = 0x01e90e}}, + {0x01e90f, {[CaseLower] = 0x01e931,[CaseTitle] = 0x01e90f,[CaseUpper] = 0x01e90f}}, + {0x01e910, {[CaseLower] = 0x01e932,[CaseTitle] = 0x01e910,[CaseUpper] = 0x01e910}}, + {0x01e911, {[CaseLower] = 0x01e933,[CaseTitle] = 0x01e911,[CaseUpper] = 0x01e911}}, + {0x01e912, {[CaseLower] = 0x01e934,[CaseTitle] = 0x01e912,[CaseUpper] = 0x01e912}}, + {0x01e913, {[CaseLower] = 0x01e935,[CaseTitle] = 0x01e913,[CaseUpper] = 0x01e913}}, + {0x01e914, {[CaseLower] = 0x01e936,[CaseTitle] = 0x01e914,[CaseUpper] = 0x01e914}}, + {0x01e915, {[CaseLower] = 0x01e937,[CaseTitle] = 0x01e915,[CaseUpper] = 0x01e915}}, + {0x01e916, {[CaseLower] = 0x01e938,[CaseTitle] = 0x01e916,[CaseUpper] = 0x01e916}}, + {0x01e917, {[CaseLower] = 0x01e939,[CaseTitle] = 0x01e917,[CaseUpper] = 0x01e917}}, + {0x01e918, {[CaseLower] = 0x01e93a,[CaseTitle] = 0x01e918,[CaseUpper] = 0x01e918}}, + {0x01e919, {[CaseLower] = 0x01e93b,[CaseTitle] = 0x01e919,[CaseUpper] = 0x01e919}}, + {0x01e91a, {[CaseLower] = 0x01e93c,[CaseTitle] = 0x01e91a,[CaseUpper] = 0x01e91a}}, + {0x01e91b, {[CaseLower] = 0x01e93d,[CaseTitle] = 0x01e91b,[CaseUpper] = 0x01e91b}}, + {0x01e91c, {[CaseLower] = 0x01e93e,[CaseTitle] = 0x01e91c,[CaseUpper] = 0x01e91c}}, + {0x01e91d, {[CaseLower] = 0x01e93f,[CaseTitle] = 0x01e91d,[CaseUpper] = 0x01e91d}}, + {0x01e91e, {[CaseLower] = 0x01e940,[CaseTitle] = 0x01e91e,[CaseUpper] = 0x01e91e}}, + {0x01e91f, {[CaseLower] = 0x01e941,[CaseTitle] = 0x01e91f,[CaseUpper] = 0x01e91f}}, + {0x01e920, {[CaseLower] = 0x01e942,[CaseTitle] = 0x01e920,[CaseUpper] = 0x01e920}}, + {0x01e921, {[CaseLower] = 0x01e943,[CaseTitle] = 0x01e921,[CaseUpper] = 0x01e921}}, + {0x01e922, {[CaseLower] = 0x01e922,[CaseTitle] = 0x01e900,[CaseUpper] = 0x01e900}}, + {0x01e923, {[CaseLower] = 0x01e923,[CaseTitle] = 0x01e901,[CaseUpper] = 0x01e901}}, + {0x01e924, {[CaseLower] = 0x01e924,[CaseTitle] = 0x01e902,[CaseUpper] = 0x01e902}}, + {0x01e925, {[CaseLower] = 0x01e925,[CaseTitle] = 0x01e903,[CaseUpper] = 0x01e903}}, + {0x01e926, {[CaseLower] = 0x01e926,[CaseTitle] = 0x01e904,[CaseUpper] = 0x01e904}}, + {0x01e927, {[CaseLower] = 0x01e927,[CaseTitle] = 0x01e905,[CaseUpper] = 0x01e905}}, + {0x01e928, {[CaseLower] = 0x01e928,[CaseTitle] = 0x01e906,[CaseUpper] = 0x01e906}}, + {0x01e929, {[CaseLower] = 0x01e929,[CaseTitle] = 0x01e907,[CaseUpper] = 0x01e907}}, + {0x01e92a, {[CaseLower] = 0x01e92a,[CaseTitle] = 0x01e908,[CaseUpper] = 0x01e908}}, + {0x01e92b, {[CaseLower] = 0x01e92b,[CaseTitle] = 0x01e909,[CaseUpper] = 0x01e909}}, + {0x01e92c, {[CaseLower] = 0x01e92c,[CaseTitle] = 0x01e90a,[CaseUpper] = 0x01e90a}}, + {0x01e92d, {[CaseLower] = 0x01e92d,[CaseTitle] = 0x01e90b,[CaseUpper] = 0x01e90b}}, + {0x01e92e, {[CaseLower] = 0x01e92e,[CaseTitle] = 0x01e90c,[CaseUpper] = 0x01e90c}}, + {0x01e92f, {[CaseLower] = 0x01e92f,[CaseTitle] = 0x01e90d,[CaseUpper] = 0x01e90d}}, + {0x01e930, {[CaseLower] = 0x01e930,[CaseTitle] = 0x01e90e,[CaseUpper] = 0x01e90e}}, + {0x01e931, {[CaseLower] = 0x01e931,[CaseTitle] = 0x01e90f,[CaseUpper] = 0x01e90f}}, + {0x01e932, {[CaseLower] = 0x01e932,[CaseTitle] = 0x01e910,[CaseUpper] = 0x01e910}}, + {0x01e933, {[CaseLower] = 0x01e933,[CaseTitle] = 0x01e911,[CaseUpper] = 0x01e911}}, + {0x01e934, {[CaseLower] = 0x01e934,[CaseTitle] = 0x01e912,[CaseUpper] = 0x01e912}}, + {0x01e935, {[CaseLower] = 0x01e935,[CaseTitle] = 0x01e913,[CaseUpper] = 0x01e913}}, + {0x01e936, {[CaseLower] = 0x01e936,[CaseTitle] = 0x01e914,[CaseUpper] = 0x01e914}}, + {0x01e937, {[CaseLower] = 0x01e937,[CaseTitle] = 0x01e915,[CaseUpper] = 0x01e915}}, + {0x01e938, {[CaseLower] = 0x01e938,[CaseTitle] = 0x01e916,[CaseUpper] = 0x01e916}}, + {0x01e939, {[CaseLower] = 0x01e939,[CaseTitle] = 0x01e917,[CaseUpper] = 0x01e917}}, + {0x01e93a, {[CaseLower] = 0x01e93a,[CaseTitle] = 0x01e918,[CaseUpper] = 0x01e918}}, + {0x01e93b, {[CaseLower] = 0x01e93b,[CaseTitle] = 0x01e919,[CaseUpper] = 0x01e919}}, + {0x01e93c, {[CaseLower] = 0x01e93c,[CaseTitle] = 0x01e91a,[CaseUpper] = 0x01e91a}}, + {0x01e93d, {[CaseLower] = 0x01e93d,[CaseTitle] = 0x01e91b,[CaseUpper] = 0x01e91b}}, + {0x01e93e, {[CaseLower] = 0x01e93e,[CaseTitle] = 0x01e91c,[CaseUpper] = 0x01e91c}}, + {0x01e93f, {[CaseLower] = 0x01e93f,[CaseTitle] = 0x01e91d,[CaseUpper] = 0x01e91d}}, + {0x01e940, {[CaseLower] = 0x01e940,[CaseTitle] = 0x01e91e,[CaseUpper] = 0x01e91e}}, + {0x01e941, {[CaseLower] = 0x01e941,[CaseTitle] = 0x01e91f,[CaseUpper] = 0x01e91f}}, + {0x01e942, {[CaseLower] = 0x01e942,[CaseTitle] = 0x01e920,[CaseUpper] = 0x01e920}}, + {0x01e943, {[CaseLower] = 0x01e943,[CaseTitle] = 0x01e921,[CaseUpper] = 0x01e921}}, +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_category.h b/platform/dbops/binaries/postgres/include/server/common/unicode_category.h new file mode 100644 index 0000000000000000000000000000000000000000..a68f9eb8c89b24b879c5b3a9f93be9779a5fbdf7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_category.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------------------- + * + * unicode_category.h + * Routines for determining the category of Unicode characters. + * + * These definitions can be used by both frontend and backend code. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/unicode_category.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_CATEGORY_H +#define UNICODE_CATEGORY_H + +#include "mb/pg_wchar.h" + +/* + * Unicode General Category Values + * + * See: https://www.unicode.org/reports/tr44/#General_Category_Values + * + * The Unicode stability policy guarantees: "The enumeration of + * General_Category property values is fixed. No new values will be + * added". See: https://www.unicode.org/policies/stability_policy.html + * + * Numeric values chosen to match corresponding ICU UCharCategory. + */ +typedef enum pg_unicode_category +{ + PG_U_UNASSIGNED = 0, /* Cn */ + PG_U_UPPERCASE_LETTER = 1, /* Lu */ + PG_U_LOWERCASE_LETTER = 2, /* Ll */ + PG_U_TITLECASE_LETTER = 3, /* Lt */ + PG_U_MODIFIER_LETTER = 4, /* Lm */ + PG_U_OTHER_LETTER = 5, /* Lo */ + PG_U_NONSPACING_MARK = 6, /* Mn */ + PG_U_ENCLOSING_MARK = 7, /* Me */ + PG_U_SPACING_MARK = 8, /* Mc */ + PG_U_DECIMAL_NUMBER = 9, /* Nd */ + PG_U_LETTER_NUMBER = 10, /* Nl */ + PG_U_OTHER_NUMBER = 11, /* No */ + PG_U_SPACE_SEPARATOR = 12, /* Zs */ + PG_U_LINE_SEPARATOR = 13, /* Zl */ + PG_U_PARAGRAPH_SEPARATOR = 14, /* Zp */ + PG_U_CONTROL = 15, /* Cc */ + PG_U_FORMAT = 16, /* Cf */ + PG_U_PRIVATE_USE = 17, /* Co */ + PG_U_SURROGATE = 18, /* Cs */ + PG_U_DASH_PUNCTUATION = 19, /* Pd */ + PG_U_OPEN_PUNCTUATION = 20, /* Ps */ + PG_U_CLOSE_PUNCTUATION = 21, /* Pe */ + PG_U_CONNECTOR_PUNCTUATION = 22, /* Pc */ + PG_U_OTHER_PUNCTUATION = 23, /* Po */ + PG_U_MATH_SYMBOL = 24, /* Sm */ + PG_U_CURRENCY_SYMBOL = 25, /* Sc */ + PG_U_MODIFIER_SYMBOL = 26, /* Sk */ + PG_U_OTHER_SYMBOL = 27, /* So */ + PG_U_INITIAL_PUNCTUATION = 28, /* Pi */ + PG_U_FINAL_PUNCTUATION = 29 /* Pf */ +} pg_unicode_category; + +extern pg_unicode_category unicode_category(pg_wchar code); +extern const char *unicode_category_string(pg_unicode_category category); +extern const char *unicode_category_abbrev(pg_unicode_category category); + +extern bool pg_u_prop_alphabetic(pg_wchar code); +extern bool pg_u_prop_lowercase(pg_wchar code); +extern bool pg_u_prop_uppercase(pg_wchar code); +extern bool pg_u_prop_cased(pg_wchar code); +extern bool pg_u_prop_case_ignorable(pg_wchar code); +extern bool pg_u_prop_white_space(pg_wchar code); +extern bool pg_u_prop_hex_digit(pg_wchar code); +extern bool pg_u_prop_join_control(pg_wchar code); + +extern bool pg_u_isdigit(pg_wchar code, bool posix); +extern bool pg_u_isalpha(pg_wchar code); +extern bool pg_u_isalnum(pg_wchar code, bool posix); +extern bool pg_u_isword(pg_wchar code); +extern bool pg_u_isupper(pg_wchar code); +extern bool pg_u_islower(pg_wchar code); +extern bool pg_u_isblank(pg_wchar code); +extern bool pg_u_iscntrl(pg_wchar code); +extern bool pg_u_isgraph(pg_wchar code); +extern bool pg_u_isprint(pg_wchar code); +extern bool pg_u_ispunct(pg_wchar code, bool posix); +extern bool pg_u_isspace(pg_wchar code); +extern bool pg_u_isxdigit(pg_wchar code, bool posix); + +#endif /* UNICODE_CATEGORY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_category_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_category_table.h new file mode 100644 index 0000000000000000000000000000000000000000..65ea5141fca9924700838e99177b299296600b25 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_category_table.h @@ -0,0 +1,7025 @@ +/*------------------------------------------------------------------------- + * + * unicode_category_table.h + * Category table for Unicode character classification. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_category_table.h + * + *------------------------------------------------------------------------- + */ + +#include "common/unicode_category.h" + +/* + * File auto-generated by src/common/unicode/generate-unicode_category_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_CATEGORY_TABLE_H + * here. + */ +typedef struct +{ + uint32 first; /* Unicode codepoint */ + uint32 last; /* Unicode codepoint */ + uint8 category; /* General Category */ +} pg_category_range; + +typedef struct +{ + uint32 first; /* Unicode codepoint */ + uint32 last; /* Unicode codepoint */ +} pg_unicode_range; + +typedef struct +{ + uint8 category; + uint8 properties; +} pg_unicode_properties; + +/* + * The properties currently used, in no particular order. Fits in a uint8, but + * if more properties are added, a wider integer will be needed. + */ +#define PG_U_PROP_ALPHABETIC (1 << 0) +#define PG_U_PROP_LOWERCASE (1 << 1) +#define PG_U_PROP_UPPERCASE (1 << 2) +#define PG_U_PROP_CASED (1 << 3) +#define PG_U_PROP_CASE_IGNORABLE (1 << 4) +#define PG_U_PROP_WHITE_SPACE (1 << 5) +#define PG_U_PROP_JOIN_CONTROL (1 << 6) +#define PG_U_PROP_HEX_DIGIT (1 << 7) + +/* table for fast lookup of ASCII codepoints */ +static const pg_unicode_properties unicode_opt_ascii[128] = +{ + { + /* 0x000000 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000001 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000002 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000003 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000004 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000005 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000006 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000007 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000008 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000009 */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000a */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000b */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000c */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000d */ + .category = PG_U_CONTROL, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x00000e */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00000f */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000010 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000011 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000012 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000013 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000014 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000015 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000016 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000017 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000018 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000019 */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001a */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001b */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001c */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001d */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001e */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x00001f */ + .category = PG_U_CONTROL, + .properties = 0 + }, + { + /* 0x000020 */ + .category = PG_U_SPACE_SEPARATOR, + .properties = PG_U_PROP_WHITE_SPACE + }, + { + /* 0x000021 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000022 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000023 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000024 */ + .category = PG_U_CURRENCY_SYMBOL, + .properties = 0 + }, + { + /* 0x000025 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000026 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000027 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x000028 */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000029 */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002a */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002b */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00002c */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002d */ + .category = PG_U_DASH_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00002e */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00002f */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000030 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000031 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000032 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000033 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000034 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000035 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000036 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000037 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000038 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x000039 */ + .category = PG_U_DECIMAL_NUMBER, + .properties = PG_U_PROP_HEX_DIGIT + }, + { + /* 0x00003a */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00003b */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00003c */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003d */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003e */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00003f */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000040 */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000041 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000042 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000043 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000044 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000045 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000046 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000047 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000048 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000049 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004a */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004b */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004c */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004d */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004e */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00004f */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000050 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000051 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000052 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000053 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000054 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000055 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000056 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000057 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000058 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x000059 */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00005a */ + .category = PG_U_UPPERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_UPPERCASE | PG_U_PROP_CASED + }, + { + /* 0x00005b */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005c */ + .category = PG_U_OTHER_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005d */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00005e */ + .category = PG_U_MODIFIER_SYMBOL, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x00005f */ + .category = PG_U_CONNECTOR_PUNCTUATION, + .properties = 0 + }, + { + /* 0x000060 */ + .category = PG_U_MODIFIER_SYMBOL, + .properties = PG_U_PROP_CASE_IGNORABLE + }, + { + /* 0x000061 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000062 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000063 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000064 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000065 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000066 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_HEX_DIGIT | PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000067 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000068 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000069 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006a */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006b */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006c */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006d */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006e */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00006f */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000070 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000071 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000072 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000073 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000074 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000075 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000076 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000077 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000078 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x000079 */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00007a */ + .category = PG_U_LOWERCASE_LETTER, + .properties = PG_U_PROP_ALPHABETIC | PG_U_PROP_LOWERCASE | PG_U_PROP_CASED + }, + { + /* 0x00007b */ + .category = PG_U_OPEN_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00007c */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00007d */ + .category = PG_U_CLOSE_PUNCTUATION, + .properties = 0 + }, + { + /* 0x00007e */ + .category = PG_U_MATH_SYMBOL, + .properties = 0 + }, + { + /* 0x00007f */ + .category = PG_U_CONTROL, + .properties = 0 + }, +}; + +/* table of Unicode codepoint ranges and their categories */ +static const pg_category_range unicode_categories[3302] = +{ + {0x000000, 0x00001f, PG_U_CONTROL}, + {0x000020, 0x000020, PG_U_SPACE_SEPARATOR}, + {0x000021, 0x000023, PG_U_OTHER_PUNCTUATION}, + {0x000024, 0x000024, PG_U_CURRENCY_SYMBOL}, + {0x000025, 0x000027, PG_U_OTHER_PUNCTUATION}, + {0x000028, 0x000028, PG_U_OPEN_PUNCTUATION}, + {0x000029, 0x000029, PG_U_CLOSE_PUNCTUATION}, + {0x00002a, 0x00002a, PG_U_OTHER_PUNCTUATION}, + {0x00002b, 0x00002b, PG_U_MATH_SYMBOL}, + {0x00002c, 0x00002c, PG_U_OTHER_PUNCTUATION}, + {0x00002d, 0x00002d, PG_U_DASH_PUNCTUATION}, + {0x00002e, 0x00002f, PG_U_OTHER_PUNCTUATION}, + {0x000030, 0x000039, PG_U_DECIMAL_NUMBER}, + {0x00003a, 0x00003b, PG_U_OTHER_PUNCTUATION}, + {0x00003c, 0x00003e, PG_U_MATH_SYMBOL}, + {0x00003f, 0x000040, PG_U_OTHER_PUNCTUATION}, + {0x000041, 0x00005a, PG_U_UPPERCASE_LETTER}, + {0x00005b, 0x00005b, PG_U_OPEN_PUNCTUATION}, + {0x00005c, 0x00005c, PG_U_OTHER_PUNCTUATION}, + {0x00005d, 0x00005d, PG_U_CLOSE_PUNCTUATION}, + {0x00005e, 0x00005e, PG_U_MODIFIER_SYMBOL}, + {0x00005f, 0x00005f, PG_U_CONNECTOR_PUNCTUATION}, + {0x000060, 0x000060, PG_U_MODIFIER_SYMBOL}, + {0x000061, 0x00007a, PG_U_LOWERCASE_LETTER}, + {0x00007b, 0x00007b, PG_U_OPEN_PUNCTUATION}, + {0x00007c, 0x00007c, PG_U_MATH_SYMBOL}, + {0x00007d, 0x00007d, PG_U_CLOSE_PUNCTUATION}, + {0x00007e, 0x00007e, PG_U_MATH_SYMBOL}, + {0x00007f, 0x00009f, PG_U_CONTROL}, + {0x0000a0, 0x0000a0, PG_U_SPACE_SEPARATOR}, + {0x0000a1, 0x0000a1, PG_U_OTHER_PUNCTUATION}, + {0x0000a2, 0x0000a5, PG_U_CURRENCY_SYMBOL}, + {0x0000a6, 0x0000a6, PG_U_OTHER_SYMBOL}, + {0x0000a7, 0x0000a7, PG_U_OTHER_PUNCTUATION}, + {0x0000a8, 0x0000a8, PG_U_MODIFIER_SYMBOL}, + {0x0000a9, 0x0000a9, PG_U_OTHER_SYMBOL}, + {0x0000aa, 0x0000aa, PG_U_OTHER_LETTER}, + {0x0000ab, 0x0000ab, PG_U_INITIAL_PUNCTUATION}, + {0x0000ac, 0x0000ac, PG_U_MATH_SYMBOL}, + {0x0000ad, 0x0000ad, PG_U_FORMAT}, + {0x0000ae, 0x0000ae, PG_U_OTHER_SYMBOL}, + {0x0000af, 0x0000af, PG_U_MODIFIER_SYMBOL}, + {0x0000b0, 0x0000b0, PG_U_OTHER_SYMBOL}, + {0x0000b1, 0x0000b1, PG_U_MATH_SYMBOL}, + {0x0000b2, 0x0000b3, PG_U_OTHER_NUMBER}, + {0x0000b4, 0x0000b4, PG_U_MODIFIER_SYMBOL}, + {0x0000b5, 0x0000b5, PG_U_LOWERCASE_LETTER}, + {0x0000b6, 0x0000b7, PG_U_OTHER_PUNCTUATION}, + {0x0000b8, 0x0000b8, PG_U_MODIFIER_SYMBOL}, + {0x0000b9, 0x0000b9, PG_U_OTHER_NUMBER}, + {0x0000ba, 0x0000ba, PG_U_OTHER_LETTER}, + {0x0000bb, 0x0000bb, PG_U_FINAL_PUNCTUATION}, + {0x0000bc, 0x0000be, PG_U_OTHER_NUMBER}, + {0x0000bf, 0x0000bf, PG_U_OTHER_PUNCTUATION}, + {0x0000c0, 0x0000d6, PG_U_UPPERCASE_LETTER}, + {0x0000d7, 0x0000d7, PG_U_MATH_SYMBOL}, + {0x0000d8, 0x0000de, PG_U_UPPERCASE_LETTER}, + {0x0000df, 0x0000f6, PG_U_LOWERCASE_LETTER}, + {0x0000f7, 0x0000f7, PG_U_MATH_SYMBOL}, + {0x0000f8, 0x0000ff, PG_U_LOWERCASE_LETTER}, + {0x000100, 0x000100, PG_U_UPPERCASE_LETTER}, + {0x000101, 0x000101, PG_U_LOWERCASE_LETTER}, + {0x000102, 0x000102, PG_U_UPPERCASE_LETTER}, + {0x000103, 0x000103, PG_U_LOWERCASE_LETTER}, + {0x000104, 0x000104, PG_U_UPPERCASE_LETTER}, + {0x000105, 0x000105, PG_U_LOWERCASE_LETTER}, + {0x000106, 0x000106, PG_U_UPPERCASE_LETTER}, + {0x000107, 0x000107, PG_U_LOWERCASE_LETTER}, + {0x000108, 0x000108, PG_U_UPPERCASE_LETTER}, + {0x000109, 0x000109, PG_U_LOWERCASE_LETTER}, + {0x00010a, 0x00010a, PG_U_UPPERCASE_LETTER}, + {0x00010b, 0x00010b, PG_U_LOWERCASE_LETTER}, + {0x00010c, 0x00010c, PG_U_UPPERCASE_LETTER}, + {0x00010d, 0x00010d, PG_U_LOWERCASE_LETTER}, + {0x00010e, 0x00010e, PG_U_UPPERCASE_LETTER}, + {0x00010f, 0x00010f, PG_U_LOWERCASE_LETTER}, + {0x000110, 0x000110, PG_U_UPPERCASE_LETTER}, + {0x000111, 0x000111, PG_U_LOWERCASE_LETTER}, + {0x000112, 0x000112, PG_U_UPPERCASE_LETTER}, + {0x000113, 0x000113, PG_U_LOWERCASE_LETTER}, + {0x000114, 0x000114, PG_U_UPPERCASE_LETTER}, + {0x000115, 0x000115, PG_U_LOWERCASE_LETTER}, + {0x000116, 0x000116, PG_U_UPPERCASE_LETTER}, + {0x000117, 0x000117, PG_U_LOWERCASE_LETTER}, + {0x000118, 0x000118, PG_U_UPPERCASE_LETTER}, + {0x000119, 0x000119, PG_U_LOWERCASE_LETTER}, + {0x00011a, 0x00011a, PG_U_UPPERCASE_LETTER}, + {0x00011b, 0x00011b, PG_U_LOWERCASE_LETTER}, + {0x00011c, 0x00011c, PG_U_UPPERCASE_LETTER}, + {0x00011d, 0x00011d, PG_U_LOWERCASE_LETTER}, + {0x00011e, 0x00011e, PG_U_UPPERCASE_LETTER}, + {0x00011f, 0x00011f, PG_U_LOWERCASE_LETTER}, + {0x000120, 0x000120, PG_U_UPPERCASE_LETTER}, + {0x000121, 0x000121, PG_U_LOWERCASE_LETTER}, + {0x000122, 0x000122, PG_U_UPPERCASE_LETTER}, + {0x000123, 0x000123, PG_U_LOWERCASE_LETTER}, + {0x000124, 0x000124, PG_U_UPPERCASE_LETTER}, + {0x000125, 0x000125, PG_U_LOWERCASE_LETTER}, + {0x000126, 0x000126, PG_U_UPPERCASE_LETTER}, + {0x000127, 0x000127, PG_U_LOWERCASE_LETTER}, + {0x000128, 0x000128, PG_U_UPPERCASE_LETTER}, + {0x000129, 0x000129, PG_U_LOWERCASE_LETTER}, + {0x00012a, 0x00012a, PG_U_UPPERCASE_LETTER}, + {0x00012b, 0x00012b, PG_U_LOWERCASE_LETTER}, + {0x00012c, 0x00012c, PG_U_UPPERCASE_LETTER}, + {0x00012d, 0x00012d, PG_U_LOWERCASE_LETTER}, + {0x00012e, 0x00012e, PG_U_UPPERCASE_LETTER}, + {0x00012f, 0x00012f, PG_U_LOWERCASE_LETTER}, + {0x000130, 0x000130, PG_U_UPPERCASE_LETTER}, + {0x000131, 0x000131, PG_U_LOWERCASE_LETTER}, + {0x000132, 0x000132, PG_U_UPPERCASE_LETTER}, + {0x000133, 0x000133, PG_U_LOWERCASE_LETTER}, + {0x000134, 0x000134, PG_U_UPPERCASE_LETTER}, + {0x000135, 0x000135, PG_U_LOWERCASE_LETTER}, + {0x000136, 0x000136, PG_U_UPPERCASE_LETTER}, + {0x000137, 0x000138, PG_U_LOWERCASE_LETTER}, + {0x000139, 0x000139, PG_U_UPPERCASE_LETTER}, + {0x00013a, 0x00013a, PG_U_LOWERCASE_LETTER}, + {0x00013b, 0x00013b, PG_U_UPPERCASE_LETTER}, + {0x00013c, 0x00013c, PG_U_LOWERCASE_LETTER}, + {0x00013d, 0x00013d, PG_U_UPPERCASE_LETTER}, + {0x00013e, 0x00013e, PG_U_LOWERCASE_LETTER}, + {0x00013f, 0x00013f, PG_U_UPPERCASE_LETTER}, + {0x000140, 0x000140, PG_U_LOWERCASE_LETTER}, + {0x000141, 0x000141, PG_U_UPPERCASE_LETTER}, + {0x000142, 0x000142, PG_U_LOWERCASE_LETTER}, + {0x000143, 0x000143, PG_U_UPPERCASE_LETTER}, + {0x000144, 0x000144, PG_U_LOWERCASE_LETTER}, + {0x000145, 0x000145, PG_U_UPPERCASE_LETTER}, + {0x000146, 0x000146, PG_U_LOWERCASE_LETTER}, + {0x000147, 0x000147, PG_U_UPPERCASE_LETTER}, + {0x000148, 0x000149, PG_U_LOWERCASE_LETTER}, + {0x00014a, 0x00014a, PG_U_UPPERCASE_LETTER}, + {0x00014b, 0x00014b, PG_U_LOWERCASE_LETTER}, + {0x00014c, 0x00014c, PG_U_UPPERCASE_LETTER}, + {0x00014d, 0x00014d, PG_U_LOWERCASE_LETTER}, + {0x00014e, 0x00014e, PG_U_UPPERCASE_LETTER}, + {0x00014f, 0x00014f, PG_U_LOWERCASE_LETTER}, + {0x000150, 0x000150, PG_U_UPPERCASE_LETTER}, + {0x000151, 0x000151, PG_U_LOWERCASE_LETTER}, + {0x000152, 0x000152, PG_U_UPPERCASE_LETTER}, + {0x000153, 0x000153, PG_U_LOWERCASE_LETTER}, + {0x000154, 0x000154, PG_U_UPPERCASE_LETTER}, + {0x000155, 0x000155, PG_U_LOWERCASE_LETTER}, + {0x000156, 0x000156, PG_U_UPPERCASE_LETTER}, + {0x000157, 0x000157, PG_U_LOWERCASE_LETTER}, + {0x000158, 0x000158, PG_U_UPPERCASE_LETTER}, + {0x000159, 0x000159, PG_U_LOWERCASE_LETTER}, + {0x00015a, 0x00015a, PG_U_UPPERCASE_LETTER}, + {0x00015b, 0x00015b, PG_U_LOWERCASE_LETTER}, + {0x00015c, 0x00015c, PG_U_UPPERCASE_LETTER}, + {0x00015d, 0x00015d, PG_U_LOWERCASE_LETTER}, + {0x00015e, 0x00015e, PG_U_UPPERCASE_LETTER}, + {0x00015f, 0x00015f, PG_U_LOWERCASE_LETTER}, + {0x000160, 0x000160, PG_U_UPPERCASE_LETTER}, + {0x000161, 0x000161, PG_U_LOWERCASE_LETTER}, + {0x000162, 0x000162, PG_U_UPPERCASE_LETTER}, + {0x000163, 0x000163, PG_U_LOWERCASE_LETTER}, + {0x000164, 0x000164, PG_U_UPPERCASE_LETTER}, + {0x000165, 0x000165, PG_U_LOWERCASE_LETTER}, + {0x000166, 0x000166, PG_U_UPPERCASE_LETTER}, + {0x000167, 0x000167, PG_U_LOWERCASE_LETTER}, + {0x000168, 0x000168, PG_U_UPPERCASE_LETTER}, + {0x000169, 0x000169, PG_U_LOWERCASE_LETTER}, + {0x00016a, 0x00016a, PG_U_UPPERCASE_LETTER}, + {0x00016b, 0x00016b, PG_U_LOWERCASE_LETTER}, + {0x00016c, 0x00016c, PG_U_UPPERCASE_LETTER}, + {0x00016d, 0x00016d, PG_U_LOWERCASE_LETTER}, + {0x00016e, 0x00016e, PG_U_UPPERCASE_LETTER}, + {0x00016f, 0x00016f, PG_U_LOWERCASE_LETTER}, + {0x000170, 0x000170, PG_U_UPPERCASE_LETTER}, + {0x000171, 0x000171, PG_U_LOWERCASE_LETTER}, + {0x000172, 0x000172, PG_U_UPPERCASE_LETTER}, + {0x000173, 0x000173, PG_U_LOWERCASE_LETTER}, + {0x000174, 0x000174, PG_U_UPPERCASE_LETTER}, + {0x000175, 0x000175, PG_U_LOWERCASE_LETTER}, + {0x000176, 0x000176, PG_U_UPPERCASE_LETTER}, + {0x000177, 0x000177, PG_U_LOWERCASE_LETTER}, + {0x000178, 0x000179, PG_U_UPPERCASE_LETTER}, + {0x00017a, 0x00017a, PG_U_LOWERCASE_LETTER}, + {0x00017b, 0x00017b, PG_U_UPPERCASE_LETTER}, + {0x00017c, 0x00017c, PG_U_LOWERCASE_LETTER}, + {0x00017d, 0x00017d, PG_U_UPPERCASE_LETTER}, + {0x00017e, 0x000180, PG_U_LOWERCASE_LETTER}, + {0x000181, 0x000182, PG_U_UPPERCASE_LETTER}, + {0x000183, 0x000183, PG_U_LOWERCASE_LETTER}, + {0x000184, 0x000184, PG_U_UPPERCASE_LETTER}, + {0x000185, 0x000185, PG_U_LOWERCASE_LETTER}, + {0x000186, 0x000187, PG_U_UPPERCASE_LETTER}, + {0x000188, 0x000188, PG_U_LOWERCASE_LETTER}, + {0x000189, 0x00018b, PG_U_UPPERCASE_LETTER}, + {0x00018c, 0x00018d, PG_U_LOWERCASE_LETTER}, + {0x00018e, 0x000191, PG_U_UPPERCASE_LETTER}, + {0x000192, 0x000192, PG_U_LOWERCASE_LETTER}, + {0x000193, 0x000194, PG_U_UPPERCASE_LETTER}, + {0x000195, 0x000195, PG_U_LOWERCASE_LETTER}, + {0x000196, 0x000198, PG_U_UPPERCASE_LETTER}, + {0x000199, 0x00019b, PG_U_LOWERCASE_LETTER}, + {0x00019c, 0x00019d, PG_U_UPPERCASE_LETTER}, + {0x00019e, 0x00019e, PG_U_LOWERCASE_LETTER}, + {0x00019f, 0x0001a0, PG_U_UPPERCASE_LETTER}, + {0x0001a1, 0x0001a1, PG_U_LOWERCASE_LETTER}, + {0x0001a2, 0x0001a2, PG_U_UPPERCASE_LETTER}, + {0x0001a3, 0x0001a3, PG_U_LOWERCASE_LETTER}, + {0x0001a4, 0x0001a4, PG_U_UPPERCASE_LETTER}, + {0x0001a5, 0x0001a5, PG_U_LOWERCASE_LETTER}, + {0x0001a6, 0x0001a7, PG_U_UPPERCASE_LETTER}, + {0x0001a8, 0x0001a8, PG_U_LOWERCASE_LETTER}, + {0x0001a9, 0x0001a9, PG_U_UPPERCASE_LETTER}, + {0x0001aa, 0x0001ab, PG_U_LOWERCASE_LETTER}, + {0x0001ac, 0x0001ac, PG_U_UPPERCASE_LETTER}, + {0x0001ad, 0x0001ad, PG_U_LOWERCASE_LETTER}, + {0x0001ae, 0x0001af, PG_U_UPPERCASE_LETTER}, + {0x0001b0, 0x0001b0, PG_U_LOWERCASE_LETTER}, + {0x0001b1, 0x0001b3, PG_U_UPPERCASE_LETTER}, + {0x0001b4, 0x0001b4, PG_U_LOWERCASE_LETTER}, + {0x0001b5, 0x0001b5, PG_U_UPPERCASE_LETTER}, + {0x0001b6, 0x0001b6, PG_U_LOWERCASE_LETTER}, + {0x0001b7, 0x0001b8, PG_U_UPPERCASE_LETTER}, + {0x0001b9, 0x0001ba, PG_U_LOWERCASE_LETTER}, + {0x0001bb, 0x0001bb, PG_U_OTHER_LETTER}, + {0x0001bc, 0x0001bc, PG_U_UPPERCASE_LETTER}, + {0x0001bd, 0x0001bf, PG_U_LOWERCASE_LETTER}, + {0x0001c0, 0x0001c3, PG_U_OTHER_LETTER}, + {0x0001c4, 0x0001c4, PG_U_UPPERCASE_LETTER}, + {0x0001c5, 0x0001c5, PG_U_TITLECASE_LETTER}, + {0x0001c6, 0x0001c6, PG_U_LOWERCASE_LETTER}, + {0x0001c7, 0x0001c7, PG_U_UPPERCASE_LETTER}, + {0x0001c8, 0x0001c8, PG_U_TITLECASE_LETTER}, + {0x0001c9, 0x0001c9, PG_U_LOWERCASE_LETTER}, + {0x0001ca, 0x0001ca, PG_U_UPPERCASE_LETTER}, + {0x0001cb, 0x0001cb, PG_U_TITLECASE_LETTER}, + {0x0001cc, 0x0001cc, PG_U_LOWERCASE_LETTER}, + {0x0001cd, 0x0001cd, PG_U_UPPERCASE_LETTER}, + {0x0001ce, 0x0001ce, PG_U_LOWERCASE_LETTER}, + {0x0001cf, 0x0001cf, PG_U_UPPERCASE_LETTER}, + {0x0001d0, 0x0001d0, PG_U_LOWERCASE_LETTER}, + {0x0001d1, 0x0001d1, PG_U_UPPERCASE_LETTER}, + {0x0001d2, 0x0001d2, PG_U_LOWERCASE_LETTER}, + {0x0001d3, 0x0001d3, PG_U_UPPERCASE_LETTER}, + {0x0001d4, 0x0001d4, PG_U_LOWERCASE_LETTER}, + {0x0001d5, 0x0001d5, PG_U_UPPERCASE_LETTER}, + {0x0001d6, 0x0001d6, PG_U_LOWERCASE_LETTER}, + {0x0001d7, 0x0001d7, PG_U_UPPERCASE_LETTER}, + {0x0001d8, 0x0001d8, PG_U_LOWERCASE_LETTER}, + {0x0001d9, 0x0001d9, PG_U_UPPERCASE_LETTER}, + {0x0001da, 0x0001da, PG_U_LOWERCASE_LETTER}, + {0x0001db, 0x0001db, PG_U_UPPERCASE_LETTER}, + {0x0001dc, 0x0001dd, PG_U_LOWERCASE_LETTER}, + {0x0001de, 0x0001de, PG_U_UPPERCASE_LETTER}, + {0x0001df, 0x0001df, PG_U_LOWERCASE_LETTER}, + {0x0001e0, 0x0001e0, PG_U_UPPERCASE_LETTER}, + {0x0001e1, 0x0001e1, PG_U_LOWERCASE_LETTER}, + {0x0001e2, 0x0001e2, PG_U_UPPERCASE_LETTER}, + {0x0001e3, 0x0001e3, PG_U_LOWERCASE_LETTER}, + {0x0001e4, 0x0001e4, PG_U_UPPERCASE_LETTER}, + {0x0001e5, 0x0001e5, PG_U_LOWERCASE_LETTER}, + {0x0001e6, 0x0001e6, PG_U_UPPERCASE_LETTER}, + {0x0001e7, 0x0001e7, PG_U_LOWERCASE_LETTER}, + {0x0001e8, 0x0001e8, PG_U_UPPERCASE_LETTER}, + {0x0001e9, 0x0001e9, PG_U_LOWERCASE_LETTER}, + {0x0001ea, 0x0001ea, PG_U_UPPERCASE_LETTER}, + {0x0001eb, 0x0001eb, PG_U_LOWERCASE_LETTER}, + {0x0001ec, 0x0001ec, PG_U_UPPERCASE_LETTER}, + {0x0001ed, 0x0001ed, PG_U_LOWERCASE_LETTER}, + {0x0001ee, 0x0001ee, PG_U_UPPERCASE_LETTER}, + {0x0001ef, 0x0001f0, PG_U_LOWERCASE_LETTER}, + {0x0001f1, 0x0001f1, PG_U_UPPERCASE_LETTER}, + {0x0001f2, 0x0001f2, PG_U_TITLECASE_LETTER}, + {0x0001f3, 0x0001f3, PG_U_LOWERCASE_LETTER}, + {0x0001f4, 0x0001f4, PG_U_UPPERCASE_LETTER}, + {0x0001f5, 0x0001f5, PG_U_LOWERCASE_LETTER}, + {0x0001f6, 0x0001f8, PG_U_UPPERCASE_LETTER}, + {0x0001f9, 0x0001f9, PG_U_LOWERCASE_LETTER}, + {0x0001fa, 0x0001fa, PG_U_UPPERCASE_LETTER}, + {0x0001fb, 0x0001fb, PG_U_LOWERCASE_LETTER}, + {0x0001fc, 0x0001fc, PG_U_UPPERCASE_LETTER}, + {0x0001fd, 0x0001fd, PG_U_LOWERCASE_LETTER}, + {0x0001fe, 0x0001fe, PG_U_UPPERCASE_LETTER}, + {0x0001ff, 0x0001ff, PG_U_LOWERCASE_LETTER}, + {0x000200, 0x000200, PG_U_UPPERCASE_LETTER}, + {0x000201, 0x000201, PG_U_LOWERCASE_LETTER}, + {0x000202, 0x000202, PG_U_UPPERCASE_LETTER}, + {0x000203, 0x000203, PG_U_LOWERCASE_LETTER}, + {0x000204, 0x000204, PG_U_UPPERCASE_LETTER}, + {0x000205, 0x000205, PG_U_LOWERCASE_LETTER}, + {0x000206, 0x000206, PG_U_UPPERCASE_LETTER}, + {0x000207, 0x000207, PG_U_LOWERCASE_LETTER}, + {0x000208, 0x000208, PG_U_UPPERCASE_LETTER}, + {0x000209, 0x000209, PG_U_LOWERCASE_LETTER}, + {0x00020a, 0x00020a, PG_U_UPPERCASE_LETTER}, + {0x00020b, 0x00020b, PG_U_LOWERCASE_LETTER}, + {0x00020c, 0x00020c, PG_U_UPPERCASE_LETTER}, + {0x00020d, 0x00020d, PG_U_LOWERCASE_LETTER}, + {0x00020e, 0x00020e, PG_U_UPPERCASE_LETTER}, + {0x00020f, 0x00020f, PG_U_LOWERCASE_LETTER}, + {0x000210, 0x000210, PG_U_UPPERCASE_LETTER}, + {0x000211, 0x000211, PG_U_LOWERCASE_LETTER}, + {0x000212, 0x000212, PG_U_UPPERCASE_LETTER}, + {0x000213, 0x000213, PG_U_LOWERCASE_LETTER}, + {0x000214, 0x000214, PG_U_UPPERCASE_LETTER}, + {0x000215, 0x000215, PG_U_LOWERCASE_LETTER}, + {0x000216, 0x000216, PG_U_UPPERCASE_LETTER}, + {0x000217, 0x000217, PG_U_LOWERCASE_LETTER}, + {0x000218, 0x000218, PG_U_UPPERCASE_LETTER}, + {0x000219, 0x000219, PG_U_LOWERCASE_LETTER}, + {0x00021a, 0x00021a, PG_U_UPPERCASE_LETTER}, + {0x00021b, 0x00021b, PG_U_LOWERCASE_LETTER}, + {0x00021c, 0x00021c, PG_U_UPPERCASE_LETTER}, + {0x00021d, 0x00021d, PG_U_LOWERCASE_LETTER}, + {0x00021e, 0x00021e, PG_U_UPPERCASE_LETTER}, + {0x00021f, 0x00021f, PG_U_LOWERCASE_LETTER}, + {0x000220, 0x000220, PG_U_UPPERCASE_LETTER}, + {0x000221, 0x000221, PG_U_LOWERCASE_LETTER}, + {0x000222, 0x000222, PG_U_UPPERCASE_LETTER}, + {0x000223, 0x000223, PG_U_LOWERCASE_LETTER}, + {0x000224, 0x000224, PG_U_UPPERCASE_LETTER}, + {0x000225, 0x000225, PG_U_LOWERCASE_LETTER}, + {0x000226, 0x000226, PG_U_UPPERCASE_LETTER}, + {0x000227, 0x000227, PG_U_LOWERCASE_LETTER}, + {0x000228, 0x000228, PG_U_UPPERCASE_LETTER}, + {0x000229, 0x000229, PG_U_LOWERCASE_LETTER}, + {0x00022a, 0x00022a, PG_U_UPPERCASE_LETTER}, + {0x00022b, 0x00022b, PG_U_LOWERCASE_LETTER}, + {0x00022c, 0x00022c, PG_U_UPPERCASE_LETTER}, + {0x00022d, 0x00022d, PG_U_LOWERCASE_LETTER}, + {0x00022e, 0x00022e, PG_U_UPPERCASE_LETTER}, + {0x00022f, 0x00022f, PG_U_LOWERCASE_LETTER}, + {0x000230, 0x000230, PG_U_UPPERCASE_LETTER}, + {0x000231, 0x000231, PG_U_LOWERCASE_LETTER}, + {0x000232, 0x000232, PG_U_UPPERCASE_LETTER}, + {0x000233, 0x000239, PG_U_LOWERCASE_LETTER}, + {0x00023a, 0x00023b, PG_U_UPPERCASE_LETTER}, + {0x00023c, 0x00023c, PG_U_LOWERCASE_LETTER}, + {0x00023d, 0x00023e, PG_U_UPPERCASE_LETTER}, + {0x00023f, 0x000240, PG_U_LOWERCASE_LETTER}, + {0x000241, 0x000241, PG_U_UPPERCASE_LETTER}, + {0x000242, 0x000242, PG_U_LOWERCASE_LETTER}, + {0x000243, 0x000246, PG_U_UPPERCASE_LETTER}, + {0x000247, 0x000247, PG_U_LOWERCASE_LETTER}, + {0x000248, 0x000248, PG_U_UPPERCASE_LETTER}, + {0x000249, 0x000249, PG_U_LOWERCASE_LETTER}, + {0x00024a, 0x00024a, PG_U_UPPERCASE_LETTER}, + {0x00024b, 0x00024b, PG_U_LOWERCASE_LETTER}, + {0x00024c, 0x00024c, PG_U_UPPERCASE_LETTER}, + {0x00024d, 0x00024d, PG_U_LOWERCASE_LETTER}, + {0x00024e, 0x00024e, PG_U_UPPERCASE_LETTER}, + {0x00024f, 0x000293, PG_U_LOWERCASE_LETTER}, + {0x000294, 0x000294, PG_U_OTHER_LETTER}, + {0x000295, 0x0002af, PG_U_LOWERCASE_LETTER}, + {0x0002b0, 0x0002c1, PG_U_MODIFIER_LETTER}, + {0x0002c2, 0x0002c5, PG_U_MODIFIER_SYMBOL}, + {0x0002c6, 0x0002d1, PG_U_MODIFIER_LETTER}, + {0x0002d2, 0x0002df, PG_U_MODIFIER_SYMBOL}, + {0x0002e0, 0x0002e4, PG_U_MODIFIER_LETTER}, + {0x0002e5, 0x0002eb, PG_U_MODIFIER_SYMBOL}, + {0x0002ec, 0x0002ec, PG_U_MODIFIER_LETTER}, + {0x0002ed, 0x0002ed, PG_U_MODIFIER_SYMBOL}, + {0x0002ee, 0x0002ee, PG_U_MODIFIER_LETTER}, + {0x0002ef, 0x0002ff, PG_U_MODIFIER_SYMBOL}, + {0x000300, 0x00036f, PG_U_NONSPACING_MARK}, + {0x000370, 0x000370, PG_U_UPPERCASE_LETTER}, + {0x000371, 0x000371, PG_U_LOWERCASE_LETTER}, + {0x000372, 0x000372, PG_U_UPPERCASE_LETTER}, + {0x000373, 0x000373, PG_U_LOWERCASE_LETTER}, + {0x000374, 0x000374, PG_U_MODIFIER_LETTER}, + {0x000375, 0x000375, PG_U_MODIFIER_SYMBOL}, + {0x000376, 0x000376, PG_U_UPPERCASE_LETTER}, + {0x000377, 0x000377, PG_U_LOWERCASE_LETTER}, + {0x00037a, 0x00037a, PG_U_MODIFIER_LETTER}, + {0x00037b, 0x00037d, PG_U_LOWERCASE_LETTER}, + {0x00037e, 0x00037e, PG_U_OTHER_PUNCTUATION}, + {0x00037f, 0x00037f, PG_U_UPPERCASE_LETTER}, + {0x000384, 0x000385, PG_U_MODIFIER_SYMBOL}, + {0x000386, 0x000386, PG_U_UPPERCASE_LETTER}, + {0x000387, 0x000387, PG_U_OTHER_PUNCTUATION}, + {0x000388, 0x00038a, PG_U_UPPERCASE_LETTER}, + {0x00038c, 0x00038c, PG_U_UPPERCASE_LETTER}, + {0x00038e, 0x00038f, PG_U_UPPERCASE_LETTER}, + {0x000390, 0x000390, PG_U_LOWERCASE_LETTER}, + {0x000391, 0x0003a1, PG_U_UPPERCASE_LETTER}, + {0x0003a3, 0x0003ab, PG_U_UPPERCASE_LETTER}, + {0x0003ac, 0x0003ce, PG_U_LOWERCASE_LETTER}, + {0x0003cf, 0x0003cf, PG_U_UPPERCASE_LETTER}, + {0x0003d0, 0x0003d1, PG_U_LOWERCASE_LETTER}, + {0x0003d2, 0x0003d4, PG_U_UPPERCASE_LETTER}, + {0x0003d5, 0x0003d7, PG_U_LOWERCASE_LETTER}, + {0x0003d8, 0x0003d8, PG_U_UPPERCASE_LETTER}, + {0x0003d9, 0x0003d9, PG_U_LOWERCASE_LETTER}, + {0x0003da, 0x0003da, PG_U_UPPERCASE_LETTER}, + {0x0003db, 0x0003db, PG_U_LOWERCASE_LETTER}, + {0x0003dc, 0x0003dc, PG_U_UPPERCASE_LETTER}, + {0x0003dd, 0x0003dd, PG_U_LOWERCASE_LETTER}, + {0x0003de, 0x0003de, PG_U_UPPERCASE_LETTER}, + {0x0003df, 0x0003df, PG_U_LOWERCASE_LETTER}, + {0x0003e0, 0x0003e0, PG_U_UPPERCASE_LETTER}, + {0x0003e1, 0x0003e1, PG_U_LOWERCASE_LETTER}, + {0x0003e2, 0x0003e2, PG_U_UPPERCASE_LETTER}, + {0x0003e3, 0x0003e3, PG_U_LOWERCASE_LETTER}, + {0x0003e4, 0x0003e4, PG_U_UPPERCASE_LETTER}, + {0x0003e5, 0x0003e5, PG_U_LOWERCASE_LETTER}, + {0x0003e6, 0x0003e6, PG_U_UPPERCASE_LETTER}, + {0x0003e7, 0x0003e7, PG_U_LOWERCASE_LETTER}, + {0x0003e8, 0x0003e8, PG_U_UPPERCASE_LETTER}, + {0x0003e9, 0x0003e9, PG_U_LOWERCASE_LETTER}, + {0x0003ea, 0x0003ea, PG_U_UPPERCASE_LETTER}, + {0x0003eb, 0x0003eb, PG_U_LOWERCASE_LETTER}, + {0x0003ec, 0x0003ec, PG_U_UPPERCASE_LETTER}, + {0x0003ed, 0x0003ed, PG_U_LOWERCASE_LETTER}, + {0x0003ee, 0x0003ee, PG_U_UPPERCASE_LETTER}, + {0x0003ef, 0x0003f3, PG_U_LOWERCASE_LETTER}, + {0x0003f4, 0x0003f4, PG_U_UPPERCASE_LETTER}, + {0x0003f5, 0x0003f5, PG_U_LOWERCASE_LETTER}, + {0x0003f6, 0x0003f6, PG_U_MATH_SYMBOL}, + {0x0003f7, 0x0003f7, PG_U_UPPERCASE_LETTER}, + {0x0003f8, 0x0003f8, PG_U_LOWERCASE_LETTER}, + {0x0003f9, 0x0003fa, PG_U_UPPERCASE_LETTER}, + {0x0003fb, 0x0003fc, PG_U_LOWERCASE_LETTER}, + {0x0003fd, 0x00042f, PG_U_UPPERCASE_LETTER}, + {0x000430, 0x00045f, PG_U_LOWERCASE_LETTER}, + {0x000460, 0x000460, PG_U_UPPERCASE_LETTER}, + {0x000461, 0x000461, PG_U_LOWERCASE_LETTER}, + {0x000462, 0x000462, PG_U_UPPERCASE_LETTER}, + {0x000463, 0x000463, PG_U_LOWERCASE_LETTER}, + {0x000464, 0x000464, PG_U_UPPERCASE_LETTER}, + {0x000465, 0x000465, PG_U_LOWERCASE_LETTER}, + {0x000466, 0x000466, PG_U_UPPERCASE_LETTER}, + {0x000467, 0x000467, PG_U_LOWERCASE_LETTER}, + {0x000468, 0x000468, PG_U_UPPERCASE_LETTER}, + {0x000469, 0x000469, PG_U_LOWERCASE_LETTER}, + {0x00046a, 0x00046a, PG_U_UPPERCASE_LETTER}, + {0x00046b, 0x00046b, PG_U_LOWERCASE_LETTER}, + {0x00046c, 0x00046c, PG_U_UPPERCASE_LETTER}, + {0x00046d, 0x00046d, PG_U_LOWERCASE_LETTER}, + {0x00046e, 0x00046e, PG_U_UPPERCASE_LETTER}, + {0x00046f, 0x00046f, PG_U_LOWERCASE_LETTER}, + {0x000470, 0x000470, PG_U_UPPERCASE_LETTER}, + {0x000471, 0x000471, PG_U_LOWERCASE_LETTER}, + {0x000472, 0x000472, PG_U_UPPERCASE_LETTER}, + {0x000473, 0x000473, PG_U_LOWERCASE_LETTER}, + {0x000474, 0x000474, PG_U_UPPERCASE_LETTER}, + {0x000475, 0x000475, PG_U_LOWERCASE_LETTER}, + {0x000476, 0x000476, PG_U_UPPERCASE_LETTER}, + {0x000477, 0x000477, PG_U_LOWERCASE_LETTER}, + {0x000478, 0x000478, PG_U_UPPERCASE_LETTER}, + {0x000479, 0x000479, PG_U_LOWERCASE_LETTER}, + {0x00047a, 0x00047a, PG_U_UPPERCASE_LETTER}, + {0x00047b, 0x00047b, PG_U_LOWERCASE_LETTER}, + {0x00047c, 0x00047c, PG_U_UPPERCASE_LETTER}, + {0x00047d, 0x00047d, PG_U_LOWERCASE_LETTER}, + {0x00047e, 0x00047e, PG_U_UPPERCASE_LETTER}, + {0x00047f, 0x00047f, PG_U_LOWERCASE_LETTER}, + {0x000480, 0x000480, PG_U_UPPERCASE_LETTER}, + {0x000481, 0x000481, PG_U_LOWERCASE_LETTER}, + {0x000482, 0x000482, PG_U_OTHER_SYMBOL}, + {0x000483, 0x000487, PG_U_NONSPACING_MARK}, + {0x000488, 0x000489, PG_U_ENCLOSING_MARK}, + {0x00048a, 0x00048a, PG_U_UPPERCASE_LETTER}, + {0x00048b, 0x00048b, PG_U_LOWERCASE_LETTER}, + {0x00048c, 0x00048c, PG_U_UPPERCASE_LETTER}, + {0x00048d, 0x00048d, PG_U_LOWERCASE_LETTER}, + {0x00048e, 0x00048e, PG_U_UPPERCASE_LETTER}, + {0x00048f, 0x00048f, PG_U_LOWERCASE_LETTER}, + {0x000490, 0x000490, PG_U_UPPERCASE_LETTER}, + {0x000491, 0x000491, PG_U_LOWERCASE_LETTER}, + {0x000492, 0x000492, PG_U_UPPERCASE_LETTER}, + {0x000493, 0x000493, PG_U_LOWERCASE_LETTER}, + {0x000494, 0x000494, PG_U_UPPERCASE_LETTER}, + {0x000495, 0x000495, PG_U_LOWERCASE_LETTER}, + {0x000496, 0x000496, PG_U_UPPERCASE_LETTER}, + {0x000497, 0x000497, PG_U_LOWERCASE_LETTER}, + {0x000498, 0x000498, PG_U_UPPERCASE_LETTER}, + {0x000499, 0x000499, PG_U_LOWERCASE_LETTER}, + {0x00049a, 0x00049a, PG_U_UPPERCASE_LETTER}, + {0x00049b, 0x00049b, PG_U_LOWERCASE_LETTER}, + {0x00049c, 0x00049c, PG_U_UPPERCASE_LETTER}, + {0x00049d, 0x00049d, PG_U_LOWERCASE_LETTER}, + {0x00049e, 0x00049e, PG_U_UPPERCASE_LETTER}, + {0x00049f, 0x00049f, PG_U_LOWERCASE_LETTER}, + {0x0004a0, 0x0004a0, PG_U_UPPERCASE_LETTER}, + {0x0004a1, 0x0004a1, PG_U_LOWERCASE_LETTER}, + {0x0004a2, 0x0004a2, PG_U_UPPERCASE_LETTER}, + {0x0004a3, 0x0004a3, PG_U_LOWERCASE_LETTER}, + {0x0004a4, 0x0004a4, PG_U_UPPERCASE_LETTER}, + {0x0004a5, 0x0004a5, PG_U_LOWERCASE_LETTER}, + {0x0004a6, 0x0004a6, PG_U_UPPERCASE_LETTER}, + {0x0004a7, 0x0004a7, PG_U_LOWERCASE_LETTER}, + {0x0004a8, 0x0004a8, PG_U_UPPERCASE_LETTER}, + {0x0004a9, 0x0004a9, PG_U_LOWERCASE_LETTER}, + {0x0004aa, 0x0004aa, PG_U_UPPERCASE_LETTER}, + {0x0004ab, 0x0004ab, PG_U_LOWERCASE_LETTER}, + {0x0004ac, 0x0004ac, PG_U_UPPERCASE_LETTER}, + {0x0004ad, 0x0004ad, PG_U_LOWERCASE_LETTER}, + {0x0004ae, 0x0004ae, PG_U_UPPERCASE_LETTER}, + {0x0004af, 0x0004af, PG_U_LOWERCASE_LETTER}, + {0x0004b0, 0x0004b0, PG_U_UPPERCASE_LETTER}, + {0x0004b1, 0x0004b1, PG_U_LOWERCASE_LETTER}, + {0x0004b2, 0x0004b2, PG_U_UPPERCASE_LETTER}, + {0x0004b3, 0x0004b3, PG_U_LOWERCASE_LETTER}, + {0x0004b4, 0x0004b4, PG_U_UPPERCASE_LETTER}, + {0x0004b5, 0x0004b5, PG_U_LOWERCASE_LETTER}, + {0x0004b6, 0x0004b6, PG_U_UPPERCASE_LETTER}, + {0x0004b7, 0x0004b7, PG_U_LOWERCASE_LETTER}, + {0x0004b8, 0x0004b8, PG_U_UPPERCASE_LETTER}, + {0x0004b9, 0x0004b9, PG_U_LOWERCASE_LETTER}, + {0x0004ba, 0x0004ba, PG_U_UPPERCASE_LETTER}, + {0x0004bb, 0x0004bb, PG_U_LOWERCASE_LETTER}, + {0x0004bc, 0x0004bc, PG_U_UPPERCASE_LETTER}, + {0x0004bd, 0x0004bd, PG_U_LOWERCASE_LETTER}, + {0x0004be, 0x0004be, PG_U_UPPERCASE_LETTER}, + {0x0004bf, 0x0004bf, PG_U_LOWERCASE_LETTER}, + {0x0004c0, 0x0004c1, PG_U_UPPERCASE_LETTER}, + {0x0004c2, 0x0004c2, PG_U_LOWERCASE_LETTER}, + {0x0004c3, 0x0004c3, PG_U_UPPERCASE_LETTER}, + {0x0004c4, 0x0004c4, PG_U_LOWERCASE_LETTER}, + {0x0004c5, 0x0004c5, PG_U_UPPERCASE_LETTER}, + {0x0004c6, 0x0004c6, PG_U_LOWERCASE_LETTER}, + {0x0004c7, 0x0004c7, PG_U_UPPERCASE_LETTER}, + {0x0004c8, 0x0004c8, PG_U_LOWERCASE_LETTER}, + {0x0004c9, 0x0004c9, PG_U_UPPERCASE_LETTER}, + {0x0004ca, 0x0004ca, PG_U_LOWERCASE_LETTER}, + {0x0004cb, 0x0004cb, PG_U_UPPERCASE_LETTER}, + {0x0004cc, 0x0004cc, PG_U_LOWERCASE_LETTER}, + {0x0004cd, 0x0004cd, PG_U_UPPERCASE_LETTER}, + {0x0004ce, 0x0004cf, PG_U_LOWERCASE_LETTER}, + {0x0004d0, 0x0004d0, PG_U_UPPERCASE_LETTER}, + {0x0004d1, 0x0004d1, PG_U_LOWERCASE_LETTER}, + {0x0004d2, 0x0004d2, PG_U_UPPERCASE_LETTER}, + {0x0004d3, 0x0004d3, PG_U_LOWERCASE_LETTER}, + {0x0004d4, 0x0004d4, PG_U_UPPERCASE_LETTER}, + {0x0004d5, 0x0004d5, PG_U_LOWERCASE_LETTER}, + {0x0004d6, 0x0004d6, PG_U_UPPERCASE_LETTER}, + {0x0004d7, 0x0004d7, PG_U_LOWERCASE_LETTER}, + {0x0004d8, 0x0004d8, PG_U_UPPERCASE_LETTER}, + {0x0004d9, 0x0004d9, PG_U_LOWERCASE_LETTER}, + {0x0004da, 0x0004da, PG_U_UPPERCASE_LETTER}, + {0x0004db, 0x0004db, PG_U_LOWERCASE_LETTER}, + {0x0004dc, 0x0004dc, PG_U_UPPERCASE_LETTER}, + {0x0004dd, 0x0004dd, PG_U_LOWERCASE_LETTER}, + {0x0004de, 0x0004de, PG_U_UPPERCASE_LETTER}, + {0x0004df, 0x0004df, PG_U_LOWERCASE_LETTER}, + {0x0004e0, 0x0004e0, PG_U_UPPERCASE_LETTER}, + {0x0004e1, 0x0004e1, PG_U_LOWERCASE_LETTER}, + {0x0004e2, 0x0004e2, PG_U_UPPERCASE_LETTER}, + {0x0004e3, 0x0004e3, PG_U_LOWERCASE_LETTER}, + {0x0004e4, 0x0004e4, PG_U_UPPERCASE_LETTER}, + {0x0004e5, 0x0004e5, PG_U_LOWERCASE_LETTER}, + {0x0004e6, 0x0004e6, PG_U_UPPERCASE_LETTER}, + {0x0004e7, 0x0004e7, PG_U_LOWERCASE_LETTER}, + {0x0004e8, 0x0004e8, PG_U_UPPERCASE_LETTER}, + {0x0004e9, 0x0004e9, PG_U_LOWERCASE_LETTER}, + {0x0004ea, 0x0004ea, PG_U_UPPERCASE_LETTER}, + {0x0004eb, 0x0004eb, PG_U_LOWERCASE_LETTER}, + {0x0004ec, 0x0004ec, PG_U_UPPERCASE_LETTER}, + {0x0004ed, 0x0004ed, PG_U_LOWERCASE_LETTER}, + {0x0004ee, 0x0004ee, PG_U_UPPERCASE_LETTER}, + {0x0004ef, 0x0004ef, PG_U_LOWERCASE_LETTER}, + {0x0004f0, 0x0004f0, PG_U_UPPERCASE_LETTER}, + {0x0004f1, 0x0004f1, PG_U_LOWERCASE_LETTER}, + {0x0004f2, 0x0004f2, PG_U_UPPERCASE_LETTER}, + {0x0004f3, 0x0004f3, PG_U_LOWERCASE_LETTER}, + {0x0004f4, 0x0004f4, PG_U_UPPERCASE_LETTER}, + {0x0004f5, 0x0004f5, PG_U_LOWERCASE_LETTER}, + {0x0004f6, 0x0004f6, PG_U_UPPERCASE_LETTER}, + {0x0004f7, 0x0004f7, PG_U_LOWERCASE_LETTER}, + {0x0004f8, 0x0004f8, PG_U_UPPERCASE_LETTER}, + {0x0004f9, 0x0004f9, PG_U_LOWERCASE_LETTER}, + {0x0004fa, 0x0004fa, PG_U_UPPERCASE_LETTER}, + {0x0004fb, 0x0004fb, PG_U_LOWERCASE_LETTER}, + {0x0004fc, 0x0004fc, PG_U_UPPERCASE_LETTER}, + {0x0004fd, 0x0004fd, PG_U_LOWERCASE_LETTER}, + {0x0004fe, 0x0004fe, PG_U_UPPERCASE_LETTER}, + {0x0004ff, 0x0004ff, PG_U_LOWERCASE_LETTER}, + {0x000500, 0x000500, PG_U_UPPERCASE_LETTER}, + {0x000501, 0x000501, PG_U_LOWERCASE_LETTER}, + {0x000502, 0x000502, PG_U_UPPERCASE_LETTER}, + {0x000503, 0x000503, PG_U_LOWERCASE_LETTER}, + {0x000504, 0x000504, PG_U_UPPERCASE_LETTER}, + {0x000505, 0x000505, PG_U_LOWERCASE_LETTER}, + {0x000506, 0x000506, PG_U_UPPERCASE_LETTER}, + {0x000507, 0x000507, PG_U_LOWERCASE_LETTER}, + {0x000508, 0x000508, PG_U_UPPERCASE_LETTER}, + {0x000509, 0x000509, PG_U_LOWERCASE_LETTER}, + {0x00050a, 0x00050a, PG_U_UPPERCASE_LETTER}, + {0x00050b, 0x00050b, PG_U_LOWERCASE_LETTER}, + {0x00050c, 0x00050c, PG_U_UPPERCASE_LETTER}, + {0x00050d, 0x00050d, PG_U_LOWERCASE_LETTER}, + {0x00050e, 0x00050e, PG_U_UPPERCASE_LETTER}, + {0x00050f, 0x00050f, PG_U_LOWERCASE_LETTER}, + {0x000510, 0x000510, PG_U_UPPERCASE_LETTER}, + {0x000511, 0x000511, PG_U_LOWERCASE_LETTER}, + {0x000512, 0x000512, PG_U_UPPERCASE_LETTER}, + {0x000513, 0x000513, PG_U_LOWERCASE_LETTER}, + {0x000514, 0x000514, PG_U_UPPERCASE_LETTER}, + {0x000515, 0x000515, PG_U_LOWERCASE_LETTER}, + {0x000516, 0x000516, PG_U_UPPERCASE_LETTER}, + {0x000517, 0x000517, PG_U_LOWERCASE_LETTER}, + {0x000518, 0x000518, PG_U_UPPERCASE_LETTER}, + {0x000519, 0x000519, PG_U_LOWERCASE_LETTER}, + {0x00051a, 0x00051a, PG_U_UPPERCASE_LETTER}, + {0x00051b, 0x00051b, PG_U_LOWERCASE_LETTER}, + {0x00051c, 0x00051c, PG_U_UPPERCASE_LETTER}, + {0x00051d, 0x00051d, PG_U_LOWERCASE_LETTER}, + {0x00051e, 0x00051e, PG_U_UPPERCASE_LETTER}, + {0x00051f, 0x00051f, PG_U_LOWERCASE_LETTER}, + {0x000520, 0x000520, PG_U_UPPERCASE_LETTER}, + {0x000521, 0x000521, PG_U_LOWERCASE_LETTER}, + {0x000522, 0x000522, PG_U_UPPERCASE_LETTER}, + {0x000523, 0x000523, PG_U_LOWERCASE_LETTER}, + {0x000524, 0x000524, PG_U_UPPERCASE_LETTER}, + {0x000525, 0x000525, PG_U_LOWERCASE_LETTER}, + {0x000526, 0x000526, PG_U_UPPERCASE_LETTER}, + {0x000527, 0x000527, PG_U_LOWERCASE_LETTER}, + {0x000528, 0x000528, PG_U_UPPERCASE_LETTER}, + {0x000529, 0x000529, PG_U_LOWERCASE_LETTER}, + {0x00052a, 0x00052a, PG_U_UPPERCASE_LETTER}, + {0x00052b, 0x00052b, PG_U_LOWERCASE_LETTER}, + {0x00052c, 0x00052c, PG_U_UPPERCASE_LETTER}, + {0x00052d, 0x00052d, PG_U_LOWERCASE_LETTER}, + {0x00052e, 0x00052e, PG_U_UPPERCASE_LETTER}, + {0x00052f, 0x00052f, PG_U_LOWERCASE_LETTER}, + {0x000531, 0x000556, PG_U_UPPERCASE_LETTER}, + {0x000559, 0x000559, PG_U_MODIFIER_LETTER}, + {0x00055a, 0x00055f, PG_U_OTHER_PUNCTUATION}, + {0x000560, 0x000588, PG_U_LOWERCASE_LETTER}, + {0x000589, 0x000589, PG_U_OTHER_PUNCTUATION}, + {0x00058a, 0x00058a, PG_U_DASH_PUNCTUATION}, + {0x00058d, 0x00058e, PG_U_OTHER_SYMBOL}, + {0x00058f, 0x00058f, PG_U_CURRENCY_SYMBOL}, + {0x000591, 0x0005bd, PG_U_NONSPACING_MARK}, + {0x0005be, 0x0005be, PG_U_DASH_PUNCTUATION}, + {0x0005bf, 0x0005bf, PG_U_NONSPACING_MARK}, + {0x0005c0, 0x0005c0, PG_U_OTHER_PUNCTUATION}, + {0x0005c1, 0x0005c2, PG_U_NONSPACING_MARK}, + {0x0005c3, 0x0005c3, PG_U_OTHER_PUNCTUATION}, + {0x0005c4, 0x0005c5, PG_U_NONSPACING_MARK}, + {0x0005c6, 0x0005c6, PG_U_OTHER_PUNCTUATION}, + {0x0005c7, 0x0005c7, PG_U_NONSPACING_MARK}, + {0x0005d0, 0x0005ea, PG_U_OTHER_LETTER}, + {0x0005ef, 0x0005f2, PG_U_OTHER_LETTER}, + {0x0005f3, 0x0005f4, PG_U_OTHER_PUNCTUATION}, + {0x000600, 0x000605, PG_U_FORMAT}, + {0x000606, 0x000608, PG_U_MATH_SYMBOL}, + {0x000609, 0x00060a, PG_U_OTHER_PUNCTUATION}, + {0x00060b, 0x00060b, PG_U_CURRENCY_SYMBOL}, + {0x00060c, 0x00060d, PG_U_OTHER_PUNCTUATION}, + {0x00060e, 0x00060f, PG_U_OTHER_SYMBOL}, + {0x000610, 0x00061a, PG_U_NONSPACING_MARK}, + {0x00061b, 0x00061b, PG_U_OTHER_PUNCTUATION}, + {0x00061c, 0x00061c, PG_U_FORMAT}, + {0x00061d, 0x00061f, PG_U_OTHER_PUNCTUATION}, + {0x000620, 0x00063f, PG_U_OTHER_LETTER}, + {0x000640, 0x000640, PG_U_MODIFIER_LETTER}, + {0x000641, 0x00064a, PG_U_OTHER_LETTER}, + {0x00064b, 0x00065f, PG_U_NONSPACING_MARK}, + {0x000660, 0x000669, PG_U_DECIMAL_NUMBER}, + {0x00066a, 0x00066d, PG_U_OTHER_PUNCTUATION}, + {0x00066e, 0x00066f, PG_U_OTHER_LETTER}, + {0x000670, 0x000670, PG_U_NONSPACING_MARK}, + {0x000671, 0x0006d3, PG_U_OTHER_LETTER}, + {0x0006d4, 0x0006d4, PG_U_OTHER_PUNCTUATION}, + {0x0006d5, 0x0006d5, PG_U_OTHER_LETTER}, + {0x0006d6, 0x0006dc, PG_U_NONSPACING_MARK}, + {0x0006dd, 0x0006dd, PG_U_FORMAT}, + {0x0006de, 0x0006de, PG_U_OTHER_SYMBOL}, + {0x0006df, 0x0006e4, PG_U_NONSPACING_MARK}, + {0x0006e5, 0x0006e6, PG_U_MODIFIER_LETTER}, + {0x0006e7, 0x0006e8, PG_U_NONSPACING_MARK}, + {0x0006e9, 0x0006e9, PG_U_OTHER_SYMBOL}, + {0x0006ea, 0x0006ed, PG_U_NONSPACING_MARK}, + {0x0006ee, 0x0006ef, PG_U_OTHER_LETTER}, + {0x0006f0, 0x0006f9, PG_U_DECIMAL_NUMBER}, + {0x0006fa, 0x0006fc, PG_U_OTHER_LETTER}, + {0x0006fd, 0x0006fe, PG_U_OTHER_SYMBOL}, + {0x0006ff, 0x0006ff, PG_U_OTHER_LETTER}, + {0x000700, 0x00070d, PG_U_OTHER_PUNCTUATION}, + {0x00070f, 0x00070f, PG_U_FORMAT}, + {0x000710, 0x000710, PG_U_OTHER_LETTER}, + {0x000711, 0x000711, PG_U_NONSPACING_MARK}, + {0x000712, 0x00072f, PG_U_OTHER_LETTER}, + {0x000730, 0x00074a, PG_U_NONSPACING_MARK}, + {0x00074d, 0x0007a5, PG_U_OTHER_LETTER}, + {0x0007a6, 0x0007b0, PG_U_NONSPACING_MARK}, + {0x0007b1, 0x0007b1, PG_U_OTHER_LETTER}, + {0x0007c0, 0x0007c9, PG_U_DECIMAL_NUMBER}, + {0x0007ca, 0x0007ea, PG_U_OTHER_LETTER}, + {0x0007eb, 0x0007f3, PG_U_NONSPACING_MARK}, + {0x0007f4, 0x0007f5, PG_U_MODIFIER_LETTER}, + {0x0007f6, 0x0007f6, PG_U_OTHER_SYMBOL}, + {0x0007f7, 0x0007f9, PG_U_OTHER_PUNCTUATION}, + {0x0007fa, 0x0007fa, PG_U_MODIFIER_LETTER}, + {0x0007fd, 0x0007fd, PG_U_NONSPACING_MARK}, + {0x0007fe, 0x0007ff, PG_U_CURRENCY_SYMBOL}, + {0x000800, 0x000815, PG_U_OTHER_LETTER}, + {0x000816, 0x000819, PG_U_NONSPACING_MARK}, + {0x00081a, 0x00081a, PG_U_MODIFIER_LETTER}, + {0x00081b, 0x000823, PG_U_NONSPACING_MARK}, + {0x000824, 0x000824, PG_U_MODIFIER_LETTER}, + {0x000825, 0x000827, PG_U_NONSPACING_MARK}, + {0x000828, 0x000828, PG_U_MODIFIER_LETTER}, + {0x000829, 0x00082d, PG_U_NONSPACING_MARK}, + {0x000830, 0x00083e, PG_U_OTHER_PUNCTUATION}, + {0x000840, 0x000858, PG_U_OTHER_LETTER}, + {0x000859, 0x00085b, PG_U_NONSPACING_MARK}, + {0x00085e, 0x00085e, PG_U_OTHER_PUNCTUATION}, + {0x000860, 0x00086a, PG_U_OTHER_LETTER}, + {0x000870, 0x000887, PG_U_OTHER_LETTER}, + {0x000888, 0x000888, PG_U_MODIFIER_SYMBOL}, + {0x000889, 0x00088e, PG_U_OTHER_LETTER}, + {0x000890, 0x000891, PG_U_FORMAT}, + {0x000898, 0x00089f, PG_U_NONSPACING_MARK}, + {0x0008a0, 0x0008c8, PG_U_OTHER_LETTER}, + {0x0008c9, 0x0008c9, PG_U_MODIFIER_LETTER}, + {0x0008ca, 0x0008e1, PG_U_NONSPACING_MARK}, + {0x0008e2, 0x0008e2, PG_U_FORMAT}, + {0x0008e3, 0x000902, PG_U_NONSPACING_MARK}, + {0x000903, 0x000903, PG_U_SPACING_MARK}, + {0x000904, 0x000939, PG_U_OTHER_LETTER}, + {0x00093a, 0x00093a, PG_U_NONSPACING_MARK}, + {0x00093b, 0x00093b, PG_U_SPACING_MARK}, + {0x00093c, 0x00093c, PG_U_NONSPACING_MARK}, + {0x00093d, 0x00093d, PG_U_OTHER_LETTER}, + {0x00093e, 0x000940, PG_U_SPACING_MARK}, + {0x000941, 0x000948, PG_U_NONSPACING_MARK}, + {0x000949, 0x00094c, PG_U_SPACING_MARK}, + {0x00094d, 0x00094d, PG_U_NONSPACING_MARK}, + {0x00094e, 0x00094f, PG_U_SPACING_MARK}, + {0x000950, 0x000950, PG_U_OTHER_LETTER}, + {0x000951, 0x000957, PG_U_NONSPACING_MARK}, + {0x000958, 0x000961, PG_U_OTHER_LETTER}, + {0x000962, 0x000963, PG_U_NONSPACING_MARK}, + {0x000964, 0x000965, PG_U_OTHER_PUNCTUATION}, + {0x000966, 0x00096f, PG_U_DECIMAL_NUMBER}, + {0x000970, 0x000970, PG_U_OTHER_PUNCTUATION}, + {0x000971, 0x000971, PG_U_MODIFIER_LETTER}, + {0x000972, 0x000980, PG_U_OTHER_LETTER}, + {0x000981, 0x000981, PG_U_NONSPACING_MARK}, + {0x000982, 0x000983, PG_U_SPACING_MARK}, + {0x000985, 0x00098c, PG_U_OTHER_LETTER}, + {0x00098f, 0x000990, PG_U_OTHER_LETTER}, + {0x000993, 0x0009a8, PG_U_OTHER_LETTER}, + {0x0009aa, 0x0009b0, PG_U_OTHER_LETTER}, + {0x0009b2, 0x0009b2, PG_U_OTHER_LETTER}, + {0x0009b6, 0x0009b9, PG_U_OTHER_LETTER}, + {0x0009bc, 0x0009bc, PG_U_NONSPACING_MARK}, + {0x0009bd, 0x0009bd, PG_U_OTHER_LETTER}, + {0x0009be, 0x0009c0, PG_U_SPACING_MARK}, + {0x0009c1, 0x0009c4, PG_U_NONSPACING_MARK}, + {0x0009c7, 0x0009c8, PG_U_SPACING_MARK}, + {0x0009cb, 0x0009cc, PG_U_SPACING_MARK}, + {0x0009cd, 0x0009cd, PG_U_NONSPACING_MARK}, + {0x0009ce, 0x0009ce, PG_U_OTHER_LETTER}, + {0x0009d7, 0x0009d7, PG_U_SPACING_MARK}, + {0x0009dc, 0x0009dd, PG_U_OTHER_LETTER}, + {0x0009df, 0x0009e1, PG_U_OTHER_LETTER}, + {0x0009e2, 0x0009e3, PG_U_NONSPACING_MARK}, + {0x0009e6, 0x0009ef, PG_U_DECIMAL_NUMBER}, + {0x0009f0, 0x0009f1, PG_U_OTHER_LETTER}, + {0x0009f2, 0x0009f3, PG_U_CURRENCY_SYMBOL}, + {0x0009f4, 0x0009f9, PG_U_OTHER_NUMBER}, + {0x0009fa, 0x0009fa, PG_U_OTHER_SYMBOL}, + {0x0009fb, 0x0009fb, PG_U_CURRENCY_SYMBOL}, + {0x0009fc, 0x0009fc, PG_U_OTHER_LETTER}, + {0x0009fd, 0x0009fd, PG_U_OTHER_PUNCTUATION}, + {0x0009fe, 0x0009fe, PG_U_NONSPACING_MARK}, + {0x000a01, 0x000a02, PG_U_NONSPACING_MARK}, + {0x000a03, 0x000a03, PG_U_SPACING_MARK}, + {0x000a05, 0x000a0a, PG_U_OTHER_LETTER}, + {0x000a0f, 0x000a10, PG_U_OTHER_LETTER}, + {0x000a13, 0x000a28, PG_U_OTHER_LETTER}, + {0x000a2a, 0x000a30, PG_U_OTHER_LETTER}, + {0x000a32, 0x000a33, PG_U_OTHER_LETTER}, + {0x000a35, 0x000a36, PG_U_OTHER_LETTER}, + {0x000a38, 0x000a39, PG_U_OTHER_LETTER}, + {0x000a3c, 0x000a3c, PG_U_NONSPACING_MARK}, + {0x000a3e, 0x000a40, PG_U_SPACING_MARK}, + {0x000a41, 0x000a42, PG_U_NONSPACING_MARK}, + {0x000a47, 0x000a48, PG_U_NONSPACING_MARK}, + {0x000a4b, 0x000a4d, PG_U_NONSPACING_MARK}, + {0x000a51, 0x000a51, PG_U_NONSPACING_MARK}, + {0x000a59, 0x000a5c, PG_U_OTHER_LETTER}, + {0x000a5e, 0x000a5e, PG_U_OTHER_LETTER}, + {0x000a66, 0x000a6f, PG_U_DECIMAL_NUMBER}, + {0x000a70, 0x000a71, PG_U_NONSPACING_MARK}, + {0x000a72, 0x000a74, PG_U_OTHER_LETTER}, + {0x000a75, 0x000a75, PG_U_NONSPACING_MARK}, + {0x000a76, 0x000a76, PG_U_OTHER_PUNCTUATION}, + {0x000a81, 0x000a82, PG_U_NONSPACING_MARK}, + {0x000a83, 0x000a83, PG_U_SPACING_MARK}, + {0x000a85, 0x000a8d, PG_U_OTHER_LETTER}, + {0x000a8f, 0x000a91, PG_U_OTHER_LETTER}, + {0x000a93, 0x000aa8, PG_U_OTHER_LETTER}, + {0x000aaa, 0x000ab0, PG_U_OTHER_LETTER}, + {0x000ab2, 0x000ab3, PG_U_OTHER_LETTER}, + {0x000ab5, 0x000ab9, PG_U_OTHER_LETTER}, + {0x000abc, 0x000abc, PG_U_NONSPACING_MARK}, + {0x000abd, 0x000abd, PG_U_OTHER_LETTER}, + {0x000abe, 0x000ac0, PG_U_SPACING_MARK}, + {0x000ac1, 0x000ac5, PG_U_NONSPACING_MARK}, + {0x000ac7, 0x000ac8, PG_U_NONSPACING_MARK}, + {0x000ac9, 0x000ac9, PG_U_SPACING_MARK}, + {0x000acb, 0x000acc, PG_U_SPACING_MARK}, + {0x000acd, 0x000acd, PG_U_NONSPACING_MARK}, + {0x000ad0, 0x000ad0, PG_U_OTHER_LETTER}, + {0x000ae0, 0x000ae1, PG_U_OTHER_LETTER}, + {0x000ae2, 0x000ae3, PG_U_NONSPACING_MARK}, + {0x000ae6, 0x000aef, PG_U_DECIMAL_NUMBER}, + {0x000af0, 0x000af0, PG_U_OTHER_PUNCTUATION}, + {0x000af1, 0x000af1, PG_U_CURRENCY_SYMBOL}, + {0x000af9, 0x000af9, PG_U_OTHER_LETTER}, + {0x000afa, 0x000aff, PG_U_NONSPACING_MARK}, + {0x000b01, 0x000b01, PG_U_NONSPACING_MARK}, + {0x000b02, 0x000b03, PG_U_SPACING_MARK}, + {0x000b05, 0x000b0c, PG_U_OTHER_LETTER}, + {0x000b0f, 0x000b10, PG_U_OTHER_LETTER}, + {0x000b13, 0x000b28, PG_U_OTHER_LETTER}, + {0x000b2a, 0x000b30, PG_U_OTHER_LETTER}, + {0x000b32, 0x000b33, PG_U_OTHER_LETTER}, + {0x000b35, 0x000b39, PG_U_OTHER_LETTER}, + {0x000b3c, 0x000b3c, PG_U_NONSPACING_MARK}, + {0x000b3d, 0x000b3d, PG_U_OTHER_LETTER}, + {0x000b3e, 0x000b3e, PG_U_SPACING_MARK}, + {0x000b3f, 0x000b3f, PG_U_NONSPACING_MARK}, + {0x000b40, 0x000b40, PG_U_SPACING_MARK}, + {0x000b41, 0x000b44, PG_U_NONSPACING_MARK}, + {0x000b47, 0x000b48, PG_U_SPACING_MARK}, + {0x000b4b, 0x000b4c, PG_U_SPACING_MARK}, + {0x000b4d, 0x000b4d, PG_U_NONSPACING_MARK}, + {0x000b55, 0x000b56, PG_U_NONSPACING_MARK}, + {0x000b57, 0x000b57, PG_U_SPACING_MARK}, + {0x000b5c, 0x000b5d, PG_U_OTHER_LETTER}, + {0x000b5f, 0x000b61, PG_U_OTHER_LETTER}, + {0x000b62, 0x000b63, PG_U_NONSPACING_MARK}, + {0x000b66, 0x000b6f, PG_U_DECIMAL_NUMBER}, + {0x000b70, 0x000b70, PG_U_OTHER_SYMBOL}, + {0x000b71, 0x000b71, PG_U_OTHER_LETTER}, + {0x000b72, 0x000b77, PG_U_OTHER_NUMBER}, + {0x000b82, 0x000b82, PG_U_NONSPACING_MARK}, + {0x000b83, 0x000b83, PG_U_OTHER_LETTER}, + {0x000b85, 0x000b8a, PG_U_OTHER_LETTER}, + {0x000b8e, 0x000b90, PG_U_OTHER_LETTER}, + {0x000b92, 0x000b95, PG_U_OTHER_LETTER}, + {0x000b99, 0x000b9a, PG_U_OTHER_LETTER}, + {0x000b9c, 0x000b9c, PG_U_OTHER_LETTER}, + {0x000b9e, 0x000b9f, PG_U_OTHER_LETTER}, + {0x000ba3, 0x000ba4, PG_U_OTHER_LETTER}, + {0x000ba8, 0x000baa, PG_U_OTHER_LETTER}, + {0x000bae, 0x000bb9, PG_U_OTHER_LETTER}, + {0x000bbe, 0x000bbf, PG_U_SPACING_MARK}, + {0x000bc0, 0x000bc0, PG_U_NONSPACING_MARK}, + {0x000bc1, 0x000bc2, PG_U_SPACING_MARK}, + {0x000bc6, 0x000bc8, PG_U_SPACING_MARK}, + {0x000bca, 0x000bcc, PG_U_SPACING_MARK}, + {0x000bcd, 0x000bcd, PG_U_NONSPACING_MARK}, + {0x000bd0, 0x000bd0, PG_U_OTHER_LETTER}, + {0x000bd7, 0x000bd7, PG_U_SPACING_MARK}, + {0x000be6, 0x000bef, PG_U_DECIMAL_NUMBER}, + {0x000bf0, 0x000bf2, PG_U_OTHER_NUMBER}, + {0x000bf3, 0x000bf8, PG_U_OTHER_SYMBOL}, + {0x000bf9, 0x000bf9, PG_U_CURRENCY_SYMBOL}, + {0x000bfa, 0x000bfa, PG_U_OTHER_SYMBOL}, + {0x000c00, 0x000c00, PG_U_NONSPACING_MARK}, + {0x000c01, 0x000c03, PG_U_SPACING_MARK}, + {0x000c04, 0x000c04, PG_U_NONSPACING_MARK}, + {0x000c05, 0x000c0c, PG_U_OTHER_LETTER}, + {0x000c0e, 0x000c10, PG_U_OTHER_LETTER}, + {0x000c12, 0x000c28, PG_U_OTHER_LETTER}, + {0x000c2a, 0x000c39, PG_U_OTHER_LETTER}, + {0x000c3c, 0x000c3c, PG_U_NONSPACING_MARK}, + {0x000c3d, 0x000c3d, PG_U_OTHER_LETTER}, + {0x000c3e, 0x000c40, PG_U_NONSPACING_MARK}, + {0x000c41, 0x000c44, PG_U_SPACING_MARK}, + {0x000c46, 0x000c48, PG_U_NONSPACING_MARK}, + {0x000c4a, 0x000c4d, PG_U_NONSPACING_MARK}, + {0x000c55, 0x000c56, PG_U_NONSPACING_MARK}, + {0x000c58, 0x000c5a, PG_U_OTHER_LETTER}, + {0x000c5d, 0x000c5d, PG_U_OTHER_LETTER}, + {0x000c60, 0x000c61, PG_U_OTHER_LETTER}, + {0x000c62, 0x000c63, PG_U_NONSPACING_MARK}, + {0x000c66, 0x000c6f, PG_U_DECIMAL_NUMBER}, + {0x000c77, 0x000c77, PG_U_OTHER_PUNCTUATION}, + {0x000c78, 0x000c7e, PG_U_OTHER_NUMBER}, + {0x000c7f, 0x000c7f, PG_U_OTHER_SYMBOL}, + {0x000c80, 0x000c80, PG_U_OTHER_LETTER}, + {0x000c81, 0x000c81, PG_U_NONSPACING_MARK}, + {0x000c82, 0x000c83, PG_U_SPACING_MARK}, + {0x000c84, 0x000c84, PG_U_OTHER_PUNCTUATION}, + {0x000c85, 0x000c8c, PG_U_OTHER_LETTER}, + {0x000c8e, 0x000c90, PG_U_OTHER_LETTER}, + {0x000c92, 0x000ca8, PG_U_OTHER_LETTER}, + {0x000caa, 0x000cb3, PG_U_OTHER_LETTER}, + {0x000cb5, 0x000cb9, PG_U_OTHER_LETTER}, + {0x000cbc, 0x000cbc, PG_U_NONSPACING_MARK}, + {0x000cbd, 0x000cbd, PG_U_OTHER_LETTER}, + {0x000cbe, 0x000cbe, PG_U_SPACING_MARK}, + {0x000cbf, 0x000cbf, PG_U_NONSPACING_MARK}, + {0x000cc0, 0x000cc4, PG_U_SPACING_MARK}, + {0x000cc6, 0x000cc6, PG_U_NONSPACING_MARK}, + {0x000cc7, 0x000cc8, PG_U_SPACING_MARK}, + {0x000cca, 0x000ccb, PG_U_SPACING_MARK}, + {0x000ccc, 0x000ccd, PG_U_NONSPACING_MARK}, + {0x000cd5, 0x000cd6, PG_U_SPACING_MARK}, + {0x000cdd, 0x000cde, PG_U_OTHER_LETTER}, + {0x000ce0, 0x000ce1, PG_U_OTHER_LETTER}, + {0x000ce2, 0x000ce3, PG_U_NONSPACING_MARK}, + {0x000ce6, 0x000cef, PG_U_DECIMAL_NUMBER}, + {0x000cf1, 0x000cf2, PG_U_OTHER_LETTER}, + {0x000cf3, 0x000cf3, PG_U_SPACING_MARK}, + {0x000d00, 0x000d01, PG_U_NONSPACING_MARK}, + {0x000d02, 0x000d03, PG_U_SPACING_MARK}, + {0x000d04, 0x000d0c, PG_U_OTHER_LETTER}, + {0x000d0e, 0x000d10, PG_U_OTHER_LETTER}, + {0x000d12, 0x000d3a, PG_U_OTHER_LETTER}, + {0x000d3b, 0x000d3c, PG_U_NONSPACING_MARK}, + {0x000d3d, 0x000d3d, PG_U_OTHER_LETTER}, + {0x000d3e, 0x000d40, PG_U_SPACING_MARK}, + {0x000d41, 0x000d44, PG_U_NONSPACING_MARK}, + {0x000d46, 0x000d48, PG_U_SPACING_MARK}, + {0x000d4a, 0x000d4c, PG_U_SPACING_MARK}, + {0x000d4d, 0x000d4d, PG_U_NONSPACING_MARK}, + {0x000d4e, 0x000d4e, PG_U_OTHER_LETTER}, + {0x000d4f, 0x000d4f, PG_U_OTHER_SYMBOL}, + {0x000d54, 0x000d56, PG_U_OTHER_LETTER}, + {0x000d57, 0x000d57, PG_U_SPACING_MARK}, + {0x000d58, 0x000d5e, PG_U_OTHER_NUMBER}, + {0x000d5f, 0x000d61, PG_U_OTHER_LETTER}, + {0x000d62, 0x000d63, PG_U_NONSPACING_MARK}, + {0x000d66, 0x000d6f, PG_U_DECIMAL_NUMBER}, + {0x000d70, 0x000d78, PG_U_OTHER_NUMBER}, + {0x000d79, 0x000d79, PG_U_OTHER_SYMBOL}, + {0x000d7a, 0x000d7f, PG_U_OTHER_LETTER}, + {0x000d81, 0x000d81, PG_U_NONSPACING_MARK}, + {0x000d82, 0x000d83, PG_U_SPACING_MARK}, + {0x000d85, 0x000d96, PG_U_OTHER_LETTER}, + {0x000d9a, 0x000db1, PG_U_OTHER_LETTER}, + {0x000db3, 0x000dbb, PG_U_OTHER_LETTER}, + {0x000dbd, 0x000dbd, PG_U_OTHER_LETTER}, + {0x000dc0, 0x000dc6, PG_U_OTHER_LETTER}, + {0x000dca, 0x000dca, PG_U_NONSPACING_MARK}, + {0x000dcf, 0x000dd1, PG_U_SPACING_MARK}, + {0x000dd2, 0x000dd4, PG_U_NONSPACING_MARK}, + {0x000dd6, 0x000dd6, PG_U_NONSPACING_MARK}, + {0x000dd8, 0x000ddf, PG_U_SPACING_MARK}, + {0x000de6, 0x000def, PG_U_DECIMAL_NUMBER}, + {0x000df2, 0x000df3, PG_U_SPACING_MARK}, + {0x000df4, 0x000df4, PG_U_OTHER_PUNCTUATION}, + {0x000e01, 0x000e30, PG_U_OTHER_LETTER}, + {0x000e31, 0x000e31, PG_U_NONSPACING_MARK}, + {0x000e32, 0x000e33, PG_U_OTHER_LETTER}, + {0x000e34, 0x000e3a, PG_U_NONSPACING_MARK}, + {0x000e3f, 0x000e3f, PG_U_CURRENCY_SYMBOL}, + {0x000e40, 0x000e45, PG_U_OTHER_LETTER}, + {0x000e46, 0x000e46, PG_U_MODIFIER_LETTER}, + {0x000e47, 0x000e4e, PG_U_NONSPACING_MARK}, + {0x000e4f, 0x000e4f, PG_U_OTHER_PUNCTUATION}, + {0x000e50, 0x000e59, PG_U_DECIMAL_NUMBER}, + {0x000e5a, 0x000e5b, PG_U_OTHER_PUNCTUATION}, + {0x000e81, 0x000e82, PG_U_OTHER_LETTER}, + {0x000e84, 0x000e84, PG_U_OTHER_LETTER}, + {0x000e86, 0x000e8a, PG_U_OTHER_LETTER}, + {0x000e8c, 0x000ea3, PG_U_OTHER_LETTER}, + {0x000ea5, 0x000ea5, PG_U_OTHER_LETTER}, + {0x000ea7, 0x000eb0, PG_U_OTHER_LETTER}, + {0x000eb1, 0x000eb1, PG_U_NONSPACING_MARK}, + {0x000eb2, 0x000eb3, PG_U_OTHER_LETTER}, + {0x000eb4, 0x000ebc, PG_U_NONSPACING_MARK}, + {0x000ebd, 0x000ebd, PG_U_OTHER_LETTER}, + {0x000ec0, 0x000ec4, PG_U_OTHER_LETTER}, + {0x000ec6, 0x000ec6, PG_U_MODIFIER_LETTER}, + {0x000ec8, 0x000ece, PG_U_NONSPACING_MARK}, + {0x000ed0, 0x000ed9, PG_U_DECIMAL_NUMBER}, + {0x000edc, 0x000edf, PG_U_OTHER_LETTER}, + {0x000f00, 0x000f00, PG_U_OTHER_LETTER}, + {0x000f01, 0x000f03, PG_U_OTHER_SYMBOL}, + {0x000f04, 0x000f12, PG_U_OTHER_PUNCTUATION}, + {0x000f13, 0x000f13, PG_U_OTHER_SYMBOL}, + {0x000f14, 0x000f14, PG_U_OTHER_PUNCTUATION}, + {0x000f15, 0x000f17, PG_U_OTHER_SYMBOL}, + {0x000f18, 0x000f19, PG_U_NONSPACING_MARK}, + {0x000f1a, 0x000f1f, PG_U_OTHER_SYMBOL}, + {0x000f20, 0x000f29, PG_U_DECIMAL_NUMBER}, + {0x000f2a, 0x000f33, PG_U_OTHER_NUMBER}, + {0x000f34, 0x000f34, PG_U_OTHER_SYMBOL}, + {0x000f35, 0x000f35, PG_U_NONSPACING_MARK}, + {0x000f36, 0x000f36, PG_U_OTHER_SYMBOL}, + {0x000f37, 0x000f37, PG_U_NONSPACING_MARK}, + {0x000f38, 0x000f38, PG_U_OTHER_SYMBOL}, + {0x000f39, 0x000f39, PG_U_NONSPACING_MARK}, + {0x000f3a, 0x000f3a, PG_U_OPEN_PUNCTUATION}, + {0x000f3b, 0x000f3b, PG_U_CLOSE_PUNCTUATION}, + {0x000f3c, 0x000f3c, PG_U_OPEN_PUNCTUATION}, + {0x000f3d, 0x000f3d, PG_U_CLOSE_PUNCTUATION}, + {0x000f3e, 0x000f3f, PG_U_SPACING_MARK}, + {0x000f40, 0x000f47, PG_U_OTHER_LETTER}, + {0x000f49, 0x000f6c, PG_U_OTHER_LETTER}, + {0x000f71, 0x000f7e, PG_U_NONSPACING_MARK}, + {0x000f7f, 0x000f7f, PG_U_SPACING_MARK}, + {0x000f80, 0x000f84, PG_U_NONSPACING_MARK}, + {0x000f85, 0x000f85, PG_U_OTHER_PUNCTUATION}, + {0x000f86, 0x000f87, PG_U_NONSPACING_MARK}, + {0x000f88, 0x000f8c, PG_U_OTHER_LETTER}, + {0x000f8d, 0x000f97, PG_U_NONSPACING_MARK}, + {0x000f99, 0x000fbc, PG_U_NONSPACING_MARK}, + {0x000fbe, 0x000fc5, PG_U_OTHER_SYMBOL}, + {0x000fc6, 0x000fc6, PG_U_NONSPACING_MARK}, + {0x000fc7, 0x000fcc, PG_U_OTHER_SYMBOL}, + {0x000fce, 0x000fcf, PG_U_OTHER_SYMBOL}, + {0x000fd0, 0x000fd4, PG_U_OTHER_PUNCTUATION}, + {0x000fd5, 0x000fd8, PG_U_OTHER_SYMBOL}, + {0x000fd9, 0x000fda, PG_U_OTHER_PUNCTUATION}, + {0x001000, 0x00102a, PG_U_OTHER_LETTER}, + {0x00102b, 0x00102c, PG_U_SPACING_MARK}, + {0x00102d, 0x001030, PG_U_NONSPACING_MARK}, + {0x001031, 0x001031, PG_U_SPACING_MARK}, + {0x001032, 0x001037, PG_U_NONSPACING_MARK}, + {0x001038, 0x001038, PG_U_SPACING_MARK}, + {0x001039, 0x00103a, PG_U_NONSPACING_MARK}, + {0x00103b, 0x00103c, PG_U_SPACING_MARK}, + {0x00103d, 0x00103e, PG_U_NONSPACING_MARK}, + {0x00103f, 0x00103f, PG_U_OTHER_LETTER}, + {0x001040, 0x001049, PG_U_DECIMAL_NUMBER}, + {0x00104a, 0x00104f, PG_U_OTHER_PUNCTUATION}, + {0x001050, 0x001055, PG_U_OTHER_LETTER}, + {0x001056, 0x001057, PG_U_SPACING_MARK}, + {0x001058, 0x001059, PG_U_NONSPACING_MARK}, + {0x00105a, 0x00105d, PG_U_OTHER_LETTER}, + {0x00105e, 0x001060, PG_U_NONSPACING_MARK}, + {0x001061, 0x001061, PG_U_OTHER_LETTER}, + {0x001062, 0x001064, PG_U_SPACING_MARK}, + {0x001065, 0x001066, PG_U_OTHER_LETTER}, + {0x001067, 0x00106d, PG_U_SPACING_MARK}, + {0x00106e, 0x001070, PG_U_OTHER_LETTER}, + {0x001071, 0x001074, PG_U_NONSPACING_MARK}, + {0x001075, 0x001081, PG_U_OTHER_LETTER}, + {0x001082, 0x001082, PG_U_NONSPACING_MARK}, + {0x001083, 0x001084, PG_U_SPACING_MARK}, + {0x001085, 0x001086, PG_U_NONSPACING_MARK}, + {0x001087, 0x00108c, PG_U_SPACING_MARK}, + {0x00108d, 0x00108d, PG_U_NONSPACING_MARK}, + {0x00108e, 0x00108e, PG_U_OTHER_LETTER}, + {0x00108f, 0x00108f, PG_U_SPACING_MARK}, + {0x001090, 0x001099, PG_U_DECIMAL_NUMBER}, + {0x00109a, 0x00109c, PG_U_SPACING_MARK}, + {0x00109d, 0x00109d, PG_U_NONSPACING_MARK}, + {0x00109e, 0x00109f, PG_U_OTHER_SYMBOL}, + {0x0010a0, 0x0010c5, PG_U_UPPERCASE_LETTER}, + {0x0010c7, 0x0010c7, PG_U_UPPERCASE_LETTER}, + {0x0010cd, 0x0010cd, PG_U_UPPERCASE_LETTER}, + {0x0010d0, 0x0010fa, PG_U_LOWERCASE_LETTER}, + {0x0010fb, 0x0010fb, PG_U_OTHER_PUNCTUATION}, + {0x0010fc, 0x0010fc, PG_U_MODIFIER_LETTER}, + {0x0010fd, 0x0010ff, PG_U_LOWERCASE_LETTER}, + {0x001100, 0x001248, PG_U_OTHER_LETTER}, + {0x00124a, 0x00124d, PG_U_OTHER_LETTER}, + {0x001250, 0x001256, PG_U_OTHER_LETTER}, + {0x001258, 0x001258, PG_U_OTHER_LETTER}, + {0x00125a, 0x00125d, PG_U_OTHER_LETTER}, + {0x001260, 0x001288, PG_U_OTHER_LETTER}, + {0x00128a, 0x00128d, PG_U_OTHER_LETTER}, + {0x001290, 0x0012b0, PG_U_OTHER_LETTER}, + {0x0012b2, 0x0012b5, PG_U_OTHER_LETTER}, + {0x0012b8, 0x0012be, PG_U_OTHER_LETTER}, + {0x0012c0, 0x0012c0, PG_U_OTHER_LETTER}, + {0x0012c2, 0x0012c5, PG_U_OTHER_LETTER}, + {0x0012c8, 0x0012d6, PG_U_OTHER_LETTER}, + {0x0012d8, 0x001310, PG_U_OTHER_LETTER}, + {0x001312, 0x001315, PG_U_OTHER_LETTER}, + {0x001318, 0x00135a, PG_U_OTHER_LETTER}, + {0x00135d, 0x00135f, PG_U_NONSPACING_MARK}, + {0x001360, 0x001368, PG_U_OTHER_PUNCTUATION}, + {0x001369, 0x00137c, PG_U_OTHER_NUMBER}, + {0x001380, 0x00138f, PG_U_OTHER_LETTER}, + {0x001390, 0x001399, PG_U_OTHER_SYMBOL}, + {0x0013a0, 0x0013f5, PG_U_UPPERCASE_LETTER}, + {0x0013f8, 0x0013fd, PG_U_LOWERCASE_LETTER}, + {0x001400, 0x001400, PG_U_DASH_PUNCTUATION}, + {0x001401, 0x00166c, PG_U_OTHER_LETTER}, + {0x00166d, 0x00166d, PG_U_OTHER_SYMBOL}, + {0x00166e, 0x00166e, PG_U_OTHER_PUNCTUATION}, + {0x00166f, 0x00167f, PG_U_OTHER_LETTER}, + {0x001680, 0x001680, PG_U_SPACE_SEPARATOR}, + {0x001681, 0x00169a, PG_U_OTHER_LETTER}, + {0x00169b, 0x00169b, PG_U_OPEN_PUNCTUATION}, + {0x00169c, 0x00169c, PG_U_CLOSE_PUNCTUATION}, + {0x0016a0, 0x0016ea, PG_U_OTHER_LETTER}, + {0x0016eb, 0x0016ed, PG_U_OTHER_PUNCTUATION}, + {0x0016ee, 0x0016f0, PG_U_LETTER_NUMBER}, + {0x0016f1, 0x0016f8, PG_U_OTHER_LETTER}, + {0x001700, 0x001711, PG_U_OTHER_LETTER}, + {0x001712, 0x001714, PG_U_NONSPACING_MARK}, + {0x001715, 0x001715, PG_U_SPACING_MARK}, + {0x00171f, 0x001731, PG_U_OTHER_LETTER}, + {0x001732, 0x001733, PG_U_NONSPACING_MARK}, + {0x001734, 0x001734, PG_U_SPACING_MARK}, + {0x001735, 0x001736, PG_U_OTHER_PUNCTUATION}, + {0x001740, 0x001751, PG_U_OTHER_LETTER}, + {0x001752, 0x001753, PG_U_NONSPACING_MARK}, + {0x001760, 0x00176c, PG_U_OTHER_LETTER}, + {0x00176e, 0x001770, PG_U_OTHER_LETTER}, + {0x001772, 0x001773, PG_U_NONSPACING_MARK}, + {0x001780, 0x0017b3, PG_U_OTHER_LETTER}, + {0x0017b4, 0x0017b5, PG_U_NONSPACING_MARK}, + {0x0017b6, 0x0017b6, PG_U_SPACING_MARK}, + {0x0017b7, 0x0017bd, PG_U_NONSPACING_MARK}, + {0x0017be, 0x0017c5, PG_U_SPACING_MARK}, + {0x0017c6, 0x0017c6, PG_U_NONSPACING_MARK}, + {0x0017c7, 0x0017c8, PG_U_SPACING_MARK}, + {0x0017c9, 0x0017d3, PG_U_NONSPACING_MARK}, + {0x0017d4, 0x0017d6, PG_U_OTHER_PUNCTUATION}, + {0x0017d7, 0x0017d7, PG_U_MODIFIER_LETTER}, + {0x0017d8, 0x0017da, PG_U_OTHER_PUNCTUATION}, + {0x0017db, 0x0017db, PG_U_CURRENCY_SYMBOL}, + {0x0017dc, 0x0017dc, PG_U_OTHER_LETTER}, + {0x0017dd, 0x0017dd, PG_U_NONSPACING_MARK}, + {0x0017e0, 0x0017e9, PG_U_DECIMAL_NUMBER}, + {0x0017f0, 0x0017f9, PG_U_OTHER_NUMBER}, + {0x001800, 0x001805, PG_U_OTHER_PUNCTUATION}, + {0x001806, 0x001806, PG_U_DASH_PUNCTUATION}, + {0x001807, 0x00180a, PG_U_OTHER_PUNCTUATION}, + {0x00180b, 0x00180d, PG_U_NONSPACING_MARK}, + {0x00180e, 0x00180e, PG_U_FORMAT}, + {0x00180f, 0x00180f, PG_U_NONSPACING_MARK}, + {0x001810, 0x001819, PG_U_DECIMAL_NUMBER}, + {0x001820, 0x001842, PG_U_OTHER_LETTER}, + {0x001843, 0x001843, PG_U_MODIFIER_LETTER}, + {0x001844, 0x001878, PG_U_OTHER_LETTER}, + {0x001880, 0x001884, PG_U_OTHER_LETTER}, + {0x001885, 0x001886, PG_U_NONSPACING_MARK}, + {0x001887, 0x0018a8, PG_U_OTHER_LETTER}, + {0x0018a9, 0x0018a9, PG_U_NONSPACING_MARK}, + {0x0018aa, 0x0018aa, PG_U_OTHER_LETTER}, + {0x0018b0, 0x0018f5, PG_U_OTHER_LETTER}, + {0x001900, 0x00191e, PG_U_OTHER_LETTER}, + {0x001920, 0x001922, PG_U_NONSPACING_MARK}, + {0x001923, 0x001926, PG_U_SPACING_MARK}, + {0x001927, 0x001928, PG_U_NONSPACING_MARK}, + {0x001929, 0x00192b, PG_U_SPACING_MARK}, + {0x001930, 0x001931, PG_U_SPACING_MARK}, + {0x001932, 0x001932, PG_U_NONSPACING_MARK}, + {0x001933, 0x001938, PG_U_SPACING_MARK}, + {0x001939, 0x00193b, PG_U_NONSPACING_MARK}, + {0x001940, 0x001940, PG_U_OTHER_SYMBOL}, + {0x001944, 0x001945, PG_U_OTHER_PUNCTUATION}, + {0x001946, 0x00194f, PG_U_DECIMAL_NUMBER}, + {0x001950, 0x00196d, PG_U_OTHER_LETTER}, + {0x001970, 0x001974, PG_U_OTHER_LETTER}, + {0x001980, 0x0019ab, PG_U_OTHER_LETTER}, + {0x0019b0, 0x0019c9, PG_U_OTHER_LETTER}, + {0x0019d0, 0x0019d9, PG_U_DECIMAL_NUMBER}, + {0x0019da, 0x0019da, PG_U_OTHER_NUMBER}, + {0x0019de, 0x0019ff, PG_U_OTHER_SYMBOL}, + {0x001a00, 0x001a16, PG_U_OTHER_LETTER}, + {0x001a17, 0x001a18, PG_U_NONSPACING_MARK}, + {0x001a19, 0x001a1a, PG_U_SPACING_MARK}, + {0x001a1b, 0x001a1b, PG_U_NONSPACING_MARK}, + {0x001a1e, 0x001a1f, PG_U_OTHER_PUNCTUATION}, + {0x001a20, 0x001a54, PG_U_OTHER_LETTER}, + {0x001a55, 0x001a55, PG_U_SPACING_MARK}, + {0x001a56, 0x001a56, PG_U_NONSPACING_MARK}, + {0x001a57, 0x001a57, PG_U_SPACING_MARK}, + {0x001a58, 0x001a5e, PG_U_NONSPACING_MARK}, + {0x001a60, 0x001a60, PG_U_NONSPACING_MARK}, + {0x001a61, 0x001a61, PG_U_SPACING_MARK}, + {0x001a62, 0x001a62, PG_U_NONSPACING_MARK}, + {0x001a63, 0x001a64, PG_U_SPACING_MARK}, + {0x001a65, 0x001a6c, PG_U_NONSPACING_MARK}, + {0x001a6d, 0x001a72, PG_U_SPACING_MARK}, + {0x001a73, 0x001a7c, PG_U_NONSPACING_MARK}, + {0x001a7f, 0x001a7f, PG_U_NONSPACING_MARK}, + {0x001a80, 0x001a89, PG_U_DECIMAL_NUMBER}, + {0x001a90, 0x001a99, PG_U_DECIMAL_NUMBER}, + {0x001aa0, 0x001aa6, PG_U_OTHER_PUNCTUATION}, + {0x001aa7, 0x001aa7, PG_U_MODIFIER_LETTER}, + {0x001aa8, 0x001aad, PG_U_OTHER_PUNCTUATION}, + {0x001ab0, 0x001abd, PG_U_NONSPACING_MARK}, + {0x001abe, 0x001abe, PG_U_ENCLOSING_MARK}, + {0x001abf, 0x001ace, PG_U_NONSPACING_MARK}, + {0x001b00, 0x001b03, PG_U_NONSPACING_MARK}, + {0x001b04, 0x001b04, PG_U_SPACING_MARK}, + {0x001b05, 0x001b33, PG_U_OTHER_LETTER}, + {0x001b34, 0x001b34, PG_U_NONSPACING_MARK}, + {0x001b35, 0x001b35, PG_U_SPACING_MARK}, + {0x001b36, 0x001b3a, PG_U_NONSPACING_MARK}, + {0x001b3b, 0x001b3b, PG_U_SPACING_MARK}, + {0x001b3c, 0x001b3c, PG_U_NONSPACING_MARK}, + {0x001b3d, 0x001b41, PG_U_SPACING_MARK}, + {0x001b42, 0x001b42, PG_U_NONSPACING_MARK}, + {0x001b43, 0x001b44, PG_U_SPACING_MARK}, + {0x001b45, 0x001b4c, PG_U_OTHER_LETTER}, + {0x001b50, 0x001b59, PG_U_DECIMAL_NUMBER}, + {0x001b5a, 0x001b60, PG_U_OTHER_PUNCTUATION}, + {0x001b61, 0x001b6a, PG_U_OTHER_SYMBOL}, + {0x001b6b, 0x001b73, PG_U_NONSPACING_MARK}, + {0x001b74, 0x001b7c, PG_U_OTHER_SYMBOL}, + {0x001b7d, 0x001b7e, PG_U_OTHER_PUNCTUATION}, + {0x001b80, 0x001b81, PG_U_NONSPACING_MARK}, + {0x001b82, 0x001b82, PG_U_SPACING_MARK}, + {0x001b83, 0x001ba0, PG_U_OTHER_LETTER}, + {0x001ba1, 0x001ba1, PG_U_SPACING_MARK}, + {0x001ba2, 0x001ba5, PG_U_NONSPACING_MARK}, + {0x001ba6, 0x001ba7, PG_U_SPACING_MARK}, + {0x001ba8, 0x001ba9, PG_U_NONSPACING_MARK}, + {0x001baa, 0x001baa, PG_U_SPACING_MARK}, + {0x001bab, 0x001bad, PG_U_NONSPACING_MARK}, + {0x001bae, 0x001baf, PG_U_OTHER_LETTER}, + {0x001bb0, 0x001bb9, PG_U_DECIMAL_NUMBER}, + {0x001bba, 0x001be5, PG_U_OTHER_LETTER}, + {0x001be6, 0x001be6, PG_U_NONSPACING_MARK}, + {0x001be7, 0x001be7, PG_U_SPACING_MARK}, + {0x001be8, 0x001be9, PG_U_NONSPACING_MARK}, + {0x001bea, 0x001bec, PG_U_SPACING_MARK}, + {0x001bed, 0x001bed, PG_U_NONSPACING_MARK}, + {0x001bee, 0x001bee, PG_U_SPACING_MARK}, + {0x001bef, 0x001bf1, PG_U_NONSPACING_MARK}, + {0x001bf2, 0x001bf3, PG_U_SPACING_MARK}, + {0x001bfc, 0x001bff, PG_U_OTHER_PUNCTUATION}, + {0x001c00, 0x001c23, PG_U_OTHER_LETTER}, + {0x001c24, 0x001c2b, PG_U_SPACING_MARK}, + {0x001c2c, 0x001c33, PG_U_NONSPACING_MARK}, + {0x001c34, 0x001c35, PG_U_SPACING_MARK}, + {0x001c36, 0x001c37, PG_U_NONSPACING_MARK}, + {0x001c3b, 0x001c3f, PG_U_OTHER_PUNCTUATION}, + {0x001c40, 0x001c49, PG_U_DECIMAL_NUMBER}, + {0x001c4d, 0x001c4f, PG_U_OTHER_LETTER}, + {0x001c50, 0x001c59, PG_U_DECIMAL_NUMBER}, + {0x001c5a, 0x001c77, PG_U_OTHER_LETTER}, + {0x001c78, 0x001c7d, PG_U_MODIFIER_LETTER}, + {0x001c7e, 0x001c7f, PG_U_OTHER_PUNCTUATION}, + {0x001c80, 0x001c88, PG_U_LOWERCASE_LETTER}, + {0x001c90, 0x001cba, PG_U_UPPERCASE_LETTER}, + {0x001cbd, 0x001cbf, PG_U_UPPERCASE_LETTER}, + {0x001cc0, 0x001cc7, PG_U_OTHER_PUNCTUATION}, + {0x001cd0, 0x001cd2, PG_U_NONSPACING_MARK}, + {0x001cd3, 0x001cd3, PG_U_OTHER_PUNCTUATION}, + {0x001cd4, 0x001ce0, PG_U_NONSPACING_MARK}, + {0x001ce1, 0x001ce1, PG_U_SPACING_MARK}, + {0x001ce2, 0x001ce8, PG_U_NONSPACING_MARK}, + {0x001ce9, 0x001cec, PG_U_OTHER_LETTER}, + {0x001ced, 0x001ced, PG_U_NONSPACING_MARK}, + {0x001cee, 0x001cf3, PG_U_OTHER_LETTER}, + {0x001cf4, 0x001cf4, PG_U_NONSPACING_MARK}, + {0x001cf5, 0x001cf6, PG_U_OTHER_LETTER}, + {0x001cf7, 0x001cf7, PG_U_SPACING_MARK}, + {0x001cf8, 0x001cf9, PG_U_NONSPACING_MARK}, + {0x001cfa, 0x001cfa, PG_U_OTHER_LETTER}, + {0x001d00, 0x001d2b, PG_U_LOWERCASE_LETTER}, + {0x001d2c, 0x001d6a, PG_U_MODIFIER_LETTER}, + {0x001d6b, 0x001d77, PG_U_LOWERCASE_LETTER}, + {0x001d78, 0x001d78, PG_U_MODIFIER_LETTER}, + {0x001d79, 0x001d9a, PG_U_LOWERCASE_LETTER}, + {0x001d9b, 0x001dbf, PG_U_MODIFIER_LETTER}, + {0x001dc0, 0x001dff, PG_U_NONSPACING_MARK}, + {0x001e00, 0x001e00, PG_U_UPPERCASE_LETTER}, + {0x001e01, 0x001e01, PG_U_LOWERCASE_LETTER}, + {0x001e02, 0x001e02, PG_U_UPPERCASE_LETTER}, + {0x001e03, 0x001e03, PG_U_LOWERCASE_LETTER}, + {0x001e04, 0x001e04, PG_U_UPPERCASE_LETTER}, + {0x001e05, 0x001e05, PG_U_LOWERCASE_LETTER}, + {0x001e06, 0x001e06, PG_U_UPPERCASE_LETTER}, + {0x001e07, 0x001e07, PG_U_LOWERCASE_LETTER}, + {0x001e08, 0x001e08, PG_U_UPPERCASE_LETTER}, + {0x001e09, 0x001e09, PG_U_LOWERCASE_LETTER}, + {0x001e0a, 0x001e0a, PG_U_UPPERCASE_LETTER}, + {0x001e0b, 0x001e0b, PG_U_LOWERCASE_LETTER}, + {0x001e0c, 0x001e0c, PG_U_UPPERCASE_LETTER}, + {0x001e0d, 0x001e0d, PG_U_LOWERCASE_LETTER}, + {0x001e0e, 0x001e0e, PG_U_UPPERCASE_LETTER}, + {0x001e0f, 0x001e0f, PG_U_LOWERCASE_LETTER}, + {0x001e10, 0x001e10, PG_U_UPPERCASE_LETTER}, + {0x001e11, 0x001e11, PG_U_LOWERCASE_LETTER}, + {0x001e12, 0x001e12, PG_U_UPPERCASE_LETTER}, + {0x001e13, 0x001e13, PG_U_LOWERCASE_LETTER}, + {0x001e14, 0x001e14, PG_U_UPPERCASE_LETTER}, + {0x001e15, 0x001e15, PG_U_LOWERCASE_LETTER}, + {0x001e16, 0x001e16, PG_U_UPPERCASE_LETTER}, + {0x001e17, 0x001e17, PG_U_LOWERCASE_LETTER}, + {0x001e18, 0x001e18, PG_U_UPPERCASE_LETTER}, + {0x001e19, 0x001e19, PG_U_LOWERCASE_LETTER}, + {0x001e1a, 0x001e1a, PG_U_UPPERCASE_LETTER}, + {0x001e1b, 0x001e1b, PG_U_LOWERCASE_LETTER}, + {0x001e1c, 0x001e1c, PG_U_UPPERCASE_LETTER}, + {0x001e1d, 0x001e1d, PG_U_LOWERCASE_LETTER}, + {0x001e1e, 0x001e1e, PG_U_UPPERCASE_LETTER}, + {0x001e1f, 0x001e1f, PG_U_LOWERCASE_LETTER}, + {0x001e20, 0x001e20, PG_U_UPPERCASE_LETTER}, + {0x001e21, 0x001e21, PG_U_LOWERCASE_LETTER}, + {0x001e22, 0x001e22, PG_U_UPPERCASE_LETTER}, + {0x001e23, 0x001e23, PG_U_LOWERCASE_LETTER}, + {0x001e24, 0x001e24, PG_U_UPPERCASE_LETTER}, + {0x001e25, 0x001e25, PG_U_LOWERCASE_LETTER}, + {0x001e26, 0x001e26, PG_U_UPPERCASE_LETTER}, + {0x001e27, 0x001e27, PG_U_LOWERCASE_LETTER}, + {0x001e28, 0x001e28, PG_U_UPPERCASE_LETTER}, + {0x001e29, 0x001e29, PG_U_LOWERCASE_LETTER}, + {0x001e2a, 0x001e2a, PG_U_UPPERCASE_LETTER}, + {0x001e2b, 0x001e2b, PG_U_LOWERCASE_LETTER}, + {0x001e2c, 0x001e2c, PG_U_UPPERCASE_LETTER}, + {0x001e2d, 0x001e2d, PG_U_LOWERCASE_LETTER}, + {0x001e2e, 0x001e2e, PG_U_UPPERCASE_LETTER}, + {0x001e2f, 0x001e2f, PG_U_LOWERCASE_LETTER}, + {0x001e30, 0x001e30, PG_U_UPPERCASE_LETTER}, + {0x001e31, 0x001e31, PG_U_LOWERCASE_LETTER}, + {0x001e32, 0x001e32, PG_U_UPPERCASE_LETTER}, + {0x001e33, 0x001e33, PG_U_LOWERCASE_LETTER}, + {0x001e34, 0x001e34, PG_U_UPPERCASE_LETTER}, + {0x001e35, 0x001e35, PG_U_LOWERCASE_LETTER}, + {0x001e36, 0x001e36, PG_U_UPPERCASE_LETTER}, + {0x001e37, 0x001e37, PG_U_LOWERCASE_LETTER}, + {0x001e38, 0x001e38, PG_U_UPPERCASE_LETTER}, + {0x001e39, 0x001e39, PG_U_LOWERCASE_LETTER}, + {0x001e3a, 0x001e3a, PG_U_UPPERCASE_LETTER}, + {0x001e3b, 0x001e3b, PG_U_LOWERCASE_LETTER}, + {0x001e3c, 0x001e3c, PG_U_UPPERCASE_LETTER}, + {0x001e3d, 0x001e3d, PG_U_LOWERCASE_LETTER}, + {0x001e3e, 0x001e3e, PG_U_UPPERCASE_LETTER}, + {0x001e3f, 0x001e3f, PG_U_LOWERCASE_LETTER}, + {0x001e40, 0x001e40, PG_U_UPPERCASE_LETTER}, + {0x001e41, 0x001e41, PG_U_LOWERCASE_LETTER}, + {0x001e42, 0x001e42, PG_U_UPPERCASE_LETTER}, + {0x001e43, 0x001e43, PG_U_LOWERCASE_LETTER}, + {0x001e44, 0x001e44, PG_U_UPPERCASE_LETTER}, + {0x001e45, 0x001e45, PG_U_LOWERCASE_LETTER}, + {0x001e46, 0x001e46, PG_U_UPPERCASE_LETTER}, + {0x001e47, 0x001e47, PG_U_LOWERCASE_LETTER}, + {0x001e48, 0x001e48, PG_U_UPPERCASE_LETTER}, + {0x001e49, 0x001e49, PG_U_LOWERCASE_LETTER}, + {0x001e4a, 0x001e4a, PG_U_UPPERCASE_LETTER}, + {0x001e4b, 0x001e4b, PG_U_LOWERCASE_LETTER}, + {0x001e4c, 0x001e4c, PG_U_UPPERCASE_LETTER}, + {0x001e4d, 0x001e4d, PG_U_LOWERCASE_LETTER}, + {0x001e4e, 0x001e4e, PG_U_UPPERCASE_LETTER}, + {0x001e4f, 0x001e4f, PG_U_LOWERCASE_LETTER}, + {0x001e50, 0x001e50, PG_U_UPPERCASE_LETTER}, + {0x001e51, 0x001e51, PG_U_LOWERCASE_LETTER}, + {0x001e52, 0x001e52, PG_U_UPPERCASE_LETTER}, + {0x001e53, 0x001e53, PG_U_LOWERCASE_LETTER}, + {0x001e54, 0x001e54, PG_U_UPPERCASE_LETTER}, + {0x001e55, 0x001e55, PG_U_LOWERCASE_LETTER}, + {0x001e56, 0x001e56, PG_U_UPPERCASE_LETTER}, + {0x001e57, 0x001e57, PG_U_LOWERCASE_LETTER}, + {0x001e58, 0x001e58, PG_U_UPPERCASE_LETTER}, + {0x001e59, 0x001e59, PG_U_LOWERCASE_LETTER}, + {0x001e5a, 0x001e5a, PG_U_UPPERCASE_LETTER}, + {0x001e5b, 0x001e5b, PG_U_LOWERCASE_LETTER}, + {0x001e5c, 0x001e5c, PG_U_UPPERCASE_LETTER}, + {0x001e5d, 0x001e5d, PG_U_LOWERCASE_LETTER}, + {0x001e5e, 0x001e5e, PG_U_UPPERCASE_LETTER}, + {0x001e5f, 0x001e5f, PG_U_LOWERCASE_LETTER}, + {0x001e60, 0x001e60, PG_U_UPPERCASE_LETTER}, + {0x001e61, 0x001e61, PG_U_LOWERCASE_LETTER}, + {0x001e62, 0x001e62, PG_U_UPPERCASE_LETTER}, + {0x001e63, 0x001e63, PG_U_LOWERCASE_LETTER}, + {0x001e64, 0x001e64, PG_U_UPPERCASE_LETTER}, + {0x001e65, 0x001e65, PG_U_LOWERCASE_LETTER}, + {0x001e66, 0x001e66, PG_U_UPPERCASE_LETTER}, + {0x001e67, 0x001e67, PG_U_LOWERCASE_LETTER}, + {0x001e68, 0x001e68, PG_U_UPPERCASE_LETTER}, + {0x001e69, 0x001e69, PG_U_LOWERCASE_LETTER}, + {0x001e6a, 0x001e6a, PG_U_UPPERCASE_LETTER}, + {0x001e6b, 0x001e6b, PG_U_LOWERCASE_LETTER}, + {0x001e6c, 0x001e6c, PG_U_UPPERCASE_LETTER}, + {0x001e6d, 0x001e6d, PG_U_LOWERCASE_LETTER}, + {0x001e6e, 0x001e6e, PG_U_UPPERCASE_LETTER}, + {0x001e6f, 0x001e6f, PG_U_LOWERCASE_LETTER}, + {0x001e70, 0x001e70, PG_U_UPPERCASE_LETTER}, + {0x001e71, 0x001e71, PG_U_LOWERCASE_LETTER}, + {0x001e72, 0x001e72, PG_U_UPPERCASE_LETTER}, + {0x001e73, 0x001e73, PG_U_LOWERCASE_LETTER}, + {0x001e74, 0x001e74, PG_U_UPPERCASE_LETTER}, + {0x001e75, 0x001e75, PG_U_LOWERCASE_LETTER}, + {0x001e76, 0x001e76, PG_U_UPPERCASE_LETTER}, + {0x001e77, 0x001e77, PG_U_LOWERCASE_LETTER}, + {0x001e78, 0x001e78, PG_U_UPPERCASE_LETTER}, + {0x001e79, 0x001e79, PG_U_LOWERCASE_LETTER}, + {0x001e7a, 0x001e7a, PG_U_UPPERCASE_LETTER}, + {0x001e7b, 0x001e7b, PG_U_LOWERCASE_LETTER}, + {0x001e7c, 0x001e7c, PG_U_UPPERCASE_LETTER}, + {0x001e7d, 0x001e7d, PG_U_LOWERCASE_LETTER}, + {0x001e7e, 0x001e7e, PG_U_UPPERCASE_LETTER}, + {0x001e7f, 0x001e7f, PG_U_LOWERCASE_LETTER}, + {0x001e80, 0x001e80, PG_U_UPPERCASE_LETTER}, + {0x001e81, 0x001e81, PG_U_LOWERCASE_LETTER}, + {0x001e82, 0x001e82, PG_U_UPPERCASE_LETTER}, + {0x001e83, 0x001e83, PG_U_LOWERCASE_LETTER}, + {0x001e84, 0x001e84, PG_U_UPPERCASE_LETTER}, + {0x001e85, 0x001e85, PG_U_LOWERCASE_LETTER}, + {0x001e86, 0x001e86, PG_U_UPPERCASE_LETTER}, + {0x001e87, 0x001e87, PG_U_LOWERCASE_LETTER}, + {0x001e88, 0x001e88, PG_U_UPPERCASE_LETTER}, + {0x001e89, 0x001e89, PG_U_LOWERCASE_LETTER}, + {0x001e8a, 0x001e8a, PG_U_UPPERCASE_LETTER}, + {0x001e8b, 0x001e8b, PG_U_LOWERCASE_LETTER}, + {0x001e8c, 0x001e8c, PG_U_UPPERCASE_LETTER}, + {0x001e8d, 0x001e8d, PG_U_LOWERCASE_LETTER}, + {0x001e8e, 0x001e8e, PG_U_UPPERCASE_LETTER}, + {0x001e8f, 0x001e8f, PG_U_LOWERCASE_LETTER}, + {0x001e90, 0x001e90, PG_U_UPPERCASE_LETTER}, + {0x001e91, 0x001e91, PG_U_LOWERCASE_LETTER}, + {0x001e92, 0x001e92, PG_U_UPPERCASE_LETTER}, + {0x001e93, 0x001e93, PG_U_LOWERCASE_LETTER}, + {0x001e94, 0x001e94, PG_U_UPPERCASE_LETTER}, + {0x001e95, 0x001e9d, PG_U_LOWERCASE_LETTER}, + {0x001e9e, 0x001e9e, PG_U_UPPERCASE_LETTER}, + {0x001e9f, 0x001e9f, PG_U_LOWERCASE_LETTER}, + {0x001ea0, 0x001ea0, PG_U_UPPERCASE_LETTER}, + {0x001ea1, 0x001ea1, PG_U_LOWERCASE_LETTER}, + {0x001ea2, 0x001ea2, PG_U_UPPERCASE_LETTER}, + {0x001ea3, 0x001ea3, PG_U_LOWERCASE_LETTER}, + {0x001ea4, 0x001ea4, PG_U_UPPERCASE_LETTER}, + {0x001ea5, 0x001ea5, PG_U_LOWERCASE_LETTER}, + {0x001ea6, 0x001ea6, PG_U_UPPERCASE_LETTER}, + {0x001ea7, 0x001ea7, PG_U_LOWERCASE_LETTER}, + {0x001ea8, 0x001ea8, PG_U_UPPERCASE_LETTER}, + {0x001ea9, 0x001ea9, PG_U_LOWERCASE_LETTER}, + {0x001eaa, 0x001eaa, PG_U_UPPERCASE_LETTER}, + {0x001eab, 0x001eab, PG_U_LOWERCASE_LETTER}, + {0x001eac, 0x001eac, PG_U_UPPERCASE_LETTER}, + {0x001ead, 0x001ead, PG_U_LOWERCASE_LETTER}, + {0x001eae, 0x001eae, PG_U_UPPERCASE_LETTER}, + {0x001eaf, 0x001eaf, PG_U_LOWERCASE_LETTER}, + {0x001eb0, 0x001eb0, PG_U_UPPERCASE_LETTER}, + {0x001eb1, 0x001eb1, PG_U_LOWERCASE_LETTER}, + {0x001eb2, 0x001eb2, PG_U_UPPERCASE_LETTER}, + {0x001eb3, 0x001eb3, PG_U_LOWERCASE_LETTER}, + {0x001eb4, 0x001eb4, PG_U_UPPERCASE_LETTER}, + {0x001eb5, 0x001eb5, PG_U_LOWERCASE_LETTER}, + {0x001eb6, 0x001eb6, PG_U_UPPERCASE_LETTER}, + {0x001eb7, 0x001eb7, PG_U_LOWERCASE_LETTER}, + {0x001eb8, 0x001eb8, PG_U_UPPERCASE_LETTER}, + {0x001eb9, 0x001eb9, PG_U_LOWERCASE_LETTER}, + {0x001eba, 0x001eba, PG_U_UPPERCASE_LETTER}, + {0x001ebb, 0x001ebb, PG_U_LOWERCASE_LETTER}, + {0x001ebc, 0x001ebc, PG_U_UPPERCASE_LETTER}, + {0x001ebd, 0x001ebd, PG_U_LOWERCASE_LETTER}, + {0x001ebe, 0x001ebe, PG_U_UPPERCASE_LETTER}, + {0x001ebf, 0x001ebf, PG_U_LOWERCASE_LETTER}, + {0x001ec0, 0x001ec0, PG_U_UPPERCASE_LETTER}, + {0x001ec1, 0x001ec1, PG_U_LOWERCASE_LETTER}, + {0x001ec2, 0x001ec2, PG_U_UPPERCASE_LETTER}, + {0x001ec3, 0x001ec3, PG_U_LOWERCASE_LETTER}, + {0x001ec4, 0x001ec4, PG_U_UPPERCASE_LETTER}, + {0x001ec5, 0x001ec5, PG_U_LOWERCASE_LETTER}, + {0x001ec6, 0x001ec6, PG_U_UPPERCASE_LETTER}, + {0x001ec7, 0x001ec7, PG_U_LOWERCASE_LETTER}, + {0x001ec8, 0x001ec8, PG_U_UPPERCASE_LETTER}, + {0x001ec9, 0x001ec9, PG_U_LOWERCASE_LETTER}, + {0x001eca, 0x001eca, PG_U_UPPERCASE_LETTER}, + {0x001ecb, 0x001ecb, PG_U_LOWERCASE_LETTER}, + {0x001ecc, 0x001ecc, PG_U_UPPERCASE_LETTER}, + {0x001ecd, 0x001ecd, PG_U_LOWERCASE_LETTER}, + {0x001ece, 0x001ece, PG_U_UPPERCASE_LETTER}, + {0x001ecf, 0x001ecf, PG_U_LOWERCASE_LETTER}, + {0x001ed0, 0x001ed0, PG_U_UPPERCASE_LETTER}, + {0x001ed1, 0x001ed1, PG_U_LOWERCASE_LETTER}, + {0x001ed2, 0x001ed2, PG_U_UPPERCASE_LETTER}, + {0x001ed3, 0x001ed3, PG_U_LOWERCASE_LETTER}, + {0x001ed4, 0x001ed4, PG_U_UPPERCASE_LETTER}, + {0x001ed5, 0x001ed5, PG_U_LOWERCASE_LETTER}, + {0x001ed6, 0x001ed6, PG_U_UPPERCASE_LETTER}, + {0x001ed7, 0x001ed7, PG_U_LOWERCASE_LETTER}, + {0x001ed8, 0x001ed8, PG_U_UPPERCASE_LETTER}, + {0x001ed9, 0x001ed9, PG_U_LOWERCASE_LETTER}, + {0x001eda, 0x001eda, PG_U_UPPERCASE_LETTER}, + {0x001edb, 0x001edb, PG_U_LOWERCASE_LETTER}, + {0x001edc, 0x001edc, PG_U_UPPERCASE_LETTER}, + {0x001edd, 0x001edd, PG_U_LOWERCASE_LETTER}, + {0x001ede, 0x001ede, PG_U_UPPERCASE_LETTER}, + {0x001edf, 0x001edf, PG_U_LOWERCASE_LETTER}, + {0x001ee0, 0x001ee0, PG_U_UPPERCASE_LETTER}, + {0x001ee1, 0x001ee1, PG_U_LOWERCASE_LETTER}, + {0x001ee2, 0x001ee2, PG_U_UPPERCASE_LETTER}, + {0x001ee3, 0x001ee3, PG_U_LOWERCASE_LETTER}, + {0x001ee4, 0x001ee4, PG_U_UPPERCASE_LETTER}, + {0x001ee5, 0x001ee5, PG_U_LOWERCASE_LETTER}, + {0x001ee6, 0x001ee6, PG_U_UPPERCASE_LETTER}, + {0x001ee7, 0x001ee7, PG_U_LOWERCASE_LETTER}, + {0x001ee8, 0x001ee8, PG_U_UPPERCASE_LETTER}, + {0x001ee9, 0x001ee9, PG_U_LOWERCASE_LETTER}, + {0x001eea, 0x001eea, PG_U_UPPERCASE_LETTER}, + {0x001eeb, 0x001eeb, PG_U_LOWERCASE_LETTER}, + {0x001eec, 0x001eec, PG_U_UPPERCASE_LETTER}, + {0x001eed, 0x001eed, PG_U_LOWERCASE_LETTER}, + {0x001eee, 0x001eee, PG_U_UPPERCASE_LETTER}, + {0x001eef, 0x001eef, PG_U_LOWERCASE_LETTER}, + {0x001ef0, 0x001ef0, PG_U_UPPERCASE_LETTER}, + {0x001ef1, 0x001ef1, PG_U_LOWERCASE_LETTER}, + {0x001ef2, 0x001ef2, PG_U_UPPERCASE_LETTER}, + {0x001ef3, 0x001ef3, PG_U_LOWERCASE_LETTER}, + {0x001ef4, 0x001ef4, PG_U_UPPERCASE_LETTER}, + {0x001ef5, 0x001ef5, PG_U_LOWERCASE_LETTER}, + {0x001ef6, 0x001ef6, PG_U_UPPERCASE_LETTER}, + {0x001ef7, 0x001ef7, PG_U_LOWERCASE_LETTER}, + {0x001ef8, 0x001ef8, PG_U_UPPERCASE_LETTER}, + {0x001ef9, 0x001ef9, PG_U_LOWERCASE_LETTER}, + {0x001efa, 0x001efa, PG_U_UPPERCASE_LETTER}, + {0x001efb, 0x001efb, PG_U_LOWERCASE_LETTER}, + {0x001efc, 0x001efc, PG_U_UPPERCASE_LETTER}, + {0x001efd, 0x001efd, PG_U_LOWERCASE_LETTER}, + {0x001efe, 0x001efe, PG_U_UPPERCASE_LETTER}, + {0x001eff, 0x001f07, PG_U_LOWERCASE_LETTER}, + {0x001f08, 0x001f0f, PG_U_UPPERCASE_LETTER}, + {0x001f10, 0x001f15, PG_U_LOWERCASE_LETTER}, + {0x001f18, 0x001f1d, PG_U_UPPERCASE_LETTER}, + {0x001f20, 0x001f27, PG_U_LOWERCASE_LETTER}, + {0x001f28, 0x001f2f, PG_U_UPPERCASE_LETTER}, + {0x001f30, 0x001f37, PG_U_LOWERCASE_LETTER}, + {0x001f38, 0x001f3f, PG_U_UPPERCASE_LETTER}, + {0x001f40, 0x001f45, PG_U_LOWERCASE_LETTER}, + {0x001f48, 0x001f4d, PG_U_UPPERCASE_LETTER}, + {0x001f50, 0x001f57, PG_U_LOWERCASE_LETTER}, + {0x001f59, 0x001f59, PG_U_UPPERCASE_LETTER}, + {0x001f5b, 0x001f5b, PG_U_UPPERCASE_LETTER}, + {0x001f5d, 0x001f5d, PG_U_UPPERCASE_LETTER}, + {0x001f5f, 0x001f5f, PG_U_UPPERCASE_LETTER}, + {0x001f60, 0x001f67, PG_U_LOWERCASE_LETTER}, + {0x001f68, 0x001f6f, PG_U_UPPERCASE_LETTER}, + {0x001f70, 0x001f7d, PG_U_LOWERCASE_LETTER}, + {0x001f80, 0x001f87, PG_U_LOWERCASE_LETTER}, + {0x001f88, 0x001f8f, PG_U_TITLECASE_LETTER}, + {0x001f90, 0x001f97, PG_U_LOWERCASE_LETTER}, + {0x001f98, 0x001f9f, PG_U_TITLECASE_LETTER}, + {0x001fa0, 0x001fa7, PG_U_LOWERCASE_LETTER}, + {0x001fa8, 0x001faf, PG_U_TITLECASE_LETTER}, + {0x001fb0, 0x001fb4, PG_U_LOWERCASE_LETTER}, + {0x001fb6, 0x001fb7, PG_U_LOWERCASE_LETTER}, + {0x001fb8, 0x001fbb, PG_U_UPPERCASE_LETTER}, + {0x001fbc, 0x001fbc, PG_U_TITLECASE_LETTER}, + {0x001fbd, 0x001fbd, PG_U_MODIFIER_SYMBOL}, + {0x001fbe, 0x001fbe, PG_U_LOWERCASE_LETTER}, + {0x001fbf, 0x001fc1, PG_U_MODIFIER_SYMBOL}, + {0x001fc2, 0x001fc4, PG_U_LOWERCASE_LETTER}, + {0x001fc6, 0x001fc7, PG_U_LOWERCASE_LETTER}, + {0x001fc8, 0x001fcb, PG_U_UPPERCASE_LETTER}, + {0x001fcc, 0x001fcc, PG_U_TITLECASE_LETTER}, + {0x001fcd, 0x001fcf, PG_U_MODIFIER_SYMBOL}, + {0x001fd0, 0x001fd3, PG_U_LOWERCASE_LETTER}, + {0x001fd6, 0x001fd7, PG_U_LOWERCASE_LETTER}, + {0x001fd8, 0x001fdb, PG_U_UPPERCASE_LETTER}, + {0x001fdd, 0x001fdf, PG_U_MODIFIER_SYMBOL}, + {0x001fe0, 0x001fe7, PG_U_LOWERCASE_LETTER}, + {0x001fe8, 0x001fec, PG_U_UPPERCASE_LETTER}, + {0x001fed, 0x001fef, PG_U_MODIFIER_SYMBOL}, + {0x001ff2, 0x001ff4, PG_U_LOWERCASE_LETTER}, + {0x001ff6, 0x001ff7, PG_U_LOWERCASE_LETTER}, + {0x001ff8, 0x001ffb, PG_U_UPPERCASE_LETTER}, + {0x001ffc, 0x001ffc, PG_U_TITLECASE_LETTER}, + {0x001ffd, 0x001ffe, PG_U_MODIFIER_SYMBOL}, + {0x002000, 0x00200a, PG_U_SPACE_SEPARATOR}, + {0x00200b, 0x00200f, PG_U_FORMAT}, + {0x002010, 0x002015, PG_U_DASH_PUNCTUATION}, + {0x002016, 0x002017, PG_U_OTHER_PUNCTUATION}, + {0x002018, 0x002018, PG_U_INITIAL_PUNCTUATION}, + {0x002019, 0x002019, PG_U_FINAL_PUNCTUATION}, + {0x00201a, 0x00201a, PG_U_OPEN_PUNCTUATION}, + {0x00201b, 0x00201c, PG_U_INITIAL_PUNCTUATION}, + {0x00201d, 0x00201d, PG_U_FINAL_PUNCTUATION}, + {0x00201e, 0x00201e, PG_U_OPEN_PUNCTUATION}, + {0x00201f, 0x00201f, PG_U_INITIAL_PUNCTUATION}, + {0x002020, 0x002027, PG_U_OTHER_PUNCTUATION}, + {0x002028, 0x002028, PG_U_LINE_SEPARATOR}, + {0x002029, 0x002029, PG_U_PARAGRAPH_SEPARATOR}, + {0x00202a, 0x00202e, PG_U_FORMAT}, + {0x00202f, 0x00202f, PG_U_SPACE_SEPARATOR}, + {0x002030, 0x002038, PG_U_OTHER_PUNCTUATION}, + {0x002039, 0x002039, PG_U_INITIAL_PUNCTUATION}, + {0x00203a, 0x00203a, PG_U_FINAL_PUNCTUATION}, + {0x00203b, 0x00203e, PG_U_OTHER_PUNCTUATION}, + {0x00203f, 0x002040, PG_U_CONNECTOR_PUNCTUATION}, + {0x002041, 0x002043, PG_U_OTHER_PUNCTUATION}, + {0x002044, 0x002044, PG_U_MATH_SYMBOL}, + {0x002045, 0x002045, PG_U_OPEN_PUNCTUATION}, + {0x002046, 0x002046, PG_U_CLOSE_PUNCTUATION}, + {0x002047, 0x002051, PG_U_OTHER_PUNCTUATION}, + {0x002052, 0x002052, PG_U_MATH_SYMBOL}, + {0x002053, 0x002053, PG_U_OTHER_PUNCTUATION}, + {0x002054, 0x002054, PG_U_CONNECTOR_PUNCTUATION}, + {0x002055, 0x00205e, PG_U_OTHER_PUNCTUATION}, + {0x00205f, 0x00205f, PG_U_SPACE_SEPARATOR}, + {0x002060, 0x002064, PG_U_FORMAT}, + {0x002066, 0x00206f, PG_U_FORMAT}, + {0x002070, 0x002070, PG_U_OTHER_NUMBER}, + {0x002071, 0x002071, PG_U_MODIFIER_LETTER}, + {0x002074, 0x002079, PG_U_OTHER_NUMBER}, + {0x00207a, 0x00207c, PG_U_MATH_SYMBOL}, + {0x00207d, 0x00207d, PG_U_OPEN_PUNCTUATION}, + {0x00207e, 0x00207e, PG_U_CLOSE_PUNCTUATION}, + {0x00207f, 0x00207f, PG_U_MODIFIER_LETTER}, + {0x002080, 0x002089, PG_U_OTHER_NUMBER}, + {0x00208a, 0x00208c, PG_U_MATH_SYMBOL}, + {0x00208d, 0x00208d, PG_U_OPEN_PUNCTUATION}, + {0x00208e, 0x00208e, PG_U_CLOSE_PUNCTUATION}, + {0x002090, 0x00209c, PG_U_MODIFIER_LETTER}, + {0x0020a0, 0x0020c0, PG_U_CURRENCY_SYMBOL}, + {0x0020d0, 0x0020dc, PG_U_NONSPACING_MARK}, + {0x0020dd, 0x0020e0, PG_U_ENCLOSING_MARK}, + {0x0020e1, 0x0020e1, PG_U_NONSPACING_MARK}, + {0x0020e2, 0x0020e4, PG_U_ENCLOSING_MARK}, + {0x0020e5, 0x0020f0, PG_U_NONSPACING_MARK}, + {0x002100, 0x002101, PG_U_OTHER_SYMBOL}, + {0x002102, 0x002102, PG_U_UPPERCASE_LETTER}, + {0x002103, 0x002106, PG_U_OTHER_SYMBOL}, + {0x002107, 0x002107, PG_U_UPPERCASE_LETTER}, + {0x002108, 0x002109, PG_U_OTHER_SYMBOL}, + {0x00210a, 0x00210a, PG_U_LOWERCASE_LETTER}, + {0x00210b, 0x00210d, PG_U_UPPERCASE_LETTER}, + {0x00210e, 0x00210f, PG_U_LOWERCASE_LETTER}, + {0x002110, 0x002112, PG_U_UPPERCASE_LETTER}, + {0x002113, 0x002113, PG_U_LOWERCASE_LETTER}, + {0x002114, 0x002114, PG_U_OTHER_SYMBOL}, + {0x002115, 0x002115, PG_U_UPPERCASE_LETTER}, + {0x002116, 0x002117, PG_U_OTHER_SYMBOL}, + {0x002118, 0x002118, PG_U_MATH_SYMBOL}, + {0x002119, 0x00211d, PG_U_UPPERCASE_LETTER}, + {0x00211e, 0x002123, PG_U_OTHER_SYMBOL}, + {0x002124, 0x002124, PG_U_UPPERCASE_LETTER}, + {0x002125, 0x002125, PG_U_OTHER_SYMBOL}, + {0x002126, 0x002126, PG_U_UPPERCASE_LETTER}, + {0x002127, 0x002127, PG_U_OTHER_SYMBOL}, + {0x002128, 0x002128, PG_U_UPPERCASE_LETTER}, + {0x002129, 0x002129, PG_U_OTHER_SYMBOL}, + {0x00212a, 0x00212d, PG_U_UPPERCASE_LETTER}, + {0x00212e, 0x00212e, PG_U_OTHER_SYMBOL}, + {0x00212f, 0x00212f, PG_U_LOWERCASE_LETTER}, + {0x002130, 0x002133, PG_U_UPPERCASE_LETTER}, + {0x002134, 0x002134, PG_U_LOWERCASE_LETTER}, + {0x002135, 0x002138, PG_U_OTHER_LETTER}, + {0x002139, 0x002139, PG_U_LOWERCASE_LETTER}, + {0x00213a, 0x00213b, PG_U_OTHER_SYMBOL}, + {0x00213c, 0x00213d, PG_U_LOWERCASE_LETTER}, + {0x00213e, 0x00213f, PG_U_UPPERCASE_LETTER}, + {0x002140, 0x002144, PG_U_MATH_SYMBOL}, + {0x002145, 0x002145, PG_U_UPPERCASE_LETTER}, + {0x002146, 0x002149, PG_U_LOWERCASE_LETTER}, + {0x00214a, 0x00214a, PG_U_OTHER_SYMBOL}, + {0x00214b, 0x00214b, PG_U_MATH_SYMBOL}, + {0x00214c, 0x00214d, PG_U_OTHER_SYMBOL}, + {0x00214e, 0x00214e, PG_U_LOWERCASE_LETTER}, + {0x00214f, 0x00214f, PG_U_OTHER_SYMBOL}, + {0x002150, 0x00215f, PG_U_OTHER_NUMBER}, + {0x002160, 0x002182, PG_U_LETTER_NUMBER}, + {0x002183, 0x002183, PG_U_UPPERCASE_LETTER}, + {0x002184, 0x002184, PG_U_LOWERCASE_LETTER}, + {0x002185, 0x002188, PG_U_LETTER_NUMBER}, + {0x002189, 0x002189, PG_U_OTHER_NUMBER}, + {0x00218a, 0x00218b, PG_U_OTHER_SYMBOL}, + {0x002190, 0x002194, PG_U_MATH_SYMBOL}, + {0x002195, 0x002199, PG_U_OTHER_SYMBOL}, + {0x00219a, 0x00219b, PG_U_MATH_SYMBOL}, + {0x00219c, 0x00219f, PG_U_OTHER_SYMBOL}, + {0x0021a0, 0x0021a0, PG_U_MATH_SYMBOL}, + {0x0021a1, 0x0021a2, PG_U_OTHER_SYMBOL}, + {0x0021a3, 0x0021a3, PG_U_MATH_SYMBOL}, + {0x0021a4, 0x0021a5, PG_U_OTHER_SYMBOL}, + {0x0021a6, 0x0021a6, PG_U_MATH_SYMBOL}, + {0x0021a7, 0x0021ad, PG_U_OTHER_SYMBOL}, + {0x0021ae, 0x0021ae, PG_U_MATH_SYMBOL}, + {0x0021af, 0x0021cd, PG_U_OTHER_SYMBOL}, + {0x0021ce, 0x0021cf, PG_U_MATH_SYMBOL}, + {0x0021d0, 0x0021d1, PG_U_OTHER_SYMBOL}, + {0x0021d2, 0x0021d2, PG_U_MATH_SYMBOL}, + {0x0021d3, 0x0021d3, PG_U_OTHER_SYMBOL}, + {0x0021d4, 0x0021d4, PG_U_MATH_SYMBOL}, + {0x0021d5, 0x0021f3, PG_U_OTHER_SYMBOL}, + {0x0021f4, 0x0022ff, PG_U_MATH_SYMBOL}, + {0x002300, 0x002307, PG_U_OTHER_SYMBOL}, + {0x002308, 0x002308, PG_U_OPEN_PUNCTUATION}, + {0x002309, 0x002309, PG_U_CLOSE_PUNCTUATION}, + {0x00230a, 0x00230a, PG_U_OPEN_PUNCTUATION}, + {0x00230b, 0x00230b, PG_U_CLOSE_PUNCTUATION}, + {0x00230c, 0x00231f, PG_U_OTHER_SYMBOL}, + {0x002320, 0x002321, PG_U_MATH_SYMBOL}, + {0x002322, 0x002328, PG_U_OTHER_SYMBOL}, + {0x002329, 0x002329, PG_U_OPEN_PUNCTUATION}, + {0x00232a, 0x00232a, PG_U_CLOSE_PUNCTUATION}, + {0x00232b, 0x00237b, PG_U_OTHER_SYMBOL}, + {0x00237c, 0x00237c, PG_U_MATH_SYMBOL}, + {0x00237d, 0x00239a, PG_U_OTHER_SYMBOL}, + {0x00239b, 0x0023b3, PG_U_MATH_SYMBOL}, + {0x0023b4, 0x0023db, PG_U_OTHER_SYMBOL}, + {0x0023dc, 0x0023e1, PG_U_MATH_SYMBOL}, + {0x0023e2, 0x002426, PG_U_OTHER_SYMBOL}, + {0x002440, 0x00244a, PG_U_OTHER_SYMBOL}, + {0x002460, 0x00249b, PG_U_OTHER_NUMBER}, + {0x00249c, 0x0024e9, PG_U_OTHER_SYMBOL}, + {0x0024ea, 0x0024ff, PG_U_OTHER_NUMBER}, + {0x002500, 0x0025b6, PG_U_OTHER_SYMBOL}, + {0x0025b7, 0x0025b7, PG_U_MATH_SYMBOL}, + {0x0025b8, 0x0025c0, PG_U_OTHER_SYMBOL}, + {0x0025c1, 0x0025c1, PG_U_MATH_SYMBOL}, + {0x0025c2, 0x0025f7, PG_U_OTHER_SYMBOL}, + {0x0025f8, 0x0025ff, PG_U_MATH_SYMBOL}, + {0x002600, 0x00266e, PG_U_OTHER_SYMBOL}, + {0x00266f, 0x00266f, PG_U_MATH_SYMBOL}, + {0x002670, 0x002767, PG_U_OTHER_SYMBOL}, + {0x002768, 0x002768, PG_U_OPEN_PUNCTUATION}, + {0x002769, 0x002769, PG_U_CLOSE_PUNCTUATION}, + {0x00276a, 0x00276a, PG_U_OPEN_PUNCTUATION}, + {0x00276b, 0x00276b, PG_U_CLOSE_PUNCTUATION}, + {0x00276c, 0x00276c, PG_U_OPEN_PUNCTUATION}, + {0x00276d, 0x00276d, PG_U_CLOSE_PUNCTUATION}, + {0x00276e, 0x00276e, PG_U_OPEN_PUNCTUATION}, + {0x00276f, 0x00276f, PG_U_CLOSE_PUNCTUATION}, + {0x002770, 0x002770, PG_U_OPEN_PUNCTUATION}, + {0x002771, 0x002771, PG_U_CLOSE_PUNCTUATION}, + {0x002772, 0x002772, PG_U_OPEN_PUNCTUATION}, + {0x002773, 0x002773, PG_U_CLOSE_PUNCTUATION}, + {0x002774, 0x002774, PG_U_OPEN_PUNCTUATION}, + {0x002775, 0x002775, PG_U_CLOSE_PUNCTUATION}, + {0x002776, 0x002793, PG_U_OTHER_NUMBER}, + {0x002794, 0x0027bf, PG_U_OTHER_SYMBOL}, + {0x0027c0, 0x0027c4, PG_U_MATH_SYMBOL}, + {0x0027c5, 0x0027c5, PG_U_OPEN_PUNCTUATION}, + {0x0027c6, 0x0027c6, PG_U_CLOSE_PUNCTUATION}, + {0x0027c7, 0x0027e5, PG_U_MATH_SYMBOL}, + {0x0027e6, 0x0027e6, PG_U_OPEN_PUNCTUATION}, + {0x0027e7, 0x0027e7, PG_U_CLOSE_PUNCTUATION}, + {0x0027e8, 0x0027e8, PG_U_OPEN_PUNCTUATION}, + {0x0027e9, 0x0027e9, PG_U_CLOSE_PUNCTUATION}, + {0x0027ea, 0x0027ea, PG_U_OPEN_PUNCTUATION}, + {0x0027eb, 0x0027eb, PG_U_CLOSE_PUNCTUATION}, + {0x0027ec, 0x0027ec, PG_U_OPEN_PUNCTUATION}, + {0x0027ed, 0x0027ed, PG_U_CLOSE_PUNCTUATION}, + {0x0027ee, 0x0027ee, PG_U_OPEN_PUNCTUATION}, + {0x0027ef, 0x0027ef, PG_U_CLOSE_PUNCTUATION}, + {0x0027f0, 0x0027ff, PG_U_MATH_SYMBOL}, + {0x002800, 0x0028ff, PG_U_OTHER_SYMBOL}, + {0x002900, 0x002982, PG_U_MATH_SYMBOL}, + {0x002983, 0x002983, PG_U_OPEN_PUNCTUATION}, + {0x002984, 0x002984, PG_U_CLOSE_PUNCTUATION}, + {0x002985, 0x002985, PG_U_OPEN_PUNCTUATION}, + {0x002986, 0x002986, PG_U_CLOSE_PUNCTUATION}, + {0x002987, 0x002987, PG_U_OPEN_PUNCTUATION}, + {0x002988, 0x002988, PG_U_CLOSE_PUNCTUATION}, + {0x002989, 0x002989, PG_U_OPEN_PUNCTUATION}, + {0x00298a, 0x00298a, PG_U_CLOSE_PUNCTUATION}, + {0x00298b, 0x00298b, PG_U_OPEN_PUNCTUATION}, + {0x00298c, 0x00298c, PG_U_CLOSE_PUNCTUATION}, + {0x00298d, 0x00298d, PG_U_OPEN_PUNCTUATION}, + {0x00298e, 0x00298e, PG_U_CLOSE_PUNCTUATION}, + {0x00298f, 0x00298f, PG_U_OPEN_PUNCTUATION}, + {0x002990, 0x002990, PG_U_CLOSE_PUNCTUATION}, + {0x002991, 0x002991, PG_U_OPEN_PUNCTUATION}, + {0x002992, 0x002992, PG_U_CLOSE_PUNCTUATION}, + {0x002993, 0x002993, PG_U_OPEN_PUNCTUATION}, + {0x002994, 0x002994, PG_U_CLOSE_PUNCTUATION}, + {0x002995, 0x002995, PG_U_OPEN_PUNCTUATION}, + {0x002996, 0x002996, PG_U_CLOSE_PUNCTUATION}, + {0x002997, 0x002997, PG_U_OPEN_PUNCTUATION}, + {0x002998, 0x002998, PG_U_CLOSE_PUNCTUATION}, + {0x002999, 0x0029d7, PG_U_MATH_SYMBOL}, + {0x0029d8, 0x0029d8, PG_U_OPEN_PUNCTUATION}, + {0x0029d9, 0x0029d9, PG_U_CLOSE_PUNCTUATION}, + {0x0029da, 0x0029da, PG_U_OPEN_PUNCTUATION}, + {0x0029db, 0x0029db, PG_U_CLOSE_PUNCTUATION}, + {0x0029dc, 0x0029fb, PG_U_MATH_SYMBOL}, + {0x0029fc, 0x0029fc, PG_U_OPEN_PUNCTUATION}, + {0x0029fd, 0x0029fd, PG_U_CLOSE_PUNCTUATION}, + {0x0029fe, 0x002aff, PG_U_MATH_SYMBOL}, + {0x002b00, 0x002b2f, PG_U_OTHER_SYMBOL}, + {0x002b30, 0x002b44, PG_U_MATH_SYMBOL}, + {0x002b45, 0x002b46, PG_U_OTHER_SYMBOL}, + {0x002b47, 0x002b4c, PG_U_MATH_SYMBOL}, + {0x002b4d, 0x002b73, PG_U_OTHER_SYMBOL}, + {0x002b76, 0x002b95, PG_U_OTHER_SYMBOL}, + {0x002b97, 0x002bff, PG_U_OTHER_SYMBOL}, + {0x002c00, 0x002c2f, PG_U_UPPERCASE_LETTER}, + {0x002c30, 0x002c5f, PG_U_LOWERCASE_LETTER}, + {0x002c60, 0x002c60, PG_U_UPPERCASE_LETTER}, + {0x002c61, 0x002c61, PG_U_LOWERCASE_LETTER}, + {0x002c62, 0x002c64, PG_U_UPPERCASE_LETTER}, + {0x002c65, 0x002c66, PG_U_LOWERCASE_LETTER}, + {0x002c67, 0x002c67, PG_U_UPPERCASE_LETTER}, + {0x002c68, 0x002c68, PG_U_LOWERCASE_LETTER}, + {0x002c69, 0x002c69, PG_U_UPPERCASE_LETTER}, + {0x002c6a, 0x002c6a, PG_U_LOWERCASE_LETTER}, + {0x002c6b, 0x002c6b, PG_U_UPPERCASE_LETTER}, + {0x002c6c, 0x002c6c, PG_U_LOWERCASE_LETTER}, + {0x002c6d, 0x002c70, PG_U_UPPERCASE_LETTER}, + {0x002c71, 0x002c71, PG_U_LOWERCASE_LETTER}, + {0x002c72, 0x002c72, PG_U_UPPERCASE_LETTER}, + {0x002c73, 0x002c74, PG_U_LOWERCASE_LETTER}, + {0x002c75, 0x002c75, PG_U_UPPERCASE_LETTER}, + {0x002c76, 0x002c7b, PG_U_LOWERCASE_LETTER}, + {0x002c7c, 0x002c7d, PG_U_MODIFIER_LETTER}, + {0x002c7e, 0x002c80, PG_U_UPPERCASE_LETTER}, + {0x002c81, 0x002c81, PG_U_LOWERCASE_LETTER}, + {0x002c82, 0x002c82, PG_U_UPPERCASE_LETTER}, + {0x002c83, 0x002c83, PG_U_LOWERCASE_LETTER}, + {0x002c84, 0x002c84, PG_U_UPPERCASE_LETTER}, + {0x002c85, 0x002c85, PG_U_LOWERCASE_LETTER}, + {0x002c86, 0x002c86, PG_U_UPPERCASE_LETTER}, + {0x002c87, 0x002c87, PG_U_LOWERCASE_LETTER}, + {0x002c88, 0x002c88, PG_U_UPPERCASE_LETTER}, + {0x002c89, 0x002c89, PG_U_LOWERCASE_LETTER}, + {0x002c8a, 0x002c8a, PG_U_UPPERCASE_LETTER}, + {0x002c8b, 0x002c8b, PG_U_LOWERCASE_LETTER}, + {0x002c8c, 0x002c8c, PG_U_UPPERCASE_LETTER}, + {0x002c8d, 0x002c8d, PG_U_LOWERCASE_LETTER}, + {0x002c8e, 0x002c8e, PG_U_UPPERCASE_LETTER}, + {0x002c8f, 0x002c8f, PG_U_LOWERCASE_LETTER}, + {0x002c90, 0x002c90, PG_U_UPPERCASE_LETTER}, + {0x002c91, 0x002c91, PG_U_LOWERCASE_LETTER}, + {0x002c92, 0x002c92, PG_U_UPPERCASE_LETTER}, + {0x002c93, 0x002c93, PG_U_LOWERCASE_LETTER}, + {0x002c94, 0x002c94, PG_U_UPPERCASE_LETTER}, + {0x002c95, 0x002c95, PG_U_LOWERCASE_LETTER}, + {0x002c96, 0x002c96, PG_U_UPPERCASE_LETTER}, + {0x002c97, 0x002c97, PG_U_LOWERCASE_LETTER}, + {0x002c98, 0x002c98, PG_U_UPPERCASE_LETTER}, + {0x002c99, 0x002c99, PG_U_LOWERCASE_LETTER}, + {0x002c9a, 0x002c9a, PG_U_UPPERCASE_LETTER}, + {0x002c9b, 0x002c9b, PG_U_LOWERCASE_LETTER}, + {0x002c9c, 0x002c9c, PG_U_UPPERCASE_LETTER}, + {0x002c9d, 0x002c9d, PG_U_LOWERCASE_LETTER}, + {0x002c9e, 0x002c9e, PG_U_UPPERCASE_LETTER}, + {0x002c9f, 0x002c9f, PG_U_LOWERCASE_LETTER}, + {0x002ca0, 0x002ca0, PG_U_UPPERCASE_LETTER}, + {0x002ca1, 0x002ca1, PG_U_LOWERCASE_LETTER}, + {0x002ca2, 0x002ca2, PG_U_UPPERCASE_LETTER}, + {0x002ca3, 0x002ca3, PG_U_LOWERCASE_LETTER}, + {0x002ca4, 0x002ca4, PG_U_UPPERCASE_LETTER}, + {0x002ca5, 0x002ca5, PG_U_LOWERCASE_LETTER}, + {0x002ca6, 0x002ca6, PG_U_UPPERCASE_LETTER}, + {0x002ca7, 0x002ca7, PG_U_LOWERCASE_LETTER}, + {0x002ca8, 0x002ca8, PG_U_UPPERCASE_LETTER}, + {0x002ca9, 0x002ca9, PG_U_LOWERCASE_LETTER}, + {0x002caa, 0x002caa, PG_U_UPPERCASE_LETTER}, + {0x002cab, 0x002cab, PG_U_LOWERCASE_LETTER}, + {0x002cac, 0x002cac, PG_U_UPPERCASE_LETTER}, + {0x002cad, 0x002cad, PG_U_LOWERCASE_LETTER}, + {0x002cae, 0x002cae, PG_U_UPPERCASE_LETTER}, + {0x002caf, 0x002caf, PG_U_LOWERCASE_LETTER}, + {0x002cb0, 0x002cb0, PG_U_UPPERCASE_LETTER}, + {0x002cb1, 0x002cb1, PG_U_LOWERCASE_LETTER}, + {0x002cb2, 0x002cb2, PG_U_UPPERCASE_LETTER}, + {0x002cb3, 0x002cb3, PG_U_LOWERCASE_LETTER}, + {0x002cb4, 0x002cb4, PG_U_UPPERCASE_LETTER}, + {0x002cb5, 0x002cb5, PG_U_LOWERCASE_LETTER}, + {0x002cb6, 0x002cb6, PG_U_UPPERCASE_LETTER}, + {0x002cb7, 0x002cb7, PG_U_LOWERCASE_LETTER}, + {0x002cb8, 0x002cb8, PG_U_UPPERCASE_LETTER}, + {0x002cb9, 0x002cb9, PG_U_LOWERCASE_LETTER}, + {0x002cba, 0x002cba, PG_U_UPPERCASE_LETTER}, + {0x002cbb, 0x002cbb, PG_U_LOWERCASE_LETTER}, + {0x002cbc, 0x002cbc, PG_U_UPPERCASE_LETTER}, + {0x002cbd, 0x002cbd, PG_U_LOWERCASE_LETTER}, + {0x002cbe, 0x002cbe, PG_U_UPPERCASE_LETTER}, + {0x002cbf, 0x002cbf, PG_U_LOWERCASE_LETTER}, + {0x002cc0, 0x002cc0, PG_U_UPPERCASE_LETTER}, + {0x002cc1, 0x002cc1, PG_U_LOWERCASE_LETTER}, + {0x002cc2, 0x002cc2, PG_U_UPPERCASE_LETTER}, + {0x002cc3, 0x002cc3, PG_U_LOWERCASE_LETTER}, + {0x002cc4, 0x002cc4, PG_U_UPPERCASE_LETTER}, + {0x002cc5, 0x002cc5, PG_U_LOWERCASE_LETTER}, + {0x002cc6, 0x002cc6, PG_U_UPPERCASE_LETTER}, + {0x002cc7, 0x002cc7, PG_U_LOWERCASE_LETTER}, + {0x002cc8, 0x002cc8, PG_U_UPPERCASE_LETTER}, + {0x002cc9, 0x002cc9, PG_U_LOWERCASE_LETTER}, + {0x002cca, 0x002cca, PG_U_UPPERCASE_LETTER}, + {0x002ccb, 0x002ccb, PG_U_LOWERCASE_LETTER}, + {0x002ccc, 0x002ccc, PG_U_UPPERCASE_LETTER}, + {0x002ccd, 0x002ccd, PG_U_LOWERCASE_LETTER}, + {0x002cce, 0x002cce, PG_U_UPPERCASE_LETTER}, + {0x002ccf, 0x002ccf, PG_U_LOWERCASE_LETTER}, + {0x002cd0, 0x002cd0, PG_U_UPPERCASE_LETTER}, + {0x002cd1, 0x002cd1, PG_U_LOWERCASE_LETTER}, + {0x002cd2, 0x002cd2, PG_U_UPPERCASE_LETTER}, + {0x002cd3, 0x002cd3, PG_U_LOWERCASE_LETTER}, + {0x002cd4, 0x002cd4, PG_U_UPPERCASE_LETTER}, + {0x002cd5, 0x002cd5, PG_U_LOWERCASE_LETTER}, + {0x002cd6, 0x002cd6, PG_U_UPPERCASE_LETTER}, + {0x002cd7, 0x002cd7, PG_U_LOWERCASE_LETTER}, + {0x002cd8, 0x002cd8, PG_U_UPPERCASE_LETTER}, + {0x002cd9, 0x002cd9, PG_U_LOWERCASE_LETTER}, + {0x002cda, 0x002cda, PG_U_UPPERCASE_LETTER}, + {0x002cdb, 0x002cdb, PG_U_LOWERCASE_LETTER}, + {0x002cdc, 0x002cdc, PG_U_UPPERCASE_LETTER}, + {0x002cdd, 0x002cdd, PG_U_LOWERCASE_LETTER}, + {0x002cde, 0x002cde, PG_U_UPPERCASE_LETTER}, + {0x002cdf, 0x002cdf, PG_U_LOWERCASE_LETTER}, + {0x002ce0, 0x002ce0, PG_U_UPPERCASE_LETTER}, + {0x002ce1, 0x002ce1, PG_U_LOWERCASE_LETTER}, + {0x002ce2, 0x002ce2, PG_U_UPPERCASE_LETTER}, + {0x002ce3, 0x002ce4, PG_U_LOWERCASE_LETTER}, + {0x002ce5, 0x002cea, PG_U_OTHER_SYMBOL}, + {0x002ceb, 0x002ceb, PG_U_UPPERCASE_LETTER}, + {0x002cec, 0x002cec, PG_U_LOWERCASE_LETTER}, + {0x002ced, 0x002ced, PG_U_UPPERCASE_LETTER}, + {0x002cee, 0x002cee, PG_U_LOWERCASE_LETTER}, + {0x002cef, 0x002cf1, PG_U_NONSPACING_MARK}, + {0x002cf2, 0x002cf2, PG_U_UPPERCASE_LETTER}, + {0x002cf3, 0x002cf3, PG_U_LOWERCASE_LETTER}, + {0x002cf9, 0x002cfc, PG_U_OTHER_PUNCTUATION}, + {0x002cfd, 0x002cfd, PG_U_OTHER_NUMBER}, + {0x002cfe, 0x002cff, PG_U_OTHER_PUNCTUATION}, + {0x002d00, 0x002d25, PG_U_LOWERCASE_LETTER}, + {0x002d27, 0x002d27, PG_U_LOWERCASE_LETTER}, + {0x002d2d, 0x002d2d, PG_U_LOWERCASE_LETTER}, + {0x002d30, 0x002d67, PG_U_OTHER_LETTER}, + {0x002d6f, 0x002d6f, PG_U_MODIFIER_LETTER}, + {0x002d70, 0x002d70, PG_U_OTHER_PUNCTUATION}, + {0x002d7f, 0x002d7f, PG_U_NONSPACING_MARK}, + {0x002d80, 0x002d96, PG_U_OTHER_LETTER}, + {0x002da0, 0x002da6, PG_U_OTHER_LETTER}, + {0x002da8, 0x002dae, PG_U_OTHER_LETTER}, + {0x002db0, 0x002db6, PG_U_OTHER_LETTER}, + {0x002db8, 0x002dbe, PG_U_OTHER_LETTER}, + {0x002dc0, 0x002dc6, PG_U_OTHER_LETTER}, + {0x002dc8, 0x002dce, PG_U_OTHER_LETTER}, + {0x002dd0, 0x002dd6, PG_U_OTHER_LETTER}, + {0x002dd8, 0x002dde, PG_U_OTHER_LETTER}, + {0x002de0, 0x002dff, PG_U_NONSPACING_MARK}, + {0x002e00, 0x002e01, PG_U_OTHER_PUNCTUATION}, + {0x002e02, 0x002e02, PG_U_INITIAL_PUNCTUATION}, + {0x002e03, 0x002e03, PG_U_FINAL_PUNCTUATION}, + {0x002e04, 0x002e04, PG_U_INITIAL_PUNCTUATION}, + {0x002e05, 0x002e05, PG_U_FINAL_PUNCTUATION}, + {0x002e06, 0x002e08, PG_U_OTHER_PUNCTUATION}, + {0x002e09, 0x002e09, PG_U_INITIAL_PUNCTUATION}, + {0x002e0a, 0x002e0a, PG_U_FINAL_PUNCTUATION}, + {0x002e0b, 0x002e0b, PG_U_OTHER_PUNCTUATION}, + {0x002e0c, 0x002e0c, PG_U_INITIAL_PUNCTUATION}, + {0x002e0d, 0x002e0d, PG_U_FINAL_PUNCTUATION}, + {0x002e0e, 0x002e16, PG_U_OTHER_PUNCTUATION}, + {0x002e17, 0x002e17, PG_U_DASH_PUNCTUATION}, + {0x002e18, 0x002e19, PG_U_OTHER_PUNCTUATION}, + {0x002e1a, 0x002e1a, PG_U_DASH_PUNCTUATION}, + {0x002e1b, 0x002e1b, PG_U_OTHER_PUNCTUATION}, + {0x002e1c, 0x002e1c, PG_U_INITIAL_PUNCTUATION}, + {0x002e1d, 0x002e1d, PG_U_FINAL_PUNCTUATION}, + {0x002e1e, 0x002e1f, PG_U_OTHER_PUNCTUATION}, + {0x002e20, 0x002e20, PG_U_INITIAL_PUNCTUATION}, + {0x002e21, 0x002e21, PG_U_FINAL_PUNCTUATION}, + {0x002e22, 0x002e22, PG_U_OPEN_PUNCTUATION}, + {0x002e23, 0x002e23, PG_U_CLOSE_PUNCTUATION}, + {0x002e24, 0x002e24, PG_U_OPEN_PUNCTUATION}, + {0x002e25, 0x002e25, PG_U_CLOSE_PUNCTUATION}, + {0x002e26, 0x002e26, PG_U_OPEN_PUNCTUATION}, + {0x002e27, 0x002e27, PG_U_CLOSE_PUNCTUATION}, + {0x002e28, 0x002e28, PG_U_OPEN_PUNCTUATION}, + {0x002e29, 0x002e29, PG_U_CLOSE_PUNCTUATION}, + {0x002e2a, 0x002e2e, PG_U_OTHER_PUNCTUATION}, + {0x002e2f, 0x002e2f, PG_U_MODIFIER_LETTER}, + {0x002e30, 0x002e39, PG_U_OTHER_PUNCTUATION}, + {0x002e3a, 0x002e3b, PG_U_DASH_PUNCTUATION}, + {0x002e3c, 0x002e3f, PG_U_OTHER_PUNCTUATION}, + {0x002e40, 0x002e40, PG_U_DASH_PUNCTUATION}, + {0x002e41, 0x002e41, PG_U_OTHER_PUNCTUATION}, + {0x002e42, 0x002e42, PG_U_OPEN_PUNCTUATION}, + {0x002e43, 0x002e4f, PG_U_OTHER_PUNCTUATION}, + {0x002e50, 0x002e51, PG_U_OTHER_SYMBOL}, + {0x002e52, 0x002e54, PG_U_OTHER_PUNCTUATION}, + {0x002e55, 0x002e55, PG_U_OPEN_PUNCTUATION}, + {0x002e56, 0x002e56, PG_U_CLOSE_PUNCTUATION}, + {0x002e57, 0x002e57, PG_U_OPEN_PUNCTUATION}, + {0x002e58, 0x002e58, PG_U_CLOSE_PUNCTUATION}, + {0x002e59, 0x002e59, PG_U_OPEN_PUNCTUATION}, + {0x002e5a, 0x002e5a, PG_U_CLOSE_PUNCTUATION}, + {0x002e5b, 0x002e5b, PG_U_OPEN_PUNCTUATION}, + {0x002e5c, 0x002e5c, PG_U_CLOSE_PUNCTUATION}, + {0x002e5d, 0x002e5d, PG_U_DASH_PUNCTUATION}, + {0x002e80, 0x002e99, PG_U_OTHER_SYMBOL}, + {0x002e9b, 0x002ef3, PG_U_OTHER_SYMBOL}, + {0x002f00, 0x002fd5, PG_U_OTHER_SYMBOL}, + {0x002ff0, 0x002fff, PG_U_OTHER_SYMBOL}, + {0x003000, 0x003000, PG_U_SPACE_SEPARATOR}, + {0x003001, 0x003003, PG_U_OTHER_PUNCTUATION}, + {0x003004, 0x003004, PG_U_OTHER_SYMBOL}, + {0x003005, 0x003005, PG_U_MODIFIER_LETTER}, + {0x003006, 0x003006, PG_U_OTHER_LETTER}, + {0x003007, 0x003007, PG_U_LETTER_NUMBER}, + {0x003008, 0x003008, PG_U_OPEN_PUNCTUATION}, + {0x003009, 0x003009, PG_U_CLOSE_PUNCTUATION}, + {0x00300a, 0x00300a, PG_U_OPEN_PUNCTUATION}, + {0x00300b, 0x00300b, PG_U_CLOSE_PUNCTUATION}, + {0x00300c, 0x00300c, PG_U_OPEN_PUNCTUATION}, + {0x00300d, 0x00300d, PG_U_CLOSE_PUNCTUATION}, + {0x00300e, 0x00300e, PG_U_OPEN_PUNCTUATION}, + {0x00300f, 0x00300f, PG_U_CLOSE_PUNCTUATION}, + {0x003010, 0x003010, PG_U_OPEN_PUNCTUATION}, + {0x003011, 0x003011, PG_U_CLOSE_PUNCTUATION}, + {0x003012, 0x003013, PG_U_OTHER_SYMBOL}, + {0x003014, 0x003014, PG_U_OPEN_PUNCTUATION}, + {0x003015, 0x003015, PG_U_CLOSE_PUNCTUATION}, + {0x003016, 0x003016, PG_U_OPEN_PUNCTUATION}, + {0x003017, 0x003017, PG_U_CLOSE_PUNCTUATION}, + {0x003018, 0x003018, PG_U_OPEN_PUNCTUATION}, + {0x003019, 0x003019, PG_U_CLOSE_PUNCTUATION}, + {0x00301a, 0x00301a, PG_U_OPEN_PUNCTUATION}, + {0x00301b, 0x00301b, PG_U_CLOSE_PUNCTUATION}, + {0x00301c, 0x00301c, PG_U_DASH_PUNCTUATION}, + {0x00301d, 0x00301d, PG_U_OPEN_PUNCTUATION}, + {0x00301e, 0x00301f, PG_U_CLOSE_PUNCTUATION}, + {0x003020, 0x003020, PG_U_OTHER_SYMBOL}, + {0x003021, 0x003029, PG_U_LETTER_NUMBER}, + {0x00302a, 0x00302d, PG_U_NONSPACING_MARK}, + {0x00302e, 0x00302f, PG_U_SPACING_MARK}, + {0x003030, 0x003030, PG_U_DASH_PUNCTUATION}, + {0x003031, 0x003035, PG_U_MODIFIER_LETTER}, + {0x003036, 0x003037, PG_U_OTHER_SYMBOL}, + {0x003038, 0x00303a, PG_U_LETTER_NUMBER}, + {0x00303b, 0x00303b, PG_U_MODIFIER_LETTER}, + {0x00303c, 0x00303c, PG_U_OTHER_LETTER}, + {0x00303d, 0x00303d, PG_U_OTHER_PUNCTUATION}, + {0x00303e, 0x00303f, PG_U_OTHER_SYMBOL}, + {0x003041, 0x003096, PG_U_OTHER_LETTER}, + {0x003099, 0x00309a, PG_U_NONSPACING_MARK}, + {0x00309b, 0x00309c, PG_U_MODIFIER_SYMBOL}, + {0x00309d, 0x00309e, PG_U_MODIFIER_LETTER}, + {0x00309f, 0x00309f, PG_U_OTHER_LETTER}, + {0x0030a0, 0x0030a0, PG_U_DASH_PUNCTUATION}, + {0x0030a1, 0x0030fa, PG_U_OTHER_LETTER}, + {0x0030fb, 0x0030fb, PG_U_OTHER_PUNCTUATION}, + {0x0030fc, 0x0030fe, PG_U_MODIFIER_LETTER}, + {0x0030ff, 0x0030ff, PG_U_OTHER_LETTER}, + {0x003105, 0x00312f, PG_U_OTHER_LETTER}, + {0x003131, 0x00318e, PG_U_OTHER_LETTER}, + {0x003190, 0x003191, PG_U_OTHER_SYMBOL}, + {0x003192, 0x003195, PG_U_OTHER_NUMBER}, + {0x003196, 0x00319f, PG_U_OTHER_SYMBOL}, + {0x0031a0, 0x0031bf, PG_U_OTHER_LETTER}, + {0x0031c0, 0x0031e3, PG_U_OTHER_SYMBOL}, + {0x0031ef, 0x0031ef, PG_U_OTHER_SYMBOL}, + {0x0031f0, 0x0031ff, PG_U_OTHER_LETTER}, + {0x003200, 0x00321e, PG_U_OTHER_SYMBOL}, + {0x003220, 0x003229, PG_U_OTHER_NUMBER}, + {0x00322a, 0x003247, PG_U_OTHER_SYMBOL}, + {0x003248, 0x00324f, PG_U_OTHER_NUMBER}, + {0x003250, 0x003250, PG_U_OTHER_SYMBOL}, + {0x003251, 0x00325f, PG_U_OTHER_NUMBER}, + {0x003260, 0x00327f, PG_U_OTHER_SYMBOL}, + {0x003280, 0x003289, PG_U_OTHER_NUMBER}, + {0x00328a, 0x0032b0, PG_U_OTHER_SYMBOL}, + {0x0032b1, 0x0032bf, PG_U_OTHER_NUMBER}, + {0x0032c0, 0x0033ff, PG_U_OTHER_SYMBOL}, + {0x003400, 0x004dbf, PG_U_OTHER_LETTER}, + {0x004dc0, 0x004dff, PG_U_OTHER_SYMBOL}, + {0x004e00, 0x00a014, PG_U_OTHER_LETTER}, + {0x00a015, 0x00a015, PG_U_MODIFIER_LETTER}, + {0x00a016, 0x00a48c, PG_U_OTHER_LETTER}, + {0x00a490, 0x00a4c6, PG_U_OTHER_SYMBOL}, + {0x00a4d0, 0x00a4f7, PG_U_OTHER_LETTER}, + {0x00a4f8, 0x00a4fd, PG_U_MODIFIER_LETTER}, + {0x00a4fe, 0x00a4ff, PG_U_OTHER_PUNCTUATION}, + {0x00a500, 0x00a60b, PG_U_OTHER_LETTER}, + {0x00a60c, 0x00a60c, PG_U_MODIFIER_LETTER}, + {0x00a60d, 0x00a60f, PG_U_OTHER_PUNCTUATION}, + {0x00a610, 0x00a61f, PG_U_OTHER_LETTER}, + {0x00a620, 0x00a629, PG_U_DECIMAL_NUMBER}, + {0x00a62a, 0x00a62b, PG_U_OTHER_LETTER}, + {0x00a640, 0x00a640, PG_U_UPPERCASE_LETTER}, + {0x00a641, 0x00a641, PG_U_LOWERCASE_LETTER}, + {0x00a642, 0x00a642, PG_U_UPPERCASE_LETTER}, + {0x00a643, 0x00a643, PG_U_LOWERCASE_LETTER}, + {0x00a644, 0x00a644, PG_U_UPPERCASE_LETTER}, + {0x00a645, 0x00a645, PG_U_LOWERCASE_LETTER}, + {0x00a646, 0x00a646, PG_U_UPPERCASE_LETTER}, + {0x00a647, 0x00a647, PG_U_LOWERCASE_LETTER}, + {0x00a648, 0x00a648, PG_U_UPPERCASE_LETTER}, + {0x00a649, 0x00a649, PG_U_LOWERCASE_LETTER}, + {0x00a64a, 0x00a64a, PG_U_UPPERCASE_LETTER}, + {0x00a64b, 0x00a64b, PG_U_LOWERCASE_LETTER}, + {0x00a64c, 0x00a64c, PG_U_UPPERCASE_LETTER}, + {0x00a64d, 0x00a64d, PG_U_LOWERCASE_LETTER}, + {0x00a64e, 0x00a64e, PG_U_UPPERCASE_LETTER}, + {0x00a64f, 0x00a64f, PG_U_LOWERCASE_LETTER}, + {0x00a650, 0x00a650, PG_U_UPPERCASE_LETTER}, + {0x00a651, 0x00a651, PG_U_LOWERCASE_LETTER}, + {0x00a652, 0x00a652, PG_U_UPPERCASE_LETTER}, + {0x00a653, 0x00a653, PG_U_LOWERCASE_LETTER}, + {0x00a654, 0x00a654, PG_U_UPPERCASE_LETTER}, + {0x00a655, 0x00a655, PG_U_LOWERCASE_LETTER}, + {0x00a656, 0x00a656, PG_U_UPPERCASE_LETTER}, + {0x00a657, 0x00a657, PG_U_LOWERCASE_LETTER}, + {0x00a658, 0x00a658, PG_U_UPPERCASE_LETTER}, + {0x00a659, 0x00a659, PG_U_LOWERCASE_LETTER}, + {0x00a65a, 0x00a65a, PG_U_UPPERCASE_LETTER}, + {0x00a65b, 0x00a65b, PG_U_LOWERCASE_LETTER}, + {0x00a65c, 0x00a65c, PG_U_UPPERCASE_LETTER}, + {0x00a65d, 0x00a65d, PG_U_LOWERCASE_LETTER}, + {0x00a65e, 0x00a65e, PG_U_UPPERCASE_LETTER}, + {0x00a65f, 0x00a65f, PG_U_LOWERCASE_LETTER}, + {0x00a660, 0x00a660, PG_U_UPPERCASE_LETTER}, + {0x00a661, 0x00a661, PG_U_LOWERCASE_LETTER}, + {0x00a662, 0x00a662, PG_U_UPPERCASE_LETTER}, + {0x00a663, 0x00a663, PG_U_LOWERCASE_LETTER}, + {0x00a664, 0x00a664, PG_U_UPPERCASE_LETTER}, + {0x00a665, 0x00a665, PG_U_LOWERCASE_LETTER}, + {0x00a666, 0x00a666, PG_U_UPPERCASE_LETTER}, + {0x00a667, 0x00a667, PG_U_LOWERCASE_LETTER}, + {0x00a668, 0x00a668, PG_U_UPPERCASE_LETTER}, + {0x00a669, 0x00a669, PG_U_LOWERCASE_LETTER}, + {0x00a66a, 0x00a66a, PG_U_UPPERCASE_LETTER}, + {0x00a66b, 0x00a66b, PG_U_LOWERCASE_LETTER}, + {0x00a66c, 0x00a66c, PG_U_UPPERCASE_LETTER}, + {0x00a66d, 0x00a66d, PG_U_LOWERCASE_LETTER}, + {0x00a66e, 0x00a66e, PG_U_OTHER_LETTER}, + {0x00a66f, 0x00a66f, PG_U_NONSPACING_MARK}, + {0x00a670, 0x00a672, PG_U_ENCLOSING_MARK}, + {0x00a673, 0x00a673, PG_U_OTHER_PUNCTUATION}, + {0x00a674, 0x00a67d, PG_U_NONSPACING_MARK}, + {0x00a67e, 0x00a67e, PG_U_OTHER_PUNCTUATION}, + {0x00a67f, 0x00a67f, PG_U_MODIFIER_LETTER}, + {0x00a680, 0x00a680, PG_U_UPPERCASE_LETTER}, + {0x00a681, 0x00a681, PG_U_LOWERCASE_LETTER}, + {0x00a682, 0x00a682, PG_U_UPPERCASE_LETTER}, + {0x00a683, 0x00a683, PG_U_LOWERCASE_LETTER}, + {0x00a684, 0x00a684, PG_U_UPPERCASE_LETTER}, + {0x00a685, 0x00a685, PG_U_LOWERCASE_LETTER}, + {0x00a686, 0x00a686, PG_U_UPPERCASE_LETTER}, + {0x00a687, 0x00a687, PG_U_LOWERCASE_LETTER}, + {0x00a688, 0x00a688, PG_U_UPPERCASE_LETTER}, + {0x00a689, 0x00a689, PG_U_LOWERCASE_LETTER}, + {0x00a68a, 0x00a68a, PG_U_UPPERCASE_LETTER}, + {0x00a68b, 0x00a68b, PG_U_LOWERCASE_LETTER}, + {0x00a68c, 0x00a68c, PG_U_UPPERCASE_LETTER}, + {0x00a68d, 0x00a68d, PG_U_LOWERCASE_LETTER}, + {0x00a68e, 0x00a68e, PG_U_UPPERCASE_LETTER}, + {0x00a68f, 0x00a68f, PG_U_LOWERCASE_LETTER}, + {0x00a690, 0x00a690, PG_U_UPPERCASE_LETTER}, + {0x00a691, 0x00a691, PG_U_LOWERCASE_LETTER}, + {0x00a692, 0x00a692, PG_U_UPPERCASE_LETTER}, + {0x00a693, 0x00a693, PG_U_LOWERCASE_LETTER}, + {0x00a694, 0x00a694, PG_U_UPPERCASE_LETTER}, + {0x00a695, 0x00a695, PG_U_LOWERCASE_LETTER}, + {0x00a696, 0x00a696, PG_U_UPPERCASE_LETTER}, + {0x00a697, 0x00a697, PG_U_LOWERCASE_LETTER}, + {0x00a698, 0x00a698, PG_U_UPPERCASE_LETTER}, + {0x00a699, 0x00a699, PG_U_LOWERCASE_LETTER}, + {0x00a69a, 0x00a69a, PG_U_UPPERCASE_LETTER}, + {0x00a69b, 0x00a69b, PG_U_LOWERCASE_LETTER}, + {0x00a69c, 0x00a69d, PG_U_MODIFIER_LETTER}, + {0x00a69e, 0x00a69f, PG_U_NONSPACING_MARK}, + {0x00a6a0, 0x00a6e5, PG_U_OTHER_LETTER}, + {0x00a6e6, 0x00a6ef, PG_U_LETTER_NUMBER}, + {0x00a6f0, 0x00a6f1, PG_U_NONSPACING_MARK}, + {0x00a6f2, 0x00a6f7, PG_U_OTHER_PUNCTUATION}, + {0x00a700, 0x00a716, PG_U_MODIFIER_SYMBOL}, + {0x00a717, 0x00a71f, PG_U_MODIFIER_LETTER}, + {0x00a720, 0x00a721, PG_U_MODIFIER_SYMBOL}, + {0x00a722, 0x00a722, PG_U_UPPERCASE_LETTER}, + {0x00a723, 0x00a723, PG_U_LOWERCASE_LETTER}, + {0x00a724, 0x00a724, PG_U_UPPERCASE_LETTER}, + {0x00a725, 0x00a725, PG_U_LOWERCASE_LETTER}, + {0x00a726, 0x00a726, PG_U_UPPERCASE_LETTER}, + {0x00a727, 0x00a727, PG_U_LOWERCASE_LETTER}, + {0x00a728, 0x00a728, PG_U_UPPERCASE_LETTER}, + {0x00a729, 0x00a729, PG_U_LOWERCASE_LETTER}, + {0x00a72a, 0x00a72a, PG_U_UPPERCASE_LETTER}, + {0x00a72b, 0x00a72b, PG_U_LOWERCASE_LETTER}, + {0x00a72c, 0x00a72c, PG_U_UPPERCASE_LETTER}, + {0x00a72d, 0x00a72d, PG_U_LOWERCASE_LETTER}, + {0x00a72e, 0x00a72e, PG_U_UPPERCASE_LETTER}, + {0x00a72f, 0x00a731, PG_U_LOWERCASE_LETTER}, + {0x00a732, 0x00a732, PG_U_UPPERCASE_LETTER}, + {0x00a733, 0x00a733, PG_U_LOWERCASE_LETTER}, + {0x00a734, 0x00a734, PG_U_UPPERCASE_LETTER}, + {0x00a735, 0x00a735, PG_U_LOWERCASE_LETTER}, + {0x00a736, 0x00a736, PG_U_UPPERCASE_LETTER}, + {0x00a737, 0x00a737, PG_U_LOWERCASE_LETTER}, + {0x00a738, 0x00a738, PG_U_UPPERCASE_LETTER}, + {0x00a739, 0x00a739, PG_U_LOWERCASE_LETTER}, + {0x00a73a, 0x00a73a, PG_U_UPPERCASE_LETTER}, + {0x00a73b, 0x00a73b, PG_U_LOWERCASE_LETTER}, + {0x00a73c, 0x00a73c, PG_U_UPPERCASE_LETTER}, + {0x00a73d, 0x00a73d, PG_U_LOWERCASE_LETTER}, + {0x00a73e, 0x00a73e, PG_U_UPPERCASE_LETTER}, + {0x00a73f, 0x00a73f, PG_U_LOWERCASE_LETTER}, + {0x00a740, 0x00a740, PG_U_UPPERCASE_LETTER}, + {0x00a741, 0x00a741, PG_U_LOWERCASE_LETTER}, + {0x00a742, 0x00a742, PG_U_UPPERCASE_LETTER}, + {0x00a743, 0x00a743, PG_U_LOWERCASE_LETTER}, + {0x00a744, 0x00a744, PG_U_UPPERCASE_LETTER}, + {0x00a745, 0x00a745, PG_U_LOWERCASE_LETTER}, + {0x00a746, 0x00a746, PG_U_UPPERCASE_LETTER}, + {0x00a747, 0x00a747, PG_U_LOWERCASE_LETTER}, + {0x00a748, 0x00a748, PG_U_UPPERCASE_LETTER}, + {0x00a749, 0x00a749, PG_U_LOWERCASE_LETTER}, + {0x00a74a, 0x00a74a, PG_U_UPPERCASE_LETTER}, + {0x00a74b, 0x00a74b, PG_U_LOWERCASE_LETTER}, + {0x00a74c, 0x00a74c, PG_U_UPPERCASE_LETTER}, + {0x00a74d, 0x00a74d, PG_U_LOWERCASE_LETTER}, + {0x00a74e, 0x00a74e, PG_U_UPPERCASE_LETTER}, + {0x00a74f, 0x00a74f, PG_U_LOWERCASE_LETTER}, + {0x00a750, 0x00a750, PG_U_UPPERCASE_LETTER}, + {0x00a751, 0x00a751, PG_U_LOWERCASE_LETTER}, + {0x00a752, 0x00a752, PG_U_UPPERCASE_LETTER}, + {0x00a753, 0x00a753, PG_U_LOWERCASE_LETTER}, + {0x00a754, 0x00a754, PG_U_UPPERCASE_LETTER}, + {0x00a755, 0x00a755, PG_U_LOWERCASE_LETTER}, + {0x00a756, 0x00a756, PG_U_UPPERCASE_LETTER}, + {0x00a757, 0x00a757, PG_U_LOWERCASE_LETTER}, + {0x00a758, 0x00a758, PG_U_UPPERCASE_LETTER}, + {0x00a759, 0x00a759, PG_U_LOWERCASE_LETTER}, + {0x00a75a, 0x00a75a, PG_U_UPPERCASE_LETTER}, + {0x00a75b, 0x00a75b, PG_U_LOWERCASE_LETTER}, + {0x00a75c, 0x00a75c, PG_U_UPPERCASE_LETTER}, + {0x00a75d, 0x00a75d, PG_U_LOWERCASE_LETTER}, + {0x00a75e, 0x00a75e, PG_U_UPPERCASE_LETTER}, + {0x00a75f, 0x00a75f, PG_U_LOWERCASE_LETTER}, + {0x00a760, 0x00a760, PG_U_UPPERCASE_LETTER}, + {0x00a761, 0x00a761, PG_U_LOWERCASE_LETTER}, + {0x00a762, 0x00a762, PG_U_UPPERCASE_LETTER}, + {0x00a763, 0x00a763, PG_U_LOWERCASE_LETTER}, + {0x00a764, 0x00a764, PG_U_UPPERCASE_LETTER}, + {0x00a765, 0x00a765, PG_U_LOWERCASE_LETTER}, + {0x00a766, 0x00a766, PG_U_UPPERCASE_LETTER}, + {0x00a767, 0x00a767, PG_U_LOWERCASE_LETTER}, + {0x00a768, 0x00a768, PG_U_UPPERCASE_LETTER}, + {0x00a769, 0x00a769, PG_U_LOWERCASE_LETTER}, + {0x00a76a, 0x00a76a, PG_U_UPPERCASE_LETTER}, + {0x00a76b, 0x00a76b, PG_U_LOWERCASE_LETTER}, + {0x00a76c, 0x00a76c, PG_U_UPPERCASE_LETTER}, + {0x00a76d, 0x00a76d, PG_U_LOWERCASE_LETTER}, + {0x00a76e, 0x00a76e, PG_U_UPPERCASE_LETTER}, + {0x00a76f, 0x00a76f, PG_U_LOWERCASE_LETTER}, + {0x00a770, 0x00a770, PG_U_MODIFIER_LETTER}, + {0x00a771, 0x00a778, PG_U_LOWERCASE_LETTER}, + {0x00a779, 0x00a779, PG_U_UPPERCASE_LETTER}, + {0x00a77a, 0x00a77a, PG_U_LOWERCASE_LETTER}, + {0x00a77b, 0x00a77b, PG_U_UPPERCASE_LETTER}, + {0x00a77c, 0x00a77c, PG_U_LOWERCASE_LETTER}, + {0x00a77d, 0x00a77e, PG_U_UPPERCASE_LETTER}, + {0x00a77f, 0x00a77f, PG_U_LOWERCASE_LETTER}, + {0x00a780, 0x00a780, PG_U_UPPERCASE_LETTER}, + {0x00a781, 0x00a781, PG_U_LOWERCASE_LETTER}, + {0x00a782, 0x00a782, PG_U_UPPERCASE_LETTER}, + {0x00a783, 0x00a783, PG_U_LOWERCASE_LETTER}, + {0x00a784, 0x00a784, PG_U_UPPERCASE_LETTER}, + {0x00a785, 0x00a785, PG_U_LOWERCASE_LETTER}, + {0x00a786, 0x00a786, PG_U_UPPERCASE_LETTER}, + {0x00a787, 0x00a787, PG_U_LOWERCASE_LETTER}, + {0x00a788, 0x00a788, PG_U_MODIFIER_LETTER}, + {0x00a789, 0x00a78a, PG_U_MODIFIER_SYMBOL}, + {0x00a78b, 0x00a78b, PG_U_UPPERCASE_LETTER}, + {0x00a78c, 0x00a78c, PG_U_LOWERCASE_LETTER}, + {0x00a78d, 0x00a78d, PG_U_UPPERCASE_LETTER}, + {0x00a78e, 0x00a78e, PG_U_LOWERCASE_LETTER}, + {0x00a78f, 0x00a78f, PG_U_OTHER_LETTER}, + {0x00a790, 0x00a790, PG_U_UPPERCASE_LETTER}, + {0x00a791, 0x00a791, PG_U_LOWERCASE_LETTER}, + {0x00a792, 0x00a792, PG_U_UPPERCASE_LETTER}, + {0x00a793, 0x00a795, PG_U_LOWERCASE_LETTER}, + {0x00a796, 0x00a796, PG_U_UPPERCASE_LETTER}, + {0x00a797, 0x00a797, PG_U_LOWERCASE_LETTER}, + {0x00a798, 0x00a798, PG_U_UPPERCASE_LETTER}, + {0x00a799, 0x00a799, PG_U_LOWERCASE_LETTER}, + {0x00a79a, 0x00a79a, PG_U_UPPERCASE_LETTER}, + {0x00a79b, 0x00a79b, PG_U_LOWERCASE_LETTER}, + {0x00a79c, 0x00a79c, PG_U_UPPERCASE_LETTER}, + {0x00a79d, 0x00a79d, PG_U_LOWERCASE_LETTER}, + {0x00a79e, 0x00a79e, PG_U_UPPERCASE_LETTER}, + {0x00a79f, 0x00a79f, PG_U_LOWERCASE_LETTER}, + {0x00a7a0, 0x00a7a0, PG_U_UPPERCASE_LETTER}, + {0x00a7a1, 0x00a7a1, PG_U_LOWERCASE_LETTER}, + {0x00a7a2, 0x00a7a2, PG_U_UPPERCASE_LETTER}, + {0x00a7a3, 0x00a7a3, PG_U_LOWERCASE_LETTER}, + {0x00a7a4, 0x00a7a4, PG_U_UPPERCASE_LETTER}, + {0x00a7a5, 0x00a7a5, PG_U_LOWERCASE_LETTER}, + {0x00a7a6, 0x00a7a6, PG_U_UPPERCASE_LETTER}, + {0x00a7a7, 0x00a7a7, PG_U_LOWERCASE_LETTER}, + {0x00a7a8, 0x00a7a8, PG_U_UPPERCASE_LETTER}, + {0x00a7a9, 0x00a7a9, PG_U_LOWERCASE_LETTER}, + {0x00a7aa, 0x00a7ae, PG_U_UPPERCASE_LETTER}, + {0x00a7af, 0x00a7af, PG_U_LOWERCASE_LETTER}, + {0x00a7b0, 0x00a7b4, PG_U_UPPERCASE_LETTER}, + {0x00a7b5, 0x00a7b5, PG_U_LOWERCASE_LETTER}, + {0x00a7b6, 0x00a7b6, PG_U_UPPERCASE_LETTER}, + {0x00a7b7, 0x00a7b7, PG_U_LOWERCASE_LETTER}, + {0x00a7b8, 0x00a7b8, PG_U_UPPERCASE_LETTER}, + {0x00a7b9, 0x00a7b9, PG_U_LOWERCASE_LETTER}, + {0x00a7ba, 0x00a7ba, PG_U_UPPERCASE_LETTER}, + {0x00a7bb, 0x00a7bb, PG_U_LOWERCASE_LETTER}, + {0x00a7bc, 0x00a7bc, PG_U_UPPERCASE_LETTER}, + {0x00a7bd, 0x00a7bd, PG_U_LOWERCASE_LETTER}, + {0x00a7be, 0x00a7be, PG_U_UPPERCASE_LETTER}, + {0x00a7bf, 0x00a7bf, PG_U_LOWERCASE_LETTER}, + {0x00a7c0, 0x00a7c0, PG_U_UPPERCASE_LETTER}, + {0x00a7c1, 0x00a7c1, PG_U_LOWERCASE_LETTER}, + {0x00a7c2, 0x00a7c2, PG_U_UPPERCASE_LETTER}, + {0x00a7c3, 0x00a7c3, PG_U_LOWERCASE_LETTER}, + {0x00a7c4, 0x00a7c7, PG_U_UPPERCASE_LETTER}, + {0x00a7c8, 0x00a7c8, PG_U_LOWERCASE_LETTER}, + {0x00a7c9, 0x00a7c9, PG_U_UPPERCASE_LETTER}, + {0x00a7ca, 0x00a7ca, PG_U_LOWERCASE_LETTER}, + {0x00a7d0, 0x00a7d0, PG_U_UPPERCASE_LETTER}, + {0x00a7d1, 0x00a7d1, PG_U_LOWERCASE_LETTER}, + {0x00a7d3, 0x00a7d3, PG_U_LOWERCASE_LETTER}, + {0x00a7d5, 0x00a7d5, PG_U_LOWERCASE_LETTER}, + {0x00a7d6, 0x00a7d6, PG_U_UPPERCASE_LETTER}, + {0x00a7d7, 0x00a7d7, PG_U_LOWERCASE_LETTER}, + {0x00a7d8, 0x00a7d8, PG_U_UPPERCASE_LETTER}, + {0x00a7d9, 0x00a7d9, PG_U_LOWERCASE_LETTER}, + {0x00a7f2, 0x00a7f4, PG_U_MODIFIER_LETTER}, + {0x00a7f5, 0x00a7f5, PG_U_UPPERCASE_LETTER}, + {0x00a7f6, 0x00a7f6, PG_U_LOWERCASE_LETTER}, + {0x00a7f7, 0x00a7f7, PG_U_OTHER_LETTER}, + {0x00a7f8, 0x00a7f9, PG_U_MODIFIER_LETTER}, + {0x00a7fa, 0x00a7fa, PG_U_LOWERCASE_LETTER}, + {0x00a7fb, 0x00a801, PG_U_OTHER_LETTER}, + {0x00a802, 0x00a802, PG_U_NONSPACING_MARK}, + {0x00a803, 0x00a805, PG_U_OTHER_LETTER}, + {0x00a806, 0x00a806, PG_U_NONSPACING_MARK}, + {0x00a807, 0x00a80a, PG_U_OTHER_LETTER}, + {0x00a80b, 0x00a80b, PG_U_NONSPACING_MARK}, + {0x00a80c, 0x00a822, PG_U_OTHER_LETTER}, + {0x00a823, 0x00a824, PG_U_SPACING_MARK}, + {0x00a825, 0x00a826, PG_U_NONSPACING_MARK}, + {0x00a827, 0x00a827, PG_U_SPACING_MARK}, + {0x00a828, 0x00a82b, PG_U_OTHER_SYMBOL}, + {0x00a82c, 0x00a82c, PG_U_NONSPACING_MARK}, + {0x00a830, 0x00a835, PG_U_OTHER_NUMBER}, + {0x00a836, 0x00a837, PG_U_OTHER_SYMBOL}, + {0x00a838, 0x00a838, PG_U_CURRENCY_SYMBOL}, + {0x00a839, 0x00a839, PG_U_OTHER_SYMBOL}, + {0x00a840, 0x00a873, PG_U_OTHER_LETTER}, + {0x00a874, 0x00a877, PG_U_OTHER_PUNCTUATION}, + {0x00a880, 0x00a881, PG_U_SPACING_MARK}, + {0x00a882, 0x00a8b3, PG_U_OTHER_LETTER}, + {0x00a8b4, 0x00a8c3, PG_U_SPACING_MARK}, + {0x00a8c4, 0x00a8c5, PG_U_NONSPACING_MARK}, + {0x00a8ce, 0x00a8cf, PG_U_OTHER_PUNCTUATION}, + {0x00a8d0, 0x00a8d9, PG_U_DECIMAL_NUMBER}, + {0x00a8e0, 0x00a8f1, PG_U_NONSPACING_MARK}, + {0x00a8f2, 0x00a8f7, PG_U_OTHER_LETTER}, + {0x00a8f8, 0x00a8fa, PG_U_OTHER_PUNCTUATION}, + {0x00a8fb, 0x00a8fb, PG_U_OTHER_LETTER}, + {0x00a8fc, 0x00a8fc, PG_U_OTHER_PUNCTUATION}, + {0x00a8fd, 0x00a8fe, PG_U_OTHER_LETTER}, + {0x00a8ff, 0x00a8ff, PG_U_NONSPACING_MARK}, + {0x00a900, 0x00a909, PG_U_DECIMAL_NUMBER}, + {0x00a90a, 0x00a925, PG_U_OTHER_LETTER}, + {0x00a926, 0x00a92d, PG_U_NONSPACING_MARK}, + {0x00a92e, 0x00a92f, PG_U_OTHER_PUNCTUATION}, + {0x00a930, 0x00a946, PG_U_OTHER_LETTER}, + {0x00a947, 0x00a951, PG_U_NONSPACING_MARK}, + {0x00a952, 0x00a953, PG_U_SPACING_MARK}, + {0x00a95f, 0x00a95f, PG_U_OTHER_PUNCTUATION}, + {0x00a960, 0x00a97c, PG_U_OTHER_LETTER}, + {0x00a980, 0x00a982, PG_U_NONSPACING_MARK}, + {0x00a983, 0x00a983, PG_U_SPACING_MARK}, + {0x00a984, 0x00a9b2, PG_U_OTHER_LETTER}, + {0x00a9b3, 0x00a9b3, PG_U_NONSPACING_MARK}, + {0x00a9b4, 0x00a9b5, PG_U_SPACING_MARK}, + {0x00a9b6, 0x00a9b9, PG_U_NONSPACING_MARK}, + {0x00a9ba, 0x00a9bb, PG_U_SPACING_MARK}, + {0x00a9bc, 0x00a9bd, PG_U_NONSPACING_MARK}, + {0x00a9be, 0x00a9c0, PG_U_SPACING_MARK}, + {0x00a9c1, 0x00a9cd, PG_U_OTHER_PUNCTUATION}, + {0x00a9cf, 0x00a9cf, PG_U_MODIFIER_LETTER}, + {0x00a9d0, 0x00a9d9, PG_U_DECIMAL_NUMBER}, + {0x00a9de, 0x00a9df, PG_U_OTHER_PUNCTUATION}, + {0x00a9e0, 0x00a9e4, PG_U_OTHER_LETTER}, + {0x00a9e5, 0x00a9e5, PG_U_NONSPACING_MARK}, + {0x00a9e6, 0x00a9e6, PG_U_MODIFIER_LETTER}, + {0x00a9e7, 0x00a9ef, PG_U_OTHER_LETTER}, + {0x00a9f0, 0x00a9f9, PG_U_DECIMAL_NUMBER}, + {0x00a9fa, 0x00a9fe, PG_U_OTHER_LETTER}, + {0x00aa00, 0x00aa28, PG_U_OTHER_LETTER}, + {0x00aa29, 0x00aa2e, PG_U_NONSPACING_MARK}, + {0x00aa2f, 0x00aa30, PG_U_SPACING_MARK}, + {0x00aa31, 0x00aa32, PG_U_NONSPACING_MARK}, + {0x00aa33, 0x00aa34, PG_U_SPACING_MARK}, + {0x00aa35, 0x00aa36, PG_U_NONSPACING_MARK}, + {0x00aa40, 0x00aa42, PG_U_OTHER_LETTER}, + {0x00aa43, 0x00aa43, PG_U_NONSPACING_MARK}, + {0x00aa44, 0x00aa4b, PG_U_OTHER_LETTER}, + {0x00aa4c, 0x00aa4c, PG_U_NONSPACING_MARK}, + {0x00aa4d, 0x00aa4d, PG_U_SPACING_MARK}, + {0x00aa50, 0x00aa59, PG_U_DECIMAL_NUMBER}, + {0x00aa5c, 0x00aa5f, PG_U_OTHER_PUNCTUATION}, + {0x00aa60, 0x00aa6f, PG_U_OTHER_LETTER}, + {0x00aa70, 0x00aa70, PG_U_MODIFIER_LETTER}, + {0x00aa71, 0x00aa76, PG_U_OTHER_LETTER}, + {0x00aa77, 0x00aa79, PG_U_OTHER_SYMBOL}, + {0x00aa7a, 0x00aa7a, PG_U_OTHER_LETTER}, + {0x00aa7b, 0x00aa7b, PG_U_SPACING_MARK}, + {0x00aa7c, 0x00aa7c, PG_U_NONSPACING_MARK}, + {0x00aa7d, 0x00aa7d, PG_U_SPACING_MARK}, + {0x00aa7e, 0x00aaaf, PG_U_OTHER_LETTER}, + {0x00aab0, 0x00aab0, PG_U_NONSPACING_MARK}, + {0x00aab1, 0x00aab1, PG_U_OTHER_LETTER}, + {0x00aab2, 0x00aab4, PG_U_NONSPACING_MARK}, + {0x00aab5, 0x00aab6, PG_U_OTHER_LETTER}, + {0x00aab7, 0x00aab8, PG_U_NONSPACING_MARK}, + {0x00aab9, 0x00aabd, PG_U_OTHER_LETTER}, + {0x00aabe, 0x00aabf, PG_U_NONSPACING_MARK}, + {0x00aac0, 0x00aac0, PG_U_OTHER_LETTER}, + {0x00aac1, 0x00aac1, PG_U_NONSPACING_MARK}, + {0x00aac2, 0x00aac2, PG_U_OTHER_LETTER}, + {0x00aadb, 0x00aadc, PG_U_OTHER_LETTER}, + {0x00aadd, 0x00aadd, PG_U_MODIFIER_LETTER}, + {0x00aade, 0x00aadf, PG_U_OTHER_PUNCTUATION}, + {0x00aae0, 0x00aaea, PG_U_OTHER_LETTER}, + {0x00aaeb, 0x00aaeb, PG_U_SPACING_MARK}, + {0x00aaec, 0x00aaed, PG_U_NONSPACING_MARK}, + {0x00aaee, 0x00aaef, PG_U_SPACING_MARK}, + {0x00aaf0, 0x00aaf1, PG_U_OTHER_PUNCTUATION}, + {0x00aaf2, 0x00aaf2, PG_U_OTHER_LETTER}, + {0x00aaf3, 0x00aaf4, PG_U_MODIFIER_LETTER}, + {0x00aaf5, 0x00aaf5, PG_U_SPACING_MARK}, + {0x00aaf6, 0x00aaf6, PG_U_NONSPACING_MARK}, + {0x00ab01, 0x00ab06, PG_U_OTHER_LETTER}, + {0x00ab09, 0x00ab0e, PG_U_OTHER_LETTER}, + {0x00ab11, 0x00ab16, PG_U_OTHER_LETTER}, + {0x00ab20, 0x00ab26, PG_U_OTHER_LETTER}, + {0x00ab28, 0x00ab2e, PG_U_OTHER_LETTER}, + {0x00ab30, 0x00ab5a, PG_U_LOWERCASE_LETTER}, + {0x00ab5b, 0x00ab5b, PG_U_MODIFIER_SYMBOL}, + {0x00ab5c, 0x00ab5f, PG_U_MODIFIER_LETTER}, + {0x00ab60, 0x00ab68, PG_U_LOWERCASE_LETTER}, + {0x00ab69, 0x00ab69, PG_U_MODIFIER_LETTER}, + {0x00ab6a, 0x00ab6b, PG_U_MODIFIER_SYMBOL}, + {0x00ab70, 0x00abbf, PG_U_LOWERCASE_LETTER}, + {0x00abc0, 0x00abe2, PG_U_OTHER_LETTER}, + {0x00abe3, 0x00abe4, PG_U_SPACING_MARK}, + {0x00abe5, 0x00abe5, PG_U_NONSPACING_MARK}, + {0x00abe6, 0x00abe7, PG_U_SPACING_MARK}, + {0x00abe8, 0x00abe8, PG_U_NONSPACING_MARK}, + {0x00abe9, 0x00abea, PG_U_SPACING_MARK}, + {0x00abeb, 0x00abeb, PG_U_OTHER_PUNCTUATION}, + {0x00abec, 0x00abec, PG_U_SPACING_MARK}, + {0x00abed, 0x00abed, PG_U_NONSPACING_MARK}, + {0x00abf0, 0x00abf9, PG_U_DECIMAL_NUMBER}, + {0x00ac00, 0x00d7a3, PG_U_OTHER_LETTER}, + {0x00d7b0, 0x00d7c6, PG_U_OTHER_LETTER}, + {0x00d7cb, 0x00d7fb, PG_U_OTHER_LETTER}, + {0x00d800, 0x00dfff, PG_U_SURROGATE}, + {0x00e000, 0x00f8ff, PG_U_PRIVATE_USE}, + {0x00f900, 0x00fa6d, PG_U_OTHER_LETTER}, + {0x00fa70, 0x00fad9, PG_U_OTHER_LETTER}, + {0x00fb00, 0x00fb06, PG_U_LOWERCASE_LETTER}, + {0x00fb13, 0x00fb17, PG_U_LOWERCASE_LETTER}, + {0x00fb1d, 0x00fb1d, PG_U_OTHER_LETTER}, + {0x00fb1e, 0x00fb1e, PG_U_NONSPACING_MARK}, + {0x00fb1f, 0x00fb28, PG_U_OTHER_LETTER}, + {0x00fb29, 0x00fb29, PG_U_MATH_SYMBOL}, + {0x00fb2a, 0x00fb36, PG_U_OTHER_LETTER}, + {0x00fb38, 0x00fb3c, PG_U_OTHER_LETTER}, + {0x00fb3e, 0x00fb3e, PG_U_OTHER_LETTER}, + {0x00fb40, 0x00fb41, PG_U_OTHER_LETTER}, + {0x00fb43, 0x00fb44, PG_U_OTHER_LETTER}, + {0x00fb46, 0x00fbb1, PG_U_OTHER_LETTER}, + {0x00fbb2, 0x00fbc2, PG_U_MODIFIER_SYMBOL}, + {0x00fbd3, 0x00fd3d, PG_U_OTHER_LETTER}, + {0x00fd3e, 0x00fd3e, PG_U_CLOSE_PUNCTUATION}, + {0x00fd3f, 0x00fd3f, PG_U_OPEN_PUNCTUATION}, + {0x00fd40, 0x00fd4f, PG_U_OTHER_SYMBOL}, + {0x00fd50, 0x00fd8f, PG_U_OTHER_LETTER}, + {0x00fd92, 0x00fdc7, PG_U_OTHER_LETTER}, + {0x00fdcf, 0x00fdcf, PG_U_OTHER_SYMBOL}, + {0x00fdf0, 0x00fdfb, PG_U_OTHER_LETTER}, + {0x00fdfc, 0x00fdfc, PG_U_CURRENCY_SYMBOL}, + {0x00fdfd, 0x00fdff, PG_U_OTHER_SYMBOL}, + {0x00fe00, 0x00fe0f, PG_U_NONSPACING_MARK}, + {0x00fe10, 0x00fe16, PG_U_OTHER_PUNCTUATION}, + {0x00fe17, 0x00fe17, PG_U_OPEN_PUNCTUATION}, + {0x00fe18, 0x00fe18, PG_U_CLOSE_PUNCTUATION}, + {0x00fe19, 0x00fe19, PG_U_OTHER_PUNCTUATION}, + {0x00fe20, 0x00fe2f, PG_U_NONSPACING_MARK}, + {0x00fe30, 0x00fe30, PG_U_OTHER_PUNCTUATION}, + {0x00fe31, 0x00fe32, PG_U_DASH_PUNCTUATION}, + {0x00fe33, 0x00fe34, PG_U_CONNECTOR_PUNCTUATION}, + {0x00fe35, 0x00fe35, PG_U_OPEN_PUNCTUATION}, + {0x00fe36, 0x00fe36, PG_U_CLOSE_PUNCTUATION}, + {0x00fe37, 0x00fe37, PG_U_OPEN_PUNCTUATION}, + {0x00fe38, 0x00fe38, PG_U_CLOSE_PUNCTUATION}, + {0x00fe39, 0x00fe39, PG_U_OPEN_PUNCTUATION}, + {0x00fe3a, 0x00fe3a, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3b, 0x00fe3b, PG_U_OPEN_PUNCTUATION}, + {0x00fe3c, 0x00fe3c, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3d, 0x00fe3d, PG_U_OPEN_PUNCTUATION}, + {0x00fe3e, 0x00fe3e, PG_U_CLOSE_PUNCTUATION}, + {0x00fe3f, 0x00fe3f, PG_U_OPEN_PUNCTUATION}, + {0x00fe40, 0x00fe40, PG_U_CLOSE_PUNCTUATION}, + {0x00fe41, 0x00fe41, PG_U_OPEN_PUNCTUATION}, + {0x00fe42, 0x00fe42, PG_U_CLOSE_PUNCTUATION}, + {0x00fe43, 0x00fe43, PG_U_OPEN_PUNCTUATION}, + {0x00fe44, 0x00fe44, PG_U_CLOSE_PUNCTUATION}, + {0x00fe45, 0x00fe46, PG_U_OTHER_PUNCTUATION}, + {0x00fe47, 0x00fe47, PG_U_OPEN_PUNCTUATION}, + {0x00fe48, 0x00fe48, PG_U_CLOSE_PUNCTUATION}, + {0x00fe49, 0x00fe4c, PG_U_OTHER_PUNCTUATION}, + {0x00fe4d, 0x00fe4f, PG_U_CONNECTOR_PUNCTUATION}, + {0x00fe50, 0x00fe52, PG_U_OTHER_PUNCTUATION}, + {0x00fe54, 0x00fe57, PG_U_OTHER_PUNCTUATION}, + {0x00fe58, 0x00fe58, PG_U_DASH_PUNCTUATION}, + {0x00fe59, 0x00fe59, PG_U_OPEN_PUNCTUATION}, + {0x00fe5a, 0x00fe5a, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5b, 0x00fe5b, PG_U_OPEN_PUNCTUATION}, + {0x00fe5c, 0x00fe5c, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5d, 0x00fe5d, PG_U_OPEN_PUNCTUATION}, + {0x00fe5e, 0x00fe5e, PG_U_CLOSE_PUNCTUATION}, + {0x00fe5f, 0x00fe61, PG_U_OTHER_PUNCTUATION}, + {0x00fe62, 0x00fe62, PG_U_MATH_SYMBOL}, + {0x00fe63, 0x00fe63, PG_U_DASH_PUNCTUATION}, + {0x00fe64, 0x00fe66, PG_U_MATH_SYMBOL}, + {0x00fe68, 0x00fe68, PG_U_OTHER_PUNCTUATION}, + {0x00fe69, 0x00fe69, PG_U_CURRENCY_SYMBOL}, + {0x00fe6a, 0x00fe6b, PG_U_OTHER_PUNCTUATION}, + {0x00fe70, 0x00fe74, PG_U_OTHER_LETTER}, + {0x00fe76, 0x00fefc, PG_U_OTHER_LETTER}, + {0x00feff, 0x00feff, PG_U_FORMAT}, + {0x00ff01, 0x00ff03, PG_U_OTHER_PUNCTUATION}, + {0x00ff04, 0x00ff04, PG_U_CURRENCY_SYMBOL}, + {0x00ff05, 0x00ff07, PG_U_OTHER_PUNCTUATION}, + {0x00ff08, 0x00ff08, PG_U_OPEN_PUNCTUATION}, + {0x00ff09, 0x00ff09, PG_U_CLOSE_PUNCTUATION}, + {0x00ff0a, 0x00ff0a, PG_U_OTHER_PUNCTUATION}, + {0x00ff0b, 0x00ff0b, PG_U_MATH_SYMBOL}, + {0x00ff0c, 0x00ff0c, PG_U_OTHER_PUNCTUATION}, + {0x00ff0d, 0x00ff0d, PG_U_DASH_PUNCTUATION}, + {0x00ff0e, 0x00ff0f, PG_U_OTHER_PUNCTUATION}, + {0x00ff10, 0x00ff19, PG_U_DECIMAL_NUMBER}, + {0x00ff1a, 0x00ff1b, PG_U_OTHER_PUNCTUATION}, + {0x00ff1c, 0x00ff1e, PG_U_MATH_SYMBOL}, + {0x00ff1f, 0x00ff20, PG_U_OTHER_PUNCTUATION}, + {0x00ff21, 0x00ff3a, PG_U_UPPERCASE_LETTER}, + {0x00ff3b, 0x00ff3b, PG_U_OPEN_PUNCTUATION}, + {0x00ff3c, 0x00ff3c, PG_U_OTHER_PUNCTUATION}, + {0x00ff3d, 0x00ff3d, PG_U_CLOSE_PUNCTUATION}, + {0x00ff3e, 0x00ff3e, PG_U_MODIFIER_SYMBOL}, + {0x00ff3f, 0x00ff3f, PG_U_CONNECTOR_PUNCTUATION}, + {0x00ff40, 0x00ff40, PG_U_MODIFIER_SYMBOL}, + {0x00ff41, 0x00ff5a, PG_U_LOWERCASE_LETTER}, + {0x00ff5b, 0x00ff5b, PG_U_OPEN_PUNCTUATION}, + {0x00ff5c, 0x00ff5c, PG_U_MATH_SYMBOL}, + {0x00ff5d, 0x00ff5d, PG_U_CLOSE_PUNCTUATION}, + {0x00ff5e, 0x00ff5e, PG_U_MATH_SYMBOL}, + {0x00ff5f, 0x00ff5f, PG_U_OPEN_PUNCTUATION}, + {0x00ff60, 0x00ff60, PG_U_CLOSE_PUNCTUATION}, + {0x00ff61, 0x00ff61, PG_U_OTHER_PUNCTUATION}, + {0x00ff62, 0x00ff62, PG_U_OPEN_PUNCTUATION}, + {0x00ff63, 0x00ff63, PG_U_CLOSE_PUNCTUATION}, + {0x00ff64, 0x00ff65, PG_U_OTHER_PUNCTUATION}, + {0x00ff66, 0x00ff6f, PG_U_OTHER_LETTER}, + {0x00ff70, 0x00ff70, PG_U_MODIFIER_LETTER}, + {0x00ff71, 0x00ff9d, PG_U_OTHER_LETTER}, + {0x00ff9e, 0x00ff9f, PG_U_MODIFIER_LETTER}, + {0x00ffa0, 0x00ffbe, PG_U_OTHER_LETTER}, + {0x00ffc2, 0x00ffc7, PG_U_OTHER_LETTER}, + {0x00ffca, 0x00ffcf, PG_U_OTHER_LETTER}, + {0x00ffd2, 0x00ffd7, PG_U_OTHER_LETTER}, + {0x00ffda, 0x00ffdc, PG_U_OTHER_LETTER}, + {0x00ffe0, 0x00ffe1, PG_U_CURRENCY_SYMBOL}, + {0x00ffe2, 0x00ffe2, PG_U_MATH_SYMBOL}, + {0x00ffe3, 0x00ffe3, PG_U_MODIFIER_SYMBOL}, + {0x00ffe4, 0x00ffe4, PG_U_OTHER_SYMBOL}, + {0x00ffe5, 0x00ffe6, PG_U_CURRENCY_SYMBOL}, + {0x00ffe8, 0x00ffe8, PG_U_OTHER_SYMBOL}, + {0x00ffe9, 0x00ffec, PG_U_MATH_SYMBOL}, + {0x00ffed, 0x00ffee, PG_U_OTHER_SYMBOL}, + {0x00fff9, 0x00fffb, PG_U_FORMAT}, + {0x00fffc, 0x00fffd, PG_U_OTHER_SYMBOL}, + {0x010000, 0x01000b, PG_U_OTHER_LETTER}, + {0x01000d, 0x010026, PG_U_OTHER_LETTER}, + {0x010028, 0x01003a, PG_U_OTHER_LETTER}, + {0x01003c, 0x01003d, PG_U_OTHER_LETTER}, + {0x01003f, 0x01004d, PG_U_OTHER_LETTER}, + {0x010050, 0x01005d, PG_U_OTHER_LETTER}, + {0x010080, 0x0100fa, PG_U_OTHER_LETTER}, + {0x010100, 0x010102, PG_U_OTHER_PUNCTUATION}, + {0x010107, 0x010133, PG_U_OTHER_NUMBER}, + {0x010137, 0x01013f, PG_U_OTHER_SYMBOL}, + {0x010140, 0x010174, PG_U_LETTER_NUMBER}, + {0x010175, 0x010178, PG_U_OTHER_NUMBER}, + {0x010179, 0x010189, PG_U_OTHER_SYMBOL}, + {0x01018a, 0x01018b, PG_U_OTHER_NUMBER}, + {0x01018c, 0x01018e, PG_U_OTHER_SYMBOL}, + {0x010190, 0x01019c, PG_U_OTHER_SYMBOL}, + {0x0101a0, 0x0101a0, PG_U_OTHER_SYMBOL}, + {0x0101d0, 0x0101fc, PG_U_OTHER_SYMBOL}, + {0x0101fd, 0x0101fd, PG_U_NONSPACING_MARK}, + {0x010280, 0x01029c, PG_U_OTHER_LETTER}, + {0x0102a0, 0x0102d0, PG_U_OTHER_LETTER}, + {0x0102e0, 0x0102e0, PG_U_NONSPACING_MARK}, + {0x0102e1, 0x0102fb, PG_U_OTHER_NUMBER}, + {0x010300, 0x01031f, PG_U_OTHER_LETTER}, + {0x010320, 0x010323, PG_U_OTHER_NUMBER}, + {0x01032d, 0x010340, PG_U_OTHER_LETTER}, + {0x010341, 0x010341, PG_U_LETTER_NUMBER}, + {0x010342, 0x010349, PG_U_OTHER_LETTER}, + {0x01034a, 0x01034a, PG_U_LETTER_NUMBER}, + {0x010350, 0x010375, PG_U_OTHER_LETTER}, + {0x010376, 0x01037a, PG_U_NONSPACING_MARK}, + {0x010380, 0x01039d, PG_U_OTHER_LETTER}, + {0x01039f, 0x01039f, PG_U_OTHER_PUNCTUATION}, + {0x0103a0, 0x0103c3, PG_U_OTHER_LETTER}, + {0x0103c8, 0x0103cf, PG_U_OTHER_LETTER}, + {0x0103d0, 0x0103d0, PG_U_OTHER_PUNCTUATION}, + {0x0103d1, 0x0103d5, PG_U_LETTER_NUMBER}, + {0x010400, 0x010427, PG_U_UPPERCASE_LETTER}, + {0x010428, 0x01044f, PG_U_LOWERCASE_LETTER}, + {0x010450, 0x01049d, PG_U_OTHER_LETTER}, + {0x0104a0, 0x0104a9, PG_U_DECIMAL_NUMBER}, + {0x0104b0, 0x0104d3, PG_U_UPPERCASE_LETTER}, + {0x0104d8, 0x0104fb, PG_U_LOWERCASE_LETTER}, + {0x010500, 0x010527, PG_U_OTHER_LETTER}, + {0x010530, 0x010563, PG_U_OTHER_LETTER}, + {0x01056f, 0x01056f, PG_U_OTHER_PUNCTUATION}, + {0x010570, 0x01057a, PG_U_UPPERCASE_LETTER}, + {0x01057c, 0x01058a, PG_U_UPPERCASE_LETTER}, + {0x01058c, 0x010592, PG_U_UPPERCASE_LETTER}, + {0x010594, 0x010595, PG_U_UPPERCASE_LETTER}, + {0x010597, 0x0105a1, PG_U_LOWERCASE_LETTER}, + {0x0105a3, 0x0105b1, PG_U_LOWERCASE_LETTER}, + {0x0105b3, 0x0105b9, PG_U_LOWERCASE_LETTER}, + {0x0105bb, 0x0105bc, PG_U_LOWERCASE_LETTER}, + {0x010600, 0x010736, PG_U_OTHER_LETTER}, + {0x010740, 0x010755, PG_U_OTHER_LETTER}, + {0x010760, 0x010767, PG_U_OTHER_LETTER}, + {0x010780, 0x010785, PG_U_MODIFIER_LETTER}, + {0x010787, 0x0107b0, PG_U_MODIFIER_LETTER}, + {0x0107b2, 0x0107ba, PG_U_MODIFIER_LETTER}, + {0x010800, 0x010805, PG_U_OTHER_LETTER}, + {0x010808, 0x010808, PG_U_OTHER_LETTER}, + {0x01080a, 0x010835, PG_U_OTHER_LETTER}, + {0x010837, 0x010838, PG_U_OTHER_LETTER}, + {0x01083c, 0x01083c, PG_U_OTHER_LETTER}, + {0x01083f, 0x010855, PG_U_OTHER_LETTER}, + {0x010857, 0x010857, PG_U_OTHER_PUNCTUATION}, + {0x010858, 0x01085f, PG_U_OTHER_NUMBER}, + {0x010860, 0x010876, PG_U_OTHER_LETTER}, + {0x010877, 0x010878, PG_U_OTHER_SYMBOL}, + {0x010879, 0x01087f, PG_U_OTHER_NUMBER}, + {0x010880, 0x01089e, PG_U_OTHER_LETTER}, + {0x0108a7, 0x0108af, PG_U_OTHER_NUMBER}, + {0x0108e0, 0x0108f2, PG_U_OTHER_LETTER}, + {0x0108f4, 0x0108f5, PG_U_OTHER_LETTER}, + {0x0108fb, 0x0108ff, PG_U_OTHER_NUMBER}, + {0x010900, 0x010915, PG_U_OTHER_LETTER}, + {0x010916, 0x01091b, PG_U_OTHER_NUMBER}, + {0x01091f, 0x01091f, PG_U_OTHER_PUNCTUATION}, + {0x010920, 0x010939, PG_U_OTHER_LETTER}, + {0x01093f, 0x01093f, PG_U_OTHER_PUNCTUATION}, + {0x010980, 0x0109b7, PG_U_OTHER_LETTER}, + {0x0109bc, 0x0109bd, PG_U_OTHER_NUMBER}, + {0x0109be, 0x0109bf, PG_U_OTHER_LETTER}, + {0x0109c0, 0x0109cf, PG_U_OTHER_NUMBER}, + {0x0109d2, 0x0109ff, PG_U_OTHER_NUMBER}, + {0x010a00, 0x010a00, PG_U_OTHER_LETTER}, + {0x010a01, 0x010a03, PG_U_NONSPACING_MARK}, + {0x010a05, 0x010a06, PG_U_NONSPACING_MARK}, + {0x010a0c, 0x010a0f, PG_U_NONSPACING_MARK}, + {0x010a10, 0x010a13, PG_U_OTHER_LETTER}, + {0x010a15, 0x010a17, PG_U_OTHER_LETTER}, + {0x010a19, 0x010a35, PG_U_OTHER_LETTER}, + {0x010a38, 0x010a3a, PG_U_NONSPACING_MARK}, + {0x010a3f, 0x010a3f, PG_U_NONSPACING_MARK}, + {0x010a40, 0x010a48, PG_U_OTHER_NUMBER}, + {0x010a50, 0x010a58, PG_U_OTHER_PUNCTUATION}, + {0x010a60, 0x010a7c, PG_U_OTHER_LETTER}, + {0x010a7d, 0x010a7e, PG_U_OTHER_NUMBER}, + {0x010a7f, 0x010a7f, PG_U_OTHER_PUNCTUATION}, + {0x010a80, 0x010a9c, PG_U_OTHER_LETTER}, + {0x010a9d, 0x010a9f, PG_U_OTHER_NUMBER}, + {0x010ac0, 0x010ac7, PG_U_OTHER_LETTER}, + {0x010ac8, 0x010ac8, PG_U_OTHER_SYMBOL}, + {0x010ac9, 0x010ae4, PG_U_OTHER_LETTER}, + {0x010ae5, 0x010ae6, PG_U_NONSPACING_MARK}, + {0x010aeb, 0x010aef, PG_U_OTHER_NUMBER}, + {0x010af0, 0x010af6, PG_U_OTHER_PUNCTUATION}, + {0x010b00, 0x010b35, PG_U_OTHER_LETTER}, + {0x010b39, 0x010b3f, PG_U_OTHER_PUNCTUATION}, + {0x010b40, 0x010b55, PG_U_OTHER_LETTER}, + {0x010b58, 0x010b5f, PG_U_OTHER_NUMBER}, + {0x010b60, 0x010b72, PG_U_OTHER_LETTER}, + {0x010b78, 0x010b7f, PG_U_OTHER_NUMBER}, + {0x010b80, 0x010b91, PG_U_OTHER_LETTER}, + {0x010b99, 0x010b9c, PG_U_OTHER_PUNCTUATION}, + {0x010ba9, 0x010baf, PG_U_OTHER_NUMBER}, + {0x010c00, 0x010c48, PG_U_OTHER_LETTER}, + {0x010c80, 0x010cb2, PG_U_UPPERCASE_LETTER}, + {0x010cc0, 0x010cf2, PG_U_LOWERCASE_LETTER}, + {0x010cfa, 0x010cff, PG_U_OTHER_NUMBER}, + {0x010d00, 0x010d23, PG_U_OTHER_LETTER}, + {0x010d24, 0x010d27, PG_U_NONSPACING_MARK}, + {0x010d30, 0x010d39, PG_U_DECIMAL_NUMBER}, + {0x010e60, 0x010e7e, PG_U_OTHER_NUMBER}, + {0x010e80, 0x010ea9, PG_U_OTHER_LETTER}, + {0x010eab, 0x010eac, PG_U_NONSPACING_MARK}, + {0x010ead, 0x010ead, PG_U_DASH_PUNCTUATION}, + {0x010eb0, 0x010eb1, PG_U_OTHER_LETTER}, + {0x010efd, 0x010eff, PG_U_NONSPACING_MARK}, + {0x010f00, 0x010f1c, PG_U_OTHER_LETTER}, + {0x010f1d, 0x010f26, PG_U_OTHER_NUMBER}, + {0x010f27, 0x010f27, PG_U_OTHER_LETTER}, + {0x010f30, 0x010f45, PG_U_OTHER_LETTER}, + {0x010f46, 0x010f50, PG_U_NONSPACING_MARK}, + {0x010f51, 0x010f54, PG_U_OTHER_NUMBER}, + {0x010f55, 0x010f59, PG_U_OTHER_PUNCTUATION}, + {0x010f70, 0x010f81, PG_U_OTHER_LETTER}, + {0x010f82, 0x010f85, PG_U_NONSPACING_MARK}, + {0x010f86, 0x010f89, PG_U_OTHER_PUNCTUATION}, + {0x010fb0, 0x010fc4, PG_U_OTHER_LETTER}, + {0x010fc5, 0x010fcb, PG_U_OTHER_NUMBER}, + {0x010fe0, 0x010ff6, PG_U_OTHER_LETTER}, + {0x011000, 0x011000, PG_U_SPACING_MARK}, + {0x011001, 0x011001, PG_U_NONSPACING_MARK}, + {0x011002, 0x011002, PG_U_SPACING_MARK}, + {0x011003, 0x011037, PG_U_OTHER_LETTER}, + {0x011038, 0x011046, PG_U_NONSPACING_MARK}, + {0x011047, 0x01104d, PG_U_OTHER_PUNCTUATION}, + {0x011052, 0x011065, PG_U_OTHER_NUMBER}, + {0x011066, 0x01106f, PG_U_DECIMAL_NUMBER}, + {0x011070, 0x011070, PG_U_NONSPACING_MARK}, + {0x011071, 0x011072, PG_U_OTHER_LETTER}, + {0x011073, 0x011074, PG_U_NONSPACING_MARK}, + {0x011075, 0x011075, PG_U_OTHER_LETTER}, + {0x01107f, 0x011081, PG_U_NONSPACING_MARK}, + {0x011082, 0x011082, PG_U_SPACING_MARK}, + {0x011083, 0x0110af, PG_U_OTHER_LETTER}, + {0x0110b0, 0x0110b2, PG_U_SPACING_MARK}, + {0x0110b3, 0x0110b6, PG_U_NONSPACING_MARK}, + {0x0110b7, 0x0110b8, PG_U_SPACING_MARK}, + {0x0110b9, 0x0110ba, PG_U_NONSPACING_MARK}, + {0x0110bb, 0x0110bc, PG_U_OTHER_PUNCTUATION}, + {0x0110bd, 0x0110bd, PG_U_FORMAT}, + {0x0110be, 0x0110c1, PG_U_OTHER_PUNCTUATION}, + {0x0110c2, 0x0110c2, PG_U_NONSPACING_MARK}, + {0x0110cd, 0x0110cd, PG_U_FORMAT}, + {0x0110d0, 0x0110e8, PG_U_OTHER_LETTER}, + {0x0110f0, 0x0110f9, PG_U_DECIMAL_NUMBER}, + {0x011100, 0x011102, PG_U_NONSPACING_MARK}, + {0x011103, 0x011126, PG_U_OTHER_LETTER}, + {0x011127, 0x01112b, PG_U_NONSPACING_MARK}, + {0x01112c, 0x01112c, PG_U_SPACING_MARK}, + {0x01112d, 0x011134, PG_U_NONSPACING_MARK}, + {0x011136, 0x01113f, PG_U_DECIMAL_NUMBER}, + {0x011140, 0x011143, PG_U_OTHER_PUNCTUATION}, + {0x011144, 0x011144, PG_U_OTHER_LETTER}, + {0x011145, 0x011146, PG_U_SPACING_MARK}, + {0x011147, 0x011147, PG_U_OTHER_LETTER}, + {0x011150, 0x011172, PG_U_OTHER_LETTER}, + {0x011173, 0x011173, PG_U_NONSPACING_MARK}, + {0x011174, 0x011175, PG_U_OTHER_PUNCTUATION}, + {0x011176, 0x011176, PG_U_OTHER_LETTER}, + {0x011180, 0x011181, PG_U_NONSPACING_MARK}, + {0x011182, 0x011182, PG_U_SPACING_MARK}, + {0x011183, 0x0111b2, PG_U_OTHER_LETTER}, + {0x0111b3, 0x0111b5, PG_U_SPACING_MARK}, + {0x0111b6, 0x0111be, PG_U_NONSPACING_MARK}, + {0x0111bf, 0x0111c0, PG_U_SPACING_MARK}, + {0x0111c1, 0x0111c4, PG_U_OTHER_LETTER}, + {0x0111c5, 0x0111c8, PG_U_OTHER_PUNCTUATION}, + {0x0111c9, 0x0111cc, PG_U_NONSPACING_MARK}, + {0x0111cd, 0x0111cd, PG_U_OTHER_PUNCTUATION}, + {0x0111ce, 0x0111ce, PG_U_SPACING_MARK}, + {0x0111cf, 0x0111cf, PG_U_NONSPACING_MARK}, + {0x0111d0, 0x0111d9, PG_U_DECIMAL_NUMBER}, + {0x0111da, 0x0111da, PG_U_OTHER_LETTER}, + {0x0111db, 0x0111db, PG_U_OTHER_PUNCTUATION}, + {0x0111dc, 0x0111dc, PG_U_OTHER_LETTER}, + {0x0111dd, 0x0111df, PG_U_OTHER_PUNCTUATION}, + {0x0111e1, 0x0111f4, PG_U_OTHER_NUMBER}, + {0x011200, 0x011211, PG_U_OTHER_LETTER}, + {0x011213, 0x01122b, PG_U_OTHER_LETTER}, + {0x01122c, 0x01122e, PG_U_SPACING_MARK}, + {0x01122f, 0x011231, PG_U_NONSPACING_MARK}, + {0x011232, 0x011233, PG_U_SPACING_MARK}, + {0x011234, 0x011234, PG_U_NONSPACING_MARK}, + {0x011235, 0x011235, PG_U_SPACING_MARK}, + {0x011236, 0x011237, PG_U_NONSPACING_MARK}, + {0x011238, 0x01123d, PG_U_OTHER_PUNCTUATION}, + {0x01123e, 0x01123e, PG_U_NONSPACING_MARK}, + {0x01123f, 0x011240, PG_U_OTHER_LETTER}, + {0x011241, 0x011241, PG_U_NONSPACING_MARK}, + {0x011280, 0x011286, PG_U_OTHER_LETTER}, + {0x011288, 0x011288, PG_U_OTHER_LETTER}, + {0x01128a, 0x01128d, PG_U_OTHER_LETTER}, + {0x01128f, 0x01129d, PG_U_OTHER_LETTER}, + {0x01129f, 0x0112a8, PG_U_OTHER_LETTER}, + {0x0112a9, 0x0112a9, PG_U_OTHER_PUNCTUATION}, + {0x0112b0, 0x0112de, PG_U_OTHER_LETTER}, + {0x0112df, 0x0112df, PG_U_NONSPACING_MARK}, + {0x0112e0, 0x0112e2, PG_U_SPACING_MARK}, + {0x0112e3, 0x0112ea, PG_U_NONSPACING_MARK}, + {0x0112f0, 0x0112f9, PG_U_DECIMAL_NUMBER}, + {0x011300, 0x011301, PG_U_NONSPACING_MARK}, + {0x011302, 0x011303, PG_U_SPACING_MARK}, + {0x011305, 0x01130c, PG_U_OTHER_LETTER}, + {0x01130f, 0x011310, PG_U_OTHER_LETTER}, + {0x011313, 0x011328, PG_U_OTHER_LETTER}, + {0x01132a, 0x011330, PG_U_OTHER_LETTER}, + {0x011332, 0x011333, PG_U_OTHER_LETTER}, + {0x011335, 0x011339, PG_U_OTHER_LETTER}, + {0x01133b, 0x01133c, PG_U_NONSPACING_MARK}, + {0x01133d, 0x01133d, PG_U_OTHER_LETTER}, + {0x01133e, 0x01133f, PG_U_SPACING_MARK}, + {0x011340, 0x011340, PG_U_NONSPACING_MARK}, + {0x011341, 0x011344, PG_U_SPACING_MARK}, + {0x011347, 0x011348, PG_U_SPACING_MARK}, + {0x01134b, 0x01134d, PG_U_SPACING_MARK}, + {0x011350, 0x011350, PG_U_OTHER_LETTER}, + {0x011357, 0x011357, PG_U_SPACING_MARK}, + {0x01135d, 0x011361, PG_U_OTHER_LETTER}, + {0x011362, 0x011363, PG_U_SPACING_MARK}, + {0x011366, 0x01136c, PG_U_NONSPACING_MARK}, + {0x011370, 0x011374, PG_U_NONSPACING_MARK}, + {0x011400, 0x011434, PG_U_OTHER_LETTER}, + {0x011435, 0x011437, PG_U_SPACING_MARK}, + {0x011438, 0x01143f, PG_U_NONSPACING_MARK}, + {0x011440, 0x011441, PG_U_SPACING_MARK}, + {0x011442, 0x011444, PG_U_NONSPACING_MARK}, + {0x011445, 0x011445, PG_U_SPACING_MARK}, + {0x011446, 0x011446, PG_U_NONSPACING_MARK}, + {0x011447, 0x01144a, PG_U_OTHER_LETTER}, + {0x01144b, 0x01144f, PG_U_OTHER_PUNCTUATION}, + {0x011450, 0x011459, PG_U_DECIMAL_NUMBER}, + {0x01145a, 0x01145b, PG_U_OTHER_PUNCTUATION}, + {0x01145d, 0x01145d, PG_U_OTHER_PUNCTUATION}, + {0x01145e, 0x01145e, PG_U_NONSPACING_MARK}, + {0x01145f, 0x011461, PG_U_OTHER_LETTER}, + {0x011480, 0x0114af, PG_U_OTHER_LETTER}, + {0x0114b0, 0x0114b2, PG_U_SPACING_MARK}, + {0x0114b3, 0x0114b8, PG_U_NONSPACING_MARK}, + {0x0114b9, 0x0114b9, PG_U_SPACING_MARK}, + {0x0114ba, 0x0114ba, PG_U_NONSPACING_MARK}, + {0x0114bb, 0x0114be, PG_U_SPACING_MARK}, + {0x0114bf, 0x0114c0, PG_U_NONSPACING_MARK}, + {0x0114c1, 0x0114c1, PG_U_SPACING_MARK}, + {0x0114c2, 0x0114c3, PG_U_NONSPACING_MARK}, + {0x0114c4, 0x0114c5, PG_U_OTHER_LETTER}, + {0x0114c6, 0x0114c6, PG_U_OTHER_PUNCTUATION}, + {0x0114c7, 0x0114c7, PG_U_OTHER_LETTER}, + {0x0114d0, 0x0114d9, PG_U_DECIMAL_NUMBER}, + {0x011580, 0x0115ae, PG_U_OTHER_LETTER}, + {0x0115af, 0x0115b1, PG_U_SPACING_MARK}, + {0x0115b2, 0x0115b5, PG_U_NONSPACING_MARK}, + {0x0115b8, 0x0115bb, PG_U_SPACING_MARK}, + {0x0115bc, 0x0115bd, PG_U_NONSPACING_MARK}, + {0x0115be, 0x0115be, PG_U_SPACING_MARK}, + {0x0115bf, 0x0115c0, PG_U_NONSPACING_MARK}, + {0x0115c1, 0x0115d7, PG_U_OTHER_PUNCTUATION}, + {0x0115d8, 0x0115db, PG_U_OTHER_LETTER}, + {0x0115dc, 0x0115dd, PG_U_NONSPACING_MARK}, + {0x011600, 0x01162f, PG_U_OTHER_LETTER}, + {0x011630, 0x011632, PG_U_SPACING_MARK}, + {0x011633, 0x01163a, PG_U_NONSPACING_MARK}, + {0x01163b, 0x01163c, PG_U_SPACING_MARK}, + {0x01163d, 0x01163d, PG_U_NONSPACING_MARK}, + {0x01163e, 0x01163e, PG_U_SPACING_MARK}, + {0x01163f, 0x011640, PG_U_NONSPACING_MARK}, + {0x011641, 0x011643, PG_U_OTHER_PUNCTUATION}, + {0x011644, 0x011644, PG_U_OTHER_LETTER}, + {0x011650, 0x011659, PG_U_DECIMAL_NUMBER}, + {0x011660, 0x01166c, PG_U_OTHER_PUNCTUATION}, + {0x011680, 0x0116aa, PG_U_OTHER_LETTER}, + {0x0116ab, 0x0116ab, PG_U_NONSPACING_MARK}, + {0x0116ac, 0x0116ac, PG_U_SPACING_MARK}, + {0x0116ad, 0x0116ad, PG_U_NONSPACING_MARK}, + {0x0116ae, 0x0116af, PG_U_SPACING_MARK}, + {0x0116b0, 0x0116b5, PG_U_NONSPACING_MARK}, + {0x0116b6, 0x0116b6, PG_U_SPACING_MARK}, + {0x0116b7, 0x0116b7, PG_U_NONSPACING_MARK}, + {0x0116b8, 0x0116b8, PG_U_OTHER_LETTER}, + {0x0116b9, 0x0116b9, PG_U_OTHER_PUNCTUATION}, + {0x0116c0, 0x0116c9, PG_U_DECIMAL_NUMBER}, + {0x011700, 0x01171a, PG_U_OTHER_LETTER}, + {0x01171d, 0x01171f, PG_U_NONSPACING_MARK}, + {0x011720, 0x011721, PG_U_SPACING_MARK}, + {0x011722, 0x011725, PG_U_NONSPACING_MARK}, + {0x011726, 0x011726, PG_U_SPACING_MARK}, + {0x011727, 0x01172b, PG_U_NONSPACING_MARK}, + {0x011730, 0x011739, PG_U_DECIMAL_NUMBER}, + {0x01173a, 0x01173b, PG_U_OTHER_NUMBER}, + {0x01173c, 0x01173e, PG_U_OTHER_PUNCTUATION}, + {0x01173f, 0x01173f, PG_U_OTHER_SYMBOL}, + {0x011740, 0x011746, PG_U_OTHER_LETTER}, + {0x011800, 0x01182b, PG_U_OTHER_LETTER}, + {0x01182c, 0x01182e, PG_U_SPACING_MARK}, + {0x01182f, 0x011837, PG_U_NONSPACING_MARK}, + {0x011838, 0x011838, PG_U_SPACING_MARK}, + {0x011839, 0x01183a, PG_U_NONSPACING_MARK}, + {0x01183b, 0x01183b, PG_U_OTHER_PUNCTUATION}, + {0x0118a0, 0x0118bf, PG_U_UPPERCASE_LETTER}, + {0x0118c0, 0x0118df, PG_U_LOWERCASE_LETTER}, + {0x0118e0, 0x0118e9, PG_U_DECIMAL_NUMBER}, + {0x0118ea, 0x0118f2, PG_U_OTHER_NUMBER}, + {0x0118ff, 0x011906, PG_U_OTHER_LETTER}, + {0x011909, 0x011909, PG_U_OTHER_LETTER}, + {0x01190c, 0x011913, PG_U_OTHER_LETTER}, + {0x011915, 0x011916, PG_U_OTHER_LETTER}, + {0x011918, 0x01192f, PG_U_OTHER_LETTER}, + {0x011930, 0x011935, PG_U_SPACING_MARK}, + {0x011937, 0x011938, PG_U_SPACING_MARK}, + {0x01193b, 0x01193c, PG_U_NONSPACING_MARK}, + {0x01193d, 0x01193d, PG_U_SPACING_MARK}, + {0x01193e, 0x01193e, PG_U_NONSPACING_MARK}, + {0x01193f, 0x01193f, PG_U_OTHER_LETTER}, + {0x011940, 0x011940, PG_U_SPACING_MARK}, + {0x011941, 0x011941, PG_U_OTHER_LETTER}, + {0x011942, 0x011942, PG_U_SPACING_MARK}, + {0x011943, 0x011943, PG_U_NONSPACING_MARK}, + {0x011944, 0x011946, PG_U_OTHER_PUNCTUATION}, + {0x011950, 0x011959, PG_U_DECIMAL_NUMBER}, + {0x0119a0, 0x0119a7, PG_U_OTHER_LETTER}, + {0x0119aa, 0x0119d0, PG_U_OTHER_LETTER}, + {0x0119d1, 0x0119d3, PG_U_SPACING_MARK}, + {0x0119d4, 0x0119d7, PG_U_NONSPACING_MARK}, + {0x0119da, 0x0119db, PG_U_NONSPACING_MARK}, + {0x0119dc, 0x0119df, PG_U_SPACING_MARK}, + {0x0119e0, 0x0119e0, PG_U_NONSPACING_MARK}, + {0x0119e1, 0x0119e1, PG_U_OTHER_LETTER}, + {0x0119e2, 0x0119e2, PG_U_OTHER_PUNCTUATION}, + {0x0119e3, 0x0119e3, PG_U_OTHER_LETTER}, + {0x0119e4, 0x0119e4, PG_U_SPACING_MARK}, + {0x011a00, 0x011a00, PG_U_OTHER_LETTER}, + {0x011a01, 0x011a0a, PG_U_NONSPACING_MARK}, + {0x011a0b, 0x011a32, PG_U_OTHER_LETTER}, + {0x011a33, 0x011a38, PG_U_NONSPACING_MARK}, + {0x011a39, 0x011a39, PG_U_SPACING_MARK}, + {0x011a3a, 0x011a3a, PG_U_OTHER_LETTER}, + {0x011a3b, 0x011a3e, PG_U_NONSPACING_MARK}, + {0x011a3f, 0x011a46, PG_U_OTHER_PUNCTUATION}, + {0x011a47, 0x011a47, PG_U_NONSPACING_MARK}, + {0x011a50, 0x011a50, PG_U_OTHER_LETTER}, + {0x011a51, 0x011a56, PG_U_NONSPACING_MARK}, + {0x011a57, 0x011a58, PG_U_SPACING_MARK}, + {0x011a59, 0x011a5b, PG_U_NONSPACING_MARK}, + {0x011a5c, 0x011a89, PG_U_OTHER_LETTER}, + {0x011a8a, 0x011a96, PG_U_NONSPACING_MARK}, + {0x011a97, 0x011a97, PG_U_SPACING_MARK}, + {0x011a98, 0x011a99, PG_U_NONSPACING_MARK}, + {0x011a9a, 0x011a9c, PG_U_OTHER_PUNCTUATION}, + {0x011a9d, 0x011a9d, PG_U_OTHER_LETTER}, + {0x011a9e, 0x011aa2, PG_U_OTHER_PUNCTUATION}, + {0x011ab0, 0x011af8, PG_U_OTHER_LETTER}, + {0x011b00, 0x011b09, PG_U_OTHER_PUNCTUATION}, + {0x011c00, 0x011c08, PG_U_OTHER_LETTER}, + {0x011c0a, 0x011c2e, PG_U_OTHER_LETTER}, + {0x011c2f, 0x011c2f, PG_U_SPACING_MARK}, + {0x011c30, 0x011c36, PG_U_NONSPACING_MARK}, + {0x011c38, 0x011c3d, PG_U_NONSPACING_MARK}, + {0x011c3e, 0x011c3e, PG_U_SPACING_MARK}, + {0x011c3f, 0x011c3f, PG_U_NONSPACING_MARK}, + {0x011c40, 0x011c40, PG_U_OTHER_LETTER}, + {0x011c41, 0x011c45, PG_U_OTHER_PUNCTUATION}, + {0x011c50, 0x011c59, PG_U_DECIMAL_NUMBER}, + {0x011c5a, 0x011c6c, PG_U_OTHER_NUMBER}, + {0x011c70, 0x011c71, PG_U_OTHER_PUNCTUATION}, + {0x011c72, 0x011c8f, PG_U_OTHER_LETTER}, + {0x011c92, 0x011ca7, PG_U_NONSPACING_MARK}, + {0x011ca9, 0x011ca9, PG_U_SPACING_MARK}, + {0x011caa, 0x011cb0, PG_U_NONSPACING_MARK}, + {0x011cb1, 0x011cb1, PG_U_SPACING_MARK}, + {0x011cb2, 0x011cb3, PG_U_NONSPACING_MARK}, + {0x011cb4, 0x011cb4, PG_U_SPACING_MARK}, + {0x011cb5, 0x011cb6, PG_U_NONSPACING_MARK}, + {0x011d00, 0x011d06, PG_U_OTHER_LETTER}, + {0x011d08, 0x011d09, PG_U_OTHER_LETTER}, + {0x011d0b, 0x011d30, PG_U_OTHER_LETTER}, + {0x011d31, 0x011d36, PG_U_NONSPACING_MARK}, + {0x011d3a, 0x011d3a, PG_U_NONSPACING_MARK}, + {0x011d3c, 0x011d3d, PG_U_NONSPACING_MARK}, + {0x011d3f, 0x011d45, PG_U_NONSPACING_MARK}, + {0x011d46, 0x011d46, PG_U_OTHER_LETTER}, + {0x011d47, 0x011d47, PG_U_NONSPACING_MARK}, + {0x011d50, 0x011d59, PG_U_DECIMAL_NUMBER}, + {0x011d60, 0x011d65, PG_U_OTHER_LETTER}, + {0x011d67, 0x011d68, PG_U_OTHER_LETTER}, + {0x011d6a, 0x011d89, PG_U_OTHER_LETTER}, + {0x011d8a, 0x011d8e, PG_U_SPACING_MARK}, + {0x011d90, 0x011d91, PG_U_NONSPACING_MARK}, + {0x011d93, 0x011d94, PG_U_SPACING_MARK}, + {0x011d95, 0x011d95, PG_U_NONSPACING_MARK}, + {0x011d96, 0x011d96, PG_U_SPACING_MARK}, + {0x011d97, 0x011d97, PG_U_NONSPACING_MARK}, + {0x011d98, 0x011d98, PG_U_OTHER_LETTER}, + {0x011da0, 0x011da9, PG_U_DECIMAL_NUMBER}, + {0x011ee0, 0x011ef2, PG_U_OTHER_LETTER}, + {0x011ef3, 0x011ef4, PG_U_NONSPACING_MARK}, + {0x011ef5, 0x011ef6, PG_U_SPACING_MARK}, + {0x011ef7, 0x011ef8, PG_U_OTHER_PUNCTUATION}, + {0x011f00, 0x011f01, PG_U_NONSPACING_MARK}, + {0x011f02, 0x011f02, PG_U_OTHER_LETTER}, + {0x011f03, 0x011f03, PG_U_SPACING_MARK}, + {0x011f04, 0x011f10, PG_U_OTHER_LETTER}, + {0x011f12, 0x011f33, PG_U_OTHER_LETTER}, + {0x011f34, 0x011f35, PG_U_SPACING_MARK}, + {0x011f36, 0x011f3a, PG_U_NONSPACING_MARK}, + {0x011f3e, 0x011f3f, PG_U_SPACING_MARK}, + {0x011f40, 0x011f40, PG_U_NONSPACING_MARK}, + {0x011f41, 0x011f41, PG_U_SPACING_MARK}, + {0x011f42, 0x011f42, PG_U_NONSPACING_MARK}, + {0x011f43, 0x011f4f, PG_U_OTHER_PUNCTUATION}, + {0x011f50, 0x011f59, PG_U_DECIMAL_NUMBER}, + {0x011fb0, 0x011fb0, PG_U_OTHER_LETTER}, + {0x011fc0, 0x011fd4, PG_U_OTHER_NUMBER}, + {0x011fd5, 0x011fdc, PG_U_OTHER_SYMBOL}, + {0x011fdd, 0x011fe0, PG_U_CURRENCY_SYMBOL}, + {0x011fe1, 0x011ff1, PG_U_OTHER_SYMBOL}, + {0x011fff, 0x011fff, PG_U_OTHER_PUNCTUATION}, + {0x012000, 0x012399, PG_U_OTHER_LETTER}, + {0x012400, 0x01246e, PG_U_LETTER_NUMBER}, + {0x012470, 0x012474, PG_U_OTHER_PUNCTUATION}, + {0x012480, 0x012543, PG_U_OTHER_LETTER}, + {0x012f90, 0x012ff0, PG_U_OTHER_LETTER}, + {0x012ff1, 0x012ff2, PG_U_OTHER_PUNCTUATION}, + {0x013000, 0x01342f, PG_U_OTHER_LETTER}, + {0x013430, 0x01343f, PG_U_FORMAT}, + {0x013440, 0x013440, PG_U_NONSPACING_MARK}, + {0x013441, 0x013446, PG_U_OTHER_LETTER}, + {0x013447, 0x013455, PG_U_NONSPACING_MARK}, + {0x014400, 0x014646, PG_U_OTHER_LETTER}, + {0x016800, 0x016a38, PG_U_OTHER_LETTER}, + {0x016a40, 0x016a5e, PG_U_OTHER_LETTER}, + {0x016a60, 0x016a69, PG_U_DECIMAL_NUMBER}, + {0x016a6e, 0x016a6f, PG_U_OTHER_PUNCTUATION}, + {0x016a70, 0x016abe, PG_U_OTHER_LETTER}, + {0x016ac0, 0x016ac9, PG_U_DECIMAL_NUMBER}, + {0x016ad0, 0x016aed, PG_U_OTHER_LETTER}, + {0x016af0, 0x016af4, PG_U_NONSPACING_MARK}, + {0x016af5, 0x016af5, PG_U_OTHER_PUNCTUATION}, + {0x016b00, 0x016b2f, PG_U_OTHER_LETTER}, + {0x016b30, 0x016b36, PG_U_NONSPACING_MARK}, + {0x016b37, 0x016b3b, PG_U_OTHER_PUNCTUATION}, + {0x016b3c, 0x016b3f, PG_U_OTHER_SYMBOL}, + {0x016b40, 0x016b43, PG_U_MODIFIER_LETTER}, + {0x016b44, 0x016b44, PG_U_OTHER_PUNCTUATION}, + {0x016b45, 0x016b45, PG_U_OTHER_SYMBOL}, + {0x016b50, 0x016b59, PG_U_DECIMAL_NUMBER}, + {0x016b5b, 0x016b61, PG_U_OTHER_NUMBER}, + {0x016b63, 0x016b77, PG_U_OTHER_LETTER}, + {0x016b7d, 0x016b8f, PG_U_OTHER_LETTER}, + {0x016e40, 0x016e5f, PG_U_UPPERCASE_LETTER}, + {0x016e60, 0x016e7f, PG_U_LOWERCASE_LETTER}, + {0x016e80, 0x016e96, PG_U_OTHER_NUMBER}, + {0x016e97, 0x016e9a, PG_U_OTHER_PUNCTUATION}, + {0x016f00, 0x016f4a, PG_U_OTHER_LETTER}, + {0x016f4f, 0x016f4f, PG_U_NONSPACING_MARK}, + {0x016f50, 0x016f50, PG_U_OTHER_LETTER}, + {0x016f51, 0x016f87, PG_U_SPACING_MARK}, + {0x016f8f, 0x016f92, PG_U_NONSPACING_MARK}, + {0x016f93, 0x016f9f, PG_U_MODIFIER_LETTER}, + {0x016fe0, 0x016fe1, PG_U_MODIFIER_LETTER}, + {0x016fe2, 0x016fe2, PG_U_OTHER_PUNCTUATION}, + {0x016fe3, 0x016fe3, PG_U_MODIFIER_LETTER}, + {0x016fe4, 0x016fe4, PG_U_NONSPACING_MARK}, + {0x016ff0, 0x016ff1, PG_U_SPACING_MARK}, + {0x017000, 0x0187f7, PG_U_OTHER_LETTER}, + {0x018800, 0x018cd5, PG_U_OTHER_LETTER}, + {0x018d00, 0x018d08, PG_U_OTHER_LETTER}, + {0x01aff0, 0x01aff3, PG_U_MODIFIER_LETTER}, + {0x01aff5, 0x01affb, PG_U_MODIFIER_LETTER}, + {0x01affd, 0x01affe, PG_U_MODIFIER_LETTER}, + {0x01b000, 0x01b122, PG_U_OTHER_LETTER}, + {0x01b132, 0x01b132, PG_U_OTHER_LETTER}, + {0x01b150, 0x01b152, PG_U_OTHER_LETTER}, + {0x01b155, 0x01b155, PG_U_OTHER_LETTER}, + {0x01b164, 0x01b167, PG_U_OTHER_LETTER}, + {0x01b170, 0x01b2fb, PG_U_OTHER_LETTER}, + {0x01bc00, 0x01bc6a, PG_U_OTHER_LETTER}, + {0x01bc70, 0x01bc7c, PG_U_OTHER_LETTER}, + {0x01bc80, 0x01bc88, PG_U_OTHER_LETTER}, + {0x01bc90, 0x01bc99, PG_U_OTHER_LETTER}, + {0x01bc9c, 0x01bc9c, PG_U_OTHER_SYMBOL}, + {0x01bc9d, 0x01bc9e, PG_U_NONSPACING_MARK}, + {0x01bc9f, 0x01bc9f, PG_U_OTHER_PUNCTUATION}, + {0x01bca0, 0x01bca3, PG_U_FORMAT}, + {0x01cf00, 0x01cf2d, PG_U_NONSPACING_MARK}, + {0x01cf30, 0x01cf46, PG_U_NONSPACING_MARK}, + {0x01cf50, 0x01cfc3, PG_U_OTHER_SYMBOL}, + {0x01d000, 0x01d0f5, PG_U_OTHER_SYMBOL}, + {0x01d100, 0x01d126, PG_U_OTHER_SYMBOL}, + {0x01d129, 0x01d164, PG_U_OTHER_SYMBOL}, + {0x01d165, 0x01d166, PG_U_SPACING_MARK}, + {0x01d167, 0x01d169, PG_U_NONSPACING_MARK}, + {0x01d16a, 0x01d16c, PG_U_OTHER_SYMBOL}, + {0x01d16d, 0x01d172, PG_U_SPACING_MARK}, + {0x01d173, 0x01d17a, PG_U_FORMAT}, + {0x01d17b, 0x01d182, PG_U_NONSPACING_MARK}, + {0x01d183, 0x01d184, PG_U_OTHER_SYMBOL}, + {0x01d185, 0x01d18b, PG_U_NONSPACING_MARK}, + {0x01d18c, 0x01d1a9, PG_U_OTHER_SYMBOL}, + {0x01d1aa, 0x01d1ad, PG_U_NONSPACING_MARK}, + {0x01d1ae, 0x01d1ea, PG_U_OTHER_SYMBOL}, + {0x01d200, 0x01d241, PG_U_OTHER_SYMBOL}, + {0x01d242, 0x01d244, PG_U_NONSPACING_MARK}, + {0x01d245, 0x01d245, PG_U_OTHER_SYMBOL}, + {0x01d2c0, 0x01d2d3, PG_U_OTHER_NUMBER}, + {0x01d2e0, 0x01d2f3, PG_U_OTHER_NUMBER}, + {0x01d300, 0x01d356, PG_U_OTHER_SYMBOL}, + {0x01d360, 0x01d378, PG_U_OTHER_NUMBER}, + {0x01d400, 0x01d419, PG_U_UPPERCASE_LETTER}, + {0x01d41a, 0x01d433, PG_U_LOWERCASE_LETTER}, + {0x01d434, 0x01d44d, PG_U_UPPERCASE_LETTER}, + {0x01d44e, 0x01d454, PG_U_LOWERCASE_LETTER}, + {0x01d456, 0x01d467, PG_U_LOWERCASE_LETTER}, + {0x01d468, 0x01d481, PG_U_UPPERCASE_LETTER}, + {0x01d482, 0x01d49b, PG_U_LOWERCASE_LETTER}, + {0x01d49c, 0x01d49c, PG_U_UPPERCASE_LETTER}, + {0x01d49e, 0x01d49f, PG_U_UPPERCASE_LETTER}, + {0x01d4a2, 0x01d4a2, PG_U_UPPERCASE_LETTER}, + {0x01d4a5, 0x01d4a6, PG_U_UPPERCASE_LETTER}, + {0x01d4a9, 0x01d4ac, PG_U_UPPERCASE_LETTER}, + {0x01d4ae, 0x01d4b5, PG_U_UPPERCASE_LETTER}, + {0x01d4b6, 0x01d4b9, PG_U_LOWERCASE_LETTER}, + {0x01d4bb, 0x01d4bb, PG_U_LOWERCASE_LETTER}, + {0x01d4bd, 0x01d4c3, PG_U_LOWERCASE_LETTER}, + {0x01d4c5, 0x01d4cf, PG_U_LOWERCASE_LETTER}, + {0x01d4d0, 0x01d4e9, PG_U_UPPERCASE_LETTER}, + {0x01d4ea, 0x01d503, PG_U_LOWERCASE_LETTER}, + {0x01d504, 0x01d505, PG_U_UPPERCASE_LETTER}, + {0x01d507, 0x01d50a, PG_U_UPPERCASE_LETTER}, + {0x01d50d, 0x01d514, PG_U_UPPERCASE_LETTER}, + {0x01d516, 0x01d51c, PG_U_UPPERCASE_LETTER}, + {0x01d51e, 0x01d537, PG_U_LOWERCASE_LETTER}, + {0x01d538, 0x01d539, PG_U_UPPERCASE_LETTER}, + {0x01d53b, 0x01d53e, PG_U_UPPERCASE_LETTER}, + {0x01d540, 0x01d544, PG_U_UPPERCASE_LETTER}, + {0x01d546, 0x01d546, PG_U_UPPERCASE_LETTER}, + {0x01d54a, 0x01d550, PG_U_UPPERCASE_LETTER}, + {0x01d552, 0x01d56b, PG_U_LOWERCASE_LETTER}, + {0x01d56c, 0x01d585, PG_U_UPPERCASE_LETTER}, + {0x01d586, 0x01d59f, PG_U_LOWERCASE_LETTER}, + {0x01d5a0, 0x01d5b9, PG_U_UPPERCASE_LETTER}, + {0x01d5ba, 0x01d5d3, PG_U_LOWERCASE_LETTER}, + {0x01d5d4, 0x01d5ed, PG_U_UPPERCASE_LETTER}, + {0x01d5ee, 0x01d607, PG_U_LOWERCASE_LETTER}, + {0x01d608, 0x01d621, PG_U_UPPERCASE_LETTER}, + {0x01d622, 0x01d63b, PG_U_LOWERCASE_LETTER}, + {0x01d63c, 0x01d655, PG_U_UPPERCASE_LETTER}, + {0x01d656, 0x01d66f, PG_U_LOWERCASE_LETTER}, + {0x01d670, 0x01d689, PG_U_UPPERCASE_LETTER}, + {0x01d68a, 0x01d6a5, PG_U_LOWERCASE_LETTER}, + {0x01d6a8, 0x01d6c0, PG_U_UPPERCASE_LETTER}, + {0x01d6c1, 0x01d6c1, PG_U_MATH_SYMBOL}, + {0x01d6c2, 0x01d6da, PG_U_LOWERCASE_LETTER}, + {0x01d6db, 0x01d6db, PG_U_MATH_SYMBOL}, + {0x01d6dc, 0x01d6e1, PG_U_LOWERCASE_LETTER}, + {0x01d6e2, 0x01d6fa, PG_U_UPPERCASE_LETTER}, + {0x01d6fb, 0x01d6fb, PG_U_MATH_SYMBOL}, + {0x01d6fc, 0x01d714, PG_U_LOWERCASE_LETTER}, + {0x01d715, 0x01d715, PG_U_MATH_SYMBOL}, + {0x01d716, 0x01d71b, PG_U_LOWERCASE_LETTER}, + {0x01d71c, 0x01d734, PG_U_UPPERCASE_LETTER}, + {0x01d735, 0x01d735, PG_U_MATH_SYMBOL}, + {0x01d736, 0x01d74e, PG_U_LOWERCASE_LETTER}, + {0x01d74f, 0x01d74f, PG_U_MATH_SYMBOL}, + {0x01d750, 0x01d755, PG_U_LOWERCASE_LETTER}, + {0x01d756, 0x01d76e, PG_U_UPPERCASE_LETTER}, + {0x01d76f, 0x01d76f, PG_U_MATH_SYMBOL}, + {0x01d770, 0x01d788, PG_U_LOWERCASE_LETTER}, + {0x01d789, 0x01d789, PG_U_MATH_SYMBOL}, + {0x01d78a, 0x01d78f, PG_U_LOWERCASE_LETTER}, + {0x01d790, 0x01d7a8, PG_U_UPPERCASE_LETTER}, + {0x01d7a9, 0x01d7a9, PG_U_MATH_SYMBOL}, + {0x01d7aa, 0x01d7c2, PG_U_LOWERCASE_LETTER}, + {0x01d7c3, 0x01d7c3, PG_U_MATH_SYMBOL}, + {0x01d7c4, 0x01d7c9, PG_U_LOWERCASE_LETTER}, + {0x01d7ca, 0x01d7ca, PG_U_UPPERCASE_LETTER}, + {0x01d7cb, 0x01d7cb, PG_U_LOWERCASE_LETTER}, + {0x01d7ce, 0x01d7ff, PG_U_DECIMAL_NUMBER}, + {0x01d800, 0x01d9ff, PG_U_OTHER_SYMBOL}, + {0x01da00, 0x01da36, PG_U_NONSPACING_MARK}, + {0x01da37, 0x01da3a, PG_U_OTHER_SYMBOL}, + {0x01da3b, 0x01da6c, PG_U_NONSPACING_MARK}, + {0x01da6d, 0x01da74, PG_U_OTHER_SYMBOL}, + {0x01da75, 0x01da75, PG_U_NONSPACING_MARK}, + {0x01da76, 0x01da83, PG_U_OTHER_SYMBOL}, + {0x01da84, 0x01da84, PG_U_NONSPACING_MARK}, + {0x01da85, 0x01da86, PG_U_OTHER_SYMBOL}, + {0x01da87, 0x01da8b, PG_U_OTHER_PUNCTUATION}, + {0x01da9b, 0x01da9f, PG_U_NONSPACING_MARK}, + {0x01daa1, 0x01daaf, PG_U_NONSPACING_MARK}, + {0x01df00, 0x01df09, PG_U_LOWERCASE_LETTER}, + {0x01df0a, 0x01df0a, PG_U_OTHER_LETTER}, + {0x01df0b, 0x01df1e, PG_U_LOWERCASE_LETTER}, + {0x01df25, 0x01df2a, PG_U_LOWERCASE_LETTER}, + {0x01e000, 0x01e006, PG_U_NONSPACING_MARK}, + {0x01e008, 0x01e018, PG_U_NONSPACING_MARK}, + {0x01e01b, 0x01e021, PG_U_NONSPACING_MARK}, + {0x01e023, 0x01e024, PG_U_NONSPACING_MARK}, + {0x01e026, 0x01e02a, PG_U_NONSPACING_MARK}, + {0x01e030, 0x01e06d, PG_U_MODIFIER_LETTER}, + {0x01e08f, 0x01e08f, PG_U_NONSPACING_MARK}, + {0x01e100, 0x01e12c, PG_U_OTHER_LETTER}, + {0x01e130, 0x01e136, PG_U_NONSPACING_MARK}, + {0x01e137, 0x01e13d, PG_U_MODIFIER_LETTER}, + {0x01e140, 0x01e149, PG_U_DECIMAL_NUMBER}, + {0x01e14e, 0x01e14e, PG_U_OTHER_LETTER}, + {0x01e14f, 0x01e14f, PG_U_OTHER_SYMBOL}, + {0x01e290, 0x01e2ad, PG_U_OTHER_LETTER}, + {0x01e2ae, 0x01e2ae, PG_U_NONSPACING_MARK}, + {0x01e2c0, 0x01e2eb, PG_U_OTHER_LETTER}, + {0x01e2ec, 0x01e2ef, PG_U_NONSPACING_MARK}, + {0x01e2f0, 0x01e2f9, PG_U_DECIMAL_NUMBER}, + {0x01e2ff, 0x01e2ff, PG_U_CURRENCY_SYMBOL}, + {0x01e4d0, 0x01e4ea, PG_U_OTHER_LETTER}, + {0x01e4eb, 0x01e4eb, PG_U_MODIFIER_LETTER}, + {0x01e4ec, 0x01e4ef, PG_U_NONSPACING_MARK}, + {0x01e4f0, 0x01e4f9, PG_U_DECIMAL_NUMBER}, + {0x01e7e0, 0x01e7e6, PG_U_OTHER_LETTER}, + {0x01e7e8, 0x01e7eb, PG_U_OTHER_LETTER}, + {0x01e7ed, 0x01e7ee, PG_U_OTHER_LETTER}, + {0x01e7f0, 0x01e7fe, PG_U_OTHER_LETTER}, + {0x01e800, 0x01e8c4, PG_U_OTHER_LETTER}, + {0x01e8c7, 0x01e8cf, PG_U_OTHER_NUMBER}, + {0x01e8d0, 0x01e8d6, PG_U_NONSPACING_MARK}, + {0x01e900, 0x01e921, PG_U_UPPERCASE_LETTER}, + {0x01e922, 0x01e943, PG_U_LOWERCASE_LETTER}, + {0x01e944, 0x01e94a, PG_U_NONSPACING_MARK}, + {0x01e94b, 0x01e94b, PG_U_MODIFIER_LETTER}, + {0x01e950, 0x01e959, PG_U_DECIMAL_NUMBER}, + {0x01e95e, 0x01e95f, PG_U_OTHER_PUNCTUATION}, + {0x01ec71, 0x01ecab, PG_U_OTHER_NUMBER}, + {0x01ecac, 0x01ecac, PG_U_OTHER_SYMBOL}, + {0x01ecad, 0x01ecaf, PG_U_OTHER_NUMBER}, + {0x01ecb0, 0x01ecb0, PG_U_CURRENCY_SYMBOL}, + {0x01ecb1, 0x01ecb4, PG_U_OTHER_NUMBER}, + {0x01ed01, 0x01ed2d, PG_U_OTHER_NUMBER}, + {0x01ed2e, 0x01ed2e, PG_U_OTHER_SYMBOL}, + {0x01ed2f, 0x01ed3d, PG_U_OTHER_NUMBER}, + {0x01ee00, 0x01ee03, PG_U_OTHER_LETTER}, + {0x01ee05, 0x01ee1f, PG_U_OTHER_LETTER}, + {0x01ee21, 0x01ee22, PG_U_OTHER_LETTER}, + {0x01ee24, 0x01ee24, PG_U_OTHER_LETTER}, + {0x01ee27, 0x01ee27, PG_U_OTHER_LETTER}, + {0x01ee29, 0x01ee32, PG_U_OTHER_LETTER}, + {0x01ee34, 0x01ee37, PG_U_OTHER_LETTER}, + {0x01ee39, 0x01ee39, PG_U_OTHER_LETTER}, + {0x01ee3b, 0x01ee3b, PG_U_OTHER_LETTER}, + {0x01ee42, 0x01ee42, PG_U_OTHER_LETTER}, + {0x01ee47, 0x01ee47, PG_U_OTHER_LETTER}, + {0x01ee49, 0x01ee49, PG_U_OTHER_LETTER}, + {0x01ee4b, 0x01ee4b, PG_U_OTHER_LETTER}, + {0x01ee4d, 0x01ee4f, PG_U_OTHER_LETTER}, + {0x01ee51, 0x01ee52, PG_U_OTHER_LETTER}, + {0x01ee54, 0x01ee54, PG_U_OTHER_LETTER}, + {0x01ee57, 0x01ee57, PG_U_OTHER_LETTER}, + {0x01ee59, 0x01ee59, PG_U_OTHER_LETTER}, + {0x01ee5b, 0x01ee5b, PG_U_OTHER_LETTER}, + {0x01ee5d, 0x01ee5d, PG_U_OTHER_LETTER}, + {0x01ee5f, 0x01ee5f, PG_U_OTHER_LETTER}, + {0x01ee61, 0x01ee62, PG_U_OTHER_LETTER}, + {0x01ee64, 0x01ee64, PG_U_OTHER_LETTER}, + {0x01ee67, 0x01ee6a, PG_U_OTHER_LETTER}, + {0x01ee6c, 0x01ee72, PG_U_OTHER_LETTER}, + {0x01ee74, 0x01ee77, PG_U_OTHER_LETTER}, + {0x01ee79, 0x01ee7c, PG_U_OTHER_LETTER}, + {0x01ee7e, 0x01ee7e, PG_U_OTHER_LETTER}, + {0x01ee80, 0x01ee89, PG_U_OTHER_LETTER}, + {0x01ee8b, 0x01ee9b, PG_U_OTHER_LETTER}, + {0x01eea1, 0x01eea3, PG_U_OTHER_LETTER}, + {0x01eea5, 0x01eea9, PG_U_OTHER_LETTER}, + {0x01eeab, 0x01eebb, PG_U_OTHER_LETTER}, + {0x01eef0, 0x01eef1, PG_U_MATH_SYMBOL}, + {0x01f000, 0x01f02b, PG_U_OTHER_SYMBOL}, + {0x01f030, 0x01f093, PG_U_OTHER_SYMBOL}, + {0x01f0a0, 0x01f0ae, PG_U_OTHER_SYMBOL}, + {0x01f0b1, 0x01f0bf, PG_U_OTHER_SYMBOL}, + {0x01f0c1, 0x01f0cf, PG_U_OTHER_SYMBOL}, + {0x01f0d1, 0x01f0f5, PG_U_OTHER_SYMBOL}, + {0x01f100, 0x01f10c, PG_U_OTHER_NUMBER}, + {0x01f10d, 0x01f1ad, PG_U_OTHER_SYMBOL}, + {0x01f1e6, 0x01f202, PG_U_OTHER_SYMBOL}, + {0x01f210, 0x01f23b, PG_U_OTHER_SYMBOL}, + {0x01f240, 0x01f248, PG_U_OTHER_SYMBOL}, + {0x01f250, 0x01f251, PG_U_OTHER_SYMBOL}, + {0x01f260, 0x01f265, PG_U_OTHER_SYMBOL}, + {0x01f300, 0x01f3fa, PG_U_OTHER_SYMBOL}, + {0x01f3fb, 0x01f3ff, PG_U_MODIFIER_SYMBOL}, + {0x01f400, 0x01f6d7, PG_U_OTHER_SYMBOL}, + {0x01f6dc, 0x01f6ec, PG_U_OTHER_SYMBOL}, + {0x01f6f0, 0x01f6fc, PG_U_OTHER_SYMBOL}, + {0x01f700, 0x01f776, PG_U_OTHER_SYMBOL}, + {0x01f77b, 0x01f7d9, PG_U_OTHER_SYMBOL}, + {0x01f7e0, 0x01f7eb, PG_U_OTHER_SYMBOL}, + {0x01f7f0, 0x01f7f0, PG_U_OTHER_SYMBOL}, + {0x01f800, 0x01f80b, PG_U_OTHER_SYMBOL}, + {0x01f810, 0x01f847, PG_U_OTHER_SYMBOL}, + {0x01f850, 0x01f859, PG_U_OTHER_SYMBOL}, + {0x01f860, 0x01f887, PG_U_OTHER_SYMBOL}, + {0x01f890, 0x01f8ad, PG_U_OTHER_SYMBOL}, + {0x01f8b0, 0x01f8b1, PG_U_OTHER_SYMBOL}, + {0x01f900, 0x01fa53, PG_U_OTHER_SYMBOL}, + {0x01fa60, 0x01fa6d, PG_U_OTHER_SYMBOL}, + {0x01fa70, 0x01fa7c, PG_U_OTHER_SYMBOL}, + {0x01fa80, 0x01fa88, PG_U_OTHER_SYMBOL}, + {0x01fa90, 0x01fabd, PG_U_OTHER_SYMBOL}, + {0x01fabf, 0x01fac5, PG_U_OTHER_SYMBOL}, + {0x01face, 0x01fadb, PG_U_OTHER_SYMBOL}, + {0x01fae0, 0x01fae8, PG_U_OTHER_SYMBOL}, + {0x01faf0, 0x01faf8, PG_U_OTHER_SYMBOL}, + {0x01fb00, 0x01fb92, PG_U_OTHER_SYMBOL}, + {0x01fb94, 0x01fbca, PG_U_OTHER_SYMBOL}, + {0x01fbf0, 0x01fbf9, PG_U_DECIMAL_NUMBER}, + {0x020000, 0x02a6df, PG_U_OTHER_LETTER}, + {0x02a700, 0x02b739, PG_U_OTHER_LETTER}, + {0x02b740, 0x02b81d, PG_U_OTHER_LETTER}, + {0x02b820, 0x02cea1, PG_U_OTHER_LETTER}, + {0x02ceb0, 0x02ebe0, PG_U_OTHER_LETTER}, + {0x02ebf0, 0x02ee5d, PG_U_OTHER_LETTER}, + {0x02f800, 0x02fa1d, PG_U_OTHER_LETTER}, + {0x030000, 0x03134a, PG_U_OTHER_LETTER}, + {0x031350, 0x0323af, PG_U_OTHER_LETTER}, + {0x0e0001, 0x0e0001, PG_U_FORMAT}, + {0x0e0020, 0x0e007f, PG_U_FORMAT}, + {0x0e0100, 0x0e01ef, PG_U_NONSPACING_MARK}, + {0x0f0000, 0x0ffffd, PG_U_PRIVATE_USE}, + {0x100000, 0x10fffd, PG_U_PRIVATE_USE}, +}; + +/* table of Unicode codepoint ranges of Alphabetic characters */ +static const pg_unicode_range unicode_alphabetic[1141] = +{ + {0x000041, 0x00005a}, + {0x000061, 0x00007a}, + {0x0000aa, 0x0000aa}, + {0x0000b5, 0x0000b5}, + {0x0000ba, 0x0000ba}, + {0x0000c0, 0x0000d6}, + {0x0000d8, 0x0000f6}, + {0x0000f8, 0x0001ba}, + {0x0001bb, 0x0001bb}, + {0x0001bc, 0x0001bf}, + {0x0001c0, 0x0001c3}, + {0x0001c4, 0x000293}, + {0x000294, 0x000294}, + {0x000295, 0x0002af}, + {0x0002b0, 0x0002c1}, + {0x0002c6, 0x0002d1}, + {0x0002e0, 0x0002e4}, + {0x0002ec, 0x0002ec}, + {0x0002ee, 0x0002ee}, + {0x000345, 0x000345}, + {0x000370, 0x000373}, + {0x000374, 0x000374}, + {0x000376, 0x000377}, + {0x00037a, 0x00037a}, + {0x00037b, 0x00037d}, + {0x00037f, 0x00037f}, + {0x000386, 0x000386}, + {0x000388, 0x00038a}, + {0x00038c, 0x00038c}, + {0x00038e, 0x0003a1}, + {0x0003a3, 0x0003f5}, + {0x0003f7, 0x000481}, + {0x00048a, 0x00052f}, + {0x000531, 0x000556}, + {0x000559, 0x000559}, + {0x000560, 0x000588}, + {0x0005b0, 0x0005bd}, + {0x0005bf, 0x0005bf}, + {0x0005c1, 0x0005c2}, + {0x0005c4, 0x0005c5}, + {0x0005c7, 0x0005c7}, + {0x0005d0, 0x0005ea}, + {0x0005ef, 0x0005f2}, + {0x000610, 0x00061a}, + {0x000620, 0x00063f}, + {0x000640, 0x000640}, + {0x000641, 0x00064a}, + {0x00064b, 0x000657}, + {0x000659, 0x00065f}, + {0x00066e, 0x00066f}, + {0x000670, 0x000670}, + {0x000671, 0x0006d3}, + {0x0006d5, 0x0006d5}, + {0x0006d6, 0x0006dc}, + {0x0006e1, 0x0006e4}, + {0x0006e5, 0x0006e6}, + {0x0006e7, 0x0006e8}, + {0x0006ed, 0x0006ed}, + {0x0006ee, 0x0006ef}, + {0x0006fa, 0x0006fc}, + {0x0006ff, 0x0006ff}, + {0x000710, 0x000710}, + {0x000711, 0x000711}, + {0x000712, 0x00072f}, + {0x000730, 0x00073f}, + {0x00074d, 0x0007a5}, + {0x0007a6, 0x0007b0}, + {0x0007b1, 0x0007b1}, + {0x0007ca, 0x0007ea}, + {0x0007f4, 0x0007f5}, + {0x0007fa, 0x0007fa}, + {0x000800, 0x000815}, + {0x000816, 0x000817}, + {0x00081a, 0x00081a}, + {0x00081b, 0x000823}, + {0x000824, 0x000824}, + {0x000825, 0x000827}, + {0x000828, 0x000828}, + {0x000829, 0x00082c}, + {0x000840, 0x000858}, + {0x000860, 0x00086a}, + {0x000870, 0x000887}, + {0x000889, 0x00088e}, + {0x0008a0, 0x0008c8}, + {0x0008c9, 0x0008c9}, + {0x0008d4, 0x0008df}, + {0x0008e3, 0x0008e9}, + {0x0008f0, 0x000902}, + {0x000903, 0x000903}, + {0x000904, 0x000939}, + {0x00093a, 0x00093a}, + {0x00093b, 0x00093b}, + {0x00093d, 0x00093d}, + {0x00093e, 0x000940}, + {0x000941, 0x000948}, + {0x000949, 0x00094c}, + {0x00094e, 0x00094f}, + {0x000950, 0x000950}, + {0x000955, 0x000957}, + {0x000958, 0x000961}, + {0x000962, 0x000963}, + {0x000971, 0x000971}, + {0x000972, 0x000980}, + {0x000981, 0x000981}, + {0x000982, 0x000983}, + {0x000985, 0x00098c}, + {0x00098f, 0x000990}, + {0x000993, 0x0009a8}, + {0x0009aa, 0x0009b0}, + {0x0009b2, 0x0009b2}, + {0x0009b6, 0x0009b9}, + {0x0009bd, 0x0009bd}, + {0x0009be, 0x0009c0}, + {0x0009c1, 0x0009c4}, + {0x0009c7, 0x0009c8}, + {0x0009cb, 0x0009cc}, + {0x0009ce, 0x0009ce}, + {0x0009d7, 0x0009d7}, + {0x0009dc, 0x0009dd}, + {0x0009df, 0x0009e1}, + {0x0009e2, 0x0009e3}, + {0x0009f0, 0x0009f1}, + {0x0009fc, 0x0009fc}, + {0x000a01, 0x000a02}, + {0x000a03, 0x000a03}, + {0x000a05, 0x000a0a}, + {0x000a0f, 0x000a10}, + {0x000a13, 0x000a28}, + {0x000a2a, 0x000a30}, + {0x000a32, 0x000a33}, + {0x000a35, 0x000a36}, + {0x000a38, 0x000a39}, + {0x000a3e, 0x000a40}, + {0x000a41, 0x000a42}, + {0x000a47, 0x000a48}, + {0x000a4b, 0x000a4c}, + {0x000a51, 0x000a51}, + {0x000a59, 0x000a5c}, + {0x000a5e, 0x000a5e}, + {0x000a70, 0x000a71}, + {0x000a72, 0x000a74}, + {0x000a75, 0x000a75}, + {0x000a81, 0x000a82}, + {0x000a83, 0x000a83}, + {0x000a85, 0x000a8d}, + {0x000a8f, 0x000a91}, + {0x000a93, 0x000aa8}, + {0x000aaa, 0x000ab0}, + {0x000ab2, 0x000ab3}, + {0x000ab5, 0x000ab9}, + {0x000abd, 0x000abd}, + {0x000abe, 0x000ac0}, + {0x000ac1, 0x000ac5}, + {0x000ac7, 0x000ac8}, + {0x000ac9, 0x000ac9}, + {0x000acb, 0x000acc}, + {0x000ad0, 0x000ad0}, + {0x000ae0, 0x000ae1}, + {0x000ae2, 0x000ae3}, + {0x000af9, 0x000af9}, + {0x000afa, 0x000afc}, + {0x000b01, 0x000b01}, + {0x000b02, 0x000b03}, + {0x000b05, 0x000b0c}, + {0x000b0f, 0x000b10}, + {0x000b13, 0x000b28}, + {0x000b2a, 0x000b30}, + {0x000b32, 0x000b33}, + {0x000b35, 0x000b39}, + {0x000b3d, 0x000b3d}, + {0x000b3e, 0x000b3e}, + {0x000b3f, 0x000b3f}, + {0x000b40, 0x000b40}, + {0x000b41, 0x000b44}, + {0x000b47, 0x000b48}, + {0x000b4b, 0x000b4c}, + {0x000b56, 0x000b56}, + {0x000b57, 0x000b57}, + {0x000b5c, 0x000b5d}, + {0x000b5f, 0x000b61}, + {0x000b62, 0x000b63}, + {0x000b71, 0x000b71}, + {0x000b82, 0x000b82}, + {0x000b83, 0x000b83}, + {0x000b85, 0x000b8a}, + {0x000b8e, 0x000b90}, + {0x000b92, 0x000b95}, + {0x000b99, 0x000b9a}, + {0x000b9c, 0x000b9c}, + {0x000b9e, 0x000b9f}, + {0x000ba3, 0x000ba4}, + {0x000ba8, 0x000baa}, + {0x000bae, 0x000bb9}, + {0x000bbe, 0x000bbf}, + {0x000bc0, 0x000bc0}, + {0x000bc1, 0x000bc2}, + {0x000bc6, 0x000bc8}, + {0x000bca, 0x000bcc}, + {0x000bd0, 0x000bd0}, + {0x000bd7, 0x000bd7}, + {0x000c00, 0x000c00}, + {0x000c01, 0x000c03}, + {0x000c04, 0x000c04}, + {0x000c05, 0x000c0c}, + {0x000c0e, 0x000c10}, + {0x000c12, 0x000c28}, + {0x000c2a, 0x000c39}, + {0x000c3d, 0x000c3d}, + {0x000c3e, 0x000c40}, + {0x000c41, 0x000c44}, + {0x000c46, 0x000c48}, + {0x000c4a, 0x000c4c}, + {0x000c55, 0x000c56}, + {0x000c58, 0x000c5a}, + {0x000c5d, 0x000c5d}, + {0x000c60, 0x000c61}, + {0x000c62, 0x000c63}, + {0x000c80, 0x000c80}, + {0x000c81, 0x000c81}, + {0x000c82, 0x000c83}, + {0x000c85, 0x000c8c}, + {0x000c8e, 0x000c90}, + {0x000c92, 0x000ca8}, + {0x000caa, 0x000cb3}, + {0x000cb5, 0x000cb9}, + {0x000cbd, 0x000cbd}, + {0x000cbe, 0x000cbe}, + {0x000cbf, 0x000cbf}, + {0x000cc0, 0x000cc4}, + {0x000cc6, 0x000cc6}, + {0x000cc7, 0x000cc8}, + {0x000cca, 0x000ccb}, + {0x000ccc, 0x000ccc}, + {0x000cd5, 0x000cd6}, + {0x000cdd, 0x000cde}, + {0x000ce0, 0x000ce1}, + {0x000ce2, 0x000ce3}, + {0x000cf1, 0x000cf2}, + {0x000cf3, 0x000cf3}, + {0x000d00, 0x000d01}, + {0x000d02, 0x000d03}, + {0x000d04, 0x000d0c}, + {0x000d0e, 0x000d10}, + {0x000d12, 0x000d3a}, + {0x000d3d, 0x000d3d}, + {0x000d3e, 0x000d40}, + {0x000d41, 0x000d44}, + {0x000d46, 0x000d48}, + {0x000d4a, 0x000d4c}, + {0x000d4e, 0x000d4e}, + {0x000d54, 0x000d56}, + {0x000d57, 0x000d57}, + {0x000d5f, 0x000d61}, + {0x000d62, 0x000d63}, + {0x000d7a, 0x000d7f}, + {0x000d81, 0x000d81}, + {0x000d82, 0x000d83}, + {0x000d85, 0x000d96}, + {0x000d9a, 0x000db1}, + {0x000db3, 0x000dbb}, + {0x000dbd, 0x000dbd}, + {0x000dc0, 0x000dc6}, + {0x000dcf, 0x000dd1}, + {0x000dd2, 0x000dd4}, + {0x000dd6, 0x000dd6}, + {0x000dd8, 0x000ddf}, + {0x000df2, 0x000df3}, + {0x000e01, 0x000e30}, + {0x000e31, 0x000e31}, + {0x000e32, 0x000e33}, + {0x000e34, 0x000e3a}, + {0x000e40, 0x000e45}, + {0x000e46, 0x000e46}, + {0x000e4d, 0x000e4d}, + {0x000e81, 0x000e82}, + {0x000e84, 0x000e84}, + {0x000e86, 0x000e8a}, + {0x000e8c, 0x000ea3}, + {0x000ea5, 0x000ea5}, + {0x000ea7, 0x000eb0}, + {0x000eb1, 0x000eb1}, + {0x000eb2, 0x000eb3}, + {0x000eb4, 0x000eb9}, + {0x000ebb, 0x000ebc}, + {0x000ebd, 0x000ebd}, + {0x000ec0, 0x000ec4}, + {0x000ec6, 0x000ec6}, + {0x000ecd, 0x000ecd}, + {0x000edc, 0x000edf}, + {0x000f00, 0x000f00}, + {0x000f40, 0x000f47}, + {0x000f49, 0x000f6c}, + {0x000f71, 0x000f7e}, + {0x000f7f, 0x000f7f}, + {0x000f80, 0x000f83}, + {0x000f88, 0x000f8c}, + {0x000f8d, 0x000f97}, + {0x000f99, 0x000fbc}, + {0x001000, 0x00102a}, + {0x00102b, 0x00102c}, + {0x00102d, 0x001030}, + {0x001031, 0x001031}, + {0x001032, 0x001036}, + {0x001038, 0x001038}, + {0x00103b, 0x00103c}, + {0x00103d, 0x00103e}, + {0x00103f, 0x00103f}, + {0x001050, 0x001055}, + {0x001056, 0x001057}, + {0x001058, 0x001059}, + {0x00105a, 0x00105d}, + {0x00105e, 0x001060}, + {0x001061, 0x001061}, + {0x001062, 0x001064}, + {0x001065, 0x001066}, + {0x001067, 0x00106d}, + {0x00106e, 0x001070}, + {0x001071, 0x001074}, + {0x001075, 0x001081}, + {0x001082, 0x001082}, + {0x001083, 0x001084}, + {0x001085, 0x001086}, + {0x001087, 0x00108c}, + {0x00108d, 0x00108d}, + {0x00108e, 0x00108e}, + {0x00108f, 0x00108f}, + {0x00109a, 0x00109c}, + {0x00109d, 0x00109d}, + {0x0010a0, 0x0010c5}, + {0x0010c7, 0x0010c7}, + {0x0010cd, 0x0010cd}, + {0x0010d0, 0x0010fa}, + {0x0010fc, 0x0010fc}, + {0x0010fd, 0x0010ff}, + {0x001100, 0x001248}, + {0x00124a, 0x00124d}, + {0x001250, 0x001256}, + {0x001258, 0x001258}, + {0x00125a, 0x00125d}, + {0x001260, 0x001288}, + {0x00128a, 0x00128d}, + {0x001290, 0x0012b0}, + {0x0012b2, 0x0012b5}, + {0x0012b8, 0x0012be}, + {0x0012c0, 0x0012c0}, + {0x0012c2, 0x0012c5}, + {0x0012c8, 0x0012d6}, + {0x0012d8, 0x001310}, + {0x001312, 0x001315}, + {0x001318, 0x00135a}, + {0x001380, 0x00138f}, + {0x0013a0, 0x0013f5}, + {0x0013f8, 0x0013fd}, + {0x001401, 0x00166c}, + {0x00166f, 0x00167f}, + {0x001681, 0x00169a}, + {0x0016a0, 0x0016ea}, + {0x0016ee, 0x0016f0}, + {0x0016f1, 0x0016f8}, + {0x001700, 0x001711}, + {0x001712, 0x001713}, + {0x00171f, 0x001731}, + {0x001732, 0x001733}, + {0x001740, 0x001751}, + {0x001752, 0x001753}, + {0x001760, 0x00176c}, + {0x00176e, 0x001770}, + {0x001772, 0x001773}, + {0x001780, 0x0017b3}, + {0x0017b6, 0x0017b6}, + {0x0017b7, 0x0017bd}, + {0x0017be, 0x0017c5}, + {0x0017c6, 0x0017c6}, + {0x0017c7, 0x0017c8}, + {0x0017d7, 0x0017d7}, + {0x0017dc, 0x0017dc}, + {0x001820, 0x001842}, + {0x001843, 0x001843}, + {0x001844, 0x001878}, + {0x001880, 0x001884}, + {0x001885, 0x001886}, + {0x001887, 0x0018a8}, + {0x0018a9, 0x0018a9}, + {0x0018aa, 0x0018aa}, + {0x0018b0, 0x0018f5}, + {0x001900, 0x00191e}, + {0x001920, 0x001922}, + {0x001923, 0x001926}, + {0x001927, 0x001928}, + {0x001929, 0x00192b}, + {0x001930, 0x001931}, + {0x001932, 0x001932}, + {0x001933, 0x001938}, + {0x001950, 0x00196d}, + {0x001970, 0x001974}, + {0x001980, 0x0019ab}, + {0x0019b0, 0x0019c9}, + {0x001a00, 0x001a16}, + {0x001a17, 0x001a18}, + {0x001a19, 0x001a1a}, + {0x001a1b, 0x001a1b}, + {0x001a20, 0x001a54}, + {0x001a55, 0x001a55}, + {0x001a56, 0x001a56}, + {0x001a57, 0x001a57}, + {0x001a58, 0x001a5e}, + {0x001a61, 0x001a61}, + {0x001a62, 0x001a62}, + {0x001a63, 0x001a64}, + {0x001a65, 0x001a6c}, + {0x001a6d, 0x001a72}, + {0x001a73, 0x001a74}, + {0x001aa7, 0x001aa7}, + {0x001abf, 0x001ac0}, + {0x001acc, 0x001ace}, + {0x001b00, 0x001b03}, + {0x001b04, 0x001b04}, + {0x001b05, 0x001b33}, + {0x001b35, 0x001b35}, + {0x001b36, 0x001b3a}, + {0x001b3b, 0x001b3b}, + {0x001b3c, 0x001b3c}, + {0x001b3d, 0x001b41}, + {0x001b42, 0x001b42}, + {0x001b43, 0x001b43}, + {0x001b45, 0x001b4c}, + {0x001b80, 0x001b81}, + {0x001b82, 0x001b82}, + {0x001b83, 0x001ba0}, + {0x001ba1, 0x001ba1}, + {0x001ba2, 0x001ba5}, + {0x001ba6, 0x001ba7}, + {0x001ba8, 0x001ba9}, + {0x001bac, 0x001bad}, + {0x001bae, 0x001baf}, + {0x001bba, 0x001be5}, + {0x001be7, 0x001be7}, + {0x001be8, 0x001be9}, + {0x001bea, 0x001bec}, + {0x001bed, 0x001bed}, + {0x001bee, 0x001bee}, + {0x001bef, 0x001bf1}, + {0x001c00, 0x001c23}, + {0x001c24, 0x001c2b}, + {0x001c2c, 0x001c33}, + {0x001c34, 0x001c35}, + {0x001c36, 0x001c36}, + {0x001c4d, 0x001c4f}, + {0x001c5a, 0x001c77}, + {0x001c78, 0x001c7d}, + {0x001c80, 0x001c88}, + {0x001c90, 0x001cba}, + {0x001cbd, 0x001cbf}, + {0x001ce9, 0x001cec}, + {0x001cee, 0x001cf3}, + {0x001cf5, 0x001cf6}, + {0x001cfa, 0x001cfa}, + {0x001d00, 0x001d2b}, + {0x001d2c, 0x001d6a}, + {0x001d6b, 0x001d77}, + {0x001d78, 0x001d78}, + {0x001d79, 0x001d9a}, + {0x001d9b, 0x001dbf}, + {0x001de7, 0x001df4}, + {0x001e00, 0x001f15}, + {0x001f18, 0x001f1d}, + {0x001f20, 0x001f45}, + {0x001f48, 0x001f4d}, + {0x001f50, 0x001f57}, + {0x001f59, 0x001f59}, + {0x001f5b, 0x001f5b}, + {0x001f5d, 0x001f5d}, + {0x001f5f, 0x001f7d}, + {0x001f80, 0x001fb4}, + {0x001fb6, 0x001fbc}, + {0x001fbe, 0x001fbe}, + {0x001fc2, 0x001fc4}, + {0x001fc6, 0x001fcc}, + {0x001fd0, 0x001fd3}, + {0x001fd6, 0x001fdb}, + {0x001fe0, 0x001fec}, + {0x001ff2, 0x001ff4}, + {0x001ff6, 0x001ffc}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x002102, 0x002102}, + {0x002107, 0x002107}, + {0x00210a, 0x002113}, + {0x002115, 0x002115}, + {0x002119, 0x00211d}, + {0x002124, 0x002124}, + {0x002126, 0x002126}, + {0x002128, 0x002128}, + {0x00212a, 0x00212d}, + {0x00212f, 0x002134}, + {0x002135, 0x002138}, + {0x002139, 0x002139}, + {0x00213c, 0x00213f}, + {0x002145, 0x002149}, + {0x00214e, 0x00214e}, + {0x002160, 0x002182}, + {0x002183, 0x002184}, + {0x002185, 0x002188}, + {0x0024b6, 0x0024e9}, + {0x002c00, 0x002c7b}, + {0x002c7c, 0x002c7d}, + {0x002c7e, 0x002ce4}, + {0x002ceb, 0x002cee}, + {0x002cf2, 0x002cf3}, + {0x002d00, 0x002d25}, + {0x002d27, 0x002d27}, + {0x002d2d, 0x002d2d}, + {0x002d30, 0x002d67}, + {0x002d6f, 0x002d6f}, + {0x002d80, 0x002d96}, + {0x002da0, 0x002da6}, + {0x002da8, 0x002dae}, + {0x002db0, 0x002db6}, + {0x002db8, 0x002dbe}, + {0x002dc0, 0x002dc6}, + {0x002dc8, 0x002dce}, + {0x002dd0, 0x002dd6}, + {0x002dd8, 0x002dde}, + {0x002de0, 0x002dff}, + {0x002e2f, 0x002e2f}, + {0x003005, 0x003005}, + {0x003006, 0x003006}, + {0x003007, 0x003007}, + {0x003021, 0x003029}, + {0x003031, 0x003035}, + {0x003038, 0x00303a}, + {0x00303b, 0x00303b}, + {0x00303c, 0x00303c}, + {0x003041, 0x003096}, + {0x00309d, 0x00309e}, + {0x00309f, 0x00309f}, + {0x0030a1, 0x0030fa}, + {0x0030fc, 0x0030fe}, + {0x0030ff, 0x0030ff}, + {0x003105, 0x00312f}, + {0x003131, 0x00318e}, + {0x0031a0, 0x0031bf}, + {0x0031f0, 0x0031ff}, + {0x003400, 0x004dbf}, + {0x004e00, 0x00a014}, + {0x00a015, 0x00a015}, + {0x00a016, 0x00a48c}, + {0x00a4d0, 0x00a4f7}, + {0x00a4f8, 0x00a4fd}, + {0x00a500, 0x00a60b}, + {0x00a60c, 0x00a60c}, + {0x00a610, 0x00a61f}, + {0x00a62a, 0x00a62b}, + {0x00a640, 0x00a66d}, + {0x00a66e, 0x00a66e}, + {0x00a674, 0x00a67b}, + {0x00a67f, 0x00a67f}, + {0x00a680, 0x00a69b}, + {0x00a69c, 0x00a69d}, + {0x00a69e, 0x00a69f}, + {0x00a6a0, 0x00a6e5}, + {0x00a6e6, 0x00a6ef}, + {0x00a717, 0x00a71f}, + {0x00a722, 0x00a76f}, + {0x00a770, 0x00a770}, + {0x00a771, 0x00a787}, + {0x00a788, 0x00a788}, + {0x00a78b, 0x00a78e}, + {0x00a78f, 0x00a78f}, + {0x00a790, 0x00a7ca}, + {0x00a7d0, 0x00a7d1}, + {0x00a7d3, 0x00a7d3}, + {0x00a7d5, 0x00a7d9}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f5, 0x00a7f6}, + {0x00a7f7, 0x00a7f7}, + {0x00a7f8, 0x00a7f9}, + {0x00a7fa, 0x00a7fa}, + {0x00a7fb, 0x00a801}, + {0x00a802, 0x00a802}, + {0x00a803, 0x00a805}, + {0x00a807, 0x00a80a}, + {0x00a80b, 0x00a80b}, + {0x00a80c, 0x00a822}, + {0x00a823, 0x00a824}, + {0x00a825, 0x00a826}, + {0x00a827, 0x00a827}, + {0x00a840, 0x00a873}, + {0x00a880, 0x00a881}, + {0x00a882, 0x00a8b3}, + {0x00a8b4, 0x00a8c3}, + {0x00a8c5, 0x00a8c5}, + {0x00a8f2, 0x00a8f7}, + {0x00a8fb, 0x00a8fb}, + {0x00a8fd, 0x00a8fe}, + {0x00a8ff, 0x00a8ff}, + {0x00a90a, 0x00a925}, + {0x00a926, 0x00a92a}, + {0x00a930, 0x00a946}, + {0x00a947, 0x00a951}, + {0x00a952, 0x00a952}, + {0x00a960, 0x00a97c}, + {0x00a980, 0x00a982}, + {0x00a983, 0x00a983}, + {0x00a984, 0x00a9b2}, + {0x00a9b4, 0x00a9b5}, + {0x00a9b6, 0x00a9b9}, + {0x00a9ba, 0x00a9bb}, + {0x00a9bc, 0x00a9bd}, + {0x00a9be, 0x00a9bf}, + {0x00a9cf, 0x00a9cf}, + {0x00a9e0, 0x00a9e4}, + {0x00a9e5, 0x00a9e5}, + {0x00a9e6, 0x00a9e6}, + {0x00a9e7, 0x00a9ef}, + {0x00a9fa, 0x00a9fe}, + {0x00aa00, 0x00aa28}, + {0x00aa29, 0x00aa2e}, + {0x00aa2f, 0x00aa30}, + {0x00aa31, 0x00aa32}, + {0x00aa33, 0x00aa34}, + {0x00aa35, 0x00aa36}, + {0x00aa40, 0x00aa42}, + {0x00aa43, 0x00aa43}, + {0x00aa44, 0x00aa4b}, + {0x00aa4c, 0x00aa4c}, + {0x00aa4d, 0x00aa4d}, + {0x00aa60, 0x00aa6f}, + {0x00aa70, 0x00aa70}, + {0x00aa71, 0x00aa76}, + {0x00aa7a, 0x00aa7a}, + {0x00aa7b, 0x00aa7b}, + {0x00aa7c, 0x00aa7c}, + {0x00aa7d, 0x00aa7d}, + {0x00aa7e, 0x00aaaf}, + {0x00aab0, 0x00aab0}, + {0x00aab1, 0x00aab1}, + {0x00aab2, 0x00aab4}, + {0x00aab5, 0x00aab6}, + {0x00aab7, 0x00aab8}, + {0x00aab9, 0x00aabd}, + {0x00aabe, 0x00aabe}, + {0x00aac0, 0x00aac0}, + {0x00aac2, 0x00aac2}, + {0x00aadb, 0x00aadc}, + {0x00aadd, 0x00aadd}, + {0x00aae0, 0x00aaea}, + {0x00aaeb, 0x00aaeb}, + {0x00aaec, 0x00aaed}, + {0x00aaee, 0x00aaef}, + {0x00aaf2, 0x00aaf2}, + {0x00aaf3, 0x00aaf4}, + {0x00aaf5, 0x00aaf5}, + {0x00ab01, 0x00ab06}, + {0x00ab09, 0x00ab0e}, + {0x00ab11, 0x00ab16}, + {0x00ab20, 0x00ab26}, + {0x00ab28, 0x00ab2e}, + {0x00ab30, 0x00ab5a}, + {0x00ab5c, 0x00ab5f}, + {0x00ab60, 0x00ab68}, + {0x00ab69, 0x00ab69}, + {0x00ab70, 0x00abbf}, + {0x00abc0, 0x00abe2}, + {0x00abe3, 0x00abe4}, + {0x00abe5, 0x00abe5}, + {0x00abe6, 0x00abe7}, + {0x00abe8, 0x00abe8}, + {0x00abe9, 0x00abea}, + {0x00ac00, 0x00d7a3}, + {0x00d7b0, 0x00d7c6}, + {0x00d7cb, 0x00d7fb}, + {0x00f900, 0x00fa6d}, + {0x00fa70, 0x00fad9}, + {0x00fb00, 0x00fb06}, + {0x00fb13, 0x00fb17}, + {0x00fb1d, 0x00fb1d}, + {0x00fb1e, 0x00fb1e}, + {0x00fb1f, 0x00fb28}, + {0x00fb2a, 0x00fb36}, + {0x00fb38, 0x00fb3c}, + {0x00fb3e, 0x00fb3e}, + {0x00fb40, 0x00fb41}, + {0x00fb43, 0x00fb44}, + {0x00fb46, 0x00fbb1}, + {0x00fbd3, 0x00fd3d}, + {0x00fd50, 0x00fd8f}, + {0x00fd92, 0x00fdc7}, + {0x00fdf0, 0x00fdfb}, + {0x00fe70, 0x00fe74}, + {0x00fe76, 0x00fefc}, + {0x00ff21, 0x00ff3a}, + {0x00ff41, 0x00ff5a}, + {0x00ff66, 0x00ff6f}, + {0x00ff70, 0x00ff70}, + {0x00ff71, 0x00ff9d}, + {0x00ff9e, 0x00ff9f}, + {0x00ffa0, 0x00ffbe}, + {0x00ffc2, 0x00ffc7}, + {0x00ffca, 0x00ffcf}, + {0x00ffd2, 0x00ffd7}, + {0x00ffda, 0x00ffdc}, + {0x010000, 0x01000b}, + {0x01000d, 0x010026}, + {0x010028, 0x01003a}, + {0x01003c, 0x01003d}, + {0x01003f, 0x01004d}, + {0x010050, 0x01005d}, + {0x010080, 0x0100fa}, + {0x010140, 0x010174}, + {0x010280, 0x01029c}, + {0x0102a0, 0x0102d0}, + {0x010300, 0x01031f}, + {0x01032d, 0x010340}, + {0x010341, 0x010341}, + {0x010342, 0x010349}, + {0x01034a, 0x01034a}, + {0x010350, 0x010375}, + {0x010376, 0x01037a}, + {0x010380, 0x01039d}, + {0x0103a0, 0x0103c3}, + {0x0103c8, 0x0103cf}, + {0x0103d1, 0x0103d5}, + {0x010400, 0x01044f}, + {0x010450, 0x01049d}, + {0x0104b0, 0x0104d3}, + {0x0104d8, 0x0104fb}, + {0x010500, 0x010527}, + {0x010530, 0x010563}, + {0x010570, 0x01057a}, + {0x01057c, 0x01058a}, + {0x01058c, 0x010592}, + {0x010594, 0x010595}, + {0x010597, 0x0105a1}, + {0x0105a3, 0x0105b1}, + {0x0105b3, 0x0105b9}, + {0x0105bb, 0x0105bc}, + {0x010600, 0x010736}, + {0x010740, 0x010755}, + {0x010760, 0x010767}, + {0x010780, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010800, 0x010805}, + {0x010808, 0x010808}, + {0x01080a, 0x010835}, + {0x010837, 0x010838}, + {0x01083c, 0x01083c}, + {0x01083f, 0x010855}, + {0x010860, 0x010876}, + {0x010880, 0x01089e}, + {0x0108e0, 0x0108f2}, + {0x0108f4, 0x0108f5}, + {0x010900, 0x010915}, + {0x010920, 0x010939}, + {0x010980, 0x0109b7}, + {0x0109be, 0x0109bf}, + {0x010a00, 0x010a00}, + {0x010a01, 0x010a03}, + {0x010a05, 0x010a06}, + {0x010a0c, 0x010a0f}, + {0x010a10, 0x010a13}, + {0x010a15, 0x010a17}, + {0x010a19, 0x010a35}, + {0x010a60, 0x010a7c}, + {0x010a80, 0x010a9c}, + {0x010ac0, 0x010ac7}, + {0x010ac9, 0x010ae4}, + {0x010b00, 0x010b35}, + {0x010b40, 0x010b55}, + {0x010b60, 0x010b72}, + {0x010b80, 0x010b91}, + {0x010c00, 0x010c48}, + {0x010c80, 0x010cb2}, + {0x010cc0, 0x010cf2}, + {0x010d00, 0x010d23}, + {0x010d24, 0x010d27}, + {0x010e80, 0x010ea9}, + {0x010eab, 0x010eac}, + {0x010eb0, 0x010eb1}, + {0x010f00, 0x010f1c}, + {0x010f27, 0x010f27}, + {0x010f30, 0x010f45}, + {0x010f70, 0x010f81}, + {0x010fb0, 0x010fc4}, + {0x010fe0, 0x010ff6}, + {0x011000, 0x011000}, + {0x011001, 0x011001}, + {0x011002, 0x011002}, + {0x011003, 0x011037}, + {0x011038, 0x011045}, + {0x011071, 0x011072}, + {0x011073, 0x011074}, + {0x011075, 0x011075}, + {0x011080, 0x011081}, + {0x011082, 0x011082}, + {0x011083, 0x0110af}, + {0x0110b0, 0x0110b2}, + {0x0110b3, 0x0110b6}, + {0x0110b7, 0x0110b8}, + {0x0110c2, 0x0110c2}, + {0x0110d0, 0x0110e8}, + {0x011100, 0x011102}, + {0x011103, 0x011126}, + {0x011127, 0x01112b}, + {0x01112c, 0x01112c}, + {0x01112d, 0x011132}, + {0x011144, 0x011144}, + {0x011145, 0x011146}, + {0x011147, 0x011147}, + {0x011150, 0x011172}, + {0x011176, 0x011176}, + {0x011180, 0x011181}, + {0x011182, 0x011182}, + {0x011183, 0x0111b2}, + {0x0111b3, 0x0111b5}, + {0x0111b6, 0x0111be}, + {0x0111bf, 0x0111bf}, + {0x0111c1, 0x0111c4}, + {0x0111ce, 0x0111ce}, + {0x0111cf, 0x0111cf}, + {0x0111da, 0x0111da}, + {0x0111dc, 0x0111dc}, + {0x011200, 0x011211}, + {0x011213, 0x01122b}, + {0x01122c, 0x01122e}, + {0x01122f, 0x011231}, + {0x011232, 0x011233}, + {0x011234, 0x011234}, + {0x011237, 0x011237}, + {0x01123e, 0x01123e}, + {0x01123f, 0x011240}, + {0x011241, 0x011241}, + {0x011280, 0x011286}, + {0x011288, 0x011288}, + {0x01128a, 0x01128d}, + {0x01128f, 0x01129d}, + {0x01129f, 0x0112a8}, + {0x0112b0, 0x0112de}, + {0x0112df, 0x0112df}, + {0x0112e0, 0x0112e2}, + {0x0112e3, 0x0112e8}, + {0x011300, 0x011301}, + {0x011302, 0x011303}, + {0x011305, 0x01130c}, + {0x01130f, 0x011310}, + {0x011313, 0x011328}, + {0x01132a, 0x011330}, + {0x011332, 0x011333}, + {0x011335, 0x011339}, + {0x01133d, 0x01133d}, + {0x01133e, 0x01133f}, + {0x011340, 0x011340}, + {0x011341, 0x011344}, + {0x011347, 0x011348}, + {0x01134b, 0x01134c}, + {0x011350, 0x011350}, + {0x011357, 0x011357}, + {0x01135d, 0x011361}, + {0x011362, 0x011363}, + {0x011400, 0x011434}, + {0x011435, 0x011437}, + {0x011438, 0x01143f}, + {0x011440, 0x011441}, + {0x011443, 0x011444}, + {0x011445, 0x011445}, + {0x011447, 0x01144a}, + {0x01145f, 0x011461}, + {0x011480, 0x0114af}, + {0x0114b0, 0x0114b2}, + {0x0114b3, 0x0114b8}, + {0x0114b9, 0x0114b9}, + {0x0114ba, 0x0114ba}, + {0x0114bb, 0x0114be}, + {0x0114bf, 0x0114c0}, + {0x0114c1, 0x0114c1}, + {0x0114c4, 0x0114c5}, + {0x0114c7, 0x0114c7}, + {0x011580, 0x0115ae}, + {0x0115af, 0x0115b1}, + {0x0115b2, 0x0115b5}, + {0x0115b8, 0x0115bb}, + {0x0115bc, 0x0115bd}, + {0x0115be, 0x0115be}, + {0x0115d8, 0x0115db}, + {0x0115dc, 0x0115dd}, + {0x011600, 0x01162f}, + {0x011630, 0x011632}, + {0x011633, 0x01163a}, + {0x01163b, 0x01163c}, + {0x01163d, 0x01163d}, + {0x01163e, 0x01163e}, + {0x011640, 0x011640}, + {0x011644, 0x011644}, + {0x011680, 0x0116aa}, + {0x0116ab, 0x0116ab}, + {0x0116ac, 0x0116ac}, + {0x0116ad, 0x0116ad}, + {0x0116ae, 0x0116af}, + {0x0116b0, 0x0116b5}, + {0x0116b8, 0x0116b8}, + {0x011700, 0x01171a}, + {0x01171d, 0x01171f}, + {0x011720, 0x011721}, + {0x011722, 0x011725}, + {0x011726, 0x011726}, + {0x011727, 0x01172a}, + {0x011740, 0x011746}, + {0x011800, 0x01182b}, + {0x01182c, 0x01182e}, + {0x01182f, 0x011837}, + {0x011838, 0x011838}, + {0x0118a0, 0x0118df}, + {0x0118ff, 0x011906}, + {0x011909, 0x011909}, + {0x01190c, 0x011913}, + {0x011915, 0x011916}, + {0x011918, 0x01192f}, + {0x011930, 0x011935}, + {0x011937, 0x011938}, + {0x01193b, 0x01193c}, + {0x01193f, 0x01193f}, + {0x011940, 0x011940}, + {0x011941, 0x011941}, + {0x011942, 0x011942}, + {0x0119a0, 0x0119a7}, + {0x0119aa, 0x0119d0}, + {0x0119d1, 0x0119d3}, + {0x0119d4, 0x0119d7}, + {0x0119da, 0x0119db}, + {0x0119dc, 0x0119df}, + {0x0119e1, 0x0119e1}, + {0x0119e3, 0x0119e3}, + {0x0119e4, 0x0119e4}, + {0x011a00, 0x011a00}, + {0x011a01, 0x011a0a}, + {0x011a0b, 0x011a32}, + {0x011a35, 0x011a38}, + {0x011a39, 0x011a39}, + {0x011a3a, 0x011a3a}, + {0x011a3b, 0x011a3e}, + {0x011a50, 0x011a50}, + {0x011a51, 0x011a56}, + {0x011a57, 0x011a58}, + {0x011a59, 0x011a5b}, + {0x011a5c, 0x011a89}, + {0x011a8a, 0x011a96}, + {0x011a97, 0x011a97}, + {0x011a9d, 0x011a9d}, + {0x011ab0, 0x011af8}, + {0x011c00, 0x011c08}, + {0x011c0a, 0x011c2e}, + {0x011c2f, 0x011c2f}, + {0x011c30, 0x011c36}, + {0x011c38, 0x011c3d}, + {0x011c3e, 0x011c3e}, + {0x011c40, 0x011c40}, + {0x011c72, 0x011c8f}, + {0x011c92, 0x011ca7}, + {0x011ca9, 0x011ca9}, + {0x011caa, 0x011cb0}, + {0x011cb1, 0x011cb1}, + {0x011cb2, 0x011cb3}, + {0x011cb4, 0x011cb4}, + {0x011cb5, 0x011cb6}, + {0x011d00, 0x011d06}, + {0x011d08, 0x011d09}, + {0x011d0b, 0x011d30}, + {0x011d31, 0x011d36}, + {0x011d3a, 0x011d3a}, + {0x011d3c, 0x011d3d}, + {0x011d3f, 0x011d41}, + {0x011d43, 0x011d43}, + {0x011d46, 0x011d46}, + {0x011d47, 0x011d47}, + {0x011d60, 0x011d65}, + {0x011d67, 0x011d68}, + {0x011d6a, 0x011d89}, + {0x011d8a, 0x011d8e}, + {0x011d90, 0x011d91}, + {0x011d93, 0x011d94}, + {0x011d95, 0x011d95}, + {0x011d96, 0x011d96}, + {0x011d98, 0x011d98}, + {0x011ee0, 0x011ef2}, + {0x011ef3, 0x011ef4}, + {0x011ef5, 0x011ef6}, + {0x011f00, 0x011f01}, + {0x011f02, 0x011f02}, + {0x011f03, 0x011f03}, + {0x011f04, 0x011f10}, + {0x011f12, 0x011f33}, + {0x011f34, 0x011f35}, + {0x011f36, 0x011f3a}, + {0x011f3e, 0x011f3f}, + {0x011f40, 0x011f40}, + {0x011fb0, 0x011fb0}, + {0x012000, 0x012399}, + {0x012400, 0x01246e}, + {0x012480, 0x012543}, + {0x012f90, 0x012ff0}, + {0x013000, 0x01342f}, + {0x013441, 0x013446}, + {0x014400, 0x014646}, + {0x016800, 0x016a38}, + {0x016a40, 0x016a5e}, + {0x016a70, 0x016abe}, + {0x016ad0, 0x016aed}, + {0x016b00, 0x016b2f}, + {0x016b40, 0x016b43}, + {0x016b63, 0x016b77}, + {0x016b7d, 0x016b8f}, + {0x016e40, 0x016e7f}, + {0x016f00, 0x016f4a}, + {0x016f4f, 0x016f4f}, + {0x016f50, 0x016f50}, + {0x016f51, 0x016f87}, + {0x016f8f, 0x016f92}, + {0x016f93, 0x016f9f}, + {0x016fe0, 0x016fe1}, + {0x016fe3, 0x016fe3}, + {0x016ff0, 0x016ff1}, + {0x017000, 0x0187f7}, + {0x018800, 0x018cd5}, + {0x018d00, 0x018d08}, + {0x01aff0, 0x01aff3}, + {0x01aff5, 0x01affb}, + {0x01affd, 0x01affe}, + {0x01b000, 0x01b122}, + {0x01b132, 0x01b132}, + {0x01b150, 0x01b152}, + {0x01b155, 0x01b155}, + {0x01b164, 0x01b167}, + {0x01b170, 0x01b2fb}, + {0x01bc00, 0x01bc6a}, + {0x01bc70, 0x01bc7c}, + {0x01bc80, 0x01bc88}, + {0x01bc90, 0x01bc99}, + {0x01bc9e, 0x01bc9e}, + {0x01d400, 0x01d454}, + {0x01d456, 0x01d49c}, + {0x01d49e, 0x01d49f}, + {0x01d4a2, 0x01d4a2}, + {0x01d4a5, 0x01d4a6}, + {0x01d4a9, 0x01d4ac}, + {0x01d4ae, 0x01d4b9}, + {0x01d4bb, 0x01d4bb}, + {0x01d4bd, 0x01d4c3}, + {0x01d4c5, 0x01d505}, + {0x01d507, 0x01d50a}, + {0x01d50d, 0x01d514}, + {0x01d516, 0x01d51c}, + {0x01d51e, 0x01d539}, + {0x01d53b, 0x01d53e}, + {0x01d540, 0x01d544}, + {0x01d546, 0x01d546}, + {0x01d54a, 0x01d550}, + {0x01d552, 0x01d6a5}, + {0x01d6a8, 0x01d6c0}, + {0x01d6c2, 0x01d6da}, + {0x01d6dc, 0x01d6fa}, + {0x01d6fc, 0x01d714}, + {0x01d716, 0x01d734}, + {0x01d736, 0x01d74e}, + {0x01d750, 0x01d76e}, + {0x01d770, 0x01d788}, + {0x01d78a, 0x01d7a8}, + {0x01d7aa, 0x01d7c2}, + {0x01d7c4, 0x01d7cb}, + {0x01df00, 0x01df09}, + {0x01df0a, 0x01df0a}, + {0x01df0b, 0x01df1e}, + {0x01df25, 0x01df2a}, + {0x01e000, 0x01e006}, + {0x01e008, 0x01e018}, + {0x01e01b, 0x01e021}, + {0x01e023, 0x01e024}, + {0x01e026, 0x01e02a}, + {0x01e030, 0x01e06d}, + {0x01e08f, 0x01e08f}, + {0x01e100, 0x01e12c}, + {0x01e137, 0x01e13d}, + {0x01e14e, 0x01e14e}, + {0x01e290, 0x01e2ad}, + {0x01e2c0, 0x01e2eb}, + {0x01e4d0, 0x01e4ea}, + {0x01e4eb, 0x01e4eb}, + {0x01e7e0, 0x01e7e6}, + {0x01e7e8, 0x01e7eb}, + {0x01e7ed, 0x01e7ee}, + {0x01e7f0, 0x01e7fe}, + {0x01e800, 0x01e8c4}, + {0x01e900, 0x01e943}, + {0x01e947, 0x01e947}, + {0x01e94b, 0x01e94b}, + {0x01ee00, 0x01ee03}, + {0x01ee05, 0x01ee1f}, + {0x01ee21, 0x01ee22}, + {0x01ee24, 0x01ee24}, + {0x01ee27, 0x01ee27}, + {0x01ee29, 0x01ee32}, + {0x01ee34, 0x01ee37}, + {0x01ee39, 0x01ee39}, + {0x01ee3b, 0x01ee3b}, + {0x01ee42, 0x01ee42}, + {0x01ee47, 0x01ee47}, + {0x01ee49, 0x01ee49}, + {0x01ee4b, 0x01ee4b}, + {0x01ee4d, 0x01ee4f}, + {0x01ee51, 0x01ee52}, + {0x01ee54, 0x01ee54}, + {0x01ee57, 0x01ee57}, + {0x01ee59, 0x01ee59}, + {0x01ee5b, 0x01ee5b}, + {0x01ee5d, 0x01ee5d}, + {0x01ee5f, 0x01ee5f}, + {0x01ee61, 0x01ee62}, + {0x01ee64, 0x01ee64}, + {0x01ee67, 0x01ee6a}, + {0x01ee6c, 0x01ee72}, + {0x01ee74, 0x01ee77}, + {0x01ee79, 0x01ee7c}, + {0x01ee7e, 0x01ee7e}, + {0x01ee80, 0x01ee89}, + {0x01ee8b, 0x01ee9b}, + {0x01eea1, 0x01eea3}, + {0x01eea5, 0x01eea9}, + {0x01eeab, 0x01eebb}, + {0x01f130, 0x01f149}, + {0x01f150, 0x01f169}, + {0x01f170, 0x01f189}, + {0x020000, 0x02a6df}, + {0x02a700, 0x02b739}, + {0x02b740, 0x02b81d}, + {0x02b820, 0x02cea1}, + {0x02ceb0, 0x02ebe0}, + {0x02ebf0, 0x02ee5d}, + {0x02f800, 0x02fa1d}, + {0x030000, 0x03134a}, + {0x031350, 0x0323af}, +}; + +/* table of Unicode codepoint ranges of Lowercase characters */ +static const pg_unicode_range unicode_lowercase[686] = +{ + {0x000061, 0x00007a}, + {0x0000aa, 0x0000aa}, + {0x0000b5, 0x0000b5}, + {0x0000ba, 0x0000ba}, + {0x0000df, 0x0000f6}, + {0x0000f8, 0x0000ff}, + {0x000101, 0x000101}, + {0x000103, 0x000103}, + {0x000105, 0x000105}, + {0x000107, 0x000107}, + {0x000109, 0x000109}, + {0x00010b, 0x00010b}, + {0x00010d, 0x00010d}, + {0x00010f, 0x00010f}, + {0x000111, 0x000111}, + {0x000113, 0x000113}, + {0x000115, 0x000115}, + {0x000117, 0x000117}, + {0x000119, 0x000119}, + {0x00011b, 0x00011b}, + {0x00011d, 0x00011d}, + {0x00011f, 0x00011f}, + {0x000121, 0x000121}, + {0x000123, 0x000123}, + {0x000125, 0x000125}, + {0x000127, 0x000127}, + {0x000129, 0x000129}, + {0x00012b, 0x00012b}, + {0x00012d, 0x00012d}, + {0x00012f, 0x00012f}, + {0x000131, 0x000131}, + {0x000133, 0x000133}, + {0x000135, 0x000135}, + {0x000137, 0x000138}, + {0x00013a, 0x00013a}, + {0x00013c, 0x00013c}, + {0x00013e, 0x00013e}, + {0x000140, 0x000140}, + {0x000142, 0x000142}, + {0x000144, 0x000144}, + {0x000146, 0x000146}, + {0x000148, 0x000149}, + {0x00014b, 0x00014b}, + {0x00014d, 0x00014d}, + {0x00014f, 0x00014f}, + {0x000151, 0x000151}, + {0x000153, 0x000153}, + {0x000155, 0x000155}, + {0x000157, 0x000157}, + {0x000159, 0x000159}, + {0x00015b, 0x00015b}, + {0x00015d, 0x00015d}, + {0x00015f, 0x00015f}, + {0x000161, 0x000161}, + {0x000163, 0x000163}, + {0x000165, 0x000165}, + {0x000167, 0x000167}, + {0x000169, 0x000169}, + {0x00016b, 0x00016b}, + {0x00016d, 0x00016d}, + {0x00016f, 0x00016f}, + {0x000171, 0x000171}, + {0x000173, 0x000173}, + {0x000175, 0x000175}, + {0x000177, 0x000177}, + {0x00017a, 0x00017a}, + {0x00017c, 0x00017c}, + {0x00017e, 0x000180}, + {0x000183, 0x000183}, + {0x000185, 0x000185}, + {0x000188, 0x000188}, + {0x00018c, 0x00018d}, + {0x000192, 0x000192}, + {0x000195, 0x000195}, + {0x000199, 0x00019b}, + {0x00019e, 0x00019e}, + {0x0001a1, 0x0001a1}, + {0x0001a3, 0x0001a3}, + {0x0001a5, 0x0001a5}, + {0x0001a8, 0x0001a8}, + {0x0001aa, 0x0001ab}, + {0x0001ad, 0x0001ad}, + {0x0001b0, 0x0001b0}, + {0x0001b4, 0x0001b4}, + {0x0001b6, 0x0001b6}, + {0x0001b9, 0x0001ba}, + {0x0001bd, 0x0001bf}, + {0x0001c6, 0x0001c6}, + {0x0001c9, 0x0001c9}, + {0x0001cc, 0x0001cc}, + {0x0001ce, 0x0001ce}, + {0x0001d0, 0x0001d0}, + {0x0001d2, 0x0001d2}, + {0x0001d4, 0x0001d4}, + {0x0001d6, 0x0001d6}, + {0x0001d8, 0x0001d8}, + {0x0001da, 0x0001da}, + {0x0001dc, 0x0001dd}, + {0x0001df, 0x0001df}, + {0x0001e1, 0x0001e1}, + {0x0001e3, 0x0001e3}, + {0x0001e5, 0x0001e5}, + {0x0001e7, 0x0001e7}, + {0x0001e9, 0x0001e9}, + {0x0001eb, 0x0001eb}, + {0x0001ed, 0x0001ed}, + {0x0001ef, 0x0001f0}, + {0x0001f3, 0x0001f3}, + {0x0001f5, 0x0001f5}, + {0x0001f9, 0x0001f9}, + {0x0001fb, 0x0001fb}, + {0x0001fd, 0x0001fd}, + {0x0001ff, 0x0001ff}, + {0x000201, 0x000201}, + {0x000203, 0x000203}, + {0x000205, 0x000205}, + {0x000207, 0x000207}, + {0x000209, 0x000209}, + {0x00020b, 0x00020b}, + {0x00020d, 0x00020d}, + {0x00020f, 0x00020f}, + {0x000211, 0x000211}, + {0x000213, 0x000213}, + {0x000215, 0x000215}, + {0x000217, 0x000217}, + {0x000219, 0x000219}, + {0x00021b, 0x00021b}, + {0x00021d, 0x00021d}, + {0x00021f, 0x00021f}, + {0x000221, 0x000221}, + {0x000223, 0x000223}, + {0x000225, 0x000225}, + {0x000227, 0x000227}, + {0x000229, 0x000229}, + {0x00022b, 0x00022b}, + {0x00022d, 0x00022d}, + {0x00022f, 0x00022f}, + {0x000231, 0x000231}, + {0x000233, 0x000239}, + {0x00023c, 0x00023c}, + {0x00023f, 0x000240}, + {0x000242, 0x000242}, + {0x000247, 0x000247}, + {0x000249, 0x000249}, + {0x00024b, 0x00024b}, + {0x00024d, 0x00024d}, + {0x00024f, 0x000293}, + {0x000295, 0x0002af}, + {0x0002b0, 0x0002b8}, + {0x0002c0, 0x0002c1}, + {0x0002e0, 0x0002e4}, + {0x000345, 0x000345}, + {0x000371, 0x000371}, + {0x000373, 0x000373}, + {0x000377, 0x000377}, + {0x00037a, 0x00037a}, + {0x00037b, 0x00037d}, + {0x000390, 0x000390}, + {0x0003ac, 0x0003ce}, + {0x0003d0, 0x0003d1}, + {0x0003d5, 0x0003d7}, + {0x0003d9, 0x0003d9}, + {0x0003db, 0x0003db}, + {0x0003dd, 0x0003dd}, + {0x0003df, 0x0003df}, + {0x0003e1, 0x0003e1}, + {0x0003e3, 0x0003e3}, + {0x0003e5, 0x0003e5}, + {0x0003e7, 0x0003e7}, + {0x0003e9, 0x0003e9}, + {0x0003eb, 0x0003eb}, + {0x0003ed, 0x0003ed}, + {0x0003ef, 0x0003f3}, + {0x0003f5, 0x0003f5}, + {0x0003f8, 0x0003f8}, + {0x0003fb, 0x0003fc}, + {0x000430, 0x00045f}, + {0x000461, 0x000461}, + {0x000463, 0x000463}, + {0x000465, 0x000465}, + {0x000467, 0x000467}, + {0x000469, 0x000469}, + {0x00046b, 0x00046b}, + {0x00046d, 0x00046d}, + {0x00046f, 0x00046f}, + {0x000471, 0x000471}, + {0x000473, 0x000473}, + {0x000475, 0x000475}, + {0x000477, 0x000477}, + {0x000479, 0x000479}, + {0x00047b, 0x00047b}, + {0x00047d, 0x00047d}, + {0x00047f, 0x00047f}, + {0x000481, 0x000481}, + {0x00048b, 0x00048b}, + {0x00048d, 0x00048d}, + {0x00048f, 0x00048f}, + {0x000491, 0x000491}, + {0x000493, 0x000493}, + {0x000495, 0x000495}, + {0x000497, 0x000497}, + {0x000499, 0x000499}, + {0x00049b, 0x00049b}, + {0x00049d, 0x00049d}, + {0x00049f, 0x00049f}, + {0x0004a1, 0x0004a1}, + {0x0004a3, 0x0004a3}, + {0x0004a5, 0x0004a5}, + {0x0004a7, 0x0004a7}, + {0x0004a9, 0x0004a9}, + {0x0004ab, 0x0004ab}, + {0x0004ad, 0x0004ad}, + {0x0004af, 0x0004af}, + {0x0004b1, 0x0004b1}, + {0x0004b3, 0x0004b3}, + {0x0004b5, 0x0004b5}, + {0x0004b7, 0x0004b7}, + {0x0004b9, 0x0004b9}, + {0x0004bb, 0x0004bb}, + {0x0004bd, 0x0004bd}, + {0x0004bf, 0x0004bf}, + {0x0004c2, 0x0004c2}, + {0x0004c4, 0x0004c4}, + {0x0004c6, 0x0004c6}, + {0x0004c8, 0x0004c8}, + {0x0004ca, 0x0004ca}, + {0x0004cc, 0x0004cc}, + {0x0004ce, 0x0004cf}, + {0x0004d1, 0x0004d1}, + {0x0004d3, 0x0004d3}, + {0x0004d5, 0x0004d5}, + {0x0004d7, 0x0004d7}, + {0x0004d9, 0x0004d9}, + {0x0004db, 0x0004db}, + {0x0004dd, 0x0004dd}, + {0x0004df, 0x0004df}, + {0x0004e1, 0x0004e1}, + {0x0004e3, 0x0004e3}, + {0x0004e5, 0x0004e5}, + {0x0004e7, 0x0004e7}, + {0x0004e9, 0x0004e9}, + {0x0004eb, 0x0004eb}, + {0x0004ed, 0x0004ed}, + {0x0004ef, 0x0004ef}, + {0x0004f1, 0x0004f1}, + {0x0004f3, 0x0004f3}, + {0x0004f5, 0x0004f5}, + {0x0004f7, 0x0004f7}, + {0x0004f9, 0x0004f9}, + {0x0004fb, 0x0004fb}, + {0x0004fd, 0x0004fd}, + {0x0004ff, 0x0004ff}, + {0x000501, 0x000501}, + {0x000503, 0x000503}, + {0x000505, 0x000505}, + {0x000507, 0x000507}, + {0x000509, 0x000509}, + {0x00050b, 0x00050b}, + {0x00050d, 0x00050d}, + {0x00050f, 0x00050f}, + {0x000511, 0x000511}, + {0x000513, 0x000513}, + {0x000515, 0x000515}, + {0x000517, 0x000517}, + {0x000519, 0x000519}, + {0x00051b, 0x00051b}, + {0x00051d, 0x00051d}, + {0x00051f, 0x00051f}, + {0x000521, 0x000521}, + {0x000523, 0x000523}, + {0x000525, 0x000525}, + {0x000527, 0x000527}, + {0x000529, 0x000529}, + {0x00052b, 0x00052b}, + {0x00052d, 0x00052d}, + {0x00052f, 0x00052f}, + {0x000560, 0x000588}, + {0x0010d0, 0x0010fa}, + {0x0010fc, 0x0010fc}, + {0x0010fd, 0x0010ff}, + {0x0013f8, 0x0013fd}, + {0x001c80, 0x001c88}, + {0x001d00, 0x001d2b}, + {0x001d2c, 0x001d6a}, + {0x001d6b, 0x001d77}, + {0x001d78, 0x001d78}, + {0x001d79, 0x001d9a}, + {0x001d9b, 0x001dbf}, + {0x001e01, 0x001e01}, + {0x001e03, 0x001e03}, + {0x001e05, 0x001e05}, + {0x001e07, 0x001e07}, + {0x001e09, 0x001e09}, + {0x001e0b, 0x001e0b}, + {0x001e0d, 0x001e0d}, + {0x001e0f, 0x001e0f}, + {0x001e11, 0x001e11}, + {0x001e13, 0x001e13}, + {0x001e15, 0x001e15}, + {0x001e17, 0x001e17}, + {0x001e19, 0x001e19}, + {0x001e1b, 0x001e1b}, + {0x001e1d, 0x001e1d}, + {0x001e1f, 0x001e1f}, + {0x001e21, 0x001e21}, + {0x001e23, 0x001e23}, + {0x001e25, 0x001e25}, + {0x001e27, 0x001e27}, + {0x001e29, 0x001e29}, + {0x001e2b, 0x001e2b}, + {0x001e2d, 0x001e2d}, + {0x001e2f, 0x001e2f}, + {0x001e31, 0x001e31}, + {0x001e33, 0x001e33}, + {0x001e35, 0x001e35}, + {0x001e37, 0x001e37}, + {0x001e39, 0x001e39}, + {0x001e3b, 0x001e3b}, + {0x001e3d, 0x001e3d}, + {0x001e3f, 0x001e3f}, + {0x001e41, 0x001e41}, + {0x001e43, 0x001e43}, + {0x001e45, 0x001e45}, + {0x001e47, 0x001e47}, + {0x001e49, 0x001e49}, + {0x001e4b, 0x001e4b}, + {0x001e4d, 0x001e4d}, + {0x001e4f, 0x001e4f}, + {0x001e51, 0x001e51}, + {0x001e53, 0x001e53}, + {0x001e55, 0x001e55}, + {0x001e57, 0x001e57}, + {0x001e59, 0x001e59}, + {0x001e5b, 0x001e5b}, + {0x001e5d, 0x001e5d}, + {0x001e5f, 0x001e5f}, + {0x001e61, 0x001e61}, + {0x001e63, 0x001e63}, + {0x001e65, 0x001e65}, + {0x001e67, 0x001e67}, + {0x001e69, 0x001e69}, + {0x001e6b, 0x001e6b}, + {0x001e6d, 0x001e6d}, + {0x001e6f, 0x001e6f}, + {0x001e71, 0x001e71}, + {0x001e73, 0x001e73}, + {0x001e75, 0x001e75}, + {0x001e77, 0x001e77}, + {0x001e79, 0x001e79}, + {0x001e7b, 0x001e7b}, + {0x001e7d, 0x001e7d}, + {0x001e7f, 0x001e7f}, + {0x001e81, 0x001e81}, + {0x001e83, 0x001e83}, + {0x001e85, 0x001e85}, + {0x001e87, 0x001e87}, + {0x001e89, 0x001e89}, + {0x001e8b, 0x001e8b}, + {0x001e8d, 0x001e8d}, + {0x001e8f, 0x001e8f}, + {0x001e91, 0x001e91}, + {0x001e93, 0x001e93}, + {0x001e95, 0x001e9d}, + {0x001e9f, 0x001e9f}, + {0x001ea1, 0x001ea1}, + {0x001ea3, 0x001ea3}, + {0x001ea5, 0x001ea5}, + {0x001ea7, 0x001ea7}, + {0x001ea9, 0x001ea9}, + {0x001eab, 0x001eab}, + {0x001ead, 0x001ead}, + {0x001eaf, 0x001eaf}, + {0x001eb1, 0x001eb1}, + {0x001eb3, 0x001eb3}, + {0x001eb5, 0x001eb5}, + {0x001eb7, 0x001eb7}, + {0x001eb9, 0x001eb9}, + {0x001ebb, 0x001ebb}, + {0x001ebd, 0x001ebd}, + {0x001ebf, 0x001ebf}, + {0x001ec1, 0x001ec1}, + {0x001ec3, 0x001ec3}, + {0x001ec5, 0x001ec5}, + {0x001ec7, 0x001ec7}, + {0x001ec9, 0x001ec9}, + {0x001ecb, 0x001ecb}, + {0x001ecd, 0x001ecd}, + {0x001ecf, 0x001ecf}, + {0x001ed1, 0x001ed1}, + {0x001ed3, 0x001ed3}, + {0x001ed5, 0x001ed5}, + {0x001ed7, 0x001ed7}, + {0x001ed9, 0x001ed9}, + {0x001edb, 0x001edb}, + {0x001edd, 0x001edd}, + {0x001edf, 0x001edf}, + {0x001ee1, 0x001ee1}, + {0x001ee3, 0x001ee3}, + {0x001ee5, 0x001ee5}, + {0x001ee7, 0x001ee7}, + {0x001ee9, 0x001ee9}, + {0x001eeb, 0x001eeb}, + {0x001eed, 0x001eed}, + {0x001eef, 0x001eef}, + {0x001ef1, 0x001ef1}, + {0x001ef3, 0x001ef3}, + {0x001ef5, 0x001ef5}, + {0x001ef7, 0x001ef7}, + {0x001ef9, 0x001ef9}, + {0x001efb, 0x001efb}, + {0x001efd, 0x001efd}, + {0x001eff, 0x001f07}, + {0x001f10, 0x001f15}, + {0x001f20, 0x001f27}, + {0x001f30, 0x001f37}, + {0x001f40, 0x001f45}, + {0x001f50, 0x001f57}, + {0x001f60, 0x001f67}, + {0x001f70, 0x001f7d}, + {0x001f80, 0x001f87}, + {0x001f90, 0x001f97}, + {0x001fa0, 0x001fa7}, + {0x001fb0, 0x001fb4}, + {0x001fb6, 0x001fb7}, + {0x001fbe, 0x001fbe}, + {0x001fc2, 0x001fc4}, + {0x001fc6, 0x001fc7}, + {0x001fd0, 0x001fd3}, + {0x001fd6, 0x001fd7}, + {0x001fe0, 0x001fe7}, + {0x001ff2, 0x001ff4}, + {0x001ff6, 0x001ff7}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x00210a, 0x00210a}, + {0x00210e, 0x00210f}, + {0x002113, 0x002113}, + {0x00212f, 0x00212f}, + {0x002134, 0x002134}, + {0x002139, 0x002139}, + {0x00213c, 0x00213d}, + {0x002146, 0x002149}, + {0x00214e, 0x00214e}, + {0x002170, 0x00217f}, + {0x002184, 0x002184}, + {0x0024d0, 0x0024e9}, + {0x002c30, 0x002c5f}, + {0x002c61, 0x002c61}, + {0x002c65, 0x002c66}, + {0x002c68, 0x002c68}, + {0x002c6a, 0x002c6a}, + {0x002c6c, 0x002c6c}, + {0x002c71, 0x002c71}, + {0x002c73, 0x002c74}, + {0x002c76, 0x002c7b}, + {0x002c7c, 0x002c7d}, + {0x002c81, 0x002c81}, + {0x002c83, 0x002c83}, + {0x002c85, 0x002c85}, + {0x002c87, 0x002c87}, + {0x002c89, 0x002c89}, + {0x002c8b, 0x002c8b}, + {0x002c8d, 0x002c8d}, + {0x002c8f, 0x002c8f}, + {0x002c91, 0x002c91}, + {0x002c93, 0x002c93}, + {0x002c95, 0x002c95}, + {0x002c97, 0x002c97}, + {0x002c99, 0x002c99}, + {0x002c9b, 0x002c9b}, + {0x002c9d, 0x002c9d}, + {0x002c9f, 0x002c9f}, + {0x002ca1, 0x002ca1}, + {0x002ca3, 0x002ca3}, + {0x002ca5, 0x002ca5}, + {0x002ca7, 0x002ca7}, + {0x002ca9, 0x002ca9}, + {0x002cab, 0x002cab}, + {0x002cad, 0x002cad}, + {0x002caf, 0x002caf}, + {0x002cb1, 0x002cb1}, + {0x002cb3, 0x002cb3}, + {0x002cb5, 0x002cb5}, + {0x002cb7, 0x002cb7}, + {0x002cb9, 0x002cb9}, + {0x002cbb, 0x002cbb}, + {0x002cbd, 0x002cbd}, + {0x002cbf, 0x002cbf}, + {0x002cc1, 0x002cc1}, + {0x002cc3, 0x002cc3}, + {0x002cc5, 0x002cc5}, + {0x002cc7, 0x002cc7}, + {0x002cc9, 0x002cc9}, + {0x002ccb, 0x002ccb}, + {0x002ccd, 0x002ccd}, + {0x002ccf, 0x002ccf}, + {0x002cd1, 0x002cd1}, + {0x002cd3, 0x002cd3}, + {0x002cd5, 0x002cd5}, + {0x002cd7, 0x002cd7}, + {0x002cd9, 0x002cd9}, + {0x002cdb, 0x002cdb}, + {0x002cdd, 0x002cdd}, + {0x002cdf, 0x002cdf}, + {0x002ce1, 0x002ce1}, + {0x002ce3, 0x002ce4}, + {0x002cec, 0x002cec}, + {0x002cee, 0x002cee}, + {0x002cf3, 0x002cf3}, + {0x002d00, 0x002d25}, + {0x002d27, 0x002d27}, + {0x002d2d, 0x002d2d}, + {0x00a641, 0x00a641}, + {0x00a643, 0x00a643}, + {0x00a645, 0x00a645}, + {0x00a647, 0x00a647}, + {0x00a649, 0x00a649}, + {0x00a64b, 0x00a64b}, + {0x00a64d, 0x00a64d}, + {0x00a64f, 0x00a64f}, + {0x00a651, 0x00a651}, + {0x00a653, 0x00a653}, + {0x00a655, 0x00a655}, + {0x00a657, 0x00a657}, + {0x00a659, 0x00a659}, + {0x00a65b, 0x00a65b}, + {0x00a65d, 0x00a65d}, + {0x00a65f, 0x00a65f}, + {0x00a661, 0x00a661}, + {0x00a663, 0x00a663}, + {0x00a665, 0x00a665}, + {0x00a667, 0x00a667}, + {0x00a669, 0x00a669}, + {0x00a66b, 0x00a66b}, + {0x00a66d, 0x00a66d}, + {0x00a681, 0x00a681}, + {0x00a683, 0x00a683}, + {0x00a685, 0x00a685}, + {0x00a687, 0x00a687}, + {0x00a689, 0x00a689}, + {0x00a68b, 0x00a68b}, + {0x00a68d, 0x00a68d}, + {0x00a68f, 0x00a68f}, + {0x00a691, 0x00a691}, + {0x00a693, 0x00a693}, + {0x00a695, 0x00a695}, + {0x00a697, 0x00a697}, + {0x00a699, 0x00a699}, + {0x00a69b, 0x00a69b}, + {0x00a69c, 0x00a69d}, + {0x00a723, 0x00a723}, + {0x00a725, 0x00a725}, + {0x00a727, 0x00a727}, + {0x00a729, 0x00a729}, + {0x00a72b, 0x00a72b}, + {0x00a72d, 0x00a72d}, + {0x00a72f, 0x00a731}, + {0x00a733, 0x00a733}, + {0x00a735, 0x00a735}, + {0x00a737, 0x00a737}, + {0x00a739, 0x00a739}, + {0x00a73b, 0x00a73b}, + {0x00a73d, 0x00a73d}, + {0x00a73f, 0x00a73f}, + {0x00a741, 0x00a741}, + {0x00a743, 0x00a743}, + {0x00a745, 0x00a745}, + {0x00a747, 0x00a747}, + {0x00a749, 0x00a749}, + {0x00a74b, 0x00a74b}, + {0x00a74d, 0x00a74d}, + {0x00a74f, 0x00a74f}, + {0x00a751, 0x00a751}, + {0x00a753, 0x00a753}, + {0x00a755, 0x00a755}, + {0x00a757, 0x00a757}, + {0x00a759, 0x00a759}, + {0x00a75b, 0x00a75b}, + {0x00a75d, 0x00a75d}, + {0x00a75f, 0x00a75f}, + {0x00a761, 0x00a761}, + {0x00a763, 0x00a763}, + {0x00a765, 0x00a765}, + {0x00a767, 0x00a767}, + {0x00a769, 0x00a769}, + {0x00a76b, 0x00a76b}, + {0x00a76d, 0x00a76d}, + {0x00a76f, 0x00a76f}, + {0x00a770, 0x00a770}, + {0x00a771, 0x00a778}, + {0x00a77a, 0x00a77a}, + {0x00a77c, 0x00a77c}, + {0x00a77f, 0x00a77f}, + {0x00a781, 0x00a781}, + {0x00a783, 0x00a783}, + {0x00a785, 0x00a785}, + {0x00a787, 0x00a787}, + {0x00a78c, 0x00a78c}, + {0x00a78e, 0x00a78e}, + {0x00a791, 0x00a791}, + {0x00a793, 0x00a795}, + {0x00a797, 0x00a797}, + {0x00a799, 0x00a799}, + {0x00a79b, 0x00a79b}, + {0x00a79d, 0x00a79d}, + {0x00a79f, 0x00a79f}, + {0x00a7a1, 0x00a7a1}, + {0x00a7a3, 0x00a7a3}, + {0x00a7a5, 0x00a7a5}, + {0x00a7a7, 0x00a7a7}, + {0x00a7a9, 0x00a7a9}, + {0x00a7af, 0x00a7af}, + {0x00a7b5, 0x00a7b5}, + {0x00a7b7, 0x00a7b7}, + {0x00a7b9, 0x00a7b9}, + {0x00a7bb, 0x00a7bb}, + {0x00a7bd, 0x00a7bd}, + {0x00a7bf, 0x00a7bf}, + {0x00a7c1, 0x00a7c1}, + {0x00a7c3, 0x00a7c3}, + {0x00a7c8, 0x00a7c8}, + {0x00a7ca, 0x00a7ca}, + {0x00a7d1, 0x00a7d1}, + {0x00a7d3, 0x00a7d3}, + {0x00a7d5, 0x00a7d5}, + {0x00a7d7, 0x00a7d7}, + {0x00a7d9, 0x00a7d9}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f6, 0x00a7f6}, + {0x00a7f8, 0x00a7f9}, + {0x00a7fa, 0x00a7fa}, + {0x00ab30, 0x00ab5a}, + {0x00ab5c, 0x00ab5f}, + {0x00ab60, 0x00ab68}, + {0x00ab69, 0x00ab69}, + {0x00ab70, 0x00abbf}, + {0x00fb00, 0x00fb06}, + {0x00fb13, 0x00fb17}, + {0x00ff41, 0x00ff5a}, + {0x010428, 0x01044f}, + {0x0104d8, 0x0104fb}, + {0x010597, 0x0105a1}, + {0x0105a3, 0x0105b1}, + {0x0105b3, 0x0105b9}, + {0x0105bb, 0x0105bc}, + {0x010780, 0x010780}, + {0x010783, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010cc0, 0x010cf2}, + {0x0118c0, 0x0118df}, + {0x016e60, 0x016e7f}, + {0x01d41a, 0x01d433}, + {0x01d44e, 0x01d454}, + {0x01d456, 0x01d467}, + {0x01d482, 0x01d49b}, + {0x01d4b6, 0x01d4b9}, + {0x01d4bb, 0x01d4bb}, + {0x01d4bd, 0x01d4c3}, + {0x01d4c5, 0x01d4cf}, + {0x01d4ea, 0x01d503}, + {0x01d51e, 0x01d537}, + {0x01d552, 0x01d56b}, + {0x01d586, 0x01d59f}, + {0x01d5ba, 0x01d5d3}, + {0x01d5ee, 0x01d607}, + {0x01d622, 0x01d63b}, + {0x01d656, 0x01d66f}, + {0x01d68a, 0x01d6a5}, + {0x01d6c2, 0x01d6da}, + {0x01d6dc, 0x01d6e1}, + {0x01d6fc, 0x01d714}, + {0x01d716, 0x01d71b}, + {0x01d736, 0x01d74e}, + {0x01d750, 0x01d755}, + {0x01d770, 0x01d788}, + {0x01d78a, 0x01d78f}, + {0x01d7aa, 0x01d7c2}, + {0x01d7c4, 0x01d7c9}, + {0x01d7cb, 0x01d7cb}, + {0x01df00, 0x01df09}, + {0x01df0b, 0x01df1e}, + {0x01df25, 0x01df2a}, + {0x01e030, 0x01e06d}, + {0x01e922, 0x01e943}, +}; + +/* table of Unicode codepoint ranges of Uppercase characters */ +static const pg_unicode_range unicode_uppercase[651] = +{ + {0x000041, 0x00005a}, + {0x0000c0, 0x0000d6}, + {0x0000d8, 0x0000de}, + {0x000100, 0x000100}, + {0x000102, 0x000102}, + {0x000104, 0x000104}, + {0x000106, 0x000106}, + {0x000108, 0x000108}, + {0x00010a, 0x00010a}, + {0x00010c, 0x00010c}, + {0x00010e, 0x00010e}, + {0x000110, 0x000110}, + {0x000112, 0x000112}, + {0x000114, 0x000114}, + {0x000116, 0x000116}, + {0x000118, 0x000118}, + {0x00011a, 0x00011a}, + {0x00011c, 0x00011c}, + {0x00011e, 0x00011e}, + {0x000120, 0x000120}, + {0x000122, 0x000122}, + {0x000124, 0x000124}, + {0x000126, 0x000126}, + {0x000128, 0x000128}, + {0x00012a, 0x00012a}, + {0x00012c, 0x00012c}, + {0x00012e, 0x00012e}, + {0x000130, 0x000130}, + {0x000132, 0x000132}, + {0x000134, 0x000134}, + {0x000136, 0x000136}, + {0x000139, 0x000139}, + {0x00013b, 0x00013b}, + {0x00013d, 0x00013d}, + {0x00013f, 0x00013f}, + {0x000141, 0x000141}, + {0x000143, 0x000143}, + {0x000145, 0x000145}, + {0x000147, 0x000147}, + {0x00014a, 0x00014a}, + {0x00014c, 0x00014c}, + {0x00014e, 0x00014e}, + {0x000150, 0x000150}, + {0x000152, 0x000152}, + {0x000154, 0x000154}, + {0x000156, 0x000156}, + {0x000158, 0x000158}, + {0x00015a, 0x00015a}, + {0x00015c, 0x00015c}, + {0x00015e, 0x00015e}, + {0x000160, 0x000160}, + {0x000162, 0x000162}, + {0x000164, 0x000164}, + {0x000166, 0x000166}, + {0x000168, 0x000168}, + {0x00016a, 0x00016a}, + {0x00016c, 0x00016c}, + {0x00016e, 0x00016e}, + {0x000170, 0x000170}, + {0x000172, 0x000172}, + {0x000174, 0x000174}, + {0x000176, 0x000176}, + {0x000178, 0x000179}, + {0x00017b, 0x00017b}, + {0x00017d, 0x00017d}, + {0x000181, 0x000182}, + {0x000184, 0x000184}, + {0x000186, 0x000187}, + {0x000189, 0x00018b}, + {0x00018e, 0x000191}, + {0x000193, 0x000194}, + {0x000196, 0x000198}, + {0x00019c, 0x00019d}, + {0x00019f, 0x0001a0}, + {0x0001a2, 0x0001a2}, + {0x0001a4, 0x0001a4}, + {0x0001a6, 0x0001a7}, + {0x0001a9, 0x0001a9}, + {0x0001ac, 0x0001ac}, + {0x0001ae, 0x0001af}, + {0x0001b1, 0x0001b3}, + {0x0001b5, 0x0001b5}, + {0x0001b7, 0x0001b8}, + {0x0001bc, 0x0001bc}, + {0x0001c4, 0x0001c4}, + {0x0001c7, 0x0001c7}, + {0x0001ca, 0x0001ca}, + {0x0001cd, 0x0001cd}, + {0x0001cf, 0x0001cf}, + {0x0001d1, 0x0001d1}, + {0x0001d3, 0x0001d3}, + {0x0001d5, 0x0001d5}, + {0x0001d7, 0x0001d7}, + {0x0001d9, 0x0001d9}, + {0x0001db, 0x0001db}, + {0x0001de, 0x0001de}, + {0x0001e0, 0x0001e0}, + {0x0001e2, 0x0001e2}, + {0x0001e4, 0x0001e4}, + {0x0001e6, 0x0001e6}, + {0x0001e8, 0x0001e8}, + {0x0001ea, 0x0001ea}, + {0x0001ec, 0x0001ec}, + {0x0001ee, 0x0001ee}, + {0x0001f1, 0x0001f1}, + {0x0001f4, 0x0001f4}, + {0x0001f6, 0x0001f8}, + {0x0001fa, 0x0001fa}, + {0x0001fc, 0x0001fc}, + {0x0001fe, 0x0001fe}, + {0x000200, 0x000200}, + {0x000202, 0x000202}, + {0x000204, 0x000204}, + {0x000206, 0x000206}, + {0x000208, 0x000208}, + {0x00020a, 0x00020a}, + {0x00020c, 0x00020c}, + {0x00020e, 0x00020e}, + {0x000210, 0x000210}, + {0x000212, 0x000212}, + {0x000214, 0x000214}, + {0x000216, 0x000216}, + {0x000218, 0x000218}, + {0x00021a, 0x00021a}, + {0x00021c, 0x00021c}, + {0x00021e, 0x00021e}, + {0x000220, 0x000220}, + {0x000222, 0x000222}, + {0x000224, 0x000224}, + {0x000226, 0x000226}, + {0x000228, 0x000228}, + {0x00022a, 0x00022a}, + {0x00022c, 0x00022c}, + {0x00022e, 0x00022e}, + {0x000230, 0x000230}, + {0x000232, 0x000232}, + {0x00023a, 0x00023b}, + {0x00023d, 0x00023e}, + {0x000241, 0x000241}, + {0x000243, 0x000246}, + {0x000248, 0x000248}, + {0x00024a, 0x00024a}, + {0x00024c, 0x00024c}, + {0x00024e, 0x00024e}, + {0x000370, 0x000370}, + {0x000372, 0x000372}, + {0x000376, 0x000376}, + {0x00037f, 0x00037f}, + {0x000386, 0x000386}, + {0x000388, 0x00038a}, + {0x00038c, 0x00038c}, + {0x00038e, 0x00038f}, + {0x000391, 0x0003a1}, + {0x0003a3, 0x0003ab}, + {0x0003cf, 0x0003cf}, + {0x0003d2, 0x0003d4}, + {0x0003d8, 0x0003d8}, + {0x0003da, 0x0003da}, + {0x0003dc, 0x0003dc}, + {0x0003de, 0x0003de}, + {0x0003e0, 0x0003e0}, + {0x0003e2, 0x0003e2}, + {0x0003e4, 0x0003e4}, + {0x0003e6, 0x0003e6}, + {0x0003e8, 0x0003e8}, + {0x0003ea, 0x0003ea}, + {0x0003ec, 0x0003ec}, + {0x0003ee, 0x0003ee}, + {0x0003f4, 0x0003f4}, + {0x0003f7, 0x0003f7}, + {0x0003f9, 0x0003fa}, + {0x0003fd, 0x00042f}, + {0x000460, 0x000460}, + {0x000462, 0x000462}, + {0x000464, 0x000464}, + {0x000466, 0x000466}, + {0x000468, 0x000468}, + {0x00046a, 0x00046a}, + {0x00046c, 0x00046c}, + {0x00046e, 0x00046e}, + {0x000470, 0x000470}, + {0x000472, 0x000472}, + {0x000474, 0x000474}, + {0x000476, 0x000476}, + {0x000478, 0x000478}, + {0x00047a, 0x00047a}, + {0x00047c, 0x00047c}, + {0x00047e, 0x00047e}, + {0x000480, 0x000480}, + {0x00048a, 0x00048a}, + {0x00048c, 0x00048c}, + {0x00048e, 0x00048e}, + {0x000490, 0x000490}, + {0x000492, 0x000492}, + {0x000494, 0x000494}, + {0x000496, 0x000496}, + {0x000498, 0x000498}, + {0x00049a, 0x00049a}, + {0x00049c, 0x00049c}, + {0x00049e, 0x00049e}, + {0x0004a0, 0x0004a0}, + {0x0004a2, 0x0004a2}, + {0x0004a4, 0x0004a4}, + {0x0004a6, 0x0004a6}, + {0x0004a8, 0x0004a8}, + {0x0004aa, 0x0004aa}, + {0x0004ac, 0x0004ac}, + {0x0004ae, 0x0004ae}, + {0x0004b0, 0x0004b0}, + {0x0004b2, 0x0004b2}, + {0x0004b4, 0x0004b4}, + {0x0004b6, 0x0004b6}, + {0x0004b8, 0x0004b8}, + {0x0004ba, 0x0004ba}, + {0x0004bc, 0x0004bc}, + {0x0004be, 0x0004be}, + {0x0004c0, 0x0004c1}, + {0x0004c3, 0x0004c3}, + {0x0004c5, 0x0004c5}, + {0x0004c7, 0x0004c7}, + {0x0004c9, 0x0004c9}, + {0x0004cb, 0x0004cb}, + {0x0004cd, 0x0004cd}, + {0x0004d0, 0x0004d0}, + {0x0004d2, 0x0004d2}, + {0x0004d4, 0x0004d4}, + {0x0004d6, 0x0004d6}, + {0x0004d8, 0x0004d8}, + {0x0004da, 0x0004da}, + {0x0004dc, 0x0004dc}, + {0x0004de, 0x0004de}, + {0x0004e0, 0x0004e0}, + {0x0004e2, 0x0004e2}, + {0x0004e4, 0x0004e4}, + {0x0004e6, 0x0004e6}, + {0x0004e8, 0x0004e8}, + {0x0004ea, 0x0004ea}, + {0x0004ec, 0x0004ec}, + {0x0004ee, 0x0004ee}, + {0x0004f0, 0x0004f0}, + {0x0004f2, 0x0004f2}, + {0x0004f4, 0x0004f4}, + {0x0004f6, 0x0004f6}, + {0x0004f8, 0x0004f8}, + {0x0004fa, 0x0004fa}, + {0x0004fc, 0x0004fc}, + {0x0004fe, 0x0004fe}, + {0x000500, 0x000500}, + {0x000502, 0x000502}, + {0x000504, 0x000504}, + {0x000506, 0x000506}, + {0x000508, 0x000508}, + {0x00050a, 0x00050a}, + {0x00050c, 0x00050c}, + {0x00050e, 0x00050e}, + {0x000510, 0x000510}, + {0x000512, 0x000512}, + {0x000514, 0x000514}, + {0x000516, 0x000516}, + {0x000518, 0x000518}, + {0x00051a, 0x00051a}, + {0x00051c, 0x00051c}, + {0x00051e, 0x00051e}, + {0x000520, 0x000520}, + {0x000522, 0x000522}, + {0x000524, 0x000524}, + {0x000526, 0x000526}, + {0x000528, 0x000528}, + {0x00052a, 0x00052a}, + {0x00052c, 0x00052c}, + {0x00052e, 0x00052e}, + {0x000531, 0x000556}, + {0x0010a0, 0x0010c5}, + {0x0010c7, 0x0010c7}, + {0x0010cd, 0x0010cd}, + {0x0013a0, 0x0013f5}, + {0x001c90, 0x001cba}, + {0x001cbd, 0x001cbf}, + {0x001e00, 0x001e00}, + {0x001e02, 0x001e02}, + {0x001e04, 0x001e04}, + {0x001e06, 0x001e06}, + {0x001e08, 0x001e08}, + {0x001e0a, 0x001e0a}, + {0x001e0c, 0x001e0c}, + {0x001e0e, 0x001e0e}, + {0x001e10, 0x001e10}, + {0x001e12, 0x001e12}, + {0x001e14, 0x001e14}, + {0x001e16, 0x001e16}, + {0x001e18, 0x001e18}, + {0x001e1a, 0x001e1a}, + {0x001e1c, 0x001e1c}, + {0x001e1e, 0x001e1e}, + {0x001e20, 0x001e20}, + {0x001e22, 0x001e22}, + {0x001e24, 0x001e24}, + {0x001e26, 0x001e26}, + {0x001e28, 0x001e28}, + {0x001e2a, 0x001e2a}, + {0x001e2c, 0x001e2c}, + {0x001e2e, 0x001e2e}, + {0x001e30, 0x001e30}, + {0x001e32, 0x001e32}, + {0x001e34, 0x001e34}, + {0x001e36, 0x001e36}, + {0x001e38, 0x001e38}, + {0x001e3a, 0x001e3a}, + {0x001e3c, 0x001e3c}, + {0x001e3e, 0x001e3e}, + {0x001e40, 0x001e40}, + {0x001e42, 0x001e42}, + {0x001e44, 0x001e44}, + {0x001e46, 0x001e46}, + {0x001e48, 0x001e48}, + {0x001e4a, 0x001e4a}, + {0x001e4c, 0x001e4c}, + {0x001e4e, 0x001e4e}, + {0x001e50, 0x001e50}, + {0x001e52, 0x001e52}, + {0x001e54, 0x001e54}, + {0x001e56, 0x001e56}, + {0x001e58, 0x001e58}, + {0x001e5a, 0x001e5a}, + {0x001e5c, 0x001e5c}, + {0x001e5e, 0x001e5e}, + {0x001e60, 0x001e60}, + {0x001e62, 0x001e62}, + {0x001e64, 0x001e64}, + {0x001e66, 0x001e66}, + {0x001e68, 0x001e68}, + {0x001e6a, 0x001e6a}, + {0x001e6c, 0x001e6c}, + {0x001e6e, 0x001e6e}, + {0x001e70, 0x001e70}, + {0x001e72, 0x001e72}, + {0x001e74, 0x001e74}, + {0x001e76, 0x001e76}, + {0x001e78, 0x001e78}, + {0x001e7a, 0x001e7a}, + {0x001e7c, 0x001e7c}, + {0x001e7e, 0x001e7e}, + {0x001e80, 0x001e80}, + {0x001e82, 0x001e82}, + {0x001e84, 0x001e84}, + {0x001e86, 0x001e86}, + {0x001e88, 0x001e88}, + {0x001e8a, 0x001e8a}, + {0x001e8c, 0x001e8c}, + {0x001e8e, 0x001e8e}, + {0x001e90, 0x001e90}, + {0x001e92, 0x001e92}, + {0x001e94, 0x001e94}, + {0x001e9e, 0x001e9e}, + {0x001ea0, 0x001ea0}, + {0x001ea2, 0x001ea2}, + {0x001ea4, 0x001ea4}, + {0x001ea6, 0x001ea6}, + {0x001ea8, 0x001ea8}, + {0x001eaa, 0x001eaa}, + {0x001eac, 0x001eac}, + {0x001eae, 0x001eae}, + {0x001eb0, 0x001eb0}, + {0x001eb2, 0x001eb2}, + {0x001eb4, 0x001eb4}, + {0x001eb6, 0x001eb6}, + {0x001eb8, 0x001eb8}, + {0x001eba, 0x001eba}, + {0x001ebc, 0x001ebc}, + {0x001ebe, 0x001ebe}, + {0x001ec0, 0x001ec0}, + {0x001ec2, 0x001ec2}, + {0x001ec4, 0x001ec4}, + {0x001ec6, 0x001ec6}, + {0x001ec8, 0x001ec8}, + {0x001eca, 0x001eca}, + {0x001ecc, 0x001ecc}, + {0x001ece, 0x001ece}, + {0x001ed0, 0x001ed0}, + {0x001ed2, 0x001ed2}, + {0x001ed4, 0x001ed4}, + {0x001ed6, 0x001ed6}, + {0x001ed8, 0x001ed8}, + {0x001eda, 0x001eda}, + {0x001edc, 0x001edc}, + {0x001ede, 0x001ede}, + {0x001ee0, 0x001ee0}, + {0x001ee2, 0x001ee2}, + {0x001ee4, 0x001ee4}, + {0x001ee6, 0x001ee6}, + {0x001ee8, 0x001ee8}, + {0x001eea, 0x001eea}, + {0x001eec, 0x001eec}, + {0x001eee, 0x001eee}, + {0x001ef0, 0x001ef0}, + {0x001ef2, 0x001ef2}, + {0x001ef4, 0x001ef4}, + {0x001ef6, 0x001ef6}, + {0x001ef8, 0x001ef8}, + {0x001efa, 0x001efa}, + {0x001efc, 0x001efc}, + {0x001efe, 0x001efe}, + {0x001f08, 0x001f0f}, + {0x001f18, 0x001f1d}, + {0x001f28, 0x001f2f}, + {0x001f38, 0x001f3f}, + {0x001f48, 0x001f4d}, + {0x001f59, 0x001f59}, + {0x001f5b, 0x001f5b}, + {0x001f5d, 0x001f5d}, + {0x001f5f, 0x001f5f}, + {0x001f68, 0x001f6f}, + {0x001fb8, 0x001fbb}, + {0x001fc8, 0x001fcb}, + {0x001fd8, 0x001fdb}, + {0x001fe8, 0x001fec}, + {0x001ff8, 0x001ffb}, + {0x002102, 0x002102}, + {0x002107, 0x002107}, + {0x00210b, 0x00210d}, + {0x002110, 0x002112}, + {0x002115, 0x002115}, + {0x002119, 0x00211d}, + {0x002124, 0x002124}, + {0x002126, 0x002126}, + {0x002128, 0x002128}, + {0x00212a, 0x00212d}, + {0x002130, 0x002133}, + {0x00213e, 0x00213f}, + {0x002145, 0x002145}, + {0x002160, 0x00216f}, + {0x002183, 0x002183}, + {0x0024b6, 0x0024cf}, + {0x002c00, 0x002c2f}, + {0x002c60, 0x002c60}, + {0x002c62, 0x002c64}, + {0x002c67, 0x002c67}, + {0x002c69, 0x002c69}, + {0x002c6b, 0x002c6b}, + {0x002c6d, 0x002c70}, + {0x002c72, 0x002c72}, + {0x002c75, 0x002c75}, + {0x002c7e, 0x002c80}, + {0x002c82, 0x002c82}, + {0x002c84, 0x002c84}, + {0x002c86, 0x002c86}, + {0x002c88, 0x002c88}, + {0x002c8a, 0x002c8a}, + {0x002c8c, 0x002c8c}, + {0x002c8e, 0x002c8e}, + {0x002c90, 0x002c90}, + {0x002c92, 0x002c92}, + {0x002c94, 0x002c94}, + {0x002c96, 0x002c96}, + {0x002c98, 0x002c98}, + {0x002c9a, 0x002c9a}, + {0x002c9c, 0x002c9c}, + {0x002c9e, 0x002c9e}, + {0x002ca0, 0x002ca0}, + {0x002ca2, 0x002ca2}, + {0x002ca4, 0x002ca4}, + {0x002ca6, 0x002ca6}, + {0x002ca8, 0x002ca8}, + {0x002caa, 0x002caa}, + {0x002cac, 0x002cac}, + {0x002cae, 0x002cae}, + {0x002cb0, 0x002cb0}, + {0x002cb2, 0x002cb2}, + {0x002cb4, 0x002cb4}, + {0x002cb6, 0x002cb6}, + {0x002cb8, 0x002cb8}, + {0x002cba, 0x002cba}, + {0x002cbc, 0x002cbc}, + {0x002cbe, 0x002cbe}, + {0x002cc0, 0x002cc0}, + {0x002cc2, 0x002cc2}, + {0x002cc4, 0x002cc4}, + {0x002cc6, 0x002cc6}, + {0x002cc8, 0x002cc8}, + {0x002cca, 0x002cca}, + {0x002ccc, 0x002ccc}, + {0x002cce, 0x002cce}, + {0x002cd0, 0x002cd0}, + {0x002cd2, 0x002cd2}, + {0x002cd4, 0x002cd4}, + {0x002cd6, 0x002cd6}, + {0x002cd8, 0x002cd8}, + {0x002cda, 0x002cda}, + {0x002cdc, 0x002cdc}, + {0x002cde, 0x002cde}, + {0x002ce0, 0x002ce0}, + {0x002ce2, 0x002ce2}, + {0x002ceb, 0x002ceb}, + {0x002ced, 0x002ced}, + {0x002cf2, 0x002cf2}, + {0x00a640, 0x00a640}, + {0x00a642, 0x00a642}, + {0x00a644, 0x00a644}, + {0x00a646, 0x00a646}, + {0x00a648, 0x00a648}, + {0x00a64a, 0x00a64a}, + {0x00a64c, 0x00a64c}, + {0x00a64e, 0x00a64e}, + {0x00a650, 0x00a650}, + {0x00a652, 0x00a652}, + {0x00a654, 0x00a654}, + {0x00a656, 0x00a656}, + {0x00a658, 0x00a658}, + {0x00a65a, 0x00a65a}, + {0x00a65c, 0x00a65c}, + {0x00a65e, 0x00a65e}, + {0x00a660, 0x00a660}, + {0x00a662, 0x00a662}, + {0x00a664, 0x00a664}, + {0x00a666, 0x00a666}, + {0x00a668, 0x00a668}, + {0x00a66a, 0x00a66a}, + {0x00a66c, 0x00a66c}, + {0x00a680, 0x00a680}, + {0x00a682, 0x00a682}, + {0x00a684, 0x00a684}, + {0x00a686, 0x00a686}, + {0x00a688, 0x00a688}, + {0x00a68a, 0x00a68a}, + {0x00a68c, 0x00a68c}, + {0x00a68e, 0x00a68e}, + {0x00a690, 0x00a690}, + {0x00a692, 0x00a692}, + {0x00a694, 0x00a694}, + {0x00a696, 0x00a696}, + {0x00a698, 0x00a698}, + {0x00a69a, 0x00a69a}, + {0x00a722, 0x00a722}, + {0x00a724, 0x00a724}, + {0x00a726, 0x00a726}, + {0x00a728, 0x00a728}, + {0x00a72a, 0x00a72a}, + {0x00a72c, 0x00a72c}, + {0x00a72e, 0x00a72e}, + {0x00a732, 0x00a732}, + {0x00a734, 0x00a734}, + {0x00a736, 0x00a736}, + {0x00a738, 0x00a738}, + {0x00a73a, 0x00a73a}, + {0x00a73c, 0x00a73c}, + {0x00a73e, 0x00a73e}, + {0x00a740, 0x00a740}, + {0x00a742, 0x00a742}, + {0x00a744, 0x00a744}, + {0x00a746, 0x00a746}, + {0x00a748, 0x00a748}, + {0x00a74a, 0x00a74a}, + {0x00a74c, 0x00a74c}, + {0x00a74e, 0x00a74e}, + {0x00a750, 0x00a750}, + {0x00a752, 0x00a752}, + {0x00a754, 0x00a754}, + {0x00a756, 0x00a756}, + {0x00a758, 0x00a758}, + {0x00a75a, 0x00a75a}, + {0x00a75c, 0x00a75c}, + {0x00a75e, 0x00a75e}, + {0x00a760, 0x00a760}, + {0x00a762, 0x00a762}, + {0x00a764, 0x00a764}, + {0x00a766, 0x00a766}, + {0x00a768, 0x00a768}, + {0x00a76a, 0x00a76a}, + {0x00a76c, 0x00a76c}, + {0x00a76e, 0x00a76e}, + {0x00a779, 0x00a779}, + {0x00a77b, 0x00a77b}, + {0x00a77d, 0x00a77e}, + {0x00a780, 0x00a780}, + {0x00a782, 0x00a782}, + {0x00a784, 0x00a784}, + {0x00a786, 0x00a786}, + {0x00a78b, 0x00a78b}, + {0x00a78d, 0x00a78d}, + {0x00a790, 0x00a790}, + {0x00a792, 0x00a792}, + {0x00a796, 0x00a796}, + {0x00a798, 0x00a798}, + {0x00a79a, 0x00a79a}, + {0x00a79c, 0x00a79c}, + {0x00a79e, 0x00a79e}, + {0x00a7a0, 0x00a7a0}, + {0x00a7a2, 0x00a7a2}, + {0x00a7a4, 0x00a7a4}, + {0x00a7a6, 0x00a7a6}, + {0x00a7a8, 0x00a7a8}, + {0x00a7aa, 0x00a7ae}, + {0x00a7b0, 0x00a7b4}, + {0x00a7b6, 0x00a7b6}, + {0x00a7b8, 0x00a7b8}, + {0x00a7ba, 0x00a7ba}, + {0x00a7bc, 0x00a7bc}, + {0x00a7be, 0x00a7be}, + {0x00a7c0, 0x00a7c0}, + {0x00a7c2, 0x00a7c2}, + {0x00a7c4, 0x00a7c7}, + {0x00a7c9, 0x00a7c9}, + {0x00a7d0, 0x00a7d0}, + {0x00a7d6, 0x00a7d6}, + {0x00a7d8, 0x00a7d8}, + {0x00a7f5, 0x00a7f5}, + {0x00ff21, 0x00ff3a}, + {0x010400, 0x010427}, + {0x0104b0, 0x0104d3}, + {0x010570, 0x01057a}, + {0x01057c, 0x01058a}, + {0x01058c, 0x010592}, + {0x010594, 0x010595}, + {0x010c80, 0x010cb2}, + {0x0118a0, 0x0118bf}, + {0x016e40, 0x016e5f}, + {0x01d400, 0x01d419}, + {0x01d434, 0x01d44d}, + {0x01d468, 0x01d481}, + {0x01d49c, 0x01d49c}, + {0x01d49e, 0x01d49f}, + {0x01d4a2, 0x01d4a2}, + {0x01d4a5, 0x01d4a6}, + {0x01d4a9, 0x01d4ac}, + {0x01d4ae, 0x01d4b5}, + {0x01d4d0, 0x01d4e9}, + {0x01d504, 0x01d505}, + {0x01d507, 0x01d50a}, + {0x01d50d, 0x01d514}, + {0x01d516, 0x01d51c}, + {0x01d538, 0x01d539}, + {0x01d53b, 0x01d53e}, + {0x01d540, 0x01d544}, + {0x01d546, 0x01d546}, + {0x01d54a, 0x01d550}, + {0x01d56c, 0x01d585}, + {0x01d5a0, 0x01d5b9}, + {0x01d5d4, 0x01d5ed}, + {0x01d608, 0x01d621}, + {0x01d63c, 0x01d655}, + {0x01d670, 0x01d689}, + {0x01d6a8, 0x01d6c0}, + {0x01d6e2, 0x01d6fa}, + {0x01d71c, 0x01d734}, + {0x01d756, 0x01d76e}, + {0x01d790, 0x01d7a8}, + {0x01d7ca, 0x01d7ca}, + {0x01e900, 0x01e921}, + {0x01f130, 0x01f149}, + {0x01f150, 0x01f169}, + {0x01f170, 0x01f189}, +}; + +/* table of Unicode codepoint ranges of Case_Ignorable characters */ +static const pg_unicode_range unicode_case_ignorable[491] = +{ + {0x000027, 0x000027}, + {0x00002e, 0x00002e}, + {0x00003a, 0x00003a}, + {0x00005e, 0x00005e}, + {0x000060, 0x000060}, + {0x0000a8, 0x0000a8}, + {0x0000ad, 0x0000ad}, + {0x0000af, 0x0000af}, + {0x0000b4, 0x0000b4}, + {0x0000b7, 0x0000b7}, + {0x0000b8, 0x0000b8}, + {0x0002b0, 0x0002c1}, + {0x0002c2, 0x0002c5}, + {0x0002c6, 0x0002d1}, + {0x0002d2, 0x0002df}, + {0x0002e0, 0x0002e4}, + {0x0002e5, 0x0002eb}, + {0x0002ec, 0x0002ec}, + {0x0002ed, 0x0002ed}, + {0x0002ee, 0x0002ee}, + {0x0002ef, 0x0002ff}, + {0x000300, 0x00036f}, + {0x000374, 0x000374}, + {0x000375, 0x000375}, + {0x00037a, 0x00037a}, + {0x000384, 0x000385}, + {0x000387, 0x000387}, + {0x000483, 0x000487}, + {0x000488, 0x000489}, + {0x000559, 0x000559}, + {0x00055f, 0x00055f}, + {0x000591, 0x0005bd}, + {0x0005bf, 0x0005bf}, + {0x0005c1, 0x0005c2}, + {0x0005c4, 0x0005c5}, + {0x0005c7, 0x0005c7}, + {0x0005f4, 0x0005f4}, + {0x000600, 0x000605}, + {0x000610, 0x00061a}, + {0x00061c, 0x00061c}, + {0x000640, 0x000640}, + {0x00064b, 0x00065f}, + {0x000670, 0x000670}, + {0x0006d6, 0x0006dc}, + {0x0006dd, 0x0006dd}, + {0x0006df, 0x0006e4}, + {0x0006e5, 0x0006e6}, + {0x0006e7, 0x0006e8}, + {0x0006ea, 0x0006ed}, + {0x00070f, 0x00070f}, + {0x000711, 0x000711}, + {0x000730, 0x00074a}, + {0x0007a6, 0x0007b0}, + {0x0007eb, 0x0007f3}, + {0x0007f4, 0x0007f5}, + {0x0007fa, 0x0007fa}, + {0x0007fd, 0x0007fd}, + {0x000816, 0x000819}, + {0x00081a, 0x00081a}, + {0x00081b, 0x000823}, + {0x000824, 0x000824}, + {0x000825, 0x000827}, + {0x000828, 0x000828}, + {0x000829, 0x00082d}, + {0x000859, 0x00085b}, + {0x000888, 0x000888}, + {0x000890, 0x000891}, + {0x000898, 0x00089f}, + {0x0008c9, 0x0008c9}, + {0x0008ca, 0x0008e1}, + {0x0008e2, 0x0008e2}, + {0x0008e3, 0x000902}, + {0x00093a, 0x00093a}, + {0x00093c, 0x00093c}, + {0x000941, 0x000948}, + {0x00094d, 0x00094d}, + {0x000951, 0x000957}, + {0x000962, 0x000963}, + {0x000971, 0x000971}, + {0x000981, 0x000981}, + {0x0009bc, 0x0009bc}, + {0x0009c1, 0x0009c4}, + {0x0009cd, 0x0009cd}, + {0x0009e2, 0x0009e3}, + {0x0009fe, 0x0009fe}, + {0x000a01, 0x000a02}, + {0x000a3c, 0x000a3c}, + {0x000a41, 0x000a42}, + {0x000a47, 0x000a48}, + {0x000a4b, 0x000a4d}, + {0x000a51, 0x000a51}, + {0x000a70, 0x000a71}, + {0x000a75, 0x000a75}, + {0x000a81, 0x000a82}, + {0x000abc, 0x000abc}, + {0x000ac1, 0x000ac5}, + {0x000ac7, 0x000ac8}, + {0x000acd, 0x000acd}, + {0x000ae2, 0x000ae3}, + {0x000afa, 0x000aff}, + {0x000b01, 0x000b01}, + {0x000b3c, 0x000b3c}, + {0x000b3f, 0x000b3f}, + {0x000b41, 0x000b44}, + {0x000b4d, 0x000b4d}, + {0x000b55, 0x000b56}, + {0x000b62, 0x000b63}, + {0x000b82, 0x000b82}, + {0x000bc0, 0x000bc0}, + {0x000bcd, 0x000bcd}, + {0x000c00, 0x000c00}, + {0x000c04, 0x000c04}, + {0x000c3c, 0x000c3c}, + {0x000c3e, 0x000c40}, + {0x000c46, 0x000c48}, + {0x000c4a, 0x000c4d}, + {0x000c55, 0x000c56}, + {0x000c62, 0x000c63}, + {0x000c81, 0x000c81}, + {0x000cbc, 0x000cbc}, + {0x000cbf, 0x000cbf}, + {0x000cc6, 0x000cc6}, + {0x000ccc, 0x000ccd}, + {0x000ce2, 0x000ce3}, + {0x000d00, 0x000d01}, + {0x000d3b, 0x000d3c}, + {0x000d41, 0x000d44}, + {0x000d4d, 0x000d4d}, + {0x000d62, 0x000d63}, + {0x000d81, 0x000d81}, + {0x000dca, 0x000dca}, + {0x000dd2, 0x000dd4}, + {0x000dd6, 0x000dd6}, + {0x000e31, 0x000e31}, + {0x000e34, 0x000e3a}, + {0x000e46, 0x000e46}, + {0x000e47, 0x000e4e}, + {0x000eb1, 0x000eb1}, + {0x000eb4, 0x000ebc}, + {0x000ec6, 0x000ec6}, + {0x000ec8, 0x000ece}, + {0x000f18, 0x000f19}, + {0x000f35, 0x000f35}, + {0x000f37, 0x000f37}, + {0x000f39, 0x000f39}, + {0x000f71, 0x000f7e}, + {0x000f80, 0x000f84}, + {0x000f86, 0x000f87}, + {0x000f8d, 0x000f97}, + {0x000f99, 0x000fbc}, + {0x000fc6, 0x000fc6}, + {0x00102d, 0x001030}, + {0x001032, 0x001037}, + {0x001039, 0x00103a}, + {0x00103d, 0x00103e}, + {0x001058, 0x001059}, + {0x00105e, 0x001060}, + {0x001071, 0x001074}, + {0x001082, 0x001082}, + {0x001085, 0x001086}, + {0x00108d, 0x00108d}, + {0x00109d, 0x00109d}, + {0x0010fc, 0x0010fc}, + {0x00135d, 0x00135f}, + {0x001712, 0x001714}, + {0x001732, 0x001733}, + {0x001752, 0x001753}, + {0x001772, 0x001773}, + {0x0017b4, 0x0017b5}, + {0x0017b7, 0x0017bd}, + {0x0017c6, 0x0017c6}, + {0x0017c9, 0x0017d3}, + {0x0017d7, 0x0017d7}, + {0x0017dd, 0x0017dd}, + {0x00180b, 0x00180d}, + {0x00180e, 0x00180e}, + {0x00180f, 0x00180f}, + {0x001843, 0x001843}, + {0x001885, 0x001886}, + {0x0018a9, 0x0018a9}, + {0x001920, 0x001922}, + {0x001927, 0x001928}, + {0x001932, 0x001932}, + {0x001939, 0x00193b}, + {0x001a17, 0x001a18}, + {0x001a1b, 0x001a1b}, + {0x001a56, 0x001a56}, + {0x001a58, 0x001a5e}, + {0x001a60, 0x001a60}, + {0x001a62, 0x001a62}, + {0x001a65, 0x001a6c}, + {0x001a73, 0x001a7c}, + {0x001a7f, 0x001a7f}, + {0x001aa7, 0x001aa7}, + {0x001ab0, 0x001abd}, + {0x001abe, 0x001abe}, + {0x001abf, 0x001ace}, + {0x001b00, 0x001b03}, + {0x001b34, 0x001b34}, + {0x001b36, 0x001b3a}, + {0x001b3c, 0x001b3c}, + {0x001b42, 0x001b42}, + {0x001b6b, 0x001b73}, + {0x001b80, 0x001b81}, + {0x001ba2, 0x001ba5}, + {0x001ba8, 0x001ba9}, + {0x001bab, 0x001bad}, + {0x001be6, 0x001be6}, + {0x001be8, 0x001be9}, + {0x001bed, 0x001bed}, + {0x001bef, 0x001bf1}, + {0x001c2c, 0x001c33}, + {0x001c36, 0x001c37}, + {0x001c78, 0x001c7d}, + {0x001cd0, 0x001cd2}, + {0x001cd4, 0x001ce0}, + {0x001ce2, 0x001ce8}, + {0x001ced, 0x001ced}, + {0x001cf4, 0x001cf4}, + {0x001cf8, 0x001cf9}, + {0x001d2c, 0x001d6a}, + {0x001d78, 0x001d78}, + {0x001d9b, 0x001dbf}, + {0x001dc0, 0x001dff}, + {0x001fbd, 0x001fbd}, + {0x001fbf, 0x001fc1}, + {0x001fcd, 0x001fcf}, + {0x001fdd, 0x001fdf}, + {0x001fed, 0x001fef}, + {0x001ffd, 0x001ffe}, + {0x00200b, 0x00200f}, + {0x002018, 0x002018}, + {0x002019, 0x002019}, + {0x002024, 0x002024}, + {0x002027, 0x002027}, + {0x00202a, 0x00202e}, + {0x002060, 0x002064}, + {0x002066, 0x00206f}, + {0x002071, 0x002071}, + {0x00207f, 0x00207f}, + {0x002090, 0x00209c}, + {0x0020d0, 0x0020dc}, + {0x0020dd, 0x0020e0}, + {0x0020e1, 0x0020e1}, + {0x0020e2, 0x0020e4}, + {0x0020e5, 0x0020f0}, + {0x002c7c, 0x002c7d}, + {0x002cef, 0x002cf1}, + {0x002d6f, 0x002d6f}, + {0x002d7f, 0x002d7f}, + {0x002de0, 0x002dff}, + {0x002e2f, 0x002e2f}, + {0x003005, 0x003005}, + {0x00302a, 0x00302d}, + {0x003031, 0x003035}, + {0x00303b, 0x00303b}, + {0x003099, 0x00309a}, + {0x00309b, 0x00309c}, + {0x00309d, 0x00309e}, + {0x0030fc, 0x0030fe}, + {0x00a015, 0x00a015}, + {0x00a4f8, 0x00a4fd}, + {0x00a60c, 0x00a60c}, + {0x00a66f, 0x00a66f}, + {0x00a670, 0x00a672}, + {0x00a674, 0x00a67d}, + {0x00a67f, 0x00a67f}, + {0x00a69c, 0x00a69d}, + {0x00a69e, 0x00a69f}, + {0x00a6f0, 0x00a6f1}, + {0x00a700, 0x00a716}, + {0x00a717, 0x00a71f}, + {0x00a720, 0x00a721}, + {0x00a770, 0x00a770}, + {0x00a788, 0x00a788}, + {0x00a789, 0x00a78a}, + {0x00a7f2, 0x00a7f4}, + {0x00a7f8, 0x00a7f9}, + {0x00a802, 0x00a802}, + {0x00a806, 0x00a806}, + {0x00a80b, 0x00a80b}, + {0x00a825, 0x00a826}, + {0x00a82c, 0x00a82c}, + {0x00a8c4, 0x00a8c5}, + {0x00a8e0, 0x00a8f1}, + {0x00a8ff, 0x00a8ff}, + {0x00a926, 0x00a92d}, + {0x00a947, 0x00a951}, + {0x00a980, 0x00a982}, + {0x00a9b3, 0x00a9b3}, + {0x00a9b6, 0x00a9b9}, + {0x00a9bc, 0x00a9bd}, + {0x00a9cf, 0x00a9cf}, + {0x00a9e5, 0x00a9e5}, + {0x00a9e6, 0x00a9e6}, + {0x00aa29, 0x00aa2e}, + {0x00aa31, 0x00aa32}, + {0x00aa35, 0x00aa36}, + {0x00aa43, 0x00aa43}, + {0x00aa4c, 0x00aa4c}, + {0x00aa70, 0x00aa70}, + {0x00aa7c, 0x00aa7c}, + {0x00aab0, 0x00aab0}, + {0x00aab2, 0x00aab4}, + {0x00aab7, 0x00aab8}, + {0x00aabe, 0x00aabf}, + {0x00aac1, 0x00aac1}, + {0x00aadd, 0x00aadd}, + {0x00aaec, 0x00aaed}, + {0x00aaf3, 0x00aaf4}, + {0x00aaf6, 0x00aaf6}, + {0x00ab5b, 0x00ab5b}, + {0x00ab5c, 0x00ab5f}, + {0x00ab69, 0x00ab69}, + {0x00ab6a, 0x00ab6b}, + {0x00abe5, 0x00abe5}, + {0x00abe8, 0x00abe8}, + {0x00abed, 0x00abed}, + {0x00fb1e, 0x00fb1e}, + {0x00fbb2, 0x00fbc2}, + {0x00fe00, 0x00fe0f}, + {0x00fe13, 0x00fe13}, + {0x00fe20, 0x00fe2f}, + {0x00fe52, 0x00fe52}, + {0x00fe55, 0x00fe55}, + {0x00feff, 0x00feff}, + {0x00ff07, 0x00ff07}, + {0x00ff0e, 0x00ff0e}, + {0x00ff1a, 0x00ff1a}, + {0x00ff3e, 0x00ff3e}, + {0x00ff40, 0x00ff40}, + {0x00ff70, 0x00ff70}, + {0x00ff9e, 0x00ff9f}, + {0x00ffe3, 0x00ffe3}, + {0x00fff9, 0x00fffb}, + {0x0101fd, 0x0101fd}, + {0x0102e0, 0x0102e0}, + {0x010376, 0x01037a}, + {0x010780, 0x010785}, + {0x010787, 0x0107b0}, + {0x0107b2, 0x0107ba}, + {0x010a01, 0x010a03}, + {0x010a05, 0x010a06}, + {0x010a0c, 0x010a0f}, + {0x010a38, 0x010a3a}, + {0x010a3f, 0x010a3f}, + {0x010ae5, 0x010ae6}, + {0x010d24, 0x010d27}, + {0x010eab, 0x010eac}, + {0x010efd, 0x010eff}, + {0x010f46, 0x010f50}, + {0x010f82, 0x010f85}, + {0x011001, 0x011001}, + {0x011038, 0x011046}, + {0x011070, 0x011070}, + {0x011073, 0x011074}, + {0x01107f, 0x011081}, + {0x0110b3, 0x0110b6}, + {0x0110b9, 0x0110ba}, + {0x0110bd, 0x0110bd}, + {0x0110c2, 0x0110c2}, + {0x0110cd, 0x0110cd}, + {0x011100, 0x011102}, + {0x011127, 0x01112b}, + {0x01112d, 0x011134}, + {0x011173, 0x011173}, + {0x011180, 0x011181}, + {0x0111b6, 0x0111be}, + {0x0111c9, 0x0111cc}, + {0x0111cf, 0x0111cf}, + {0x01122f, 0x011231}, + {0x011234, 0x011234}, + {0x011236, 0x011237}, + {0x01123e, 0x01123e}, + {0x011241, 0x011241}, + {0x0112df, 0x0112df}, + {0x0112e3, 0x0112ea}, + {0x011300, 0x011301}, + {0x01133b, 0x01133c}, + {0x011340, 0x011340}, + {0x011366, 0x01136c}, + {0x011370, 0x011374}, + {0x011438, 0x01143f}, + {0x011442, 0x011444}, + {0x011446, 0x011446}, + {0x01145e, 0x01145e}, + {0x0114b3, 0x0114b8}, + {0x0114ba, 0x0114ba}, + {0x0114bf, 0x0114c0}, + {0x0114c2, 0x0114c3}, + {0x0115b2, 0x0115b5}, + {0x0115bc, 0x0115bd}, + {0x0115bf, 0x0115c0}, + {0x0115dc, 0x0115dd}, + {0x011633, 0x01163a}, + {0x01163d, 0x01163d}, + {0x01163f, 0x011640}, + {0x0116ab, 0x0116ab}, + {0x0116ad, 0x0116ad}, + {0x0116b0, 0x0116b5}, + {0x0116b7, 0x0116b7}, + {0x01171d, 0x01171f}, + {0x011722, 0x011725}, + {0x011727, 0x01172b}, + {0x01182f, 0x011837}, + {0x011839, 0x01183a}, + {0x01193b, 0x01193c}, + {0x01193e, 0x01193e}, + {0x011943, 0x011943}, + {0x0119d4, 0x0119d7}, + {0x0119da, 0x0119db}, + {0x0119e0, 0x0119e0}, + {0x011a01, 0x011a0a}, + {0x011a33, 0x011a38}, + {0x011a3b, 0x011a3e}, + {0x011a47, 0x011a47}, + {0x011a51, 0x011a56}, + {0x011a59, 0x011a5b}, + {0x011a8a, 0x011a96}, + {0x011a98, 0x011a99}, + {0x011c30, 0x011c36}, + {0x011c38, 0x011c3d}, + {0x011c3f, 0x011c3f}, + {0x011c92, 0x011ca7}, + {0x011caa, 0x011cb0}, + {0x011cb2, 0x011cb3}, + {0x011cb5, 0x011cb6}, + {0x011d31, 0x011d36}, + {0x011d3a, 0x011d3a}, + {0x011d3c, 0x011d3d}, + {0x011d3f, 0x011d45}, + {0x011d47, 0x011d47}, + {0x011d90, 0x011d91}, + {0x011d95, 0x011d95}, + {0x011d97, 0x011d97}, + {0x011ef3, 0x011ef4}, + {0x011f00, 0x011f01}, + {0x011f36, 0x011f3a}, + {0x011f40, 0x011f40}, + {0x011f42, 0x011f42}, + {0x013430, 0x01343f}, + {0x013440, 0x013440}, + {0x013447, 0x013455}, + {0x016af0, 0x016af4}, + {0x016b30, 0x016b36}, + {0x016b40, 0x016b43}, + {0x016f4f, 0x016f4f}, + {0x016f8f, 0x016f92}, + {0x016f93, 0x016f9f}, + {0x016fe0, 0x016fe1}, + {0x016fe3, 0x016fe3}, + {0x016fe4, 0x016fe4}, + {0x01aff0, 0x01aff3}, + {0x01aff5, 0x01affb}, + {0x01affd, 0x01affe}, + {0x01bc9d, 0x01bc9e}, + {0x01bca0, 0x01bca3}, + {0x01cf00, 0x01cf2d}, + {0x01cf30, 0x01cf46}, + {0x01d167, 0x01d169}, + {0x01d173, 0x01d17a}, + {0x01d17b, 0x01d182}, + {0x01d185, 0x01d18b}, + {0x01d1aa, 0x01d1ad}, + {0x01d242, 0x01d244}, + {0x01da00, 0x01da36}, + {0x01da3b, 0x01da6c}, + {0x01da75, 0x01da75}, + {0x01da84, 0x01da84}, + {0x01da9b, 0x01da9f}, + {0x01daa1, 0x01daaf}, + {0x01e000, 0x01e006}, + {0x01e008, 0x01e018}, + {0x01e01b, 0x01e021}, + {0x01e023, 0x01e024}, + {0x01e026, 0x01e02a}, + {0x01e030, 0x01e06d}, + {0x01e08f, 0x01e08f}, + {0x01e130, 0x01e136}, + {0x01e137, 0x01e13d}, + {0x01e2ae, 0x01e2ae}, + {0x01e2ec, 0x01e2ef}, + {0x01e4eb, 0x01e4eb}, + {0x01e4ec, 0x01e4ef}, + {0x01e8d0, 0x01e8d6}, + {0x01e944, 0x01e94a}, + {0x01e94b, 0x01e94b}, + {0x01f3fb, 0x01f3ff}, + {0x0e0001, 0x0e0001}, + {0x0e0020, 0x0e007f}, + {0x0e0100, 0x0e01ef}, +}; + +/* table of Unicode codepoint ranges of White_Space characters */ +static const pg_unicode_range unicode_white_space[11] = +{ + {0x000009, 0x00000d}, + {0x000020, 0x000020}, + {0x000085, 0x000085}, + {0x0000a0, 0x0000a0}, + {0x001680, 0x001680}, + {0x002000, 0x00200a}, + {0x002028, 0x002028}, + {0x002029, 0x002029}, + {0x00202f, 0x00202f}, + {0x00205f, 0x00205f}, + {0x003000, 0x003000}, +}; + +/* table of Unicode codepoint ranges of Hex_Digit characters */ +static const pg_unicode_range unicode_hex_digit[6] = +{ + {0x000030, 0x000039}, + {0x000041, 0x000046}, + {0x000061, 0x000066}, + {0x00ff10, 0x00ff19}, + {0x00ff21, 0x00ff26}, + {0x00ff41, 0x00ff46}, +}; + +/* table of Unicode codepoint ranges of Join_Control characters */ +static const pg_unicode_range unicode_join_control[1] = +{ + {0x00200c, 0x00200d}, +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_east_asian_fw_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_east_asian_fw_table.h new file mode 100644 index 0000000000000000000000000000000000000000..dcd1f136eb7770391ee9920e6772a65b17659d56 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_east_asian_fw_table.h @@ -0,0 +1,124 @@ +/* generated by src/common/unicode/generate-unicode_east_asian_fw_table.pl, do not edit */ + +static const struct mbinterval east_asian_fw[] = { + {0x1100, 0x115F}, + {0x231A, 0x231B}, + {0x2329, 0x232A}, + {0x23E9, 0x23EC}, + {0x23F0, 0x23F0}, + {0x23F3, 0x23F3}, + {0x25FD, 0x25FE}, + {0x2614, 0x2615}, + {0x2648, 0x2653}, + {0x267F, 0x267F}, + {0x2693, 0x2693}, + {0x26A1, 0x26A1}, + {0x26AA, 0x26AB}, + {0x26BD, 0x26BE}, + {0x26C4, 0x26C5}, + {0x26CE, 0x26CE}, + {0x26D4, 0x26D4}, + {0x26EA, 0x26EA}, + {0x26F2, 0x26F3}, + {0x26F5, 0x26F5}, + {0x26FA, 0x26FA}, + {0x26FD, 0x26FD}, + {0x2705, 0x2705}, + {0x270A, 0x270B}, + {0x2728, 0x2728}, + {0x274C, 0x274C}, + {0x274E, 0x274E}, + {0x2753, 0x2755}, + {0x2757, 0x2757}, + {0x2795, 0x2797}, + {0x27B0, 0x27B0}, + {0x27BF, 0x27BF}, + {0x2B1B, 0x2B1C}, + {0x2B50, 0x2B50}, + {0x2B55, 0x2B55}, + {0x2E80, 0x2E99}, + {0x2E9B, 0x2EF3}, + {0x2F00, 0x2FD5}, + {0x2FF0, 0x303E}, + {0x3041, 0x3096}, + {0x3099, 0x30FF}, + {0x3105, 0x312F}, + {0x3131, 0x318E}, + {0x3190, 0x31E3}, + {0x31EF, 0x321E}, + {0x3220, 0x3247}, + {0x3250, 0x4DBF}, + {0x4E00, 0xA48C}, + {0xA490, 0xA4C6}, + {0xA960, 0xA97C}, + {0xAC00, 0xD7A3}, + {0xF900, 0xFAFF}, + {0xFE10, 0xFE19}, + {0xFE30, 0xFE52}, + {0xFE54, 0xFE66}, + {0xFE68, 0xFE6B}, + {0xFF01, 0xFF60}, + {0xFFE0, 0xFFE6}, + {0x16FE0, 0x16FE4}, + {0x16FF0, 0x16FF1}, + {0x17000, 0x187F7}, + {0x18800, 0x18CD5}, + {0x18D00, 0x18D08}, + {0x1AFF0, 0x1AFF3}, + {0x1AFF5, 0x1AFFB}, + {0x1AFFD, 0x1AFFE}, + {0x1B000, 0x1B122}, + {0x1B132, 0x1B132}, + {0x1B150, 0x1B152}, + {0x1B155, 0x1B155}, + {0x1B164, 0x1B167}, + {0x1B170, 0x1B2FB}, + {0x1F004, 0x1F004}, + {0x1F0CF, 0x1F0CF}, + {0x1F18E, 0x1F18E}, + {0x1F191, 0x1F19A}, + {0x1F200, 0x1F202}, + {0x1F210, 0x1F23B}, + {0x1F240, 0x1F248}, + {0x1F250, 0x1F251}, + {0x1F260, 0x1F265}, + {0x1F300, 0x1F320}, + {0x1F32D, 0x1F335}, + {0x1F337, 0x1F37C}, + {0x1F37E, 0x1F393}, + {0x1F3A0, 0x1F3CA}, + {0x1F3CF, 0x1F3D3}, + {0x1F3E0, 0x1F3F0}, + {0x1F3F4, 0x1F3F4}, + {0x1F3F8, 0x1F43E}, + {0x1F440, 0x1F440}, + {0x1F442, 0x1F4FC}, + {0x1F4FF, 0x1F53D}, + {0x1F54B, 0x1F54E}, + {0x1F550, 0x1F567}, + {0x1F57A, 0x1F57A}, + {0x1F595, 0x1F596}, + {0x1F5A4, 0x1F5A4}, + {0x1F5FB, 0x1F64F}, + {0x1F680, 0x1F6C5}, + {0x1F6CC, 0x1F6CC}, + {0x1F6D0, 0x1F6D2}, + {0x1F6D5, 0x1F6D7}, + {0x1F6DC, 0x1F6DF}, + {0x1F6EB, 0x1F6EC}, + {0x1F6F4, 0x1F6FC}, + {0x1F7E0, 0x1F7EB}, + {0x1F7F0, 0x1F7F0}, + {0x1F90C, 0x1F93A}, + {0x1F93C, 0x1F945}, + {0x1F947, 0x1F9FF}, + {0x1FA70, 0x1FA7C}, + {0x1FA80, 0x1FA88}, + {0x1FA90, 0x1FABD}, + {0x1FABF, 0x1FAC5}, + {0x1FACE, 0x1FADB}, + {0x1FAE0, 0x1FAE8}, + {0x1FAF0, 0x1FAF8}, + {0x20000, 0x2FFFD}, + {0x30000, 0x3FFFD}, +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_nonspacing_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_nonspacing_table.h new file mode 100644 index 0000000000000000000000000000000000000000..8d00e127fcd9c49ad42f078c09315b6c6c8ef5cf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_nonspacing_table.h @@ -0,0 +1,326 @@ +/* generated by src/common/unicode/generate-unicode_nonspacing_table.pl, do not edit */ + +static const struct mbinterval nonspacing[] = { + {0x00AD, 0x00AD}, + {0x0300, 0x036F}, + {0x0483, 0x0489}, + {0x0591, 0x05BD}, + {0x05BF, 0x05BF}, + {0x05C1, 0x05C2}, + {0x05C4, 0x05C5}, + {0x05C7, 0x05C7}, + {0x0600, 0x0605}, + {0x0610, 0x061A}, + {0x061C, 0x061C}, + {0x064B, 0x065F}, + {0x0670, 0x0670}, + {0x06D6, 0x06DD}, + {0x06DF, 0x06E4}, + {0x06E7, 0x06E8}, + {0x06EA, 0x06ED}, + {0x070F, 0x070F}, + {0x0711, 0x0711}, + {0x0730, 0x074A}, + {0x07A6, 0x07B0}, + {0x07EB, 0x07F3}, + {0x07FD, 0x07FD}, + {0x0816, 0x0819}, + {0x081B, 0x0823}, + {0x0825, 0x0827}, + {0x0829, 0x082D}, + {0x0859, 0x085B}, + {0x0890, 0x089F}, + {0x08CA, 0x0902}, + {0x093A, 0x093A}, + {0x093C, 0x093C}, + {0x0941, 0x0948}, + {0x094D, 0x094D}, + {0x0951, 0x0957}, + {0x0962, 0x0963}, + {0x0981, 0x0981}, + {0x09BC, 0x09BC}, + {0x09C1, 0x09C4}, + {0x09CD, 0x09CD}, + {0x09E2, 0x09E3}, + {0x09FE, 0x0A02}, + {0x0A3C, 0x0A3C}, + {0x0A41, 0x0A51}, + {0x0A70, 0x0A71}, + {0x0A75, 0x0A75}, + {0x0A81, 0x0A82}, + {0x0ABC, 0x0ABC}, + {0x0AC1, 0x0AC8}, + {0x0ACD, 0x0ACD}, + {0x0AE2, 0x0AE3}, + {0x0AFA, 0x0B01}, + {0x0B3C, 0x0B3C}, + {0x0B3F, 0x0B3F}, + {0x0B41, 0x0B44}, + {0x0B4D, 0x0B56}, + {0x0B62, 0x0B63}, + {0x0B82, 0x0B82}, + {0x0BC0, 0x0BC0}, + {0x0BCD, 0x0BCD}, + {0x0C00, 0x0C00}, + {0x0C04, 0x0C04}, + {0x0C3C, 0x0C3C}, + {0x0C3E, 0x0C40}, + {0x0C46, 0x0C56}, + {0x0C62, 0x0C63}, + {0x0C81, 0x0C81}, + {0x0CBC, 0x0CBC}, + {0x0CBF, 0x0CBF}, + {0x0CC6, 0x0CC6}, + {0x0CCC, 0x0CCD}, + {0x0CE2, 0x0CE3}, + {0x0D00, 0x0D01}, + {0x0D3B, 0x0D3C}, + {0x0D41, 0x0D44}, + {0x0D4D, 0x0D4D}, + {0x0D62, 0x0D63}, + {0x0D81, 0x0D81}, + {0x0DCA, 0x0DCA}, + {0x0DD2, 0x0DD6}, + {0x0E31, 0x0E31}, + {0x0E34, 0x0E3A}, + {0x0E47, 0x0E4E}, + {0x0EB1, 0x0EB1}, + {0x0EB4, 0x0EBC}, + {0x0EC8, 0x0ECE}, + {0x0F18, 0x0F19}, + {0x0F35, 0x0F35}, + {0x0F37, 0x0F37}, + {0x0F39, 0x0F39}, + {0x0F71, 0x0F7E}, + {0x0F80, 0x0F84}, + {0x0F86, 0x0F87}, + {0x0F8D, 0x0FBC}, + {0x0FC6, 0x0FC6}, + {0x102D, 0x1030}, + {0x1032, 0x1037}, + {0x1039, 0x103A}, + {0x103D, 0x103E}, + {0x1058, 0x1059}, + {0x105E, 0x1060}, + {0x1071, 0x1074}, + {0x1082, 0x1082}, + {0x1085, 0x1086}, + {0x108D, 0x108D}, + {0x109D, 0x109D}, + {0x135D, 0x135F}, + {0x1712, 0x1714}, + {0x1732, 0x1733}, + {0x1752, 0x1753}, + {0x1772, 0x1773}, + {0x17B4, 0x17B5}, + {0x17B7, 0x17BD}, + {0x17C6, 0x17C6}, + {0x17C9, 0x17D3}, + {0x17DD, 0x17DD}, + {0x180B, 0x180F}, + {0x1885, 0x1886}, + {0x18A9, 0x18A9}, + {0x1920, 0x1922}, + {0x1927, 0x1928}, + {0x1932, 0x1932}, + {0x1939, 0x193B}, + {0x1A17, 0x1A18}, + {0x1A1B, 0x1A1B}, + {0x1A56, 0x1A56}, + {0x1A58, 0x1A60}, + {0x1A62, 0x1A62}, + {0x1A65, 0x1A6C}, + {0x1A73, 0x1A7F}, + {0x1AB0, 0x1B03}, + {0x1B34, 0x1B34}, + {0x1B36, 0x1B3A}, + {0x1B3C, 0x1B3C}, + {0x1B42, 0x1B42}, + {0x1B6B, 0x1B73}, + {0x1B80, 0x1B81}, + {0x1BA2, 0x1BA5}, + {0x1BA8, 0x1BA9}, + {0x1BAB, 0x1BAD}, + {0x1BE6, 0x1BE6}, + {0x1BE8, 0x1BE9}, + {0x1BED, 0x1BED}, + {0x1BEF, 0x1BF1}, + {0x1C2C, 0x1C33}, + {0x1C36, 0x1C37}, + {0x1CD0, 0x1CD2}, + {0x1CD4, 0x1CE0}, + {0x1CE2, 0x1CE8}, + {0x1CED, 0x1CED}, + {0x1CF4, 0x1CF4}, + {0x1CF8, 0x1CF9}, + {0x1DC0, 0x1DFF}, + {0x200B, 0x200F}, + {0x202A, 0x202E}, + {0x2060, 0x206F}, + {0x20D0, 0x20F0}, + {0x2CEF, 0x2CF1}, + {0x2D7F, 0x2D7F}, + {0x2DE0, 0x2DFF}, + {0x302A, 0x302D}, + {0x3099, 0x309A}, + {0xA66F, 0xA672}, + {0xA674, 0xA67D}, + {0xA69E, 0xA69F}, + {0xA6F0, 0xA6F1}, + {0xA802, 0xA802}, + {0xA806, 0xA806}, + {0xA80B, 0xA80B}, + {0xA825, 0xA826}, + {0xA82C, 0xA82C}, + {0xA8C4, 0xA8C5}, + {0xA8E0, 0xA8F1}, + {0xA8FF, 0xA8FF}, + {0xA926, 0xA92D}, + {0xA947, 0xA951}, + {0xA980, 0xA982}, + {0xA9B3, 0xA9B3}, + {0xA9B6, 0xA9B9}, + {0xA9BC, 0xA9BD}, + {0xA9E5, 0xA9E5}, + {0xAA29, 0xAA2E}, + {0xAA31, 0xAA32}, + {0xAA35, 0xAA36}, + {0xAA43, 0xAA43}, + {0xAA4C, 0xAA4C}, + {0xAA7C, 0xAA7C}, + {0xAAB0, 0xAAB0}, + {0xAAB2, 0xAAB4}, + {0xAAB7, 0xAAB8}, + {0xAABE, 0xAABF}, + {0xAAC1, 0xAAC1}, + {0xAAEC, 0xAAED}, + {0xAAF6, 0xAAF6}, + {0xABE5, 0xABE5}, + {0xABE8, 0xABE8}, + {0xABED, 0xABED}, + {0xFB1E, 0xFB1E}, + {0xFE00, 0xFE0F}, + {0xFE20, 0xFE2F}, + {0xFEFF, 0xFEFF}, + {0xFFF9, 0xFFFB}, + {0x101FD, 0x101FD}, + {0x102E0, 0x102E0}, + {0x10376, 0x1037A}, + {0x10A01, 0x10A0F}, + {0x10A38, 0x10A3F}, + {0x10AE5, 0x10AE6}, + {0x10D24, 0x10D27}, + {0x10EAB, 0x10EAC}, + {0x10EFD, 0x10EFF}, + {0x10F46, 0x10F50}, + {0x10F82, 0x10F85}, + {0x11001, 0x11001}, + {0x11038, 0x11046}, + {0x11070, 0x11070}, + {0x11073, 0x11074}, + {0x1107F, 0x11081}, + {0x110B3, 0x110B6}, + {0x110B9, 0x110BA}, + {0x110BD, 0x110BD}, + {0x110C2, 0x110CD}, + {0x11100, 0x11102}, + {0x11127, 0x1112B}, + {0x1112D, 0x11134}, + {0x11173, 0x11173}, + {0x11180, 0x11181}, + {0x111B6, 0x111BE}, + {0x111C9, 0x111CC}, + {0x111CF, 0x111CF}, + {0x1122F, 0x11231}, + {0x11234, 0x11234}, + {0x11236, 0x11237}, + {0x1123E, 0x1123E}, + {0x11241, 0x11241}, + {0x112DF, 0x112DF}, + {0x112E3, 0x112EA}, + {0x11300, 0x11301}, + {0x1133B, 0x1133C}, + {0x11340, 0x11340}, + {0x11366, 0x11374}, + {0x11438, 0x1143F}, + {0x11442, 0x11444}, + {0x11446, 0x11446}, + {0x1145E, 0x1145E}, + {0x114B3, 0x114B8}, + {0x114BA, 0x114BA}, + {0x114BF, 0x114C0}, + {0x114C2, 0x114C3}, + {0x115B2, 0x115B5}, + {0x115BC, 0x115BD}, + {0x115BF, 0x115C0}, + {0x115DC, 0x115DD}, + {0x11633, 0x1163A}, + {0x1163D, 0x1163D}, + {0x1163F, 0x11640}, + {0x116AB, 0x116AB}, + {0x116AD, 0x116AD}, + {0x116B0, 0x116B5}, + {0x116B7, 0x116B7}, + {0x1171D, 0x1171F}, + {0x11722, 0x11725}, + {0x11727, 0x1172B}, + {0x1182F, 0x11837}, + {0x11839, 0x1183A}, + {0x1193B, 0x1193C}, + {0x1193E, 0x1193E}, + {0x11943, 0x11943}, + {0x119D4, 0x119DB}, + {0x119E0, 0x119E0}, + {0x11A01, 0x11A0A}, + {0x11A33, 0x11A38}, + {0x11A3B, 0x11A3E}, + {0x11A47, 0x11A47}, + {0x11A51, 0x11A56}, + {0x11A59, 0x11A5B}, + {0x11A8A, 0x11A96}, + {0x11A98, 0x11A99}, + {0x11C30, 0x11C3D}, + {0x11C3F, 0x11C3F}, + {0x11C92, 0x11CA7}, + {0x11CAA, 0x11CB0}, + {0x11CB2, 0x11CB3}, + {0x11CB5, 0x11CB6}, + {0x11D31, 0x11D45}, + {0x11D47, 0x11D47}, + {0x11D90, 0x11D91}, + {0x11D95, 0x11D95}, + {0x11D97, 0x11D97}, + {0x11EF3, 0x11EF4}, + {0x11F00, 0x11F01}, + {0x11F36, 0x11F3A}, + {0x11F40, 0x11F40}, + {0x11F42, 0x11F42}, + {0x13430, 0x13440}, + {0x13447, 0x13455}, + {0x16AF0, 0x16AF4}, + {0x16B30, 0x16B36}, + {0x16F4F, 0x16F4F}, + {0x16F8F, 0x16F92}, + {0x16FE4, 0x16FE4}, + {0x1BC9D, 0x1BC9E}, + {0x1BCA0, 0x1CF46}, + {0x1D167, 0x1D169}, + {0x1D173, 0x1D182}, + {0x1D185, 0x1D18B}, + {0x1D1AA, 0x1D1AD}, + {0x1D242, 0x1D244}, + {0x1DA00, 0x1DA36}, + {0x1DA3B, 0x1DA6C}, + {0x1DA75, 0x1DA75}, + {0x1DA84, 0x1DA84}, + {0x1DA9B, 0x1DAAF}, + {0x1E000, 0x1E02A}, + {0x1E08F, 0x1E08F}, + {0x1E130, 0x1E136}, + {0x1E2AE, 0x1E2AE}, + {0x1E2EC, 0x1E2EF}, + {0x1E4EC, 0x1E4EF}, + {0x1E8D0, 0x1E8D6}, + {0x1E944, 0x1E94A}, + {0xE0001, 0xE01EF}, +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_norm.h b/platform/dbops/binaries/postgres/include/server/common/unicode_norm.h new file mode 100644 index 0000000000000000000000000000000000000000..740b77a373e1838bf6b372a54c6207e94b7522b4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_norm.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm.h + * Routines for normalizing Unicode strings + * + * These definitions are used by both frontend and backend code. + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/common/unicode_norm.h + * + *------------------------------------------------------------------------- + */ +#ifndef UNICODE_NORM_H +#define UNICODE_NORM_H + +#include "mb/pg_wchar.h" + +typedef enum +{ + UNICODE_NFC = 0, + UNICODE_NFD = 1, + UNICODE_NFKC = 2, + UNICODE_NFKD = 3, +} UnicodeNormalizationForm; + +/* see UAX #15 */ +typedef enum +{ + UNICODE_NORM_QC_NO = 0, + UNICODE_NORM_QC_YES = 1, + UNICODE_NORM_QC_MAYBE = -1, +} UnicodeNormalizationQC; + +extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input); + +extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input); + +#endif /* UNICODE_NORM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_norm_hashfunc.h b/platform/dbops/binaries/postgres/include/server/common/unicode_norm_hashfunc.h new file mode 100644 index 0000000000000000000000000000000000000000..0913ea1c6587e31dfdc569986432b68aa0a65218 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_norm_hashfunc.h @@ -0,0 +1,2974 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm_hashfunc.h + * Perfect hash functions used for Unicode normalization + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_norm_hashfunc.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_norm_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_NORM_HASHFUNC_H + * here. + */ + +#include "common/unicode_norm_table.h" + +/* Typedef for perfect hash functions */ +typedef int (*cp_hash_func) (const void *key); + +/* Information for lookups with perfect hash functions */ +typedef struct +{ + const pg_unicode_decomposition *decomps; + cp_hash_func hash; + int num_decomps; +} pg_unicode_decompinfo; + +typedef struct +{ + const uint16 *inverse_lookup; + cp_hash_func hash; + int num_recomps; +} pg_unicode_recompinfo; + +/* Perfect hash function for decomposition */ +static int +Decomp_hash_func(const void *key) +{ + static const int16 h[13551] = { + 6102, 6103, 6104, 6105, 6106, 11163, 11164, 9247, + 3108, 32767, 32767, 5839, 5840, 11166, 3130, 3130, + 3130, 3130, -1926, -1926, 9274, 9275, 9276, 9277, + 9278, 473, 473, 6107, 0, 6110, 6111, -1569, + 9287, 9288, 9289, 9290, 9291, 9292, 9293, 9294, + 9295, 11077, 11078, 11079, 11080, 9300, 9301, 9302, + 9303, 9304, 9305, 9306, 9307, 9308, 9309, 9310, + 9311, 9312, 9313, 9314, 9315, 9316, 9317, 9318, + 9319, 9320, 4265, 4266, -1834, 4268, 4269, 4270, + 4271, 4272, 9329, 9330, 7413, 1274, 1274, 1274, + 5264, 1274, 9337, 1301, 1301, 1301, 1301, 8982, + -3754, 11381, 11382, 11383, 11384, 10049, 11386, 5605, + 5606, 5607, 5608, 5609, 5610, 5611, 5612, 465, + 465, 5617, 5618, 5619, 5620, 5621, 5622, 5623, + 465, 465, 465, 465, 465, 465, 465, 465, + 465, 465, 465, 465, 465, 465, 465, 465, + 465, 465, 465, 465, 465, 465, 465, 465, + 465, 465, 465, 465, 465, 465, 5256, 5256, + -10103,5256, 465, 465, 5256, 5256, 465, 5939, + 465, 465, 465, 465, 465, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -71, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -884, -884, -884, -884, -884, -884, + 0, -885, -885, -885, -885, -885, -885, 0, + 0, -886, -886, -886, -886, -886, -4378, 0, + -888, -888, 422, -888, -888, -888, 0, -7896, + -7896, -7896, 0, 0, 0, 0, 0, 1463, + 1463, 1463, 1463, 2951, 1464, 1464, -18469,1464, + 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, + 1215, 1216, 1464, 1464, 1464, 1464, 1464, 1464, + 1464, 1464, 0, 1465, 1465, 1465, 80, 1464, + 1464, 1464, 7565, 1464, 1464, 1464, 1464, 1464, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 32767, + 32767, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 32767, 112, 113, 114, 115, 116, + 117, 32767, 118, 119, 120, 121, 122, 123, + 124, 0, 0, 0, 126, 0, 0, 0, + 0, 0, 0, 0, 4145, 4146, 4147, 4148, + 4149, 4150, 4151, 4152, 4153, 4154, 0, 0, + 0, 0, 0, 0, 4155, 4156, 4157, 4158, + 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, + 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, + 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, + 4183, 4184, 4185, 4186, 4187, 4188, 4189, 179, + 180, 32767, 32767, 4192, 4193, 4194, 4195, 4196, + 4197, 4198, 4199, 4200, 4201, 4202, 4203, 32767, + 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, + 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, + 4220, 4221, 4222, 32767, 4223, 4224, 4225, 4226, + 32767, 32767, 32767, 32767, 4227, 4228, 4229, 32767, + -4545, -5662, -5662, -5662, -5662, -5662, -5662, -5662, + -5662, 4238, 4239, -5664, -5664, -5664, -5664, -5664, + -5664, -5664, -5664, 4248, 4249, 4250, 4251, 4252, + 4253, -6935, -1879, -1879, 4222, -1879, -1879, -1879, + -1879, -1879, -6935, -6935, 4265, 4266, 4267, 4268, + 4269, -4536, -4536, 1098, 1099, 1100, 1101, -6579, + 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, + 4285, 6067, 6068, 6069, 6070, 4290, 4291, 4292, + 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, + 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, + 4309, 4310, -745, -744, -6844, -742, -741, -740, + -739, -738, 4319, 4320, 2403, -3736, -3736, -3736, + 254, -3736, 4327, -3709, -3709, 4330, 0, 0, + 0, 0, 0, 0, 0, -2997, -2997, 2705, + 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, + 0, 0, 0, 0, 0, 0, -4452, 0, + 0, 0, 0, 0, 2716, 0, 0, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 1841, + 32767, 32767, 4710, 32767, 0, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 1845, 32767, 32767, 32767, 32767, 32767, 0, + 0, 32767, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 1850, 32767, 32767, 0, + 32767, 32767, 0, 32767, 1853, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 32767, 32767, 0, + 0, 32767, 32767, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 567, 567, 567, 567, -1649, -4447, + 32767, 32767, 566, 566, -1644, 566, 566, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, -1144, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 0, + 0, 0, 0, 304, 305, 306, -2209, -2208, + 309, 2223, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, -550, 328, 329, 330, 331, 332, + 333, 334, 335, 0, 0, 0, 0, 340, + 341, 342, 343, -534, 345, 0, 0, 0, + 0, -6511, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 32767, 383, 384, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 4654, 410, 4655, + 412, 413, 414, 32767, 32767, 32767, 32767, 415, + 32767, 32767, 32767, 32767, 32767, 416, 32767, 32767, + 32767, -464, 32767, 32767, 32767, 32767, 32767, 418, + 419, 420, 421, 422, 423, 424, 32767, 425, + 32767, 426, 427, 428, 32767, 32767, 32767, 32767, + 4656, 4657, 4658, 32767, 32767, 32767, 32767, 4659, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 429, 430, 431, + 432, 433, 434, 435, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -2290, -2290, -2290, + -2290, -2290, 32767, -2291, -2291, -2291, -2291, -2291, + -2291, 2502, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 733, 733, 733, 32767, 732, + 732, 32767, 32767, 32767, 729, 32767, 0, 0, + 32767, 32767, 32767, 32767, -241, -241, 32767, -242, + 32767, 32767, 32767, -4550, 32767, 32767, 32767, 32767, + -249, -1737, -1737, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -1747, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -291, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4660, 4661, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 3982, 3982, 3982, 32767, -1149, -1148, 32767, -1147, + 32767, 32767, 32767, -1146, 32767, 32767, 32767, 32767, + -1145, -1144, -1143, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -4642, -1836, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -1839, + -4651, -1838, -1838, 476, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 4708, 4709, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -4703, -1851, 32767, + 32767, 32767, 32767, 32767, 4710, 4711, 4712, 32767, + 32767, 32767, 32767, 32767, -1857, -4716, -1856, -4716, + 32767, 32767, -4718, -1855, 32767, 32767, -4720, -905, + -4720, -4720, -4720, -4720, 32767, 32767, -894, -893, + 4714, 4715, 4716, 1689, 8219, 4719, -4724, -1850, + -1850, 3912, 4721, 4722, 4723, 4724, -4724, -4724, + -4724, -4724, 32767, 32767, -4726, -4726, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -1149, -1396, -1395, -1394, -1393, -1392, -1391, -1390, + -1389, 76, -1388, -1387, -1386, 0, -1383, -1382, + 32767, 32767, -1381, -1380, -1379, -1378, -1377, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32767, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 125, 32767, 32767, 0, 127, 128, 129, 130, + 131, 132, 32767, 32767, -4013, -4013, -4013, -4013, + -4013, -4013, 32767, 32767, -4015, 140, 141, 142, + 143, 144, 145, -4009, -4009, -4009, -4009, -4009, + -4009, -4009, -4009, -4009, -4009, -4009, 32767, 32767, + -4011, -4011, -4011, -4011, -4011, -4011, -4011, -4011, + -4011, -4011, -4011, -4011, -4011, -4011, -4011, -4011, + -4011, -4011, -4011, -4011, -4011, -4011, 0, 0, + -2541, 32767, 32767, 32767, 32767, 32767, 512, 513, + 514, 515, 516, 517, -441, -441, 520, 521, + 522, 523, 524, 525, 526, 527, 528, 529, + 530, 531, 532, 533, 534, 535, 536, 537, + -4040, -4040, 540, 541, 542, 543, 544, 545, + 546, 547, 548, 549, 550, 551, 552, 4728, + 5846, 555, 556, 32767, 557, 32767, 558, 559, + 32767, 560, 561, 32767, 562, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -4065, -4065, -4065, -4065, + 7124, 2069, 2070, -4030, 2072, 2073, 2074, 2075, + 2076, 7133, 7134, -4065, -4065, -4065, -4065, -4065, + 4741, 4742, -891, -891, -891, 32767, 6789, -4066, + -4066, -4066, -4066, -4066, 32767, 32767, -4068, -4068, + -5849, -5849, -5849, -5849, -4068, -4068, -4068, -4068, + -4068, -4068, -4068, -4068, -4068, -4068, 5832, 5833, + -4070, -4070, -4070, -4070, -4070, -4070, -4070, -4070, + 5842, 5843, 5844, 5845, 5846, 5847, -5341, -285, + -285, 5816, -285, -285, -285, -285, -285, -5341, + -5341, 5859, 5860, 5861, 5862, 5863, -2942, -2942, + 2692, 2693, 2694, 2695, -4985, 5871, 5872, 5873, + 5874, 5875, 5876, 5877, 5878, 5879, 7661, 7662, + 7663, 7664, 5884, 5885, 5886, 5887, 5888, 5889, + 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, + 5898, 5899, 5900, 5901, 5902, 5903, 5904, 849, + 850, -5250, 852, 853, 854, 855, 856, 5913, + 5914, 3997, -2142, -2142, 590, 591, 592, 5918, + -2118, -2118, -2118, -2118, 5563, -7173, 7962, 7963, + 7964, 7965, 6630, 7967, 2186, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4034, 32767, + 32767, 32767, 5815, 5816, 5817, 5818, 5819, 5820, + 5821, 32767, 5822, 5823, 5824, 5825, 5826, 5827, + 5828, 5829, -272, -272, -272, -272, -272, -5328, + -5328, -3410, 2730, 2731, 0, 0, 0, -5325, + 2712, 2713, 2714, 2715, -4965, 7772, -3427, 32767, + -3428, -3428, -3428, 5378, 5379, 32767, 32767, 32767, + 32767, 32767, -3434, -3434, -3434, -3434, -3434, -3434, + -3434, -3434, -3434, -5215, -5215, -5215, -5215, -3434, + -3434, -3434, -3434, -3434, -3434, -3434, -3434, -3434, + -3434, -3434, -3434, -3434, -3434, -3434, -3434, -3434, + -3434, -3434, -3434, -3434, 1622, 1622, 7723, 1622, + 1622, 1622, 1622, 1622, -3434, -3434, -1516, 4624, + 4625, 4626, 637, 4628, -3434, 4603, 4604, 4605, + 4606, -3074, 9663, -5471, -5471, -5471, -5471, -4135, + 618, -4134, -4134, 32767, 32767, 621, 622, 32767, + 623, 624, 625, 626, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4039, 32767, + 4040, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 5450, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -4019, 32767, 32767, 4042, -3994, -3994, -3994, + -3994, 3687, -9049, 32767, 32767, 6086, 6087, 4752, + 0, 4753, 4754, 32767, 32767, 0, 0, 32767, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 6862, + 6863, 6864, 6865, 1810, 1811, -4289, 1813, 1814, + 1815, 1816, 1817, 6874, 6875, 4958, -1181, -1181, + -1181, 2809, -1181, 6882, -1154, -1154, -1154, -1154, + 6527, -6209, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 82, 32767, 32767, 11618, 11619, 11620, 5919, 5920, + 5921, 5922, 32767, 32767, 786, 32767, 32767, 787, + 788, 789, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 790, 791, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -1151, -1151, -1151, -1151, -1151, -1151, + -1151, -1400, -1399, 32767, 32767, 32767, 32767, 32767, + 792, 32767, 32767, 32767, -1159, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4666, + 4667, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 665, 666, + 667, 668, 32767, 669, 670, 671, 672, 673, + 674, 675, 676, 677, 32767, 678, 679, 680, + 32767, 681, 682, 683, 684, 685, -1578, -5751, + -5751, -5751, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -1193, 32767, 32767, 32767, 32767, -5986, -5986, -5986, + -5986, -5986, -5986, -5986, -5986, -5986, -5986, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 686, 687, 688, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -174, 1314, -173, + -173, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 689, 690, 691, 692, 693, 694, 695, 696, + 32767, 32767, 32767, 4671, 4672, 4673, 4674, 4675, + 4676, 4677, 4678, 4679, 4680, 4681, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -1552, -1552, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 697, 533, 533, 700, 701, 702, + 703, 704, 705, 706, 707, 708, 709, 710, + 711, 712, 713, 714, 715, 716, 717, 4682, + 6946, 2158, 4685, 721, 722, 723, 724, 725, + 726, 727, 728, 729, 730, 731, 732, 733, + 734, 735, 736, 737, 738, 739, 740, 741, + 742, 743, 744, 745, 746, 747, 748, 749, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 5923, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4215, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4181, 32767, 32767, -1922, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4218, 32767, 32767, + 32767, 32767, 2986, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4219, 32767, + 32767, 32767, 6001, 4221, 4222, 4223, 32767, 32767, + 32767, 4224, 4225, 4226, 4227, 4228, 4229, 4230, + 4231, 5925, 5926, 5927, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 1170, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -901, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 767, 32767, 32767, + 32767, 32767, 32767, 32767, -5005, -4757, -4757, 32767, + 32767, 32767, -4760, -4760, 68, 68, 68, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 287, 32767, 32767, 32767, 58, 58, 32767, + 57, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 4689, 32767, 4690, 32767, 32767, 32767, 32767, -1717, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 4691, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 6903, + 4693, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 775, 32767, 32767, + 776, 32767, 32767, 32767, 32767, 32767, 777, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 778, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 779, 780, 781, 32767, 4694, + 4695, 4696, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4697, 4698, 32767, + 32767, 32767, 4699, 4700, 32767, 32767, 32767, 2428, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 2995, 2996, 2997, 2998, 2999, + 2696, 2696, 2696, 5212, 5212, 2696, 783, 2696, + 2696, 2696, 2696, 2696, 2696, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 784, + 32767, 32767, 4701, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3013, + 3014, 3015, 32767, 32767, 32767, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 2139, 2140, -808, + 681, 682, 683, 684, 32767, 32767, 32767, 2633, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3016, + 685, 686, 936, 936, 689, 32767, 32767, 32767, + 32767, 32767, 690, 691, 692, 693, 694, 695, + 696, 697, 698, 699, -5401, 701, 702, 703, + 704, 705, 706, 707, -779, 709, 80, -7189, + -7189, -7189, 0, 0, 32767, 0, 0, 0, + 0, 0, 32767, 0, 32767, 0, 0, 32767, + 0, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1310, 0, + 0, 0, 0, -7007, -7007, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6538, + 6539, 6540, 6541, 6542, 6543, 2371, 6545, 6546, + 6547, 6548, 6549, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1693, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -6893, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -6902, 0, 0, 0, + 0, -2600, 0, 1974, 1974, 0, 0, 0, + 0, -6912, -5556, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3019, 0, 3020, + 3021, 3022, 0, 0, 3023, 3024, 0, 0, + 0, 0, 0, 2206, 3026, 0, 3027, 0, + 0, 0, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -3504, 0, 0, 0, -6893, 0, 0, 5606, + 0, 0, 0, 3028, -3501, 0, -3500, -3499, + 0, 808, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1619, 1620, 32767, 32767, 1621, 1622, + 1623, 32767, 1624, 1625, 1626, 1627, 1628, 1629, + 0, 0, 1632, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 3029, 3030, 3031, 3032, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 3033, + -1994, 810, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 811, + 1188, -1999, 814, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2778, 32767, 32767, 32767, + 2775, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -2863, -2863, -2863, -2863, + -2863, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 986, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 815, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 817, 818, 819, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -2752, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4452, 0, + 4451, 0, 0, 0, 4448, 4732, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2022, 0, 32767, 32767, 32767, + 32767, -7994, 32767, 32767, 32767, 32767, -4824, -4824, + 2857, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -8011, -8011, + -8011, -8011, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -251, -251, -251, -251, -251, -251, 4127, + 3239, 3239, 4549, 4549, 32767, 32767, 32767, 32767, + 32767, -3773, 4123, 4123, 4123, 4123, 4123, 5586, + 5586, 5586, 5586, 7074, 5587, 5587, -14346,5587, + 5587, 5587, 5587, 5587, 5587, 5587, 5587, 5587, + 5338, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 4131, 0, 0, 0, 0, 0, + 0, 828, 0, 0, 0, 0, 829, 830, + -3958, 0, 0, 8614, 4312, 0, 0, 0, + 0, 0, 4619, 0, 0, 0, 832, 833, + 834, 835, 32767, 32767, 32767, 32767, -215, -215, + 4094, 4630, -213, -213, -213, 32767, 32767, 32767, + 32767, 32767, -3542, -2653, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -21505,-1572, -1572, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 32767, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -977, 32767, -2211, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 4386, 4386, -2210, + -2209, 32767, 4735, 4736, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -5881, 32767, 4018, 32767, + -5885, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4020, 1382, 1382, 1382, 1382, 1382, + 5938, 32767, 32767, 32767, -2118, 32767, 32767, 32767, + 32767, 4022, 32767, 32767, 32767, 32767, -4783, 32767, + 32767, 32767, 32767, 850, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 5806, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, + 4034, 4035, 4036, 4037, 4038, 32767, 32767, -1017, + -1016, -7116, -1014, -1013, 32767, -1012, -1011, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -3993, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 4737, 302, 32767, 32767, 32767, + 32767, 303, 32767, 32767, 32767, 32767, 306, 32767, + 32767, 32767, 32767, 307, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 5939, + -4862, 5941, -388, -388, -388, -388, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -4874, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 2516, 2516, 0, -1913, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 877, 0, + 0, 0, 0, 0, 0, 0, 0, 336, + 337, 338, 339, 0, 0, 0, 0, 878, + 0, 346, 347, 348, 349, 6861, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -4245, 0, -4244, 0, 0, 0, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 3833, 0, 32767, 32767, 32767, 881, 32767, 32767, + 32767, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 32767, 0, 32767, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2713, -2075, -2074, -2073, + -2072, -2071, -2070, 2720, -2068, -2067, -2066, 2724, + 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, + 2733, 2734, 2735, 2736, 2737, -2055, -2054, 2740, + -2052, 2742, 2743, 2744, 2745, 2746, 2747, -1630, + -741, -740, -2049, -2048, -738, -737, -1624, 6273, + 6274, -291, -290, -289, -288, -287, -286, -285, + -284, -283, -282, -281, -280, -279, -278, -277, + -276, 2772, 0, 0, 0, 0, 2779, -5015, + -269, -268, 0, 0, -2210, 0, 0, -262, + -261, -260, -259, -258, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2040, 2040, + 2040, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 165, 166, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -3964, -6227, -1438, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2824, 2825, 5791, 3454, + 3455, 3456, 32767, 10734, -115, 3459, 1375, 32767, + 32767, 3461, 10743, 5953, 3464, 3465, 3466, 3467, + 10751, 32767, 10753, 3470, 3471, 3472, 3473, 3474, + 3475, 32767, 3476, 5980, 10770, 5982, 7789, 7790, + 3482, 0, 2797, 0, 2798, 0, 2799, 0, + 2800, 0, 2801, 0, 2802, 0, 2803, 0, + 2804, 0, 0, 2806, 0, 2807, 32767, 2807, + 0, 0, 0, 32767, 0, 0, -376, 2812, + 0, 32767, 2812, 32767, 32767, 32767, 0, 2811, + 2811, 0, 2812, 2812, 0, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2833, 0, 0, 0, 0, 3781, + 2837, 3782, 2837, 0, 3784, 3785, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2850, 0, 2851, 0, 2852, 0, + 2853, 0, 2854, 0, 2855, 0, 2856, 0, + 2857, 0, 2858, 0, 2859, 0, 2860, 0, + 2861, 0, 0, 2863, 0, 2864, 0, 3815, + 0, 0, 0, 0, 0, 0, 3828, 3829, + 9436, 9437, 9438, 6411, 2873, 2873, 0, 2874, + 2874, 8636, 9445, 9446, 9447, 9448, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2897, 0, 0, 660, 7421, 7236, + 2899, 0, 0, 0, 2902, 816, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2013, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 5486, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 4750, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1009, -417, -417, -417, 32767, 3553, -9183, 5952, + 5953, 5954, 5955, 4620, 5957, 176, 177, 178, + 179, 180, 181, 182, 183, -4964, -4964, 188, + 189, 190, 191, 192, 193, 194, -4964, -4964, + 32767, -4965, -4965, 32767, -4966, 32767, 32767, -4968, + 32767, -4969, -4969, -4969, -4969, -4969, -4969, -4969, + -4969, -4969, -4969, 32767, -4970, -4970, -4970, -4970, + 32767, -4971, 32767, -4972, 32767, 32767, 32767, 32767, + 32767, 32767, -187, 32767, 32767, 32767, 32767, -4980, + 32767, -4981, 32767, -4982, 32767, -194, -194, -194, + 32767, -195, -195, 32767, -196, 32767, 32767, -4987, + 32767, -4988, 32767, -4989, 32767, -4990, 32767, -4991, + 32767, -4992, -4992, 0, -4993, 32767, 32767, -4995, + -202, -4995, -4995, 32767, -4996, -4996, -4996, -618, + -1506, -1506, -196, 32767, -1506, -1506, -618, -8514, + 32767, -8515, -619, -619, -619, 32767, 6034, 32767, + -455, -455, -455, -455, -455, -455, -455, -455, + -455, -455, 32767, -456, -456, -456, -456, -456, + -456, -456, -456, -456, -456, -456, -456, -456, + -456, -456, -456, -456, 32767, 32767, 32767, 32767, + 32767, -461, -461, -461, 32767, -7469, -462, -462, + -462, -462, 32767, -463, -463, -463, -463, -463, + 6075, 6076, 6077, 6078, 6079, 6080, 1908, 6082, + 6083, 6084, 6085, 6086, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -9650, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 4751, 32767, 32767, -6842, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3990, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2002, 2002, 2002, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4118, 0, + 0, 0, 0, 0, 0, 0, 4126, 0, + 0, 2728, 0, 0, 32767, 32767, 32767, 32767, + 32767, 0, 5928, 5929, 5930, 5931, 0, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4755, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 4132, 4133, 4134, 4135, + 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, + 4144, 32767, 32767, 886, 5880, 32767, 32767, 32767, + 32767, 32767, 32767, 1132, 1132, 1132, 1132, 32767, + 6280, 1129, 1129, 32767, 1128, 1128, 1128, 1128, + 6287, 6288, 6289, 6290, 6291, 6292, 6293, 32767, + 6294, 6295, 32767, 1343, 6296, 6297, 6298, 6299, + 6300, 32767, 32767, 6301, 6302, 6303, 32767, 6304, + 32767, 6305, 32767, 6306, 32767, 6307, 1517, 1518, + 16878, 32767, 6311, 6312, 1522, 32767, 6314, 1524, + 1525, 6315, 6316, 6317, 6318, 32767, 6319, 1531, + 1532, 1533, 1534, 1535, 32767, 32767, 32767, 32767, + 1536, 6326, 6327, 6328, 6329, 32767, 0, 32767, + 0, 10802, 0, 6330, 6331, 6332, 6333, 1541, + 1542, 6336, 1544, 6338, 6339, 6340, 6341, 6342, + 6343, 1966, 2855, 2856, 1547, 1548, 2858, 2859, + 1972, 9869, 9870, 9871, 1976, 1977, 1978, 1979, + 1980, 518, 519, 520, 521, -966, 522, 523, + 20457, 525, 526, 527, 528, 529, 530, 531, + 532, 533, 783, 6122, 6123, 6124, 6125, 6126, + 6127, 6128, 32767, 6129, 1999, 6131, 6132, 6133, + 6134, 6135, 6136, 5309, 6138, 6139, 6140, 6141, + 5313, 5313, 10102, 6145, 6146, -2467, 1836, 6149, + 6150, 6151, 6152, 6153, 1535, 6155, 6156, 6157, + 5326, 5326, 5326, 32767, 32767, 32767, 32767, 32767, + 32767, 1837, 32767, 1741, 32767, 32767, 32767, 32767, + 10538, 10539, 9184, 9185, 6237, 7726, 7727, 7728, + 7729, 7730, 6243, 7731, 7732, 27666, 7734, 7735, + 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7992, + 7992, 7745, 7746, 7747, 7748, 7749, 7750, 7751, + 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, + 7760, 1660, 7762, 7763, 7764, 7765, 7766, 7767, + 7768, 6282, 7770, 7141, -128, -128, -128, 7768, + 7768, 7768, 4803, 7141, 7141, 7141, 5529, -136, + 10714, 7141, 9226, -10707,4652, 7141, -140, 4651, + 7141, 7141, 7141, 7141, -142, 5529, -143, 7141, + 7141, 7141, 6315, 7140, 7140, 6318, 6319, 4635, + 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, + 6329, 6330, 9168, 9169, 9170, 15325, 15078, 15079, + 9174, 9175, 9176, 6539, 9178, 9179, 9180, 6344, + 6345, 6346, 6347, 8761, 6349, 6350, 6351, 9193, + 9194, 9195, 4634, 4634, 9196, 9197, 9198, -1165, + -1165, -1165, 4937, 6364, 6365, 6366, 10077, 2397, + 15134, 0, 0, 0, 0, 1336, 0, 5782, + 5782, 5782, 5782, 5782, 5782, 5782, 5782, 10930, + 10931, 5780, 5780, 5780, 5780, 5780, 5780, 5780, + 10939, 10940, 10941, 10942, 10943, 10944, 10945, 10946, + 10947, 10948, 10949, 10950, 10951, 10952, 10953, 10954, + 10955, 10956, 10957, 10958, 10959, 10960, 10961, 10962, + 10963, 10964, 10965, 10966, 10967, 10968, 6178, 6179, + 21539, 6181, 10973, 10974, 6184, 6185, 10977, 6187, + 6188, 10978, 10979, 10980, 10981, 10982, 10983, 6195, + 6196, 6197, 6198, 6199, 6200, 10990, 6202, 6203, + 6204, 10994, 10995, 10996, 10997, 10998, 10999, 11000, + 11001, 11002, 11003, 11004, 11005, 11006, 11007, 6215, + 6216, 11010, 6218, 11012, 11013, 11014, 11015, 11016, + 11017, 6640, 7529, 7530, 6221, 6222, 7532, 7533, + 6646, 14543, 14544, 14545, 6650, 6651, 6652, 6653, + 0, 6489, 6490, 6491, 6492, 6493, 6494, 6495, + 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, + 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, + 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, + 6520, 5211, 6522, 6523, 6524, 6525, 13533, 13534, + 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, + 6536, 6537, 0, 0, 0, 0, 0, 0, + 4173, 0, 0, 0, 0, 0, 6550, 6551, + 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, + 6560, 6561, 6562, 6563, 6564, 6565, 4873, 6567, + 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, + 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, + 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, + 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, + 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, + 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, + 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, + 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, + 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, + 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, + 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, + 6656, 6657, 6658, 13552, 6660, 6661, 6662, 6663, + 6664, 6665, 6666, 6667, 6668, 6669, 6670, 13573, + 6672, 6673, 6674, 6675, 9276, 6677, 4704, 4705, + 6680, 6681, 6682, 6683, 13596, 12241, 6686, 6687, + 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, + 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, + 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, + 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, + 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, + 3709, 6729, 3710, 3710, 3710, 6733, 6734, 3712, + 3712, 6737, 6738, 6739, 6740, 6741, 4536, 3717, + 6744, 32767, 6745, 6746, 6747, 6748, 6749, 6750, + 6751, 6752, 6753, 6754, 6755, 6756, 6757, 6758, + 6759, 6760, 6761, 6762, 6763, 6764, 6765, 6766, + 6767, 6768, 6769, -2005, 6771, -3121, -3121, -3121, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 895, 896, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 4706, 4707, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 897, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 898, + 899, 900, 901, 902, 903, 904, 905, 32767, + 32767, 906, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1, 32767, 2, 32767, 32767, 32767, 32767, 3, + 32767, 32767, 4, 5, 6, 7, 32767, 32767, + 8, 9, 10, 32767, 11, 83, 13, 32767, + 14, 15, 16, 17, 18, 19, 32767, 20, + 21, 22, 907, 908, 909, 910, 911, 912, + 913, 914, 915, 916, 917, 918, 919, 920, + 32767, 921, 922, 923, 924, 925, 926, 927, + 928, 929, -380, 931, 932, 933, 934, 7942, + 7943, 7944, 49, 50, 51, 52, 53, -1409, + 32767, -1408, -1407, -2894, -1406, -1405, 18529, 3171, + 32767, -1403, -1402, -1401, -1400, -1399, 32767, -1398, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 683, 32767, 7976, 32767, 4994, 32767, 686, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 937, 0, -3182, 0, -3183, 0, -3184, + 32767, 941, 32767, 32767, 32767, -3188, 0, 32767, + 0, 0, 32767, 0, 0, 32767, 0, 0, + 32767, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 943, + 32767, 0, 32767, 32767, 32767, 32767, 944, 0, + 945, 0, 32767, 946, 947, 32767, 948, 949, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 32767, 0, 32767, 0, 32767, 950, 951, + 952, 953, 954, 955, 956, 957, 958, 32767, + 6565, 6566, 32767, 0, 0, 32767, 0, 0, + 32767, 6570, 6571, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 32767, -2239, 4522, 4337, 0, + 32767, 32767, 32767, 0, -2086, 32767, 32767, 0, + 0, 0, 0, 0, 0, 959, 960, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4578, 4579, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -4175, -5292, 0, 0, 32767, 0, 32767, 0, + 0, 32767, 0, 0, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 961, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 962, 963, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 964, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 0, 0, + 32767, 32767, -3913, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 965, 966, 967, 32767, + 968, 969, 970, 971, 972, 973, 974, 975, + 976, 977, 978, 979, 980, 32767, 981, 982, + 983, 984, 985, 986, 987, 32767, 32767, 32767, + 32767, 988, 32767, 32767, 32767, 32767, 32767, 32767, + 989, 32767, 32767, 32767, -4941, 991, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 992, 993, 994, 32767, 995, 996, 997, + 998, 999, 1000, 1001, -3143, -3143, -3143, -3143, + 32767, -3144, -3144, -3144, -3144, -3144, 1011, 1012, + 1013, 1014, 1015, 1016, -3138, -3138, -3138, -3138, + -3138, -3138, -3138, 32767, -3139, -3139, -3139, -3139, + -3139, -3139, -3139, -3139, -3139, -3139, -3139, -3139, + -3139, -3139, -3139, -3139, -3139, -3139, -3139, -3139, + -3139, -3139, -3139, -3139, -3139, -3139, -3139, 872, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 3049, 3049, -3150, 3049, 3049, + 3049, 3049, 3049, 3049, 3049, 3049, 3049, 3049, + 3049, 3049, 3049, 3049, 3049, 3049, 3049, 3049, + 3049, 3049, 3049, 3049, 3049, 0, 0, 0, + 0, 0, 0, 0, 0, 3057, 5596, 5597, + 5598, 6716, 6717, 6718, 6719, 6720, 6721, 6722, + 6723, -3176, -3176, 6728, 6729, 6730, 6731, 6732, + 6733, 6734, 6735, -3176, -3176, -3176, -3176, -3176, + -3176, 8013, 2958, 2959, -3141, 2961, 2962, 2963, + 2964, 2965, 8022, 8023, -3176, -3176, -3176, -3176, + -3176, 5630, 5631, -2, -2, -2, -2, 7679, + -3176, -3176, -3176, -3176, -3176, -3176, -3176, -3176, + -3176, -4957, -4957, -4957, -4957, -3176, -3176, -3176, + -3176, -3176, -3176, -3176, -3176, -3176, -3176, -3176, + -3176, -3176, -3176, -3176, -3176, -3176, -3176, -3176, + -3176, -3176, 1880, 1880, 7981, 1880, 1880, 1880, + 1880, 1880, -3176, -3176, -1258, 4882, 4883, 4884, + 895, 4886, -3176, 4861, 4862, 4863, 4864, -2816, + 9921, -5213, -5213, -5213, -5213, -3877, -5213, 569, + 569, 569, 569, 569, 569, 569, 569, 5717, + 5718, 567, 567, 567, 567, 567, 567, 567, + 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, + 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, + 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, + 5750, 5751, 5752, 5753, 5754, 5755, 965, 966, + 16326, 968, 5760, 5761, 971, 972, 5764, 974, + 975, 5765, 5766, 5767, 5768, 5769, 5770, 982, + 983, 984, 985, 986, 987, 5777, 989, 990, + 991, 5781, 5782, 5783, 5784, 5785, 5786, 5787, + 5788, 5789, 5790, 5791, 5792, 5793, 5794, 1002, + 1003, 5797, 1005, 5799, 5800, 5801, 5802, 5803, + 5804, 1427, 2316, 2317, 1008, 1009, 2319, 2320, + 1433, 9330, 9331, 9332, 1437, 1438, 1439, 1440, + 1441, -21, -20, -19, -18, -1505, -17, -16, + 19918, -14, -13, -12, -11, -10, -9, -8, + -7, -6, 244, 244, -3, -2, -1, 0, + 1, 2, 3, 4, 1469, 5, 6, 7, + 8, 9, 32767, 32767, 32767, 32767, 10, 11, + 12, 13, 5070, 5071, 3154, -2985, 1318, 1319, + 1320, -2988, 5075, -2961, -2961, -2961, -2961, 1327, + 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, + 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, + 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, + 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, + 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, + 7522, 7275, 7276, 1371, 1372, 1373, -1264, 1375, + 1376, 1377, 1378, 1379, 1380, 1381, 1382, 957, + -14402,957, 1386, 1387, 1388, 1389, 1390, 1391, + 1392, 1393, -8970, -8970, -8970, 1397, 1398, 948, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 1400, + 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, + 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, + 1417, 1418, 1419, 1420, 1421, 32767, 32767, 1422, + 1423, 1424, 1425, 1426, 1427, 32767, 32767, 1428, + 1429, 1430, 1431, 8325, 1433, 1434, 1435, 1436, + 1437, 1438, 1439, 1440, 1441, 1442, 1443, 8346, + 1445, 1446, 1447, 1448, 4049, 1450, -523, -522, + 1453, 1454, 1455, 1456, 8369, 7014, 1459, 1460, + 1461, 1462, 1463, 1464, 1465, 32767, 32767, 1466, + 1467, 1468, 1469, 1470, 1471, 32767, 32767, 1472, + 1473, 1474, 1475, 1476, 1477, 1478, 1479, 32767, + 1480, 32767, 1481, 32767, 1482, 32767, 1483, 1484, + 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, + -1526, 1494, -1525, -1525, -1525, 1498, 1499, -1523, + -1523, 1502, 1503, 1504, 1505, 1506, -699, -1518, + 1509, -1517, 1511, 1512, 1513, 32767, 32767, 1514, + 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, + 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, + 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, + 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, + 1547, 1548, 1549, 5054, 1551, 1552, 1553, 8447, + 1555, 1556, -4049, 1558, 1559, 1560, -1467, 5063, + 1563, 5064, 5064, 1566, 32767, 1567, 1568, 1569, + 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, + 1578, 1579, 1580, 1581, 32767, 1582, 1583, 1584, + 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, + 1593, 1594, 1595, 32767, 32767, 1596, 1597, 1598, + 1599, 1600, 1601, 32767, 1602, 1603, 1604, 1605, + 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, + 1614, 1615, 1616, 1617, 1618, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1630, 1631, 0, 32767, -5702, + -5702, -5702, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 32767, 0, + 32767, -7163, 0, 0, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -7269, -7269, -7269, 627, + 627, 627, -2338, 0, 0, 0, -1612, -7277, + 3573, 0, 2085, -17848,-2489, 0, -7281, -2490, + 0, 0, 0, 0, -7283, -1612, -7284, 0, + 0, 0, 0, 0, 0, 0, 0, -2503, + -7292, -2503, -4309, -4309, 0, 536, -4307, -4307, + -4307, -4307, 677, -4306, -4306, -4306, -4306, -7305, + 0, -4306, -4306, 32767, 32767, -4308, -4308, -7312, + -4307, 690, -4306, -6530, 0, -4306, 0, 0, + -4306, 0, -4305, -4305, -4305, -4305, -4305, -4305, + -2949, -2949, 0, -1488, -1488, -1488, -1488, -1488, + 0, -1487, -1487, -21420,-1487, -1487, -1487, -1487, + -1487, -1487, -1487, -1487, -1487, -1736, -1735, -1487, + -1487, -1487, -1487, -1487, -1487, -1487, -1487, -1487, + -1487, -1487, -1487, -1487, -1487, -1487, -1487, 4614, + -1487, -1487, -1487, -1487, -1487, -1487, -1487, 0, + -1487, -857, 6413, 6414, 6415, -1480, -1479, -1478, + 1488, -849, -848, -847, 766, 6432, -4417, -843, + -2927, 17007, 1649, -839, 6443, 1653, -836, -835, + -834, -833, 6451, 781, 6454, -829, -828, -827, + 0, -824, -823, 0, 0, 1685, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -2837, -2837, -2837, -8991, -8743, -8743, -2837, -2837, + -2837, -199, -2837, -2837, -2837, 0, 0, 0, + 0, -2413, 0, 0, 0, -2841, -2841, -2841, + 1721, 1722, -2839, -2839, -2839, 7525, 7526, 7527, + 1426, 0, 0, 0, -3710, 3971, -8765, 6370, + 6371, 6372, 6373, 5038, 6375, 594, 595, 596, + 597, 598, 599, 600, 601, -4546, -4546, 606, + 607, 608, 609, 610, 611, 612, -4546, -4546, + -4546, -4546, -4546, -4546, -4546, -4546, -4546, -4546, + -4546, -4546, -4546, -4546, -4546, -4546, -4546, -4546, + -4546, -4546, -4546, -4546, -4546, -4546, -4546, -4546, + -4546, -4546, -4546, -4546, 245, 245, -15114,245, + -4546, -4546, 245, 245, -4546, 245, 245, -4544, + -4544, -4544, -4544, -4544, -4544, 245, 245, 245, + 245, 245, 245, -4544, 245, 245, 245, -4544, + -4544, -4544, -4544, -4544, -4544, -4544, -4544, -4544, + -4544, -4544, -4544, -4544, -4544, 249, 249, -4544, + 249, -4544, -4544, -4544, -4544, -4544, -4544, -166, + -1054, -1054, 256, 256, -1053, -1053, -165, -8061, + -8061, -8061, -165, -165, -165, -165, -165, 1298, + 1298, 1298, 1298, 2786, 1299, 1299, -18634,1299, + 1299, 1299, 1299, 1299, 1299, 1299, 1299, 1299, + 1050, 1051, 1299, 1299, 1299, 1299, 1299, 1299, + 1299, 1299, -165, 1300, 1300, 1300, 1300, 1300, + 1300, 1300, 7401, 1300, 1300, 1300, 1300, 1300, + -3756, -3756, -1838, 4302, 0, 0, 0, 4309, + -3753, 4284, 4285, 4286, 4287, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -6154, -5906, + -5906, 0, 0, 0, 2638, 0, 0, 0, + 0, 0, 0, 0, 0, 426, 15786, 428, + 0, 0, 0, 0, 0, 0, 0, 0, + 10364, 10365, 10366, 0, 0, 451, 452, 453, + 454, 455, 456, 32767, 32767, 0, 0, 0, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 32767, 1842, 32767, 32767, 1843, 32767, + 32767, 0, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 1844, 32767, + 0, 0, 0, 32767, 32767, 32767, 1846, 1847, + 32767, 1848, 1849, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 1851, 32767, + 32767, 1852, 32767, 0, 0, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 1854, 32767, 1855, 6223, 6224, 6225, + 6226, 6227, 6228, 6229, 6230, 6231, 6232, 1856, + 1857, 1574, 1574, 1574, 32767, 32767, 1572, 1572, + 32767, 32767, 1863, 1864, 32767, 32767, 32767, 32767, + 32767, 32767, 1865, 1866, 32767, 32767, 1867, 1868, + 32767, 32767, 1869, 1870, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 1871, 1872, + 3017, 1874, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 3018, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 1875, 1876, 1877, 1878, 32767, 32767, + 32767, 0, 0, 32767, 1879, 1880, 1881, 1882, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 1883, 1884, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, -2263, 2526, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 1885, 1886, 1887, 1888, + 1889, 1890, 1891, 1892, 1893, 1894, 4758, 4759, + 4760, 4761, 4762, 1900, 1901, 1902, 1903, 1904, + 1905, 1906, 1907, 1908, 1909, 924, 1911, 1912, + 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, + 1921, 1107, 1923, 1924, 1925, 1926, 1927, 1928, + 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, + 1937, 1938, 1939, 1123, 1123, 1123, 1943, 1944, + 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, + 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, + 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, + 1969, 1970, 1971, 1972, 1973, 1974, 4727, 1976, + 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, + 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, + 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + -2451, 2002, -2448, 2004, 2005, 2006, -2441, -2724, + 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, + 2017, 2018, 2019, 2020, 2021, 0, 2023, 985, + 985, 7086, 985, 985, 985, 985, 985, -4071, + -4071, -2153, 3987, 3988, 3989, 0, 3991, -4071, + 3966, 3967, -4071, 260, 261, 262, 263, 264, + 265, 266, 3264, 32767, 32767, -2437, -2436, 32767, + 32767, 32767, 32767, 32767, 32767, 270, 271, 272, + 273, 274, 275, 4728, 277, 278, 279, 280, + 281, -2434, 283, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 1329, 441, 441, 1751, + 1751, 442, 442, 1330, -6566, -6566, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -3047, -274, + -273, -272, -271, 1946, 4745, 0, 0, -267, + -266, 1945, -264, -263, 0, 0, 0, 0, + 0, 0, 0, 0, -6199, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 2539, 2540, 2541, + 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, + -6233, -6233, 3671, 3672, 3673, 3674, 3675, 3676, + 3677, 3678, -6233, -6233, -6233, -6233, -6233, -6233, + 4956, -99, -98, -6198, -96, -95, -94, -93, + -92, 4965, 4966, -6233, -6233, -6233, -6233, -6233, + 2573, 2574, -3059, 3049, -3060, -3060, 4621, -6234, + -6234, -6234, -6234, -6234, -6234, -6234, -6234, -6234, + -8015, -8015, -8015, -8015, -6234, -6234, -6234, -6234, + -6234, -6234, -6234, -6234, -6234, -6234, -6234, -6234, + -6234, -6234, -6234, -6234, -6234, -6234, -6234, -6234, + -6234, -1178, -1178, 4923, -1178, -1178, -1178, -1178, + -1178, -6234, -6234, -4316, 1824, 1825, 1826, -2163, + 1828, -6234, 1803, 1804, 1805, 1806, -5874, 6863, + -8271, -8271, -8271, -8271, -6935, -8271, -2489, -2489, + -2489, -2489, -2489, -2489, -2489, -2489, 2659, 2660, + -2491, -2491, -2491, -2491, -2491, -2491, -2491, 2668, + 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, + 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, + 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, + 2693, 2694, 2695, 2696, 2697, -2093, -2092, 13268, + -2090, 2702, 2703, -2087, -2086, 2706, -2767, 2708, + 2709, 2710, 2711, 2712, 3178, 3179, 3180, 3181, + 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, + 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, + 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, + 3206, 3207, 3208, 3209, 3281, 3211, 3212, 3213, + 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, + 3222, 4107, 4108, 4109, 4110, 4111, 4112, 3229, + 4115, 4116, 4117, 4118, 4119, 4120, 3236, 3237, + 4124, 4125, 4126, 4127, 4128, 7621, 3244, 4133, + 4134, 2825, 4136, 4137, 4138, 3251, 11148, 11149, + 11150, 3255, 3256, 3257, 3258, 3259, 1797, 1798, + 1799, 1800, 313, 1801, 1802, 21736, 1804, 1805, + 1806, 1807, 1808, 1809, 1810, 1811, 1812, 2062, + 2062, 1815, 1816, 1817, 1818, 1819, 1820, 1821, + 1822, 3287, 1823, 1824, 1825, 32767, 3291, 3292, + 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, + 3301, 3302, 3303, 3304, 32767, 32767, 3305, 32767, + 9008, 32767, 32767, 3307, 3308, 3309, 3310, 3311, + 3312, 3313, 3314, 3315, 3316, 32767, 3317, 32767, + 3318, 32767, 32767, 3319, 3320, 32767, 32767, 32767, + 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, + 3329, 3330, 3331, 3332, 3333, 10603, 10604, 10605, + 2710, 2711, 2712, 5678, 3341, 3342, 3343, 4956, + 10622, -227, 3347, 1263, 21197, 5839, 3351, 10633, + 5843, 3354, 3355, 3356, 3357, 10641, 4971, 10644, + 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, + 5872, 10662, 5874, 7681, 7682, 3374, 2839, 7683, + 7684, 7685, 7686, 2703, 7687, 7688, 7689, 7690, + 10690, 3386, 7693, 7694, 7695, 0, 7697, 7698, + 10703, 7699, 2703, 7700, 9925, 3396, 7703, 3398, + 3399, 7706, 3401, 7707, 7708, 7709, 7710, 7711, + 7712, 6357, 6358, 3410, 4899, 4900, 4901, 4902, + 4903, 3416, 4904, 4905, 24839, 4907, 4908, 4909, + 4910, 4911, 4912, 4913, 4914, 4915, 5165, 5165, + 4918, 4919, 4920, 4921, 4922, 4923, 4924, 4925, + 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, + -1167, 4935, 4936, 4937, 4938, 4939, 4940, 4941, + 3455, 4943, 4314, -2955, -2955, -2955, 4941, 4941, + 4941, 1976, 4314, 4314, 4314, 2702, -2963, 7887, + 4314, 6399, -13534,1825, 4314, -2967, 1824, 4314, + 4314, 4314, 4314, -2969, 2702, -2970, 4314, 4314, + 4314, 3488, 4313, 4313, 3491, 3492, 1808, 3494, + 32767, 0, 0, 32767, 32767, 0, 0, 0, + 0, 32767, 0, 0, 0, 0, -2999, 4306, + 0, 0, 0, 7696, 0, 0, 32767, 0, + 32767, 0, -2224, 4306, 0, 4306, 4306, 0, + 0, 0, 0, 0, 0, 0, 0, 1356, + 1356, 4305, 2817, 2817, 2817, 2817, 2817, 2817, + 2817, 2817, -17116,2817, 2817, 2817, 2817, 2817, + 2817, 2817, 2817, 2817, 2568, 2569, 2817, 2817, + 2817, 2817, 2817, 2817, 2817, 2817, 2817, 2817, + 2817, 2817, 2817, 2817, 2817, 2817, 8918, 2817, + 2817, 2817, 2817, 2817, 2817, 2817, 4304, 2817, + 3447, 10717, 10718, 10719, 3531, 3532, 32767, 3533, + 3534, 3535, 3536, 3537, 32767, 3538, 32767, 3539, + 3540, 32767, 3541, 3542, 32767, 3543, 3544, 3545, + 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, + 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, + 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, + 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, + 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, + 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, + 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, + 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, + 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, + 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, + 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, + 2324, 3635, 3636, 3637, 3638, 10646, 10647, 3641, + 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, + 3650, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 3651, 3652, 3653, 3654, 3655, 3656, + 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, + 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, + 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, + 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, + 3689, 3690, 3691, 3692, 3693, 3694, 3695, 32767, + 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, + 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, + 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, + 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, + 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, + 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, + 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, + 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, + 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, + 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, + 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, + 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, + 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, + 3800, -210, -209, 3803, 3804, 3805, 3806, 3807, + 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, + 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, + 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, + 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, + 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, + 3848, 3849, -4925, 3851, -6041, -6041, -6041, -6041, + -6041, -6041, -6041, 3859, 3860, -6043, -6043, -6043, + -6043, -6043, -6043, -6043, -6043, 3869, 3870, 3871, + 3872, 3873, 3874, -7314, -2258, -2258, 3843, -2258, + -2258, -2258, -2258, -2258, -7314, -7314, 3886, 3887, + 3888, 3889, 3890, -4915, -4915, 719, 720, 721, + 722, -6958, 3898, 3899, 3900, 3901, 3902, 3903, + 3904, 3905, 3906, 5688, 5689, 5690, 5691, 3911, + 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, + 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, + 3928, 3929, 3930, 3931, -1124, -1123, -7223, -1121, + -1120, -1119, -1118, -1117, 3940, 3941, 2024, -4115, + -4115, -4115, -125, -4115, 3948, -4088, -4088, 3951, + 32767, 3952, 3953, 3954, 3955, 3956, 3957, 3958, + 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, + 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, + 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, + 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, + 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, + 3999, 4000, 4001, 4002, 4003, 14, 4005, 4006, + 4007, 4008, 4009, 4010, 4011, 4012, 4013, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 4014, 4015, 4016, 4017, 4018, 4019, 4020, + 4021, 4022, 4023, 4024, 4025, 4026, 2025, 2026, + 2027, 4030, 4031, 4032, 4033, 4034, 4035, 4036, + 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, + 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, + 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, + 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, + 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, + 4077, 32767, 32767, 4078, 4079, 4080, 4081, 4082, + 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, + 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, + 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, + 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, + 4115, 4116, 4117, 0, 4119, 4120, 4121, 4122, + 4123, 4124, 4125, 0, 4127, 4128, 1401, 4130, + 4131, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4011, 4011, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 8775, 0, + 9893, 9894, 9895, 9896, 9897, 9898, 9899, 0, + 0, 9904, 9905, 9906, 9907, 9908, 9909, 9910, + 9911, 0, 0, 0, 0, 0, 0, 11189, + 6134, 6135, 35, 6137, 6138, 6139, 6140, 6141, + 11198, 11199, 0, 0, 0, 0, 0, 8806, + 8807, 3174, 3174, 3174, 3174, 10855, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -1781, + -1781, -1781, -1781, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 5056, 5056, 11157, 5056, 5056, 5056, 5056, 5056, + 0, 0, 1918, 8058, 8059, 8060, 4071, 8062, + 0, 8037, 8038, 0, 4331, 4332, 4333, 4334, + 4335, 4336, 4337, 7335, 7336, 1635, 1636, 1637, + 1638, 1639, 1640, 1641, 1642, 1643, 4349, 4350, + 4351, 4352, 4353, 4354, 8807, 4356, 4357, 4358, + 4359, 4360, 1645, 4362, 4363, 4364, 4365, 32767, + 32767, 32767, 32767, 32767, 8912, 8913, 8914, 8915, + 8916, 8917, 8918, 8919, 8920, 8921, 8922, 8923, + 8924, 8925, 8926, 8927, 4137, 4138, 19498, 4140, + 8932, 8933, 4143, 4144, 8936, 4146, 4147, 8937, + 8938, 8939, 8940, 8941, 8942, 4154, 4155, 4156, + 4157, 4158, 4159, 8949, 4161, 4162, 4163, 8953, + 8954, 8955, 8956, 8957, 8958, 8959, 8960, 8961, + 8962, 8963, 8964, 8965, 8966, 4174, 4175, 8969, + 4177, 8971, 8972, 8973, 8974, 8975, 8976, 4599, + 5488, 5489, 4180, 4181, 5491, 5492, 4605, 12502, + 12503, 12504, 4609, 4610, 4611, 4612, 4613, 3151, + 3152, 3153, 3154, 1667, 3155, 3156, 23090, 3158, + 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, + 3416, 3416, 3169, 3170, 3171, 3172, 3173, 3174, + 3175, 3176, 4641, 3177, 3178, 3179, 3180, 3181, + 3182, 3183, -2917, 3185, 3186, 3187, 3188, 3189, + 8246, 8247, 6330, 191, 4494, 4495, 4496, 188, + 8251, 215, 215, 215, 215, 4503, 4504, 4505, + 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, + 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, + 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, + 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, + 4538, 4539, 4540, 4541, 4542, 4543, 10698, 10451, + 10452, 4547, 4548, 4549, 1912, 4551, 4552, 4553, + 4554, 4555, 0, 32767, 4130, 4130, -11229,4130, + 4559, 4560, 4561, 0, 0, 4562, 4563, 4564, + -5799, -5799, -5799, 303, 32767, 4117, 4117, 4117, + 4117, 4117, 4117, 2031, 2032, 4574, 4575, 4576, + 32767, 32767, 32767, 4577, 4578, 4579, 4580, 4581, + 4582, 4583, 32767, 4584, 4585, 4586, 4587, 4588, + 4589, 4590, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 2034, 4816, 4817, 4818, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 2035, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 2036, 2037, 2038, + 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, + 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, + 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, + 2063, 2064, 2065, 2066, 2067, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -4778, -4778, -4778, 0, 32767, 32767, 32767, 0, + 0, 32767, 32767, 32767, 0, 0, 32767, 32767, + -4791, -4791, -4791, -4791, -4791, -4791, -4791, -4791, + -4791, -4791, 0, 0, -15359,0, -4791, -4791, + 0, 0, -4791, 0, 0, -4789, -4789, -4789, + -4789, -4789, -4789, 0, 0, 0, 0, 0, + 0, -4789, 0, 0, 0, -4789, -4789, -4789, + -4789, -4789, -4789, -4789, 32767, 32767, 32767, 32767, + -4793, -4793, -4793, 0, 0, -4793, 0, -4793, + -4793, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 2069, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 4017, 32767, 32767, 32767, 2070, + 2071, 2072, 2073, 2074, 2075, 2076, 2077, 22011, + 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, + 2087, 2337, 2337, 2090, 2091, 2092, 2093, 2094, + 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, + 2103, 2104, 2105, -3995, 2107, 2108, 2109, 2110, + 2111, 2112, 2113, 627, 2115, 1486, -5783, -5783, + -5783, 2113, 2113, 2113, -852, 1486, 1486, 1486, + -126, -5791, 5059, 1486, 3571, -16362,-1003, 1486, + -5795, -1004, 1486, 1486, 1486, 1486, -5797, -126, + -5798, 1486, 1486, 1486, 1486, 1486, 1486, 1486, + 1486, -1017, -5806, -1017, -2823, -2823, 1486, 2022, + -2821, -2821, -2821, -2821, 2163, -2820, -2820, -2820, + -2820, -5819, 1486, -2820, -2820, -2820, 4876, -2820, + -2820, -5824, -2819, 2178, -2818, -5042, 1488, -2818, + 1488, 1488, -2818, 1488, -2817, -2817, -2817, -2817, + -2817, -2817, -1461, -1461, 1488, 0, 0, 0, + 0, 0, 0, 0, 0, -19933,0, 0, + 0, 0, 0, 0, 0, 0, 0, -249, + -248, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 6101, 0, 0, 0, 0, 0, 0, + 0, 1487, 0, 630, 7900, 7901, 7902, 7, + 8, 9, 2975, 638, 639, 640, 2253, 7919, + -2930, 644, -1440, 18494, 3136, 648, 7930, 3140, + 651, 652, 653, 654, 7938, 2268, 7941, 658, + 659, 660, 661, 662, 663, 664, 665, 3169, + 7959, 3171, 4978, 4979, 671, 136, 4980, 4981, + 4982, 4983, 0, 4984, 4985, 4986, 4987, 7987, + 683, 4990, 4991, 4992, -2703, 4994, 4995, 8000, + 4996, 0, 4997, 7222, 693, 5000, 695, 696, + 5003, 698, 5004, 5005, 5006, 5007, 5008, 5009, + 3654, 3655, 707, 2196, 2197, 2198, 2199, 2200, + 2201, 2202, 2203, 22137, 2205, 2206, 2207, 2208, + 2209, 2210, 2211, 2212, 2213, 2463, 2463, 2216, + 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, + 2225, 2226, 2227, 2228, 2229, 2230, 2231, -3869, + 2233, 2234, 2235, 2236, 2237, 2238, 2239, 753, + 2241, 1612, -5657, -5657, -5657, 2239, 2239, 2239, + -726, 1612, 1612, 1612, 0, -5665, 5185, 1612, + 3697, -16236,-877, 1612, -5669, -878, 1612, 1612, + 1612, 1612, -5671, 0, -5672, 1612, 1612, 1612, + 1612, 1612, 1612, 1612, 1612, -891, -5680, -891, + -2697, -2697, 1612, 5095, 2299, 5097, 2300, 5099, + 2301, 5101, 2302, 5103, 2303, 5105, 2304, 5107, + 2305, 5109, 2306, 5111, 5112, 2307, 5114, 2308, + 32767, 2309, 5117, 5118, 5119, 32767, 5120, 5121, + 5498, 2311, 5124, 2312, 2313, 0, 2314, 2315, + 5126, 2316, 2317, 5129, 2318, 2319, 5132, 32767, + 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, + 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, + 5149, 5150, 5151, 5152, 2320, 5154, 5155, 5156, + 5157, 1377, 2322, 1378, 2324, 5162, 1379, 1379, + 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, + 5173, 5174, 5175, 5176, 2327, 5178, 2328, 5180, + 2329, 5182, 2330, 5184, 2331, 5186, 2332, 5188, + 2333, 5190, 2334, 5192, 2335, 5194, 2336, 5196, + 2337, 5198, 2338, 5200, 5201, 2339, 5203, 2340, + 5205, 1391, 5207, 5208, 5209, 5210, 5211, 5212, + 1385, 1385, -4221, -4221, -4221, -1193, 2346, 2347, + 5221, 2348, 2349, -3412, -4220, -4220, -4220, -4220, + 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, + 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, + 5245, 5246, 5247, 5248, 2352, 5250, 5251, 4592, + -2168, -1982, 2356, 5256, 5257, 5258, 2357, 4444, + 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, + 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, + 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, + 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, + 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, + 5301, 5302, 5303, 5304, 5305, 5306, 32767, 5307, + 5308, 5309, 6427, 6428, 6429, 6430, 6431, 6432, + 6433, 6434, -3465, -3465, 6439, 6440, 6441, 6442, + 6443, 6444, 6445, 6446, -3465, -3465, -3465, -3465, + -3465, -3465, 7724, 2669, 2670, -3430, 2672, 2673, + 2674, 2675, 2676, 7733, 7734, -3465, -3465, -3465, + -3465, -3465, 5341, 5342, -291, -291, -291, -291, + 7390, -3465, -3465, -3465, -3465, -3465, -3465, -3465, + -3465, -3465, -5246, -5246, -5246, -5246, -3465, -3465, + -3465, -3465, -3465, -3465, -3465, -3465, -3465, -3465, + -3465, -3465, -3465, -3465, -3465, -3465, -3465, -3465, + -3465, -3465, -3465, 1591, 1591, 7692, 1591, 1591, + 1591, 1591, 1591, -3465, -3465, -1547, 4593, 4594, + 4595, 606, 4597, -3465, 4572, 4573, 4574, 4575, + -3105, 9632, -5502, -5502, -5502, -5502, -4166, -5502, + 280, 280, 280, 280, 280, 280, 280, 280, + 5428, 5429, 278, 278, 278, 278, 278, 278, + 278, 5437, 5438, 5439, 5440, 5441, 5442, 5443, + 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, + 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, + 5460, 5461, 5462, 5463, 5464, 5465, 5466, 676, + 677, 16037, 679, 5471, 5472, 32767, 32767, 5473, + 0, 5475, 5476, 5477, 5478, 5479, 5480, 5481, + 693, 694, 695, 696, 697, 698, 5488, 700, + 701, 702, 5492, 5493, 5494, 5495, 5496, 5497, + 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, + 713, 714, 5508, 716, 5510, 5511, 5512, 5513, + 5514, 5515, 1138, 2027, 2028, 719, 720, 2030, + 2031, 1144, 9041, 9042, 2477, 2478, 2479, 2480, + 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, + 2489, 2490, 2491, 2492, 5540, 2768, 2768, 2768, + 2768, 5547, -2247, 2499, 2500, 2768, 2768, 558, + 2768, 2768, 2506, 2507, 2508, 2509, 2510, 2511, + 2512, 2513, 8713, 2515, 2516, 2517, 2518, 2519, + 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, + 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, + 2536, 2537, 5587, 5588, 5589, 5590, 5591, 5592, + 5593, 5594, 2538, 0, 0, 0, -1117, -1117, + -1117, -1117, -1117, -1117, -1117, -1117, 8783, 8784, + -1119, -1119, -1119, -1119, -1119, -1119, -1119, -1119, + 8793, 8794, 8795, 8796, 8797, 8798, -2390, 2666, + 2666, 8767, 2666, 2666, 2666, 2666, 2666, -2390, + -2390, 8810, 8811, 8812, 8813, 8814, 9, 9, + 5643, 5644, 5645, 5646, -2034, 8822, 8823, 8824, + 8825, 8826, 8827, 8828, 8829, 8830, 10612, 10613, + 10614, 10615, 8835, 8836, 8837, 8838, 8839, 8840, + 8841, 8842, 8843, 8844, 8845, 8846, 8847, 8848, + 8849, 8850, 8851, 8852, 8853, 8854, 8855, 3800, + 3801, -2299, 3803, 3804, 3805, 3806, 3807, 8864, + 8865, 6948, 809, 809, 809, 4799, 809, 8872, + 836, 836, 836, 836, 8517, -4219, 10916, 10917, + 10918, 10919, 9584, 10921, 5140, 5141, 5142, 5143, + 5144, 5145, 5146, 5147, 0, 0, 5152, 5153, + 5154, 5155, 5156, 5157, 5158, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4791, 4791, -10568,4791, 0, + 0, 4791, 4791, 0, 5474, 0, 0, 0, + 0, 0, 0, 0, 4789, 4789, 4789, 4789, + 4789, 4789, 0, 4789, 4789, 4789, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4793, 4793, 0, 4793, + 0, 0, 0, 0, 0, 0, 4378, 3490, + 3490, 4800, 4800, 3491, 3491, 4379, -3517, -3517, + 3049, 3049, 3049, 3049, 3049, 3049, 3049, 3049, + 3049, 3049, 3049, 3049, 3049, 3049, 3049, 3049, + 2, 2775, 2776, 2777, 2778, 0, 7795, 3050, + 3050, 2783, 2784, 4995, 2786, 2787, 3050, 3050, + 3050, 3050, 3050, 2793, 2794, 2795, 2796, 2797, + 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, + 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, + 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, + 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, + 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, + 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, + 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, + 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, + 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, + 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, + 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, + 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, + 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, + 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, + 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, + 2918, 2919, 2920, 2921, 2922, 883, 884, 885, + 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, + 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, + 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, + 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, + 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, + 2966, 2967, 2968, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 4770, 4771, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 32767, 0, + 0, 0, 0, 0, 0, 0, 0 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 1; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 8191 + c; + } + return h[a % 13551] + h[b % 13551]; +} + +/* Hash lookup information for decomposition */ +static const pg_unicode_decompinfo UnicodeDecompInfo = +{ + UnicodeDecompMain, + Decomp_hash_func, + 6775 +}; + +/* Inverse lookup array -- contains indexes into UnicodeDecompMain[] */ +static const uint16 RecompInverseLookup[941] = +{ + /* U+003C+0338 -> U+226E */ 1857, + /* U+003D+0338 -> U+2260 */ 1854, + /* U+003E+0338 -> U+226F */ 1858, + /* U+0041+0300 -> U+00C0 */ 14, + /* U+0041+0301 -> U+00C1 */ 15, + /* U+0041+0302 -> U+00C2 */ 16, + /* U+0041+0303 -> U+00C3 */ 17, + /* U+0041+0304 -> U+0100 */ 67, + /* U+0041+0306 -> U+0102 */ 69, + /* U+0041+0307 -> U+0226 */ 270, + /* U+0041+0308 -> U+00C4 */ 18, + /* U+0041+0309 -> U+1EA2 */ 1312, + /* U+0041+030A -> U+00C5 */ 19, + /* U+0041+030C -> U+01CD */ 194, + /* U+0041+030F -> U+0200 */ 240, + /* U+0041+0311 -> U+0202 */ 242, + /* U+0041+0323 -> U+1EA0 */ 1310, + /* U+0041+0325 -> U+1E00 */ 1154, + /* U+0041+0328 -> U+0104 */ 71, + /* U+0042+0307 -> U+1E02 */ 1156, + /* U+0042+0323 -> U+1E04 */ 1158, + /* U+0042+0331 -> U+1E06 */ 1160, + /* U+0043+0301 -> U+0106 */ 73, + /* U+0043+0302 -> U+0108 */ 75, + /* U+0043+0307 -> U+010A */ 77, + /* U+0043+030C -> U+010C */ 79, + /* U+0043+0327 -> U+00C7 */ 20, + /* U+0044+0307 -> U+1E0A */ 1164, + /* U+0044+030C -> U+010E */ 81, + /* U+0044+0323 -> U+1E0C */ 1166, + /* U+0044+0327 -> U+1E10 */ 1170, + /* U+0044+032D -> U+1E12 */ 1172, + /* U+0044+0331 -> U+1E0E */ 1168, + /* U+0045+0300 -> U+00C8 */ 21, + /* U+0045+0301 -> U+00C9 */ 22, + /* U+0045+0302 -> U+00CA */ 23, + /* U+0045+0303 -> U+1EBC */ 1338, + /* U+0045+0304 -> U+0112 */ 83, + /* U+0045+0306 -> U+0114 */ 85, + /* U+0045+0307 -> U+0116 */ 87, + /* U+0045+0308 -> U+00CB */ 24, + /* U+0045+0309 -> U+1EBA */ 1336, + /* U+0045+030C -> U+011A */ 91, + /* U+0045+030F -> U+0204 */ 244, + /* U+0045+0311 -> U+0206 */ 246, + /* U+0045+0323 -> U+1EB8 */ 1334, + /* U+0045+0327 -> U+0228 */ 272, + /* U+0045+0328 -> U+0118 */ 89, + /* U+0045+032D -> U+1E18 */ 1178, + /* U+0045+0330 -> U+1E1A */ 1180, + /* U+0046+0307 -> U+1E1E */ 1184, + /* U+0047+0301 -> U+01F4 */ 230, + /* U+0047+0302 -> U+011C */ 93, + /* U+0047+0304 -> U+1E20 */ 1186, + /* U+0047+0306 -> U+011E */ 95, + /* U+0047+0307 -> U+0120 */ 97, + /* U+0047+030C -> U+01E6 */ 216, + /* U+0047+0327 -> U+0122 */ 99, + /* U+0048+0302 -> U+0124 */ 101, + /* U+0048+0307 -> U+1E22 */ 1188, + /* U+0048+0308 -> U+1E26 */ 1192, + /* U+0048+030C -> U+021E */ 268, + /* U+0048+0323 -> U+1E24 */ 1190, + /* U+0048+0327 -> U+1E28 */ 1194, + /* U+0048+032E -> U+1E2A */ 1196, + /* U+0049+0300 -> U+00CC */ 25, + /* U+0049+0301 -> U+00CD */ 26, + /* U+0049+0302 -> U+00CE */ 27, + /* U+0049+0303 -> U+0128 */ 103, + /* U+0049+0304 -> U+012A */ 105, + /* U+0049+0306 -> U+012C */ 107, + /* U+0049+0307 -> U+0130 */ 111, + /* U+0049+0308 -> U+00CF */ 28, + /* U+0049+0309 -> U+1EC8 */ 1350, + /* U+0049+030C -> U+01CF */ 196, + /* U+0049+030F -> U+0208 */ 248, + /* U+0049+0311 -> U+020A */ 250, + /* U+0049+0323 -> U+1ECA */ 1352, + /* U+0049+0328 -> U+012E */ 109, + /* U+0049+0330 -> U+1E2C */ 1198, + /* U+004A+0302 -> U+0134 */ 114, + /* U+004B+0301 -> U+1E30 */ 1202, + /* U+004B+030C -> U+01E8 */ 218, + /* U+004B+0323 -> U+1E32 */ 1204, + /* U+004B+0327 -> U+0136 */ 116, + /* U+004B+0331 -> U+1E34 */ 1206, + /* U+004C+0301 -> U+0139 */ 118, + /* U+004C+030C -> U+013D */ 122, + /* U+004C+0323 -> U+1E36 */ 1208, + /* U+004C+0327 -> U+013B */ 120, + /* U+004C+032D -> U+1E3C */ 1214, + /* U+004C+0331 -> U+1E3A */ 1212, + /* U+004D+0301 -> U+1E3E */ 1216, + /* U+004D+0307 -> U+1E40 */ 1218, + /* U+004D+0323 -> U+1E42 */ 1220, + /* U+004E+0300 -> U+01F8 */ 232, + /* U+004E+0301 -> U+0143 */ 126, + /* U+004E+0303 -> U+00D1 */ 29, + /* U+004E+0307 -> U+1E44 */ 1222, + /* U+004E+030C -> U+0147 */ 130, + /* U+004E+0323 -> U+1E46 */ 1224, + /* U+004E+0327 -> U+0145 */ 128, + /* U+004E+032D -> U+1E4A */ 1228, + /* U+004E+0331 -> U+1E48 */ 1226, + /* U+004F+0300 -> U+00D2 */ 30, + /* U+004F+0301 -> U+00D3 */ 31, + /* U+004F+0302 -> U+00D4 */ 32, + /* U+004F+0303 -> U+00D5 */ 33, + /* U+004F+0304 -> U+014C */ 133, + /* U+004F+0306 -> U+014E */ 135, + /* U+004F+0307 -> U+022E */ 278, + /* U+004F+0308 -> U+00D6 */ 34, + /* U+004F+0309 -> U+1ECE */ 1356, + /* U+004F+030B -> U+0150 */ 137, + /* U+004F+030C -> U+01D1 */ 198, + /* U+004F+030F -> U+020C */ 252, + /* U+004F+0311 -> U+020E */ 254, + /* U+004F+031B -> U+01A0 */ 181, + /* U+004F+0323 -> U+1ECC */ 1354, + /* U+004F+0328 -> U+01EA */ 220, + /* U+0050+0301 -> U+1E54 */ 1238, + /* U+0050+0307 -> U+1E56 */ 1240, + /* U+0052+0301 -> U+0154 */ 139, + /* U+0052+0307 -> U+1E58 */ 1242, + /* U+0052+030C -> U+0158 */ 143, + /* U+0052+030F -> U+0210 */ 256, + /* U+0052+0311 -> U+0212 */ 258, + /* U+0052+0323 -> U+1E5A */ 1244, + /* U+0052+0327 -> U+0156 */ 141, + /* U+0052+0331 -> U+1E5E */ 1248, + /* U+0053+0301 -> U+015A */ 145, + /* U+0053+0302 -> U+015C */ 147, + /* U+0053+0307 -> U+1E60 */ 1250, + /* U+0053+030C -> U+0160 */ 151, + /* U+0053+0323 -> U+1E62 */ 1252, + /* U+0053+0326 -> U+0218 */ 264, + /* U+0053+0327 -> U+015E */ 149, + /* U+0054+0307 -> U+1E6A */ 1260, + /* U+0054+030C -> U+0164 */ 155, + /* U+0054+0323 -> U+1E6C */ 1262, + /* U+0054+0326 -> U+021A */ 266, + /* U+0054+0327 -> U+0162 */ 153, + /* U+0054+032D -> U+1E70 */ 1266, + /* U+0054+0331 -> U+1E6E */ 1264, + /* U+0055+0300 -> U+00D9 */ 35, + /* U+0055+0301 -> U+00DA */ 36, + /* U+0055+0302 -> U+00DB */ 37, + /* U+0055+0303 -> U+0168 */ 157, + /* U+0055+0304 -> U+016A */ 159, + /* U+0055+0306 -> U+016C */ 161, + /* U+0055+0308 -> U+00DC */ 38, + /* U+0055+0309 -> U+1EE6 */ 1380, + /* U+0055+030A -> U+016E */ 163, + /* U+0055+030B -> U+0170 */ 165, + /* U+0055+030C -> U+01D3 */ 200, + /* U+0055+030F -> U+0214 */ 260, + /* U+0055+0311 -> U+0216 */ 262, + /* U+0055+031B -> U+01AF */ 183, + /* U+0055+0323 -> U+1EE4 */ 1378, + /* U+0055+0324 -> U+1E72 */ 1268, + /* U+0055+0328 -> U+0172 */ 167, + /* U+0055+032D -> U+1E76 */ 1272, + /* U+0055+0330 -> U+1E74 */ 1270, + /* U+0056+0303 -> U+1E7C */ 1278, + /* U+0056+0323 -> U+1E7E */ 1280, + /* U+0057+0300 -> U+1E80 */ 1282, + /* U+0057+0301 -> U+1E82 */ 1284, + /* U+0057+0302 -> U+0174 */ 169, + /* U+0057+0307 -> U+1E86 */ 1288, + /* U+0057+0308 -> U+1E84 */ 1286, + /* U+0057+0323 -> U+1E88 */ 1290, + /* U+0058+0307 -> U+1E8A */ 1292, + /* U+0058+0308 -> U+1E8C */ 1294, + /* U+0059+0300 -> U+1EF2 */ 1392, + /* U+0059+0301 -> U+00DD */ 39, + /* U+0059+0302 -> U+0176 */ 171, + /* U+0059+0303 -> U+1EF8 */ 1398, + /* U+0059+0304 -> U+0232 */ 282, + /* U+0059+0307 -> U+1E8E */ 1296, + /* U+0059+0308 -> U+0178 */ 173, + /* U+0059+0309 -> U+1EF6 */ 1396, + /* U+0059+0323 -> U+1EF4 */ 1394, + /* U+005A+0301 -> U+0179 */ 174, + /* U+005A+0302 -> U+1E90 */ 1298, + /* U+005A+0307 -> U+017B */ 176, + /* U+005A+030C -> U+017D */ 178, + /* U+005A+0323 -> U+1E92 */ 1300, + /* U+005A+0331 -> U+1E94 */ 1302, + /* U+0061+0300 -> U+00E0 */ 40, + /* U+0061+0301 -> U+00E1 */ 41, + /* U+0061+0302 -> U+00E2 */ 42, + /* U+0061+0303 -> U+00E3 */ 43, + /* U+0061+0304 -> U+0101 */ 68, + /* U+0061+0306 -> U+0103 */ 70, + /* U+0061+0307 -> U+0227 */ 271, + /* U+0061+0308 -> U+00E4 */ 44, + /* U+0061+0309 -> U+1EA3 */ 1313, + /* U+0061+030A -> U+00E5 */ 45, + /* U+0061+030C -> U+01CE */ 195, + /* U+0061+030F -> U+0201 */ 241, + /* U+0061+0311 -> U+0203 */ 243, + /* U+0061+0323 -> U+1EA1 */ 1311, + /* U+0061+0325 -> U+1E01 */ 1155, + /* U+0061+0328 -> U+0105 */ 72, + /* U+0062+0307 -> U+1E03 */ 1157, + /* U+0062+0323 -> U+1E05 */ 1159, + /* U+0062+0331 -> U+1E07 */ 1161, + /* U+0063+0301 -> U+0107 */ 74, + /* U+0063+0302 -> U+0109 */ 76, + /* U+0063+0307 -> U+010B */ 78, + /* U+0063+030C -> U+010D */ 80, + /* U+0063+0327 -> U+00E7 */ 46, + /* U+0064+0307 -> U+1E0B */ 1165, + /* U+0064+030C -> U+010F */ 82, + /* U+0064+0323 -> U+1E0D */ 1167, + /* U+0064+0327 -> U+1E11 */ 1171, + /* U+0064+032D -> U+1E13 */ 1173, + /* U+0064+0331 -> U+1E0F */ 1169, + /* U+0065+0300 -> U+00E8 */ 47, + /* U+0065+0301 -> U+00E9 */ 48, + /* U+0065+0302 -> U+00EA */ 49, + /* U+0065+0303 -> U+1EBD */ 1339, + /* U+0065+0304 -> U+0113 */ 84, + /* U+0065+0306 -> U+0115 */ 86, + /* U+0065+0307 -> U+0117 */ 88, + /* U+0065+0308 -> U+00EB */ 50, + /* U+0065+0309 -> U+1EBB */ 1337, + /* U+0065+030C -> U+011B */ 92, + /* U+0065+030F -> U+0205 */ 245, + /* U+0065+0311 -> U+0207 */ 247, + /* U+0065+0323 -> U+1EB9 */ 1335, + /* U+0065+0327 -> U+0229 */ 273, + /* U+0065+0328 -> U+0119 */ 90, + /* U+0065+032D -> U+1E19 */ 1179, + /* U+0065+0330 -> U+1E1B */ 1181, + /* U+0066+0307 -> U+1E1F */ 1185, + /* U+0067+0301 -> U+01F5 */ 231, + /* U+0067+0302 -> U+011D */ 94, + /* U+0067+0304 -> U+1E21 */ 1187, + /* U+0067+0306 -> U+011F */ 96, + /* U+0067+0307 -> U+0121 */ 98, + /* U+0067+030C -> U+01E7 */ 217, + /* U+0067+0327 -> U+0123 */ 100, + /* U+0068+0302 -> U+0125 */ 102, + /* U+0068+0307 -> U+1E23 */ 1189, + /* U+0068+0308 -> U+1E27 */ 1193, + /* U+0068+030C -> U+021F */ 269, + /* U+0068+0323 -> U+1E25 */ 1191, + /* U+0068+0327 -> U+1E29 */ 1195, + /* U+0068+032E -> U+1E2B */ 1197, + /* U+0068+0331 -> U+1E96 */ 1304, + /* U+0069+0300 -> U+00EC */ 51, + /* U+0069+0301 -> U+00ED */ 52, + /* U+0069+0302 -> U+00EE */ 53, + /* U+0069+0303 -> U+0129 */ 104, + /* U+0069+0304 -> U+012B */ 106, + /* U+0069+0306 -> U+012D */ 108, + /* U+0069+0308 -> U+00EF */ 54, + /* U+0069+0309 -> U+1EC9 */ 1351, + /* U+0069+030C -> U+01D0 */ 197, + /* U+0069+030F -> U+0209 */ 249, + /* U+0069+0311 -> U+020B */ 251, + /* U+0069+0323 -> U+1ECB */ 1353, + /* U+0069+0328 -> U+012F */ 110, + /* U+0069+0330 -> U+1E2D */ 1199, + /* U+006A+0302 -> U+0135 */ 115, + /* U+006A+030C -> U+01F0 */ 226, + /* U+006B+0301 -> U+1E31 */ 1203, + /* U+006B+030C -> U+01E9 */ 219, + /* U+006B+0323 -> U+1E33 */ 1205, + /* U+006B+0327 -> U+0137 */ 117, + /* U+006B+0331 -> U+1E35 */ 1207, + /* U+006C+0301 -> U+013A */ 119, + /* U+006C+030C -> U+013E */ 123, + /* U+006C+0323 -> U+1E37 */ 1209, + /* U+006C+0327 -> U+013C */ 121, + /* U+006C+032D -> U+1E3D */ 1215, + /* U+006C+0331 -> U+1E3B */ 1213, + /* U+006D+0301 -> U+1E3F */ 1217, + /* U+006D+0307 -> U+1E41 */ 1219, + /* U+006D+0323 -> U+1E43 */ 1221, + /* U+006E+0300 -> U+01F9 */ 233, + /* U+006E+0301 -> U+0144 */ 127, + /* U+006E+0303 -> U+00F1 */ 55, + /* U+006E+0307 -> U+1E45 */ 1223, + /* U+006E+030C -> U+0148 */ 131, + /* U+006E+0323 -> U+1E47 */ 1225, + /* U+006E+0327 -> U+0146 */ 129, + /* U+006E+032D -> U+1E4B */ 1229, + /* U+006E+0331 -> U+1E49 */ 1227, + /* U+006F+0300 -> U+00F2 */ 56, + /* U+006F+0301 -> U+00F3 */ 57, + /* U+006F+0302 -> U+00F4 */ 58, + /* U+006F+0303 -> U+00F5 */ 59, + /* U+006F+0304 -> U+014D */ 134, + /* U+006F+0306 -> U+014F */ 136, + /* U+006F+0307 -> U+022F */ 279, + /* U+006F+0308 -> U+00F6 */ 60, + /* U+006F+0309 -> U+1ECF */ 1357, + /* U+006F+030B -> U+0151 */ 138, + /* U+006F+030C -> U+01D2 */ 199, + /* U+006F+030F -> U+020D */ 253, + /* U+006F+0311 -> U+020F */ 255, + /* U+006F+031B -> U+01A1 */ 182, + /* U+006F+0323 -> U+1ECD */ 1355, + /* U+006F+0328 -> U+01EB */ 221, + /* U+0070+0301 -> U+1E55 */ 1239, + /* U+0070+0307 -> U+1E57 */ 1241, + /* U+0072+0301 -> U+0155 */ 140, + /* U+0072+0307 -> U+1E59 */ 1243, + /* U+0072+030C -> U+0159 */ 144, + /* U+0072+030F -> U+0211 */ 257, + /* U+0072+0311 -> U+0213 */ 259, + /* U+0072+0323 -> U+1E5B */ 1245, + /* U+0072+0327 -> U+0157 */ 142, + /* U+0072+0331 -> U+1E5F */ 1249, + /* U+0073+0301 -> U+015B */ 146, + /* U+0073+0302 -> U+015D */ 148, + /* U+0073+0307 -> U+1E61 */ 1251, + /* U+0073+030C -> U+0161 */ 152, + /* U+0073+0323 -> U+1E63 */ 1253, + /* U+0073+0326 -> U+0219 */ 265, + /* U+0073+0327 -> U+015F */ 150, + /* U+0074+0307 -> U+1E6B */ 1261, + /* U+0074+0308 -> U+1E97 */ 1305, + /* U+0074+030C -> U+0165 */ 156, + /* U+0074+0323 -> U+1E6D */ 1263, + /* U+0074+0326 -> U+021B */ 267, + /* U+0074+0327 -> U+0163 */ 154, + /* U+0074+032D -> U+1E71 */ 1267, + /* U+0074+0331 -> U+1E6F */ 1265, + /* U+0075+0300 -> U+00F9 */ 61, + /* U+0075+0301 -> U+00FA */ 62, + /* U+0075+0302 -> U+00FB */ 63, + /* U+0075+0303 -> U+0169 */ 158, + /* U+0075+0304 -> U+016B */ 160, + /* U+0075+0306 -> U+016D */ 162, + /* U+0075+0308 -> U+00FC */ 64, + /* U+0075+0309 -> U+1EE7 */ 1381, + /* U+0075+030A -> U+016F */ 164, + /* U+0075+030B -> U+0171 */ 166, + /* U+0075+030C -> U+01D4 */ 201, + /* U+0075+030F -> U+0215 */ 261, + /* U+0075+0311 -> U+0217 */ 263, + /* U+0075+031B -> U+01B0 */ 184, + /* U+0075+0323 -> U+1EE5 */ 1379, + /* U+0075+0324 -> U+1E73 */ 1269, + /* U+0075+0328 -> U+0173 */ 168, + /* U+0075+032D -> U+1E77 */ 1273, + /* U+0075+0330 -> U+1E75 */ 1271, + /* U+0076+0303 -> U+1E7D */ 1279, + /* U+0076+0323 -> U+1E7F */ 1281, + /* U+0077+0300 -> U+1E81 */ 1283, + /* U+0077+0301 -> U+1E83 */ 1285, + /* U+0077+0302 -> U+0175 */ 170, + /* U+0077+0307 -> U+1E87 */ 1289, + /* U+0077+0308 -> U+1E85 */ 1287, + /* U+0077+030A -> U+1E98 */ 1306, + /* U+0077+0323 -> U+1E89 */ 1291, + /* U+0078+0307 -> U+1E8B */ 1293, + /* U+0078+0308 -> U+1E8D */ 1295, + /* U+0079+0300 -> U+1EF3 */ 1393, + /* U+0079+0301 -> U+00FD */ 65, + /* U+0079+0302 -> U+0177 */ 172, + /* U+0079+0303 -> U+1EF9 */ 1399, + /* U+0079+0304 -> U+0233 */ 283, + /* U+0079+0307 -> U+1E8F */ 1297, + /* U+0079+0308 -> U+00FF */ 66, + /* U+0079+0309 -> U+1EF7 */ 1397, + /* U+0079+030A -> U+1E99 */ 1307, + /* U+0079+0323 -> U+1EF5 */ 1395, + /* U+007A+0301 -> U+017A */ 175, + /* U+007A+0302 -> U+1E91 */ 1299, + /* U+007A+0307 -> U+017C */ 177, + /* U+007A+030C -> U+017E */ 179, + /* U+007A+0323 -> U+1E93 */ 1301, + /* U+007A+0331 -> U+1E95 */ 1303, + /* U+00A8+0300 -> U+1FED */ 1618, + /* U+00A8+0301 -> U+0385 */ 419, + /* U+00A8+0342 -> U+1FC1 */ 1578, + /* U+00C2+0300 -> U+1EA6 */ 1316, + /* U+00C2+0301 -> U+1EA4 */ 1314, + /* U+00C2+0303 -> U+1EAA */ 1320, + /* U+00C2+0309 -> U+1EA8 */ 1318, + /* U+00C4+0304 -> U+01DE */ 210, + /* U+00C5+0301 -> U+01FA */ 234, + /* U+00C6+0301 -> U+01FC */ 236, + /* U+00C6+0304 -> U+01E2 */ 214, + /* U+00C7+0301 -> U+1E08 */ 1162, + /* U+00CA+0300 -> U+1EC0 */ 1342, + /* U+00CA+0301 -> U+1EBE */ 1340, + /* U+00CA+0303 -> U+1EC4 */ 1346, + /* U+00CA+0309 -> U+1EC2 */ 1344, + /* U+00CF+0301 -> U+1E2E */ 1200, + /* U+00D4+0300 -> U+1ED2 */ 1360, + /* U+00D4+0301 -> U+1ED0 */ 1358, + /* U+00D4+0303 -> U+1ED6 */ 1364, + /* U+00D4+0309 -> U+1ED4 */ 1362, + /* U+00D5+0301 -> U+1E4C */ 1230, + /* U+00D5+0304 -> U+022C */ 276, + /* U+00D5+0308 -> U+1E4E */ 1232, + /* U+00D6+0304 -> U+022A */ 274, + /* U+00D8+0301 -> U+01FE */ 238, + /* U+00DC+0300 -> U+01DB */ 208, + /* U+00DC+0301 -> U+01D7 */ 204, + /* U+00DC+0304 -> U+01D5 */ 202, + /* U+00DC+030C -> U+01D9 */ 206, + /* U+00E2+0300 -> U+1EA7 */ 1317, + /* U+00E2+0301 -> U+1EA5 */ 1315, + /* U+00E2+0303 -> U+1EAB */ 1321, + /* U+00E2+0309 -> U+1EA9 */ 1319, + /* U+00E4+0304 -> U+01DF */ 211, + /* U+00E5+0301 -> U+01FB */ 235, + /* U+00E6+0301 -> U+01FD */ 237, + /* U+00E6+0304 -> U+01E3 */ 215, + /* U+00E7+0301 -> U+1E09 */ 1163, + /* U+00EA+0300 -> U+1EC1 */ 1343, + /* U+00EA+0301 -> U+1EBF */ 1341, + /* U+00EA+0303 -> U+1EC5 */ 1347, + /* U+00EA+0309 -> U+1EC3 */ 1345, + /* U+00EF+0301 -> U+1E2F */ 1201, + /* U+00F4+0300 -> U+1ED3 */ 1361, + /* U+00F4+0301 -> U+1ED1 */ 1359, + /* U+00F4+0303 -> U+1ED7 */ 1365, + /* U+00F4+0309 -> U+1ED5 */ 1363, + /* U+00F5+0301 -> U+1E4D */ 1231, + /* U+00F5+0304 -> U+022D */ 277, + /* U+00F5+0308 -> U+1E4F */ 1233, + /* U+00F6+0304 -> U+022B */ 275, + /* U+00F8+0301 -> U+01FF */ 239, + /* U+00FC+0300 -> U+01DC */ 209, + /* U+00FC+0301 -> U+01D8 */ 205, + /* U+00FC+0304 -> U+01D6 */ 203, + /* U+00FC+030C -> U+01DA */ 207, + /* U+0102+0300 -> U+1EB0 */ 1326, + /* U+0102+0301 -> U+1EAE */ 1324, + /* U+0102+0303 -> U+1EB4 */ 1330, + /* U+0102+0309 -> U+1EB2 */ 1328, + /* U+0103+0300 -> U+1EB1 */ 1327, + /* U+0103+0301 -> U+1EAF */ 1325, + /* U+0103+0303 -> U+1EB5 */ 1331, + /* U+0103+0309 -> U+1EB3 */ 1329, + /* U+0112+0300 -> U+1E14 */ 1174, + /* U+0112+0301 -> U+1E16 */ 1176, + /* U+0113+0300 -> U+1E15 */ 1175, + /* U+0113+0301 -> U+1E17 */ 1177, + /* U+014C+0300 -> U+1E50 */ 1234, + /* U+014C+0301 -> U+1E52 */ 1236, + /* U+014D+0300 -> U+1E51 */ 1235, + /* U+014D+0301 -> U+1E53 */ 1237, + /* U+015A+0307 -> U+1E64 */ 1254, + /* U+015B+0307 -> U+1E65 */ 1255, + /* U+0160+0307 -> U+1E66 */ 1256, + /* U+0161+0307 -> U+1E67 */ 1257, + /* U+0168+0301 -> U+1E78 */ 1274, + /* U+0169+0301 -> U+1E79 */ 1275, + /* U+016A+0308 -> U+1E7A */ 1276, + /* U+016B+0308 -> U+1E7B */ 1277, + /* U+017F+0307 -> U+1E9B */ 1309, + /* U+01A0+0300 -> U+1EDC */ 1370, + /* U+01A0+0301 -> U+1EDA */ 1368, + /* U+01A0+0303 -> U+1EE0 */ 1374, + /* U+01A0+0309 -> U+1EDE */ 1372, + /* U+01A0+0323 -> U+1EE2 */ 1376, + /* U+01A1+0300 -> U+1EDD */ 1371, + /* U+01A1+0301 -> U+1EDB */ 1369, + /* U+01A1+0303 -> U+1EE1 */ 1375, + /* U+01A1+0309 -> U+1EDF */ 1373, + /* U+01A1+0323 -> U+1EE3 */ 1377, + /* U+01AF+0300 -> U+1EEA */ 1384, + /* U+01AF+0301 -> U+1EE8 */ 1382, + /* U+01AF+0303 -> U+1EEE */ 1388, + /* U+01AF+0309 -> U+1EEC */ 1386, + /* U+01AF+0323 -> U+1EF0 */ 1390, + /* U+01B0+0300 -> U+1EEB */ 1385, + /* U+01B0+0301 -> U+1EE9 */ 1383, + /* U+01B0+0303 -> U+1EEF */ 1389, + /* U+01B0+0309 -> U+1EED */ 1387, + /* U+01B0+0323 -> U+1EF1 */ 1391, + /* U+01B7+030C -> U+01EE */ 224, + /* U+01EA+0304 -> U+01EC */ 222, + /* U+01EB+0304 -> U+01ED */ 223, + /* U+0226+0304 -> U+01E0 */ 212, + /* U+0227+0304 -> U+01E1 */ 213, + /* U+0228+0306 -> U+1E1C */ 1182, + /* U+0229+0306 -> U+1E1D */ 1183, + /* U+022E+0304 -> U+0230 */ 280, + /* U+022F+0304 -> U+0231 */ 281, + /* U+0292+030C -> U+01EF */ 225, + /* U+0391+0300 -> U+1FBA */ 1571, + /* U+0391+0301 -> U+0386 */ 420, + /* U+0391+0304 -> U+1FB9 */ 1570, + /* U+0391+0306 -> U+1FB8 */ 1569, + /* U+0391+0313 -> U+1F08 */ 1408, + /* U+0391+0314 -> U+1F09 */ 1409, + /* U+0391+0345 -> U+1FBC */ 1573, + /* U+0395+0300 -> U+1FC8 */ 1584, + /* U+0395+0301 -> U+0388 */ 422, + /* U+0395+0313 -> U+1F18 */ 1422, + /* U+0395+0314 -> U+1F19 */ 1423, + /* U+0397+0300 -> U+1FCA */ 1586, + /* U+0397+0301 -> U+0389 */ 423, + /* U+0397+0313 -> U+1F28 */ 1436, + /* U+0397+0314 -> U+1F29 */ 1437, + /* U+0397+0345 -> U+1FCC */ 1588, + /* U+0399+0300 -> U+1FDA */ 1600, + /* U+0399+0301 -> U+038A */ 424, + /* U+0399+0304 -> U+1FD9 */ 1599, + /* U+0399+0306 -> U+1FD8 */ 1598, + /* U+0399+0308 -> U+03AA */ 429, + /* U+0399+0313 -> U+1F38 */ 1452, + /* U+0399+0314 -> U+1F39 */ 1453, + /* U+039F+0300 -> U+1FF8 */ 1626, + /* U+039F+0301 -> U+038C */ 425, + /* U+039F+0313 -> U+1F48 */ 1466, + /* U+039F+0314 -> U+1F49 */ 1467, + /* U+03A1+0314 -> U+1FEC */ 1617, + /* U+03A5+0300 -> U+1FEA */ 1615, + /* U+03A5+0301 -> U+038E */ 426, + /* U+03A5+0304 -> U+1FE9 */ 1614, + /* U+03A5+0306 -> U+1FE8 */ 1613, + /* U+03A5+0308 -> U+03AB */ 430, + /* U+03A5+0314 -> U+1F59 */ 1480, + /* U+03A9+0300 -> U+1FFA */ 1628, + /* U+03A9+0301 -> U+038F */ 427, + /* U+03A9+0313 -> U+1F68 */ 1492, + /* U+03A9+0314 -> U+1F69 */ 1493, + /* U+03A9+0345 -> U+1FFC */ 1630, + /* U+03AC+0345 -> U+1FB4 */ 1566, + /* U+03AE+0345 -> U+1FC4 */ 1581, + /* U+03B1+0300 -> U+1F70 */ 1500, + /* U+03B1+0301 -> U+03AC */ 431, + /* U+03B1+0304 -> U+1FB1 */ 1563, + /* U+03B1+0306 -> U+1FB0 */ 1562, + /* U+03B1+0313 -> U+1F00 */ 1400, + /* U+03B1+0314 -> U+1F01 */ 1401, + /* U+03B1+0342 -> U+1FB6 */ 1567, + /* U+03B1+0345 -> U+1FB3 */ 1565, + /* U+03B5+0300 -> U+1F72 */ 1502, + /* U+03B5+0301 -> U+03AD */ 432, + /* U+03B5+0313 -> U+1F10 */ 1416, + /* U+03B5+0314 -> U+1F11 */ 1417, + /* U+03B7+0300 -> U+1F74 */ 1504, + /* U+03B7+0301 -> U+03AE */ 433, + /* U+03B7+0313 -> U+1F20 */ 1428, + /* U+03B7+0314 -> U+1F21 */ 1429, + /* U+03B7+0342 -> U+1FC6 */ 1582, + /* U+03B7+0345 -> U+1FC3 */ 1580, + /* U+03B9+0300 -> U+1F76 */ 1506, + /* U+03B9+0301 -> U+03AF */ 434, + /* U+03B9+0304 -> U+1FD1 */ 1593, + /* U+03B9+0306 -> U+1FD0 */ 1592, + /* U+03B9+0308 -> U+03CA */ 436, + /* U+03B9+0313 -> U+1F30 */ 1444, + /* U+03B9+0314 -> U+1F31 */ 1445, + /* U+03B9+0342 -> U+1FD6 */ 1596, + /* U+03BF+0300 -> U+1F78 */ 1508, + /* U+03BF+0301 -> U+03CC */ 438, + /* U+03BF+0313 -> U+1F40 */ 1460, + /* U+03BF+0314 -> U+1F41 */ 1461, + /* U+03C1+0313 -> U+1FE4 */ 1609, + /* U+03C1+0314 -> U+1FE5 */ 1610, + /* U+03C5+0300 -> U+1F7A */ 1510, + /* U+03C5+0301 -> U+03CD */ 439, + /* U+03C5+0304 -> U+1FE1 */ 1606, + /* U+03C5+0306 -> U+1FE0 */ 1605, + /* U+03C5+0308 -> U+03CB */ 437, + /* U+03C5+0313 -> U+1F50 */ 1472, + /* U+03C5+0314 -> U+1F51 */ 1473, + /* U+03C5+0342 -> U+1FE6 */ 1611, + /* U+03C9+0300 -> U+1F7C */ 1512, + /* U+03C9+0301 -> U+03CE */ 440, + /* U+03C9+0313 -> U+1F60 */ 1484, + /* U+03C9+0314 -> U+1F61 */ 1485, + /* U+03C9+0342 -> U+1FF6 */ 1624, + /* U+03C9+0345 -> U+1FF3 */ 1622, + /* U+03CA+0300 -> U+1FD2 */ 1594, + /* U+03CA+0301 -> U+0390 */ 428, + /* U+03CA+0342 -> U+1FD7 */ 1597, + /* U+03CB+0300 -> U+1FE2 */ 1607, + /* U+03CB+0301 -> U+03B0 */ 435, + /* U+03CB+0342 -> U+1FE7 */ 1612, + /* U+03CE+0345 -> U+1FF4 */ 1623, + /* U+03D2+0301 -> U+03D3 */ 444, + /* U+03D2+0308 -> U+03D4 */ 445, + /* U+0406+0308 -> U+0407 */ 457, + /* U+0410+0306 -> U+04D0 */ 479, + /* U+0410+0308 -> U+04D2 */ 481, + /* U+0413+0301 -> U+0403 */ 456, + /* U+0415+0300 -> U+0400 */ 454, + /* U+0415+0306 -> U+04D6 */ 483, + /* U+0415+0308 -> U+0401 */ 455, + /* U+0416+0306 -> U+04C1 */ 477, + /* U+0416+0308 -> U+04DC */ 487, + /* U+0417+0308 -> U+04DE */ 489, + /* U+0418+0300 -> U+040D */ 459, + /* U+0418+0304 -> U+04E2 */ 491, + /* U+0418+0306 -> U+0419 */ 461, + /* U+0418+0308 -> U+04E4 */ 493, + /* U+041A+0301 -> U+040C */ 458, + /* U+041E+0308 -> U+04E6 */ 495, + /* U+0423+0304 -> U+04EE */ 501, + /* U+0423+0306 -> U+040E */ 460, + /* U+0423+0308 -> U+04F0 */ 503, + /* U+0423+030B -> U+04F2 */ 505, + /* U+0427+0308 -> U+04F4 */ 507, + /* U+042B+0308 -> U+04F8 */ 509, + /* U+042D+0308 -> U+04EC */ 499, + /* U+0430+0306 -> U+04D1 */ 480, + /* U+0430+0308 -> U+04D3 */ 482, + /* U+0433+0301 -> U+0453 */ 465, + /* U+0435+0300 -> U+0450 */ 463, + /* U+0435+0306 -> U+04D7 */ 484, + /* U+0435+0308 -> U+0451 */ 464, + /* U+0436+0306 -> U+04C2 */ 478, + /* U+0436+0308 -> U+04DD */ 488, + /* U+0437+0308 -> U+04DF */ 490, + /* U+0438+0300 -> U+045D */ 468, + /* U+0438+0304 -> U+04E3 */ 492, + /* U+0438+0306 -> U+0439 */ 462, + /* U+0438+0308 -> U+04E5 */ 494, + /* U+043A+0301 -> U+045C */ 467, + /* U+043E+0308 -> U+04E7 */ 496, + /* U+0443+0304 -> U+04EF */ 502, + /* U+0443+0306 -> U+045E */ 469, + /* U+0443+0308 -> U+04F1 */ 504, + /* U+0443+030B -> U+04F3 */ 506, + /* U+0447+0308 -> U+04F5 */ 508, + /* U+044B+0308 -> U+04F9 */ 510, + /* U+044D+0308 -> U+04ED */ 500, + /* U+0456+0308 -> U+0457 */ 466, + /* U+0474+030F -> U+0476 */ 470, + /* U+0475+030F -> U+0477 */ 471, + /* U+04D8+0308 -> U+04DA */ 485, + /* U+04D9+0308 -> U+04DB */ 486, + /* U+04E8+0308 -> U+04EA */ 497, + /* U+04E9+0308 -> U+04EB */ 498, + /* U+0627+0653 -> U+0622 */ 574, + /* U+0627+0654 -> U+0623 */ 575, + /* U+0627+0655 -> U+0625 */ 577, + /* U+0648+0654 -> U+0624 */ 576, + /* U+064A+0654 -> U+0626 */ 578, + /* U+06C1+0654 -> U+06C2 */ 606, + /* U+06D2+0654 -> U+06D3 */ 607, + /* U+06D5+0654 -> U+06C0 */ 605, + /* U+0928+093C -> U+0929 */ 750, + /* U+0930+093C -> U+0931 */ 751, + /* U+0933+093C -> U+0934 */ 752, + /* U+09C7+09BE -> U+09CB */ 768, + /* U+09C7+09D7 -> U+09CC */ 769, + /* U+0B47+0B3E -> U+0B4B */ 787, + /* U+0B47+0B56 -> U+0B48 */ 786, + /* U+0B47+0B57 -> U+0B4C */ 788, + /* U+0B92+0BD7 -> U+0B94 */ 792, + /* U+0BC6+0BBE -> U+0BCA */ 793, + /* U+0BC6+0BD7 -> U+0BCC */ 795, + /* U+0BC7+0BBE -> U+0BCB */ 794, + /* U+0C46+0C56 -> U+0C48 */ 798, + /* U+0CBF+0CD5 -> U+0CC0 */ 803, + /* U+0CC6+0CC2 -> U+0CCA */ 806, + /* U+0CC6+0CD5 -> U+0CC7 */ 804, + /* U+0CC6+0CD6 -> U+0CC8 */ 805, + /* U+0CCA+0CD5 -> U+0CCB */ 807, + /* U+0D46+0D3E -> U+0D4A */ 811, + /* U+0D46+0D57 -> U+0D4C */ 813, + /* U+0D47+0D3E -> U+0D4B */ 812, + /* U+0DD9+0DCA -> U+0DDA */ 816, + /* U+0DD9+0DCF -> U+0DDC */ 817, + /* U+0DD9+0DDF -> U+0DDE */ 819, + /* U+0DDC+0DCA -> U+0DDD */ 818, + /* U+1025+102E -> U+1026 */ 877, + /* U+1B05+1B35 -> U+1B06 */ 937, + /* U+1B07+1B35 -> U+1B08 */ 938, + /* U+1B09+1B35 -> U+1B0A */ 939, + /* U+1B0B+1B35 -> U+1B0C */ 940, + /* U+1B0D+1B35 -> U+1B0E */ 941, + /* U+1B11+1B35 -> U+1B12 */ 942, + /* U+1B3A+1B35 -> U+1B3B */ 944, + /* U+1B3C+1B35 -> U+1B3D */ 945, + /* U+1B3E+1B35 -> U+1B40 */ 946, + /* U+1B3F+1B35 -> U+1B41 */ 947, + /* U+1B42+1B35 -> U+1B43 */ 948, + /* U+1E36+0304 -> U+1E38 */ 1210, + /* U+1E37+0304 -> U+1E39 */ 1211, + /* U+1E5A+0304 -> U+1E5C */ 1246, + /* U+1E5B+0304 -> U+1E5D */ 1247, + /* U+1E62+0307 -> U+1E68 */ 1258, + /* U+1E63+0307 -> U+1E69 */ 1259, + /* U+1EA0+0302 -> U+1EAC */ 1322, + /* U+1EA0+0306 -> U+1EB6 */ 1332, + /* U+1EA1+0302 -> U+1EAD */ 1323, + /* U+1EA1+0306 -> U+1EB7 */ 1333, + /* U+1EB8+0302 -> U+1EC6 */ 1348, + /* U+1EB9+0302 -> U+1EC7 */ 1349, + /* U+1ECC+0302 -> U+1ED8 */ 1366, + /* U+1ECD+0302 -> U+1ED9 */ 1367, + /* U+1F00+0300 -> U+1F02 */ 1402, + /* U+1F00+0301 -> U+1F04 */ 1404, + /* U+1F00+0342 -> U+1F06 */ 1406, + /* U+1F00+0345 -> U+1F80 */ 1514, + /* U+1F01+0300 -> U+1F03 */ 1403, + /* U+1F01+0301 -> U+1F05 */ 1405, + /* U+1F01+0342 -> U+1F07 */ 1407, + /* U+1F01+0345 -> U+1F81 */ 1515, + /* U+1F02+0345 -> U+1F82 */ 1516, + /* U+1F03+0345 -> U+1F83 */ 1517, + /* U+1F04+0345 -> U+1F84 */ 1518, + /* U+1F05+0345 -> U+1F85 */ 1519, + /* U+1F06+0345 -> U+1F86 */ 1520, + /* U+1F07+0345 -> U+1F87 */ 1521, + /* U+1F08+0300 -> U+1F0A */ 1410, + /* U+1F08+0301 -> U+1F0C */ 1412, + /* U+1F08+0342 -> U+1F0E */ 1414, + /* U+1F08+0345 -> U+1F88 */ 1522, + /* U+1F09+0300 -> U+1F0B */ 1411, + /* U+1F09+0301 -> U+1F0D */ 1413, + /* U+1F09+0342 -> U+1F0F */ 1415, + /* U+1F09+0345 -> U+1F89 */ 1523, + /* U+1F0A+0345 -> U+1F8A */ 1524, + /* U+1F0B+0345 -> U+1F8B */ 1525, + /* U+1F0C+0345 -> U+1F8C */ 1526, + /* U+1F0D+0345 -> U+1F8D */ 1527, + /* U+1F0E+0345 -> U+1F8E */ 1528, + /* U+1F0F+0345 -> U+1F8F */ 1529, + /* U+1F10+0300 -> U+1F12 */ 1418, + /* U+1F10+0301 -> U+1F14 */ 1420, + /* U+1F11+0300 -> U+1F13 */ 1419, + /* U+1F11+0301 -> U+1F15 */ 1421, + /* U+1F18+0300 -> U+1F1A */ 1424, + /* U+1F18+0301 -> U+1F1C */ 1426, + /* U+1F19+0300 -> U+1F1B */ 1425, + /* U+1F19+0301 -> U+1F1D */ 1427, + /* U+1F20+0300 -> U+1F22 */ 1430, + /* U+1F20+0301 -> U+1F24 */ 1432, + /* U+1F20+0342 -> U+1F26 */ 1434, + /* U+1F20+0345 -> U+1F90 */ 1530, + /* U+1F21+0300 -> U+1F23 */ 1431, + /* U+1F21+0301 -> U+1F25 */ 1433, + /* U+1F21+0342 -> U+1F27 */ 1435, + /* U+1F21+0345 -> U+1F91 */ 1531, + /* U+1F22+0345 -> U+1F92 */ 1532, + /* U+1F23+0345 -> U+1F93 */ 1533, + /* U+1F24+0345 -> U+1F94 */ 1534, + /* U+1F25+0345 -> U+1F95 */ 1535, + /* U+1F26+0345 -> U+1F96 */ 1536, + /* U+1F27+0345 -> U+1F97 */ 1537, + /* U+1F28+0300 -> U+1F2A */ 1438, + /* U+1F28+0301 -> U+1F2C */ 1440, + /* U+1F28+0342 -> U+1F2E */ 1442, + /* U+1F28+0345 -> U+1F98 */ 1538, + /* U+1F29+0300 -> U+1F2B */ 1439, + /* U+1F29+0301 -> U+1F2D */ 1441, + /* U+1F29+0342 -> U+1F2F */ 1443, + /* U+1F29+0345 -> U+1F99 */ 1539, + /* U+1F2A+0345 -> U+1F9A */ 1540, + /* U+1F2B+0345 -> U+1F9B */ 1541, + /* U+1F2C+0345 -> U+1F9C */ 1542, + /* U+1F2D+0345 -> U+1F9D */ 1543, + /* U+1F2E+0345 -> U+1F9E */ 1544, + /* U+1F2F+0345 -> U+1F9F */ 1545, + /* U+1F30+0300 -> U+1F32 */ 1446, + /* U+1F30+0301 -> U+1F34 */ 1448, + /* U+1F30+0342 -> U+1F36 */ 1450, + /* U+1F31+0300 -> U+1F33 */ 1447, + /* U+1F31+0301 -> U+1F35 */ 1449, + /* U+1F31+0342 -> U+1F37 */ 1451, + /* U+1F38+0300 -> U+1F3A */ 1454, + /* U+1F38+0301 -> U+1F3C */ 1456, + /* U+1F38+0342 -> U+1F3E */ 1458, + /* U+1F39+0300 -> U+1F3B */ 1455, + /* U+1F39+0301 -> U+1F3D */ 1457, + /* U+1F39+0342 -> U+1F3F */ 1459, + /* U+1F40+0300 -> U+1F42 */ 1462, + /* U+1F40+0301 -> U+1F44 */ 1464, + /* U+1F41+0300 -> U+1F43 */ 1463, + /* U+1F41+0301 -> U+1F45 */ 1465, + /* U+1F48+0300 -> U+1F4A */ 1468, + /* U+1F48+0301 -> U+1F4C */ 1470, + /* U+1F49+0300 -> U+1F4B */ 1469, + /* U+1F49+0301 -> U+1F4D */ 1471, + /* U+1F50+0300 -> U+1F52 */ 1474, + /* U+1F50+0301 -> U+1F54 */ 1476, + /* U+1F50+0342 -> U+1F56 */ 1478, + /* U+1F51+0300 -> U+1F53 */ 1475, + /* U+1F51+0301 -> U+1F55 */ 1477, + /* U+1F51+0342 -> U+1F57 */ 1479, + /* U+1F59+0300 -> U+1F5B */ 1481, + /* U+1F59+0301 -> U+1F5D */ 1482, + /* U+1F59+0342 -> U+1F5F */ 1483, + /* U+1F60+0300 -> U+1F62 */ 1486, + /* U+1F60+0301 -> U+1F64 */ 1488, + /* U+1F60+0342 -> U+1F66 */ 1490, + /* U+1F60+0345 -> U+1FA0 */ 1546, + /* U+1F61+0300 -> U+1F63 */ 1487, + /* U+1F61+0301 -> U+1F65 */ 1489, + /* U+1F61+0342 -> U+1F67 */ 1491, + /* U+1F61+0345 -> U+1FA1 */ 1547, + /* U+1F62+0345 -> U+1FA2 */ 1548, + /* U+1F63+0345 -> U+1FA3 */ 1549, + /* U+1F64+0345 -> U+1FA4 */ 1550, + /* U+1F65+0345 -> U+1FA5 */ 1551, + /* U+1F66+0345 -> U+1FA6 */ 1552, + /* U+1F67+0345 -> U+1FA7 */ 1553, + /* U+1F68+0300 -> U+1F6A */ 1494, + /* U+1F68+0301 -> U+1F6C */ 1496, + /* U+1F68+0342 -> U+1F6E */ 1498, + /* U+1F68+0345 -> U+1FA8 */ 1554, + /* U+1F69+0300 -> U+1F6B */ 1495, + /* U+1F69+0301 -> U+1F6D */ 1497, + /* U+1F69+0342 -> U+1F6F */ 1499, + /* U+1F69+0345 -> U+1FA9 */ 1555, + /* U+1F6A+0345 -> U+1FAA */ 1556, + /* U+1F6B+0345 -> U+1FAB */ 1557, + /* U+1F6C+0345 -> U+1FAC */ 1558, + /* U+1F6D+0345 -> U+1FAD */ 1559, + /* U+1F6E+0345 -> U+1FAE */ 1560, + /* U+1F6F+0345 -> U+1FAF */ 1561, + /* U+1F70+0345 -> U+1FB2 */ 1564, + /* U+1F74+0345 -> U+1FC2 */ 1579, + /* U+1F7C+0345 -> U+1FF2 */ 1621, + /* U+1FB6+0345 -> U+1FB7 */ 1568, + /* U+1FBF+0300 -> U+1FCD */ 1589, + /* U+1FBF+0301 -> U+1FCE */ 1590, + /* U+1FBF+0342 -> U+1FCF */ 1591, + /* U+1FC6+0345 -> U+1FC7 */ 1583, + /* U+1FF6+0345 -> U+1FF7 */ 1625, + /* U+1FFE+0300 -> U+1FDD */ 1602, + /* U+1FFE+0301 -> U+1FDE */ 1603, + /* U+1FFE+0342 -> U+1FDF */ 1604, + /* U+2190+0338 -> U+219A */ 1835, + /* U+2192+0338 -> U+219B */ 1836, + /* U+2194+0338 -> U+21AE */ 1837, + /* U+21D0+0338 -> U+21CD */ 1838, + /* U+21D2+0338 -> U+21CF */ 1840, + /* U+21D4+0338 -> U+21CE */ 1839, + /* U+2203+0338 -> U+2204 */ 1841, + /* U+2208+0338 -> U+2209 */ 1842, + /* U+220B+0338 -> U+220C */ 1843, + /* U+2223+0338 -> U+2224 */ 1844, + /* U+2225+0338 -> U+2226 */ 1845, + /* U+223C+0338 -> U+2241 */ 1850, + /* U+2243+0338 -> U+2244 */ 1851, + /* U+2245+0338 -> U+2247 */ 1852, + /* U+2248+0338 -> U+2249 */ 1853, + /* U+224D+0338 -> U+226D */ 1856, + /* U+2261+0338 -> U+2262 */ 1855, + /* U+2264+0338 -> U+2270 */ 1859, + /* U+2265+0338 -> U+2271 */ 1860, + /* U+2272+0338 -> U+2274 */ 1861, + /* U+2273+0338 -> U+2275 */ 1862, + /* U+2276+0338 -> U+2278 */ 1863, + /* U+2277+0338 -> U+2279 */ 1864, + /* U+227A+0338 -> U+2280 */ 1865, + /* U+227B+0338 -> U+2281 */ 1866, + /* U+227C+0338 -> U+22E0 */ 1875, + /* U+227D+0338 -> U+22E1 */ 1876, + /* U+2282+0338 -> U+2284 */ 1867, + /* U+2283+0338 -> U+2285 */ 1868, + /* U+2286+0338 -> U+2288 */ 1869, + /* U+2287+0338 -> U+2289 */ 1870, + /* U+2291+0338 -> U+22E2 */ 1877, + /* U+2292+0338 -> U+22E3 */ 1878, + /* U+22A2+0338 -> U+22AC */ 1871, + /* U+22A8+0338 -> U+22AD */ 1872, + /* U+22A9+0338 -> U+22AE */ 1873, + /* U+22AB+0338 -> U+22AF */ 1874, + /* U+22B2+0338 -> U+22EA */ 1879, + /* U+22B3+0338 -> U+22EB */ 1880, + /* U+22B4+0338 -> U+22EC */ 1881, + /* U+22B5+0338 -> U+22ED */ 1882, + /* U+3046+3099 -> U+3094 */ 2320, + /* U+304B+3099 -> U+304C */ 2295, + /* U+304D+3099 -> U+304E */ 2296, + /* U+304F+3099 -> U+3050 */ 2297, + /* U+3051+3099 -> U+3052 */ 2298, + /* U+3053+3099 -> U+3054 */ 2299, + /* U+3055+3099 -> U+3056 */ 2300, + /* U+3057+3099 -> U+3058 */ 2301, + /* U+3059+3099 -> U+305A */ 2302, + /* U+305B+3099 -> U+305C */ 2303, + /* U+305D+3099 -> U+305E */ 2304, + /* U+305F+3099 -> U+3060 */ 2305, + /* U+3061+3099 -> U+3062 */ 2306, + /* U+3064+3099 -> U+3065 */ 2307, + /* U+3066+3099 -> U+3067 */ 2308, + /* U+3068+3099 -> U+3069 */ 2309, + /* U+306F+3099 -> U+3070 */ 2310, + /* U+306F+309A -> U+3071 */ 2311, + /* U+3072+3099 -> U+3073 */ 2312, + /* U+3072+309A -> U+3074 */ 2313, + /* U+3075+3099 -> U+3076 */ 2314, + /* U+3075+309A -> U+3077 */ 2315, + /* U+3078+3099 -> U+3079 */ 2316, + /* U+3078+309A -> U+307A */ 2317, + /* U+307B+3099 -> U+307C */ 2318, + /* U+307B+309A -> U+307D */ 2319, + /* U+309D+3099 -> U+309E */ 2325, + /* U+30A6+3099 -> U+30F4 */ 2352, + /* U+30AB+3099 -> U+30AC */ 2327, + /* U+30AD+3099 -> U+30AE */ 2328, + /* U+30AF+3099 -> U+30B0 */ 2329, + /* U+30B1+3099 -> U+30B2 */ 2330, + /* U+30B3+3099 -> U+30B4 */ 2331, + /* U+30B5+3099 -> U+30B6 */ 2332, + /* U+30B7+3099 -> U+30B8 */ 2333, + /* U+30B9+3099 -> U+30BA */ 2334, + /* U+30BB+3099 -> U+30BC */ 2335, + /* U+30BD+3099 -> U+30BE */ 2336, + /* U+30BF+3099 -> U+30C0 */ 2337, + /* U+30C1+3099 -> U+30C2 */ 2338, + /* U+30C4+3099 -> U+30C5 */ 2339, + /* U+30C6+3099 -> U+30C7 */ 2340, + /* U+30C8+3099 -> U+30C9 */ 2341, + /* U+30CF+3099 -> U+30D0 */ 2342, + /* U+30CF+309A -> U+30D1 */ 2343, + /* U+30D2+3099 -> U+30D3 */ 2344, + /* U+30D2+309A -> U+30D4 */ 2345, + /* U+30D5+3099 -> U+30D6 */ 2346, + /* U+30D5+309A -> U+30D7 */ 2347, + /* U+30D8+3099 -> U+30D9 */ 2348, + /* U+30D8+309A -> U+30DA */ 2349, + /* U+30DB+3099 -> U+30DC */ 2350, + /* U+30DB+309A -> U+30DD */ 2351, + /* U+30EF+3099 -> U+30F7 */ 2353, + /* U+30F0+3099 -> U+30F8 */ 2354, + /* U+30F1+3099 -> U+30F9 */ 2355, + /* U+30F2+3099 -> U+30FA */ 2356, + /* U+30FD+3099 -> U+30FE */ 2357, + /* U+11099+110BA -> U+1109A */ 4689, + /* U+1109B+110BA -> U+1109C */ 4690, + /* U+110A5+110BA -> U+110AB */ 4691, + /* U+11131+11127 -> U+1112E */ 4697, + /* U+11132+11127 -> U+1112F */ 4698, + /* U+11347+1133E -> U+1134B */ 4710, + /* U+11347+11357 -> U+1134C */ 4711, + /* U+114B9+114B0 -> U+114BC */ 4729, + /* U+114B9+114BA -> U+114BB */ 4728, + /* U+114B9+114BD -> U+114BE */ 4730, + /* U+115B8+115AF -> U+115BA */ 4733, + /* U+115B9+115AF -> U+115BB */ 4734, + /* U+11935+11930 -> U+11938 */ 4743 +}; + +/* Perfect hash function for recomposition */ +static int +Recomp_hash_func(const void *key) +{ + static const int16 h[1883] = { + 772, 773, 621, 32767, 32767, 387, 653, 196, + 32767, 32767, 855, 463, -19, 651, 32767, 32767, + 32767, 364, 32767, 32767, -108, 32767, 32767, 32767, + 32767, 0, -568, 32767, 32767, 32767, 0, 0, + 0, -103, 364, 0, 210, 732, 0, 0, + -506, 0, 0, 0, 32767, 32767, 0, 32767, + 407, -140, 32767, 409, 32767, 772, 0, 86, + 842, 934, 32767, 32767, -499, -355, 32767, 32767, + 532, 138, 174, -243, 860, 1870, 742, 32767, + 32767, 339, 32767, 1290, 0, 32767, 32767, 0, + -449, -1386, 1633, 560, 561, 32767, 1219, 1004, + 139, -804, 32767, -179, 141, 579, 1586, 32767, + 32767, 32767, 142, 199, 32767, 32767, 143, 0, + 32767, 32767, 314, 896, 32767, 32767, 428, 129, + 286, -58, 0, 68, 32767, 0, 244, -566, + 32767, 32767, 32767, 246, 32767, 32767, 0, 32767, + 32767, 271, -108, 928, 32767, 715, 32767, 32767, + -211, -497, 32767, 0, 1055, 1339, 32767, 0, + 32767, 32767, -968, -144, 32767, 32767, 248, 32767, + -161, 32767, 32767, 282, 32767, -372, 0, 2, + -137, 1116, 32767, 687, 32767, 459, 913, 0, + 461, 879, -816, 443, 32767, 32767, 462, 1089, + 32767, 1054, 0, 314, 447, -26, 480, 32767, + 64, 0, 0, 112, 32767, 66, 0, 646, + 603, 22, -292, 0, 710, 475, 32767, 24, + -781, 32767, 32767, 32767, 281, 307, 32767, 1289, + 32767, 0, 1064, -149, 454, 118, 32767, 32767, + 0, 32767, -126, 0, 32767, 32767, 858, 32767, + 32767, 32767, 1029, 886, 665, 209, 0, 26, + 359, 0, 0, -108, -508, -603, 894, 906, + 32767, 32767, 14, 0, 0, 534, 984, 876, + 32767, -93, 110, -367, 167, 843, 32767, 32767, + -947, -290, 169, 0, 0, 32767, -42, 564, + 0, -927, 32767, 817, 32767, 32767, 32767, 110, + 0, 32767, 32767, -38, 32767, 32767, -101, 694, + -142, 190, 191, 1288, 32767, -687, 194, -579, + 534, -452, 0, -72, 536, 765, 823, 266, + -259, 684, 767, 32767, 654, 32767, 32767, 64, + 920, 32767, 32767, 32767, 0, 1653, 0, 0, + 32767, 32767, -452, -222, 855, 0, 32767, -1153, + 127, 490, 449, 863, 32767, -144, 32767, -379, + 545, 32767, 32767, 32767, 530, 32767, 32767, 1331, + 611, -612, 332, 545, -73, 0, 604, 201, + 32767, -279, 338, 836, 340, 408, 32767, -60, + -358, 32767, 343, 69, 707, 0, -129, 582, + 32767, 0, 32767, 96, 392, 490, 639, 157, + -4, 406, 32767, 32767, -571, 1077, 546, 32767, + 551, 0, 0, 0, 32767, 32767, 348, 32767, + 498, -181, 0, -433, 1057, 260, 0, 32767, + 32767, 397, 32767, 816, -130, 32767, 624, 0, + 0, 32767, 32767, 32767, 485, 0, 32767, 32767, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 1222, + -230, 32767, 797, -538, 32767, 974, 32767, 32767, + 831, 70, -658, 145, 0, 147, 0, 32767, + 1295, 32767, 0, 0, 895, 0, 0, -385, + 491, -287, 32767, -587, 32767, 32767, 32767, 813, + -471, -13, 32767, 32767, 32767, 0, 203, 411, + 470, 0, -546, -179, 146, 0, 0, 32767, + -468, 32767, 0, 0, 32767, 32767, 32767, 211, + 32767, 32767, 0, 32767, 0, 52, 32767, 0, + 32767, 0, 692, 990, 32767, 32767, 32767, 56, + -507, 784, 951, 0, 32767, 0, 697, 32767, + 187, 0, 32767, 32767, 430, 1209, 682, 32767, + 130, 0, -25, 0, -1006, 0, 32767, 214, + 433, 22, 0, -1119, 32767, 285, 32767, 32767, + 32767, 216, 32767, 32767, 32767, 217, 527, 32767, + 32767, 32767, 829, 485, 419, 717, 620, 731, + 32767, 470, 0, -145, -620, 1162, -644, 848, + 287, -632, 32767, 32767, 32767, 32767, 381, 32767, + 510, 511, -554, -2, 32767, 0, 0, 698, + 32767, 32767, 436, 1154, 32767, 463, 32767, 32767, + 627, 517, 32767, 32767, 854, 579, 723, 396, + 110, -42, 354, 32767, 664, 32767, 32767, 0, + 0, 32767, 65, -163, 67, 140, 69, 341, + 70, 71, 402, 73, 623, 544, 624, 417, + -1375, 648, 32767, -26, 904, 0, 548, 0, + 0, 32767, 32767, 855, 32767, 488, -524, 599, + 130, 131, 32767, 32767, 542, -1110, -324, -462, + 32767, -405, -440, 0, 0, 629, 850, 0, + 741, 257, 258, 32767, 32767, 0, 32767, 923, + 0, 32767, 0, 32767, 1559, 32767, 32767, 32767, + 671, 32767, 134, 32767, 32767, -336, -104, 576, + 577, 829, 32767, 32767, 762, 902, 32767, 0, + 32767, 0, 1506, 887, 32767, 636, 601, 2465, + 426, 0, 236, 317, 427, 968, 32767, -975, + -559, -343, 341, 32767, 937, 241, 0, 32767, + 32767, 547, 32767, 32767, 32767, 32767, 32767, 789, + 0, 32767, 32767, 32767, 0, 0, 0, 32767, + -192, 859, 1185, 1153, 69, 32767, 32767, 32767, + -539, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 640, 578, 32767, 32767, -766, 32767, 32767, 32767, + 32767, 1050, -572, 32767, 32767, 32767, 32767, 1268, + 32767, 32767, 32767, 754, 32767, 32767, 1640, 179, + 804, 32767, 32767, 32767, 32767, 0, 684, 943, + 1006, 32767, 32767, 652, 0, 32767, 1041, 32767, + 718, 791, 32767, 274, 697, 32767, 32767, 0, + 32767, 32767, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 735, + 0, 32767, 32767, 32767, 275, 358, 688, 32767, + 32767, 32767, 548, -87, 770, 32767, -42, 0, + 551, 32767, 691, 222, 32767, 32767, 32767, 32767, + 0, 1273, 403, -121, 806, 553, 554, 163, + 32767, 32767, 892, 825, 32767, 32767, -490, 32767, + 32767, 32767, 32767, 32767, -109, 744, 910, 32767, + 91, 32767, 32767, 0, 0, 32767, 32767, 32767, + 1521, 50, 701, 32767, 32767, 32767, 32767, 164, + 658, 32767, 288, 0, 32767, 0, 51, 0, + 32767, 32767, 32767, 32767, 555, 1547, 32767, 32767, + 595, 585, 429, 32767, -80, 32767, 1258, 0, + 540, 486, -434, 865, 0, 192, 0, 884, + 0, 0, 0, 175, 555, 0, 32767, 32767, + 0, 32767, -566, 866, 591, 32767, 32767, 32767, + 32767, 32767, 496, 495, -215, 32767, 849, -772, + 32767, 32767, 502, 178, 483, 32767, 912, 793, + 794, 0, 32767, 32767, 32767, -556, 499, 838, + 32767, 32767, -506, 331, 0, 0, -1096, 512, + 880, 0, 774, -338, 649, 32767, 270, 32767, + 32767, -624, 328, 459, 32767, 32767, 32767, 32767, + 329, -201, -835, 813, -879, 560, 0, -212, + -114, 35, -494, 37, 523, 653, 751, -653, + -743, 32767, 1356, 818, 32767, 32767, 856, 0, + 44, 902, 0, 0, 0, 0, 32767, -26, + 526, 795, 456, 32767, 104, -209, -341, 133, + -372, 0, 45, 110, 111, 0, 511, 47, + 114, 32767, 32767, 93, 48, 116, -1031, -279, + 32767, 192, 0, 32767, 453, 415, 0, -190, + 32767, 471, 240, 175, 29, 665, 684, 0, + -11, -95, -344, 32767, 245, 148, 0, 530, + 0, 1185, -615, -712, 693, 784, 32767, 0, + -776, 32767, 32767, -813, 0, 0, 0, 207, + 208, 32767, 674, 32767, 742, -289, 249, 32767, + 520, 929, -50, 781, 0, -778, 32767, 0, + 302, 32767, 720, -465, 0, 32767, 32767, 32767, + 0, 0, 32767, 833, 328, 806, 32767, -403, + 0, 32767, -77, 32767, 0, 441, 930, 32767, + 643, 0, 32767, 1938, 0, 1334, 381, 32767, + 216, 32767, 32767, 0, 32767, 484, 383, 0, + 242, 395, 0, 32767, 32767, 32767, -781, 355, + 356, 32767, 292, 706, 32767, 32767, 32767, 32767, + 32767, -410, 32767, 32767, 782, 32767, 189, 32767, + 32767, 943, 0, -212, 407, 335, 0, 135, + 32767, 616, 0, -497, 0, -67, 853, 32767, + 700, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 459, -48, 32767, 58, 0, + -856, 1017, 32767, 59, 916, -731, 32767, 940, + -855, 347, 650, 0, 678, 32767, 0, 32767, + 32767, 530, 32767, 0, -80, 32767, -730, 32767, + 1214, 799, 58, 651, 841, 0, 0, -589, + -1530, -478, 651, 652, 93, 576, -1215, 32767, + 125, 32767, 1279, 32767, 32767, 0, 32767, 0, + -367, 416, -1236, 32767, 418, 32767, 815, 558, + 559, 781, 419, 32767, 739, 32767, 0, 32767, + 128, 570, 1349, -298, -66, 0, 147, -488, + 32767, 590, 189, 274, 524, 32767, 1082, -209, + 32767, 423, 32767, 32767, 975, 573, 32767, 424, + 32767, 32767, 1241, 32767, 32767, 32767, 32767, 32767, + 612, 391, 32767, 0, -803, 1004, -561, 32767, + 32767, 735, 870, 32767, 0, 32767, 32767, -123, + 99, 210, 600, 1294, 109, 1053, 32767, 307, + 834, 32767, 0, 1651, 32767, 644, 32767, 32767, + 0, 32767, -801, 385, 379, 32767, -368, 32767, + 32767, 830, 0, 32767, 32767, 739, 371, 372, + -275, 32767, 32767, 331, -780, 32767, 0, 1229, + -1462, 913, 266, 827, 125, 32767, 32767, 32767, + 393, 32767, 631, -33, -883, -661, -204, 6, + -19, 257, 8, 9, 118, 519, 615, -541, + -893, 0, 32767, 0, 1156, 15, 900, 32767, + 32767, 32767, 32767, 32767, 32767, 1022, 376, 0, + 32767, 32767, -972, 676, 840, -661, 631, 58, + 0, 17, 32767, 0, -799, 82, 0, 32767, + 32767, 680, 32767, 905, 0, 0, 32767, 32767, + 0, 0, 32767, 0, 828, 386, 802, 0, + 146, 0, 148, 32767, -1146, 0, 150, 151, + -743, 153, 154, 32767, 32767, 442, 32767, 743, + 0, 0, 746, 0, 32767, 32767, 32767, 98, + 32767, 157, 0, 696, 0, 32767, 32767, -294, + 32767, 158, 159, 32767, 0, 32767, 160, 32767, + 933, 32767, 32767, -50, 759, 824, 162, 672, + 32767, 356, 0, 356, 32767, 32767, 0, 0, + 656, 692, 253, 254, -374, 102, 256, 32767, + 0, 0, 32767, 32767, 259, 32767, 63, 260, + 510, 261, 32767, 0, 32767, 1061, 32767, 521, + 32767, 32767, 32767, 32767, 32767, 32767, 316, 317, + 846, 0, 32767, -500, 318, 0, 32767, 32767, + 263, 0, 790, 872, 32767, 32767, 32767, 2171, + 264, 32767, 32767, 32767, 32767, 486, 334, 465, + 32767, 466, 32767, 444, 606, 32767, 0, 445, + 320, -317, 0, 520, 322, 718, 32767, 32767, + 32767, 0, 1013, 32767, 32767, 32767, 32767, 32767, + 32767, 611, 32767, 0, 0, 32767, 32767, -120, + 156, 613, 0, 0, 32767, -68, 32767, 622, + 32767, 32767, 32767, 32767, 32767, 455, 32767, 32767, + 32767, 403, 533, 0, -161, 405, 95, 96, + 32767, 97, 32767, 0, 29, 0, 32767, 32767, + 30, 32767, 99, 32767, 32767, 0, 161, 32767, + 97, 0, 32, 32767, 32767, 0, 0, 315, + 32767, 32767, 414, 966, 0, 585, 32767, 32767, + -616, -256, 171, 172, 666, 101, 562, 563, + 32767, 95, 0, 0, 1492, 390, -251, 103, + 32767, 0, 32767, 188, 1487, 32767, 0, 0, + 586, 668, -126, 0, 0, 32767, 32767, 204, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 656, 32767, 32767, + 599, 0, 222, 32767, 0, 1368, -412, 435, + 32767, 936, 32767, -17, 32767, 832, 32767, 437, + 0, -518, 787, 32767, 864, -449, 0, 636, + 713, 206, 592, 572, 0, 483, -139, 32767, + 32767, 180, 818, 32767, 32767, 1304, 0, 32767, + 274, 0, 0, 0, 0, 705, 32767, 32767, + 32767, 0, -272, 0, 502, 503, 319, 0, + 32767, 0, 13, 32767, 32767, 0, 32767, 270, + 737, 0, 32767, 32767, 32767, 901, 32767, 616, + 180, 32767, 721, 353, 32767, 0, 32767, 32767, + -199, 0, 280, 788, 32767, 940, 32767, 51, + 0, 400, 53, 0, 54, -637, 0, -453, + 0, 0, 0, 380, 0, 32767, 504, 0, + 2049, 0, -964, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 798, 32767, 32767, 32767, 0, + 538, 488, 0, 32767, -528, 57, 819, 32767, + 32767, 1244, 0, 488, 739, 908, 32767, 32767, + 0, 32767, 32767, 0, 55, 533, 0, 32767, + 814, 0, 32767, 458, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 776, 777, 920, 0, + 0, 755, 32767, 0, 32767, 32767, 0, 32767, + 55, -954, 0, 372, 166, 218, 165, 857, + 221, 675, 0, 223, 224, -155, 226, 32767, + 1851, 227, 32767, 32767, 1192, 0, 229, 0, + -72, 0, 865, 0, 0, -330, 0, 683, + 32767, -550, -196, 725, -573, 293, 102, 32767, + -589, 296, 297, 298, 231, -256, 300, 32767, + 32767, 301, 233, 868, 32767, 234, 0, 811, + 1187, 32767, 32767, 0, 32767, 518, 0, 361, + 362, 466, 0, 365, 32767, -179, 366, 367, + 874, 369, 305, 0, 32767, 0, 32767, 0, + 32767, 2000, 1215, 451, 652, 0, 0, 799, + 32767, 32767, 32767 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 8; + uint32 a = 0; + uint32 b = 0; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 17 + c; + } + return h[a % 1883] + h[b % 1883]; +} + +/* Hash lookup information for recomposition */ +static const pg_unicode_recompinfo UnicodeRecompInfo = +{ + RecompInverseLookup, + Recomp_hash_func, + 941 +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_norm_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_norm_table.h new file mode 100644 index 0000000000000000000000000000000000000000..7ef8efac8afab625b3fb6d11500654d37dbfc8e9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_norm_table.h @@ -0,0 +1,9114 @@ +/*------------------------------------------------------------------------- + * + * unicode_norm_table.h + * Composition table used for Unicode normalization + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_norm_table.h + * + *------------------------------------------------------------------------- + */ + +/* + * File auto-generated by src/common/unicode/generate-unicode_norm_table.pl, + * do not edit. There is deliberately not an #ifndef PG_UNICODE_NORM_TABLE_H + * here. + */ +typedef struct +{ + uint32 codepoint; /* Unicode codepoint */ + uint8 comb_class; /* combining class of character */ + uint8 dec_size_flags; /* size and flags of decomposition code list */ + uint16 dec_index; /* index into UnicodeDecomp_codepoints, or the + * decomposition itself if DECOMP_INLINE */ +} pg_unicode_decomposition; + +#define DECOMP_NO_COMPOSE 0x80 /* don't use for re-composition */ +#define DECOMP_INLINE 0x40 /* decomposition is stored inline in + * dec_index */ +#define DECOMP_COMPAT 0x20 /* compatibility mapping */ + +#define DECOMPOSITION_SIZE(x) ((x)->dec_size_flags & 0x1F) +#define DECOMPOSITION_NO_COMPOSE(x) (((x)->dec_size_flags & (DECOMP_NO_COMPOSE | DECOMP_COMPAT)) != 0) +#define DECOMPOSITION_IS_INLINE(x) (((x)->dec_size_flags & DECOMP_INLINE) != 0) +#define DECOMPOSITION_IS_COMPAT(x) (((x)->dec_size_flags & DECOMP_COMPAT) != 0) + +/* Table of Unicode codepoints and their decompositions */ +static const pg_unicode_decomposition UnicodeDecompMain[6775] = +{ + {0x00A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x00A8, 0, 2 | DECOMP_COMPAT, 0}, + {0x00AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x00AF, 0, 2 | DECOMP_COMPAT, 2}, + {0x00B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x00B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x00B4, 0, 2 | DECOMP_COMPAT, 4}, + {0x00B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x00B8, 0, 2 | DECOMP_COMPAT, 6}, + {0x00B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x00BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x00BC, 0, 3 | DECOMP_COMPAT, 8}, + {0x00BD, 0, 3 | DECOMP_COMPAT, 11}, + {0x00BE, 0, 3 | DECOMP_COMPAT, 14}, + {0x00C0, 0, 2, 17}, + {0x00C1, 0, 2, 19}, + {0x00C2, 0, 2, 21}, + {0x00C3, 0, 2, 23}, + {0x00C4, 0, 2, 25}, + {0x00C5, 0, 2, 27}, + {0x00C7, 0, 2, 29}, + {0x00C8, 0, 2, 31}, + {0x00C9, 0, 2, 33}, + {0x00CA, 0, 2, 35}, + {0x00CB, 0, 2, 37}, + {0x00CC, 0, 2, 39}, + {0x00CD, 0, 2, 41}, + {0x00CE, 0, 2, 43}, + {0x00CF, 0, 2, 45}, + {0x00D1, 0, 2, 47}, + {0x00D2, 0, 2, 49}, + {0x00D3, 0, 2, 51}, + {0x00D4, 0, 2, 53}, + {0x00D5, 0, 2, 55}, + {0x00D6, 0, 2, 57}, + {0x00D9, 0, 2, 59}, + {0x00DA, 0, 2, 61}, + {0x00DB, 0, 2, 63}, + {0x00DC, 0, 2, 65}, + {0x00DD, 0, 2, 67}, + {0x00E0, 0, 2, 69}, + {0x00E1, 0, 2, 71}, + {0x00E2, 0, 2, 73}, + {0x00E3, 0, 2, 75}, + {0x00E4, 0, 2, 77}, + {0x00E5, 0, 2, 79}, + {0x00E7, 0, 2, 81}, + {0x00E8, 0, 2, 83}, + {0x00E9, 0, 2, 85}, + {0x00EA, 0, 2, 87}, + {0x00EB, 0, 2, 89}, + {0x00EC, 0, 2, 91}, + {0x00ED, 0, 2, 93}, + {0x00EE, 0, 2, 95}, + {0x00EF, 0, 2, 97}, + {0x00F1, 0, 2, 99}, + {0x00F2, 0, 2, 101}, + {0x00F3, 0, 2, 103}, + {0x00F4, 0, 2, 105}, + {0x00F5, 0, 2, 107}, + {0x00F6, 0, 2, 109}, + {0x00F9, 0, 2, 111}, + {0x00FA, 0, 2, 113}, + {0x00FB, 0, 2, 115}, + {0x00FC, 0, 2, 117}, + {0x00FD, 0, 2, 119}, + {0x00FF, 0, 2, 121}, + {0x0100, 0, 2, 123}, + {0x0101, 0, 2, 125}, + {0x0102, 0, 2, 127}, + {0x0103, 0, 2, 129}, + {0x0104, 0, 2, 131}, + {0x0105, 0, 2, 133}, + {0x0106, 0, 2, 135}, + {0x0107, 0, 2, 137}, + {0x0108, 0, 2, 139}, + {0x0109, 0, 2, 141}, + {0x010A, 0, 2, 143}, + {0x010B, 0, 2, 145}, + {0x010C, 0, 2, 147}, + {0x010D, 0, 2, 149}, + {0x010E, 0, 2, 151}, + {0x010F, 0, 2, 153}, + {0x0112, 0, 2, 155}, + {0x0113, 0, 2, 157}, + {0x0114, 0, 2, 159}, + {0x0115, 0, 2, 161}, + {0x0116, 0, 2, 163}, + {0x0117, 0, 2, 165}, + {0x0118, 0, 2, 167}, + {0x0119, 0, 2, 169}, + {0x011A, 0, 2, 171}, + {0x011B, 0, 2, 173}, + {0x011C, 0, 2, 175}, + {0x011D, 0, 2, 177}, + {0x011E, 0, 2, 179}, + {0x011F, 0, 2, 181}, + {0x0120, 0, 2, 183}, + {0x0121, 0, 2, 185}, + {0x0122, 0, 2, 187}, + {0x0123, 0, 2, 189}, + {0x0124, 0, 2, 191}, + {0x0125, 0, 2, 193}, + {0x0128, 0, 2, 195}, + {0x0129, 0, 2, 197}, + {0x012A, 0, 2, 199}, + {0x012B, 0, 2, 201}, + {0x012C, 0, 2, 203}, + {0x012D, 0, 2, 205}, + {0x012E, 0, 2, 207}, + {0x012F, 0, 2, 209}, + {0x0130, 0, 2, 211}, + {0x0132, 0, 2 | DECOMP_COMPAT, 213}, + {0x0133, 0, 2 | DECOMP_COMPAT, 215}, + {0x0134, 0, 2, 217}, + {0x0135, 0, 2, 219}, + {0x0136, 0, 2, 221}, + {0x0137, 0, 2, 223}, + {0x0139, 0, 2, 225}, + {0x013A, 0, 2, 227}, + {0x013B, 0, 2, 229}, + {0x013C, 0, 2, 231}, + {0x013D, 0, 2, 233}, + {0x013E, 0, 2, 235}, + {0x013F, 0, 2 | DECOMP_COMPAT, 237}, + {0x0140, 0, 2 | DECOMP_COMPAT, 239}, + {0x0143, 0, 2, 241}, + {0x0144, 0, 2, 243}, + {0x0145, 0, 2, 245}, + {0x0146, 0, 2, 247}, + {0x0147, 0, 2, 249}, + {0x0148, 0, 2, 251}, + {0x0149, 0, 2 | DECOMP_COMPAT, 253}, + {0x014C, 0, 2, 255}, + {0x014D, 0, 2, 257}, + {0x014E, 0, 2, 259}, + {0x014F, 0, 2, 261}, + {0x0150, 0, 2, 263}, + {0x0151, 0, 2, 265}, + {0x0154, 0, 2, 267}, + {0x0155, 0, 2, 269}, + {0x0156, 0, 2, 271}, + {0x0157, 0, 2, 273}, + {0x0158, 0, 2, 275}, + {0x0159, 0, 2, 277}, + {0x015A, 0, 2, 279}, + {0x015B, 0, 2, 281}, + {0x015C, 0, 2, 283}, + {0x015D, 0, 2, 285}, + {0x015E, 0, 2, 287}, + {0x015F, 0, 2, 289}, + {0x0160, 0, 2, 291}, + {0x0161, 0, 2, 293}, + {0x0162, 0, 2, 295}, + {0x0163, 0, 2, 297}, + {0x0164, 0, 2, 299}, + {0x0165, 0, 2, 301}, + {0x0168, 0, 2, 303}, + {0x0169, 0, 2, 305}, + {0x016A, 0, 2, 307}, + {0x016B, 0, 2, 309}, + {0x016C, 0, 2, 311}, + {0x016D, 0, 2, 313}, + {0x016E, 0, 2, 315}, + {0x016F, 0, 2, 317}, + {0x0170, 0, 2, 319}, + {0x0171, 0, 2, 321}, + {0x0172, 0, 2, 323}, + {0x0173, 0, 2, 325}, + {0x0174, 0, 2, 327}, + {0x0175, 0, 2, 329}, + {0x0176, 0, 2, 331}, + {0x0177, 0, 2, 333}, + {0x0178, 0, 2, 335}, + {0x0179, 0, 2, 337}, + {0x017A, 0, 2, 339}, + {0x017B, 0, 2, 341}, + {0x017C, 0, 2, 343}, + {0x017D, 0, 2, 345}, + {0x017E, 0, 2, 347}, + {0x017F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x01A0, 0, 2, 349}, + {0x01A1, 0, 2, 351}, + {0x01AF, 0, 2, 353}, + {0x01B0, 0, 2, 355}, + {0x01C4, 0, 2 | DECOMP_COMPAT, 357}, + {0x01C5, 0, 2 | DECOMP_COMPAT, 359}, + {0x01C6, 0, 2 | DECOMP_COMPAT, 361}, + {0x01C7, 0, 2 | DECOMP_COMPAT, 363}, + {0x01C8, 0, 2 | DECOMP_COMPAT, 365}, + {0x01C9, 0, 2 | DECOMP_COMPAT, 367}, + {0x01CA, 0, 2 | DECOMP_COMPAT, 369}, + {0x01CB, 0, 2 | DECOMP_COMPAT, 371}, + {0x01CC, 0, 2 | DECOMP_COMPAT, 373}, + {0x01CD, 0, 2, 375}, + {0x01CE, 0, 2, 377}, + {0x01CF, 0, 2, 379}, + {0x01D0, 0, 2, 381}, + {0x01D1, 0, 2, 383}, + {0x01D2, 0, 2, 385}, + {0x01D3, 0, 2, 387}, + {0x01D4, 0, 2, 389}, + {0x01D5, 0, 2, 391}, + {0x01D6, 0, 2, 393}, + {0x01D7, 0, 2, 395}, + {0x01D8, 0, 2, 397}, + {0x01D9, 0, 2, 399}, + {0x01DA, 0, 2, 401}, + {0x01DB, 0, 2, 403}, + {0x01DC, 0, 2, 405}, + {0x01DE, 0, 2, 407}, + {0x01DF, 0, 2, 409}, + {0x01E0, 0, 2, 411}, + {0x01E1, 0, 2, 413}, + {0x01E2, 0, 2, 415}, + {0x01E3, 0, 2, 417}, + {0x01E6, 0, 2, 419}, + {0x01E7, 0, 2, 421}, + {0x01E8, 0, 2, 423}, + {0x01E9, 0, 2, 425}, + {0x01EA, 0, 2, 427}, + {0x01EB, 0, 2, 429}, + {0x01EC, 0, 2, 431}, + {0x01ED, 0, 2, 433}, + {0x01EE, 0, 2, 435}, + {0x01EF, 0, 2, 437}, + {0x01F0, 0, 2, 439}, + {0x01F1, 0, 2 | DECOMP_COMPAT, 441}, + {0x01F2, 0, 2 | DECOMP_COMPAT, 443}, + {0x01F3, 0, 2 | DECOMP_COMPAT, 445}, + {0x01F4, 0, 2, 447}, + {0x01F5, 0, 2, 449}, + {0x01F8, 0, 2, 451}, + {0x01F9, 0, 2, 453}, + {0x01FA, 0, 2, 455}, + {0x01FB, 0, 2, 457}, + {0x01FC, 0, 2, 459}, + {0x01FD, 0, 2, 461}, + {0x01FE, 0, 2, 463}, + {0x01FF, 0, 2, 465}, + {0x0200, 0, 2, 467}, + {0x0201, 0, 2, 469}, + {0x0202, 0, 2, 471}, + {0x0203, 0, 2, 473}, + {0x0204, 0, 2, 475}, + {0x0205, 0, 2, 477}, + {0x0206, 0, 2, 479}, + {0x0207, 0, 2, 481}, + {0x0208, 0, 2, 483}, + {0x0209, 0, 2, 485}, + {0x020A, 0, 2, 487}, + {0x020B, 0, 2, 489}, + {0x020C, 0, 2, 491}, + {0x020D, 0, 2, 493}, + {0x020E, 0, 2, 495}, + {0x020F, 0, 2, 497}, + {0x0210, 0, 2, 499}, + {0x0211, 0, 2, 501}, + {0x0212, 0, 2, 503}, + {0x0213, 0, 2, 505}, + {0x0214, 0, 2, 507}, + {0x0215, 0, 2, 509}, + {0x0216, 0, 2, 511}, + {0x0217, 0, 2, 513}, + {0x0218, 0, 2, 515}, + {0x0219, 0, 2, 517}, + {0x021A, 0, 2, 519}, + {0x021B, 0, 2, 521}, + {0x021E, 0, 2, 523}, + {0x021F, 0, 2, 525}, + {0x0226, 0, 2, 527}, + {0x0227, 0, 2, 529}, + {0x0228, 0, 2, 531}, + {0x0229, 0, 2, 533}, + {0x022A, 0, 2, 535}, + {0x022B, 0, 2, 537}, + {0x022C, 0, 2, 539}, + {0x022D, 0, 2, 541}, + {0x022E, 0, 2, 543}, + {0x022F, 0, 2, 545}, + {0x0230, 0, 2, 547}, + {0x0231, 0, 2, 549}, + {0x0232, 0, 2, 551}, + {0x0233, 0, 2, 553}, + {0x02B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x02B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0266}, + {0x02B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x02B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x02B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0279}, + {0x02B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027B}, + {0x02B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0281}, + {0x02B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x02B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x02D8, 0, 2 | DECOMP_COMPAT, 555}, + {0x02D9, 0, 2 | DECOMP_COMPAT, 557}, + {0x02DA, 0, 2 | DECOMP_COMPAT, 559}, + {0x02DB, 0, 2 | DECOMP_COMPAT, 561}, + {0x02DC, 0, 2 | DECOMP_COMPAT, 563}, + {0x02DD, 0, 2 | DECOMP_COMPAT, 565}, + {0x02E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0263}, + {0x02E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x02E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x02E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x02E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0295}, + {0x0300, 230, 0, 0}, + {0x0301, 230, 0, 0}, + {0x0302, 230, 0, 0}, + {0x0303, 230, 0, 0}, + {0x0304, 230, 0, 0}, + {0x0305, 230, 0, 0}, + {0x0306, 230, 0, 0}, + {0x0307, 230, 0, 0}, + {0x0308, 230, 0, 0}, + {0x0309, 230, 0, 0}, + {0x030A, 230, 0, 0}, + {0x030B, 230, 0, 0}, + {0x030C, 230, 0, 0}, + {0x030D, 230, 0, 0}, + {0x030E, 230, 0, 0}, + {0x030F, 230, 0, 0}, + {0x0310, 230, 0, 0}, + {0x0311, 230, 0, 0}, + {0x0312, 230, 0, 0}, + {0x0313, 230, 0, 0}, + {0x0314, 230, 0, 0}, + {0x0315, 232, 0, 0}, + {0x0316, 220, 0, 0}, + {0x0317, 220, 0, 0}, + {0x0318, 220, 0, 0}, + {0x0319, 220, 0, 0}, + {0x031A, 232, 0, 0}, + {0x031B, 216, 0, 0}, + {0x031C, 220, 0, 0}, + {0x031D, 220, 0, 0}, + {0x031E, 220, 0, 0}, + {0x031F, 220, 0, 0}, + {0x0320, 220, 0, 0}, + {0x0321, 202, 0, 0}, + {0x0322, 202, 0, 0}, + {0x0323, 220, 0, 0}, + {0x0324, 220, 0, 0}, + {0x0325, 220, 0, 0}, + {0x0326, 220, 0, 0}, + {0x0327, 202, 0, 0}, + {0x0328, 202, 0, 0}, + {0x0329, 220, 0, 0}, + {0x032A, 220, 0, 0}, + {0x032B, 220, 0, 0}, + {0x032C, 220, 0, 0}, + {0x032D, 220, 0, 0}, + {0x032E, 220, 0, 0}, + {0x032F, 220, 0, 0}, + {0x0330, 220, 0, 0}, + {0x0331, 220, 0, 0}, + {0x0332, 220, 0, 0}, + {0x0333, 220, 0, 0}, + {0x0334, 1, 0, 0}, + {0x0335, 1, 0, 0}, + {0x0336, 1, 0, 0}, + {0x0337, 1, 0, 0}, + {0x0338, 1, 0, 0}, + {0x0339, 220, 0, 0}, + {0x033A, 220, 0, 0}, + {0x033B, 220, 0, 0}, + {0x033C, 220, 0, 0}, + {0x033D, 230, 0, 0}, + {0x033E, 230, 0, 0}, + {0x033F, 230, 0, 0}, + {0x0340, 230, 1 | DECOMP_INLINE, 0x0300}, + {0x0341, 230, 1 | DECOMP_INLINE, 0x0301}, + {0x0342, 230, 0, 0}, + {0x0343, 230, 1 | DECOMP_INLINE, 0x0313}, + {0x0344, 230, 2 | DECOMP_NO_COMPOSE, 567}, /* non-starter decomposition */ + {0x0345, 240, 0, 0}, + {0x0346, 230, 0, 0}, + {0x0347, 220, 0, 0}, + {0x0348, 220, 0, 0}, + {0x0349, 220, 0, 0}, + {0x034A, 230, 0, 0}, + {0x034B, 230, 0, 0}, + {0x034C, 230, 0, 0}, + {0x034D, 220, 0, 0}, + {0x034E, 220, 0, 0}, + {0x0350, 230, 0, 0}, + {0x0351, 230, 0, 0}, + {0x0352, 230, 0, 0}, + {0x0353, 220, 0, 0}, + {0x0354, 220, 0, 0}, + {0x0355, 220, 0, 0}, + {0x0356, 220, 0, 0}, + {0x0357, 230, 0, 0}, + {0x0358, 232, 0, 0}, + {0x0359, 220, 0, 0}, + {0x035A, 220, 0, 0}, + {0x035B, 230, 0, 0}, + {0x035C, 233, 0, 0}, + {0x035D, 234, 0, 0}, + {0x035E, 234, 0, 0}, + {0x035F, 233, 0, 0}, + {0x0360, 234, 0, 0}, + {0x0361, 234, 0, 0}, + {0x0362, 233, 0, 0}, + {0x0363, 230, 0, 0}, + {0x0364, 230, 0, 0}, + {0x0365, 230, 0, 0}, + {0x0366, 230, 0, 0}, + {0x0367, 230, 0, 0}, + {0x0368, 230, 0, 0}, + {0x0369, 230, 0, 0}, + {0x036A, 230, 0, 0}, + {0x036B, 230, 0, 0}, + {0x036C, 230, 0, 0}, + {0x036D, 230, 0, 0}, + {0x036E, 230, 0, 0}, + {0x036F, 230, 0, 0}, + {0x0374, 0, 1 | DECOMP_INLINE, 0x02B9}, + {0x037A, 0, 2 | DECOMP_COMPAT, 569}, + {0x037E, 0, 1 | DECOMP_INLINE, 0x003B}, + {0x0384, 0, 2 | DECOMP_COMPAT, 571}, + {0x0385, 0, 2, 573}, + {0x0386, 0, 2, 575}, + {0x0387, 0, 1 | DECOMP_INLINE, 0x00B7}, + {0x0388, 0, 2, 577}, + {0x0389, 0, 2, 579}, + {0x038A, 0, 2, 581}, + {0x038C, 0, 2, 583}, + {0x038E, 0, 2, 585}, + {0x038F, 0, 2, 587}, + {0x0390, 0, 2, 589}, + {0x03AA, 0, 2, 591}, + {0x03AB, 0, 2, 593}, + {0x03AC, 0, 2, 595}, + {0x03AD, 0, 2, 597}, + {0x03AE, 0, 2, 599}, + {0x03AF, 0, 2, 601}, + {0x03B0, 0, 2, 603}, + {0x03CA, 0, 2, 605}, + {0x03CB, 0, 2, 607}, + {0x03CC, 0, 2, 609}, + {0x03CD, 0, 2, 611}, + {0x03CE, 0, 2, 613}, + {0x03D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x03D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x03D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x03D3, 0, 2, 615}, + {0x03D4, 0, 2, 617}, + {0x03D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x03D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x03F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x03F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x03F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x03F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x03F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x03F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x0400, 0, 2, 619}, + {0x0401, 0, 2, 621}, + {0x0403, 0, 2, 623}, + {0x0407, 0, 2, 625}, + {0x040C, 0, 2, 627}, + {0x040D, 0, 2, 629}, + {0x040E, 0, 2, 631}, + {0x0419, 0, 2, 633}, + {0x0439, 0, 2, 635}, + {0x0450, 0, 2, 637}, + {0x0451, 0, 2, 639}, + {0x0453, 0, 2, 641}, + {0x0457, 0, 2, 643}, + {0x045C, 0, 2, 645}, + {0x045D, 0, 2, 647}, + {0x045E, 0, 2, 649}, + {0x0476, 0, 2, 651}, + {0x0477, 0, 2, 653}, + {0x0483, 230, 0, 0}, + {0x0484, 230, 0, 0}, + {0x0485, 230, 0, 0}, + {0x0486, 230, 0, 0}, + {0x0487, 230, 0, 0}, + {0x04C1, 0, 2, 655}, + {0x04C2, 0, 2, 657}, + {0x04D0, 0, 2, 659}, + {0x04D1, 0, 2, 661}, + {0x04D2, 0, 2, 663}, + {0x04D3, 0, 2, 665}, + {0x04D6, 0, 2, 667}, + {0x04D7, 0, 2, 669}, + {0x04DA, 0, 2, 671}, + {0x04DB, 0, 2, 673}, + {0x04DC, 0, 2, 675}, + {0x04DD, 0, 2, 677}, + {0x04DE, 0, 2, 679}, + {0x04DF, 0, 2, 681}, + {0x04E2, 0, 2, 683}, + {0x04E3, 0, 2, 685}, + {0x04E4, 0, 2, 687}, + {0x04E5, 0, 2, 689}, + {0x04E6, 0, 2, 691}, + {0x04E7, 0, 2, 693}, + {0x04EA, 0, 2, 695}, + {0x04EB, 0, 2, 697}, + {0x04EC, 0, 2, 699}, + {0x04ED, 0, 2, 701}, + {0x04EE, 0, 2, 703}, + {0x04EF, 0, 2, 705}, + {0x04F0, 0, 2, 707}, + {0x04F1, 0, 2, 709}, + {0x04F2, 0, 2, 711}, + {0x04F3, 0, 2, 713}, + {0x04F4, 0, 2, 715}, + {0x04F5, 0, 2, 717}, + {0x04F8, 0, 2, 719}, + {0x04F9, 0, 2, 721}, + {0x0587, 0, 2 | DECOMP_COMPAT, 723}, + {0x0591, 220, 0, 0}, + {0x0592, 230, 0, 0}, + {0x0593, 230, 0, 0}, + {0x0594, 230, 0, 0}, + {0x0595, 230, 0, 0}, + {0x0596, 220, 0, 0}, + {0x0597, 230, 0, 0}, + {0x0598, 230, 0, 0}, + {0x0599, 230, 0, 0}, + {0x059A, 222, 0, 0}, + {0x059B, 220, 0, 0}, + {0x059C, 230, 0, 0}, + {0x059D, 230, 0, 0}, + {0x059E, 230, 0, 0}, + {0x059F, 230, 0, 0}, + {0x05A0, 230, 0, 0}, + {0x05A1, 230, 0, 0}, + {0x05A2, 220, 0, 0}, + {0x05A3, 220, 0, 0}, + {0x05A4, 220, 0, 0}, + {0x05A5, 220, 0, 0}, + {0x05A6, 220, 0, 0}, + {0x05A7, 220, 0, 0}, + {0x05A8, 230, 0, 0}, + {0x05A9, 230, 0, 0}, + {0x05AA, 220, 0, 0}, + {0x05AB, 230, 0, 0}, + {0x05AC, 230, 0, 0}, + {0x05AD, 222, 0, 0}, + {0x05AE, 228, 0, 0}, + {0x05AF, 230, 0, 0}, + {0x05B0, 10, 0, 0}, + {0x05B1, 11, 0, 0}, + {0x05B2, 12, 0, 0}, + {0x05B3, 13, 0, 0}, + {0x05B4, 14, 0, 0}, + {0x05B5, 15, 0, 0}, + {0x05B6, 16, 0, 0}, + {0x05B7, 17, 0, 0}, + {0x05B8, 18, 0, 0}, + {0x05B9, 19, 0, 0}, + {0x05BA, 19, 0, 0}, + {0x05BB, 20, 0, 0}, + {0x05BC, 21, 0, 0}, + {0x05BD, 22, 0, 0}, + {0x05BF, 23, 0, 0}, + {0x05C1, 24, 0, 0}, + {0x05C2, 25, 0, 0}, + {0x05C4, 230, 0, 0}, + {0x05C5, 220, 0, 0}, + {0x05C7, 18, 0, 0}, + {0x0610, 230, 0, 0}, + {0x0611, 230, 0, 0}, + {0x0612, 230, 0, 0}, + {0x0613, 230, 0, 0}, + {0x0614, 230, 0, 0}, + {0x0615, 230, 0, 0}, + {0x0616, 230, 0, 0}, + {0x0617, 230, 0, 0}, + {0x0618, 30, 0, 0}, + {0x0619, 31, 0, 0}, + {0x061A, 32, 0, 0}, + {0x0622, 0, 2, 725}, + {0x0623, 0, 2, 727}, + {0x0624, 0, 2, 729}, + {0x0625, 0, 2, 731}, + {0x0626, 0, 2, 733}, + {0x064B, 27, 0, 0}, + {0x064C, 28, 0, 0}, + {0x064D, 29, 0, 0}, + {0x064E, 30, 0, 0}, + {0x064F, 31, 0, 0}, + {0x0650, 32, 0, 0}, + {0x0651, 33, 0, 0}, + {0x0652, 34, 0, 0}, + {0x0653, 230, 0, 0}, + {0x0654, 230, 0, 0}, + {0x0655, 220, 0, 0}, + {0x0656, 220, 0, 0}, + {0x0657, 230, 0, 0}, + {0x0658, 230, 0, 0}, + {0x0659, 230, 0, 0}, + {0x065A, 230, 0, 0}, + {0x065B, 230, 0, 0}, + {0x065C, 220, 0, 0}, + {0x065D, 230, 0, 0}, + {0x065E, 230, 0, 0}, + {0x065F, 220, 0, 0}, + {0x0670, 35, 0, 0}, + {0x0675, 0, 2 | DECOMP_COMPAT, 735}, + {0x0676, 0, 2 | DECOMP_COMPAT, 737}, + {0x0677, 0, 2 | DECOMP_COMPAT, 739}, + {0x0678, 0, 2 | DECOMP_COMPAT, 741}, + {0x06C0, 0, 2, 743}, + {0x06C2, 0, 2, 745}, + {0x06D3, 0, 2, 747}, + {0x06D6, 230, 0, 0}, + {0x06D7, 230, 0, 0}, + {0x06D8, 230, 0, 0}, + {0x06D9, 230, 0, 0}, + {0x06DA, 230, 0, 0}, + {0x06DB, 230, 0, 0}, + {0x06DC, 230, 0, 0}, + {0x06DF, 230, 0, 0}, + {0x06E0, 230, 0, 0}, + {0x06E1, 230, 0, 0}, + {0x06E2, 230, 0, 0}, + {0x06E3, 220, 0, 0}, + {0x06E4, 230, 0, 0}, + {0x06E7, 230, 0, 0}, + {0x06E8, 230, 0, 0}, + {0x06EA, 220, 0, 0}, + {0x06EB, 230, 0, 0}, + {0x06EC, 230, 0, 0}, + {0x06ED, 220, 0, 0}, + {0x0711, 36, 0, 0}, + {0x0730, 230, 0, 0}, + {0x0731, 220, 0, 0}, + {0x0732, 230, 0, 0}, + {0x0733, 230, 0, 0}, + {0x0734, 220, 0, 0}, + {0x0735, 230, 0, 0}, + {0x0736, 230, 0, 0}, + {0x0737, 220, 0, 0}, + {0x0738, 220, 0, 0}, + {0x0739, 220, 0, 0}, + {0x073A, 230, 0, 0}, + {0x073B, 220, 0, 0}, + {0x073C, 220, 0, 0}, + {0x073D, 230, 0, 0}, + {0x073E, 220, 0, 0}, + {0x073F, 230, 0, 0}, + {0x0740, 230, 0, 0}, + {0x0741, 230, 0, 0}, + {0x0742, 220, 0, 0}, + {0x0743, 230, 0, 0}, + {0x0744, 220, 0, 0}, + {0x0745, 230, 0, 0}, + {0x0746, 220, 0, 0}, + {0x0747, 230, 0, 0}, + {0x0748, 220, 0, 0}, + {0x0749, 230, 0, 0}, + {0x074A, 230, 0, 0}, + {0x07EB, 230, 0, 0}, + {0x07EC, 230, 0, 0}, + {0x07ED, 230, 0, 0}, + {0x07EE, 230, 0, 0}, + {0x07EF, 230, 0, 0}, + {0x07F0, 230, 0, 0}, + {0x07F1, 230, 0, 0}, + {0x07F2, 220, 0, 0}, + {0x07F3, 230, 0, 0}, + {0x07FD, 220, 0, 0}, + {0x0816, 230, 0, 0}, + {0x0817, 230, 0, 0}, + {0x0818, 230, 0, 0}, + {0x0819, 230, 0, 0}, + {0x081B, 230, 0, 0}, + {0x081C, 230, 0, 0}, + {0x081D, 230, 0, 0}, + {0x081E, 230, 0, 0}, + {0x081F, 230, 0, 0}, + {0x0820, 230, 0, 0}, + {0x0821, 230, 0, 0}, + {0x0822, 230, 0, 0}, + {0x0823, 230, 0, 0}, + {0x0825, 230, 0, 0}, + {0x0826, 230, 0, 0}, + {0x0827, 230, 0, 0}, + {0x0829, 230, 0, 0}, + {0x082A, 230, 0, 0}, + {0x082B, 230, 0, 0}, + {0x082C, 230, 0, 0}, + {0x082D, 230, 0, 0}, + {0x0859, 220, 0, 0}, + {0x085A, 220, 0, 0}, + {0x085B, 220, 0, 0}, + {0x0898, 230, 0, 0}, + {0x0899, 220, 0, 0}, + {0x089A, 220, 0, 0}, + {0x089B, 220, 0, 0}, + {0x089C, 230, 0, 0}, + {0x089D, 230, 0, 0}, + {0x089E, 230, 0, 0}, + {0x089F, 230, 0, 0}, + {0x08CA, 230, 0, 0}, + {0x08CB, 230, 0, 0}, + {0x08CC, 230, 0, 0}, + {0x08CD, 230, 0, 0}, + {0x08CE, 230, 0, 0}, + {0x08CF, 220, 0, 0}, + {0x08D0, 220, 0, 0}, + {0x08D1, 220, 0, 0}, + {0x08D2, 220, 0, 0}, + {0x08D3, 220, 0, 0}, + {0x08D4, 230, 0, 0}, + {0x08D5, 230, 0, 0}, + {0x08D6, 230, 0, 0}, + {0x08D7, 230, 0, 0}, + {0x08D8, 230, 0, 0}, + {0x08D9, 230, 0, 0}, + {0x08DA, 230, 0, 0}, + {0x08DB, 230, 0, 0}, + {0x08DC, 230, 0, 0}, + {0x08DD, 230, 0, 0}, + {0x08DE, 230, 0, 0}, + {0x08DF, 230, 0, 0}, + {0x08E0, 230, 0, 0}, + {0x08E1, 230, 0, 0}, + {0x08E3, 220, 0, 0}, + {0x08E4, 230, 0, 0}, + {0x08E5, 230, 0, 0}, + {0x08E6, 220, 0, 0}, + {0x08E7, 230, 0, 0}, + {0x08E8, 230, 0, 0}, + {0x08E9, 220, 0, 0}, + {0x08EA, 230, 0, 0}, + {0x08EB, 230, 0, 0}, + {0x08EC, 230, 0, 0}, + {0x08ED, 220, 0, 0}, + {0x08EE, 220, 0, 0}, + {0x08EF, 220, 0, 0}, + {0x08F0, 27, 0, 0}, + {0x08F1, 28, 0, 0}, + {0x08F2, 29, 0, 0}, + {0x08F3, 230, 0, 0}, + {0x08F4, 230, 0, 0}, + {0x08F5, 230, 0, 0}, + {0x08F6, 220, 0, 0}, + {0x08F7, 230, 0, 0}, + {0x08F8, 230, 0, 0}, + {0x08F9, 220, 0, 0}, + {0x08FA, 220, 0, 0}, + {0x08FB, 230, 0, 0}, + {0x08FC, 230, 0, 0}, + {0x08FD, 230, 0, 0}, + {0x08FE, 230, 0, 0}, + {0x08FF, 230, 0, 0}, + {0x0929, 0, 2, 749}, + {0x0931, 0, 2, 751}, + {0x0934, 0, 2, 753}, + {0x093C, 7, 0, 0}, + {0x094D, 9, 0, 0}, + {0x0951, 230, 0, 0}, + {0x0952, 220, 0, 0}, + {0x0953, 230, 0, 0}, + {0x0954, 230, 0, 0}, + {0x0958, 0, 2 | DECOMP_NO_COMPOSE, 755}, /* in exclusion list */ + {0x0959, 0, 2 | DECOMP_NO_COMPOSE, 757}, /* in exclusion list */ + {0x095A, 0, 2 | DECOMP_NO_COMPOSE, 759}, /* in exclusion list */ + {0x095B, 0, 2 | DECOMP_NO_COMPOSE, 761}, /* in exclusion list */ + {0x095C, 0, 2 | DECOMP_NO_COMPOSE, 763}, /* in exclusion list */ + {0x095D, 0, 2 | DECOMP_NO_COMPOSE, 765}, /* in exclusion list */ + {0x095E, 0, 2 | DECOMP_NO_COMPOSE, 767}, /* in exclusion list */ + {0x095F, 0, 2 | DECOMP_NO_COMPOSE, 769}, /* in exclusion list */ + {0x09BC, 7, 0, 0}, + {0x09CB, 0, 2, 771}, + {0x09CC, 0, 2, 773}, + {0x09CD, 9, 0, 0}, + {0x09DC, 0, 2 | DECOMP_NO_COMPOSE, 775}, /* in exclusion list */ + {0x09DD, 0, 2 | DECOMP_NO_COMPOSE, 777}, /* in exclusion list */ + {0x09DF, 0, 2 | DECOMP_NO_COMPOSE, 779}, /* in exclusion list */ + {0x09FE, 230, 0, 0}, + {0x0A33, 0, 2 | DECOMP_NO_COMPOSE, 781}, /* in exclusion list */ + {0x0A36, 0, 2 | DECOMP_NO_COMPOSE, 783}, /* in exclusion list */ + {0x0A3C, 7, 0, 0}, + {0x0A4D, 9, 0, 0}, + {0x0A59, 0, 2 | DECOMP_NO_COMPOSE, 785}, /* in exclusion list */ + {0x0A5A, 0, 2 | DECOMP_NO_COMPOSE, 787}, /* in exclusion list */ + {0x0A5B, 0, 2 | DECOMP_NO_COMPOSE, 789}, /* in exclusion list */ + {0x0A5E, 0, 2 | DECOMP_NO_COMPOSE, 791}, /* in exclusion list */ + {0x0ABC, 7, 0, 0}, + {0x0ACD, 9, 0, 0}, + {0x0B3C, 7, 0, 0}, + {0x0B48, 0, 2, 793}, + {0x0B4B, 0, 2, 795}, + {0x0B4C, 0, 2, 797}, + {0x0B4D, 9, 0, 0}, + {0x0B5C, 0, 2 | DECOMP_NO_COMPOSE, 799}, /* in exclusion list */ + {0x0B5D, 0, 2 | DECOMP_NO_COMPOSE, 801}, /* in exclusion list */ + {0x0B94, 0, 2, 803}, + {0x0BCA, 0, 2, 805}, + {0x0BCB, 0, 2, 807}, + {0x0BCC, 0, 2, 809}, + {0x0BCD, 9, 0, 0}, + {0x0C3C, 7, 0, 0}, + {0x0C48, 0, 2, 811}, + {0x0C4D, 9, 0, 0}, + {0x0C55, 84, 0, 0}, + {0x0C56, 91, 0, 0}, + {0x0CBC, 7, 0, 0}, + {0x0CC0, 0, 2, 813}, + {0x0CC7, 0, 2, 815}, + {0x0CC8, 0, 2, 817}, + {0x0CCA, 0, 2, 819}, + {0x0CCB, 0, 2, 821}, + {0x0CCD, 9, 0, 0}, + {0x0D3B, 9, 0, 0}, + {0x0D3C, 9, 0, 0}, + {0x0D4A, 0, 2, 823}, + {0x0D4B, 0, 2, 825}, + {0x0D4C, 0, 2, 827}, + {0x0D4D, 9, 0, 0}, + {0x0DCA, 9, 0, 0}, + {0x0DDA, 0, 2, 829}, + {0x0DDC, 0, 2, 831}, + {0x0DDD, 0, 2, 833}, + {0x0DDE, 0, 2, 835}, + {0x0E33, 0, 2 | DECOMP_COMPAT, 837}, + {0x0E38, 103, 0, 0}, + {0x0E39, 103, 0, 0}, + {0x0E3A, 9, 0, 0}, + {0x0E48, 107, 0, 0}, + {0x0E49, 107, 0, 0}, + {0x0E4A, 107, 0, 0}, + {0x0E4B, 107, 0, 0}, + {0x0EB3, 0, 2 | DECOMP_COMPAT, 839}, + {0x0EB8, 118, 0, 0}, + {0x0EB9, 118, 0, 0}, + {0x0EBA, 9, 0, 0}, + {0x0EC8, 122, 0, 0}, + {0x0EC9, 122, 0, 0}, + {0x0ECA, 122, 0, 0}, + {0x0ECB, 122, 0, 0}, + {0x0EDC, 0, 2 | DECOMP_COMPAT, 841}, + {0x0EDD, 0, 2 | DECOMP_COMPAT, 843}, + {0x0F0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0F0B}, + {0x0F18, 220, 0, 0}, + {0x0F19, 220, 0, 0}, + {0x0F35, 220, 0, 0}, + {0x0F37, 220, 0, 0}, + {0x0F39, 216, 0, 0}, + {0x0F43, 0, 2 | DECOMP_NO_COMPOSE, 845}, /* in exclusion list */ + {0x0F4D, 0, 2 | DECOMP_NO_COMPOSE, 847}, /* in exclusion list */ + {0x0F52, 0, 2 | DECOMP_NO_COMPOSE, 849}, /* in exclusion list */ + {0x0F57, 0, 2 | DECOMP_NO_COMPOSE, 851}, /* in exclusion list */ + {0x0F5C, 0, 2 | DECOMP_NO_COMPOSE, 853}, /* in exclusion list */ + {0x0F69, 0, 2 | DECOMP_NO_COMPOSE, 855}, /* in exclusion list */ + {0x0F71, 129, 0, 0}, + {0x0F72, 130, 0, 0}, + {0x0F73, 0, 2 | DECOMP_NO_COMPOSE, 857}, /* non-starter decomposition */ + {0x0F74, 132, 0, 0}, + {0x0F75, 0, 2 | DECOMP_NO_COMPOSE, 859}, /* non-starter decomposition */ + {0x0F76, 0, 2 | DECOMP_NO_COMPOSE, 861}, /* in exclusion list */ + {0x0F77, 0, 2 | DECOMP_COMPAT, 863}, + {0x0F78, 0, 2 | DECOMP_NO_COMPOSE, 865}, /* in exclusion list */ + {0x0F79, 0, 2 | DECOMP_COMPAT, 867}, + {0x0F7A, 130, 0, 0}, + {0x0F7B, 130, 0, 0}, + {0x0F7C, 130, 0, 0}, + {0x0F7D, 130, 0, 0}, + {0x0F80, 130, 0, 0}, + {0x0F81, 0, 2 | DECOMP_NO_COMPOSE, 869}, /* non-starter decomposition */ + {0x0F82, 230, 0, 0}, + {0x0F83, 230, 0, 0}, + {0x0F84, 9, 0, 0}, + {0x0F86, 230, 0, 0}, + {0x0F87, 230, 0, 0}, + {0x0F93, 0, 2 | DECOMP_NO_COMPOSE, 871}, /* in exclusion list */ + {0x0F9D, 0, 2 | DECOMP_NO_COMPOSE, 873}, /* in exclusion list */ + {0x0FA2, 0, 2 | DECOMP_NO_COMPOSE, 875}, /* in exclusion list */ + {0x0FA7, 0, 2 | DECOMP_NO_COMPOSE, 877}, /* in exclusion list */ + {0x0FAC, 0, 2 | DECOMP_NO_COMPOSE, 879}, /* in exclusion list */ + {0x0FB9, 0, 2 | DECOMP_NO_COMPOSE, 881}, /* in exclusion list */ + {0x0FC6, 220, 0, 0}, + {0x1026, 0, 2, 883}, + {0x1037, 7, 0, 0}, + {0x1039, 9, 0, 0}, + {0x103A, 9, 0, 0}, + {0x108D, 220, 0, 0}, + {0x10FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x10DC}, + {0x135D, 230, 0, 0}, + {0x135E, 230, 0, 0}, + {0x135F, 230, 0, 0}, + {0x1714, 9, 0, 0}, + {0x1715, 9, 0, 0}, + {0x1734, 9, 0, 0}, + {0x17D2, 9, 0, 0}, + {0x17DD, 230, 0, 0}, + {0x18A9, 228, 0, 0}, + {0x1939, 222, 0, 0}, + {0x193A, 230, 0, 0}, + {0x193B, 220, 0, 0}, + {0x1A17, 230, 0, 0}, + {0x1A18, 220, 0, 0}, + {0x1A60, 9, 0, 0}, + {0x1A75, 230, 0, 0}, + {0x1A76, 230, 0, 0}, + {0x1A77, 230, 0, 0}, + {0x1A78, 230, 0, 0}, + {0x1A79, 230, 0, 0}, + {0x1A7A, 230, 0, 0}, + {0x1A7B, 230, 0, 0}, + {0x1A7C, 230, 0, 0}, + {0x1A7F, 220, 0, 0}, + {0x1AB0, 230, 0, 0}, + {0x1AB1, 230, 0, 0}, + {0x1AB2, 230, 0, 0}, + {0x1AB3, 230, 0, 0}, + {0x1AB4, 230, 0, 0}, + {0x1AB5, 220, 0, 0}, + {0x1AB6, 220, 0, 0}, + {0x1AB7, 220, 0, 0}, + {0x1AB8, 220, 0, 0}, + {0x1AB9, 220, 0, 0}, + {0x1ABA, 220, 0, 0}, + {0x1ABB, 230, 0, 0}, + {0x1ABC, 230, 0, 0}, + {0x1ABD, 220, 0, 0}, + {0x1ABF, 220, 0, 0}, + {0x1AC0, 220, 0, 0}, + {0x1AC1, 230, 0, 0}, + {0x1AC2, 230, 0, 0}, + {0x1AC3, 220, 0, 0}, + {0x1AC4, 220, 0, 0}, + {0x1AC5, 230, 0, 0}, + {0x1AC6, 230, 0, 0}, + {0x1AC7, 230, 0, 0}, + {0x1AC8, 230, 0, 0}, + {0x1AC9, 230, 0, 0}, + {0x1ACA, 220, 0, 0}, + {0x1ACB, 230, 0, 0}, + {0x1ACC, 230, 0, 0}, + {0x1ACD, 230, 0, 0}, + {0x1ACE, 230, 0, 0}, + {0x1B06, 0, 2, 885}, + {0x1B08, 0, 2, 887}, + {0x1B0A, 0, 2, 889}, + {0x1B0C, 0, 2, 891}, + {0x1B0E, 0, 2, 893}, + {0x1B12, 0, 2, 895}, + {0x1B34, 7, 0, 0}, + {0x1B3B, 0, 2, 897}, + {0x1B3D, 0, 2, 899}, + {0x1B40, 0, 2, 901}, + {0x1B41, 0, 2, 903}, + {0x1B43, 0, 2, 905}, + {0x1B44, 9, 0, 0}, + {0x1B6B, 230, 0, 0}, + {0x1B6C, 220, 0, 0}, + {0x1B6D, 230, 0, 0}, + {0x1B6E, 230, 0, 0}, + {0x1B6F, 230, 0, 0}, + {0x1B70, 230, 0, 0}, + {0x1B71, 230, 0, 0}, + {0x1B72, 230, 0, 0}, + {0x1B73, 230, 0, 0}, + {0x1BAA, 9, 0, 0}, + {0x1BAB, 9, 0, 0}, + {0x1BE6, 7, 0, 0}, + {0x1BF2, 9, 0, 0}, + {0x1BF3, 9, 0, 0}, + {0x1C37, 7, 0, 0}, + {0x1CD0, 230, 0, 0}, + {0x1CD1, 230, 0, 0}, + {0x1CD2, 230, 0, 0}, + {0x1CD4, 1, 0, 0}, + {0x1CD5, 220, 0, 0}, + {0x1CD6, 220, 0, 0}, + {0x1CD7, 220, 0, 0}, + {0x1CD8, 220, 0, 0}, + {0x1CD9, 220, 0, 0}, + {0x1CDA, 230, 0, 0}, + {0x1CDB, 230, 0, 0}, + {0x1CDC, 220, 0, 0}, + {0x1CDD, 220, 0, 0}, + {0x1CDE, 220, 0, 0}, + {0x1CDF, 220, 0, 0}, + {0x1CE0, 230, 0, 0}, + {0x1CE2, 1, 0, 0}, + {0x1CE3, 1, 0, 0}, + {0x1CE4, 1, 0, 0}, + {0x1CE5, 1, 0, 0}, + {0x1CE6, 1, 0, 0}, + {0x1CE7, 1, 0, 0}, + {0x1CE8, 1, 0, 0}, + {0x1CED, 220, 0, 0}, + {0x1CF4, 230, 0, 0}, + {0x1CF8, 230, 0, 0}, + {0x1CF9, 230, 0, 0}, + {0x1D2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00C6}, + {0x1D2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x018E}, + {0x1D33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0222}, + {0x1D3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0250}, + {0x1D45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0251}, + {0x1D46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D02}, + {0x1D47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0259}, + {0x1D4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025B}, + {0x1D4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025C}, + {0x1D4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x014B}, + {0x1D52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0254}, + {0x1D54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D16}, + {0x1D55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D17}, + {0x1D56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D1D}, + {0x1D5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026F}, + {0x1D5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D25}, + {0x1D5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043D}, + {0x1D9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0252}, + {0x1D9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0255}, + {0x1D9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00F0}, + {0x1D9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025C}, + {0x1DA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1DA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025F}, + {0x1DA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0261}, + {0x1DA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0265}, + {0x1DA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0268}, + {0x1DA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0269}, + {0x1DA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026A}, + {0x1DA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D7B}, + {0x1DA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029D}, + {0x1DA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026D}, + {0x1DAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D85}, + {0x1DAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029F}, + {0x1DAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0271}, + {0x1DAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0270}, + {0x1DAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0272}, + {0x1DAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0273}, + {0x1DB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0274}, + {0x1DB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0275}, + {0x1DB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0278}, + {0x1DB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0282}, + {0x1DB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0283}, + {0x1DB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01AB}, + {0x1DB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0289}, + {0x1DB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028A}, + {0x1DB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D1C}, + {0x1DB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028B}, + {0x1DBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028C}, + {0x1DBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1DBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0290}, + {0x1DBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0291}, + {0x1DBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0292}, + {0x1DBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1DC0, 230, 0, 0}, + {0x1DC1, 230, 0, 0}, + {0x1DC2, 220, 0, 0}, + {0x1DC3, 230, 0, 0}, + {0x1DC4, 230, 0, 0}, + {0x1DC5, 230, 0, 0}, + {0x1DC6, 230, 0, 0}, + {0x1DC7, 230, 0, 0}, + {0x1DC8, 230, 0, 0}, + {0x1DC9, 230, 0, 0}, + {0x1DCA, 220, 0, 0}, + {0x1DCB, 230, 0, 0}, + {0x1DCC, 230, 0, 0}, + {0x1DCD, 234, 0, 0}, + {0x1DCE, 214, 0, 0}, + {0x1DCF, 220, 0, 0}, + {0x1DD0, 202, 0, 0}, + {0x1DD1, 230, 0, 0}, + {0x1DD2, 230, 0, 0}, + {0x1DD3, 230, 0, 0}, + {0x1DD4, 230, 0, 0}, + {0x1DD5, 230, 0, 0}, + {0x1DD6, 230, 0, 0}, + {0x1DD7, 230, 0, 0}, + {0x1DD8, 230, 0, 0}, + {0x1DD9, 230, 0, 0}, + {0x1DDA, 230, 0, 0}, + {0x1DDB, 230, 0, 0}, + {0x1DDC, 230, 0, 0}, + {0x1DDD, 230, 0, 0}, + {0x1DDE, 230, 0, 0}, + {0x1DDF, 230, 0, 0}, + {0x1DE0, 230, 0, 0}, + {0x1DE1, 230, 0, 0}, + {0x1DE2, 230, 0, 0}, + {0x1DE3, 230, 0, 0}, + {0x1DE4, 230, 0, 0}, + {0x1DE5, 230, 0, 0}, + {0x1DE6, 230, 0, 0}, + {0x1DE7, 230, 0, 0}, + {0x1DE8, 230, 0, 0}, + {0x1DE9, 230, 0, 0}, + {0x1DEA, 230, 0, 0}, + {0x1DEB, 230, 0, 0}, + {0x1DEC, 230, 0, 0}, + {0x1DED, 230, 0, 0}, + {0x1DEE, 230, 0, 0}, + {0x1DEF, 230, 0, 0}, + {0x1DF0, 230, 0, 0}, + {0x1DF1, 230, 0, 0}, + {0x1DF2, 230, 0, 0}, + {0x1DF3, 230, 0, 0}, + {0x1DF4, 230, 0, 0}, + {0x1DF5, 230, 0, 0}, + {0x1DF6, 232, 0, 0}, + {0x1DF7, 228, 0, 0}, + {0x1DF8, 228, 0, 0}, + {0x1DF9, 220, 0, 0}, + {0x1DFA, 218, 0, 0}, + {0x1DFB, 230, 0, 0}, + {0x1DFC, 233, 0, 0}, + {0x1DFD, 220, 0, 0}, + {0x1DFE, 230, 0, 0}, + {0x1DFF, 220, 0, 0}, + {0x1E00, 0, 2, 907}, + {0x1E01, 0, 2, 909}, + {0x1E02, 0, 2, 911}, + {0x1E03, 0, 2, 913}, + {0x1E04, 0, 2, 915}, + {0x1E05, 0, 2, 917}, + {0x1E06, 0, 2, 919}, + {0x1E07, 0, 2, 921}, + {0x1E08, 0, 2, 923}, + {0x1E09, 0, 2, 925}, + {0x1E0A, 0, 2, 927}, + {0x1E0B, 0, 2, 929}, + {0x1E0C, 0, 2, 931}, + {0x1E0D, 0, 2, 933}, + {0x1E0E, 0, 2, 935}, + {0x1E0F, 0, 2, 937}, + {0x1E10, 0, 2, 939}, + {0x1E11, 0, 2, 941}, + {0x1E12, 0, 2, 943}, + {0x1E13, 0, 2, 945}, + {0x1E14, 0, 2, 947}, + {0x1E15, 0, 2, 949}, + {0x1E16, 0, 2, 951}, + {0x1E17, 0, 2, 953}, + {0x1E18, 0, 2, 955}, + {0x1E19, 0, 2, 957}, + {0x1E1A, 0, 2, 959}, + {0x1E1B, 0, 2, 961}, + {0x1E1C, 0, 2, 963}, + {0x1E1D, 0, 2, 965}, + {0x1E1E, 0, 2, 967}, + {0x1E1F, 0, 2, 969}, + {0x1E20, 0, 2, 971}, + {0x1E21, 0, 2, 973}, + {0x1E22, 0, 2, 975}, + {0x1E23, 0, 2, 977}, + {0x1E24, 0, 2, 979}, + {0x1E25, 0, 2, 981}, + {0x1E26, 0, 2, 983}, + {0x1E27, 0, 2, 985}, + {0x1E28, 0, 2, 987}, + {0x1E29, 0, 2, 989}, + {0x1E2A, 0, 2, 991}, + {0x1E2B, 0, 2, 993}, + {0x1E2C, 0, 2, 995}, + {0x1E2D, 0, 2, 997}, + {0x1E2E, 0, 2, 999}, + {0x1E2F, 0, 2, 1001}, + {0x1E30, 0, 2, 1003}, + {0x1E31, 0, 2, 1005}, + {0x1E32, 0, 2, 1007}, + {0x1E33, 0, 2, 1009}, + {0x1E34, 0, 2, 1011}, + {0x1E35, 0, 2, 1013}, + {0x1E36, 0, 2, 1015}, + {0x1E37, 0, 2, 1017}, + {0x1E38, 0, 2, 1019}, + {0x1E39, 0, 2, 1021}, + {0x1E3A, 0, 2, 1023}, + {0x1E3B, 0, 2, 1025}, + {0x1E3C, 0, 2, 1027}, + {0x1E3D, 0, 2, 1029}, + {0x1E3E, 0, 2, 1031}, + {0x1E3F, 0, 2, 1033}, + {0x1E40, 0, 2, 1035}, + {0x1E41, 0, 2, 1037}, + {0x1E42, 0, 2, 1039}, + {0x1E43, 0, 2, 1041}, + {0x1E44, 0, 2, 1043}, + {0x1E45, 0, 2, 1045}, + {0x1E46, 0, 2, 1047}, + {0x1E47, 0, 2, 1049}, + {0x1E48, 0, 2, 1051}, + {0x1E49, 0, 2, 1053}, + {0x1E4A, 0, 2, 1055}, + {0x1E4B, 0, 2, 1057}, + {0x1E4C, 0, 2, 1059}, + {0x1E4D, 0, 2, 1061}, + {0x1E4E, 0, 2, 1063}, + {0x1E4F, 0, 2, 1065}, + {0x1E50, 0, 2, 1067}, + {0x1E51, 0, 2, 1069}, + {0x1E52, 0, 2, 1071}, + {0x1E53, 0, 2, 1073}, + {0x1E54, 0, 2, 1075}, + {0x1E55, 0, 2, 1077}, + {0x1E56, 0, 2, 1079}, + {0x1E57, 0, 2, 1081}, + {0x1E58, 0, 2, 1083}, + {0x1E59, 0, 2, 1085}, + {0x1E5A, 0, 2, 1087}, + {0x1E5B, 0, 2, 1089}, + {0x1E5C, 0, 2, 1091}, + {0x1E5D, 0, 2, 1093}, + {0x1E5E, 0, 2, 1095}, + {0x1E5F, 0, 2, 1097}, + {0x1E60, 0, 2, 1099}, + {0x1E61, 0, 2, 1101}, + {0x1E62, 0, 2, 1103}, + {0x1E63, 0, 2, 1105}, + {0x1E64, 0, 2, 1107}, + {0x1E65, 0, 2, 1109}, + {0x1E66, 0, 2, 1111}, + {0x1E67, 0, 2, 1113}, + {0x1E68, 0, 2, 1115}, + {0x1E69, 0, 2, 1117}, + {0x1E6A, 0, 2, 1119}, + {0x1E6B, 0, 2, 1121}, + {0x1E6C, 0, 2, 1123}, + {0x1E6D, 0, 2, 1125}, + {0x1E6E, 0, 2, 1127}, + {0x1E6F, 0, 2, 1129}, + {0x1E70, 0, 2, 1131}, + {0x1E71, 0, 2, 1133}, + {0x1E72, 0, 2, 1135}, + {0x1E73, 0, 2, 1137}, + {0x1E74, 0, 2, 1139}, + {0x1E75, 0, 2, 1141}, + {0x1E76, 0, 2, 1143}, + {0x1E77, 0, 2, 1145}, + {0x1E78, 0, 2, 1147}, + {0x1E79, 0, 2, 1149}, + {0x1E7A, 0, 2, 1151}, + {0x1E7B, 0, 2, 1153}, + {0x1E7C, 0, 2, 1155}, + {0x1E7D, 0, 2, 1157}, + {0x1E7E, 0, 2, 1159}, + {0x1E7F, 0, 2, 1161}, + {0x1E80, 0, 2, 1163}, + {0x1E81, 0, 2, 1165}, + {0x1E82, 0, 2, 1167}, + {0x1E83, 0, 2, 1169}, + {0x1E84, 0, 2, 1171}, + {0x1E85, 0, 2, 1173}, + {0x1E86, 0, 2, 1175}, + {0x1E87, 0, 2, 1177}, + {0x1E88, 0, 2, 1179}, + {0x1E89, 0, 2, 1181}, + {0x1E8A, 0, 2, 1183}, + {0x1E8B, 0, 2, 1185}, + {0x1E8C, 0, 2, 1187}, + {0x1E8D, 0, 2, 1189}, + {0x1E8E, 0, 2, 1191}, + {0x1E8F, 0, 2, 1193}, + {0x1E90, 0, 2, 1195}, + {0x1E91, 0, 2, 1197}, + {0x1E92, 0, 2, 1199}, + {0x1E93, 0, 2, 1201}, + {0x1E94, 0, 2, 1203}, + {0x1E95, 0, 2, 1205}, + {0x1E96, 0, 2, 1207}, + {0x1E97, 0, 2, 1209}, + {0x1E98, 0, 2, 1211}, + {0x1E99, 0, 2, 1213}, + {0x1E9A, 0, 2 | DECOMP_COMPAT, 1215}, + {0x1E9B, 0, 2, 1217}, + {0x1EA0, 0, 2, 1219}, + {0x1EA1, 0, 2, 1221}, + {0x1EA2, 0, 2, 1223}, + {0x1EA3, 0, 2, 1225}, + {0x1EA4, 0, 2, 1227}, + {0x1EA5, 0, 2, 1229}, + {0x1EA6, 0, 2, 1231}, + {0x1EA7, 0, 2, 1233}, + {0x1EA8, 0, 2, 1235}, + {0x1EA9, 0, 2, 1237}, + {0x1EAA, 0, 2, 1239}, + {0x1EAB, 0, 2, 1241}, + {0x1EAC, 0, 2, 1243}, + {0x1EAD, 0, 2, 1245}, + {0x1EAE, 0, 2, 1247}, + {0x1EAF, 0, 2, 1249}, + {0x1EB0, 0, 2, 1251}, + {0x1EB1, 0, 2, 1253}, + {0x1EB2, 0, 2, 1255}, + {0x1EB3, 0, 2, 1257}, + {0x1EB4, 0, 2, 1259}, + {0x1EB5, 0, 2, 1261}, + {0x1EB6, 0, 2, 1263}, + {0x1EB7, 0, 2, 1265}, + {0x1EB8, 0, 2, 1267}, + {0x1EB9, 0, 2, 1269}, + {0x1EBA, 0, 2, 1271}, + {0x1EBB, 0, 2, 1273}, + {0x1EBC, 0, 2, 1275}, + {0x1EBD, 0, 2, 1277}, + {0x1EBE, 0, 2, 1279}, + {0x1EBF, 0, 2, 1281}, + {0x1EC0, 0, 2, 1283}, + {0x1EC1, 0, 2, 1285}, + {0x1EC2, 0, 2, 1287}, + {0x1EC3, 0, 2, 1289}, + {0x1EC4, 0, 2, 1291}, + {0x1EC5, 0, 2, 1293}, + {0x1EC6, 0, 2, 1295}, + {0x1EC7, 0, 2, 1297}, + {0x1EC8, 0, 2, 1299}, + {0x1EC9, 0, 2, 1301}, + {0x1ECA, 0, 2, 1303}, + {0x1ECB, 0, 2, 1305}, + {0x1ECC, 0, 2, 1307}, + {0x1ECD, 0, 2, 1309}, + {0x1ECE, 0, 2, 1311}, + {0x1ECF, 0, 2, 1313}, + {0x1ED0, 0, 2, 1315}, + {0x1ED1, 0, 2, 1317}, + {0x1ED2, 0, 2, 1319}, + {0x1ED3, 0, 2, 1321}, + {0x1ED4, 0, 2, 1323}, + {0x1ED5, 0, 2, 1325}, + {0x1ED6, 0, 2, 1327}, + {0x1ED7, 0, 2, 1329}, + {0x1ED8, 0, 2, 1331}, + {0x1ED9, 0, 2, 1333}, + {0x1EDA, 0, 2, 1335}, + {0x1EDB, 0, 2, 1337}, + {0x1EDC, 0, 2, 1339}, + {0x1EDD, 0, 2, 1341}, + {0x1EDE, 0, 2, 1343}, + {0x1EDF, 0, 2, 1345}, + {0x1EE0, 0, 2, 1347}, + {0x1EE1, 0, 2, 1349}, + {0x1EE2, 0, 2, 1351}, + {0x1EE3, 0, 2, 1353}, + {0x1EE4, 0, 2, 1355}, + {0x1EE5, 0, 2, 1357}, + {0x1EE6, 0, 2, 1359}, + {0x1EE7, 0, 2, 1361}, + {0x1EE8, 0, 2, 1363}, + {0x1EE9, 0, 2, 1365}, + {0x1EEA, 0, 2, 1367}, + {0x1EEB, 0, 2, 1369}, + {0x1EEC, 0, 2, 1371}, + {0x1EED, 0, 2, 1373}, + {0x1EEE, 0, 2, 1375}, + {0x1EEF, 0, 2, 1377}, + {0x1EF0, 0, 2, 1379}, + {0x1EF1, 0, 2, 1381}, + {0x1EF2, 0, 2, 1383}, + {0x1EF3, 0, 2, 1385}, + {0x1EF4, 0, 2, 1387}, + {0x1EF5, 0, 2, 1389}, + {0x1EF6, 0, 2, 1391}, + {0x1EF7, 0, 2, 1393}, + {0x1EF8, 0, 2, 1395}, + {0x1EF9, 0, 2, 1397}, + {0x1F00, 0, 2, 1399}, + {0x1F01, 0, 2, 1401}, + {0x1F02, 0, 2, 1403}, + {0x1F03, 0, 2, 1405}, + {0x1F04, 0, 2, 1407}, + {0x1F05, 0, 2, 1409}, + {0x1F06, 0, 2, 1411}, + {0x1F07, 0, 2, 1413}, + {0x1F08, 0, 2, 1415}, + {0x1F09, 0, 2, 1417}, + {0x1F0A, 0, 2, 1419}, + {0x1F0B, 0, 2, 1421}, + {0x1F0C, 0, 2, 1423}, + {0x1F0D, 0, 2, 1425}, + {0x1F0E, 0, 2, 1427}, + {0x1F0F, 0, 2, 1429}, + {0x1F10, 0, 2, 1431}, + {0x1F11, 0, 2, 1433}, + {0x1F12, 0, 2, 1435}, + {0x1F13, 0, 2, 1437}, + {0x1F14, 0, 2, 1439}, + {0x1F15, 0, 2, 1441}, + {0x1F18, 0, 2, 1443}, + {0x1F19, 0, 2, 1445}, + {0x1F1A, 0, 2, 1447}, + {0x1F1B, 0, 2, 1449}, + {0x1F1C, 0, 2, 1451}, + {0x1F1D, 0, 2, 1453}, + {0x1F20, 0, 2, 1455}, + {0x1F21, 0, 2, 1457}, + {0x1F22, 0, 2, 1459}, + {0x1F23, 0, 2, 1461}, + {0x1F24, 0, 2, 1463}, + {0x1F25, 0, 2, 1465}, + {0x1F26, 0, 2, 1467}, + {0x1F27, 0, 2, 1469}, + {0x1F28, 0, 2, 1471}, + {0x1F29, 0, 2, 1473}, + {0x1F2A, 0, 2, 1475}, + {0x1F2B, 0, 2, 1477}, + {0x1F2C, 0, 2, 1479}, + {0x1F2D, 0, 2, 1481}, + {0x1F2E, 0, 2, 1483}, + {0x1F2F, 0, 2, 1485}, + {0x1F30, 0, 2, 1487}, + {0x1F31, 0, 2, 1489}, + {0x1F32, 0, 2, 1491}, + {0x1F33, 0, 2, 1493}, + {0x1F34, 0, 2, 1495}, + {0x1F35, 0, 2, 1497}, + {0x1F36, 0, 2, 1499}, + {0x1F37, 0, 2, 1501}, + {0x1F38, 0, 2, 1503}, + {0x1F39, 0, 2, 1505}, + {0x1F3A, 0, 2, 1507}, + {0x1F3B, 0, 2, 1509}, + {0x1F3C, 0, 2, 1511}, + {0x1F3D, 0, 2, 1513}, + {0x1F3E, 0, 2, 1515}, + {0x1F3F, 0, 2, 1517}, + {0x1F40, 0, 2, 1519}, + {0x1F41, 0, 2, 1521}, + {0x1F42, 0, 2, 1523}, + {0x1F43, 0, 2, 1525}, + {0x1F44, 0, 2, 1527}, + {0x1F45, 0, 2, 1529}, + {0x1F48, 0, 2, 1531}, + {0x1F49, 0, 2, 1533}, + {0x1F4A, 0, 2, 1535}, + {0x1F4B, 0, 2, 1537}, + {0x1F4C, 0, 2, 1539}, + {0x1F4D, 0, 2, 1541}, + {0x1F50, 0, 2, 1543}, + {0x1F51, 0, 2, 1545}, + {0x1F52, 0, 2, 1547}, + {0x1F53, 0, 2, 1549}, + {0x1F54, 0, 2, 1551}, + {0x1F55, 0, 2, 1553}, + {0x1F56, 0, 2, 1555}, + {0x1F57, 0, 2, 1557}, + {0x1F59, 0, 2, 1559}, + {0x1F5B, 0, 2, 1561}, + {0x1F5D, 0, 2, 1563}, + {0x1F5F, 0, 2, 1565}, + {0x1F60, 0, 2, 1567}, + {0x1F61, 0, 2, 1569}, + {0x1F62, 0, 2, 1571}, + {0x1F63, 0, 2, 1573}, + {0x1F64, 0, 2, 1575}, + {0x1F65, 0, 2, 1577}, + {0x1F66, 0, 2, 1579}, + {0x1F67, 0, 2, 1581}, + {0x1F68, 0, 2, 1583}, + {0x1F69, 0, 2, 1585}, + {0x1F6A, 0, 2, 1587}, + {0x1F6B, 0, 2, 1589}, + {0x1F6C, 0, 2, 1591}, + {0x1F6D, 0, 2, 1593}, + {0x1F6E, 0, 2, 1595}, + {0x1F6F, 0, 2, 1597}, + {0x1F70, 0, 2, 1599}, + {0x1F71, 0, 1 | DECOMP_INLINE, 0x03AC}, + {0x1F72, 0, 2, 1601}, + {0x1F73, 0, 1 | DECOMP_INLINE, 0x03AD}, + {0x1F74, 0, 2, 1603}, + {0x1F75, 0, 1 | DECOMP_INLINE, 0x03AE}, + {0x1F76, 0, 2, 1605}, + {0x1F77, 0, 1 | DECOMP_INLINE, 0x03AF}, + {0x1F78, 0, 2, 1607}, + {0x1F79, 0, 1 | DECOMP_INLINE, 0x03CC}, + {0x1F7A, 0, 2, 1609}, + {0x1F7B, 0, 1 | DECOMP_INLINE, 0x03CD}, + {0x1F7C, 0, 2, 1611}, + {0x1F7D, 0, 1 | DECOMP_INLINE, 0x03CE}, + {0x1F80, 0, 2, 1613}, + {0x1F81, 0, 2, 1615}, + {0x1F82, 0, 2, 1617}, + {0x1F83, 0, 2, 1619}, + {0x1F84, 0, 2, 1621}, + {0x1F85, 0, 2, 1623}, + {0x1F86, 0, 2, 1625}, + {0x1F87, 0, 2, 1627}, + {0x1F88, 0, 2, 1629}, + {0x1F89, 0, 2, 1631}, + {0x1F8A, 0, 2, 1633}, + {0x1F8B, 0, 2, 1635}, + {0x1F8C, 0, 2, 1637}, + {0x1F8D, 0, 2, 1639}, + {0x1F8E, 0, 2, 1641}, + {0x1F8F, 0, 2, 1643}, + {0x1F90, 0, 2, 1645}, + {0x1F91, 0, 2, 1647}, + {0x1F92, 0, 2, 1649}, + {0x1F93, 0, 2, 1651}, + {0x1F94, 0, 2, 1653}, + {0x1F95, 0, 2, 1655}, + {0x1F96, 0, 2, 1657}, + {0x1F97, 0, 2, 1659}, + {0x1F98, 0, 2, 1661}, + {0x1F99, 0, 2, 1663}, + {0x1F9A, 0, 2, 1665}, + {0x1F9B, 0, 2, 1667}, + {0x1F9C, 0, 2, 1669}, + {0x1F9D, 0, 2, 1671}, + {0x1F9E, 0, 2, 1673}, + {0x1F9F, 0, 2, 1675}, + {0x1FA0, 0, 2, 1677}, + {0x1FA1, 0, 2, 1679}, + {0x1FA2, 0, 2, 1681}, + {0x1FA3, 0, 2, 1683}, + {0x1FA4, 0, 2, 1685}, + {0x1FA5, 0, 2, 1687}, + {0x1FA6, 0, 2, 1689}, + {0x1FA7, 0, 2, 1691}, + {0x1FA8, 0, 2, 1693}, + {0x1FA9, 0, 2, 1695}, + {0x1FAA, 0, 2, 1697}, + {0x1FAB, 0, 2, 1699}, + {0x1FAC, 0, 2, 1701}, + {0x1FAD, 0, 2, 1703}, + {0x1FAE, 0, 2, 1705}, + {0x1FAF, 0, 2, 1707}, + {0x1FB0, 0, 2, 1709}, + {0x1FB1, 0, 2, 1711}, + {0x1FB2, 0, 2, 1713}, + {0x1FB3, 0, 2, 1715}, + {0x1FB4, 0, 2, 1717}, + {0x1FB6, 0, 2, 1719}, + {0x1FB7, 0, 2, 1721}, + {0x1FB8, 0, 2, 1723}, + {0x1FB9, 0, 2, 1725}, + {0x1FBA, 0, 2, 1727}, + {0x1FBB, 0, 1 | DECOMP_INLINE, 0x0386}, + {0x1FBC, 0, 2, 1729}, + {0x1FBD, 0, 2 | DECOMP_COMPAT, 1731}, + {0x1FBE, 0, 1 | DECOMP_INLINE, 0x03B9}, + {0x1FBF, 0, 2 | DECOMP_COMPAT, 1733}, + {0x1FC0, 0, 2 | DECOMP_COMPAT, 1735}, + {0x1FC1, 0, 2, 1737}, + {0x1FC2, 0, 2, 1739}, + {0x1FC3, 0, 2, 1741}, + {0x1FC4, 0, 2, 1743}, + {0x1FC6, 0, 2, 1745}, + {0x1FC7, 0, 2, 1747}, + {0x1FC8, 0, 2, 1749}, + {0x1FC9, 0, 1 | DECOMP_INLINE, 0x0388}, + {0x1FCA, 0, 2, 1751}, + {0x1FCB, 0, 1 | DECOMP_INLINE, 0x0389}, + {0x1FCC, 0, 2, 1753}, + {0x1FCD, 0, 2, 1755}, + {0x1FCE, 0, 2, 1757}, + {0x1FCF, 0, 2, 1759}, + {0x1FD0, 0, 2, 1761}, + {0x1FD1, 0, 2, 1763}, + {0x1FD2, 0, 2, 1765}, + {0x1FD3, 0, 1 | DECOMP_INLINE, 0x0390}, + {0x1FD6, 0, 2, 1767}, + {0x1FD7, 0, 2, 1769}, + {0x1FD8, 0, 2, 1771}, + {0x1FD9, 0, 2, 1773}, + {0x1FDA, 0, 2, 1775}, + {0x1FDB, 0, 1 | DECOMP_INLINE, 0x038A}, + {0x1FDD, 0, 2, 1777}, + {0x1FDE, 0, 2, 1779}, + {0x1FDF, 0, 2, 1781}, + {0x1FE0, 0, 2, 1783}, + {0x1FE1, 0, 2, 1785}, + {0x1FE2, 0, 2, 1787}, + {0x1FE3, 0, 1 | DECOMP_INLINE, 0x03B0}, + {0x1FE4, 0, 2, 1789}, + {0x1FE5, 0, 2, 1791}, + {0x1FE6, 0, 2, 1793}, + {0x1FE7, 0, 2, 1795}, + {0x1FE8, 0, 2, 1797}, + {0x1FE9, 0, 2, 1799}, + {0x1FEA, 0, 2, 1801}, + {0x1FEB, 0, 1 | DECOMP_INLINE, 0x038E}, + {0x1FEC, 0, 2, 1803}, + {0x1FED, 0, 2, 1805}, + {0x1FEE, 0, 1 | DECOMP_INLINE, 0x0385}, + {0x1FEF, 0, 1 | DECOMP_INLINE, 0x0060}, + {0x1FF2, 0, 2, 1807}, + {0x1FF3, 0, 2, 1809}, + {0x1FF4, 0, 2, 1811}, + {0x1FF6, 0, 2, 1813}, + {0x1FF7, 0, 2, 1815}, + {0x1FF8, 0, 2, 1817}, + {0x1FF9, 0, 1 | DECOMP_INLINE, 0x038C}, + {0x1FFA, 0, 2, 1819}, + {0x1FFB, 0, 1 | DECOMP_INLINE, 0x038F}, + {0x1FFC, 0, 2, 1821}, + {0x1FFD, 0, 1 | DECOMP_INLINE, 0x00B4}, + {0x1FFE, 0, 2 | DECOMP_COMPAT, 1823}, + {0x2000, 0, 1 | DECOMP_INLINE, 0x2002}, + {0x2001, 0, 1 | DECOMP_INLINE, 0x2003}, + {0x2002, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2003, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2004, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2005, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2006, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2007, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2008, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2009, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x200A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2011, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2010}, + {0x2017, 0, 2 | DECOMP_COMPAT, 1825}, + {0x2024, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0x2025, 0, 2 | DECOMP_COMPAT, 1827}, + {0x2026, 0, 3 | DECOMP_COMPAT, 1829}, + {0x202F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2033, 0, 2 | DECOMP_COMPAT, 1832}, + {0x2034, 0, 3 | DECOMP_COMPAT, 1834}, + {0x2036, 0, 2 | DECOMP_COMPAT, 1837}, + {0x2037, 0, 3 | DECOMP_COMPAT, 1839}, + {0x203C, 0, 2 | DECOMP_COMPAT, 1842}, + {0x203E, 0, 2 | DECOMP_COMPAT, 1844}, + {0x2047, 0, 2 | DECOMP_COMPAT, 1846}, + {0x2048, 0, 2 | DECOMP_COMPAT, 1848}, + {0x2049, 0, 2 | DECOMP_COMPAT, 1850}, + {0x2057, 0, 4 | DECOMP_COMPAT, 1852}, + {0x205F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x2070, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2071, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2074, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2075, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2076, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2077, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2078, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2079, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x207A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0x207B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2212}, + {0x207C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0x207D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0x207E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0x207F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x2080, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2081, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x2082, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x2083, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x2084, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2085, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2086, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2087, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2088, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2089, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x208A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0x208B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2212}, + {0x208C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0x208D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0x208E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0x2090, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x2091, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2092, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x2093, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x2094, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0259}, + {0x2095, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x2096, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x2097, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x2098, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x2099, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x209A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x209B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x209C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x20A8, 0, 2 | DECOMP_COMPAT, 1856}, + {0x20D0, 230, 0, 0}, + {0x20D1, 230, 0, 0}, + {0x20D2, 1, 0, 0}, + {0x20D3, 1, 0, 0}, + {0x20D4, 230, 0, 0}, + {0x20D5, 230, 0, 0}, + {0x20D6, 230, 0, 0}, + {0x20D7, 230, 0, 0}, + {0x20D8, 1, 0, 0}, + {0x20D9, 1, 0, 0}, + {0x20DA, 1, 0, 0}, + {0x20DB, 230, 0, 0}, + {0x20DC, 230, 0, 0}, + {0x20E1, 230, 0, 0}, + {0x20E5, 1, 0, 0}, + {0x20E6, 1, 0, 0}, + {0x20E7, 230, 0, 0}, + {0x20E8, 220, 0, 0}, + {0x20E9, 230, 0, 0}, + {0x20EA, 1, 0, 0}, + {0x20EB, 1, 0, 0}, + {0x20EC, 220, 0, 0}, + {0x20ED, 220, 0, 0}, + {0x20EE, 220, 0, 0}, + {0x20EF, 220, 0, 0}, + {0x20F0, 230, 0, 0}, + {0x2100, 0, 3 | DECOMP_COMPAT, 1858}, + {0x2101, 0, 3 | DECOMP_COMPAT, 1861}, + {0x2102, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x2103, 0, 2 | DECOMP_COMPAT, 1864}, + {0x2105, 0, 3 | DECOMP_COMPAT, 1866}, + {0x2106, 0, 3 | DECOMP_COMPAT, 1869}, + {0x2107, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0190}, + {0x2109, 0, 2 | DECOMP_COMPAT, 1872}, + {0x210A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x210B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x210E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x210F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0127}, + {0x2110, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2111, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2112, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x2113, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x2115, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x2116, 0, 2 | DECOMP_COMPAT, 1874}, + {0x2119, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x211A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x211B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x211C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x211D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x2120, 0, 2 | DECOMP_COMPAT, 1876}, + {0x2121, 0, 3 | DECOMP_COMPAT, 1878}, + {0x2122, 0, 2 | DECOMP_COMPAT, 1881}, + {0x2124, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x2126, 0, 1 | DECOMP_INLINE, 0x03A9}, + {0x2128, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x212A, 0, 1 | DECOMP_INLINE, 0x004B}, + {0x212B, 0, 1 | DECOMP_INLINE, 0x00C5}, + {0x212C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x212D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x212F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2130, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x2131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x2133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x2134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x2135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D0}, + {0x2136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D1}, + {0x2137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D2}, + {0x2138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D3}, + {0x2139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x213B, 0, 3 | DECOMP_COMPAT, 1883}, + {0x213C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x213D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x213E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x213F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x2140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2211}, + {0x2145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x2146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x2147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x2148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x2150, 0, 3 | DECOMP_COMPAT, 1886}, + {0x2151, 0, 3 | DECOMP_COMPAT, 1889}, + {0x2152, 0, 4 | DECOMP_COMPAT, 1892}, + {0x2153, 0, 3 | DECOMP_COMPAT, 1896}, + {0x2154, 0, 3 | DECOMP_COMPAT, 1899}, + {0x2155, 0, 3 | DECOMP_COMPAT, 1902}, + {0x2156, 0, 3 | DECOMP_COMPAT, 1905}, + {0x2157, 0, 3 | DECOMP_COMPAT, 1908}, + {0x2158, 0, 3 | DECOMP_COMPAT, 1911}, + {0x2159, 0, 3 | DECOMP_COMPAT, 1914}, + {0x215A, 0, 3 | DECOMP_COMPAT, 1917}, + {0x215B, 0, 3 | DECOMP_COMPAT, 1920}, + {0x215C, 0, 3 | DECOMP_COMPAT, 1923}, + {0x215D, 0, 3 | DECOMP_COMPAT, 1926}, + {0x215E, 0, 3 | DECOMP_COMPAT, 1929}, + {0x215F, 0, 2 | DECOMP_COMPAT, 1932}, + {0x2160, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x2161, 0, 2 | DECOMP_COMPAT, 1934}, + {0x2162, 0, 3 | DECOMP_COMPAT, 1936}, + {0x2163, 0, 2 | DECOMP_COMPAT, 1939}, + {0x2164, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x2165, 0, 2 | DECOMP_COMPAT, 1941}, + {0x2166, 0, 3 | DECOMP_COMPAT, 1943}, + {0x2167, 0, 4 | DECOMP_COMPAT, 1946}, + {0x2168, 0, 2 | DECOMP_COMPAT, 1950}, + {0x2169, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x216A, 0, 2 | DECOMP_COMPAT, 1952}, + {0x216B, 0, 3 | DECOMP_COMPAT, 1954}, + {0x216C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x216D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x216E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x216F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x2170, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x2171, 0, 2 | DECOMP_COMPAT, 1957}, + {0x2172, 0, 3 | DECOMP_COMPAT, 1959}, + {0x2173, 0, 2 | DECOMP_COMPAT, 1962}, + {0x2174, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x2175, 0, 2 | DECOMP_COMPAT, 1964}, + {0x2176, 0, 3 | DECOMP_COMPAT, 1966}, + {0x2177, 0, 4 | DECOMP_COMPAT, 1969}, + {0x2178, 0, 2 | DECOMP_COMPAT, 1973}, + {0x2179, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x217A, 0, 2 | DECOMP_COMPAT, 1975}, + {0x217B, 0, 3 | DECOMP_COMPAT, 1977}, + {0x217C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x217D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x217E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x217F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x2189, 0, 3 | DECOMP_COMPAT, 1980}, + {0x219A, 0, 2, 1983}, + {0x219B, 0, 2, 1985}, + {0x21AE, 0, 2, 1987}, + {0x21CD, 0, 2, 1989}, + {0x21CE, 0, 2, 1991}, + {0x21CF, 0, 2, 1993}, + {0x2204, 0, 2, 1995}, + {0x2209, 0, 2, 1997}, + {0x220C, 0, 2, 1999}, + {0x2224, 0, 2, 2001}, + {0x2226, 0, 2, 2003}, + {0x222C, 0, 2 | DECOMP_COMPAT, 2005}, + {0x222D, 0, 3 | DECOMP_COMPAT, 2007}, + {0x222F, 0, 2 | DECOMP_COMPAT, 2010}, + {0x2230, 0, 3 | DECOMP_COMPAT, 2012}, + {0x2241, 0, 2, 2015}, + {0x2244, 0, 2, 2017}, + {0x2247, 0, 2, 2019}, + {0x2249, 0, 2, 2021}, + {0x2260, 0, 2, 2023}, + {0x2262, 0, 2, 2025}, + {0x226D, 0, 2, 2027}, + {0x226E, 0, 2, 2029}, + {0x226F, 0, 2, 2031}, + {0x2270, 0, 2, 2033}, + {0x2271, 0, 2, 2035}, + {0x2274, 0, 2, 2037}, + {0x2275, 0, 2, 2039}, + {0x2278, 0, 2, 2041}, + {0x2279, 0, 2, 2043}, + {0x2280, 0, 2, 2045}, + {0x2281, 0, 2, 2047}, + {0x2284, 0, 2, 2049}, + {0x2285, 0, 2, 2051}, + {0x2288, 0, 2, 2053}, + {0x2289, 0, 2, 2055}, + {0x22AC, 0, 2, 2057}, + {0x22AD, 0, 2, 2059}, + {0x22AE, 0, 2, 2061}, + {0x22AF, 0, 2, 2063}, + {0x22E0, 0, 2, 2065}, + {0x22E1, 0, 2, 2067}, + {0x22E2, 0, 2, 2069}, + {0x22E3, 0, 2, 2071}, + {0x22EA, 0, 2, 2073}, + {0x22EB, 0, 2, 2075}, + {0x22EC, 0, 2, 2077}, + {0x22ED, 0, 2, 2079}, + {0x2329, 0, 1 | DECOMP_INLINE, 0x3008}, + {0x232A, 0, 1 | DECOMP_INLINE, 0x3009}, + {0x2460, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x2461, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x2462, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x2463, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x2464, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x2465, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x2466, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x2467, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x2468, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x2469, 0, 2 | DECOMP_COMPAT, 2081}, + {0x246A, 0, 2 | DECOMP_COMPAT, 2083}, + {0x246B, 0, 2 | DECOMP_COMPAT, 2085}, + {0x246C, 0, 2 | DECOMP_COMPAT, 2087}, + {0x246D, 0, 2 | DECOMP_COMPAT, 2089}, + {0x246E, 0, 2 | DECOMP_COMPAT, 2091}, + {0x246F, 0, 2 | DECOMP_COMPAT, 2093}, + {0x2470, 0, 2 | DECOMP_COMPAT, 2095}, + {0x2471, 0, 2 | DECOMP_COMPAT, 2097}, + {0x2472, 0, 2 | DECOMP_COMPAT, 2099}, + {0x2473, 0, 2 | DECOMP_COMPAT, 2101}, + {0x2474, 0, 3 | DECOMP_COMPAT, 2103}, + {0x2475, 0, 3 | DECOMP_COMPAT, 2106}, + {0x2476, 0, 3 | DECOMP_COMPAT, 2109}, + {0x2477, 0, 3 | DECOMP_COMPAT, 2112}, + {0x2478, 0, 3 | DECOMP_COMPAT, 2115}, + {0x2479, 0, 3 | DECOMP_COMPAT, 2118}, + {0x247A, 0, 3 | DECOMP_COMPAT, 2121}, + {0x247B, 0, 3 | DECOMP_COMPAT, 2124}, + {0x247C, 0, 3 | DECOMP_COMPAT, 2127}, + {0x247D, 0, 4 | DECOMP_COMPAT, 2130}, + {0x247E, 0, 4 | DECOMP_COMPAT, 2134}, + {0x247F, 0, 4 | DECOMP_COMPAT, 2138}, + {0x2480, 0, 4 | DECOMP_COMPAT, 2142}, + {0x2481, 0, 4 | DECOMP_COMPAT, 2146}, + {0x2482, 0, 4 | DECOMP_COMPAT, 2150}, + {0x2483, 0, 4 | DECOMP_COMPAT, 2154}, + {0x2484, 0, 4 | DECOMP_COMPAT, 2158}, + {0x2485, 0, 4 | DECOMP_COMPAT, 2162}, + {0x2486, 0, 4 | DECOMP_COMPAT, 2166}, + {0x2487, 0, 4 | DECOMP_COMPAT, 2170}, + {0x2488, 0, 2 | DECOMP_COMPAT, 2174}, + {0x2489, 0, 2 | DECOMP_COMPAT, 2176}, + {0x248A, 0, 2 | DECOMP_COMPAT, 2178}, + {0x248B, 0, 2 | DECOMP_COMPAT, 2180}, + {0x248C, 0, 2 | DECOMP_COMPAT, 2182}, + {0x248D, 0, 2 | DECOMP_COMPAT, 2184}, + {0x248E, 0, 2 | DECOMP_COMPAT, 2186}, + {0x248F, 0, 2 | DECOMP_COMPAT, 2188}, + {0x2490, 0, 2 | DECOMP_COMPAT, 2190}, + {0x2491, 0, 3 | DECOMP_COMPAT, 2192}, + {0x2492, 0, 3 | DECOMP_COMPAT, 2195}, + {0x2493, 0, 3 | DECOMP_COMPAT, 2198}, + {0x2494, 0, 3 | DECOMP_COMPAT, 2201}, + {0x2495, 0, 3 | DECOMP_COMPAT, 2204}, + {0x2496, 0, 3 | DECOMP_COMPAT, 2207}, + {0x2497, 0, 3 | DECOMP_COMPAT, 2210}, + {0x2498, 0, 3 | DECOMP_COMPAT, 2213}, + {0x2499, 0, 3 | DECOMP_COMPAT, 2216}, + {0x249A, 0, 3 | DECOMP_COMPAT, 2219}, + {0x249B, 0, 3 | DECOMP_COMPAT, 2222}, + {0x249C, 0, 3 | DECOMP_COMPAT, 2225}, + {0x249D, 0, 3 | DECOMP_COMPAT, 2228}, + {0x249E, 0, 3 | DECOMP_COMPAT, 2231}, + {0x249F, 0, 3 | DECOMP_COMPAT, 2234}, + {0x24A0, 0, 3 | DECOMP_COMPAT, 2237}, + {0x24A1, 0, 3 | DECOMP_COMPAT, 2240}, + {0x24A2, 0, 3 | DECOMP_COMPAT, 2243}, + {0x24A3, 0, 3 | DECOMP_COMPAT, 2246}, + {0x24A4, 0, 3 | DECOMP_COMPAT, 2249}, + {0x24A5, 0, 3 | DECOMP_COMPAT, 2252}, + {0x24A6, 0, 3 | DECOMP_COMPAT, 2255}, + {0x24A7, 0, 3 | DECOMP_COMPAT, 2258}, + {0x24A8, 0, 3 | DECOMP_COMPAT, 2261}, + {0x24A9, 0, 3 | DECOMP_COMPAT, 2264}, + {0x24AA, 0, 3 | DECOMP_COMPAT, 2267}, + {0x24AB, 0, 3 | DECOMP_COMPAT, 2270}, + {0x24AC, 0, 3 | DECOMP_COMPAT, 2273}, + {0x24AD, 0, 3 | DECOMP_COMPAT, 2276}, + {0x24AE, 0, 3 | DECOMP_COMPAT, 2279}, + {0x24AF, 0, 3 | DECOMP_COMPAT, 2282}, + {0x24B0, 0, 3 | DECOMP_COMPAT, 2285}, + {0x24B1, 0, 3 | DECOMP_COMPAT, 2288}, + {0x24B2, 0, 3 | DECOMP_COMPAT, 2291}, + {0x24B3, 0, 3 | DECOMP_COMPAT, 2294}, + {0x24B4, 0, 3 | DECOMP_COMPAT, 2297}, + {0x24B5, 0, 3 | DECOMP_COMPAT, 2300}, + {0x24B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x24B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x24B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x24B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x24BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x24BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x24BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x24BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x24BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x24BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x24C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x24C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x24C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x24C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x24C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x24C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x24C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x24C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x24C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x24C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x24CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x24CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x24CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x24CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x24CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x24CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x24D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x24D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x24D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x24D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x24D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x24D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x24D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x24D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x24D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x24D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x24DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x24DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x24DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x24DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x24DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x24DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x24E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x24E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x24E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x24E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x24E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x24E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x24E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x24E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x24E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x24E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x24EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x2A0C, 0, 4 | DECOMP_COMPAT, 2303}, + {0x2A74, 0, 3 | DECOMP_COMPAT, 2307}, + {0x2A75, 0, 2 | DECOMP_COMPAT, 2310}, + {0x2A76, 0, 3 | DECOMP_COMPAT, 2312}, + {0x2ADC, 0, 2 | DECOMP_NO_COMPOSE, 2315}, /* in exclusion list */ + {0x2C7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x2C7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x2CEF, 230, 0, 0}, + {0x2CF0, 230, 0, 0}, + {0x2CF1, 230, 0, 0}, + {0x2D6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2D61}, + {0x2D7F, 9, 0, 0}, + {0x2DE0, 230, 0, 0}, + {0x2DE1, 230, 0, 0}, + {0x2DE2, 230, 0, 0}, + {0x2DE3, 230, 0, 0}, + {0x2DE4, 230, 0, 0}, + {0x2DE5, 230, 0, 0}, + {0x2DE6, 230, 0, 0}, + {0x2DE7, 230, 0, 0}, + {0x2DE8, 230, 0, 0}, + {0x2DE9, 230, 0, 0}, + {0x2DEA, 230, 0, 0}, + {0x2DEB, 230, 0, 0}, + {0x2DEC, 230, 0, 0}, + {0x2DED, 230, 0, 0}, + {0x2DEE, 230, 0, 0}, + {0x2DEF, 230, 0, 0}, + {0x2DF0, 230, 0, 0}, + {0x2DF1, 230, 0, 0}, + {0x2DF2, 230, 0, 0}, + {0x2DF3, 230, 0, 0}, + {0x2DF4, 230, 0, 0}, + {0x2DF5, 230, 0, 0}, + {0x2DF6, 230, 0, 0}, + {0x2DF7, 230, 0, 0}, + {0x2DF8, 230, 0, 0}, + {0x2DF9, 230, 0, 0}, + {0x2DFA, 230, 0, 0}, + {0x2DFB, 230, 0, 0}, + {0x2DFC, 230, 0, 0}, + {0x2DFD, 230, 0, 0}, + {0x2DFE, 230, 0, 0}, + {0x2DFF, 230, 0, 0}, + {0x2E9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BCD}, + {0x2EF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F9F}, + {0x2F00, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x2F01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E28}, + {0x2F02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E36}, + {0x2F03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E3F}, + {0x2F04, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E59}, + {0x2F05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E85}, + {0x2F06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x2F07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EA0}, + {0x2F08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EBA}, + {0x2F09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x513F}, + {0x2F0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5165}, + {0x2F0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516B}, + {0x2F0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5182}, + {0x2F0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5196}, + {0x2F0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51AB}, + {0x2F0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51E0}, + {0x2F10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x51F5}, + {0x2F11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5200}, + {0x2F12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x529B}, + {0x2F13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x52F9}, + {0x2F14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5315}, + {0x2F15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x531A}, + {0x2F16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5338}, + {0x2F17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x2F18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x535C}, + {0x2F19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5369}, + {0x2F1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5382}, + {0x2F1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53B6}, + {0x2F1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53C8}, + {0x2F1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53E3}, + {0x2F1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56D7}, + {0x2F1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x571F}, + {0x2F20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x58EB}, + {0x2F21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5902}, + {0x2F22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x590A}, + {0x2F23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5915}, + {0x2F24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5927}, + {0x2F25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5973}, + {0x2F26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B50}, + {0x2F27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B80}, + {0x2F28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5BF8}, + {0x2F29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C0F}, + {0x2F2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C22}, + {0x2F2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C38}, + {0x2F2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C6E}, + {0x2F2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5C71}, + {0x2F2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DDB}, + {0x2F2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE5}, + {0x2F30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DF1}, + {0x2F31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DFE}, + {0x2F32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E72}, + {0x2F33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7A}, + {0x2F34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7F}, + {0x2F35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5EF4}, + {0x2F36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5EFE}, + {0x2F37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F0B}, + {0x2F38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F13}, + {0x2F39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F50}, + {0x2F3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F61}, + {0x2F3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F73}, + {0x2F3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5FC3}, + {0x2F3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6208}, + {0x2F3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6236}, + {0x2F3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x624B}, + {0x2F40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x652F}, + {0x2F41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6534}, + {0x2F42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6587}, + {0x2F43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6597}, + {0x2F44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65A4}, + {0x2F45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65B9}, + {0x2F46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E0}, + {0x2F47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E5}, + {0x2F48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x66F0}, + {0x2F49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x2F4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6728}, + {0x2F4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B20}, + {0x2F4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B62}, + {0x2F4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B79}, + {0x2F4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BB3}, + {0x2F4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BCB}, + {0x2F50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BD4}, + {0x2F51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6BDB}, + {0x2F52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C0F}, + {0x2F53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C14}, + {0x2F54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C34}, + {0x2F55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x706B}, + {0x2F56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x722A}, + {0x2F57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7236}, + {0x2F58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x723B}, + {0x2F59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x723F}, + {0x2F5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7247}, + {0x2F5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7259}, + {0x2F5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x725B}, + {0x2F5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x72AC}, + {0x2F5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7384}, + {0x2F5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7389}, + {0x2F60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x74DC}, + {0x2F61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x74E6}, + {0x2F62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7518}, + {0x2F63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x751F}, + {0x2F64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7528}, + {0x2F65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7530}, + {0x2F66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x758B}, + {0x2F67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7592}, + {0x2F68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7676}, + {0x2F69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x767D}, + {0x2F6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76AE}, + {0x2F6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76BF}, + {0x2F6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76EE}, + {0x2F6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77DB}, + {0x2F6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77E2}, + {0x2F6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x77F3}, + {0x2F70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x793A}, + {0x2F71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79B8}, + {0x2F72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79BE}, + {0x2F73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7A74}, + {0x2F74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7ACB}, + {0x2F75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7AF9}, + {0x2F76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7C73}, + {0x2F77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7CF8}, + {0x2F78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F36}, + {0x2F79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F51}, + {0x2F7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7F8A}, + {0x2F7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7FBD}, + {0x2F7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8001}, + {0x2F7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x800C}, + {0x2F7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8012}, + {0x2F7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8033}, + {0x2F80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x807F}, + {0x2F81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8089}, + {0x2F82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81E3}, + {0x2F83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81EA}, + {0x2F84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81F3}, + {0x2F85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x81FC}, + {0x2F86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x820C}, + {0x2F87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x821B}, + {0x2F88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x821F}, + {0x2F89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x826E}, + {0x2F8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8272}, + {0x2F8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8278}, + {0x2F8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x864D}, + {0x2F8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x866B}, + {0x2F8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8840}, + {0x2F8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x884C}, + {0x2F90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8863}, + {0x2F91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x897E}, + {0x2F92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x898B}, + {0x2F93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x89D2}, + {0x2F94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8A00}, + {0x2F95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C37}, + {0x2F96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C46}, + {0x2F97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C55}, + {0x2F98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C78}, + {0x2F99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8C9D}, + {0x2F9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D64}, + {0x2F9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D70}, + {0x2F9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8DB3}, + {0x2F9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8EAB}, + {0x2F9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8ECA}, + {0x2F9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8F9B}, + {0x2FA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8FB0}, + {0x2FA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8FB5}, + {0x2FA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9091}, + {0x2FA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9149}, + {0x2FA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91C6}, + {0x2FA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91CC}, + {0x2FA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91D1}, + {0x2FA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9577}, + {0x2FA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9580}, + {0x2FA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x961C}, + {0x2FAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96B6}, + {0x2FAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96B9}, + {0x2FAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x96E8}, + {0x2FAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9751}, + {0x2FAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x975E}, + {0x2FAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9762}, + {0x2FB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9769}, + {0x2FB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97CB}, + {0x2FB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97ED}, + {0x2FB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x97F3}, + {0x2FB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9801}, + {0x2FB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98A8}, + {0x2FB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98DB}, + {0x2FB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x98DF}, + {0x2FB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9996}, + {0x2FB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9999}, + {0x2FBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x99AC}, + {0x2FBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9AA8}, + {0x2FBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9AD8}, + {0x2FBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ADF}, + {0x2FBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B25}, + {0x2FBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B2F}, + {0x2FC0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B32}, + {0x2FC1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B3C}, + {0x2FC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9B5A}, + {0x2FC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9CE5}, + {0x2FC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9E75}, + {0x2FC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9E7F}, + {0x2FC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EA5}, + {0x2FC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EBB}, + {0x2FC8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EC3}, + {0x2FC9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ECD}, + {0x2FCA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9ED1}, + {0x2FCB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EF9}, + {0x2FCC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9EFD}, + {0x2FCD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F0E}, + {0x2FCE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F13}, + {0x2FCF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F20}, + {0x2FD0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F3B}, + {0x2FD1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F4A}, + {0x2FD2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F52}, + {0x2FD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F8D}, + {0x2FD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9F9C}, + {0x2FD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9FA0}, + {0x3000, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0020}, + {0x302A, 218, 0, 0}, + {0x302B, 228, 0, 0}, + {0x302C, 232, 0, 0}, + {0x302D, 222, 0, 0}, + {0x302E, 224, 0, 0}, + {0x302F, 224, 0, 0}, + {0x3036, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3012}, + {0x3038, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x3039, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5344}, + {0x303A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5345}, + {0x304C, 0, 2, 2317}, + {0x304E, 0, 2, 2319}, + {0x3050, 0, 2, 2321}, + {0x3052, 0, 2, 2323}, + {0x3054, 0, 2, 2325}, + {0x3056, 0, 2, 2327}, + {0x3058, 0, 2, 2329}, + {0x305A, 0, 2, 2331}, + {0x305C, 0, 2, 2333}, + {0x305E, 0, 2, 2335}, + {0x3060, 0, 2, 2337}, + {0x3062, 0, 2, 2339}, + {0x3065, 0, 2, 2341}, + {0x3067, 0, 2, 2343}, + {0x3069, 0, 2, 2345}, + {0x3070, 0, 2, 2347}, + {0x3071, 0, 2, 2349}, + {0x3073, 0, 2, 2351}, + {0x3074, 0, 2, 2353}, + {0x3076, 0, 2, 2355}, + {0x3077, 0, 2, 2357}, + {0x3079, 0, 2, 2359}, + {0x307A, 0, 2, 2361}, + {0x307C, 0, 2, 2363}, + {0x307D, 0, 2, 2365}, + {0x3094, 0, 2, 2367}, + {0x3099, 8, 0, 0}, + {0x309A, 8, 0, 0}, + {0x309B, 0, 2 | DECOMP_COMPAT, 2369}, + {0x309C, 0, 2 | DECOMP_COMPAT, 2371}, + {0x309E, 0, 2, 2373}, + {0x309F, 0, 2 | DECOMP_COMPAT, 2375}, + {0x30AC, 0, 2, 2377}, + {0x30AE, 0, 2, 2379}, + {0x30B0, 0, 2, 2381}, + {0x30B2, 0, 2, 2383}, + {0x30B4, 0, 2, 2385}, + {0x30B6, 0, 2, 2387}, + {0x30B8, 0, 2, 2389}, + {0x30BA, 0, 2, 2391}, + {0x30BC, 0, 2, 2393}, + {0x30BE, 0, 2, 2395}, + {0x30C0, 0, 2, 2397}, + {0x30C2, 0, 2, 2399}, + {0x30C5, 0, 2, 2401}, + {0x30C7, 0, 2, 2403}, + {0x30C9, 0, 2, 2405}, + {0x30D0, 0, 2, 2407}, + {0x30D1, 0, 2, 2409}, + {0x30D3, 0, 2, 2411}, + {0x30D4, 0, 2, 2413}, + {0x30D6, 0, 2, 2415}, + {0x30D7, 0, 2, 2417}, + {0x30D9, 0, 2, 2419}, + {0x30DA, 0, 2, 2421}, + {0x30DC, 0, 2, 2423}, + {0x30DD, 0, 2, 2425}, + {0x30F4, 0, 2, 2427}, + {0x30F7, 0, 2, 2429}, + {0x30F8, 0, 2, 2431}, + {0x30F9, 0, 2, 2433}, + {0x30FA, 0, 2, 2435}, + {0x30FE, 0, 2, 2437}, + {0x30FF, 0, 2 | DECOMP_COMPAT, 2439}, + {0x3131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1100}, + {0x3132, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1101}, + {0x3133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AA}, + {0x3134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1102}, + {0x3135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AC}, + {0x3136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11AD}, + {0x3137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1103}, + {0x3138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1104}, + {0x3139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1105}, + {0x313A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B0}, + {0x313B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B1}, + {0x313C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B2}, + {0x313D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B3}, + {0x313E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B4}, + {0x313F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11B5}, + {0x3140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111A}, + {0x3141, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1106}, + {0x3142, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1107}, + {0x3143, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1108}, + {0x3144, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1121}, + {0x3145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1109}, + {0x3146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110A}, + {0x3147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110B}, + {0x3148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110C}, + {0x3149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110D}, + {0x314A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110E}, + {0x314B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110F}, + {0x314C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1110}, + {0x314D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1111}, + {0x314E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1112}, + {0x314F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1161}, + {0x3150, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1162}, + {0x3151, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1163}, + {0x3152, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1164}, + {0x3153, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1165}, + {0x3154, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1166}, + {0x3155, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1167}, + {0x3156, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1168}, + {0x3157, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1169}, + {0x3158, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116A}, + {0x3159, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116B}, + {0x315A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116C}, + {0x315B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116D}, + {0x315C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116E}, + {0x315D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x116F}, + {0x315E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1170}, + {0x315F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1171}, + {0x3160, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1172}, + {0x3161, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1173}, + {0x3162, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1174}, + {0x3163, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1175}, + {0x3164, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1160}, + {0x3165, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1114}, + {0x3166, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1115}, + {0x3167, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11C7}, + {0x3168, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11C8}, + {0x3169, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11CC}, + {0x316A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11CE}, + {0x316B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D3}, + {0x316C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D7}, + {0x316D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11D9}, + {0x316E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111C}, + {0x316F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11DD}, + {0x3170, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11DF}, + {0x3171, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111D}, + {0x3172, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x111E}, + {0x3173, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1120}, + {0x3174, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1122}, + {0x3175, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1123}, + {0x3176, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1127}, + {0x3177, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1129}, + {0x3178, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112B}, + {0x3179, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112C}, + {0x317A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112D}, + {0x317B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112E}, + {0x317C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x112F}, + {0x317D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1132}, + {0x317E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1136}, + {0x317F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1140}, + {0x3180, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1147}, + {0x3181, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x114C}, + {0x3182, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11F1}, + {0x3183, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11F2}, + {0x3184, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1157}, + {0x3185, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1158}, + {0x3186, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1159}, + {0x3187, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1184}, + {0x3188, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1185}, + {0x3189, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1188}, + {0x318A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1191}, + {0x318B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1192}, + {0x318C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1194}, + {0x318D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x119E}, + {0x318E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x11A1}, + {0x3192, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x3193, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x3194, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x3195, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56DB}, + {0x3196, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0A}, + {0x3197, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x3198, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0B}, + {0x3199, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7532}, + {0x319A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E59}, + {0x319B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E19}, + {0x319C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E01}, + {0x319D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5929}, + {0x319E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5730}, + {0x319F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EBA}, + {0x3200, 0, 3 | DECOMP_COMPAT, 2441}, + {0x3201, 0, 3 | DECOMP_COMPAT, 2444}, + {0x3202, 0, 3 | DECOMP_COMPAT, 2447}, + {0x3203, 0, 3 | DECOMP_COMPAT, 2450}, + {0x3204, 0, 3 | DECOMP_COMPAT, 2453}, + {0x3205, 0, 3 | DECOMP_COMPAT, 2456}, + {0x3206, 0, 3 | DECOMP_COMPAT, 2459}, + {0x3207, 0, 3 | DECOMP_COMPAT, 2462}, + {0x3208, 0, 3 | DECOMP_COMPAT, 2465}, + {0x3209, 0, 3 | DECOMP_COMPAT, 2468}, + {0x320A, 0, 3 | DECOMP_COMPAT, 2471}, + {0x320B, 0, 3 | DECOMP_COMPAT, 2474}, + {0x320C, 0, 3 | DECOMP_COMPAT, 2477}, + {0x320D, 0, 3 | DECOMP_COMPAT, 2480}, + {0x320E, 0, 4 | DECOMP_COMPAT, 2483}, + {0x320F, 0, 4 | DECOMP_COMPAT, 2487}, + {0x3210, 0, 4 | DECOMP_COMPAT, 2491}, + {0x3211, 0, 4 | DECOMP_COMPAT, 2495}, + {0x3212, 0, 4 | DECOMP_COMPAT, 2499}, + {0x3213, 0, 4 | DECOMP_COMPAT, 2503}, + {0x3214, 0, 4 | DECOMP_COMPAT, 2507}, + {0x3215, 0, 4 | DECOMP_COMPAT, 2511}, + {0x3216, 0, 4 | DECOMP_COMPAT, 2515}, + {0x3217, 0, 4 | DECOMP_COMPAT, 2519}, + {0x3218, 0, 4 | DECOMP_COMPAT, 2523}, + {0x3219, 0, 4 | DECOMP_COMPAT, 2527}, + {0x321A, 0, 4 | DECOMP_COMPAT, 2531}, + {0x321B, 0, 4 | DECOMP_COMPAT, 2535}, + {0x321C, 0, 4 | DECOMP_COMPAT, 2539}, + {0x321D, 0, 7 | DECOMP_COMPAT, 2543}, + {0x321E, 0, 6 | DECOMP_COMPAT, 2550}, + {0x3220, 0, 3 | DECOMP_COMPAT, 2556}, + {0x3221, 0, 3 | DECOMP_COMPAT, 2559}, + {0x3222, 0, 3 | DECOMP_COMPAT, 2562}, + {0x3223, 0, 3 | DECOMP_COMPAT, 2565}, + {0x3224, 0, 3 | DECOMP_COMPAT, 2568}, + {0x3225, 0, 3 | DECOMP_COMPAT, 2571}, + {0x3226, 0, 3 | DECOMP_COMPAT, 2574}, + {0x3227, 0, 3 | DECOMP_COMPAT, 2577}, + {0x3228, 0, 3 | DECOMP_COMPAT, 2580}, + {0x3229, 0, 3 | DECOMP_COMPAT, 2583}, + {0x322A, 0, 3 | DECOMP_COMPAT, 2586}, + {0x322B, 0, 3 | DECOMP_COMPAT, 2589}, + {0x322C, 0, 3 | DECOMP_COMPAT, 2592}, + {0x322D, 0, 3 | DECOMP_COMPAT, 2595}, + {0x322E, 0, 3 | DECOMP_COMPAT, 2598}, + {0x322F, 0, 3 | DECOMP_COMPAT, 2601}, + {0x3230, 0, 3 | DECOMP_COMPAT, 2604}, + {0x3231, 0, 3 | DECOMP_COMPAT, 2607}, + {0x3232, 0, 3 | DECOMP_COMPAT, 2610}, + {0x3233, 0, 3 | DECOMP_COMPAT, 2613}, + {0x3234, 0, 3 | DECOMP_COMPAT, 2616}, + {0x3235, 0, 3 | DECOMP_COMPAT, 2619}, + {0x3236, 0, 3 | DECOMP_COMPAT, 2622}, + {0x3237, 0, 3 | DECOMP_COMPAT, 2625}, + {0x3238, 0, 3 | DECOMP_COMPAT, 2628}, + {0x3239, 0, 3 | DECOMP_COMPAT, 2631}, + {0x323A, 0, 3 | DECOMP_COMPAT, 2634}, + {0x323B, 0, 3 | DECOMP_COMPAT, 2637}, + {0x323C, 0, 3 | DECOMP_COMPAT, 2640}, + {0x323D, 0, 3 | DECOMP_COMPAT, 2643}, + {0x323E, 0, 3 | DECOMP_COMPAT, 2646}, + {0x323F, 0, 3 | DECOMP_COMPAT, 2649}, + {0x3240, 0, 3 | DECOMP_COMPAT, 2652}, + {0x3241, 0, 3 | DECOMP_COMPAT, 2655}, + {0x3242, 0, 3 | DECOMP_COMPAT, 2658}, + {0x3243, 0, 3 | DECOMP_COMPAT, 2661}, + {0x3244, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x554F}, + {0x3245, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5E7C}, + {0x3246, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6587}, + {0x3247, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7B8F}, + {0x3250, 0, 3 | DECOMP_COMPAT, 2664}, + {0x3251, 0, 2 | DECOMP_COMPAT, 2667}, + {0x3252, 0, 2 | DECOMP_COMPAT, 2669}, + {0x3253, 0, 2 | DECOMP_COMPAT, 2671}, + {0x3254, 0, 2 | DECOMP_COMPAT, 2673}, + {0x3255, 0, 2 | DECOMP_COMPAT, 2675}, + {0x3256, 0, 2 | DECOMP_COMPAT, 2677}, + {0x3257, 0, 2 | DECOMP_COMPAT, 2679}, + {0x3258, 0, 2 | DECOMP_COMPAT, 2681}, + {0x3259, 0, 2 | DECOMP_COMPAT, 2683}, + {0x325A, 0, 2 | DECOMP_COMPAT, 2685}, + {0x325B, 0, 2 | DECOMP_COMPAT, 2687}, + {0x325C, 0, 2 | DECOMP_COMPAT, 2689}, + {0x325D, 0, 2 | DECOMP_COMPAT, 2691}, + {0x325E, 0, 2 | DECOMP_COMPAT, 2693}, + {0x325F, 0, 2 | DECOMP_COMPAT, 2695}, + {0x3260, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1100}, + {0x3261, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1102}, + {0x3262, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1103}, + {0x3263, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1105}, + {0x3264, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1106}, + {0x3265, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1107}, + {0x3266, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1109}, + {0x3267, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110B}, + {0x3268, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110C}, + {0x3269, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110E}, + {0x326A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x110F}, + {0x326B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1110}, + {0x326C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1111}, + {0x326D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1112}, + {0x326E, 0, 2 | DECOMP_COMPAT, 2697}, + {0x326F, 0, 2 | DECOMP_COMPAT, 2699}, + {0x3270, 0, 2 | DECOMP_COMPAT, 2701}, + {0x3271, 0, 2 | DECOMP_COMPAT, 2703}, + {0x3272, 0, 2 | DECOMP_COMPAT, 2705}, + {0x3273, 0, 2 | DECOMP_COMPAT, 2707}, + {0x3274, 0, 2 | DECOMP_COMPAT, 2709}, + {0x3275, 0, 2 | DECOMP_COMPAT, 2711}, + {0x3276, 0, 2 | DECOMP_COMPAT, 2713}, + {0x3277, 0, 2 | DECOMP_COMPAT, 2715}, + {0x3278, 0, 2 | DECOMP_COMPAT, 2717}, + {0x3279, 0, 2 | DECOMP_COMPAT, 2719}, + {0x327A, 0, 2 | DECOMP_COMPAT, 2721}, + {0x327B, 0, 2 | DECOMP_COMPAT, 2723}, + {0x327C, 0, 5 | DECOMP_COMPAT, 2725}, + {0x327D, 0, 4 | DECOMP_COMPAT, 2730}, + {0x327E, 0, 2 | DECOMP_COMPAT, 2734}, + {0x3280, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x3281, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x3282, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x3283, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x56DB}, + {0x3284, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E94}, + {0x3285, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516D}, + {0x3286, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E03}, + {0x3287, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x516B}, + {0x3288, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E5D}, + {0x3289, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5341}, + {0x328A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x328B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x706B}, + {0x328C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6C34}, + {0x328D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6728}, + {0x328E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x91D1}, + {0x328F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x571F}, + {0x3290, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65E5}, + {0x3291, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x682A}, + {0x3292, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6709}, + {0x3293, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x793E}, + {0x3294, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x540D}, + {0x3295, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7279}, + {0x3296, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CA1}, + {0x3297, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x795D}, + {0x3298, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x52B4}, + {0x3299, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x79D8}, + {0x329A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7537}, + {0x329B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5973}, + {0x329C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9069}, + {0x329D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x512A}, + {0x329E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5370}, + {0x329F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6CE8}, + {0x32A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x9805}, + {0x32A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4F11}, + {0x32A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5199}, + {0x32A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6B63}, + {0x32A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0A}, + {0x32A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x32A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E0B}, + {0x32A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE6}, + {0x32A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53F3}, + {0x32A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x533B}, + {0x32AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B97}, + {0x32AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B66}, + {0x32AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x76E3}, + {0x32AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4F01}, + {0x32AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CC7}, + {0x32AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5354}, + {0x32B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x591C}, + {0x32B1, 0, 2 | DECOMP_COMPAT, 2736}, + {0x32B2, 0, 2 | DECOMP_COMPAT, 2738}, + {0x32B3, 0, 2 | DECOMP_COMPAT, 2740}, + {0x32B4, 0, 2 | DECOMP_COMPAT, 2742}, + {0x32B5, 0, 2 | DECOMP_COMPAT, 2744}, + {0x32B6, 0, 2 | DECOMP_COMPAT, 2746}, + {0x32B7, 0, 2 | DECOMP_COMPAT, 2748}, + {0x32B8, 0, 2 | DECOMP_COMPAT, 2750}, + {0x32B9, 0, 2 | DECOMP_COMPAT, 2752}, + {0x32BA, 0, 2 | DECOMP_COMPAT, 2754}, + {0x32BB, 0, 2 | DECOMP_COMPAT, 2756}, + {0x32BC, 0, 2 | DECOMP_COMPAT, 2758}, + {0x32BD, 0, 2 | DECOMP_COMPAT, 2760}, + {0x32BE, 0, 2 | DECOMP_COMPAT, 2762}, + {0x32BF, 0, 2 | DECOMP_COMPAT, 2764}, + {0x32C0, 0, 2 | DECOMP_COMPAT, 2766}, + {0x32C1, 0, 2 | DECOMP_COMPAT, 2768}, + {0x32C2, 0, 2 | DECOMP_COMPAT, 2770}, + {0x32C3, 0, 2 | DECOMP_COMPAT, 2772}, + {0x32C4, 0, 2 | DECOMP_COMPAT, 2774}, + {0x32C5, 0, 2 | DECOMP_COMPAT, 2776}, + {0x32C6, 0, 2 | DECOMP_COMPAT, 2778}, + {0x32C7, 0, 2 | DECOMP_COMPAT, 2780}, + {0x32C8, 0, 2 | DECOMP_COMPAT, 2782}, + {0x32C9, 0, 3 | DECOMP_COMPAT, 2784}, + {0x32CA, 0, 3 | DECOMP_COMPAT, 2787}, + {0x32CB, 0, 3 | DECOMP_COMPAT, 2790}, + {0x32CC, 0, 2 | DECOMP_COMPAT, 2793}, + {0x32CD, 0, 3 | DECOMP_COMPAT, 2795}, + {0x32CE, 0, 2 | DECOMP_COMPAT, 2798}, + {0x32CF, 0, 3 | DECOMP_COMPAT, 2800}, + {0x32D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A2}, + {0x32D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A4}, + {0x32D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A6}, + {0x32D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A8}, + {0x32D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AA}, + {0x32D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AB}, + {0x32D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AD}, + {0x32D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AF}, + {0x32D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B1}, + {0x32D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B3}, + {0x32DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0x32DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B7}, + {0x32DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B9}, + {0x32DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BB}, + {0x32DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BD}, + {0x32DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BF}, + {0x32E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C1}, + {0x32E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C4}, + {0x32E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C6}, + {0x32E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C8}, + {0x32E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CA}, + {0x32E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CB}, + {0x32E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CC}, + {0x32E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CD}, + {0x32E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CE}, + {0x32E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CF}, + {0x32EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D2}, + {0x32EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D5}, + {0x32EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D8}, + {0x32ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DB}, + {0x32EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DE}, + {0x32EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DF}, + {0x32F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E0}, + {0x32F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E1}, + {0x32F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E2}, + {0x32F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E4}, + {0x32F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E6}, + {0x32F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E8}, + {0x32F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E9}, + {0x32F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EA}, + {0x32F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EB}, + {0x32F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EC}, + {0x32FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30ED}, + {0x32FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EF}, + {0x32FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F0}, + {0x32FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F1}, + {0x32FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F2}, + {0x32FF, 0, 2 | DECOMP_COMPAT, 2803}, + {0x3300, 0, 4 | DECOMP_COMPAT, 2805}, + {0x3301, 0, 4 | DECOMP_COMPAT, 2809}, + {0x3302, 0, 4 | DECOMP_COMPAT, 2813}, + {0x3303, 0, 3 | DECOMP_COMPAT, 2817}, + {0x3304, 0, 4 | DECOMP_COMPAT, 2820}, + {0x3305, 0, 3 | DECOMP_COMPAT, 2824}, + {0x3306, 0, 3 | DECOMP_COMPAT, 2827}, + {0x3307, 0, 5 | DECOMP_COMPAT, 2830}, + {0x3308, 0, 4 | DECOMP_COMPAT, 2835}, + {0x3309, 0, 3 | DECOMP_COMPAT, 2839}, + {0x330A, 0, 3 | DECOMP_COMPAT, 2842}, + {0x330B, 0, 3 | DECOMP_COMPAT, 2845}, + {0x330C, 0, 4 | DECOMP_COMPAT, 2848}, + {0x330D, 0, 4 | DECOMP_COMPAT, 2852}, + {0x330E, 0, 3 | DECOMP_COMPAT, 2856}, + {0x330F, 0, 3 | DECOMP_COMPAT, 2859}, + {0x3310, 0, 2 | DECOMP_COMPAT, 2862}, + {0x3311, 0, 3 | DECOMP_COMPAT, 2864}, + {0x3312, 0, 4 | DECOMP_COMPAT, 2867}, + {0x3313, 0, 4 | DECOMP_COMPAT, 2871}, + {0x3314, 0, 2 | DECOMP_COMPAT, 2875}, + {0x3315, 0, 5 | DECOMP_COMPAT, 2877}, + {0x3316, 0, 6 | DECOMP_COMPAT, 2882}, + {0x3317, 0, 5 | DECOMP_COMPAT, 2888}, + {0x3318, 0, 3 | DECOMP_COMPAT, 2893}, + {0x3319, 0, 5 | DECOMP_COMPAT, 2896}, + {0x331A, 0, 5 | DECOMP_COMPAT, 2901}, + {0x331B, 0, 4 | DECOMP_COMPAT, 2906}, + {0x331C, 0, 3 | DECOMP_COMPAT, 2910}, + {0x331D, 0, 3 | DECOMP_COMPAT, 2913}, + {0x331E, 0, 3 | DECOMP_COMPAT, 2916}, + {0x331F, 0, 4 | DECOMP_COMPAT, 2919}, + {0x3320, 0, 5 | DECOMP_COMPAT, 2923}, + {0x3321, 0, 4 | DECOMP_COMPAT, 2928}, + {0x3322, 0, 3 | DECOMP_COMPAT, 2932}, + {0x3323, 0, 3 | DECOMP_COMPAT, 2935}, + {0x3324, 0, 3 | DECOMP_COMPAT, 2938}, + {0x3325, 0, 2 | DECOMP_COMPAT, 2941}, + {0x3326, 0, 2 | DECOMP_COMPAT, 2943}, + {0x3327, 0, 2 | DECOMP_COMPAT, 2945}, + {0x3328, 0, 2 | DECOMP_COMPAT, 2947}, + {0x3329, 0, 3 | DECOMP_COMPAT, 2949}, + {0x332A, 0, 3 | DECOMP_COMPAT, 2952}, + {0x332B, 0, 5 | DECOMP_COMPAT, 2955}, + {0x332C, 0, 3 | DECOMP_COMPAT, 2960}, + {0x332D, 0, 4 | DECOMP_COMPAT, 2963}, + {0x332E, 0, 5 | DECOMP_COMPAT, 2967}, + {0x332F, 0, 3 | DECOMP_COMPAT, 2972}, + {0x3330, 0, 2 | DECOMP_COMPAT, 2975}, + {0x3331, 0, 2 | DECOMP_COMPAT, 2977}, + {0x3332, 0, 5 | DECOMP_COMPAT, 2979}, + {0x3333, 0, 4 | DECOMP_COMPAT, 2984}, + {0x3334, 0, 5 | DECOMP_COMPAT, 2988}, + {0x3335, 0, 3 | DECOMP_COMPAT, 2993}, + {0x3336, 0, 5 | DECOMP_COMPAT, 2996}, + {0x3337, 0, 2 | DECOMP_COMPAT, 3001}, + {0x3338, 0, 3 | DECOMP_COMPAT, 3003}, + {0x3339, 0, 3 | DECOMP_COMPAT, 3006}, + {0x333A, 0, 3 | DECOMP_COMPAT, 3009}, + {0x333B, 0, 3 | DECOMP_COMPAT, 3012}, + {0x333C, 0, 3 | DECOMP_COMPAT, 3015}, + {0x333D, 0, 4 | DECOMP_COMPAT, 3018}, + {0x333E, 0, 3 | DECOMP_COMPAT, 3022}, + {0x333F, 0, 2 | DECOMP_COMPAT, 3025}, + {0x3340, 0, 3 | DECOMP_COMPAT, 3027}, + {0x3341, 0, 3 | DECOMP_COMPAT, 3030}, + {0x3342, 0, 3 | DECOMP_COMPAT, 3033}, + {0x3343, 0, 4 | DECOMP_COMPAT, 3036}, + {0x3344, 0, 3 | DECOMP_COMPAT, 3040}, + {0x3345, 0, 3 | DECOMP_COMPAT, 3043}, + {0x3346, 0, 3 | DECOMP_COMPAT, 3046}, + {0x3347, 0, 5 | DECOMP_COMPAT, 3049}, + {0x3348, 0, 4 | DECOMP_COMPAT, 3054}, + {0x3349, 0, 2 | DECOMP_COMPAT, 3058}, + {0x334A, 0, 5 | DECOMP_COMPAT, 3060}, + {0x334B, 0, 2 | DECOMP_COMPAT, 3065}, + {0x334C, 0, 4 | DECOMP_COMPAT, 3067}, + {0x334D, 0, 4 | DECOMP_COMPAT, 3071}, + {0x334E, 0, 3 | DECOMP_COMPAT, 3075}, + {0x334F, 0, 3 | DECOMP_COMPAT, 3078}, + {0x3350, 0, 3 | DECOMP_COMPAT, 3081}, + {0x3351, 0, 4 | DECOMP_COMPAT, 3084}, + {0x3352, 0, 2 | DECOMP_COMPAT, 3088}, + {0x3353, 0, 3 | DECOMP_COMPAT, 3090}, + {0x3354, 0, 4 | DECOMP_COMPAT, 3093}, + {0x3355, 0, 2 | DECOMP_COMPAT, 3097}, + {0x3356, 0, 5 | DECOMP_COMPAT, 3099}, + {0x3357, 0, 3 | DECOMP_COMPAT, 3104}, + {0x3358, 0, 2 | DECOMP_COMPAT, 3107}, + {0x3359, 0, 2 | DECOMP_COMPAT, 3109}, + {0x335A, 0, 2 | DECOMP_COMPAT, 3111}, + {0x335B, 0, 2 | DECOMP_COMPAT, 3113}, + {0x335C, 0, 2 | DECOMP_COMPAT, 3115}, + {0x335D, 0, 2 | DECOMP_COMPAT, 3117}, + {0x335E, 0, 2 | DECOMP_COMPAT, 3119}, + {0x335F, 0, 2 | DECOMP_COMPAT, 3121}, + {0x3360, 0, 2 | DECOMP_COMPAT, 3123}, + {0x3361, 0, 2 | DECOMP_COMPAT, 3125}, + {0x3362, 0, 3 | DECOMP_COMPAT, 3127}, + {0x3363, 0, 3 | DECOMP_COMPAT, 3130}, + {0x3364, 0, 3 | DECOMP_COMPAT, 3133}, + {0x3365, 0, 3 | DECOMP_COMPAT, 3136}, + {0x3366, 0, 3 | DECOMP_COMPAT, 3139}, + {0x3367, 0, 3 | DECOMP_COMPAT, 3142}, + {0x3368, 0, 3 | DECOMP_COMPAT, 3145}, + {0x3369, 0, 3 | DECOMP_COMPAT, 3148}, + {0x336A, 0, 3 | DECOMP_COMPAT, 3151}, + {0x336B, 0, 3 | DECOMP_COMPAT, 3154}, + {0x336C, 0, 3 | DECOMP_COMPAT, 3157}, + {0x336D, 0, 3 | DECOMP_COMPAT, 3160}, + {0x336E, 0, 3 | DECOMP_COMPAT, 3163}, + {0x336F, 0, 3 | DECOMP_COMPAT, 3166}, + {0x3370, 0, 3 | DECOMP_COMPAT, 3169}, + {0x3371, 0, 3 | DECOMP_COMPAT, 3172}, + {0x3372, 0, 2 | DECOMP_COMPAT, 3175}, + {0x3373, 0, 2 | DECOMP_COMPAT, 3177}, + {0x3374, 0, 3 | DECOMP_COMPAT, 3179}, + {0x3375, 0, 2 | DECOMP_COMPAT, 3182}, + {0x3376, 0, 2 | DECOMP_COMPAT, 3184}, + {0x3377, 0, 2 | DECOMP_COMPAT, 3186}, + {0x3378, 0, 3 | DECOMP_COMPAT, 3188}, + {0x3379, 0, 3 | DECOMP_COMPAT, 3191}, + {0x337A, 0, 2 | DECOMP_COMPAT, 3194}, + {0x337B, 0, 2 | DECOMP_COMPAT, 3196}, + {0x337C, 0, 2 | DECOMP_COMPAT, 3198}, + {0x337D, 0, 2 | DECOMP_COMPAT, 3200}, + {0x337E, 0, 2 | DECOMP_COMPAT, 3202}, + {0x337F, 0, 4 | DECOMP_COMPAT, 3204}, + {0x3380, 0, 2 | DECOMP_COMPAT, 3208}, + {0x3381, 0, 2 | DECOMP_COMPAT, 3210}, + {0x3382, 0, 2 | DECOMP_COMPAT, 3212}, + {0x3383, 0, 2 | DECOMP_COMPAT, 3214}, + {0x3384, 0, 2 | DECOMP_COMPAT, 3216}, + {0x3385, 0, 2 | DECOMP_COMPAT, 3218}, + {0x3386, 0, 2 | DECOMP_COMPAT, 3220}, + {0x3387, 0, 2 | DECOMP_COMPAT, 3222}, + {0x3388, 0, 3 | DECOMP_COMPAT, 3224}, + {0x3389, 0, 4 | DECOMP_COMPAT, 3227}, + {0x338A, 0, 2 | DECOMP_COMPAT, 3231}, + {0x338B, 0, 2 | DECOMP_COMPAT, 3233}, + {0x338C, 0, 2 | DECOMP_COMPAT, 3235}, + {0x338D, 0, 2 | DECOMP_COMPAT, 3237}, + {0x338E, 0, 2 | DECOMP_COMPAT, 3239}, + {0x338F, 0, 2 | DECOMP_COMPAT, 3241}, + {0x3390, 0, 2 | DECOMP_COMPAT, 3243}, + {0x3391, 0, 3 | DECOMP_COMPAT, 3245}, + {0x3392, 0, 3 | DECOMP_COMPAT, 3248}, + {0x3393, 0, 3 | DECOMP_COMPAT, 3251}, + {0x3394, 0, 3 | DECOMP_COMPAT, 3254}, + {0x3395, 0, 2 | DECOMP_COMPAT, 3257}, + {0x3396, 0, 2 | DECOMP_COMPAT, 3259}, + {0x3397, 0, 2 | DECOMP_COMPAT, 3261}, + {0x3398, 0, 2 | DECOMP_COMPAT, 3263}, + {0x3399, 0, 2 | DECOMP_COMPAT, 3265}, + {0x339A, 0, 2 | DECOMP_COMPAT, 3267}, + {0x339B, 0, 2 | DECOMP_COMPAT, 3269}, + {0x339C, 0, 2 | DECOMP_COMPAT, 3271}, + {0x339D, 0, 2 | DECOMP_COMPAT, 3273}, + {0x339E, 0, 2 | DECOMP_COMPAT, 3275}, + {0x339F, 0, 3 | DECOMP_COMPAT, 3277}, + {0x33A0, 0, 3 | DECOMP_COMPAT, 3280}, + {0x33A1, 0, 2 | DECOMP_COMPAT, 3283}, + {0x33A2, 0, 3 | DECOMP_COMPAT, 3285}, + {0x33A3, 0, 3 | DECOMP_COMPAT, 3288}, + {0x33A4, 0, 3 | DECOMP_COMPAT, 3291}, + {0x33A5, 0, 2 | DECOMP_COMPAT, 3294}, + {0x33A6, 0, 3 | DECOMP_COMPAT, 3296}, + {0x33A7, 0, 3 | DECOMP_COMPAT, 3299}, + {0x33A8, 0, 4 | DECOMP_COMPAT, 3302}, + {0x33A9, 0, 2 | DECOMP_COMPAT, 3306}, + {0x33AA, 0, 3 | DECOMP_COMPAT, 3308}, + {0x33AB, 0, 3 | DECOMP_COMPAT, 3311}, + {0x33AC, 0, 3 | DECOMP_COMPAT, 3314}, + {0x33AD, 0, 3 | DECOMP_COMPAT, 3317}, + {0x33AE, 0, 5 | DECOMP_COMPAT, 3320}, + {0x33AF, 0, 6 | DECOMP_COMPAT, 3325}, + {0x33B0, 0, 2 | DECOMP_COMPAT, 3331}, + {0x33B1, 0, 2 | DECOMP_COMPAT, 3333}, + {0x33B2, 0, 2 | DECOMP_COMPAT, 3335}, + {0x33B3, 0, 2 | DECOMP_COMPAT, 3337}, + {0x33B4, 0, 2 | DECOMP_COMPAT, 3339}, + {0x33B5, 0, 2 | DECOMP_COMPAT, 3341}, + {0x33B6, 0, 2 | DECOMP_COMPAT, 3343}, + {0x33B7, 0, 2 | DECOMP_COMPAT, 3345}, + {0x33B8, 0, 2 | DECOMP_COMPAT, 3347}, + {0x33B9, 0, 2 | DECOMP_COMPAT, 3349}, + {0x33BA, 0, 2 | DECOMP_COMPAT, 3351}, + {0x33BB, 0, 2 | DECOMP_COMPAT, 3353}, + {0x33BC, 0, 2 | DECOMP_COMPAT, 3355}, + {0x33BD, 0, 2 | DECOMP_COMPAT, 3357}, + {0x33BE, 0, 2 | DECOMP_COMPAT, 3359}, + {0x33BF, 0, 2 | DECOMP_COMPAT, 3361}, + {0x33C0, 0, 2 | DECOMP_COMPAT, 3363}, + {0x33C1, 0, 2 | DECOMP_COMPAT, 3365}, + {0x33C2, 0, 4 | DECOMP_COMPAT, 3367}, + {0x33C3, 0, 2 | DECOMP_COMPAT, 3371}, + {0x33C4, 0, 2 | DECOMP_COMPAT, 3373}, + {0x33C5, 0, 2 | DECOMP_COMPAT, 3375}, + {0x33C6, 0, 4 | DECOMP_COMPAT, 3377}, + {0x33C7, 0, 3 | DECOMP_COMPAT, 3381}, + {0x33C8, 0, 2 | DECOMP_COMPAT, 3384}, + {0x33C9, 0, 2 | DECOMP_COMPAT, 3386}, + {0x33CA, 0, 2 | DECOMP_COMPAT, 3388}, + {0x33CB, 0, 2 | DECOMP_COMPAT, 3390}, + {0x33CC, 0, 2 | DECOMP_COMPAT, 3392}, + {0x33CD, 0, 2 | DECOMP_COMPAT, 3394}, + {0x33CE, 0, 2 | DECOMP_COMPAT, 3396}, + {0x33CF, 0, 2 | DECOMP_COMPAT, 3398}, + {0x33D0, 0, 2 | DECOMP_COMPAT, 3400}, + {0x33D1, 0, 2 | DECOMP_COMPAT, 3402}, + {0x33D2, 0, 3 | DECOMP_COMPAT, 3404}, + {0x33D3, 0, 2 | DECOMP_COMPAT, 3407}, + {0x33D4, 0, 2 | DECOMP_COMPAT, 3409}, + {0x33D5, 0, 3 | DECOMP_COMPAT, 3411}, + {0x33D6, 0, 3 | DECOMP_COMPAT, 3414}, + {0x33D7, 0, 2 | DECOMP_COMPAT, 3417}, + {0x33D8, 0, 4 | DECOMP_COMPAT, 3419}, + {0x33D9, 0, 3 | DECOMP_COMPAT, 3423}, + {0x33DA, 0, 2 | DECOMP_COMPAT, 3426}, + {0x33DB, 0, 2 | DECOMP_COMPAT, 3428}, + {0x33DC, 0, 2 | DECOMP_COMPAT, 3430}, + {0x33DD, 0, 2 | DECOMP_COMPAT, 3432}, + {0x33DE, 0, 3 | DECOMP_COMPAT, 3434}, + {0x33DF, 0, 3 | DECOMP_COMPAT, 3437}, + {0x33E0, 0, 2 | DECOMP_COMPAT, 3440}, + {0x33E1, 0, 2 | DECOMP_COMPAT, 3442}, + {0x33E2, 0, 2 | DECOMP_COMPAT, 3444}, + {0x33E3, 0, 2 | DECOMP_COMPAT, 3446}, + {0x33E4, 0, 2 | DECOMP_COMPAT, 3448}, + {0x33E5, 0, 2 | DECOMP_COMPAT, 3450}, + {0x33E6, 0, 2 | DECOMP_COMPAT, 3452}, + {0x33E7, 0, 2 | DECOMP_COMPAT, 3454}, + {0x33E8, 0, 2 | DECOMP_COMPAT, 3456}, + {0x33E9, 0, 3 | DECOMP_COMPAT, 3458}, + {0x33EA, 0, 3 | DECOMP_COMPAT, 3461}, + {0x33EB, 0, 3 | DECOMP_COMPAT, 3464}, + {0x33EC, 0, 3 | DECOMP_COMPAT, 3467}, + {0x33ED, 0, 3 | DECOMP_COMPAT, 3470}, + {0x33EE, 0, 3 | DECOMP_COMPAT, 3473}, + {0x33EF, 0, 3 | DECOMP_COMPAT, 3476}, + {0x33F0, 0, 3 | DECOMP_COMPAT, 3479}, + {0x33F1, 0, 3 | DECOMP_COMPAT, 3482}, + {0x33F2, 0, 3 | DECOMP_COMPAT, 3485}, + {0x33F3, 0, 3 | DECOMP_COMPAT, 3488}, + {0x33F4, 0, 3 | DECOMP_COMPAT, 3491}, + {0x33F5, 0, 3 | DECOMP_COMPAT, 3494}, + {0x33F6, 0, 3 | DECOMP_COMPAT, 3497}, + {0x33F7, 0, 3 | DECOMP_COMPAT, 3500}, + {0x33F8, 0, 3 | DECOMP_COMPAT, 3503}, + {0x33F9, 0, 3 | DECOMP_COMPAT, 3506}, + {0x33FA, 0, 3 | DECOMP_COMPAT, 3509}, + {0x33FB, 0, 3 | DECOMP_COMPAT, 3512}, + {0x33FC, 0, 3 | DECOMP_COMPAT, 3515}, + {0x33FD, 0, 3 | DECOMP_COMPAT, 3518}, + {0x33FE, 0, 3 | DECOMP_COMPAT, 3521}, + {0x33FF, 0, 3 | DECOMP_COMPAT, 3524}, + {0xA66F, 230, 0, 0}, + {0xA674, 230, 0, 0}, + {0xA675, 230, 0, 0}, + {0xA676, 230, 0, 0}, + {0xA677, 230, 0, 0}, + {0xA678, 230, 0, 0}, + {0xA679, 230, 0, 0}, + {0xA67A, 230, 0, 0}, + {0xA67B, 230, 0, 0}, + {0xA67C, 230, 0, 0}, + {0xA67D, 230, 0, 0}, + {0xA69C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044A}, + {0xA69D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044C}, + {0xA69E, 230, 0, 0}, + {0xA69F, 230, 0, 0}, + {0xA6F0, 230, 0, 0}, + {0xA6F1, 230, 0, 0}, + {0xA770, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA76F}, + {0xA7F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0xA7F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0xA7F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0xA7F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0126}, + {0xA7F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0153}, + {0xA806, 9, 0, 0}, + {0xA82C, 9, 0, 0}, + {0xA8C4, 9, 0, 0}, + {0xA8E0, 230, 0, 0}, + {0xA8E1, 230, 0, 0}, + {0xA8E2, 230, 0, 0}, + {0xA8E3, 230, 0, 0}, + {0xA8E4, 230, 0, 0}, + {0xA8E5, 230, 0, 0}, + {0xA8E6, 230, 0, 0}, + {0xA8E7, 230, 0, 0}, + {0xA8E8, 230, 0, 0}, + {0xA8E9, 230, 0, 0}, + {0xA8EA, 230, 0, 0}, + {0xA8EB, 230, 0, 0}, + {0xA8EC, 230, 0, 0}, + {0xA8ED, 230, 0, 0}, + {0xA8EE, 230, 0, 0}, + {0xA8EF, 230, 0, 0}, + {0xA8F0, 230, 0, 0}, + {0xA8F1, 230, 0, 0}, + {0xA92B, 220, 0, 0}, + {0xA92C, 220, 0, 0}, + {0xA92D, 220, 0, 0}, + {0xA953, 9, 0, 0}, + {0xA9B3, 7, 0, 0}, + {0xA9C0, 9, 0, 0}, + {0xAAB0, 230, 0, 0}, + {0xAAB2, 230, 0, 0}, + {0xAAB3, 230, 0, 0}, + {0xAAB4, 220, 0, 0}, + {0xAAB7, 230, 0, 0}, + {0xAAB8, 230, 0, 0}, + {0xAABE, 230, 0, 0}, + {0xAABF, 230, 0, 0}, + {0xAAC1, 230, 0, 0}, + {0xAAF6, 9, 0, 0}, + {0xAB5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA727}, + {0xAB5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB37}, + {0xAB5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026B}, + {0xAB5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB52}, + {0xAB69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028D}, + {0xABED, 9, 0, 0}, + {0xF900, 0, 1 | DECOMP_INLINE, 0x8C48}, + {0xF901, 0, 1 | DECOMP_INLINE, 0x66F4}, + {0xF902, 0, 1 | DECOMP_INLINE, 0x8ECA}, + {0xF903, 0, 1 | DECOMP_INLINE, 0x8CC8}, + {0xF904, 0, 1 | DECOMP_INLINE, 0x6ED1}, + {0xF905, 0, 1 | DECOMP_INLINE, 0x4E32}, + {0xF906, 0, 1 | DECOMP_INLINE, 0x53E5}, + {0xF907, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xF908, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xF909, 0, 1 | DECOMP_INLINE, 0x5951}, + {0xF90A, 0, 1 | DECOMP_INLINE, 0x91D1}, + {0xF90B, 0, 1 | DECOMP_INLINE, 0x5587}, + {0xF90C, 0, 1 | DECOMP_INLINE, 0x5948}, + {0xF90D, 0, 1 | DECOMP_INLINE, 0x61F6}, + {0xF90E, 0, 1 | DECOMP_INLINE, 0x7669}, + {0xF90F, 0, 1 | DECOMP_INLINE, 0x7F85}, + {0xF910, 0, 1 | DECOMP_INLINE, 0x863F}, + {0xF911, 0, 1 | DECOMP_INLINE, 0x87BA}, + {0xF912, 0, 1 | DECOMP_INLINE, 0x88F8}, + {0xF913, 0, 1 | DECOMP_INLINE, 0x908F}, + {0xF914, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF915, 0, 1 | DECOMP_INLINE, 0x6D1B}, + {0xF916, 0, 1 | DECOMP_INLINE, 0x70D9}, + {0xF917, 0, 1 | DECOMP_INLINE, 0x73DE}, + {0xF918, 0, 1 | DECOMP_INLINE, 0x843D}, + {0xF919, 0, 1 | DECOMP_INLINE, 0x916A}, + {0xF91A, 0, 1 | DECOMP_INLINE, 0x99F1}, + {0xF91B, 0, 1 | DECOMP_INLINE, 0x4E82}, + {0xF91C, 0, 1 | DECOMP_INLINE, 0x5375}, + {0xF91D, 0, 1 | DECOMP_INLINE, 0x6B04}, + {0xF91E, 0, 1 | DECOMP_INLINE, 0x721B}, + {0xF91F, 0, 1 | DECOMP_INLINE, 0x862D}, + {0xF920, 0, 1 | DECOMP_INLINE, 0x9E1E}, + {0xF921, 0, 1 | DECOMP_INLINE, 0x5D50}, + {0xF922, 0, 1 | DECOMP_INLINE, 0x6FEB}, + {0xF923, 0, 1 | DECOMP_INLINE, 0x85CD}, + {0xF924, 0, 1 | DECOMP_INLINE, 0x8964}, + {0xF925, 0, 1 | DECOMP_INLINE, 0x62C9}, + {0xF926, 0, 1 | DECOMP_INLINE, 0x81D8}, + {0xF927, 0, 1 | DECOMP_INLINE, 0x881F}, + {0xF928, 0, 1 | DECOMP_INLINE, 0x5ECA}, + {0xF929, 0, 1 | DECOMP_INLINE, 0x6717}, + {0xF92A, 0, 1 | DECOMP_INLINE, 0x6D6A}, + {0xF92B, 0, 1 | DECOMP_INLINE, 0x72FC}, + {0xF92C, 0, 1 | DECOMP_INLINE, 0x90CE}, + {0xF92D, 0, 1 | DECOMP_INLINE, 0x4F86}, + {0xF92E, 0, 1 | DECOMP_INLINE, 0x51B7}, + {0xF92F, 0, 1 | DECOMP_INLINE, 0x52DE}, + {0xF930, 0, 1 | DECOMP_INLINE, 0x64C4}, + {0xF931, 0, 1 | DECOMP_INLINE, 0x6AD3}, + {0xF932, 0, 1 | DECOMP_INLINE, 0x7210}, + {0xF933, 0, 1 | DECOMP_INLINE, 0x76E7}, + {0xF934, 0, 1 | DECOMP_INLINE, 0x8001}, + {0xF935, 0, 1 | DECOMP_INLINE, 0x8606}, + {0xF936, 0, 1 | DECOMP_INLINE, 0x865C}, + {0xF937, 0, 1 | DECOMP_INLINE, 0x8DEF}, + {0xF938, 0, 1 | DECOMP_INLINE, 0x9732}, + {0xF939, 0, 1 | DECOMP_INLINE, 0x9B6F}, + {0xF93A, 0, 1 | DECOMP_INLINE, 0x9DFA}, + {0xF93B, 0, 1 | DECOMP_INLINE, 0x788C}, + {0xF93C, 0, 1 | DECOMP_INLINE, 0x797F}, + {0xF93D, 0, 1 | DECOMP_INLINE, 0x7DA0}, + {0xF93E, 0, 1 | DECOMP_INLINE, 0x83C9}, + {0xF93F, 0, 1 | DECOMP_INLINE, 0x9304}, + {0xF940, 0, 1 | DECOMP_INLINE, 0x9E7F}, + {0xF941, 0, 1 | DECOMP_INLINE, 0x8AD6}, + {0xF942, 0, 1 | DECOMP_INLINE, 0x58DF}, + {0xF943, 0, 1 | DECOMP_INLINE, 0x5F04}, + {0xF944, 0, 1 | DECOMP_INLINE, 0x7C60}, + {0xF945, 0, 1 | DECOMP_INLINE, 0x807E}, + {0xF946, 0, 1 | DECOMP_INLINE, 0x7262}, + {0xF947, 0, 1 | DECOMP_INLINE, 0x78CA}, + {0xF948, 0, 1 | DECOMP_INLINE, 0x8CC2}, + {0xF949, 0, 1 | DECOMP_INLINE, 0x96F7}, + {0xF94A, 0, 1 | DECOMP_INLINE, 0x58D8}, + {0xF94B, 0, 1 | DECOMP_INLINE, 0x5C62}, + {0xF94C, 0, 1 | DECOMP_INLINE, 0x6A13}, + {0xF94D, 0, 1 | DECOMP_INLINE, 0x6DDA}, + {0xF94E, 0, 1 | DECOMP_INLINE, 0x6F0F}, + {0xF94F, 0, 1 | DECOMP_INLINE, 0x7D2F}, + {0xF950, 0, 1 | DECOMP_INLINE, 0x7E37}, + {0xF951, 0, 1 | DECOMP_INLINE, 0x964B}, + {0xF952, 0, 1 | DECOMP_INLINE, 0x52D2}, + {0xF953, 0, 1 | DECOMP_INLINE, 0x808B}, + {0xF954, 0, 1 | DECOMP_INLINE, 0x51DC}, + {0xF955, 0, 1 | DECOMP_INLINE, 0x51CC}, + {0xF956, 0, 1 | DECOMP_INLINE, 0x7A1C}, + {0xF957, 0, 1 | DECOMP_INLINE, 0x7DBE}, + {0xF958, 0, 1 | DECOMP_INLINE, 0x83F1}, + {0xF959, 0, 1 | DECOMP_INLINE, 0x9675}, + {0xF95A, 0, 1 | DECOMP_INLINE, 0x8B80}, + {0xF95B, 0, 1 | DECOMP_INLINE, 0x62CF}, + {0xF95C, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF95D, 0, 1 | DECOMP_INLINE, 0x8AFE}, + {0xF95E, 0, 1 | DECOMP_INLINE, 0x4E39}, + {0xF95F, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0xF960, 0, 1 | DECOMP_INLINE, 0x6012}, + {0xF961, 0, 1 | DECOMP_INLINE, 0x7387}, + {0xF962, 0, 1 | DECOMP_INLINE, 0x7570}, + {0xF963, 0, 1 | DECOMP_INLINE, 0x5317}, + {0xF964, 0, 1 | DECOMP_INLINE, 0x78FB}, + {0xF965, 0, 1 | DECOMP_INLINE, 0x4FBF}, + {0xF966, 0, 1 | DECOMP_INLINE, 0x5FA9}, + {0xF967, 0, 1 | DECOMP_INLINE, 0x4E0D}, + {0xF968, 0, 1 | DECOMP_INLINE, 0x6CCC}, + {0xF969, 0, 1 | DECOMP_INLINE, 0x6578}, + {0xF96A, 0, 1 | DECOMP_INLINE, 0x7D22}, + {0xF96B, 0, 1 | DECOMP_INLINE, 0x53C3}, + {0xF96C, 0, 1 | DECOMP_INLINE, 0x585E}, + {0xF96D, 0, 1 | DECOMP_INLINE, 0x7701}, + {0xF96E, 0, 1 | DECOMP_INLINE, 0x8449}, + {0xF96F, 0, 1 | DECOMP_INLINE, 0x8AAA}, + {0xF970, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0xF971, 0, 1 | DECOMP_INLINE, 0x8FB0}, + {0xF972, 0, 1 | DECOMP_INLINE, 0x6C88}, + {0xF973, 0, 1 | DECOMP_INLINE, 0x62FE}, + {0xF974, 0, 1 | DECOMP_INLINE, 0x82E5}, + {0xF975, 0, 1 | DECOMP_INLINE, 0x63A0}, + {0xF976, 0, 1 | DECOMP_INLINE, 0x7565}, + {0xF977, 0, 1 | DECOMP_INLINE, 0x4EAE}, + {0xF978, 0, 1 | DECOMP_INLINE, 0x5169}, + {0xF979, 0, 1 | DECOMP_INLINE, 0x51C9}, + {0xF97A, 0, 1 | DECOMP_INLINE, 0x6881}, + {0xF97B, 0, 1 | DECOMP_INLINE, 0x7CE7}, + {0xF97C, 0, 1 | DECOMP_INLINE, 0x826F}, + {0xF97D, 0, 1 | DECOMP_INLINE, 0x8AD2}, + {0xF97E, 0, 1 | DECOMP_INLINE, 0x91CF}, + {0xF97F, 0, 1 | DECOMP_INLINE, 0x52F5}, + {0xF980, 0, 1 | DECOMP_INLINE, 0x5442}, + {0xF981, 0, 1 | DECOMP_INLINE, 0x5973}, + {0xF982, 0, 1 | DECOMP_INLINE, 0x5EEC}, + {0xF983, 0, 1 | DECOMP_INLINE, 0x65C5}, + {0xF984, 0, 1 | DECOMP_INLINE, 0x6FFE}, + {0xF985, 0, 1 | DECOMP_INLINE, 0x792A}, + {0xF986, 0, 1 | DECOMP_INLINE, 0x95AD}, + {0xF987, 0, 1 | DECOMP_INLINE, 0x9A6A}, + {0xF988, 0, 1 | DECOMP_INLINE, 0x9E97}, + {0xF989, 0, 1 | DECOMP_INLINE, 0x9ECE}, + {0xF98A, 0, 1 | DECOMP_INLINE, 0x529B}, + {0xF98B, 0, 1 | DECOMP_INLINE, 0x66C6}, + {0xF98C, 0, 1 | DECOMP_INLINE, 0x6B77}, + {0xF98D, 0, 1 | DECOMP_INLINE, 0x8F62}, + {0xF98E, 0, 1 | DECOMP_INLINE, 0x5E74}, + {0xF98F, 0, 1 | DECOMP_INLINE, 0x6190}, + {0xF990, 0, 1 | DECOMP_INLINE, 0x6200}, + {0xF991, 0, 1 | DECOMP_INLINE, 0x649A}, + {0xF992, 0, 1 | DECOMP_INLINE, 0x6F23}, + {0xF993, 0, 1 | DECOMP_INLINE, 0x7149}, + {0xF994, 0, 1 | DECOMP_INLINE, 0x7489}, + {0xF995, 0, 1 | DECOMP_INLINE, 0x79CA}, + {0xF996, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xF997, 0, 1 | DECOMP_INLINE, 0x806F}, + {0xF998, 0, 1 | DECOMP_INLINE, 0x8F26}, + {0xF999, 0, 1 | DECOMP_INLINE, 0x84EE}, + {0xF99A, 0, 1 | DECOMP_INLINE, 0x9023}, + {0xF99B, 0, 1 | DECOMP_INLINE, 0x934A}, + {0xF99C, 0, 1 | DECOMP_INLINE, 0x5217}, + {0xF99D, 0, 1 | DECOMP_INLINE, 0x52A3}, + {0xF99E, 0, 1 | DECOMP_INLINE, 0x54BD}, + {0xF99F, 0, 1 | DECOMP_INLINE, 0x70C8}, + {0xF9A0, 0, 1 | DECOMP_INLINE, 0x88C2}, + {0xF9A1, 0, 1 | DECOMP_INLINE, 0x8AAA}, + {0xF9A2, 0, 1 | DECOMP_INLINE, 0x5EC9}, + {0xF9A3, 0, 1 | DECOMP_INLINE, 0x5FF5}, + {0xF9A4, 0, 1 | DECOMP_INLINE, 0x637B}, + {0xF9A5, 0, 1 | DECOMP_INLINE, 0x6BAE}, + {0xF9A6, 0, 1 | DECOMP_INLINE, 0x7C3E}, + {0xF9A7, 0, 1 | DECOMP_INLINE, 0x7375}, + {0xF9A8, 0, 1 | DECOMP_INLINE, 0x4EE4}, + {0xF9A9, 0, 1 | DECOMP_INLINE, 0x56F9}, + {0xF9AA, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0xF9AB, 0, 1 | DECOMP_INLINE, 0x5DBA}, + {0xF9AC, 0, 1 | DECOMP_INLINE, 0x601C}, + {0xF9AD, 0, 1 | DECOMP_INLINE, 0x73B2}, + {0xF9AE, 0, 1 | DECOMP_INLINE, 0x7469}, + {0xF9AF, 0, 1 | DECOMP_INLINE, 0x7F9A}, + {0xF9B0, 0, 1 | DECOMP_INLINE, 0x8046}, + {0xF9B1, 0, 1 | DECOMP_INLINE, 0x9234}, + {0xF9B2, 0, 1 | DECOMP_INLINE, 0x96F6}, + {0xF9B3, 0, 1 | DECOMP_INLINE, 0x9748}, + {0xF9B4, 0, 1 | DECOMP_INLINE, 0x9818}, + {0xF9B5, 0, 1 | DECOMP_INLINE, 0x4F8B}, + {0xF9B6, 0, 1 | DECOMP_INLINE, 0x79AE}, + {0xF9B7, 0, 1 | DECOMP_INLINE, 0x91B4}, + {0xF9B8, 0, 1 | DECOMP_INLINE, 0x96B8}, + {0xF9B9, 0, 1 | DECOMP_INLINE, 0x60E1}, + {0xF9BA, 0, 1 | DECOMP_INLINE, 0x4E86}, + {0xF9BB, 0, 1 | DECOMP_INLINE, 0x50DA}, + {0xF9BC, 0, 1 | DECOMP_INLINE, 0x5BEE}, + {0xF9BD, 0, 1 | DECOMP_INLINE, 0x5C3F}, + {0xF9BE, 0, 1 | DECOMP_INLINE, 0x6599}, + {0xF9BF, 0, 1 | DECOMP_INLINE, 0x6A02}, + {0xF9C0, 0, 1 | DECOMP_INLINE, 0x71CE}, + {0xF9C1, 0, 1 | DECOMP_INLINE, 0x7642}, + {0xF9C2, 0, 1 | DECOMP_INLINE, 0x84FC}, + {0xF9C3, 0, 1 | DECOMP_INLINE, 0x907C}, + {0xF9C4, 0, 1 | DECOMP_INLINE, 0x9F8D}, + {0xF9C5, 0, 1 | DECOMP_INLINE, 0x6688}, + {0xF9C6, 0, 1 | DECOMP_INLINE, 0x962E}, + {0xF9C7, 0, 1 | DECOMP_INLINE, 0x5289}, + {0xF9C8, 0, 1 | DECOMP_INLINE, 0x677B}, + {0xF9C9, 0, 1 | DECOMP_INLINE, 0x67F3}, + {0xF9CA, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0xF9CB, 0, 1 | DECOMP_INLINE, 0x6E9C}, + {0xF9CC, 0, 1 | DECOMP_INLINE, 0x7409}, + {0xF9CD, 0, 1 | DECOMP_INLINE, 0x7559}, + {0xF9CE, 0, 1 | DECOMP_INLINE, 0x786B}, + {0xF9CF, 0, 1 | DECOMP_INLINE, 0x7D10}, + {0xF9D0, 0, 1 | DECOMP_INLINE, 0x985E}, + {0xF9D1, 0, 1 | DECOMP_INLINE, 0x516D}, + {0xF9D2, 0, 1 | DECOMP_INLINE, 0x622E}, + {0xF9D3, 0, 1 | DECOMP_INLINE, 0x9678}, + {0xF9D4, 0, 1 | DECOMP_INLINE, 0x502B}, + {0xF9D5, 0, 1 | DECOMP_INLINE, 0x5D19}, + {0xF9D6, 0, 1 | DECOMP_INLINE, 0x6DEA}, + {0xF9D7, 0, 1 | DECOMP_INLINE, 0x8F2A}, + {0xF9D8, 0, 1 | DECOMP_INLINE, 0x5F8B}, + {0xF9D9, 0, 1 | DECOMP_INLINE, 0x6144}, + {0xF9DA, 0, 1 | DECOMP_INLINE, 0x6817}, + {0xF9DB, 0, 1 | DECOMP_INLINE, 0x7387}, + {0xF9DC, 0, 1 | DECOMP_INLINE, 0x9686}, + {0xF9DD, 0, 1 | DECOMP_INLINE, 0x5229}, + {0xF9DE, 0, 1 | DECOMP_INLINE, 0x540F}, + {0xF9DF, 0, 1 | DECOMP_INLINE, 0x5C65}, + {0xF9E0, 0, 1 | DECOMP_INLINE, 0x6613}, + {0xF9E1, 0, 1 | DECOMP_INLINE, 0x674E}, + {0xF9E2, 0, 1 | DECOMP_INLINE, 0x68A8}, + {0xF9E3, 0, 1 | DECOMP_INLINE, 0x6CE5}, + {0xF9E4, 0, 1 | DECOMP_INLINE, 0x7406}, + {0xF9E5, 0, 1 | DECOMP_INLINE, 0x75E2}, + {0xF9E6, 0, 1 | DECOMP_INLINE, 0x7F79}, + {0xF9E7, 0, 1 | DECOMP_INLINE, 0x88CF}, + {0xF9E8, 0, 1 | DECOMP_INLINE, 0x88E1}, + {0xF9E9, 0, 1 | DECOMP_INLINE, 0x91CC}, + {0xF9EA, 0, 1 | DECOMP_INLINE, 0x96E2}, + {0xF9EB, 0, 1 | DECOMP_INLINE, 0x533F}, + {0xF9EC, 0, 1 | DECOMP_INLINE, 0x6EBA}, + {0xF9ED, 0, 1 | DECOMP_INLINE, 0x541D}, + {0xF9EE, 0, 1 | DECOMP_INLINE, 0x71D0}, + {0xF9EF, 0, 1 | DECOMP_INLINE, 0x7498}, + {0xF9F0, 0, 1 | DECOMP_INLINE, 0x85FA}, + {0xF9F1, 0, 1 | DECOMP_INLINE, 0x96A3}, + {0xF9F2, 0, 1 | DECOMP_INLINE, 0x9C57}, + {0xF9F3, 0, 1 | DECOMP_INLINE, 0x9E9F}, + {0xF9F4, 0, 1 | DECOMP_INLINE, 0x6797}, + {0xF9F5, 0, 1 | DECOMP_INLINE, 0x6DCB}, + {0xF9F6, 0, 1 | DECOMP_INLINE, 0x81E8}, + {0xF9F7, 0, 1 | DECOMP_INLINE, 0x7ACB}, + {0xF9F8, 0, 1 | DECOMP_INLINE, 0x7B20}, + {0xF9F9, 0, 1 | DECOMP_INLINE, 0x7C92}, + {0xF9FA, 0, 1 | DECOMP_INLINE, 0x72C0}, + {0xF9FB, 0, 1 | DECOMP_INLINE, 0x7099}, + {0xF9FC, 0, 1 | DECOMP_INLINE, 0x8B58}, + {0xF9FD, 0, 1 | DECOMP_INLINE, 0x4EC0}, + {0xF9FE, 0, 1 | DECOMP_INLINE, 0x8336}, + {0xF9FF, 0, 1 | DECOMP_INLINE, 0x523A}, + {0xFA00, 0, 1 | DECOMP_INLINE, 0x5207}, + {0xFA01, 0, 1 | DECOMP_INLINE, 0x5EA6}, + {0xFA02, 0, 1 | DECOMP_INLINE, 0x62D3}, + {0xFA03, 0, 1 | DECOMP_INLINE, 0x7CD6}, + {0xFA04, 0, 1 | DECOMP_INLINE, 0x5B85}, + {0xFA05, 0, 1 | DECOMP_INLINE, 0x6D1E}, + {0xFA06, 0, 1 | DECOMP_INLINE, 0x66B4}, + {0xFA07, 0, 1 | DECOMP_INLINE, 0x8F3B}, + {0xFA08, 0, 1 | DECOMP_INLINE, 0x884C}, + {0xFA09, 0, 1 | DECOMP_INLINE, 0x964D}, + {0xFA0A, 0, 1 | DECOMP_INLINE, 0x898B}, + {0xFA0B, 0, 1 | DECOMP_INLINE, 0x5ED3}, + {0xFA0C, 0, 1 | DECOMP_INLINE, 0x5140}, + {0xFA0D, 0, 1 | DECOMP_INLINE, 0x55C0}, + {0xFA10, 0, 1 | DECOMP_INLINE, 0x585A}, + {0xFA12, 0, 1 | DECOMP_INLINE, 0x6674}, + {0xFA15, 0, 1 | DECOMP_INLINE, 0x51DE}, + {0xFA16, 0, 1 | DECOMP_INLINE, 0x732A}, + {0xFA17, 0, 1 | DECOMP_INLINE, 0x76CA}, + {0xFA18, 0, 1 | DECOMP_INLINE, 0x793C}, + {0xFA19, 0, 1 | DECOMP_INLINE, 0x795E}, + {0xFA1A, 0, 1 | DECOMP_INLINE, 0x7965}, + {0xFA1B, 0, 1 | DECOMP_INLINE, 0x798F}, + {0xFA1C, 0, 1 | DECOMP_INLINE, 0x9756}, + {0xFA1D, 0, 1 | DECOMP_INLINE, 0x7CBE}, + {0xFA1E, 0, 1 | DECOMP_INLINE, 0x7FBD}, + {0xFA20, 0, 1 | DECOMP_INLINE, 0x8612}, + {0xFA22, 0, 1 | DECOMP_INLINE, 0x8AF8}, + {0xFA25, 0, 1 | DECOMP_INLINE, 0x9038}, + {0xFA26, 0, 1 | DECOMP_INLINE, 0x90FD}, + {0xFA2A, 0, 1 | DECOMP_INLINE, 0x98EF}, + {0xFA2B, 0, 1 | DECOMP_INLINE, 0x98FC}, + {0xFA2C, 0, 1 | DECOMP_INLINE, 0x9928}, + {0xFA2D, 0, 1 | DECOMP_INLINE, 0x9DB4}, + {0xFA2E, 0, 1 | DECOMP_INLINE, 0x90DE}, + {0xFA2F, 0, 1 | DECOMP_INLINE, 0x96B7}, + {0xFA30, 0, 1 | DECOMP_INLINE, 0x4FAE}, + {0xFA31, 0, 1 | DECOMP_INLINE, 0x50E7}, + {0xFA32, 0, 1 | DECOMP_INLINE, 0x514D}, + {0xFA33, 0, 1 | DECOMP_INLINE, 0x52C9}, + {0xFA34, 0, 1 | DECOMP_INLINE, 0x52E4}, + {0xFA35, 0, 1 | DECOMP_INLINE, 0x5351}, + {0xFA36, 0, 1 | DECOMP_INLINE, 0x559D}, + {0xFA37, 0, 1 | DECOMP_INLINE, 0x5606}, + {0xFA38, 0, 1 | DECOMP_INLINE, 0x5668}, + {0xFA39, 0, 1 | DECOMP_INLINE, 0x5840}, + {0xFA3A, 0, 1 | DECOMP_INLINE, 0x58A8}, + {0xFA3B, 0, 1 | DECOMP_INLINE, 0x5C64}, + {0xFA3C, 0, 1 | DECOMP_INLINE, 0x5C6E}, + {0xFA3D, 0, 1 | DECOMP_INLINE, 0x6094}, + {0xFA3E, 0, 1 | DECOMP_INLINE, 0x6168}, + {0xFA3F, 0, 1 | DECOMP_INLINE, 0x618E}, + {0xFA40, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0xFA41, 0, 1 | DECOMP_INLINE, 0x654F}, + {0xFA42, 0, 1 | DECOMP_INLINE, 0x65E2}, + {0xFA43, 0, 1 | DECOMP_INLINE, 0x6691}, + {0xFA44, 0, 1 | DECOMP_INLINE, 0x6885}, + {0xFA45, 0, 1 | DECOMP_INLINE, 0x6D77}, + {0xFA46, 0, 1 | DECOMP_INLINE, 0x6E1A}, + {0xFA47, 0, 1 | DECOMP_INLINE, 0x6F22}, + {0xFA48, 0, 1 | DECOMP_INLINE, 0x716E}, + {0xFA49, 0, 1 | DECOMP_INLINE, 0x722B}, + {0xFA4A, 0, 1 | DECOMP_INLINE, 0x7422}, + {0xFA4B, 0, 1 | DECOMP_INLINE, 0x7891}, + {0xFA4C, 0, 1 | DECOMP_INLINE, 0x793E}, + {0xFA4D, 0, 1 | DECOMP_INLINE, 0x7949}, + {0xFA4E, 0, 1 | DECOMP_INLINE, 0x7948}, + {0xFA4F, 0, 1 | DECOMP_INLINE, 0x7950}, + {0xFA50, 0, 1 | DECOMP_INLINE, 0x7956}, + {0xFA51, 0, 1 | DECOMP_INLINE, 0x795D}, + {0xFA52, 0, 1 | DECOMP_INLINE, 0x798D}, + {0xFA53, 0, 1 | DECOMP_INLINE, 0x798E}, + {0xFA54, 0, 1 | DECOMP_INLINE, 0x7A40}, + {0xFA55, 0, 1 | DECOMP_INLINE, 0x7A81}, + {0xFA56, 0, 1 | DECOMP_INLINE, 0x7BC0}, + {0xFA57, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xFA58, 0, 1 | DECOMP_INLINE, 0x7E09}, + {0xFA59, 0, 1 | DECOMP_INLINE, 0x7E41}, + {0xFA5A, 0, 1 | DECOMP_INLINE, 0x7F72}, + {0xFA5B, 0, 1 | DECOMP_INLINE, 0x8005}, + {0xFA5C, 0, 1 | DECOMP_INLINE, 0x81ED}, + {0xFA5D, 0, 1 | DECOMP_INLINE, 0x8279}, + {0xFA5E, 0, 1 | DECOMP_INLINE, 0x8279}, + {0xFA5F, 0, 1 | DECOMP_INLINE, 0x8457}, + {0xFA60, 0, 1 | DECOMP_INLINE, 0x8910}, + {0xFA61, 0, 1 | DECOMP_INLINE, 0x8996}, + {0xFA62, 0, 1 | DECOMP_INLINE, 0x8B01}, + {0xFA63, 0, 1 | DECOMP_INLINE, 0x8B39}, + {0xFA64, 0, 1 | DECOMP_INLINE, 0x8CD3}, + {0xFA65, 0, 1 | DECOMP_INLINE, 0x8D08}, + {0xFA66, 0, 1 | DECOMP_INLINE, 0x8FB6}, + {0xFA67, 0, 1 | DECOMP_INLINE, 0x9038}, + {0xFA68, 0, 1 | DECOMP_INLINE, 0x96E3}, + {0xFA69, 0, 1 | DECOMP_INLINE, 0x97FF}, + {0xFA6A, 0, 1 | DECOMP_INLINE, 0x983B}, + {0xFA6B, 0, 1 | DECOMP_INLINE, 0x6075}, + {0xFA6C, 0, 1, 3527}, + {0xFA6D, 0, 1 | DECOMP_INLINE, 0x8218}, + {0xFA70, 0, 1 | DECOMP_INLINE, 0x4E26}, + {0xFA71, 0, 1 | DECOMP_INLINE, 0x51B5}, + {0xFA72, 0, 1 | DECOMP_INLINE, 0x5168}, + {0xFA73, 0, 1 | DECOMP_INLINE, 0x4F80}, + {0xFA74, 0, 1 | DECOMP_INLINE, 0x5145}, + {0xFA75, 0, 1 | DECOMP_INLINE, 0x5180}, + {0xFA76, 0, 1 | DECOMP_INLINE, 0x52C7}, + {0xFA77, 0, 1 | DECOMP_INLINE, 0x52FA}, + {0xFA78, 0, 1 | DECOMP_INLINE, 0x559D}, + {0xFA79, 0, 1 | DECOMP_INLINE, 0x5555}, + {0xFA7A, 0, 1 | DECOMP_INLINE, 0x5599}, + {0xFA7B, 0, 1 | DECOMP_INLINE, 0x55E2}, + {0xFA7C, 0, 1 | DECOMP_INLINE, 0x585A}, + {0xFA7D, 0, 1 | DECOMP_INLINE, 0x58B3}, + {0xFA7E, 0, 1 | DECOMP_INLINE, 0x5944}, + {0xFA7F, 0, 1 | DECOMP_INLINE, 0x5954}, + {0xFA80, 0, 1 | DECOMP_INLINE, 0x5A62}, + {0xFA81, 0, 1 | DECOMP_INLINE, 0x5B28}, + {0xFA82, 0, 1 | DECOMP_INLINE, 0x5ED2}, + {0xFA83, 0, 1 | DECOMP_INLINE, 0x5ED9}, + {0xFA84, 0, 1 | DECOMP_INLINE, 0x5F69}, + {0xFA85, 0, 1 | DECOMP_INLINE, 0x5FAD}, + {0xFA86, 0, 1 | DECOMP_INLINE, 0x60D8}, + {0xFA87, 0, 1 | DECOMP_INLINE, 0x614E}, + {0xFA88, 0, 1 | DECOMP_INLINE, 0x6108}, + {0xFA89, 0, 1 | DECOMP_INLINE, 0x618E}, + {0xFA8A, 0, 1 | DECOMP_INLINE, 0x6160}, + {0xFA8B, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0xFA8C, 0, 1 | DECOMP_INLINE, 0x6234}, + {0xFA8D, 0, 1 | DECOMP_INLINE, 0x63C4}, + {0xFA8E, 0, 1 | DECOMP_INLINE, 0x641C}, + {0xFA8F, 0, 1 | DECOMP_INLINE, 0x6452}, + {0xFA90, 0, 1 | DECOMP_INLINE, 0x6556}, + {0xFA91, 0, 1 | DECOMP_INLINE, 0x6674}, + {0xFA92, 0, 1 | DECOMP_INLINE, 0x6717}, + {0xFA93, 0, 1 | DECOMP_INLINE, 0x671B}, + {0xFA94, 0, 1 | DECOMP_INLINE, 0x6756}, + {0xFA95, 0, 1 | DECOMP_INLINE, 0x6B79}, + {0xFA96, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0xFA97, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0xFA98, 0, 1 | DECOMP_INLINE, 0x6EDB}, + {0xFA99, 0, 1 | DECOMP_INLINE, 0x6ECB}, + {0xFA9A, 0, 1 | DECOMP_INLINE, 0x6F22}, + {0xFA9B, 0, 1 | DECOMP_INLINE, 0x701E}, + {0xFA9C, 0, 1 | DECOMP_INLINE, 0x716E}, + {0xFA9D, 0, 1 | DECOMP_INLINE, 0x77A7}, + {0xFA9E, 0, 1 | DECOMP_INLINE, 0x7235}, + {0xFA9F, 0, 1 | DECOMP_INLINE, 0x72AF}, + {0xFAA0, 0, 1 | DECOMP_INLINE, 0x732A}, + {0xFAA1, 0, 1 | DECOMP_INLINE, 0x7471}, + {0xFAA2, 0, 1 | DECOMP_INLINE, 0x7506}, + {0xFAA3, 0, 1 | DECOMP_INLINE, 0x753B}, + {0xFAA4, 0, 1 | DECOMP_INLINE, 0x761D}, + {0xFAA5, 0, 1 | DECOMP_INLINE, 0x761F}, + {0xFAA6, 0, 1 | DECOMP_INLINE, 0x76CA}, + {0xFAA7, 0, 1 | DECOMP_INLINE, 0x76DB}, + {0xFAA8, 0, 1 | DECOMP_INLINE, 0x76F4}, + {0xFAA9, 0, 1 | DECOMP_INLINE, 0x774A}, + {0xFAAA, 0, 1 | DECOMP_INLINE, 0x7740}, + {0xFAAB, 0, 1 | DECOMP_INLINE, 0x78CC}, + {0xFAAC, 0, 1 | DECOMP_INLINE, 0x7AB1}, + {0xFAAD, 0, 1 | DECOMP_INLINE, 0x7BC0}, + {0xFAAE, 0, 1 | DECOMP_INLINE, 0x7C7B}, + {0xFAAF, 0, 1 | DECOMP_INLINE, 0x7D5B}, + {0xFAB0, 0, 1 | DECOMP_INLINE, 0x7DF4}, + {0xFAB1, 0, 1 | DECOMP_INLINE, 0x7F3E}, + {0xFAB2, 0, 1 | DECOMP_INLINE, 0x8005}, + {0xFAB3, 0, 1 | DECOMP_INLINE, 0x8352}, + {0xFAB4, 0, 1 | DECOMP_INLINE, 0x83EF}, + {0xFAB5, 0, 1 | DECOMP_INLINE, 0x8779}, + {0xFAB6, 0, 1 | DECOMP_INLINE, 0x8941}, + {0xFAB7, 0, 1 | DECOMP_INLINE, 0x8986}, + {0xFAB8, 0, 1 | DECOMP_INLINE, 0x8996}, + {0xFAB9, 0, 1 | DECOMP_INLINE, 0x8ABF}, + {0xFABA, 0, 1 | DECOMP_INLINE, 0x8AF8}, + {0xFABB, 0, 1 | DECOMP_INLINE, 0x8ACB}, + {0xFABC, 0, 1 | DECOMP_INLINE, 0x8B01}, + {0xFABD, 0, 1 | DECOMP_INLINE, 0x8AFE}, + {0xFABE, 0, 1 | DECOMP_INLINE, 0x8AED}, + {0xFABF, 0, 1 | DECOMP_INLINE, 0x8B39}, + {0xFAC0, 0, 1 | DECOMP_INLINE, 0x8B8A}, + {0xFAC1, 0, 1 | DECOMP_INLINE, 0x8D08}, + {0xFAC2, 0, 1 | DECOMP_INLINE, 0x8F38}, + {0xFAC3, 0, 1 | DECOMP_INLINE, 0x9072}, + {0xFAC4, 0, 1 | DECOMP_INLINE, 0x9199}, + {0xFAC5, 0, 1 | DECOMP_INLINE, 0x9276}, + {0xFAC6, 0, 1 | DECOMP_INLINE, 0x967C}, + {0xFAC7, 0, 1 | DECOMP_INLINE, 0x96E3}, + {0xFAC8, 0, 1 | DECOMP_INLINE, 0x9756}, + {0xFAC9, 0, 1 | DECOMP_INLINE, 0x97DB}, + {0xFACA, 0, 1 | DECOMP_INLINE, 0x97FF}, + {0xFACB, 0, 1 | DECOMP_INLINE, 0x980B}, + {0xFACC, 0, 1 | DECOMP_INLINE, 0x983B}, + {0xFACD, 0, 1 | DECOMP_INLINE, 0x9B12}, + {0xFACE, 0, 1 | DECOMP_INLINE, 0x9F9C}, + {0xFACF, 0, 1, 3528}, + {0xFAD0, 0, 1, 3529}, + {0xFAD1, 0, 1, 3530}, + {0xFAD2, 0, 1 | DECOMP_INLINE, 0x3B9D}, + {0xFAD3, 0, 1 | DECOMP_INLINE, 0x4018}, + {0xFAD4, 0, 1 | DECOMP_INLINE, 0x4039}, + {0xFAD5, 0, 1, 3531}, + {0xFAD6, 0, 1, 3532}, + {0xFAD7, 0, 1, 3533}, + {0xFAD8, 0, 1 | DECOMP_INLINE, 0x9F43}, + {0xFAD9, 0, 1 | DECOMP_INLINE, 0x9F8E}, + {0xFB00, 0, 2 | DECOMP_COMPAT, 3534}, + {0xFB01, 0, 2 | DECOMP_COMPAT, 3536}, + {0xFB02, 0, 2 | DECOMP_COMPAT, 3538}, + {0xFB03, 0, 3 | DECOMP_COMPAT, 3540}, + {0xFB04, 0, 3 | DECOMP_COMPAT, 3543}, + {0xFB05, 0, 2 | DECOMP_COMPAT, 3546}, + {0xFB06, 0, 2 | DECOMP_COMPAT, 3548}, + {0xFB13, 0, 2 | DECOMP_COMPAT, 3550}, + {0xFB14, 0, 2 | DECOMP_COMPAT, 3552}, + {0xFB15, 0, 2 | DECOMP_COMPAT, 3554}, + {0xFB16, 0, 2 | DECOMP_COMPAT, 3556}, + {0xFB17, 0, 2 | DECOMP_COMPAT, 3558}, + {0xFB1D, 0, 2 | DECOMP_NO_COMPOSE, 3560}, /* in exclusion list */ + {0xFB1E, 26, 0, 0}, + {0xFB1F, 0, 2 | DECOMP_NO_COMPOSE, 3562}, /* in exclusion list */ + {0xFB20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05E2}, + {0xFB21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D0}, + {0xFB22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D3}, + {0xFB23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05D4}, + {0xFB24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DB}, + {0xFB25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DC}, + {0xFB26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05DD}, + {0xFB27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05E8}, + {0xFB28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x05EA}, + {0xFB29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFB2A, 0, 2 | DECOMP_NO_COMPOSE, 3564}, /* in exclusion list */ + {0xFB2B, 0, 2 | DECOMP_NO_COMPOSE, 3566}, /* in exclusion list */ + {0xFB2C, 0, 2 | DECOMP_NO_COMPOSE, 3568}, /* in exclusion list */ + {0xFB2D, 0, 2 | DECOMP_NO_COMPOSE, 3570}, /* in exclusion list */ + {0xFB2E, 0, 2 | DECOMP_NO_COMPOSE, 3572}, /* in exclusion list */ + {0xFB2F, 0, 2 | DECOMP_NO_COMPOSE, 3574}, /* in exclusion list */ + {0xFB30, 0, 2 | DECOMP_NO_COMPOSE, 3576}, /* in exclusion list */ + {0xFB31, 0, 2 | DECOMP_NO_COMPOSE, 3578}, /* in exclusion list */ + {0xFB32, 0, 2 | DECOMP_NO_COMPOSE, 3580}, /* in exclusion list */ + {0xFB33, 0, 2 | DECOMP_NO_COMPOSE, 3582}, /* in exclusion list */ + {0xFB34, 0, 2 | DECOMP_NO_COMPOSE, 3584}, /* in exclusion list */ + {0xFB35, 0, 2 | DECOMP_NO_COMPOSE, 3586}, /* in exclusion list */ + {0xFB36, 0, 2 | DECOMP_NO_COMPOSE, 3588}, /* in exclusion list */ + {0xFB38, 0, 2 | DECOMP_NO_COMPOSE, 3590}, /* in exclusion list */ + {0xFB39, 0, 2 | DECOMP_NO_COMPOSE, 3592}, /* in exclusion list */ + {0xFB3A, 0, 2 | DECOMP_NO_COMPOSE, 3594}, /* in exclusion list */ + {0xFB3B, 0, 2 | DECOMP_NO_COMPOSE, 3596}, /* in exclusion list */ + {0xFB3C, 0, 2 | DECOMP_NO_COMPOSE, 3598}, /* in exclusion list */ + {0xFB3E, 0, 2 | DECOMP_NO_COMPOSE, 3600}, /* in exclusion list */ + {0xFB40, 0, 2 | DECOMP_NO_COMPOSE, 3602}, /* in exclusion list */ + {0xFB41, 0, 2 | DECOMP_NO_COMPOSE, 3604}, /* in exclusion list */ + {0xFB43, 0, 2 | DECOMP_NO_COMPOSE, 3606}, /* in exclusion list */ + {0xFB44, 0, 2 | DECOMP_NO_COMPOSE, 3608}, /* in exclusion list */ + {0xFB46, 0, 2 | DECOMP_NO_COMPOSE, 3610}, /* in exclusion list */ + {0xFB47, 0, 2 | DECOMP_NO_COMPOSE, 3612}, /* in exclusion list */ + {0xFB48, 0, 2 | DECOMP_NO_COMPOSE, 3614}, /* in exclusion list */ + {0xFB49, 0, 2 | DECOMP_NO_COMPOSE, 3616}, /* in exclusion list */ + {0xFB4A, 0, 2 | DECOMP_NO_COMPOSE, 3618}, /* in exclusion list */ + {0xFB4B, 0, 2 | DECOMP_NO_COMPOSE, 3620}, /* in exclusion list */ + {0xFB4C, 0, 2 | DECOMP_NO_COMPOSE, 3622}, /* in exclusion list */ + {0xFB4D, 0, 2 | DECOMP_NO_COMPOSE, 3624}, /* in exclusion list */ + {0xFB4E, 0, 2 | DECOMP_NO_COMPOSE, 3626}, /* in exclusion list */ + {0xFB4F, 0, 2 | DECOMP_COMPAT, 3628}, + {0xFB50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0671}, + {0xFB51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0671}, + {0xFB52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067B}, + {0xFB56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067E}, + {0xFB5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0680}, + {0xFB5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067A}, + {0xFB62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x067F}, + {0xFB66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0679}, + {0xFB6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A4}, + {0xFB6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A6}, + {0xFB72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0684}, + {0xFB76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0683}, + {0xFB7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0686}, + {0xFB7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0687}, + {0xFB82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068D}, + {0xFB83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068D}, + {0xFB84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068C}, + {0xFB85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068C}, + {0xFB86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068E}, + {0xFB87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x068E}, + {0xFB88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0688}, + {0xFB89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0688}, + {0xFB8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0698}, + {0xFB8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0698}, + {0xFB8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0691}, + {0xFB8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0691}, + {0xFB8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A9}, + {0xFB92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AF}, + {0xFB96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B3}, + {0xFB9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06B1}, + {0xFB9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0xFB9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0xFBA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BB}, + {0xFBA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C0}, + {0xFBA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C0}, + {0xFBA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C1}, + {0xFBAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BE}, + {0xFBAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D2}, + {0xFBAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D2}, + {0xFBB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D3}, + {0xFBB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D3}, + {0xFBD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06AD}, + {0xFBD7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C7}, + {0xFBD8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C7}, + {0xFBD9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C6}, + {0xFBDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C6}, + {0xFBDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C8}, + {0xFBDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C8}, + {0xFBDD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0677}, + {0xFBDE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CB}, + {0xFBDF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CB}, + {0xFBE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C5}, + {0xFBE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C5}, + {0xFBE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C9}, + {0xFBE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06C9}, + {0xFBE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06D0}, + {0xFBE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFBE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFBEA, 0, 2 | DECOMP_COMPAT, 3630}, + {0xFBEB, 0, 2 | DECOMP_COMPAT, 3632}, + {0xFBEC, 0, 2 | DECOMP_COMPAT, 3634}, + {0xFBED, 0, 2 | DECOMP_COMPAT, 3636}, + {0xFBEE, 0, 2 | DECOMP_COMPAT, 3638}, + {0xFBEF, 0, 2 | DECOMP_COMPAT, 3640}, + {0xFBF0, 0, 2 | DECOMP_COMPAT, 3642}, + {0xFBF1, 0, 2 | DECOMP_COMPAT, 3644}, + {0xFBF2, 0, 2 | DECOMP_COMPAT, 3646}, + {0xFBF3, 0, 2 | DECOMP_COMPAT, 3648}, + {0xFBF4, 0, 2 | DECOMP_COMPAT, 3650}, + {0xFBF5, 0, 2 | DECOMP_COMPAT, 3652}, + {0xFBF6, 0, 2 | DECOMP_COMPAT, 3654}, + {0xFBF7, 0, 2 | DECOMP_COMPAT, 3656}, + {0xFBF8, 0, 2 | DECOMP_COMPAT, 3658}, + {0xFBF9, 0, 2 | DECOMP_COMPAT, 3660}, + {0xFBFA, 0, 2 | DECOMP_COMPAT, 3662}, + {0xFBFB, 0, 2 | DECOMP_COMPAT, 3664}, + {0xFBFC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFBFF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06CC}, + {0xFC00, 0, 2 | DECOMP_COMPAT, 3666}, + {0xFC01, 0, 2 | DECOMP_COMPAT, 3668}, + {0xFC02, 0, 2 | DECOMP_COMPAT, 3670}, + {0xFC03, 0, 2 | DECOMP_COMPAT, 3672}, + {0xFC04, 0, 2 | DECOMP_COMPAT, 3674}, + {0xFC05, 0, 2 | DECOMP_COMPAT, 3676}, + {0xFC06, 0, 2 | DECOMP_COMPAT, 3678}, + {0xFC07, 0, 2 | DECOMP_COMPAT, 3680}, + {0xFC08, 0, 2 | DECOMP_COMPAT, 3682}, + {0xFC09, 0, 2 | DECOMP_COMPAT, 3684}, + {0xFC0A, 0, 2 | DECOMP_COMPAT, 3686}, + {0xFC0B, 0, 2 | DECOMP_COMPAT, 3688}, + {0xFC0C, 0, 2 | DECOMP_COMPAT, 3690}, + {0xFC0D, 0, 2 | DECOMP_COMPAT, 3692}, + {0xFC0E, 0, 2 | DECOMP_COMPAT, 3694}, + {0xFC0F, 0, 2 | DECOMP_COMPAT, 3696}, + {0xFC10, 0, 2 | DECOMP_COMPAT, 3698}, + {0xFC11, 0, 2 | DECOMP_COMPAT, 3700}, + {0xFC12, 0, 2 | DECOMP_COMPAT, 3702}, + {0xFC13, 0, 2 | DECOMP_COMPAT, 3704}, + {0xFC14, 0, 2 | DECOMP_COMPAT, 3706}, + {0xFC15, 0, 2 | DECOMP_COMPAT, 3708}, + {0xFC16, 0, 2 | DECOMP_COMPAT, 3710}, + {0xFC17, 0, 2 | DECOMP_COMPAT, 3712}, + {0xFC18, 0, 2 | DECOMP_COMPAT, 3714}, + {0xFC19, 0, 2 | DECOMP_COMPAT, 3716}, + {0xFC1A, 0, 2 | DECOMP_COMPAT, 3718}, + {0xFC1B, 0, 2 | DECOMP_COMPAT, 3720}, + {0xFC1C, 0, 2 | DECOMP_COMPAT, 3722}, + {0xFC1D, 0, 2 | DECOMP_COMPAT, 3724}, + {0xFC1E, 0, 2 | DECOMP_COMPAT, 3726}, + {0xFC1F, 0, 2 | DECOMP_COMPAT, 3728}, + {0xFC20, 0, 2 | DECOMP_COMPAT, 3730}, + {0xFC21, 0, 2 | DECOMP_COMPAT, 3732}, + {0xFC22, 0, 2 | DECOMP_COMPAT, 3734}, + {0xFC23, 0, 2 | DECOMP_COMPAT, 3736}, + {0xFC24, 0, 2 | DECOMP_COMPAT, 3738}, + {0xFC25, 0, 2 | DECOMP_COMPAT, 3740}, + {0xFC26, 0, 2 | DECOMP_COMPAT, 3742}, + {0xFC27, 0, 2 | DECOMP_COMPAT, 3744}, + {0xFC28, 0, 2 | DECOMP_COMPAT, 3746}, + {0xFC29, 0, 2 | DECOMP_COMPAT, 3748}, + {0xFC2A, 0, 2 | DECOMP_COMPAT, 3750}, + {0xFC2B, 0, 2 | DECOMP_COMPAT, 3752}, + {0xFC2C, 0, 2 | DECOMP_COMPAT, 3754}, + {0xFC2D, 0, 2 | DECOMP_COMPAT, 3756}, + {0xFC2E, 0, 2 | DECOMP_COMPAT, 3758}, + {0xFC2F, 0, 2 | DECOMP_COMPAT, 3760}, + {0xFC30, 0, 2 | DECOMP_COMPAT, 3762}, + {0xFC31, 0, 2 | DECOMP_COMPAT, 3764}, + {0xFC32, 0, 2 | DECOMP_COMPAT, 3766}, + {0xFC33, 0, 2 | DECOMP_COMPAT, 3768}, + {0xFC34, 0, 2 | DECOMP_COMPAT, 3770}, + {0xFC35, 0, 2 | DECOMP_COMPAT, 3772}, + {0xFC36, 0, 2 | DECOMP_COMPAT, 3774}, + {0xFC37, 0, 2 | DECOMP_COMPAT, 3776}, + {0xFC38, 0, 2 | DECOMP_COMPAT, 3778}, + {0xFC39, 0, 2 | DECOMP_COMPAT, 3780}, + {0xFC3A, 0, 2 | DECOMP_COMPAT, 3782}, + {0xFC3B, 0, 2 | DECOMP_COMPAT, 3784}, + {0xFC3C, 0, 2 | DECOMP_COMPAT, 3786}, + {0xFC3D, 0, 2 | DECOMP_COMPAT, 3788}, + {0xFC3E, 0, 2 | DECOMP_COMPAT, 3790}, + {0xFC3F, 0, 2 | DECOMP_COMPAT, 3792}, + {0xFC40, 0, 2 | DECOMP_COMPAT, 3794}, + {0xFC41, 0, 2 | DECOMP_COMPAT, 3796}, + {0xFC42, 0, 2 | DECOMP_COMPAT, 3798}, + {0xFC43, 0, 2 | DECOMP_COMPAT, 3800}, + {0xFC44, 0, 2 | DECOMP_COMPAT, 3802}, + {0xFC45, 0, 2 | DECOMP_COMPAT, 3804}, + {0xFC46, 0, 2 | DECOMP_COMPAT, 3806}, + {0xFC47, 0, 2 | DECOMP_COMPAT, 3808}, + {0xFC48, 0, 2 | DECOMP_COMPAT, 3810}, + {0xFC49, 0, 2 | DECOMP_COMPAT, 3812}, + {0xFC4A, 0, 2 | DECOMP_COMPAT, 3814}, + {0xFC4B, 0, 2 | DECOMP_COMPAT, 3816}, + {0xFC4C, 0, 2 | DECOMP_COMPAT, 3818}, + {0xFC4D, 0, 2 | DECOMP_COMPAT, 3820}, + {0xFC4E, 0, 2 | DECOMP_COMPAT, 3822}, + {0xFC4F, 0, 2 | DECOMP_COMPAT, 3824}, + {0xFC50, 0, 2 | DECOMP_COMPAT, 3826}, + {0xFC51, 0, 2 | DECOMP_COMPAT, 3828}, + {0xFC52, 0, 2 | DECOMP_COMPAT, 3830}, + {0xFC53, 0, 2 | DECOMP_COMPAT, 3832}, + {0xFC54, 0, 2 | DECOMP_COMPAT, 3834}, + {0xFC55, 0, 2 | DECOMP_COMPAT, 3836}, + {0xFC56, 0, 2 | DECOMP_COMPAT, 3838}, + {0xFC57, 0, 2 | DECOMP_COMPAT, 3840}, + {0xFC58, 0, 2 | DECOMP_COMPAT, 3842}, + {0xFC59, 0, 2 | DECOMP_COMPAT, 3844}, + {0xFC5A, 0, 2 | DECOMP_COMPAT, 3846}, + {0xFC5B, 0, 2 | DECOMP_COMPAT, 3848}, + {0xFC5C, 0, 2 | DECOMP_COMPAT, 3850}, + {0xFC5D, 0, 2 | DECOMP_COMPAT, 3852}, + {0xFC5E, 0, 3 | DECOMP_COMPAT, 3854}, + {0xFC5F, 0, 3 | DECOMP_COMPAT, 3857}, + {0xFC60, 0, 3 | DECOMP_COMPAT, 3860}, + {0xFC61, 0, 3 | DECOMP_COMPAT, 3863}, + {0xFC62, 0, 3 | DECOMP_COMPAT, 3866}, + {0xFC63, 0, 3 | DECOMP_COMPAT, 3869}, + {0xFC64, 0, 2 | DECOMP_COMPAT, 3872}, + {0xFC65, 0, 2 | DECOMP_COMPAT, 3874}, + {0xFC66, 0, 2 | DECOMP_COMPAT, 3876}, + {0xFC67, 0, 2 | DECOMP_COMPAT, 3878}, + {0xFC68, 0, 2 | DECOMP_COMPAT, 3880}, + {0xFC69, 0, 2 | DECOMP_COMPAT, 3882}, + {0xFC6A, 0, 2 | DECOMP_COMPAT, 3884}, + {0xFC6B, 0, 2 | DECOMP_COMPAT, 3886}, + {0xFC6C, 0, 2 | DECOMP_COMPAT, 3888}, + {0xFC6D, 0, 2 | DECOMP_COMPAT, 3890}, + {0xFC6E, 0, 2 | DECOMP_COMPAT, 3892}, + {0xFC6F, 0, 2 | DECOMP_COMPAT, 3894}, + {0xFC70, 0, 2 | DECOMP_COMPAT, 3896}, + {0xFC71, 0, 2 | DECOMP_COMPAT, 3898}, + {0xFC72, 0, 2 | DECOMP_COMPAT, 3900}, + {0xFC73, 0, 2 | DECOMP_COMPAT, 3902}, + {0xFC74, 0, 2 | DECOMP_COMPAT, 3904}, + {0xFC75, 0, 2 | DECOMP_COMPAT, 3906}, + {0xFC76, 0, 2 | DECOMP_COMPAT, 3908}, + {0xFC77, 0, 2 | DECOMP_COMPAT, 3910}, + {0xFC78, 0, 2 | DECOMP_COMPAT, 3912}, + {0xFC79, 0, 2 | DECOMP_COMPAT, 3914}, + {0xFC7A, 0, 2 | DECOMP_COMPAT, 3916}, + {0xFC7B, 0, 2 | DECOMP_COMPAT, 3918}, + {0xFC7C, 0, 2 | DECOMP_COMPAT, 3920}, + {0xFC7D, 0, 2 | DECOMP_COMPAT, 3922}, + {0xFC7E, 0, 2 | DECOMP_COMPAT, 3924}, + {0xFC7F, 0, 2 | DECOMP_COMPAT, 3926}, + {0xFC80, 0, 2 | DECOMP_COMPAT, 3928}, + {0xFC81, 0, 2 | DECOMP_COMPAT, 3930}, + {0xFC82, 0, 2 | DECOMP_COMPAT, 3932}, + {0xFC83, 0, 2 | DECOMP_COMPAT, 3934}, + {0xFC84, 0, 2 | DECOMP_COMPAT, 3936}, + {0xFC85, 0, 2 | DECOMP_COMPAT, 3938}, + {0xFC86, 0, 2 | DECOMP_COMPAT, 3940}, + {0xFC87, 0, 2 | DECOMP_COMPAT, 3942}, + {0xFC88, 0, 2 | DECOMP_COMPAT, 3944}, + {0xFC89, 0, 2 | DECOMP_COMPAT, 3946}, + {0xFC8A, 0, 2 | DECOMP_COMPAT, 3948}, + {0xFC8B, 0, 2 | DECOMP_COMPAT, 3950}, + {0xFC8C, 0, 2 | DECOMP_COMPAT, 3952}, + {0xFC8D, 0, 2 | DECOMP_COMPAT, 3954}, + {0xFC8E, 0, 2 | DECOMP_COMPAT, 3956}, + {0xFC8F, 0, 2 | DECOMP_COMPAT, 3958}, + {0xFC90, 0, 2 | DECOMP_COMPAT, 3960}, + {0xFC91, 0, 2 | DECOMP_COMPAT, 3962}, + {0xFC92, 0, 2 | DECOMP_COMPAT, 3964}, + {0xFC93, 0, 2 | DECOMP_COMPAT, 3966}, + {0xFC94, 0, 2 | DECOMP_COMPAT, 3968}, + {0xFC95, 0, 2 | DECOMP_COMPAT, 3970}, + {0xFC96, 0, 2 | DECOMP_COMPAT, 3972}, + {0xFC97, 0, 2 | DECOMP_COMPAT, 3974}, + {0xFC98, 0, 2 | DECOMP_COMPAT, 3976}, + {0xFC99, 0, 2 | DECOMP_COMPAT, 3978}, + {0xFC9A, 0, 2 | DECOMP_COMPAT, 3980}, + {0xFC9B, 0, 2 | DECOMP_COMPAT, 3982}, + {0xFC9C, 0, 2 | DECOMP_COMPAT, 3984}, + {0xFC9D, 0, 2 | DECOMP_COMPAT, 3986}, + {0xFC9E, 0, 2 | DECOMP_COMPAT, 3988}, + {0xFC9F, 0, 2 | DECOMP_COMPAT, 3990}, + {0xFCA0, 0, 2 | DECOMP_COMPAT, 3992}, + {0xFCA1, 0, 2 | DECOMP_COMPAT, 3994}, + {0xFCA2, 0, 2 | DECOMP_COMPAT, 3996}, + {0xFCA3, 0, 2 | DECOMP_COMPAT, 3998}, + {0xFCA4, 0, 2 | DECOMP_COMPAT, 4000}, + {0xFCA5, 0, 2 | DECOMP_COMPAT, 4002}, + {0xFCA6, 0, 2 | DECOMP_COMPAT, 4004}, + {0xFCA7, 0, 2 | DECOMP_COMPAT, 4006}, + {0xFCA8, 0, 2 | DECOMP_COMPAT, 4008}, + {0xFCA9, 0, 2 | DECOMP_COMPAT, 4010}, + {0xFCAA, 0, 2 | DECOMP_COMPAT, 4012}, + {0xFCAB, 0, 2 | DECOMP_COMPAT, 4014}, + {0xFCAC, 0, 2 | DECOMP_COMPAT, 4016}, + {0xFCAD, 0, 2 | DECOMP_COMPAT, 4018}, + {0xFCAE, 0, 2 | DECOMP_COMPAT, 4020}, + {0xFCAF, 0, 2 | DECOMP_COMPAT, 4022}, + {0xFCB0, 0, 2 | DECOMP_COMPAT, 4024}, + {0xFCB1, 0, 2 | DECOMP_COMPAT, 4026}, + {0xFCB2, 0, 2 | DECOMP_COMPAT, 4028}, + {0xFCB3, 0, 2 | DECOMP_COMPAT, 4030}, + {0xFCB4, 0, 2 | DECOMP_COMPAT, 4032}, + {0xFCB5, 0, 2 | DECOMP_COMPAT, 4034}, + {0xFCB6, 0, 2 | DECOMP_COMPAT, 4036}, + {0xFCB7, 0, 2 | DECOMP_COMPAT, 4038}, + {0xFCB8, 0, 2 | DECOMP_COMPAT, 4040}, + {0xFCB9, 0, 2 | DECOMP_COMPAT, 4042}, + {0xFCBA, 0, 2 | DECOMP_COMPAT, 4044}, + {0xFCBB, 0, 2 | DECOMP_COMPAT, 4046}, + {0xFCBC, 0, 2 | DECOMP_COMPAT, 4048}, + {0xFCBD, 0, 2 | DECOMP_COMPAT, 4050}, + {0xFCBE, 0, 2 | DECOMP_COMPAT, 4052}, + {0xFCBF, 0, 2 | DECOMP_COMPAT, 4054}, + {0xFCC0, 0, 2 | DECOMP_COMPAT, 4056}, + {0xFCC1, 0, 2 | DECOMP_COMPAT, 4058}, + {0xFCC2, 0, 2 | DECOMP_COMPAT, 4060}, + {0xFCC3, 0, 2 | DECOMP_COMPAT, 4062}, + {0xFCC4, 0, 2 | DECOMP_COMPAT, 4064}, + {0xFCC5, 0, 2 | DECOMP_COMPAT, 4066}, + {0xFCC6, 0, 2 | DECOMP_COMPAT, 4068}, + {0xFCC7, 0, 2 | DECOMP_COMPAT, 4070}, + {0xFCC8, 0, 2 | DECOMP_COMPAT, 4072}, + {0xFCC9, 0, 2 | DECOMP_COMPAT, 4074}, + {0xFCCA, 0, 2 | DECOMP_COMPAT, 4076}, + {0xFCCB, 0, 2 | DECOMP_COMPAT, 4078}, + {0xFCCC, 0, 2 | DECOMP_COMPAT, 4080}, + {0xFCCD, 0, 2 | DECOMP_COMPAT, 4082}, + {0xFCCE, 0, 2 | DECOMP_COMPAT, 4084}, + {0xFCCF, 0, 2 | DECOMP_COMPAT, 4086}, + {0xFCD0, 0, 2 | DECOMP_COMPAT, 4088}, + {0xFCD1, 0, 2 | DECOMP_COMPAT, 4090}, + {0xFCD2, 0, 2 | DECOMP_COMPAT, 4092}, + {0xFCD3, 0, 2 | DECOMP_COMPAT, 4094}, + {0xFCD4, 0, 2 | DECOMP_COMPAT, 4096}, + {0xFCD5, 0, 2 | DECOMP_COMPAT, 4098}, + {0xFCD6, 0, 2 | DECOMP_COMPAT, 4100}, + {0xFCD7, 0, 2 | DECOMP_COMPAT, 4102}, + {0xFCD8, 0, 2 | DECOMP_COMPAT, 4104}, + {0xFCD9, 0, 2 | DECOMP_COMPAT, 4106}, + {0xFCDA, 0, 2 | DECOMP_COMPAT, 4108}, + {0xFCDB, 0, 2 | DECOMP_COMPAT, 4110}, + {0xFCDC, 0, 2 | DECOMP_COMPAT, 4112}, + {0xFCDD, 0, 2 | DECOMP_COMPAT, 4114}, + {0xFCDE, 0, 2 | DECOMP_COMPAT, 4116}, + {0xFCDF, 0, 2 | DECOMP_COMPAT, 4118}, + {0xFCE0, 0, 2 | DECOMP_COMPAT, 4120}, + {0xFCE1, 0, 2 | DECOMP_COMPAT, 4122}, + {0xFCE2, 0, 2 | DECOMP_COMPAT, 4124}, + {0xFCE3, 0, 2 | DECOMP_COMPAT, 4126}, + {0xFCE4, 0, 2 | DECOMP_COMPAT, 4128}, + {0xFCE5, 0, 2 | DECOMP_COMPAT, 4130}, + {0xFCE6, 0, 2 | DECOMP_COMPAT, 4132}, + {0xFCE7, 0, 2 | DECOMP_COMPAT, 4134}, + {0xFCE8, 0, 2 | DECOMP_COMPAT, 4136}, + {0xFCE9, 0, 2 | DECOMP_COMPAT, 4138}, + {0xFCEA, 0, 2 | DECOMP_COMPAT, 4140}, + {0xFCEB, 0, 2 | DECOMP_COMPAT, 4142}, + {0xFCEC, 0, 2 | DECOMP_COMPAT, 4144}, + {0xFCED, 0, 2 | DECOMP_COMPAT, 4146}, + {0xFCEE, 0, 2 | DECOMP_COMPAT, 4148}, + {0xFCEF, 0, 2 | DECOMP_COMPAT, 4150}, + {0xFCF0, 0, 2 | DECOMP_COMPAT, 4152}, + {0xFCF1, 0, 2 | DECOMP_COMPAT, 4154}, + {0xFCF2, 0, 3 | DECOMP_COMPAT, 4156}, + {0xFCF3, 0, 3 | DECOMP_COMPAT, 4159}, + {0xFCF4, 0, 3 | DECOMP_COMPAT, 4162}, + {0xFCF5, 0, 2 | DECOMP_COMPAT, 4165}, + {0xFCF6, 0, 2 | DECOMP_COMPAT, 4167}, + {0xFCF7, 0, 2 | DECOMP_COMPAT, 4169}, + {0xFCF8, 0, 2 | DECOMP_COMPAT, 4171}, + {0xFCF9, 0, 2 | DECOMP_COMPAT, 4173}, + {0xFCFA, 0, 2 | DECOMP_COMPAT, 4175}, + {0xFCFB, 0, 2 | DECOMP_COMPAT, 4177}, + {0xFCFC, 0, 2 | DECOMP_COMPAT, 4179}, + {0xFCFD, 0, 2 | DECOMP_COMPAT, 4181}, + {0xFCFE, 0, 2 | DECOMP_COMPAT, 4183}, + {0xFCFF, 0, 2 | DECOMP_COMPAT, 4185}, + {0xFD00, 0, 2 | DECOMP_COMPAT, 4187}, + {0xFD01, 0, 2 | DECOMP_COMPAT, 4189}, + {0xFD02, 0, 2 | DECOMP_COMPAT, 4191}, + {0xFD03, 0, 2 | DECOMP_COMPAT, 4193}, + {0xFD04, 0, 2 | DECOMP_COMPAT, 4195}, + {0xFD05, 0, 2 | DECOMP_COMPAT, 4197}, + {0xFD06, 0, 2 | DECOMP_COMPAT, 4199}, + {0xFD07, 0, 2 | DECOMP_COMPAT, 4201}, + {0xFD08, 0, 2 | DECOMP_COMPAT, 4203}, + {0xFD09, 0, 2 | DECOMP_COMPAT, 4205}, + {0xFD0A, 0, 2 | DECOMP_COMPAT, 4207}, + {0xFD0B, 0, 2 | DECOMP_COMPAT, 4209}, + {0xFD0C, 0, 2 | DECOMP_COMPAT, 4211}, + {0xFD0D, 0, 2 | DECOMP_COMPAT, 4213}, + {0xFD0E, 0, 2 | DECOMP_COMPAT, 4215}, + {0xFD0F, 0, 2 | DECOMP_COMPAT, 4217}, + {0xFD10, 0, 2 | DECOMP_COMPAT, 4219}, + {0xFD11, 0, 2 | DECOMP_COMPAT, 4221}, + {0xFD12, 0, 2 | DECOMP_COMPAT, 4223}, + {0xFD13, 0, 2 | DECOMP_COMPAT, 4225}, + {0xFD14, 0, 2 | DECOMP_COMPAT, 4227}, + {0xFD15, 0, 2 | DECOMP_COMPAT, 4229}, + {0xFD16, 0, 2 | DECOMP_COMPAT, 4231}, + {0xFD17, 0, 2 | DECOMP_COMPAT, 4233}, + {0xFD18, 0, 2 | DECOMP_COMPAT, 4235}, + {0xFD19, 0, 2 | DECOMP_COMPAT, 4237}, + {0xFD1A, 0, 2 | DECOMP_COMPAT, 4239}, + {0xFD1B, 0, 2 | DECOMP_COMPAT, 4241}, + {0xFD1C, 0, 2 | DECOMP_COMPAT, 4243}, + {0xFD1D, 0, 2 | DECOMP_COMPAT, 4245}, + {0xFD1E, 0, 2 | DECOMP_COMPAT, 4247}, + {0xFD1F, 0, 2 | DECOMP_COMPAT, 4249}, + {0xFD20, 0, 2 | DECOMP_COMPAT, 4251}, + {0xFD21, 0, 2 | DECOMP_COMPAT, 4253}, + {0xFD22, 0, 2 | DECOMP_COMPAT, 4255}, + {0xFD23, 0, 2 | DECOMP_COMPAT, 4257}, + {0xFD24, 0, 2 | DECOMP_COMPAT, 4259}, + {0xFD25, 0, 2 | DECOMP_COMPAT, 4261}, + {0xFD26, 0, 2 | DECOMP_COMPAT, 4263}, + {0xFD27, 0, 2 | DECOMP_COMPAT, 4265}, + {0xFD28, 0, 2 | DECOMP_COMPAT, 4267}, + {0xFD29, 0, 2 | DECOMP_COMPAT, 4269}, + {0xFD2A, 0, 2 | DECOMP_COMPAT, 4271}, + {0xFD2B, 0, 2 | DECOMP_COMPAT, 4273}, + {0xFD2C, 0, 2 | DECOMP_COMPAT, 4275}, + {0xFD2D, 0, 2 | DECOMP_COMPAT, 4277}, + {0xFD2E, 0, 2 | DECOMP_COMPAT, 4279}, + {0xFD2F, 0, 2 | DECOMP_COMPAT, 4281}, + {0xFD30, 0, 2 | DECOMP_COMPAT, 4283}, + {0xFD31, 0, 2 | DECOMP_COMPAT, 4285}, + {0xFD32, 0, 2 | DECOMP_COMPAT, 4287}, + {0xFD33, 0, 2 | DECOMP_COMPAT, 4289}, + {0xFD34, 0, 2 | DECOMP_COMPAT, 4291}, + {0xFD35, 0, 2 | DECOMP_COMPAT, 4293}, + {0xFD36, 0, 2 | DECOMP_COMPAT, 4295}, + {0xFD37, 0, 2 | DECOMP_COMPAT, 4297}, + {0xFD38, 0, 2 | DECOMP_COMPAT, 4299}, + {0xFD39, 0, 2 | DECOMP_COMPAT, 4301}, + {0xFD3A, 0, 2 | DECOMP_COMPAT, 4303}, + {0xFD3B, 0, 2 | DECOMP_COMPAT, 4305}, + {0xFD3C, 0, 2 | DECOMP_COMPAT, 4307}, + {0xFD3D, 0, 2 | DECOMP_COMPAT, 4309}, + {0xFD50, 0, 3 | DECOMP_COMPAT, 4311}, + {0xFD51, 0, 3 | DECOMP_COMPAT, 4314}, + {0xFD52, 0, 3 | DECOMP_COMPAT, 4317}, + {0xFD53, 0, 3 | DECOMP_COMPAT, 4320}, + {0xFD54, 0, 3 | DECOMP_COMPAT, 4323}, + {0xFD55, 0, 3 | DECOMP_COMPAT, 4326}, + {0xFD56, 0, 3 | DECOMP_COMPAT, 4329}, + {0xFD57, 0, 3 | DECOMP_COMPAT, 4332}, + {0xFD58, 0, 3 | DECOMP_COMPAT, 4335}, + {0xFD59, 0, 3 | DECOMP_COMPAT, 4338}, + {0xFD5A, 0, 3 | DECOMP_COMPAT, 4341}, + {0xFD5B, 0, 3 | DECOMP_COMPAT, 4344}, + {0xFD5C, 0, 3 | DECOMP_COMPAT, 4347}, + {0xFD5D, 0, 3 | DECOMP_COMPAT, 4350}, + {0xFD5E, 0, 3 | DECOMP_COMPAT, 4353}, + {0xFD5F, 0, 3 | DECOMP_COMPAT, 4356}, + {0xFD60, 0, 3 | DECOMP_COMPAT, 4359}, + {0xFD61, 0, 3 | DECOMP_COMPAT, 4362}, + {0xFD62, 0, 3 | DECOMP_COMPAT, 4365}, + {0xFD63, 0, 3 | DECOMP_COMPAT, 4368}, + {0xFD64, 0, 3 | DECOMP_COMPAT, 4371}, + {0xFD65, 0, 3 | DECOMP_COMPAT, 4374}, + {0xFD66, 0, 3 | DECOMP_COMPAT, 4377}, + {0xFD67, 0, 3 | DECOMP_COMPAT, 4380}, + {0xFD68, 0, 3 | DECOMP_COMPAT, 4383}, + {0xFD69, 0, 3 | DECOMP_COMPAT, 4386}, + {0xFD6A, 0, 3 | DECOMP_COMPAT, 4389}, + {0xFD6B, 0, 3 | DECOMP_COMPAT, 4392}, + {0xFD6C, 0, 3 | DECOMP_COMPAT, 4395}, + {0xFD6D, 0, 3 | DECOMP_COMPAT, 4398}, + {0xFD6E, 0, 3 | DECOMP_COMPAT, 4401}, + {0xFD6F, 0, 3 | DECOMP_COMPAT, 4404}, + {0xFD70, 0, 3 | DECOMP_COMPAT, 4407}, + {0xFD71, 0, 3 | DECOMP_COMPAT, 4410}, + {0xFD72, 0, 3 | DECOMP_COMPAT, 4413}, + {0xFD73, 0, 3 | DECOMP_COMPAT, 4416}, + {0xFD74, 0, 3 | DECOMP_COMPAT, 4419}, + {0xFD75, 0, 3 | DECOMP_COMPAT, 4422}, + {0xFD76, 0, 3 | DECOMP_COMPAT, 4425}, + {0xFD77, 0, 3 | DECOMP_COMPAT, 4428}, + {0xFD78, 0, 3 | DECOMP_COMPAT, 4431}, + {0xFD79, 0, 3 | DECOMP_COMPAT, 4434}, + {0xFD7A, 0, 3 | DECOMP_COMPAT, 4437}, + {0xFD7B, 0, 3 | DECOMP_COMPAT, 4440}, + {0xFD7C, 0, 3 | DECOMP_COMPAT, 4443}, + {0xFD7D, 0, 3 | DECOMP_COMPAT, 4446}, + {0xFD7E, 0, 3 | DECOMP_COMPAT, 4449}, + {0xFD7F, 0, 3 | DECOMP_COMPAT, 4452}, + {0xFD80, 0, 3 | DECOMP_COMPAT, 4455}, + {0xFD81, 0, 3 | DECOMP_COMPAT, 4458}, + {0xFD82, 0, 3 | DECOMP_COMPAT, 4461}, + {0xFD83, 0, 3 | DECOMP_COMPAT, 4464}, + {0xFD84, 0, 3 | DECOMP_COMPAT, 4467}, + {0xFD85, 0, 3 | DECOMP_COMPAT, 4470}, + {0xFD86, 0, 3 | DECOMP_COMPAT, 4473}, + {0xFD87, 0, 3 | DECOMP_COMPAT, 4476}, + {0xFD88, 0, 3 | DECOMP_COMPAT, 4479}, + {0xFD89, 0, 3 | DECOMP_COMPAT, 4482}, + {0xFD8A, 0, 3 | DECOMP_COMPAT, 4485}, + {0xFD8B, 0, 3 | DECOMP_COMPAT, 4488}, + {0xFD8C, 0, 3 | DECOMP_COMPAT, 4491}, + {0xFD8D, 0, 3 | DECOMP_COMPAT, 4494}, + {0xFD8E, 0, 3 | DECOMP_COMPAT, 4497}, + {0xFD8F, 0, 3 | DECOMP_COMPAT, 4500}, + {0xFD92, 0, 3 | DECOMP_COMPAT, 4503}, + {0xFD93, 0, 3 | DECOMP_COMPAT, 4506}, + {0xFD94, 0, 3 | DECOMP_COMPAT, 4509}, + {0xFD95, 0, 3 | DECOMP_COMPAT, 4512}, + {0xFD96, 0, 3 | DECOMP_COMPAT, 4515}, + {0xFD97, 0, 3 | DECOMP_COMPAT, 4518}, + {0xFD98, 0, 3 | DECOMP_COMPAT, 4521}, + {0xFD99, 0, 3 | DECOMP_COMPAT, 4524}, + {0xFD9A, 0, 3 | DECOMP_COMPAT, 4527}, + {0xFD9B, 0, 3 | DECOMP_COMPAT, 4530}, + {0xFD9C, 0, 3 | DECOMP_COMPAT, 4533}, + {0xFD9D, 0, 3 | DECOMP_COMPAT, 4536}, + {0xFD9E, 0, 3 | DECOMP_COMPAT, 4539}, + {0xFD9F, 0, 3 | DECOMP_COMPAT, 4542}, + {0xFDA0, 0, 3 | DECOMP_COMPAT, 4545}, + {0xFDA1, 0, 3 | DECOMP_COMPAT, 4548}, + {0xFDA2, 0, 3 | DECOMP_COMPAT, 4551}, + {0xFDA3, 0, 3 | DECOMP_COMPAT, 4554}, + {0xFDA4, 0, 3 | DECOMP_COMPAT, 4557}, + {0xFDA5, 0, 3 | DECOMP_COMPAT, 4560}, + {0xFDA6, 0, 3 | DECOMP_COMPAT, 4563}, + {0xFDA7, 0, 3 | DECOMP_COMPAT, 4566}, + {0xFDA8, 0, 3 | DECOMP_COMPAT, 4569}, + {0xFDA9, 0, 3 | DECOMP_COMPAT, 4572}, + {0xFDAA, 0, 3 | DECOMP_COMPAT, 4575}, + {0xFDAB, 0, 3 | DECOMP_COMPAT, 4578}, + {0xFDAC, 0, 3 | DECOMP_COMPAT, 4581}, + {0xFDAD, 0, 3 | DECOMP_COMPAT, 4584}, + {0xFDAE, 0, 3 | DECOMP_COMPAT, 4587}, + {0xFDAF, 0, 3 | DECOMP_COMPAT, 4590}, + {0xFDB0, 0, 3 | DECOMP_COMPAT, 4593}, + {0xFDB1, 0, 3 | DECOMP_COMPAT, 4596}, + {0xFDB2, 0, 3 | DECOMP_COMPAT, 4599}, + {0xFDB3, 0, 3 | DECOMP_COMPAT, 4602}, + {0xFDB4, 0, 3 | DECOMP_COMPAT, 4605}, + {0xFDB5, 0, 3 | DECOMP_COMPAT, 4608}, + {0xFDB6, 0, 3 | DECOMP_COMPAT, 4611}, + {0xFDB7, 0, 3 | DECOMP_COMPAT, 4614}, + {0xFDB8, 0, 3 | DECOMP_COMPAT, 4617}, + {0xFDB9, 0, 3 | DECOMP_COMPAT, 4620}, + {0xFDBA, 0, 3 | DECOMP_COMPAT, 4623}, + {0xFDBB, 0, 3 | DECOMP_COMPAT, 4626}, + {0xFDBC, 0, 3 | DECOMP_COMPAT, 4629}, + {0xFDBD, 0, 3 | DECOMP_COMPAT, 4632}, + {0xFDBE, 0, 3 | DECOMP_COMPAT, 4635}, + {0xFDBF, 0, 3 | DECOMP_COMPAT, 4638}, + {0xFDC0, 0, 3 | DECOMP_COMPAT, 4641}, + {0xFDC1, 0, 3 | DECOMP_COMPAT, 4644}, + {0xFDC2, 0, 3 | DECOMP_COMPAT, 4647}, + {0xFDC3, 0, 3 | DECOMP_COMPAT, 4650}, + {0xFDC4, 0, 3 | DECOMP_COMPAT, 4653}, + {0xFDC5, 0, 3 | DECOMP_COMPAT, 4656}, + {0xFDC6, 0, 3 | DECOMP_COMPAT, 4659}, + {0xFDC7, 0, 3 | DECOMP_COMPAT, 4662}, + {0xFDF0, 0, 3 | DECOMP_COMPAT, 4665}, + {0xFDF1, 0, 3 | DECOMP_COMPAT, 4668}, + {0xFDF2, 0, 4 | DECOMP_COMPAT, 4671}, + {0xFDF3, 0, 4 | DECOMP_COMPAT, 4675}, + {0xFDF4, 0, 4 | DECOMP_COMPAT, 4679}, + {0xFDF5, 0, 4 | DECOMP_COMPAT, 4683}, + {0xFDF6, 0, 4 | DECOMP_COMPAT, 4687}, + {0xFDF7, 0, 4 | DECOMP_COMPAT, 4691}, + {0xFDF8, 0, 4 | DECOMP_COMPAT, 4695}, + {0xFDF9, 0, 3 | DECOMP_COMPAT, 4699}, + {0xFDFA, 0, 18 | DECOMP_COMPAT, 4702}, + {0xFDFB, 0, 8 | DECOMP_COMPAT, 4720}, + {0xFDFC, 0, 4 | DECOMP_COMPAT, 4728}, + {0xFE10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFE11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFE12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3002}, + {0xFE13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFE14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFE15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFE16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFE17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3016}, + {0xFE18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3017}, + {0xFE19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2026}, + {0xFE20, 230, 0, 0}, + {0xFE21, 230, 0, 0}, + {0xFE22, 230, 0, 0}, + {0xFE23, 230, 0, 0}, + {0xFE24, 230, 0, 0}, + {0xFE25, 230, 0, 0}, + {0xFE26, 230, 0, 0}, + {0xFE27, 220, 0, 0}, + {0xFE28, 220, 0, 0}, + {0xFE29, 220, 0, 0}, + {0xFE2A, 220, 0, 0}, + {0xFE2B, 220, 0, 0}, + {0xFE2C, 220, 0, 0}, + {0xFE2D, 220, 0, 0}, + {0xFE2E, 230, 0, 0}, + {0xFE2F, 230, 0, 0}, + {0xFE30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2025}, + {0xFE31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2014}, + {0xFE32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2013}, + {0xFE33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFE36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFE37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFE38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFE39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3014}, + {0xFE3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3015}, + {0xFE3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3010}, + {0xFE3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3011}, + {0xFE3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300A}, + {0xFE3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300B}, + {0xFE3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3008}, + {0xFE40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3009}, + {0xFE41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300C}, + {0xFE42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300D}, + {0xFE43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300E}, + {0xFE44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300F}, + {0xFE47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005B}, + {0xFE48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005D}, + {0xFE49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x203E}, + {0xFE4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFE50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFE51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFE52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0xFE54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFE55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFE56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFE57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFE58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2014}, + {0xFE59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFE5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFE5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFE5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFE5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3014}, + {0xFE5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3015}, + {0xFE5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0023}, + {0xFE60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0026}, + {0xFE61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002A}, + {0xFE62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFE63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002D}, + {0xFE64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003C}, + {0xFE65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003E}, + {0xFE66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0xFE68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005C}, + {0xFE69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0024}, + {0xFE6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0025}, + {0xFE6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0040}, + {0xFE70, 0, 2 | DECOMP_COMPAT, 4732}, + {0xFE71, 0, 2 | DECOMP_COMPAT, 4734}, + {0xFE72, 0, 2 | DECOMP_COMPAT, 4736}, + {0xFE74, 0, 2 | DECOMP_COMPAT, 4738}, + {0xFE76, 0, 2 | DECOMP_COMPAT, 4740}, + {0xFE77, 0, 2 | DECOMP_COMPAT, 4742}, + {0xFE78, 0, 2 | DECOMP_COMPAT, 4744}, + {0xFE79, 0, 2 | DECOMP_COMPAT, 4746}, + {0xFE7A, 0, 2 | DECOMP_COMPAT, 4748}, + {0xFE7B, 0, 2 | DECOMP_COMPAT, 4750}, + {0xFE7C, 0, 2 | DECOMP_COMPAT, 4752}, + {0xFE7D, 0, 2 | DECOMP_COMPAT, 4754}, + {0xFE7E, 0, 2 | DECOMP_COMPAT, 4756}, + {0xFE7F, 0, 2 | DECOMP_COMPAT, 4758}, + {0xFE80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0621}, + {0xFE81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0622}, + {0xFE82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0622}, + {0xFE83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0623}, + {0xFE84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0623}, + {0xFE85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0624}, + {0xFE86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0624}, + {0xFE87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0625}, + {0xFE88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0625}, + {0xFE89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0626}, + {0xFE8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0xFE8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0xFE8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0xFE93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0629}, + {0xFE94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0629}, + {0xFE95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0xFE99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0xFE9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFE9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFE9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFEA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0xFEA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0xFEA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0xFEA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0xFEAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0xFEAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0xFEAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0xFEAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0xFEAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0xFEAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0xFEB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0xFEB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0xFEB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0xFEB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0xFEBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEBF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEC0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0xFEC1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0xFEC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0xFEC9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0xFECD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFECE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFECF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFED0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0xFED1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0xFED5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0xFED9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0xFEDD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEDE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEDF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0xFEE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0xFEE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0xFEE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEEC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0xFEED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0xFEEE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0xFEEF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFEF0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0649}, + {0xFEF1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0xFEF5, 0, 2 | DECOMP_COMPAT, 4760}, + {0xFEF6, 0, 2 | DECOMP_COMPAT, 4762}, + {0xFEF7, 0, 2 | DECOMP_COMPAT, 4764}, + {0xFEF8, 0, 2 | DECOMP_COMPAT, 4766}, + {0xFEF9, 0, 2 | DECOMP_COMPAT, 4768}, + {0xFEFA, 0, 2 | DECOMP_COMPAT, 4770}, + {0xFEFB, 0, 2 | DECOMP_COMPAT, 4772}, + {0xFEFC, 0, 2 | DECOMP_COMPAT, 4774}, + {0xFF01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0021}, + {0xFF02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0022}, + {0xFF03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0023}, + {0xFF04, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0024}, + {0xFF05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0025}, + {0xFF06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0026}, + {0xFF07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0027}, + {0xFF08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0028}, + {0xFF09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0029}, + {0xFF0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002A}, + {0xFF0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002B}, + {0xFF0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002C}, + {0xFF0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002D}, + {0xFF0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002E}, + {0xFF0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x002F}, + {0xFF10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0xFF11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0xFF12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0xFF13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0xFF14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0xFF15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0xFF16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0xFF17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0xFF18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0xFF19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0xFF1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003A}, + {0xFF1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003B}, + {0xFF1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003C}, + {0xFF1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003D}, + {0xFF1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003E}, + {0xFF1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x003F}, + {0xFF20, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0040}, + {0xFF21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0xFF22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0xFF23, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0xFF24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0xFF25, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0xFF26, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0xFF27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0xFF28, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0xFF29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0xFF2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0xFF2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0xFF2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0xFF2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0xFF2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0xFF2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0xFF30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0xFF31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0xFF32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0xFF33, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0xFF34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0xFF35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0xFF36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0xFF37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0xFF38, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0xFF39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0xFF3A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0xFF3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005B}, + {0xFF3C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005C}, + {0xFF3D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005D}, + {0xFF3E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005E}, + {0xFF3F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005F}, + {0xFF40, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0060}, + {0xFF41, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0xFF42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0xFF43, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0xFF44, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0xFF45, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0xFF46, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0xFF47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0xFF48, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0xFF49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0xFF4A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0xFF4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0xFF4C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0xFF4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0xFF4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0xFF4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0xFF50, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0xFF51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0xFF52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0xFF53, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0xFF54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0xFF55, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0xFF56, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0xFF57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0xFF58, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0xFF59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0xFF5A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0xFF5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007B}, + {0xFF5C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007C}, + {0xFF5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007D}, + {0xFF5E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007E}, + {0xFF5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2985}, + {0xFF60, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2986}, + {0xFF61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3002}, + {0xFF62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300C}, + {0xFF63, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x300D}, + {0xFF64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3001}, + {0xFF65, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30FB}, + {0xFF66, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F2}, + {0xFF67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A1}, + {0xFF68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A3}, + {0xFF69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A5}, + {0xFF6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A7}, + {0xFF6B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A9}, + {0xFF6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E3}, + {0xFF6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E5}, + {0xFF6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E7}, + {0xFF6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C3}, + {0xFF70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30FC}, + {0xFF71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A2}, + {0xFF72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A4}, + {0xFF73, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A6}, + {0xFF74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30A8}, + {0xFF75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AA}, + {0xFF76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AB}, + {0xFF77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AD}, + {0xFF78, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30AF}, + {0xFF79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B1}, + {0xFF7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B3}, + {0xFF7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0xFF7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B7}, + {0xFF7D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B9}, + {0xFF7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BB}, + {0xFF7F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BD}, + {0xFF80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30BF}, + {0xFF81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C1}, + {0xFF82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C4}, + {0xFF83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C6}, + {0xFF84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C8}, + {0xFF85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CA}, + {0xFF86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CB}, + {0xFF87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CC}, + {0xFF88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CD}, + {0xFF89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CE}, + {0xFF8A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30CF}, + {0xFF8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D2}, + {0xFF8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D5}, + {0xFF8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30D8}, + {0xFF8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DB}, + {0xFF8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DE}, + {0xFF90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30DF}, + {0xFF91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E0}, + {0xFF92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E1}, + {0xFF93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E2}, + {0xFF94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E4}, + {0xFF95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E6}, + {0xFF96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E8}, + {0xFF97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30E9}, + {0xFF98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EA}, + {0xFF99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EB}, + {0xFF9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EC}, + {0xFF9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30ED}, + {0xFF9C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30EF}, + {0xFF9D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30F3}, + {0xFF9E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3099}, + {0xFF9F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x309A}, + {0xFFA0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3164}, + {0xFFA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3131}, + {0xFFA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3132}, + {0xFFA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3133}, + {0xFFA4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3134}, + {0xFFA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3135}, + {0xFFA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3136}, + {0xFFA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3137}, + {0xFFA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3138}, + {0xFFA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3139}, + {0xFFAA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313A}, + {0xFFAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313B}, + {0xFFAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313C}, + {0xFFAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313D}, + {0xFFAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313E}, + {0xFFAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x313F}, + {0xFFB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3140}, + {0xFFB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3141}, + {0xFFB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3142}, + {0xFFB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3143}, + {0xFFB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3144}, + {0xFFB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3145}, + {0xFFB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3146}, + {0xFFB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3147}, + {0xFFB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3148}, + {0xFFB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3149}, + {0xFFBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314A}, + {0xFFBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314B}, + {0xFFBC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314C}, + {0xFFBD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314D}, + {0xFFBE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314E}, + {0xFFC2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x314F}, + {0xFFC3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3150}, + {0xFFC4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3151}, + {0xFFC5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3152}, + {0xFFC6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3153}, + {0xFFC7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3154}, + {0xFFCA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3155}, + {0xFFCB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3156}, + {0xFFCC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3157}, + {0xFFCD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3158}, + {0xFFCE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3159}, + {0xFFCF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315A}, + {0xFFD2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315B}, + {0xFFD3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315C}, + {0xFFD4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315D}, + {0xFFD5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315E}, + {0xFFD6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x315F}, + {0xFFD7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3160}, + {0xFFDA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3161}, + {0xFFDB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3162}, + {0xFFDC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x3163}, + {0xFFE0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A2}, + {0xFFE1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A3}, + {0xFFE2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00AC}, + {0xFFE3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00AF}, + {0xFFE4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A6}, + {0xFFE5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00A5}, + {0xFFE6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x20A9}, + {0xFFE8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2502}, + {0xFFE9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2190}, + {0xFFEA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2191}, + {0xFFEB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2192}, + {0xFFEC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2193}, + {0xFFED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x25A0}, + {0xFFEE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x25CB}, + {0x101FD, 220, 0, 0}, + {0x102E0, 220, 0, 0}, + {0x10376, 230, 0, 0}, + {0x10377, 230, 0, 0}, + {0x10378, 230, 0, 0}, + {0x10379, 230, 0, 0}, + {0x1037A, 230, 0, 0}, + {0x10781, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02D0}, + {0x10782, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02D1}, + {0x10783, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00E6}, + {0x10784, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0299}, + {0x10785, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0253}, + {0x10787, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A3}, + {0x10788, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB66}, + {0x10789, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A5}, + {0x1078A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A4}, + {0x1078B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0256}, + {0x1078C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0257}, + {0x1078D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x1D91}, + {0x1078E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0258}, + {0x1078F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x025E}, + {0x10790, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A9}, + {0x10791, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0264}, + {0x10792, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0262}, + {0x10793, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0260}, + {0x10794, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029B}, + {0x10795, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0127}, + {0x10796, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x029C}, + {0x10797, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0267}, + {0x10798, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0284}, + {0x10799, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02AA}, + {0x1079A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02AB}, + {0x1079B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026C}, + {0x1079C, 0, 1 | DECOMP_COMPAT, 4776}, + {0x1079D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA78E}, + {0x1079E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x026E}, + {0x1079F, 0, 1 | DECOMP_COMPAT, 4777}, + {0x107A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028E}, + {0x107A1, 0, 1 | DECOMP_COMPAT, 4778}, + {0x107A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x00F8}, + {0x107A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0276}, + {0x107A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0277}, + {0x107A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x107A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027A}, + {0x107A7, 0, 1 | DECOMP_COMPAT, 4779}, + {0x107A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027D}, + {0x107A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x027E}, + {0x107AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0280}, + {0x107AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A8}, + {0x107AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A6}, + {0x107AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xAB67}, + {0x107AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A7}, + {0x107AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0288}, + {0x107B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2C71}, + {0x107B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x028F}, + {0x107B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A1}, + {0x107B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x02A2}, + {0x107B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0298}, + {0x107B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C0}, + {0x107B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C1}, + {0x107B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x01C2}, + {0x107B9, 0, 1 | DECOMP_COMPAT, 4780}, + {0x107BA, 0, 1 | DECOMP_COMPAT, 4781}, + {0x10A0D, 220, 0, 0}, + {0x10A0F, 230, 0, 0}, + {0x10A38, 230, 0, 0}, + {0x10A39, 1, 0, 0}, + {0x10A3A, 220, 0, 0}, + {0x10A3F, 9, 0, 0}, + {0x10AE5, 230, 0, 0}, + {0x10AE6, 220, 0, 0}, + {0x10D24, 230, 0, 0}, + {0x10D25, 230, 0, 0}, + {0x10D26, 230, 0, 0}, + {0x10D27, 230, 0, 0}, + {0x10EAB, 230, 0, 0}, + {0x10EAC, 230, 0, 0}, + {0x10EFD, 220, 0, 0}, + {0x10EFE, 220, 0, 0}, + {0x10EFF, 220, 0, 0}, + {0x10F46, 220, 0, 0}, + {0x10F47, 220, 0, 0}, + {0x10F48, 230, 0, 0}, + {0x10F49, 230, 0, 0}, + {0x10F4A, 230, 0, 0}, + {0x10F4B, 220, 0, 0}, + {0x10F4C, 230, 0, 0}, + {0x10F4D, 220, 0, 0}, + {0x10F4E, 220, 0, 0}, + {0x10F4F, 220, 0, 0}, + {0x10F50, 220, 0, 0}, + {0x10F82, 230, 0, 0}, + {0x10F83, 220, 0, 0}, + {0x10F84, 230, 0, 0}, + {0x10F85, 220, 0, 0}, + {0x11046, 9, 0, 0}, + {0x11070, 9, 0, 0}, + {0x1107F, 9, 0, 0}, + {0x1109A, 0, 2, 4782}, + {0x1109C, 0, 2, 4784}, + {0x110AB, 0, 2, 4786}, + {0x110B9, 9, 0, 0}, + {0x110BA, 7, 0, 0}, + {0x11100, 230, 0, 0}, + {0x11101, 230, 0, 0}, + {0x11102, 230, 0, 0}, + {0x1112E, 0, 2, 4788}, + {0x1112F, 0, 2, 4790}, + {0x11133, 9, 0, 0}, + {0x11134, 9, 0, 0}, + {0x11173, 7, 0, 0}, + {0x111C0, 9, 0, 0}, + {0x111CA, 7, 0, 0}, + {0x11235, 9, 0, 0}, + {0x11236, 7, 0, 0}, + {0x112E9, 7, 0, 0}, + {0x112EA, 9, 0, 0}, + {0x1133B, 7, 0, 0}, + {0x1133C, 7, 0, 0}, + {0x1134B, 0, 2, 4792}, + {0x1134C, 0, 2, 4794}, + {0x1134D, 9, 0, 0}, + {0x11366, 230, 0, 0}, + {0x11367, 230, 0, 0}, + {0x11368, 230, 0, 0}, + {0x11369, 230, 0, 0}, + {0x1136A, 230, 0, 0}, + {0x1136B, 230, 0, 0}, + {0x1136C, 230, 0, 0}, + {0x11370, 230, 0, 0}, + {0x11371, 230, 0, 0}, + {0x11372, 230, 0, 0}, + {0x11373, 230, 0, 0}, + {0x11374, 230, 0, 0}, + {0x11442, 9, 0, 0}, + {0x11446, 7, 0, 0}, + {0x1145E, 230, 0, 0}, + {0x114BB, 0, 2, 4796}, + {0x114BC, 0, 2, 4798}, + {0x114BE, 0, 2, 4800}, + {0x114C2, 9, 0, 0}, + {0x114C3, 7, 0, 0}, + {0x115BA, 0, 2, 4802}, + {0x115BB, 0, 2, 4804}, + {0x115BF, 9, 0, 0}, + {0x115C0, 7, 0, 0}, + {0x1163F, 9, 0, 0}, + {0x116B6, 9, 0, 0}, + {0x116B7, 7, 0, 0}, + {0x1172B, 9, 0, 0}, + {0x11839, 9, 0, 0}, + {0x1183A, 7, 0, 0}, + {0x11938, 0, 2, 4806}, + {0x1193D, 9, 0, 0}, + {0x1193E, 9, 0, 0}, + {0x11943, 7, 0, 0}, + {0x119E0, 9, 0, 0}, + {0x11A34, 9, 0, 0}, + {0x11A47, 9, 0, 0}, + {0x11A99, 9, 0, 0}, + {0x11C3F, 9, 0, 0}, + {0x11D42, 7, 0, 0}, + {0x11D44, 9, 0, 0}, + {0x11D45, 9, 0, 0}, + {0x11D97, 9, 0, 0}, + {0x11F41, 9, 0, 0}, + {0x11F42, 9, 0, 0}, + {0x16AF0, 1, 0, 0}, + {0x16AF1, 1, 0, 0}, + {0x16AF2, 1, 0, 0}, + {0x16AF3, 1, 0, 0}, + {0x16AF4, 1, 0, 0}, + {0x16B30, 230, 0, 0}, + {0x16B31, 230, 0, 0}, + {0x16B32, 230, 0, 0}, + {0x16B33, 230, 0, 0}, + {0x16B34, 230, 0, 0}, + {0x16B35, 230, 0, 0}, + {0x16B36, 230, 0, 0}, + {0x16FF0, 6, 0, 0}, + {0x16FF1, 6, 0, 0}, + {0x1BC9E, 1, 0, 0}, + {0x1D15E, 0, 2 | DECOMP_NO_COMPOSE, 4808}, /* in exclusion list */ + {0x1D15F, 0, 2 | DECOMP_NO_COMPOSE, 4810}, /* in exclusion list */ + {0x1D160, 0, 2 | DECOMP_NO_COMPOSE, 4812}, /* in exclusion list */ + {0x1D161, 0, 2 | DECOMP_NO_COMPOSE, 4814}, /* in exclusion list */ + {0x1D162, 0, 2 | DECOMP_NO_COMPOSE, 4816}, /* in exclusion list */ + {0x1D163, 0, 2 | DECOMP_NO_COMPOSE, 4818}, /* in exclusion list */ + {0x1D164, 0, 2 | DECOMP_NO_COMPOSE, 4820}, /* in exclusion list */ + {0x1D165, 216, 0, 0}, + {0x1D166, 216, 0, 0}, + {0x1D167, 1, 0, 0}, + {0x1D168, 1, 0, 0}, + {0x1D169, 1, 0, 0}, + {0x1D16D, 226, 0, 0}, + {0x1D16E, 216, 0, 0}, + {0x1D16F, 216, 0, 0}, + {0x1D170, 216, 0, 0}, + {0x1D171, 216, 0, 0}, + {0x1D172, 216, 0, 0}, + {0x1D17B, 220, 0, 0}, + {0x1D17C, 220, 0, 0}, + {0x1D17D, 220, 0, 0}, + {0x1D17E, 220, 0, 0}, + {0x1D17F, 220, 0, 0}, + {0x1D180, 220, 0, 0}, + {0x1D181, 220, 0, 0}, + {0x1D182, 220, 0, 0}, + {0x1D185, 230, 0, 0}, + {0x1D186, 230, 0, 0}, + {0x1D187, 230, 0, 0}, + {0x1D188, 230, 0, 0}, + {0x1D189, 230, 0, 0}, + {0x1D18A, 220, 0, 0}, + {0x1D18B, 220, 0, 0}, + {0x1D1AA, 230, 0, 0}, + {0x1D1AB, 230, 0, 0}, + {0x1D1AC, 230, 0, 0}, + {0x1D1AD, 230, 0, 0}, + {0x1D1BB, 0, 2 | DECOMP_NO_COMPOSE, 4822}, /* in exclusion list */ + {0x1D1BC, 0, 2 | DECOMP_NO_COMPOSE, 4824}, /* in exclusion list */ + {0x1D1BD, 0, 2 | DECOMP_NO_COMPOSE, 4826}, /* in exclusion list */ + {0x1D1BE, 0, 2 | DECOMP_NO_COMPOSE, 4828}, /* in exclusion list */ + {0x1D1BF, 0, 2 | DECOMP_NO_COMPOSE, 4830}, /* in exclusion list */ + {0x1D1C0, 0, 2 | DECOMP_NO_COMPOSE, 4832}, /* in exclusion list */ + {0x1D242, 230, 0, 0}, + {0x1D243, 230, 0, 0}, + {0x1D244, 230, 0, 0}, + {0x1D400, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D401, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D402, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D403, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D404, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D405, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D406, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D407, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D408, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D409, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D40A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D40B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D40C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D40D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D40E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D40F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D410, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D411, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D412, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D413, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D414, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D415, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D416, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D417, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D418, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D419, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D41A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D41B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D41C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D41D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D41E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D41F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D420, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D421, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D422, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D423, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D424, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D425, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D426, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D427, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D428, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D429, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D42A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D42B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D42C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D42D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D42E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D42F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D430, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D431, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D432, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D433, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D434, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D435, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D436, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D437, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D438, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D439, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D43A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D43B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D43C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D43D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D43E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D43F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D440, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D441, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D442, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D443, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D444, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D445, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D446, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D447, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D448, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D449, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D44A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D44B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D44C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D44D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D44E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D44F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D450, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D451, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D452, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D453, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D454, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D456, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D457, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D458, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D459, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D45A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D45B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D45C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D45D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D45E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D45F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D460, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D461, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D462, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D463, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D464, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D465, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D466, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D467, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D468, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D469, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D46A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D46B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D46C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D46D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D46E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D46F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D470, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D471, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D472, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D473, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D474, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D475, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D476, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D477, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D478, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D479, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D47A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D47B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D47C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D47D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D47E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D47F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D480, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D481, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D482, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D483, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D484, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D485, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D486, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D487, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D488, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D489, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D48A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D48B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D48C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D48D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D48E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D48F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D490, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D491, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D492, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D493, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D494, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D495, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D496, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D497, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D498, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D499, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D49A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D49B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D49C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D49E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D49F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D4A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D4A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D4A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D4A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D4AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D4AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D4AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D4AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D4AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D4B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D4B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D4B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D4B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D4B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D4B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D4B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D4B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D4B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D4B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D4BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D4BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D4BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D4BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D4C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D4C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D4C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D4C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D4C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D4C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D4C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D4C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D4C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D4CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D4CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D4CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D4CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D4CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D4CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D4D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D4D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D4D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D4D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D4D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D4D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D4D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D4D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D4D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D4D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D4DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D4DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D4DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D4DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D4DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D4DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D4E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D4E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D4E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D4E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D4E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D4E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D4E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D4E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D4E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D4E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D4EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D4EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D4EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D4ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D4EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D4EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D4F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D4F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D4F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D4F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D4F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D4F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D4F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D4F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D4F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D4F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D4FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D4FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D4FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D4FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D4FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D4FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D500, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D501, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D502, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D503, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D504, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D505, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D507, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D508, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D509, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D50A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D50D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D50E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D50F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D510, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D511, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D512, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D513, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D514, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D516, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D517, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D518, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D519, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D51A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D51B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D51C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D51E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D51F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D520, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D521, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D522, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D523, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D524, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D525, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D526, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D527, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D528, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D529, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D52A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D52B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D52C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D52D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D52E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D52F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D530, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D531, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D532, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D533, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D534, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D535, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D536, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D537, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D538, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D539, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D53B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D53C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D53D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D53E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D540, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D541, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D542, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D543, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D544, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D546, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D54A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D54B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D54C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D54D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D54E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D54F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D550, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D552, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D553, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D554, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D555, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D556, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D557, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D558, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D559, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D55A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D55B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D55C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D55D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D55E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D55F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D560, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D561, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D562, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D563, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D564, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D565, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D566, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D567, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D568, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D569, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D56A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D56B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D56C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D56D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D56E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D56F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D570, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D571, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D572, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D573, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D574, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D575, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D576, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D577, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D578, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D579, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D57A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D57B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D57C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D57D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D57E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D57F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D580, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D581, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D582, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D583, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D584, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D585, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D586, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D587, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D588, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D589, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D58A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D58B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D58C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D58D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D58E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D58F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D590, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D591, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D592, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D593, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D594, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D595, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D596, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D597, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D598, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D599, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D59A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D59B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D59C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D59D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D59E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D59F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D5A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D5A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D5A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D5A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D5A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D5A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D5A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D5A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D5A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D5A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D5AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D5AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D5AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D5AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D5AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D5AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D5B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D5B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D5B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D5B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D5B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D5B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D5B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D5B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D5B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D5B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D5BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D5BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D5BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D5BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D5BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D5BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D5C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D5C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D5C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D5C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D5C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D5C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D5C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D5C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D5C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D5C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D5CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D5CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D5CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D5CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D5CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D5CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D5D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D5D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D5D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D5D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D5D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D5D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D5D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D5D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D5D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D5D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D5DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D5DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D5DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D5DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D5DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D5DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D5E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D5E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D5E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D5E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D5E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D5E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D5E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D5E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D5E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D5E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D5EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D5EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D5EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D5ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D5EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D5EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D5F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D5F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D5F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D5F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D5F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D5F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D5F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D5F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D5F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D5F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D5FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D5FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D5FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D5FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D5FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D5FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D600, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D601, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D602, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D603, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D604, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D605, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D606, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D607, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D608, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D609, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D60A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D60B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D60C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D60D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D60E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D60F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D610, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D611, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D612, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D613, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D614, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D615, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D616, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D617, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D618, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D619, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D61A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D61B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D61C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D61D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D61E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D61F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D620, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D621, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D622, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D623, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D624, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D625, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D626, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D627, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D628, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D629, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D62A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D62B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D62C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D62D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D62E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D62F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D630, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D631, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D632, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D633, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D634, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D635, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D636, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D637, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D638, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D639, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D63A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D63B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D63C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D63D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D63E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D63F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D640, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D641, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D642, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D643, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D644, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D645, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D646, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D647, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D648, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D649, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D64A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D64B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D64C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D64D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D64E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D64F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D650, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D651, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D652, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D653, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D654, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D655, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D656, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D657, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D658, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D659, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D65A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D65B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D65C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D65D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D65E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D65F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D660, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D661, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D662, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D663, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D664, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D665, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D666, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D667, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D668, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D669, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D66A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D66B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D66C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D66D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D66E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D66F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D670, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1D671, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1D672, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1D673, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1D674, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1D675, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1D676, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1D677, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1D678, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1D679, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1D67A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1D67B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1D67C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1D67D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1D67E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1D67F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1D680, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1D681, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1D682, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1D683, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1D684, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1D685, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1D686, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1D687, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1D688, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1D689, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1D68A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0061}, + {0x1D68B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0062}, + {0x1D68C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0063}, + {0x1D68D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0064}, + {0x1D68E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0065}, + {0x1D68F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0066}, + {0x1D690, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0067}, + {0x1D691, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0068}, + {0x1D692, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0069}, + {0x1D693, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006A}, + {0x1D694, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006B}, + {0x1D695, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006C}, + {0x1D696, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006D}, + {0x1D697, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006E}, + {0x1D698, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x006F}, + {0x1D699, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0070}, + {0x1D69A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0071}, + {0x1D69B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0072}, + {0x1D69C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0073}, + {0x1D69D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0074}, + {0x1D69E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0075}, + {0x1D69F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0076}, + {0x1D6A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0077}, + {0x1D6A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0078}, + {0x1D6A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0079}, + {0x1D6A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x007A}, + {0x1D6A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0131}, + {0x1D6A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0237}, + {0x1D6A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D6A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D6AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D6AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D6AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D6AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D6AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D6AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D6B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D6B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D6B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D6B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D6B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D6B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D6B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D6B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D6B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D6B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D6BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D6BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D6BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D6BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D6BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D6BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D6C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D6C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D6C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D6C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D6C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D6C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D6C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D6C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D6C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D6C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D6CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D6CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D6CC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D6CD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D6CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D6CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D6D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D6D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D6D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D6D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D6D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D6D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D6D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D6D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D6D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D6D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D6DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D6DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D6DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D6DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D6DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D6DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D6E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D6E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D6E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D6E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D6E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D6E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D6E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D6E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D6E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D6E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D6EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D6EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D6EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D6ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D6EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D6EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D6F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D6F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D6F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D6F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D6F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D6F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D6F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D6F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D6F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D6F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D6FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D6FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D6FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D6FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D6FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D6FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D700, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D701, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D702, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D703, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D704, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D705, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D706, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D707, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D708, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D709, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D70A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D70B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D70C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D70D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D70E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D70F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D710, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D711, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D712, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D713, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D714, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D715, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D716, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D717, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D718, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D719, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D71A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D71B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D71C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D71D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D71E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D71F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D720, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D721, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D722, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D723, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D724, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D725, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D726, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D727, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D728, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D729, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D72A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D72B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D72C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D72D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D72E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D72F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D730, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D731, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D732, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D733, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D734, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D735, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D736, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D737, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D738, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D739, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D73A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D73B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D73C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D73D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D73E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D73F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D740, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D741, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D742, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D743, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D744, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D745, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D746, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D747, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D748, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D749, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D74A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D74B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D74C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D74D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D74E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D74F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D750, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D751, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D752, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D753, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D754, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D755, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D756, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D757, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D758, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D759, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D75A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D75B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D75C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D75D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D75E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D75F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D760, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D761, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D762, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D763, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D764, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D765, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D766, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D767, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D768, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D769, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D76A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D76B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D76C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D76D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D76E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D76F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D770, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D771, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D772, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D773, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D774, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D775, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D776, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D777, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D778, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D779, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D77A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D77B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D77C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D77D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D77E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D77F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D780, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D781, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D782, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D783, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D784, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D785, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D786, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D787, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D788, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D789, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D78A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D78B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D78C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D78D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D78E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D78F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D790, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0391}, + {0x1D791, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0392}, + {0x1D792, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0393}, + {0x1D793, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0394}, + {0x1D794, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0395}, + {0x1D795, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0396}, + {0x1D796, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0397}, + {0x1D797, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0398}, + {0x1D798, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0399}, + {0x1D799, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039A}, + {0x1D79A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039B}, + {0x1D79B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039C}, + {0x1D79C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039D}, + {0x1D79D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039E}, + {0x1D79E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x039F}, + {0x1D79F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A0}, + {0x1D7A0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A1}, + {0x1D7A1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F4}, + {0x1D7A2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A3}, + {0x1D7A3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A4}, + {0x1D7A4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A5}, + {0x1D7A5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A6}, + {0x1D7A6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A7}, + {0x1D7A7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A8}, + {0x1D7A8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03A9}, + {0x1D7A9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2207}, + {0x1D7AA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B1}, + {0x1D7AB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B2}, + {0x1D7AC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B3}, + {0x1D7AD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B4}, + {0x1D7AE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B5}, + {0x1D7AF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B6}, + {0x1D7B0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B7}, + {0x1D7B1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B8}, + {0x1D7B2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03B9}, + {0x1D7B3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BA}, + {0x1D7B4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BB}, + {0x1D7B5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BC}, + {0x1D7B6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BD}, + {0x1D7B7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BE}, + {0x1D7B8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03BF}, + {0x1D7B9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C0}, + {0x1D7BA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C1}, + {0x1D7BB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C2}, + {0x1D7BC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C3}, + {0x1D7BD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C4}, + {0x1D7BE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C5}, + {0x1D7BF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C6}, + {0x1D7C0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C7}, + {0x1D7C1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C8}, + {0x1D7C2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03C9}, + {0x1D7C3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x2202}, + {0x1D7C4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F5}, + {0x1D7C5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D1}, + {0x1D7C6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F0}, + {0x1D7C7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D5}, + {0x1D7C8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03F1}, + {0x1D7C9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03D6}, + {0x1D7CA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03DC}, + {0x1D7CB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x03DD}, + {0x1D7CE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7CF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7D0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7D1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7D2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7D3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7D4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7D5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7D6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7D7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7D8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7D9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7DA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7DB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7DC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7DD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7DE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7DF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7E0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7E1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7E2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7E3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7E4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7E5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7E6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7E7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7E8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7E9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7EA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7EB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7EC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7ED, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7EE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7EF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7F0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7F1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7F2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7F3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7F4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7F5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1D7F6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1D7F7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1D7F8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1D7F9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1D7FA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1D7FB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1D7FC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1D7FD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1D7FE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1D7FF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x1E000, 230, 0, 0}, + {0x1E001, 230, 0, 0}, + {0x1E002, 230, 0, 0}, + {0x1E003, 230, 0, 0}, + {0x1E004, 230, 0, 0}, + {0x1E005, 230, 0, 0}, + {0x1E006, 230, 0, 0}, + {0x1E008, 230, 0, 0}, + {0x1E009, 230, 0, 0}, + {0x1E00A, 230, 0, 0}, + {0x1E00B, 230, 0, 0}, + {0x1E00C, 230, 0, 0}, + {0x1E00D, 230, 0, 0}, + {0x1E00E, 230, 0, 0}, + {0x1E00F, 230, 0, 0}, + {0x1E010, 230, 0, 0}, + {0x1E011, 230, 0, 0}, + {0x1E012, 230, 0, 0}, + {0x1E013, 230, 0, 0}, + {0x1E014, 230, 0, 0}, + {0x1E015, 230, 0, 0}, + {0x1E016, 230, 0, 0}, + {0x1E017, 230, 0, 0}, + {0x1E018, 230, 0, 0}, + {0x1E01B, 230, 0, 0}, + {0x1E01C, 230, 0, 0}, + {0x1E01D, 230, 0, 0}, + {0x1E01E, 230, 0, 0}, + {0x1E01F, 230, 0, 0}, + {0x1E020, 230, 0, 0}, + {0x1E021, 230, 0, 0}, + {0x1E023, 230, 0, 0}, + {0x1E024, 230, 0, 0}, + {0x1E026, 230, 0, 0}, + {0x1E027, 230, 0, 0}, + {0x1E028, 230, 0, 0}, + {0x1E029, 230, 0, 0}, + {0x1E02A, 230, 0, 0}, + {0x1E030, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0430}, + {0x1E031, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0431}, + {0x1E032, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0432}, + {0x1E033, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0433}, + {0x1E034, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0434}, + {0x1E035, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0435}, + {0x1E036, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0436}, + {0x1E037, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0437}, + {0x1E038, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0438}, + {0x1E039, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043A}, + {0x1E03A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043B}, + {0x1E03B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043C}, + {0x1E03C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043E}, + {0x1E03D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043F}, + {0x1E03E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0440}, + {0x1E03F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0441}, + {0x1E040, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0442}, + {0x1E041, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0443}, + {0x1E042, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0444}, + {0x1E043, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0445}, + {0x1E044, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0446}, + {0x1E045, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0447}, + {0x1E046, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0448}, + {0x1E047, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044B}, + {0x1E048, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044D}, + {0x1E049, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044E}, + {0x1E04A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA689}, + {0x1E04B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04D9}, + {0x1E04C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0456}, + {0x1E04D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0458}, + {0x1E04E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04E9}, + {0x1E04F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04AF}, + {0x1E050, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04CF}, + {0x1E051, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0430}, + {0x1E052, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0431}, + {0x1E053, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0432}, + {0x1E054, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0433}, + {0x1E055, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0434}, + {0x1E056, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0435}, + {0x1E057, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0436}, + {0x1E058, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0437}, + {0x1E059, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0438}, + {0x1E05A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043A}, + {0x1E05B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043B}, + {0x1E05C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043E}, + {0x1E05D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x043F}, + {0x1E05E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0441}, + {0x1E05F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0443}, + {0x1E060, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0444}, + {0x1E061, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0445}, + {0x1E062, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0446}, + {0x1E063, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0447}, + {0x1E064, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0448}, + {0x1E065, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044A}, + {0x1E066, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x044B}, + {0x1E067, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0491}, + {0x1E068, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0456}, + {0x1E069, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0455}, + {0x1E06A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x045F}, + {0x1E06B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04AB}, + {0x1E06C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0xA651}, + {0x1E06D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x04B1}, + {0x1E08F, 230, 0, 0}, + {0x1E130, 230, 0, 0}, + {0x1E131, 230, 0, 0}, + {0x1E132, 230, 0, 0}, + {0x1E133, 230, 0, 0}, + {0x1E134, 230, 0, 0}, + {0x1E135, 230, 0, 0}, + {0x1E136, 230, 0, 0}, + {0x1E2AE, 230, 0, 0}, + {0x1E2EC, 230, 0, 0}, + {0x1E2ED, 230, 0, 0}, + {0x1E2EE, 230, 0, 0}, + {0x1E2EF, 230, 0, 0}, + {0x1E4EC, 232, 0, 0}, + {0x1E4ED, 232, 0, 0}, + {0x1E4EE, 220, 0, 0}, + {0x1E4EF, 230, 0, 0}, + {0x1E8D0, 220, 0, 0}, + {0x1E8D1, 220, 0, 0}, + {0x1E8D2, 220, 0, 0}, + {0x1E8D3, 220, 0, 0}, + {0x1E8D4, 220, 0, 0}, + {0x1E8D5, 220, 0, 0}, + {0x1E8D6, 220, 0, 0}, + {0x1E944, 230, 0, 0}, + {0x1E945, 230, 0, 0}, + {0x1E946, 230, 0, 0}, + {0x1E947, 230, 0, 0}, + {0x1E948, 230, 0, 0}, + {0x1E949, 230, 0, 0}, + {0x1E94A, 7, 0, 0}, + {0x1EE00, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0x1EE01, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE02, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE03, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EE05, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EE06, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EE07, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE08, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE09, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE0A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE0B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE0C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE0D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE0E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE0F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE10, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE11, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE12, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE13, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EE14, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE15, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE16, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE17, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE18, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EE19, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE1A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE1B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE1C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066E}, + {0x1EE1D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0x1EE1E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A1}, + {0x1EE1F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066F}, + {0x1EE21, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE22, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE24, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE27, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE29, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE2A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE2B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE2C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE2D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE2E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE2F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE30, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE31, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE32, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE34, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE35, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE36, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE37, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE39, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE3B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE42, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE47, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE49, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE4B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE4D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE4E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE4F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE51, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE52, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE54, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE57, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE59, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE5B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE5D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06BA}, + {0x1EE5F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066F}, + {0x1EE61, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE62, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE64, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE67, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE68, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE69, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE6A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0643}, + {0x1EE6C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE6D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE6E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE6F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE70, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE71, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE72, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE74, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE75, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE76, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE77, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE79, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE7A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE7B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EE7C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x066E}, + {0x1EE7E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x06A1}, + {0x1EE80, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0627}, + {0x1EE81, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EE82, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EE83, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EE84, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0647}, + {0x1EE85, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EE86, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EE87, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EE88, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EE89, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EE8B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EE8C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EE8D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EE8E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EE8F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EE90, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EE91, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EE92, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EE93, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EE94, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EE95, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EE96, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EE97, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EE98, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EE99, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EE9A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EE9B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1EEA1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0628}, + {0x1EEA2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062C}, + {0x1EEA3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062F}, + {0x1EEA5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0648}, + {0x1EEA6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0632}, + {0x1EEA7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062D}, + {0x1EEA8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0637}, + {0x1EEA9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x064A}, + {0x1EEAB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0644}, + {0x1EEAC, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0645}, + {0x1EEAD, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0646}, + {0x1EEAE, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0633}, + {0x1EEAF, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0639}, + {0x1EEB0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0641}, + {0x1EEB1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0635}, + {0x1EEB2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0642}, + {0x1EEB3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0631}, + {0x1EEB4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0634}, + {0x1EEB5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062A}, + {0x1EEB6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062B}, + {0x1EEB7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x062E}, + {0x1EEB8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0630}, + {0x1EEB9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0636}, + {0x1EEBA, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0638}, + {0x1EEBB, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x063A}, + {0x1F100, 0, 2 | DECOMP_COMPAT, 4834}, + {0x1F101, 0, 2 | DECOMP_COMPAT, 4836}, + {0x1F102, 0, 2 | DECOMP_COMPAT, 4838}, + {0x1F103, 0, 2 | DECOMP_COMPAT, 4840}, + {0x1F104, 0, 2 | DECOMP_COMPAT, 4842}, + {0x1F105, 0, 2 | DECOMP_COMPAT, 4844}, + {0x1F106, 0, 2 | DECOMP_COMPAT, 4846}, + {0x1F107, 0, 2 | DECOMP_COMPAT, 4848}, + {0x1F108, 0, 2 | DECOMP_COMPAT, 4850}, + {0x1F109, 0, 2 | DECOMP_COMPAT, 4852}, + {0x1F10A, 0, 2 | DECOMP_COMPAT, 4854}, + {0x1F110, 0, 3 | DECOMP_COMPAT, 4856}, + {0x1F111, 0, 3 | DECOMP_COMPAT, 4859}, + {0x1F112, 0, 3 | DECOMP_COMPAT, 4862}, + {0x1F113, 0, 3 | DECOMP_COMPAT, 4865}, + {0x1F114, 0, 3 | DECOMP_COMPAT, 4868}, + {0x1F115, 0, 3 | DECOMP_COMPAT, 4871}, + {0x1F116, 0, 3 | DECOMP_COMPAT, 4874}, + {0x1F117, 0, 3 | DECOMP_COMPAT, 4877}, + {0x1F118, 0, 3 | DECOMP_COMPAT, 4880}, + {0x1F119, 0, 3 | DECOMP_COMPAT, 4883}, + {0x1F11A, 0, 3 | DECOMP_COMPAT, 4886}, + {0x1F11B, 0, 3 | DECOMP_COMPAT, 4889}, + {0x1F11C, 0, 3 | DECOMP_COMPAT, 4892}, + {0x1F11D, 0, 3 | DECOMP_COMPAT, 4895}, + {0x1F11E, 0, 3 | DECOMP_COMPAT, 4898}, + {0x1F11F, 0, 3 | DECOMP_COMPAT, 4901}, + {0x1F120, 0, 3 | DECOMP_COMPAT, 4904}, + {0x1F121, 0, 3 | DECOMP_COMPAT, 4907}, + {0x1F122, 0, 3 | DECOMP_COMPAT, 4910}, + {0x1F123, 0, 3 | DECOMP_COMPAT, 4913}, + {0x1F124, 0, 3 | DECOMP_COMPAT, 4916}, + {0x1F125, 0, 3 | DECOMP_COMPAT, 4919}, + {0x1F126, 0, 3 | DECOMP_COMPAT, 4922}, + {0x1F127, 0, 3 | DECOMP_COMPAT, 4925}, + {0x1F128, 0, 3 | DECOMP_COMPAT, 4928}, + {0x1F129, 0, 3 | DECOMP_COMPAT, 4931}, + {0x1F12A, 0, 3 | DECOMP_COMPAT, 4934}, + {0x1F12B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1F12C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1F12D, 0, 2 | DECOMP_COMPAT, 4937}, + {0x1F12E, 0, 2 | DECOMP_COMPAT, 4939}, + {0x1F130, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0041}, + {0x1F131, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0042}, + {0x1F132, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0043}, + {0x1F133, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0044}, + {0x1F134, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0045}, + {0x1F135, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0046}, + {0x1F136, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0047}, + {0x1F137, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0048}, + {0x1F138, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0049}, + {0x1F139, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004A}, + {0x1F13A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004B}, + {0x1F13B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004C}, + {0x1F13C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004D}, + {0x1F13D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004E}, + {0x1F13E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x004F}, + {0x1F13F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0050}, + {0x1F140, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0051}, + {0x1F141, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0052}, + {0x1F142, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0053}, + {0x1F143, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0054}, + {0x1F144, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0055}, + {0x1F145, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0056}, + {0x1F146, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0057}, + {0x1F147, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0058}, + {0x1F148, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0059}, + {0x1F149, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x005A}, + {0x1F14A, 0, 2 | DECOMP_COMPAT, 4941}, + {0x1F14B, 0, 2 | DECOMP_COMPAT, 4943}, + {0x1F14C, 0, 2 | DECOMP_COMPAT, 4945}, + {0x1F14D, 0, 2 | DECOMP_COMPAT, 4947}, + {0x1F14E, 0, 3 | DECOMP_COMPAT, 4949}, + {0x1F14F, 0, 2 | DECOMP_COMPAT, 4952}, + {0x1F16A, 0, 2 | DECOMP_COMPAT, 4954}, + {0x1F16B, 0, 2 | DECOMP_COMPAT, 4956}, + {0x1F16C, 0, 2 | DECOMP_COMPAT, 4958}, + {0x1F190, 0, 2 | DECOMP_COMPAT, 4960}, + {0x1F200, 0, 2 | DECOMP_COMPAT, 4962}, + {0x1F201, 0, 2 | DECOMP_COMPAT, 4964}, + {0x1F202, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30B5}, + {0x1F210, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x624B}, + {0x1F211, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5B57}, + {0x1F212, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53CC}, + {0x1F213, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x30C7}, + {0x1F214, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E8C}, + {0x1F215, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x591A}, + {0x1F216, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x89E3}, + {0x1F217, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5929}, + {0x1F218, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4EA4}, + {0x1F219, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6620}, + {0x1F21A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7121}, + {0x1F21B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6599}, + {0x1F21C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x524D}, + {0x1F21D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F8C}, + {0x1F21E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x518D}, + {0x1F21F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x65B0}, + {0x1F220, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x521D}, + {0x1F221, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7D42}, + {0x1F222, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x751F}, + {0x1F223, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8CA9}, + {0x1F224, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x58F0}, + {0x1F225, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5439}, + {0x1F226, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6F14}, + {0x1F227, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6295}, + {0x1F228, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6355}, + {0x1F229, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E00}, + {0x1F22A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E09}, + {0x1F22B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x904A}, + {0x1F22C, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5DE6}, + {0x1F22D, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x4E2D}, + {0x1F22E, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53F3}, + {0x1F22F, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6307}, + {0x1F230, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x8D70}, + {0x1F231, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6253}, + {0x1F232, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7981}, + {0x1F233, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7A7A}, + {0x1F234, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5408}, + {0x1F235, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6E80}, + {0x1F236, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6709}, + {0x1F237, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x6708}, + {0x1F238, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x7533}, + {0x1F239, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5272}, + {0x1F23A, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x55B6}, + {0x1F23B, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x914D}, + {0x1F240, 0, 3 | DECOMP_COMPAT, 4966}, + {0x1F241, 0, 3 | DECOMP_COMPAT, 4969}, + {0x1F242, 0, 3 | DECOMP_COMPAT, 4972}, + {0x1F243, 0, 3 | DECOMP_COMPAT, 4975}, + {0x1F244, 0, 3 | DECOMP_COMPAT, 4978}, + {0x1F245, 0, 3 | DECOMP_COMPAT, 4981}, + {0x1F246, 0, 3 | DECOMP_COMPAT, 4984}, + {0x1F247, 0, 3 | DECOMP_COMPAT, 4987}, + {0x1F248, 0, 3 | DECOMP_COMPAT, 4990}, + {0x1F250, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x5F97}, + {0x1F251, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x53EF}, + {0x1FBF0, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0030}, + {0x1FBF1, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0031}, + {0x1FBF2, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0032}, + {0x1FBF3, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0033}, + {0x1FBF4, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0034}, + {0x1FBF5, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0035}, + {0x1FBF6, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0036}, + {0x1FBF7, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0037}, + {0x1FBF8, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0038}, + {0x1FBF9, 0, 1 | DECOMP_COMPAT | DECOMP_INLINE, 0x0039}, + {0x2F800, 0, 1 | DECOMP_INLINE, 0x4E3D}, + {0x2F801, 0, 1 | DECOMP_INLINE, 0x4E38}, + {0x2F802, 0, 1 | DECOMP_INLINE, 0x4E41}, + {0x2F803, 0, 1, 4993}, + {0x2F804, 0, 1 | DECOMP_INLINE, 0x4F60}, + {0x2F805, 0, 1 | DECOMP_INLINE, 0x4FAE}, + {0x2F806, 0, 1 | DECOMP_INLINE, 0x4FBB}, + {0x2F807, 0, 1 | DECOMP_INLINE, 0x5002}, + {0x2F808, 0, 1 | DECOMP_INLINE, 0x507A}, + {0x2F809, 0, 1 | DECOMP_INLINE, 0x5099}, + {0x2F80A, 0, 1 | DECOMP_INLINE, 0x50E7}, + {0x2F80B, 0, 1 | DECOMP_INLINE, 0x50CF}, + {0x2F80C, 0, 1 | DECOMP_INLINE, 0x349E}, + {0x2F80D, 0, 1, 4994}, + {0x2F80E, 0, 1 | DECOMP_INLINE, 0x514D}, + {0x2F80F, 0, 1 | DECOMP_INLINE, 0x5154}, + {0x2F810, 0, 1 | DECOMP_INLINE, 0x5164}, + {0x2F811, 0, 1 | DECOMP_INLINE, 0x5177}, + {0x2F812, 0, 1, 4995}, + {0x2F813, 0, 1 | DECOMP_INLINE, 0x34B9}, + {0x2F814, 0, 1 | DECOMP_INLINE, 0x5167}, + {0x2F815, 0, 1 | DECOMP_INLINE, 0x518D}, + {0x2F816, 0, 1, 4996}, + {0x2F817, 0, 1 | DECOMP_INLINE, 0x5197}, + {0x2F818, 0, 1 | DECOMP_INLINE, 0x51A4}, + {0x2F819, 0, 1 | DECOMP_INLINE, 0x4ECC}, + {0x2F81A, 0, 1 | DECOMP_INLINE, 0x51AC}, + {0x2F81B, 0, 1 | DECOMP_INLINE, 0x51B5}, + {0x2F81C, 0, 1, 4997}, + {0x2F81D, 0, 1 | DECOMP_INLINE, 0x51F5}, + {0x2F81E, 0, 1 | DECOMP_INLINE, 0x5203}, + {0x2F81F, 0, 1 | DECOMP_INLINE, 0x34DF}, + {0x2F820, 0, 1 | DECOMP_INLINE, 0x523B}, + {0x2F821, 0, 1 | DECOMP_INLINE, 0x5246}, + {0x2F822, 0, 1 | DECOMP_INLINE, 0x5272}, + {0x2F823, 0, 1 | DECOMP_INLINE, 0x5277}, + {0x2F824, 0, 1 | DECOMP_INLINE, 0x3515}, + {0x2F825, 0, 1 | DECOMP_INLINE, 0x52C7}, + {0x2F826, 0, 1 | DECOMP_INLINE, 0x52C9}, + {0x2F827, 0, 1 | DECOMP_INLINE, 0x52E4}, + {0x2F828, 0, 1 | DECOMP_INLINE, 0x52FA}, + {0x2F829, 0, 1 | DECOMP_INLINE, 0x5305}, + {0x2F82A, 0, 1 | DECOMP_INLINE, 0x5306}, + {0x2F82B, 0, 1 | DECOMP_INLINE, 0x5317}, + {0x2F82C, 0, 1 | DECOMP_INLINE, 0x5349}, + {0x2F82D, 0, 1 | DECOMP_INLINE, 0x5351}, + {0x2F82E, 0, 1 | DECOMP_INLINE, 0x535A}, + {0x2F82F, 0, 1 | DECOMP_INLINE, 0x5373}, + {0x2F830, 0, 1 | DECOMP_INLINE, 0x537D}, + {0x2F831, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F832, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F833, 0, 1 | DECOMP_INLINE, 0x537F}, + {0x2F834, 0, 1, 4998}, + {0x2F835, 0, 1 | DECOMP_INLINE, 0x7070}, + {0x2F836, 0, 1 | DECOMP_INLINE, 0x53CA}, + {0x2F837, 0, 1 | DECOMP_INLINE, 0x53DF}, + {0x2F838, 0, 1, 4999}, + {0x2F839, 0, 1 | DECOMP_INLINE, 0x53EB}, + {0x2F83A, 0, 1 | DECOMP_INLINE, 0x53F1}, + {0x2F83B, 0, 1 | DECOMP_INLINE, 0x5406}, + {0x2F83C, 0, 1 | DECOMP_INLINE, 0x549E}, + {0x2F83D, 0, 1 | DECOMP_INLINE, 0x5438}, + {0x2F83E, 0, 1 | DECOMP_INLINE, 0x5448}, + {0x2F83F, 0, 1 | DECOMP_INLINE, 0x5468}, + {0x2F840, 0, 1 | DECOMP_INLINE, 0x54A2}, + {0x2F841, 0, 1 | DECOMP_INLINE, 0x54F6}, + {0x2F842, 0, 1 | DECOMP_INLINE, 0x5510}, + {0x2F843, 0, 1 | DECOMP_INLINE, 0x5553}, + {0x2F844, 0, 1 | DECOMP_INLINE, 0x5563}, + {0x2F845, 0, 1 | DECOMP_INLINE, 0x5584}, + {0x2F846, 0, 1 | DECOMP_INLINE, 0x5584}, + {0x2F847, 0, 1 | DECOMP_INLINE, 0x5599}, + {0x2F848, 0, 1 | DECOMP_INLINE, 0x55AB}, + {0x2F849, 0, 1 | DECOMP_INLINE, 0x55B3}, + {0x2F84A, 0, 1 | DECOMP_INLINE, 0x55C2}, + {0x2F84B, 0, 1 | DECOMP_INLINE, 0x5716}, + {0x2F84C, 0, 1 | DECOMP_INLINE, 0x5606}, + {0x2F84D, 0, 1 | DECOMP_INLINE, 0x5717}, + {0x2F84E, 0, 1 | DECOMP_INLINE, 0x5651}, + {0x2F84F, 0, 1 | DECOMP_INLINE, 0x5674}, + {0x2F850, 0, 1 | DECOMP_INLINE, 0x5207}, + {0x2F851, 0, 1 | DECOMP_INLINE, 0x58EE}, + {0x2F852, 0, 1 | DECOMP_INLINE, 0x57CE}, + {0x2F853, 0, 1 | DECOMP_INLINE, 0x57F4}, + {0x2F854, 0, 1 | DECOMP_INLINE, 0x580D}, + {0x2F855, 0, 1 | DECOMP_INLINE, 0x578B}, + {0x2F856, 0, 1 | DECOMP_INLINE, 0x5832}, + {0x2F857, 0, 1 | DECOMP_INLINE, 0x5831}, + {0x2F858, 0, 1 | DECOMP_INLINE, 0x58AC}, + {0x2F859, 0, 1, 5000}, + {0x2F85A, 0, 1 | DECOMP_INLINE, 0x58F2}, + {0x2F85B, 0, 1 | DECOMP_INLINE, 0x58F7}, + {0x2F85C, 0, 1 | DECOMP_INLINE, 0x5906}, + {0x2F85D, 0, 1 | DECOMP_INLINE, 0x591A}, + {0x2F85E, 0, 1 | DECOMP_INLINE, 0x5922}, + {0x2F85F, 0, 1 | DECOMP_INLINE, 0x5962}, + {0x2F860, 0, 1, 5001}, + {0x2F861, 0, 1, 5002}, + {0x2F862, 0, 1 | DECOMP_INLINE, 0x59EC}, + {0x2F863, 0, 1 | DECOMP_INLINE, 0x5A1B}, + {0x2F864, 0, 1 | DECOMP_INLINE, 0x5A27}, + {0x2F865, 0, 1 | DECOMP_INLINE, 0x59D8}, + {0x2F866, 0, 1 | DECOMP_INLINE, 0x5A66}, + {0x2F867, 0, 1 | DECOMP_INLINE, 0x36EE}, + {0x2F868, 0, 1 | DECOMP_INLINE, 0x36FC}, + {0x2F869, 0, 1 | DECOMP_INLINE, 0x5B08}, + {0x2F86A, 0, 1 | DECOMP_INLINE, 0x5B3E}, + {0x2F86B, 0, 1 | DECOMP_INLINE, 0x5B3E}, + {0x2F86C, 0, 1, 5003}, + {0x2F86D, 0, 1 | DECOMP_INLINE, 0x5BC3}, + {0x2F86E, 0, 1 | DECOMP_INLINE, 0x5BD8}, + {0x2F86F, 0, 1 | DECOMP_INLINE, 0x5BE7}, + {0x2F870, 0, 1 | DECOMP_INLINE, 0x5BF3}, + {0x2F871, 0, 1, 5004}, + {0x2F872, 0, 1 | DECOMP_INLINE, 0x5BFF}, + {0x2F873, 0, 1 | DECOMP_INLINE, 0x5C06}, + {0x2F874, 0, 1 | DECOMP_INLINE, 0x5F53}, + {0x2F875, 0, 1 | DECOMP_INLINE, 0x5C22}, + {0x2F876, 0, 1 | DECOMP_INLINE, 0x3781}, + {0x2F877, 0, 1 | DECOMP_INLINE, 0x5C60}, + {0x2F878, 0, 1 | DECOMP_INLINE, 0x5C6E}, + {0x2F879, 0, 1 | DECOMP_INLINE, 0x5CC0}, + {0x2F87A, 0, 1 | DECOMP_INLINE, 0x5C8D}, + {0x2F87B, 0, 1, 5005}, + {0x2F87C, 0, 1 | DECOMP_INLINE, 0x5D43}, + {0x2F87D, 0, 1, 5006}, + {0x2F87E, 0, 1 | DECOMP_INLINE, 0x5D6E}, + {0x2F87F, 0, 1 | DECOMP_INLINE, 0x5D6B}, + {0x2F880, 0, 1 | DECOMP_INLINE, 0x5D7C}, + {0x2F881, 0, 1 | DECOMP_INLINE, 0x5DE1}, + {0x2F882, 0, 1 | DECOMP_INLINE, 0x5DE2}, + {0x2F883, 0, 1 | DECOMP_INLINE, 0x382F}, + {0x2F884, 0, 1 | DECOMP_INLINE, 0x5DFD}, + {0x2F885, 0, 1 | DECOMP_INLINE, 0x5E28}, + {0x2F886, 0, 1 | DECOMP_INLINE, 0x5E3D}, + {0x2F887, 0, 1 | DECOMP_INLINE, 0x5E69}, + {0x2F888, 0, 1 | DECOMP_INLINE, 0x3862}, + {0x2F889, 0, 1, 5007}, + {0x2F88A, 0, 1 | DECOMP_INLINE, 0x387C}, + {0x2F88B, 0, 1 | DECOMP_INLINE, 0x5EB0}, + {0x2F88C, 0, 1 | DECOMP_INLINE, 0x5EB3}, + {0x2F88D, 0, 1 | DECOMP_INLINE, 0x5EB6}, + {0x2F88E, 0, 1 | DECOMP_INLINE, 0x5ECA}, + {0x2F88F, 0, 1, 5008}, + {0x2F890, 0, 1 | DECOMP_INLINE, 0x5EFE}, + {0x2F891, 0, 1, 5009}, + {0x2F892, 0, 1, 5010}, + {0x2F893, 0, 1 | DECOMP_INLINE, 0x8201}, + {0x2F894, 0, 1 | DECOMP_INLINE, 0x5F22}, + {0x2F895, 0, 1 | DECOMP_INLINE, 0x5F22}, + {0x2F896, 0, 1 | DECOMP_INLINE, 0x38C7}, + {0x2F897, 0, 1, 5011}, + {0x2F898, 0, 1, 5012}, + {0x2F899, 0, 1 | DECOMP_INLINE, 0x5F62}, + {0x2F89A, 0, 1 | DECOMP_INLINE, 0x5F6B}, + {0x2F89B, 0, 1 | DECOMP_INLINE, 0x38E3}, + {0x2F89C, 0, 1 | DECOMP_INLINE, 0x5F9A}, + {0x2F89D, 0, 1 | DECOMP_INLINE, 0x5FCD}, + {0x2F89E, 0, 1 | DECOMP_INLINE, 0x5FD7}, + {0x2F89F, 0, 1 | DECOMP_INLINE, 0x5FF9}, + {0x2F8A0, 0, 1 | DECOMP_INLINE, 0x6081}, + {0x2F8A1, 0, 1 | DECOMP_INLINE, 0x393A}, + {0x2F8A2, 0, 1 | DECOMP_INLINE, 0x391C}, + {0x2F8A3, 0, 1 | DECOMP_INLINE, 0x6094}, + {0x2F8A4, 0, 1, 5013}, + {0x2F8A5, 0, 1 | DECOMP_INLINE, 0x60C7}, + {0x2F8A6, 0, 1 | DECOMP_INLINE, 0x6148}, + {0x2F8A7, 0, 1 | DECOMP_INLINE, 0x614C}, + {0x2F8A8, 0, 1 | DECOMP_INLINE, 0x614E}, + {0x2F8A9, 0, 1 | DECOMP_INLINE, 0x614C}, + {0x2F8AA, 0, 1 | DECOMP_INLINE, 0x617A}, + {0x2F8AB, 0, 1 | DECOMP_INLINE, 0x618E}, + {0x2F8AC, 0, 1 | DECOMP_INLINE, 0x61B2}, + {0x2F8AD, 0, 1 | DECOMP_INLINE, 0x61A4}, + {0x2F8AE, 0, 1 | DECOMP_INLINE, 0x61AF}, + {0x2F8AF, 0, 1 | DECOMP_INLINE, 0x61DE}, + {0x2F8B0, 0, 1 | DECOMP_INLINE, 0x61F2}, + {0x2F8B1, 0, 1 | DECOMP_INLINE, 0x61F6}, + {0x2F8B2, 0, 1 | DECOMP_INLINE, 0x6210}, + {0x2F8B3, 0, 1 | DECOMP_INLINE, 0x621B}, + {0x2F8B4, 0, 1 | DECOMP_INLINE, 0x625D}, + {0x2F8B5, 0, 1 | DECOMP_INLINE, 0x62B1}, + {0x2F8B6, 0, 1 | DECOMP_INLINE, 0x62D4}, + {0x2F8B7, 0, 1 | DECOMP_INLINE, 0x6350}, + {0x2F8B8, 0, 1, 5014}, + {0x2F8B9, 0, 1 | DECOMP_INLINE, 0x633D}, + {0x2F8BA, 0, 1 | DECOMP_INLINE, 0x62FC}, + {0x2F8BB, 0, 1 | DECOMP_INLINE, 0x6368}, + {0x2F8BC, 0, 1 | DECOMP_INLINE, 0x6383}, + {0x2F8BD, 0, 1 | DECOMP_INLINE, 0x63E4}, + {0x2F8BE, 0, 1, 5015}, + {0x2F8BF, 0, 1 | DECOMP_INLINE, 0x6422}, + {0x2F8C0, 0, 1 | DECOMP_INLINE, 0x63C5}, + {0x2F8C1, 0, 1 | DECOMP_INLINE, 0x63A9}, + {0x2F8C2, 0, 1 | DECOMP_INLINE, 0x3A2E}, + {0x2F8C3, 0, 1 | DECOMP_INLINE, 0x6469}, + {0x2F8C4, 0, 1 | DECOMP_INLINE, 0x647E}, + {0x2F8C5, 0, 1 | DECOMP_INLINE, 0x649D}, + {0x2F8C6, 0, 1 | DECOMP_INLINE, 0x6477}, + {0x2F8C7, 0, 1 | DECOMP_INLINE, 0x3A6C}, + {0x2F8C8, 0, 1 | DECOMP_INLINE, 0x654F}, + {0x2F8C9, 0, 1 | DECOMP_INLINE, 0x656C}, + {0x2F8CA, 0, 1, 5016}, + {0x2F8CB, 0, 1 | DECOMP_INLINE, 0x65E3}, + {0x2F8CC, 0, 1 | DECOMP_INLINE, 0x66F8}, + {0x2F8CD, 0, 1 | DECOMP_INLINE, 0x6649}, + {0x2F8CE, 0, 1 | DECOMP_INLINE, 0x3B19}, + {0x2F8CF, 0, 1 | DECOMP_INLINE, 0x6691}, + {0x2F8D0, 0, 1 | DECOMP_INLINE, 0x3B08}, + {0x2F8D1, 0, 1 | DECOMP_INLINE, 0x3AE4}, + {0x2F8D2, 0, 1 | DECOMP_INLINE, 0x5192}, + {0x2F8D3, 0, 1 | DECOMP_INLINE, 0x5195}, + {0x2F8D4, 0, 1 | DECOMP_INLINE, 0x6700}, + {0x2F8D5, 0, 1 | DECOMP_INLINE, 0x669C}, + {0x2F8D6, 0, 1 | DECOMP_INLINE, 0x80AD}, + {0x2F8D7, 0, 1 | DECOMP_INLINE, 0x43D9}, + {0x2F8D8, 0, 1 | DECOMP_INLINE, 0x6717}, + {0x2F8D9, 0, 1 | DECOMP_INLINE, 0x671B}, + {0x2F8DA, 0, 1 | DECOMP_INLINE, 0x6721}, + {0x2F8DB, 0, 1 | DECOMP_INLINE, 0x675E}, + {0x2F8DC, 0, 1 | DECOMP_INLINE, 0x6753}, + {0x2F8DD, 0, 1, 5017}, + {0x2F8DE, 0, 1 | DECOMP_INLINE, 0x3B49}, + {0x2F8DF, 0, 1 | DECOMP_INLINE, 0x67FA}, + {0x2F8E0, 0, 1 | DECOMP_INLINE, 0x6785}, + {0x2F8E1, 0, 1 | DECOMP_INLINE, 0x6852}, + {0x2F8E2, 0, 1 | DECOMP_INLINE, 0x6885}, + {0x2F8E3, 0, 1, 5018}, + {0x2F8E4, 0, 1 | DECOMP_INLINE, 0x688E}, + {0x2F8E5, 0, 1 | DECOMP_INLINE, 0x681F}, + {0x2F8E6, 0, 1 | DECOMP_INLINE, 0x6914}, + {0x2F8E7, 0, 1 | DECOMP_INLINE, 0x3B9D}, + {0x2F8E8, 0, 1 | DECOMP_INLINE, 0x6942}, + {0x2F8E9, 0, 1 | DECOMP_INLINE, 0x69A3}, + {0x2F8EA, 0, 1 | DECOMP_INLINE, 0x69EA}, + {0x2F8EB, 0, 1 | DECOMP_INLINE, 0x6AA8}, + {0x2F8EC, 0, 1, 5019}, + {0x2F8ED, 0, 1 | DECOMP_INLINE, 0x6ADB}, + {0x2F8EE, 0, 1 | DECOMP_INLINE, 0x3C18}, + {0x2F8EF, 0, 1 | DECOMP_INLINE, 0x6B21}, + {0x2F8F0, 0, 1, 5020}, + {0x2F8F1, 0, 1 | DECOMP_INLINE, 0x6B54}, + {0x2F8F2, 0, 1 | DECOMP_INLINE, 0x3C4E}, + {0x2F8F3, 0, 1 | DECOMP_INLINE, 0x6B72}, + {0x2F8F4, 0, 1 | DECOMP_INLINE, 0x6B9F}, + {0x2F8F5, 0, 1 | DECOMP_INLINE, 0x6BBA}, + {0x2F8F6, 0, 1 | DECOMP_INLINE, 0x6BBB}, + {0x2F8F7, 0, 1, 5021}, + {0x2F8F8, 0, 1, 5022}, + {0x2F8F9, 0, 1, 5023}, + {0x2F8FA, 0, 1 | DECOMP_INLINE, 0x6C4E}, + {0x2F8FB, 0, 1, 5024}, + {0x2F8FC, 0, 1 | DECOMP_INLINE, 0x6CBF}, + {0x2F8FD, 0, 1 | DECOMP_INLINE, 0x6CCD}, + {0x2F8FE, 0, 1 | DECOMP_INLINE, 0x6C67}, + {0x2F8FF, 0, 1 | DECOMP_INLINE, 0x6D16}, + {0x2F900, 0, 1 | DECOMP_INLINE, 0x6D3E}, + {0x2F901, 0, 1 | DECOMP_INLINE, 0x6D77}, + {0x2F902, 0, 1 | DECOMP_INLINE, 0x6D41}, + {0x2F903, 0, 1 | DECOMP_INLINE, 0x6D69}, + {0x2F904, 0, 1 | DECOMP_INLINE, 0x6D78}, + {0x2F905, 0, 1 | DECOMP_INLINE, 0x6D85}, + {0x2F906, 0, 1, 5025}, + {0x2F907, 0, 1 | DECOMP_INLINE, 0x6D34}, + {0x2F908, 0, 1 | DECOMP_INLINE, 0x6E2F}, + {0x2F909, 0, 1 | DECOMP_INLINE, 0x6E6E}, + {0x2F90A, 0, 1 | DECOMP_INLINE, 0x3D33}, + {0x2F90B, 0, 1 | DECOMP_INLINE, 0x6ECB}, + {0x2F90C, 0, 1 | DECOMP_INLINE, 0x6EC7}, + {0x2F90D, 0, 1, 5026}, + {0x2F90E, 0, 1 | DECOMP_INLINE, 0x6DF9}, + {0x2F90F, 0, 1 | DECOMP_INLINE, 0x6F6E}, + {0x2F910, 0, 1, 5027}, + {0x2F911, 0, 1, 5028}, + {0x2F912, 0, 1 | DECOMP_INLINE, 0x6FC6}, + {0x2F913, 0, 1 | DECOMP_INLINE, 0x7039}, + {0x2F914, 0, 1 | DECOMP_INLINE, 0x701E}, + {0x2F915, 0, 1 | DECOMP_INLINE, 0x701B}, + {0x2F916, 0, 1 | DECOMP_INLINE, 0x3D96}, + {0x2F917, 0, 1 | DECOMP_INLINE, 0x704A}, + {0x2F918, 0, 1 | DECOMP_INLINE, 0x707D}, + {0x2F919, 0, 1 | DECOMP_INLINE, 0x7077}, + {0x2F91A, 0, 1 | DECOMP_INLINE, 0x70AD}, + {0x2F91B, 0, 1, 5029}, + {0x2F91C, 0, 1 | DECOMP_INLINE, 0x7145}, + {0x2F91D, 0, 1, 5030}, + {0x2F91E, 0, 1 | DECOMP_INLINE, 0x719C}, + {0x2F91F, 0, 1, 5031}, + {0x2F920, 0, 1 | DECOMP_INLINE, 0x7228}, + {0x2F921, 0, 1 | DECOMP_INLINE, 0x7235}, + {0x2F922, 0, 1 | DECOMP_INLINE, 0x7250}, + {0x2F923, 0, 1, 5032}, + {0x2F924, 0, 1 | DECOMP_INLINE, 0x7280}, + {0x2F925, 0, 1 | DECOMP_INLINE, 0x7295}, + {0x2F926, 0, 1, 5033}, + {0x2F927, 0, 1, 5034}, + {0x2F928, 0, 1 | DECOMP_INLINE, 0x737A}, + {0x2F929, 0, 1 | DECOMP_INLINE, 0x738B}, + {0x2F92A, 0, 1 | DECOMP_INLINE, 0x3EAC}, + {0x2F92B, 0, 1 | DECOMP_INLINE, 0x73A5}, + {0x2F92C, 0, 1 | DECOMP_INLINE, 0x3EB8}, + {0x2F92D, 0, 1 | DECOMP_INLINE, 0x3EB8}, + {0x2F92E, 0, 1 | DECOMP_INLINE, 0x7447}, + {0x2F92F, 0, 1 | DECOMP_INLINE, 0x745C}, + {0x2F930, 0, 1 | DECOMP_INLINE, 0x7471}, + {0x2F931, 0, 1 | DECOMP_INLINE, 0x7485}, + {0x2F932, 0, 1 | DECOMP_INLINE, 0x74CA}, + {0x2F933, 0, 1 | DECOMP_INLINE, 0x3F1B}, + {0x2F934, 0, 1 | DECOMP_INLINE, 0x7524}, + {0x2F935, 0, 1, 5035}, + {0x2F936, 0, 1 | DECOMP_INLINE, 0x753E}, + {0x2F937, 0, 1, 5036}, + {0x2F938, 0, 1 | DECOMP_INLINE, 0x7570}, + {0x2F939, 0, 1, 5037}, + {0x2F93A, 0, 1 | DECOMP_INLINE, 0x7610}, + {0x2F93B, 0, 1, 5038}, + {0x2F93C, 0, 1, 5039}, + {0x2F93D, 0, 1, 5040}, + {0x2F93E, 0, 1 | DECOMP_INLINE, 0x3FFC}, + {0x2F93F, 0, 1 | DECOMP_INLINE, 0x4008}, + {0x2F940, 0, 1 | DECOMP_INLINE, 0x76F4}, + {0x2F941, 0, 1, 5041}, + {0x2F942, 0, 1, 5042}, + {0x2F943, 0, 1, 5043}, + {0x2F944, 0, 1, 5044}, + {0x2F945, 0, 1 | DECOMP_INLINE, 0x771E}, + {0x2F946, 0, 1 | DECOMP_INLINE, 0x771F}, + {0x2F947, 0, 1 | DECOMP_INLINE, 0x771F}, + {0x2F948, 0, 1 | DECOMP_INLINE, 0x774A}, + {0x2F949, 0, 1 | DECOMP_INLINE, 0x4039}, + {0x2F94A, 0, 1 | DECOMP_INLINE, 0x778B}, + {0x2F94B, 0, 1 | DECOMP_INLINE, 0x4046}, + {0x2F94C, 0, 1 | DECOMP_INLINE, 0x4096}, + {0x2F94D, 0, 1, 5045}, + {0x2F94E, 0, 1 | DECOMP_INLINE, 0x784E}, + {0x2F94F, 0, 1 | DECOMP_INLINE, 0x788C}, + {0x2F950, 0, 1 | DECOMP_INLINE, 0x78CC}, + {0x2F951, 0, 1 | DECOMP_INLINE, 0x40E3}, + {0x2F952, 0, 1, 5046}, + {0x2F953, 0, 1 | DECOMP_INLINE, 0x7956}, + {0x2F954, 0, 1, 5047}, + {0x2F955, 0, 1, 5048}, + {0x2F956, 0, 1 | DECOMP_INLINE, 0x798F}, + {0x2F957, 0, 1 | DECOMP_INLINE, 0x79EB}, + {0x2F958, 0, 1 | DECOMP_INLINE, 0x412F}, + {0x2F959, 0, 1 | DECOMP_INLINE, 0x7A40}, + {0x2F95A, 0, 1 | DECOMP_INLINE, 0x7A4A}, + {0x2F95B, 0, 1 | DECOMP_INLINE, 0x7A4F}, + {0x2F95C, 0, 1, 5049}, + {0x2F95D, 0, 1, 5050}, + {0x2F95E, 0, 1, 5051}, + {0x2F95F, 0, 1 | DECOMP_INLINE, 0x7AEE}, + {0x2F960, 0, 1 | DECOMP_INLINE, 0x4202}, + {0x2F961, 0, 1, 5052}, + {0x2F962, 0, 1 | DECOMP_INLINE, 0x7BC6}, + {0x2F963, 0, 1 | DECOMP_INLINE, 0x7BC9}, + {0x2F964, 0, 1 | DECOMP_INLINE, 0x4227}, + {0x2F965, 0, 1, 5053}, + {0x2F966, 0, 1 | DECOMP_INLINE, 0x7CD2}, + {0x2F967, 0, 1 | DECOMP_INLINE, 0x42A0}, + {0x2F968, 0, 1 | DECOMP_INLINE, 0x7CE8}, + {0x2F969, 0, 1 | DECOMP_INLINE, 0x7CE3}, + {0x2F96A, 0, 1 | DECOMP_INLINE, 0x7D00}, + {0x2F96B, 0, 1, 5054}, + {0x2F96C, 0, 1 | DECOMP_INLINE, 0x7D63}, + {0x2F96D, 0, 1 | DECOMP_INLINE, 0x4301}, + {0x2F96E, 0, 1 | DECOMP_INLINE, 0x7DC7}, + {0x2F96F, 0, 1 | DECOMP_INLINE, 0x7E02}, + {0x2F970, 0, 1 | DECOMP_INLINE, 0x7E45}, + {0x2F971, 0, 1 | DECOMP_INLINE, 0x4334}, + {0x2F972, 0, 1, 5055}, + {0x2F973, 0, 1, 5056}, + {0x2F974, 0, 1 | DECOMP_INLINE, 0x4359}, + {0x2F975, 0, 1, 5057}, + {0x2F976, 0, 1 | DECOMP_INLINE, 0x7F7A}, + {0x2F977, 0, 1, 5058}, + {0x2F978, 0, 1 | DECOMP_INLINE, 0x7F95}, + {0x2F979, 0, 1 | DECOMP_INLINE, 0x7FFA}, + {0x2F97A, 0, 1 | DECOMP_INLINE, 0x8005}, + {0x2F97B, 0, 1, 5059}, + {0x2F97C, 0, 1, 5060}, + {0x2F97D, 0, 1 | DECOMP_INLINE, 0x8060}, + {0x2F97E, 0, 1, 5061}, + {0x2F97F, 0, 1 | DECOMP_INLINE, 0x8070}, + {0x2F980, 0, 1, 5062}, + {0x2F981, 0, 1 | DECOMP_INLINE, 0x43D5}, + {0x2F982, 0, 1 | DECOMP_INLINE, 0x80B2}, + {0x2F983, 0, 1 | DECOMP_INLINE, 0x8103}, + {0x2F984, 0, 1 | DECOMP_INLINE, 0x440B}, + {0x2F985, 0, 1 | DECOMP_INLINE, 0x813E}, + {0x2F986, 0, 1 | DECOMP_INLINE, 0x5AB5}, + {0x2F987, 0, 1, 5063}, + {0x2F988, 0, 1, 5064}, + {0x2F989, 0, 1, 5065}, + {0x2F98A, 0, 1, 5066}, + {0x2F98B, 0, 1 | DECOMP_INLINE, 0x8201}, + {0x2F98C, 0, 1 | DECOMP_INLINE, 0x8204}, + {0x2F98D, 0, 1 | DECOMP_INLINE, 0x8F9E}, + {0x2F98E, 0, 1 | DECOMP_INLINE, 0x446B}, + {0x2F98F, 0, 1 | DECOMP_INLINE, 0x8291}, + {0x2F990, 0, 1 | DECOMP_INLINE, 0x828B}, + {0x2F991, 0, 1 | DECOMP_INLINE, 0x829D}, + {0x2F992, 0, 1 | DECOMP_INLINE, 0x52B3}, + {0x2F993, 0, 1 | DECOMP_INLINE, 0x82B1}, + {0x2F994, 0, 1 | DECOMP_INLINE, 0x82B3}, + {0x2F995, 0, 1 | DECOMP_INLINE, 0x82BD}, + {0x2F996, 0, 1 | DECOMP_INLINE, 0x82E6}, + {0x2F997, 0, 1, 5067}, + {0x2F998, 0, 1 | DECOMP_INLINE, 0x82E5}, + {0x2F999, 0, 1 | DECOMP_INLINE, 0x831D}, + {0x2F99A, 0, 1 | DECOMP_INLINE, 0x8363}, + {0x2F99B, 0, 1 | DECOMP_INLINE, 0x83AD}, + {0x2F99C, 0, 1 | DECOMP_INLINE, 0x8323}, + {0x2F99D, 0, 1 | DECOMP_INLINE, 0x83BD}, + {0x2F99E, 0, 1 | DECOMP_INLINE, 0x83E7}, + {0x2F99F, 0, 1 | DECOMP_INLINE, 0x8457}, + {0x2F9A0, 0, 1 | DECOMP_INLINE, 0x8353}, + {0x2F9A1, 0, 1 | DECOMP_INLINE, 0x83CA}, + {0x2F9A2, 0, 1 | DECOMP_INLINE, 0x83CC}, + {0x2F9A3, 0, 1 | DECOMP_INLINE, 0x83DC}, + {0x2F9A4, 0, 1, 5068}, + {0x2F9A5, 0, 1, 5069}, + {0x2F9A6, 0, 1, 5070}, + {0x2F9A7, 0, 1 | DECOMP_INLINE, 0x452B}, + {0x2F9A8, 0, 1 | DECOMP_INLINE, 0x84F1}, + {0x2F9A9, 0, 1 | DECOMP_INLINE, 0x84F3}, + {0x2F9AA, 0, 1 | DECOMP_INLINE, 0x8516}, + {0x2F9AB, 0, 1, 5071}, + {0x2F9AC, 0, 1 | DECOMP_INLINE, 0x8564}, + {0x2F9AD, 0, 1, 5072}, + {0x2F9AE, 0, 1 | DECOMP_INLINE, 0x455D}, + {0x2F9AF, 0, 1 | DECOMP_INLINE, 0x4561}, + {0x2F9B0, 0, 1, 5073}, + {0x2F9B1, 0, 1, 5074}, + {0x2F9B2, 0, 1 | DECOMP_INLINE, 0x456B}, + {0x2F9B3, 0, 1 | DECOMP_INLINE, 0x8650}, + {0x2F9B4, 0, 1 | DECOMP_INLINE, 0x865C}, + {0x2F9B5, 0, 1 | DECOMP_INLINE, 0x8667}, + {0x2F9B6, 0, 1 | DECOMP_INLINE, 0x8669}, + {0x2F9B7, 0, 1 | DECOMP_INLINE, 0x86A9}, + {0x2F9B8, 0, 1 | DECOMP_INLINE, 0x8688}, + {0x2F9B9, 0, 1 | DECOMP_INLINE, 0x870E}, + {0x2F9BA, 0, 1 | DECOMP_INLINE, 0x86E2}, + {0x2F9BB, 0, 1 | DECOMP_INLINE, 0x8779}, + {0x2F9BC, 0, 1 | DECOMP_INLINE, 0x8728}, + {0x2F9BD, 0, 1 | DECOMP_INLINE, 0x876B}, + {0x2F9BE, 0, 1 | DECOMP_INLINE, 0x8786}, + {0x2F9BF, 0, 1 | DECOMP_INLINE, 0x45D7}, + {0x2F9C0, 0, 1 | DECOMP_INLINE, 0x87E1}, + {0x2F9C1, 0, 1 | DECOMP_INLINE, 0x8801}, + {0x2F9C2, 0, 1 | DECOMP_INLINE, 0x45F9}, + {0x2F9C3, 0, 1 | DECOMP_INLINE, 0x8860}, + {0x2F9C4, 0, 1 | DECOMP_INLINE, 0x8863}, + {0x2F9C5, 0, 1, 5075}, + {0x2F9C6, 0, 1 | DECOMP_INLINE, 0x88D7}, + {0x2F9C7, 0, 1 | DECOMP_INLINE, 0x88DE}, + {0x2F9C8, 0, 1 | DECOMP_INLINE, 0x4635}, + {0x2F9C9, 0, 1 | DECOMP_INLINE, 0x88FA}, + {0x2F9CA, 0, 1 | DECOMP_INLINE, 0x34BB}, + {0x2F9CB, 0, 1, 5076}, + {0x2F9CC, 0, 1, 5077}, + {0x2F9CD, 0, 1 | DECOMP_INLINE, 0x46BE}, + {0x2F9CE, 0, 1 | DECOMP_INLINE, 0x46C7}, + {0x2F9CF, 0, 1 | DECOMP_INLINE, 0x8AA0}, + {0x2F9D0, 0, 1 | DECOMP_INLINE, 0x8AED}, + {0x2F9D1, 0, 1 | DECOMP_INLINE, 0x8B8A}, + {0x2F9D2, 0, 1 | DECOMP_INLINE, 0x8C55}, + {0x2F9D3, 0, 1, 5078}, + {0x2F9D4, 0, 1 | DECOMP_INLINE, 0x8CAB}, + {0x2F9D5, 0, 1 | DECOMP_INLINE, 0x8CC1}, + {0x2F9D6, 0, 1 | DECOMP_INLINE, 0x8D1B}, + {0x2F9D7, 0, 1 | DECOMP_INLINE, 0x8D77}, + {0x2F9D8, 0, 1, 5079}, + {0x2F9D9, 0, 1, 5080}, + {0x2F9DA, 0, 1 | DECOMP_INLINE, 0x8DCB}, + {0x2F9DB, 0, 1 | DECOMP_INLINE, 0x8DBC}, + {0x2F9DC, 0, 1 | DECOMP_INLINE, 0x8DF0}, + {0x2F9DD, 0, 1, 5081}, + {0x2F9DE, 0, 1 | DECOMP_INLINE, 0x8ED4}, + {0x2F9DF, 0, 1 | DECOMP_INLINE, 0x8F38}, + {0x2F9E0, 0, 1, 5082}, + {0x2F9E1, 0, 1, 5083}, + {0x2F9E2, 0, 1 | DECOMP_INLINE, 0x9094}, + {0x2F9E3, 0, 1 | DECOMP_INLINE, 0x90F1}, + {0x2F9E4, 0, 1 | DECOMP_INLINE, 0x9111}, + {0x2F9E5, 0, 1, 5084}, + {0x2F9E6, 0, 1 | DECOMP_INLINE, 0x911B}, + {0x2F9E7, 0, 1 | DECOMP_INLINE, 0x9238}, + {0x2F9E8, 0, 1 | DECOMP_INLINE, 0x92D7}, + {0x2F9E9, 0, 1 | DECOMP_INLINE, 0x92D8}, + {0x2F9EA, 0, 1 | DECOMP_INLINE, 0x927C}, + {0x2F9EB, 0, 1 | DECOMP_INLINE, 0x93F9}, + {0x2F9EC, 0, 1 | DECOMP_INLINE, 0x9415}, + {0x2F9ED, 0, 1, 5085}, + {0x2F9EE, 0, 1 | DECOMP_INLINE, 0x958B}, + {0x2F9EF, 0, 1 | DECOMP_INLINE, 0x4995}, + {0x2F9F0, 0, 1 | DECOMP_INLINE, 0x95B7}, + {0x2F9F1, 0, 1, 5086}, + {0x2F9F2, 0, 1 | DECOMP_INLINE, 0x49E6}, + {0x2F9F3, 0, 1 | DECOMP_INLINE, 0x96C3}, + {0x2F9F4, 0, 1 | DECOMP_INLINE, 0x5DB2}, + {0x2F9F5, 0, 1 | DECOMP_INLINE, 0x9723}, + {0x2F9F6, 0, 1, 5087}, + {0x2F9F7, 0, 1, 5088}, + {0x2F9F8, 0, 1 | DECOMP_INLINE, 0x4A6E}, + {0x2F9F9, 0, 1 | DECOMP_INLINE, 0x4A76}, + {0x2F9FA, 0, 1 | DECOMP_INLINE, 0x97E0}, + {0x2F9FB, 0, 1, 5089}, + {0x2F9FC, 0, 1 | DECOMP_INLINE, 0x4AB2}, + {0x2F9FD, 0, 1, 5090}, + {0x2F9FE, 0, 1 | DECOMP_INLINE, 0x980B}, + {0x2F9FF, 0, 1 | DECOMP_INLINE, 0x980B}, + {0x2FA00, 0, 1 | DECOMP_INLINE, 0x9829}, + {0x2FA01, 0, 1, 5091}, + {0x2FA02, 0, 1 | DECOMP_INLINE, 0x98E2}, + {0x2FA03, 0, 1 | DECOMP_INLINE, 0x4B33}, + {0x2FA04, 0, 1 | DECOMP_INLINE, 0x9929}, + {0x2FA05, 0, 1 | DECOMP_INLINE, 0x99A7}, + {0x2FA06, 0, 1 | DECOMP_INLINE, 0x99C2}, + {0x2FA07, 0, 1 | DECOMP_INLINE, 0x99FE}, + {0x2FA08, 0, 1 | DECOMP_INLINE, 0x4BCE}, + {0x2FA09, 0, 1, 5092}, + {0x2FA0A, 0, 1 | DECOMP_INLINE, 0x9B12}, + {0x2FA0B, 0, 1 | DECOMP_INLINE, 0x9C40}, + {0x2FA0C, 0, 1 | DECOMP_INLINE, 0x9CFD}, + {0x2FA0D, 0, 1 | DECOMP_INLINE, 0x4CCE}, + {0x2FA0E, 0, 1 | DECOMP_INLINE, 0x4CED}, + {0x2FA0F, 0, 1 | DECOMP_INLINE, 0x9D67}, + {0x2FA10, 0, 1, 5093}, + {0x2FA11, 0, 1 | DECOMP_INLINE, 0x4CF8}, + {0x2FA12, 0, 1, 5094}, + {0x2FA13, 0, 1, 5095}, + {0x2FA14, 0, 1, 5096}, + {0x2FA15, 0, 1 | DECOMP_INLINE, 0x9EBB}, + {0x2FA16, 0, 1 | DECOMP_INLINE, 0x4D56}, + {0x2FA17, 0, 1 | DECOMP_INLINE, 0x9EF9}, + {0x2FA18, 0, 1 | DECOMP_INLINE, 0x9EFE}, + {0x2FA19, 0, 1 | DECOMP_INLINE, 0x9F05}, + {0x2FA1A, 0, 1 | DECOMP_INLINE, 0x9F0F}, + {0x2FA1B, 0, 1 | DECOMP_INLINE, 0x9F16}, + {0x2FA1C, 0, 1 | DECOMP_INLINE, 0x9F3B}, + {0x2FA1D, 0, 1, 5097} + +}; + +/* codepoints array */ +static const uint32 UnicodeDecomp_codepoints[5098] = +{ + /* 0 */ 0x0020, 0x0308, + /* 2 */ 0x0020, 0x0304, + /* 4 */ 0x0020, 0x0301, + /* 6 */ 0x0020, 0x0327, + /* 8 */ 0x0031, 0x2044, 0x0034, + /* 11 */ 0x0031, 0x2044, 0x0032, + /* 14 */ 0x0033, 0x2044, 0x0034, + /* 17 */ 0x0041, 0x0300, + /* 19 */ 0x0041, 0x0301, + /* 21 */ 0x0041, 0x0302, + /* 23 */ 0x0041, 0x0303, + /* 25 */ 0x0041, 0x0308, + /* 27 */ 0x0041, 0x030A, + /* 29 */ 0x0043, 0x0327, + /* 31 */ 0x0045, 0x0300, + /* 33 */ 0x0045, 0x0301, + /* 35 */ 0x0045, 0x0302, + /* 37 */ 0x0045, 0x0308, + /* 39 */ 0x0049, 0x0300, + /* 41 */ 0x0049, 0x0301, + /* 43 */ 0x0049, 0x0302, + /* 45 */ 0x0049, 0x0308, + /* 47 */ 0x004E, 0x0303, + /* 49 */ 0x004F, 0x0300, + /* 51 */ 0x004F, 0x0301, + /* 53 */ 0x004F, 0x0302, + /* 55 */ 0x004F, 0x0303, + /* 57 */ 0x004F, 0x0308, + /* 59 */ 0x0055, 0x0300, + /* 61 */ 0x0055, 0x0301, + /* 63 */ 0x0055, 0x0302, + /* 65 */ 0x0055, 0x0308, + /* 67 */ 0x0059, 0x0301, + /* 69 */ 0x0061, 0x0300, + /* 71 */ 0x0061, 0x0301, + /* 73 */ 0x0061, 0x0302, + /* 75 */ 0x0061, 0x0303, + /* 77 */ 0x0061, 0x0308, + /* 79 */ 0x0061, 0x030A, + /* 81 */ 0x0063, 0x0327, + /* 83 */ 0x0065, 0x0300, + /* 85 */ 0x0065, 0x0301, + /* 87 */ 0x0065, 0x0302, + /* 89 */ 0x0065, 0x0308, + /* 91 */ 0x0069, 0x0300, + /* 93 */ 0x0069, 0x0301, + /* 95 */ 0x0069, 0x0302, + /* 97 */ 0x0069, 0x0308, + /* 99 */ 0x006E, 0x0303, + /* 101 */ 0x006F, 0x0300, + /* 103 */ 0x006F, 0x0301, + /* 105 */ 0x006F, 0x0302, + /* 107 */ 0x006F, 0x0303, + /* 109 */ 0x006F, 0x0308, + /* 111 */ 0x0075, 0x0300, + /* 113 */ 0x0075, 0x0301, + /* 115 */ 0x0075, 0x0302, + /* 117 */ 0x0075, 0x0308, + /* 119 */ 0x0079, 0x0301, + /* 121 */ 0x0079, 0x0308, + /* 123 */ 0x0041, 0x0304, + /* 125 */ 0x0061, 0x0304, + /* 127 */ 0x0041, 0x0306, + /* 129 */ 0x0061, 0x0306, + /* 131 */ 0x0041, 0x0328, + /* 133 */ 0x0061, 0x0328, + /* 135 */ 0x0043, 0x0301, + /* 137 */ 0x0063, 0x0301, + /* 139 */ 0x0043, 0x0302, + /* 141 */ 0x0063, 0x0302, + /* 143 */ 0x0043, 0x0307, + /* 145 */ 0x0063, 0x0307, + /* 147 */ 0x0043, 0x030C, + /* 149 */ 0x0063, 0x030C, + /* 151 */ 0x0044, 0x030C, + /* 153 */ 0x0064, 0x030C, + /* 155 */ 0x0045, 0x0304, + /* 157 */ 0x0065, 0x0304, + /* 159 */ 0x0045, 0x0306, + /* 161 */ 0x0065, 0x0306, + /* 163 */ 0x0045, 0x0307, + /* 165 */ 0x0065, 0x0307, + /* 167 */ 0x0045, 0x0328, + /* 169 */ 0x0065, 0x0328, + /* 171 */ 0x0045, 0x030C, + /* 173 */ 0x0065, 0x030C, + /* 175 */ 0x0047, 0x0302, + /* 177 */ 0x0067, 0x0302, + /* 179 */ 0x0047, 0x0306, + /* 181 */ 0x0067, 0x0306, + /* 183 */ 0x0047, 0x0307, + /* 185 */ 0x0067, 0x0307, + /* 187 */ 0x0047, 0x0327, + /* 189 */ 0x0067, 0x0327, + /* 191 */ 0x0048, 0x0302, + /* 193 */ 0x0068, 0x0302, + /* 195 */ 0x0049, 0x0303, + /* 197 */ 0x0069, 0x0303, + /* 199 */ 0x0049, 0x0304, + /* 201 */ 0x0069, 0x0304, + /* 203 */ 0x0049, 0x0306, + /* 205 */ 0x0069, 0x0306, + /* 207 */ 0x0049, 0x0328, + /* 209 */ 0x0069, 0x0328, + /* 211 */ 0x0049, 0x0307, + /* 213 */ 0x0049, 0x004A, + /* 215 */ 0x0069, 0x006A, + /* 217 */ 0x004A, 0x0302, + /* 219 */ 0x006A, 0x0302, + /* 221 */ 0x004B, 0x0327, + /* 223 */ 0x006B, 0x0327, + /* 225 */ 0x004C, 0x0301, + /* 227 */ 0x006C, 0x0301, + /* 229 */ 0x004C, 0x0327, + /* 231 */ 0x006C, 0x0327, + /* 233 */ 0x004C, 0x030C, + /* 235 */ 0x006C, 0x030C, + /* 237 */ 0x004C, 0x00B7, + /* 239 */ 0x006C, 0x00B7, + /* 241 */ 0x004E, 0x0301, + /* 243 */ 0x006E, 0x0301, + /* 245 */ 0x004E, 0x0327, + /* 247 */ 0x006E, 0x0327, + /* 249 */ 0x004E, 0x030C, + /* 251 */ 0x006E, 0x030C, + /* 253 */ 0x02BC, 0x006E, + /* 255 */ 0x004F, 0x0304, + /* 257 */ 0x006F, 0x0304, + /* 259 */ 0x004F, 0x0306, + /* 261 */ 0x006F, 0x0306, + /* 263 */ 0x004F, 0x030B, + /* 265 */ 0x006F, 0x030B, + /* 267 */ 0x0052, 0x0301, + /* 269 */ 0x0072, 0x0301, + /* 271 */ 0x0052, 0x0327, + /* 273 */ 0x0072, 0x0327, + /* 275 */ 0x0052, 0x030C, + /* 277 */ 0x0072, 0x030C, + /* 279 */ 0x0053, 0x0301, + /* 281 */ 0x0073, 0x0301, + /* 283 */ 0x0053, 0x0302, + /* 285 */ 0x0073, 0x0302, + /* 287 */ 0x0053, 0x0327, + /* 289 */ 0x0073, 0x0327, + /* 291 */ 0x0053, 0x030C, + /* 293 */ 0x0073, 0x030C, + /* 295 */ 0x0054, 0x0327, + /* 297 */ 0x0074, 0x0327, + /* 299 */ 0x0054, 0x030C, + /* 301 */ 0x0074, 0x030C, + /* 303 */ 0x0055, 0x0303, + /* 305 */ 0x0075, 0x0303, + /* 307 */ 0x0055, 0x0304, + /* 309 */ 0x0075, 0x0304, + /* 311 */ 0x0055, 0x0306, + /* 313 */ 0x0075, 0x0306, + /* 315 */ 0x0055, 0x030A, + /* 317 */ 0x0075, 0x030A, + /* 319 */ 0x0055, 0x030B, + /* 321 */ 0x0075, 0x030B, + /* 323 */ 0x0055, 0x0328, + /* 325 */ 0x0075, 0x0328, + /* 327 */ 0x0057, 0x0302, + /* 329 */ 0x0077, 0x0302, + /* 331 */ 0x0059, 0x0302, + /* 333 */ 0x0079, 0x0302, + /* 335 */ 0x0059, 0x0308, + /* 337 */ 0x005A, 0x0301, + /* 339 */ 0x007A, 0x0301, + /* 341 */ 0x005A, 0x0307, + /* 343 */ 0x007A, 0x0307, + /* 345 */ 0x005A, 0x030C, + /* 347 */ 0x007A, 0x030C, + /* 349 */ 0x004F, 0x031B, + /* 351 */ 0x006F, 0x031B, + /* 353 */ 0x0055, 0x031B, + /* 355 */ 0x0075, 0x031B, + /* 357 */ 0x0044, 0x017D, + /* 359 */ 0x0044, 0x017E, + /* 361 */ 0x0064, 0x017E, + /* 363 */ 0x004C, 0x004A, + /* 365 */ 0x004C, 0x006A, + /* 367 */ 0x006C, 0x006A, + /* 369 */ 0x004E, 0x004A, + /* 371 */ 0x004E, 0x006A, + /* 373 */ 0x006E, 0x006A, + /* 375 */ 0x0041, 0x030C, + /* 377 */ 0x0061, 0x030C, + /* 379 */ 0x0049, 0x030C, + /* 381 */ 0x0069, 0x030C, + /* 383 */ 0x004F, 0x030C, + /* 385 */ 0x006F, 0x030C, + /* 387 */ 0x0055, 0x030C, + /* 389 */ 0x0075, 0x030C, + /* 391 */ 0x00DC, 0x0304, + /* 393 */ 0x00FC, 0x0304, + /* 395 */ 0x00DC, 0x0301, + /* 397 */ 0x00FC, 0x0301, + /* 399 */ 0x00DC, 0x030C, + /* 401 */ 0x00FC, 0x030C, + /* 403 */ 0x00DC, 0x0300, + /* 405 */ 0x00FC, 0x0300, + /* 407 */ 0x00C4, 0x0304, + /* 409 */ 0x00E4, 0x0304, + /* 411 */ 0x0226, 0x0304, + /* 413 */ 0x0227, 0x0304, + /* 415 */ 0x00C6, 0x0304, + /* 417 */ 0x00E6, 0x0304, + /* 419 */ 0x0047, 0x030C, + /* 421 */ 0x0067, 0x030C, + /* 423 */ 0x004B, 0x030C, + /* 425 */ 0x006B, 0x030C, + /* 427 */ 0x004F, 0x0328, + /* 429 */ 0x006F, 0x0328, + /* 431 */ 0x01EA, 0x0304, + /* 433 */ 0x01EB, 0x0304, + /* 435 */ 0x01B7, 0x030C, + /* 437 */ 0x0292, 0x030C, + /* 439 */ 0x006A, 0x030C, + /* 441 */ 0x0044, 0x005A, + /* 443 */ 0x0044, 0x007A, + /* 445 */ 0x0064, 0x007A, + /* 447 */ 0x0047, 0x0301, + /* 449 */ 0x0067, 0x0301, + /* 451 */ 0x004E, 0x0300, + /* 453 */ 0x006E, 0x0300, + /* 455 */ 0x00C5, 0x0301, + /* 457 */ 0x00E5, 0x0301, + /* 459 */ 0x00C6, 0x0301, + /* 461 */ 0x00E6, 0x0301, + /* 463 */ 0x00D8, 0x0301, + /* 465 */ 0x00F8, 0x0301, + /* 467 */ 0x0041, 0x030F, + /* 469 */ 0x0061, 0x030F, + /* 471 */ 0x0041, 0x0311, + /* 473 */ 0x0061, 0x0311, + /* 475 */ 0x0045, 0x030F, + /* 477 */ 0x0065, 0x030F, + /* 479 */ 0x0045, 0x0311, + /* 481 */ 0x0065, 0x0311, + /* 483 */ 0x0049, 0x030F, + /* 485 */ 0x0069, 0x030F, + /* 487 */ 0x0049, 0x0311, + /* 489 */ 0x0069, 0x0311, + /* 491 */ 0x004F, 0x030F, + /* 493 */ 0x006F, 0x030F, + /* 495 */ 0x004F, 0x0311, + /* 497 */ 0x006F, 0x0311, + /* 499 */ 0x0052, 0x030F, + /* 501 */ 0x0072, 0x030F, + /* 503 */ 0x0052, 0x0311, + /* 505 */ 0x0072, 0x0311, + /* 507 */ 0x0055, 0x030F, + /* 509 */ 0x0075, 0x030F, + /* 511 */ 0x0055, 0x0311, + /* 513 */ 0x0075, 0x0311, + /* 515 */ 0x0053, 0x0326, + /* 517 */ 0x0073, 0x0326, + /* 519 */ 0x0054, 0x0326, + /* 521 */ 0x0074, 0x0326, + /* 523 */ 0x0048, 0x030C, + /* 525 */ 0x0068, 0x030C, + /* 527 */ 0x0041, 0x0307, + /* 529 */ 0x0061, 0x0307, + /* 531 */ 0x0045, 0x0327, + /* 533 */ 0x0065, 0x0327, + /* 535 */ 0x00D6, 0x0304, + /* 537 */ 0x00F6, 0x0304, + /* 539 */ 0x00D5, 0x0304, + /* 541 */ 0x00F5, 0x0304, + /* 543 */ 0x004F, 0x0307, + /* 545 */ 0x006F, 0x0307, + /* 547 */ 0x022E, 0x0304, + /* 549 */ 0x022F, 0x0304, + /* 551 */ 0x0059, 0x0304, + /* 553 */ 0x0079, 0x0304, + /* 555 */ 0x0020, 0x0306, + /* 557 */ 0x0020, 0x0307, + /* 559 */ 0x0020, 0x030A, + /* 561 */ 0x0020, 0x0328, + /* 563 */ 0x0020, 0x0303, + /* 565 */ 0x0020, 0x030B, + /* 567 */ 0x0308, 0x0301, + /* 569 */ 0x0020, 0x0345, + /* 571 */ 0x0020, 0x0301, + /* 573 */ 0x00A8, 0x0301, + /* 575 */ 0x0391, 0x0301, + /* 577 */ 0x0395, 0x0301, + /* 579 */ 0x0397, 0x0301, + /* 581 */ 0x0399, 0x0301, + /* 583 */ 0x039F, 0x0301, + /* 585 */ 0x03A5, 0x0301, + /* 587 */ 0x03A9, 0x0301, + /* 589 */ 0x03CA, 0x0301, + /* 591 */ 0x0399, 0x0308, + /* 593 */ 0x03A5, 0x0308, + /* 595 */ 0x03B1, 0x0301, + /* 597 */ 0x03B5, 0x0301, + /* 599 */ 0x03B7, 0x0301, + /* 601 */ 0x03B9, 0x0301, + /* 603 */ 0x03CB, 0x0301, + /* 605 */ 0x03B9, 0x0308, + /* 607 */ 0x03C5, 0x0308, + /* 609 */ 0x03BF, 0x0301, + /* 611 */ 0x03C5, 0x0301, + /* 613 */ 0x03C9, 0x0301, + /* 615 */ 0x03D2, 0x0301, + /* 617 */ 0x03D2, 0x0308, + /* 619 */ 0x0415, 0x0300, + /* 621 */ 0x0415, 0x0308, + /* 623 */ 0x0413, 0x0301, + /* 625 */ 0x0406, 0x0308, + /* 627 */ 0x041A, 0x0301, + /* 629 */ 0x0418, 0x0300, + /* 631 */ 0x0423, 0x0306, + /* 633 */ 0x0418, 0x0306, + /* 635 */ 0x0438, 0x0306, + /* 637 */ 0x0435, 0x0300, + /* 639 */ 0x0435, 0x0308, + /* 641 */ 0x0433, 0x0301, + /* 643 */ 0x0456, 0x0308, + /* 645 */ 0x043A, 0x0301, + /* 647 */ 0x0438, 0x0300, + /* 649 */ 0x0443, 0x0306, + /* 651 */ 0x0474, 0x030F, + /* 653 */ 0x0475, 0x030F, + /* 655 */ 0x0416, 0x0306, + /* 657 */ 0x0436, 0x0306, + /* 659 */ 0x0410, 0x0306, + /* 661 */ 0x0430, 0x0306, + /* 663 */ 0x0410, 0x0308, + /* 665 */ 0x0430, 0x0308, + /* 667 */ 0x0415, 0x0306, + /* 669 */ 0x0435, 0x0306, + /* 671 */ 0x04D8, 0x0308, + /* 673 */ 0x04D9, 0x0308, + /* 675 */ 0x0416, 0x0308, + /* 677 */ 0x0436, 0x0308, + /* 679 */ 0x0417, 0x0308, + /* 681 */ 0x0437, 0x0308, + /* 683 */ 0x0418, 0x0304, + /* 685 */ 0x0438, 0x0304, + /* 687 */ 0x0418, 0x0308, + /* 689 */ 0x0438, 0x0308, + /* 691 */ 0x041E, 0x0308, + /* 693 */ 0x043E, 0x0308, + /* 695 */ 0x04E8, 0x0308, + /* 697 */ 0x04E9, 0x0308, + /* 699 */ 0x042D, 0x0308, + /* 701 */ 0x044D, 0x0308, + /* 703 */ 0x0423, 0x0304, + /* 705 */ 0x0443, 0x0304, + /* 707 */ 0x0423, 0x0308, + /* 709 */ 0x0443, 0x0308, + /* 711 */ 0x0423, 0x030B, + /* 713 */ 0x0443, 0x030B, + /* 715 */ 0x0427, 0x0308, + /* 717 */ 0x0447, 0x0308, + /* 719 */ 0x042B, 0x0308, + /* 721 */ 0x044B, 0x0308, + /* 723 */ 0x0565, 0x0582, + /* 725 */ 0x0627, 0x0653, + /* 727 */ 0x0627, 0x0654, + /* 729 */ 0x0648, 0x0654, + /* 731 */ 0x0627, 0x0655, + /* 733 */ 0x064A, 0x0654, + /* 735 */ 0x0627, 0x0674, + /* 737 */ 0x0648, 0x0674, + /* 739 */ 0x06C7, 0x0674, + /* 741 */ 0x064A, 0x0674, + /* 743 */ 0x06D5, 0x0654, + /* 745 */ 0x06C1, 0x0654, + /* 747 */ 0x06D2, 0x0654, + /* 749 */ 0x0928, 0x093C, + /* 751 */ 0x0930, 0x093C, + /* 753 */ 0x0933, 0x093C, + /* 755 */ 0x0915, 0x093C, + /* 757 */ 0x0916, 0x093C, + /* 759 */ 0x0917, 0x093C, + /* 761 */ 0x091C, 0x093C, + /* 763 */ 0x0921, 0x093C, + /* 765 */ 0x0922, 0x093C, + /* 767 */ 0x092B, 0x093C, + /* 769 */ 0x092F, 0x093C, + /* 771 */ 0x09C7, 0x09BE, + /* 773 */ 0x09C7, 0x09D7, + /* 775 */ 0x09A1, 0x09BC, + /* 777 */ 0x09A2, 0x09BC, + /* 779 */ 0x09AF, 0x09BC, + /* 781 */ 0x0A32, 0x0A3C, + /* 783 */ 0x0A38, 0x0A3C, + /* 785 */ 0x0A16, 0x0A3C, + /* 787 */ 0x0A17, 0x0A3C, + /* 789 */ 0x0A1C, 0x0A3C, + /* 791 */ 0x0A2B, 0x0A3C, + /* 793 */ 0x0B47, 0x0B56, + /* 795 */ 0x0B47, 0x0B3E, + /* 797 */ 0x0B47, 0x0B57, + /* 799 */ 0x0B21, 0x0B3C, + /* 801 */ 0x0B22, 0x0B3C, + /* 803 */ 0x0B92, 0x0BD7, + /* 805 */ 0x0BC6, 0x0BBE, + /* 807 */ 0x0BC7, 0x0BBE, + /* 809 */ 0x0BC6, 0x0BD7, + /* 811 */ 0x0C46, 0x0C56, + /* 813 */ 0x0CBF, 0x0CD5, + /* 815 */ 0x0CC6, 0x0CD5, + /* 817 */ 0x0CC6, 0x0CD6, + /* 819 */ 0x0CC6, 0x0CC2, + /* 821 */ 0x0CCA, 0x0CD5, + /* 823 */ 0x0D46, 0x0D3E, + /* 825 */ 0x0D47, 0x0D3E, + /* 827 */ 0x0D46, 0x0D57, + /* 829 */ 0x0DD9, 0x0DCA, + /* 831 */ 0x0DD9, 0x0DCF, + /* 833 */ 0x0DDC, 0x0DCA, + /* 835 */ 0x0DD9, 0x0DDF, + /* 837 */ 0x0E4D, 0x0E32, + /* 839 */ 0x0ECD, 0x0EB2, + /* 841 */ 0x0EAB, 0x0E99, + /* 843 */ 0x0EAB, 0x0EA1, + /* 845 */ 0x0F42, 0x0FB7, + /* 847 */ 0x0F4C, 0x0FB7, + /* 849 */ 0x0F51, 0x0FB7, + /* 851 */ 0x0F56, 0x0FB7, + /* 853 */ 0x0F5B, 0x0FB7, + /* 855 */ 0x0F40, 0x0FB5, + /* 857 */ 0x0F71, 0x0F72, + /* 859 */ 0x0F71, 0x0F74, + /* 861 */ 0x0FB2, 0x0F80, + /* 863 */ 0x0FB2, 0x0F81, + /* 865 */ 0x0FB3, 0x0F80, + /* 867 */ 0x0FB3, 0x0F81, + /* 869 */ 0x0F71, 0x0F80, + /* 871 */ 0x0F92, 0x0FB7, + /* 873 */ 0x0F9C, 0x0FB7, + /* 875 */ 0x0FA1, 0x0FB7, + /* 877 */ 0x0FA6, 0x0FB7, + /* 879 */ 0x0FAB, 0x0FB7, + /* 881 */ 0x0F90, 0x0FB5, + /* 883 */ 0x1025, 0x102E, + /* 885 */ 0x1B05, 0x1B35, + /* 887 */ 0x1B07, 0x1B35, + /* 889 */ 0x1B09, 0x1B35, + /* 891 */ 0x1B0B, 0x1B35, + /* 893 */ 0x1B0D, 0x1B35, + /* 895 */ 0x1B11, 0x1B35, + /* 897 */ 0x1B3A, 0x1B35, + /* 899 */ 0x1B3C, 0x1B35, + /* 901 */ 0x1B3E, 0x1B35, + /* 903 */ 0x1B3F, 0x1B35, + /* 905 */ 0x1B42, 0x1B35, + /* 907 */ 0x0041, 0x0325, + /* 909 */ 0x0061, 0x0325, + /* 911 */ 0x0042, 0x0307, + /* 913 */ 0x0062, 0x0307, + /* 915 */ 0x0042, 0x0323, + /* 917 */ 0x0062, 0x0323, + /* 919 */ 0x0042, 0x0331, + /* 921 */ 0x0062, 0x0331, + /* 923 */ 0x00C7, 0x0301, + /* 925 */ 0x00E7, 0x0301, + /* 927 */ 0x0044, 0x0307, + /* 929 */ 0x0064, 0x0307, + /* 931 */ 0x0044, 0x0323, + /* 933 */ 0x0064, 0x0323, + /* 935 */ 0x0044, 0x0331, + /* 937 */ 0x0064, 0x0331, + /* 939 */ 0x0044, 0x0327, + /* 941 */ 0x0064, 0x0327, + /* 943 */ 0x0044, 0x032D, + /* 945 */ 0x0064, 0x032D, + /* 947 */ 0x0112, 0x0300, + /* 949 */ 0x0113, 0x0300, + /* 951 */ 0x0112, 0x0301, + /* 953 */ 0x0113, 0x0301, + /* 955 */ 0x0045, 0x032D, + /* 957 */ 0x0065, 0x032D, + /* 959 */ 0x0045, 0x0330, + /* 961 */ 0x0065, 0x0330, + /* 963 */ 0x0228, 0x0306, + /* 965 */ 0x0229, 0x0306, + /* 967 */ 0x0046, 0x0307, + /* 969 */ 0x0066, 0x0307, + /* 971 */ 0x0047, 0x0304, + /* 973 */ 0x0067, 0x0304, + /* 975 */ 0x0048, 0x0307, + /* 977 */ 0x0068, 0x0307, + /* 979 */ 0x0048, 0x0323, + /* 981 */ 0x0068, 0x0323, + /* 983 */ 0x0048, 0x0308, + /* 985 */ 0x0068, 0x0308, + /* 987 */ 0x0048, 0x0327, + /* 989 */ 0x0068, 0x0327, + /* 991 */ 0x0048, 0x032E, + /* 993 */ 0x0068, 0x032E, + /* 995 */ 0x0049, 0x0330, + /* 997 */ 0x0069, 0x0330, + /* 999 */ 0x00CF, 0x0301, + /* 1001 */ 0x00EF, 0x0301, + /* 1003 */ 0x004B, 0x0301, + /* 1005 */ 0x006B, 0x0301, + /* 1007 */ 0x004B, 0x0323, + /* 1009 */ 0x006B, 0x0323, + /* 1011 */ 0x004B, 0x0331, + /* 1013 */ 0x006B, 0x0331, + /* 1015 */ 0x004C, 0x0323, + /* 1017 */ 0x006C, 0x0323, + /* 1019 */ 0x1E36, 0x0304, + /* 1021 */ 0x1E37, 0x0304, + /* 1023 */ 0x004C, 0x0331, + /* 1025 */ 0x006C, 0x0331, + /* 1027 */ 0x004C, 0x032D, + /* 1029 */ 0x006C, 0x032D, + /* 1031 */ 0x004D, 0x0301, + /* 1033 */ 0x006D, 0x0301, + /* 1035 */ 0x004D, 0x0307, + /* 1037 */ 0x006D, 0x0307, + /* 1039 */ 0x004D, 0x0323, + /* 1041 */ 0x006D, 0x0323, + /* 1043 */ 0x004E, 0x0307, + /* 1045 */ 0x006E, 0x0307, + /* 1047 */ 0x004E, 0x0323, + /* 1049 */ 0x006E, 0x0323, + /* 1051 */ 0x004E, 0x0331, + /* 1053 */ 0x006E, 0x0331, + /* 1055 */ 0x004E, 0x032D, + /* 1057 */ 0x006E, 0x032D, + /* 1059 */ 0x00D5, 0x0301, + /* 1061 */ 0x00F5, 0x0301, + /* 1063 */ 0x00D5, 0x0308, + /* 1065 */ 0x00F5, 0x0308, + /* 1067 */ 0x014C, 0x0300, + /* 1069 */ 0x014D, 0x0300, + /* 1071 */ 0x014C, 0x0301, + /* 1073 */ 0x014D, 0x0301, + /* 1075 */ 0x0050, 0x0301, + /* 1077 */ 0x0070, 0x0301, + /* 1079 */ 0x0050, 0x0307, + /* 1081 */ 0x0070, 0x0307, + /* 1083 */ 0x0052, 0x0307, + /* 1085 */ 0x0072, 0x0307, + /* 1087 */ 0x0052, 0x0323, + /* 1089 */ 0x0072, 0x0323, + /* 1091 */ 0x1E5A, 0x0304, + /* 1093 */ 0x1E5B, 0x0304, + /* 1095 */ 0x0052, 0x0331, + /* 1097 */ 0x0072, 0x0331, + /* 1099 */ 0x0053, 0x0307, + /* 1101 */ 0x0073, 0x0307, + /* 1103 */ 0x0053, 0x0323, + /* 1105 */ 0x0073, 0x0323, + /* 1107 */ 0x015A, 0x0307, + /* 1109 */ 0x015B, 0x0307, + /* 1111 */ 0x0160, 0x0307, + /* 1113 */ 0x0161, 0x0307, + /* 1115 */ 0x1E62, 0x0307, + /* 1117 */ 0x1E63, 0x0307, + /* 1119 */ 0x0054, 0x0307, + /* 1121 */ 0x0074, 0x0307, + /* 1123 */ 0x0054, 0x0323, + /* 1125 */ 0x0074, 0x0323, + /* 1127 */ 0x0054, 0x0331, + /* 1129 */ 0x0074, 0x0331, + /* 1131 */ 0x0054, 0x032D, + /* 1133 */ 0x0074, 0x032D, + /* 1135 */ 0x0055, 0x0324, + /* 1137 */ 0x0075, 0x0324, + /* 1139 */ 0x0055, 0x0330, + /* 1141 */ 0x0075, 0x0330, + /* 1143 */ 0x0055, 0x032D, + /* 1145 */ 0x0075, 0x032D, + /* 1147 */ 0x0168, 0x0301, + /* 1149 */ 0x0169, 0x0301, + /* 1151 */ 0x016A, 0x0308, + /* 1153 */ 0x016B, 0x0308, + /* 1155 */ 0x0056, 0x0303, + /* 1157 */ 0x0076, 0x0303, + /* 1159 */ 0x0056, 0x0323, + /* 1161 */ 0x0076, 0x0323, + /* 1163 */ 0x0057, 0x0300, + /* 1165 */ 0x0077, 0x0300, + /* 1167 */ 0x0057, 0x0301, + /* 1169 */ 0x0077, 0x0301, + /* 1171 */ 0x0057, 0x0308, + /* 1173 */ 0x0077, 0x0308, + /* 1175 */ 0x0057, 0x0307, + /* 1177 */ 0x0077, 0x0307, + /* 1179 */ 0x0057, 0x0323, + /* 1181 */ 0x0077, 0x0323, + /* 1183 */ 0x0058, 0x0307, + /* 1185 */ 0x0078, 0x0307, + /* 1187 */ 0x0058, 0x0308, + /* 1189 */ 0x0078, 0x0308, + /* 1191 */ 0x0059, 0x0307, + /* 1193 */ 0x0079, 0x0307, + /* 1195 */ 0x005A, 0x0302, + /* 1197 */ 0x007A, 0x0302, + /* 1199 */ 0x005A, 0x0323, + /* 1201 */ 0x007A, 0x0323, + /* 1203 */ 0x005A, 0x0331, + /* 1205 */ 0x007A, 0x0331, + /* 1207 */ 0x0068, 0x0331, + /* 1209 */ 0x0074, 0x0308, + /* 1211 */ 0x0077, 0x030A, + /* 1213 */ 0x0079, 0x030A, + /* 1215 */ 0x0061, 0x02BE, + /* 1217 */ 0x017F, 0x0307, + /* 1219 */ 0x0041, 0x0323, + /* 1221 */ 0x0061, 0x0323, + /* 1223 */ 0x0041, 0x0309, + /* 1225 */ 0x0061, 0x0309, + /* 1227 */ 0x00C2, 0x0301, + /* 1229 */ 0x00E2, 0x0301, + /* 1231 */ 0x00C2, 0x0300, + /* 1233 */ 0x00E2, 0x0300, + /* 1235 */ 0x00C2, 0x0309, + /* 1237 */ 0x00E2, 0x0309, + /* 1239 */ 0x00C2, 0x0303, + /* 1241 */ 0x00E2, 0x0303, + /* 1243 */ 0x1EA0, 0x0302, + /* 1245 */ 0x1EA1, 0x0302, + /* 1247 */ 0x0102, 0x0301, + /* 1249 */ 0x0103, 0x0301, + /* 1251 */ 0x0102, 0x0300, + /* 1253 */ 0x0103, 0x0300, + /* 1255 */ 0x0102, 0x0309, + /* 1257 */ 0x0103, 0x0309, + /* 1259 */ 0x0102, 0x0303, + /* 1261 */ 0x0103, 0x0303, + /* 1263 */ 0x1EA0, 0x0306, + /* 1265 */ 0x1EA1, 0x0306, + /* 1267 */ 0x0045, 0x0323, + /* 1269 */ 0x0065, 0x0323, + /* 1271 */ 0x0045, 0x0309, + /* 1273 */ 0x0065, 0x0309, + /* 1275 */ 0x0045, 0x0303, + /* 1277 */ 0x0065, 0x0303, + /* 1279 */ 0x00CA, 0x0301, + /* 1281 */ 0x00EA, 0x0301, + /* 1283 */ 0x00CA, 0x0300, + /* 1285 */ 0x00EA, 0x0300, + /* 1287 */ 0x00CA, 0x0309, + /* 1289 */ 0x00EA, 0x0309, + /* 1291 */ 0x00CA, 0x0303, + /* 1293 */ 0x00EA, 0x0303, + /* 1295 */ 0x1EB8, 0x0302, + /* 1297 */ 0x1EB9, 0x0302, + /* 1299 */ 0x0049, 0x0309, + /* 1301 */ 0x0069, 0x0309, + /* 1303 */ 0x0049, 0x0323, + /* 1305 */ 0x0069, 0x0323, + /* 1307 */ 0x004F, 0x0323, + /* 1309 */ 0x006F, 0x0323, + /* 1311 */ 0x004F, 0x0309, + /* 1313 */ 0x006F, 0x0309, + /* 1315 */ 0x00D4, 0x0301, + /* 1317 */ 0x00F4, 0x0301, + /* 1319 */ 0x00D4, 0x0300, + /* 1321 */ 0x00F4, 0x0300, + /* 1323 */ 0x00D4, 0x0309, + /* 1325 */ 0x00F4, 0x0309, + /* 1327 */ 0x00D4, 0x0303, + /* 1329 */ 0x00F4, 0x0303, + /* 1331 */ 0x1ECC, 0x0302, + /* 1333 */ 0x1ECD, 0x0302, + /* 1335 */ 0x01A0, 0x0301, + /* 1337 */ 0x01A1, 0x0301, + /* 1339 */ 0x01A0, 0x0300, + /* 1341 */ 0x01A1, 0x0300, + /* 1343 */ 0x01A0, 0x0309, + /* 1345 */ 0x01A1, 0x0309, + /* 1347 */ 0x01A0, 0x0303, + /* 1349 */ 0x01A1, 0x0303, + /* 1351 */ 0x01A0, 0x0323, + /* 1353 */ 0x01A1, 0x0323, + /* 1355 */ 0x0055, 0x0323, + /* 1357 */ 0x0075, 0x0323, + /* 1359 */ 0x0055, 0x0309, + /* 1361 */ 0x0075, 0x0309, + /* 1363 */ 0x01AF, 0x0301, + /* 1365 */ 0x01B0, 0x0301, + /* 1367 */ 0x01AF, 0x0300, + /* 1369 */ 0x01B0, 0x0300, + /* 1371 */ 0x01AF, 0x0309, + /* 1373 */ 0x01B0, 0x0309, + /* 1375 */ 0x01AF, 0x0303, + /* 1377 */ 0x01B0, 0x0303, + /* 1379 */ 0x01AF, 0x0323, + /* 1381 */ 0x01B0, 0x0323, + /* 1383 */ 0x0059, 0x0300, + /* 1385 */ 0x0079, 0x0300, + /* 1387 */ 0x0059, 0x0323, + /* 1389 */ 0x0079, 0x0323, + /* 1391 */ 0x0059, 0x0309, + /* 1393 */ 0x0079, 0x0309, + /* 1395 */ 0x0059, 0x0303, + /* 1397 */ 0x0079, 0x0303, + /* 1399 */ 0x03B1, 0x0313, + /* 1401 */ 0x03B1, 0x0314, + /* 1403 */ 0x1F00, 0x0300, + /* 1405 */ 0x1F01, 0x0300, + /* 1407 */ 0x1F00, 0x0301, + /* 1409 */ 0x1F01, 0x0301, + /* 1411 */ 0x1F00, 0x0342, + /* 1413 */ 0x1F01, 0x0342, + /* 1415 */ 0x0391, 0x0313, + /* 1417 */ 0x0391, 0x0314, + /* 1419 */ 0x1F08, 0x0300, + /* 1421 */ 0x1F09, 0x0300, + /* 1423 */ 0x1F08, 0x0301, + /* 1425 */ 0x1F09, 0x0301, + /* 1427 */ 0x1F08, 0x0342, + /* 1429 */ 0x1F09, 0x0342, + /* 1431 */ 0x03B5, 0x0313, + /* 1433 */ 0x03B5, 0x0314, + /* 1435 */ 0x1F10, 0x0300, + /* 1437 */ 0x1F11, 0x0300, + /* 1439 */ 0x1F10, 0x0301, + /* 1441 */ 0x1F11, 0x0301, + /* 1443 */ 0x0395, 0x0313, + /* 1445 */ 0x0395, 0x0314, + /* 1447 */ 0x1F18, 0x0300, + /* 1449 */ 0x1F19, 0x0300, + /* 1451 */ 0x1F18, 0x0301, + /* 1453 */ 0x1F19, 0x0301, + /* 1455 */ 0x03B7, 0x0313, + /* 1457 */ 0x03B7, 0x0314, + /* 1459 */ 0x1F20, 0x0300, + /* 1461 */ 0x1F21, 0x0300, + /* 1463 */ 0x1F20, 0x0301, + /* 1465 */ 0x1F21, 0x0301, + /* 1467 */ 0x1F20, 0x0342, + /* 1469 */ 0x1F21, 0x0342, + /* 1471 */ 0x0397, 0x0313, + /* 1473 */ 0x0397, 0x0314, + /* 1475 */ 0x1F28, 0x0300, + /* 1477 */ 0x1F29, 0x0300, + /* 1479 */ 0x1F28, 0x0301, + /* 1481 */ 0x1F29, 0x0301, + /* 1483 */ 0x1F28, 0x0342, + /* 1485 */ 0x1F29, 0x0342, + /* 1487 */ 0x03B9, 0x0313, + /* 1489 */ 0x03B9, 0x0314, + /* 1491 */ 0x1F30, 0x0300, + /* 1493 */ 0x1F31, 0x0300, + /* 1495 */ 0x1F30, 0x0301, + /* 1497 */ 0x1F31, 0x0301, + /* 1499 */ 0x1F30, 0x0342, + /* 1501 */ 0x1F31, 0x0342, + /* 1503 */ 0x0399, 0x0313, + /* 1505 */ 0x0399, 0x0314, + /* 1507 */ 0x1F38, 0x0300, + /* 1509 */ 0x1F39, 0x0300, + /* 1511 */ 0x1F38, 0x0301, + /* 1513 */ 0x1F39, 0x0301, + /* 1515 */ 0x1F38, 0x0342, + /* 1517 */ 0x1F39, 0x0342, + /* 1519 */ 0x03BF, 0x0313, + /* 1521 */ 0x03BF, 0x0314, + /* 1523 */ 0x1F40, 0x0300, + /* 1525 */ 0x1F41, 0x0300, + /* 1527 */ 0x1F40, 0x0301, + /* 1529 */ 0x1F41, 0x0301, + /* 1531 */ 0x039F, 0x0313, + /* 1533 */ 0x039F, 0x0314, + /* 1535 */ 0x1F48, 0x0300, + /* 1537 */ 0x1F49, 0x0300, + /* 1539 */ 0x1F48, 0x0301, + /* 1541 */ 0x1F49, 0x0301, + /* 1543 */ 0x03C5, 0x0313, + /* 1545 */ 0x03C5, 0x0314, + /* 1547 */ 0x1F50, 0x0300, + /* 1549 */ 0x1F51, 0x0300, + /* 1551 */ 0x1F50, 0x0301, + /* 1553 */ 0x1F51, 0x0301, + /* 1555 */ 0x1F50, 0x0342, + /* 1557 */ 0x1F51, 0x0342, + /* 1559 */ 0x03A5, 0x0314, + /* 1561 */ 0x1F59, 0x0300, + /* 1563 */ 0x1F59, 0x0301, + /* 1565 */ 0x1F59, 0x0342, + /* 1567 */ 0x03C9, 0x0313, + /* 1569 */ 0x03C9, 0x0314, + /* 1571 */ 0x1F60, 0x0300, + /* 1573 */ 0x1F61, 0x0300, + /* 1575 */ 0x1F60, 0x0301, + /* 1577 */ 0x1F61, 0x0301, + /* 1579 */ 0x1F60, 0x0342, + /* 1581 */ 0x1F61, 0x0342, + /* 1583 */ 0x03A9, 0x0313, + /* 1585 */ 0x03A9, 0x0314, + /* 1587 */ 0x1F68, 0x0300, + /* 1589 */ 0x1F69, 0x0300, + /* 1591 */ 0x1F68, 0x0301, + /* 1593 */ 0x1F69, 0x0301, + /* 1595 */ 0x1F68, 0x0342, + /* 1597 */ 0x1F69, 0x0342, + /* 1599 */ 0x03B1, 0x0300, + /* 1601 */ 0x03B5, 0x0300, + /* 1603 */ 0x03B7, 0x0300, + /* 1605 */ 0x03B9, 0x0300, + /* 1607 */ 0x03BF, 0x0300, + /* 1609 */ 0x03C5, 0x0300, + /* 1611 */ 0x03C9, 0x0300, + /* 1613 */ 0x1F00, 0x0345, + /* 1615 */ 0x1F01, 0x0345, + /* 1617 */ 0x1F02, 0x0345, + /* 1619 */ 0x1F03, 0x0345, + /* 1621 */ 0x1F04, 0x0345, + /* 1623 */ 0x1F05, 0x0345, + /* 1625 */ 0x1F06, 0x0345, + /* 1627 */ 0x1F07, 0x0345, + /* 1629 */ 0x1F08, 0x0345, + /* 1631 */ 0x1F09, 0x0345, + /* 1633 */ 0x1F0A, 0x0345, + /* 1635 */ 0x1F0B, 0x0345, + /* 1637 */ 0x1F0C, 0x0345, + /* 1639 */ 0x1F0D, 0x0345, + /* 1641 */ 0x1F0E, 0x0345, + /* 1643 */ 0x1F0F, 0x0345, + /* 1645 */ 0x1F20, 0x0345, + /* 1647 */ 0x1F21, 0x0345, + /* 1649 */ 0x1F22, 0x0345, + /* 1651 */ 0x1F23, 0x0345, + /* 1653 */ 0x1F24, 0x0345, + /* 1655 */ 0x1F25, 0x0345, + /* 1657 */ 0x1F26, 0x0345, + /* 1659 */ 0x1F27, 0x0345, + /* 1661 */ 0x1F28, 0x0345, + /* 1663 */ 0x1F29, 0x0345, + /* 1665 */ 0x1F2A, 0x0345, + /* 1667 */ 0x1F2B, 0x0345, + /* 1669 */ 0x1F2C, 0x0345, + /* 1671 */ 0x1F2D, 0x0345, + /* 1673 */ 0x1F2E, 0x0345, + /* 1675 */ 0x1F2F, 0x0345, + /* 1677 */ 0x1F60, 0x0345, + /* 1679 */ 0x1F61, 0x0345, + /* 1681 */ 0x1F62, 0x0345, + /* 1683 */ 0x1F63, 0x0345, + /* 1685 */ 0x1F64, 0x0345, + /* 1687 */ 0x1F65, 0x0345, + /* 1689 */ 0x1F66, 0x0345, + /* 1691 */ 0x1F67, 0x0345, + /* 1693 */ 0x1F68, 0x0345, + /* 1695 */ 0x1F69, 0x0345, + /* 1697 */ 0x1F6A, 0x0345, + /* 1699 */ 0x1F6B, 0x0345, + /* 1701 */ 0x1F6C, 0x0345, + /* 1703 */ 0x1F6D, 0x0345, + /* 1705 */ 0x1F6E, 0x0345, + /* 1707 */ 0x1F6F, 0x0345, + /* 1709 */ 0x03B1, 0x0306, + /* 1711 */ 0x03B1, 0x0304, + /* 1713 */ 0x1F70, 0x0345, + /* 1715 */ 0x03B1, 0x0345, + /* 1717 */ 0x03AC, 0x0345, + /* 1719 */ 0x03B1, 0x0342, + /* 1721 */ 0x1FB6, 0x0345, + /* 1723 */ 0x0391, 0x0306, + /* 1725 */ 0x0391, 0x0304, + /* 1727 */ 0x0391, 0x0300, + /* 1729 */ 0x0391, 0x0345, + /* 1731 */ 0x0020, 0x0313, + /* 1733 */ 0x0020, 0x0313, + /* 1735 */ 0x0020, 0x0342, + /* 1737 */ 0x00A8, 0x0342, + /* 1739 */ 0x1F74, 0x0345, + /* 1741 */ 0x03B7, 0x0345, + /* 1743 */ 0x03AE, 0x0345, + /* 1745 */ 0x03B7, 0x0342, + /* 1747 */ 0x1FC6, 0x0345, + /* 1749 */ 0x0395, 0x0300, + /* 1751 */ 0x0397, 0x0300, + /* 1753 */ 0x0397, 0x0345, + /* 1755 */ 0x1FBF, 0x0300, + /* 1757 */ 0x1FBF, 0x0301, + /* 1759 */ 0x1FBF, 0x0342, + /* 1761 */ 0x03B9, 0x0306, + /* 1763 */ 0x03B9, 0x0304, + /* 1765 */ 0x03CA, 0x0300, + /* 1767 */ 0x03B9, 0x0342, + /* 1769 */ 0x03CA, 0x0342, + /* 1771 */ 0x0399, 0x0306, + /* 1773 */ 0x0399, 0x0304, + /* 1775 */ 0x0399, 0x0300, + /* 1777 */ 0x1FFE, 0x0300, + /* 1779 */ 0x1FFE, 0x0301, + /* 1781 */ 0x1FFE, 0x0342, + /* 1783 */ 0x03C5, 0x0306, + /* 1785 */ 0x03C5, 0x0304, + /* 1787 */ 0x03CB, 0x0300, + /* 1789 */ 0x03C1, 0x0313, + /* 1791 */ 0x03C1, 0x0314, + /* 1793 */ 0x03C5, 0x0342, + /* 1795 */ 0x03CB, 0x0342, + /* 1797 */ 0x03A5, 0x0306, + /* 1799 */ 0x03A5, 0x0304, + /* 1801 */ 0x03A5, 0x0300, + /* 1803 */ 0x03A1, 0x0314, + /* 1805 */ 0x00A8, 0x0300, + /* 1807 */ 0x1F7C, 0x0345, + /* 1809 */ 0x03C9, 0x0345, + /* 1811 */ 0x03CE, 0x0345, + /* 1813 */ 0x03C9, 0x0342, + /* 1815 */ 0x1FF6, 0x0345, + /* 1817 */ 0x039F, 0x0300, + /* 1819 */ 0x03A9, 0x0300, + /* 1821 */ 0x03A9, 0x0345, + /* 1823 */ 0x0020, 0x0314, + /* 1825 */ 0x0020, 0x0333, + /* 1827 */ 0x002E, 0x002E, + /* 1829 */ 0x002E, 0x002E, 0x002E, + /* 1832 */ 0x2032, 0x2032, + /* 1834 */ 0x2032, 0x2032, 0x2032, + /* 1837 */ 0x2035, 0x2035, + /* 1839 */ 0x2035, 0x2035, 0x2035, + /* 1842 */ 0x0021, 0x0021, + /* 1844 */ 0x0020, 0x0305, + /* 1846 */ 0x003F, 0x003F, + /* 1848 */ 0x003F, 0x0021, + /* 1850 */ 0x0021, 0x003F, + /* 1852 */ 0x2032, 0x2032, 0x2032, 0x2032, + /* 1856 */ 0x0052, 0x0073, + /* 1858 */ 0x0061, 0x002F, 0x0063, + /* 1861 */ 0x0061, 0x002F, 0x0073, + /* 1864 */ 0x00B0, 0x0043, + /* 1866 */ 0x0063, 0x002F, 0x006F, + /* 1869 */ 0x0063, 0x002F, 0x0075, + /* 1872 */ 0x00B0, 0x0046, + /* 1874 */ 0x004E, 0x006F, + /* 1876 */ 0x0053, 0x004D, + /* 1878 */ 0x0054, 0x0045, 0x004C, + /* 1881 */ 0x0054, 0x004D, + /* 1883 */ 0x0046, 0x0041, 0x0058, + /* 1886 */ 0x0031, 0x2044, 0x0037, + /* 1889 */ 0x0031, 0x2044, 0x0039, + /* 1892 */ 0x0031, 0x2044, 0x0031, 0x0030, + /* 1896 */ 0x0031, 0x2044, 0x0033, + /* 1899 */ 0x0032, 0x2044, 0x0033, + /* 1902 */ 0x0031, 0x2044, 0x0035, + /* 1905 */ 0x0032, 0x2044, 0x0035, + /* 1908 */ 0x0033, 0x2044, 0x0035, + /* 1911 */ 0x0034, 0x2044, 0x0035, + /* 1914 */ 0x0031, 0x2044, 0x0036, + /* 1917 */ 0x0035, 0x2044, 0x0036, + /* 1920 */ 0x0031, 0x2044, 0x0038, + /* 1923 */ 0x0033, 0x2044, 0x0038, + /* 1926 */ 0x0035, 0x2044, 0x0038, + /* 1929 */ 0x0037, 0x2044, 0x0038, + /* 1932 */ 0x0031, 0x2044, + /* 1934 */ 0x0049, 0x0049, + /* 1936 */ 0x0049, 0x0049, 0x0049, + /* 1939 */ 0x0049, 0x0056, + /* 1941 */ 0x0056, 0x0049, + /* 1943 */ 0x0056, 0x0049, 0x0049, + /* 1946 */ 0x0056, 0x0049, 0x0049, 0x0049, + /* 1950 */ 0x0049, 0x0058, + /* 1952 */ 0x0058, 0x0049, + /* 1954 */ 0x0058, 0x0049, 0x0049, + /* 1957 */ 0x0069, 0x0069, + /* 1959 */ 0x0069, 0x0069, 0x0069, + /* 1962 */ 0x0069, 0x0076, + /* 1964 */ 0x0076, 0x0069, + /* 1966 */ 0x0076, 0x0069, 0x0069, + /* 1969 */ 0x0076, 0x0069, 0x0069, 0x0069, + /* 1973 */ 0x0069, 0x0078, + /* 1975 */ 0x0078, 0x0069, + /* 1977 */ 0x0078, 0x0069, 0x0069, + /* 1980 */ 0x0030, 0x2044, 0x0033, + /* 1983 */ 0x2190, 0x0338, + /* 1985 */ 0x2192, 0x0338, + /* 1987 */ 0x2194, 0x0338, + /* 1989 */ 0x21D0, 0x0338, + /* 1991 */ 0x21D4, 0x0338, + /* 1993 */ 0x21D2, 0x0338, + /* 1995 */ 0x2203, 0x0338, + /* 1997 */ 0x2208, 0x0338, + /* 1999 */ 0x220B, 0x0338, + /* 2001 */ 0x2223, 0x0338, + /* 2003 */ 0x2225, 0x0338, + /* 2005 */ 0x222B, 0x222B, + /* 2007 */ 0x222B, 0x222B, 0x222B, + /* 2010 */ 0x222E, 0x222E, + /* 2012 */ 0x222E, 0x222E, 0x222E, + /* 2015 */ 0x223C, 0x0338, + /* 2017 */ 0x2243, 0x0338, + /* 2019 */ 0x2245, 0x0338, + /* 2021 */ 0x2248, 0x0338, + /* 2023 */ 0x003D, 0x0338, + /* 2025 */ 0x2261, 0x0338, + /* 2027 */ 0x224D, 0x0338, + /* 2029 */ 0x003C, 0x0338, + /* 2031 */ 0x003E, 0x0338, + /* 2033 */ 0x2264, 0x0338, + /* 2035 */ 0x2265, 0x0338, + /* 2037 */ 0x2272, 0x0338, + /* 2039 */ 0x2273, 0x0338, + /* 2041 */ 0x2276, 0x0338, + /* 2043 */ 0x2277, 0x0338, + /* 2045 */ 0x227A, 0x0338, + /* 2047 */ 0x227B, 0x0338, + /* 2049 */ 0x2282, 0x0338, + /* 2051 */ 0x2283, 0x0338, + /* 2053 */ 0x2286, 0x0338, + /* 2055 */ 0x2287, 0x0338, + /* 2057 */ 0x22A2, 0x0338, + /* 2059 */ 0x22A8, 0x0338, + /* 2061 */ 0x22A9, 0x0338, + /* 2063 */ 0x22AB, 0x0338, + /* 2065 */ 0x227C, 0x0338, + /* 2067 */ 0x227D, 0x0338, + /* 2069 */ 0x2291, 0x0338, + /* 2071 */ 0x2292, 0x0338, + /* 2073 */ 0x22B2, 0x0338, + /* 2075 */ 0x22B3, 0x0338, + /* 2077 */ 0x22B4, 0x0338, + /* 2079 */ 0x22B5, 0x0338, + /* 2081 */ 0x0031, 0x0030, + /* 2083 */ 0x0031, 0x0031, + /* 2085 */ 0x0031, 0x0032, + /* 2087 */ 0x0031, 0x0033, + /* 2089 */ 0x0031, 0x0034, + /* 2091 */ 0x0031, 0x0035, + /* 2093 */ 0x0031, 0x0036, + /* 2095 */ 0x0031, 0x0037, + /* 2097 */ 0x0031, 0x0038, + /* 2099 */ 0x0031, 0x0039, + /* 2101 */ 0x0032, 0x0030, + /* 2103 */ 0x0028, 0x0031, 0x0029, + /* 2106 */ 0x0028, 0x0032, 0x0029, + /* 2109 */ 0x0028, 0x0033, 0x0029, + /* 2112 */ 0x0028, 0x0034, 0x0029, + /* 2115 */ 0x0028, 0x0035, 0x0029, + /* 2118 */ 0x0028, 0x0036, 0x0029, + /* 2121 */ 0x0028, 0x0037, 0x0029, + /* 2124 */ 0x0028, 0x0038, 0x0029, + /* 2127 */ 0x0028, 0x0039, 0x0029, + /* 2130 */ 0x0028, 0x0031, 0x0030, 0x0029, + /* 2134 */ 0x0028, 0x0031, 0x0031, 0x0029, + /* 2138 */ 0x0028, 0x0031, 0x0032, 0x0029, + /* 2142 */ 0x0028, 0x0031, 0x0033, 0x0029, + /* 2146 */ 0x0028, 0x0031, 0x0034, 0x0029, + /* 2150 */ 0x0028, 0x0031, 0x0035, 0x0029, + /* 2154 */ 0x0028, 0x0031, 0x0036, 0x0029, + /* 2158 */ 0x0028, 0x0031, 0x0037, 0x0029, + /* 2162 */ 0x0028, 0x0031, 0x0038, 0x0029, + /* 2166 */ 0x0028, 0x0031, 0x0039, 0x0029, + /* 2170 */ 0x0028, 0x0032, 0x0030, 0x0029, + /* 2174 */ 0x0031, 0x002E, + /* 2176 */ 0x0032, 0x002E, + /* 2178 */ 0x0033, 0x002E, + /* 2180 */ 0x0034, 0x002E, + /* 2182 */ 0x0035, 0x002E, + /* 2184 */ 0x0036, 0x002E, + /* 2186 */ 0x0037, 0x002E, + /* 2188 */ 0x0038, 0x002E, + /* 2190 */ 0x0039, 0x002E, + /* 2192 */ 0x0031, 0x0030, 0x002E, + /* 2195 */ 0x0031, 0x0031, 0x002E, + /* 2198 */ 0x0031, 0x0032, 0x002E, + /* 2201 */ 0x0031, 0x0033, 0x002E, + /* 2204 */ 0x0031, 0x0034, 0x002E, + /* 2207 */ 0x0031, 0x0035, 0x002E, + /* 2210 */ 0x0031, 0x0036, 0x002E, + /* 2213 */ 0x0031, 0x0037, 0x002E, + /* 2216 */ 0x0031, 0x0038, 0x002E, + /* 2219 */ 0x0031, 0x0039, 0x002E, + /* 2222 */ 0x0032, 0x0030, 0x002E, + /* 2225 */ 0x0028, 0x0061, 0x0029, + /* 2228 */ 0x0028, 0x0062, 0x0029, + /* 2231 */ 0x0028, 0x0063, 0x0029, + /* 2234 */ 0x0028, 0x0064, 0x0029, + /* 2237 */ 0x0028, 0x0065, 0x0029, + /* 2240 */ 0x0028, 0x0066, 0x0029, + /* 2243 */ 0x0028, 0x0067, 0x0029, + /* 2246 */ 0x0028, 0x0068, 0x0029, + /* 2249 */ 0x0028, 0x0069, 0x0029, + /* 2252 */ 0x0028, 0x006A, 0x0029, + /* 2255 */ 0x0028, 0x006B, 0x0029, + /* 2258 */ 0x0028, 0x006C, 0x0029, + /* 2261 */ 0x0028, 0x006D, 0x0029, + /* 2264 */ 0x0028, 0x006E, 0x0029, + /* 2267 */ 0x0028, 0x006F, 0x0029, + /* 2270 */ 0x0028, 0x0070, 0x0029, + /* 2273 */ 0x0028, 0x0071, 0x0029, + /* 2276 */ 0x0028, 0x0072, 0x0029, + /* 2279 */ 0x0028, 0x0073, 0x0029, + /* 2282 */ 0x0028, 0x0074, 0x0029, + /* 2285 */ 0x0028, 0x0075, 0x0029, + /* 2288 */ 0x0028, 0x0076, 0x0029, + /* 2291 */ 0x0028, 0x0077, 0x0029, + /* 2294 */ 0x0028, 0x0078, 0x0029, + /* 2297 */ 0x0028, 0x0079, 0x0029, + /* 2300 */ 0x0028, 0x007A, 0x0029, + /* 2303 */ 0x222B, 0x222B, 0x222B, 0x222B, + /* 2307 */ 0x003A, 0x003A, 0x003D, + /* 2310 */ 0x003D, 0x003D, + /* 2312 */ 0x003D, 0x003D, 0x003D, + /* 2315 */ 0x2ADD, 0x0338, + /* 2317 */ 0x304B, 0x3099, + /* 2319 */ 0x304D, 0x3099, + /* 2321 */ 0x304F, 0x3099, + /* 2323 */ 0x3051, 0x3099, + /* 2325 */ 0x3053, 0x3099, + /* 2327 */ 0x3055, 0x3099, + /* 2329 */ 0x3057, 0x3099, + /* 2331 */ 0x3059, 0x3099, + /* 2333 */ 0x305B, 0x3099, + /* 2335 */ 0x305D, 0x3099, + /* 2337 */ 0x305F, 0x3099, + /* 2339 */ 0x3061, 0x3099, + /* 2341 */ 0x3064, 0x3099, + /* 2343 */ 0x3066, 0x3099, + /* 2345 */ 0x3068, 0x3099, + /* 2347 */ 0x306F, 0x3099, + /* 2349 */ 0x306F, 0x309A, + /* 2351 */ 0x3072, 0x3099, + /* 2353 */ 0x3072, 0x309A, + /* 2355 */ 0x3075, 0x3099, + /* 2357 */ 0x3075, 0x309A, + /* 2359 */ 0x3078, 0x3099, + /* 2361 */ 0x3078, 0x309A, + /* 2363 */ 0x307B, 0x3099, + /* 2365 */ 0x307B, 0x309A, + /* 2367 */ 0x3046, 0x3099, + /* 2369 */ 0x0020, 0x3099, + /* 2371 */ 0x0020, 0x309A, + /* 2373 */ 0x309D, 0x3099, + /* 2375 */ 0x3088, 0x308A, + /* 2377 */ 0x30AB, 0x3099, + /* 2379 */ 0x30AD, 0x3099, + /* 2381 */ 0x30AF, 0x3099, + /* 2383 */ 0x30B1, 0x3099, + /* 2385 */ 0x30B3, 0x3099, + /* 2387 */ 0x30B5, 0x3099, + /* 2389 */ 0x30B7, 0x3099, + /* 2391 */ 0x30B9, 0x3099, + /* 2393 */ 0x30BB, 0x3099, + /* 2395 */ 0x30BD, 0x3099, + /* 2397 */ 0x30BF, 0x3099, + /* 2399 */ 0x30C1, 0x3099, + /* 2401 */ 0x30C4, 0x3099, + /* 2403 */ 0x30C6, 0x3099, + /* 2405 */ 0x30C8, 0x3099, + /* 2407 */ 0x30CF, 0x3099, + /* 2409 */ 0x30CF, 0x309A, + /* 2411 */ 0x30D2, 0x3099, + /* 2413 */ 0x30D2, 0x309A, + /* 2415 */ 0x30D5, 0x3099, + /* 2417 */ 0x30D5, 0x309A, + /* 2419 */ 0x30D8, 0x3099, + /* 2421 */ 0x30D8, 0x309A, + /* 2423 */ 0x30DB, 0x3099, + /* 2425 */ 0x30DB, 0x309A, + /* 2427 */ 0x30A6, 0x3099, + /* 2429 */ 0x30EF, 0x3099, + /* 2431 */ 0x30F0, 0x3099, + /* 2433 */ 0x30F1, 0x3099, + /* 2435 */ 0x30F2, 0x3099, + /* 2437 */ 0x30FD, 0x3099, + /* 2439 */ 0x30B3, 0x30C8, + /* 2441 */ 0x0028, 0x1100, 0x0029, + /* 2444 */ 0x0028, 0x1102, 0x0029, + /* 2447 */ 0x0028, 0x1103, 0x0029, + /* 2450 */ 0x0028, 0x1105, 0x0029, + /* 2453 */ 0x0028, 0x1106, 0x0029, + /* 2456 */ 0x0028, 0x1107, 0x0029, + /* 2459 */ 0x0028, 0x1109, 0x0029, + /* 2462 */ 0x0028, 0x110B, 0x0029, + /* 2465 */ 0x0028, 0x110C, 0x0029, + /* 2468 */ 0x0028, 0x110E, 0x0029, + /* 2471 */ 0x0028, 0x110F, 0x0029, + /* 2474 */ 0x0028, 0x1110, 0x0029, + /* 2477 */ 0x0028, 0x1111, 0x0029, + /* 2480 */ 0x0028, 0x1112, 0x0029, + /* 2483 */ 0x0028, 0x1100, 0x1161, 0x0029, + /* 2487 */ 0x0028, 0x1102, 0x1161, 0x0029, + /* 2491 */ 0x0028, 0x1103, 0x1161, 0x0029, + /* 2495 */ 0x0028, 0x1105, 0x1161, 0x0029, + /* 2499 */ 0x0028, 0x1106, 0x1161, 0x0029, + /* 2503 */ 0x0028, 0x1107, 0x1161, 0x0029, + /* 2507 */ 0x0028, 0x1109, 0x1161, 0x0029, + /* 2511 */ 0x0028, 0x110B, 0x1161, 0x0029, + /* 2515 */ 0x0028, 0x110C, 0x1161, 0x0029, + /* 2519 */ 0x0028, 0x110E, 0x1161, 0x0029, + /* 2523 */ 0x0028, 0x110F, 0x1161, 0x0029, + /* 2527 */ 0x0028, 0x1110, 0x1161, 0x0029, + /* 2531 */ 0x0028, 0x1111, 0x1161, 0x0029, + /* 2535 */ 0x0028, 0x1112, 0x1161, 0x0029, + /* 2539 */ 0x0028, 0x110C, 0x116E, 0x0029, + /* 2543 */ 0x0028, 0x110B, 0x1169, 0x110C, 0x1165, 0x11AB, 0x0029, + /* 2550 */ 0x0028, 0x110B, 0x1169, 0x1112, 0x116E, 0x0029, + /* 2556 */ 0x0028, 0x4E00, 0x0029, + /* 2559 */ 0x0028, 0x4E8C, 0x0029, + /* 2562 */ 0x0028, 0x4E09, 0x0029, + /* 2565 */ 0x0028, 0x56DB, 0x0029, + /* 2568 */ 0x0028, 0x4E94, 0x0029, + /* 2571 */ 0x0028, 0x516D, 0x0029, + /* 2574 */ 0x0028, 0x4E03, 0x0029, + /* 2577 */ 0x0028, 0x516B, 0x0029, + /* 2580 */ 0x0028, 0x4E5D, 0x0029, + /* 2583 */ 0x0028, 0x5341, 0x0029, + /* 2586 */ 0x0028, 0x6708, 0x0029, + /* 2589 */ 0x0028, 0x706B, 0x0029, + /* 2592 */ 0x0028, 0x6C34, 0x0029, + /* 2595 */ 0x0028, 0x6728, 0x0029, + /* 2598 */ 0x0028, 0x91D1, 0x0029, + /* 2601 */ 0x0028, 0x571F, 0x0029, + /* 2604 */ 0x0028, 0x65E5, 0x0029, + /* 2607 */ 0x0028, 0x682A, 0x0029, + /* 2610 */ 0x0028, 0x6709, 0x0029, + /* 2613 */ 0x0028, 0x793E, 0x0029, + /* 2616 */ 0x0028, 0x540D, 0x0029, + /* 2619 */ 0x0028, 0x7279, 0x0029, + /* 2622 */ 0x0028, 0x8CA1, 0x0029, + /* 2625 */ 0x0028, 0x795D, 0x0029, + /* 2628 */ 0x0028, 0x52B4, 0x0029, + /* 2631 */ 0x0028, 0x4EE3, 0x0029, + /* 2634 */ 0x0028, 0x547C, 0x0029, + /* 2637 */ 0x0028, 0x5B66, 0x0029, + /* 2640 */ 0x0028, 0x76E3, 0x0029, + /* 2643 */ 0x0028, 0x4F01, 0x0029, + /* 2646 */ 0x0028, 0x8CC7, 0x0029, + /* 2649 */ 0x0028, 0x5354, 0x0029, + /* 2652 */ 0x0028, 0x796D, 0x0029, + /* 2655 */ 0x0028, 0x4F11, 0x0029, + /* 2658 */ 0x0028, 0x81EA, 0x0029, + /* 2661 */ 0x0028, 0x81F3, 0x0029, + /* 2664 */ 0x0050, 0x0054, 0x0045, + /* 2667 */ 0x0032, 0x0031, + /* 2669 */ 0x0032, 0x0032, + /* 2671 */ 0x0032, 0x0033, + /* 2673 */ 0x0032, 0x0034, + /* 2675 */ 0x0032, 0x0035, + /* 2677 */ 0x0032, 0x0036, + /* 2679 */ 0x0032, 0x0037, + /* 2681 */ 0x0032, 0x0038, + /* 2683 */ 0x0032, 0x0039, + /* 2685 */ 0x0033, 0x0030, + /* 2687 */ 0x0033, 0x0031, + /* 2689 */ 0x0033, 0x0032, + /* 2691 */ 0x0033, 0x0033, + /* 2693 */ 0x0033, 0x0034, + /* 2695 */ 0x0033, 0x0035, + /* 2697 */ 0x1100, 0x1161, + /* 2699 */ 0x1102, 0x1161, + /* 2701 */ 0x1103, 0x1161, + /* 2703 */ 0x1105, 0x1161, + /* 2705 */ 0x1106, 0x1161, + /* 2707 */ 0x1107, 0x1161, + /* 2709 */ 0x1109, 0x1161, + /* 2711 */ 0x110B, 0x1161, + /* 2713 */ 0x110C, 0x1161, + /* 2715 */ 0x110E, 0x1161, + /* 2717 */ 0x110F, 0x1161, + /* 2719 */ 0x1110, 0x1161, + /* 2721 */ 0x1111, 0x1161, + /* 2723 */ 0x1112, 0x1161, + /* 2725 */ 0x110E, 0x1161, 0x11B7, 0x1100, 0x1169, + /* 2730 */ 0x110C, 0x116E, 0x110B, 0x1174, + /* 2734 */ 0x110B, 0x116E, + /* 2736 */ 0x0033, 0x0036, + /* 2738 */ 0x0033, 0x0037, + /* 2740 */ 0x0033, 0x0038, + /* 2742 */ 0x0033, 0x0039, + /* 2744 */ 0x0034, 0x0030, + /* 2746 */ 0x0034, 0x0031, + /* 2748 */ 0x0034, 0x0032, + /* 2750 */ 0x0034, 0x0033, + /* 2752 */ 0x0034, 0x0034, + /* 2754 */ 0x0034, 0x0035, + /* 2756 */ 0x0034, 0x0036, + /* 2758 */ 0x0034, 0x0037, + /* 2760 */ 0x0034, 0x0038, + /* 2762 */ 0x0034, 0x0039, + /* 2764 */ 0x0035, 0x0030, + /* 2766 */ 0x0031, 0x6708, + /* 2768 */ 0x0032, 0x6708, + /* 2770 */ 0x0033, 0x6708, + /* 2772 */ 0x0034, 0x6708, + /* 2774 */ 0x0035, 0x6708, + /* 2776 */ 0x0036, 0x6708, + /* 2778 */ 0x0037, 0x6708, + /* 2780 */ 0x0038, 0x6708, + /* 2782 */ 0x0039, 0x6708, + /* 2784 */ 0x0031, 0x0030, 0x6708, + /* 2787 */ 0x0031, 0x0031, 0x6708, + /* 2790 */ 0x0031, 0x0032, 0x6708, + /* 2793 */ 0x0048, 0x0067, + /* 2795 */ 0x0065, 0x0072, 0x0067, + /* 2798 */ 0x0065, 0x0056, + /* 2800 */ 0x004C, 0x0054, 0x0044, + /* 2803 */ 0x4EE4, 0x548C, + /* 2805 */ 0x30A2, 0x30D1, 0x30FC, 0x30C8, + /* 2809 */ 0x30A2, 0x30EB, 0x30D5, 0x30A1, + /* 2813 */ 0x30A2, 0x30F3, 0x30DA, 0x30A2, + /* 2817 */ 0x30A2, 0x30FC, 0x30EB, + /* 2820 */ 0x30A4, 0x30CB, 0x30F3, 0x30B0, + /* 2824 */ 0x30A4, 0x30F3, 0x30C1, + /* 2827 */ 0x30A6, 0x30A9, 0x30F3, + /* 2830 */ 0x30A8, 0x30B9, 0x30AF, 0x30FC, 0x30C9, + /* 2835 */ 0x30A8, 0x30FC, 0x30AB, 0x30FC, + /* 2839 */ 0x30AA, 0x30F3, 0x30B9, + /* 2842 */ 0x30AA, 0x30FC, 0x30E0, + /* 2845 */ 0x30AB, 0x30A4, 0x30EA, + /* 2848 */ 0x30AB, 0x30E9, 0x30C3, 0x30C8, + /* 2852 */ 0x30AB, 0x30ED, 0x30EA, 0x30FC, + /* 2856 */ 0x30AC, 0x30ED, 0x30F3, + /* 2859 */ 0x30AC, 0x30F3, 0x30DE, + /* 2862 */ 0x30AE, 0x30AC, + /* 2864 */ 0x30AE, 0x30CB, 0x30FC, + /* 2867 */ 0x30AD, 0x30E5, 0x30EA, 0x30FC, + /* 2871 */ 0x30AE, 0x30EB, 0x30C0, 0x30FC, + /* 2875 */ 0x30AD, 0x30ED, + /* 2877 */ 0x30AD, 0x30ED, 0x30B0, 0x30E9, 0x30E0, + /* 2882 */ 0x30AD, 0x30ED, 0x30E1, 0x30FC, 0x30C8, 0x30EB, + /* 2888 */ 0x30AD, 0x30ED, 0x30EF, 0x30C3, 0x30C8, + /* 2893 */ 0x30B0, 0x30E9, 0x30E0, + /* 2896 */ 0x30B0, 0x30E9, 0x30E0, 0x30C8, 0x30F3, + /* 2901 */ 0x30AF, 0x30EB, 0x30BC, 0x30A4, 0x30ED, + /* 2906 */ 0x30AF, 0x30ED, 0x30FC, 0x30CD, + /* 2910 */ 0x30B1, 0x30FC, 0x30B9, + /* 2913 */ 0x30B3, 0x30EB, 0x30CA, + /* 2916 */ 0x30B3, 0x30FC, 0x30DD, + /* 2919 */ 0x30B5, 0x30A4, 0x30AF, 0x30EB, + /* 2923 */ 0x30B5, 0x30F3, 0x30C1, 0x30FC, 0x30E0, + /* 2928 */ 0x30B7, 0x30EA, 0x30F3, 0x30B0, + /* 2932 */ 0x30BB, 0x30F3, 0x30C1, + /* 2935 */ 0x30BB, 0x30F3, 0x30C8, + /* 2938 */ 0x30C0, 0x30FC, 0x30B9, + /* 2941 */ 0x30C7, 0x30B7, + /* 2943 */ 0x30C9, 0x30EB, + /* 2945 */ 0x30C8, 0x30F3, + /* 2947 */ 0x30CA, 0x30CE, + /* 2949 */ 0x30CE, 0x30C3, 0x30C8, + /* 2952 */ 0x30CF, 0x30A4, 0x30C4, + /* 2955 */ 0x30D1, 0x30FC, 0x30BB, 0x30F3, 0x30C8, + /* 2960 */ 0x30D1, 0x30FC, 0x30C4, + /* 2963 */ 0x30D0, 0x30FC, 0x30EC, 0x30EB, + /* 2967 */ 0x30D4, 0x30A2, 0x30B9, 0x30C8, 0x30EB, + /* 2972 */ 0x30D4, 0x30AF, 0x30EB, + /* 2975 */ 0x30D4, 0x30B3, + /* 2977 */ 0x30D3, 0x30EB, + /* 2979 */ 0x30D5, 0x30A1, 0x30E9, 0x30C3, 0x30C9, + /* 2984 */ 0x30D5, 0x30A3, 0x30FC, 0x30C8, + /* 2988 */ 0x30D6, 0x30C3, 0x30B7, 0x30A7, 0x30EB, + /* 2993 */ 0x30D5, 0x30E9, 0x30F3, + /* 2996 */ 0x30D8, 0x30AF, 0x30BF, 0x30FC, 0x30EB, + /* 3001 */ 0x30DA, 0x30BD, + /* 3003 */ 0x30DA, 0x30CB, 0x30D2, + /* 3006 */ 0x30D8, 0x30EB, 0x30C4, + /* 3009 */ 0x30DA, 0x30F3, 0x30B9, + /* 3012 */ 0x30DA, 0x30FC, 0x30B8, + /* 3015 */ 0x30D9, 0x30FC, 0x30BF, + /* 3018 */ 0x30DD, 0x30A4, 0x30F3, 0x30C8, + /* 3022 */ 0x30DC, 0x30EB, 0x30C8, + /* 3025 */ 0x30DB, 0x30F3, + /* 3027 */ 0x30DD, 0x30F3, 0x30C9, + /* 3030 */ 0x30DB, 0x30FC, 0x30EB, + /* 3033 */ 0x30DB, 0x30FC, 0x30F3, + /* 3036 */ 0x30DE, 0x30A4, 0x30AF, 0x30ED, + /* 3040 */ 0x30DE, 0x30A4, 0x30EB, + /* 3043 */ 0x30DE, 0x30C3, 0x30CF, + /* 3046 */ 0x30DE, 0x30EB, 0x30AF, + /* 3049 */ 0x30DE, 0x30F3, 0x30B7, 0x30E7, 0x30F3, + /* 3054 */ 0x30DF, 0x30AF, 0x30ED, 0x30F3, + /* 3058 */ 0x30DF, 0x30EA, + /* 3060 */ 0x30DF, 0x30EA, 0x30D0, 0x30FC, 0x30EB, + /* 3065 */ 0x30E1, 0x30AC, + /* 3067 */ 0x30E1, 0x30AC, 0x30C8, 0x30F3, + /* 3071 */ 0x30E1, 0x30FC, 0x30C8, 0x30EB, + /* 3075 */ 0x30E4, 0x30FC, 0x30C9, + /* 3078 */ 0x30E4, 0x30FC, 0x30EB, + /* 3081 */ 0x30E6, 0x30A2, 0x30F3, + /* 3084 */ 0x30EA, 0x30C3, 0x30C8, 0x30EB, + /* 3088 */ 0x30EA, 0x30E9, + /* 3090 */ 0x30EB, 0x30D4, 0x30FC, + /* 3093 */ 0x30EB, 0x30FC, 0x30D6, 0x30EB, + /* 3097 */ 0x30EC, 0x30E0, + /* 3099 */ 0x30EC, 0x30F3, 0x30C8, 0x30B2, 0x30F3, + /* 3104 */ 0x30EF, 0x30C3, 0x30C8, + /* 3107 */ 0x0030, 0x70B9, + /* 3109 */ 0x0031, 0x70B9, + /* 3111 */ 0x0032, 0x70B9, + /* 3113 */ 0x0033, 0x70B9, + /* 3115 */ 0x0034, 0x70B9, + /* 3117 */ 0x0035, 0x70B9, + /* 3119 */ 0x0036, 0x70B9, + /* 3121 */ 0x0037, 0x70B9, + /* 3123 */ 0x0038, 0x70B9, + /* 3125 */ 0x0039, 0x70B9, + /* 3127 */ 0x0031, 0x0030, 0x70B9, + /* 3130 */ 0x0031, 0x0031, 0x70B9, + /* 3133 */ 0x0031, 0x0032, 0x70B9, + /* 3136 */ 0x0031, 0x0033, 0x70B9, + /* 3139 */ 0x0031, 0x0034, 0x70B9, + /* 3142 */ 0x0031, 0x0035, 0x70B9, + /* 3145 */ 0x0031, 0x0036, 0x70B9, + /* 3148 */ 0x0031, 0x0037, 0x70B9, + /* 3151 */ 0x0031, 0x0038, 0x70B9, + /* 3154 */ 0x0031, 0x0039, 0x70B9, + /* 3157 */ 0x0032, 0x0030, 0x70B9, + /* 3160 */ 0x0032, 0x0031, 0x70B9, + /* 3163 */ 0x0032, 0x0032, 0x70B9, + /* 3166 */ 0x0032, 0x0033, 0x70B9, + /* 3169 */ 0x0032, 0x0034, 0x70B9, + /* 3172 */ 0x0068, 0x0050, 0x0061, + /* 3175 */ 0x0064, 0x0061, + /* 3177 */ 0x0041, 0x0055, + /* 3179 */ 0x0062, 0x0061, 0x0072, + /* 3182 */ 0x006F, 0x0056, + /* 3184 */ 0x0070, 0x0063, + /* 3186 */ 0x0064, 0x006D, + /* 3188 */ 0x0064, 0x006D, 0x00B2, + /* 3191 */ 0x0064, 0x006D, 0x00B3, + /* 3194 */ 0x0049, 0x0055, + /* 3196 */ 0x5E73, 0x6210, + /* 3198 */ 0x662D, 0x548C, + /* 3200 */ 0x5927, 0x6B63, + /* 3202 */ 0x660E, 0x6CBB, + /* 3204 */ 0x682A, 0x5F0F, 0x4F1A, 0x793E, + /* 3208 */ 0x0070, 0x0041, + /* 3210 */ 0x006E, 0x0041, + /* 3212 */ 0x03BC, 0x0041, + /* 3214 */ 0x006D, 0x0041, + /* 3216 */ 0x006B, 0x0041, + /* 3218 */ 0x004B, 0x0042, + /* 3220 */ 0x004D, 0x0042, + /* 3222 */ 0x0047, 0x0042, + /* 3224 */ 0x0063, 0x0061, 0x006C, + /* 3227 */ 0x006B, 0x0063, 0x0061, 0x006C, + /* 3231 */ 0x0070, 0x0046, + /* 3233 */ 0x006E, 0x0046, + /* 3235 */ 0x03BC, 0x0046, + /* 3237 */ 0x03BC, 0x0067, + /* 3239 */ 0x006D, 0x0067, + /* 3241 */ 0x006B, 0x0067, + /* 3243 */ 0x0048, 0x007A, + /* 3245 */ 0x006B, 0x0048, 0x007A, + /* 3248 */ 0x004D, 0x0048, 0x007A, + /* 3251 */ 0x0047, 0x0048, 0x007A, + /* 3254 */ 0x0054, 0x0048, 0x007A, + /* 3257 */ 0x03BC, 0x2113, + /* 3259 */ 0x006D, 0x2113, + /* 3261 */ 0x0064, 0x2113, + /* 3263 */ 0x006B, 0x2113, + /* 3265 */ 0x0066, 0x006D, + /* 3267 */ 0x006E, 0x006D, + /* 3269 */ 0x03BC, 0x006D, + /* 3271 */ 0x006D, 0x006D, + /* 3273 */ 0x0063, 0x006D, + /* 3275 */ 0x006B, 0x006D, + /* 3277 */ 0x006D, 0x006D, 0x00B2, + /* 3280 */ 0x0063, 0x006D, 0x00B2, + /* 3283 */ 0x006D, 0x00B2, + /* 3285 */ 0x006B, 0x006D, 0x00B2, + /* 3288 */ 0x006D, 0x006D, 0x00B3, + /* 3291 */ 0x0063, 0x006D, 0x00B3, + /* 3294 */ 0x006D, 0x00B3, + /* 3296 */ 0x006B, 0x006D, 0x00B3, + /* 3299 */ 0x006D, 0x2215, 0x0073, + /* 3302 */ 0x006D, 0x2215, 0x0073, 0x00B2, + /* 3306 */ 0x0050, 0x0061, + /* 3308 */ 0x006B, 0x0050, 0x0061, + /* 3311 */ 0x004D, 0x0050, 0x0061, + /* 3314 */ 0x0047, 0x0050, 0x0061, + /* 3317 */ 0x0072, 0x0061, 0x0064, + /* 3320 */ 0x0072, 0x0061, 0x0064, 0x2215, 0x0073, + /* 3325 */ 0x0072, 0x0061, 0x0064, 0x2215, 0x0073, 0x00B2, + /* 3331 */ 0x0070, 0x0073, + /* 3333 */ 0x006E, 0x0073, + /* 3335 */ 0x03BC, 0x0073, + /* 3337 */ 0x006D, 0x0073, + /* 3339 */ 0x0070, 0x0056, + /* 3341 */ 0x006E, 0x0056, + /* 3343 */ 0x03BC, 0x0056, + /* 3345 */ 0x006D, 0x0056, + /* 3347 */ 0x006B, 0x0056, + /* 3349 */ 0x004D, 0x0056, + /* 3351 */ 0x0070, 0x0057, + /* 3353 */ 0x006E, 0x0057, + /* 3355 */ 0x03BC, 0x0057, + /* 3357 */ 0x006D, 0x0057, + /* 3359 */ 0x006B, 0x0057, + /* 3361 */ 0x004D, 0x0057, + /* 3363 */ 0x006B, 0x03A9, + /* 3365 */ 0x004D, 0x03A9, + /* 3367 */ 0x0061, 0x002E, 0x006D, 0x002E, + /* 3371 */ 0x0042, 0x0071, + /* 3373 */ 0x0063, 0x0063, + /* 3375 */ 0x0063, 0x0064, + /* 3377 */ 0x0043, 0x2215, 0x006B, 0x0067, + /* 3381 */ 0x0043, 0x006F, 0x002E, + /* 3384 */ 0x0064, 0x0042, + /* 3386 */ 0x0047, 0x0079, + /* 3388 */ 0x0068, 0x0061, + /* 3390 */ 0x0048, 0x0050, + /* 3392 */ 0x0069, 0x006E, + /* 3394 */ 0x004B, 0x004B, + /* 3396 */ 0x004B, 0x004D, + /* 3398 */ 0x006B, 0x0074, + /* 3400 */ 0x006C, 0x006D, + /* 3402 */ 0x006C, 0x006E, + /* 3404 */ 0x006C, 0x006F, 0x0067, + /* 3407 */ 0x006C, 0x0078, + /* 3409 */ 0x006D, 0x0062, + /* 3411 */ 0x006D, 0x0069, 0x006C, + /* 3414 */ 0x006D, 0x006F, 0x006C, + /* 3417 */ 0x0050, 0x0048, + /* 3419 */ 0x0070, 0x002E, 0x006D, 0x002E, + /* 3423 */ 0x0050, 0x0050, 0x004D, + /* 3426 */ 0x0050, 0x0052, + /* 3428 */ 0x0073, 0x0072, + /* 3430 */ 0x0053, 0x0076, + /* 3432 */ 0x0057, 0x0062, + /* 3434 */ 0x0056, 0x2215, 0x006D, + /* 3437 */ 0x0041, 0x2215, 0x006D, + /* 3440 */ 0x0031, 0x65E5, + /* 3442 */ 0x0032, 0x65E5, + /* 3444 */ 0x0033, 0x65E5, + /* 3446 */ 0x0034, 0x65E5, + /* 3448 */ 0x0035, 0x65E5, + /* 3450 */ 0x0036, 0x65E5, + /* 3452 */ 0x0037, 0x65E5, + /* 3454 */ 0x0038, 0x65E5, + /* 3456 */ 0x0039, 0x65E5, + /* 3458 */ 0x0031, 0x0030, 0x65E5, + /* 3461 */ 0x0031, 0x0031, 0x65E5, + /* 3464 */ 0x0031, 0x0032, 0x65E5, + /* 3467 */ 0x0031, 0x0033, 0x65E5, + /* 3470 */ 0x0031, 0x0034, 0x65E5, + /* 3473 */ 0x0031, 0x0035, 0x65E5, + /* 3476 */ 0x0031, 0x0036, 0x65E5, + /* 3479 */ 0x0031, 0x0037, 0x65E5, + /* 3482 */ 0x0031, 0x0038, 0x65E5, + /* 3485 */ 0x0031, 0x0039, 0x65E5, + /* 3488 */ 0x0032, 0x0030, 0x65E5, + /* 3491 */ 0x0032, 0x0031, 0x65E5, + /* 3494 */ 0x0032, 0x0032, 0x65E5, + /* 3497 */ 0x0032, 0x0033, 0x65E5, + /* 3500 */ 0x0032, 0x0034, 0x65E5, + /* 3503 */ 0x0032, 0x0035, 0x65E5, + /* 3506 */ 0x0032, 0x0036, 0x65E5, + /* 3509 */ 0x0032, 0x0037, 0x65E5, + /* 3512 */ 0x0032, 0x0038, 0x65E5, + /* 3515 */ 0x0032, 0x0039, 0x65E5, + /* 3518 */ 0x0033, 0x0030, 0x65E5, + /* 3521 */ 0x0033, 0x0031, 0x65E5, + /* 3524 */ 0x0067, 0x0061, 0x006C, + /* 3527 */ 0x242EE, + /* 3528 */ 0x2284A, + /* 3529 */ 0x22844, + /* 3530 */ 0x233D5, + /* 3531 */ 0x25249, + /* 3532 */ 0x25CD0, + /* 3533 */ 0x27ED3, + /* 3534 */ 0x0066, 0x0066, + /* 3536 */ 0x0066, 0x0069, + /* 3538 */ 0x0066, 0x006C, + /* 3540 */ 0x0066, 0x0066, 0x0069, + /* 3543 */ 0x0066, 0x0066, 0x006C, + /* 3546 */ 0x017F, 0x0074, + /* 3548 */ 0x0073, 0x0074, + /* 3550 */ 0x0574, 0x0576, + /* 3552 */ 0x0574, 0x0565, + /* 3554 */ 0x0574, 0x056B, + /* 3556 */ 0x057E, 0x0576, + /* 3558 */ 0x0574, 0x056D, + /* 3560 */ 0x05D9, 0x05B4, + /* 3562 */ 0x05F2, 0x05B7, + /* 3564 */ 0x05E9, 0x05C1, + /* 3566 */ 0x05E9, 0x05C2, + /* 3568 */ 0xFB49, 0x05C1, + /* 3570 */ 0xFB49, 0x05C2, + /* 3572 */ 0x05D0, 0x05B7, + /* 3574 */ 0x05D0, 0x05B8, + /* 3576 */ 0x05D0, 0x05BC, + /* 3578 */ 0x05D1, 0x05BC, + /* 3580 */ 0x05D2, 0x05BC, + /* 3582 */ 0x05D3, 0x05BC, + /* 3584 */ 0x05D4, 0x05BC, + /* 3586 */ 0x05D5, 0x05BC, + /* 3588 */ 0x05D6, 0x05BC, + /* 3590 */ 0x05D8, 0x05BC, + /* 3592 */ 0x05D9, 0x05BC, + /* 3594 */ 0x05DA, 0x05BC, + /* 3596 */ 0x05DB, 0x05BC, + /* 3598 */ 0x05DC, 0x05BC, + /* 3600 */ 0x05DE, 0x05BC, + /* 3602 */ 0x05E0, 0x05BC, + /* 3604 */ 0x05E1, 0x05BC, + /* 3606 */ 0x05E3, 0x05BC, + /* 3608 */ 0x05E4, 0x05BC, + /* 3610 */ 0x05E6, 0x05BC, + /* 3612 */ 0x05E7, 0x05BC, + /* 3614 */ 0x05E8, 0x05BC, + /* 3616 */ 0x05E9, 0x05BC, + /* 3618 */ 0x05EA, 0x05BC, + /* 3620 */ 0x05D5, 0x05B9, + /* 3622 */ 0x05D1, 0x05BF, + /* 3624 */ 0x05DB, 0x05BF, + /* 3626 */ 0x05E4, 0x05BF, + /* 3628 */ 0x05D0, 0x05DC, + /* 3630 */ 0x0626, 0x0627, + /* 3632 */ 0x0626, 0x0627, + /* 3634 */ 0x0626, 0x06D5, + /* 3636 */ 0x0626, 0x06D5, + /* 3638 */ 0x0626, 0x0648, + /* 3640 */ 0x0626, 0x0648, + /* 3642 */ 0x0626, 0x06C7, + /* 3644 */ 0x0626, 0x06C7, + /* 3646 */ 0x0626, 0x06C6, + /* 3648 */ 0x0626, 0x06C6, + /* 3650 */ 0x0626, 0x06C8, + /* 3652 */ 0x0626, 0x06C8, + /* 3654 */ 0x0626, 0x06D0, + /* 3656 */ 0x0626, 0x06D0, + /* 3658 */ 0x0626, 0x06D0, + /* 3660 */ 0x0626, 0x0649, + /* 3662 */ 0x0626, 0x0649, + /* 3664 */ 0x0626, 0x0649, + /* 3666 */ 0x0626, 0x062C, + /* 3668 */ 0x0626, 0x062D, + /* 3670 */ 0x0626, 0x0645, + /* 3672 */ 0x0626, 0x0649, + /* 3674 */ 0x0626, 0x064A, + /* 3676 */ 0x0628, 0x062C, + /* 3678 */ 0x0628, 0x062D, + /* 3680 */ 0x0628, 0x062E, + /* 3682 */ 0x0628, 0x0645, + /* 3684 */ 0x0628, 0x0649, + /* 3686 */ 0x0628, 0x064A, + /* 3688 */ 0x062A, 0x062C, + /* 3690 */ 0x062A, 0x062D, + /* 3692 */ 0x062A, 0x062E, + /* 3694 */ 0x062A, 0x0645, + /* 3696 */ 0x062A, 0x0649, + /* 3698 */ 0x062A, 0x064A, + /* 3700 */ 0x062B, 0x062C, + /* 3702 */ 0x062B, 0x0645, + /* 3704 */ 0x062B, 0x0649, + /* 3706 */ 0x062B, 0x064A, + /* 3708 */ 0x062C, 0x062D, + /* 3710 */ 0x062C, 0x0645, + /* 3712 */ 0x062D, 0x062C, + /* 3714 */ 0x062D, 0x0645, + /* 3716 */ 0x062E, 0x062C, + /* 3718 */ 0x062E, 0x062D, + /* 3720 */ 0x062E, 0x0645, + /* 3722 */ 0x0633, 0x062C, + /* 3724 */ 0x0633, 0x062D, + /* 3726 */ 0x0633, 0x062E, + /* 3728 */ 0x0633, 0x0645, + /* 3730 */ 0x0635, 0x062D, + /* 3732 */ 0x0635, 0x0645, + /* 3734 */ 0x0636, 0x062C, + /* 3736 */ 0x0636, 0x062D, + /* 3738 */ 0x0636, 0x062E, + /* 3740 */ 0x0636, 0x0645, + /* 3742 */ 0x0637, 0x062D, + /* 3744 */ 0x0637, 0x0645, + /* 3746 */ 0x0638, 0x0645, + /* 3748 */ 0x0639, 0x062C, + /* 3750 */ 0x0639, 0x0645, + /* 3752 */ 0x063A, 0x062C, + /* 3754 */ 0x063A, 0x0645, + /* 3756 */ 0x0641, 0x062C, + /* 3758 */ 0x0641, 0x062D, + /* 3760 */ 0x0641, 0x062E, + /* 3762 */ 0x0641, 0x0645, + /* 3764 */ 0x0641, 0x0649, + /* 3766 */ 0x0641, 0x064A, + /* 3768 */ 0x0642, 0x062D, + /* 3770 */ 0x0642, 0x0645, + /* 3772 */ 0x0642, 0x0649, + /* 3774 */ 0x0642, 0x064A, + /* 3776 */ 0x0643, 0x0627, + /* 3778 */ 0x0643, 0x062C, + /* 3780 */ 0x0643, 0x062D, + /* 3782 */ 0x0643, 0x062E, + /* 3784 */ 0x0643, 0x0644, + /* 3786 */ 0x0643, 0x0645, + /* 3788 */ 0x0643, 0x0649, + /* 3790 */ 0x0643, 0x064A, + /* 3792 */ 0x0644, 0x062C, + /* 3794 */ 0x0644, 0x062D, + /* 3796 */ 0x0644, 0x062E, + /* 3798 */ 0x0644, 0x0645, + /* 3800 */ 0x0644, 0x0649, + /* 3802 */ 0x0644, 0x064A, + /* 3804 */ 0x0645, 0x062C, + /* 3806 */ 0x0645, 0x062D, + /* 3808 */ 0x0645, 0x062E, + /* 3810 */ 0x0645, 0x0645, + /* 3812 */ 0x0645, 0x0649, + /* 3814 */ 0x0645, 0x064A, + /* 3816 */ 0x0646, 0x062C, + /* 3818 */ 0x0646, 0x062D, + /* 3820 */ 0x0646, 0x062E, + /* 3822 */ 0x0646, 0x0645, + /* 3824 */ 0x0646, 0x0649, + /* 3826 */ 0x0646, 0x064A, + /* 3828 */ 0x0647, 0x062C, + /* 3830 */ 0x0647, 0x0645, + /* 3832 */ 0x0647, 0x0649, + /* 3834 */ 0x0647, 0x064A, + /* 3836 */ 0x064A, 0x062C, + /* 3838 */ 0x064A, 0x062D, + /* 3840 */ 0x064A, 0x062E, + /* 3842 */ 0x064A, 0x0645, + /* 3844 */ 0x064A, 0x0649, + /* 3846 */ 0x064A, 0x064A, + /* 3848 */ 0x0630, 0x0670, + /* 3850 */ 0x0631, 0x0670, + /* 3852 */ 0x0649, 0x0670, + /* 3854 */ 0x0020, 0x064C, 0x0651, + /* 3857 */ 0x0020, 0x064D, 0x0651, + /* 3860 */ 0x0020, 0x064E, 0x0651, + /* 3863 */ 0x0020, 0x064F, 0x0651, + /* 3866 */ 0x0020, 0x0650, 0x0651, + /* 3869 */ 0x0020, 0x0651, 0x0670, + /* 3872 */ 0x0626, 0x0631, + /* 3874 */ 0x0626, 0x0632, + /* 3876 */ 0x0626, 0x0645, + /* 3878 */ 0x0626, 0x0646, + /* 3880 */ 0x0626, 0x0649, + /* 3882 */ 0x0626, 0x064A, + /* 3884 */ 0x0628, 0x0631, + /* 3886 */ 0x0628, 0x0632, + /* 3888 */ 0x0628, 0x0645, + /* 3890 */ 0x0628, 0x0646, + /* 3892 */ 0x0628, 0x0649, + /* 3894 */ 0x0628, 0x064A, + /* 3896 */ 0x062A, 0x0631, + /* 3898 */ 0x062A, 0x0632, + /* 3900 */ 0x062A, 0x0645, + /* 3902 */ 0x062A, 0x0646, + /* 3904 */ 0x062A, 0x0649, + /* 3906 */ 0x062A, 0x064A, + /* 3908 */ 0x062B, 0x0631, + /* 3910 */ 0x062B, 0x0632, + /* 3912 */ 0x062B, 0x0645, + /* 3914 */ 0x062B, 0x0646, + /* 3916 */ 0x062B, 0x0649, + /* 3918 */ 0x062B, 0x064A, + /* 3920 */ 0x0641, 0x0649, + /* 3922 */ 0x0641, 0x064A, + /* 3924 */ 0x0642, 0x0649, + /* 3926 */ 0x0642, 0x064A, + /* 3928 */ 0x0643, 0x0627, + /* 3930 */ 0x0643, 0x0644, + /* 3932 */ 0x0643, 0x0645, + /* 3934 */ 0x0643, 0x0649, + /* 3936 */ 0x0643, 0x064A, + /* 3938 */ 0x0644, 0x0645, + /* 3940 */ 0x0644, 0x0649, + /* 3942 */ 0x0644, 0x064A, + /* 3944 */ 0x0645, 0x0627, + /* 3946 */ 0x0645, 0x0645, + /* 3948 */ 0x0646, 0x0631, + /* 3950 */ 0x0646, 0x0632, + /* 3952 */ 0x0646, 0x0645, + /* 3954 */ 0x0646, 0x0646, + /* 3956 */ 0x0646, 0x0649, + /* 3958 */ 0x0646, 0x064A, + /* 3960 */ 0x0649, 0x0670, + /* 3962 */ 0x064A, 0x0631, + /* 3964 */ 0x064A, 0x0632, + /* 3966 */ 0x064A, 0x0645, + /* 3968 */ 0x064A, 0x0646, + /* 3970 */ 0x064A, 0x0649, + /* 3972 */ 0x064A, 0x064A, + /* 3974 */ 0x0626, 0x062C, + /* 3976 */ 0x0626, 0x062D, + /* 3978 */ 0x0626, 0x062E, + /* 3980 */ 0x0626, 0x0645, + /* 3982 */ 0x0626, 0x0647, + /* 3984 */ 0x0628, 0x062C, + /* 3986 */ 0x0628, 0x062D, + /* 3988 */ 0x0628, 0x062E, + /* 3990 */ 0x0628, 0x0645, + /* 3992 */ 0x0628, 0x0647, + /* 3994 */ 0x062A, 0x062C, + /* 3996 */ 0x062A, 0x062D, + /* 3998 */ 0x062A, 0x062E, + /* 4000 */ 0x062A, 0x0645, + /* 4002 */ 0x062A, 0x0647, + /* 4004 */ 0x062B, 0x0645, + /* 4006 */ 0x062C, 0x062D, + /* 4008 */ 0x062C, 0x0645, + /* 4010 */ 0x062D, 0x062C, + /* 4012 */ 0x062D, 0x0645, + /* 4014 */ 0x062E, 0x062C, + /* 4016 */ 0x062E, 0x0645, + /* 4018 */ 0x0633, 0x062C, + /* 4020 */ 0x0633, 0x062D, + /* 4022 */ 0x0633, 0x062E, + /* 4024 */ 0x0633, 0x0645, + /* 4026 */ 0x0635, 0x062D, + /* 4028 */ 0x0635, 0x062E, + /* 4030 */ 0x0635, 0x0645, + /* 4032 */ 0x0636, 0x062C, + /* 4034 */ 0x0636, 0x062D, + /* 4036 */ 0x0636, 0x062E, + /* 4038 */ 0x0636, 0x0645, + /* 4040 */ 0x0637, 0x062D, + /* 4042 */ 0x0638, 0x0645, + /* 4044 */ 0x0639, 0x062C, + /* 4046 */ 0x0639, 0x0645, + /* 4048 */ 0x063A, 0x062C, + /* 4050 */ 0x063A, 0x0645, + /* 4052 */ 0x0641, 0x062C, + /* 4054 */ 0x0641, 0x062D, + /* 4056 */ 0x0641, 0x062E, + /* 4058 */ 0x0641, 0x0645, + /* 4060 */ 0x0642, 0x062D, + /* 4062 */ 0x0642, 0x0645, + /* 4064 */ 0x0643, 0x062C, + /* 4066 */ 0x0643, 0x062D, + /* 4068 */ 0x0643, 0x062E, + /* 4070 */ 0x0643, 0x0644, + /* 4072 */ 0x0643, 0x0645, + /* 4074 */ 0x0644, 0x062C, + /* 4076 */ 0x0644, 0x062D, + /* 4078 */ 0x0644, 0x062E, + /* 4080 */ 0x0644, 0x0645, + /* 4082 */ 0x0644, 0x0647, + /* 4084 */ 0x0645, 0x062C, + /* 4086 */ 0x0645, 0x062D, + /* 4088 */ 0x0645, 0x062E, + /* 4090 */ 0x0645, 0x0645, + /* 4092 */ 0x0646, 0x062C, + /* 4094 */ 0x0646, 0x062D, + /* 4096 */ 0x0646, 0x062E, + /* 4098 */ 0x0646, 0x0645, + /* 4100 */ 0x0646, 0x0647, + /* 4102 */ 0x0647, 0x062C, + /* 4104 */ 0x0647, 0x0645, + /* 4106 */ 0x0647, 0x0670, + /* 4108 */ 0x064A, 0x062C, + /* 4110 */ 0x064A, 0x062D, + /* 4112 */ 0x064A, 0x062E, + /* 4114 */ 0x064A, 0x0645, + /* 4116 */ 0x064A, 0x0647, + /* 4118 */ 0x0626, 0x0645, + /* 4120 */ 0x0626, 0x0647, + /* 4122 */ 0x0628, 0x0645, + /* 4124 */ 0x0628, 0x0647, + /* 4126 */ 0x062A, 0x0645, + /* 4128 */ 0x062A, 0x0647, + /* 4130 */ 0x062B, 0x0645, + /* 4132 */ 0x062B, 0x0647, + /* 4134 */ 0x0633, 0x0645, + /* 4136 */ 0x0633, 0x0647, + /* 4138 */ 0x0634, 0x0645, + /* 4140 */ 0x0634, 0x0647, + /* 4142 */ 0x0643, 0x0644, + /* 4144 */ 0x0643, 0x0645, + /* 4146 */ 0x0644, 0x0645, + /* 4148 */ 0x0646, 0x0645, + /* 4150 */ 0x0646, 0x0647, + /* 4152 */ 0x064A, 0x0645, + /* 4154 */ 0x064A, 0x0647, + /* 4156 */ 0x0640, 0x064E, 0x0651, + /* 4159 */ 0x0640, 0x064F, 0x0651, + /* 4162 */ 0x0640, 0x0650, 0x0651, + /* 4165 */ 0x0637, 0x0649, + /* 4167 */ 0x0637, 0x064A, + /* 4169 */ 0x0639, 0x0649, + /* 4171 */ 0x0639, 0x064A, + /* 4173 */ 0x063A, 0x0649, + /* 4175 */ 0x063A, 0x064A, + /* 4177 */ 0x0633, 0x0649, + /* 4179 */ 0x0633, 0x064A, + /* 4181 */ 0x0634, 0x0649, + /* 4183 */ 0x0634, 0x064A, + /* 4185 */ 0x062D, 0x0649, + /* 4187 */ 0x062D, 0x064A, + /* 4189 */ 0x062C, 0x0649, + /* 4191 */ 0x062C, 0x064A, + /* 4193 */ 0x062E, 0x0649, + /* 4195 */ 0x062E, 0x064A, + /* 4197 */ 0x0635, 0x0649, + /* 4199 */ 0x0635, 0x064A, + /* 4201 */ 0x0636, 0x0649, + /* 4203 */ 0x0636, 0x064A, + /* 4205 */ 0x0634, 0x062C, + /* 4207 */ 0x0634, 0x062D, + /* 4209 */ 0x0634, 0x062E, + /* 4211 */ 0x0634, 0x0645, + /* 4213 */ 0x0634, 0x0631, + /* 4215 */ 0x0633, 0x0631, + /* 4217 */ 0x0635, 0x0631, + /* 4219 */ 0x0636, 0x0631, + /* 4221 */ 0x0637, 0x0649, + /* 4223 */ 0x0637, 0x064A, + /* 4225 */ 0x0639, 0x0649, + /* 4227 */ 0x0639, 0x064A, + /* 4229 */ 0x063A, 0x0649, + /* 4231 */ 0x063A, 0x064A, + /* 4233 */ 0x0633, 0x0649, + /* 4235 */ 0x0633, 0x064A, + /* 4237 */ 0x0634, 0x0649, + /* 4239 */ 0x0634, 0x064A, + /* 4241 */ 0x062D, 0x0649, + /* 4243 */ 0x062D, 0x064A, + /* 4245 */ 0x062C, 0x0649, + /* 4247 */ 0x062C, 0x064A, + /* 4249 */ 0x062E, 0x0649, + /* 4251 */ 0x062E, 0x064A, + /* 4253 */ 0x0635, 0x0649, + /* 4255 */ 0x0635, 0x064A, + /* 4257 */ 0x0636, 0x0649, + /* 4259 */ 0x0636, 0x064A, + /* 4261 */ 0x0634, 0x062C, + /* 4263 */ 0x0634, 0x062D, + /* 4265 */ 0x0634, 0x062E, + /* 4267 */ 0x0634, 0x0645, + /* 4269 */ 0x0634, 0x0631, + /* 4271 */ 0x0633, 0x0631, + /* 4273 */ 0x0635, 0x0631, + /* 4275 */ 0x0636, 0x0631, + /* 4277 */ 0x0634, 0x062C, + /* 4279 */ 0x0634, 0x062D, + /* 4281 */ 0x0634, 0x062E, + /* 4283 */ 0x0634, 0x0645, + /* 4285 */ 0x0633, 0x0647, + /* 4287 */ 0x0634, 0x0647, + /* 4289 */ 0x0637, 0x0645, + /* 4291 */ 0x0633, 0x062C, + /* 4293 */ 0x0633, 0x062D, + /* 4295 */ 0x0633, 0x062E, + /* 4297 */ 0x0634, 0x062C, + /* 4299 */ 0x0634, 0x062D, + /* 4301 */ 0x0634, 0x062E, + /* 4303 */ 0x0637, 0x0645, + /* 4305 */ 0x0638, 0x0645, + /* 4307 */ 0x0627, 0x064B, + /* 4309 */ 0x0627, 0x064B, + /* 4311 */ 0x062A, 0x062C, 0x0645, + /* 4314 */ 0x062A, 0x062D, 0x062C, + /* 4317 */ 0x062A, 0x062D, 0x062C, + /* 4320 */ 0x062A, 0x062D, 0x0645, + /* 4323 */ 0x062A, 0x062E, 0x0645, + /* 4326 */ 0x062A, 0x0645, 0x062C, + /* 4329 */ 0x062A, 0x0645, 0x062D, + /* 4332 */ 0x062A, 0x0645, 0x062E, + /* 4335 */ 0x062C, 0x0645, 0x062D, + /* 4338 */ 0x062C, 0x0645, 0x062D, + /* 4341 */ 0x062D, 0x0645, 0x064A, + /* 4344 */ 0x062D, 0x0645, 0x0649, + /* 4347 */ 0x0633, 0x062D, 0x062C, + /* 4350 */ 0x0633, 0x062C, 0x062D, + /* 4353 */ 0x0633, 0x062C, 0x0649, + /* 4356 */ 0x0633, 0x0645, 0x062D, + /* 4359 */ 0x0633, 0x0645, 0x062D, + /* 4362 */ 0x0633, 0x0645, 0x062C, + /* 4365 */ 0x0633, 0x0645, 0x0645, + /* 4368 */ 0x0633, 0x0645, 0x0645, + /* 4371 */ 0x0635, 0x062D, 0x062D, + /* 4374 */ 0x0635, 0x062D, 0x062D, + /* 4377 */ 0x0635, 0x0645, 0x0645, + /* 4380 */ 0x0634, 0x062D, 0x0645, + /* 4383 */ 0x0634, 0x062D, 0x0645, + /* 4386 */ 0x0634, 0x062C, 0x064A, + /* 4389 */ 0x0634, 0x0645, 0x062E, + /* 4392 */ 0x0634, 0x0645, 0x062E, + /* 4395 */ 0x0634, 0x0645, 0x0645, + /* 4398 */ 0x0634, 0x0645, 0x0645, + /* 4401 */ 0x0636, 0x062D, 0x0649, + /* 4404 */ 0x0636, 0x062E, 0x0645, + /* 4407 */ 0x0636, 0x062E, 0x0645, + /* 4410 */ 0x0637, 0x0645, 0x062D, + /* 4413 */ 0x0637, 0x0645, 0x062D, + /* 4416 */ 0x0637, 0x0645, 0x0645, + /* 4419 */ 0x0637, 0x0645, 0x064A, + /* 4422 */ 0x0639, 0x062C, 0x0645, + /* 4425 */ 0x0639, 0x0645, 0x0645, + /* 4428 */ 0x0639, 0x0645, 0x0645, + /* 4431 */ 0x0639, 0x0645, 0x0649, + /* 4434 */ 0x063A, 0x0645, 0x0645, + /* 4437 */ 0x063A, 0x0645, 0x064A, + /* 4440 */ 0x063A, 0x0645, 0x0649, + /* 4443 */ 0x0641, 0x062E, 0x0645, + /* 4446 */ 0x0641, 0x062E, 0x0645, + /* 4449 */ 0x0642, 0x0645, 0x062D, + /* 4452 */ 0x0642, 0x0645, 0x0645, + /* 4455 */ 0x0644, 0x062D, 0x0645, + /* 4458 */ 0x0644, 0x062D, 0x064A, + /* 4461 */ 0x0644, 0x062D, 0x0649, + /* 4464 */ 0x0644, 0x062C, 0x062C, + /* 4467 */ 0x0644, 0x062C, 0x062C, + /* 4470 */ 0x0644, 0x062E, 0x0645, + /* 4473 */ 0x0644, 0x062E, 0x0645, + /* 4476 */ 0x0644, 0x0645, 0x062D, + /* 4479 */ 0x0644, 0x0645, 0x062D, + /* 4482 */ 0x0645, 0x062D, 0x062C, + /* 4485 */ 0x0645, 0x062D, 0x0645, + /* 4488 */ 0x0645, 0x062D, 0x064A, + /* 4491 */ 0x0645, 0x062C, 0x062D, + /* 4494 */ 0x0645, 0x062C, 0x0645, + /* 4497 */ 0x0645, 0x062E, 0x062C, + /* 4500 */ 0x0645, 0x062E, 0x0645, + /* 4503 */ 0x0645, 0x062C, 0x062E, + /* 4506 */ 0x0647, 0x0645, 0x062C, + /* 4509 */ 0x0647, 0x0645, 0x0645, + /* 4512 */ 0x0646, 0x062D, 0x0645, + /* 4515 */ 0x0646, 0x062D, 0x0649, + /* 4518 */ 0x0646, 0x062C, 0x0645, + /* 4521 */ 0x0646, 0x062C, 0x0645, + /* 4524 */ 0x0646, 0x062C, 0x0649, + /* 4527 */ 0x0646, 0x0645, 0x064A, + /* 4530 */ 0x0646, 0x0645, 0x0649, + /* 4533 */ 0x064A, 0x0645, 0x0645, + /* 4536 */ 0x064A, 0x0645, 0x0645, + /* 4539 */ 0x0628, 0x062E, 0x064A, + /* 4542 */ 0x062A, 0x062C, 0x064A, + /* 4545 */ 0x062A, 0x062C, 0x0649, + /* 4548 */ 0x062A, 0x062E, 0x064A, + /* 4551 */ 0x062A, 0x062E, 0x0649, + /* 4554 */ 0x062A, 0x0645, 0x064A, + /* 4557 */ 0x062A, 0x0645, 0x0649, + /* 4560 */ 0x062C, 0x0645, 0x064A, + /* 4563 */ 0x062C, 0x062D, 0x0649, + /* 4566 */ 0x062C, 0x0645, 0x0649, + /* 4569 */ 0x0633, 0x062E, 0x0649, + /* 4572 */ 0x0635, 0x062D, 0x064A, + /* 4575 */ 0x0634, 0x062D, 0x064A, + /* 4578 */ 0x0636, 0x062D, 0x064A, + /* 4581 */ 0x0644, 0x062C, 0x064A, + /* 4584 */ 0x0644, 0x0645, 0x064A, + /* 4587 */ 0x064A, 0x062D, 0x064A, + /* 4590 */ 0x064A, 0x062C, 0x064A, + /* 4593 */ 0x064A, 0x0645, 0x064A, + /* 4596 */ 0x0645, 0x0645, 0x064A, + /* 4599 */ 0x0642, 0x0645, 0x064A, + /* 4602 */ 0x0646, 0x062D, 0x064A, + /* 4605 */ 0x0642, 0x0645, 0x062D, + /* 4608 */ 0x0644, 0x062D, 0x0645, + /* 4611 */ 0x0639, 0x0645, 0x064A, + /* 4614 */ 0x0643, 0x0645, 0x064A, + /* 4617 */ 0x0646, 0x062C, 0x062D, + /* 4620 */ 0x0645, 0x062E, 0x064A, + /* 4623 */ 0x0644, 0x062C, 0x0645, + /* 4626 */ 0x0643, 0x0645, 0x0645, + /* 4629 */ 0x0644, 0x062C, 0x0645, + /* 4632 */ 0x0646, 0x062C, 0x062D, + /* 4635 */ 0x062C, 0x062D, 0x064A, + /* 4638 */ 0x062D, 0x062C, 0x064A, + /* 4641 */ 0x0645, 0x062C, 0x064A, + /* 4644 */ 0x0641, 0x0645, 0x064A, + /* 4647 */ 0x0628, 0x062D, 0x064A, + /* 4650 */ 0x0643, 0x0645, 0x0645, + /* 4653 */ 0x0639, 0x062C, 0x0645, + /* 4656 */ 0x0635, 0x0645, 0x0645, + /* 4659 */ 0x0633, 0x062E, 0x064A, + /* 4662 */ 0x0646, 0x062C, 0x064A, + /* 4665 */ 0x0635, 0x0644, 0x06D2, + /* 4668 */ 0x0642, 0x0644, 0x06D2, + /* 4671 */ 0x0627, 0x0644, 0x0644, 0x0647, + /* 4675 */ 0x0627, 0x0643, 0x0628, 0x0631, + /* 4679 */ 0x0645, 0x062D, 0x0645, 0x062F, + /* 4683 */ 0x0635, 0x0644, 0x0639, 0x0645, + /* 4687 */ 0x0631, 0x0633, 0x0648, 0x0644, + /* 4691 */ 0x0639, 0x0644, 0x064A, 0x0647, + /* 4695 */ 0x0648, 0x0633, 0x0644, 0x0645, + /* 4699 */ 0x0635, 0x0644, 0x0649, + /* 4702 */ 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645, + /* 4720 */ 0x062C, 0x0644, 0x0020, 0x062C, 0x0644, 0x0627, 0x0644, 0x0647, + /* 4728 */ 0x0631, 0x06CC, 0x0627, 0x0644, + /* 4732 */ 0x0020, 0x064B, + /* 4734 */ 0x0640, 0x064B, + /* 4736 */ 0x0020, 0x064C, + /* 4738 */ 0x0020, 0x064D, + /* 4740 */ 0x0020, 0x064E, + /* 4742 */ 0x0640, 0x064E, + /* 4744 */ 0x0020, 0x064F, + /* 4746 */ 0x0640, 0x064F, + /* 4748 */ 0x0020, 0x0650, + /* 4750 */ 0x0640, 0x0650, + /* 4752 */ 0x0020, 0x0651, + /* 4754 */ 0x0640, 0x0651, + /* 4756 */ 0x0020, 0x0652, + /* 4758 */ 0x0640, 0x0652, + /* 4760 */ 0x0644, 0x0622, + /* 4762 */ 0x0644, 0x0622, + /* 4764 */ 0x0644, 0x0623, + /* 4766 */ 0x0644, 0x0623, + /* 4768 */ 0x0644, 0x0625, + /* 4770 */ 0x0644, 0x0625, + /* 4772 */ 0x0644, 0x0627, + /* 4774 */ 0x0644, 0x0627, + /* 4776 */ 0x1DF04, + /* 4777 */ 0x1DF05, + /* 4778 */ 0x1DF06, + /* 4779 */ 0x1DF08, + /* 4780 */ 0x1DF0A, + /* 4781 */ 0x1DF1E, + /* 4782 */ 0x11099, 0x110BA, + /* 4784 */ 0x1109B, 0x110BA, + /* 4786 */ 0x110A5, 0x110BA, + /* 4788 */ 0x11131, 0x11127, + /* 4790 */ 0x11132, 0x11127, + /* 4792 */ 0x11347, 0x1133E, + /* 4794 */ 0x11347, 0x11357, + /* 4796 */ 0x114B9, 0x114BA, + /* 4798 */ 0x114B9, 0x114B0, + /* 4800 */ 0x114B9, 0x114BD, + /* 4802 */ 0x115B8, 0x115AF, + /* 4804 */ 0x115B9, 0x115AF, + /* 4806 */ 0x11935, 0x11930, + /* 4808 */ 0x1D157, 0x1D165, + /* 4810 */ 0x1D158, 0x1D165, + /* 4812 */ 0x1D15F, 0x1D16E, + /* 4814 */ 0x1D15F, 0x1D16F, + /* 4816 */ 0x1D15F, 0x1D170, + /* 4818 */ 0x1D15F, 0x1D171, + /* 4820 */ 0x1D15F, 0x1D172, + /* 4822 */ 0x1D1B9, 0x1D165, + /* 4824 */ 0x1D1BA, 0x1D165, + /* 4826 */ 0x1D1BB, 0x1D16E, + /* 4828 */ 0x1D1BC, 0x1D16E, + /* 4830 */ 0x1D1BB, 0x1D16F, + /* 4832 */ 0x1D1BC, 0x1D16F, + /* 4834 */ 0x0030, 0x002E, + /* 4836 */ 0x0030, 0x002C, + /* 4838 */ 0x0031, 0x002C, + /* 4840 */ 0x0032, 0x002C, + /* 4842 */ 0x0033, 0x002C, + /* 4844 */ 0x0034, 0x002C, + /* 4846 */ 0x0035, 0x002C, + /* 4848 */ 0x0036, 0x002C, + /* 4850 */ 0x0037, 0x002C, + /* 4852 */ 0x0038, 0x002C, + /* 4854 */ 0x0039, 0x002C, + /* 4856 */ 0x0028, 0x0041, 0x0029, + /* 4859 */ 0x0028, 0x0042, 0x0029, + /* 4862 */ 0x0028, 0x0043, 0x0029, + /* 4865 */ 0x0028, 0x0044, 0x0029, + /* 4868 */ 0x0028, 0x0045, 0x0029, + /* 4871 */ 0x0028, 0x0046, 0x0029, + /* 4874 */ 0x0028, 0x0047, 0x0029, + /* 4877 */ 0x0028, 0x0048, 0x0029, + /* 4880 */ 0x0028, 0x0049, 0x0029, + /* 4883 */ 0x0028, 0x004A, 0x0029, + /* 4886 */ 0x0028, 0x004B, 0x0029, + /* 4889 */ 0x0028, 0x004C, 0x0029, + /* 4892 */ 0x0028, 0x004D, 0x0029, + /* 4895 */ 0x0028, 0x004E, 0x0029, + /* 4898 */ 0x0028, 0x004F, 0x0029, + /* 4901 */ 0x0028, 0x0050, 0x0029, + /* 4904 */ 0x0028, 0x0051, 0x0029, + /* 4907 */ 0x0028, 0x0052, 0x0029, + /* 4910 */ 0x0028, 0x0053, 0x0029, + /* 4913 */ 0x0028, 0x0054, 0x0029, + /* 4916 */ 0x0028, 0x0055, 0x0029, + /* 4919 */ 0x0028, 0x0056, 0x0029, + /* 4922 */ 0x0028, 0x0057, 0x0029, + /* 4925 */ 0x0028, 0x0058, 0x0029, + /* 4928 */ 0x0028, 0x0059, 0x0029, + /* 4931 */ 0x0028, 0x005A, 0x0029, + /* 4934 */ 0x3014, 0x0053, 0x3015, + /* 4937 */ 0x0043, 0x0044, + /* 4939 */ 0x0057, 0x005A, + /* 4941 */ 0x0048, 0x0056, + /* 4943 */ 0x004D, 0x0056, + /* 4945 */ 0x0053, 0x0044, + /* 4947 */ 0x0053, 0x0053, + /* 4949 */ 0x0050, 0x0050, 0x0056, + /* 4952 */ 0x0057, 0x0043, + /* 4954 */ 0x004D, 0x0043, + /* 4956 */ 0x004D, 0x0044, + /* 4958 */ 0x004D, 0x0052, + /* 4960 */ 0x0044, 0x004A, + /* 4962 */ 0x307B, 0x304B, + /* 4964 */ 0x30B3, 0x30B3, + /* 4966 */ 0x3014, 0x672C, 0x3015, + /* 4969 */ 0x3014, 0x4E09, 0x3015, + /* 4972 */ 0x3014, 0x4E8C, 0x3015, + /* 4975 */ 0x3014, 0x5B89, 0x3015, + /* 4978 */ 0x3014, 0x70B9, 0x3015, + /* 4981 */ 0x3014, 0x6253, 0x3015, + /* 4984 */ 0x3014, 0x76D7, 0x3015, + /* 4987 */ 0x3014, 0x52DD, 0x3015, + /* 4990 */ 0x3014, 0x6557, 0x3015, + /* 4993 */ 0x20122, + /* 4994 */ 0x2063A, + /* 4995 */ 0x2051C, + /* 4996 */ 0x2054B, + /* 4997 */ 0x291DF, + /* 4998 */ 0x20A2C, + /* 4999 */ 0x20B63, + /* 5000 */ 0x214E4, + /* 5001 */ 0x216A8, + /* 5002 */ 0x216EA, + /* 5003 */ 0x219C8, + /* 5004 */ 0x21B18, + /* 5005 */ 0x21DE4, + /* 5006 */ 0x21DE6, + /* 5007 */ 0x22183, + /* 5008 */ 0x2A392, + /* 5009 */ 0x22331, + /* 5010 */ 0x22331, + /* 5011 */ 0x232B8, + /* 5012 */ 0x261DA, + /* 5013 */ 0x226D4, + /* 5014 */ 0x22B0C, + /* 5015 */ 0x22BF1, + /* 5016 */ 0x2300A, + /* 5017 */ 0x233C3, + /* 5018 */ 0x2346D, + /* 5019 */ 0x236A3, + /* 5020 */ 0x238A7, + /* 5021 */ 0x23A8D, + /* 5022 */ 0x21D0B, + /* 5023 */ 0x23AFA, + /* 5024 */ 0x23CBC, + /* 5025 */ 0x23D1E, + /* 5026 */ 0x23ED1, + /* 5027 */ 0x23F5E, + /* 5028 */ 0x23F8E, + /* 5029 */ 0x20525, + /* 5030 */ 0x24263, + /* 5031 */ 0x243AB, + /* 5032 */ 0x24608, + /* 5033 */ 0x24735, + /* 5034 */ 0x24814, + /* 5035 */ 0x24C36, + /* 5036 */ 0x24C92, + /* 5037 */ 0x2219F, + /* 5038 */ 0x24FA1, + /* 5039 */ 0x24FB8, + /* 5040 */ 0x25044, + /* 5041 */ 0x250F3, + /* 5042 */ 0x250F2, + /* 5043 */ 0x25119, + /* 5044 */ 0x25133, + /* 5045 */ 0x2541D, + /* 5046 */ 0x25626, + /* 5047 */ 0x2569A, + /* 5048 */ 0x256C5, + /* 5049 */ 0x2597C, + /* 5050 */ 0x25AA7, + /* 5051 */ 0x25AA7, + /* 5052 */ 0x25BAB, + /* 5053 */ 0x25C80, + /* 5054 */ 0x25F86, + /* 5055 */ 0x26228, + /* 5056 */ 0x26247, + /* 5057 */ 0x262D9, + /* 5058 */ 0x2633E, + /* 5059 */ 0x264DA, + /* 5060 */ 0x26523, + /* 5061 */ 0x265A8, + /* 5062 */ 0x2335F, + /* 5063 */ 0x267A7, + /* 5064 */ 0x267B5, + /* 5065 */ 0x23393, + /* 5066 */ 0x2339C, + /* 5067 */ 0x26B3C, + /* 5068 */ 0x26C36, + /* 5069 */ 0x26D6B, + /* 5070 */ 0x26CD5, + /* 5071 */ 0x273CA, + /* 5072 */ 0x26F2C, + /* 5073 */ 0x26FB1, + /* 5074 */ 0x270D2, + /* 5075 */ 0x27667, + /* 5076 */ 0x278AE, + /* 5077 */ 0x27966, + /* 5078 */ 0x27CA8, + /* 5079 */ 0x27F2F, + /* 5080 */ 0x20804, + /* 5081 */ 0x208DE, + /* 5082 */ 0x285D2, + /* 5083 */ 0x285ED, + /* 5084 */ 0x2872E, + /* 5085 */ 0x28BFA, + /* 5086 */ 0x28D77, + /* 5087 */ 0x29145, + /* 5088 */ 0x2921A, + /* 5089 */ 0x2940A, + /* 5090 */ 0x29496, + /* 5091 */ 0x295B6, + /* 5092 */ 0x29B30, + /* 5093 */ 0x2A0CE, + /* 5094 */ 0x2A105, + /* 5095 */ 0x2A20E, + /* 5096 */ 0x2A291, + /* 5097 */ 0x2A600 +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_normprops_table.h b/platform/dbops/binaries/postgres/include/server/common/unicode_normprops_table.h new file mode 100644 index 0000000000000000000000000000000000000000..7a13405525295f9e991f8c31cfe1a1cca5f9f366 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_normprops_table.h @@ -0,0 +1,7926 @@ +/* generated by src/common/unicode/generate-unicode_normprops_table.pl, do not edit */ + +#include "common/unicode_norm.h" + +/* + * Normalization quick check entry for codepoint. We use a bit field + * here to save space. + */ +typedef struct +{ + unsigned int codepoint:21; + signed int quickcheck:4; /* really UnicodeNormalizationQC */ +} pg_unicode_normprops; + +/* Typedef for hash function on quick check table */ +typedef int (*qc_hash_func) (const void *key); + +/* Information for quick check lookup with perfect hash function */ +typedef struct +{ + const pg_unicode_normprops *normprops; + qc_hash_func hash; + int num_normprops; +} pg_unicode_norminfo; + +static const pg_unicode_normprops UnicodeNormProps_NFC_QC[] = { + {0x0300, UNICODE_NORM_QC_MAYBE}, + {0x0301, UNICODE_NORM_QC_MAYBE}, + {0x0302, UNICODE_NORM_QC_MAYBE}, + {0x0303, UNICODE_NORM_QC_MAYBE}, + {0x0304, UNICODE_NORM_QC_MAYBE}, + {0x0306, UNICODE_NORM_QC_MAYBE}, + {0x0307, UNICODE_NORM_QC_MAYBE}, + {0x0308, UNICODE_NORM_QC_MAYBE}, + {0x0309, UNICODE_NORM_QC_MAYBE}, + {0x030A, UNICODE_NORM_QC_MAYBE}, + {0x030B, UNICODE_NORM_QC_MAYBE}, + {0x030C, UNICODE_NORM_QC_MAYBE}, + {0x030F, UNICODE_NORM_QC_MAYBE}, + {0x0311, UNICODE_NORM_QC_MAYBE}, + {0x0313, UNICODE_NORM_QC_MAYBE}, + {0x0314, UNICODE_NORM_QC_MAYBE}, + {0x031B, UNICODE_NORM_QC_MAYBE}, + {0x0323, UNICODE_NORM_QC_MAYBE}, + {0x0324, UNICODE_NORM_QC_MAYBE}, + {0x0325, UNICODE_NORM_QC_MAYBE}, + {0x0326, UNICODE_NORM_QC_MAYBE}, + {0x0327, UNICODE_NORM_QC_MAYBE}, + {0x0328, UNICODE_NORM_QC_MAYBE}, + {0x032D, UNICODE_NORM_QC_MAYBE}, + {0x032E, UNICODE_NORM_QC_MAYBE}, + {0x0330, UNICODE_NORM_QC_MAYBE}, + {0x0331, UNICODE_NORM_QC_MAYBE}, + {0x0338, UNICODE_NORM_QC_MAYBE}, + {0x0340, UNICODE_NORM_QC_NO}, + {0x0341, UNICODE_NORM_QC_NO}, + {0x0342, UNICODE_NORM_QC_MAYBE}, + {0x0343, UNICODE_NORM_QC_NO}, + {0x0344, UNICODE_NORM_QC_NO}, + {0x0345, UNICODE_NORM_QC_MAYBE}, + {0x0374, UNICODE_NORM_QC_NO}, + {0x037E, UNICODE_NORM_QC_NO}, + {0x0387, UNICODE_NORM_QC_NO}, + {0x0653, UNICODE_NORM_QC_MAYBE}, + {0x0654, UNICODE_NORM_QC_MAYBE}, + {0x0655, UNICODE_NORM_QC_MAYBE}, + {0x093C, UNICODE_NORM_QC_MAYBE}, + {0x0958, UNICODE_NORM_QC_NO}, + {0x0959, UNICODE_NORM_QC_NO}, + {0x095A, UNICODE_NORM_QC_NO}, + {0x095B, UNICODE_NORM_QC_NO}, + {0x095C, UNICODE_NORM_QC_NO}, + {0x095D, UNICODE_NORM_QC_NO}, + {0x095E, UNICODE_NORM_QC_NO}, + {0x095F, UNICODE_NORM_QC_NO}, + {0x09BE, UNICODE_NORM_QC_MAYBE}, + {0x09D7, UNICODE_NORM_QC_MAYBE}, + {0x09DC, UNICODE_NORM_QC_NO}, + {0x09DD, UNICODE_NORM_QC_NO}, + {0x09DF, UNICODE_NORM_QC_NO}, + {0x0A33, UNICODE_NORM_QC_NO}, + {0x0A36, UNICODE_NORM_QC_NO}, + {0x0A59, UNICODE_NORM_QC_NO}, + {0x0A5A, UNICODE_NORM_QC_NO}, + {0x0A5B, UNICODE_NORM_QC_NO}, + {0x0A5E, UNICODE_NORM_QC_NO}, + {0x0B3E, UNICODE_NORM_QC_MAYBE}, + {0x0B56, UNICODE_NORM_QC_MAYBE}, + {0x0B57, UNICODE_NORM_QC_MAYBE}, + {0x0B5C, UNICODE_NORM_QC_NO}, + {0x0B5D, UNICODE_NORM_QC_NO}, + {0x0BBE, UNICODE_NORM_QC_MAYBE}, + {0x0BD7, UNICODE_NORM_QC_MAYBE}, + {0x0C56, UNICODE_NORM_QC_MAYBE}, + {0x0CC2, UNICODE_NORM_QC_MAYBE}, + {0x0CD5, UNICODE_NORM_QC_MAYBE}, + {0x0CD6, UNICODE_NORM_QC_MAYBE}, + {0x0D3E, UNICODE_NORM_QC_MAYBE}, + {0x0D57, UNICODE_NORM_QC_MAYBE}, + {0x0DCA, UNICODE_NORM_QC_MAYBE}, + {0x0DCF, UNICODE_NORM_QC_MAYBE}, + {0x0DDF, UNICODE_NORM_QC_MAYBE}, + {0x0F43, UNICODE_NORM_QC_NO}, + {0x0F4D, UNICODE_NORM_QC_NO}, + {0x0F52, UNICODE_NORM_QC_NO}, + {0x0F57, UNICODE_NORM_QC_NO}, + {0x0F5C, UNICODE_NORM_QC_NO}, + {0x0F69, UNICODE_NORM_QC_NO}, + {0x0F73, UNICODE_NORM_QC_NO}, + {0x0F75, UNICODE_NORM_QC_NO}, + {0x0F76, UNICODE_NORM_QC_NO}, + {0x0F78, UNICODE_NORM_QC_NO}, + {0x0F81, UNICODE_NORM_QC_NO}, + {0x0F93, UNICODE_NORM_QC_NO}, + {0x0F9D, UNICODE_NORM_QC_NO}, + {0x0FA2, UNICODE_NORM_QC_NO}, + {0x0FA7, UNICODE_NORM_QC_NO}, + {0x0FAC, UNICODE_NORM_QC_NO}, + {0x0FB9, UNICODE_NORM_QC_NO}, + {0x102E, UNICODE_NORM_QC_MAYBE}, + {0x1161, UNICODE_NORM_QC_MAYBE}, + {0x1162, UNICODE_NORM_QC_MAYBE}, + {0x1163, UNICODE_NORM_QC_MAYBE}, + {0x1164, UNICODE_NORM_QC_MAYBE}, + {0x1165, UNICODE_NORM_QC_MAYBE}, + {0x1166, UNICODE_NORM_QC_MAYBE}, + {0x1167, UNICODE_NORM_QC_MAYBE}, + {0x1168, UNICODE_NORM_QC_MAYBE}, + {0x1169, UNICODE_NORM_QC_MAYBE}, + {0x116A, UNICODE_NORM_QC_MAYBE}, + {0x116B, UNICODE_NORM_QC_MAYBE}, + {0x116C, UNICODE_NORM_QC_MAYBE}, + {0x116D, UNICODE_NORM_QC_MAYBE}, + {0x116E, UNICODE_NORM_QC_MAYBE}, + {0x116F, UNICODE_NORM_QC_MAYBE}, + {0x1170, UNICODE_NORM_QC_MAYBE}, + {0x1171, UNICODE_NORM_QC_MAYBE}, + {0x1172, UNICODE_NORM_QC_MAYBE}, + {0x1173, UNICODE_NORM_QC_MAYBE}, + {0x1174, UNICODE_NORM_QC_MAYBE}, + {0x1175, UNICODE_NORM_QC_MAYBE}, + {0x11A8, UNICODE_NORM_QC_MAYBE}, + {0x11A9, UNICODE_NORM_QC_MAYBE}, + {0x11AA, UNICODE_NORM_QC_MAYBE}, + {0x11AB, UNICODE_NORM_QC_MAYBE}, + {0x11AC, UNICODE_NORM_QC_MAYBE}, + {0x11AD, UNICODE_NORM_QC_MAYBE}, + {0x11AE, UNICODE_NORM_QC_MAYBE}, + {0x11AF, UNICODE_NORM_QC_MAYBE}, + {0x11B0, UNICODE_NORM_QC_MAYBE}, + {0x11B1, UNICODE_NORM_QC_MAYBE}, + {0x11B2, UNICODE_NORM_QC_MAYBE}, + {0x11B3, UNICODE_NORM_QC_MAYBE}, + {0x11B4, UNICODE_NORM_QC_MAYBE}, + {0x11B5, UNICODE_NORM_QC_MAYBE}, + {0x11B6, UNICODE_NORM_QC_MAYBE}, + {0x11B7, UNICODE_NORM_QC_MAYBE}, + {0x11B8, UNICODE_NORM_QC_MAYBE}, + {0x11B9, UNICODE_NORM_QC_MAYBE}, + {0x11BA, UNICODE_NORM_QC_MAYBE}, + {0x11BB, UNICODE_NORM_QC_MAYBE}, + {0x11BC, UNICODE_NORM_QC_MAYBE}, + {0x11BD, UNICODE_NORM_QC_MAYBE}, + {0x11BE, UNICODE_NORM_QC_MAYBE}, + {0x11BF, UNICODE_NORM_QC_MAYBE}, + {0x11C0, UNICODE_NORM_QC_MAYBE}, + {0x11C1, UNICODE_NORM_QC_MAYBE}, + {0x11C2, UNICODE_NORM_QC_MAYBE}, + {0x1B35, UNICODE_NORM_QC_MAYBE}, + {0x1F71, UNICODE_NORM_QC_NO}, + {0x1F73, UNICODE_NORM_QC_NO}, + {0x1F75, UNICODE_NORM_QC_NO}, + {0x1F77, UNICODE_NORM_QC_NO}, + {0x1F79, UNICODE_NORM_QC_NO}, + {0x1F7B, UNICODE_NORM_QC_NO}, + {0x1F7D, UNICODE_NORM_QC_NO}, + {0x1FBB, UNICODE_NORM_QC_NO}, + {0x1FBE, UNICODE_NORM_QC_NO}, + {0x1FC9, UNICODE_NORM_QC_NO}, + {0x1FCB, UNICODE_NORM_QC_NO}, + {0x1FD3, UNICODE_NORM_QC_NO}, + {0x1FDB, UNICODE_NORM_QC_NO}, + {0x1FE3, UNICODE_NORM_QC_NO}, + {0x1FEB, UNICODE_NORM_QC_NO}, + {0x1FEE, UNICODE_NORM_QC_NO}, + {0x1FEF, UNICODE_NORM_QC_NO}, + {0x1FF9, UNICODE_NORM_QC_NO}, + {0x1FFB, UNICODE_NORM_QC_NO}, + {0x1FFD, UNICODE_NORM_QC_NO}, + {0x2000, UNICODE_NORM_QC_NO}, + {0x2001, UNICODE_NORM_QC_NO}, + {0x2126, UNICODE_NORM_QC_NO}, + {0x212A, UNICODE_NORM_QC_NO}, + {0x212B, UNICODE_NORM_QC_NO}, + {0x2329, UNICODE_NORM_QC_NO}, + {0x232A, UNICODE_NORM_QC_NO}, + {0x2ADC, UNICODE_NORM_QC_NO}, + {0x3099, UNICODE_NORM_QC_MAYBE}, + {0x309A, UNICODE_NORM_QC_MAYBE}, + {0xF900, UNICODE_NORM_QC_NO}, + {0xF901, UNICODE_NORM_QC_NO}, + {0xF902, UNICODE_NORM_QC_NO}, + {0xF903, UNICODE_NORM_QC_NO}, + {0xF904, UNICODE_NORM_QC_NO}, + {0xF905, UNICODE_NORM_QC_NO}, + {0xF906, UNICODE_NORM_QC_NO}, + {0xF907, UNICODE_NORM_QC_NO}, + {0xF908, UNICODE_NORM_QC_NO}, + {0xF909, UNICODE_NORM_QC_NO}, + {0xF90A, UNICODE_NORM_QC_NO}, + {0xF90B, UNICODE_NORM_QC_NO}, + {0xF90C, UNICODE_NORM_QC_NO}, + {0xF90D, UNICODE_NORM_QC_NO}, + {0xF90E, UNICODE_NORM_QC_NO}, + {0xF90F, UNICODE_NORM_QC_NO}, + {0xF910, UNICODE_NORM_QC_NO}, + {0xF911, UNICODE_NORM_QC_NO}, + {0xF912, UNICODE_NORM_QC_NO}, + {0xF913, UNICODE_NORM_QC_NO}, + {0xF914, UNICODE_NORM_QC_NO}, + {0xF915, UNICODE_NORM_QC_NO}, + {0xF916, UNICODE_NORM_QC_NO}, + {0xF917, UNICODE_NORM_QC_NO}, + {0xF918, UNICODE_NORM_QC_NO}, + {0xF919, UNICODE_NORM_QC_NO}, + {0xF91A, UNICODE_NORM_QC_NO}, + {0xF91B, UNICODE_NORM_QC_NO}, + {0xF91C, UNICODE_NORM_QC_NO}, + {0xF91D, UNICODE_NORM_QC_NO}, + {0xF91E, UNICODE_NORM_QC_NO}, + {0xF91F, UNICODE_NORM_QC_NO}, + {0xF920, UNICODE_NORM_QC_NO}, + {0xF921, UNICODE_NORM_QC_NO}, + {0xF922, UNICODE_NORM_QC_NO}, + {0xF923, UNICODE_NORM_QC_NO}, + {0xF924, UNICODE_NORM_QC_NO}, + {0xF925, UNICODE_NORM_QC_NO}, + {0xF926, UNICODE_NORM_QC_NO}, + {0xF927, UNICODE_NORM_QC_NO}, + {0xF928, UNICODE_NORM_QC_NO}, + {0xF929, UNICODE_NORM_QC_NO}, + {0xF92A, UNICODE_NORM_QC_NO}, + {0xF92B, UNICODE_NORM_QC_NO}, + {0xF92C, UNICODE_NORM_QC_NO}, + {0xF92D, UNICODE_NORM_QC_NO}, + {0xF92E, UNICODE_NORM_QC_NO}, + {0xF92F, UNICODE_NORM_QC_NO}, + {0xF930, UNICODE_NORM_QC_NO}, + {0xF931, UNICODE_NORM_QC_NO}, + {0xF932, UNICODE_NORM_QC_NO}, + {0xF933, UNICODE_NORM_QC_NO}, + {0xF934, UNICODE_NORM_QC_NO}, + {0xF935, UNICODE_NORM_QC_NO}, + {0xF936, UNICODE_NORM_QC_NO}, + {0xF937, UNICODE_NORM_QC_NO}, + {0xF938, UNICODE_NORM_QC_NO}, + {0xF939, UNICODE_NORM_QC_NO}, + {0xF93A, UNICODE_NORM_QC_NO}, + {0xF93B, UNICODE_NORM_QC_NO}, + {0xF93C, UNICODE_NORM_QC_NO}, + {0xF93D, UNICODE_NORM_QC_NO}, + {0xF93E, UNICODE_NORM_QC_NO}, + {0xF93F, UNICODE_NORM_QC_NO}, + {0xF940, UNICODE_NORM_QC_NO}, + {0xF941, UNICODE_NORM_QC_NO}, + {0xF942, UNICODE_NORM_QC_NO}, + {0xF943, UNICODE_NORM_QC_NO}, + {0xF944, UNICODE_NORM_QC_NO}, + {0xF945, UNICODE_NORM_QC_NO}, + {0xF946, UNICODE_NORM_QC_NO}, + {0xF947, UNICODE_NORM_QC_NO}, + {0xF948, UNICODE_NORM_QC_NO}, + {0xF949, UNICODE_NORM_QC_NO}, + {0xF94A, UNICODE_NORM_QC_NO}, + {0xF94B, UNICODE_NORM_QC_NO}, + {0xF94C, UNICODE_NORM_QC_NO}, + {0xF94D, UNICODE_NORM_QC_NO}, + {0xF94E, UNICODE_NORM_QC_NO}, + {0xF94F, UNICODE_NORM_QC_NO}, + {0xF950, UNICODE_NORM_QC_NO}, + {0xF951, UNICODE_NORM_QC_NO}, + {0xF952, UNICODE_NORM_QC_NO}, + {0xF953, UNICODE_NORM_QC_NO}, + {0xF954, UNICODE_NORM_QC_NO}, + {0xF955, UNICODE_NORM_QC_NO}, + {0xF956, UNICODE_NORM_QC_NO}, + {0xF957, UNICODE_NORM_QC_NO}, + {0xF958, UNICODE_NORM_QC_NO}, + {0xF959, UNICODE_NORM_QC_NO}, + {0xF95A, UNICODE_NORM_QC_NO}, + {0xF95B, UNICODE_NORM_QC_NO}, + {0xF95C, UNICODE_NORM_QC_NO}, + {0xF95D, UNICODE_NORM_QC_NO}, + {0xF95E, UNICODE_NORM_QC_NO}, + {0xF95F, UNICODE_NORM_QC_NO}, + {0xF960, UNICODE_NORM_QC_NO}, + {0xF961, UNICODE_NORM_QC_NO}, + {0xF962, UNICODE_NORM_QC_NO}, + {0xF963, UNICODE_NORM_QC_NO}, + {0xF964, UNICODE_NORM_QC_NO}, + {0xF965, UNICODE_NORM_QC_NO}, + {0xF966, UNICODE_NORM_QC_NO}, + {0xF967, UNICODE_NORM_QC_NO}, + {0xF968, UNICODE_NORM_QC_NO}, + {0xF969, UNICODE_NORM_QC_NO}, + {0xF96A, UNICODE_NORM_QC_NO}, + {0xF96B, UNICODE_NORM_QC_NO}, + {0xF96C, UNICODE_NORM_QC_NO}, + {0xF96D, UNICODE_NORM_QC_NO}, + {0xF96E, UNICODE_NORM_QC_NO}, + {0xF96F, UNICODE_NORM_QC_NO}, + {0xF970, UNICODE_NORM_QC_NO}, + {0xF971, UNICODE_NORM_QC_NO}, + {0xF972, UNICODE_NORM_QC_NO}, + {0xF973, UNICODE_NORM_QC_NO}, + {0xF974, UNICODE_NORM_QC_NO}, + {0xF975, UNICODE_NORM_QC_NO}, + {0xF976, UNICODE_NORM_QC_NO}, + {0xF977, UNICODE_NORM_QC_NO}, + {0xF978, UNICODE_NORM_QC_NO}, + {0xF979, UNICODE_NORM_QC_NO}, + {0xF97A, UNICODE_NORM_QC_NO}, + {0xF97B, UNICODE_NORM_QC_NO}, + {0xF97C, UNICODE_NORM_QC_NO}, + {0xF97D, UNICODE_NORM_QC_NO}, + {0xF97E, UNICODE_NORM_QC_NO}, + {0xF97F, UNICODE_NORM_QC_NO}, + {0xF980, UNICODE_NORM_QC_NO}, + {0xF981, UNICODE_NORM_QC_NO}, + {0xF982, UNICODE_NORM_QC_NO}, + {0xF983, UNICODE_NORM_QC_NO}, + {0xF984, UNICODE_NORM_QC_NO}, + {0xF985, UNICODE_NORM_QC_NO}, + {0xF986, UNICODE_NORM_QC_NO}, + {0xF987, UNICODE_NORM_QC_NO}, + {0xF988, UNICODE_NORM_QC_NO}, + {0xF989, UNICODE_NORM_QC_NO}, + {0xF98A, UNICODE_NORM_QC_NO}, + {0xF98B, UNICODE_NORM_QC_NO}, + {0xF98C, UNICODE_NORM_QC_NO}, + {0xF98D, UNICODE_NORM_QC_NO}, + {0xF98E, UNICODE_NORM_QC_NO}, + {0xF98F, UNICODE_NORM_QC_NO}, + {0xF990, UNICODE_NORM_QC_NO}, + {0xF991, UNICODE_NORM_QC_NO}, + {0xF992, UNICODE_NORM_QC_NO}, + {0xF993, UNICODE_NORM_QC_NO}, + {0xF994, UNICODE_NORM_QC_NO}, + {0xF995, UNICODE_NORM_QC_NO}, + {0xF996, UNICODE_NORM_QC_NO}, + {0xF997, UNICODE_NORM_QC_NO}, + {0xF998, UNICODE_NORM_QC_NO}, + {0xF999, UNICODE_NORM_QC_NO}, + {0xF99A, UNICODE_NORM_QC_NO}, + {0xF99B, UNICODE_NORM_QC_NO}, + {0xF99C, UNICODE_NORM_QC_NO}, + {0xF99D, UNICODE_NORM_QC_NO}, + {0xF99E, UNICODE_NORM_QC_NO}, + {0xF99F, UNICODE_NORM_QC_NO}, + {0xF9A0, UNICODE_NORM_QC_NO}, + {0xF9A1, UNICODE_NORM_QC_NO}, + {0xF9A2, UNICODE_NORM_QC_NO}, + {0xF9A3, UNICODE_NORM_QC_NO}, + {0xF9A4, UNICODE_NORM_QC_NO}, + {0xF9A5, UNICODE_NORM_QC_NO}, + {0xF9A6, UNICODE_NORM_QC_NO}, + {0xF9A7, UNICODE_NORM_QC_NO}, + {0xF9A8, UNICODE_NORM_QC_NO}, + {0xF9A9, UNICODE_NORM_QC_NO}, + {0xF9AA, UNICODE_NORM_QC_NO}, + {0xF9AB, UNICODE_NORM_QC_NO}, + {0xF9AC, UNICODE_NORM_QC_NO}, + {0xF9AD, UNICODE_NORM_QC_NO}, + {0xF9AE, UNICODE_NORM_QC_NO}, + {0xF9AF, UNICODE_NORM_QC_NO}, + {0xF9B0, UNICODE_NORM_QC_NO}, + {0xF9B1, UNICODE_NORM_QC_NO}, + {0xF9B2, UNICODE_NORM_QC_NO}, + {0xF9B3, UNICODE_NORM_QC_NO}, + {0xF9B4, UNICODE_NORM_QC_NO}, + {0xF9B5, UNICODE_NORM_QC_NO}, + {0xF9B6, UNICODE_NORM_QC_NO}, + {0xF9B7, UNICODE_NORM_QC_NO}, + {0xF9B8, UNICODE_NORM_QC_NO}, + {0xF9B9, UNICODE_NORM_QC_NO}, + {0xF9BA, UNICODE_NORM_QC_NO}, + {0xF9BB, UNICODE_NORM_QC_NO}, + {0xF9BC, UNICODE_NORM_QC_NO}, + {0xF9BD, UNICODE_NORM_QC_NO}, + {0xF9BE, UNICODE_NORM_QC_NO}, + {0xF9BF, UNICODE_NORM_QC_NO}, + {0xF9C0, UNICODE_NORM_QC_NO}, + {0xF9C1, UNICODE_NORM_QC_NO}, + {0xF9C2, UNICODE_NORM_QC_NO}, + {0xF9C3, UNICODE_NORM_QC_NO}, + {0xF9C4, UNICODE_NORM_QC_NO}, + {0xF9C5, UNICODE_NORM_QC_NO}, + {0xF9C6, UNICODE_NORM_QC_NO}, + {0xF9C7, UNICODE_NORM_QC_NO}, + {0xF9C8, UNICODE_NORM_QC_NO}, + {0xF9C9, UNICODE_NORM_QC_NO}, + {0xF9CA, UNICODE_NORM_QC_NO}, + {0xF9CB, UNICODE_NORM_QC_NO}, + {0xF9CC, UNICODE_NORM_QC_NO}, + {0xF9CD, UNICODE_NORM_QC_NO}, + {0xF9CE, UNICODE_NORM_QC_NO}, + {0xF9CF, UNICODE_NORM_QC_NO}, + {0xF9D0, UNICODE_NORM_QC_NO}, + {0xF9D1, UNICODE_NORM_QC_NO}, + {0xF9D2, UNICODE_NORM_QC_NO}, + {0xF9D3, UNICODE_NORM_QC_NO}, + {0xF9D4, UNICODE_NORM_QC_NO}, + {0xF9D5, UNICODE_NORM_QC_NO}, + {0xF9D6, UNICODE_NORM_QC_NO}, + {0xF9D7, UNICODE_NORM_QC_NO}, + {0xF9D8, UNICODE_NORM_QC_NO}, + {0xF9D9, UNICODE_NORM_QC_NO}, + {0xF9DA, UNICODE_NORM_QC_NO}, + {0xF9DB, UNICODE_NORM_QC_NO}, + {0xF9DC, UNICODE_NORM_QC_NO}, + {0xF9DD, UNICODE_NORM_QC_NO}, + {0xF9DE, UNICODE_NORM_QC_NO}, + {0xF9DF, UNICODE_NORM_QC_NO}, + {0xF9E0, UNICODE_NORM_QC_NO}, + {0xF9E1, UNICODE_NORM_QC_NO}, + {0xF9E2, UNICODE_NORM_QC_NO}, + {0xF9E3, UNICODE_NORM_QC_NO}, + {0xF9E4, UNICODE_NORM_QC_NO}, + {0xF9E5, UNICODE_NORM_QC_NO}, + {0xF9E6, UNICODE_NORM_QC_NO}, + {0xF9E7, UNICODE_NORM_QC_NO}, + {0xF9E8, UNICODE_NORM_QC_NO}, + {0xF9E9, UNICODE_NORM_QC_NO}, + {0xF9EA, UNICODE_NORM_QC_NO}, + {0xF9EB, UNICODE_NORM_QC_NO}, + {0xF9EC, UNICODE_NORM_QC_NO}, + {0xF9ED, UNICODE_NORM_QC_NO}, + {0xF9EE, UNICODE_NORM_QC_NO}, + {0xF9EF, UNICODE_NORM_QC_NO}, + {0xF9F0, UNICODE_NORM_QC_NO}, + {0xF9F1, UNICODE_NORM_QC_NO}, + {0xF9F2, UNICODE_NORM_QC_NO}, + {0xF9F3, UNICODE_NORM_QC_NO}, + {0xF9F4, UNICODE_NORM_QC_NO}, + {0xF9F5, UNICODE_NORM_QC_NO}, + {0xF9F6, UNICODE_NORM_QC_NO}, + {0xF9F7, UNICODE_NORM_QC_NO}, + {0xF9F8, UNICODE_NORM_QC_NO}, + {0xF9F9, UNICODE_NORM_QC_NO}, + {0xF9FA, UNICODE_NORM_QC_NO}, + {0xF9FB, UNICODE_NORM_QC_NO}, + {0xF9FC, UNICODE_NORM_QC_NO}, + {0xF9FD, UNICODE_NORM_QC_NO}, + {0xF9FE, UNICODE_NORM_QC_NO}, + {0xF9FF, UNICODE_NORM_QC_NO}, + {0xFA00, UNICODE_NORM_QC_NO}, + {0xFA01, UNICODE_NORM_QC_NO}, + {0xFA02, UNICODE_NORM_QC_NO}, + {0xFA03, UNICODE_NORM_QC_NO}, + {0xFA04, UNICODE_NORM_QC_NO}, + {0xFA05, UNICODE_NORM_QC_NO}, + {0xFA06, UNICODE_NORM_QC_NO}, + {0xFA07, UNICODE_NORM_QC_NO}, + {0xFA08, UNICODE_NORM_QC_NO}, + {0xFA09, UNICODE_NORM_QC_NO}, + {0xFA0A, UNICODE_NORM_QC_NO}, + {0xFA0B, UNICODE_NORM_QC_NO}, + {0xFA0C, UNICODE_NORM_QC_NO}, + {0xFA0D, UNICODE_NORM_QC_NO}, + {0xFA10, UNICODE_NORM_QC_NO}, + {0xFA12, UNICODE_NORM_QC_NO}, + {0xFA15, UNICODE_NORM_QC_NO}, + {0xFA16, UNICODE_NORM_QC_NO}, + {0xFA17, UNICODE_NORM_QC_NO}, + {0xFA18, UNICODE_NORM_QC_NO}, + {0xFA19, UNICODE_NORM_QC_NO}, + {0xFA1A, UNICODE_NORM_QC_NO}, + {0xFA1B, UNICODE_NORM_QC_NO}, + {0xFA1C, UNICODE_NORM_QC_NO}, + {0xFA1D, UNICODE_NORM_QC_NO}, + {0xFA1E, UNICODE_NORM_QC_NO}, + {0xFA20, UNICODE_NORM_QC_NO}, + {0xFA22, UNICODE_NORM_QC_NO}, + {0xFA25, UNICODE_NORM_QC_NO}, + {0xFA26, UNICODE_NORM_QC_NO}, + {0xFA2A, UNICODE_NORM_QC_NO}, + {0xFA2B, UNICODE_NORM_QC_NO}, + {0xFA2C, UNICODE_NORM_QC_NO}, + {0xFA2D, UNICODE_NORM_QC_NO}, + {0xFA2E, UNICODE_NORM_QC_NO}, + {0xFA2F, UNICODE_NORM_QC_NO}, + {0xFA30, UNICODE_NORM_QC_NO}, + {0xFA31, UNICODE_NORM_QC_NO}, + {0xFA32, UNICODE_NORM_QC_NO}, + {0xFA33, UNICODE_NORM_QC_NO}, + {0xFA34, UNICODE_NORM_QC_NO}, + {0xFA35, UNICODE_NORM_QC_NO}, + {0xFA36, UNICODE_NORM_QC_NO}, + {0xFA37, UNICODE_NORM_QC_NO}, + {0xFA38, UNICODE_NORM_QC_NO}, + {0xFA39, UNICODE_NORM_QC_NO}, + {0xFA3A, UNICODE_NORM_QC_NO}, + {0xFA3B, UNICODE_NORM_QC_NO}, + {0xFA3C, UNICODE_NORM_QC_NO}, + {0xFA3D, UNICODE_NORM_QC_NO}, + {0xFA3E, UNICODE_NORM_QC_NO}, + {0xFA3F, UNICODE_NORM_QC_NO}, + {0xFA40, UNICODE_NORM_QC_NO}, + {0xFA41, UNICODE_NORM_QC_NO}, + {0xFA42, UNICODE_NORM_QC_NO}, + {0xFA43, UNICODE_NORM_QC_NO}, + {0xFA44, UNICODE_NORM_QC_NO}, + {0xFA45, UNICODE_NORM_QC_NO}, + {0xFA46, UNICODE_NORM_QC_NO}, + {0xFA47, UNICODE_NORM_QC_NO}, + {0xFA48, UNICODE_NORM_QC_NO}, + {0xFA49, UNICODE_NORM_QC_NO}, + {0xFA4A, UNICODE_NORM_QC_NO}, + {0xFA4B, UNICODE_NORM_QC_NO}, + {0xFA4C, UNICODE_NORM_QC_NO}, + {0xFA4D, UNICODE_NORM_QC_NO}, + {0xFA4E, UNICODE_NORM_QC_NO}, + {0xFA4F, UNICODE_NORM_QC_NO}, + {0xFA50, UNICODE_NORM_QC_NO}, + {0xFA51, UNICODE_NORM_QC_NO}, + {0xFA52, UNICODE_NORM_QC_NO}, + {0xFA53, UNICODE_NORM_QC_NO}, + {0xFA54, UNICODE_NORM_QC_NO}, + {0xFA55, UNICODE_NORM_QC_NO}, + {0xFA56, UNICODE_NORM_QC_NO}, + {0xFA57, UNICODE_NORM_QC_NO}, + {0xFA58, UNICODE_NORM_QC_NO}, + {0xFA59, UNICODE_NORM_QC_NO}, + {0xFA5A, UNICODE_NORM_QC_NO}, + {0xFA5B, UNICODE_NORM_QC_NO}, + {0xFA5C, UNICODE_NORM_QC_NO}, + {0xFA5D, UNICODE_NORM_QC_NO}, + {0xFA5E, UNICODE_NORM_QC_NO}, + {0xFA5F, UNICODE_NORM_QC_NO}, + {0xFA60, UNICODE_NORM_QC_NO}, + {0xFA61, UNICODE_NORM_QC_NO}, + {0xFA62, UNICODE_NORM_QC_NO}, + {0xFA63, UNICODE_NORM_QC_NO}, + {0xFA64, UNICODE_NORM_QC_NO}, + {0xFA65, UNICODE_NORM_QC_NO}, + {0xFA66, UNICODE_NORM_QC_NO}, + {0xFA67, UNICODE_NORM_QC_NO}, + {0xFA68, UNICODE_NORM_QC_NO}, + {0xFA69, UNICODE_NORM_QC_NO}, + {0xFA6A, UNICODE_NORM_QC_NO}, + {0xFA6B, UNICODE_NORM_QC_NO}, + {0xFA6C, UNICODE_NORM_QC_NO}, + {0xFA6D, UNICODE_NORM_QC_NO}, + {0xFA70, UNICODE_NORM_QC_NO}, + {0xFA71, UNICODE_NORM_QC_NO}, + {0xFA72, UNICODE_NORM_QC_NO}, + {0xFA73, UNICODE_NORM_QC_NO}, + {0xFA74, UNICODE_NORM_QC_NO}, + {0xFA75, UNICODE_NORM_QC_NO}, + {0xFA76, UNICODE_NORM_QC_NO}, + {0xFA77, UNICODE_NORM_QC_NO}, + {0xFA78, UNICODE_NORM_QC_NO}, + {0xFA79, UNICODE_NORM_QC_NO}, + {0xFA7A, UNICODE_NORM_QC_NO}, + {0xFA7B, UNICODE_NORM_QC_NO}, + {0xFA7C, UNICODE_NORM_QC_NO}, + {0xFA7D, UNICODE_NORM_QC_NO}, + {0xFA7E, UNICODE_NORM_QC_NO}, + {0xFA7F, UNICODE_NORM_QC_NO}, + {0xFA80, UNICODE_NORM_QC_NO}, + {0xFA81, UNICODE_NORM_QC_NO}, + {0xFA82, UNICODE_NORM_QC_NO}, + {0xFA83, UNICODE_NORM_QC_NO}, + {0xFA84, UNICODE_NORM_QC_NO}, + {0xFA85, UNICODE_NORM_QC_NO}, + {0xFA86, UNICODE_NORM_QC_NO}, + {0xFA87, UNICODE_NORM_QC_NO}, + {0xFA88, UNICODE_NORM_QC_NO}, + {0xFA89, UNICODE_NORM_QC_NO}, + {0xFA8A, UNICODE_NORM_QC_NO}, + {0xFA8B, UNICODE_NORM_QC_NO}, + {0xFA8C, UNICODE_NORM_QC_NO}, + {0xFA8D, UNICODE_NORM_QC_NO}, + {0xFA8E, UNICODE_NORM_QC_NO}, + {0xFA8F, UNICODE_NORM_QC_NO}, + {0xFA90, UNICODE_NORM_QC_NO}, + {0xFA91, UNICODE_NORM_QC_NO}, + {0xFA92, UNICODE_NORM_QC_NO}, + {0xFA93, UNICODE_NORM_QC_NO}, + {0xFA94, UNICODE_NORM_QC_NO}, + {0xFA95, UNICODE_NORM_QC_NO}, + {0xFA96, UNICODE_NORM_QC_NO}, + {0xFA97, UNICODE_NORM_QC_NO}, + {0xFA98, UNICODE_NORM_QC_NO}, + {0xFA99, UNICODE_NORM_QC_NO}, + {0xFA9A, UNICODE_NORM_QC_NO}, + {0xFA9B, UNICODE_NORM_QC_NO}, + {0xFA9C, UNICODE_NORM_QC_NO}, + {0xFA9D, UNICODE_NORM_QC_NO}, + {0xFA9E, UNICODE_NORM_QC_NO}, + {0xFA9F, UNICODE_NORM_QC_NO}, + {0xFAA0, UNICODE_NORM_QC_NO}, + {0xFAA1, UNICODE_NORM_QC_NO}, + {0xFAA2, UNICODE_NORM_QC_NO}, + {0xFAA3, UNICODE_NORM_QC_NO}, + {0xFAA4, UNICODE_NORM_QC_NO}, + {0xFAA5, UNICODE_NORM_QC_NO}, + {0xFAA6, UNICODE_NORM_QC_NO}, + {0xFAA7, UNICODE_NORM_QC_NO}, + {0xFAA8, UNICODE_NORM_QC_NO}, + {0xFAA9, UNICODE_NORM_QC_NO}, + {0xFAAA, UNICODE_NORM_QC_NO}, + {0xFAAB, UNICODE_NORM_QC_NO}, + {0xFAAC, UNICODE_NORM_QC_NO}, + {0xFAAD, UNICODE_NORM_QC_NO}, + {0xFAAE, UNICODE_NORM_QC_NO}, + {0xFAAF, UNICODE_NORM_QC_NO}, + {0xFAB0, UNICODE_NORM_QC_NO}, + {0xFAB1, UNICODE_NORM_QC_NO}, + {0xFAB2, UNICODE_NORM_QC_NO}, + {0xFAB3, UNICODE_NORM_QC_NO}, + {0xFAB4, UNICODE_NORM_QC_NO}, + {0xFAB5, UNICODE_NORM_QC_NO}, + {0xFAB6, UNICODE_NORM_QC_NO}, + {0xFAB7, UNICODE_NORM_QC_NO}, + {0xFAB8, UNICODE_NORM_QC_NO}, + {0xFAB9, UNICODE_NORM_QC_NO}, + {0xFABA, UNICODE_NORM_QC_NO}, + {0xFABB, UNICODE_NORM_QC_NO}, + {0xFABC, UNICODE_NORM_QC_NO}, + {0xFABD, UNICODE_NORM_QC_NO}, + {0xFABE, UNICODE_NORM_QC_NO}, + {0xFABF, UNICODE_NORM_QC_NO}, + {0xFAC0, UNICODE_NORM_QC_NO}, + {0xFAC1, UNICODE_NORM_QC_NO}, + {0xFAC2, UNICODE_NORM_QC_NO}, + {0xFAC3, UNICODE_NORM_QC_NO}, + {0xFAC4, UNICODE_NORM_QC_NO}, + {0xFAC5, UNICODE_NORM_QC_NO}, + {0xFAC6, UNICODE_NORM_QC_NO}, + {0xFAC7, UNICODE_NORM_QC_NO}, + {0xFAC8, UNICODE_NORM_QC_NO}, + {0xFAC9, UNICODE_NORM_QC_NO}, + {0xFACA, UNICODE_NORM_QC_NO}, + {0xFACB, UNICODE_NORM_QC_NO}, + {0xFACC, UNICODE_NORM_QC_NO}, + {0xFACD, UNICODE_NORM_QC_NO}, + {0xFACE, UNICODE_NORM_QC_NO}, + {0xFACF, UNICODE_NORM_QC_NO}, + {0xFAD0, UNICODE_NORM_QC_NO}, + {0xFAD1, UNICODE_NORM_QC_NO}, + {0xFAD2, UNICODE_NORM_QC_NO}, + {0xFAD3, UNICODE_NORM_QC_NO}, + {0xFAD4, UNICODE_NORM_QC_NO}, + {0xFAD5, UNICODE_NORM_QC_NO}, + {0xFAD6, UNICODE_NORM_QC_NO}, + {0xFAD7, UNICODE_NORM_QC_NO}, + {0xFAD8, UNICODE_NORM_QC_NO}, + {0xFAD9, UNICODE_NORM_QC_NO}, + {0xFB1D, UNICODE_NORM_QC_NO}, + {0xFB1F, UNICODE_NORM_QC_NO}, + {0xFB2A, UNICODE_NORM_QC_NO}, + {0xFB2B, UNICODE_NORM_QC_NO}, + {0xFB2C, UNICODE_NORM_QC_NO}, + {0xFB2D, UNICODE_NORM_QC_NO}, + {0xFB2E, UNICODE_NORM_QC_NO}, + {0xFB2F, UNICODE_NORM_QC_NO}, + {0xFB30, UNICODE_NORM_QC_NO}, + {0xFB31, UNICODE_NORM_QC_NO}, + {0xFB32, UNICODE_NORM_QC_NO}, + {0xFB33, UNICODE_NORM_QC_NO}, + {0xFB34, UNICODE_NORM_QC_NO}, + {0xFB35, UNICODE_NORM_QC_NO}, + {0xFB36, UNICODE_NORM_QC_NO}, + {0xFB38, UNICODE_NORM_QC_NO}, + {0xFB39, UNICODE_NORM_QC_NO}, + {0xFB3A, UNICODE_NORM_QC_NO}, + {0xFB3B, UNICODE_NORM_QC_NO}, + {0xFB3C, UNICODE_NORM_QC_NO}, + {0xFB3E, UNICODE_NORM_QC_NO}, + {0xFB40, UNICODE_NORM_QC_NO}, + {0xFB41, UNICODE_NORM_QC_NO}, + {0xFB43, UNICODE_NORM_QC_NO}, + {0xFB44, UNICODE_NORM_QC_NO}, + {0xFB46, UNICODE_NORM_QC_NO}, + {0xFB47, UNICODE_NORM_QC_NO}, + {0xFB48, UNICODE_NORM_QC_NO}, + {0xFB49, UNICODE_NORM_QC_NO}, + {0xFB4A, UNICODE_NORM_QC_NO}, + {0xFB4B, UNICODE_NORM_QC_NO}, + {0xFB4C, UNICODE_NORM_QC_NO}, + {0xFB4D, UNICODE_NORM_QC_NO}, + {0xFB4E, UNICODE_NORM_QC_NO}, + {0x110BA, UNICODE_NORM_QC_MAYBE}, + {0x11127, UNICODE_NORM_QC_MAYBE}, + {0x1133E, UNICODE_NORM_QC_MAYBE}, + {0x11357, UNICODE_NORM_QC_MAYBE}, + {0x114B0, UNICODE_NORM_QC_MAYBE}, + {0x114BA, UNICODE_NORM_QC_MAYBE}, + {0x114BD, UNICODE_NORM_QC_MAYBE}, + {0x115AF, UNICODE_NORM_QC_MAYBE}, + {0x11930, UNICODE_NORM_QC_MAYBE}, + {0x1D15E, UNICODE_NORM_QC_NO}, + {0x1D15F, UNICODE_NORM_QC_NO}, + {0x1D160, UNICODE_NORM_QC_NO}, + {0x1D161, UNICODE_NORM_QC_NO}, + {0x1D162, UNICODE_NORM_QC_NO}, + {0x1D163, UNICODE_NORM_QC_NO}, + {0x1D164, UNICODE_NORM_QC_NO}, + {0x1D1BB, UNICODE_NORM_QC_NO}, + {0x1D1BC, UNICODE_NORM_QC_NO}, + {0x1D1BD, UNICODE_NORM_QC_NO}, + {0x1D1BE, UNICODE_NORM_QC_NO}, + {0x1D1BF, UNICODE_NORM_QC_NO}, + {0x1D1C0, UNICODE_NORM_QC_NO}, + {0x2F800, UNICODE_NORM_QC_NO}, + {0x2F801, UNICODE_NORM_QC_NO}, + {0x2F802, UNICODE_NORM_QC_NO}, + {0x2F803, UNICODE_NORM_QC_NO}, + {0x2F804, UNICODE_NORM_QC_NO}, + {0x2F805, UNICODE_NORM_QC_NO}, + {0x2F806, UNICODE_NORM_QC_NO}, + {0x2F807, UNICODE_NORM_QC_NO}, + {0x2F808, UNICODE_NORM_QC_NO}, + {0x2F809, UNICODE_NORM_QC_NO}, + {0x2F80A, UNICODE_NORM_QC_NO}, + {0x2F80B, UNICODE_NORM_QC_NO}, + {0x2F80C, UNICODE_NORM_QC_NO}, + {0x2F80D, UNICODE_NORM_QC_NO}, + {0x2F80E, UNICODE_NORM_QC_NO}, + {0x2F80F, UNICODE_NORM_QC_NO}, + {0x2F810, UNICODE_NORM_QC_NO}, + {0x2F811, UNICODE_NORM_QC_NO}, + {0x2F812, UNICODE_NORM_QC_NO}, + {0x2F813, UNICODE_NORM_QC_NO}, + {0x2F814, UNICODE_NORM_QC_NO}, + {0x2F815, UNICODE_NORM_QC_NO}, + {0x2F816, UNICODE_NORM_QC_NO}, + {0x2F817, UNICODE_NORM_QC_NO}, + {0x2F818, UNICODE_NORM_QC_NO}, + {0x2F819, UNICODE_NORM_QC_NO}, + {0x2F81A, UNICODE_NORM_QC_NO}, + {0x2F81B, UNICODE_NORM_QC_NO}, + {0x2F81C, UNICODE_NORM_QC_NO}, + {0x2F81D, UNICODE_NORM_QC_NO}, + {0x2F81E, UNICODE_NORM_QC_NO}, + {0x2F81F, UNICODE_NORM_QC_NO}, + {0x2F820, UNICODE_NORM_QC_NO}, + {0x2F821, UNICODE_NORM_QC_NO}, + {0x2F822, UNICODE_NORM_QC_NO}, + {0x2F823, UNICODE_NORM_QC_NO}, + {0x2F824, UNICODE_NORM_QC_NO}, + {0x2F825, UNICODE_NORM_QC_NO}, + {0x2F826, UNICODE_NORM_QC_NO}, + {0x2F827, UNICODE_NORM_QC_NO}, + {0x2F828, UNICODE_NORM_QC_NO}, + {0x2F829, UNICODE_NORM_QC_NO}, + {0x2F82A, UNICODE_NORM_QC_NO}, + {0x2F82B, UNICODE_NORM_QC_NO}, + {0x2F82C, UNICODE_NORM_QC_NO}, + {0x2F82D, UNICODE_NORM_QC_NO}, + {0x2F82E, UNICODE_NORM_QC_NO}, + {0x2F82F, UNICODE_NORM_QC_NO}, + {0x2F830, UNICODE_NORM_QC_NO}, + {0x2F831, UNICODE_NORM_QC_NO}, + {0x2F832, UNICODE_NORM_QC_NO}, + {0x2F833, UNICODE_NORM_QC_NO}, + {0x2F834, UNICODE_NORM_QC_NO}, + {0x2F835, UNICODE_NORM_QC_NO}, + {0x2F836, UNICODE_NORM_QC_NO}, + {0x2F837, UNICODE_NORM_QC_NO}, + {0x2F838, UNICODE_NORM_QC_NO}, + {0x2F839, UNICODE_NORM_QC_NO}, + {0x2F83A, UNICODE_NORM_QC_NO}, + {0x2F83B, UNICODE_NORM_QC_NO}, + {0x2F83C, UNICODE_NORM_QC_NO}, + {0x2F83D, UNICODE_NORM_QC_NO}, + {0x2F83E, UNICODE_NORM_QC_NO}, + {0x2F83F, UNICODE_NORM_QC_NO}, + {0x2F840, UNICODE_NORM_QC_NO}, + {0x2F841, UNICODE_NORM_QC_NO}, + {0x2F842, UNICODE_NORM_QC_NO}, + {0x2F843, UNICODE_NORM_QC_NO}, + {0x2F844, UNICODE_NORM_QC_NO}, + {0x2F845, UNICODE_NORM_QC_NO}, + {0x2F846, UNICODE_NORM_QC_NO}, + {0x2F847, UNICODE_NORM_QC_NO}, + {0x2F848, UNICODE_NORM_QC_NO}, + {0x2F849, UNICODE_NORM_QC_NO}, + {0x2F84A, UNICODE_NORM_QC_NO}, + {0x2F84B, UNICODE_NORM_QC_NO}, + {0x2F84C, UNICODE_NORM_QC_NO}, + {0x2F84D, UNICODE_NORM_QC_NO}, + {0x2F84E, UNICODE_NORM_QC_NO}, + {0x2F84F, UNICODE_NORM_QC_NO}, + {0x2F850, UNICODE_NORM_QC_NO}, + {0x2F851, UNICODE_NORM_QC_NO}, + {0x2F852, UNICODE_NORM_QC_NO}, + {0x2F853, UNICODE_NORM_QC_NO}, + {0x2F854, UNICODE_NORM_QC_NO}, + {0x2F855, UNICODE_NORM_QC_NO}, + {0x2F856, UNICODE_NORM_QC_NO}, + {0x2F857, UNICODE_NORM_QC_NO}, + {0x2F858, UNICODE_NORM_QC_NO}, + {0x2F859, UNICODE_NORM_QC_NO}, + {0x2F85A, UNICODE_NORM_QC_NO}, + {0x2F85B, UNICODE_NORM_QC_NO}, + {0x2F85C, UNICODE_NORM_QC_NO}, + {0x2F85D, UNICODE_NORM_QC_NO}, + {0x2F85E, UNICODE_NORM_QC_NO}, + {0x2F85F, UNICODE_NORM_QC_NO}, + {0x2F860, UNICODE_NORM_QC_NO}, + {0x2F861, UNICODE_NORM_QC_NO}, + {0x2F862, UNICODE_NORM_QC_NO}, + {0x2F863, UNICODE_NORM_QC_NO}, + {0x2F864, UNICODE_NORM_QC_NO}, + {0x2F865, UNICODE_NORM_QC_NO}, + {0x2F866, UNICODE_NORM_QC_NO}, + {0x2F867, UNICODE_NORM_QC_NO}, + {0x2F868, UNICODE_NORM_QC_NO}, + {0x2F869, UNICODE_NORM_QC_NO}, + {0x2F86A, UNICODE_NORM_QC_NO}, + {0x2F86B, UNICODE_NORM_QC_NO}, + {0x2F86C, UNICODE_NORM_QC_NO}, + {0x2F86D, UNICODE_NORM_QC_NO}, + {0x2F86E, UNICODE_NORM_QC_NO}, + {0x2F86F, UNICODE_NORM_QC_NO}, + {0x2F870, UNICODE_NORM_QC_NO}, + {0x2F871, UNICODE_NORM_QC_NO}, + {0x2F872, UNICODE_NORM_QC_NO}, + {0x2F873, UNICODE_NORM_QC_NO}, + {0x2F874, UNICODE_NORM_QC_NO}, + {0x2F875, UNICODE_NORM_QC_NO}, + {0x2F876, UNICODE_NORM_QC_NO}, + {0x2F877, UNICODE_NORM_QC_NO}, + {0x2F878, UNICODE_NORM_QC_NO}, + {0x2F879, UNICODE_NORM_QC_NO}, + {0x2F87A, UNICODE_NORM_QC_NO}, + {0x2F87B, UNICODE_NORM_QC_NO}, + {0x2F87C, UNICODE_NORM_QC_NO}, + {0x2F87D, UNICODE_NORM_QC_NO}, + {0x2F87E, UNICODE_NORM_QC_NO}, + {0x2F87F, UNICODE_NORM_QC_NO}, + {0x2F880, UNICODE_NORM_QC_NO}, + {0x2F881, UNICODE_NORM_QC_NO}, + {0x2F882, UNICODE_NORM_QC_NO}, + {0x2F883, UNICODE_NORM_QC_NO}, + {0x2F884, UNICODE_NORM_QC_NO}, + {0x2F885, UNICODE_NORM_QC_NO}, + {0x2F886, UNICODE_NORM_QC_NO}, + {0x2F887, UNICODE_NORM_QC_NO}, + {0x2F888, UNICODE_NORM_QC_NO}, + {0x2F889, UNICODE_NORM_QC_NO}, + {0x2F88A, UNICODE_NORM_QC_NO}, + {0x2F88B, UNICODE_NORM_QC_NO}, + {0x2F88C, UNICODE_NORM_QC_NO}, + {0x2F88D, UNICODE_NORM_QC_NO}, + {0x2F88E, UNICODE_NORM_QC_NO}, + {0x2F88F, UNICODE_NORM_QC_NO}, + {0x2F890, UNICODE_NORM_QC_NO}, + {0x2F891, UNICODE_NORM_QC_NO}, + {0x2F892, UNICODE_NORM_QC_NO}, + {0x2F893, UNICODE_NORM_QC_NO}, + {0x2F894, UNICODE_NORM_QC_NO}, + {0x2F895, UNICODE_NORM_QC_NO}, + {0x2F896, UNICODE_NORM_QC_NO}, + {0x2F897, UNICODE_NORM_QC_NO}, + {0x2F898, UNICODE_NORM_QC_NO}, + {0x2F899, UNICODE_NORM_QC_NO}, + {0x2F89A, UNICODE_NORM_QC_NO}, + {0x2F89B, UNICODE_NORM_QC_NO}, + {0x2F89C, UNICODE_NORM_QC_NO}, + {0x2F89D, UNICODE_NORM_QC_NO}, + {0x2F89E, UNICODE_NORM_QC_NO}, + {0x2F89F, UNICODE_NORM_QC_NO}, + {0x2F8A0, UNICODE_NORM_QC_NO}, + {0x2F8A1, UNICODE_NORM_QC_NO}, + {0x2F8A2, UNICODE_NORM_QC_NO}, + {0x2F8A3, UNICODE_NORM_QC_NO}, + {0x2F8A4, UNICODE_NORM_QC_NO}, + {0x2F8A5, UNICODE_NORM_QC_NO}, + {0x2F8A6, UNICODE_NORM_QC_NO}, + {0x2F8A7, UNICODE_NORM_QC_NO}, + {0x2F8A8, UNICODE_NORM_QC_NO}, + {0x2F8A9, UNICODE_NORM_QC_NO}, + {0x2F8AA, UNICODE_NORM_QC_NO}, + {0x2F8AB, UNICODE_NORM_QC_NO}, + {0x2F8AC, UNICODE_NORM_QC_NO}, + {0x2F8AD, UNICODE_NORM_QC_NO}, + {0x2F8AE, UNICODE_NORM_QC_NO}, + {0x2F8AF, UNICODE_NORM_QC_NO}, + {0x2F8B0, UNICODE_NORM_QC_NO}, + {0x2F8B1, UNICODE_NORM_QC_NO}, + {0x2F8B2, UNICODE_NORM_QC_NO}, + {0x2F8B3, UNICODE_NORM_QC_NO}, + {0x2F8B4, UNICODE_NORM_QC_NO}, + {0x2F8B5, UNICODE_NORM_QC_NO}, + {0x2F8B6, UNICODE_NORM_QC_NO}, + {0x2F8B7, UNICODE_NORM_QC_NO}, + {0x2F8B8, UNICODE_NORM_QC_NO}, + {0x2F8B9, UNICODE_NORM_QC_NO}, + {0x2F8BA, UNICODE_NORM_QC_NO}, + {0x2F8BB, UNICODE_NORM_QC_NO}, + {0x2F8BC, UNICODE_NORM_QC_NO}, + {0x2F8BD, UNICODE_NORM_QC_NO}, + {0x2F8BE, UNICODE_NORM_QC_NO}, + {0x2F8BF, UNICODE_NORM_QC_NO}, + {0x2F8C0, UNICODE_NORM_QC_NO}, + {0x2F8C1, UNICODE_NORM_QC_NO}, + {0x2F8C2, UNICODE_NORM_QC_NO}, + {0x2F8C3, UNICODE_NORM_QC_NO}, + {0x2F8C4, UNICODE_NORM_QC_NO}, + {0x2F8C5, UNICODE_NORM_QC_NO}, + {0x2F8C6, UNICODE_NORM_QC_NO}, + {0x2F8C7, UNICODE_NORM_QC_NO}, + {0x2F8C8, UNICODE_NORM_QC_NO}, + {0x2F8C9, UNICODE_NORM_QC_NO}, + {0x2F8CA, UNICODE_NORM_QC_NO}, + {0x2F8CB, UNICODE_NORM_QC_NO}, + {0x2F8CC, UNICODE_NORM_QC_NO}, + {0x2F8CD, UNICODE_NORM_QC_NO}, + {0x2F8CE, UNICODE_NORM_QC_NO}, + {0x2F8CF, UNICODE_NORM_QC_NO}, + {0x2F8D0, UNICODE_NORM_QC_NO}, + {0x2F8D1, UNICODE_NORM_QC_NO}, + {0x2F8D2, UNICODE_NORM_QC_NO}, + {0x2F8D3, UNICODE_NORM_QC_NO}, + {0x2F8D4, UNICODE_NORM_QC_NO}, + {0x2F8D5, UNICODE_NORM_QC_NO}, + {0x2F8D6, UNICODE_NORM_QC_NO}, + {0x2F8D7, UNICODE_NORM_QC_NO}, + {0x2F8D8, UNICODE_NORM_QC_NO}, + {0x2F8D9, UNICODE_NORM_QC_NO}, + {0x2F8DA, UNICODE_NORM_QC_NO}, + {0x2F8DB, UNICODE_NORM_QC_NO}, + {0x2F8DC, UNICODE_NORM_QC_NO}, + {0x2F8DD, UNICODE_NORM_QC_NO}, + {0x2F8DE, UNICODE_NORM_QC_NO}, + {0x2F8DF, UNICODE_NORM_QC_NO}, + {0x2F8E0, UNICODE_NORM_QC_NO}, + {0x2F8E1, UNICODE_NORM_QC_NO}, + {0x2F8E2, UNICODE_NORM_QC_NO}, + {0x2F8E3, UNICODE_NORM_QC_NO}, + {0x2F8E4, UNICODE_NORM_QC_NO}, + {0x2F8E5, UNICODE_NORM_QC_NO}, + {0x2F8E6, UNICODE_NORM_QC_NO}, + {0x2F8E7, UNICODE_NORM_QC_NO}, + {0x2F8E8, UNICODE_NORM_QC_NO}, + {0x2F8E9, UNICODE_NORM_QC_NO}, + {0x2F8EA, UNICODE_NORM_QC_NO}, + {0x2F8EB, UNICODE_NORM_QC_NO}, + {0x2F8EC, UNICODE_NORM_QC_NO}, + {0x2F8ED, UNICODE_NORM_QC_NO}, + {0x2F8EE, UNICODE_NORM_QC_NO}, + {0x2F8EF, UNICODE_NORM_QC_NO}, + {0x2F8F0, UNICODE_NORM_QC_NO}, + {0x2F8F1, UNICODE_NORM_QC_NO}, + {0x2F8F2, UNICODE_NORM_QC_NO}, + {0x2F8F3, UNICODE_NORM_QC_NO}, + {0x2F8F4, UNICODE_NORM_QC_NO}, + {0x2F8F5, UNICODE_NORM_QC_NO}, + {0x2F8F6, UNICODE_NORM_QC_NO}, + {0x2F8F7, UNICODE_NORM_QC_NO}, + {0x2F8F8, UNICODE_NORM_QC_NO}, + {0x2F8F9, UNICODE_NORM_QC_NO}, + {0x2F8FA, UNICODE_NORM_QC_NO}, + {0x2F8FB, UNICODE_NORM_QC_NO}, + {0x2F8FC, UNICODE_NORM_QC_NO}, + {0x2F8FD, UNICODE_NORM_QC_NO}, + {0x2F8FE, UNICODE_NORM_QC_NO}, + {0x2F8FF, UNICODE_NORM_QC_NO}, + {0x2F900, UNICODE_NORM_QC_NO}, + {0x2F901, UNICODE_NORM_QC_NO}, + {0x2F902, UNICODE_NORM_QC_NO}, + {0x2F903, UNICODE_NORM_QC_NO}, + {0x2F904, UNICODE_NORM_QC_NO}, + {0x2F905, UNICODE_NORM_QC_NO}, + {0x2F906, UNICODE_NORM_QC_NO}, + {0x2F907, UNICODE_NORM_QC_NO}, + {0x2F908, UNICODE_NORM_QC_NO}, + {0x2F909, UNICODE_NORM_QC_NO}, + {0x2F90A, UNICODE_NORM_QC_NO}, + {0x2F90B, UNICODE_NORM_QC_NO}, + {0x2F90C, UNICODE_NORM_QC_NO}, + {0x2F90D, UNICODE_NORM_QC_NO}, + {0x2F90E, UNICODE_NORM_QC_NO}, + {0x2F90F, UNICODE_NORM_QC_NO}, + {0x2F910, UNICODE_NORM_QC_NO}, + {0x2F911, UNICODE_NORM_QC_NO}, + {0x2F912, UNICODE_NORM_QC_NO}, + {0x2F913, UNICODE_NORM_QC_NO}, + {0x2F914, UNICODE_NORM_QC_NO}, + {0x2F915, UNICODE_NORM_QC_NO}, + {0x2F916, UNICODE_NORM_QC_NO}, + {0x2F917, UNICODE_NORM_QC_NO}, + {0x2F918, UNICODE_NORM_QC_NO}, + {0x2F919, UNICODE_NORM_QC_NO}, + {0x2F91A, UNICODE_NORM_QC_NO}, + {0x2F91B, UNICODE_NORM_QC_NO}, + {0x2F91C, UNICODE_NORM_QC_NO}, + {0x2F91D, UNICODE_NORM_QC_NO}, + {0x2F91E, UNICODE_NORM_QC_NO}, + {0x2F91F, UNICODE_NORM_QC_NO}, + {0x2F920, UNICODE_NORM_QC_NO}, + {0x2F921, UNICODE_NORM_QC_NO}, + {0x2F922, UNICODE_NORM_QC_NO}, + {0x2F923, UNICODE_NORM_QC_NO}, + {0x2F924, UNICODE_NORM_QC_NO}, + {0x2F925, UNICODE_NORM_QC_NO}, + {0x2F926, UNICODE_NORM_QC_NO}, + {0x2F927, UNICODE_NORM_QC_NO}, + {0x2F928, UNICODE_NORM_QC_NO}, + {0x2F929, UNICODE_NORM_QC_NO}, + {0x2F92A, UNICODE_NORM_QC_NO}, + {0x2F92B, UNICODE_NORM_QC_NO}, + {0x2F92C, UNICODE_NORM_QC_NO}, + {0x2F92D, UNICODE_NORM_QC_NO}, + {0x2F92E, UNICODE_NORM_QC_NO}, + {0x2F92F, UNICODE_NORM_QC_NO}, + {0x2F930, UNICODE_NORM_QC_NO}, + {0x2F931, UNICODE_NORM_QC_NO}, + {0x2F932, UNICODE_NORM_QC_NO}, + {0x2F933, UNICODE_NORM_QC_NO}, + {0x2F934, UNICODE_NORM_QC_NO}, + {0x2F935, UNICODE_NORM_QC_NO}, + {0x2F936, UNICODE_NORM_QC_NO}, + {0x2F937, UNICODE_NORM_QC_NO}, + {0x2F938, UNICODE_NORM_QC_NO}, + {0x2F939, UNICODE_NORM_QC_NO}, + {0x2F93A, UNICODE_NORM_QC_NO}, + {0x2F93B, UNICODE_NORM_QC_NO}, + {0x2F93C, UNICODE_NORM_QC_NO}, + {0x2F93D, UNICODE_NORM_QC_NO}, + {0x2F93E, UNICODE_NORM_QC_NO}, + {0x2F93F, UNICODE_NORM_QC_NO}, + {0x2F940, UNICODE_NORM_QC_NO}, + {0x2F941, UNICODE_NORM_QC_NO}, + {0x2F942, UNICODE_NORM_QC_NO}, + {0x2F943, UNICODE_NORM_QC_NO}, + {0x2F944, UNICODE_NORM_QC_NO}, + {0x2F945, UNICODE_NORM_QC_NO}, + {0x2F946, UNICODE_NORM_QC_NO}, + {0x2F947, UNICODE_NORM_QC_NO}, + {0x2F948, UNICODE_NORM_QC_NO}, + {0x2F949, UNICODE_NORM_QC_NO}, + {0x2F94A, UNICODE_NORM_QC_NO}, + {0x2F94B, UNICODE_NORM_QC_NO}, + {0x2F94C, UNICODE_NORM_QC_NO}, + {0x2F94D, UNICODE_NORM_QC_NO}, + {0x2F94E, UNICODE_NORM_QC_NO}, + {0x2F94F, UNICODE_NORM_QC_NO}, + {0x2F950, UNICODE_NORM_QC_NO}, + {0x2F951, UNICODE_NORM_QC_NO}, + {0x2F952, UNICODE_NORM_QC_NO}, + {0x2F953, UNICODE_NORM_QC_NO}, + {0x2F954, UNICODE_NORM_QC_NO}, + {0x2F955, UNICODE_NORM_QC_NO}, + {0x2F956, UNICODE_NORM_QC_NO}, + {0x2F957, UNICODE_NORM_QC_NO}, + {0x2F958, UNICODE_NORM_QC_NO}, + {0x2F959, UNICODE_NORM_QC_NO}, + {0x2F95A, UNICODE_NORM_QC_NO}, + {0x2F95B, UNICODE_NORM_QC_NO}, + {0x2F95C, UNICODE_NORM_QC_NO}, + {0x2F95D, UNICODE_NORM_QC_NO}, + {0x2F95E, UNICODE_NORM_QC_NO}, + {0x2F95F, UNICODE_NORM_QC_NO}, + {0x2F960, UNICODE_NORM_QC_NO}, + {0x2F961, UNICODE_NORM_QC_NO}, + {0x2F962, UNICODE_NORM_QC_NO}, + {0x2F963, UNICODE_NORM_QC_NO}, + {0x2F964, UNICODE_NORM_QC_NO}, + {0x2F965, UNICODE_NORM_QC_NO}, + {0x2F966, UNICODE_NORM_QC_NO}, + {0x2F967, UNICODE_NORM_QC_NO}, + {0x2F968, UNICODE_NORM_QC_NO}, + {0x2F969, UNICODE_NORM_QC_NO}, + {0x2F96A, UNICODE_NORM_QC_NO}, + {0x2F96B, UNICODE_NORM_QC_NO}, + {0x2F96C, UNICODE_NORM_QC_NO}, + {0x2F96D, UNICODE_NORM_QC_NO}, + {0x2F96E, UNICODE_NORM_QC_NO}, + {0x2F96F, UNICODE_NORM_QC_NO}, + {0x2F970, UNICODE_NORM_QC_NO}, + {0x2F971, UNICODE_NORM_QC_NO}, + {0x2F972, UNICODE_NORM_QC_NO}, + {0x2F973, UNICODE_NORM_QC_NO}, + {0x2F974, UNICODE_NORM_QC_NO}, + {0x2F975, UNICODE_NORM_QC_NO}, + {0x2F976, UNICODE_NORM_QC_NO}, + {0x2F977, UNICODE_NORM_QC_NO}, + {0x2F978, UNICODE_NORM_QC_NO}, + {0x2F979, UNICODE_NORM_QC_NO}, + {0x2F97A, UNICODE_NORM_QC_NO}, + {0x2F97B, UNICODE_NORM_QC_NO}, + {0x2F97C, UNICODE_NORM_QC_NO}, + {0x2F97D, UNICODE_NORM_QC_NO}, + {0x2F97E, UNICODE_NORM_QC_NO}, + {0x2F97F, UNICODE_NORM_QC_NO}, + {0x2F980, UNICODE_NORM_QC_NO}, + {0x2F981, UNICODE_NORM_QC_NO}, + {0x2F982, UNICODE_NORM_QC_NO}, + {0x2F983, UNICODE_NORM_QC_NO}, + {0x2F984, UNICODE_NORM_QC_NO}, + {0x2F985, UNICODE_NORM_QC_NO}, + {0x2F986, UNICODE_NORM_QC_NO}, + {0x2F987, UNICODE_NORM_QC_NO}, + {0x2F988, UNICODE_NORM_QC_NO}, + {0x2F989, UNICODE_NORM_QC_NO}, + {0x2F98A, UNICODE_NORM_QC_NO}, + {0x2F98B, UNICODE_NORM_QC_NO}, + {0x2F98C, UNICODE_NORM_QC_NO}, + {0x2F98D, UNICODE_NORM_QC_NO}, + {0x2F98E, UNICODE_NORM_QC_NO}, + {0x2F98F, UNICODE_NORM_QC_NO}, + {0x2F990, UNICODE_NORM_QC_NO}, + {0x2F991, UNICODE_NORM_QC_NO}, + {0x2F992, UNICODE_NORM_QC_NO}, + {0x2F993, UNICODE_NORM_QC_NO}, + {0x2F994, UNICODE_NORM_QC_NO}, + {0x2F995, UNICODE_NORM_QC_NO}, + {0x2F996, UNICODE_NORM_QC_NO}, + {0x2F997, UNICODE_NORM_QC_NO}, + {0x2F998, UNICODE_NORM_QC_NO}, + {0x2F999, UNICODE_NORM_QC_NO}, + {0x2F99A, UNICODE_NORM_QC_NO}, + {0x2F99B, UNICODE_NORM_QC_NO}, + {0x2F99C, UNICODE_NORM_QC_NO}, + {0x2F99D, UNICODE_NORM_QC_NO}, + {0x2F99E, UNICODE_NORM_QC_NO}, + {0x2F99F, UNICODE_NORM_QC_NO}, + {0x2F9A0, UNICODE_NORM_QC_NO}, + {0x2F9A1, UNICODE_NORM_QC_NO}, + {0x2F9A2, UNICODE_NORM_QC_NO}, + {0x2F9A3, UNICODE_NORM_QC_NO}, + {0x2F9A4, UNICODE_NORM_QC_NO}, + {0x2F9A5, UNICODE_NORM_QC_NO}, + {0x2F9A6, UNICODE_NORM_QC_NO}, + {0x2F9A7, UNICODE_NORM_QC_NO}, + {0x2F9A8, UNICODE_NORM_QC_NO}, + {0x2F9A9, UNICODE_NORM_QC_NO}, + {0x2F9AA, UNICODE_NORM_QC_NO}, + {0x2F9AB, UNICODE_NORM_QC_NO}, + {0x2F9AC, UNICODE_NORM_QC_NO}, + {0x2F9AD, UNICODE_NORM_QC_NO}, + {0x2F9AE, UNICODE_NORM_QC_NO}, + {0x2F9AF, UNICODE_NORM_QC_NO}, + {0x2F9B0, UNICODE_NORM_QC_NO}, + {0x2F9B1, UNICODE_NORM_QC_NO}, + {0x2F9B2, UNICODE_NORM_QC_NO}, + {0x2F9B3, UNICODE_NORM_QC_NO}, + {0x2F9B4, UNICODE_NORM_QC_NO}, + {0x2F9B5, UNICODE_NORM_QC_NO}, + {0x2F9B6, UNICODE_NORM_QC_NO}, + {0x2F9B7, UNICODE_NORM_QC_NO}, + {0x2F9B8, UNICODE_NORM_QC_NO}, + {0x2F9B9, UNICODE_NORM_QC_NO}, + {0x2F9BA, UNICODE_NORM_QC_NO}, + {0x2F9BB, UNICODE_NORM_QC_NO}, + {0x2F9BC, UNICODE_NORM_QC_NO}, + {0x2F9BD, UNICODE_NORM_QC_NO}, + {0x2F9BE, UNICODE_NORM_QC_NO}, + {0x2F9BF, UNICODE_NORM_QC_NO}, + {0x2F9C0, UNICODE_NORM_QC_NO}, + {0x2F9C1, UNICODE_NORM_QC_NO}, + {0x2F9C2, UNICODE_NORM_QC_NO}, + {0x2F9C3, UNICODE_NORM_QC_NO}, + {0x2F9C4, UNICODE_NORM_QC_NO}, + {0x2F9C5, UNICODE_NORM_QC_NO}, + {0x2F9C6, UNICODE_NORM_QC_NO}, + {0x2F9C7, UNICODE_NORM_QC_NO}, + {0x2F9C8, UNICODE_NORM_QC_NO}, + {0x2F9C9, UNICODE_NORM_QC_NO}, + {0x2F9CA, UNICODE_NORM_QC_NO}, + {0x2F9CB, UNICODE_NORM_QC_NO}, + {0x2F9CC, UNICODE_NORM_QC_NO}, + {0x2F9CD, UNICODE_NORM_QC_NO}, + {0x2F9CE, UNICODE_NORM_QC_NO}, + {0x2F9CF, UNICODE_NORM_QC_NO}, + {0x2F9D0, UNICODE_NORM_QC_NO}, + {0x2F9D1, UNICODE_NORM_QC_NO}, + {0x2F9D2, UNICODE_NORM_QC_NO}, + {0x2F9D3, UNICODE_NORM_QC_NO}, + {0x2F9D4, UNICODE_NORM_QC_NO}, + {0x2F9D5, UNICODE_NORM_QC_NO}, + {0x2F9D6, UNICODE_NORM_QC_NO}, + {0x2F9D7, UNICODE_NORM_QC_NO}, + {0x2F9D8, UNICODE_NORM_QC_NO}, + {0x2F9D9, UNICODE_NORM_QC_NO}, + {0x2F9DA, UNICODE_NORM_QC_NO}, + {0x2F9DB, UNICODE_NORM_QC_NO}, + {0x2F9DC, UNICODE_NORM_QC_NO}, + {0x2F9DD, UNICODE_NORM_QC_NO}, + {0x2F9DE, UNICODE_NORM_QC_NO}, + {0x2F9DF, UNICODE_NORM_QC_NO}, + {0x2F9E0, UNICODE_NORM_QC_NO}, + {0x2F9E1, UNICODE_NORM_QC_NO}, + {0x2F9E2, UNICODE_NORM_QC_NO}, + {0x2F9E3, UNICODE_NORM_QC_NO}, + {0x2F9E4, UNICODE_NORM_QC_NO}, + {0x2F9E5, UNICODE_NORM_QC_NO}, + {0x2F9E6, UNICODE_NORM_QC_NO}, + {0x2F9E7, UNICODE_NORM_QC_NO}, + {0x2F9E8, UNICODE_NORM_QC_NO}, + {0x2F9E9, UNICODE_NORM_QC_NO}, + {0x2F9EA, UNICODE_NORM_QC_NO}, + {0x2F9EB, UNICODE_NORM_QC_NO}, + {0x2F9EC, UNICODE_NORM_QC_NO}, + {0x2F9ED, UNICODE_NORM_QC_NO}, + {0x2F9EE, UNICODE_NORM_QC_NO}, + {0x2F9EF, UNICODE_NORM_QC_NO}, + {0x2F9F0, UNICODE_NORM_QC_NO}, + {0x2F9F1, UNICODE_NORM_QC_NO}, + {0x2F9F2, UNICODE_NORM_QC_NO}, + {0x2F9F3, UNICODE_NORM_QC_NO}, + {0x2F9F4, UNICODE_NORM_QC_NO}, + {0x2F9F5, UNICODE_NORM_QC_NO}, + {0x2F9F6, UNICODE_NORM_QC_NO}, + {0x2F9F7, UNICODE_NORM_QC_NO}, + {0x2F9F8, UNICODE_NORM_QC_NO}, + {0x2F9F9, UNICODE_NORM_QC_NO}, + {0x2F9FA, UNICODE_NORM_QC_NO}, + {0x2F9FB, UNICODE_NORM_QC_NO}, + {0x2F9FC, UNICODE_NORM_QC_NO}, + {0x2F9FD, UNICODE_NORM_QC_NO}, + {0x2F9FE, UNICODE_NORM_QC_NO}, + {0x2F9FF, UNICODE_NORM_QC_NO}, + {0x2FA00, UNICODE_NORM_QC_NO}, + {0x2FA01, UNICODE_NORM_QC_NO}, + {0x2FA02, UNICODE_NORM_QC_NO}, + {0x2FA03, UNICODE_NORM_QC_NO}, + {0x2FA04, UNICODE_NORM_QC_NO}, + {0x2FA05, UNICODE_NORM_QC_NO}, + {0x2FA06, UNICODE_NORM_QC_NO}, + {0x2FA07, UNICODE_NORM_QC_NO}, + {0x2FA08, UNICODE_NORM_QC_NO}, + {0x2FA09, UNICODE_NORM_QC_NO}, + {0x2FA0A, UNICODE_NORM_QC_NO}, + {0x2FA0B, UNICODE_NORM_QC_NO}, + {0x2FA0C, UNICODE_NORM_QC_NO}, + {0x2FA0D, UNICODE_NORM_QC_NO}, + {0x2FA0E, UNICODE_NORM_QC_NO}, + {0x2FA0F, UNICODE_NORM_QC_NO}, + {0x2FA10, UNICODE_NORM_QC_NO}, + {0x2FA11, UNICODE_NORM_QC_NO}, + {0x2FA12, UNICODE_NORM_QC_NO}, + {0x2FA13, UNICODE_NORM_QC_NO}, + {0x2FA14, UNICODE_NORM_QC_NO}, + {0x2FA15, UNICODE_NORM_QC_NO}, + {0x2FA16, UNICODE_NORM_QC_NO}, + {0x2FA17, UNICODE_NORM_QC_NO}, + {0x2FA18, UNICODE_NORM_QC_NO}, + {0x2FA19, UNICODE_NORM_QC_NO}, + {0x2FA1A, UNICODE_NORM_QC_NO}, + {0x2FA1B, UNICODE_NORM_QC_NO}, + {0x2FA1C, UNICODE_NORM_QC_NO}, + {0x2FA1D, UNICODE_NORM_QC_NO}, +}; + +/* Perfect hash function for NFC_QC */ +static int +NFC_QC_hash_func(const void *key) +{ + static const int16 h[2463] = { + 0, -2717, 0, 221, 1293, 223, 1295, 225, + 226, 241, 0, 229, 230, 231, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -386, 0, 0, 0, 0, 0, 0, 0, + -163, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -246, -175, 1260, 0, 0, 0, -174, -173, + 0, -172, 0, 0, 0, 0, 0, 0, + 1049, 0, 300, 301, 1071, 0, 1071, 0, + 1071, 1071, 1057, 0, 0, 0, 0, 1061, + 0, -1053, 1664, 0, 2956, 0, 0, -13, + 0, 0, 0, 0, 2156, 0, 0, 0, + 0, 0, 0, 0, 71, 0, 1082, 0, + 1083, 1083, 0, 1084, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 359, 360, 361, + -1091, 363, -762, -130, -129, -128, -127, -126, + 137, -124, -708, -707, -706, -120, -185, -705, + -117, -184, -1307, -114, -113, -112, -111, 0, + 386, 387, 388, 389, -90, 391, 171, 172, + 394, -94, -183, 397, 398, 399, -98, -225, + 402, -1019, -636, -1019, -225, 407, 408, 409, + 410, 411, 674, 413, -171, -170, -169, 417, + 352, -168, 420, 353, -770, 423, 424, 425, + 426, 427, 428, 32767, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 32767, 32767, 237, 32767, 236, 32767, + 32767, 234, 234, 234, 234, 617, 234, 234, + 234, -2483, 234, -1430, 1526, -1430, 1527, 47, + 48, 471, 230, 32767, 32767, 32767, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, + -159, 227, 227, 227, 227, 227, 227, 227, + 64, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, + -19, 52, 1487, 227, 227, 227, 53, 54, + 227, 55, 227, 227, 227, 227, 227, 227, + 1276, 227, -989, 32767, 1296, 225, 1296, 225, + 1296, 1296, 1282, 225, 225, 225, 225, 1286, + 225, -828, 1889, 225, 3181, 225, 225, 212, + 225, 225, 225, 225, 2381, 225, 225, 225, + 225, 225, 225, 225, 296, 225, 1307, 225, + 1308, 1308, 225, 1309, 225, 225, 225, 225, + 225, 225, 225, 225, 225, 225, 225, 225, + 225, 225, 225, 225, 225, 584, 585, 586, + -866, 588, -537, 95, 96, 97, 98, 99, + 362, 101, -483, -482, -481, 105, 40, -480, + 108, 41, -1082, 111, 112, 113, 114, 225, + 611, 612, 613, 614, 135, 616, 396, 397, + 619, 131, 42, 622, 623, 624, 127, 0, + 627, -794, -411, -794, 0, 632, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + -272, 32767, 32767, 32767, 0, 32767, 32767, 32767, + 32767, 32767, -166, -165, 32767, 32767, 32767, 32767, + -164, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 397, 32767, 396, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 386, + 0, 386, 386, 386, 386, 386, 386, 386, + 223, 386, 386, 386, 32767, 385, 385, 385, + 385, 385, 32767, 384, 32767, 383, 383, 32767, + 382, 382, 32767, 381, 381, 381, 381, 381, + 135, 206, 1641, 381, 32767, 32767, 32767, 32767, + 32767, 32767, -160, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 1148, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -257, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -910, -910, 32767, 32767, + 0, 32767, 0, 32767, 0, 32767, 0, 32767, + 147, 32767, 0, 32767, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 143, 32767, 144, 32767, 145, + 32767, 146, 32767, 0, 32767, 148, 32767, 149, + 32767, 32767, 32767, -160, 32767, 32767, 32767, 32767, + 32767, 32767, 15, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 145, 32767, 144, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, -148, 32767, 32767, 32767, 32767, + 32767, 32767, 2009, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 135, -918, 32767, + 151, 32767, 32767, 0, 1, 2, 3, 4, + 133, 5, 6, 7, 8, 9, 10, 11, + 32767, 32767, -1248, 32767, 13, 154, 188, 188, + 32767, 32767, 32767, 32767, 32767, 155, 16, 32767, + 32767, 32767, 32767, 32767, 32767, -1853, -1054, 18, + -1052, -1051, -1036, 22, 32767, 157, 32767, 28, + 23, 1077, 673, 25, -2930, 0, 32767, 32767, + 32767, 32767, 32767, 27, 32767, 155, 32767, 154, + 32767, 32767, -62, 28, -42, 30, -1051, 32, + -1050, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 34, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 129, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 672, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 32767, 32767, 32767, 32767, -156, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -155, 32767, 32767, + 32767, 0, 0, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 73, 32767, 32767, 32767, 32767, 74, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 675, + 32767, 32767, 32767, 32767, 32767, 75, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 165, 32767, 32767, 32767, 166, 167, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 170, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 689, 690, 691, 692, 693, 694, 695, + 696, 697, 698, 699, 700, 701, 702, 703, + 704, 705, 706, 707, 708, 709, 710, 711, + 712, 713, 714, 715, 716, 717, 718, 719, + 720, 721, 722, -304, -303, -302, -301, -300, + -299, -298, -297, 930, -295, -294, -293, -292, + -291, -290, -289, -288, -287, -286, -285, -284, + -283, -282, -281, -280, -279, -278, -277, -276, + -275, 753, 754, 755, 646, 757, -712, -1765, + 952, -712, 2244, -712, 2245, 765, 766, 767, + 768, 125, 770, 771, 772, 773, 774, 775, + 603, 777, 778, 779, 780, 781, 782, 783, + 784, 2011, 786, 787, 788, 789, 790, 791, + 792, 793, 794, 795, 796, 797, 798, 799, + 800, 801, 802, 803, 804, 805, 806, 603, + 603, 809, 603, 811, 603, 603, 814, 815, + 816, 817, 435, 819, 820, 821, 3539, 823, + 603, -468, 603, -468, 603, 603, 589, 831, + 603, 603, 603, 835, 836, 837, 838, 839, + 840, 841, 842, 843, 844, 845, 846, 847, + 848, 849, 850, 851, 852, 1239, 854, 855, + 856, 857, 858, 859, 860, 1024, 862, 863, + 864, 865, 866, 867, 868, 869, 870, 871, + 872, 873, 874, 875, 876, 877, 878, 879, + 880, 881, 882, 883, 884, 1131, 1061, -373, + 888, 889, 890, 1065, 1065, 893, 1066, 895, + 896, 897, 898, 899, 900, -148, 902, 603, + 603, -166, 906, -164, 908, -162, -161, -146, + 912, 913, 914, 915, -145, 917, 1971, -745, + 920, -2035, 922, 923, 937, 925, 926, 927, + 928, -1227, 930, 931, 932, 933, 934, 935, + 936, 866, 938, -143, 940, -142, -141, 943, + -140, 32767, 945, 946, 947, 948, 949, 950, + 951, 952, 953, 954, 955, 956, 957, 958, + 959, 960, 961, -65, -64, -63, -62, -61, + -60, -59, -58, 1169, -56, -55, -54, -53, + -52, -51, -50, -49, -48, -47, -46, -45, + -44, -43, -42, -41, -40, -39, -38, -37, + -36, 992, 993, 994, 885, 996, -473, -1526, + 1191, -473, 2483, -473, 2484, 1004, 1005, 1006, + 1007, 364, 1009, 1010, 1011, 1012, 1013, 1014, + 842, 1016, 1017, 1018, 1019, 1020, 1021, 1022, + 1023, 2250, 1025, 1026, 1027, 1028, 1029, 1030, + 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, + 1039, 1040, 1041, 1042, 1043, 1044, 1045, 842, + 842, 1048, 842, 1050, 842, 842, 1053, 1054, + 1055, 1056, 674, 1058, 1059, 1060, 3778, 1062, + 842, -229, 842, -229, 842, 842, 828, 1070, + 842, 842, 842, 1074, 1075, 1076, 1077, 1078, + 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, + 1087, 1088, 1089, 1090, 1091, 1478, 1093, 1094, + 1095, 1096, 1097, 1098, 1099, 1263, 1101, 1102, + 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, + 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, + 1119, 1120, 1121, 1122, 1123, 1370, 1300, -134, + 1127, 1128, 1129, 1304, 1304, 1132, 1305, 1134, + 1135, 1136, 1137, 1138, 1139, 91, 1141, 842, + 842, 73, 1145, 75, 1147, 77, 78, 93, + 1151, 1152, 1153, 1154, 94, 1156, 2210, -506, + 1159, -1796, 1161, 1162, 1176, 1164, 1165, 1166, + 1167, -988, 1169, 1170, 1171, 1172, 1173, 1174, + 1175, 1105, 1177, 96, 1179, 97, 98, 1182, + 99, 1184, 1185, 1186, 1187, 1188, 1189, 1190, + 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, + 1199, 1200, 0, 174, 175, 176, 177, 178, + 179, 180, 181, 1408, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, + 203, 0, 0, 206, 0, 208, 0, 0, + 211, 212, 213, 214, -168, 216, 217, 218, + 2936, 220, 0, -1071, 0, -1071, 0, 0, + -14, 228, 0, 0, 0, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 636, + 251, 252, 253, 254, 255, 256, 257, 421, + 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 528, + 458, -976, 285, 286, 287, 462, 462, 290, + 463, 292, 293, 294, 295, 296, 297, -751, + 299, 0, 0, -769, 303, -767, 305, -765, + -764, -749, 309, 310, 311, 312, -748, 314, + 1368, -1348, 317, -2638, 319, 320, 334, 322, + 323, 324, 325, -1830, 327, 328, 329, 330, + 331, 332, 333, 263, 335, -746, 337, -745, + -744, 340, -743, 342, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 0, 0, 0, 1453, + 0, 1126, 495, 495, 495, 495, 495, 233, + 495, 1080, 1080, 1080, 495, 561, 1082, 495, + 563, 1687, 495, 495, 495, 495, 385, 0, + 0, 0, 0, 480, 0, 221, 221, 0, + 489, 579, 0, 0, 0, 498, 626, 0, + 1422, 1040, 1424, 631, 0, 0, 0, 0, + 0, -262, 0, 585, 585, 585, 0, 66, + 587, 0, 68, 1192, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 669, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 670, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 142, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1027, 1027, 1027, + 1027, 1027, 1027, 1027, 1027, -199, 1027, 1027, + 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, + 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, + 1027, 1027, 1027, 0, 0, 0, 110, 0, + 1470, 2524, -192, 1473, -1482, 1475, -1481, 0, + 0, 0, 0, 644, 0, 0, 0, 0, + 0, 0, 173, 0, 0, 0, 0, 0, + 0, 0, 0, -1226, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 204, 205, 0, 207, 0, 209, 210, + 0, 0, 0, 0, 383, 0, 0 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 0; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 17 + c; + } + return h[a % 2463] + h[b % 2463]; +} + +/* Hash lookup information for NFC_QC */ +static const pg_unicode_norminfo UnicodeNormInfo_NFC_QC = { + UnicodeNormProps_NFC_QC, + NFC_QC_hash_func, + 1231 +}; + +static const pg_unicode_normprops UnicodeNormProps_NFKC_QC[] = { + {0x00A0, UNICODE_NORM_QC_NO}, + {0x00A8, UNICODE_NORM_QC_NO}, + {0x00AA, UNICODE_NORM_QC_NO}, + {0x00AF, UNICODE_NORM_QC_NO}, + {0x00B2, UNICODE_NORM_QC_NO}, + {0x00B3, UNICODE_NORM_QC_NO}, + {0x00B4, UNICODE_NORM_QC_NO}, + {0x00B5, UNICODE_NORM_QC_NO}, + {0x00B8, UNICODE_NORM_QC_NO}, + {0x00B9, UNICODE_NORM_QC_NO}, + {0x00BA, UNICODE_NORM_QC_NO}, + {0x00BC, UNICODE_NORM_QC_NO}, + {0x00BD, UNICODE_NORM_QC_NO}, + {0x00BE, UNICODE_NORM_QC_NO}, + {0x0132, UNICODE_NORM_QC_NO}, + {0x0133, UNICODE_NORM_QC_NO}, + {0x013F, UNICODE_NORM_QC_NO}, + {0x0140, UNICODE_NORM_QC_NO}, + {0x0149, UNICODE_NORM_QC_NO}, + {0x017F, UNICODE_NORM_QC_NO}, + {0x01C4, UNICODE_NORM_QC_NO}, + {0x01C5, UNICODE_NORM_QC_NO}, + {0x01C6, UNICODE_NORM_QC_NO}, + {0x01C7, UNICODE_NORM_QC_NO}, + {0x01C8, UNICODE_NORM_QC_NO}, + {0x01C9, UNICODE_NORM_QC_NO}, + {0x01CA, UNICODE_NORM_QC_NO}, + {0x01CB, UNICODE_NORM_QC_NO}, + {0x01CC, UNICODE_NORM_QC_NO}, + {0x01F1, UNICODE_NORM_QC_NO}, + {0x01F2, UNICODE_NORM_QC_NO}, + {0x01F3, UNICODE_NORM_QC_NO}, + {0x02B0, UNICODE_NORM_QC_NO}, + {0x02B1, UNICODE_NORM_QC_NO}, + {0x02B2, UNICODE_NORM_QC_NO}, + {0x02B3, UNICODE_NORM_QC_NO}, + {0x02B4, UNICODE_NORM_QC_NO}, + {0x02B5, UNICODE_NORM_QC_NO}, + {0x02B6, UNICODE_NORM_QC_NO}, + {0x02B7, UNICODE_NORM_QC_NO}, + {0x02B8, UNICODE_NORM_QC_NO}, + {0x02D8, UNICODE_NORM_QC_NO}, + {0x02D9, UNICODE_NORM_QC_NO}, + {0x02DA, UNICODE_NORM_QC_NO}, + {0x02DB, UNICODE_NORM_QC_NO}, + {0x02DC, UNICODE_NORM_QC_NO}, + {0x02DD, UNICODE_NORM_QC_NO}, + {0x02E0, UNICODE_NORM_QC_NO}, + {0x02E1, UNICODE_NORM_QC_NO}, + {0x02E2, UNICODE_NORM_QC_NO}, + {0x02E3, UNICODE_NORM_QC_NO}, + {0x02E4, UNICODE_NORM_QC_NO}, + {0x0300, UNICODE_NORM_QC_MAYBE}, + {0x0301, UNICODE_NORM_QC_MAYBE}, + {0x0302, UNICODE_NORM_QC_MAYBE}, + {0x0303, UNICODE_NORM_QC_MAYBE}, + {0x0304, UNICODE_NORM_QC_MAYBE}, + {0x0306, UNICODE_NORM_QC_MAYBE}, + {0x0307, UNICODE_NORM_QC_MAYBE}, + {0x0308, UNICODE_NORM_QC_MAYBE}, + {0x0309, UNICODE_NORM_QC_MAYBE}, + {0x030A, UNICODE_NORM_QC_MAYBE}, + {0x030B, UNICODE_NORM_QC_MAYBE}, + {0x030C, UNICODE_NORM_QC_MAYBE}, + {0x030F, UNICODE_NORM_QC_MAYBE}, + {0x0311, UNICODE_NORM_QC_MAYBE}, + {0x0313, UNICODE_NORM_QC_MAYBE}, + {0x0314, UNICODE_NORM_QC_MAYBE}, + {0x031B, UNICODE_NORM_QC_MAYBE}, + {0x0323, UNICODE_NORM_QC_MAYBE}, + {0x0324, UNICODE_NORM_QC_MAYBE}, + {0x0325, UNICODE_NORM_QC_MAYBE}, + {0x0326, UNICODE_NORM_QC_MAYBE}, + {0x0327, UNICODE_NORM_QC_MAYBE}, + {0x0328, UNICODE_NORM_QC_MAYBE}, + {0x032D, UNICODE_NORM_QC_MAYBE}, + {0x032E, UNICODE_NORM_QC_MAYBE}, + {0x0330, UNICODE_NORM_QC_MAYBE}, + {0x0331, UNICODE_NORM_QC_MAYBE}, + {0x0338, UNICODE_NORM_QC_MAYBE}, + {0x0340, UNICODE_NORM_QC_NO}, + {0x0341, UNICODE_NORM_QC_NO}, + {0x0342, UNICODE_NORM_QC_MAYBE}, + {0x0343, UNICODE_NORM_QC_NO}, + {0x0344, UNICODE_NORM_QC_NO}, + {0x0345, UNICODE_NORM_QC_MAYBE}, + {0x0374, UNICODE_NORM_QC_NO}, + {0x037A, UNICODE_NORM_QC_NO}, + {0x037E, UNICODE_NORM_QC_NO}, + {0x0384, UNICODE_NORM_QC_NO}, + {0x0385, UNICODE_NORM_QC_NO}, + {0x0387, UNICODE_NORM_QC_NO}, + {0x03D0, UNICODE_NORM_QC_NO}, + {0x03D1, UNICODE_NORM_QC_NO}, + {0x03D2, UNICODE_NORM_QC_NO}, + {0x03D3, UNICODE_NORM_QC_NO}, + {0x03D4, UNICODE_NORM_QC_NO}, + {0x03D5, UNICODE_NORM_QC_NO}, + {0x03D6, UNICODE_NORM_QC_NO}, + {0x03F0, UNICODE_NORM_QC_NO}, + {0x03F1, UNICODE_NORM_QC_NO}, + {0x03F2, UNICODE_NORM_QC_NO}, + {0x03F4, UNICODE_NORM_QC_NO}, + {0x03F5, UNICODE_NORM_QC_NO}, + {0x03F9, UNICODE_NORM_QC_NO}, + {0x0587, UNICODE_NORM_QC_NO}, + {0x0653, UNICODE_NORM_QC_MAYBE}, + {0x0654, UNICODE_NORM_QC_MAYBE}, + {0x0655, UNICODE_NORM_QC_MAYBE}, + {0x0675, UNICODE_NORM_QC_NO}, + {0x0676, UNICODE_NORM_QC_NO}, + {0x0677, UNICODE_NORM_QC_NO}, + {0x0678, UNICODE_NORM_QC_NO}, + {0x093C, UNICODE_NORM_QC_MAYBE}, + {0x0958, UNICODE_NORM_QC_NO}, + {0x0959, UNICODE_NORM_QC_NO}, + {0x095A, UNICODE_NORM_QC_NO}, + {0x095B, UNICODE_NORM_QC_NO}, + {0x095C, UNICODE_NORM_QC_NO}, + {0x095D, UNICODE_NORM_QC_NO}, + {0x095E, UNICODE_NORM_QC_NO}, + {0x095F, UNICODE_NORM_QC_NO}, + {0x09BE, UNICODE_NORM_QC_MAYBE}, + {0x09D7, UNICODE_NORM_QC_MAYBE}, + {0x09DC, UNICODE_NORM_QC_NO}, + {0x09DD, UNICODE_NORM_QC_NO}, + {0x09DF, UNICODE_NORM_QC_NO}, + {0x0A33, UNICODE_NORM_QC_NO}, + {0x0A36, UNICODE_NORM_QC_NO}, + {0x0A59, UNICODE_NORM_QC_NO}, + {0x0A5A, UNICODE_NORM_QC_NO}, + {0x0A5B, UNICODE_NORM_QC_NO}, + {0x0A5E, UNICODE_NORM_QC_NO}, + {0x0B3E, UNICODE_NORM_QC_MAYBE}, + {0x0B56, UNICODE_NORM_QC_MAYBE}, + {0x0B57, UNICODE_NORM_QC_MAYBE}, + {0x0B5C, UNICODE_NORM_QC_NO}, + {0x0B5D, UNICODE_NORM_QC_NO}, + {0x0BBE, UNICODE_NORM_QC_MAYBE}, + {0x0BD7, UNICODE_NORM_QC_MAYBE}, + {0x0C56, UNICODE_NORM_QC_MAYBE}, + {0x0CC2, UNICODE_NORM_QC_MAYBE}, + {0x0CD5, UNICODE_NORM_QC_MAYBE}, + {0x0CD6, UNICODE_NORM_QC_MAYBE}, + {0x0D3E, UNICODE_NORM_QC_MAYBE}, + {0x0D57, UNICODE_NORM_QC_MAYBE}, + {0x0DCA, UNICODE_NORM_QC_MAYBE}, + {0x0DCF, UNICODE_NORM_QC_MAYBE}, + {0x0DDF, UNICODE_NORM_QC_MAYBE}, + {0x0E33, UNICODE_NORM_QC_NO}, + {0x0EB3, UNICODE_NORM_QC_NO}, + {0x0EDC, UNICODE_NORM_QC_NO}, + {0x0EDD, UNICODE_NORM_QC_NO}, + {0x0F0C, UNICODE_NORM_QC_NO}, + {0x0F43, UNICODE_NORM_QC_NO}, + {0x0F4D, UNICODE_NORM_QC_NO}, + {0x0F52, UNICODE_NORM_QC_NO}, + {0x0F57, UNICODE_NORM_QC_NO}, + {0x0F5C, UNICODE_NORM_QC_NO}, + {0x0F69, UNICODE_NORM_QC_NO}, + {0x0F73, UNICODE_NORM_QC_NO}, + {0x0F75, UNICODE_NORM_QC_NO}, + {0x0F76, UNICODE_NORM_QC_NO}, + {0x0F77, UNICODE_NORM_QC_NO}, + {0x0F78, UNICODE_NORM_QC_NO}, + {0x0F79, UNICODE_NORM_QC_NO}, + {0x0F81, UNICODE_NORM_QC_NO}, + {0x0F93, UNICODE_NORM_QC_NO}, + {0x0F9D, UNICODE_NORM_QC_NO}, + {0x0FA2, UNICODE_NORM_QC_NO}, + {0x0FA7, UNICODE_NORM_QC_NO}, + {0x0FAC, UNICODE_NORM_QC_NO}, + {0x0FB9, UNICODE_NORM_QC_NO}, + {0x102E, UNICODE_NORM_QC_MAYBE}, + {0x10FC, UNICODE_NORM_QC_NO}, + {0x1161, UNICODE_NORM_QC_MAYBE}, + {0x1162, UNICODE_NORM_QC_MAYBE}, + {0x1163, UNICODE_NORM_QC_MAYBE}, + {0x1164, UNICODE_NORM_QC_MAYBE}, + {0x1165, UNICODE_NORM_QC_MAYBE}, + {0x1166, UNICODE_NORM_QC_MAYBE}, + {0x1167, UNICODE_NORM_QC_MAYBE}, + {0x1168, UNICODE_NORM_QC_MAYBE}, + {0x1169, UNICODE_NORM_QC_MAYBE}, + {0x116A, UNICODE_NORM_QC_MAYBE}, + {0x116B, UNICODE_NORM_QC_MAYBE}, + {0x116C, UNICODE_NORM_QC_MAYBE}, + {0x116D, UNICODE_NORM_QC_MAYBE}, + {0x116E, UNICODE_NORM_QC_MAYBE}, + {0x116F, UNICODE_NORM_QC_MAYBE}, + {0x1170, UNICODE_NORM_QC_MAYBE}, + {0x1171, UNICODE_NORM_QC_MAYBE}, + {0x1172, UNICODE_NORM_QC_MAYBE}, + {0x1173, UNICODE_NORM_QC_MAYBE}, + {0x1174, UNICODE_NORM_QC_MAYBE}, + {0x1175, UNICODE_NORM_QC_MAYBE}, + {0x11A8, UNICODE_NORM_QC_MAYBE}, + {0x11A9, UNICODE_NORM_QC_MAYBE}, + {0x11AA, UNICODE_NORM_QC_MAYBE}, + {0x11AB, UNICODE_NORM_QC_MAYBE}, + {0x11AC, UNICODE_NORM_QC_MAYBE}, + {0x11AD, UNICODE_NORM_QC_MAYBE}, + {0x11AE, UNICODE_NORM_QC_MAYBE}, + {0x11AF, UNICODE_NORM_QC_MAYBE}, + {0x11B0, UNICODE_NORM_QC_MAYBE}, + {0x11B1, UNICODE_NORM_QC_MAYBE}, + {0x11B2, UNICODE_NORM_QC_MAYBE}, + {0x11B3, UNICODE_NORM_QC_MAYBE}, + {0x11B4, UNICODE_NORM_QC_MAYBE}, + {0x11B5, UNICODE_NORM_QC_MAYBE}, + {0x11B6, UNICODE_NORM_QC_MAYBE}, + {0x11B7, UNICODE_NORM_QC_MAYBE}, + {0x11B8, UNICODE_NORM_QC_MAYBE}, + {0x11B9, UNICODE_NORM_QC_MAYBE}, + {0x11BA, UNICODE_NORM_QC_MAYBE}, + {0x11BB, UNICODE_NORM_QC_MAYBE}, + {0x11BC, UNICODE_NORM_QC_MAYBE}, + {0x11BD, UNICODE_NORM_QC_MAYBE}, + {0x11BE, UNICODE_NORM_QC_MAYBE}, + {0x11BF, UNICODE_NORM_QC_MAYBE}, + {0x11C0, UNICODE_NORM_QC_MAYBE}, + {0x11C1, UNICODE_NORM_QC_MAYBE}, + {0x11C2, UNICODE_NORM_QC_MAYBE}, + {0x1B35, UNICODE_NORM_QC_MAYBE}, + {0x1D2C, UNICODE_NORM_QC_NO}, + {0x1D2D, UNICODE_NORM_QC_NO}, + {0x1D2E, UNICODE_NORM_QC_NO}, + {0x1D30, UNICODE_NORM_QC_NO}, + {0x1D31, UNICODE_NORM_QC_NO}, + {0x1D32, UNICODE_NORM_QC_NO}, + {0x1D33, UNICODE_NORM_QC_NO}, + {0x1D34, UNICODE_NORM_QC_NO}, + {0x1D35, UNICODE_NORM_QC_NO}, + {0x1D36, UNICODE_NORM_QC_NO}, + {0x1D37, UNICODE_NORM_QC_NO}, + {0x1D38, UNICODE_NORM_QC_NO}, + {0x1D39, UNICODE_NORM_QC_NO}, + {0x1D3A, UNICODE_NORM_QC_NO}, + {0x1D3C, UNICODE_NORM_QC_NO}, + {0x1D3D, UNICODE_NORM_QC_NO}, + {0x1D3E, UNICODE_NORM_QC_NO}, + {0x1D3F, UNICODE_NORM_QC_NO}, + {0x1D40, UNICODE_NORM_QC_NO}, + {0x1D41, UNICODE_NORM_QC_NO}, + {0x1D42, UNICODE_NORM_QC_NO}, + {0x1D43, UNICODE_NORM_QC_NO}, + {0x1D44, UNICODE_NORM_QC_NO}, + {0x1D45, UNICODE_NORM_QC_NO}, + {0x1D46, UNICODE_NORM_QC_NO}, + {0x1D47, UNICODE_NORM_QC_NO}, + {0x1D48, UNICODE_NORM_QC_NO}, + {0x1D49, UNICODE_NORM_QC_NO}, + {0x1D4A, UNICODE_NORM_QC_NO}, + {0x1D4B, UNICODE_NORM_QC_NO}, + {0x1D4C, UNICODE_NORM_QC_NO}, + {0x1D4D, UNICODE_NORM_QC_NO}, + {0x1D4F, UNICODE_NORM_QC_NO}, + {0x1D50, UNICODE_NORM_QC_NO}, + {0x1D51, UNICODE_NORM_QC_NO}, + {0x1D52, UNICODE_NORM_QC_NO}, + {0x1D53, UNICODE_NORM_QC_NO}, + {0x1D54, UNICODE_NORM_QC_NO}, + {0x1D55, UNICODE_NORM_QC_NO}, + {0x1D56, UNICODE_NORM_QC_NO}, + {0x1D57, UNICODE_NORM_QC_NO}, + {0x1D58, UNICODE_NORM_QC_NO}, + {0x1D59, UNICODE_NORM_QC_NO}, + {0x1D5A, UNICODE_NORM_QC_NO}, + {0x1D5B, UNICODE_NORM_QC_NO}, + {0x1D5C, UNICODE_NORM_QC_NO}, + {0x1D5D, UNICODE_NORM_QC_NO}, + {0x1D5E, UNICODE_NORM_QC_NO}, + {0x1D5F, UNICODE_NORM_QC_NO}, + {0x1D60, UNICODE_NORM_QC_NO}, + {0x1D61, UNICODE_NORM_QC_NO}, + {0x1D62, UNICODE_NORM_QC_NO}, + {0x1D63, UNICODE_NORM_QC_NO}, + {0x1D64, UNICODE_NORM_QC_NO}, + {0x1D65, UNICODE_NORM_QC_NO}, + {0x1D66, UNICODE_NORM_QC_NO}, + {0x1D67, UNICODE_NORM_QC_NO}, + {0x1D68, UNICODE_NORM_QC_NO}, + {0x1D69, UNICODE_NORM_QC_NO}, + {0x1D6A, UNICODE_NORM_QC_NO}, + {0x1D78, UNICODE_NORM_QC_NO}, + {0x1D9B, UNICODE_NORM_QC_NO}, + {0x1D9C, UNICODE_NORM_QC_NO}, + {0x1D9D, UNICODE_NORM_QC_NO}, + {0x1D9E, UNICODE_NORM_QC_NO}, + {0x1D9F, UNICODE_NORM_QC_NO}, + {0x1DA0, UNICODE_NORM_QC_NO}, + {0x1DA1, UNICODE_NORM_QC_NO}, + {0x1DA2, UNICODE_NORM_QC_NO}, + {0x1DA3, UNICODE_NORM_QC_NO}, + {0x1DA4, UNICODE_NORM_QC_NO}, + {0x1DA5, UNICODE_NORM_QC_NO}, + {0x1DA6, UNICODE_NORM_QC_NO}, + {0x1DA7, UNICODE_NORM_QC_NO}, + {0x1DA8, UNICODE_NORM_QC_NO}, + {0x1DA9, UNICODE_NORM_QC_NO}, + {0x1DAA, UNICODE_NORM_QC_NO}, + {0x1DAB, UNICODE_NORM_QC_NO}, + {0x1DAC, UNICODE_NORM_QC_NO}, + {0x1DAD, UNICODE_NORM_QC_NO}, + {0x1DAE, UNICODE_NORM_QC_NO}, + {0x1DAF, UNICODE_NORM_QC_NO}, + {0x1DB0, UNICODE_NORM_QC_NO}, + {0x1DB1, UNICODE_NORM_QC_NO}, + {0x1DB2, UNICODE_NORM_QC_NO}, + {0x1DB3, UNICODE_NORM_QC_NO}, + {0x1DB4, UNICODE_NORM_QC_NO}, + {0x1DB5, UNICODE_NORM_QC_NO}, + {0x1DB6, UNICODE_NORM_QC_NO}, + {0x1DB7, UNICODE_NORM_QC_NO}, + {0x1DB8, UNICODE_NORM_QC_NO}, + {0x1DB9, UNICODE_NORM_QC_NO}, + {0x1DBA, UNICODE_NORM_QC_NO}, + {0x1DBB, UNICODE_NORM_QC_NO}, + {0x1DBC, UNICODE_NORM_QC_NO}, + {0x1DBD, UNICODE_NORM_QC_NO}, + {0x1DBE, UNICODE_NORM_QC_NO}, + {0x1DBF, UNICODE_NORM_QC_NO}, + {0x1E9A, UNICODE_NORM_QC_NO}, + {0x1E9B, UNICODE_NORM_QC_NO}, + {0x1F71, UNICODE_NORM_QC_NO}, + {0x1F73, UNICODE_NORM_QC_NO}, + {0x1F75, UNICODE_NORM_QC_NO}, + {0x1F77, UNICODE_NORM_QC_NO}, + {0x1F79, UNICODE_NORM_QC_NO}, + {0x1F7B, UNICODE_NORM_QC_NO}, + {0x1F7D, UNICODE_NORM_QC_NO}, + {0x1FBB, UNICODE_NORM_QC_NO}, + {0x1FBD, UNICODE_NORM_QC_NO}, + {0x1FBE, UNICODE_NORM_QC_NO}, + {0x1FBF, UNICODE_NORM_QC_NO}, + {0x1FC0, UNICODE_NORM_QC_NO}, + {0x1FC1, UNICODE_NORM_QC_NO}, + {0x1FC9, UNICODE_NORM_QC_NO}, + {0x1FCB, UNICODE_NORM_QC_NO}, + {0x1FCD, UNICODE_NORM_QC_NO}, + {0x1FCE, UNICODE_NORM_QC_NO}, + {0x1FCF, UNICODE_NORM_QC_NO}, + {0x1FD3, UNICODE_NORM_QC_NO}, + {0x1FDB, UNICODE_NORM_QC_NO}, + {0x1FDD, UNICODE_NORM_QC_NO}, + {0x1FDE, UNICODE_NORM_QC_NO}, + {0x1FDF, UNICODE_NORM_QC_NO}, + {0x1FE3, UNICODE_NORM_QC_NO}, + {0x1FEB, UNICODE_NORM_QC_NO}, + {0x1FED, UNICODE_NORM_QC_NO}, + {0x1FEE, UNICODE_NORM_QC_NO}, + {0x1FEF, UNICODE_NORM_QC_NO}, + {0x1FF9, UNICODE_NORM_QC_NO}, + {0x1FFB, UNICODE_NORM_QC_NO}, + {0x1FFD, UNICODE_NORM_QC_NO}, + {0x1FFE, UNICODE_NORM_QC_NO}, + {0x2000, UNICODE_NORM_QC_NO}, + {0x2001, UNICODE_NORM_QC_NO}, + {0x2002, UNICODE_NORM_QC_NO}, + {0x2003, UNICODE_NORM_QC_NO}, + {0x2004, UNICODE_NORM_QC_NO}, + {0x2005, UNICODE_NORM_QC_NO}, + {0x2006, UNICODE_NORM_QC_NO}, + {0x2007, UNICODE_NORM_QC_NO}, + {0x2008, UNICODE_NORM_QC_NO}, + {0x2009, UNICODE_NORM_QC_NO}, + {0x200A, UNICODE_NORM_QC_NO}, + {0x2011, UNICODE_NORM_QC_NO}, + {0x2017, UNICODE_NORM_QC_NO}, + {0x2024, UNICODE_NORM_QC_NO}, + {0x2025, UNICODE_NORM_QC_NO}, + {0x2026, UNICODE_NORM_QC_NO}, + {0x202F, UNICODE_NORM_QC_NO}, + {0x2033, UNICODE_NORM_QC_NO}, + {0x2034, UNICODE_NORM_QC_NO}, + {0x2036, UNICODE_NORM_QC_NO}, + {0x2037, UNICODE_NORM_QC_NO}, + {0x203C, UNICODE_NORM_QC_NO}, + {0x203E, UNICODE_NORM_QC_NO}, + {0x2047, UNICODE_NORM_QC_NO}, + {0x2048, UNICODE_NORM_QC_NO}, + {0x2049, UNICODE_NORM_QC_NO}, + {0x2057, UNICODE_NORM_QC_NO}, + {0x205F, UNICODE_NORM_QC_NO}, + {0x2070, UNICODE_NORM_QC_NO}, + {0x2071, UNICODE_NORM_QC_NO}, + {0x2074, UNICODE_NORM_QC_NO}, + {0x2075, UNICODE_NORM_QC_NO}, + {0x2076, UNICODE_NORM_QC_NO}, + {0x2077, UNICODE_NORM_QC_NO}, + {0x2078, UNICODE_NORM_QC_NO}, + {0x2079, UNICODE_NORM_QC_NO}, + {0x207A, UNICODE_NORM_QC_NO}, + {0x207B, UNICODE_NORM_QC_NO}, + {0x207C, UNICODE_NORM_QC_NO}, + {0x207D, UNICODE_NORM_QC_NO}, + {0x207E, UNICODE_NORM_QC_NO}, + {0x207F, UNICODE_NORM_QC_NO}, + {0x2080, UNICODE_NORM_QC_NO}, + {0x2081, UNICODE_NORM_QC_NO}, + {0x2082, UNICODE_NORM_QC_NO}, + {0x2083, UNICODE_NORM_QC_NO}, + {0x2084, UNICODE_NORM_QC_NO}, + {0x2085, UNICODE_NORM_QC_NO}, + {0x2086, UNICODE_NORM_QC_NO}, + {0x2087, UNICODE_NORM_QC_NO}, + {0x2088, UNICODE_NORM_QC_NO}, + {0x2089, UNICODE_NORM_QC_NO}, + {0x208A, UNICODE_NORM_QC_NO}, + {0x208B, UNICODE_NORM_QC_NO}, + {0x208C, UNICODE_NORM_QC_NO}, + {0x208D, UNICODE_NORM_QC_NO}, + {0x208E, UNICODE_NORM_QC_NO}, + {0x2090, UNICODE_NORM_QC_NO}, + {0x2091, UNICODE_NORM_QC_NO}, + {0x2092, UNICODE_NORM_QC_NO}, + {0x2093, UNICODE_NORM_QC_NO}, + {0x2094, UNICODE_NORM_QC_NO}, + {0x2095, UNICODE_NORM_QC_NO}, + {0x2096, UNICODE_NORM_QC_NO}, + {0x2097, UNICODE_NORM_QC_NO}, + {0x2098, UNICODE_NORM_QC_NO}, + {0x2099, UNICODE_NORM_QC_NO}, + {0x209A, UNICODE_NORM_QC_NO}, + {0x209B, UNICODE_NORM_QC_NO}, + {0x209C, UNICODE_NORM_QC_NO}, + {0x20A8, UNICODE_NORM_QC_NO}, + {0x2100, UNICODE_NORM_QC_NO}, + {0x2101, UNICODE_NORM_QC_NO}, + {0x2102, UNICODE_NORM_QC_NO}, + {0x2103, UNICODE_NORM_QC_NO}, + {0x2105, UNICODE_NORM_QC_NO}, + {0x2106, UNICODE_NORM_QC_NO}, + {0x2107, UNICODE_NORM_QC_NO}, + {0x2109, UNICODE_NORM_QC_NO}, + {0x210A, UNICODE_NORM_QC_NO}, + {0x210B, UNICODE_NORM_QC_NO}, + {0x210C, UNICODE_NORM_QC_NO}, + {0x210D, UNICODE_NORM_QC_NO}, + {0x210E, UNICODE_NORM_QC_NO}, + {0x210F, UNICODE_NORM_QC_NO}, + {0x2110, UNICODE_NORM_QC_NO}, + {0x2111, UNICODE_NORM_QC_NO}, + {0x2112, UNICODE_NORM_QC_NO}, + {0x2113, UNICODE_NORM_QC_NO}, + {0x2115, UNICODE_NORM_QC_NO}, + {0x2116, UNICODE_NORM_QC_NO}, + {0x2119, UNICODE_NORM_QC_NO}, + {0x211A, UNICODE_NORM_QC_NO}, + {0x211B, UNICODE_NORM_QC_NO}, + {0x211C, UNICODE_NORM_QC_NO}, + {0x211D, UNICODE_NORM_QC_NO}, + {0x2120, UNICODE_NORM_QC_NO}, + {0x2121, UNICODE_NORM_QC_NO}, + {0x2122, UNICODE_NORM_QC_NO}, + {0x2124, UNICODE_NORM_QC_NO}, + {0x2126, UNICODE_NORM_QC_NO}, + {0x2128, UNICODE_NORM_QC_NO}, + {0x212A, UNICODE_NORM_QC_NO}, + {0x212B, UNICODE_NORM_QC_NO}, + {0x212C, UNICODE_NORM_QC_NO}, + {0x212D, UNICODE_NORM_QC_NO}, + {0x212F, UNICODE_NORM_QC_NO}, + {0x2130, UNICODE_NORM_QC_NO}, + {0x2131, UNICODE_NORM_QC_NO}, + {0x2133, UNICODE_NORM_QC_NO}, + {0x2134, UNICODE_NORM_QC_NO}, + {0x2135, UNICODE_NORM_QC_NO}, + {0x2136, UNICODE_NORM_QC_NO}, + {0x2137, UNICODE_NORM_QC_NO}, + {0x2138, UNICODE_NORM_QC_NO}, + {0x2139, UNICODE_NORM_QC_NO}, + {0x213B, UNICODE_NORM_QC_NO}, + {0x213C, UNICODE_NORM_QC_NO}, + {0x213D, UNICODE_NORM_QC_NO}, + {0x213E, UNICODE_NORM_QC_NO}, + {0x213F, UNICODE_NORM_QC_NO}, + {0x2140, UNICODE_NORM_QC_NO}, + {0x2145, UNICODE_NORM_QC_NO}, + {0x2146, UNICODE_NORM_QC_NO}, + {0x2147, UNICODE_NORM_QC_NO}, + {0x2148, UNICODE_NORM_QC_NO}, + {0x2149, UNICODE_NORM_QC_NO}, + {0x2150, UNICODE_NORM_QC_NO}, + {0x2151, UNICODE_NORM_QC_NO}, + {0x2152, UNICODE_NORM_QC_NO}, + {0x2153, UNICODE_NORM_QC_NO}, + {0x2154, UNICODE_NORM_QC_NO}, + {0x2155, UNICODE_NORM_QC_NO}, + {0x2156, UNICODE_NORM_QC_NO}, + {0x2157, UNICODE_NORM_QC_NO}, + {0x2158, UNICODE_NORM_QC_NO}, + {0x2159, UNICODE_NORM_QC_NO}, + {0x215A, UNICODE_NORM_QC_NO}, + {0x215B, UNICODE_NORM_QC_NO}, + {0x215C, UNICODE_NORM_QC_NO}, + {0x215D, UNICODE_NORM_QC_NO}, + {0x215E, UNICODE_NORM_QC_NO}, + {0x215F, UNICODE_NORM_QC_NO}, + {0x2160, UNICODE_NORM_QC_NO}, + {0x2161, UNICODE_NORM_QC_NO}, + {0x2162, UNICODE_NORM_QC_NO}, + {0x2163, UNICODE_NORM_QC_NO}, + {0x2164, UNICODE_NORM_QC_NO}, + {0x2165, UNICODE_NORM_QC_NO}, + {0x2166, UNICODE_NORM_QC_NO}, + {0x2167, UNICODE_NORM_QC_NO}, + {0x2168, UNICODE_NORM_QC_NO}, + {0x2169, UNICODE_NORM_QC_NO}, + {0x216A, UNICODE_NORM_QC_NO}, + {0x216B, UNICODE_NORM_QC_NO}, + {0x216C, UNICODE_NORM_QC_NO}, + {0x216D, UNICODE_NORM_QC_NO}, + {0x216E, UNICODE_NORM_QC_NO}, + {0x216F, UNICODE_NORM_QC_NO}, + {0x2170, UNICODE_NORM_QC_NO}, + {0x2171, UNICODE_NORM_QC_NO}, + {0x2172, UNICODE_NORM_QC_NO}, + {0x2173, UNICODE_NORM_QC_NO}, + {0x2174, UNICODE_NORM_QC_NO}, + {0x2175, UNICODE_NORM_QC_NO}, + {0x2176, UNICODE_NORM_QC_NO}, + {0x2177, UNICODE_NORM_QC_NO}, + {0x2178, UNICODE_NORM_QC_NO}, + {0x2179, UNICODE_NORM_QC_NO}, + {0x217A, UNICODE_NORM_QC_NO}, + {0x217B, UNICODE_NORM_QC_NO}, + {0x217C, UNICODE_NORM_QC_NO}, + {0x217D, UNICODE_NORM_QC_NO}, + {0x217E, UNICODE_NORM_QC_NO}, + {0x217F, UNICODE_NORM_QC_NO}, + {0x2189, UNICODE_NORM_QC_NO}, + {0x222C, UNICODE_NORM_QC_NO}, + {0x222D, UNICODE_NORM_QC_NO}, + {0x222F, UNICODE_NORM_QC_NO}, + {0x2230, UNICODE_NORM_QC_NO}, + {0x2329, UNICODE_NORM_QC_NO}, + {0x232A, UNICODE_NORM_QC_NO}, + {0x2460, UNICODE_NORM_QC_NO}, + {0x2461, UNICODE_NORM_QC_NO}, + {0x2462, UNICODE_NORM_QC_NO}, + {0x2463, UNICODE_NORM_QC_NO}, + {0x2464, UNICODE_NORM_QC_NO}, + {0x2465, UNICODE_NORM_QC_NO}, + {0x2466, UNICODE_NORM_QC_NO}, + {0x2467, UNICODE_NORM_QC_NO}, + {0x2468, UNICODE_NORM_QC_NO}, + {0x2469, UNICODE_NORM_QC_NO}, + {0x246A, UNICODE_NORM_QC_NO}, + {0x246B, UNICODE_NORM_QC_NO}, + {0x246C, UNICODE_NORM_QC_NO}, + {0x246D, UNICODE_NORM_QC_NO}, + {0x246E, UNICODE_NORM_QC_NO}, + {0x246F, UNICODE_NORM_QC_NO}, + {0x2470, UNICODE_NORM_QC_NO}, + {0x2471, UNICODE_NORM_QC_NO}, + {0x2472, UNICODE_NORM_QC_NO}, + {0x2473, UNICODE_NORM_QC_NO}, + {0x2474, UNICODE_NORM_QC_NO}, + {0x2475, UNICODE_NORM_QC_NO}, + {0x2476, UNICODE_NORM_QC_NO}, + {0x2477, UNICODE_NORM_QC_NO}, + {0x2478, UNICODE_NORM_QC_NO}, + {0x2479, UNICODE_NORM_QC_NO}, + {0x247A, UNICODE_NORM_QC_NO}, + {0x247B, UNICODE_NORM_QC_NO}, + {0x247C, UNICODE_NORM_QC_NO}, + {0x247D, UNICODE_NORM_QC_NO}, + {0x247E, UNICODE_NORM_QC_NO}, + {0x247F, UNICODE_NORM_QC_NO}, + {0x2480, UNICODE_NORM_QC_NO}, + {0x2481, UNICODE_NORM_QC_NO}, + {0x2482, UNICODE_NORM_QC_NO}, + {0x2483, UNICODE_NORM_QC_NO}, + {0x2484, UNICODE_NORM_QC_NO}, + {0x2485, UNICODE_NORM_QC_NO}, + {0x2486, UNICODE_NORM_QC_NO}, + {0x2487, UNICODE_NORM_QC_NO}, + {0x2488, UNICODE_NORM_QC_NO}, + {0x2489, UNICODE_NORM_QC_NO}, + {0x248A, UNICODE_NORM_QC_NO}, + {0x248B, UNICODE_NORM_QC_NO}, + {0x248C, UNICODE_NORM_QC_NO}, + {0x248D, UNICODE_NORM_QC_NO}, + {0x248E, UNICODE_NORM_QC_NO}, + {0x248F, UNICODE_NORM_QC_NO}, + {0x2490, UNICODE_NORM_QC_NO}, + {0x2491, UNICODE_NORM_QC_NO}, + {0x2492, UNICODE_NORM_QC_NO}, + {0x2493, UNICODE_NORM_QC_NO}, + {0x2494, UNICODE_NORM_QC_NO}, + {0x2495, UNICODE_NORM_QC_NO}, + {0x2496, UNICODE_NORM_QC_NO}, + {0x2497, UNICODE_NORM_QC_NO}, + {0x2498, UNICODE_NORM_QC_NO}, + {0x2499, UNICODE_NORM_QC_NO}, + {0x249A, UNICODE_NORM_QC_NO}, + {0x249B, UNICODE_NORM_QC_NO}, + {0x249C, UNICODE_NORM_QC_NO}, + {0x249D, UNICODE_NORM_QC_NO}, + {0x249E, UNICODE_NORM_QC_NO}, + {0x249F, UNICODE_NORM_QC_NO}, + {0x24A0, UNICODE_NORM_QC_NO}, + {0x24A1, UNICODE_NORM_QC_NO}, + {0x24A2, UNICODE_NORM_QC_NO}, + {0x24A3, UNICODE_NORM_QC_NO}, + {0x24A4, UNICODE_NORM_QC_NO}, + {0x24A5, UNICODE_NORM_QC_NO}, + {0x24A6, UNICODE_NORM_QC_NO}, + {0x24A7, UNICODE_NORM_QC_NO}, + {0x24A8, UNICODE_NORM_QC_NO}, + {0x24A9, UNICODE_NORM_QC_NO}, + {0x24AA, UNICODE_NORM_QC_NO}, + {0x24AB, UNICODE_NORM_QC_NO}, + {0x24AC, UNICODE_NORM_QC_NO}, + {0x24AD, UNICODE_NORM_QC_NO}, + {0x24AE, UNICODE_NORM_QC_NO}, + {0x24AF, UNICODE_NORM_QC_NO}, + {0x24B0, UNICODE_NORM_QC_NO}, + {0x24B1, UNICODE_NORM_QC_NO}, + {0x24B2, UNICODE_NORM_QC_NO}, + {0x24B3, UNICODE_NORM_QC_NO}, + {0x24B4, UNICODE_NORM_QC_NO}, + {0x24B5, UNICODE_NORM_QC_NO}, + {0x24B6, UNICODE_NORM_QC_NO}, + {0x24B7, UNICODE_NORM_QC_NO}, + {0x24B8, UNICODE_NORM_QC_NO}, + {0x24B9, UNICODE_NORM_QC_NO}, + {0x24BA, UNICODE_NORM_QC_NO}, + {0x24BB, UNICODE_NORM_QC_NO}, + {0x24BC, UNICODE_NORM_QC_NO}, + {0x24BD, UNICODE_NORM_QC_NO}, + {0x24BE, UNICODE_NORM_QC_NO}, + {0x24BF, UNICODE_NORM_QC_NO}, + {0x24C0, UNICODE_NORM_QC_NO}, + {0x24C1, UNICODE_NORM_QC_NO}, + {0x24C2, UNICODE_NORM_QC_NO}, + {0x24C3, UNICODE_NORM_QC_NO}, + {0x24C4, UNICODE_NORM_QC_NO}, + {0x24C5, UNICODE_NORM_QC_NO}, + {0x24C6, UNICODE_NORM_QC_NO}, + {0x24C7, UNICODE_NORM_QC_NO}, + {0x24C8, UNICODE_NORM_QC_NO}, + {0x24C9, UNICODE_NORM_QC_NO}, + {0x24CA, UNICODE_NORM_QC_NO}, + {0x24CB, UNICODE_NORM_QC_NO}, + {0x24CC, UNICODE_NORM_QC_NO}, + {0x24CD, UNICODE_NORM_QC_NO}, + {0x24CE, UNICODE_NORM_QC_NO}, + {0x24CF, UNICODE_NORM_QC_NO}, + {0x24D0, UNICODE_NORM_QC_NO}, + {0x24D1, UNICODE_NORM_QC_NO}, + {0x24D2, UNICODE_NORM_QC_NO}, + {0x24D3, UNICODE_NORM_QC_NO}, + {0x24D4, UNICODE_NORM_QC_NO}, + {0x24D5, UNICODE_NORM_QC_NO}, + {0x24D6, UNICODE_NORM_QC_NO}, + {0x24D7, UNICODE_NORM_QC_NO}, + {0x24D8, UNICODE_NORM_QC_NO}, + {0x24D9, UNICODE_NORM_QC_NO}, + {0x24DA, UNICODE_NORM_QC_NO}, + {0x24DB, UNICODE_NORM_QC_NO}, + {0x24DC, UNICODE_NORM_QC_NO}, + {0x24DD, UNICODE_NORM_QC_NO}, + {0x24DE, UNICODE_NORM_QC_NO}, + {0x24DF, UNICODE_NORM_QC_NO}, + {0x24E0, UNICODE_NORM_QC_NO}, + {0x24E1, UNICODE_NORM_QC_NO}, + {0x24E2, UNICODE_NORM_QC_NO}, + {0x24E3, UNICODE_NORM_QC_NO}, + {0x24E4, UNICODE_NORM_QC_NO}, + {0x24E5, UNICODE_NORM_QC_NO}, + {0x24E6, UNICODE_NORM_QC_NO}, + {0x24E7, UNICODE_NORM_QC_NO}, + {0x24E8, UNICODE_NORM_QC_NO}, + {0x24E9, UNICODE_NORM_QC_NO}, + {0x24EA, UNICODE_NORM_QC_NO}, + {0x2A0C, UNICODE_NORM_QC_NO}, + {0x2A74, UNICODE_NORM_QC_NO}, + {0x2A75, UNICODE_NORM_QC_NO}, + {0x2A76, UNICODE_NORM_QC_NO}, + {0x2ADC, UNICODE_NORM_QC_NO}, + {0x2C7C, UNICODE_NORM_QC_NO}, + {0x2C7D, UNICODE_NORM_QC_NO}, + {0x2D6F, UNICODE_NORM_QC_NO}, + {0x2E9F, UNICODE_NORM_QC_NO}, + {0x2EF3, UNICODE_NORM_QC_NO}, + {0x2F00, UNICODE_NORM_QC_NO}, + {0x2F01, UNICODE_NORM_QC_NO}, + {0x2F02, UNICODE_NORM_QC_NO}, + {0x2F03, UNICODE_NORM_QC_NO}, + {0x2F04, UNICODE_NORM_QC_NO}, + {0x2F05, UNICODE_NORM_QC_NO}, + {0x2F06, UNICODE_NORM_QC_NO}, + {0x2F07, UNICODE_NORM_QC_NO}, + {0x2F08, UNICODE_NORM_QC_NO}, + {0x2F09, UNICODE_NORM_QC_NO}, + {0x2F0A, UNICODE_NORM_QC_NO}, + {0x2F0B, UNICODE_NORM_QC_NO}, + {0x2F0C, UNICODE_NORM_QC_NO}, + {0x2F0D, UNICODE_NORM_QC_NO}, + {0x2F0E, UNICODE_NORM_QC_NO}, + {0x2F0F, UNICODE_NORM_QC_NO}, + {0x2F10, UNICODE_NORM_QC_NO}, + {0x2F11, UNICODE_NORM_QC_NO}, + {0x2F12, UNICODE_NORM_QC_NO}, + {0x2F13, UNICODE_NORM_QC_NO}, + {0x2F14, UNICODE_NORM_QC_NO}, + {0x2F15, UNICODE_NORM_QC_NO}, + {0x2F16, UNICODE_NORM_QC_NO}, + {0x2F17, UNICODE_NORM_QC_NO}, + {0x2F18, UNICODE_NORM_QC_NO}, + {0x2F19, UNICODE_NORM_QC_NO}, + {0x2F1A, UNICODE_NORM_QC_NO}, + {0x2F1B, UNICODE_NORM_QC_NO}, + {0x2F1C, UNICODE_NORM_QC_NO}, + {0x2F1D, UNICODE_NORM_QC_NO}, + {0x2F1E, UNICODE_NORM_QC_NO}, + {0x2F1F, UNICODE_NORM_QC_NO}, + {0x2F20, UNICODE_NORM_QC_NO}, + {0x2F21, UNICODE_NORM_QC_NO}, + {0x2F22, UNICODE_NORM_QC_NO}, + {0x2F23, UNICODE_NORM_QC_NO}, + {0x2F24, UNICODE_NORM_QC_NO}, + {0x2F25, UNICODE_NORM_QC_NO}, + {0x2F26, UNICODE_NORM_QC_NO}, + {0x2F27, UNICODE_NORM_QC_NO}, + {0x2F28, UNICODE_NORM_QC_NO}, + {0x2F29, UNICODE_NORM_QC_NO}, + {0x2F2A, UNICODE_NORM_QC_NO}, + {0x2F2B, UNICODE_NORM_QC_NO}, + {0x2F2C, UNICODE_NORM_QC_NO}, + {0x2F2D, UNICODE_NORM_QC_NO}, + {0x2F2E, UNICODE_NORM_QC_NO}, + {0x2F2F, UNICODE_NORM_QC_NO}, + {0x2F30, UNICODE_NORM_QC_NO}, + {0x2F31, UNICODE_NORM_QC_NO}, + {0x2F32, UNICODE_NORM_QC_NO}, + {0x2F33, UNICODE_NORM_QC_NO}, + {0x2F34, UNICODE_NORM_QC_NO}, + {0x2F35, UNICODE_NORM_QC_NO}, + {0x2F36, UNICODE_NORM_QC_NO}, + {0x2F37, UNICODE_NORM_QC_NO}, + {0x2F38, UNICODE_NORM_QC_NO}, + {0x2F39, UNICODE_NORM_QC_NO}, + {0x2F3A, UNICODE_NORM_QC_NO}, + {0x2F3B, UNICODE_NORM_QC_NO}, + {0x2F3C, UNICODE_NORM_QC_NO}, + {0x2F3D, UNICODE_NORM_QC_NO}, + {0x2F3E, UNICODE_NORM_QC_NO}, + {0x2F3F, UNICODE_NORM_QC_NO}, + {0x2F40, UNICODE_NORM_QC_NO}, + {0x2F41, UNICODE_NORM_QC_NO}, + {0x2F42, UNICODE_NORM_QC_NO}, + {0x2F43, UNICODE_NORM_QC_NO}, + {0x2F44, UNICODE_NORM_QC_NO}, + {0x2F45, UNICODE_NORM_QC_NO}, + {0x2F46, UNICODE_NORM_QC_NO}, + {0x2F47, UNICODE_NORM_QC_NO}, + {0x2F48, UNICODE_NORM_QC_NO}, + {0x2F49, UNICODE_NORM_QC_NO}, + {0x2F4A, UNICODE_NORM_QC_NO}, + {0x2F4B, UNICODE_NORM_QC_NO}, + {0x2F4C, UNICODE_NORM_QC_NO}, + {0x2F4D, UNICODE_NORM_QC_NO}, + {0x2F4E, UNICODE_NORM_QC_NO}, + {0x2F4F, UNICODE_NORM_QC_NO}, + {0x2F50, UNICODE_NORM_QC_NO}, + {0x2F51, UNICODE_NORM_QC_NO}, + {0x2F52, UNICODE_NORM_QC_NO}, + {0x2F53, UNICODE_NORM_QC_NO}, + {0x2F54, UNICODE_NORM_QC_NO}, + {0x2F55, UNICODE_NORM_QC_NO}, + {0x2F56, UNICODE_NORM_QC_NO}, + {0x2F57, UNICODE_NORM_QC_NO}, + {0x2F58, UNICODE_NORM_QC_NO}, + {0x2F59, UNICODE_NORM_QC_NO}, + {0x2F5A, UNICODE_NORM_QC_NO}, + {0x2F5B, UNICODE_NORM_QC_NO}, + {0x2F5C, UNICODE_NORM_QC_NO}, + {0x2F5D, UNICODE_NORM_QC_NO}, + {0x2F5E, UNICODE_NORM_QC_NO}, + {0x2F5F, UNICODE_NORM_QC_NO}, + {0x2F60, UNICODE_NORM_QC_NO}, + {0x2F61, UNICODE_NORM_QC_NO}, + {0x2F62, UNICODE_NORM_QC_NO}, + {0x2F63, UNICODE_NORM_QC_NO}, + {0x2F64, UNICODE_NORM_QC_NO}, + {0x2F65, UNICODE_NORM_QC_NO}, + {0x2F66, UNICODE_NORM_QC_NO}, + {0x2F67, UNICODE_NORM_QC_NO}, + {0x2F68, UNICODE_NORM_QC_NO}, + {0x2F69, UNICODE_NORM_QC_NO}, + {0x2F6A, UNICODE_NORM_QC_NO}, + {0x2F6B, UNICODE_NORM_QC_NO}, + {0x2F6C, UNICODE_NORM_QC_NO}, + {0x2F6D, UNICODE_NORM_QC_NO}, + {0x2F6E, UNICODE_NORM_QC_NO}, + {0x2F6F, UNICODE_NORM_QC_NO}, + {0x2F70, UNICODE_NORM_QC_NO}, + {0x2F71, UNICODE_NORM_QC_NO}, + {0x2F72, UNICODE_NORM_QC_NO}, + {0x2F73, UNICODE_NORM_QC_NO}, + {0x2F74, UNICODE_NORM_QC_NO}, + {0x2F75, UNICODE_NORM_QC_NO}, + {0x2F76, UNICODE_NORM_QC_NO}, + {0x2F77, UNICODE_NORM_QC_NO}, + {0x2F78, UNICODE_NORM_QC_NO}, + {0x2F79, UNICODE_NORM_QC_NO}, + {0x2F7A, UNICODE_NORM_QC_NO}, + {0x2F7B, UNICODE_NORM_QC_NO}, + {0x2F7C, UNICODE_NORM_QC_NO}, + {0x2F7D, UNICODE_NORM_QC_NO}, + {0x2F7E, UNICODE_NORM_QC_NO}, + {0x2F7F, UNICODE_NORM_QC_NO}, + {0x2F80, UNICODE_NORM_QC_NO}, + {0x2F81, UNICODE_NORM_QC_NO}, + {0x2F82, UNICODE_NORM_QC_NO}, + {0x2F83, UNICODE_NORM_QC_NO}, + {0x2F84, UNICODE_NORM_QC_NO}, + {0x2F85, UNICODE_NORM_QC_NO}, + {0x2F86, UNICODE_NORM_QC_NO}, + {0x2F87, UNICODE_NORM_QC_NO}, + {0x2F88, UNICODE_NORM_QC_NO}, + {0x2F89, UNICODE_NORM_QC_NO}, + {0x2F8A, UNICODE_NORM_QC_NO}, + {0x2F8B, UNICODE_NORM_QC_NO}, + {0x2F8C, UNICODE_NORM_QC_NO}, + {0x2F8D, UNICODE_NORM_QC_NO}, + {0x2F8E, UNICODE_NORM_QC_NO}, + {0x2F8F, UNICODE_NORM_QC_NO}, + {0x2F90, UNICODE_NORM_QC_NO}, + {0x2F91, UNICODE_NORM_QC_NO}, + {0x2F92, UNICODE_NORM_QC_NO}, + {0x2F93, UNICODE_NORM_QC_NO}, + {0x2F94, UNICODE_NORM_QC_NO}, + {0x2F95, UNICODE_NORM_QC_NO}, + {0x2F96, UNICODE_NORM_QC_NO}, + {0x2F97, UNICODE_NORM_QC_NO}, + {0x2F98, UNICODE_NORM_QC_NO}, + {0x2F99, UNICODE_NORM_QC_NO}, + {0x2F9A, UNICODE_NORM_QC_NO}, + {0x2F9B, UNICODE_NORM_QC_NO}, + {0x2F9C, UNICODE_NORM_QC_NO}, + {0x2F9D, UNICODE_NORM_QC_NO}, + {0x2F9E, UNICODE_NORM_QC_NO}, + {0x2F9F, UNICODE_NORM_QC_NO}, + {0x2FA0, UNICODE_NORM_QC_NO}, + {0x2FA1, UNICODE_NORM_QC_NO}, + {0x2FA2, UNICODE_NORM_QC_NO}, + {0x2FA3, UNICODE_NORM_QC_NO}, + {0x2FA4, UNICODE_NORM_QC_NO}, + {0x2FA5, UNICODE_NORM_QC_NO}, + {0x2FA6, UNICODE_NORM_QC_NO}, + {0x2FA7, UNICODE_NORM_QC_NO}, + {0x2FA8, UNICODE_NORM_QC_NO}, + {0x2FA9, UNICODE_NORM_QC_NO}, + {0x2FAA, UNICODE_NORM_QC_NO}, + {0x2FAB, UNICODE_NORM_QC_NO}, + {0x2FAC, UNICODE_NORM_QC_NO}, + {0x2FAD, UNICODE_NORM_QC_NO}, + {0x2FAE, UNICODE_NORM_QC_NO}, + {0x2FAF, UNICODE_NORM_QC_NO}, + {0x2FB0, UNICODE_NORM_QC_NO}, + {0x2FB1, UNICODE_NORM_QC_NO}, + {0x2FB2, UNICODE_NORM_QC_NO}, + {0x2FB3, UNICODE_NORM_QC_NO}, + {0x2FB4, UNICODE_NORM_QC_NO}, + {0x2FB5, UNICODE_NORM_QC_NO}, + {0x2FB6, UNICODE_NORM_QC_NO}, + {0x2FB7, UNICODE_NORM_QC_NO}, + {0x2FB8, UNICODE_NORM_QC_NO}, + {0x2FB9, UNICODE_NORM_QC_NO}, + {0x2FBA, UNICODE_NORM_QC_NO}, + {0x2FBB, UNICODE_NORM_QC_NO}, + {0x2FBC, UNICODE_NORM_QC_NO}, + {0x2FBD, UNICODE_NORM_QC_NO}, + {0x2FBE, UNICODE_NORM_QC_NO}, + {0x2FBF, UNICODE_NORM_QC_NO}, + {0x2FC0, UNICODE_NORM_QC_NO}, + {0x2FC1, UNICODE_NORM_QC_NO}, + {0x2FC2, UNICODE_NORM_QC_NO}, + {0x2FC3, UNICODE_NORM_QC_NO}, + {0x2FC4, UNICODE_NORM_QC_NO}, + {0x2FC5, UNICODE_NORM_QC_NO}, + {0x2FC6, UNICODE_NORM_QC_NO}, + {0x2FC7, UNICODE_NORM_QC_NO}, + {0x2FC8, UNICODE_NORM_QC_NO}, + {0x2FC9, UNICODE_NORM_QC_NO}, + {0x2FCA, UNICODE_NORM_QC_NO}, + {0x2FCB, UNICODE_NORM_QC_NO}, + {0x2FCC, UNICODE_NORM_QC_NO}, + {0x2FCD, UNICODE_NORM_QC_NO}, + {0x2FCE, UNICODE_NORM_QC_NO}, + {0x2FCF, UNICODE_NORM_QC_NO}, + {0x2FD0, UNICODE_NORM_QC_NO}, + {0x2FD1, UNICODE_NORM_QC_NO}, + {0x2FD2, UNICODE_NORM_QC_NO}, + {0x2FD3, UNICODE_NORM_QC_NO}, + {0x2FD4, UNICODE_NORM_QC_NO}, + {0x2FD5, UNICODE_NORM_QC_NO}, + {0x3000, UNICODE_NORM_QC_NO}, + {0x3036, UNICODE_NORM_QC_NO}, + {0x3038, UNICODE_NORM_QC_NO}, + {0x3039, UNICODE_NORM_QC_NO}, + {0x303A, UNICODE_NORM_QC_NO}, + {0x3099, UNICODE_NORM_QC_MAYBE}, + {0x309A, UNICODE_NORM_QC_MAYBE}, + {0x309B, UNICODE_NORM_QC_NO}, + {0x309C, UNICODE_NORM_QC_NO}, + {0x309F, UNICODE_NORM_QC_NO}, + {0x30FF, UNICODE_NORM_QC_NO}, + {0x3131, UNICODE_NORM_QC_NO}, + {0x3132, UNICODE_NORM_QC_NO}, + {0x3133, UNICODE_NORM_QC_NO}, + {0x3134, UNICODE_NORM_QC_NO}, + {0x3135, UNICODE_NORM_QC_NO}, + {0x3136, UNICODE_NORM_QC_NO}, + {0x3137, UNICODE_NORM_QC_NO}, + {0x3138, UNICODE_NORM_QC_NO}, + {0x3139, UNICODE_NORM_QC_NO}, + {0x313A, UNICODE_NORM_QC_NO}, + {0x313B, UNICODE_NORM_QC_NO}, + {0x313C, UNICODE_NORM_QC_NO}, + {0x313D, UNICODE_NORM_QC_NO}, + {0x313E, UNICODE_NORM_QC_NO}, + {0x313F, UNICODE_NORM_QC_NO}, + {0x3140, UNICODE_NORM_QC_NO}, + {0x3141, UNICODE_NORM_QC_NO}, + {0x3142, UNICODE_NORM_QC_NO}, + {0x3143, UNICODE_NORM_QC_NO}, + {0x3144, UNICODE_NORM_QC_NO}, + {0x3145, UNICODE_NORM_QC_NO}, + {0x3146, UNICODE_NORM_QC_NO}, + {0x3147, UNICODE_NORM_QC_NO}, + {0x3148, UNICODE_NORM_QC_NO}, + {0x3149, UNICODE_NORM_QC_NO}, + {0x314A, UNICODE_NORM_QC_NO}, + {0x314B, UNICODE_NORM_QC_NO}, + {0x314C, UNICODE_NORM_QC_NO}, + {0x314D, UNICODE_NORM_QC_NO}, + {0x314E, UNICODE_NORM_QC_NO}, + {0x314F, UNICODE_NORM_QC_NO}, + {0x3150, UNICODE_NORM_QC_NO}, + {0x3151, UNICODE_NORM_QC_NO}, + {0x3152, UNICODE_NORM_QC_NO}, + {0x3153, UNICODE_NORM_QC_NO}, + {0x3154, UNICODE_NORM_QC_NO}, + {0x3155, UNICODE_NORM_QC_NO}, + {0x3156, UNICODE_NORM_QC_NO}, + {0x3157, UNICODE_NORM_QC_NO}, + {0x3158, UNICODE_NORM_QC_NO}, + {0x3159, UNICODE_NORM_QC_NO}, + {0x315A, UNICODE_NORM_QC_NO}, + {0x315B, UNICODE_NORM_QC_NO}, + {0x315C, UNICODE_NORM_QC_NO}, + {0x315D, UNICODE_NORM_QC_NO}, + {0x315E, UNICODE_NORM_QC_NO}, + {0x315F, UNICODE_NORM_QC_NO}, + {0x3160, UNICODE_NORM_QC_NO}, + {0x3161, UNICODE_NORM_QC_NO}, + {0x3162, UNICODE_NORM_QC_NO}, + {0x3163, UNICODE_NORM_QC_NO}, + {0x3164, UNICODE_NORM_QC_NO}, + {0x3165, UNICODE_NORM_QC_NO}, + {0x3166, UNICODE_NORM_QC_NO}, + {0x3167, UNICODE_NORM_QC_NO}, + {0x3168, UNICODE_NORM_QC_NO}, + {0x3169, UNICODE_NORM_QC_NO}, + {0x316A, UNICODE_NORM_QC_NO}, + {0x316B, UNICODE_NORM_QC_NO}, + {0x316C, UNICODE_NORM_QC_NO}, + {0x316D, UNICODE_NORM_QC_NO}, + {0x316E, UNICODE_NORM_QC_NO}, + {0x316F, UNICODE_NORM_QC_NO}, + {0x3170, UNICODE_NORM_QC_NO}, + {0x3171, UNICODE_NORM_QC_NO}, + {0x3172, UNICODE_NORM_QC_NO}, + {0x3173, UNICODE_NORM_QC_NO}, + {0x3174, UNICODE_NORM_QC_NO}, + {0x3175, UNICODE_NORM_QC_NO}, + {0x3176, UNICODE_NORM_QC_NO}, + {0x3177, UNICODE_NORM_QC_NO}, + {0x3178, UNICODE_NORM_QC_NO}, + {0x3179, UNICODE_NORM_QC_NO}, + {0x317A, UNICODE_NORM_QC_NO}, + {0x317B, UNICODE_NORM_QC_NO}, + {0x317C, UNICODE_NORM_QC_NO}, + {0x317D, UNICODE_NORM_QC_NO}, + {0x317E, UNICODE_NORM_QC_NO}, + {0x317F, UNICODE_NORM_QC_NO}, + {0x3180, UNICODE_NORM_QC_NO}, + {0x3181, UNICODE_NORM_QC_NO}, + {0x3182, UNICODE_NORM_QC_NO}, + {0x3183, UNICODE_NORM_QC_NO}, + {0x3184, UNICODE_NORM_QC_NO}, + {0x3185, UNICODE_NORM_QC_NO}, + {0x3186, UNICODE_NORM_QC_NO}, + {0x3187, UNICODE_NORM_QC_NO}, + {0x3188, UNICODE_NORM_QC_NO}, + {0x3189, UNICODE_NORM_QC_NO}, + {0x318A, UNICODE_NORM_QC_NO}, + {0x318B, UNICODE_NORM_QC_NO}, + {0x318C, UNICODE_NORM_QC_NO}, + {0x318D, UNICODE_NORM_QC_NO}, + {0x318E, UNICODE_NORM_QC_NO}, + {0x3192, UNICODE_NORM_QC_NO}, + {0x3193, UNICODE_NORM_QC_NO}, + {0x3194, UNICODE_NORM_QC_NO}, + {0x3195, UNICODE_NORM_QC_NO}, + {0x3196, UNICODE_NORM_QC_NO}, + {0x3197, UNICODE_NORM_QC_NO}, + {0x3198, UNICODE_NORM_QC_NO}, + {0x3199, UNICODE_NORM_QC_NO}, + {0x319A, UNICODE_NORM_QC_NO}, + {0x319B, UNICODE_NORM_QC_NO}, + {0x319C, UNICODE_NORM_QC_NO}, + {0x319D, UNICODE_NORM_QC_NO}, + {0x319E, UNICODE_NORM_QC_NO}, + {0x319F, UNICODE_NORM_QC_NO}, + {0x3200, UNICODE_NORM_QC_NO}, + {0x3201, UNICODE_NORM_QC_NO}, + {0x3202, UNICODE_NORM_QC_NO}, + {0x3203, UNICODE_NORM_QC_NO}, + {0x3204, UNICODE_NORM_QC_NO}, + {0x3205, UNICODE_NORM_QC_NO}, + {0x3206, UNICODE_NORM_QC_NO}, + {0x3207, UNICODE_NORM_QC_NO}, + {0x3208, UNICODE_NORM_QC_NO}, + {0x3209, UNICODE_NORM_QC_NO}, + {0x320A, UNICODE_NORM_QC_NO}, + {0x320B, UNICODE_NORM_QC_NO}, + {0x320C, UNICODE_NORM_QC_NO}, + {0x320D, UNICODE_NORM_QC_NO}, + {0x320E, UNICODE_NORM_QC_NO}, + {0x320F, UNICODE_NORM_QC_NO}, + {0x3210, UNICODE_NORM_QC_NO}, + {0x3211, UNICODE_NORM_QC_NO}, + {0x3212, UNICODE_NORM_QC_NO}, + {0x3213, UNICODE_NORM_QC_NO}, + {0x3214, UNICODE_NORM_QC_NO}, + {0x3215, UNICODE_NORM_QC_NO}, + {0x3216, UNICODE_NORM_QC_NO}, + {0x3217, UNICODE_NORM_QC_NO}, + {0x3218, UNICODE_NORM_QC_NO}, + {0x3219, UNICODE_NORM_QC_NO}, + {0x321A, UNICODE_NORM_QC_NO}, + {0x321B, UNICODE_NORM_QC_NO}, + {0x321C, UNICODE_NORM_QC_NO}, + {0x321D, UNICODE_NORM_QC_NO}, + {0x321E, UNICODE_NORM_QC_NO}, + {0x3220, UNICODE_NORM_QC_NO}, + {0x3221, UNICODE_NORM_QC_NO}, + {0x3222, UNICODE_NORM_QC_NO}, + {0x3223, UNICODE_NORM_QC_NO}, + {0x3224, UNICODE_NORM_QC_NO}, + {0x3225, UNICODE_NORM_QC_NO}, + {0x3226, UNICODE_NORM_QC_NO}, + {0x3227, UNICODE_NORM_QC_NO}, + {0x3228, UNICODE_NORM_QC_NO}, + {0x3229, UNICODE_NORM_QC_NO}, + {0x322A, UNICODE_NORM_QC_NO}, + {0x322B, UNICODE_NORM_QC_NO}, + {0x322C, UNICODE_NORM_QC_NO}, + {0x322D, UNICODE_NORM_QC_NO}, + {0x322E, UNICODE_NORM_QC_NO}, + {0x322F, UNICODE_NORM_QC_NO}, + {0x3230, UNICODE_NORM_QC_NO}, + {0x3231, UNICODE_NORM_QC_NO}, + {0x3232, UNICODE_NORM_QC_NO}, + {0x3233, UNICODE_NORM_QC_NO}, + {0x3234, UNICODE_NORM_QC_NO}, + {0x3235, UNICODE_NORM_QC_NO}, + {0x3236, UNICODE_NORM_QC_NO}, + {0x3237, UNICODE_NORM_QC_NO}, + {0x3238, UNICODE_NORM_QC_NO}, + {0x3239, UNICODE_NORM_QC_NO}, + {0x323A, UNICODE_NORM_QC_NO}, + {0x323B, UNICODE_NORM_QC_NO}, + {0x323C, UNICODE_NORM_QC_NO}, + {0x323D, UNICODE_NORM_QC_NO}, + {0x323E, UNICODE_NORM_QC_NO}, + {0x323F, UNICODE_NORM_QC_NO}, + {0x3240, UNICODE_NORM_QC_NO}, + {0x3241, UNICODE_NORM_QC_NO}, + {0x3242, UNICODE_NORM_QC_NO}, + {0x3243, UNICODE_NORM_QC_NO}, + {0x3244, UNICODE_NORM_QC_NO}, + {0x3245, UNICODE_NORM_QC_NO}, + {0x3246, UNICODE_NORM_QC_NO}, + {0x3247, UNICODE_NORM_QC_NO}, + {0x3250, UNICODE_NORM_QC_NO}, + {0x3251, UNICODE_NORM_QC_NO}, + {0x3252, UNICODE_NORM_QC_NO}, + {0x3253, UNICODE_NORM_QC_NO}, + {0x3254, UNICODE_NORM_QC_NO}, + {0x3255, UNICODE_NORM_QC_NO}, + {0x3256, UNICODE_NORM_QC_NO}, + {0x3257, UNICODE_NORM_QC_NO}, + {0x3258, UNICODE_NORM_QC_NO}, + {0x3259, UNICODE_NORM_QC_NO}, + {0x325A, UNICODE_NORM_QC_NO}, + {0x325B, UNICODE_NORM_QC_NO}, + {0x325C, UNICODE_NORM_QC_NO}, + {0x325D, UNICODE_NORM_QC_NO}, + {0x325E, UNICODE_NORM_QC_NO}, + {0x325F, UNICODE_NORM_QC_NO}, + {0x3260, UNICODE_NORM_QC_NO}, + {0x3261, UNICODE_NORM_QC_NO}, + {0x3262, UNICODE_NORM_QC_NO}, + {0x3263, UNICODE_NORM_QC_NO}, + {0x3264, UNICODE_NORM_QC_NO}, + {0x3265, UNICODE_NORM_QC_NO}, + {0x3266, UNICODE_NORM_QC_NO}, + {0x3267, UNICODE_NORM_QC_NO}, + {0x3268, UNICODE_NORM_QC_NO}, + {0x3269, UNICODE_NORM_QC_NO}, + {0x326A, UNICODE_NORM_QC_NO}, + {0x326B, UNICODE_NORM_QC_NO}, + {0x326C, UNICODE_NORM_QC_NO}, + {0x326D, UNICODE_NORM_QC_NO}, + {0x326E, UNICODE_NORM_QC_NO}, + {0x326F, UNICODE_NORM_QC_NO}, + {0x3270, UNICODE_NORM_QC_NO}, + {0x3271, UNICODE_NORM_QC_NO}, + {0x3272, UNICODE_NORM_QC_NO}, + {0x3273, UNICODE_NORM_QC_NO}, + {0x3274, UNICODE_NORM_QC_NO}, + {0x3275, UNICODE_NORM_QC_NO}, + {0x3276, UNICODE_NORM_QC_NO}, + {0x3277, UNICODE_NORM_QC_NO}, + {0x3278, UNICODE_NORM_QC_NO}, + {0x3279, UNICODE_NORM_QC_NO}, + {0x327A, UNICODE_NORM_QC_NO}, + {0x327B, UNICODE_NORM_QC_NO}, + {0x327C, UNICODE_NORM_QC_NO}, + {0x327D, UNICODE_NORM_QC_NO}, + {0x327E, UNICODE_NORM_QC_NO}, + {0x3280, UNICODE_NORM_QC_NO}, + {0x3281, UNICODE_NORM_QC_NO}, + {0x3282, UNICODE_NORM_QC_NO}, + {0x3283, UNICODE_NORM_QC_NO}, + {0x3284, UNICODE_NORM_QC_NO}, + {0x3285, UNICODE_NORM_QC_NO}, + {0x3286, UNICODE_NORM_QC_NO}, + {0x3287, UNICODE_NORM_QC_NO}, + {0x3288, UNICODE_NORM_QC_NO}, + {0x3289, UNICODE_NORM_QC_NO}, + {0x328A, UNICODE_NORM_QC_NO}, + {0x328B, UNICODE_NORM_QC_NO}, + {0x328C, UNICODE_NORM_QC_NO}, + {0x328D, UNICODE_NORM_QC_NO}, + {0x328E, UNICODE_NORM_QC_NO}, + {0x328F, UNICODE_NORM_QC_NO}, + {0x3290, UNICODE_NORM_QC_NO}, + {0x3291, UNICODE_NORM_QC_NO}, + {0x3292, UNICODE_NORM_QC_NO}, + {0x3293, UNICODE_NORM_QC_NO}, + {0x3294, UNICODE_NORM_QC_NO}, + {0x3295, UNICODE_NORM_QC_NO}, + {0x3296, UNICODE_NORM_QC_NO}, + {0x3297, UNICODE_NORM_QC_NO}, + {0x3298, UNICODE_NORM_QC_NO}, + {0x3299, UNICODE_NORM_QC_NO}, + {0x329A, UNICODE_NORM_QC_NO}, + {0x329B, UNICODE_NORM_QC_NO}, + {0x329C, UNICODE_NORM_QC_NO}, + {0x329D, UNICODE_NORM_QC_NO}, + {0x329E, UNICODE_NORM_QC_NO}, + {0x329F, UNICODE_NORM_QC_NO}, + {0x32A0, UNICODE_NORM_QC_NO}, + {0x32A1, UNICODE_NORM_QC_NO}, + {0x32A2, UNICODE_NORM_QC_NO}, + {0x32A3, UNICODE_NORM_QC_NO}, + {0x32A4, UNICODE_NORM_QC_NO}, + {0x32A5, UNICODE_NORM_QC_NO}, + {0x32A6, UNICODE_NORM_QC_NO}, + {0x32A7, UNICODE_NORM_QC_NO}, + {0x32A8, UNICODE_NORM_QC_NO}, + {0x32A9, UNICODE_NORM_QC_NO}, + {0x32AA, UNICODE_NORM_QC_NO}, + {0x32AB, UNICODE_NORM_QC_NO}, + {0x32AC, UNICODE_NORM_QC_NO}, + {0x32AD, UNICODE_NORM_QC_NO}, + {0x32AE, UNICODE_NORM_QC_NO}, + {0x32AF, UNICODE_NORM_QC_NO}, + {0x32B0, UNICODE_NORM_QC_NO}, + {0x32B1, UNICODE_NORM_QC_NO}, + {0x32B2, UNICODE_NORM_QC_NO}, + {0x32B3, UNICODE_NORM_QC_NO}, + {0x32B4, UNICODE_NORM_QC_NO}, + {0x32B5, UNICODE_NORM_QC_NO}, + {0x32B6, UNICODE_NORM_QC_NO}, + {0x32B7, UNICODE_NORM_QC_NO}, + {0x32B8, UNICODE_NORM_QC_NO}, + {0x32B9, UNICODE_NORM_QC_NO}, + {0x32BA, UNICODE_NORM_QC_NO}, + {0x32BB, UNICODE_NORM_QC_NO}, + {0x32BC, UNICODE_NORM_QC_NO}, + {0x32BD, UNICODE_NORM_QC_NO}, + {0x32BE, UNICODE_NORM_QC_NO}, + {0x32BF, UNICODE_NORM_QC_NO}, + {0x32C0, UNICODE_NORM_QC_NO}, + {0x32C1, UNICODE_NORM_QC_NO}, + {0x32C2, UNICODE_NORM_QC_NO}, + {0x32C3, UNICODE_NORM_QC_NO}, + {0x32C4, UNICODE_NORM_QC_NO}, + {0x32C5, UNICODE_NORM_QC_NO}, + {0x32C6, UNICODE_NORM_QC_NO}, + {0x32C7, UNICODE_NORM_QC_NO}, + {0x32C8, UNICODE_NORM_QC_NO}, + {0x32C9, UNICODE_NORM_QC_NO}, + {0x32CA, UNICODE_NORM_QC_NO}, + {0x32CB, UNICODE_NORM_QC_NO}, + {0x32CC, UNICODE_NORM_QC_NO}, + {0x32CD, UNICODE_NORM_QC_NO}, + {0x32CE, UNICODE_NORM_QC_NO}, + {0x32CF, UNICODE_NORM_QC_NO}, + {0x32D0, UNICODE_NORM_QC_NO}, + {0x32D1, UNICODE_NORM_QC_NO}, + {0x32D2, UNICODE_NORM_QC_NO}, + {0x32D3, UNICODE_NORM_QC_NO}, + {0x32D4, UNICODE_NORM_QC_NO}, + {0x32D5, UNICODE_NORM_QC_NO}, + {0x32D6, UNICODE_NORM_QC_NO}, + {0x32D7, UNICODE_NORM_QC_NO}, + {0x32D8, UNICODE_NORM_QC_NO}, + {0x32D9, UNICODE_NORM_QC_NO}, + {0x32DA, UNICODE_NORM_QC_NO}, + {0x32DB, UNICODE_NORM_QC_NO}, + {0x32DC, UNICODE_NORM_QC_NO}, + {0x32DD, UNICODE_NORM_QC_NO}, + {0x32DE, UNICODE_NORM_QC_NO}, + {0x32DF, UNICODE_NORM_QC_NO}, + {0x32E0, UNICODE_NORM_QC_NO}, + {0x32E1, UNICODE_NORM_QC_NO}, + {0x32E2, UNICODE_NORM_QC_NO}, + {0x32E3, UNICODE_NORM_QC_NO}, + {0x32E4, UNICODE_NORM_QC_NO}, + {0x32E5, UNICODE_NORM_QC_NO}, + {0x32E6, UNICODE_NORM_QC_NO}, + {0x32E7, UNICODE_NORM_QC_NO}, + {0x32E8, UNICODE_NORM_QC_NO}, + {0x32E9, UNICODE_NORM_QC_NO}, + {0x32EA, UNICODE_NORM_QC_NO}, + {0x32EB, UNICODE_NORM_QC_NO}, + {0x32EC, UNICODE_NORM_QC_NO}, + {0x32ED, UNICODE_NORM_QC_NO}, + {0x32EE, UNICODE_NORM_QC_NO}, + {0x32EF, UNICODE_NORM_QC_NO}, + {0x32F0, UNICODE_NORM_QC_NO}, + {0x32F1, UNICODE_NORM_QC_NO}, + {0x32F2, UNICODE_NORM_QC_NO}, + {0x32F3, UNICODE_NORM_QC_NO}, + {0x32F4, UNICODE_NORM_QC_NO}, + {0x32F5, UNICODE_NORM_QC_NO}, + {0x32F6, UNICODE_NORM_QC_NO}, + {0x32F7, UNICODE_NORM_QC_NO}, + {0x32F8, UNICODE_NORM_QC_NO}, + {0x32F9, UNICODE_NORM_QC_NO}, + {0x32FA, UNICODE_NORM_QC_NO}, + {0x32FB, UNICODE_NORM_QC_NO}, + {0x32FC, UNICODE_NORM_QC_NO}, + {0x32FD, UNICODE_NORM_QC_NO}, + {0x32FE, UNICODE_NORM_QC_NO}, + {0x32FF, UNICODE_NORM_QC_NO}, + {0x3300, UNICODE_NORM_QC_NO}, + {0x3301, UNICODE_NORM_QC_NO}, + {0x3302, UNICODE_NORM_QC_NO}, + {0x3303, UNICODE_NORM_QC_NO}, + {0x3304, UNICODE_NORM_QC_NO}, + {0x3305, UNICODE_NORM_QC_NO}, + {0x3306, UNICODE_NORM_QC_NO}, + {0x3307, UNICODE_NORM_QC_NO}, + {0x3308, UNICODE_NORM_QC_NO}, + {0x3309, UNICODE_NORM_QC_NO}, + {0x330A, UNICODE_NORM_QC_NO}, + {0x330B, UNICODE_NORM_QC_NO}, + {0x330C, UNICODE_NORM_QC_NO}, + {0x330D, UNICODE_NORM_QC_NO}, + {0x330E, UNICODE_NORM_QC_NO}, + {0x330F, UNICODE_NORM_QC_NO}, + {0x3310, UNICODE_NORM_QC_NO}, + {0x3311, UNICODE_NORM_QC_NO}, + {0x3312, UNICODE_NORM_QC_NO}, + {0x3313, UNICODE_NORM_QC_NO}, + {0x3314, UNICODE_NORM_QC_NO}, + {0x3315, UNICODE_NORM_QC_NO}, + {0x3316, UNICODE_NORM_QC_NO}, + {0x3317, UNICODE_NORM_QC_NO}, + {0x3318, UNICODE_NORM_QC_NO}, + {0x3319, UNICODE_NORM_QC_NO}, + {0x331A, UNICODE_NORM_QC_NO}, + {0x331B, UNICODE_NORM_QC_NO}, + {0x331C, UNICODE_NORM_QC_NO}, + {0x331D, UNICODE_NORM_QC_NO}, + {0x331E, UNICODE_NORM_QC_NO}, + {0x331F, UNICODE_NORM_QC_NO}, + {0x3320, UNICODE_NORM_QC_NO}, + {0x3321, UNICODE_NORM_QC_NO}, + {0x3322, UNICODE_NORM_QC_NO}, + {0x3323, UNICODE_NORM_QC_NO}, + {0x3324, UNICODE_NORM_QC_NO}, + {0x3325, UNICODE_NORM_QC_NO}, + {0x3326, UNICODE_NORM_QC_NO}, + {0x3327, UNICODE_NORM_QC_NO}, + {0x3328, UNICODE_NORM_QC_NO}, + {0x3329, UNICODE_NORM_QC_NO}, + {0x332A, UNICODE_NORM_QC_NO}, + {0x332B, UNICODE_NORM_QC_NO}, + {0x332C, UNICODE_NORM_QC_NO}, + {0x332D, UNICODE_NORM_QC_NO}, + {0x332E, UNICODE_NORM_QC_NO}, + {0x332F, UNICODE_NORM_QC_NO}, + {0x3330, UNICODE_NORM_QC_NO}, + {0x3331, UNICODE_NORM_QC_NO}, + {0x3332, UNICODE_NORM_QC_NO}, + {0x3333, UNICODE_NORM_QC_NO}, + {0x3334, UNICODE_NORM_QC_NO}, + {0x3335, UNICODE_NORM_QC_NO}, + {0x3336, UNICODE_NORM_QC_NO}, + {0x3337, UNICODE_NORM_QC_NO}, + {0x3338, UNICODE_NORM_QC_NO}, + {0x3339, UNICODE_NORM_QC_NO}, + {0x333A, UNICODE_NORM_QC_NO}, + {0x333B, UNICODE_NORM_QC_NO}, + {0x333C, UNICODE_NORM_QC_NO}, + {0x333D, UNICODE_NORM_QC_NO}, + {0x333E, UNICODE_NORM_QC_NO}, + {0x333F, UNICODE_NORM_QC_NO}, + {0x3340, UNICODE_NORM_QC_NO}, + {0x3341, UNICODE_NORM_QC_NO}, + {0x3342, UNICODE_NORM_QC_NO}, + {0x3343, UNICODE_NORM_QC_NO}, + {0x3344, UNICODE_NORM_QC_NO}, + {0x3345, UNICODE_NORM_QC_NO}, + {0x3346, UNICODE_NORM_QC_NO}, + {0x3347, UNICODE_NORM_QC_NO}, + {0x3348, UNICODE_NORM_QC_NO}, + {0x3349, UNICODE_NORM_QC_NO}, + {0x334A, UNICODE_NORM_QC_NO}, + {0x334B, UNICODE_NORM_QC_NO}, + {0x334C, UNICODE_NORM_QC_NO}, + {0x334D, UNICODE_NORM_QC_NO}, + {0x334E, UNICODE_NORM_QC_NO}, + {0x334F, UNICODE_NORM_QC_NO}, + {0x3350, UNICODE_NORM_QC_NO}, + {0x3351, UNICODE_NORM_QC_NO}, + {0x3352, UNICODE_NORM_QC_NO}, + {0x3353, UNICODE_NORM_QC_NO}, + {0x3354, UNICODE_NORM_QC_NO}, + {0x3355, UNICODE_NORM_QC_NO}, + {0x3356, UNICODE_NORM_QC_NO}, + {0x3357, UNICODE_NORM_QC_NO}, + {0x3358, UNICODE_NORM_QC_NO}, + {0x3359, UNICODE_NORM_QC_NO}, + {0x335A, UNICODE_NORM_QC_NO}, + {0x335B, UNICODE_NORM_QC_NO}, + {0x335C, UNICODE_NORM_QC_NO}, + {0x335D, UNICODE_NORM_QC_NO}, + {0x335E, UNICODE_NORM_QC_NO}, + {0x335F, UNICODE_NORM_QC_NO}, + {0x3360, UNICODE_NORM_QC_NO}, + {0x3361, UNICODE_NORM_QC_NO}, + {0x3362, UNICODE_NORM_QC_NO}, + {0x3363, UNICODE_NORM_QC_NO}, + {0x3364, UNICODE_NORM_QC_NO}, + {0x3365, UNICODE_NORM_QC_NO}, + {0x3366, UNICODE_NORM_QC_NO}, + {0x3367, UNICODE_NORM_QC_NO}, + {0x3368, UNICODE_NORM_QC_NO}, + {0x3369, UNICODE_NORM_QC_NO}, + {0x336A, UNICODE_NORM_QC_NO}, + {0x336B, UNICODE_NORM_QC_NO}, + {0x336C, UNICODE_NORM_QC_NO}, + {0x336D, UNICODE_NORM_QC_NO}, + {0x336E, UNICODE_NORM_QC_NO}, + {0x336F, UNICODE_NORM_QC_NO}, + {0x3370, UNICODE_NORM_QC_NO}, + {0x3371, UNICODE_NORM_QC_NO}, + {0x3372, UNICODE_NORM_QC_NO}, + {0x3373, UNICODE_NORM_QC_NO}, + {0x3374, UNICODE_NORM_QC_NO}, + {0x3375, UNICODE_NORM_QC_NO}, + {0x3376, UNICODE_NORM_QC_NO}, + {0x3377, UNICODE_NORM_QC_NO}, + {0x3378, UNICODE_NORM_QC_NO}, + {0x3379, UNICODE_NORM_QC_NO}, + {0x337A, UNICODE_NORM_QC_NO}, + {0x337B, UNICODE_NORM_QC_NO}, + {0x337C, UNICODE_NORM_QC_NO}, + {0x337D, UNICODE_NORM_QC_NO}, + {0x337E, UNICODE_NORM_QC_NO}, + {0x337F, UNICODE_NORM_QC_NO}, + {0x3380, UNICODE_NORM_QC_NO}, + {0x3381, UNICODE_NORM_QC_NO}, + {0x3382, UNICODE_NORM_QC_NO}, + {0x3383, UNICODE_NORM_QC_NO}, + {0x3384, UNICODE_NORM_QC_NO}, + {0x3385, UNICODE_NORM_QC_NO}, + {0x3386, UNICODE_NORM_QC_NO}, + {0x3387, UNICODE_NORM_QC_NO}, + {0x3388, UNICODE_NORM_QC_NO}, + {0x3389, UNICODE_NORM_QC_NO}, + {0x338A, UNICODE_NORM_QC_NO}, + {0x338B, UNICODE_NORM_QC_NO}, + {0x338C, UNICODE_NORM_QC_NO}, + {0x338D, UNICODE_NORM_QC_NO}, + {0x338E, UNICODE_NORM_QC_NO}, + {0x338F, UNICODE_NORM_QC_NO}, + {0x3390, UNICODE_NORM_QC_NO}, + {0x3391, UNICODE_NORM_QC_NO}, + {0x3392, UNICODE_NORM_QC_NO}, + {0x3393, UNICODE_NORM_QC_NO}, + {0x3394, UNICODE_NORM_QC_NO}, + {0x3395, UNICODE_NORM_QC_NO}, + {0x3396, UNICODE_NORM_QC_NO}, + {0x3397, UNICODE_NORM_QC_NO}, + {0x3398, UNICODE_NORM_QC_NO}, + {0x3399, UNICODE_NORM_QC_NO}, + {0x339A, UNICODE_NORM_QC_NO}, + {0x339B, UNICODE_NORM_QC_NO}, + {0x339C, UNICODE_NORM_QC_NO}, + {0x339D, UNICODE_NORM_QC_NO}, + {0x339E, UNICODE_NORM_QC_NO}, + {0x339F, UNICODE_NORM_QC_NO}, + {0x33A0, UNICODE_NORM_QC_NO}, + {0x33A1, UNICODE_NORM_QC_NO}, + {0x33A2, UNICODE_NORM_QC_NO}, + {0x33A3, UNICODE_NORM_QC_NO}, + {0x33A4, UNICODE_NORM_QC_NO}, + {0x33A5, UNICODE_NORM_QC_NO}, + {0x33A6, UNICODE_NORM_QC_NO}, + {0x33A7, UNICODE_NORM_QC_NO}, + {0x33A8, UNICODE_NORM_QC_NO}, + {0x33A9, UNICODE_NORM_QC_NO}, + {0x33AA, UNICODE_NORM_QC_NO}, + {0x33AB, UNICODE_NORM_QC_NO}, + {0x33AC, UNICODE_NORM_QC_NO}, + {0x33AD, UNICODE_NORM_QC_NO}, + {0x33AE, UNICODE_NORM_QC_NO}, + {0x33AF, UNICODE_NORM_QC_NO}, + {0x33B0, UNICODE_NORM_QC_NO}, + {0x33B1, UNICODE_NORM_QC_NO}, + {0x33B2, UNICODE_NORM_QC_NO}, + {0x33B3, UNICODE_NORM_QC_NO}, + {0x33B4, UNICODE_NORM_QC_NO}, + {0x33B5, UNICODE_NORM_QC_NO}, + {0x33B6, UNICODE_NORM_QC_NO}, + {0x33B7, UNICODE_NORM_QC_NO}, + {0x33B8, UNICODE_NORM_QC_NO}, + {0x33B9, UNICODE_NORM_QC_NO}, + {0x33BA, UNICODE_NORM_QC_NO}, + {0x33BB, UNICODE_NORM_QC_NO}, + {0x33BC, UNICODE_NORM_QC_NO}, + {0x33BD, UNICODE_NORM_QC_NO}, + {0x33BE, UNICODE_NORM_QC_NO}, + {0x33BF, UNICODE_NORM_QC_NO}, + {0x33C0, UNICODE_NORM_QC_NO}, + {0x33C1, UNICODE_NORM_QC_NO}, + {0x33C2, UNICODE_NORM_QC_NO}, + {0x33C3, UNICODE_NORM_QC_NO}, + {0x33C4, UNICODE_NORM_QC_NO}, + {0x33C5, UNICODE_NORM_QC_NO}, + {0x33C6, UNICODE_NORM_QC_NO}, + {0x33C7, UNICODE_NORM_QC_NO}, + {0x33C8, UNICODE_NORM_QC_NO}, + {0x33C9, UNICODE_NORM_QC_NO}, + {0x33CA, UNICODE_NORM_QC_NO}, + {0x33CB, UNICODE_NORM_QC_NO}, + {0x33CC, UNICODE_NORM_QC_NO}, + {0x33CD, UNICODE_NORM_QC_NO}, + {0x33CE, UNICODE_NORM_QC_NO}, + {0x33CF, UNICODE_NORM_QC_NO}, + {0x33D0, UNICODE_NORM_QC_NO}, + {0x33D1, UNICODE_NORM_QC_NO}, + {0x33D2, UNICODE_NORM_QC_NO}, + {0x33D3, UNICODE_NORM_QC_NO}, + {0x33D4, UNICODE_NORM_QC_NO}, + {0x33D5, UNICODE_NORM_QC_NO}, + {0x33D6, UNICODE_NORM_QC_NO}, + {0x33D7, UNICODE_NORM_QC_NO}, + {0x33D8, UNICODE_NORM_QC_NO}, + {0x33D9, UNICODE_NORM_QC_NO}, + {0x33DA, UNICODE_NORM_QC_NO}, + {0x33DB, UNICODE_NORM_QC_NO}, + {0x33DC, UNICODE_NORM_QC_NO}, + {0x33DD, UNICODE_NORM_QC_NO}, + {0x33DE, UNICODE_NORM_QC_NO}, + {0x33DF, UNICODE_NORM_QC_NO}, + {0x33E0, UNICODE_NORM_QC_NO}, + {0x33E1, UNICODE_NORM_QC_NO}, + {0x33E2, UNICODE_NORM_QC_NO}, + {0x33E3, UNICODE_NORM_QC_NO}, + {0x33E4, UNICODE_NORM_QC_NO}, + {0x33E5, UNICODE_NORM_QC_NO}, + {0x33E6, UNICODE_NORM_QC_NO}, + {0x33E7, UNICODE_NORM_QC_NO}, + {0x33E8, UNICODE_NORM_QC_NO}, + {0x33E9, UNICODE_NORM_QC_NO}, + {0x33EA, UNICODE_NORM_QC_NO}, + {0x33EB, UNICODE_NORM_QC_NO}, + {0x33EC, UNICODE_NORM_QC_NO}, + {0x33ED, UNICODE_NORM_QC_NO}, + {0x33EE, UNICODE_NORM_QC_NO}, + {0x33EF, UNICODE_NORM_QC_NO}, + {0x33F0, UNICODE_NORM_QC_NO}, + {0x33F1, UNICODE_NORM_QC_NO}, + {0x33F2, UNICODE_NORM_QC_NO}, + {0x33F3, UNICODE_NORM_QC_NO}, + {0x33F4, UNICODE_NORM_QC_NO}, + {0x33F5, UNICODE_NORM_QC_NO}, + {0x33F6, UNICODE_NORM_QC_NO}, + {0x33F7, UNICODE_NORM_QC_NO}, + {0x33F8, UNICODE_NORM_QC_NO}, + {0x33F9, UNICODE_NORM_QC_NO}, + {0x33FA, UNICODE_NORM_QC_NO}, + {0x33FB, UNICODE_NORM_QC_NO}, + {0x33FC, UNICODE_NORM_QC_NO}, + {0x33FD, UNICODE_NORM_QC_NO}, + {0x33FE, UNICODE_NORM_QC_NO}, + {0x33FF, UNICODE_NORM_QC_NO}, + {0xA69C, UNICODE_NORM_QC_NO}, + {0xA69D, UNICODE_NORM_QC_NO}, + {0xA770, UNICODE_NORM_QC_NO}, + {0xA7F2, UNICODE_NORM_QC_NO}, + {0xA7F3, UNICODE_NORM_QC_NO}, + {0xA7F4, UNICODE_NORM_QC_NO}, + {0xA7F8, UNICODE_NORM_QC_NO}, + {0xA7F9, UNICODE_NORM_QC_NO}, + {0xAB5C, UNICODE_NORM_QC_NO}, + {0xAB5D, UNICODE_NORM_QC_NO}, + {0xAB5E, UNICODE_NORM_QC_NO}, + {0xAB5F, UNICODE_NORM_QC_NO}, + {0xAB69, UNICODE_NORM_QC_NO}, + {0xF900, UNICODE_NORM_QC_NO}, + {0xF901, UNICODE_NORM_QC_NO}, + {0xF902, UNICODE_NORM_QC_NO}, + {0xF903, UNICODE_NORM_QC_NO}, + {0xF904, UNICODE_NORM_QC_NO}, + {0xF905, UNICODE_NORM_QC_NO}, + {0xF906, UNICODE_NORM_QC_NO}, + {0xF907, UNICODE_NORM_QC_NO}, + {0xF908, UNICODE_NORM_QC_NO}, + {0xF909, UNICODE_NORM_QC_NO}, + {0xF90A, UNICODE_NORM_QC_NO}, + {0xF90B, UNICODE_NORM_QC_NO}, + {0xF90C, UNICODE_NORM_QC_NO}, + {0xF90D, UNICODE_NORM_QC_NO}, + {0xF90E, UNICODE_NORM_QC_NO}, + {0xF90F, UNICODE_NORM_QC_NO}, + {0xF910, UNICODE_NORM_QC_NO}, + {0xF911, UNICODE_NORM_QC_NO}, + {0xF912, UNICODE_NORM_QC_NO}, + {0xF913, UNICODE_NORM_QC_NO}, + {0xF914, UNICODE_NORM_QC_NO}, + {0xF915, UNICODE_NORM_QC_NO}, + {0xF916, UNICODE_NORM_QC_NO}, + {0xF917, UNICODE_NORM_QC_NO}, + {0xF918, UNICODE_NORM_QC_NO}, + {0xF919, UNICODE_NORM_QC_NO}, + {0xF91A, UNICODE_NORM_QC_NO}, + {0xF91B, UNICODE_NORM_QC_NO}, + {0xF91C, UNICODE_NORM_QC_NO}, + {0xF91D, UNICODE_NORM_QC_NO}, + {0xF91E, UNICODE_NORM_QC_NO}, + {0xF91F, UNICODE_NORM_QC_NO}, + {0xF920, UNICODE_NORM_QC_NO}, + {0xF921, UNICODE_NORM_QC_NO}, + {0xF922, UNICODE_NORM_QC_NO}, + {0xF923, UNICODE_NORM_QC_NO}, + {0xF924, UNICODE_NORM_QC_NO}, + {0xF925, UNICODE_NORM_QC_NO}, + {0xF926, UNICODE_NORM_QC_NO}, + {0xF927, UNICODE_NORM_QC_NO}, + {0xF928, UNICODE_NORM_QC_NO}, + {0xF929, UNICODE_NORM_QC_NO}, + {0xF92A, UNICODE_NORM_QC_NO}, + {0xF92B, UNICODE_NORM_QC_NO}, + {0xF92C, UNICODE_NORM_QC_NO}, + {0xF92D, UNICODE_NORM_QC_NO}, + {0xF92E, UNICODE_NORM_QC_NO}, + {0xF92F, UNICODE_NORM_QC_NO}, + {0xF930, UNICODE_NORM_QC_NO}, + {0xF931, UNICODE_NORM_QC_NO}, + {0xF932, UNICODE_NORM_QC_NO}, + {0xF933, UNICODE_NORM_QC_NO}, + {0xF934, UNICODE_NORM_QC_NO}, + {0xF935, UNICODE_NORM_QC_NO}, + {0xF936, UNICODE_NORM_QC_NO}, + {0xF937, UNICODE_NORM_QC_NO}, + {0xF938, UNICODE_NORM_QC_NO}, + {0xF939, UNICODE_NORM_QC_NO}, + {0xF93A, UNICODE_NORM_QC_NO}, + {0xF93B, UNICODE_NORM_QC_NO}, + {0xF93C, UNICODE_NORM_QC_NO}, + {0xF93D, UNICODE_NORM_QC_NO}, + {0xF93E, UNICODE_NORM_QC_NO}, + {0xF93F, UNICODE_NORM_QC_NO}, + {0xF940, UNICODE_NORM_QC_NO}, + {0xF941, UNICODE_NORM_QC_NO}, + {0xF942, UNICODE_NORM_QC_NO}, + {0xF943, UNICODE_NORM_QC_NO}, + {0xF944, UNICODE_NORM_QC_NO}, + {0xF945, UNICODE_NORM_QC_NO}, + {0xF946, UNICODE_NORM_QC_NO}, + {0xF947, UNICODE_NORM_QC_NO}, + {0xF948, UNICODE_NORM_QC_NO}, + {0xF949, UNICODE_NORM_QC_NO}, + {0xF94A, UNICODE_NORM_QC_NO}, + {0xF94B, UNICODE_NORM_QC_NO}, + {0xF94C, UNICODE_NORM_QC_NO}, + {0xF94D, UNICODE_NORM_QC_NO}, + {0xF94E, UNICODE_NORM_QC_NO}, + {0xF94F, UNICODE_NORM_QC_NO}, + {0xF950, UNICODE_NORM_QC_NO}, + {0xF951, UNICODE_NORM_QC_NO}, + {0xF952, UNICODE_NORM_QC_NO}, + {0xF953, UNICODE_NORM_QC_NO}, + {0xF954, UNICODE_NORM_QC_NO}, + {0xF955, UNICODE_NORM_QC_NO}, + {0xF956, UNICODE_NORM_QC_NO}, + {0xF957, UNICODE_NORM_QC_NO}, + {0xF958, UNICODE_NORM_QC_NO}, + {0xF959, UNICODE_NORM_QC_NO}, + {0xF95A, UNICODE_NORM_QC_NO}, + {0xF95B, UNICODE_NORM_QC_NO}, + {0xF95C, UNICODE_NORM_QC_NO}, + {0xF95D, UNICODE_NORM_QC_NO}, + {0xF95E, UNICODE_NORM_QC_NO}, + {0xF95F, UNICODE_NORM_QC_NO}, + {0xF960, UNICODE_NORM_QC_NO}, + {0xF961, UNICODE_NORM_QC_NO}, + {0xF962, UNICODE_NORM_QC_NO}, + {0xF963, UNICODE_NORM_QC_NO}, + {0xF964, UNICODE_NORM_QC_NO}, + {0xF965, UNICODE_NORM_QC_NO}, + {0xF966, UNICODE_NORM_QC_NO}, + {0xF967, UNICODE_NORM_QC_NO}, + {0xF968, UNICODE_NORM_QC_NO}, + {0xF969, UNICODE_NORM_QC_NO}, + {0xF96A, UNICODE_NORM_QC_NO}, + {0xF96B, UNICODE_NORM_QC_NO}, + {0xF96C, UNICODE_NORM_QC_NO}, + {0xF96D, UNICODE_NORM_QC_NO}, + {0xF96E, UNICODE_NORM_QC_NO}, + {0xF96F, UNICODE_NORM_QC_NO}, + {0xF970, UNICODE_NORM_QC_NO}, + {0xF971, UNICODE_NORM_QC_NO}, + {0xF972, UNICODE_NORM_QC_NO}, + {0xF973, UNICODE_NORM_QC_NO}, + {0xF974, UNICODE_NORM_QC_NO}, + {0xF975, UNICODE_NORM_QC_NO}, + {0xF976, UNICODE_NORM_QC_NO}, + {0xF977, UNICODE_NORM_QC_NO}, + {0xF978, UNICODE_NORM_QC_NO}, + {0xF979, UNICODE_NORM_QC_NO}, + {0xF97A, UNICODE_NORM_QC_NO}, + {0xF97B, UNICODE_NORM_QC_NO}, + {0xF97C, UNICODE_NORM_QC_NO}, + {0xF97D, UNICODE_NORM_QC_NO}, + {0xF97E, UNICODE_NORM_QC_NO}, + {0xF97F, UNICODE_NORM_QC_NO}, + {0xF980, UNICODE_NORM_QC_NO}, + {0xF981, UNICODE_NORM_QC_NO}, + {0xF982, UNICODE_NORM_QC_NO}, + {0xF983, UNICODE_NORM_QC_NO}, + {0xF984, UNICODE_NORM_QC_NO}, + {0xF985, UNICODE_NORM_QC_NO}, + {0xF986, UNICODE_NORM_QC_NO}, + {0xF987, UNICODE_NORM_QC_NO}, + {0xF988, UNICODE_NORM_QC_NO}, + {0xF989, UNICODE_NORM_QC_NO}, + {0xF98A, UNICODE_NORM_QC_NO}, + {0xF98B, UNICODE_NORM_QC_NO}, + {0xF98C, UNICODE_NORM_QC_NO}, + {0xF98D, UNICODE_NORM_QC_NO}, + {0xF98E, UNICODE_NORM_QC_NO}, + {0xF98F, UNICODE_NORM_QC_NO}, + {0xF990, UNICODE_NORM_QC_NO}, + {0xF991, UNICODE_NORM_QC_NO}, + {0xF992, UNICODE_NORM_QC_NO}, + {0xF993, UNICODE_NORM_QC_NO}, + {0xF994, UNICODE_NORM_QC_NO}, + {0xF995, UNICODE_NORM_QC_NO}, + {0xF996, UNICODE_NORM_QC_NO}, + {0xF997, UNICODE_NORM_QC_NO}, + {0xF998, UNICODE_NORM_QC_NO}, + {0xF999, UNICODE_NORM_QC_NO}, + {0xF99A, UNICODE_NORM_QC_NO}, + {0xF99B, UNICODE_NORM_QC_NO}, + {0xF99C, UNICODE_NORM_QC_NO}, + {0xF99D, UNICODE_NORM_QC_NO}, + {0xF99E, UNICODE_NORM_QC_NO}, + {0xF99F, UNICODE_NORM_QC_NO}, + {0xF9A0, UNICODE_NORM_QC_NO}, + {0xF9A1, UNICODE_NORM_QC_NO}, + {0xF9A2, UNICODE_NORM_QC_NO}, + {0xF9A3, UNICODE_NORM_QC_NO}, + {0xF9A4, UNICODE_NORM_QC_NO}, + {0xF9A5, UNICODE_NORM_QC_NO}, + {0xF9A6, UNICODE_NORM_QC_NO}, + {0xF9A7, UNICODE_NORM_QC_NO}, + {0xF9A8, UNICODE_NORM_QC_NO}, + {0xF9A9, UNICODE_NORM_QC_NO}, + {0xF9AA, UNICODE_NORM_QC_NO}, + {0xF9AB, UNICODE_NORM_QC_NO}, + {0xF9AC, UNICODE_NORM_QC_NO}, + {0xF9AD, UNICODE_NORM_QC_NO}, + {0xF9AE, UNICODE_NORM_QC_NO}, + {0xF9AF, UNICODE_NORM_QC_NO}, + {0xF9B0, UNICODE_NORM_QC_NO}, + {0xF9B1, UNICODE_NORM_QC_NO}, + {0xF9B2, UNICODE_NORM_QC_NO}, + {0xF9B3, UNICODE_NORM_QC_NO}, + {0xF9B4, UNICODE_NORM_QC_NO}, + {0xF9B5, UNICODE_NORM_QC_NO}, + {0xF9B6, UNICODE_NORM_QC_NO}, + {0xF9B7, UNICODE_NORM_QC_NO}, + {0xF9B8, UNICODE_NORM_QC_NO}, + {0xF9B9, UNICODE_NORM_QC_NO}, + {0xF9BA, UNICODE_NORM_QC_NO}, + {0xF9BB, UNICODE_NORM_QC_NO}, + {0xF9BC, UNICODE_NORM_QC_NO}, + {0xF9BD, UNICODE_NORM_QC_NO}, + {0xF9BE, UNICODE_NORM_QC_NO}, + {0xF9BF, UNICODE_NORM_QC_NO}, + {0xF9C0, UNICODE_NORM_QC_NO}, + {0xF9C1, UNICODE_NORM_QC_NO}, + {0xF9C2, UNICODE_NORM_QC_NO}, + {0xF9C3, UNICODE_NORM_QC_NO}, + {0xF9C4, UNICODE_NORM_QC_NO}, + {0xF9C5, UNICODE_NORM_QC_NO}, + {0xF9C6, UNICODE_NORM_QC_NO}, + {0xF9C7, UNICODE_NORM_QC_NO}, + {0xF9C8, UNICODE_NORM_QC_NO}, + {0xF9C9, UNICODE_NORM_QC_NO}, + {0xF9CA, UNICODE_NORM_QC_NO}, + {0xF9CB, UNICODE_NORM_QC_NO}, + {0xF9CC, UNICODE_NORM_QC_NO}, + {0xF9CD, UNICODE_NORM_QC_NO}, + {0xF9CE, UNICODE_NORM_QC_NO}, + {0xF9CF, UNICODE_NORM_QC_NO}, + {0xF9D0, UNICODE_NORM_QC_NO}, + {0xF9D1, UNICODE_NORM_QC_NO}, + {0xF9D2, UNICODE_NORM_QC_NO}, + {0xF9D3, UNICODE_NORM_QC_NO}, + {0xF9D4, UNICODE_NORM_QC_NO}, + {0xF9D5, UNICODE_NORM_QC_NO}, + {0xF9D6, UNICODE_NORM_QC_NO}, + {0xF9D7, UNICODE_NORM_QC_NO}, + {0xF9D8, UNICODE_NORM_QC_NO}, + {0xF9D9, UNICODE_NORM_QC_NO}, + {0xF9DA, UNICODE_NORM_QC_NO}, + {0xF9DB, UNICODE_NORM_QC_NO}, + {0xF9DC, UNICODE_NORM_QC_NO}, + {0xF9DD, UNICODE_NORM_QC_NO}, + {0xF9DE, UNICODE_NORM_QC_NO}, + {0xF9DF, UNICODE_NORM_QC_NO}, + {0xF9E0, UNICODE_NORM_QC_NO}, + {0xF9E1, UNICODE_NORM_QC_NO}, + {0xF9E2, UNICODE_NORM_QC_NO}, + {0xF9E3, UNICODE_NORM_QC_NO}, + {0xF9E4, UNICODE_NORM_QC_NO}, + {0xF9E5, UNICODE_NORM_QC_NO}, + {0xF9E6, UNICODE_NORM_QC_NO}, + {0xF9E7, UNICODE_NORM_QC_NO}, + {0xF9E8, UNICODE_NORM_QC_NO}, + {0xF9E9, UNICODE_NORM_QC_NO}, + {0xF9EA, UNICODE_NORM_QC_NO}, + {0xF9EB, UNICODE_NORM_QC_NO}, + {0xF9EC, UNICODE_NORM_QC_NO}, + {0xF9ED, UNICODE_NORM_QC_NO}, + {0xF9EE, UNICODE_NORM_QC_NO}, + {0xF9EF, UNICODE_NORM_QC_NO}, + {0xF9F0, UNICODE_NORM_QC_NO}, + {0xF9F1, UNICODE_NORM_QC_NO}, + {0xF9F2, UNICODE_NORM_QC_NO}, + {0xF9F3, UNICODE_NORM_QC_NO}, + {0xF9F4, UNICODE_NORM_QC_NO}, + {0xF9F5, UNICODE_NORM_QC_NO}, + {0xF9F6, UNICODE_NORM_QC_NO}, + {0xF9F7, UNICODE_NORM_QC_NO}, + {0xF9F8, UNICODE_NORM_QC_NO}, + {0xF9F9, UNICODE_NORM_QC_NO}, + {0xF9FA, UNICODE_NORM_QC_NO}, + {0xF9FB, UNICODE_NORM_QC_NO}, + {0xF9FC, UNICODE_NORM_QC_NO}, + {0xF9FD, UNICODE_NORM_QC_NO}, + {0xF9FE, UNICODE_NORM_QC_NO}, + {0xF9FF, UNICODE_NORM_QC_NO}, + {0xFA00, UNICODE_NORM_QC_NO}, + {0xFA01, UNICODE_NORM_QC_NO}, + {0xFA02, UNICODE_NORM_QC_NO}, + {0xFA03, UNICODE_NORM_QC_NO}, + {0xFA04, UNICODE_NORM_QC_NO}, + {0xFA05, UNICODE_NORM_QC_NO}, + {0xFA06, UNICODE_NORM_QC_NO}, + {0xFA07, UNICODE_NORM_QC_NO}, + {0xFA08, UNICODE_NORM_QC_NO}, + {0xFA09, UNICODE_NORM_QC_NO}, + {0xFA0A, UNICODE_NORM_QC_NO}, + {0xFA0B, UNICODE_NORM_QC_NO}, + {0xFA0C, UNICODE_NORM_QC_NO}, + {0xFA0D, UNICODE_NORM_QC_NO}, + {0xFA10, UNICODE_NORM_QC_NO}, + {0xFA12, UNICODE_NORM_QC_NO}, + {0xFA15, UNICODE_NORM_QC_NO}, + {0xFA16, UNICODE_NORM_QC_NO}, + {0xFA17, UNICODE_NORM_QC_NO}, + {0xFA18, UNICODE_NORM_QC_NO}, + {0xFA19, UNICODE_NORM_QC_NO}, + {0xFA1A, UNICODE_NORM_QC_NO}, + {0xFA1B, UNICODE_NORM_QC_NO}, + {0xFA1C, UNICODE_NORM_QC_NO}, + {0xFA1D, UNICODE_NORM_QC_NO}, + {0xFA1E, UNICODE_NORM_QC_NO}, + {0xFA20, UNICODE_NORM_QC_NO}, + {0xFA22, UNICODE_NORM_QC_NO}, + {0xFA25, UNICODE_NORM_QC_NO}, + {0xFA26, UNICODE_NORM_QC_NO}, + {0xFA2A, UNICODE_NORM_QC_NO}, + {0xFA2B, UNICODE_NORM_QC_NO}, + {0xFA2C, UNICODE_NORM_QC_NO}, + {0xFA2D, UNICODE_NORM_QC_NO}, + {0xFA2E, UNICODE_NORM_QC_NO}, + {0xFA2F, UNICODE_NORM_QC_NO}, + {0xFA30, UNICODE_NORM_QC_NO}, + {0xFA31, UNICODE_NORM_QC_NO}, + {0xFA32, UNICODE_NORM_QC_NO}, + {0xFA33, UNICODE_NORM_QC_NO}, + {0xFA34, UNICODE_NORM_QC_NO}, + {0xFA35, UNICODE_NORM_QC_NO}, + {0xFA36, UNICODE_NORM_QC_NO}, + {0xFA37, UNICODE_NORM_QC_NO}, + {0xFA38, UNICODE_NORM_QC_NO}, + {0xFA39, UNICODE_NORM_QC_NO}, + {0xFA3A, UNICODE_NORM_QC_NO}, + {0xFA3B, UNICODE_NORM_QC_NO}, + {0xFA3C, UNICODE_NORM_QC_NO}, + {0xFA3D, UNICODE_NORM_QC_NO}, + {0xFA3E, UNICODE_NORM_QC_NO}, + {0xFA3F, UNICODE_NORM_QC_NO}, + {0xFA40, UNICODE_NORM_QC_NO}, + {0xFA41, UNICODE_NORM_QC_NO}, + {0xFA42, UNICODE_NORM_QC_NO}, + {0xFA43, UNICODE_NORM_QC_NO}, + {0xFA44, UNICODE_NORM_QC_NO}, + {0xFA45, UNICODE_NORM_QC_NO}, + {0xFA46, UNICODE_NORM_QC_NO}, + {0xFA47, UNICODE_NORM_QC_NO}, + {0xFA48, UNICODE_NORM_QC_NO}, + {0xFA49, UNICODE_NORM_QC_NO}, + {0xFA4A, UNICODE_NORM_QC_NO}, + {0xFA4B, UNICODE_NORM_QC_NO}, + {0xFA4C, UNICODE_NORM_QC_NO}, + {0xFA4D, UNICODE_NORM_QC_NO}, + {0xFA4E, UNICODE_NORM_QC_NO}, + {0xFA4F, UNICODE_NORM_QC_NO}, + {0xFA50, UNICODE_NORM_QC_NO}, + {0xFA51, UNICODE_NORM_QC_NO}, + {0xFA52, UNICODE_NORM_QC_NO}, + {0xFA53, UNICODE_NORM_QC_NO}, + {0xFA54, UNICODE_NORM_QC_NO}, + {0xFA55, UNICODE_NORM_QC_NO}, + {0xFA56, UNICODE_NORM_QC_NO}, + {0xFA57, UNICODE_NORM_QC_NO}, + {0xFA58, UNICODE_NORM_QC_NO}, + {0xFA59, UNICODE_NORM_QC_NO}, + {0xFA5A, UNICODE_NORM_QC_NO}, + {0xFA5B, UNICODE_NORM_QC_NO}, + {0xFA5C, UNICODE_NORM_QC_NO}, + {0xFA5D, UNICODE_NORM_QC_NO}, + {0xFA5E, UNICODE_NORM_QC_NO}, + {0xFA5F, UNICODE_NORM_QC_NO}, + {0xFA60, UNICODE_NORM_QC_NO}, + {0xFA61, UNICODE_NORM_QC_NO}, + {0xFA62, UNICODE_NORM_QC_NO}, + {0xFA63, UNICODE_NORM_QC_NO}, + {0xFA64, UNICODE_NORM_QC_NO}, + {0xFA65, UNICODE_NORM_QC_NO}, + {0xFA66, UNICODE_NORM_QC_NO}, + {0xFA67, UNICODE_NORM_QC_NO}, + {0xFA68, UNICODE_NORM_QC_NO}, + {0xFA69, UNICODE_NORM_QC_NO}, + {0xFA6A, UNICODE_NORM_QC_NO}, + {0xFA6B, UNICODE_NORM_QC_NO}, + {0xFA6C, UNICODE_NORM_QC_NO}, + {0xFA6D, UNICODE_NORM_QC_NO}, + {0xFA70, UNICODE_NORM_QC_NO}, + {0xFA71, UNICODE_NORM_QC_NO}, + {0xFA72, UNICODE_NORM_QC_NO}, + {0xFA73, UNICODE_NORM_QC_NO}, + {0xFA74, UNICODE_NORM_QC_NO}, + {0xFA75, UNICODE_NORM_QC_NO}, + {0xFA76, UNICODE_NORM_QC_NO}, + {0xFA77, UNICODE_NORM_QC_NO}, + {0xFA78, UNICODE_NORM_QC_NO}, + {0xFA79, UNICODE_NORM_QC_NO}, + {0xFA7A, UNICODE_NORM_QC_NO}, + {0xFA7B, UNICODE_NORM_QC_NO}, + {0xFA7C, UNICODE_NORM_QC_NO}, + {0xFA7D, UNICODE_NORM_QC_NO}, + {0xFA7E, UNICODE_NORM_QC_NO}, + {0xFA7F, UNICODE_NORM_QC_NO}, + {0xFA80, UNICODE_NORM_QC_NO}, + {0xFA81, UNICODE_NORM_QC_NO}, + {0xFA82, UNICODE_NORM_QC_NO}, + {0xFA83, UNICODE_NORM_QC_NO}, + {0xFA84, UNICODE_NORM_QC_NO}, + {0xFA85, UNICODE_NORM_QC_NO}, + {0xFA86, UNICODE_NORM_QC_NO}, + {0xFA87, UNICODE_NORM_QC_NO}, + {0xFA88, UNICODE_NORM_QC_NO}, + {0xFA89, UNICODE_NORM_QC_NO}, + {0xFA8A, UNICODE_NORM_QC_NO}, + {0xFA8B, UNICODE_NORM_QC_NO}, + {0xFA8C, UNICODE_NORM_QC_NO}, + {0xFA8D, UNICODE_NORM_QC_NO}, + {0xFA8E, UNICODE_NORM_QC_NO}, + {0xFA8F, UNICODE_NORM_QC_NO}, + {0xFA90, UNICODE_NORM_QC_NO}, + {0xFA91, UNICODE_NORM_QC_NO}, + {0xFA92, UNICODE_NORM_QC_NO}, + {0xFA93, UNICODE_NORM_QC_NO}, + {0xFA94, UNICODE_NORM_QC_NO}, + {0xFA95, UNICODE_NORM_QC_NO}, + {0xFA96, UNICODE_NORM_QC_NO}, + {0xFA97, UNICODE_NORM_QC_NO}, + {0xFA98, UNICODE_NORM_QC_NO}, + {0xFA99, UNICODE_NORM_QC_NO}, + {0xFA9A, UNICODE_NORM_QC_NO}, + {0xFA9B, UNICODE_NORM_QC_NO}, + {0xFA9C, UNICODE_NORM_QC_NO}, + {0xFA9D, UNICODE_NORM_QC_NO}, + {0xFA9E, UNICODE_NORM_QC_NO}, + {0xFA9F, UNICODE_NORM_QC_NO}, + {0xFAA0, UNICODE_NORM_QC_NO}, + {0xFAA1, UNICODE_NORM_QC_NO}, + {0xFAA2, UNICODE_NORM_QC_NO}, + {0xFAA3, UNICODE_NORM_QC_NO}, + {0xFAA4, UNICODE_NORM_QC_NO}, + {0xFAA5, UNICODE_NORM_QC_NO}, + {0xFAA6, UNICODE_NORM_QC_NO}, + {0xFAA7, UNICODE_NORM_QC_NO}, + {0xFAA8, UNICODE_NORM_QC_NO}, + {0xFAA9, UNICODE_NORM_QC_NO}, + {0xFAAA, UNICODE_NORM_QC_NO}, + {0xFAAB, UNICODE_NORM_QC_NO}, + {0xFAAC, UNICODE_NORM_QC_NO}, + {0xFAAD, UNICODE_NORM_QC_NO}, + {0xFAAE, UNICODE_NORM_QC_NO}, + {0xFAAF, UNICODE_NORM_QC_NO}, + {0xFAB0, UNICODE_NORM_QC_NO}, + {0xFAB1, UNICODE_NORM_QC_NO}, + {0xFAB2, UNICODE_NORM_QC_NO}, + {0xFAB3, UNICODE_NORM_QC_NO}, + {0xFAB4, UNICODE_NORM_QC_NO}, + {0xFAB5, UNICODE_NORM_QC_NO}, + {0xFAB6, UNICODE_NORM_QC_NO}, + {0xFAB7, UNICODE_NORM_QC_NO}, + {0xFAB8, UNICODE_NORM_QC_NO}, + {0xFAB9, UNICODE_NORM_QC_NO}, + {0xFABA, UNICODE_NORM_QC_NO}, + {0xFABB, UNICODE_NORM_QC_NO}, + {0xFABC, UNICODE_NORM_QC_NO}, + {0xFABD, UNICODE_NORM_QC_NO}, + {0xFABE, UNICODE_NORM_QC_NO}, + {0xFABF, UNICODE_NORM_QC_NO}, + {0xFAC0, UNICODE_NORM_QC_NO}, + {0xFAC1, UNICODE_NORM_QC_NO}, + {0xFAC2, UNICODE_NORM_QC_NO}, + {0xFAC3, UNICODE_NORM_QC_NO}, + {0xFAC4, UNICODE_NORM_QC_NO}, + {0xFAC5, UNICODE_NORM_QC_NO}, + {0xFAC6, UNICODE_NORM_QC_NO}, + {0xFAC7, UNICODE_NORM_QC_NO}, + {0xFAC8, UNICODE_NORM_QC_NO}, + {0xFAC9, UNICODE_NORM_QC_NO}, + {0xFACA, UNICODE_NORM_QC_NO}, + {0xFACB, UNICODE_NORM_QC_NO}, + {0xFACC, UNICODE_NORM_QC_NO}, + {0xFACD, UNICODE_NORM_QC_NO}, + {0xFACE, UNICODE_NORM_QC_NO}, + {0xFACF, UNICODE_NORM_QC_NO}, + {0xFAD0, UNICODE_NORM_QC_NO}, + {0xFAD1, UNICODE_NORM_QC_NO}, + {0xFAD2, UNICODE_NORM_QC_NO}, + {0xFAD3, UNICODE_NORM_QC_NO}, + {0xFAD4, UNICODE_NORM_QC_NO}, + {0xFAD5, UNICODE_NORM_QC_NO}, + {0xFAD6, UNICODE_NORM_QC_NO}, + {0xFAD7, UNICODE_NORM_QC_NO}, + {0xFAD8, UNICODE_NORM_QC_NO}, + {0xFAD9, UNICODE_NORM_QC_NO}, + {0xFB00, UNICODE_NORM_QC_NO}, + {0xFB01, UNICODE_NORM_QC_NO}, + {0xFB02, UNICODE_NORM_QC_NO}, + {0xFB03, UNICODE_NORM_QC_NO}, + {0xFB04, UNICODE_NORM_QC_NO}, + {0xFB05, UNICODE_NORM_QC_NO}, + {0xFB06, UNICODE_NORM_QC_NO}, + {0xFB13, UNICODE_NORM_QC_NO}, + {0xFB14, UNICODE_NORM_QC_NO}, + {0xFB15, UNICODE_NORM_QC_NO}, + {0xFB16, UNICODE_NORM_QC_NO}, + {0xFB17, UNICODE_NORM_QC_NO}, + {0xFB1D, UNICODE_NORM_QC_NO}, + {0xFB1F, UNICODE_NORM_QC_NO}, + {0xFB20, UNICODE_NORM_QC_NO}, + {0xFB21, UNICODE_NORM_QC_NO}, + {0xFB22, UNICODE_NORM_QC_NO}, + {0xFB23, UNICODE_NORM_QC_NO}, + {0xFB24, UNICODE_NORM_QC_NO}, + {0xFB25, UNICODE_NORM_QC_NO}, + {0xFB26, UNICODE_NORM_QC_NO}, + {0xFB27, UNICODE_NORM_QC_NO}, + {0xFB28, UNICODE_NORM_QC_NO}, + {0xFB29, UNICODE_NORM_QC_NO}, + {0xFB2A, UNICODE_NORM_QC_NO}, + {0xFB2B, UNICODE_NORM_QC_NO}, + {0xFB2C, UNICODE_NORM_QC_NO}, + {0xFB2D, UNICODE_NORM_QC_NO}, + {0xFB2E, UNICODE_NORM_QC_NO}, + {0xFB2F, UNICODE_NORM_QC_NO}, + {0xFB30, UNICODE_NORM_QC_NO}, + {0xFB31, UNICODE_NORM_QC_NO}, + {0xFB32, UNICODE_NORM_QC_NO}, + {0xFB33, UNICODE_NORM_QC_NO}, + {0xFB34, UNICODE_NORM_QC_NO}, + {0xFB35, UNICODE_NORM_QC_NO}, + {0xFB36, UNICODE_NORM_QC_NO}, + {0xFB38, UNICODE_NORM_QC_NO}, + {0xFB39, UNICODE_NORM_QC_NO}, + {0xFB3A, UNICODE_NORM_QC_NO}, + {0xFB3B, UNICODE_NORM_QC_NO}, + {0xFB3C, UNICODE_NORM_QC_NO}, + {0xFB3E, UNICODE_NORM_QC_NO}, + {0xFB40, UNICODE_NORM_QC_NO}, + {0xFB41, UNICODE_NORM_QC_NO}, + {0xFB43, UNICODE_NORM_QC_NO}, + {0xFB44, UNICODE_NORM_QC_NO}, + {0xFB46, UNICODE_NORM_QC_NO}, + {0xFB47, UNICODE_NORM_QC_NO}, + {0xFB48, UNICODE_NORM_QC_NO}, + {0xFB49, UNICODE_NORM_QC_NO}, + {0xFB4A, UNICODE_NORM_QC_NO}, + {0xFB4B, UNICODE_NORM_QC_NO}, + {0xFB4C, UNICODE_NORM_QC_NO}, + {0xFB4D, UNICODE_NORM_QC_NO}, + {0xFB4E, UNICODE_NORM_QC_NO}, + {0xFB4F, UNICODE_NORM_QC_NO}, + {0xFB50, UNICODE_NORM_QC_NO}, + {0xFB51, UNICODE_NORM_QC_NO}, + {0xFB52, UNICODE_NORM_QC_NO}, + {0xFB53, UNICODE_NORM_QC_NO}, + {0xFB54, UNICODE_NORM_QC_NO}, + {0xFB55, UNICODE_NORM_QC_NO}, + {0xFB56, UNICODE_NORM_QC_NO}, + {0xFB57, UNICODE_NORM_QC_NO}, + {0xFB58, UNICODE_NORM_QC_NO}, + {0xFB59, UNICODE_NORM_QC_NO}, + {0xFB5A, UNICODE_NORM_QC_NO}, + {0xFB5B, UNICODE_NORM_QC_NO}, + {0xFB5C, UNICODE_NORM_QC_NO}, + {0xFB5D, UNICODE_NORM_QC_NO}, + {0xFB5E, UNICODE_NORM_QC_NO}, + {0xFB5F, UNICODE_NORM_QC_NO}, + {0xFB60, UNICODE_NORM_QC_NO}, + {0xFB61, UNICODE_NORM_QC_NO}, + {0xFB62, UNICODE_NORM_QC_NO}, + {0xFB63, UNICODE_NORM_QC_NO}, + {0xFB64, UNICODE_NORM_QC_NO}, + {0xFB65, UNICODE_NORM_QC_NO}, + {0xFB66, UNICODE_NORM_QC_NO}, + {0xFB67, UNICODE_NORM_QC_NO}, + {0xFB68, UNICODE_NORM_QC_NO}, + {0xFB69, UNICODE_NORM_QC_NO}, + {0xFB6A, UNICODE_NORM_QC_NO}, + {0xFB6B, UNICODE_NORM_QC_NO}, + {0xFB6C, UNICODE_NORM_QC_NO}, + {0xFB6D, UNICODE_NORM_QC_NO}, + {0xFB6E, UNICODE_NORM_QC_NO}, + {0xFB6F, UNICODE_NORM_QC_NO}, + {0xFB70, UNICODE_NORM_QC_NO}, + {0xFB71, UNICODE_NORM_QC_NO}, + {0xFB72, UNICODE_NORM_QC_NO}, + {0xFB73, UNICODE_NORM_QC_NO}, + {0xFB74, UNICODE_NORM_QC_NO}, + {0xFB75, UNICODE_NORM_QC_NO}, + {0xFB76, UNICODE_NORM_QC_NO}, + {0xFB77, UNICODE_NORM_QC_NO}, + {0xFB78, UNICODE_NORM_QC_NO}, + {0xFB79, UNICODE_NORM_QC_NO}, + {0xFB7A, UNICODE_NORM_QC_NO}, + {0xFB7B, UNICODE_NORM_QC_NO}, + {0xFB7C, UNICODE_NORM_QC_NO}, + {0xFB7D, UNICODE_NORM_QC_NO}, + {0xFB7E, UNICODE_NORM_QC_NO}, + {0xFB7F, UNICODE_NORM_QC_NO}, + {0xFB80, UNICODE_NORM_QC_NO}, + {0xFB81, UNICODE_NORM_QC_NO}, + {0xFB82, UNICODE_NORM_QC_NO}, + {0xFB83, UNICODE_NORM_QC_NO}, + {0xFB84, UNICODE_NORM_QC_NO}, + {0xFB85, UNICODE_NORM_QC_NO}, + {0xFB86, UNICODE_NORM_QC_NO}, + {0xFB87, UNICODE_NORM_QC_NO}, + {0xFB88, UNICODE_NORM_QC_NO}, + {0xFB89, UNICODE_NORM_QC_NO}, + {0xFB8A, UNICODE_NORM_QC_NO}, + {0xFB8B, UNICODE_NORM_QC_NO}, + {0xFB8C, UNICODE_NORM_QC_NO}, + {0xFB8D, UNICODE_NORM_QC_NO}, + {0xFB8E, UNICODE_NORM_QC_NO}, + {0xFB8F, UNICODE_NORM_QC_NO}, + {0xFB90, UNICODE_NORM_QC_NO}, + {0xFB91, UNICODE_NORM_QC_NO}, + {0xFB92, UNICODE_NORM_QC_NO}, + {0xFB93, UNICODE_NORM_QC_NO}, + {0xFB94, UNICODE_NORM_QC_NO}, + {0xFB95, UNICODE_NORM_QC_NO}, + {0xFB96, UNICODE_NORM_QC_NO}, + {0xFB97, UNICODE_NORM_QC_NO}, + {0xFB98, UNICODE_NORM_QC_NO}, + {0xFB99, UNICODE_NORM_QC_NO}, + {0xFB9A, UNICODE_NORM_QC_NO}, + {0xFB9B, UNICODE_NORM_QC_NO}, + {0xFB9C, UNICODE_NORM_QC_NO}, + {0xFB9D, UNICODE_NORM_QC_NO}, + {0xFB9E, UNICODE_NORM_QC_NO}, + {0xFB9F, UNICODE_NORM_QC_NO}, + {0xFBA0, UNICODE_NORM_QC_NO}, + {0xFBA1, UNICODE_NORM_QC_NO}, + {0xFBA2, UNICODE_NORM_QC_NO}, + {0xFBA3, UNICODE_NORM_QC_NO}, + {0xFBA4, UNICODE_NORM_QC_NO}, + {0xFBA5, UNICODE_NORM_QC_NO}, + {0xFBA6, UNICODE_NORM_QC_NO}, + {0xFBA7, UNICODE_NORM_QC_NO}, + {0xFBA8, UNICODE_NORM_QC_NO}, + {0xFBA9, UNICODE_NORM_QC_NO}, + {0xFBAA, UNICODE_NORM_QC_NO}, + {0xFBAB, UNICODE_NORM_QC_NO}, + {0xFBAC, UNICODE_NORM_QC_NO}, + {0xFBAD, UNICODE_NORM_QC_NO}, + {0xFBAE, UNICODE_NORM_QC_NO}, + {0xFBAF, UNICODE_NORM_QC_NO}, + {0xFBB0, UNICODE_NORM_QC_NO}, + {0xFBB1, UNICODE_NORM_QC_NO}, + {0xFBD3, UNICODE_NORM_QC_NO}, + {0xFBD4, UNICODE_NORM_QC_NO}, + {0xFBD5, UNICODE_NORM_QC_NO}, + {0xFBD6, UNICODE_NORM_QC_NO}, + {0xFBD7, UNICODE_NORM_QC_NO}, + {0xFBD8, UNICODE_NORM_QC_NO}, + {0xFBD9, UNICODE_NORM_QC_NO}, + {0xFBDA, UNICODE_NORM_QC_NO}, + {0xFBDB, UNICODE_NORM_QC_NO}, + {0xFBDC, UNICODE_NORM_QC_NO}, + {0xFBDD, UNICODE_NORM_QC_NO}, + {0xFBDE, UNICODE_NORM_QC_NO}, + {0xFBDF, UNICODE_NORM_QC_NO}, + {0xFBE0, UNICODE_NORM_QC_NO}, + {0xFBE1, UNICODE_NORM_QC_NO}, + {0xFBE2, UNICODE_NORM_QC_NO}, + {0xFBE3, UNICODE_NORM_QC_NO}, + {0xFBE4, UNICODE_NORM_QC_NO}, + {0xFBE5, UNICODE_NORM_QC_NO}, + {0xFBE6, UNICODE_NORM_QC_NO}, + {0xFBE7, UNICODE_NORM_QC_NO}, + {0xFBE8, UNICODE_NORM_QC_NO}, + {0xFBE9, UNICODE_NORM_QC_NO}, + {0xFBEA, UNICODE_NORM_QC_NO}, + {0xFBEB, UNICODE_NORM_QC_NO}, + {0xFBEC, UNICODE_NORM_QC_NO}, + {0xFBED, UNICODE_NORM_QC_NO}, + {0xFBEE, UNICODE_NORM_QC_NO}, + {0xFBEF, UNICODE_NORM_QC_NO}, + {0xFBF0, UNICODE_NORM_QC_NO}, + {0xFBF1, UNICODE_NORM_QC_NO}, + {0xFBF2, UNICODE_NORM_QC_NO}, + {0xFBF3, UNICODE_NORM_QC_NO}, + {0xFBF4, UNICODE_NORM_QC_NO}, + {0xFBF5, UNICODE_NORM_QC_NO}, + {0xFBF6, UNICODE_NORM_QC_NO}, + {0xFBF7, UNICODE_NORM_QC_NO}, + {0xFBF8, UNICODE_NORM_QC_NO}, + {0xFBF9, UNICODE_NORM_QC_NO}, + {0xFBFA, UNICODE_NORM_QC_NO}, + {0xFBFB, UNICODE_NORM_QC_NO}, + {0xFBFC, UNICODE_NORM_QC_NO}, + {0xFBFD, UNICODE_NORM_QC_NO}, + {0xFBFE, UNICODE_NORM_QC_NO}, + {0xFBFF, UNICODE_NORM_QC_NO}, + {0xFC00, UNICODE_NORM_QC_NO}, + {0xFC01, UNICODE_NORM_QC_NO}, + {0xFC02, UNICODE_NORM_QC_NO}, + {0xFC03, UNICODE_NORM_QC_NO}, + {0xFC04, UNICODE_NORM_QC_NO}, + {0xFC05, UNICODE_NORM_QC_NO}, + {0xFC06, UNICODE_NORM_QC_NO}, + {0xFC07, UNICODE_NORM_QC_NO}, + {0xFC08, UNICODE_NORM_QC_NO}, + {0xFC09, UNICODE_NORM_QC_NO}, + {0xFC0A, UNICODE_NORM_QC_NO}, + {0xFC0B, UNICODE_NORM_QC_NO}, + {0xFC0C, UNICODE_NORM_QC_NO}, + {0xFC0D, UNICODE_NORM_QC_NO}, + {0xFC0E, UNICODE_NORM_QC_NO}, + {0xFC0F, UNICODE_NORM_QC_NO}, + {0xFC10, UNICODE_NORM_QC_NO}, + {0xFC11, UNICODE_NORM_QC_NO}, + {0xFC12, UNICODE_NORM_QC_NO}, + {0xFC13, UNICODE_NORM_QC_NO}, + {0xFC14, UNICODE_NORM_QC_NO}, + {0xFC15, UNICODE_NORM_QC_NO}, + {0xFC16, UNICODE_NORM_QC_NO}, + {0xFC17, UNICODE_NORM_QC_NO}, + {0xFC18, UNICODE_NORM_QC_NO}, + {0xFC19, UNICODE_NORM_QC_NO}, + {0xFC1A, UNICODE_NORM_QC_NO}, + {0xFC1B, UNICODE_NORM_QC_NO}, + {0xFC1C, UNICODE_NORM_QC_NO}, + {0xFC1D, UNICODE_NORM_QC_NO}, + {0xFC1E, UNICODE_NORM_QC_NO}, + {0xFC1F, UNICODE_NORM_QC_NO}, + {0xFC20, UNICODE_NORM_QC_NO}, + {0xFC21, UNICODE_NORM_QC_NO}, + {0xFC22, UNICODE_NORM_QC_NO}, + {0xFC23, UNICODE_NORM_QC_NO}, + {0xFC24, UNICODE_NORM_QC_NO}, + {0xFC25, UNICODE_NORM_QC_NO}, + {0xFC26, UNICODE_NORM_QC_NO}, + {0xFC27, UNICODE_NORM_QC_NO}, + {0xFC28, UNICODE_NORM_QC_NO}, + {0xFC29, UNICODE_NORM_QC_NO}, + {0xFC2A, UNICODE_NORM_QC_NO}, + {0xFC2B, UNICODE_NORM_QC_NO}, + {0xFC2C, UNICODE_NORM_QC_NO}, + {0xFC2D, UNICODE_NORM_QC_NO}, + {0xFC2E, UNICODE_NORM_QC_NO}, + {0xFC2F, UNICODE_NORM_QC_NO}, + {0xFC30, UNICODE_NORM_QC_NO}, + {0xFC31, UNICODE_NORM_QC_NO}, + {0xFC32, UNICODE_NORM_QC_NO}, + {0xFC33, UNICODE_NORM_QC_NO}, + {0xFC34, UNICODE_NORM_QC_NO}, + {0xFC35, UNICODE_NORM_QC_NO}, + {0xFC36, UNICODE_NORM_QC_NO}, + {0xFC37, UNICODE_NORM_QC_NO}, + {0xFC38, UNICODE_NORM_QC_NO}, + {0xFC39, UNICODE_NORM_QC_NO}, + {0xFC3A, UNICODE_NORM_QC_NO}, + {0xFC3B, UNICODE_NORM_QC_NO}, + {0xFC3C, UNICODE_NORM_QC_NO}, + {0xFC3D, UNICODE_NORM_QC_NO}, + {0xFC3E, UNICODE_NORM_QC_NO}, + {0xFC3F, UNICODE_NORM_QC_NO}, + {0xFC40, UNICODE_NORM_QC_NO}, + {0xFC41, UNICODE_NORM_QC_NO}, + {0xFC42, UNICODE_NORM_QC_NO}, + {0xFC43, UNICODE_NORM_QC_NO}, + {0xFC44, UNICODE_NORM_QC_NO}, + {0xFC45, UNICODE_NORM_QC_NO}, + {0xFC46, UNICODE_NORM_QC_NO}, + {0xFC47, UNICODE_NORM_QC_NO}, + {0xFC48, UNICODE_NORM_QC_NO}, + {0xFC49, UNICODE_NORM_QC_NO}, + {0xFC4A, UNICODE_NORM_QC_NO}, + {0xFC4B, UNICODE_NORM_QC_NO}, + {0xFC4C, UNICODE_NORM_QC_NO}, + {0xFC4D, UNICODE_NORM_QC_NO}, + {0xFC4E, UNICODE_NORM_QC_NO}, + {0xFC4F, UNICODE_NORM_QC_NO}, + {0xFC50, UNICODE_NORM_QC_NO}, + {0xFC51, UNICODE_NORM_QC_NO}, + {0xFC52, UNICODE_NORM_QC_NO}, + {0xFC53, UNICODE_NORM_QC_NO}, + {0xFC54, UNICODE_NORM_QC_NO}, + {0xFC55, UNICODE_NORM_QC_NO}, + {0xFC56, UNICODE_NORM_QC_NO}, + {0xFC57, UNICODE_NORM_QC_NO}, + {0xFC58, UNICODE_NORM_QC_NO}, + {0xFC59, UNICODE_NORM_QC_NO}, + {0xFC5A, UNICODE_NORM_QC_NO}, + {0xFC5B, UNICODE_NORM_QC_NO}, + {0xFC5C, UNICODE_NORM_QC_NO}, + {0xFC5D, UNICODE_NORM_QC_NO}, + {0xFC5E, UNICODE_NORM_QC_NO}, + {0xFC5F, UNICODE_NORM_QC_NO}, + {0xFC60, UNICODE_NORM_QC_NO}, + {0xFC61, UNICODE_NORM_QC_NO}, + {0xFC62, UNICODE_NORM_QC_NO}, + {0xFC63, UNICODE_NORM_QC_NO}, + {0xFC64, UNICODE_NORM_QC_NO}, + {0xFC65, UNICODE_NORM_QC_NO}, + {0xFC66, UNICODE_NORM_QC_NO}, + {0xFC67, UNICODE_NORM_QC_NO}, + {0xFC68, UNICODE_NORM_QC_NO}, + {0xFC69, UNICODE_NORM_QC_NO}, + {0xFC6A, UNICODE_NORM_QC_NO}, + {0xFC6B, UNICODE_NORM_QC_NO}, + {0xFC6C, UNICODE_NORM_QC_NO}, + {0xFC6D, UNICODE_NORM_QC_NO}, + {0xFC6E, UNICODE_NORM_QC_NO}, + {0xFC6F, UNICODE_NORM_QC_NO}, + {0xFC70, UNICODE_NORM_QC_NO}, + {0xFC71, UNICODE_NORM_QC_NO}, + {0xFC72, UNICODE_NORM_QC_NO}, + {0xFC73, UNICODE_NORM_QC_NO}, + {0xFC74, UNICODE_NORM_QC_NO}, + {0xFC75, UNICODE_NORM_QC_NO}, + {0xFC76, UNICODE_NORM_QC_NO}, + {0xFC77, UNICODE_NORM_QC_NO}, + {0xFC78, UNICODE_NORM_QC_NO}, + {0xFC79, UNICODE_NORM_QC_NO}, + {0xFC7A, UNICODE_NORM_QC_NO}, + {0xFC7B, UNICODE_NORM_QC_NO}, + {0xFC7C, UNICODE_NORM_QC_NO}, + {0xFC7D, UNICODE_NORM_QC_NO}, + {0xFC7E, UNICODE_NORM_QC_NO}, + {0xFC7F, UNICODE_NORM_QC_NO}, + {0xFC80, UNICODE_NORM_QC_NO}, + {0xFC81, UNICODE_NORM_QC_NO}, + {0xFC82, UNICODE_NORM_QC_NO}, + {0xFC83, UNICODE_NORM_QC_NO}, + {0xFC84, UNICODE_NORM_QC_NO}, + {0xFC85, UNICODE_NORM_QC_NO}, + {0xFC86, UNICODE_NORM_QC_NO}, + {0xFC87, UNICODE_NORM_QC_NO}, + {0xFC88, UNICODE_NORM_QC_NO}, + {0xFC89, UNICODE_NORM_QC_NO}, + {0xFC8A, UNICODE_NORM_QC_NO}, + {0xFC8B, UNICODE_NORM_QC_NO}, + {0xFC8C, UNICODE_NORM_QC_NO}, + {0xFC8D, UNICODE_NORM_QC_NO}, + {0xFC8E, UNICODE_NORM_QC_NO}, + {0xFC8F, UNICODE_NORM_QC_NO}, + {0xFC90, UNICODE_NORM_QC_NO}, + {0xFC91, UNICODE_NORM_QC_NO}, + {0xFC92, UNICODE_NORM_QC_NO}, + {0xFC93, UNICODE_NORM_QC_NO}, + {0xFC94, UNICODE_NORM_QC_NO}, + {0xFC95, UNICODE_NORM_QC_NO}, + {0xFC96, UNICODE_NORM_QC_NO}, + {0xFC97, UNICODE_NORM_QC_NO}, + {0xFC98, UNICODE_NORM_QC_NO}, + {0xFC99, UNICODE_NORM_QC_NO}, + {0xFC9A, UNICODE_NORM_QC_NO}, + {0xFC9B, UNICODE_NORM_QC_NO}, + {0xFC9C, UNICODE_NORM_QC_NO}, + {0xFC9D, UNICODE_NORM_QC_NO}, + {0xFC9E, UNICODE_NORM_QC_NO}, + {0xFC9F, UNICODE_NORM_QC_NO}, + {0xFCA0, UNICODE_NORM_QC_NO}, + {0xFCA1, UNICODE_NORM_QC_NO}, + {0xFCA2, UNICODE_NORM_QC_NO}, + {0xFCA3, UNICODE_NORM_QC_NO}, + {0xFCA4, UNICODE_NORM_QC_NO}, + {0xFCA5, UNICODE_NORM_QC_NO}, + {0xFCA6, UNICODE_NORM_QC_NO}, + {0xFCA7, UNICODE_NORM_QC_NO}, + {0xFCA8, UNICODE_NORM_QC_NO}, + {0xFCA9, UNICODE_NORM_QC_NO}, + {0xFCAA, UNICODE_NORM_QC_NO}, + {0xFCAB, UNICODE_NORM_QC_NO}, + {0xFCAC, UNICODE_NORM_QC_NO}, + {0xFCAD, UNICODE_NORM_QC_NO}, + {0xFCAE, UNICODE_NORM_QC_NO}, + {0xFCAF, UNICODE_NORM_QC_NO}, + {0xFCB0, UNICODE_NORM_QC_NO}, + {0xFCB1, UNICODE_NORM_QC_NO}, + {0xFCB2, UNICODE_NORM_QC_NO}, + {0xFCB3, UNICODE_NORM_QC_NO}, + {0xFCB4, UNICODE_NORM_QC_NO}, + {0xFCB5, UNICODE_NORM_QC_NO}, + {0xFCB6, UNICODE_NORM_QC_NO}, + {0xFCB7, UNICODE_NORM_QC_NO}, + {0xFCB8, UNICODE_NORM_QC_NO}, + {0xFCB9, UNICODE_NORM_QC_NO}, + {0xFCBA, UNICODE_NORM_QC_NO}, + {0xFCBB, UNICODE_NORM_QC_NO}, + {0xFCBC, UNICODE_NORM_QC_NO}, + {0xFCBD, UNICODE_NORM_QC_NO}, + {0xFCBE, UNICODE_NORM_QC_NO}, + {0xFCBF, UNICODE_NORM_QC_NO}, + {0xFCC0, UNICODE_NORM_QC_NO}, + {0xFCC1, UNICODE_NORM_QC_NO}, + {0xFCC2, UNICODE_NORM_QC_NO}, + {0xFCC3, UNICODE_NORM_QC_NO}, + {0xFCC4, UNICODE_NORM_QC_NO}, + {0xFCC5, UNICODE_NORM_QC_NO}, + {0xFCC6, UNICODE_NORM_QC_NO}, + {0xFCC7, UNICODE_NORM_QC_NO}, + {0xFCC8, UNICODE_NORM_QC_NO}, + {0xFCC9, UNICODE_NORM_QC_NO}, + {0xFCCA, UNICODE_NORM_QC_NO}, + {0xFCCB, UNICODE_NORM_QC_NO}, + {0xFCCC, UNICODE_NORM_QC_NO}, + {0xFCCD, UNICODE_NORM_QC_NO}, + {0xFCCE, UNICODE_NORM_QC_NO}, + {0xFCCF, UNICODE_NORM_QC_NO}, + {0xFCD0, UNICODE_NORM_QC_NO}, + {0xFCD1, UNICODE_NORM_QC_NO}, + {0xFCD2, UNICODE_NORM_QC_NO}, + {0xFCD3, UNICODE_NORM_QC_NO}, + {0xFCD4, UNICODE_NORM_QC_NO}, + {0xFCD5, UNICODE_NORM_QC_NO}, + {0xFCD6, UNICODE_NORM_QC_NO}, + {0xFCD7, UNICODE_NORM_QC_NO}, + {0xFCD8, UNICODE_NORM_QC_NO}, + {0xFCD9, UNICODE_NORM_QC_NO}, + {0xFCDA, UNICODE_NORM_QC_NO}, + {0xFCDB, UNICODE_NORM_QC_NO}, + {0xFCDC, UNICODE_NORM_QC_NO}, + {0xFCDD, UNICODE_NORM_QC_NO}, + {0xFCDE, UNICODE_NORM_QC_NO}, + {0xFCDF, UNICODE_NORM_QC_NO}, + {0xFCE0, UNICODE_NORM_QC_NO}, + {0xFCE1, UNICODE_NORM_QC_NO}, + {0xFCE2, UNICODE_NORM_QC_NO}, + {0xFCE3, UNICODE_NORM_QC_NO}, + {0xFCE4, UNICODE_NORM_QC_NO}, + {0xFCE5, UNICODE_NORM_QC_NO}, + {0xFCE6, UNICODE_NORM_QC_NO}, + {0xFCE7, UNICODE_NORM_QC_NO}, + {0xFCE8, UNICODE_NORM_QC_NO}, + {0xFCE9, UNICODE_NORM_QC_NO}, + {0xFCEA, UNICODE_NORM_QC_NO}, + {0xFCEB, UNICODE_NORM_QC_NO}, + {0xFCEC, UNICODE_NORM_QC_NO}, + {0xFCED, UNICODE_NORM_QC_NO}, + {0xFCEE, UNICODE_NORM_QC_NO}, + {0xFCEF, UNICODE_NORM_QC_NO}, + {0xFCF0, UNICODE_NORM_QC_NO}, + {0xFCF1, UNICODE_NORM_QC_NO}, + {0xFCF2, UNICODE_NORM_QC_NO}, + {0xFCF3, UNICODE_NORM_QC_NO}, + {0xFCF4, UNICODE_NORM_QC_NO}, + {0xFCF5, UNICODE_NORM_QC_NO}, + {0xFCF6, UNICODE_NORM_QC_NO}, + {0xFCF7, UNICODE_NORM_QC_NO}, + {0xFCF8, UNICODE_NORM_QC_NO}, + {0xFCF9, UNICODE_NORM_QC_NO}, + {0xFCFA, UNICODE_NORM_QC_NO}, + {0xFCFB, UNICODE_NORM_QC_NO}, + {0xFCFC, UNICODE_NORM_QC_NO}, + {0xFCFD, UNICODE_NORM_QC_NO}, + {0xFCFE, UNICODE_NORM_QC_NO}, + {0xFCFF, UNICODE_NORM_QC_NO}, + {0xFD00, UNICODE_NORM_QC_NO}, + {0xFD01, UNICODE_NORM_QC_NO}, + {0xFD02, UNICODE_NORM_QC_NO}, + {0xFD03, UNICODE_NORM_QC_NO}, + {0xFD04, UNICODE_NORM_QC_NO}, + {0xFD05, UNICODE_NORM_QC_NO}, + {0xFD06, UNICODE_NORM_QC_NO}, + {0xFD07, UNICODE_NORM_QC_NO}, + {0xFD08, UNICODE_NORM_QC_NO}, + {0xFD09, UNICODE_NORM_QC_NO}, + {0xFD0A, UNICODE_NORM_QC_NO}, + {0xFD0B, UNICODE_NORM_QC_NO}, + {0xFD0C, UNICODE_NORM_QC_NO}, + {0xFD0D, UNICODE_NORM_QC_NO}, + {0xFD0E, UNICODE_NORM_QC_NO}, + {0xFD0F, UNICODE_NORM_QC_NO}, + {0xFD10, UNICODE_NORM_QC_NO}, + {0xFD11, UNICODE_NORM_QC_NO}, + {0xFD12, UNICODE_NORM_QC_NO}, + {0xFD13, UNICODE_NORM_QC_NO}, + {0xFD14, UNICODE_NORM_QC_NO}, + {0xFD15, UNICODE_NORM_QC_NO}, + {0xFD16, UNICODE_NORM_QC_NO}, + {0xFD17, UNICODE_NORM_QC_NO}, + {0xFD18, UNICODE_NORM_QC_NO}, + {0xFD19, UNICODE_NORM_QC_NO}, + {0xFD1A, UNICODE_NORM_QC_NO}, + {0xFD1B, UNICODE_NORM_QC_NO}, + {0xFD1C, UNICODE_NORM_QC_NO}, + {0xFD1D, UNICODE_NORM_QC_NO}, + {0xFD1E, UNICODE_NORM_QC_NO}, + {0xFD1F, UNICODE_NORM_QC_NO}, + {0xFD20, UNICODE_NORM_QC_NO}, + {0xFD21, UNICODE_NORM_QC_NO}, + {0xFD22, UNICODE_NORM_QC_NO}, + {0xFD23, UNICODE_NORM_QC_NO}, + {0xFD24, UNICODE_NORM_QC_NO}, + {0xFD25, UNICODE_NORM_QC_NO}, + {0xFD26, UNICODE_NORM_QC_NO}, + {0xFD27, UNICODE_NORM_QC_NO}, + {0xFD28, UNICODE_NORM_QC_NO}, + {0xFD29, UNICODE_NORM_QC_NO}, + {0xFD2A, UNICODE_NORM_QC_NO}, + {0xFD2B, UNICODE_NORM_QC_NO}, + {0xFD2C, UNICODE_NORM_QC_NO}, + {0xFD2D, UNICODE_NORM_QC_NO}, + {0xFD2E, UNICODE_NORM_QC_NO}, + {0xFD2F, UNICODE_NORM_QC_NO}, + {0xFD30, UNICODE_NORM_QC_NO}, + {0xFD31, UNICODE_NORM_QC_NO}, + {0xFD32, UNICODE_NORM_QC_NO}, + {0xFD33, UNICODE_NORM_QC_NO}, + {0xFD34, UNICODE_NORM_QC_NO}, + {0xFD35, UNICODE_NORM_QC_NO}, + {0xFD36, UNICODE_NORM_QC_NO}, + {0xFD37, UNICODE_NORM_QC_NO}, + {0xFD38, UNICODE_NORM_QC_NO}, + {0xFD39, UNICODE_NORM_QC_NO}, + {0xFD3A, UNICODE_NORM_QC_NO}, + {0xFD3B, UNICODE_NORM_QC_NO}, + {0xFD3C, UNICODE_NORM_QC_NO}, + {0xFD3D, UNICODE_NORM_QC_NO}, + {0xFD50, UNICODE_NORM_QC_NO}, + {0xFD51, UNICODE_NORM_QC_NO}, + {0xFD52, UNICODE_NORM_QC_NO}, + {0xFD53, UNICODE_NORM_QC_NO}, + {0xFD54, UNICODE_NORM_QC_NO}, + {0xFD55, UNICODE_NORM_QC_NO}, + {0xFD56, UNICODE_NORM_QC_NO}, + {0xFD57, UNICODE_NORM_QC_NO}, + {0xFD58, UNICODE_NORM_QC_NO}, + {0xFD59, UNICODE_NORM_QC_NO}, + {0xFD5A, UNICODE_NORM_QC_NO}, + {0xFD5B, UNICODE_NORM_QC_NO}, + {0xFD5C, UNICODE_NORM_QC_NO}, + {0xFD5D, UNICODE_NORM_QC_NO}, + {0xFD5E, UNICODE_NORM_QC_NO}, + {0xFD5F, UNICODE_NORM_QC_NO}, + {0xFD60, UNICODE_NORM_QC_NO}, + {0xFD61, UNICODE_NORM_QC_NO}, + {0xFD62, UNICODE_NORM_QC_NO}, + {0xFD63, UNICODE_NORM_QC_NO}, + {0xFD64, UNICODE_NORM_QC_NO}, + {0xFD65, UNICODE_NORM_QC_NO}, + {0xFD66, UNICODE_NORM_QC_NO}, + {0xFD67, UNICODE_NORM_QC_NO}, + {0xFD68, UNICODE_NORM_QC_NO}, + {0xFD69, UNICODE_NORM_QC_NO}, + {0xFD6A, UNICODE_NORM_QC_NO}, + {0xFD6B, UNICODE_NORM_QC_NO}, + {0xFD6C, UNICODE_NORM_QC_NO}, + {0xFD6D, UNICODE_NORM_QC_NO}, + {0xFD6E, UNICODE_NORM_QC_NO}, + {0xFD6F, UNICODE_NORM_QC_NO}, + {0xFD70, UNICODE_NORM_QC_NO}, + {0xFD71, UNICODE_NORM_QC_NO}, + {0xFD72, UNICODE_NORM_QC_NO}, + {0xFD73, UNICODE_NORM_QC_NO}, + {0xFD74, UNICODE_NORM_QC_NO}, + {0xFD75, UNICODE_NORM_QC_NO}, + {0xFD76, UNICODE_NORM_QC_NO}, + {0xFD77, UNICODE_NORM_QC_NO}, + {0xFD78, UNICODE_NORM_QC_NO}, + {0xFD79, UNICODE_NORM_QC_NO}, + {0xFD7A, UNICODE_NORM_QC_NO}, + {0xFD7B, UNICODE_NORM_QC_NO}, + {0xFD7C, UNICODE_NORM_QC_NO}, + {0xFD7D, UNICODE_NORM_QC_NO}, + {0xFD7E, UNICODE_NORM_QC_NO}, + {0xFD7F, UNICODE_NORM_QC_NO}, + {0xFD80, UNICODE_NORM_QC_NO}, + {0xFD81, UNICODE_NORM_QC_NO}, + {0xFD82, UNICODE_NORM_QC_NO}, + {0xFD83, UNICODE_NORM_QC_NO}, + {0xFD84, UNICODE_NORM_QC_NO}, + {0xFD85, UNICODE_NORM_QC_NO}, + {0xFD86, UNICODE_NORM_QC_NO}, + {0xFD87, UNICODE_NORM_QC_NO}, + {0xFD88, UNICODE_NORM_QC_NO}, + {0xFD89, UNICODE_NORM_QC_NO}, + {0xFD8A, UNICODE_NORM_QC_NO}, + {0xFD8B, UNICODE_NORM_QC_NO}, + {0xFD8C, UNICODE_NORM_QC_NO}, + {0xFD8D, UNICODE_NORM_QC_NO}, + {0xFD8E, UNICODE_NORM_QC_NO}, + {0xFD8F, UNICODE_NORM_QC_NO}, + {0xFD92, UNICODE_NORM_QC_NO}, + {0xFD93, UNICODE_NORM_QC_NO}, + {0xFD94, UNICODE_NORM_QC_NO}, + {0xFD95, UNICODE_NORM_QC_NO}, + {0xFD96, UNICODE_NORM_QC_NO}, + {0xFD97, UNICODE_NORM_QC_NO}, + {0xFD98, UNICODE_NORM_QC_NO}, + {0xFD99, UNICODE_NORM_QC_NO}, + {0xFD9A, UNICODE_NORM_QC_NO}, + {0xFD9B, UNICODE_NORM_QC_NO}, + {0xFD9C, UNICODE_NORM_QC_NO}, + {0xFD9D, UNICODE_NORM_QC_NO}, + {0xFD9E, UNICODE_NORM_QC_NO}, + {0xFD9F, UNICODE_NORM_QC_NO}, + {0xFDA0, UNICODE_NORM_QC_NO}, + {0xFDA1, UNICODE_NORM_QC_NO}, + {0xFDA2, UNICODE_NORM_QC_NO}, + {0xFDA3, UNICODE_NORM_QC_NO}, + {0xFDA4, UNICODE_NORM_QC_NO}, + {0xFDA5, UNICODE_NORM_QC_NO}, + {0xFDA6, UNICODE_NORM_QC_NO}, + {0xFDA7, UNICODE_NORM_QC_NO}, + {0xFDA8, UNICODE_NORM_QC_NO}, + {0xFDA9, UNICODE_NORM_QC_NO}, + {0xFDAA, UNICODE_NORM_QC_NO}, + {0xFDAB, UNICODE_NORM_QC_NO}, + {0xFDAC, UNICODE_NORM_QC_NO}, + {0xFDAD, UNICODE_NORM_QC_NO}, + {0xFDAE, UNICODE_NORM_QC_NO}, + {0xFDAF, UNICODE_NORM_QC_NO}, + {0xFDB0, UNICODE_NORM_QC_NO}, + {0xFDB1, UNICODE_NORM_QC_NO}, + {0xFDB2, UNICODE_NORM_QC_NO}, + {0xFDB3, UNICODE_NORM_QC_NO}, + {0xFDB4, UNICODE_NORM_QC_NO}, + {0xFDB5, UNICODE_NORM_QC_NO}, + {0xFDB6, UNICODE_NORM_QC_NO}, + {0xFDB7, UNICODE_NORM_QC_NO}, + {0xFDB8, UNICODE_NORM_QC_NO}, + {0xFDB9, UNICODE_NORM_QC_NO}, + {0xFDBA, UNICODE_NORM_QC_NO}, + {0xFDBB, UNICODE_NORM_QC_NO}, + {0xFDBC, UNICODE_NORM_QC_NO}, + {0xFDBD, UNICODE_NORM_QC_NO}, + {0xFDBE, UNICODE_NORM_QC_NO}, + {0xFDBF, UNICODE_NORM_QC_NO}, + {0xFDC0, UNICODE_NORM_QC_NO}, + {0xFDC1, UNICODE_NORM_QC_NO}, + {0xFDC2, UNICODE_NORM_QC_NO}, + {0xFDC3, UNICODE_NORM_QC_NO}, + {0xFDC4, UNICODE_NORM_QC_NO}, + {0xFDC5, UNICODE_NORM_QC_NO}, + {0xFDC6, UNICODE_NORM_QC_NO}, + {0xFDC7, UNICODE_NORM_QC_NO}, + {0xFDF0, UNICODE_NORM_QC_NO}, + {0xFDF1, UNICODE_NORM_QC_NO}, + {0xFDF2, UNICODE_NORM_QC_NO}, + {0xFDF3, UNICODE_NORM_QC_NO}, + {0xFDF4, UNICODE_NORM_QC_NO}, + {0xFDF5, UNICODE_NORM_QC_NO}, + {0xFDF6, UNICODE_NORM_QC_NO}, + {0xFDF7, UNICODE_NORM_QC_NO}, + {0xFDF8, UNICODE_NORM_QC_NO}, + {0xFDF9, UNICODE_NORM_QC_NO}, + {0xFDFA, UNICODE_NORM_QC_NO}, + {0xFDFB, UNICODE_NORM_QC_NO}, + {0xFDFC, UNICODE_NORM_QC_NO}, + {0xFE10, UNICODE_NORM_QC_NO}, + {0xFE11, UNICODE_NORM_QC_NO}, + {0xFE12, UNICODE_NORM_QC_NO}, + {0xFE13, UNICODE_NORM_QC_NO}, + {0xFE14, UNICODE_NORM_QC_NO}, + {0xFE15, UNICODE_NORM_QC_NO}, + {0xFE16, UNICODE_NORM_QC_NO}, + {0xFE17, UNICODE_NORM_QC_NO}, + {0xFE18, UNICODE_NORM_QC_NO}, + {0xFE19, UNICODE_NORM_QC_NO}, + {0xFE30, UNICODE_NORM_QC_NO}, + {0xFE31, UNICODE_NORM_QC_NO}, + {0xFE32, UNICODE_NORM_QC_NO}, + {0xFE33, UNICODE_NORM_QC_NO}, + {0xFE34, UNICODE_NORM_QC_NO}, + {0xFE35, UNICODE_NORM_QC_NO}, + {0xFE36, UNICODE_NORM_QC_NO}, + {0xFE37, UNICODE_NORM_QC_NO}, + {0xFE38, UNICODE_NORM_QC_NO}, + {0xFE39, UNICODE_NORM_QC_NO}, + {0xFE3A, UNICODE_NORM_QC_NO}, + {0xFE3B, UNICODE_NORM_QC_NO}, + {0xFE3C, UNICODE_NORM_QC_NO}, + {0xFE3D, UNICODE_NORM_QC_NO}, + {0xFE3E, UNICODE_NORM_QC_NO}, + {0xFE3F, UNICODE_NORM_QC_NO}, + {0xFE40, UNICODE_NORM_QC_NO}, + {0xFE41, UNICODE_NORM_QC_NO}, + {0xFE42, UNICODE_NORM_QC_NO}, + {0xFE43, UNICODE_NORM_QC_NO}, + {0xFE44, UNICODE_NORM_QC_NO}, + {0xFE47, UNICODE_NORM_QC_NO}, + {0xFE48, UNICODE_NORM_QC_NO}, + {0xFE49, UNICODE_NORM_QC_NO}, + {0xFE4A, UNICODE_NORM_QC_NO}, + {0xFE4B, UNICODE_NORM_QC_NO}, + {0xFE4C, UNICODE_NORM_QC_NO}, + {0xFE4D, UNICODE_NORM_QC_NO}, + {0xFE4E, UNICODE_NORM_QC_NO}, + {0xFE4F, UNICODE_NORM_QC_NO}, + {0xFE50, UNICODE_NORM_QC_NO}, + {0xFE51, UNICODE_NORM_QC_NO}, + {0xFE52, UNICODE_NORM_QC_NO}, + {0xFE54, UNICODE_NORM_QC_NO}, + {0xFE55, UNICODE_NORM_QC_NO}, + {0xFE56, UNICODE_NORM_QC_NO}, + {0xFE57, UNICODE_NORM_QC_NO}, + {0xFE58, UNICODE_NORM_QC_NO}, + {0xFE59, UNICODE_NORM_QC_NO}, + {0xFE5A, UNICODE_NORM_QC_NO}, + {0xFE5B, UNICODE_NORM_QC_NO}, + {0xFE5C, UNICODE_NORM_QC_NO}, + {0xFE5D, UNICODE_NORM_QC_NO}, + {0xFE5E, UNICODE_NORM_QC_NO}, + {0xFE5F, UNICODE_NORM_QC_NO}, + {0xFE60, UNICODE_NORM_QC_NO}, + {0xFE61, UNICODE_NORM_QC_NO}, + {0xFE62, UNICODE_NORM_QC_NO}, + {0xFE63, UNICODE_NORM_QC_NO}, + {0xFE64, UNICODE_NORM_QC_NO}, + {0xFE65, UNICODE_NORM_QC_NO}, + {0xFE66, UNICODE_NORM_QC_NO}, + {0xFE68, UNICODE_NORM_QC_NO}, + {0xFE69, UNICODE_NORM_QC_NO}, + {0xFE6A, UNICODE_NORM_QC_NO}, + {0xFE6B, UNICODE_NORM_QC_NO}, + {0xFE70, UNICODE_NORM_QC_NO}, + {0xFE71, UNICODE_NORM_QC_NO}, + {0xFE72, UNICODE_NORM_QC_NO}, + {0xFE74, UNICODE_NORM_QC_NO}, + {0xFE76, UNICODE_NORM_QC_NO}, + {0xFE77, UNICODE_NORM_QC_NO}, + {0xFE78, UNICODE_NORM_QC_NO}, + {0xFE79, UNICODE_NORM_QC_NO}, + {0xFE7A, UNICODE_NORM_QC_NO}, + {0xFE7B, UNICODE_NORM_QC_NO}, + {0xFE7C, UNICODE_NORM_QC_NO}, + {0xFE7D, UNICODE_NORM_QC_NO}, + {0xFE7E, UNICODE_NORM_QC_NO}, + {0xFE7F, UNICODE_NORM_QC_NO}, + {0xFE80, UNICODE_NORM_QC_NO}, + {0xFE81, UNICODE_NORM_QC_NO}, + {0xFE82, UNICODE_NORM_QC_NO}, + {0xFE83, UNICODE_NORM_QC_NO}, + {0xFE84, UNICODE_NORM_QC_NO}, + {0xFE85, UNICODE_NORM_QC_NO}, + {0xFE86, UNICODE_NORM_QC_NO}, + {0xFE87, UNICODE_NORM_QC_NO}, + {0xFE88, UNICODE_NORM_QC_NO}, + {0xFE89, UNICODE_NORM_QC_NO}, + {0xFE8A, UNICODE_NORM_QC_NO}, + {0xFE8B, UNICODE_NORM_QC_NO}, + {0xFE8C, UNICODE_NORM_QC_NO}, + {0xFE8D, UNICODE_NORM_QC_NO}, + {0xFE8E, UNICODE_NORM_QC_NO}, + {0xFE8F, UNICODE_NORM_QC_NO}, + {0xFE90, UNICODE_NORM_QC_NO}, + {0xFE91, UNICODE_NORM_QC_NO}, + {0xFE92, UNICODE_NORM_QC_NO}, + {0xFE93, UNICODE_NORM_QC_NO}, + {0xFE94, UNICODE_NORM_QC_NO}, + {0xFE95, UNICODE_NORM_QC_NO}, + {0xFE96, UNICODE_NORM_QC_NO}, + {0xFE97, UNICODE_NORM_QC_NO}, + {0xFE98, UNICODE_NORM_QC_NO}, + {0xFE99, UNICODE_NORM_QC_NO}, + {0xFE9A, UNICODE_NORM_QC_NO}, + {0xFE9B, UNICODE_NORM_QC_NO}, + {0xFE9C, UNICODE_NORM_QC_NO}, + {0xFE9D, UNICODE_NORM_QC_NO}, + {0xFE9E, UNICODE_NORM_QC_NO}, + {0xFE9F, UNICODE_NORM_QC_NO}, + {0xFEA0, UNICODE_NORM_QC_NO}, + {0xFEA1, UNICODE_NORM_QC_NO}, + {0xFEA2, UNICODE_NORM_QC_NO}, + {0xFEA3, UNICODE_NORM_QC_NO}, + {0xFEA4, UNICODE_NORM_QC_NO}, + {0xFEA5, UNICODE_NORM_QC_NO}, + {0xFEA6, UNICODE_NORM_QC_NO}, + {0xFEA7, UNICODE_NORM_QC_NO}, + {0xFEA8, UNICODE_NORM_QC_NO}, + {0xFEA9, UNICODE_NORM_QC_NO}, + {0xFEAA, UNICODE_NORM_QC_NO}, + {0xFEAB, UNICODE_NORM_QC_NO}, + {0xFEAC, UNICODE_NORM_QC_NO}, + {0xFEAD, UNICODE_NORM_QC_NO}, + {0xFEAE, UNICODE_NORM_QC_NO}, + {0xFEAF, UNICODE_NORM_QC_NO}, + {0xFEB0, UNICODE_NORM_QC_NO}, + {0xFEB1, UNICODE_NORM_QC_NO}, + {0xFEB2, UNICODE_NORM_QC_NO}, + {0xFEB3, UNICODE_NORM_QC_NO}, + {0xFEB4, UNICODE_NORM_QC_NO}, + {0xFEB5, UNICODE_NORM_QC_NO}, + {0xFEB6, UNICODE_NORM_QC_NO}, + {0xFEB7, UNICODE_NORM_QC_NO}, + {0xFEB8, UNICODE_NORM_QC_NO}, + {0xFEB9, UNICODE_NORM_QC_NO}, + {0xFEBA, UNICODE_NORM_QC_NO}, + {0xFEBB, UNICODE_NORM_QC_NO}, + {0xFEBC, UNICODE_NORM_QC_NO}, + {0xFEBD, UNICODE_NORM_QC_NO}, + {0xFEBE, UNICODE_NORM_QC_NO}, + {0xFEBF, UNICODE_NORM_QC_NO}, + {0xFEC0, UNICODE_NORM_QC_NO}, + {0xFEC1, UNICODE_NORM_QC_NO}, + {0xFEC2, UNICODE_NORM_QC_NO}, + {0xFEC3, UNICODE_NORM_QC_NO}, + {0xFEC4, UNICODE_NORM_QC_NO}, + {0xFEC5, UNICODE_NORM_QC_NO}, + {0xFEC6, UNICODE_NORM_QC_NO}, + {0xFEC7, UNICODE_NORM_QC_NO}, + {0xFEC8, UNICODE_NORM_QC_NO}, + {0xFEC9, UNICODE_NORM_QC_NO}, + {0xFECA, UNICODE_NORM_QC_NO}, + {0xFECB, UNICODE_NORM_QC_NO}, + {0xFECC, UNICODE_NORM_QC_NO}, + {0xFECD, UNICODE_NORM_QC_NO}, + {0xFECE, UNICODE_NORM_QC_NO}, + {0xFECF, UNICODE_NORM_QC_NO}, + {0xFED0, UNICODE_NORM_QC_NO}, + {0xFED1, UNICODE_NORM_QC_NO}, + {0xFED2, UNICODE_NORM_QC_NO}, + {0xFED3, UNICODE_NORM_QC_NO}, + {0xFED4, UNICODE_NORM_QC_NO}, + {0xFED5, UNICODE_NORM_QC_NO}, + {0xFED6, UNICODE_NORM_QC_NO}, + {0xFED7, UNICODE_NORM_QC_NO}, + {0xFED8, UNICODE_NORM_QC_NO}, + {0xFED9, UNICODE_NORM_QC_NO}, + {0xFEDA, UNICODE_NORM_QC_NO}, + {0xFEDB, UNICODE_NORM_QC_NO}, + {0xFEDC, UNICODE_NORM_QC_NO}, + {0xFEDD, UNICODE_NORM_QC_NO}, + {0xFEDE, UNICODE_NORM_QC_NO}, + {0xFEDF, UNICODE_NORM_QC_NO}, + {0xFEE0, UNICODE_NORM_QC_NO}, + {0xFEE1, UNICODE_NORM_QC_NO}, + {0xFEE2, UNICODE_NORM_QC_NO}, + {0xFEE3, UNICODE_NORM_QC_NO}, + {0xFEE4, UNICODE_NORM_QC_NO}, + {0xFEE5, UNICODE_NORM_QC_NO}, + {0xFEE6, UNICODE_NORM_QC_NO}, + {0xFEE7, UNICODE_NORM_QC_NO}, + {0xFEE8, UNICODE_NORM_QC_NO}, + {0xFEE9, UNICODE_NORM_QC_NO}, + {0xFEEA, UNICODE_NORM_QC_NO}, + {0xFEEB, UNICODE_NORM_QC_NO}, + {0xFEEC, UNICODE_NORM_QC_NO}, + {0xFEED, UNICODE_NORM_QC_NO}, + {0xFEEE, UNICODE_NORM_QC_NO}, + {0xFEEF, UNICODE_NORM_QC_NO}, + {0xFEF0, UNICODE_NORM_QC_NO}, + {0xFEF1, UNICODE_NORM_QC_NO}, + {0xFEF2, UNICODE_NORM_QC_NO}, + {0xFEF3, UNICODE_NORM_QC_NO}, + {0xFEF4, UNICODE_NORM_QC_NO}, + {0xFEF5, UNICODE_NORM_QC_NO}, + {0xFEF6, UNICODE_NORM_QC_NO}, + {0xFEF7, UNICODE_NORM_QC_NO}, + {0xFEF8, UNICODE_NORM_QC_NO}, + {0xFEF9, UNICODE_NORM_QC_NO}, + {0xFEFA, UNICODE_NORM_QC_NO}, + {0xFEFB, UNICODE_NORM_QC_NO}, + {0xFEFC, UNICODE_NORM_QC_NO}, + {0xFF01, UNICODE_NORM_QC_NO}, + {0xFF02, UNICODE_NORM_QC_NO}, + {0xFF03, UNICODE_NORM_QC_NO}, + {0xFF04, UNICODE_NORM_QC_NO}, + {0xFF05, UNICODE_NORM_QC_NO}, + {0xFF06, UNICODE_NORM_QC_NO}, + {0xFF07, UNICODE_NORM_QC_NO}, + {0xFF08, UNICODE_NORM_QC_NO}, + {0xFF09, UNICODE_NORM_QC_NO}, + {0xFF0A, UNICODE_NORM_QC_NO}, + {0xFF0B, UNICODE_NORM_QC_NO}, + {0xFF0C, UNICODE_NORM_QC_NO}, + {0xFF0D, UNICODE_NORM_QC_NO}, + {0xFF0E, UNICODE_NORM_QC_NO}, + {0xFF0F, UNICODE_NORM_QC_NO}, + {0xFF10, UNICODE_NORM_QC_NO}, + {0xFF11, UNICODE_NORM_QC_NO}, + {0xFF12, UNICODE_NORM_QC_NO}, + {0xFF13, UNICODE_NORM_QC_NO}, + {0xFF14, UNICODE_NORM_QC_NO}, + {0xFF15, UNICODE_NORM_QC_NO}, + {0xFF16, UNICODE_NORM_QC_NO}, + {0xFF17, UNICODE_NORM_QC_NO}, + {0xFF18, UNICODE_NORM_QC_NO}, + {0xFF19, UNICODE_NORM_QC_NO}, + {0xFF1A, UNICODE_NORM_QC_NO}, + {0xFF1B, UNICODE_NORM_QC_NO}, + {0xFF1C, UNICODE_NORM_QC_NO}, + {0xFF1D, UNICODE_NORM_QC_NO}, + {0xFF1E, UNICODE_NORM_QC_NO}, + {0xFF1F, UNICODE_NORM_QC_NO}, + {0xFF20, UNICODE_NORM_QC_NO}, + {0xFF21, UNICODE_NORM_QC_NO}, + {0xFF22, UNICODE_NORM_QC_NO}, + {0xFF23, UNICODE_NORM_QC_NO}, + {0xFF24, UNICODE_NORM_QC_NO}, + {0xFF25, UNICODE_NORM_QC_NO}, + {0xFF26, UNICODE_NORM_QC_NO}, + {0xFF27, UNICODE_NORM_QC_NO}, + {0xFF28, UNICODE_NORM_QC_NO}, + {0xFF29, UNICODE_NORM_QC_NO}, + {0xFF2A, UNICODE_NORM_QC_NO}, + {0xFF2B, UNICODE_NORM_QC_NO}, + {0xFF2C, UNICODE_NORM_QC_NO}, + {0xFF2D, UNICODE_NORM_QC_NO}, + {0xFF2E, UNICODE_NORM_QC_NO}, + {0xFF2F, UNICODE_NORM_QC_NO}, + {0xFF30, UNICODE_NORM_QC_NO}, + {0xFF31, UNICODE_NORM_QC_NO}, + {0xFF32, UNICODE_NORM_QC_NO}, + {0xFF33, UNICODE_NORM_QC_NO}, + {0xFF34, UNICODE_NORM_QC_NO}, + {0xFF35, UNICODE_NORM_QC_NO}, + {0xFF36, UNICODE_NORM_QC_NO}, + {0xFF37, UNICODE_NORM_QC_NO}, + {0xFF38, UNICODE_NORM_QC_NO}, + {0xFF39, UNICODE_NORM_QC_NO}, + {0xFF3A, UNICODE_NORM_QC_NO}, + {0xFF3B, UNICODE_NORM_QC_NO}, + {0xFF3C, UNICODE_NORM_QC_NO}, + {0xFF3D, UNICODE_NORM_QC_NO}, + {0xFF3E, UNICODE_NORM_QC_NO}, + {0xFF3F, UNICODE_NORM_QC_NO}, + {0xFF40, UNICODE_NORM_QC_NO}, + {0xFF41, UNICODE_NORM_QC_NO}, + {0xFF42, UNICODE_NORM_QC_NO}, + {0xFF43, UNICODE_NORM_QC_NO}, + {0xFF44, UNICODE_NORM_QC_NO}, + {0xFF45, UNICODE_NORM_QC_NO}, + {0xFF46, UNICODE_NORM_QC_NO}, + {0xFF47, UNICODE_NORM_QC_NO}, + {0xFF48, UNICODE_NORM_QC_NO}, + {0xFF49, UNICODE_NORM_QC_NO}, + {0xFF4A, UNICODE_NORM_QC_NO}, + {0xFF4B, UNICODE_NORM_QC_NO}, + {0xFF4C, UNICODE_NORM_QC_NO}, + {0xFF4D, UNICODE_NORM_QC_NO}, + {0xFF4E, UNICODE_NORM_QC_NO}, + {0xFF4F, UNICODE_NORM_QC_NO}, + {0xFF50, UNICODE_NORM_QC_NO}, + {0xFF51, UNICODE_NORM_QC_NO}, + {0xFF52, UNICODE_NORM_QC_NO}, + {0xFF53, UNICODE_NORM_QC_NO}, + {0xFF54, UNICODE_NORM_QC_NO}, + {0xFF55, UNICODE_NORM_QC_NO}, + {0xFF56, UNICODE_NORM_QC_NO}, + {0xFF57, UNICODE_NORM_QC_NO}, + {0xFF58, UNICODE_NORM_QC_NO}, + {0xFF59, UNICODE_NORM_QC_NO}, + {0xFF5A, UNICODE_NORM_QC_NO}, + {0xFF5B, UNICODE_NORM_QC_NO}, + {0xFF5C, UNICODE_NORM_QC_NO}, + {0xFF5D, UNICODE_NORM_QC_NO}, + {0xFF5E, UNICODE_NORM_QC_NO}, + {0xFF5F, UNICODE_NORM_QC_NO}, + {0xFF60, UNICODE_NORM_QC_NO}, + {0xFF61, UNICODE_NORM_QC_NO}, + {0xFF62, UNICODE_NORM_QC_NO}, + {0xFF63, UNICODE_NORM_QC_NO}, + {0xFF64, UNICODE_NORM_QC_NO}, + {0xFF65, UNICODE_NORM_QC_NO}, + {0xFF66, UNICODE_NORM_QC_NO}, + {0xFF67, UNICODE_NORM_QC_NO}, + {0xFF68, UNICODE_NORM_QC_NO}, + {0xFF69, UNICODE_NORM_QC_NO}, + {0xFF6A, UNICODE_NORM_QC_NO}, + {0xFF6B, UNICODE_NORM_QC_NO}, + {0xFF6C, UNICODE_NORM_QC_NO}, + {0xFF6D, UNICODE_NORM_QC_NO}, + {0xFF6E, UNICODE_NORM_QC_NO}, + {0xFF6F, UNICODE_NORM_QC_NO}, + {0xFF70, UNICODE_NORM_QC_NO}, + {0xFF71, UNICODE_NORM_QC_NO}, + {0xFF72, UNICODE_NORM_QC_NO}, + {0xFF73, UNICODE_NORM_QC_NO}, + {0xFF74, UNICODE_NORM_QC_NO}, + {0xFF75, UNICODE_NORM_QC_NO}, + {0xFF76, UNICODE_NORM_QC_NO}, + {0xFF77, UNICODE_NORM_QC_NO}, + {0xFF78, UNICODE_NORM_QC_NO}, + {0xFF79, UNICODE_NORM_QC_NO}, + {0xFF7A, UNICODE_NORM_QC_NO}, + {0xFF7B, UNICODE_NORM_QC_NO}, + {0xFF7C, UNICODE_NORM_QC_NO}, + {0xFF7D, UNICODE_NORM_QC_NO}, + {0xFF7E, UNICODE_NORM_QC_NO}, + {0xFF7F, UNICODE_NORM_QC_NO}, + {0xFF80, UNICODE_NORM_QC_NO}, + {0xFF81, UNICODE_NORM_QC_NO}, + {0xFF82, UNICODE_NORM_QC_NO}, + {0xFF83, UNICODE_NORM_QC_NO}, + {0xFF84, UNICODE_NORM_QC_NO}, + {0xFF85, UNICODE_NORM_QC_NO}, + {0xFF86, UNICODE_NORM_QC_NO}, + {0xFF87, UNICODE_NORM_QC_NO}, + {0xFF88, UNICODE_NORM_QC_NO}, + {0xFF89, UNICODE_NORM_QC_NO}, + {0xFF8A, UNICODE_NORM_QC_NO}, + {0xFF8B, UNICODE_NORM_QC_NO}, + {0xFF8C, UNICODE_NORM_QC_NO}, + {0xFF8D, UNICODE_NORM_QC_NO}, + {0xFF8E, UNICODE_NORM_QC_NO}, + {0xFF8F, UNICODE_NORM_QC_NO}, + {0xFF90, UNICODE_NORM_QC_NO}, + {0xFF91, UNICODE_NORM_QC_NO}, + {0xFF92, UNICODE_NORM_QC_NO}, + {0xFF93, UNICODE_NORM_QC_NO}, + {0xFF94, UNICODE_NORM_QC_NO}, + {0xFF95, UNICODE_NORM_QC_NO}, + {0xFF96, UNICODE_NORM_QC_NO}, + {0xFF97, UNICODE_NORM_QC_NO}, + {0xFF98, UNICODE_NORM_QC_NO}, + {0xFF99, UNICODE_NORM_QC_NO}, + {0xFF9A, UNICODE_NORM_QC_NO}, + {0xFF9B, UNICODE_NORM_QC_NO}, + {0xFF9C, UNICODE_NORM_QC_NO}, + {0xFF9D, UNICODE_NORM_QC_NO}, + {0xFF9E, UNICODE_NORM_QC_NO}, + {0xFF9F, UNICODE_NORM_QC_NO}, + {0xFFA0, UNICODE_NORM_QC_NO}, + {0xFFA1, UNICODE_NORM_QC_NO}, + {0xFFA2, UNICODE_NORM_QC_NO}, + {0xFFA3, UNICODE_NORM_QC_NO}, + {0xFFA4, UNICODE_NORM_QC_NO}, + {0xFFA5, UNICODE_NORM_QC_NO}, + {0xFFA6, UNICODE_NORM_QC_NO}, + {0xFFA7, UNICODE_NORM_QC_NO}, + {0xFFA8, UNICODE_NORM_QC_NO}, + {0xFFA9, UNICODE_NORM_QC_NO}, + {0xFFAA, UNICODE_NORM_QC_NO}, + {0xFFAB, UNICODE_NORM_QC_NO}, + {0xFFAC, UNICODE_NORM_QC_NO}, + {0xFFAD, UNICODE_NORM_QC_NO}, + {0xFFAE, UNICODE_NORM_QC_NO}, + {0xFFAF, UNICODE_NORM_QC_NO}, + {0xFFB0, UNICODE_NORM_QC_NO}, + {0xFFB1, UNICODE_NORM_QC_NO}, + {0xFFB2, UNICODE_NORM_QC_NO}, + {0xFFB3, UNICODE_NORM_QC_NO}, + {0xFFB4, UNICODE_NORM_QC_NO}, + {0xFFB5, UNICODE_NORM_QC_NO}, + {0xFFB6, UNICODE_NORM_QC_NO}, + {0xFFB7, UNICODE_NORM_QC_NO}, + {0xFFB8, UNICODE_NORM_QC_NO}, + {0xFFB9, UNICODE_NORM_QC_NO}, + {0xFFBA, UNICODE_NORM_QC_NO}, + {0xFFBB, UNICODE_NORM_QC_NO}, + {0xFFBC, UNICODE_NORM_QC_NO}, + {0xFFBD, UNICODE_NORM_QC_NO}, + {0xFFBE, UNICODE_NORM_QC_NO}, + {0xFFC2, UNICODE_NORM_QC_NO}, + {0xFFC3, UNICODE_NORM_QC_NO}, + {0xFFC4, UNICODE_NORM_QC_NO}, + {0xFFC5, UNICODE_NORM_QC_NO}, + {0xFFC6, UNICODE_NORM_QC_NO}, + {0xFFC7, UNICODE_NORM_QC_NO}, + {0xFFCA, UNICODE_NORM_QC_NO}, + {0xFFCB, UNICODE_NORM_QC_NO}, + {0xFFCC, UNICODE_NORM_QC_NO}, + {0xFFCD, UNICODE_NORM_QC_NO}, + {0xFFCE, UNICODE_NORM_QC_NO}, + {0xFFCF, UNICODE_NORM_QC_NO}, + {0xFFD2, UNICODE_NORM_QC_NO}, + {0xFFD3, UNICODE_NORM_QC_NO}, + {0xFFD4, UNICODE_NORM_QC_NO}, + {0xFFD5, UNICODE_NORM_QC_NO}, + {0xFFD6, UNICODE_NORM_QC_NO}, + {0xFFD7, UNICODE_NORM_QC_NO}, + {0xFFDA, UNICODE_NORM_QC_NO}, + {0xFFDB, UNICODE_NORM_QC_NO}, + {0xFFDC, UNICODE_NORM_QC_NO}, + {0xFFE0, UNICODE_NORM_QC_NO}, + {0xFFE1, UNICODE_NORM_QC_NO}, + {0xFFE2, UNICODE_NORM_QC_NO}, + {0xFFE3, UNICODE_NORM_QC_NO}, + {0xFFE4, UNICODE_NORM_QC_NO}, + {0xFFE5, UNICODE_NORM_QC_NO}, + {0xFFE6, UNICODE_NORM_QC_NO}, + {0xFFE8, UNICODE_NORM_QC_NO}, + {0xFFE9, UNICODE_NORM_QC_NO}, + {0xFFEA, UNICODE_NORM_QC_NO}, + {0xFFEB, UNICODE_NORM_QC_NO}, + {0xFFEC, UNICODE_NORM_QC_NO}, + {0xFFED, UNICODE_NORM_QC_NO}, + {0xFFEE, UNICODE_NORM_QC_NO}, + {0x10781, UNICODE_NORM_QC_NO}, + {0x10782, UNICODE_NORM_QC_NO}, + {0x10783, UNICODE_NORM_QC_NO}, + {0x10784, UNICODE_NORM_QC_NO}, + {0x10785, UNICODE_NORM_QC_NO}, + {0x10787, UNICODE_NORM_QC_NO}, + {0x10788, UNICODE_NORM_QC_NO}, + {0x10789, UNICODE_NORM_QC_NO}, + {0x1078A, UNICODE_NORM_QC_NO}, + {0x1078B, UNICODE_NORM_QC_NO}, + {0x1078C, UNICODE_NORM_QC_NO}, + {0x1078D, UNICODE_NORM_QC_NO}, + {0x1078E, UNICODE_NORM_QC_NO}, + {0x1078F, UNICODE_NORM_QC_NO}, + {0x10790, UNICODE_NORM_QC_NO}, + {0x10791, UNICODE_NORM_QC_NO}, + {0x10792, UNICODE_NORM_QC_NO}, + {0x10793, UNICODE_NORM_QC_NO}, + {0x10794, UNICODE_NORM_QC_NO}, + {0x10795, UNICODE_NORM_QC_NO}, + {0x10796, UNICODE_NORM_QC_NO}, + {0x10797, UNICODE_NORM_QC_NO}, + {0x10798, UNICODE_NORM_QC_NO}, + {0x10799, UNICODE_NORM_QC_NO}, + {0x1079A, UNICODE_NORM_QC_NO}, + {0x1079B, UNICODE_NORM_QC_NO}, + {0x1079C, UNICODE_NORM_QC_NO}, + {0x1079D, UNICODE_NORM_QC_NO}, + {0x1079E, UNICODE_NORM_QC_NO}, + {0x1079F, UNICODE_NORM_QC_NO}, + {0x107A0, UNICODE_NORM_QC_NO}, + {0x107A1, UNICODE_NORM_QC_NO}, + {0x107A2, UNICODE_NORM_QC_NO}, + {0x107A3, UNICODE_NORM_QC_NO}, + {0x107A4, UNICODE_NORM_QC_NO}, + {0x107A5, UNICODE_NORM_QC_NO}, + {0x107A6, UNICODE_NORM_QC_NO}, + {0x107A7, UNICODE_NORM_QC_NO}, + {0x107A8, UNICODE_NORM_QC_NO}, + {0x107A9, UNICODE_NORM_QC_NO}, + {0x107AA, UNICODE_NORM_QC_NO}, + {0x107AB, UNICODE_NORM_QC_NO}, + {0x107AC, UNICODE_NORM_QC_NO}, + {0x107AD, UNICODE_NORM_QC_NO}, + {0x107AE, UNICODE_NORM_QC_NO}, + {0x107AF, UNICODE_NORM_QC_NO}, + {0x107B0, UNICODE_NORM_QC_NO}, + {0x107B2, UNICODE_NORM_QC_NO}, + {0x107B3, UNICODE_NORM_QC_NO}, + {0x107B4, UNICODE_NORM_QC_NO}, + {0x107B5, UNICODE_NORM_QC_NO}, + {0x107B6, UNICODE_NORM_QC_NO}, + {0x107B7, UNICODE_NORM_QC_NO}, + {0x107B8, UNICODE_NORM_QC_NO}, + {0x107B9, UNICODE_NORM_QC_NO}, + {0x107BA, UNICODE_NORM_QC_NO}, + {0x110BA, UNICODE_NORM_QC_MAYBE}, + {0x11127, UNICODE_NORM_QC_MAYBE}, + {0x1133E, UNICODE_NORM_QC_MAYBE}, + {0x11357, UNICODE_NORM_QC_MAYBE}, + {0x114B0, UNICODE_NORM_QC_MAYBE}, + {0x114BA, UNICODE_NORM_QC_MAYBE}, + {0x114BD, UNICODE_NORM_QC_MAYBE}, + {0x115AF, UNICODE_NORM_QC_MAYBE}, + {0x11930, UNICODE_NORM_QC_MAYBE}, + {0x1D15E, UNICODE_NORM_QC_NO}, + {0x1D15F, UNICODE_NORM_QC_NO}, + {0x1D160, UNICODE_NORM_QC_NO}, + {0x1D161, UNICODE_NORM_QC_NO}, + {0x1D162, UNICODE_NORM_QC_NO}, + {0x1D163, UNICODE_NORM_QC_NO}, + {0x1D164, UNICODE_NORM_QC_NO}, + {0x1D1BB, UNICODE_NORM_QC_NO}, + {0x1D1BC, UNICODE_NORM_QC_NO}, + {0x1D1BD, UNICODE_NORM_QC_NO}, + {0x1D1BE, UNICODE_NORM_QC_NO}, + {0x1D1BF, UNICODE_NORM_QC_NO}, + {0x1D1C0, UNICODE_NORM_QC_NO}, + {0x1D400, UNICODE_NORM_QC_NO}, + {0x1D401, UNICODE_NORM_QC_NO}, + {0x1D402, UNICODE_NORM_QC_NO}, + {0x1D403, UNICODE_NORM_QC_NO}, + {0x1D404, UNICODE_NORM_QC_NO}, + {0x1D405, UNICODE_NORM_QC_NO}, + {0x1D406, UNICODE_NORM_QC_NO}, + {0x1D407, UNICODE_NORM_QC_NO}, + {0x1D408, UNICODE_NORM_QC_NO}, + {0x1D409, UNICODE_NORM_QC_NO}, + {0x1D40A, UNICODE_NORM_QC_NO}, + {0x1D40B, UNICODE_NORM_QC_NO}, + {0x1D40C, UNICODE_NORM_QC_NO}, + {0x1D40D, UNICODE_NORM_QC_NO}, + {0x1D40E, UNICODE_NORM_QC_NO}, + {0x1D40F, UNICODE_NORM_QC_NO}, + {0x1D410, UNICODE_NORM_QC_NO}, + {0x1D411, UNICODE_NORM_QC_NO}, + {0x1D412, UNICODE_NORM_QC_NO}, + {0x1D413, UNICODE_NORM_QC_NO}, + {0x1D414, UNICODE_NORM_QC_NO}, + {0x1D415, UNICODE_NORM_QC_NO}, + {0x1D416, UNICODE_NORM_QC_NO}, + {0x1D417, UNICODE_NORM_QC_NO}, + {0x1D418, UNICODE_NORM_QC_NO}, + {0x1D419, UNICODE_NORM_QC_NO}, + {0x1D41A, UNICODE_NORM_QC_NO}, + {0x1D41B, UNICODE_NORM_QC_NO}, + {0x1D41C, UNICODE_NORM_QC_NO}, + {0x1D41D, UNICODE_NORM_QC_NO}, + {0x1D41E, UNICODE_NORM_QC_NO}, + {0x1D41F, UNICODE_NORM_QC_NO}, + {0x1D420, UNICODE_NORM_QC_NO}, + {0x1D421, UNICODE_NORM_QC_NO}, + {0x1D422, UNICODE_NORM_QC_NO}, + {0x1D423, UNICODE_NORM_QC_NO}, + {0x1D424, UNICODE_NORM_QC_NO}, + {0x1D425, UNICODE_NORM_QC_NO}, + {0x1D426, UNICODE_NORM_QC_NO}, + {0x1D427, UNICODE_NORM_QC_NO}, + {0x1D428, UNICODE_NORM_QC_NO}, + {0x1D429, UNICODE_NORM_QC_NO}, + {0x1D42A, UNICODE_NORM_QC_NO}, + {0x1D42B, UNICODE_NORM_QC_NO}, + {0x1D42C, UNICODE_NORM_QC_NO}, + {0x1D42D, UNICODE_NORM_QC_NO}, + {0x1D42E, UNICODE_NORM_QC_NO}, + {0x1D42F, UNICODE_NORM_QC_NO}, + {0x1D430, UNICODE_NORM_QC_NO}, + {0x1D431, UNICODE_NORM_QC_NO}, + {0x1D432, UNICODE_NORM_QC_NO}, + {0x1D433, UNICODE_NORM_QC_NO}, + {0x1D434, UNICODE_NORM_QC_NO}, + {0x1D435, UNICODE_NORM_QC_NO}, + {0x1D436, UNICODE_NORM_QC_NO}, + {0x1D437, UNICODE_NORM_QC_NO}, + {0x1D438, UNICODE_NORM_QC_NO}, + {0x1D439, UNICODE_NORM_QC_NO}, + {0x1D43A, UNICODE_NORM_QC_NO}, + {0x1D43B, UNICODE_NORM_QC_NO}, + {0x1D43C, UNICODE_NORM_QC_NO}, + {0x1D43D, UNICODE_NORM_QC_NO}, + {0x1D43E, UNICODE_NORM_QC_NO}, + {0x1D43F, UNICODE_NORM_QC_NO}, + {0x1D440, UNICODE_NORM_QC_NO}, + {0x1D441, UNICODE_NORM_QC_NO}, + {0x1D442, UNICODE_NORM_QC_NO}, + {0x1D443, UNICODE_NORM_QC_NO}, + {0x1D444, UNICODE_NORM_QC_NO}, + {0x1D445, UNICODE_NORM_QC_NO}, + {0x1D446, UNICODE_NORM_QC_NO}, + {0x1D447, UNICODE_NORM_QC_NO}, + {0x1D448, UNICODE_NORM_QC_NO}, + {0x1D449, UNICODE_NORM_QC_NO}, + {0x1D44A, UNICODE_NORM_QC_NO}, + {0x1D44B, UNICODE_NORM_QC_NO}, + {0x1D44C, UNICODE_NORM_QC_NO}, + {0x1D44D, UNICODE_NORM_QC_NO}, + {0x1D44E, UNICODE_NORM_QC_NO}, + {0x1D44F, UNICODE_NORM_QC_NO}, + {0x1D450, UNICODE_NORM_QC_NO}, + {0x1D451, UNICODE_NORM_QC_NO}, + {0x1D452, UNICODE_NORM_QC_NO}, + {0x1D453, UNICODE_NORM_QC_NO}, + {0x1D454, UNICODE_NORM_QC_NO}, + {0x1D456, UNICODE_NORM_QC_NO}, + {0x1D457, UNICODE_NORM_QC_NO}, + {0x1D458, UNICODE_NORM_QC_NO}, + {0x1D459, UNICODE_NORM_QC_NO}, + {0x1D45A, UNICODE_NORM_QC_NO}, + {0x1D45B, UNICODE_NORM_QC_NO}, + {0x1D45C, UNICODE_NORM_QC_NO}, + {0x1D45D, UNICODE_NORM_QC_NO}, + {0x1D45E, UNICODE_NORM_QC_NO}, + {0x1D45F, UNICODE_NORM_QC_NO}, + {0x1D460, UNICODE_NORM_QC_NO}, + {0x1D461, UNICODE_NORM_QC_NO}, + {0x1D462, UNICODE_NORM_QC_NO}, + {0x1D463, UNICODE_NORM_QC_NO}, + {0x1D464, UNICODE_NORM_QC_NO}, + {0x1D465, UNICODE_NORM_QC_NO}, + {0x1D466, UNICODE_NORM_QC_NO}, + {0x1D467, UNICODE_NORM_QC_NO}, + {0x1D468, UNICODE_NORM_QC_NO}, + {0x1D469, UNICODE_NORM_QC_NO}, + {0x1D46A, UNICODE_NORM_QC_NO}, + {0x1D46B, UNICODE_NORM_QC_NO}, + {0x1D46C, UNICODE_NORM_QC_NO}, + {0x1D46D, UNICODE_NORM_QC_NO}, + {0x1D46E, UNICODE_NORM_QC_NO}, + {0x1D46F, UNICODE_NORM_QC_NO}, + {0x1D470, UNICODE_NORM_QC_NO}, + {0x1D471, UNICODE_NORM_QC_NO}, + {0x1D472, UNICODE_NORM_QC_NO}, + {0x1D473, UNICODE_NORM_QC_NO}, + {0x1D474, UNICODE_NORM_QC_NO}, + {0x1D475, UNICODE_NORM_QC_NO}, + {0x1D476, UNICODE_NORM_QC_NO}, + {0x1D477, UNICODE_NORM_QC_NO}, + {0x1D478, UNICODE_NORM_QC_NO}, + {0x1D479, UNICODE_NORM_QC_NO}, + {0x1D47A, UNICODE_NORM_QC_NO}, + {0x1D47B, UNICODE_NORM_QC_NO}, + {0x1D47C, UNICODE_NORM_QC_NO}, + {0x1D47D, UNICODE_NORM_QC_NO}, + {0x1D47E, UNICODE_NORM_QC_NO}, + {0x1D47F, UNICODE_NORM_QC_NO}, + {0x1D480, UNICODE_NORM_QC_NO}, + {0x1D481, UNICODE_NORM_QC_NO}, + {0x1D482, UNICODE_NORM_QC_NO}, + {0x1D483, UNICODE_NORM_QC_NO}, + {0x1D484, UNICODE_NORM_QC_NO}, + {0x1D485, UNICODE_NORM_QC_NO}, + {0x1D486, UNICODE_NORM_QC_NO}, + {0x1D487, UNICODE_NORM_QC_NO}, + {0x1D488, UNICODE_NORM_QC_NO}, + {0x1D489, UNICODE_NORM_QC_NO}, + {0x1D48A, UNICODE_NORM_QC_NO}, + {0x1D48B, UNICODE_NORM_QC_NO}, + {0x1D48C, UNICODE_NORM_QC_NO}, + {0x1D48D, UNICODE_NORM_QC_NO}, + {0x1D48E, UNICODE_NORM_QC_NO}, + {0x1D48F, UNICODE_NORM_QC_NO}, + {0x1D490, UNICODE_NORM_QC_NO}, + {0x1D491, UNICODE_NORM_QC_NO}, + {0x1D492, UNICODE_NORM_QC_NO}, + {0x1D493, UNICODE_NORM_QC_NO}, + {0x1D494, UNICODE_NORM_QC_NO}, + {0x1D495, UNICODE_NORM_QC_NO}, + {0x1D496, UNICODE_NORM_QC_NO}, + {0x1D497, UNICODE_NORM_QC_NO}, + {0x1D498, UNICODE_NORM_QC_NO}, + {0x1D499, UNICODE_NORM_QC_NO}, + {0x1D49A, UNICODE_NORM_QC_NO}, + {0x1D49B, UNICODE_NORM_QC_NO}, + {0x1D49C, UNICODE_NORM_QC_NO}, + {0x1D49E, UNICODE_NORM_QC_NO}, + {0x1D49F, UNICODE_NORM_QC_NO}, + {0x1D4A2, UNICODE_NORM_QC_NO}, + {0x1D4A5, UNICODE_NORM_QC_NO}, + {0x1D4A6, UNICODE_NORM_QC_NO}, + {0x1D4A9, UNICODE_NORM_QC_NO}, + {0x1D4AA, UNICODE_NORM_QC_NO}, + {0x1D4AB, UNICODE_NORM_QC_NO}, + {0x1D4AC, UNICODE_NORM_QC_NO}, + {0x1D4AE, UNICODE_NORM_QC_NO}, + {0x1D4AF, UNICODE_NORM_QC_NO}, + {0x1D4B0, UNICODE_NORM_QC_NO}, + {0x1D4B1, UNICODE_NORM_QC_NO}, + {0x1D4B2, UNICODE_NORM_QC_NO}, + {0x1D4B3, UNICODE_NORM_QC_NO}, + {0x1D4B4, UNICODE_NORM_QC_NO}, + {0x1D4B5, UNICODE_NORM_QC_NO}, + {0x1D4B6, UNICODE_NORM_QC_NO}, + {0x1D4B7, UNICODE_NORM_QC_NO}, + {0x1D4B8, UNICODE_NORM_QC_NO}, + {0x1D4B9, UNICODE_NORM_QC_NO}, + {0x1D4BB, UNICODE_NORM_QC_NO}, + {0x1D4BD, UNICODE_NORM_QC_NO}, + {0x1D4BE, UNICODE_NORM_QC_NO}, + {0x1D4BF, UNICODE_NORM_QC_NO}, + {0x1D4C0, UNICODE_NORM_QC_NO}, + {0x1D4C1, UNICODE_NORM_QC_NO}, + {0x1D4C2, UNICODE_NORM_QC_NO}, + {0x1D4C3, UNICODE_NORM_QC_NO}, + {0x1D4C5, UNICODE_NORM_QC_NO}, + {0x1D4C6, UNICODE_NORM_QC_NO}, + {0x1D4C7, UNICODE_NORM_QC_NO}, + {0x1D4C8, UNICODE_NORM_QC_NO}, + {0x1D4C9, UNICODE_NORM_QC_NO}, + {0x1D4CA, UNICODE_NORM_QC_NO}, + {0x1D4CB, UNICODE_NORM_QC_NO}, + {0x1D4CC, UNICODE_NORM_QC_NO}, + {0x1D4CD, UNICODE_NORM_QC_NO}, + {0x1D4CE, UNICODE_NORM_QC_NO}, + {0x1D4CF, UNICODE_NORM_QC_NO}, + {0x1D4D0, UNICODE_NORM_QC_NO}, + {0x1D4D1, UNICODE_NORM_QC_NO}, + {0x1D4D2, UNICODE_NORM_QC_NO}, + {0x1D4D3, UNICODE_NORM_QC_NO}, + {0x1D4D4, UNICODE_NORM_QC_NO}, + {0x1D4D5, UNICODE_NORM_QC_NO}, + {0x1D4D6, UNICODE_NORM_QC_NO}, + {0x1D4D7, UNICODE_NORM_QC_NO}, + {0x1D4D8, UNICODE_NORM_QC_NO}, + {0x1D4D9, UNICODE_NORM_QC_NO}, + {0x1D4DA, UNICODE_NORM_QC_NO}, + {0x1D4DB, UNICODE_NORM_QC_NO}, + {0x1D4DC, UNICODE_NORM_QC_NO}, + {0x1D4DD, UNICODE_NORM_QC_NO}, + {0x1D4DE, UNICODE_NORM_QC_NO}, + {0x1D4DF, UNICODE_NORM_QC_NO}, + {0x1D4E0, UNICODE_NORM_QC_NO}, + {0x1D4E1, UNICODE_NORM_QC_NO}, + {0x1D4E2, UNICODE_NORM_QC_NO}, + {0x1D4E3, UNICODE_NORM_QC_NO}, + {0x1D4E4, UNICODE_NORM_QC_NO}, + {0x1D4E5, UNICODE_NORM_QC_NO}, + {0x1D4E6, UNICODE_NORM_QC_NO}, + {0x1D4E7, UNICODE_NORM_QC_NO}, + {0x1D4E8, UNICODE_NORM_QC_NO}, + {0x1D4E9, UNICODE_NORM_QC_NO}, + {0x1D4EA, UNICODE_NORM_QC_NO}, + {0x1D4EB, UNICODE_NORM_QC_NO}, + {0x1D4EC, UNICODE_NORM_QC_NO}, + {0x1D4ED, UNICODE_NORM_QC_NO}, + {0x1D4EE, UNICODE_NORM_QC_NO}, + {0x1D4EF, UNICODE_NORM_QC_NO}, + {0x1D4F0, UNICODE_NORM_QC_NO}, + {0x1D4F1, UNICODE_NORM_QC_NO}, + {0x1D4F2, UNICODE_NORM_QC_NO}, + {0x1D4F3, UNICODE_NORM_QC_NO}, + {0x1D4F4, UNICODE_NORM_QC_NO}, + {0x1D4F5, UNICODE_NORM_QC_NO}, + {0x1D4F6, UNICODE_NORM_QC_NO}, + {0x1D4F7, UNICODE_NORM_QC_NO}, + {0x1D4F8, UNICODE_NORM_QC_NO}, + {0x1D4F9, UNICODE_NORM_QC_NO}, + {0x1D4FA, UNICODE_NORM_QC_NO}, + {0x1D4FB, UNICODE_NORM_QC_NO}, + {0x1D4FC, UNICODE_NORM_QC_NO}, + {0x1D4FD, UNICODE_NORM_QC_NO}, + {0x1D4FE, UNICODE_NORM_QC_NO}, + {0x1D4FF, UNICODE_NORM_QC_NO}, + {0x1D500, UNICODE_NORM_QC_NO}, + {0x1D501, UNICODE_NORM_QC_NO}, + {0x1D502, UNICODE_NORM_QC_NO}, + {0x1D503, UNICODE_NORM_QC_NO}, + {0x1D504, UNICODE_NORM_QC_NO}, + {0x1D505, UNICODE_NORM_QC_NO}, + {0x1D507, UNICODE_NORM_QC_NO}, + {0x1D508, UNICODE_NORM_QC_NO}, + {0x1D509, UNICODE_NORM_QC_NO}, + {0x1D50A, UNICODE_NORM_QC_NO}, + {0x1D50D, UNICODE_NORM_QC_NO}, + {0x1D50E, UNICODE_NORM_QC_NO}, + {0x1D50F, UNICODE_NORM_QC_NO}, + {0x1D510, UNICODE_NORM_QC_NO}, + {0x1D511, UNICODE_NORM_QC_NO}, + {0x1D512, UNICODE_NORM_QC_NO}, + {0x1D513, UNICODE_NORM_QC_NO}, + {0x1D514, UNICODE_NORM_QC_NO}, + {0x1D516, UNICODE_NORM_QC_NO}, + {0x1D517, UNICODE_NORM_QC_NO}, + {0x1D518, UNICODE_NORM_QC_NO}, + {0x1D519, UNICODE_NORM_QC_NO}, + {0x1D51A, UNICODE_NORM_QC_NO}, + {0x1D51B, UNICODE_NORM_QC_NO}, + {0x1D51C, UNICODE_NORM_QC_NO}, + {0x1D51E, UNICODE_NORM_QC_NO}, + {0x1D51F, UNICODE_NORM_QC_NO}, + {0x1D520, UNICODE_NORM_QC_NO}, + {0x1D521, UNICODE_NORM_QC_NO}, + {0x1D522, UNICODE_NORM_QC_NO}, + {0x1D523, UNICODE_NORM_QC_NO}, + {0x1D524, UNICODE_NORM_QC_NO}, + {0x1D525, UNICODE_NORM_QC_NO}, + {0x1D526, UNICODE_NORM_QC_NO}, + {0x1D527, UNICODE_NORM_QC_NO}, + {0x1D528, UNICODE_NORM_QC_NO}, + {0x1D529, UNICODE_NORM_QC_NO}, + {0x1D52A, UNICODE_NORM_QC_NO}, + {0x1D52B, UNICODE_NORM_QC_NO}, + {0x1D52C, UNICODE_NORM_QC_NO}, + {0x1D52D, UNICODE_NORM_QC_NO}, + {0x1D52E, UNICODE_NORM_QC_NO}, + {0x1D52F, UNICODE_NORM_QC_NO}, + {0x1D530, UNICODE_NORM_QC_NO}, + {0x1D531, UNICODE_NORM_QC_NO}, + {0x1D532, UNICODE_NORM_QC_NO}, + {0x1D533, UNICODE_NORM_QC_NO}, + {0x1D534, UNICODE_NORM_QC_NO}, + {0x1D535, UNICODE_NORM_QC_NO}, + {0x1D536, UNICODE_NORM_QC_NO}, + {0x1D537, UNICODE_NORM_QC_NO}, + {0x1D538, UNICODE_NORM_QC_NO}, + {0x1D539, UNICODE_NORM_QC_NO}, + {0x1D53B, UNICODE_NORM_QC_NO}, + {0x1D53C, UNICODE_NORM_QC_NO}, + {0x1D53D, UNICODE_NORM_QC_NO}, + {0x1D53E, UNICODE_NORM_QC_NO}, + {0x1D540, UNICODE_NORM_QC_NO}, + {0x1D541, UNICODE_NORM_QC_NO}, + {0x1D542, UNICODE_NORM_QC_NO}, + {0x1D543, UNICODE_NORM_QC_NO}, + {0x1D544, UNICODE_NORM_QC_NO}, + {0x1D546, UNICODE_NORM_QC_NO}, + {0x1D54A, UNICODE_NORM_QC_NO}, + {0x1D54B, UNICODE_NORM_QC_NO}, + {0x1D54C, UNICODE_NORM_QC_NO}, + {0x1D54D, UNICODE_NORM_QC_NO}, + {0x1D54E, UNICODE_NORM_QC_NO}, + {0x1D54F, UNICODE_NORM_QC_NO}, + {0x1D550, UNICODE_NORM_QC_NO}, + {0x1D552, UNICODE_NORM_QC_NO}, + {0x1D553, UNICODE_NORM_QC_NO}, + {0x1D554, UNICODE_NORM_QC_NO}, + {0x1D555, UNICODE_NORM_QC_NO}, + {0x1D556, UNICODE_NORM_QC_NO}, + {0x1D557, UNICODE_NORM_QC_NO}, + {0x1D558, UNICODE_NORM_QC_NO}, + {0x1D559, UNICODE_NORM_QC_NO}, + {0x1D55A, UNICODE_NORM_QC_NO}, + {0x1D55B, UNICODE_NORM_QC_NO}, + {0x1D55C, UNICODE_NORM_QC_NO}, + {0x1D55D, UNICODE_NORM_QC_NO}, + {0x1D55E, UNICODE_NORM_QC_NO}, + {0x1D55F, UNICODE_NORM_QC_NO}, + {0x1D560, UNICODE_NORM_QC_NO}, + {0x1D561, UNICODE_NORM_QC_NO}, + {0x1D562, UNICODE_NORM_QC_NO}, + {0x1D563, UNICODE_NORM_QC_NO}, + {0x1D564, UNICODE_NORM_QC_NO}, + {0x1D565, UNICODE_NORM_QC_NO}, + {0x1D566, UNICODE_NORM_QC_NO}, + {0x1D567, UNICODE_NORM_QC_NO}, + {0x1D568, UNICODE_NORM_QC_NO}, + {0x1D569, UNICODE_NORM_QC_NO}, + {0x1D56A, UNICODE_NORM_QC_NO}, + {0x1D56B, UNICODE_NORM_QC_NO}, + {0x1D56C, UNICODE_NORM_QC_NO}, + {0x1D56D, UNICODE_NORM_QC_NO}, + {0x1D56E, UNICODE_NORM_QC_NO}, + {0x1D56F, UNICODE_NORM_QC_NO}, + {0x1D570, UNICODE_NORM_QC_NO}, + {0x1D571, UNICODE_NORM_QC_NO}, + {0x1D572, UNICODE_NORM_QC_NO}, + {0x1D573, UNICODE_NORM_QC_NO}, + {0x1D574, UNICODE_NORM_QC_NO}, + {0x1D575, UNICODE_NORM_QC_NO}, + {0x1D576, UNICODE_NORM_QC_NO}, + {0x1D577, UNICODE_NORM_QC_NO}, + {0x1D578, UNICODE_NORM_QC_NO}, + {0x1D579, UNICODE_NORM_QC_NO}, + {0x1D57A, UNICODE_NORM_QC_NO}, + {0x1D57B, UNICODE_NORM_QC_NO}, + {0x1D57C, UNICODE_NORM_QC_NO}, + {0x1D57D, UNICODE_NORM_QC_NO}, + {0x1D57E, UNICODE_NORM_QC_NO}, + {0x1D57F, UNICODE_NORM_QC_NO}, + {0x1D580, UNICODE_NORM_QC_NO}, + {0x1D581, UNICODE_NORM_QC_NO}, + {0x1D582, UNICODE_NORM_QC_NO}, + {0x1D583, UNICODE_NORM_QC_NO}, + {0x1D584, UNICODE_NORM_QC_NO}, + {0x1D585, UNICODE_NORM_QC_NO}, + {0x1D586, UNICODE_NORM_QC_NO}, + {0x1D587, UNICODE_NORM_QC_NO}, + {0x1D588, UNICODE_NORM_QC_NO}, + {0x1D589, UNICODE_NORM_QC_NO}, + {0x1D58A, UNICODE_NORM_QC_NO}, + {0x1D58B, UNICODE_NORM_QC_NO}, + {0x1D58C, UNICODE_NORM_QC_NO}, + {0x1D58D, UNICODE_NORM_QC_NO}, + {0x1D58E, UNICODE_NORM_QC_NO}, + {0x1D58F, UNICODE_NORM_QC_NO}, + {0x1D590, UNICODE_NORM_QC_NO}, + {0x1D591, UNICODE_NORM_QC_NO}, + {0x1D592, UNICODE_NORM_QC_NO}, + {0x1D593, UNICODE_NORM_QC_NO}, + {0x1D594, UNICODE_NORM_QC_NO}, + {0x1D595, UNICODE_NORM_QC_NO}, + {0x1D596, UNICODE_NORM_QC_NO}, + {0x1D597, UNICODE_NORM_QC_NO}, + {0x1D598, UNICODE_NORM_QC_NO}, + {0x1D599, UNICODE_NORM_QC_NO}, + {0x1D59A, UNICODE_NORM_QC_NO}, + {0x1D59B, UNICODE_NORM_QC_NO}, + {0x1D59C, UNICODE_NORM_QC_NO}, + {0x1D59D, UNICODE_NORM_QC_NO}, + {0x1D59E, UNICODE_NORM_QC_NO}, + {0x1D59F, UNICODE_NORM_QC_NO}, + {0x1D5A0, UNICODE_NORM_QC_NO}, + {0x1D5A1, UNICODE_NORM_QC_NO}, + {0x1D5A2, UNICODE_NORM_QC_NO}, + {0x1D5A3, UNICODE_NORM_QC_NO}, + {0x1D5A4, UNICODE_NORM_QC_NO}, + {0x1D5A5, UNICODE_NORM_QC_NO}, + {0x1D5A6, UNICODE_NORM_QC_NO}, + {0x1D5A7, UNICODE_NORM_QC_NO}, + {0x1D5A8, UNICODE_NORM_QC_NO}, + {0x1D5A9, UNICODE_NORM_QC_NO}, + {0x1D5AA, UNICODE_NORM_QC_NO}, + {0x1D5AB, UNICODE_NORM_QC_NO}, + {0x1D5AC, UNICODE_NORM_QC_NO}, + {0x1D5AD, UNICODE_NORM_QC_NO}, + {0x1D5AE, UNICODE_NORM_QC_NO}, + {0x1D5AF, UNICODE_NORM_QC_NO}, + {0x1D5B0, UNICODE_NORM_QC_NO}, + {0x1D5B1, UNICODE_NORM_QC_NO}, + {0x1D5B2, UNICODE_NORM_QC_NO}, + {0x1D5B3, UNICODE_NORM_QC_NO}, + {0x1D5B4, UNICODE_NORM_QC_NO}, + {0x1D5B5, UNICODE_NORM_QC_NO}, + {0x1D5B6, UNICODE_NORM_QC_NO}, + {0x1D5B7, UNICODE_NORM_QC_NO}, + {0x1D5B8, UNICODE_NORM_QC_NO}, + {0x1D5B9, UNICODE_NORM_QC_NO}, + {0x1D5BA, UNICODE_NORM_QC_NO}, + {0x1D5BB, UNICODE_NORM_QC_NO}, + {0x1D5BC, UNICODE_NORM_QC_NO}, + {0x1D5BD, UNICODE_NORM_QC_NO}, + {0x1D5BE, UNICODE_NORM_QC_NO}, + {0x1D5BF, UNICODE_NORM_QC_NO}, + {0x1D5C0, UNICODE_NORM_QC_NO}, + {0x1D5C1, UNICODE_NORM_QC_NO}, + {0x1D5C2, UNICODE_NORM_QC_NO}, + {0x1D5C3, UNICODE_NORM_QC_NO}, + {0x1D5C4, UNICODE_NORM_QC_NO}, + {0x1D5C5, UNICODE_NORM_QC_NO}, + {0x1D5C6, UNICODE_NORM_QC_NO}, + {0x1D5C7, UNICODE_NORM_QC_NO}, + {0x1D5C8, UNICODE_NORM_QC_NO}, + {0x1D5C9, UNICODE_NORM_QC_NO}, + {0x1D5CA, UNICODE_NORM_QC_NO}, + {0x1D5CB, UNICODE_NORM_QC_NO}, + {0x1D5CC, UNICODE_NORM_QC_NO}, + {0x1D5CD, UNICODE_NORM_QC_NO}, + {0x1D5CE, UNICODE_NORM_QC_NO}, + {0x1D5CF, UNICODE_NORM_QC_NO}, + {0x1D5D0, UNICODE_NORM_QC_NO}, + {0x1D5D1, UNICODE_NORM_QC_NO}, + {0x1D5D2, UNICODE_NORM_QC_NO}, + {0x1D5D3, UNICODE_NORM_QC_NO}, + {0x1D5D4, UNICODE_NORM_QC_NO}, + {0x1D5D5, UNICODE_NORM_QC_NO}, + {0x1D5D6, UNICODE_NORM_QC_NO}, + {0x1D5D7, UNICODE_NORM_QC_NO}, + {0x1D5D8, UNICODE_NORM_QC_NO}, + {0x1D5D9, UNICODE_NORM_QC_NO}, + {0x1D5DA, UNICODE_NORM_QC_NO}, + {0x1D5DB, UNICODE_NORM_QC_NO}, + {0x1D5DC, UNICODE_NORM_QC_NO}, + {0x1D5DD, UNICODE_NORM_QC_NO}, + {0x1D5DE, UNICODE_NORM_QC_NO}, + {0x1D5DF, UNICODE_NORM_QC_NO}, + {0x1D5E0, UNICODE_NORM_QC_NO}, + {0x1D5E1, UNICODE_NORM_QC_NO}, + {0x1D5E2, UNICODE_NORM_QC_NO}, + {0x1D5E3, UNICODE_NORM_QC_NO}, + {0x1D5E4, UNICODE_NORM_QC_NO}, + {0x1D5E5, UNICODE_NORM_QC_NO}, + {0x1D5E6, UNICODE_NORM_QC_NO}, + {0x1D5E7, UNICODE_NORM_QC_NO}, + {0x1D5E8, UNICODE_NORM_QC_NO}, + {0x1D5E9, UNICODE_NORM_QC_NO}, + {0x1D5EA, UNICODE_NORM_QC_NO}, + {0x1D5EB, UNICODE_NORM_QC_NO}, + {0x1D5EC, UNICODE_NORM_QC_NO}, + {0x1D5ED, UNICODE_NORM_QC_NO}, + {0x1D5EE, UNICODE_NORM_QC_NO}, + {0x1D5EF, UNICODE_NORM_QC_NO}, + {0x1D5F0, UNICODE_NORM_QC_NO}, + {0x1D5F1, UNICODE_NORM_QC_NO}, + {0x1D5F2, UNICODE_NORM_QC_NO}, + {0x1D5F3, UNICODE_NORM_QC_NO}, + {0x1D5F4, UNICODE_NORM_QC_NO}, + {0x1D5F5, UNICODE_NORM_QC_NO}, + {0x1D5F6, UNICODE_NORM_QC_NO}, + {0x1D5F7, UNICODE_NORM_QC_NO}, + {0x1D5F8, UNICODE_NORM_QC_NO}, + {0x1D5F9, UNICODE_NORM_QC_NO}, + {0x1D5FA, UNICODE_NORM_QC_NO}, + {0x1D5FB, UNICODE_NORM_QC_NO}, + {0x1D5FC, UNICODE_NORM_QC_NO}, + {0x1D5FD, UNICODE_NORM_QC_NO}, + {0x1D5FE, UNICODE_NORM_QC_NO}, + {0x1D5FF, UNICODE_NORM_QC_NO}, + {0x1D600, UNICODE_NORM_QC_NO}, + {0x1D601, UNICODE_NORM_QC_NO}, + {0x1D602, UNICODE_NORM_QC_NO}, + {0x1D603, UNICODE_NORM_QC_NO}, + {0x1D604, UNICODE_NORM_QC_NO}, + {0x1D605, UNICODE_NORM_QC_NO}, + {0x1D606, UNICODE_NORM_QC_NO}, + {0x1D607, UNICODE_NORM_QC_NO}, + {0x1D608, UNICODE_NORM_QC_NO}, + {0x1D609, UNICODE_NORM_QC_NO}, + {0x1D60A, UNICODE_NORM_QC_NO}, + {0x1D60B, UNICODE_NORM_QC_NO}, + {0x1D60C, UNICODE_NORM_QC_NO}, + {0x1D60D, UNICODE_NORM_QC_NO}, + {0x1D60E, UNICODE_NORM_QC_NO}, + {0x1D60F, UNICODE_NORM_QC_NO}, + {0x1D610, UNICODE_NORM_QC_NO}, + {0x1D611, UNICODE_NORM_QC_NO}, + {0x1D612, UNICODE_NORM_QC_NO}, + {0x1D613, UNICODE_NORM_QC_NO}, + {0x1D614, UNICODE_NORM_QC_NO}, + {0x1D615, UNICODE_NORM_QC_NO}, + {0x1D616, UNICODE_NORM_QC_NO}, + {0x1D617, UNICODE_NORM_QC_NO}, + {0x1D618, UNICODE_NORM_QC_NO}, + {0x1D619, UNICODE_NORM_QC_NO}, + {0x1D61A, UNICODE_NORM_QC_NO}, + {0x1D61B, UNICODE_NORM_QC_NO}, + {0x1D61C, UNICODE_NORM_QC_NO}, + {0x1D61D, UNICODE_NORM_QC_NO}, + {0x1D61E, UNICODE_NORM_QC_NO}, + {0x1D61F, UNICODE_NORM_QC_NO}, + {0x1D620, UNICODE_NORM_QC_NO}, + {0x1D621, UNICODE_NORM_QC_NO}, + {0x1D622, UNICODE_NORM_QC_NO}, + {0x1D623, UNICODE_NORM_QC_NO}, + {0x1D624, UNICODE_NORM_QC_NO}, + {0x1D625, UNICODE_NORM_QC_NO}, + {0x1D626, UNICODE_NORM_QC_NO}, + {0x1D627, UNICODE_NORM_QC_NO}, + {0x1D628, UNICODE_NORM_QC_NO}, + {0x1D629, UNICODE_NORM_QC_NO}, + {0x1D62A, UNICODE_NORM_QC_NO}, + {0x1D62B, UNICODE_NORM_QC_NO}, + {0x1D62C, UNICODE_NORM_QC_NO}, + {0x1D62D, UNICODE_NORM_QC_NO}, + {0x1D62E, UNICODE_NORM_QC_NO}, + {0x1D62F, UNICODE_NORM_QC_NO}, + {0x1D630, UNICODE_NORM_QC_NO}, + {0x1D631, UNICODE_NORM_QC_NO}, + {0x1D632, UNICODE_NORM_QC_NO}, + {0x1D633, UNICODE_NORM_QC_NO}, + {0x1D634, UNICODE_NORM_QC_NO}, + {0x1D635, UNICODE_NORM_QC_NO}, + {0x1D636, UNICODE_NORM_QC_NO}, + {0x1D637, UNICODE_NORM_QC_NO}, + {0x1D638, UNICODE_NORM_QC_NO}, + {0x1D639, UNICODE_NORM_QC_NO}, + {0x1D63A, UNICODE_NORM_QC_NO}, + {0x1D63B, UNICODE_NORM_QC_NO}, + {0x1D63C, UNICODE_NORM_QC_NO}, + {0x1D63D, UNICODE_NORM_QC_NO}, + {0x1D63E, UNICODE_NORM_QC_NO}, + {0x1D63F, UNICODE_NORM_QC_NO}, + {0x1D640, UNICODE_NORM_QC_NO}, + {0x1D641, UNICODE_NORM_QC_NO}, + {0x1D642, UNICODE_NORM_QC_NO}, + {0x1D643, UNICODE_NORM_QC_NO}, + {0x1D644, UNICODE_NORM_QC_NO}, + {0x1D645, UNICODE_NORM_QC_NO}, + {0x1D646, UNICODE_NORM_QC_NO}, + {0x1D647, UNICODE_NORM_QC_NO}, + {0x1D648, UNICODE_NORM_QC_NO}, + {0x1D649, UNICODE_NORM_QC_NO}, + {0x1D64A, UNICODE_NORM_QC_NO}, + {0x1D64B, UNICODE_NORM_QC_NO}, + {0x1D64C, UNICODE_NORM_QC_NO}, + {0x1D64D, UNICODE_NORM_QC_NO}, + {0x1D64E, UNICODE_NORM_QC_NO}, + {0x1D64F, UNICODE_NORM_QC_NO}, + {0x1D650, UNICODE_NORM_QC_NO}, + {0x1D651, UNICODE_NORM_QC_NO}, + {0x1D652, UNICODE_NORM_QC_NO}, + {0x1D653, UNICODE_NORM_QC_NO}, + {0x1D654, UNICODE_NORM_QC_NO}, + {0x1D655, UNICODE_NORM_QC_NO}, + {0x1D656, UNICODE_NORM_QC_NO}, + {0x1D657, UNICODE_NORM_QC_NO}, + {0x1D658, UNICODE_NORM_QC_NO}, + {0x1D659, UNICODE_NORM_QC_NO}, + {0x1D65A, UNICODE_NORM_QC_NO}, + {0x1D65B, UNICODE_NORM_QC_NO}, + {0x1D65C, UNICODE_NORM_QC_NO}, + {0x1D65D, UNICODE_NORM_QC_NO}, + {0x1D65E, UNICODE_NORM_QC_NO}, + {0x1D65F, UNICODE_NORM_QC_NO}, + {0x1D660, UNICODE_NORM_QC_NO}, + {0x1D661, UNICODE_NORM_QC_NO}, + {0x1D662, UNICODE_NORM_QC_NO}, + {0x1D663, UNICODE_NORM_QC_NO}, + {0x1D664, UNICODE_NORM_QC_NO}, + {0x1D665, UNICODE_NORM_QC_NO}, + {0x1D666, UNICODE_NORM_QC_NO}, + {0x1D667, UNICODE_NORM_QC_NO}, + {0x1D668, UNICODE_NORM_QC_NO}, + {0x1D669, UNICODE_NORM_QC_NO}, + {0x1D66A, UNICODE_NORM_QC_NO}, + {0x1D66B, UNICODE_NORM_QC_NO}, + {0x1D66C, UNICODE_NORM_QC_NO}, + {0x1D66D, UNICODE_NORM_QC_NO}, + {0x1D66E, UNICODE_NORM_QC_NO}, + {0x1D66F, UNICODE_NORM_QC_NO}, + {0x1D670, UNICODE_NORM_QC_NO}, + {0x1D671, UNICODE_NORM_QC_NO}, + {0x1D672, UNICODE_NORM_QC_NO}, + {0x1D673, UNICODE_NORM_QC_NO}, + {0x1D674, UNICODE_NORM_QC_NO}, + {0x1D675, UNICODE_NORM_QC_NO}, + {0x1D676, UNICODE_NORM_QC_NO}, + {0x1D677, UNICODE_NORM_QC_NO}, + {0x1D678, UNICODE_NORM_QC_NO}, + {0x1D679, UNICODE_NORM_QC_NO}, + {0x1D67A, UNICODE_NORM_QC_NO}, + {0x1D67B, UNICODE_NORM_QC_NO}, + {0x1D67C, UNICODE_NORM_QC_NO}, + {0x1D67D, UNICODE_NORM_QC_NO}, + {0x1D67E, UNICODE_NORM_QC_NO}, + {0x1D67F, UNICODE_NORM_QC_NO}, + {0x1D680, UNICODE_NORM_QC_NO}, + {0x1D681, UNICODE_NORM_QC_NO}, + {0x1D682, UNICODE_NORM_QC_NO}, + {0x1D683, UNICODE_NORM_QC_NO}, + {0x1D684, UNICODE_NORM_QC_NO}, + {0x1D685, UNICODE_NORM_QC_NO}, + {0x1D686, UNICODE_NORM_QC_NO}, + {0x1D687, UNICODE_NORM_QC_NO}, + {0x1D688, UNICODE_NORM_QC_NO}, + {0x1D689, UNICODE_NORM_QC_NO}, + {0x1D68A, UNICODE_NORM_QC_NO}, + {0x1D68B, UNICODE_NORM_QC_NO}, + {0x1D68C, UNICODE_NORM_QC_NO}, + {0x1D68D, UNICODE_NORM_QC_NO}, + {0x1D68E, UNICODE_NORM_QC_NO}, + {0x1D68F, UNICODE_NORM_QC_NO}, + {0x1D690, UNICODE_NORM_QC_NO}, + {0x1D691, UNICODE_NORM_QC_NO}, + {0x1D692, UNICODE_NORM_QC_NO}, + {0x1D693, UNICODE_NORM_QC_NO}, + {0x1D694, UNICODE_NORM_QC_NO}, + {0x1D695, UNICODE_NORM_QC_NO}, + {0x1D696, UNICODE_NORM_QC_NO}, + {0x1D697, UNICODE_NORM_QC_NO}, + {0x1D698, UNICODE_NORM_QC_NO}, + {0x1D699, UNICODE_NORM_QC_NO}, + {0x1D69A, UNICODE_NORM_QC_NO}, + {0x1D69B, UNICODE_NORM_QC_NO}, + {0x1D69C, UNICODE_NORM_QC_NO}, + {0x1D69D, UNICODE_NORM_QC_NO}, + {0x1D69E, UNICODE_NORM_QC_NO}, + {0x1D69F, UNICODE_NORM_QC_NO}, + {0x1D6A0, UNICODE_NORM_QC_NO}, + {0x1D6A1, UNICODE_NORM_QC_NO}, + {0x1D6A2, UNICODE_NORM_QC_NO}, + {0x1D6A3, UNICODE_NORM_QC_NO}, + {0x1D6A4, UNICODE_NORM_QC_NO}, + {0x1D6A5, UNICODE_NORM_QC_NO}, + {0x1D6A8, UNICODE_NORM_QC_NO}, + {0x1D6A9, UNICODE_NORM_QC_NO}, + {0x1D6AA, UNICODE_NORM_QC_NO}, + {0x1D6AB, UNICODE_NORM_QC_NO}, + {0x1D6AC, UNICODE_NORM_QC_NO}, + {0x1D6AD, UNICODE_NORM_QC_NO}, + {0x1D6AE, UNICODE_NORM_QC_NO}, + {0x1D6AF, UNICODE_NORM_QC_NO}, + {0x1D6B0, UNICODE_NORM_QC_NO}, + {0x1D6B1, UNICODE_NORM_QC_NO}, + {0x1D6B2, UNICODE_NORM_QC_NO}, + {0x1D6B3, UNICODE_NORM_QC_NO}, + {0x1D6B4, UNICODE_NORM_QC_NO}, + {0x1D6B5, UNICODE_NORM_QC_NO}, + {0x1D6B6, UNICODE_NORM_QC_NO}, + {0x1D6B7, UNICODE_NORM_QC_NO}, + {0x1D6B8, UNICODE_NORM_QC_NO}, + {0x1D6B9, UNICODE_NORM_QC_NO}, + {0x1D6BA, UNICODE_NORM_QC_NO}, + {0x1D6BB, UNICODE_NORM_QC_NO}, + {0x1D6BC, UNICODE_NORM_QC_NO}, + {0x1D6BD, UNICODE_NORM_QC_NO}, + {0x1D6BE, UNICODE_NORM_QC_NO}, + {0x1D6BF, UNICODE_NORM_QC_NO}, + {0x1D6C0, UNICODE_NORM_QC_NO}, + {0x1D6C1, UNICODE_NORM_QC_NO}, + {0x1D6C2, UNICODE_NORM_QC_NO}, + {0x1D6C3, UNICODE_NORM_QC_NO}, + {0x1D6C4, UNICODE_NORM_QC_NO}, + {0x1D6C5, UNICODE_NORM_QC_NO}, + {0x1D6C6, UNICODE_NORM_QC_NO}, + {0x1D6C7, UNICODE_NORM_QC_NO}, + {0x1D6C8, UNICODE_NORM_QC_NO}, + {0x1D6C9, UNICODE_NORM_QC_NO}, + {0x1D6CA, UNICODE_NORM_QC_NO}, + {0x1D6CB, UNICODE_NORM_QC_NO}, + {0x1D6CC, UNICODE_NORM_QC_NO}, + {0x1D6CD, UNICODE_NORM_QC_NO}, + {0x1D6CE, UNICODE_NORM_QC_NO}, + {0x1D6CF, UNICODE_NORM_QC_NO}, + {0x1D6D0, UNICODE_NORM_QC_NO}, + {0x1D6D1, UNICODE_NORM_QC_NO}, + {0x1D6D2, UNICODE_NORM_QC_NO}, + {0x1D6D3, UNICODE_NORM_QC_NO}, + {0x1D6D4, UNICODE_NORM_QC_NO}, + {0x1D6D5, UNICODE_NORM_QC_NO}, + {0x1D6D6, UNICODE_NORM_QC_NO}, + {0x1D6D7, UNICODE_NORM_QC_NO}, + {0x1D6D8, UNICODE_NORM_QC_NO}, + {0x1D6D9, UNICODE_NORM_QC_NO}, + {0x1D6DA, UNICODE_NORM_QC_NO}, + {0x1D6DB, UNICODE_NORM_QC_NO}, + {0x1D6DC, UNICODE_NORM_QC_NO}, + {0x1D6DD, UNICODE_NORM_QC_NO}, + {0x1D6DE, UNICODE_NORM_QC_NO}, + {0x1D6DF, UNICODE_NORM_QC_NO}, + {0x1D6E0, UNICODE_NORM_QC_NO}, + {0x1D6E1, UNICODE_NORM_QC_NO}, + {0x1D6E2, UNICODE_NORM_QC_NO}, + {0x1D6E3, UNICODE_NORM_QC_NO}, + {0x1D6E4, UNICODE_NORM_QC_NO}, + {0x1D6E5, UNICODE_NORM_QC_NO}, + {0x1D6E6, UNICODE_NORM_QC_NO}, + {0x1D6E7, UNICODE_NORM_QC_NO}, + {0x1D6E8, UNICODE_NORM_QC_NO}, + {0x1D6E9, UNICODE_NORM_QC_NO}, + {0x1D6EA, UNICODE_NORM_QC_NO}, + {0x1D6EB, UNICODE_NORM_QC_NO}, + {0x1D6EC, UNICODE_NORM_QC_NO}, + {0x1D6ED, UNICODE_NORM_QC_NO}, + {0x1D6EE, UNICODE_NORM_QC_NO}, + {0x1D6EF, UNICODE_NORM_QC_NO}, + {0x1D6F0, UNICODE_NORM_QC_NO}, + {0x1D6F1, UNICODE_NORM_QC_NO}, + {0x1D6F2, UNICODE_NORM_QC_NO}, + {0x1D6F3, UNICODE_NORM_QC_NO}, + {0x1D6F4, UNICODE_NORM_QC_NO}, + {0x1D6F5, UNICODE_NORM_QC_NO}, + {0x1D6F6, UNICODE_NORM_QC_NO}, + {0x1D6F7, UNICODE_NORM_QC_NO}, + {0x1D6F8, UNICODE_NORM_QC_NO}, + {0x1D6F9, UNICODE_NORM_QC_NO}, + {0x1D6FA, UNICODE_NORM_QC_NO}, + {0x1D6FB, UNICODE_NORM_QC_NO}, + {0x1D6FC, UNICODE_NORM_QC_NO}, + {0x1D6FD, UNICODE_NORM_QC_NO}, + {0x1D6FE, UNICODE_NORM_QC_NO}, + {0x1D6FF, UNICODE_NORM_QC_NO}, + {0x1D700, UNICODE_NORM_QC_NO}, + {0x1D701, UNICODE_NORM_QC_NO}, + {0x1D702, UNICODE_NORM_QC_NO}, + {0x1D703, UNICODE_NORM_QC_NO}, + {0x1D704, UNICODE_NORM_QC_NO}, + {0x1D705, UNICODE_NORM_QC_NO}, + {0x1D706, UNICODE_NORM_QC_NO}, + {0x1D707, UNICODE_NORM_QC_NO}, + {0x1D708, UNICODE_NORM_QC_NO}, + {0x1D709, UNICODE_NORM_QC_NO}, + {0x1D70A, UNICODE_NORM_QC_NO}, + {0x1D70B, UNICODE_NORM_QC_NO}, + {0x1D70C, UNICODE_NORM_QC_NO}, + {0x1D70D, UNICODE_NORM_QC_NO}, + {0x1D70E, UNICODE_NORM_QC_NO}, + {0x1D70F, UNICODE_NORM_QC_NO}, + {0x1D710, UNICODE_NORM_QC_NO}, + {0x1D711, UNICODE_NORM_QC_NO}, + {0x1D712, UNICODE_NORM_QC_NO}, + {0x1D713, UNICODE_NORM_QC_NO}, + {0x1D714, UNICODE_NORM_QC_NO}, + {0x1D715, UNICODE_NORM_QC_NO}, + {0x1D716, UNICODE_NORM_QC_NO}, + {0x1D717, UNICODE_NORM_QC_NO}, + {0x1D718, UNICODE_NORM_QC_NO}, + {0x1D719, UNICODE_NORM_QC_NO}, + {0x1D71A, UNICODE_NORM_QC_NO}, + {0x1D71B, UNICODE_NORM_QC_NO}, + {0x1D71C, UNICODE_NORM_QC_NO}, + {0x1D71D, UNICODE_NORM_QC_NO}, + {0x1D71E, UNICODE_NORM_QC_NO}, + {0x1D71F, UNICODE_NORM_QC_NO}, + {0x1D720, UNICODE_NORM_QC_NO}, + {0x1D721, UNICODE_NORM_QC_NO}, + {0x1D722, UNICODE_NORM_QC_NO}, + {0x1D723, UNICODE_NORM_QC_NO}, + {0x1D724, UNICODE_NORM_QC_NO}, + {0x1D725, UNICODE_NORM_QC_NO}, + {0x1D726, UNICODE_NORM_QC_NO}, + {0x1D727, UNICODE_NORM_QC_NO}, + {0x1D728, UNICODE_NORM_QC_NO}, + {0x1D729, UNICODE_NORM_QC_NO}, + {0x1D72A, UNICODE_NORM_QC_NO}, + {0x1D72B, UNICODE_NORM_QC_NO}, + {0x1D72C, UNICODE_NORM_QC_NO}, + {0x1D72D, UNICODE_NORM_QC_NO}, + {0x1D72E, UNICODE_NORM_QC_NO}, + {0x1D72F, UNICODE_NORM_QC_NO}, + {0x1D730, UNICODE_NORM_QC_NO}, + {0x1D731, UNICODE_NORM_QC_NO}, + {0x1D732, UNICODE_NORM_QC_NO}, + {0x1D733, UNICODE_NORM_QC_NO}, + {0x1D734, UNICODE_NORM_QC_NO}, + {0x1D735, UNICODE_NORM_QC_NO}, + {0x1D736, UNICODE_NORM_QC_NO}, + {0x1D737, UNICODE_NORM_QC_NO}, + {0x1D738, UNICODE_NORM_QC_NO}, + {0x1D739, UNICODE_NORM_QC_NO}, + {0x1D73A, UNICODE_NORM_QC_NO}, + {0x1D73B, UNICODE_NORM_QC_NO}, + {0x1D73C, UNICODE_NORM_QC_NO}, + {0x1D73D, UNICODE_NORM_QC_NO}, + {0x1D73E, UNICODE_NORM_QC_NO}, + {0x1D73F, UNICODE_NORM_QC_NO}, + {0x1D740, UNICODE_NORM_QC_NO}, + {0x1D741, UNICODE_NORM_QC_NO}, + {0x1D742, UNICODE_NORM_QC_NO}, + {0x1D743, UNICODE_NORM_QC_NO}, + {0x1D744, UNICODE_NORM_QC_NO}, + {0x1D745, UNICODE_NORM_QC_NO}, + {0x1D746, UNICODE_NORM_QC_NO}, + {0x1D747, UNICODE_NORM_QC_NO}, + {0x1D748, UNICODE_NORM_QC_NO}, + {0x1D749, UNICODE_NORM_QC_NO}, + {0x1D74A, UNICODE_NORM_QC_NO}, + {0x1D74B, UNICODE_NORM_QC_NO}, + {0x1D74C, UNICODE_NORM_QC_NO}, + {0x1D74D, UNICODE_NORM_QC_NO}, + {0x1D74E, UNICODE_NORM_QC_NO}, + {0x1D74F, UNICODE_NORM_QC_NO}, + {0x1D750, UNICODE_NORM_QC_NO}, + {0x1D751, UNICODE_NORM_QC_NO}, + {0x1D752, UNICODE_NORM_QC_NO}, + {0x1D753, UNICODE_NORM_QC_NO}, + {0x1D754, UNICODE_NORM_QC_NO}, + {0x1D755, UNICODE_NORM_QC_NO}, + {0x1D756, UNICODE_NORM_QC_NO}, + {0x1D757, UNICODE_NORM_QC_NO}, + {0x1D758, UNICODE_NORM_QC_NO}, + {0x1D759, UNICODE_NORM_QC_NO}, + {0x1D75A, UNICODE_NORM_QC_NO}, + {0x1D75B, UNICODE_NORM_QC_NO}, + {0x1D75C, UNICODE_NORM_QC_NO}, + {0x1D75D, UNICODE_NORM_QC_NO}, + {0x1D75E, UNICODE_NORM_QC_NO}, + {0x1D75F, UNICODE_NORM_QC_NO}, + {0x1D760, UNICODE_NORM_QC_NO}, + {0x1D761, UNICODE_NORM_QC_NO}, + {0x1D762, UNICODE_NORM_QC_NO}, + {0x1D763, UNICODE_NORM_QC_NO}, + {0x1D764, UNICODE_NORM_QC_NO}, + {0x1D765, UNICODE_NORM_QC_NO}, + {0x1D766, UNICODE_NORM_QC_NO}, + {0x1D767, UNICODE_NORM_QC_NO}, + {0x1D768, UNICODE_NORM_QC_NO}, + {0x1D769, UNICODE_NORM_QC_NO}, + {0x1D76A, UNICODE_NORM_QC_NO}, + {0x1D76B, UNICODE_NORM_QC_NO}, + {0x1D76C, UNICODE_NORM_QC_NO}, + {0x1D76D, UNICODE_NORM_QC_NO}, + {0x1D76E, UNICODE_NORM_QC_NO}, + {0x1D76F, UNICODE_NORM_QC_NO}, + {0x1D770, UNICODE_NORM_QC_NO}, + {0x1D771, UNICODE_NORM_QC_NO}, + {0x1D772, UNICODE_NORM_QC_NO}, + {0x1D773, UNICODE_NORM_QC_NO}, + {0x1D774, UNICODE_NORM_QC_NO}, + {0x1D775, UNICODE_NORM_QC_NO}, + {0x1D776, UNICODE_NORM_QC_NO}, + {0x1D777, UNICODE_NORM_QC_NO}, + {0x1D778, UNICODE_NORM_QC_NO}, + {0x1D779, UNICODE_NORM_QC_NO}, + {0x1D77A, UNICODE_NORM_QC_NO}, + {0x1D77B, UNICODE_NORM_QC_NO}, + {0x1D77C, UNICODE_NORM_QC_NO}, + {0x1D77D, UNICODE_NORM_QC_NO}, + {0x1D77E, UNICODE_NORM_QC_NO}, + {0x1D77F, UNICODE_NORM_QC_NO}, + {0x1D780, UNICODE_NORM_QC_NO}, + {0x1D781, UNICODE_NORM_QC_NO}, + {0x1D782, UNICODE_NORM_QC_NO}, + {0x1D783, UNICODE_NORM_QC_NO}, + {0x1D784, UNICODE_NORM_QC_NO}, + {0x1D785, UNICODE_NORM_QC_NO}, + {0x1D786, UNICODE_NORM_QC_NO}, + {0x1D787, UNICODE_NORM_QC_NO}, + {0x1D788, UNICODE_NORM_QC_NO}, + {0x1D789, UNICODE_NORM_QC_NO}, + {0x1D78A, UNICODE_NORM_QC_NO}, + {0x1D78B, UNICODE_NORM_QC_NO}, + {0x1D78C, UNICODE_NORM_QC_NO}, + {0x1D78D, UNICODE_NORM_QC_NO}, + {0x1D78E, UNICODE_NORM_QC_NO}, + {0x1D78F, UNICODE_NORM_QC_NO}, + {0x1D790, UNICODE_NORM_QC_NO}, + {0x1D791, UNICODE_NORM_QC_NO}, + {0x1D792, UNICODE_NORM_QC_NO}, + {0x1D793, UNICODE_NORM_QC_NO}, + {0x1D794, UNICODE_NORM_QC_NO}, + {0x1D795, UNICODE_NORM_QC_NO}, + {0x1D796, UNICODE_NORM_QC_NO}, + {0x1D797, UNICODE_NORM_QC_NO}, + {0x1D798, UNICODE_NORM_QC_NO}, + {0x1D799, UNICODE_NORM_QC_NO}, + {0x1D79A, UNICODE_NORM_QC_NO}, + {0x1D79B, UNICODE_NORM_QC_NO}, + {0x1D79C, UNICODE_NORM_QC_NO}, + {0x1D79D, UNICODE_NORM_QC_NO}, + {0x1D79E, UNICODE_NORM_QC_NO}, + {0x1D79F, UNICODE_NORM_QC_NO}, + {0x1D7A0, UNICODE_NORM_QC_NO}, + {0x1D7A1, UNICODE_NORM_QC_NO}, + {0x1D7A2, UNICODE_NORM_QC_NO}, + {0x1D7A3, UNICODE_NORM_QC_NO}, + {0x1D7A4, UNICODE_NORM_QC_NO}, + {0x1D7A5, UNICODE_NORM_QC_NO}, + {0x1D7A6, UNICODE_NORM_QC_NO}, + {0x1D7A7, UNICODE_NORM_QC_NO}, + {0x1D7A8, UNICODE_NORM_QC_NO}, + {0x1D7A9, UNICODE_NORM_QC_NO}, + {0x1D7AA, UNICODE_NORM_QC_NO}, + {0x1D7AB, UNICODE_NORM_QC_NO}, + {0x1D7AC, UNICODE_NORM_QC_NO}, + {0x1D7AD, UNICODE_NORM_QC_NO}, + {0x1D7AE, UNICODE_NORM_QC_NO}, + {0x1D7AF, UNICODE_NORM_QC_NO}, + {0x1D7B0, UNICODE_NORM_QC_NO}, + {0x1D7B1, UNICODE_NORM_QC_NO}, + {0x1D7B2, UNICODE_NORM_QC_NO}, + {0x1D7B3, UNICODE_NORM_QC_NO}, + {0x1D7B4, UNICODE_NORM_QC_NO}, + {0x1D7B5, UNICODE_NORM_QC_NO}, + {0x1D7B6, UNICODE_NORM_QC_NO}, + {0x1D7B7, UNICODE_NORM_QC_NO}, + {0x1D7B8, UNICODE_NORM_QC_NO}, + {0x1D7B9, UNICODE_NORM_QC_NO}, + {0x1D7BA, UNICODE_NORM_QC_NO}, + {0x1D7BB, UNICODE_NORM_QC_NO}, + {0x1D7BC, UNICODE_NORM_QC_NO}, + {0x1D7BD, UNICODE_NORM_QC_NO}, + {0x1D7BE, UNICODE_NORM_QC_NO}, + {0x1D7BF, UNICODE_NORM_QC_NO}, + {0x1D7C0, UNICODE_NORM_QC_NO}, + {0x1D7C1, UNICODE_NORM_QC_NO}, + {0x1D7C2, UNICODE_NORM_QC_NO}, + {0x1D7C3, UNICODE_NORM_QC_NO}, + {0x1D7C4, UNICODE_NORM_QC_NO}, + {0x1D7C5, UNICODE_NORM_QC_NO}, + {0x1D7C6, UNICODE_NORM_QC_NO}, + {0x1D7C7, UNICODE_NORM_QC_NO}, + {0x1D7C8, UNICODE_NORM_QC_NO}, + {0x1D7C9, UNICODE_NORM_QC_NO}, + {0x1D7CA, UNICODE_NORM_QC_NO}, + {0x1D7CB, UNICODE_NORM_QC_NO}, + {0x1D7CE, UNICODE_NORM_QC_NO}, + {0x1D7CF, UNICODE_NORM_QC_NO}, + {0x1D7D0, UNICODE_NORM_QC_NO}, + {0x1D7D1, UNICODE_NORM_QC_NO}, + {0x1D7D2, UNICODE_NORM_QC_NO}, + {0x1D7D3, UNICODE_NORM_QC_NO}, + {0x1D7D4, UNICODE_NORM_QC_NO}, + {0x1D7D5, UNICODE_NORM_QC_NO}, + {0x1D7D6, UNICODE_NORM_QC_NO}, + {0x1D7D7, UNICODE_NORM_QC_NO}, + {0x1D7D8, UNICODE_NORM_QC_NO}, + {0x1D7D9, UNICODE_NORM_QC_NO}, + {0x1D7DA, UNICODE_NORM_QC_NO}, + {0x1D7DB, UNICODE_NORM_QC_NO}, + {0x1D7DC, UNICODE_NORM_QC_NO}, + {0x1D7DD, UNICODE_NORM_QC_NO}, + {0x1D7DE, UNICODE_NORM_QC_NO}, + {0x1D7DF, UNICODE_NORM_QC_NO}, + {0x1D7E0, UNICODE_NORM_QC_NO}, + {0x1D7E1, UNICODE_NORM_QC_NO}, + {0x1D7E2, UNICODE_NORM_QC_NO}, + {0x1D7E3, UNICODE_NORM_QC_NO}, + {0x1D7E4, UNICODE_NORM_QC_NO}, + {0x1D7E5, UNICODE_NORM_QC_NO}, + {0x1D7E6, UNICODE_NORM_QC_NO}, + {0x1D7E7, UNICODE_NORM_QC_NO}, + {0x1D7E8, UNICODE_NORM_QC_NO}, + {0x1D7E9, UNICODE_NORM_QC_NO}, + {0x1D7EA, UNICODE_NORM_QC_NO}, + {0x1D7EB, UNICODE_NORM_QC_NO}, + {0x1D7EC, UNICODE_NORM_QC_NO}, + {0x1D7ED, UNICODE_NORM_QC_NO}, + {0x1D7EE, UNICODE_NORM_QC_NO}, + {0x1D7EF, UNICODE_NORM_QC_NO}, + {0x1D7F0, UNICODE_NORM_QC_NO}, + {0x1D7F1, UNICODE_NORM_QC_NO}, + {0x1D7F2, UNICODE_NORM_QC_NO}, + {0x1D7F3, UNICODE_NORM_QC_NO}, + {0x1D7F4, UNICODE_NORM_QC_NO}, + {0x1D7F5, UNICODE_NORM_QC_NO}, + {0x1D7F6, UNICODE_NORM_QC_NO}, + {0x1D7F7, UNICODE_NORM_QC_NO}, + {0x1D7F8, UNICODE_NORM_QC_NO}, + {0x1D7F9, UNICODE_NORM_QC_NO}, + {0x1D7FA, UNICODE_NORM_QC_NO}, + {0x1D7FB, UNICODE_NORM_QC_NO}, + {0x1D7FC, UNICODE_NORM_QC_NO}, + {0x1D7FD, UNICODE_NORM_QC_NO}, + {0x1D7FE, UNICODE_NORM_QC_NO}, + {0x1D7FF, UNICODE_NORM_QC_NO}, + {0x1E030, UNICODE_NORM_QC_NO}, + {0x1E031, UNICODE_NORM_QC_NO}, + {0x1E032, UNICODE_NORM_QC_NO}, + {0x1E033, UNICODE_NORM_QC_NO}, + {0x1E034, UNICODE_NORM_QC_NO}, + {0x1E035, UNICODE_NORM_QC_NO}, + {0x1E036, UNICODE_NORM_QC_NO}, + {0x1E037, UNICODE_NORM_QC_NO}, + {0x1E038, UNICODE_NORM_QC_NO}, + {0x1E039, UNICODE_NORM_QC_NO}, + {0x1E03A, UNICODE_NORM_QC_NO}, + {0x1E03B, UNICODE_NORM_QC_NO}, + {0x1E03C, UNICODE_NORM_QC_NO}, + {0x1E03D, UNICODE_NORM_QC_NO}, + {0x1E03E, UNICODE_NORM_QC_NO}, + {0x1E03F, UNICODE_NORM_QC_NO}, + {0x1E040, UNICODE_NORM_QC_NO}, + {0x1E041, UNICODE_NORM_QC_NO}, + {0x1E042, UNICODE_NORM_QC_NO}, + {0x1E043, UNICODE_NORM_QC_NO}, + {0x1E044, UNICODE_NORM_QC_NO}, + {0x1E045, UNICODE_NORM_QC_NO}, + {0x1E046, UNICODE_NORM_QC_NO}, + {0x1E047, UNICODE_NORM_QC_NO}, + {0x1E048, UNICODE_NORM_QC_NO}, + {0x1E049, UNICODE_NORM_QC_NO}, + {0x1E04A, UNICODE_NORM_QC_NO}, + {0x1E04B, UNICODE_NORM_QC_NO}, + {0x1E04C, UNICODE_NORM_QC_NO}, + {0x1E04D, UNICODE_NORM_QC_NO}, + {0x1E04E, UNICODE_NORM_QC_NO}, + {0x1E04F, UNICODE_NORM_QC_NO}, + {0x1E050, UNICODE_NORM_QC_NO}, + {0x1E051, UNICODE_NORM_QC_NO}, + {0x1E052, UNICODE_NORM_QC_NO}, + {0x1E053, UNICODE_NORM_QC_NO}, + {0x1E054, UNICODE_NORM_QC_NO}, + {0x1E055, UNICODE_NORM_QC_NO}, + {0x1E056, UNICODE_NORM_QC_NO}, + {0x1E057, UNICODE_NORM_QC_NO}, + {0x1E058, UNICODE_NORM_QC_NO}, + {0x1E059, UNICODE_NORM_QC_NO}, + {0x1E05A, UNICODE_NORM_QC_NO}, + {0x1E05B, UNICODE_NORM_QC_NO}, + {0x1E05C, UNICODE_NORM_QC_NO}, + {0x1E05D, UNICODE_NORM_QC_NO}, + {0x1E05E, UNICODE_NORM_QC_NO}, + {0x1E05F, UNICODE_NORM_QC_NO}, + {0x1E060, UNICODE_NORM_QC_NO}, + {0x1E061, UNICODE_NORM_QC_NO}, + {0x1E062, UNICODE_NORM_QC_NO}, + {0x1E063, UNICODE_NORM_QC_NO}, + {0x1E064, UNICODE_NORM_QC_NO}, + {0x1E065, UNICODE_NORM_QC_NO}, + {0x1E066, UNICODE_NORM_QC_NO}, + {0x1E067, UNICODE_NORM_QC_NO}, + {0x1E068, UNICODE_NORM_QC_NO}, + {0x1E069, UNICODE_NORM_QC_NO}, + {0x1E06A, UNICODE_NORM_QC_NO}, + {0x1E06B, UNICODE_NORM_QC_NO}, + {0x1E06C, UNICODE_NORM_QC_NO}, + {0x1E06D, UNICODE_NORM_QC_NO}, + {0x1EE00, UNICODE_NORM_QC_NO}, + {0x1EE01, UNICODE_NORM_QC_NO}, + {0x1EE02, UNICODE_NORM_QC_NO}, + {0x1EE03, UNICODE_NORM_QC_NO}, + {0x1EE05, UNICODE_NORM_QC_NO}, + {0x1EE06, UNICODE_NORM_QC_NO}, + {0x1EE07, UNICODE_NORM_QC_NO}, + {0x1EE08, UNICODE_NORM_QC_NO}, + {0x1EE09, UNICODE_NORM_QC_NO}, + {0x1EE0A, UNICODE_NORM_QC_NO}, + {0x1EE0B, UNICODE_NORM_QC_NO}, + {0x1EE0C, UNICODE_NORM_QC_NO}, + {0x1EE0D, UNICODE_NORM_QC_NO}, + {0x1EE0E, UNICODE_NORM_QC_NO}, + {0x1EE0F, UNICODE_NORM_QC_NO}, + {0x1EE10, UNICODE_NORM_QC_NO}, + {0x1EE11, UNICODE_NORM_QC_NO}, + {0x1EE12, UNICODE_NORM_QC_NO}, + {0x1EE13, UNICODE_NORM_QC_NO}, + {0x1EE14, UNICODE_NORM_QC_NO}, + {0x1EE15, UNICODE_NORM_QC_NO}, + {0x1EE16, UNICODE_NORM_QC_NO}, + {0x1EE17, UNICODE_NORM_QC_NO}, + {0x1EE18, UNICODE_NORM_QC_NO}, + {0x1EE19, UNICODE_NORM_QC_NO}, + {0x1EE1A, UNICODE_NORM_QC_NO}, + {0x1EE1B, UNICODE_NORM_QC_NO}, + {0x1EE1C, UNICODE_NORM_QC_NO}, + {0x1EE1D, UNICODE_NORM_QC_NO}, + {0x1EE1E, UNICODE_NORM_QC_NO}, + {0x1EE1F, UNICODE_NORM_QC_NO}, + {0x1EE21, UNICODE_NORM_QC_NO}, + {0x1EE22, UNICODE_NORM_QC_NO}, + {0x1EE24, UNICODE_NORM_QC_NO}, + {0x1EE27, UNICODE_NORM_QC_NO}, + {0x1EE29, UNICODE_NORM_QC_NO}, + {0x1EE2A, UNICODE_NORM_QC_NO}, + {0x1EE2B, UNICODE_NORM_QC_NO}, + {0x1EE2C, UNICODE_NORM_QC_NO}, + {0x1EE2D, UNICODE_NORM_QC_NO}, + {0x1EE2E, UNICODE_NORM_QC_NO}, + {0x1EE2F, UNICODE_NORM_QC_NO}, + {0x1EE30, UNICODE_NORM_QC_NO}, + {0x1EE31, UNICODE_NORM_QC_NO}, + {0x1EE32, UNICODE_NORM_QC_NO}, + {0x1EE34, UNICODE_NORM_QC_NO}, + {0x1EE35, UNICODE_NORM_QC_NO}, + {0x1EE36, UNICODE_NORM_QC_NO}, + {0x1EE37, UNICODE_NORM_QC_NO}, + {0x1EE39, UNICODE_NORM_QC_NO}, + {0x1EE3B, UNICODE_NORM_QC_NO}, + {0x1EE42, UNICODE_NORM_QC_NO}, + {0x1EE47, UNICODE_NORM_QC_NO}, + {0x1EE49, UNICODE_NORM_QC_NO}, + {0x1EE4B, UNICODE_NORM_QC_NO}, + {0x1EE4D, UNICODE_NORM_QC_NO}, + {0x1EE4E, UNICODE_NORM_QC_NO}, + {0x1EE4F, UNICODE_NORM_QC_NO}, + {0x1EE51, UNICODE_NORM_QC_NO}, + {0x1EE52, UNICODE_NORM_QC_NO}, + {0x1EE54, UNICODE_NORM_QC_NO}, + {0x1EE57, UNICODE_NORM_QC_NO}, + {0x1EE59, UNICODE_NORM_QC_NO}, + {0x1EE5B, UNICODE_NORM_QC_NO}, + {0x1EE5D, UNICODE_NORM_QC_NO}, + {0x1EE5F, UNICODE_NORM_QC_NO}, + {0x1EE61, UNICODE_NORM_QC_NO}, + {0x1EE62, UNICODE_NORM_QC_NO}, + {0x1EE64, UNICODE_NORM_QC_NO}, + {0x1EE67, UNICODE_NORM_QC_NO}, + {0x1EE68, UNICODE_NORM_QC_NO}, + {0x1EE69, UNICODE_NORM_QC_NO}, + {0x1EE6A, UNICODE_NORM_QC_NO}, + {0x1EE6C, UNICODE_NORM_QC_NO}, + {0x1EE6D, UNICODE_NORM_QC_NO}, + {0x1EE6E, UNICODE_NORM_QC_NO}, + {0x1EE6F, UNICODE_NORM_QC_NO}, + {0x1EE70, UNICODE_NORM_QC_NO}, + {0x1EE71, UNICODE_NORM_QC_NO}, + {0x1EE72, UNICODE_NORM_QC_NO}, + {0x1EE74, UNICODE_NORM_QC_NO}, + {0x1EE75, UNICODE_NORM_QC_NO}, + {0x1EE76, UNICODE_NORM_QC_NO}, + {0x1EE77, UNICODE_NORM_QC_NO}, + {0x1EE79, UNICODE_NORM_QC_NO}, + {0x1EE7A, UNICODE_NORM_QC_NO}, + {0x1EE7B, UNICODE_NORM_QC_NO}, + {0x1EE7C, UNICODE_NORM_QC_NO}, + {0x1EE7E, UNICODE_NORM_QC_NO}, + {0x1EE80, UNICODE_NORM_QC_NO}, + {0x1EE81, UNICODE_NORM_QC_NO}, + {0x1EE82, UNICODE_NORM_QC_NO}, + {0x1EE83, UNICODE_NORM_QC_NO}, + {0x1EE84, UNICODE_NORM_QC_NO}, + {0x1EE85, UNICODE_NORM_QC_NO}, + {0x1EE86, UNICODE_NORM_QC_NO}, + {0x1EE87, UNICODE_NORM_QC_NO}, + {0x1EE88, UNICODE_NORM_QC_NO}, + {0x1EE89, UNICODE_NORM_QC_NO}, + {0x1EE8B, UNICODE_NORM_QC_NO}, + {0x1EE8C, UNICODE_NORM_QC_NO}, + {0x1EE8D, UNICODE_NORM_QC_NO}, + {0x1EE8E, UNICODE_NORM_QC_NO}, + {0x1EE8F, UNICODE_NORM_QC_NO}, + {0x1EE90, UNICODE_NORM_QC_NO}, + {0x1EE91, UNICODE_NORM_QC_NO}, + {0x1EE92, UNICODE_NORM_QC_NO}, + {0x1EE93, UNICODE_NORM_QC_NO}, + {0x1EE94, UNICODE_NORM_QC_NO}, + {0x1EE95, UNICODE_NORM_QC_NO}, + {0x1EE96, UNICODE_NORM_QC_NO}, + {0x1EE97, UNICODE_NORM_QC_NO}, + {0x1EE98, UNICODE_NORM_QC_NO}, + {0x1EE99, UNICODE_NORM_QC_NO}, + {0x1EE9A, UNICODE_NORM_QC_NO}, + {0x1EE9B, UNICODE_NORM_QC_NO}, + {0x1EEA1, UNICODE_NORM_QC_NO}, + {0x1EEA2, UNICODE_NORM_QC_NO}, + {0x1EEA3, UNICODE_NORM_QC_NO}, + {0x1EEA5, UNICODE_NORM_QC_NO}, + {0x1EEA6, UNICODE_NORM_QC_NO}, + {0x1EEA7, UNICODE_NORM_QC_NO}, + {0x1EEA8, UNICODE_NORM_QC_NO}, + {0x1EEA9, UNICODE_NORM_QC_NO}, + {0x1EEAB, UNICODE_NORM_QC_NO}, + {0x1EEAC, UNICODE_NORM_QC_NO}, + {0x1EEAD, UNICODE_NORM_QC_NO}, + {0x1EEAE, UNICODE_NORM_QC_NO}, + {0x1EEAF, UNICODE_NORM_QC_NO}, + {0x1EEB0, UNICODE_NORM_QC_NO}, + {0x1EEB1, UNICODE_NORM_QC_NO}, + {0x1EEB2, UNICODE_NORM_QC_NO}, + {0x1EEB3, UNICODE_NORM_QC_NO}, + {0x1EEB4, UNICODE_NORM_QC_NO}, + {0x1EEB5, UNICODE_NORM_QC_NO}, + {0x1EEB6, UNICODE_NORM_QC_NO}, + {0x1EEB7, UNICODE_NORM_QC_NO}, + {0x1EEB8, UNICODE_NORM_QC_NO}, + {0x1EEB9, UNICODE_NORM_QC_NO}, + {0x1EEBA, UNICODE_NORM_QC_NO}, + {0x1EEBB, UNICODE_NORM_QC_NO}, + {0x1F100, UNICODE_NORM_QC_NO}, + {0x1F101, UNICODE_NORM_QC_NO}, + {0x1F102, UNICODE_NORM_QC_NO}, + {0x1F103, UNICODE_NORM_QC_NO}, + {0x1F104, UNICODE_NORM_QC_NO}, + {0x1F105, UNICODE_NORM_QC_NO}, + {0x1F106, UNICODE_NORM_QC_NO}, + {0x1F107, UNICODE_NORM_QC_NO}, + {0x1F108, UNICODE_NORM_QC_NO}, + {0x1F109, UNICODE_NORM_QC_NO}, + {0x1F10A, UNICODE_NORM_QC_NO}, + {0x1F110, UNICODE_NORM_QC_NO}, + {0x1F111, UNICODE_NORM_QC_NO}, + {0x1F112, UNICODE_NORM_QC_NO}, + {0x1F113, UNICODE_NORM_QC_NO}, + {0x1F114, UNICODE_NORM_QC_NO}, + {0x1F115, UNICODE_NORM_QC_NO}, + {0x1F116, UNICODE_NORM_QC_NO}, + {0x1F117, UNICODE_NORM_QC_NO}, + {0x1F118, UNICODE_NORM_QC_NO}, + {0x1F119, UNICODE_NORM_QC_NO}, + {0x1F11A, UNICODE_NORM_QC_NO}, + {0x1F11B, UNICODE_NORM_QC_NO}, + {0x1F11C, UNICODE_NORM_QC_NO}, + {0x1F11D, UNICODE_NORM_QC_NO}, + {0x1F11E, UNICODE_NORM_QC_NO}, + {0x1F11F, UNICODE_NORM_QC_NO}, + {0x1F120, UNICODE_NORM_QC_NO}, + {0x1F121, UNICODE_NORM_QC_NO}, + {0x1F122, UNICODE_NORM_QC_NO}, + {0x1F123, UNICODE_NORM_QC_NO}, + {0x1F124, UNICODE_NORM_QC_NO}, + {0x1F125, UNICODE_NORM_QC_NO}, + {0x1F126, UNICODE_NORM_QC_NO}, + {0x1F127, UNICODE_NORM_QC_NO}, + {0x1F128, UNICODE_NORM_QC_NO}, + {0x1F129, UNICODE_NORM_QC_NO}, + {0x1F12A, UNICODE_NORM_QC_NO}, + {0x1F12B, UNICODE_NORM_QC_NO}, + {0x1F12C, UNICODE_NORM_QC_NO}, + {0x1F12D, UNICODE_NORM_QC_NO}, + {0x1F12E, UNICODE_NORM_QC_NO}, + {0x1F130, UNICODE_NORM_QC_NO}, + {0x1F131, UNICODE_NORM_QC_NO}, + {0x1F132, UNICODE_NORM_QC_NO}, + {0x1F133, UNICODE_NORM_QC_NO}, + {0x1F134, UNICODE_NORM_QC_NO}, + {0x1F135, UNICODE_NORM_QC_NO}, + {0x1F136, UNICODE_NORM_QC_NO}, + {0x1F137, UNICODE_NORM_QC_NO}, + {0x1F138, UNICODE_NORM_QC_NO}, + {0x1F139, UNICODE_NORM_QC_NO}, + {0x1F13A, UNICODE_NORM_QC_NO}, + {0x1F13B, UNICODE_NORM_QC_NO}, + {0x1F13C, UNICODE_NORM_QC_NO}, + {0x1F13D, UNICODE_NORM_QC_NO}, + {0x1F13E, UNICODE_NORM_QC_NO}, + {0x1F13F, UNICODE_NORM_QC_NO}, + {0x1F140, UNICODE_NORM_QC_NO}, + {0x1F141, UNICODE_NORM_QC_NO}, + {0x1F142, UNICODE_NORM_QC_NO}, + {0x1F143, UNICODE_NORM_QC_NO}, + {0x1F144, UNICODE_NORM_QC_NO}, + {0x1F145, UNICODE_NORM_QC_NO}, + {0x1F146, UNICODE_NORM_QC_NO}, + {0x1F147, UNICODE_NORM_QC_NO}, + {0x1F148, UNICODE_NORM_QC_NO}, + {0x1F149, UNICODE_NORM_QC_NO}, + {0x1F14A, UNICODE_NORM_QC_NO}, + {0x1F14B, UNICODE_NORM_QC_NO}, + {0x1F14C, UNICODE_NORM_QC_NO}, + {0x1F14D, UNICODE_NORM_QC_NO}, + {0x1F14E, UNICODE_NORM_QC_NO}, + {0x1F14F, UNICODE_NORM_QC_NO}, + {0x1F16A, UNICODE_NORM_QC_NO}, + {0x1F16B, UNICODE_NORM_QC_NO}, + {0x1F16C, UNICODE_NORM_QC_NO}, + {0x1F190, UNICODE_NORM_QC_NO}, + {0x1F200, UNICODE_NORM_QC_NO}, + {0x1F201, UNICODE_NORM_QC_NO}, + {0x1F202, UNICODE_NORM_QC_NO}, + {0x1F210, UNICODE_NORM_QC_NO}, + {0x1F211, UNICODE_NORM_QC_NO}, + {0x1F212, UNICODE_NORM_QC_NO}, + {0x1F213, UNICODE_NORM_QC_NO}, + {0x1F214, UNICODE_NORM_QC_NO}, + {0x1F215, UNICODE_NORM_QC_NO}, + {0x1F216, UNICODE_NORM_QC_NO}, + {0x1F217, UNICODE_NORM_QC_NO}, + {0x1F218, UNICODE_NORM_QC_NO}, + {0x1F219, UNICODE_NORM_QC_NO}, + {0x1F21A, UNICODE_NORM_QC_NO}, + {0x1F21B, UNICODE_NORM_QC_NO}, + {0x1F21C, UNICODE_NORM_QC_NO}, + {0x1F21D, UNICODE_NORM_QC_NO}, + {0x1F21E, UNICODE_NORM_QC_NO}, + {0x1F21F, UNICODE_NORM_QC_NO}, + {0x1F220, UNICODE_NORM_QC_NO}, + {0x1F221, UNICODE_NORM_QC_NO}, + {0x1F222, UNICODE_NORM_QC_NO}, + {0x1F223, UNICODE_NORM_QC_NO}, + {0x1F224, UNICODE_NORM_QC_NO}, + {0x1F225, UNICODE_NORM_QC_NO}, + {0x1F226, UNICODE_NORM_QC_NO}, + {0x1F227, UNICODE_NORM_QC_NO}, + {0x1F228, UNICODE_NORM_QC_NO}, + {0x1F229, UNICODE_NORM_QC_NO}, + {0x1F22A, UNICODE_NORM_QC_NO}, + {0x1F22B, UNICODE_NORM_QC_NO}, + {0x1F22C, UNICODE_NORM_QC_NO}, + {0x1F22D, UNICODE_NORM_QC_NO}, + {0x1F22E, UNICODE_NORM_QC_NO}, + {0x1F22F, UNICODE_NORM_QC_NO}, + {0x1F230, UNICODE_NORM_QC_NO}, + {0x1F231, UNICODE_NORM_QC_NO}, + {0x1F232, UNICODE_NORM_QC_NO}, + {0x1F233, UNICODE_NORM_QC_NO}, + {0x1F234, UNICODE_NORM_QC_NO}, + {0x1F235, UNICODE_NORM_QC_NO}, + {0x1F236, UNICODE_NORM_QC_NO}, + {0x1F237, UNICODE_NORM_QC_NO}, + {0x1F238, UNICODE_NORM_QC_NO}, + {0x1F239, UNICODE_NORM_QC_NO}, + {0x1F23A, UNICODE_NORM_QC_NO}, + {0x1F23B, UNICODE_NORM_QC_NO}, + {0x1F240, UNICODE_NORM_QC_NO}, + {0x1F241, UNICODE_NORM_QC_NO}, + {0x1F242, UNICODE_NORM_QC_NO}, + {0x1F243, UNICODE_NORM_QC_NO}, + {0x1F244, UNICODE_NORM_QC_NO}, + {0x1F245, UNICODE_NORM_QC_NO}, + {0x1F246, UNICODE_NORM_QC_NO}, + {0x1F247, UNICODE_NORM_QC_NO}, + {0x1F248, UNICODE_NORM_QC_NO}, + {0x1F250, UNICODE_NORM_QC_NO}, + {0x1F251, UNICODE_NORM_QC_NO}, + {0x1FBF0, UNICODE_NORM_QC_NO}, + {0x1FBF1, UNICODE_NORM_QC_NO}, + {0x1FBF2, UNICODE_NORM_QC_NO}, + {0x1FBF3, UNICODE_NORM_QC_NO}, + {0x1FBF4, UNICODE_NORM_QC_NO}, + {0x1FBF5, UNICODE_NORM_QC_NO}, + {0x1FBF6, UNICODE_NORM_QC_NO}, + {0x1FBF7, UNICODE_NORM_QC_NO}, + {0x1FBF8, UNICODE_NORM_QC_NO}, + {0x1FBF9, UNICODE_NORM_QC_NO}, + {0x2F800, UNICODE_NORM_QC_NO}, + {0x2F801, UNICODE_NORM_QC_NO}, + {0x2F802, UNICODE_NORM_QC_NO}, + {0x2F803, UNICODE_NORM_QC_NO}, + {0x2F804, UNICODE_NORM_QC_NO}, + {0x2F805, UNICODE_NORM_QC_NO}, + {0x2F806, UNICODE_NORM_QC_NO}, + {0x2F807, UNICODE_NORM_QC_NO}, + {0x2F808, UNICODE_NORM_QC_NO}, + {0x2F809, UNICODE_NORM_QC_NO}, + {0x2F80A, UNICODE_NORM_QC_NO}, + {0x2F80B, UNICODE_NORM_QC_NO}, + {0x2F80C, UNICODE_NORM_QC_NO}, + {0x2F80D, UNICODE_NORM_QC_NO}, + {0x2F80E, UNICODE_NORM_QC_NO}, + {0x2F80F, UNICODE_NORM_QC_NO}, + {0x2F810, UNICODE_NORM_QC_NO}, + {0x2F811, UNICODE_NORM_QC_NO}, + {0x2F812, UNICODE_NORM_QC_NO}, + {0x2F813, UNICODE_NORM_QC_NO}, + {0x2F814, UNICODE_NORM_QC_NO}, + {0x2F815, UNICODE_NORM_QC_NO}, + {0x2F816, UNICODE_NORM_QC_NO}, + {0x2F817, UNICODE_NORM_QC_NO}, + {0x2F818, UNICODE_NORM_QC_NO}, + {0x2F819, UNICODE_NORM_QC_NO}, + {0x2F81A, UNICODE_NORM_QC_NO}, + {0x2F81B, UNICODE_NORM_QC_NO}, + {0x2F81C, UNICODE_NORM_QC_NO}, + {0x2F81D, UNICODE_NORM_QC_NO}, + {0x2F81E, UNICODE_NORM_QC_NO}, + {0x2F81F, UNICODE_NORM_QC_NO}, + {0x2F820, UNICODE_NORM_QC_NO}, + {0x2F821, UNICODE_NORM_QC_NO}, + {0x2F822, UNICODE_NORM_QC_NO}, + {0x2F823, UNICODE_NORM_QC_NO}, + {0x2F824, UNICODE_NORM_QC_NO}, + {0x2F825, UNICODE_NORM_QC_NO}, + {0x2F826, UNICODE_NORM_QC_NO}, + {0x2F827, UNICODE_NORM_QC_NO}, + {0x2F828, UNICODE_NORM_QC_NO}, + {0x2F829, UNICODE_NORM_QC_NO}, + {0x2F82A, UNICODE_NORM_QC_NO}, + {0x2F82B, UNICODE_NORM_QC_NO}, + {0x2F82C, UNICODE_NORM_QC_NO}, + {0x2F82D, UNICODE_NORM_QC_NO}, + {0x2F82E, UNICODE_NORM_QC_NO}, + {0x2F82F, UNICODE_NORM_QC_NO}, + {0x2F830, UNICODE_NORM_QC_NO}, + {0x2F831, UNICODE_NORM_QC_NO}, + {0x2F832, UNICODE_NORM_QC_NO}, + {0x2F833, UNICODE_NORM_QC_NO}, + {0x2F834, UNICODE_NORM_QC_NO}, + {0x2F835, UNICODE_NORM_QC_NO}, + {0x2F836, UNICODE_NORM_QC_NO}, + {0x2F837, UNICODE_NORM_QC_NO}, + {0x2F838, UNICODE_NORM_QC_NO}, + {0x2F839, UNICODE_NORM_QC_NO}, + {0x2F83A, UNICODE_NORM_QC_NO}, + {0x2F83B, UNICODE_NORM_QC_NO}, + {0x2F83C, UNICODE_NORM_QC_NO}, + {0x2F83D, UNICODE_NORM_QC_NO}, + {0x2F83E, UNICODE_NORM_QC_NO}, + {0x2F83F, UNICODE_NORM_QC_NO}, + {0x2F840, UNICODE_NORM_QC_NO}, + {0x2F841, UNICODE_NORM_QC_NO}, + {0x2F842, UNICODE_NORM_QC_NO}, + {0x2F843, UNICODE_NORM_QC_NO}, + {0x2F844, UNICODE_NORM_QC_NO}, + {0x2F845, UNICODE_NORM_QC_NO}, + {0x2F846, UNICODE_NORM_QC_NO}, + {0x2F847, UNICODE_NORM_QC_NO}, + {0x2F848, UNICODE_NORM_QC_NO}, + {0x2F849, UNICODE_NORM_QC_NO}, + {0x2F84A, UNICODE_NORM_QC_NO}, + {0x2F84B, UNICODE_NORM_QC_NO}, + {0x2F84C, UNICODE_NORM_QC_NO}, + {0x2F84D, UNICODE_NORM_QC_NO}, + {0x2F84E, UNICODE_NORM_QC_NO}, + {0x2F84F, UNICODE_NORM_QC_NO}, + {0x2F850, UNICODE_NORM_QC_NO}, + {0x2F851, UNICODE_NORM_QC_NO}, + {0x2F852, UNICODE_NORM_QC_NO}, + {0x2F853, UNICODE_NORM_QC_NO}, + {0x2F854, UNICODE_NORM_QC_NO}, + {0x2F855, UNICODE_NORM_QC_NO}, + {0x2F856, UNICODE_NORM_QC_NO}, + {0x2F857, UNICODE_NORM_QC_NO}, + {0x2F858, UNICODE_NORM_QC_NO}, + {0x2F859, UNICODE_NORM_QC_NO}, + {0x2F85A, UNICODE_NORM_QC_NO}, + {0x2F85B, UNICODE_NORM_QC_NO}, + {0x2F85C, UNICODE_NORM_QC_NO}, + {0x2F85D, UNICODE_NORM_QC_NO}, + {0x2F85E, UNICODE_NORM_QC_NO}, + {0x2F85F, UNICODE_NORM_QC_NO}, + {0x2F860, UNICODE_NORM_QC_NO}, + {0x2F861, UNICODE_NORM_QC_NO}, + {0x2F862, UNICODE_NORM_QC_NO}, + {0x2F863, UNICODE_NORM_QC_NO}, + {0x2F864, UNICODE_NORM_QC_NO}, + {0x2F865, UNICODE_NORM_QC_NO}, + {0x2F866, UNICODE_NORM_QC_NO}, + {0x2F867, UNICODE_NORM_QC_NO}, + {0x2F868, UNICODE_NORM_QC_NO}, + {0x2F869, UNICODE_NORM_QC_NO}, + {0x2F86A, UNICODE_NORM_QC_NO}, + {0x2F86B, UNICODE_NORM_QC_NO}, + {0x2F86C, UNICODE_NORM_QC_NO}, + {0x2F86D, UNICODE_NORM_QC_NO}, + {0x2F86E, UNICODE_NORM_QC_NO}, + {0x2F86F, UNICODE_NORM_QC_NO}, + {0x2F870, UNICODE_NORM_QC_NO}, + {0x2F871, UNICODE_NORM_QC_NO}, + {0x2F872, UNICODE_NORM_QC_NO}, + {0x2F873, UNICODE_NORM_QC_NO}, + {0x2F874, UNICODE_NORM_QC_NO}, + {0x2F875, UNICODE_NORM_QC_NO}, + {0x2F876, UNICODE_NORM_QC_NO}, + {0x2F877, UNICODE_NORM_QC_NO}, + {0x2F878, UNICODE_NORM_QC_NO}, + {0x2F879, UNICODE_NORM_QC_NO}, + {0x2F87A, UNICODE_NORM_QC_NO}, + {0x2F87B, UNICODE_NORM_QC_NO}, + {0x2F87C, UNICODE_NORM_QC_NO}, + {0x2F87D, UNICODE_NORM_QC_NO}, + {0x2F87E, UNICODE_NORM_QC_NO}, + {0x2F87F, UNICODE_NORM_QC_NO}, + {0x2F880, UNICODE_NORM_QC_NO}, + {0x2F881, UNICODE_NORM_QC_NO}, + {0x2F882, UNICODE_NORM_QC_NO}, + {0x2F883, UNICODE_NORM_QC_NO}, + {0x2F884, UNICODE_NORM_QC_NO}, + {0x2F885, UNICODE_NORM_QC_NO}, + {0x2F886, UNICODE_NORM_QC_NO}, + {0x2F887, UNICODE_NORM_QC_NO}, + {0x2F888, UNICODE_NORM_QC_NO}, + {0x2F889, UNICODE_NORM_QC_NO}, + {0x2F88A, UNICODE_NORM_QC_NO}, + {0x2F88B, UNICODE_NORM_QC_NO}, + {0x2F88C, UNICODE_NORM_QC_NO}, + {0x2F88D, UNICODE_NORM_QC_NO}, + {0x2F88E, UNICODE_NORM_QC_NO}, + {0x2F88F, UNICODE_NORM_QC_NO}, + {0x2F890, UNICODE_NORM_QC_NO}, + {0x2F891, UNICODE_NORM_QC_NO}, + {0x2F892, UNICODE_NORM_QC_NO}, + {0x2F893, UNICODE_NORM_QC_NO}, + {0x2F894, UNICODE_NORM_QC_NO}, + {0x2F895, UNICODE_NORM_QC_NO}, + {0x2F896, UNICODE_NORM_QC_NO}, + {0x2F897, UNICODE_NORM_QC_NO}, + {0x2F898, UNICODE_NORM_QC_NO}, + {0x2F899, UNICODE_NORM_QC_NO}, + {0x2F89A, UNICODE_NORM_QC_NO}, + {0x2F89B, UNICODE_NORM_QC_NO}, + {0x2F89C, UNICODE_NORM_QC_NO}, + {0x2F89D, UNICODE_NORM_QC_NO}, + {0x2F89E, UNICODE_NORM_QC_NO}, + {0x2F89F, UNICODE_NORM_QC_NO}, + {0x2F8A0, UNICODE_NORM_QC_NO}, + {0x2F8A1, UNICODE_NORM_QC_NO}, + {0x2F8A2, UNICODE_NORM_QC_NO}, + {0x2F8A3, UNICODE_NORM_QC_NO}, + {0x2F8A4, UNICODE_NORM_QC_NO}, + {0x2F8A5, UNICODE_NORM_QC_NO}, + {0x2F8A6, UNICODE_NORM_QC_NO}, + {0x2F8A7, UNICODE_NORM_QC_NO}, + {0x2F8A8, UNICODE_NORM_QC_NO}, + {0x2F8A9, UNICODE_NORM_QC_NO}, + {0x2F8AA, UNICODE_NORM_QC_NO}, + {0x2F8AB, UNICODE_NORM_QC_NO}, + {0x2F8AC, UNICODE_NORM_QC_NO}, + {0x2F8AD, UNICODE_NORM_QC_NO}, + {0x2F8AE, UNICODE_NORM_QC_NO}, + {0x2F8AF, UNICODE_NORM_QC_NO}, + {0x2F8B0, UNICODE_NORM_QC_NO}, + {0x2F8B1, UNICODE_NORM_QC_NO}, + {0x2F8B2, UNICODE_NORM_QC_NO}, + {0x2F8B3, UNICODE_NORM_QC_NO}, + {0x2F8B4, UNICODE_NORM_QC_NO}, + {0x2F8B5, UNICODE_NORM_QC_NO}, + {0x2F8B6, UNICODE_NORM_QC_NO}, + {0x2F8B7, UNICODE_NORM_QC_NO}, + {0x2F8B8, UNICODE_NORM_QC_NO}, + {0x2F8B9, UNICODE_NORM_QC_NO}, + {0x2F8BA, UNICODE_NORM_QC_NO}, + {0x2F8BB, UNICODE_NORM_QC_NO}, + {0x2F8BC, UNICODE_NORM_QC_NO}, + {0x2F8BD, UNICODE_NORM_QC_NO}, + {0x2F8BE, UNICODE_NORM_QC_NO}, + {0x2F8BF, UNICODE_NORM_QC_NO}, + {0x2F8C0, UNICODE_NORM_QC_NO}, + {0x2F8C1, UNICODE_NORM_QC_NO}, + {0x2F8C2, UNICODE_NORM_QC_NO}, + {0x2F8C3, UNICODE_NORM_QC_NO}, + {0x2F8C4, UNICODE_NORM_QC_NO}, + {0x2F8C5, UNICODE_NORM_QC_NO}, + {0x2F8C6, UNICODE_NORM_QC_NO}, + {0x2F8C7, UNICODE_NORM_QC_NO}, + {0x2F8C8, UNICODE_NORM_QC_NO}, + {0x2F8C9, UNICODE_NORM_QC_NO}, + {0x2F8CA, UNICODE_NORM_QC_NO}, + {0x2F8CB, UNICODE_NORM_QC_NO}, + {0x2F8CC, UNICODE_NORM_QC_NO}, + {0x2F8CD, UNICODE_NORM_QC_NO}, + {0x2F8CE, UNICODE_NORM_QC_NO}, + {0x2F8CF, UNICODE_NORM_QC_NO}, + {0x2F8D0, UNICODE_NORM_QC_NO}, + {0x2F8D1, UNICODE_NORM_QC_NO}, + {0x2F8D2, UNICODE_NORM_QC_NO}, + {0x2F8D3, UNICODE_NORM_QC_NO}, + {0x2F8D4, UNICODE_NORM_QC_NO}, + {0x2F8D5, UNICODE_NORM_QC_NO}, + {0x2F8D6, UNICODE_NORM_QC_NO}, + {0x2F8D7, UNICODE_NORM_QC_NO}, + {0x2F8D8, UNICODE_NORM_QC_NO}, + {0x2F8D9, UNICODE_NORM_QC_NO}, + {0x2F8DA, UNICODE_NORM_QC_NO}, + {0x2F8DB, UNICODE_NORM_QC_NO}, + {0x2F8DC, UNICODE_NORM_QC_NO}, + {0x2F8DD, UNICODE_NORM_QC_NO}, + {0x2F8DE, UNICODE_NORM_QC_NO}, + {0x2F8DF, UNICODE_NORM_QC_NO}, + {0x2F8E0, UNICODE_NORM_QC_NO}, + {0x2F8E1, UNICODE_NORM_QC_NO}, + {0x2F8E2, UNICODE_NORM_QC_NO}, + {0x2F8E3, UNICODE_NORM_QC_NO}, + {0x2F8E4, UNICODE_NORM_QC_NO}, + {0x2F8E5, UNICODE_NORM_QC_NO}, + {0x2F8E6, UNICODE_NORM_QC_NO}, + {0x2F8E7, UNICODE_NORM_QC_NO}, + {0x2F8E8, UNICODE_NORM_QC_NO}, + {0x2F8E9, UNICODE_NORM_QC_NO}, + {0x2F8EA, UNICODE_NORM_QC_NO}, + {0x2F8EB, UNICODE_NORM_QC_NO}, + {0x2F8EC, UNICODE_NORM_QC_NO}, + {0x2F8ED, UNICODE_NORM_QC_NO}, + {0x2F8EE, UNICODE_NORM_QC_NO}, + {0x2F8EF, UNICODE_NORM_QC_NO}, + {0x2F8F0, UNICODE_NORM_QC_NO}, + {0x2F8F1, UNICODE_NORM_QC_NO}, + {0x2F8F2, UNICODE_NORM_QC_NO}, + {0x2F8F3, UNICODE_NORM_QC_NO}, + {0x2F8F4, UNICODE_NORM_QC_NO}, + {0x2F8F5, UNICODE_NORM_QC_NO}, + {0x2F8F6, UNICODE_NORM_QC_NO}, + {0x2F8F7, UNICODE_NORM_QC_NO}, + {0x2F8F8, UNICODE_NORM_QC_NO}, + {0x2F8F9, UNICODE_NORM_QC_NO}, + {0x2F8FA, UNICODE_NORM_QC_NO}, + {0x2F8FB, UNICODE_NORM_QC_NO}, + {0x2F8FC, UNICODE_NORM_QC_NO}, + {0x2F8FD, UNICODE_NORM_QC_NO}, + {0x2F8FE, UNICODE_NORM_QC_NO}, + {0x2F8FF, UNICODE_NORM_QC_NO}, + {0x2F900, UNICODE_NORM_QC_NO}, + {0x2F901, UNICODE_NORM_QC_NO}, + {0x2F902, UNICODE_NORM_QC_NO}, + {0x2F903, UNICODE_NORM_QC_NO}, + {0x2F904, UNICODE_NORM_QC_NO}, + {0x2F905, UNICODE_NORM_QC_NO}, + {0x2F906, UNICODE_NORM_QC_NO}, + {0x2F907, UNICODE_NORM_QC_NO}, + {0x2F908, UNICODE_NORM_QC_NO}, + {0x2F909, UNICODE_NORM_QC_NO}, + {0x2F90A, UNICODE_NORM_QC_NO}, + {0x2F90B, UNICODE_NORM_QC_NO}, + {0x2F90C, UNICODE_NORM_QC_NO}, + {0x2F90D, UNICODE_NORM_QC_NO}, + {0x2F90E, UNICODE_NORM_QC_NO}, + {0x2F90F, UNICODE_NORM_QC_NO}, + {0x2F910, UNICODE_NORM_QC_NO}, + {0x2F911, UNICODE_NORM_QC_NO}, + {0x2F912, UNICODE_NORM_QC_NO}, + {0x2F913, UNICODE_NORM_QC_NO}, + {0x2F914, UNICODE_NORM_QC_NO}, + {0x2F915, UNICODE_NORM_QC_NO}, + {0x2F916, UNICODE_NORM_QC_NO}, + {0x2F917, UNICODE_NORM_QC_NO}, + {0x2F918, UNICODE_NORM_QC_NO}, + {0x2F919, UNICODE_NORM_QC_NO}, + {0x2F91A, UNICODE_NORM_QC_NO}, + {0x2F91B, UNICODE_NORM_QC_NO}, + {0x2F91C, UNICODE_NORM_QC_NO}, + {0x2F91D, UNICODE_NORM_QC_NO}, + {0x2F91E, UNICODE_NORM_QC_NO}, + {0x2F91F, UNICODE_NORM_QC_NO}, + {0x2F920, UNICODE_NORM_QC_NO}, + {0x2F921, UNICODE_NORM_QC_NO}, + {0x2F922, UNICODE_NORM_QC_NO}, + {0x2F923, UNICODE_NORM_QC_NO}, + {0x2F924, UNICODE_NORM_QC_NO}, + {0x2F925, UNICODE_NORM_QC_NO}, + {0x2F926, UNICODE_NORM_QC_NO}, + {0x2F927, UNICODE_NORM_QC_NO}, + {0x2F928, UNICODE_NORM_QC_NO}, + {0x2F929, UNICODE_NORM_QC_NO}, + {0x2F92A, UNICODE_NORM_QC_NO}, + {0x2F92B, UNICODE_NORM_QC_NO}, + {0x2F92C, UNICODE_NORM_QC_NO}, + {0x2F92D, UNICODE_NORM_QC_NO}, + {0x2F92E, UNICODE_NORM_QC_NO}, + {0x2F92F, UNICODE_NORM_QC_NO}, + {0x2F930, UNICODE_NORM_QC_NO}, + {0x2F931, UNICODE_NORM_QC_NO}, + {0x2F932, UNICODE_NORM_QC_NO}, + {0x2F933, UNICODE_NORM_QC_NO}, + {0x2F934, UNICODE_NORM_QC_NO}, + {0x2F935, UNICODE_NORM_QC_NO}, + {0x2F936, UNICODE_NORM_QC_NO}, + {0x2F937, UNICODE_NORM_QC_NO}, + {0x2F938, UNICODE_NORM_QC_NO}, + {0x2F939, UNICODE_NORM_QC_NO}, + {0x2F93A, UNICODE_NORM_QC_NO}, + {0x2F93B, UNICODE_NORM_QC_NO}, + {0x2F93C, UNICODE_NORM_QC_NO}, + {0x2F93D, UNICODE_NORM_QC_NO}, + {0x2F93E, UNICODE_NORM_QC_NO}, + {0x2F93F, UNICODE_NORM_QC_NO}, + {0x2F940, UNICODE_NORM_QC_NO}, + {0x2F941, UNICODE_NORM_QC_NO}, + {0x2F942, UNICODE_NORM_QC_NO}, + {0x2F943, UNICODE_NORM_QC_NO}, + {0x2F944, UNICODE_NORM_QC_NO}, + {0x2F945, UNICODE_NORM_QC_NO}, + {0x2F946, UNICODE_NORM_QC_NO}, + {0x2F947, UNICODE_NORM_QC_NO}, + {0x2F948, UNICODE_NORM_QC_NO}, + {0x2F949, UNICODE_NORM_QC_NO}, + {0x2F94A, UNICODE_NORM_QC_NO}, + {0x2F94B, UNICODE_NORM_QC_NO}, + {0x2F94C, UNICODE_NORM_QC_NO}, + {0x2F94D, UNICODE_NORM_QC_NO}, + {0x2F94E, UNICODE_NORM_QC_NO}, + {0x2F94F, UNICODE_NORM_QC_NO}, + {0x2F950, UNICODE_NORM_QC_NO}, + {0x2F951, UNICODE_NORM_QC_NO}, + {0x2F952, UNICODE_NORM_QC_NO}, + {0x2F953, UNICODE_NORM_QC_NO}, + {0x2F954, UNICODE_NORM_QC_NO}, + {0x2F955, UNICODE_NORM_QC_NO}, + {0x2F956, UNICODE_NORM_QC_NO}, + {0x2F957, UNICODE_NORM_QC_NO}, + {0x2F958, UNICODE_NORM_QC_NO}, + {0x2F959, UNICODE_NORM_QC_NO}, + {0x2F95A, UNICODE_NORM_QC_NO}, + {0x2F95B, UNICODE_NORM_QC_NO}, + {0x2F95C, UNICODE_NORM_QC_NO}, + {0x2F95D, UNICODE_NORM_QC_NO}, + {0x2F95E, UNICODE_NORM_QC_NO}, + {0x2F95F, UNICODE_NORM_QC_NO}, + {0x2F960, UNICODE_NORM_QC_NO}, + {0x2F961, UNICODE_NORM_QC_NO}, + {0x2F962, UNICODE_NORM_QC_NO}, + {0x2F963, UNICODE_NORM_QC_NO}, + {0x2F964, UNICODE_NORM_QC_NO}, + {0x2F965, UNICODE_NORM_QC_NO}, + {0x2F966, UNICODE_NORM_QC_NO}, + {0x2F967, UNICODE_NORM_QC_NO}, + {0x2F968, UNICODE_NORM_QC_NO}, + {0x2F969, UNICODE_NORM_QC_NO}, + {0x2F96A, UNICODE_NORM_QC_NO}, + {0x2F96B, UNICODE_NORM_QC_NO}, + {0x2F96C, UNICODE_NORM_QC_NO}, + {0x2F96D, UNICODE_NORM_QC_NO}, + {0x2F96E, UNICODE_NORM_QC_NO}, + {0x2F96F, UNICODE_NORM_QC_NO}, + {0x2F970, UNICODE_NORM_QC_NO}, + {0x2F971, UNICODE_NORM_QC_NO}, + {0x2F972, UNICODE_NORM_QC_NO}, + {0x2F973, UNICODE_NORM_QC_NO}, + {0x2F974, UNICODE_NORM_QC_NO}, + {0x2F975, UNICODE_NORM_QC_NO}, + {0x2F976, UNICODE_NORM_QC_NO}, + {0x2F977, UNICODE_NORM_QC_NO}, + {0x2F978, UNICODE_NORM_QC_NO}, + {0x2F979, UNICODE_NORM_QC_NO}, + {0x2F97A, UNICODE_NORM_QC_NO}, + {0x2F97B, UNICODE_NORM_QC_NO}, + {0x2F97C, UNICODE_NORM_QC_NO}, + {0x2F97D, UNICODE_NORM_QC_NO}, + {0x2F97E, UNICODE_NORM_QC_NO}, + {0x2F97F, UNICODE_NORM_QC_NO}, + {0x2F980, UNICODE_NORM_QC_NO}, + {0x2F981, UNICODE_NORM_QC_NO}, + {0x2F982, UNICODE_NORM_QC_NO}, + {0x2F983, UNICODE_NORM_QC_NO}, + {0x2F984, UNICODE_NORM_QC_NO}, + {0x2F985, UNICODE_NORM_QC_NO}, + {0x2F986, UNICODE_NORM_QC_NO}, + {0x2F987, UNICODE_NORM_QC_NO}, + {0x2F988, UNICODE_NORM_QC_NO}, + {0x2F989, UNICODE_NORM_QC_NO}, + {0x2F98A, UNICODE_NORM_QC_NO}, + {0x2F98B, UNICODE_NORM_QC_NO}, + {0x2F98C, UNICODE_NORM_QC_NO}, + {0x2F98D, UNICODE_NORM_QC_NO}, + {0x2F98E, UNICODE_NORM_QC_NO}, + {0x2F98F, UNICODE_NORM_QC_NO}, + {0x2F990, UNICODE_NORM_QC_NO}, + {0x2F991, UNICODE_NORM_QC_NO}, + {0x2F992, UNICODE_NORM_QC_NO}, + {0x2F993, UNICODE_NORM_QC_NO}, + {0x2F994, UNICODE_NORM_QC_NO}, + {0x2F995, UNICODE_NORM_QC_NO}, + {0x2F996, UNICODE_NORM_QC_NO}, + {0x2F997, UNICODE_NORM_QC_NO}, + {0x2F998, UNICODE_NORM_QC_NO}, + {0x2F999, UNICODE_NORM_QC_NO}, + {0x2F99A, UNICODE_NORM_QC_NO}, + {0x2F99B, UNICODE_NORM_QC_NO}, + {0x2F99C, UNICODE_NORM_QC_NO}, + {0x2F99D, UNICODE_NORM_QC_NO}, + {0x2F99E, UNICODE_NORM_QC_NO}, + {0x2F99F, UNICODE_NORM_QC_NO}, + {0x2F9A0, UNICODE_NORM_QC_NO}, + {0x2F9A1, UNICODE_NORM_QC_NO}, + {0x2F9A2, UNICODE_NORM_QC_NO}, + {0x2F9A3, UNICODE_NORM_QC_NO}, + {0x2F9A4, UNICODE_NORM_QC_NO}, + {0x2F9A5, UNICODE_NORM_QC_NO}, + {0x2F9A6, UNICODE_NORM_QC_NO}, + {0x2F9A7, UNICODE_NORM_QC_NO}, + {0x2F9A8, UNICODE_NORM_QC_NO}, + {0x2F9A9, UNICODE_NORM_QC_NO}, + {0x2F9AA, UNICODE_NORM_QC_NO}, + {0x2F9AB, UNICODE_NORM_QC_NO}, + {0x2F9AC, UNICODE_NORM_QC_NO}, + {0x2F9AD, UNICODE_NORM_QC_NO}, + {0x2F9AE, UNICODE_NORM_QC_NO}, + {0x2F9AF, UNICODE_NORM_QC_NO}, + {0x2F9B0, UNICODE_NORM_QC_NO}, + {0x2F9B1, UNICODE_NORM_QC_NO}, + {0x2F9B2, UNICODE_NORM_QC_NO}, + {0x2F9B3, UNICODE_NORM_QC_NO}, + {0x2F9B4, UNICODE_NORM_QC_NO}, + {0x2F9B5, UNICODE_NORM_QC_NO}, + {0x2F9B6, UNICODE_NORM_QC_NO}, + {0x2F9B7, UNICODE_NORM_QC_NO}, + {0x2F9B8, UNICODE_NORM_QC_NO}, + {0x2F9B9, UNICODE_NORM_QC_NO}, + {0x2F9BA, UNICODE_NORM_QC_NO}, + {0x2F9BB, UNICODE_NORM_QC_NO}, + {0x2F9BC, UNICODE_NORM_QC_NO}, + {0x2F9BD, UNICODE_NORM_QC_NO}, + {0x2F9BE, UNICODE_NORM_QC_NO}, + {0x2F9BF, UNICODE_NORM_QC_NO}, + {0x2F9C0, UNICODE_NORM_QC_NO}, + {0x2F9C1, UNICODE_NORM_QC_NO}, + {0x2F9C2, UNICODE_NORM_QC_NO}, + {0x2F9C3, UNICODE_NORM_QC_NO}, + {0x2F9C4, UNICODE_NORM_QC_NO}, + {0x2F9C5, UNICODE_NORM_QC_NO}, + {0x2F9C6, UNICODE_NORM_QC_NO}, + {0x2F9C7, UNICODE_NORM_QC_NO}, + {0x2F9C8, UNICODE_NORM_QC_NO}, + {0x2F9C9, UNICODE_NORM_QC_NO}, + {0x2F9CA, UNICODE_NORM_QC_NO}, + {0x2F9CB, UNICODE_NORM_QC_NO}, + {0x2F9CC, UNICODE_NORM_QC_NO}, + {0x2F9CD, UNICODE_NORM_QC_NO}, + {0x2F9CE, UNICODE_NORM_QC_NO}, + {0x2F9CF, UNICODE_NORM_QC_NO}, + {0x2F9D0, UNICODE_NORM_QC_NO}, + {0x2F9D1, UNICODE_NORM_QC_NO}, + {0x2F9D2, UNICODE_NORM_QC_NO}, + {0x2F9D3, UNICODE_NORM_QC_NO}, + {0x2F9D4, UNICODE_NORM_QC_NO}, + {0x2F9D5, UNICODE_NORM_QC_NO}, + {0x2F9D6, UNICODE_NORM_QC_NO}, + {0x2F9D7, UNICODE_NORM_QC_NO}, + {0x2F9D8, UNICODE_NORM_QC_NO}, + {0x2F9D9, UNICODE_NORM_QC_NO}, + {0x2F9DA, UNICODE_NORM_QC_NO}, + {0x2F9DB, UNICODE_NORM_QC_NO}, + {0x2F9DC, UNICODE_NORM_QC_NO}, + {0x2F9DD, UNICODE_NORM_QC_NO}, + {0x2F9DE, UNICODE_NORM_QC_NO}, + {0x2F9DF, UNICODE_NORM_QC_NO}, + {0x2F9E0, UNICODE_NORM_QC_NO}, + {0x2F9E1, UNICODE_NORM_QC_NO}, + {0x2F9E2, UNICODE_NORM_QC_NO}, + {0x2F9E3, UNICODE_NORM_QC_NO}, + {0x2F9E4, UNICODE_NORM_QC_NO}, + {0x2F9E5, UNICODE_NORM_QC_NO}, + {0x2F9E6, UNICODE_NORM_QC_NO}, + {0x2F9E7, UNICODE_NORM_QC_NO}, + {0x2F9E8, UNICODE_NORM_QC_NO}, + {0x2F9E9, UNICODE_NORM_QC_NO}, + {0x2F9EA, UNICODE_NORM_QC_NO}, + {0x2F9EB, UNICODE_NORM_QC_NO}, + {0x2F9EC, UNICODE_NORM_QC_NO}, + {0x2F9ED, UNICODE_NORM_QC_NO}, + {0x2F9EE, UNICODE_NORM_QC_NO}, + {0x2F9EF, UNICODE_NORM_QC_NO}, + {0x2F9F0, UNICODE_NORM_QC_NO}, + {0x2F9F1, UNICODE_NORM_QC_NO}, + {0x2F9F2, UNICODE_NORM_QC_NO}, + {0x2F9F3, UNICODE_NORM_QC_NO}, + {0x2F9F4, UNICODE_NORM_QC_NO}, + {0x2F9F5, UNICODE_NORM_QC_NO}, + {0x2F9F6, UNICODE_NORM_QC_NO}, + {0x2F9F7, UNICODE_NORM_QC_NO}, + {0x2F9F8, UNICODE_NORM_QC_NO}, + {0x2F9F9, UNICODE_NORM_QC_NO}, + {0x2F9FA, UNICODE_NORM_QC_NO}, + {0x2F9FB, UNICODE_NORM_QC_NO}, + {0x2F9FC, UNICODE_NORM_QC_NO}, + {0x2F9FD, UNICODE_NORM_QC_NO}, + {0x2F9FE, UNICODE_NORM_QC_NO}, + {0x2F9FF, UNICODE_NORM_QC_NO}, + {0x2FA00, UNICODE_NORM_QC_NO}, + {0x2FA01, UNICODE_NORM_QC_NO}, + {0x2FA02, UNICODE_NORM_QC_NO}, + {0x2FA03, UNICODE_NORM_QC_NO}, + {0x2FA04, UNICODE_NORM_QC_NO}, + {0x2FA05, UNICODE_NORM_QC_NO}, + {0x2FA06, UNICODE_NORM_QC_NO}, + {0x2FA07, UNICODE_NORM_QC_NO}, + {0x2FA08, UNICODE_NORM_QC_NO}, + {0x2FA09, UNICODE_NORM_QC_NO}, + {0x2FA0A, UNICODE_NORM_QC_NO}, + {0x2FA0B, UNICODE_NORM_QC_NO}, + {0x2FA0C, UNICODE_NORM_QC_NO}, + {0x2FA0D, UNICODE_NORM_QC_NO}, + {0x2FA0E, UNICODE_NORM_QC_NO}, + {0x2FA0F, UNICODE_NORM_QC_NO}, + {0x2FA10, UNICODE_NORM_QC_NO}, + {0x2FA11, UNICODE_NORM_QC_NO}, + {0x2FA12, UNICODE_NORM_QC_NO}, + {0x2FA13, UNICODE_NORM_QC_NO}, + {0x2FA14, UNICODE_NORM_QC_NO}, + {0x2FA15, UNICODE_NORM_QC_NO}, + {0x2FA16, UNICODE_NORM_QC_NO}, + {0x2FA17, UNICODE_NORM_QC_NO}, + {0x2FA18, UNICODE_NORM_QC_NO}, + {0x2FA19, UNICODE_NORM_QC_NO}, + {0x2FA1A, UNICODE_NORM_QC_NO}, + {0x2FA1B, UNICODE_NORM_QC_NO}, + {0x2FA1C, UNICODE_NORM_QC_NO}, + {0x2FA1D, UNICODE_NORM_QC_NO}, +}; + +/* Perfect hash function for NFKC_QC */ +static int +NFKC_QC_hash_func(const void *key) +{ + static const int16 h[10079] = { + 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, + 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, + 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, + 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, + 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, + 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, + 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, + 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, + 3606, 3607, 3608, 3970, 3488, 3611, 3612, 3613, + 3614, 3615, 3616, 3617, 3618, 7967, 3620, 3621, + 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, + 3630, 3631, 3632, 3633, 3634, 3512, 3636, 3637, + 3638, 3639, 32767, 11118, 11119, 11120, 11121, 11122, + 1470, 11124, 11125, 11126, 11127, 11128, 11129, 11130, + 11131, 11132, -287, 8773, 8774, 8775, 8776, 8777, + 8778, -287, 8781, 8782, -287, 8783, 8784, 8785, + 8786, 8787, 8788, 8789, 8790, 8791, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, 2372, -287, -287, -287, -287, -287, -287, + -287, -287, -287, 2458, 2458, 2458, 2458, 2458, + 2458, 2458, 2458, 2458, -287, -287, -287, -5017, + 5765, -287, -5019, -5019, -5019, -5019, -287, -287, + 4632, -5021, -5021, -287, -5022, -5022, -5022, 3732, + -287, -287, 3735, 3736, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + 4994, 2491, 2491, -287, -287, -287, 6887, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, 32767, 32767, -289, 1778, 629, 3809, 3810, + -3050, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, -287, -287, -287, -287, -287, -287, + -287, -287, 3861, 3862, 3863, 3864, 3865, 3866, + 3867, 3868, -1002, 3870, 3871, 3872, 3873, 3874, + 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, + 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, + 3891, 3892, 3893, 32767, 3392, 3392, 3392, -5411, + 3392, 3392, 3392, 3392, 3392, 3392, 3392, 3392, + 3392, 3392, 224, 225, 226, 3392, 227, 228, + -5998, -5998, 3392, -5998, -5, 0, -5997, -5997, + -7477, 3923, -7478, -7478, -7478, -7478, -7478, -7478, + -7478, -7478, 2175, -7478, -7478, -7478, -7478, -7478, + -7478, -7478, -7478, -7478, 3942, -5117, -5117, -5117, + -5117, -5117, -5117, 3949, -5118, -5118, 3952, -5117, + -5117, -5117, -5117, -5117, -5117, -5117, -5117, -5117, + 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, + 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, + 3978, 3979, 3980, 1322, 3982, 3983, 3984, 3985, + 3986, 3987, 3988, 3989, 3990, 1246, 1247, 1248, + 1249, 1250, 1251, 1252, 1253, 1254, 4000, 4001, + 4002, 8733, -2048, 4005, 8738, 8739, 8740, 8741, + 4010, 4011, -907, 8747, 8748, 4015, 8751, 8752, + 8753, 0, 4020, 4021, 0, 0, 4024, 4025, + 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, + 4034, 4035, -1245, 1259, 1260, 4039, 4040, 4041, + -3132, 4043, 4044, 4045, 4046, 4047, 4048, 4049, + 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, + 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, + 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, + 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, + 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, + 4090, 4091, 4092, 4093, 4094, 4095, 2029, 3179, + 0, 0, 6861, 4099, 4100, 4101, 4102, 4103, + 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, + 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, + 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, + 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, + 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, + 4144, 4145, 4146, 4147, 0, 0, 0, 0, + 0, 0, 0, 0, 4871, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, -1786, -1785, -1784, -1783, -1782, 5982, + -630, -48, -48, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 677, + 32767, 32767, -636, -635, 1019, -3373, 1019, 1019, + 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, + 1019, 1019, 1019, 1019, 1019, -685, -684, -683, + -682, -681, -6170, -679, -678, 2476, 2477, -6912, + 2479, -3513, 3959, 2482, 2483, 3964, 3965, 3966, + 3967, 3968, 3969, 3970, 3971, 3972, 55, 56, + 2495, 57, 58, 59, 60, 61, 62, 63, + 2503, 2504, 64, 2506, 65, 2508, 66, 67, + 2511, 2512, 32767, 32767, 32767, 32767, 68, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 69, 70, + 71, 72, 73, 74, 1140, 2514, 2515, 422, + 75, 2518, -1594, 556, 557, 2522, 2523, 2524, + 2525, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 422, 422, + 422, 422, 422, 422, 422, 422, 422, -2277, + -2277, -2277, -2277, -2277, 32767, 32767, -2279, -2279, + -2279, -2279, -2279, -2279, -2279, -2279, -2279, 86, + -2279, -2279, -2279, -2279, -2279, 87, -2279, -2279, + -2279, 88, -2279, -2279, -2279, -2279, -2279, 89, + 453, 453, 453, 453, 453, 453, 2609, 453, + 453, 453, 453, 453, 453, 453, 453, 453, + 453, 453, 453, 1817, 453, 453, 453, 453, + 453, 453, 453, 453, 32767, 32767, 32767, 681, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -2319, 2632, -2319, -2319, + -2319, 2636, 2637, 92, 2639, 2640, 95, 96, + 97, 98, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 3279, 3280, 3281, 3282, 3283, 3284, + 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, + -384, -1535, -385, -385, 0, 3298, 3299, 3300, + 3301, 3302, 3303, 3304, -8646, -1149, -1148, -1147, + -1146, 32767, 3310, 3311, 3312, 3313, 3314, -1140, + -1139, -1138, -1137, -1136, -1135, -1134, -1133, -1132, + 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, + 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, + 3340, 3341, 3342, 3343, 3344, -1327, -1327, -1327, + -1327, -1327, 32767, 32767, 2346, 32767, 32767, 32767, + 32767, 32767, 3350, 335, 3245, 8185, 1818, 666, + 1818, 795, 795, 1818, 1818, 1818, 1818, 1818, + -5945, 668, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 0, 0, 671, 671, 671, + 671, 671, 0, 0, 673, 673, 673, 0, + 674, 0, 675, 0, 676, 0, 677, 677, + 677, 32767, 0, 677, 677, -976, 3417, -974, + -973, 678, 678, -972, -971, -970, -969, -968, + 1152, 1153, 1154, 1155, 1156, 0, 1022, 1022, + 5615, -6335, 1162, 1163, 1164, 1165, 5621, 5622, + 5623, 5624, 5625, 5626, 1172, 1173, 1174, 1175, + 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, + 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, + 1192, 1193, 9997, 1195, 1196, 1197, 1198, 1199, + 1200, 1201, 1202, 1203, 1204, 4373, 4373, 4373, + 1208, 4374, 4374, 10601, 10602, 1213, 10604, 4612, + 4608, 10606, 10607, 12088, 1220, 1221, 1222, 1223, + 1224, 1225, 1226, 2453, 2454, 2455, 2456, 2457, + 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, + 2466, 2467, 6860, 2469, 2470, 2471, 2472, 2473, + 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, + 2482, 2483, 2484, 258, 2486, 2487, 258, 258, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 5673, 5674, + 0, 5677, 0, 5680, 5681, 5682, 5683, 5684, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 682, 683, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 105, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 2315, 4754, 2316, 2317, 2318, 2319, 2320, 2321, + 2322, 4762, 4763, 2323, 4765, 2324, 4767, 2325, + 2326, 4770, 4771, 4772, 2377, 4774, 4775, 4776, + 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, + 4785, 4786, 4787, 4788, 4789, 3417, 4791, 4792, + 2699, 2352, 4795, 683, 2833, 2834, 4799, 4800, + 4801, 4802, 2699, 2699, 2699, 2699, 2699, 2699, + 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, + 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, + 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, + 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, + 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 2365, 0, 0, 0, 0, 0, 2366, 0, + 0, 0, 2367, 0, 0, 0, 0, 0, + 2368, 2732, 2732, 2732, 2732, 2732, 2732, 4888, + 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, + 2732, 2732, 2732, 2732, 4096, 2732, 2732, 2732, + 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, + 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, + 2732, 2732, 2732, 2732, 2732, 2732, 4927, 0, + 0, 0, 0, 0, 4933, 0, 0, 0, + 0, -2910, 0, 4940, 4941, 4942, 0, 0, + 0, 0, 0, 0, 0, 0, 4951, 0, + 0, 0, 4955, 4956, 2411, 4958, 4959, 2414, + 2415, 2416, 0, 10954, 0, 3436, 0, 0, + 0, 0, 0, -3170, -3169, -3168, -3167, 3446, + 2865, 0, 0, 0, 0, 0, 2339, 2339, + 2339, 2339, 2339, 2339, 2339, 2339, 2892, 2339, + 0, 0, 0, 0, 0, 0, 2907, 0, + 0, 0, 0, 0, 0, 4719, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 1856, 868, 868, 868, 868, + 868, 868, 868, 868, 868, 868, 868, 1856, + 1856, 1856, 1856, 1856, 873, 873, 873, 873, + 873, 873, 873, 873, 873, 873, 873, 873, + 873, 873, 873, 873, 873, 6441, 6442, 6443, + 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, + 6452, -1169, 6454, 6455, 6456, 6457, 6458, 6459, + 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, + 6468, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, -3334, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -766, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, -1530, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 686, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 687, 688, 689, 690, 691, 692, 693, 694, + 695, 2465, 697, 698, 699, 700, 701, 702, + 703, 704, 705, 2484, 707, 708, 709, 710, + 2493, 712, 713, 714, 715, 2502, 717, 718, + 719, 720, 2511, 722, 723, 724, 725, 726, + 727, 728, 729, 730, 731, 732, 733, 2536, + 735, 736, 737, 738, 739, 740, 741, 742, + 743, 2555, 745, 2558, 2559, 2560, 2561, 2562, + 751, 752, 753, 754, 755, 756, 757, 2577, + 759, 760, 761, 762, 763, 764, 1224, 1224, + 767, 768, 769, 770, 3787, 772, 773, 774, + 775, 776, 777, 778, 779, 780, 781, 782, + 783, 784, 785, 786, 787, 788, 789, 790, + 791, 792, 793, 794, 795, 796, 797, 798, + 799, 800, 801, 802, 803, 804, 805, 806, + 807, 808, 809, 810, 811, 812, 813, 814, + 815, 816, 817, 818, 819, 820, 821, 822, + 823, 824, 825, 826, 827, 828, 829, 830, + 831, 832, 833, 834, 835, 836, 837, 838, + 839, 840, 841, 842, 843, 844, 845, 846, + 847, 848, 849, 850, 851, 852, 853, 854, + 855, 856, 857, 858, 859, 860, 861, 862, + 863, 864, 865, 866, 867, 868, 869, 870, + 871, 872, 873, 874, 875, 876, 877, 878, + 879, 880, 881, 882, 883, 884, 885, 886, + 887, 888, 889, 890, 891, 892, 893, 894, + 895, 896, 897, 898, 899, 900, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 901, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -1268, + 32767, 32767, 32767, 32767, 32767, -984, -984, -2101, + -2101, -2101, -2101, 32767, 3402, 3403, -985, -985, + 32767, 32767, 0, -986, -986, -986, -986, -986, + -986, -986, 32767, -987, -987, -987, -987, -987, + -987, -987, 32767, -988, -988, -988, -988, -1746, + -988, -1747, -1747, -1194, -988, -988, -988, -988, + -988, -988, -988, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32767, + 0, 0, 0, 321, 32767, 0, 0, 0, + 0, 0, 32767, 0, 32767, 32767, 32767, -968, + 0, 0, 0, 0, 0, 0, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 333, 113, 333, 2915, + 333, 333, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -934, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -361, 122, + 0, 0, 0, 0, 0, 0, 0, 0, + -4348, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 123, 0, 0, 0, 0, -3819, -3818, 32767, + 126, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 5367, 5368, 914, 915, 916, + 917, 918, 919, 920, 921, 922, 923, 924, + 925, 926, 927, 928, 929, 930, 931, 932, + 933, 934, 935, 9739, 937, 938, 939, 940, + 941, 942, 943, 944, 945, 946, 4115, 4115, + 4115, 950, 4116, 4116, 10343, 10344, 955, 10346, + 4354, 4350, 10348, 10349, 11830, 962, 963, 964, + 965, 966, 967, 968, 2195, 2196, 2197, 2198, + 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, + 2207, 2208, 2209, 6602, 2211, 2212, 2213, 2214, + 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, + 2223, 2224, 2225, 2226, 0, 2228, 2229, 0, + 0, 2232, 0, 129, 2235, 2236, -260, -260, + 2239, 2240, 2241, 2242, -260, 2244, 2245, 2246, + 2247, 2248, 2249, 2250, 2251, 2252, 2253, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, 2264, 2265, -2259, 2267, 2268, 2269, 2270, + 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, + -2729, 2280, 2281, 2282, 2283, 2284, 2285, 2286, + 2287, 2288, 2289, 2290, 2291, 2292, 3281, 3282, + 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, + 3291, 2304, 2305, 2306, 2307, 2308, 3292, 3293, + 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, + 3302, 3303, 3304, 3305, 3306, 3307, 3308, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, -2259, -2259, 5363, -2259, -2259, -2259, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, 1418, 2570, 1421, 1422, 1038, -2259, -2259, + -2259, -2259, -2259, -2259, -2259, 9692, 2196, 2196, + 2196, 2196, -2259, -2259, -2259, -2259, -2259, -2259, + 2196, 2196, 2196, 2196, 2196, 2196, 2196, 2196, + 2196, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, -2259, -2259, + -2259, -2259, -2259, -2259, -2259, -2259, 2413, 2414, + 2415, 2416, 2417, 2418, 2419, 301, 302, 760, + -2259, -2259, -2259, -2259, 757, -2152, -7091, -723, + 430, -721, 303, 304, -718, -717, -716, -715, + -714, 7050, 438, 1020, 1020, 1020, 1020, 1020, + 1020, 1020, 1020, 1020, 1116, 1117, 447, 448, + 449, 450, 451, 1123, 1124, 452, 453, 454, + 1128, 455, 1130, 456, 1132, 457, 1134, 458, + 459, 460, 461, 1138, 462, 463, 2117, -2275, + 2117, 2117, 467, 468, 2119, 2119, 2119, 2119, + 2119, 0, 0, 0, 0, 0, 1157, 136, + 137, -4455, 7496, 0, 0, 0, 0, -4455, + -4455, -4455, -4455, -4455, -4455, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -8803, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -3168, -3167, + -3166, 0, -3165, -3164, -9390, -9390, 0, -9390, + -3397, -3392, -9389, -9389, -10869,0, 0, 0, + 0, 0, 0, 0, -1226, -1226, -1226, -1226, + -1226, -1226, -1226, -1226, -1226, -1226, -1226, -1226, + -1226, -1226, -1226, -5618, -1226, -1226, -1226, -1226, + -1226, -1226, -1226, -1226, -1226, -1226, -1226, -1226, + -1226, -1226, -1226, -1226, 1001, -1226, -1226, 1004, + 1005, 1264, 1265, 32767, -1229, -1229, 1268, 1269, + -1229, -1229, -1229, -1229, 1274, -1229, -1229, -1229, + -1229, -1229, 139, 1281, 1282, 1283, 1284, 1285, + 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, + 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, + 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, + 1310, 1311, 1675, 1313, 1676, 1315, 1316, 1317, + 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, + 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, + 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, + 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, + 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, + 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, + 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, + 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, + 1382, 1383, 1384, 1385, 1386, 1387, 3934, 3935, + 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, + 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, + 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, + 1414, 1415, 1416, 1417, 1418, 935, 1320, 4618, + 1422, 4621, 4622, 1425, 1426, 1427, -7322, 5372, + 1430, 1431, 5375, 891, 891, 891, 891, 891, + 891, 891, 5376, 2037, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 891, 891, + 891, 891, 891, 891, 891, 891, 141, 891, + 891, 891, 891, 891, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 142, 143, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 1999, 4498, 4499, 4500, 4501, 1999, 4503, 4504, + 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4523, 4524, 0, 4526, 4527, 4528, + 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, + 4537, -470, 4539, 4540, 4541, 4542, 4543, 4544, + 4545, 4546, 4547, 4548, 4549, 4550, 4551, 5540, + 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, + 5549, 5550, 4563, 4564, 4565, 4566, 4567, 5551, + 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, + 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7622, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3677, 4829, 3680, 3681, 3297, 0, + 0, 0, 0, 0, 0, 0, 11951, 4455, + 4455, 4455, 4455, 0, 0, 0, 0, 0, + 0, 4455, 4455, 4455, 4455, 4455, 4455, 4455, + 4455, 4455, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4672, + 4673, 4674, 4675, 4676, 4677, 4678, 2560, 2561, + 3019, 0, 0, 0, 0, 3016, 107, -4832, + 1536, 2689, 1538, 2562, 2563, 1541, 1542, 1543, + 1544, 1545, 9309, 2697, 3279, 3279, 3279, 3279, + 3279, 3279, 3279, 3279, 3279, 3279, 3279, -1113, + 3279, 3279, 3279, 3279, 3279, 3279, 3279, 3279, + 3279, 3279, 3279, 3279, 3279, 3279, 3279, 1575, + 1576, 1577, 1578, 1579, -3910, 1581, 1582, 4736, + 4737, -4652, 4739, -1253, 6219, 4742, 4743, 6224, + 6225, 6226, 6227, 6228, 6229, 6230, 6231, 6232, + 6233, -3419, 6235, 6236, 6237, 6238, 6239, 6240, + 6241, 6242, 6243, 3882, 3883, 3884, 3885, 3886, + 3887, 3888, -5177, 3891, 3892, -5177, 3893, 3894, + 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, + -5176, -5176, -5176, -5176, -5176, -5176, -5176, -5176, + 1640, 1641, 1642, 3924, 1644, 1645, 1646, 1647, + 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, + 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, + 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, + 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, + 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, + 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, + 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, + 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, + 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, + 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, + 1728, 1729, 1730, 1731, -847, -5786, 582, 1735, + 1736, 1609, 1610, 588, 1740, 591, 592, 593, + 8357, 1745, 2327, 2327, 2327, 2327, 2327, 2327, + 1357, 2328, 2328, 1755, 1756, 1757, 1758, 1759, + 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, + 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, + 1776, 1777, 1778, 1779, 1780, 3434, 1782, 3435, + 3435, 1785, 1786, 3437, 3437, 3437, 3306, 32767, + -2509, -2509, -2509, -2509, -2509, -2509, -2509, -2509, + -2509, 1800, -2508, -2508, -2508, -2508, 32767, 32767, + -2510, 32767, -2511, 32767, 32767, -2513, -2513, -2513, + -2513, -2513, -2513, 1813, 1814, 1815, 1816, 32767, + -2509, 32767, -2510, 32767, 32767, -2511, -2511, 32767, + 32767, 32767, -3871, -3871, -2513, -2513, -2513, -2513, + -2513, -2513, -2513, -2513, -2513, -2513, -2513, -2513, + -2513, -2513, -2513, 1838, 1839, 1840, 1841, 1842, + 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, + 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, + 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, + 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, + 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, + 1883, 1401, 1885, 1886, 1887, 1888, 32767, 32767, + 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, + 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, + 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, + 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, + 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, + 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, + 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, + 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, + 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, + 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, + 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, + 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, + 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, + 3710, 1994, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 167, 612, 32767, 32767, 2714, 32767, + 32767, 32767, 32767, 32767, 168, 32767, 32767, 32767, + 32767, 169, 32767, 32767, 32767, 32767, 170, 32767, + 32767, 32767, 32767, 171, 32767, 32767, 32767, 32767, + 32767, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 172, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -1151, -127, -126, -1148, + -1147, 32767, 32767, 32767, 32767, 32767, 585, 32767, + 584, 584, 584, 584, 584, 584, 584, 584, + 584, -3808, 584, 584, 584, 584, 584, 584, + 584, 584, 584, 584, 584, 584, 584, 584, + 32767, -1121, -1120, -1119, -1118, -1117, 32767, -1116, + 32767, 2038, 2039, 32767, 2040, -3952, 32767, 2042, + 2043, 3524, 3525, 3526, 3527, 3528, 3529, 3530, + 3531, 3532, -385, -384, 2055, -383, -382, -381, + -380, -379, -378, -377, 2063, 2064, -376, 2066, + -375, 2068, -374, -373, 2071, 2072, 2073, -322, + 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, + 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, + 718, 2092, 2093, 0, -347, 2096, -2016, 134, + 135, 2100, 2101, 2102, 2103, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2156, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1364, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -4392, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2227, 0, 0, 2230, 2231, 0, + 2233, 2105, 0, 0, 2497, 2498, 0, 0, + 0, 0, 2503, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4513, 4514, 4515, + 4516, 4517, 4518, 4519, 4520, 4521, 4522, 0, + 0, 4525, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5008, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -988, -988, -988, -988, + -988, -988, -988, -988, -988, -988, -988, 0, + 0, 0, 0, 0, -983, -983, -983, -983, + -983, -983, -983, -983, -983, -983, -983, -983, + -983, -983, -983, -983, -983, 4585, 4586, 4587, + 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, + 4596, -3025, 4598, 4599, 4600, 4601, 4602, 4603, + 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, + 4612, 4613, 4614, 4615, 4616, 4617, 4618, 942, + -209, 941, 941, 1326, 4624, 4625, 4626, 4627, + 4628, 4629, 4630, -7320, 177, 178, 179, 180, + 4636, 4637, 4638, 4639, 4640, 4641, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 4651, + 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, + 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, + 4668, 4669, 4670, 4671, 0, 0, 0, 0, + 0, 0, 0, 2119, 2119, 1662, 4682, 4683, + 4684, 4685, 1670, 4580, 9520, 3153, 2001, 3153, + 2130, 2130, 3153, 3153, 3153, 3153, 3153, -4610, + 2003, 1422, 1423, 1424, 1425, 1426, 1427, 1428, + 1429, 1430, 1431, 1432, 5825, 1434, 1435, 1436, + 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, + 1445, 1446, 1447, 1448, 3153, 3153, 3153, 3153, + 3153, 8643, 3153, 3153, 0, 0, 9390, 0, + 5993, -1478, 0, 0, -1480, -1480, -1480, -1480, + -1480, -1480, -1480, -1480, -1480, 2438, 2438, 0, + 2439, 2439, 2439, 2439, 2439, 2439, 2439, 0, + 0, 2441, 0, 2442, 0, 2443, 2443, 0, + 0, 0, 2396, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1373, 0, 0, 2094, 2442, + 0, 4113, 1964, 1964, 0, 0, 0, 0, + 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, + 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, + 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, + 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, + 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, + 2144, 2145, 2146, 2147, 2148, 2149, 4849, 4850, + 4851, 4852, 4853, 4854, 4855, 4856, 4857, 4858, + 4859, 4860, 4861, 4862, 4863, 4864, 2500, 4866, + 4867, 4868, 4869, 4870, 2505, 4872, 4873, 4874, + 2508, 4876, 4877, 4878, 4879, 4880, 2513, 2150, + 2151, 2152, 2153, 2154, 2155, 0, 2157, 2158, + 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, + 2167, 2168, 805, 2170, 2171, 2172, 2173, 2174, + 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, + 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, + 2191, 2192, 2193, 2194, 0, 4928, 4929, 4930, + 4931, 4932, 0, 4934, 4935, 4936, 4937, 7848, + 4939, 0, 0, 0, 4943, 4944, 4945, 4946, + 4947, 4948, 4949, 4950, 0, 4952, 4953, 4954, + 0, 0, 2546, 0, 0, 2546, 2546, 2546, + 4963, -5990, 4965, 1530, 4967, 4968, 4969, 4970, + 4971, 8142, 8142, 8142, 8142, 1530, 2112, 4978, + 4979, 4980, 4981, 4982, 2644, 2645, 2646, 2647, + 2648, 2649, 2650, 2651, 2099, 2653, 4993, 4994, + 4995, 4996, 4997, 4998, 2092, 5000, 5001, 5002, + 5003, 5004, 5005, 287, 5007, 5008, 32767, 5009, + 5010, 5011, 5012, -2457, 5014, -2456, 5016, 5017, + 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, + 5026, 5027, 5028, -4624, 5030, 5031, 5032, 5033, + 5034, 5035, 5036, 5037, 5038, 2677, 2678, 2679, + 2680, 2681, 2682, 2683, 2684, 2685, 2686, -6383, + 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, + 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, + 2703, 2704, 2705, 32767, 2706, 2707, 2708, 2709, + 32767, 32767, 32767, 32767, 2710, 4682, 4683, 32767, + 2713, 32767, 2714, 906, 907, 908, 909, 2719, + 2720, 910, 2722, 2723, 2724, 2725, 2726, 2727, + 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, + 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, + 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, + 2752, 2753, 2974, 2755, 174, 2757, 2758, 2759, + 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, + 2768, 2769, 2770, 6689, 6690, 6691, 2774, 2775, + 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, + 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, + 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, + 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, + 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, + 2816, 5259, 2818, 3298, 3299, 2821, 2822, 2823, + 2824, 2825, 2826, 3170, 2828, 2829, 2830, 2831, + 2832, 2833, 2834, 3177, 3177, 3177, 3177, 3177, + 3177, 2841, 2842, 2843, 2844, 2845, 2846, 2847, + 2848, 32767, 32767, 32767, 32767, 32767, 2849, 2850, + 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, + 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, + 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, + 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, + 2883, -1495, 2885, 2886, 4004, 4005, 4006, 4007, + 4008, -1495, -1495, 2894, 2895, -1495, -1495, 2898, + 2899, 2900, 2901, 2902, 2903, 2904, 2905, -1494, + 2907, 2908, 2909, 2910, 2911, 2912, 2913, -1494, + 2915, 2916, 2917, 2918, 3677, 2920, 3680, 3681, + 3129, 2924, 2925, 2926, 2927, 2928, 2929, 2930, + 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, + 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, + 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, + 2955, 2956, -1468, -1468, 2959, 2960, 2961, 2962, + 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, + 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, + 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, + 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, + 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002, + 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, + 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, + 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, + 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, + 3035, 3036, 3037, 3038, 32767, 32767, 32767, 3039, + 3040, 3041, 3042, 3043, 3044, 32767, 32767, 3045, + 3046, 3047, 3048, 3049, 3050, 32767, 32767, 3051, + 3052, 3053, 3054, 3055, 3056, 32767, 32767, 3057, + 3058, 3059, 32767, 32767, 32767, 3060, 3061, 3062, + 3063, 3064, 3065, 3066, 32767, 3067, 3068, 3069, + 3070, 3071, 3072, 3073, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 0, 0, 32767, 0, 32767, 32767, 0, + 32767, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + 32767, 0, 32767, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 32767, 32767, 32767, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 0, 0, + 32767, 0, 0, 32767, 0, 32767, 32767, 0, + 32767, 0, 32767, 0, 32767, 0, 32767, 0, + 32767, 0, 0, 32767, 0, 32767, 32767, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + 0, 0, 0, 32767, 0, 0, 0, 0, + 32767, 0, 0, 0, 0, 32767, 0, 32767, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 32767, -1358, -1358, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, -847, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 5181, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, -2069, 32767, 32767, -2071, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, -2105, -2105, 32767, 32767, -2107, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 256, + 257, 258, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 4210, 4211, 4212, 4213, 32767, + 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, + 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, + 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, + 4238, 4239, 4240, 32767, 4241, 4242, 32767, 4243, + 32767, 32767, 4244, 32767, 4245, 4246, 4247, 4248, + 4249, 4250, 4251, 4252, 4253, 4254, 32767, 4255, + 4256, 4257, 4258, 32767, 4259, 32767, 4260, 32767, + 32767, 32767, 32767, 32767, 32767, 4261, 32767, 32767, + 32767, 32767, 4262, 32767, 4263, 32767, 4264, 32767, + 4265, 4266, 4267, 32767, 4268, 4269, 32767, 4270, + 32767, 32767, 4271, 32767, 4272, 32767, 4273, 32767, + 4274, 32767, 4275, 32767, 4276, 4277, 32767, 4278, + 32767, 32767, 4279, 4280, 4281, 4282, 32767, 4283, + 4284, 4285, 4286, 4287, 4288, 4289, 32767, 4290, + 4291, 4292, 4293, 32767, 4294, 4295, 4296, 4297, + 32767, 4298, 32767, 4299, 4300, 4301, 4302, 4303, + 4304, 4305, 4306, 4307, 4308, 0, 4309, 4310, + 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, + 4319, 4320, 4321, 4322, 4323, 4324, 4325, 0, + 0, 0, 0, 32767, 4326, 4327, 4328, 32767, + 4329, 4330, 4331, 4332, 4333, 32767, 5692, 5693, + 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, + 4344, 4345, 4346, 4347, 4348, 4349, 4350, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 483, 0, 0, + 0, 0, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -1717, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1769, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -1778, 0, 0, + 0, 0, -1782, 0, 0, 0, 0, -1786, + 0, 0, 0, 0, -1790, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1802, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1811, 0, -1812, -1812, -1812, + -1812, -1812, 0, 0, 0, 0, 0, 0, + 0, -1819, 0, 0, 0, 0, 0, 0, + -459, -458, 0, 0, 0, 0, -3016, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 0, 32767, + 0, 32767, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 223, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4379, + 0, 0, -1117, -1117, -1117, -1117, -1117, 4387, + 4388, 0, 0, 4391, 4392, 0, 0, 0, + 0, 0, 0, 0, 0, 4400, 0, 0, + 0, 0, 0, 0, 0, 4408, 0, 0, + 0, 0, -758, 0, -759, -759, -206, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 4425, 4426, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 0, 0, 0, + 0, 0, 0, 32767, 32767, 0, 0, 0, + 0, 0, 0, 32767, 32767, 0, 0, 0, + 0, 0, 0, 32767, 32767, 0, 0, 0, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 32767, 0, 0, 0, 0, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4429, + 4430, 4431, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 4432, + 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, + 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, + 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, + 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, + 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, + 4473, 4474, 4475, 32767, 32767, 32767, 32767, 4476, + 4477, 4478, 4479, 4480, 4481, 539, 540, 4484, + 0, 0, 0, 0, 0, 0, 0, 4485, + 1146, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -750, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6227, + 6228, -3161, 6230, 238, 234, 6232, 6233, 7714, + 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, + 7723, -1929, 7725, 7726, 7727, 7728, 7729, 7730, + 7731, 7732, 7733, 5372, 5373, 5374, 5375, 5376, + 5377, 5378, -3687, 5381, 5382, -3687, 5383, 5384, + 5385, 5386, 5387, 5388, 5389, 5390, 5391, -3687, + -3687, -3687, -3687, -3687, -3687, -3687, -3687, -3687, + 3129, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, -3700, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 285, -3734, -3734, 288, 289, -3734, -3734, -3734, + -3734, -3734, -3734, -3734, -3734, -3734, -3734, -3734, + -3734, 1547, -956, -956, -3734, -3734, -3734, 3440, + -3734, -3734, -3734, -3734, -3734, -3734, -3734, -3734, + -3734, -3734, -3734, -3734, -3734, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 322, 323, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 0, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 114, 115, 116, 117, 118, 119, 120, + 121, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 0, 0, 3943, 3943, 0, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 3340, 32767, 325, 32767, 326, 32767, 327, 32767, + 328, 32767, 329, 32767, 330, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 331, 32767, 332, 333, 334, 335, + 336, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 337, 32767, 338, 32767, 339, 340, 341, 32767, + 32767, 32767, 342, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 343, 32767, 344, 345, 346, 32767, + 32767, 32767, 347, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 348, 32767, 349, 350, 351, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 352, 32767, 353, 32767, 354, 355, 32767, 32767, + -1816, -1816, -1816, -1816, -1816, -1816, -1816, -1816, + -1816, -1816, -1816, 32767, 32767, 32767, 32767, 32767, + 32767, -1822, 32767, 32767, 32767, 32767, 32767, 368, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 369, 370, 371, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 372, + 32767, 32767, 32767, 373, 374, 32767, 375, 376, + 32767, 32767, 32767, 32767, 6367, 0, -1152, 0, + -1023, -1023, 0, 0, 0, 0, 0, -7763, + -1150, -1731, -1730, -1729, -1728, -1727, -1726, -1725, + -1724, -1723, -1722, -1721, 2672, -1719, -1718, -1717, + -1716, -1715, -1714, -1713, -1712, -1711, -1710, -1709, + -1708, -1707, -1706, -1705, 0, 0, 0, 0, + 0, 5490, 0, 0, -3153, -3153, 6237, -3153, + 2840, -4631, -3153, -3153, -4633, -4633, -4633, -4633, + -4633, -4633, -4633, -4633, -4633, -4633, 5020, -4633, + -4633, -4633, -4633, -4633, -4633, -4633, -4633, -4633, + -2271, -2271, -2271, -2271, -2271, -2271, -2271, 6795, + -2272, -2272, 6798, -2271, -2271, -2271, -2271, -2271, + -2271, -2271, -2271, -2271, -2271, 6808, 6809, 6810, + 6811, 6812, 6813, 6814, 6815, 0, 0, 0, + -2281, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2579, 7519, 1152, 0, 0, 128, 128, + 1151, 0, 1150, 1150, 1150, -6613, 0, -581, + -580, -579, -578, -577, -576, 395, -575, -574, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -1653, 0, -1652, -1651, 0, 0, + -1650, -1649, -1648, -1516, -1647, 473, 474, 475, + 476, 477, 32767, 32767, 32767, 32767, -7018, 479, + 480, 481, 482, 32767, 32767, 32767, 32767, 32767, + 32767, 483, 484, 485, 486, 487, 488, 489, + 490, 491, 492, 493, 494, 495, 496, 497, + 498, 499, 500, 501, 502, 503, 504, 9308, + 506, 507, 508, 509, 510, 511, 512, 513, + 514, 515, 3684, 3684, 3684, 519, 3685, 3685, + 9912, 9913, 524, 9915, 3923, 3919, 9917, 9918, + 11399, 0, 11402, 11403, 11404, 11405, 11406, 11407, + 11408, 11409, 1757, 11411, 11412, 11413, 11414, 11415, + 11416, 11417, 11418, 11419, 0, 9060, 9061, 9062, + 9063, 9064, 9065, 0, 9068, 9069, 0, 9070, + 9071, 9072, 9073, 9074, 9075, 9076, 9077, 9078, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2659, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2745, 2745, 2745, + 2745, 2745, 2745, 2745, 2745, 2745, 0, 0, + 0, -4730, 6052, 0, -4732, -4732, -4732, -4732, + 0, 0, 4919, -4734, -4734, 0, -4735, -4735, + -4735, 4019, 0, 0, 4022, 4023, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5281, 2778, 2778, 0, 0, 0, + 7174, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2067, 918, + 32767, 534, -2763, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 0, 0, 0, 0, 0, + 0, 0, 0, 553, 0, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, -2360, 5111, -2360, -2360, -2360, + -2360, -2360, -2360, -2360, -2360, -2360, -2360, -2360, + -2360, -2360, 7293, -2360, -2360, -2360, -2360, -2360, + 3144, 3145, -2362, -2362, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32767, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 32767, 0, 0, 0, 0, 32767, + 32767, 32767, 32767, 0, -1971, -1971, 32767, 0, + 32767, 0, 1809, 1809, 1809, 1809, 0, 0, + 1811, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -220, 0, 2582, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -3918, -3918, -3918, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -2442, 0, -479, -479, 0, 0, 0, 0, + 0, 0, -343, 0, 0, 0, 0, 0, + 0, 0, -342, -341, -340, -339, -338, -337, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 2495, 2496, 0, 0, 2499, 2500, 2501, + 2502, 0, 2504, 2505, 2506, 2507, 2508, 1141, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -363, + 0, -362, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -2546, -2546, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 484, 100, -3197, 0, -3198, -3198, + 0, 0, 0, 8750, -3943, 0, 0, -3943, + 542, 543, 544, 545, 546, 547, 548, -3936, + -596, 551, 552, 553, 554, 555, 556, 557, + 558, 559, 560, 561, 562, 563, 564, 565, + 566, 567, 568, 569, 570, 571, 572, 573, + 574, 575, 576, 577, 578, 579, 580, 581, + 582, 583, 584, 585, 586, 587, 588, 589, + 590, 591, 592, 593, 594, 595, 596, 597, + 598, 599, 600, 601, 602, 603, 604, 605, + 606, 607, 608, 609, 610, 611, 612, 613, + 614, 615, 616, 617, 618, 619, 620, 621, + 622, 623, 624, 1375, 626, 627, 628, 629, + 630, 631, 632, 633, 634, 635, 636, 637, + 638, 639, 640, 641, 642, 643, 644, 645, + 646, 647, 648, 649, 650, 651, 652, 653, + 654, 655, 656, 657, 658, 659, 660, 661, + 662, 663, 664, 665, 666, 667, 668, 669, + 670, 671, 672, 673, 674, 675, 676, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 0, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, 32767, 32767, 32767, 0, + 0, 0, 0, 7470, 0, 7471, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9653, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 32767, 32767, 32767, + 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, + 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, + 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, + 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, + 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, + 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, + 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, + 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, + 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, + 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, + 3232, 3233, 3234, 3235, 3236, 32767, 3237, 3238, + 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, + 3247, 3248, 1885, 3250, 3251, 3252, 3253, 3254, + 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, + 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, + 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, + 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, + 3287, 3288, 3289, 3290, 7683, 3292, 3293, 3294, + 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, + 3303, 3304, 3305, 3306, 3307, 32767, 3308, 3309, + 32767, 32767, 3310, 32767, 32767, 3311, 3312, 32767, + 32767, 3313, 3314, 3315, 3316, 32767, 3317, 3318, + 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, + -1186, -1186, 4489, -1187, 4491, -1188, -1188, -1188, + -1188, -1188, 3335, 3336, 32767, 3337, 3338, 3339, + 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, + 3348, -1659, 3350, 3351, 3352, 3353, 3354, 3355, + 3356, 3357, 3358, 3359, 3360, 3361, 3362, 4351, + 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, + 4360, 4361, 3374, 3375, 3376, 3377, 3378, 4362, + 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, + 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, + 0, 4380, 4381, 5499, 5500, 5501, 5502, 5503, + 0, 0, 4389, 4390, 0, 0, 3406, 4393, + 4394, 4395, 4396, 4397, 4398, 4399, 0, 4401, + 4402, 4403, 4404, 4405, 4406, 4407, 0, 4409, + 4410, 4411, 4412, 5171, 4414, 5174, 5175, 4623, + 4418, 4419, 4420, 4421, 4422, 4423, 4424, 3437, + 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, + 3446, 3447, 3448, 32767, 3449, 3450, 3451, 3131, + 32767, 3453, 3454, 3455, 3456, 3457, 32767, 3458, + 32767, 0, 0, 4427, 3460, 3461, 3462, 3463, + 3464, 3465, 32767, 3466, 3467, 3468, 3469, 3470, + 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, + 3146, 3367, 3148, 567, 3150, 3151, 3485, 3486, + 3487, 3488, 3489, 3490, 3491, 3492, 3493, 4428, + 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, + 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, + 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, + 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, + 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, + 3535, 3536, 3537, 3538, 3539, 3540, 3541 + }; + + const unsigned char *k = (const unsigned char *) key; + size_t keylen = 4; + uint32 a = 0; + uint32 b = 1; + + while (keylen--) + { + unsigned char c = *k++; + + a = a * 257 + c; + b = b * 8191 + c; + } + return h[a % 10079] + h[b % 10079]; +} + +/* Hash lookup information for NFKC_QC */ +static const pg_unicode_norminfo UnicodeNormInfo_NFKC_QC = { + UnicodeNormProps_NFKC_QC, + NFKC_QC_hash_func, + 5039 +}; diff --git a/platform/dbops/binaries/postgres/include/server/common/unicode_version.h b/platform/dbops/binaries/postgres/include/server/common/unicode_version.h new file mode 100644 index 0000000000000000000000000000000000000000..487fcef78a540cfbf122473803f031c9b5f6c2b0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/unicode_version.h @@ -0,0 +1,14 @@ +/*------------------------------------------------------------------------- + * + * unicode_version.h + * Unicode version used by Postgres. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/common/unicode_version.h + * + *------------------------------------------------------------------------- + */ + +#define PG_UNICODE_VERSION "15.1" diff --git a/platform/dbops/binaries/postgres/include/server/common/username.h b/platform/dbops/binaries/postgres/include/server/common/username.h new file mode 100644 index 0000000000000000000000000000000000000000..60fcc70a970f01c1287d1af5b775f51fa71756f2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/common/username.h @@ -0,0 +1,15 @@ +/* + * username.h + * lookup effective username + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/common/username.h + */ +#ifndef USERNAME_H +#define USERNAME_H + +extern const char *get_user_name(char **errstr); +extern const char *get_user_name_or_exit(const char *progname); + +#endif /* USERNAME_H */ diff --git a/platform/dbops/binaries/postgres/include/server/datatype/timestamp.h b/platform/dbops/binaries/postgres/include/server/datatype/timestamp.h new file mode 100644 index 0000000000000000000000000000000000000000..7d9d2fd0932fdf52f2ad62c8808d5c10d9a0d6ea --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/datatype/timestamp.h @@ -0,0 +1,269 @@ +/*------------------------------------------------------------------------- + * + * timestamp.h + * Timestamp and Interval typedefs and related macros. + * + * Note: this file must be includable in both frontend and backend contexts. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/datatype/timestamp.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATATYPE_TIMESTAMP_H +#define DATATYPE_TIMESTAMP_H + +/* + * Timestamp represents absolute time. + * + * Interval represents delta time. Keep track of months (and years), days, + * and hours/minutes/seconds separately since the elapsed time spanned is + * unknown until instantiated relative to an absolute time. + * + * Note that Postgres uses "time interval" to mean a bounded interval, + * consisting of a beginning and ending time, not a time span - thomas 97/03/20 + * + * Timestamps, as well as the h/m/s fields of intervals, are stored as + * int64 values with units of microseconds. (Once upon a time they were + * double values with units of seconds.) + * + * TimeOffset and fsec_t are convenience typedefs for temporary variables. + * Do not use fsec_t in values stored on-disk. + * Also, fsec_t is only meant for *fractional* seconds; beware of overflow + * if the value you need to store could be many seconds. + */ + +typedef int64 Timestamp; +typedef int64 TimestampTz; +typedef int64 TimeOffset; +typedef int32 fsec_t; /* fractional seconds (in microseconds) */ + + +/* + * Storage format for type interval. + */ +typedef struct +{ + TimeOffset time; /* all time units other than days, months and + * years */ + int32 day; /* days, after time for alignment */ + int32 month; /* months and years, after time for alignment */ +} Interval; + +/* + * Data structure representing a broken-down interval. + * + * For historical reasons, this is modeled on struct pg_tm for timestamps. + * Unlike the situation for timestamps, there's no magic interpretation + * needed for months or years: they're just zero or not. Note that fields + * can be negative; however, because of the divisions done while converting + * from struct Interval, only tm_mday could be INT_MIN. This is important + * because we may need to negate the values in some code paths. + */ +struct pg_itm +{ + int tm_usec; + int tm_sec; + int tm_min; + int64 tm_hour; /* needs to be wide */ + int tm_mday; + int tm_mon; + int tm_year; +}; + +/* + * Data structure for decoding intervals. We could just use struct pg_itm, + * but then the requirement for tm_usec to be 64 bits would propagate to + * places where it's not really needed. Also, omitting the fields that + * aren't used during decoding seems like a good error-prevention measure. + */ +struct pg_itm_in +{ + int64 tm_usec; /* needs to be wide */ + int tm_mday; + int tm_mon; + int tm_year; +}; + + +/* Limits on the "precision" option (typmod) for these data types */ +#define MAX_TIMESTAMP_PRECISION 6 +#define MAX_INTERVAL_PRECISION 6 + +/* + * Round off to MAX_TIMESTAMP_PRECISION decimal places. + * Note: this is also used for rounding off intervals. + */ +#define TS_PREC_INV 1000000.0 +#define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV) + + +/* + * Assorted constants for datetime-related calculations + */ + +#define DAYS_PER_YEAR 365.25 /* assumes leap year every four years */ +#define MONTHS_PER_YEAR 12 +/* + * DAYS_PER_MONTH is very imprecise. The more accurate value is + * 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only + * return an integral number of days, but someday perhaps we should + * also return a 'time' value to be used as well. ISO 8601 suggests + * 30 days. + */ +#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */ +#define DAYS_PER_WEEK 7 +#define HOURS_PER_DAY 24 /* assume no daylight savings time changes */ + +/* + * This doesn't adjust for uneven daylight savings time intervals or leap + * seconds, and it crudely estimates leap years. A more accurate value + * for days per years is 365.2422. + */ +#define SECS_PER_YEAR (36525 * 864) /* avoid floating-point computation */ +#define SECS_PER_DAY 86400 +#define SECS_PER_HOUR 3600 +#define SECS_PER_MINUTE 60 +#define MINS_PER_HOUR 60 + +#define USECS_PER_DAY INT64CONST(86400000000) +#define USECS_PER_HOUR INT64CONST(3600000000) +#define USECS_PER_MINUTE INT64CONST(60000000) +#define USECS_PER_SEC INT64CONST(1000000) + +/* + * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich. + * Currently, the record holders for wackiest offsets in actual use are zones + * Asia/Manila, at -15:56:08 until 1844, and America/Metlakatla, at +15:13:42 + * until 1867. If we were to reject such values we would fail to dump and + * restore old timestamptz values with these zone settings. + */ +#define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */ +#define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR) + +/* + * We reserve the minimum and maximum integer values to represent + * timestamp (or timestamptz) -infinity and +infinity. + */ +#define TIMESTAMP_MINUS_INFINITY PG_INT64_MIN +#define TIMESTAMP_INFINITY PG_INT64_MAX + +/* + * Historically these aliases for infinity have been used. + */ +#define DT_NOBEGIN TIMESTAMP_MINUS_INFINITY +#define DT_NOEND TIMESTAMP_INFINITY + +#define TIMESTAMP_NOBEGIN(j) \ + do {(j) = DT_NOBEGIN;} while (0) + +#define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) + +#define TIMESTAMP_NOEND(j) \ + do {(j) = DT_NOEND;} while (0) + +#define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) + +#define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) + +/* + * Infinite intervals are represented by setting all fields to the minimum or + * maximum integer values. + */ +#define INTERVAL_NOBEGIN(i) \ + do { \ + (i)->time = PG_INT64_MIN; \ + (i)->day = PG_INT32_MIN; \ + (i)->month = PG_INT32_MIN; \ + } while (0) + +#define INTERVAL_IS_NOBEGIN(i) \ + ((i)->month == PG_INT32_MIN && (i)->day == PG_INT32_MIN && (i)->time == PG_INT64_MIN) + +#define INTERVAL_NOEND(i) \ + do { \ + (i)->time = PG_INT64_MAX; \ + (i)->day = PG_INT32_MAX; \ + (i)->month = PG_INT32_MAX; \ + } while (0) + +#define INTERVAL_IS_NOEND(i) \ + ((i)->month == PG_INT32_MAX && (i)->day == PG_INT32_MAX && (i)->time == PG_INT64_MAX) + +#define INTERVAL_NOT_FINITE(i) (INTERVAL_IS_NOBEGIN(i) || INTERVAL_IS_NOEND(i)) + +/* + * Julian date support. + * + * date2j() and j2date() nominally handle the Julian date range 0..INT_MAX, + * or 4714-11-24 BC to 5874898-06-03 AD. In practice, date2j() will work and + * give correct negative Julian dates for dates before 4714-11-24 BC as well. + * We rely on it to do so back to 4714-11-01 BC. Allowing at least one day's + * slop is necessary so that timestamp rotation doesn't produce dates that + * would be rejected on input. For example, '4714-11-24 00:00 GMT BC' is a + * legal timestamptz value, but in zones east of Greenwich it would print as + * sometime in the afternoon of 4714-11-23 BC; if we couldn't process such a + * date we'd have a dump/reload failure. So the idea is for IS_VALID_JULIAN + * to accept a slightly wider range of dates than we really support, and + * then we apply the exact checks in IS_VALID_DATE or IS_VALID_TIMESTAMP, + * after timezone rotation if any. To save a few cycles, we can make + * IS_VALID_JULIAN check only to the month boundary, since its exact cutoffs + * are not very critical in this scheme. + * + * It is correct that JULIAN_MINYEAR is -4713, not -4714; it is defined to + * allow easy comparison to tm_year values, in which we follow the convention + * that tm_year <= 0 represents abs(tm_year)+1 BC. + */ + +#define JULIAN_MINYEAR (-4713) +#define JULIAN_MINMONTH (11) +#define JULIAN_MINDAY (24) +#define JULIAN_MAXYEAR (5874898) +#define JULIAN_MAXMONTH (6) +#define JULIAN_MAXDAY (3) + +#define IS_VALID_JULIAN(y,m,d) \ + (((y) > JULIAN_MINYEAR || \ + ((y) == JULIAN_MINYEAR && ((m) >= JULIAN_MINMONTH))) && \ + ((y) < JULIAN_MAXYEAR || \ + ((y) == JULIAN_MAXYEAR && ((m) < JULIAN_MAXMONTH)))) + +/* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */ +#define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */ +#define POSTGRES_EPOCH_JDATE 2451545 /* == date2j(2000, 1, 1) */ + +/* + * Range limits for dates and timestamps. + * + * We have traditionally allowed Julian day zero as a valid datetime value, + * so that is the lower bound for both dates and timestamps. + * + * The upper limit for dates is 5874897-12-31, which is a bit less than what + * the Julian-date code can allow. For timestamps, the upper limit is + * 294276-12-31. The int64 overflow limit would be a few days later; again, + * leaving some slop avoids worries about corner-case overflow, and provides + * a simpler user-visible definition. + */ + +/* First allowed date, and first disallowed date, in Julian-date form */ +#define DATETIME_MIN_JULIAN (0) +#define DATE_END_JULIAN (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */ +#define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */ + +/* Timestamp limits */ +#define MIN_TIMESTAMP INT64CONST(-211813488000000000) +/* == (DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */ +#define END_TIMESTAMP INT64CONST(9223371331200000000) +/* == (TIMESTAMP_END_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */ + +/* Range-check a date (given in Postgres, not Julian, numbering) */ +#define IS_VALID_DATE(d) \ + ((DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) <= (d) && \ + (d) < (DATE_END_JULIAN - POSTGRES_EPOCH_JDATE)) + +/* Range-check a timestamp */ +#define IS_VALID_TIMESTAMP(t) (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP) + +#endif /* DATATYPE_TIMESTAMP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execAsync.h b/platform/dbops/binaries/postgres/include/server/executor/execAsync.h new file mode 100644 index 0000000000000000000000000000000000000000..c5f26ced6750db935072fd6548d8fb9ff6938bd6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execAsync.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * execAsync.h + * Support functions for asynchronous execution + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execAsync.h + *------------------------------------------------------------------------- + */ + +#ifndef EXECASYNC_H +#define EXECASYNC_H + +#include "nodes/execnodes.h" + +extern void ExecAsyncRequest(AsyncRequest *areq); +extern void ExecAsyncConfigureWait(AsyncRequest *areq); +extern void ExecAsyncNotify(AsyncRequest *areq); +extern void ExecAsyncResponse(AsyncRequest *areq); +extern void ExecAsyncRequestDone(AsyncRequest *areq, TupleTableSlot *result); +extern void ExecAsyncRequestPending(AsyncRequest *areq); + +#endif /* EXECASYNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execExpr.h b/platform/dbops/binaries/postgres/include/server/executor/execExpr.h new file mode 100644 index 0000000000000000000000000000000000000000..ef1fa37716de560e0032f99303e3112abc44ea97 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execExpr.h @@ -0,0 +1,865 @@ +/*------------------------------------------------------------------------- + * + * execExpr.h + * Low level infrastructure related to expression evaluation + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execExpr.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXEC_EXPR_H +#define EXEC_EXPR_H + +#include "executor/nodeAgg.h" +#include "nodes/execnodes.h" +#include "nodes/miscnodes.h" + +/* forward references to avoid circularity */ +struct ExprEvalStep; +struct SubscriptingRefState; +struct ScalarArrayOpExprHashTable; +struct JsonConstructorExprState; + +/* Bits in ExprState->flags (see also execnodes.h for public flag bits): */ +/* expression's interpreter has been initialized */ +#define EEO_FLAG_INTERPRETER_INITIALIZED (1 << 1) +/* jump-threading is in use */ +#define EEO_FLAG_DIRECT_THREADED (1 << 2) + +/* Typical API for out-of-line evaluation subroutines */ +typedef void (*ExecEvalSubroutine) (ExprState *state, + struct ExprEvalStep *op, + ExprContext *econtext); + +/* API for out-of-line evaluation subroutines returning bool */ +typedef bool (*ExecEvalBoolSubroutine) (ExprState *state, + struct ExprEvalStep *op, + ExprContext *econtext); + +/* ExprEvalSteps that cache a composite type's tupdesc need one of these */ +/* (it fits in-line in some step types, otherwise allocate out-of-line) */ +typedef struct ExprEvalRowtypeCache +{ + /* + * cacheptr points to composite type's TypeCacheEntry if tupdesc_id is not + * 0; or for an anonymous RECORD type, it points directly at the cached + * tupdesc for the type, and tupdesc_id is 0. (We'd use separate fields + * if space were not at a premium.) Initial state is cacheptr == NULL. + */ + void *cacheptr; + uint64 tupdesc_id; /* last-seen tupdesc identifier, or 0 */ +} ExprEvalRowtypeCache; + +/* + * Discriminator for ExprEvalSteps. + * + * Identifies the operation to be executed and which member in the + * ExprEvalStep->d union is valid. + * + * The order of entries needs to be kept in sync with the dispatch_table[] + * array in execExprInterp.c:ExecInterpExpr(). + */ +typedef enum ExprEvalOp +{ + /* entire expression has been evaluated completely, return */ + EEOP_DONE, + + /* apply slot_getsomeattrs on corresponding tuple slot */ + EEOP_INNER_FETCHSOME, + EEOP_OUTER_FETCHSOME, + EEOP_SCAN_FETCHSOME, + + /* compute non-system Var value */ + EEOP_INNER_VAR, + EEOP_OUTER_VAR, + EEOP_SCAN_VAR, + + /* compute system Var value */ + EEOP_INNER_SYSVAR, + EEOP_OUTER_SYSVAR, + EEOP_SCAN_SYSVAR, + + /* compute wholerow Var */ + EEOP_WHOLEROW, + + /* + * Compute non-system Var value, assign it into ExprState's resultslot. + * These are not used if a CheckVarSlotCompatibility() check would be + * needed. + */ + EEOP_ASSIGN_INNER_VAR, + EEOP_ASSIGN_OUTER_VAR, + EEOP_ASSIGN_SCAN_VAR, + + /* assign ExprState's resvalue/resnull to a column of its resultslot */ + EEOP_ASSIGN_TMP, + /* ditto, applying MakeExpandedObjectReadOnly() */ + EEOP_ASSIGN_TMP_MAKE_RO, + + /* evaluate Const value */ + EEOP_CONST, + + /* + * Evaluate function call (including OpExprs etc). For speed, we + * distinguish in the opcode whether the function is strict and/or + * requires usage stats tracking. + */ + EEOP_FUNCEXPR, + EEOP_FUNCEXPR_STRICT, + EEOP_FUNCEXPR_FUSAGE, + EEOP_FUNCEXPR_STRICT_FUSAGE, + + /* + * Evaluate boolean AND expression, one step per subexpression. FIRST/LAST + * subexpressions are special-cased for performance. Since AND always has + * at least two subexpressions, FIRST and LAST never apply to the same + * subexpression. + */ + EEOP_BOOL_AND_STEP_FIRST, + EEOP_BOOL_AND_STEP, + EEOP_BOOL_AND_STEP_LAST, + + /* similarly for boolean OR expression */ + EEOP_BOOL_OR_STEP_FIRST, + EEOP_BOOL_OR_STEP, + EEOP_BOOL_OR_STEP_LAST, + + /* evaluate boolean NOT expression */ + EEOP_BOOL_NOT_STEP, + + /* simplified version of BOOL_AND_STEP for use by ExecQual() */ + EEOP_QUAL, + + /* unconditional jump to another step */ + EEOP_JUMP, + + /* conditional jumps based on current result value */ + EEOP_JUMP_IF_NULL, + EEOP_JUMP_IF_NOT_NULL, + EEOP_JUMP_IF_NOT_TRUE, + + /* perform NULL tests for scalar values */ + EEOP_NULLTEST_ISNULL, + EEOP_NULLTEST_ISNOTNULL, + + /* perform NULL tests for row values */ + EEOP_NULLTEST_ROWISNULL, + EEOP_NULLTEST_ROWISNOTNULL, + + /* evaluate a BooleanTest expression */ + EEOP_BOOLTEST_IS_TRUE, + EEOP_BOOLTEST_IS_NOT_TRUE, + EEOP_BOOLTEST_IS_FALSE, + EEOP_BOOLTEST_IS_NOT_FALSE, + + /* evaluate PARAM_EXEC/EXTERN parameters */ + EEOP_PARAM_EXEC, + EEOP_PARAM_EXTERN, + EEOP_PARAM_CALLBACK, + + /* return CaseTestExpr value */ + EEOP_CASE_TESTVAL, + + /* apply MakeExpandedObjectReadOnly() to target value */ + EEOP_MAKE_READONLY, + + /* evaluate assorted special-purpose expression types */ + EEOP_IOCOERCE, + EEOP_IOCOERCE_SAFE, + EEOP_DISTINCT, + EEOP_NOT_DISTINCT, + EEOP_NULLIF, + EEOP_SQLVALUEFUNCTION, + EEOP_CURRENTOFEXPR, + EEOP_NEXTVALUEEXPR, + EEOP_ARRAYEXPR, + EEOP_ARRAYCOERCE, + EEOP_ROW, + + /* + * Compare two individual elements of each of two compared ROW() + * expressions. Skip to ROWCOMPARE_FINAL if elements are not equal. + */ + EEOP_ROWCOMPARE_STEP, + + /* evaluate boolean value based on previous ROWCOMPARE_STEP operations */ + EEOP_ROWCOMPARE_FINAL, + + /* evaluate GREATEST() or LEAST() */ + EEOP_MINMAX, + + /* evaluate FieldSelect expression */ + EEOP_FIELDSELECT, + + /* + * Deform tuple before evaluating new values for individual fields in a + * FieldStore expression. + */ + EEOP_FIELDSTORE_DEFORM, + + /* + * Form the new tuple for a FieldStore expression. Individual fields will + * have been evaluated into columns of the tuple deformed by the preceding + * DEFORM step. + */ + EEOP_FIELDSTORE_FORM, + + /* Process container subscripts; possibly short-circuit result to NULL */ + EEOP_SBSREF_SUBSCRIPTS, + + /* + * Compute old container element/slice when a SubscriptingRef assignment + * expression contains SubscriptingRef/FieldStore subexpressions. Value is + * accessed using the CaseTest mechanism. + */ + EEOP_SBSREF_OLD, + + /* compute new value for SubscriptingRef assignment expression */ + EEOP_SBSREF_ASSIGN, + + /* compute element/slice for SubscriptingRef fetch expression */ + EEOP_SBSREF_FETCH, + + /* evaluate value for CoerceToDomainValue */ + EEOP_DOMAIN_TESTVAL, + + /* evaluate a domain's NOT NULL constraint */ + EEOP_DOMAIN_NOTNULL, + + /* evaluate a single domain CHECK constraint */ + EEOP_DOMAIN_CHECK, + + /* evaluate assorted special-purpose expression types */ + EEOP_CONVERT_ROWTYPE, + EEOP_SCALARARRAYOP, + EEOP_HASHED_SCALARARRAYOP, + EEOP_XMLEXPR, + EEOP_JSON_CONSTRUCTOR, + EEOP_IS_JSON, + EEOP_JSONEXPR_PATH, + EEOP_JSONEXPR_COERCION, + EEOP_JSONEXPR_COERCION_FINISH, + EEOP_AGGREF, + EEOP_GROUPING_FUNC, + EEOP_WINDOW_FUNC, + EEOP_MERGE_SUPPORT_FUNC, + EEOP_SUBPLAN, + + /* aggregation related nodes */ + EEOP_AGG_STRICT_DESERIALIZE, + EEOP_AGG_DESERIALIZE, + EEOP_AGG_STRICT_INPUT_CHECK_ARGS, + EEOP_AGG_STRICT_INPUT_CHECK_NULLS, + EEOP_AGG_PLAIN_PERGROUP_NULLCHECK, + EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL, + EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL, + EEOP_AGG_PLAIN_TRANS_BYVAL, + EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF, + EEOP_AGG_PLAIN_TRANS_STRICT_BYREF, + EEOP_AGG_PLAIN_TRANS_BYREF, + EEOP_AGG_PRESORTED_DISTINCT_SINGLE, + EEOP_AGG_PRESORTED_DISTINCT_MULTI, + EEOP_AGG_ORDERED_TRANS_DATUM, + EEOP_AGG_ORDERED_TRANS_TUPLE, + + /* non-existent operation, used e.g. to check array lengths */ + EEOP_LAST +} ExprEvalOp; + + +typedef struct ExprEvalStep +{ + /* + * Instruction to be executed. During instruction preparation this is an + * enum ExprEvalOp, but later it can be changed to some other type, e.g. a + * pointer for computed goto (that's why it's an intptr_t). + */ + intptr_t opcode; + + /* where to store the result of this step */ + Datum *resvalue; + bool *resnull; + + /* + * Inline data for the operation. Inline data is faster to access, but + * also bloats the size of all instructions. The union should be kept to + * no more than 40 bytes on 64-bit systems (so that the entire struct is + * no more than 64 bytes, a single cacheline on common systems). + */ + union + { + /* for EEOP_INNER/OUTER/SCAN_FETCHSOME */ + struct + { + /* attribute number up to which to fetch (inclusive) */ + int last_var; + /* will the type of slot be the same for every invocation */ + bool fixed; + /* tuple descriptor, if known */ + TupleDesc known_desc; + /* type of slot, can only be relied upon if fixed is set */ + const TupleTableSlotOps *kind; + } fetch; + + /* for EEOP_INNER/OUTER/SCAN_[SYS]VAR[_FIRST] */ + struct + { + /* attnum is attr number - 1 for regular VAR ... */ + /* but it's just the normal (negative) attr number for SYSVAR */ + int attnum; + Oid vartype; /* type OID of variable */ + } var; + + /* for EEOP_WHOLEROW */ + struct + { + Var *var; /* original Var node in plan tree */ + bool first; /* first time through, need to initialize? */ + bool slow; /* need runtime check for nulls? */ + TupleDesc tupdesc; /* descriptor for resulting tuples */ + JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */ + } wholerow; + + /* for EEOP_ASSIGN_*_VAR */ + struct + { + /* target index in ExprState->resultslot->tts_values/nulls */ + int resultnum; + /* source attribute number - 1 */ + int attnum; + } assign_var; + + /* for EEOP_ASSIGN_TMP[_MAKE_RO] */ + struct + { + /* target index in ExprState->resultslot->tts_values/nulls */ + int resultnum; + } assign_tmp; + + /* for EEOP_CONST */ + struct + { + /* constant's value */ + Datum value; + bool isnull; + } constval; + + /* for EEOP_FUNCEXPR_* / NULLIF / DISTINCT */ + struct + { + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + int nargs; /* number of arguments */ + bool make_ro; /* make arg0 R/O (used only for NULLIF) */ + } func; + + /* for EEOP_BOOL_*_STEP */ + struct + { + bool *anynull; /* track if any input was NULL */ + int jumpdone; /* jump here if result determined */ + } boolexpr; + + /* for EEOP_QUAL */ + struct + { + int jumpdone; /* jump here on false or null */ + } qualexpr; + + /* for EEOP_JUMP[_CONDITION] */ + struct + { + int jumpdone; /* target instruction's index */ + } jump; + + /* for EEOP_NULLTEST_ROWIS[NOT]NULL */ + struct + { + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; + } nulltest_row; + + /* for EEOP_PARAM_EXEC/EXTERN */ + struct + { + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* OID of parameter's datatype */ + } param; + + /* for EEOP_PARAM_CALLBACK */ + struct + { + ExecEvalSubroutine paramfunc; /* add-on evaluation subroutine */ + void *paramarg; /* private data for same */ + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* OID of parameter's datatype */ + } cparam; + + /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */ + struct + { + Datum *value; /* value to return */ + bool *isnull; + } casetest; + + /* for EEOP_MAKE_READONLY */ + struct + { + Datum *value; /* value to coerce to read-only */ + bool *isnull; + } make_readonly; + + /* for EEOP_IOCOERCE */ + struct + { + /* lookup and call info for source type's output function */ + FmgrInfo *finfo_out; + FunctionCallInfo fcinfo_data_out; + /* lookup and call info for result type's input function */ + FmgrInfo *finfo_in; + FunctionCallInfo fcinfo_data_in; + } iocoerce; + + /* for EEOP_SQLVALUEFUNCTION */ + struct + { + SQLValueFunction *svf; + } sqlvaluefunction; + + /* for EEOP_NEXTVALUEEXPR */ + struct + { + Oid seqid; + Oid seqtypid; + } nextvalueexpr; + + /* for EEOP_ARRAYEXPR */ + struct + { + Datum *elemvalues; /* element values get stored here */ + bool *elemnulls; + int nelems; /* length of the above arrays */ + Oid elemtype; /* array element type */ + int16 elemlength; /* typlen of the array element type */ + bool elembyval; /* is the element type pass-by-value? */ + char elemalign; /* typalign of the element type */ + bool multidims; /* is array expression multi-D? */ + } arrayexpr; + + /* for EEOP_ARRAYCOERCE */ + struct + { + ExprState *elemexprstate; /* null if no per-element work */ + Oid resultelemtype; /* element type of result array */ + struct ArrayMapState *amstate; /* workspace for array_map */ + } arraycoerce; + + /* for EEOP_ROW */ + struct + { + TupleDesc tupdesc; /* descriptor for result tuples */ + /* workspace for the values constituting the row: */ + Datum *elemvalues; + bool *elemnulls; + } row; + + /* for EEOP_ROWCOMPARE_STEP */ + struct + { + /* lookup and call data for column comparison function */ + FmgrInfo *finfo; + FunctionCallInfo fcinfo_data; + PGFunction fn_addr; + /* target for comparison resulting in NULL */ + int jumpnull; + /* target for comparison yielding inequality */ + int jumpdone; + } rowcompare_step; + + /* for EEOP_ROWCOMPARE_FINAL */ + struct + { + RowCompareType rctype; + } rowcompare_final; + + /* for EEOP_MINMAX */ + struct + { + /* workspace for argument values */ + Datum *values; + bool *nulls; + int nelems; + /* is it GREATEST or LEAST? */ + MinMaxOp op; + /* lookup and call data for comparison function */ + FmgrInfo *finfo; + FunctionCallInfo fcinfo_data; + } minmax; + + /* for EEOP_FIELDSELECT */ + struct + { + AttrNumber fieldnum; /* field number to extract */ + Oid resulttype; /* field's type */ + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; + } fieldselect; + + /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */ + struct + { + /* original expression node */ + FieldStore *fstore; + + /* cached descriptor for composite type - filled at runtime */ + /* note that a DEFORM and FORM pair share the same cache */ + ExprEvalRowtypeCache *rowcache; + + /* workspace for column values */ + Datum *values; + bool *nulls; + int ncolumns; + } fieldstore; + + /* for EEOP_SBSREF_SUBSCRIPTS */ + struct + { + ExecEvalBoolSubroutine subscriptfunc; /* evaluation subroutine */ + /* too big to have inline */ + struct SubscriptingRefState *state; + int jumpdone; /* jump here on null */ + } sbsref_subscript; + + /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */ + struct + { + ExecEvalSubroutine subscriptfunc; /* evaluation subroutine */ + /* too big to have inline */ + struct SubscriptingRefState *state; + } sbsref; + + /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */ + struct + { + /* name of constraint */ + char *constraintname; + /* where the result of a CHECK constraint will be stored */ + Datum *checkvalue; + bool *checknull; + /* OID of domain type */ + Oid resulttype; + ErrorSaveContext *escontext; + } domaincheck; + + /* for EEOP_CONVERT_ROWTYPE */ + struct + { + Oid inputtype; /* input composite type */ + Oid outputtype; /* output composite type */ + /* these three fields are filled at runtime: */ + ExprEvalRowtypeCache *incache; /* cache for input type */ + ExprEvalRowtypeCache *outcache; /* cache for output type */ + TupleConversionMap *map; /* column mapping */ + } convert_rowtype; + + /* for EEOP_SCALARARRAYOP */ + struct + { + /* element_type/typlen/typbyval/typalign are filled at runtime */ + Oid element_type; /* InvalidOid if not yet filled */ + bool useOr; /* use OR or AND semantics? */ + int16 typlen; /* array element type storage info */ + bool typbyval; + char typalign; + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + } scalararrayop; + + /* for EEOP_HASHED_SCALARARRAYOP */ + struct + { + bool has_nulls; + bool inclause; /* true for IN and false for NOT IN */ + struct ScalarArrayOpExprHashTable *elements_tab; + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + ScalarArrayOpExpr *saop; + } hashedscalararrayop; + + /* for EEOP_XMLEXPR */ + struct + { + XmlExpr *xexpr; /* original expression node */ + /* workspace for evaluating named args, if any */ + Datum *named_argvalue; + bool *named_argnull; + /* workspace for evaluating unnamed args, if any */ + Datum *argvalue; + bool *argnull; + } xmlexpr; + + /* for EEOP_JSON_CONSTRUCTOR */ + struct + { + struct JsonConstructorExprState *jcstate; + } json_constructor; + + /* for EEOP_AGGREF */ + struct + { + int aggno; + } aggref; + + /* for EEOP_GROUPING_FUNC */ + struct + { + List *clauses; /* integer list of column numbers */ + } grouping_func; + + /* for EEOP_WINDOW_FUNC */ + struct + { + /* out-of-line state, modified by nodeWindowAgg.c */ + WindowFuncExprState *wfstate; + } window_func; + + /* for EEOP_SUBPLAN */ + struct + { + /* out-of-line state, created by nodeSubplan.c */ + SubPlanState *sstate; + } subplan; + + /* for EEOP_AGG_*DESERIALIZE */ + struct + { + FunctionCallInfo fcinfo_data; + int jumpnull; + } agg_deserialize; + + /* for EEOP_AGG_STRICT_INPUT_CHECK_NULLS / STRICT_INPUT_CHECK_ARGS */ + struct + { + /* + * For EEOP_AGG_STRICT_INPUT_CHECK_ARGS args contains pointers to + * the NullableDatums that need to be checked for NULLs. + * + * For EEOP_AGG_STRICT_INPUT_CHECK_NULLS nulls contains pointers + * to booleans that need to be checked for NULLs. + * + * Both cases currently need to exist because sometimes the + * to-be-checked nulls are in TupleTableSlot.isnull array, and + * sometimes in FunctionCallInfoBaseData.args[i].isnull. + */ + NullableDatum *args; + bool *nulls; + int nargs; + int jumpnull; + } agg_strict_input_check; + + /* for EEOP_AGG_PLAIN_PERGROUP_NULLCHECK */ + struct + { + int setoff; + int jumpnull; + } agg_plain_pergroup_nullcheck; + + /* for EEOP_AGG_PRESORTED_DISTINCT_{SINGLE,MULTI} */ + struct + { + AggStatePerTrans pertrans; + ExprContext *aggcontext; + int jumpdistinct; + } agg_presorted_distinctcheck; + + /* for EEOP_AGG_PLAIN_TRANS_[INIT_][STRICT_]{BYVAL,BYREF} */ + /* for EEOP_AGG_ORDERED_TRANS_{DATUM,TUPLE} */ + struct + { + AggStatePerTrans pertrans; + ExprContext *aggcontext; + int setno; + int transno; + int setoff; + } agg_trans; + + /* for EEOP_IS_JSON */ + struct + { + JsonIsPredicate *pred; /* original expression node */ + } is_json; + + /* for EEOP_JSONEXPR_PATH */ + struct + { + struct JsonExprState *jsestate; + } jsonexpr; + + /* for EEOP_JSONEXPR_COERCION */ + struct + { + Oid targettype; + int32 targettypmod; + bool omit_quotes; + /* exists_* fields only relevant for JSON_EXISTS_OP. */ + bool exists_coerce; + bool exists_cast_to_int; + bool exists_check_domain; + void *json_coercion_cache; + ErrorSaveContext *escontext; + } jsonexpr_coercion; + } d; +} ExprEvalStep; + +/* Enforce the size rule given in the comment above */ +StaticAssertDecl(sizeof(ExprEvalStep) <= 64, + "size of ExprEvalStep exceeds 64 bytes"); + + +/* Non-inline data for container operations */ +typedef struct SubscriptingRefState +{ + bool isassignment; /* is it assignment, or just fetch? */ + + /* workspace for type-specific subscripting code */ + void *workspace; + + /* numupper and upperprovided[] are filled at expression compile time */ + /* at runtime, subscripts are computed in upperindex[]/upperindexnull[] */ + int numupper; + bool *upperprovided; /* indicates if this position is supplied */ + Datum *upperindex; + bool *upperindexnull; + + /* similarly for lower indexes, if any */ + int numlower; + bool *lowerprovided; + Datum *lowerindex; + bool *lowerindexnull; + + /* for assignment, new value to assign is evaluated into here */ + Datum replacevalue; + bool replacenull; + + /* if we have a nested assignment, sbs_fetch_old puts old value here */ + Datum prevvalue; + bool prevnull; +} SubscriptingRefState; + +/* Execution step methods used for SubscriptingRef */ +typedef struct SubscriptExecSteps +{ + /* See nodes/subscripting.h for more detail about these */ + ExecEvalBoolSubroutine sbs_check_subscripts; /* process subscripts */ + ExecEvalSubroutine sbs_fetch; /* fetch an element */ + ExecEvalSubroutine sbs_assign; /* assign to an element */ + ExecEvalSubroutine sbs_fetch_old; /* fetch old value for assignment */ +} SubscriptExecSteps; + +/* EEOP_JSON_CONSTRUCTOR state, too big to inline */ +typedef struct JsonConstructorExprState +{ + JsonConstructorExpr *constructor; + Datum *arg_values; + bool *arg_nulls; + Oid *arg_types; + struct + { + int category; + Oid outfuncid; + } *arg_type_cache; /* cache for datum_to_json[b]() */ + int nargs; +} JsonConstructorExprState; + + +/* functions in execExpr.c */ +extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s); + +/* functions in execExprInterp.c */ +extern void ExecReadyInterpretedExpr(ExprState *state); +extern ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op); + +extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull); +extern void CheckExprStillValid(ExprState *state, ExprContext *econtext); + +/* + * Non fast-path execution functions. These are externs instead of statics in + * execExprInterp.c, because that allows them to be used by other methods of + * expression evaluation, reducing code duplication. + */ +extern void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op); +extern void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op); +extern void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalRow(ExprState *state, ExprEvalStep *op); +extern void ExecEvalMinMax(ExprState *state, ExprEvalStep *op); +extern void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op); +extern void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op); +extern void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op); +extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op); +extern void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op); +extern int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op); +extern void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op); +extern void ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, + ExprContext *econtext, TupleTableSlot *slot); + +extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, + ExprContext *aggcontext); +extern Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans, + Datum newValue, bool newValueIsNull, + Datum oldValue, bool oldValueIsNull); +extern bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, + AggStatePerTrans pertrans); +extern bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate, + AggStatePerTrans pertrans); +extern void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); +extern void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, + ExprContext *econtext); + +#endif /* EXEC_EXPR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execParallel.h b/platform/dbops/binaries/postgres/include/server/executor/execParallel.h new file mode 100644 index 0000000000000000000000000000000000000000..6b8c00bb0fbfac71d42a13261dde782c638e869b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execParallel.h @@ -0,0 +1,51 @@ +/*-------------------------------------------------------------------- + * execParallel.h + * POSTGRES parallel execution interface + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execParallel.h + *-------------------------------------------------------------------- + */ + +#ifndef EXECPARALLEL_H +#define EXECPARALLEL_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "utils/dsa.h" + +typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation; + +typedef struct ParallelExecutorInfo +{ + PlanState *planstate; /* plan subtree we're running in parallel */ + ParallelContext *pcxt; /* parallel context we're using */ + BufferUsage *buffer_usage; /* points to bufusage area in DSM */ + WalUsage *wal_usage; /* walusage area in DSM */ + SharedExecutorInstrumentation *instrumentation; /* optional */ + struct SharedJitInstrumentation *jit_instrumentation; /* optional */ + dsa_area *area; /* points to DSA area in DSM */ + dsa_pointer param_exec; /* serialized PARAM_EXEC parameters */ + bool finished; /* set true by ExecParallelFinish */ + /* These two arrays have pcxt->nworkers_launched entries: */ + shm_mq_handle **tqueue; /* tuple queues for worker output */ + struct TupleQueueReader **reader; /* tuple reader/writer support */ +} ParallelExecutorInfo; + +extern ParallelExecutorInfo *ExecInitParallelPlan(PlanState *planstate, + EState *estate, Bitmapset *sendParams, int nworkers, + int64 tuples_needed); +extern void ExecParallelCreateReaders(ParallelExecutorInfo *pei); +extern void ExecParallelFinish(ParallelExecutorInfo *pei); +extern void ExecParallelCleanup(ParallelExecutorInfo *pei); +extern void ExecParallelReinitialize(PlanState *planstate, + ParallelExecutorInfo *pei, Bitmapset *sendParams); + +extern void ParallelQueryMain(dsm_segment *seg, shm_toc *toc); + +#endif /* EXECPARALLEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execPartition.h b/platform/dbops/binaries/postgres/include/server/executor/execPartition.h new file mode 100644 index 0000000000000000000000000000000000000000..c09bc83b2ac3c45c25aefcffa07bb9bb3d1e85e0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execPartition.h @@ -0,0 +1,131 @@ +/*-------------------------------------------------------------------- + * execPartition.h + * POSTGRES partitioning executor interface + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/executor/execPartition.h + *-------------------------------------------------------------------- + */ + +#ifndef EXECPARTITION_H +#define EXECPARTITION_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" +#include "nodes/plannodes.h" +#include "partitioning/partprune.h" + +/* See execPartition.c for the definitions. */ +typedef struct PartitionDispatchData *PartitionDispatch; +typedef struct PartitionTupleRouting PartitionTupleRouting; + +extern PartitionTupleRouting *ExecSetupPartitionTupleRouting(EState *estate, + Relation rel); +extern ResultRelInfo *ExecFindPartition(ModifyTableState *mtstate, + ResultRelInfo *rootResultRelInfo, + PartitionTupleRouting *proute, + TupleTableSlot *slot, + EState *estate); +extern void ExecCleanupTupleRouting(ModifyTableState *mtstate, + PartitionTupleRouting *proute); + + +/* + * PartitionedRelPruningData - Per-partitioned-table data for run-time pruning + * of partitions. For a multilevel partitioned table, we have one of these + * for the topmost partition plus one for each non-leaf child partition. + * + * subplan_map[] and subpart_map[] have the same definitions as in + * PartitionedRelPruneInfo (see plannodes.h); though note that here, + * subpart_map contains indexes into PartitionPruningData.partrelprunedata[]. + * + * nparts Length of subplan_map[] and subpart_map[]. + * subplan_map Subplan index by partition index, or -1. + * subpart_map Subpart index by partition index, or -1. + * present_parts A Bitmapset of the partition indexes that we + * have subplans or subparts for. + * initial_pruning_steps List of PartitionPruneSteps used to + * perform executor startup pruning. + * exec_pruning_steps List of PartitionPruneSteps used to + * perform per-scan pruning. + * initial_context If initial_pruning_steps isn't NIL, contains + * the details needed to execute those steps. + * exec_context If exec_pruning_steps isn't NIL, contains + * the details needed to execute those steps. + */ +typedef struct PartitionedRelPruningData +{ + int nparts; + int *subplan_map; + int *subpart_map; + Bitmapset *present_parts; + List *initial_pruning_steps; + List *exec_pruning_steps; + PartitionPruneContext initial_context; + PartitionPruneContext exec_context; +} PartitionedRelPruningData; + +/* + * PartitionPruningData - Holds all the run-time pruning information for + * a single partitioning hierarchy containing one or more partitions. + * partrelprunedata[] is an array ordered such that parents appear before + * their children; in particular, the first entry is the topmost partition, + * which was actually named in the SQL query. + */ +typedef struct PartitionPruningData +{ + int num_partrelprunedata; /* number of array entries */ + PartitionedRelPruningData partrelprunedata[FLEXIBLE_ARRAY_MEMBER]; +} PartitionPruningData; + +/* + * PartitionPruneState - State object required for plan nodes to perform + * run-time partition pruning. + * + * This struct can be attached to plan types which support arbitrary Lists of + * subplans containing partitions, to allow subplans to be eliminated due to + * the clauses being unable to match to any tuple that the subplan could + * possibly produce. + * + * execparamids Contains paramids of PARAM_EXEC Params found within + * any of the partprunedata structs. Pruning must be + * done again each time the value of one of these + * parameters changes. + * other_subplans Contains indexes of subplans that don't belong to any + * "partprunedata", e.g UNION ALL children that are not + * partitioned tables, or a partitioned table that the + * planner deemed run-time pruning to be useless for. + * These must not be pruned. + * prune_context A short-lived memory context in which to execute the + * partition pruning functions. + * do_initial_prune true if pruning should be performed during executor + * startup (at any hierarchy level). + * do_exec_prune true if pruning should be performed during + * executor run (at any hierarchy level). + * num_partprunedata Number of items in "partprunedata" array. + * partprunedata Array of PartitionPruningData pointers for the plan's + * partitioned relation(s), one for each partitioning + * hierarchy that requires run-time pruning. + */ +typedef struct PartitionPruneState +{ + Bitmapset *execparamids; + Bitmapset *other_subplans; + MemoryContext prune_context; + bool do_initial_prune; + bool do_exec_prune; + int num_partprunedata; + PartitionPruningData *partprunedata[FLEXIBLE_ARRAY_MEMBER]; +} PartitionPruneState; + +extern PartitionPruneState *ExecInitPartitionPruning(PlanState *planstate, + int n_total_subplans, + PartitionPruneInfo *pruneinfo, + Bitmapset **initially_valid_subplans); +extern Bitmapset *ExecFindMatchingSubPlans(PartitionPruneState *prunestate, + bool initial_prune); + +#endif /* EXECPARTITION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execdebug.h b/platform/dbops/binaries/postgres/include/server/executor/execdebug.h new file mode 100644 index 0000000000000000000000000000000000000000..27e30b16f57a5238977d52495e41807ec7cece9b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execdebug.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * execdebug.h + * #defines governing debugging behaviour in the executor + * + * XXX this is all pretty old and crufty. Newer code tends to use elog() + * for debug printouts, because that's more flexible than printf(). + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execdebug.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECDEBUG_H +#define EXECDEBUG_H + +#include "executor/executor.h" +#include "nodes/print.h" + +/* ---------------------------------------------------------------- + * debugging defines. + * + * If you want certain debugging behaviour, then #define + * the variable to 1. No need to explicitly #undef by default, + * since we can use -D compiler options to enable features. + * - thomas 1999-02-20 + * ---------------------------------------------------------------- + */ + +/* ---------------- + * EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the + * nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c + * ---------------- +#undef EXEC_NESTLOOPDEBUG + */ + +/* ---------------- + * EXEC_SORTDEBUG is a flag which turns on debugging of + * the ExecSort() stuff by SO_printf() in nodeSort.c + * ---------------- +#undef EXEC_SORTDEBUG + */ + +/* ---------------- + * EXEC_MERGEJOINDEBUG is a flag which turns on debugging of + * the ExecMergeJoin() stuff by MJ_printf() in nodeMergejoin.c + * ---------------- +#undef EXEC_MERGEJOINDEBUG + */ + +/* ---------------------------------------------------------------- + * #defines controlled by above definitions + * + * Note: most of these are "incomplete" because I didn't + * need the ones not defined. More should be added + * only as necessary -cim 10/26/89 + * ---------------------------------------------------------------- + */ +#define T_OR_F(b) ((b) ? "true" : "false") +#define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple") + +/* ---------------- + * nest loop debugging defines + * ---------------- + */ +#ifdef EXEC_NESTLOOPDEBUG +#define NL_nodeDisplay(l) nodeDisplay(l) +#define NL_printf(s) printf(s) +#define NL1_printf(s, a) printf(s, a) +#define ENL1_printf(message) printf("ExecNestLoop: %s\n", message) +#else +#define NL_nodeDisplay(l) +#define NL_printf(s) +#define NL1_printf(s, a) +#define ENL1_printf(message) +#endif /* EXEC_NESTLOOPDEBUG */ + +/* ---------------- + * sort node debugging defines + * ---------------- + */ +#ifdef EXEC_SORTDEBUG +#define SO_nodeDisplay(l) nodeDisplay(l) +#define SO_printf(s) printf(s) +#define SO1_printf(s, p) printf(s, p) +#define SO2_printf(s, p1, p2) printf(s, p1, p2) +#else +#define SO_nodeDisplay(l) +#define SO_printf(s) +#define SO1_printf(s, p) +#define SO2_printf(s, p1, p2) +#endif /* EXEC_SORTDEBUG */ + +/* ---------------- + * merge join debugging defines + * ---------------- + */ +#ifdef EXEC_MERGEJOINDEBUG + +#define MJ_nodeDisplay(l) nodeDisplay(l) +#define MJ_printf(s) printf(s) +#define MJ1_printf(s, p) printf(s, p) +#define MJ2_printf(s, p1, p2) printf(s, p1, p2) +#define MJ_debugtup(slot) debugtup(slot, NULL) +#define MJ_dump(state) ExecMergeTupleDump(state) +#define MJ_DEBUG_COMPARE(res) \ + MJ1_printf(" MJCompare() returns %d\n", (res)) +#define MJ_DEBUG_QUAL(clause, res) \ + MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \ + CppAsString(clause), T_OR_F(res)) +#define MJ_DEBUG_PROC_NODE(slot) \ + MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \ + CppAsString(slot), NULL_OR_TUPLE(slot)) +#else + +#define MJ_nodeDisplay(l) +#define MJ_printf(s) +#define MJ1_printf(s, p) +#define MJ2_printf(s, p1, p2) +#define MJ_debugtup(slot) +#define MJ_dump(state) +#define MJ_DEBUG_COMPARE(res) +#define MJ_DEBUG_QUAL(clause, res) +#define MJ_DEBUG_PROC_NODE(slot) +#endif /* EXEC_MERGEJOINDEBUG */ + +#endif /* EXECDEBUG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/execdesc.h b/platform/dbops/binaries/postgres/include/server/executor/execdesc.h new file mode 100644 index 0000000000000000000000000000000000000000..79e8b6311145ccaf39bf31e68543bacac28d1746 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/execdesc.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * execdesc.h + * plan and query descriptor accessor macros used by the executor + * and related modules. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/execdesc.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECDESC_H +#define EXECDESC_H + +#include "nodes/execnodes.h" +#include "tcop/dest.h" + + +/* ---------------- + * query descriptor: + * + * a QueryDesc encapsulates everything that the executor + * needs to execute the query. + * + * For the convenience of SQL-language functions, we also support QueryDescs + * containing utility statements; these must not be passed to the executor + * however. + * --------------------- + */ +typedef struct QueryDesc +{ + /* These fields are provided by CreateQueryDesc */ + CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */ + PlannedStmt *plannedstmt; /* planner's output (could be utility, too) */ + const char *sourceText; /* source text of the query */ + Snapshot snapshot; /* snapshot to use for query */ + Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */ + DestReceiver *dest; /* the destination for tuple output */ + ParamListInfo params; /* param values being passed in */ + QueryEnvironment *queryEnv; /* query environment passed in */ + int instrument_options; /* OR of InstrumentOption flags */ + + /* These fields are set by ExecutorStart */ + TupleDesc tupDesc; /* descriptor for result tuples */ + EState *estate; /* executor's query-wide state */ + PlanState *planstate; /* tree of per-plan-node state */ + + /* This field is set by ExecutePlan */ + bool already_executed; /* true if previously executed */ + + /* This is always set NULL by the core system, but plugins can change it */ + struct Instrumentation *totaltime; /* total time spent in ExecutorRun */ +} QueryDesc; + +/* in pquery.c */ +extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, + const char *sourceText, + Snapshot snapshot, + Snapshot crosscheck_snapshot, + DestReceiver *dest, + ParamListInfo params, + QueryEnvironment *queryEnv, + int instrument_options); + +extern void FreeQueryDesc(QueryDesc *qdesc); + +#endif /* EXECDESC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/executor.h b/platform/dbops/binaries/postgres/include/server/executor/executor.h new file mode 100644 index 0000000000000000000000000000000000000000..9770752ea3c1bdb8b446ecf732f332f39a4aafbe --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/executor.h @@ -0,0 +1,681 @@ +/*------------------------------------------------------------------------- + * + * executor.h + * support for the POSTGRES executor module + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/executor.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECUTOR_H +#define EXECUTOR_H + +#include "executor/execdesc.h" +#include "fmgr.h" +#include "nodes/lockoptions.h" +#include "nodes/parsenodes.h" +#include "utils/memutils.h" + + +/* + * The "eflags" argument to ExecutorStart and the various ExecInitNode + * routines is a bitwise OR of the following flag bits, which tell the + * called plan node what to expect. Note that the flags will get modified + * as they are passed down the plan tree, since an upper node may require + * functionality in its subnode not demanded of the plan as a whole + * (example: MergeJoin requires mark/restore capability in its inner input), + * or an upper node may shield its input from some functionality requirement + * (example: Materialize shields its input from needing to do backward scan). + * + * EXPLAIN_ONLY indicates that the plan tree is being initialized just so + * EXPLAIN can print it out; it will not be run. Hence, no side-effects + * of startup should occur. However, error checks (such as permission checks) + * should be performed. + * + * EXPLAIN_GENERIC can only be used together with EXPLAIN_ONLY. It indicates + * that a generic plan is being shown using EXPLAIN (GENERIC_PLAN), which + * means that missing parameter values must be tolerated. Currently, the only + * effect is to suppress execution-time partition pruning. + * + * REWIND indicates that the plan node should try to efficiently support + * rescans without parameter changes. (Nodes must support ExecReScan calls + * in any case, but if this flag was not given, they are at liberty to do it + * through complete recalculation. Note that a parameter change forces a + * full recalculation in any case.) + * + * BACKWARD indicates that the plan node must respect the es_direction flag. + * When this is not passed, the plan node will only be run forwards. + * + * MARK indicates that the plan node must support Mark/Restore calls. + * When this is not passed, no Mark/Restore will occur. + * + * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling + * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily + * mean that the plan can't queue any AFTER triggers; just that the caller + * is responsible for there being a trigger context for them to be queued in. + * + * WITH_NO_DATA indicates that we are performing REFRESH MATERIALIZED VIEW + * ... WITH NO DATA. Currently, the only effect is to suppress errors about + * scanning unpopulated materialized views. + */ +#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ +#define EXEC_FLAG_EXPLAIN_GENERIC 0x0002 /* EXPLAIN (GENERIC_PLAN) */ +#define EXEC_FLAG_REWIND 0x0004 /* need efficient rescan */ +#define EXEC_FLAG_BACKWARD 0x0008 /* need backward scan */ +#define EXEC_FLAG_MARK 0x0010 /* need mark/restore */ +#define EXEC_FLAG_SKIP_TRIGGERS 0x0020 /* skip AfterTrigger setup */ +#define EXEC_FLAG_WITH_NO_DATA 0x0040 /* REFRESH ... WITH NO DATA */ + + +/* Hook for plugins to get control in ExecutorStart() */ +typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); +extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; + +/* Hook for plugins to get control in ExecutorRun() */ +typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, + ScanDirection direction, + uint64 count, + bool execute_once); +extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; + +/* Hook for plugins to get control in ExecutorFinish() */ +typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc); +extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook; + +/* Hook for plugins to get control in ExecutorEnd() */ +typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc); +extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; + +/* Hook for plugins to get control in ExecCheckPermissions() */ +typedef bool (*ExecutorCheckPerms_hook_type) (List *rangeTable, + List *rtePermInfos, + bool ereport_on_violation); +extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; + + +/* + * prototypes from functions in execAmi.c + */ +struct Path; /* avoid including pathnodes.h here */ + +extern void ExecReScan(PlanState *node); +extern void ExecMarkPos(PlanState *node); +extern void ExecRestrPos(PlanState *node); +extern bool ExecSupportsMarkRestore(struct Path *pathnode); +extern bool ExecSupportsBackwardScan(Plan *node); +extern bool ExecMaterializesOutput(NodeTag plantype); + +/* + * prototypes from functions in execCurrent.c + */ +extern bool execCurrentOf(CurrentOfExpr *cexpr, + ExprContext *econtext, + Oid table_oid, + ItemPointer current_tid); + +/* + * prototypes from functions in execGrouping.c + */ +extern ExprState *execTuplesMatchPrepare(TupleDesc desc, + int numCols, + const AttrNumber *keyColIdx, + const Oid *eqOperators, + const Oid *collations, + PlanState *parent); +extern void execTuplesHashPrepare(int numCols, + const Oid *eqOperators, + Oid **eqFuncOids, + FmgrInfo **hashFunctions); +extern TupleHashTable BuildTupleHashTable(PlanState *parent, + TupleDesc inputDesc, + int numCols, AttrNumber *keyColIdx, + const Oid *eqfuncoids, + FmgrInfo *hashfunctions, + Oid *collations, + long nbuckets, Size additionalsize, + MemoryContext tablecxt, + MemoryContext tempcxt, bool use_variable_hash_iv); +extern TupleHashTable BuildTupleHashTableExt(PlanState *parent, + TupleDesc inputDesc, + int numCols, AttrNumber *keyColIdx, + const Oid *eqfuncoids, + FmgrInfo *hashfunctions, + Oid *collations, + long nbuckets, Size additionalsize, + MemoryContext metacxt, + MemoryContext tablecxt, + MemoryContext tempcxt, bool use_variable_hash_iv); +extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, + TupleTableSlot *slot, + bool *isnew, uint32 *hash); +extern uint32 TupleHashTableHash(TupleHashTable hashtable, + TupleTableSlot *slot); +extern TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable, + TupleTableSlot *slot, + bool *isnew, uint32 hash); +extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, + TupleTableSlot *slot, + ExprState *eqcomp, + FmgrInfo *hashfunctions); +extern void ResetTupleHashTable(TupleHashTable hashtable); + +/* + * prototypes from functions in execJunk.c + */ +extern JunkFilter *ExecInitJunkFilter(List *targetList, + TupleTableSlot *slot); +extern JunkFilter *ExecInitJunkFilterConversion(List *targetList, + TupleDesc cleanTupType, + TupleTableSlot *slot); +extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, + const char *attrName); +extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, + const char *attrName); +extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter, + TupleTableSlot *slot); + +/* + * ExecGetJunkAttribute + * + * Given a junk filter's input tuple (slot) and a junk attribute's number + * previously found by ExecFindJunkAttribute, extract & return the value and + * isNull flag of the attribute. + */ +#ifndef FRONTEND +static inline Datum +ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull) +{ + Assert(attno > 0); + return slot_getattr(slot, attno, isNull); +} +#endif + +/* + * prototypes from functions in execMain.c + */ +extern void ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void ExecutorRun(QueryDesc *queryDesc, + ScanDirection direction, uint64 count, bool execute_once); +extern void standard_ExecutorRun(QueryDesc *queryDesc, + ScanDirection direction, uint64 count, bool execute_once); +extern void ExecutorFinish(QueryDesc *queryDesc); +extern void standard_ExecutorFinish(QueryDesc *queryDesc); +extern void ExecutorEnd(QueryDesc *queryDesc); +extern void standard_ExecutorEnd(QueryDesc *queryDesc); +extern void ExecutorRewind(QueryDesc *queryDesc); +extern bool ExecCheckPermissions(List *rangeTable, + List *rteperminfos, bool ereport_on_violation); +extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, + List *mergeActions); +extern void InitResultRelInfo(ResultRelInfo *resultRelInfo, + Relation resultRelationDesc, + Index resultRelationIndex, + ResultRelInfo *partition_root_rri, + int instrument_options); +extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid, + ResultRelInfo *rootRelInfo); +extern List *ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo); +extern void ExecConstraints(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate, bool emitError); +extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate); +extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo); +extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok); +extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist); +extern TupleTableSlot *EvalPlanQual(EPQState *epqstate, Relation relation, + Index rti, TupleTableSlot *inputslot); +extern void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, + Plan *subplan, List *auxrowmarks, + int epqParam, List *resultRelations); +extern void EvalPlanQualSetPlan(EPQState *epqstate, + Plan *subplan, List *auxrowmarks); +extern TupleTableSlot *EvalPlanQualSlot(EPQState *epqstate, + Relation relation, Index rti); + +#define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot)) +extern bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot); +extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate); +extern void EvalPlanQualBegin(EPQState *epqstate); +extern void EvalPlanQualEnd(EPQState *epqstate); + +/* + * functions in execProcnode.c + */ +extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags); +extern void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function); +extern Node *MultiExecProcNode(PlanState *node); +extern void ExecEndNode(PlanState *node); +extern void ExecShutdownNode(PlanState *node); +extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node); + + +/* ---------------------------------------------------------------- + * ExecProcNode + * + * Execute the given node to return a(nother) tuple. + * ---------------------------------------------------------------- + */ +#ifndef FRONTEND +static inline TupleTableSlot * +ExecProcNode(PlanState *node) +{ + if (node->chgParam != NULL) /* something changed? */ + ExecReScan(node); /* let ReScan handle this */ + + return node->ExecProcNode(node); +} +#endif + +/* + * prototypes from functions in execExpr.c + */ +extern ExprState *ExecInitExpr(Expr *node, PlanState *parent); +extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params); +extern ExprState *ExecInitQual(List *qual, PlanState *parent); +extern ExprState *ExecInitCheck(List *qual, PlanState *parent); +extern List *ExecInitExprList(List *nodes, PlanState *parent); +extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, + bool doSort, bool doHash, bool nullcheck); +extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, + const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, + int numCols, + const AttrNumber *keyColIdx, + const Oid *eqfunctions, + const Oid *collations, + PlanState *parent); +extern ExprState *ExecBuildParamSetEqual(TupleDesc desc, + const TupleTableSlotOps *lops, + const TupleTableSlotOps *rops, + const Oid *eqfunctions, + const Oid *collations, + const List *param_exprs, + PlanState *parent); +extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList, + ExprContext *econtext, + TupleTableSlot *slot, + PlanState *parent, + TupleDesc inputDesc); +extern ProjectionInfo *ExecBuildUpdateProjection(List *targetList, + bool evalTargetList, + List *targetColnos, + TupleDesc relDesc, + ExprContext *econtext, + TupleTableSlot *slot, + PlanState *parent); +extern ExprState *ExecPrepareExpr(Expr *node, EState *estate); +extern ExprState *ExecPrepareQual(List *qual, EState *estate); +extern ExprState *ExecPrepareCheck(List *qual, EState *estate); +extern List *ExecPrepareExprList(List *nodes, EState *estate); + +/* + * ExecEvalExpr + * + * Evaluate expression identified by "state" in the execution context + * given by "econtext". *isNull is set to the is-null flag for the result, + * and the Datum value is the function result. + * + * The caller should already have switched into the temporary memory + * context econtext->ecxt_per_tuple_memory. The convenience entry point + * ExecEvalExprSwitchContext() is provided for callers who don't prefer to + * do the switch in an outer loop. + */ +#ifndef FRONTEND +static inline Datum +ExecEvalExpr(ExprState *state, + ExprContext *econtext, + bool *isNull) +{ + return state->evalfunc(state, econtext, isNull); +} +#endif + +/* + * ExecEvalExprSwitchContext + * + * Same as ExecEvalExpr, but get into the right allocation context explicitly. + */ +#ifndef FRONTEND +static inline Datum +ExecEvalExprSwitchContext(ExprState *state, + ExprContext *econtext, + bool *isNull) +{ + Datum retDatum; + MemoryContext oldContext; + + oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); + retDatum = state->evalfunc(state, econtext, isNull); + MemoryContextSwitchTo(oldContext); + return retDatum; +} +#endif + +/* + * ExecProject + * + * Projects a tuple based on projection info and stores it in the slot passed + * to ExecBuildProjectionInfo(). + * + * Note: the result is always a virtual tuple; therefore it may reference + * the contents of the exprContext's scan tuples and/or temporary results + * constructed in the exprContext. If the caller wishes the result to be + * valid longer than that data will be valid, he must call ExecMaterializeSlot + * on the result slot. + */ +#ifndef FRONTEND +static inline TupleTableSlot * +ExecProject(ProjectionInfo *projInfo) +{ + ExprContext *econtext = projInfo->pi_exprContext; + ExprState *state = &projInfo->pi_state; + TupleTableSlot *slot = state->resultslot; + bool isnull; + + /* + * Clear any former contents of the result slot. This makes it safe for + * us to use the slot's Datum/isnull arrays as workspace. + */ + ExecClearTuple(slot); + + /* Run the expression, discarding scalar result from the last column. */ + (void) ExecEvalExprSwitchContext(state, econtext, &isnull); + + /* + * Successfully formed a result row. Mark the result slot as containing a + * valid virtual tuple (inlined version of ExecStoreVirtualTuple()). + */ + slot->tts_flags &= ~TTS_FLAG_EMPTY; + slot->tts_nvalid = slot->tts_tupleDescriptor->natts; + + return slot; +} +#endif + +/* + * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via + * ExecPrepareQual). Returns true if qual is satisfied, else false. + * + * Note: ExecQual used to have a third argument "resultForNull". The + * behavior of this function now corresponds to resultForNull == false. + * If you want the resultForNull == true behavior, see ExecCheck. + */ +#ifndef FRONTEND +static inline bool +ExecQual(ExprState *state, ExprContext *econtext) +{ + Datum ret; + bool isnull; + + /* short-circuit (here and in ExecInitQual) for empty restriction list */ + if (state == NULL) + return true; + + /* verify that expression was compiled using ExecInitQual */ + Assert(state->flags & EEO_FLAG_IS_QUAL); + + ret = ExecEvalExprSwitchContext(state, econtext, &isnull); + + /* EEOP_QUAL should never return NULL */ + Assert(!isnull); + + return DatumGetBool(ret); +} +#endif + +/* + * ExecQualAndReset() - evaluate qual with ExecQual() and reset expression + * context. + */ +#ifndef FRONTEND +static inline bool +ExecQualAndReset(ExprState *state, ExprContext *econtext) +{ + bool ret = ExecQual(state, econtext); + + /* inline ResetExprContext, to avoid ordering issue in this file */ + MemoryContextReset(econtext->ecxt_per_tuple_memory); + return ret; +} +#endif + +extern bool ExecCheck(ExprState *state, ExprContext *econtext); + +/* + * prototypes from functions in execSRF.c + */ +extern SetExprState *ExecInitTableFunctionResult(Expr *expr, + ExprContext *econtext, PlanState *parent); +extern Tuplestorestate *ExecMakeTableFunctionResult(SetExprState *setexpr, + ExprContext *econtext, + MemoryContext argContext, + TupleDesc expectedDesc, + bool randomAccess); +extern SetExprState *ExecInitFunctionResultSet(Expr *expr, + ExprContext *econtext, PlanState *parent); +extern Datum ExecMakeFunctionResultSet(SetExprState *fcache, + ExprContext *econtext, + MemoryContext argContext, + bool *isNull, + ExprDoneCond *isDone); + +/* + * prototypes from functions in execScan.c + */ +typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node); +typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot); + +extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, + ExecScanRecheckMtd recheckMtd); +extern void ExecAssignScanProjectionInfo(ScanState *node); +extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno); +extern void ExecScanReScan(ScanState *node); + +/* + * prototypes from functions in execTuples.c + */ +extern void ExecInitResultTypeTL(PlanState *planstate); +extern void ExecInitResultSlot(PlanState *planstate, + const TupleTableSlotOps *tts_ops); +extern void ExecInitResultTupleSlotTL(PlanState *planstate, + const TupleTableSlotOps *tts_ops); +extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, + TupleDesc tupledesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate, + TupleDesc tupledesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType, + const TupleTableSlotOps *tts_ops); +extern TupleDesc ExecTypeFromTL(List *targetList); +extern TupleDesc ExecCleanTypeFromTL(List *targetList); +extern TupleDesc ExecTypeFromExprList(List *exprList); +extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList); +extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg); + +typedef struct TupOutputState +{ + TupleTableSlot *slot; + DestReceiver *dest; +} TupOutputState; + +extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest, + TupleDesc tupdesc, + const TupleTableSlotOps *tts_ops); +extern void do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull); +extern void do_text_output_multiline(TupOutputState *tstate, const char *txt); +extern void end_tup_output(TupOutputState *tstate); + +/* + * Write a single line of text given as a C string. + * + * Should only be used with a single-TEXT-attribute tupdesc. + */ +#define do_text_output_oneline(tstate, str_to_emit) \ + do { \ + Datum values_[1]; \ + bool isnull_[1]; \ + values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \ + isnull_[0] = false; \ + do_tup_output(tstate, values_, isnull_); \ + pfree(DatumGetPointer(values_[0])); \ + } while (0) + + +/* + * prototypes from functions in execUtils.c + */ +extern EState *CreateExecutorState(void); +extern void FreeExecutorState(EState *estate); +extern ExprContext *CreateExprContext(EState *estate); +extern ExprContext *CreateWorkExprContext(EState *estate); +extern ExprContext *CreateStandaloneExprContext(void); +extern void FreeExprContext(ExprContext *econtext, bool isCommit); +extern void ReScanExprContext(ExprContext *econtext); + +#define ResetExprContext(econtext) \ + MemoryContextReset((econtext)->ecxt_per_tuple_memory) + +extern ExprContext *MakePerTupleExprContext(EState *estate); + +/* Get an EState's per-output-tuple exprcontext, making it if first use */ +#define GetPerTupleExprContext(estate) \ + ((estate)->es_per_tuple_exprcontext ? \ + (estate)->es_per_tuple_exprcontext : \ + MakePerTupleExprContext(estate)) + +#define GetPerTupleMemoryContext(estate) \ + (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory) + +/* Reset an EState's per-output-tuple exprcontext, if one's been created */ +#define ResetPerTupleExprContext(estate) \ + do { \ + if ((estate)->es_per_tuple_exprcontext) \ + ResetExprContext((estate)->es_per_tuple_exprcontext); \ + } while (0) + +extern void ExecAssignExprContext(EState *estate, PlanState *planstate); +extern TupleDesc ExecGetResultType(PlanState *planstate); +extern const TupleTableSlotOps *ExecGetResultSlotOps(PlanState *planstate, + bool *isfixed); +extern void ExecAssignProjectionInfo(PlanState *planstate, + TupleDesc inputDesc); +extern void ExecConditionalAssignProjectionInfo(PlanState *planstate, + TupleDesc inputDesc, int varno); +extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc); +extern void ExecCreateScanSlotFromOuterPlan(EState *estate, + ScanState *scanstate, + const TupleTableSlotOps *tts_ops); + +extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid); + +extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags); + +extern void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos); +extern void ExecCloseRangeTableRelations(EState *estate); +extern void ExecCloseResultRelations(EState *estate); + +static inline RangeTblEntry * +exec_rt_fetch(Index rti, EState *estate) +{ + return (RangeTblEntry *) list_nth(estate->es_range_table, rti - 1); +} + +extern Relation ExecGetRangeTableRelation(EState *estate, Index rti); +extern void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, + Index rti); + +extern int executor_errposition(EState *estate, int location); + +extern void RegisterExprContextCallback(ExprContext *econtext, + ExprContextCallbackFunction function, + Datum arg); +extern void UnregisterExprContextCallback(ExprContext *econtext, + ExprContextCallbackFunction function, + Datum arg); + +extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname, + bool *isNull); +extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno, + bool *isNull); + +extern int ExecTargetListLength(List *targetlist); +extern int ExecCleanTargetListLength(List *targetlist); + +extern TupleTableSlot *ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleTableSlot *ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo); +extern TupleConversionMap *ExecGetChildToRootMap(ResultRelInfo *resultRelInfo); +extern TupleConversionMap *ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate); + +extern Oid ExecGetResultRelCheckAsUser(ResultRelInfo *relInfo, EState *estate); +extern Bitmapset *ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate); +extern Bitmapset *ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate); + +/* + * prototypes from functions in execIndexing.c + */ +extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative); +extern void ExecCloseIndices(ResultRelInfo *resultRelInfo); +extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, EState *estate, + bool update, + bool noDupErr, + bool *specConflict, List *arbiterIndexes, + bool onlySummarizing); +extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, + TupleTableSlot *slot, + EState *estate, ItemPointer conflictTid, + List *arbiterIndexes); +extern void check_exclusion_constraint(Relation heap, Relation index, + IndexInfo *indexInfo, + ItemPointer tupleid, + const Datum *values, const bool *isnull, + EState *estate, bool newIndex); + +/* + * prototypes from functions in execReplication.c + */ +extern StrategyNumber get_equal_strategy_number_for_am(Oid am); +extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, + LockTupleMode lockmode, + TupleTableSlot *searchslot, + TupleTableSlot *outslot); +extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, + TupleTableSlot *searchslot, TupleTableSlot *outslot); + +extern void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo, + EState *estate, TupleTableSlot *slot); +extern void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo, + EState *estate, EPQState *epqstate, + TupleTableSlot *searchslot, TupleTableSlot *slot); +extern void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo, + EState *estate, EPQState *epqstate, + TupleTableSlot *searchslot); +extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd); + +extern void CheckSubscriptionRelkind(char relkind, const char *nspname, + const char *relname); + +/* + * prototypes from functions in nodeModifyTable.c + */ +extern TupleTableSlot *ExecGetUpdateNewTuple(ResultRelInfo *relinfo, + TupleTableSlot *planSlot, + TupleTableSlot *oldSlot); +extern ResultRelInfo *ExecLookupResultRelByOid(ModifyTableState *node, + Oid resultoid, + bool missing_ok, + bool update_cache); + +#endif /* EXECUTOR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/functions.h b/platform/dbops/binaries/postgres/include/server/executor/functions.h new file mode 100644 index 0000000000000000000000000000000000000000..27f948c6f52eb42615b02f3dd7d5d43fc253eed0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/functions.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * functions.h + * Declarations for execution of SQL-language functions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/functions.h + * + *------------------------------------------------------------------------- + */ +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "nodes/execnodes.h" +#include "tcop/dest.h" + +/* + * Data structure needed by the parser callback hooks to resolve parameter + * references during parsing of a SQL function's body. This is separate from + * SQLFunctionCache since we sometimes do parsing separately from execution. + */ +typedef struct SQLFunctionParseInfo +{ + char *fname; /* function's name */ + int nargs; /* number of input arguments */ + Oid *argtypes; /* resolved types of input arguments */ + char **argnames; /* names of input arguments; NULL if none */ + /* Note that argnames[i] can be NULL, if some args are unnamed */ + Oid collation; /* function's input collation, if known */ +} SQLFunctionParseInfo; + +typedef SQLFunctionParseInfo *SQLFunctionParseInfoPtr; + +extern Datum fmgr_sql(PG_FUNCTION_ARGS); + +extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple, + Node *call_expr, + Oid inputCollation); + +extern void sql_fn_parser_setup(struct ParseState *pstate, + SQLFunctionParseInfoPtr pinfo); + +extern void check_sql_fn_statements(List *queryTreeLists); + +extern bool check_sql_fn_retval(List *queryTreeLists, + Oid rettype, TupleDesc rettupdesc, + char prokind, + bool insertDroppedCols, + List **resultTargetList); + +extern DestReceiver *CreateSQLFunctionDestReceiver(void); + +#endif /* FUNCTIONS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/hashjoin.h b/platform/dbops/binaries/postgres/include/server/executor/hashjoin.h new file mode 100644 index 0000000000000000000000000000000000000000..9197846cda75a1be8c2d4212111cbda311d00951 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/hashjoin.h @@ -0,0 +1,377 @@ +/*------------------------------------------------------------------------- + * + * hashjoin.h + * internal structures for hash joins + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/hashjoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef HASHJOIN_H +#define HASHJOIN_H + +#include "nodes/execnodes.h" +#include "port/atomics.h" +#include "storage/barrier.h" +#include "storage/buffile.h" +#include "storage/lwlock.h" + +/* ---------------------------------------------------------------- + * hash-join hash table structures + * + * Each active hashjoin has a HashJoinTable structure, which is + * palloc'd in the executor's per-query context. Other storage needed for + * each hashjoin is kept in child contexts, three for each hashjoin: + * - HashTableContext (hashCxt): the parent hash table storage context + * - HashSpillContext (spillCxt): storage for temp files buffers + * - HashBatchContext (batchCxt): storage for a batch in serial hash join + * + * The hashtable contexts are made children of the per-query context, ensuring + * that they will be discarded at end of statement even if the join is + * aborted early by an error. (Likewise, any temporary files we make will + * be cleaned up by the virtual file manager in event of an error.) + * + * Storage that should live through the entire join is allocated from the + * "hashCxt" (mainly the hashtable's metadata). Also, the "hashCxt" context is + * the parent of "spillCxt" and "batchCxt". It makes it easy and fast to + * release the storage when we don't need it anymore. + * + * Data associated with temp files is allocated in the "spillCxt" context + * which lives for the duration of the entire join as batch files' + * creation and usage may span batch execution. These files are + * explicitly destroyed by calling BufFileClose() when the code is done + * with them. The aim of this context is to help accounting for the + * memory allocated for temp files and their buffers. + * + * Finally, data used only during a single batch's execution is allocated + * in the "batchCxt". By resetting the batchCxt at the end of each batch, + * we free all the per-batch storage reliably and without tedium. + * + * During first scan of inner relation, we get its tuples from executor. + * If nbatch > 1 then tuples that don't belong in first batch get saved + * into inner-batch temp files. The same statements apply for the + * first scan of the outer relation, except we write tuples to outer-batch + * temp files. After finishing the first scan, we do the following for + * each remaining batch: + * 1. Read tuples from inner batch file, load into hash buckets. + * 2. Read tuples from outer batch file, match to hash buckets and output. + * + * It is possible to increase nbatch on the fly if the in-memory hash table + * gets too big. The hash-value-to-batch computation is arranged so that this + * can only cause a tuple to go into a later batch than previously thought, + * never into an earlier batch. When we increase nbatch, we rescan the hash + * table and dump out any tuples that are now of a later batch to the correct + * inner batch file. Subsequently, while reading either inner or outer batch + * files, we might find tuples that no longer belong to the current batch; + * if so, we just dump them out to the correct batch file. + * ---------------------------------------------------------------- + */ + +/* these are in nodes/execnodes.h: */ +/* typedef struct HashJoinTupleData *HashJoinTuple; */ +/* typedef struct HashJoinTableData *HashJoinTable; */ + +typedef struct HashJoinTupleData +{ + /* link to next tuple in same bucket */ + union + { + struct HashJoinTupleData *unshared; + dsa_pointer shared; + } next; + uint32 hashvalue; /* tuple's hash code */ + /* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */ +} HashJoinTupleData; + +#define HJTUPLE_OVERHEAD MAXALIGN(sizeof(HashJoinTupleData)) +#define HJTUPLE_MINTUPLE(hjtup) \ + ((MinimalTuple) ((char *) (hjtup) + HJTUPLE_OVERHEAD)) + +/* + * If the outer relation's distribution is sufficiently nonuniform, we attempt + * to optimize the join by treating the hash values corresponding to the outer + * relation's MCVs specially. Inner relation tuples matching these hash + * values go into the "skew" hashtable instead of the main hashtable, and + * outer relation tuples with these hash values are matched against that + * table instead of the main one. Thus, tuples with these hash values are + * effectively handled as part of the first batch and will never go to disk. + * The skew hashtable is limited to SKEW_HASH_MEM_PERCENT of the total memory + * allowed for the join; while building the hashtables, we decrease the number + * of MCVs being specially treated if needed to stay under this limit. + * + * Note: you might wonder why we look at the outer relation stats for this, + * rather than the inner. One reason is that the outer relation is typically + * bigger, so we get more I/O savings by optimizing for its most common values. + * Also, for similarly-sized relations, the planner prefers to put the more + * uniformly distributed relation on the inside, so we're more likely to find + * interesting skew in the outer relation. + */ +typedef struct HashSkewBucket +{ + uint32 hashvalue; /* common hash value */ + HashJoinTuple tuples; /* linked list of inner-relation tuples */ +} HashSkewBucket; + +#define SKEW_BUCKET_OVERHEAD MAXALIGN(sizeof(HashSkewBucket)) +#define INVALID_SKEW_BUCKET_NO (-1) +#define SKEW_HASH_MEM_PERCENT 2 +#define SKEW_MIN_OUTER_FRACTION 0.01 + +/* + * To reduce palloc overhead, the HashJoinTuples for the current batch are + * packed in 32kB buffers instead of pallocing each tuple individually. + */ +typedef struct HashMemoryChunkData +{ + int ntuples; /* number of tuples stored in this chunk */ + size_t maxlen; /* size of the chunk's tuple buffer */ + size_t used; /* number of buffer bytes already used */ + + /* pointer to the next chunk (linked list) */ + union + { + struct HashMemoryChunkData *unshared; + dsa_pointer shared; + } next; + + /* + * The chunk's tuple buffer starts after the HashMemoryChunkData struct, + * at offset HASH_CHUNK_HEADER_SIZE (which must be maxaligned). Note that + * that offset is not included in "maxlen" or "used". + */ +} HashMemoryChunkData; + +typedef struct HashMemoryChunkData *HashMemoryChunk; + +#define HASH_CHUNK_SIZE (32 * 1024L) +#define HASH_CHUNK_HEADER_SIZE MAXALIGN(sizeof(HashMemoryChunkData)) +#define HASH_CHUNK_DATA(hc) (((char *) (hc)) + HASH_CHUNK_HEADER_SIZE) +/* tuples exceeding HASH_CHUNK_THRESHOLD bytes are put in their own chunk */ +#define HASH_CHUNK_THRESHOLD (HASH_CHUNK_SIZE / 4) + +/* + * For each batch of a Parallel Hash Join, we have a ParallelHashJoinBatch + * object in shared memory to coordinate access to it. Since they are + * followed by variable-sized objects, they are arranged in contiguous memory + * but not accessed directly as an array. + */ +typedef struct ParallelHashJoinBatch +{ + dsa_pointer buckets; /* array of hash table buckets */ + Barrier batch_barrier; /* synchronization for joining this batch */ + + dsa_pointer chunks; /* chunks of tuples loaded */ + size_t size; /* size of buckets + chunks in memory */ + size_t estimated_size; /* size of buckets + chunks while writing */ + size_t ntuples; /* number of tuples loaded */ + size_t old_ntuples; /* number of tuples before repartitioning */ + bool space_exhausted; + bool skip_unmatched; /* whether to abandon unmatched scan */ + + /* + * Variable-sized SharedTuplestore objects follow this struct in memory. + * See the accessor macros below. + */ +} ParallelHashJoinBatch; + +/* Accessor for inner batch tuplestore following a ParallelHashJoinBatch. */ +#define ParallelHashJoinBatchInner(batch) \ + ((SharedTuplestore *) \ + ((char *) (batch) + MAXALIGN(sizeof(ParallelHashJoinBatch)))) + +/* Accessor for outer batch tuplestore following a ParallelHashJoinBatch. */ +#define ParallelHashJoinBatchOuter(batch, nparticipants) \ + ((SharedTuplestore *) \ + ((char *) ParallelHashJoinBatchInner(batch) + \ + MAXALIGN(sts_estimate(nparticipants)))) + +/* Total size of a ParallelHashJoinBatch and tuplestores. */ +#define EstimateParallelHashJoinBatch(hashtable) \ + (MAXALIGN(sizeof(ParallelHashJoinBatch)) + \ + MAXALIGN(sts_estimate((hashtable)->parallel_state->nparticipants)) * 2) + +/* Accessor for the nth ParallelHashJoinBatch given the base. */ +#define NthParallelHashJoinBatch(base, n) \ + ((ParallelHashJoinBatch *) \ + ((char *) (base) + \ + EstimateParallelHashJoinBatch(hashtable) * (n))) + +/* + * Each backend requires a small amount of per-batch state to interact with + * each ParallelHashJoinBatch. + */ +typedef struct ParallelHashJoinBatchAccessor +{ + ParallelHashJoinBatch *shared; /* pointer to shared state */ + + /* Per-backend partial counters to reduce contention. */ + size_t preallocated; /* pre-allocated space for this backend */ + size_t ntuples; /* number of tuples */ + size_t size; /* size of partition in memory */ + size_t estimated_size; /* size of partition on disk */ + size_t old_ntuples; /* how many tuples before repartitioning? */ + bool at_least_one_chunk; /* has this backend allocated a chunk? */ + bool outer_eof; /* has this process hit end of batch? */ + bool done; /* flag to remember that a batch is done */ + SharedTuplestoreAccessor *inner_tuples; + SharedTuplestoreAccessor *outer_tuples; +} ParallelHashJoinBatchAccessor; + +/* + * While hashing the inner relation, any participant might determine that it's + * time to increase the number of buckets to reduce the load factor or batches + * to reduce the memory size. This is indicated by setting the growth flag to + * these values. + */ +typedef enum ParallelHashGrowth +{ + /* The current dimensions are sufficient. */ + PHJ_GROWTH_OK, + /* The load factor is too high, so we need to add buckets. */ + PHJ_GROWTH_NEED_MORE_BUCKETS, + /* The memory budget would be exhausted, so we need to repartition. */ + PHJ_GROWTH_NEED_MORE_BATCHES, + /* Repartitioning didn't help last time, so don't try to do that again. */ + PHJ_GROWTH_DISABLED, +} ParallelHashGrowth; + +/* + * The shared state used to coordinate a Parallel Hash Join. This is stored + * in the DSM segment. + */ +typedef struct ParallelHashJoinState +{ + dsa_pointer batches; /* array of ParallelHashJoinBatch */ + dsa_pointer old_batches; /* previous generation during repartition */ + int nbatch; /* number of batches now */ + int old_nbatch; /* previous number of batches */ + int nbuckets; /* number of buckets */ + ParallelHashGrowth growth; /* control batch/bucket growth */ + dsa_pointer chunk_work_queue; /* chunk work queue */ + int nparticipants; + size_t space_allowed; + size_t total_tuples; /* total number of inner tuples */ + LWLock lock; /* lock protecting the above */ + + Barrier build_barrier; /* synchronization for the build phases */ + Barrier grow_batches_barrier; + Barrier grow_buckets_barrier; + pg_atomic_uint32 distributor; /* counter for load balancing */ + + SharedFileSet fileset; /* space for shared temporary files */ +} ParallelHashJoinState; + +/* The phases for building batches, used by build_barrier. */ +#define PHJ_BUILD_ELECT 0 +#define PHJ_BUILD_ALLOCATE 1 +#define PHJ_BUILD_HASH_INNER 2 +#define PHJ_BUILD_HASH_OUTER 3 +#define PHJ_BUILD_RUN 4 +#define PHJ_BUILD_FREE 5 + +/* The phases for probing each batch, used by for batch_barrier. */ +#define PHJ_BATCH_ELECT 0 +#define PHJ_BATCH_ALLOCATE 1 +#define PHJ_BATCH_LOAD 2 +#define PHJ_BATCH_PROBE 3 +#define PHJ_BATCH_SCAN 4 +#define PHJ_BATCH_FREE 5 + +/* The phases of batch growth while hashing, for grow_batches_barrier. */ +#define PHJ_GROW_BATCHES_ELECT 0 +#define PHJ_GROW_BATCHES_REALLOCATE 1 +#define PHJ_GROW_BATCHES_REPARTITION 2 +#define PHJ_GROW_BATCHES_DECIDE 3 +#define PHJ_GROW_BATCHES_FINISH 4 +#define PHJ_GROW_BATCHES_PHASE(n) ((n) % 5) /* circular phases */ + +/* The phases of bucket growth while hashing, for grow_buckets_barrier. */ +#define PHJ_GROW_BUCKETS_ELECT 0 +#define PHJ_GROW_BUCKETS_REALLOCATE 1 +#define PHJ_GROW_BUCKETS_REINSERT 2 +#define PHJ_GROW_BUCKETS_PHASE(n) ((n) % 3) /* circular phases */ + +typedef struct HashJoinTableData +{ + int nbuckets; /* # buckets in the in-memory hash table */ + int log2_nbuckets; /* its log2 (nbuckets must be a power of 2) */ + + int nbuckets_original; /* # buckets when starting the first hash */ + int nbuckets_optimal; /* optimal # buckets (per batch) */ + int log2_nbuckets_optimal; /* log2(nbuckets_optimal) */ + + /* buckets[i] is head of list of tuples in i'th in-memory bucket */ + union + { + /* unshared array is per-batch storage, as are all the tuples */ + struct HashJoinTupleData **unshared; + /* shared array is per-query DSA area, as are all the tuples */ + dsa_pointer_atomic *shared; + } buckets; + + bool keepNulls; /* true to store unmatchable NULL tuples */ + + bool skewEnabled; /* are we using skew optimization? */ + HashSkewBucket **skewBucket; /* hashtable of skew buckets */ + int skewBucketLen; /* size of skewBucket array (a power of 2!) */ + int nSkewBuckets; /* number of active skew buckets */ + int *skewBucketNums; /* array indexes of active skew buckets */ + + int nbatch; /* number of batches */ + int curbatch; /* current batch #; 0 during 1st pass */ + + int nbatch_original; /* nbatch when we started inner scan */ + int nbatch_outstart; /* nbatch when we started outer scan */ + + bool growEnabled; /* flag to shut off nbatch increases */ + + double totalTuples; /* # tuples obtained from inner plan */ + double partialTuples; /* # tuples obtained from inner plan by me */ + double skewTuples; /* # tuples inserted into skew tuples */ + + /* + * These arrays are allocated for the life of the hash join, but only if + * nbatch > 1. A file is opened only when we first write a tuple into it + * (otherwise its pointer remains NULL). Note that the zero'th array + * elements never get used, since we will process rather than dump out any + * tuples of batch zero. + */ + BufFile **innerBatchFile; /* buffered virtual temp file per batch */ + BufFile **outerBatchFile; /* buffered virtual temp file per batch */ + + /* + * Info about the datatype-specific hash functions for the datatypes being + * hashed. These are arrays of the same length as the number of hash join + * clauses (hash keys). + */ + FmgrInfo *outer_hashfunctions; /* lookup data for hash functions */ + FmgrInfo *inner_hashfunctions; /* lookup data for hash functions */ + bool *hashStrict; /* is each hash join operator strict? */ + Oid *collations; + + Size spaceUsed; /* memory space currently used by tuples */ + Size spaceAllowed; /* upper limit for space used */ + Size spacePeak; /* peak space used */ + Size spaceUsedSkew; /* skew hash table's current space usage */ + Size spaceAllowedSkew; /* upper limit for skew hashtable */ + + MemoryContext hashCxt; /* context for whole-hash-join storage */ + MemoryContext batchCxt; /* context for this-batch-only storage */ + MemoryContext spillCxt; /* context for spilling to temp files */ + + /* used for dense allocation of tuples (into linked chunks) */ + HashMemoryChunk chunks; /* one list for the whole batch */ + + /* Shared and private state for Parallel Hash. */ + HashMemoryChunk current_chunk; /* this backend's current chunk */ + dsa_area *area; /* DSA area to allocate memory from */ + ParallelHashJoinState *parallel_state; + ParallelHashJoinBatchAccessor *batches; + dsa_pointer current_chunk_shared; +} HashJoinTableData; + +#endif /* HASHJOIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/instrument.h b/platform/dbops/binaries/postgres/include/server/executor/instrument.h new file mode 100644 index 0000000000000000000000000000000000000000..bfd7b6d84452fe177705d4e325f0cb31081a16dc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/instrument.h @@ -0,0 +1,120 @@ +/*------------------------------------------------------------------------- + * + * instrument.h + * definitions for run-time statistics collection + * + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/executor/instrument.h + * + *------------------------------------------------------------------------- + */ +#ifndef INSTRUMENT_H +#define INSTRUMENT_H + +#include "portability/instr_time.h" + + +/* + * BufferUsage and WalUsage counters keep being incremented infinitely, + * i.e., must never be reset to zero, so that we can calculate how much + * the counters are incremented in an arbitrary period. + */ +typedef struct BufferUsage +{ + int64 shared_blks_hit; /* # of shared buffer hits */ + int64 shared_blks_read; /* # of shared disk blocks read */ + int64 shared_blks_dirtied; /* # of shared blocks dirtied */ + int64 shared_blks_written; /* # of shared disk blocks written */ + int64 local_blks_hit; /* # of local buffer hits */ + int64 local_blks_read; /* # of local disk blocks read */ + int64 local_blks_dirtied; /* # of local blocks dirtied */ + int64 local_blks_written; /* # of local disk blocks written */ + int64 temp_blks_read; /* # of temp blocks read */ + int64 temp_blks_written; /* # of temp blocks written */ + instr_time shared_blk_read_time; /* time spent reading shared blocks */ + instr_time shared_blk_write_time; /* time spent writing shared blocks */ + instr_time local_blk_read_time; /* time spent reading local blocks */ + instr_time local_blk_write_time; /* time spent writing local blocks */ + instr_time temp_blk_read_time; /* time spent reading temp blocks */ + instr_time temp_blk_write_time; /* time spent writing temp blocks */ +} BufferUsage; + +/* + * WalUsage tracks only WAL activity like WAL records generation that + * can be measured per query and is displayed by EXPLAIN command, + * pg_stat_statements extension, etc. It does not track other WAL activity + * like WAL writes that it's not worth measuring per query. That's tracked + * by WAL global statistics counters in WalStats, instead. + */ +typedef struct WalUsage +{ + int64 wal_records; /* # of WAL records produced */ + int64 wal_fpi; /* # of WAL full page images produced */ + uint64 wal_bytes; /* size of WAL records produced */ +} WalUsage; + +/* Flag bits included in InstrAlloc's instrument_options bitmask */ +typedef enum InstrumentOption +{ + INSTRUMENT_TIMER = 1 << 0, /* needs timer (and row counts) */ + INSTRUMENT_BUFFERS = 1 << 1, /* needs buffer usage */ + INSTRUMENT_ROWS = 1 << 2, /* needs row count */ + INSTRUMENT_WAL = 1 << 3, /* needs WAL usage */ + INSTRUMENT_ALL = PG_INT32_MAX +} InstrumentOption; + +typedef struct Instrumentation +{ + /* Parameters set at node creation: */ + bool need_timer; /* true if we need timer data */ + bool need_bufusage; /* true if we need buffer usage data */ + bool need_walusage; /* true if we need WAL usage data */ + bool async_mode; /* true if node is in async mode */ + /* Info about current plan cycle: */ + bool running; /* true if we've completed first tuple */ + instr_time starttime; /* start time of current iteration of node */ + instr_time counter; /* accumulated runtime for this node */ + double firsttuple; /* time for first tuple of this cycle */ + double tuplecount; /* # of tuples emitted so far this cycle */ + BufferUsage bufusage_start; /* buffer usage at start */ + WalUsage walusage_start; /* WAL usage at start */ + /* Accumulated statistics across all completed cycles: */ + double startup; /* total startup time (in seconds) */ + double total; /* total time (in seconds) */ + double ntuples; /* total tuples produced */ + double ntuples2; /* secondary node-specific tuple counter */ + double nloops; /* # of run cycles for this node */ + double nfiltered1; /* # of tuples removed by scanqual or joinqual */ + double nfiltered2; /* # of tuples removed by "other" quals */ + BufferUsage bufusage; /* total buffer usage */ + WalUsage walusage; /* total WAL usage */ +} Instrumentation; + +typedef struct WorkerInstrumentation +{ + int num_workers; /* # of structures that follow */ + Instrumentation instrument[FLEXIBLE_ARRAY_MEMBER]; +} WorkerInstrumentation; + +extern PGDLLIMPORT BufferUsage pgBufferUsage; +extern PGDLLIMPORT WalUsage pgWalUsage; + +extern Instrumentation *InstrAlloc(int n, int instrument_options, + bool async_mode); +extern void InstrInit(Instrumentation *instr, int instrument_options); +extern void InstrStartNode(Instrumentation *instr); +extern void InstrStopNode(Instrumentation *instr, double nTuples); +extern void InstrUpdateTupleCount(Instrumentation *instr, double nTuples); +extern void InstrEndLoop(Instrumentation *instr); +extern void InstrAggNode(Instrumentation *dst, Instrumentation *add); +extern void InstrStartParallelQuery(void); +extern void InstrEndParallelQuery(BufferUsage *bufusage, WalUsage *walusage); +extern void InstrAccumParallelQuery(BufferUsage *bufusage, WalUsage *walusage); +extern void BufferUsageAccumDiff(BufferUsage *dst, + const BufferUsage *add, const BufferUsage *sub); +extern void WalUsageAccumDiff(WalUsage *dst, const WalUsage *add, + const WalUsage *sub); + +#endif /* INSTRUMENT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeAgg.h b/platform/dbops/binaries/postgres/include/server/executor/nodeAgg.h new file mode 100644 index 0000000000000000000000000000000000000000..684779a6a326b60dbe919419ff072a1e3a718dab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeAgg.h @@ -0,0 +1,341 @@ +/*------------------------------------------------------------------------- + * + * nodeAgg.h + * prototypes for nodeAgg.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeAgg.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEAGG_H +#define NODEAGG_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + + +/* + * AggStatePerTransData - per aggregate state value information + * + * Working state for updating the aggregate's state value, by calling the + * transition function with an input row. This struct does not store the + * information needed to produce the final aggregate result from the transition + * state, that's stored in AggStatePerAggData instead. This separation allows + * multiple aggregate results to be produced from a single state value. + */ +typedef struct AggStatePerTransData +{ + /* + * These values are set up during ExecInitAgg() and do not change + * thereafter: + */ + + /* + * Link to an Aggref expr this state value is for. + * + * There can be multiple Aggref's sharing the same state value, so long as + * the inputs and transition functions are identical and the final + * functions are not read-write. This points to the first one of them. + */ + Aggref *aggref; + + /* + * Is this state value actually being shared by more than one Aggref? + */ + bool aggshared; + + /* + * True for ORDER BY and DISTINCT Aggrefs that are not aggpresorted. + */ + bool aggsortrequired; + + /* + * Number of aggregated input columns. This includes ORDER BY expressions + * in both the plain-agg and ordered-set cases. Ordered-set direct args + * are not counted, though. + */ + int numInputs; + + /* + * Number of aggregated input columns to pass to the transfn. This + * includes the ORDER BY columns for ordered-set aggs, but not for plain + * aggs. (This doesn't count the transition state value!) + */ + int numTransInputs; + + /* Oid of the state transition or combine function */ + Oid transfn_oid; + + /* Oid of the serialization function or InvalidOid */ + Oid serialfn_oid; + + /* Oid of the deserialization function or InvalidOid */ + Oid deserialfn_oid; + + /* Oid of state value's datatype */ + Oid aggtranstype; + + /* + * fmgr lookup data for transition function or combine function. Note in + * particular that the fn_strict flag is kept here. + */ + FmgrInfo transfn; + + /* fmgr lookup data for serialization function */ + FmgrInfo serialfn; + + /* fmgr lookup data for deserialization function */ + FmgrInfo deserialfn; + + /* Input collation derived for aggregate */ + Oid aggCollation; + + /* number of sorting columns */ + int numSortCols; + + /* number of sorting columns to consider in DISTINCT comparisons */ + /* (this is either zero or the same as numSortCols) */ + int numDistinctCols; + + /* deconstructed sorting information (arrays of length numSortCols) */ + AttrNumber *sortColIdx; + Oid *sortOperators; + Oid *sortCollations; + bool *sortNullsFirst; + + /* + * Comparators for input columns --- only set/used when aggregate has + * DISTINCT flag. equalfnOne version is used for single-column + * comparisons, equalfnMulti for the case of multiple columns. + */ + FmgrInfo equalfnOne; + ExprState *equalfnMulti; + + /* + * initial value from pg_aggregate entry + */ + Datum initValue; + bool initValueIsNull; + + /* + * We need the len and byval info for the agg's input and transition data + * types in order to know how to copy/delete values. + * + * Note that the info for the input type is used only when handling + * DISTINCT aggs with just one argument, so there is only one input type. + */ + int16 inputtypeLen, + transtypeLen; + bool inputtypeByVal, + transtypeByVal; + + /* + * Slots for holding the evaluated input arguments. These are set up + * during ExecInitAgg() and then used for each input row requiring either + * FILTER or ORDER BY/DISTINCT processing. + */ + TupleTableSlot *sortslot; /* current input tuple */ + TupleTableSlot *uniqslot; /* used for multi-column DISTINCT */ + TupleDesc sortdesc; /* descriptor of input tuples */ + Datum lastdatum; /* used for single-column DISTINCT */ + bool lastisnull; /* used for single-column DISTINCT */ + bool haslast; /* got a last value for DISTINCT check */ + + /* + * These values are working state that is initialized at the start of an + * input tuple group and updated for each input tuple. + * + * For a simple (non DISTINCT/ORDER BY) aggregate, we just feed the input + * values straight to the transition function. If it's DISTINCT or + * requires ORDER BY, we pass the input values into a Tuplesort object; + * then at completion of the input tuple group, we scan the sorted values, + * eliminate duplicates if needed, and run the transition function on the + * rest. + * + * We need a separate tuplesort for each grouping set. + */ + + Tuplesortstate **sortstates; /* sort objects, if DISTINCT or ORDER BY */ + + /* + * This field is a pre-initialized FunctionCallInfo struct used for + * calling this aggregate's transfn. We save a few cycles per row by not + * re-initializing the unchanging fields; which isn't much, but it seems + * worth the extra space consumption. + */ + FunctionCallInfo transfn_fcinfo; + + /* Likewise for serialization and deserialization functions */ + FunctionCallInfo serialfn_fcinfo; + + FunctionCallInfo deserialfn_fcinfo; +} AggStatePerTransData; + +/* + * AggStatePerAggData - per-aggregate information + * + * This contains the information needed to call the final function, to produce + * a final aggregate result from the state value. If there are multiple + * identical Aggrefs in the query, they can all share the same per-agg data. + * + * These values are set up during ExecInitAgg() and do not change thereafter. + */ +typedef struct AggStatePerAggData +{ + /* + * Link to an Aggref expr this state value is for. + * + * There can be multiple identical Aggref's sharing the same per-agg. This + * points to the first one of them. + */ + Aggref *aggref; + + /* index to the state value which this agg should use */ + int transno; + + /* Optional Oid of final function (may be InvalidOid) */ + Oid finalfn_oid; + + /* + * fmgr lookup data for final function --- only valid when finalfn_oid is + * not InvalidOid. + */ + FmgrInfo finalfn; + + /* + * Number of arguments to pass to the finalfn. This is always at least 1 + * (the transition state value) plus any ordered-set direct args. If the + * finalfn wants extra args then we pass nulls corresponding to the + * aggregated input columns. + */ + int numFinalArgs; + + /* ExprStates for any direct-argument expressions */ + List *aggdirectargs; + + /* + * We need the len and byval info for the agg's result data type in order + * to know how to copy/delete values. + */ + int16 resulttypeLen; + bool resulttypeByVal; + + /* + * "shareable" is false if this agg cannot share state values with other + * aggregates because the final function is read-write. + */ + bool shareable; +} AggStatePerAggData; + +/* + * AggStatePerGroupData - per-aggregate-per-group working state + * + * These values are working state that is initialized at the start of + * an input tuple group and updated for each input tuple. + * + * In AGG_PLAIN and AGG_SORTED modes, we have a single array of these + * structs (pointed to by aggstate->pergroup); we re-use the array for + * each input group, if it's AGG_SORTED mode. In AGG_HASHED mode, the + * hash table contains an array of these structs for each tuple group. + * + * Logically, the sortstate field belongs in this struct, but we do not + * keep it here for space reasons: we don't support DISTINCT aggregates + * in AGG_HASHED mode, so there's no reason to use up a pointer field + * in every entry of the hashtable. + */ +typedef struct AggStatePerGroupData +{ +#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUE 0 + Datum transValue; /* current transition value */ +#define FIELDNO_AGGSTATEPERGROUPDATA_TRANSVALUEISNULL 1 + bool transValueIsNull; + +#define FIELDNO_AGGSTATEPERGROUPDATA_NOTRANSVALUE 2 + bool noTransValue; /* true if transValue not set yet */ + + /* + * Note: noTransValue initially has the same value as transValueIsNull, + * and if true both are cleared to false at the same time. They are not + * the same though: if transfn later returns a NULL, we want to keep that + * NULL and not auto-replace it with a later input value. Only the first + * non-NULL input will be auto-substituted. + */ +} AggStatePerGroupData; + +/* + * AggStatePerPhaseData - per-grouping-set-phase state + * + * Grouping sets are divided into "phases", where a single phase can be + * processed in one pass over the input. If there is more than one phase, then + * at the end of input from the current phase, state is reset and another pass + * taken over the data which has been re-sorted in the mean time. + * + * Accordingly, each phase specifies a list of grouping sets and group clause + * information, plus each phase after the first also has a sort order. + */ +typedef struct AggStatePerPhaseData +{ + AggStrategy aggstrategy; /* strategy for this phase */ + int numsets; /* number of grouping sets (or 0) */ + int *gset_lengths; /* lengths of grouping sets */ + Bitmapset **grouped_cols; /* column groupings for rollup */ + ExprState **eqfunctions; /* expression returning equality, indexed by + * nr of cols to compare */ + Agg *aggnode; /* Agg node for phase data */ + Sort *sortnode; /* Sort node for input ordering for phase */ + + ExprState *evaltrans; /* evaluation of transition functions */ + + /*---------- + * Cached variants of the compiled expression. + * first subscript: 0: outerops; 1: TTSOpsMinimalTuple + * second subscript: 0: no NULL check; 1: with NULL check + *---------- + */ + ExprState *evaltrans_cache[2][2]; +} AggStatePerPhaseData; + +/* + * AggStatePerHashData - per-hashtable state + * + * When doing grouping sets with hashing, we have one of these for each + * grouping set. (When doing hashing without grouping sets, we have just one of + * them.) + */ +typedef struct AggStatePerHashData +{ + TupleHashTable hashtable; /* hash table with one entry per group */ + TupleHashIterator hashiter; /* for iterating through hash table */ + TupleTableSlot *hashslot; /* slot for loading hash table */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + int numCols; /* number of hash key columns */ + int numhashGrpCols; /* number of columns in hash table */ + int largestGrpColIdx; /* largest col required for hashing */ + AttrNumber *hashGrpColIdxInput; /* hash col indices in input slot */ + AttrNumber *hashGrpColIdxHash; /* indices in hash table tuples */ + Agg *aggnode; /* original Agg node, for numGroups etc. */ +} AggStatePerHashData; + + +extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags); +extern void ExecEndAgg(AggState *node); +extern void ExecReScanAgg(AggState *node); + +extern Size hash_agg_entry_size(int numTrans, Size tupleWidth, + Size transitionSpace); +extern void hash_agg_set_limits(double hashentrysize, double input_groups, + int used_bits, Size *mem_limit, + uint64 *ngroups_limit, int *num_partitions); + +/* parallel instrumentation support */ +extern void ExecAggEstimate(AggState *node, ParallelContext *pcxt); +extern void ExecAggInitializeDSM(AggState *node, ParallelContext *pcxt); +extern void ExecAggInitializeWorker(AggState *node, ParallelWorkerContext *pwcxt); +extern void ExecAggRetrieveInstrumentation(AggState *node); + +#endif /* NODEAGG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeAppend.h b/platform/dbops/binaries/postgres/include/server/executor/nodeAppend.h new file mode 100644 index 0000000000000000000000000000000000000000..ee75953d116dcf3629899169ed48ef18ab22f871 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeAppend.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * nodeAppend.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeAppend.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEAPPEND_H +#define NODEAPPEND_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern AppendState *ExecInitAppend(Append *node, EState *estate, int eflags); +extern void ExecEndAppend(AppendState *node); +extern void ExecReScanAppend(AppendState *node); +extern void ExecAppendEstimate(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendInitializeDSM(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendReInitializeDSM(AppendState *node, ParallelContext *pcxt); +extern void ExecAppendInitializeWorker(AppendState *node, ParallelWorkerContext *pwcxt); + +extern void ExecAsyncAppendResponse(AsyncRequest *areq); + +#endif /* NODEAPPEND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapAnd.h b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapAnd.h new file mode 100644 index 0000000000000000000000000000000000000000..299185f53dfeaaf7aa13fb736bbb65a22f93e135 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapAnd.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapAnd.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapAnd.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPAND_H +#define NODEBITMAPAND_H + +#include "nodes/execnodes.h" + +extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags); +extern Node *MultiExecBitmapAnd(BitmapAndState *node); +extern void ExecEndBitmapAnd(BitmapAndState *node); +extern void ExecReScanBitmapAnd(BitmapAndState *node); + +#endif /* NODEBITMAPAND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapHeapscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapHeapscan.h new file mode 100644 index 0000000000000000000000000000000000000000..ea003a9caaef52277b93c2d0a835a873510faae6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapHeapscan.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapHeapscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapHeapscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPHEAPSCAN_H +#define NODEBITMAPHEAPSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags); +extern void ExecEndBitmapHeapScan(BitmapHeapScanState *node); +extern void ExecReScanBitmapHeapScan(BitmapHeapScanState *node); +extern void ExecBitmapHeapEstimate(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node, + ParallelContext *pcxt); +extern void ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, + ParallelWorkerContext *pwcxt); + +#endif /* NODEBITMAPHEAPSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapIndexscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapIndexscan.h new file mode 100644 index 0000000000000000000000000000000000000000..1de0a57787ac30ae0b0ced4366fd4601d2c9c77e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapIndexscan.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapIndexscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapIndexscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPINDEXSCAN_H +#define NODEBITMAPINDEXSCAN_H + +#include "nodes/execnodes.h" + +extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags); +extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); +extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); +extern void ExecReScanBitmapIndexScan(BitmapIndexScanState *node); + +#endif /* NODEBITMAPINDEXSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapOr.h b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapOr.h new file mode 100644 index 0000000000000000000000000000000000000000..8bafc5bec9a37834707e054ea19727eb7ea72d43 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeBitmapOr.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeBitmapOr.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeBitmapOr.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEBITMAPOR_H +#define NODEBITMAPOR_H + +#include "nodes/execnodes.h" + +extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags); +extern Node *MultiExecBitmapOr(BitmapOrState *node); +extern void ExecEndBitmapOr(BitmapOrState *node); +extern void ExecReScanBitmapOr(BitmapOrState *node); + +#endif /* NODEBITMAPOR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeCtescan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeCtescan.h new file mode 100644 index 0000000000000000000000000000000000000000..9df8ea71198e1b0fd5a3b384dfa779fdb7f60eac --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeCtescan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeCtescan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeCtescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODECTESCAN_H +#define NODECTESCAN_H + +#include "nodes/execnodes.h" + +extern CteScanState *ExecInitCteScan(CteScan *node, EState *estate, int eflags); +extern void ExecEndCteScan(CteScanState *node); +extern void ExecReScanCteScan(CteScanState *node); + +#endif /* NODECTESCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeCustom.h b/platform/dbops/binaries/postgres/include/server/executor/nodeCustom.h new file mode 100644 index 0000000000000000000000000000000000000000..e8b7e53fbd5b0d2cff63d5db3de44a66b3838176 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeCustom.h @@ -0,0 +1,42 @@ +/* ------------------------------------------------------------------------ + * + * nodeCustom.h + * + * prototypes for CustomScan nodes + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * ------------------------------------------------------------------------ + */ +#ifndef NODECUSTOM_H +#define NODECUSTOM_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +/* + * General executor code + */ +extern CustomScanState *ExecInitCustomScan(CustomScan *cscan, + EState *estate, int eflags); +extern void ExecEndCustomScan(CustomScanState *node); + +extern void ExecReScanCustomScan(CustomScanState *node); +extern void ExecCustomMarkPos(CustomScanState *node); +extern void ExecCustomRestrPos(CustomScanState *node); + +/* + * Parallel execution support + */ +extern void ExecCustomScanEstimate(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanInitializeDSM(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanReInitializeDSM(CustomScanState *node, + ParallelContext *pcxt); +extern void ExecCustomScanInitializeWorker(CustomScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecShutdownCustomScan(CustomScanState *node); + +#endif /* NODECUSTOM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeForeignscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeForeignscan.h new file mode 100644 index 0000000000000000000000000000000000000000..747fe4eee4114b796fcdd2ed171471e099f5cb07 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeForeignscan.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * nodeForeignscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeForeignscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFOREIGNSCAN_H +#define NODEFOREIGNSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern ForeignScanState *ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags); +extern void ExecEndForeignScan(ForeignScanState *node); +extern void ExecReScanForeignScan(ForeignScanState *node); + +extern void ExecForeignScanEstimate(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanInitializeDSM(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanReInitializeDSM(ForeignScanState *node, + ParallelContext *pcxt); +extern void ExecForeignScanInitializeWorker(ForeignScanState *node, + ParallelWorkerContext *pwcxt); +extern void ExecShutdownForeignScan(ForeignScanState *node); + +extern void ExecAsyncForeignScanRequest(AsyncRequest *areq); +extern void ExecAsyncForeignScanConfigureWait(AsyncRequest *areq); +extern void ExecAsyncForeignScanNotify(AsyncRequest *areq); + +#endif /* NODEFOREIGNSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeFunctionscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeFunctionscan.h new file mode 100644 index 0000000000000000000000000000000000000000..d957a885f634759b02c230fcb86519b50b03c925 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeFunctionscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeFunctionscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeFunctionscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFUNCTIONSCAN_H +#define NODEFUNCTIONSCAN_H + +#include "nodes/execnodes.h" + +extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags); +extern void ExecEndFunctionScan(FunctionScanState *node); +extern void ExecReScanFunctionScan(FunctionScanState *node); + +#endif /* NODEFUNCTIONSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeGather.h b/platform/dbops/binaries/postgres/include/server/executor/nodeGather.h new file mode 100644 index 0000000000000000000000000000000000000000..045c16d2647656f2097a6aca89c7a5a2bec55a09 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeGather.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeGather.h + * prototypes for nodeGather.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGather.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGATHER_H +#define NODEGATHER_H + +#include "nodes/execnodes.h" + +extern GatherState *ExecInitGather(Gather *node, EState *estate, int eflags); +extern void ExecEndGather(GatherState *node); +extern void ExecShutdownGather(GatherState *node); +extern void ExecReScanGather(GatherState *node); + +#endif /* NODEGATHER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeGatherMerge.h b/platform/dbops/binaries/postgres/include/server/executor/nodeGatherMerge.h new file mode 100644 index 0000000000000000000000000000000000000000..d828c00f471ae0c4bfa2a486d5ebdc02ed3aed45 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeGatherMerge.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * nodeGatherMerge.h + * prototypes for nodeGatherMerge.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGatherMerge.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGATHERMERGE_H +#define NODEGATHERMERGE_H + +#include "nodes/execnodes.h" + +extern GatherMergeState *ExecInitGatherMerge(GatherMerge *node, + EState *estate, + int eflags); +extern void ExecEndGatherMerge(GatherMergeState *node); +extern void ExecReScanGatherMerge(GatherMergeState *node); +extern void ExecShutdownGatherMerge(GatherMergeState *node); + +#endif /* NODEGATHERMERGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeGroup.h b/platform/dbops/binaries/postgres/include/server/executor/nodeGroup.h new file mode 100644 index 0000000000000000000000000000000000000000..9578b9229e39646bc2de5ffaacc1b8485475505a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeGroup.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeGroup.h + * prototypes for nodeGroup.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeGroup.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEGROUP_H +#define NODEGROUP_H + +#include "nodes/execnodes.h" + +extern GroupState *ExecInitGroup(Group *node, EState *estate, int eflags); +extern void ExecEndGroup(GroupState *node); +extern void ExecReScanGroup(GroupState *node); + +#endif /* NODEGROUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeHash.h b/platform/dbops/binaries/postgres/include/server/executor/nodeHash.h new file mode 100644 index 0000000000000000000000000000000000000000..a95911c2feeb52a10c6874364df6defd69d2a6f0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeHash.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * nodeHash.h + * prototypes for nodeHash.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeHash.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEHASH_H +#define NODEHASH_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +struct SharedHashJoinBatch; + +extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); +extern Node *MultiExecHash(HashState *node); +extern void ExecEndHash(HashState *node); +extern void ExecReScanHash(HashState *node); + +extern HashJoinTable ExecHashTableCreate(HashState *state, List *hashOperators, List *hashCollations, + bool keepNulls); +extern void ExecParallelHashTableAlloc(HashJoinTable hashtable, + int batchno); +extern void ExecHashTableDestroy(HashJoinTable hashtable); +extern void ExecHashTableDetach(HashJoinTable hashtable); +extern void ExecHashTableDetachBatch(HashJoinTable hashtable); +extern void ExecParallelHashTableSetCurrentBatch(HashJoinTable hashtable, + int batchno); + +extern void ExecHashTableInsert(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern void ExecParallelHashTableInsert(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable, + TupleTableSlot *slot, + uint32 hashvalue); +extern bool ExecHashGetHashValue(HashJoinTable hashtable, + ExprContext *econtext, + List *hashkeys, + bool outer_tuple, + bool keep_nulls, + uint32 *hashvalue); +extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, + uint32 hashvalue, + int *bucketno, + int *batchno); +extern bool ExecScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); +extern bool ExecParallelScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); +extern void ExecPrepHashTableForUnmatched(HashJoinState *hjstate); +extern bool ExecParallelPrepHashTableForUnmatched(HashJoinState *hjstate); +extern bool ExecScanHashTableForUnmatched(HashJoinState *hjstate, + ExprContext *econtext); +extern bool ExecParallelScanHashTableForUnmatched(HashJoinState *hjstate, + ExprContext *econtext); +extern void ExecHashTableReset(HashJoinTable hashtable); +extern void ExecHashTableResetMatchFlags(HashJoinTable hashtable); +extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, + bool try_combined_hash_mem, + int parallel_workers, + size_t *space_allowed, + int *numbuckets, + int *numbatches, + int *num_skew_mcvs); +extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue); +extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt); +extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt); +extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt); +extern void ExecHashRetrieveInstrumentation(HashState *node); +extern void ExecShutdownHash(HashState *node); +extern void ExecHashAccumInstrumentation(HashInstrumentation *instrument, + HashJoinTable hashtable); + +#endif /* NODEHASH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeHashjoin.h b/platform/dbops/binaries/postgres/include/server/executor/nodeHashjoin.h new file mode 100644 index 0000000000000000000000000000000000000000..2b121094f278bf68199944079a5b1ea7e26abfd4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeHashjoin.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * nodeHashjoin.h + * prototypes for nodeHashjoin.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeHashjoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEHASHJOIN_H +#define NODEHASHJOIN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "storage/buffile.h" + +extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate, int eflags); +extern void ExecEndHashJoin(HashJoinState *node); +extern void ExecReScanHashJoin(HashJoinState *node); +extern void ExecShutdownHashJoin(HashJoinState *node); +extern void ExecHashJoinEstimate(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinInitializeDSM(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinReInitializeDSM(HashJoinState *state, ParallelContext *pcxt); +extern void ExecHashJoinInitializeWorker(HashJoinState *state, + ParallelWorkerContext *pwcxt); + +extern void ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue, + BufFile **fileptr, HashJoinTable hashtable); + +#endif /* NODEHASHJOIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeIncrementalSort.h b/platform/dbops/binaries/postgres/include/server/executor/nodeIncrementalSort.h new file mode 100644 index 0000000000000000000000000000000000000000..df020741aff7ab48943b86f0d621c3dede659c9e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeIncrementalSort.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * nodeIncrementalSort.h + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIncrementalSort.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINCREMENTALSORT_H +#define NODEINCREMENTALSORT_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IncrementalSortState *ExecInitIncrementalSort(IncrementalSort *node, EState *estate, int eflags); +extern void ExecEndIncrementalSort(IncrementalSortState *node); +extern void ExecReScanIncrementalSort(IncrementalSortState *node); + +/* parallel instrumentation support */ +extern void ExecIncrementalSortEstimate(IncrementalSortState *node, ParallelContext *pcxt); +extern void ExecIncrementalSortInitializeDSM(IncrementalSortState *node, ParallelContext *pcxt); +extern void ExecIncrementalSortInitializeWorker(IncrementalSortState *node, ParallelWorkerContext *pwcxt); +extern void ExecIncrementalSortRetrieveInstrumentation(IncrementalSortState *node); + +#endif /* NODEINCREMENTALSORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeIndexonlyscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeIndexonlyscan.h new file mode 100644 index 0000000000000000000000000000000000000000..607af8c354003aa2acc177f2549550227ab3f35e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeIndexonlyscan.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * nodeIndexonlyscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIndexonlyscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINDEXONLYSCAN_H +#define NODEINDEXONLYSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IndexOnlyScanState *ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags); +extern void ExecEndIndexOnlyScan(IndexOnlyScanState *node); +extern void ExecIndexOnlyMarkPos(IndexOnlyScanState *node); +extern void ExecIndexOnlyRestrPos(IndexOnlyScanState *node); +extern void ExecReScanIndexOnlyScan(IndexOnlyScanState *node); + +/* Support functions for parallel index-only scans */ +extern void ExecIndexOnlyScanEstimate(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanInitializeDSM(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node, + ParallelContext *pcxt); +extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node, + ParallelWorkerContext *pwcxt); + +#endif /* NODEINDEXONLYSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeIndexscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeIndexscan.h new file mode 100644 index 0000000000000000000000000000000000000000..3cddece67c8eb2d645b12071806834f0648671ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeIndexscan.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * nodeIndexscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeIndexscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEINDEXSCAN_H +#define NODEINDEXSCAN_H + +#include "access/genam.h" +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern IndexScanState *ExecInitIndexScan(IndexScan *node, EState *estate, int eflags); +extern void ExecEndIndexScan(IndexScanState *node); +extern void ExecIndexMarkPos(IndexScanState *node); +extern void ExecIndexRestrPos(IndexScanState *node); +extern void ExecReScanIndexScan(IndexScanState *node); +extern void ExecIndexScanEstimate(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanInitializeDSM(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanReInitializeDSM(IndexScanState *node, ParallelContext *pcxt); +extern void ExecIndexScanInitializeWorker(IndexScanState *node, + ParallelWorkerContext *pwcxt); + +/* + * These routines are exported to share code with nodeIndexonlyscan.c and + * nodeBitmapIndexscan.c + */ +extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, + List *quals, bool isorderby, + ScanKey *scanKeys, int *numScanKeys, + IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, + IndexArrayKeyInfo **arrayKeys, int *numArrayKeys); +extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext, + IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys); +extern bool ExecIndexEvalArrayKeys(ExprContext *econtext, + IndexArrayKeyInfo *arrayKeys, int numArrayKeys); +extern bool ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys); + +#endif /* NODEINDEXSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeLimit.h b/platform/dbops/binaries/postgres/include/server/executor/nodeLimit.h new file mode 100644 index 0000000000000000000000000000000000000000..7cf5c1cad61f7adc7cedca07bb6c88c68690f402 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeLimit.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeLimit.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeLimit.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODELIMIT_H +#define NODELIMIT_H + +#include "nodes/execnodes.h" + +extern LimitState *ExecInitLimit(Limit *node, EState *estate, int eflags); +extern void ExecEndLimit(LimitState *node); +extern void ExecReScanLimit(LimitState *node); + +#endif /* NODELIMIT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeLockRows.h b/platform/dbops/binaries/postgres/include/server/executor/nodeLockRows.h new file mode 100644 index 0000000000000000000000000000000000000000..310d2ba4458db7beb548cf0bc80f8c43c5c3821d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeLockRows.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeLockRows.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeLockRows.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODELOCKROWS_H +#define NODELOCKROWS_H + +#include "nodes/execnodes.h" + +extern LockRowsState *ExecInitLockRows(LockRows *node, EState *estate, int eflags); +extern void ExecEndLockRows(LockRowsState *node); +extern void ExecReScanLockRows(LockRowsState *node); + +#endif /* NODELOCKROWS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeMaterial.h b/platform/dbops/binaries/postgres/include/server/executor/nodeMaterial.h new file mode 100644 index 0000000000000000000000000000000000000000..0ba7d0edc6d78f3b71d18f4c7ae578e4bf87bd72 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeMaterial.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * nodeMaterial.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMaterial.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMATERIAL_H +#define NODEMATERIAL_H + +#include "nodes/execnodes.h" + +extern MaterialState *ExecInitMaterial(Material *node, EState *estate, int eflags); +extern void ExecEndMaterial(MaterialState *node); +extern void ExecMaterialMarkPos(MaterialState *node); +extern void ExecMaterialRestrPos(MaterialState *node); +extern void ExecReScanMaterial(MaterialState *node); + +#endif /* NODEMATERIAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeMemoize.h b/platform/dbops/binaries/postgres/include/server/executor/nodeMemoize.h new file mode 100644 index 0000000000000000000000000000000000000000..758dcd6fe1b8407691f9b0b2e12f8020a5586e00 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeMemoize.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeMemoize.h + * + * + * + * Portions Copyright (c) 2021-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMemoize.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMEMOIZE_H +#define NODEMEMOIZE_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern MemoizeState *ExecInitMemoize(Memoize *node, EState *estate, int eflags); +extern void ExecEndMemoize(MemoizeState *node); +extern void ExecReScanMemoize(MemoizeState *node); +extern double ExecEstimateCacheEntryOverheadBytes(double ntuples); +extern void ExecMemoizeEstimate(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeDSM(MemoizeState *node, + ParallelContext *pcxt); +extern void ExecMemoizeInitializeWorker(MemoizeState *node, + ParallelWorkerContext *pwcxt); +extern void ExecMemoizeRetrieveInstrumentation(MemoizeState *node); + +#endif /* NODEMEMOIZE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeMergeAppend.h b/platform/dbops/binaries/postgres/include/server/executor/nodeMergeAppend.h new file mode 100644 index 0000000000000000000000000000000000000000..c39a9fc0cb28474d1a08d77916bff654fddc905d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeMergeAppend.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeMergeAppend.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMergeAppend.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMERGEAPPEND_H +#define NODEMERGEAPPEND_H + +#include "nodes/execnodes.h" + +extern MergeAppendState *ExecInitMergeAppend(MergeAppend *node, EState *estate, int eflags); +extern void ExecEndMergeAppend(MergeAppendState *node); +extern void ExecReScanMergeAppend(MergeAppendState *node); + +#endif /* NODEMERGEAPPEND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeMergejoin.h b/platform/dbops/binaries/postgres/include/server/executor/nodeMergejoin.h new file mode 100644 index 0000000000000000000000000000000000000000..e60e1bb3357b45256cd9ac98c2e132e8054cbf15 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeMergejoin.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeMergejoin.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeMergejoin.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMERGEJOIN_H +#define NODEMERGEJOIN_H + +#include "nodes/execnodes.h" + +extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags); +extern void ExecEndMergeJoin(MergeJoinState *node); +extern void ExecReScanMergeJoin(MergeJoinState *node); + +#endif /* NODEMERGEJOIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeModifyTable.h b/platform/dbops/binaries/postgres/include/server/executor/nodeModifyTable.h new file mode 100644 index 0000000000000000000000000000000000000000..681cdaa89dbc8fde221a07c31f3327741656ea55 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeModifyTable.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * nodeModifyTable.h + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeModifyTable.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEMODIFYTABLE_H +#define NODEMODIFYTABLE_H + +#include "nodes/execnodes.h" + +extern void ExecInitStoredGenerated(ResultRelInfo *resultRelInfo, + EState *estate, + CmdType cmdtype); + +extern void ExecComputeStoredGenerated(ResultRelInfo *resultRelInfo, + EState *estate, TupleTableSlot *slot, + CmdType cmdtype); + +extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags); +extern void ExecEndModifyTable(ModifyTableState *node); +extern void ExecReScanModifyTable(ModifyTableState *node); + +extern void ExecInitMergeTupleSlots(ModifyTableState *mtstate, + ResultRelInfo *resultRelInfo); + +#endif /* NODEMODIFYTABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeNamedtuplestorescan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeNamedtuplestorescan.h new file mode 100644 index 0000000000000000000000000000000000000000..97d19820063311c6cffbc5218e76b837309cd154 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeNamedtuplestorescan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeNamedtuplestorescan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeNamedtuplestorescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODENAMEDTUPLESTORESCAN_H +#define NODENAMEDTUPLESTORESCAN_H + +#include "nodes/execnodes.h" + +extern NamedTuplestoreScanState *ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflags); +extern void ExecReScanNamedTuplestoreScan(NamedTuplestoreScanState *node); + +#endif /* NODENAMEDTUPLESTORESCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeNestloop.h b/platform/dbops/binaries/postgres/include/server/executor/nodeNestloop.h new file mode 100644 index 0000000000000000000000000000000000000000..37dff400d376cee854d2cece2d97a1530ac4c4bc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeNestloop.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeNestloop.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeNestloop.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODENESTLOOP_H +#define NODENESTLOOP_H + +#include "nodes/execnodes.h" + +extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate, int eflags); +extern void ExecEndNestLoop(NestLoopState *node); +extern void ExecReScanNestLoop(NestLoopState *node); + +#endif /* NODENESTLOOP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeProjectSet.h b/platform/dbops/binaries/postgres/include/server/executor/nodeProjectSet.h new file mode 100644 index 0000000000000000000000000000000000000000..4ae6cffab5424e5100d996dc352de9971bd1debb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeProjectSet.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeProjectSet.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeProjectSet.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEPROJECTSET_H +#define NODEPROJECTSET_H + +#include "nodes/execnodes.h" + +extern ProjectSetState *ExecInitProjectSet(ProjectSet *node, EState *estate, int eflags); +extern void ExecEndProjectSet(ProjectSetState *node); +extern void ExecReScanProjectSet(ProjectSetState *node); + +#endif /* NODEPROJECTSET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeRecursiveunion.h b/platform/dbops/binaries/postgres/include/server/executor/nodeRecursiveunion.h new file mode 100644 index 0000000000000000000000000000000000000000..f108d4553bdf0e39ba7c8a9f2b95ded5e3d768d0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeRecursiveunion.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeRecursiveunion.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeRecursiveunion.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODERECURSIVEUNION_H +#define NODERECURSIVEUNION_H + +#include "nodes/execnodes.h" + +extern RecursiveUnionState *ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags); +extern void ExecEndRecursiveUnion(RecursiveUnionState *node); +extern void ExecReScanRecursiveUnion(RecursiveUnionState *node); + +#endif /* NODERECURSIVEUNION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeResult.h b/platform/dbops/binaries/postgres/include/server/executor/nodeResult.h new file mode 100644 index 0000000000000000000000000000000000000000..1332640ab92c33697a04bb96bb667c5b9913cdc0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeResult.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * nodeResult.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeResult.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODERESULT_H +#define NODERESULT_H + +#include "nodes/execnodes.h" + +extern ResultState *ExecInitResult(Result *node, EState *estate, int eflags); +extern void ExecEndResult(ResultState *node); +extern void ExecResultMarkPos(ResultState *node); +extern void ExecResultRestrPos(ResultState *node); +extern void ExecReScanResult(ResultState *node); + +#endif /* NODERESULT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSamplescan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSamplescan.h new file mode 100644 index 0000000000000000000000000000000000000000..838c1bf4abd2bb2a26669b22ec70d8086c8fe001 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSamplescan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSamplescan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSamplescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESAMPLESCAN_H +#define NODESAMPLESCAN_H + +#include "nodes/execnodes.h" + +extern SampleScanState *ExecInitSampleScan(SampleScan *node, EState *estate, int eflags); +extern void ExecEndSampleScan(SampleScanState *node); +extern void ExecReScanSampleScan(SampleScanState *node); + +#endif /* NODESAMPLESCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSeqscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSeqscan.h new file mode 100644 index 0000000000000000000000000000000000000000..68f689e69417eb24ed776376dfa1c3b4caadb313 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSeqscan.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * nodeSeqscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSeqscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESEQSCAN_H +#define NODESEQSCAN_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern SeqScanState *ExecInitSeqScan(SeqScan *node, EState *estate, int eflags); +extern void ExecEndSeqScan(SeqScanState *node); +extern void ExecReScanSeqScan(SeqScanState *node); + +/* parallel scan support */ +extern void ExecSeqScanEstimate(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanInitializeDSM(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanReInitializeDSM(SeqScanState *node, ParallelContext *pcxt); +extern void ExecSeqScanInitializeWorker(SeqScanState *node, + ParallelWorkerContext *pwcxt); + +#endif /* NODESEQSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSetOp.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSetOp.h new file mode 100644 index 0000000000000000000000000000000000000000..9c484c1eab9582af402cdcc31780b2f9b0a31c23 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSetOp.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSetOp.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSetOp.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESETOP_H +#define NODESETOP_H + +#include "nodes/execnodes.h" + +extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate, int eflags); +extern void ExecEndSetOp(SetOpState *node); +extern void ExecReScanSetOp(SetOpState *node); + +#endif /* NODESETOP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSort.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSort.h new file mode 100644 index 0000000000000000000000000000000000000000..0fb2a12d8fbdc54beaa72728e2a42f43bd00b530 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSort.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * nodeSort.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSort.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESORT_H +#define NODESORT_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" + +extern SortState *ExecInitSort(Sort *node, EState *estate, int eflags); +extern void ExecEndSort(SortState *node); +extern void ExecSortMarkPos(SortState *node); +extern void ExecSortRestrPos(SortState *node); +extern void ExecReScanSort(SortState *node); + +/* parallel instrumentation support */ +extern void ExecSortEstimate(SortState *node, ParallelContext *pcxt); +extern void ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt); +extern void ExecSortInitializeWorker(SortState *node, ParallelWorkerContext *pwcxt); +extern void ExecSortRetrieveInstrumentation(SortState *node); + +#endif /* NODESORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSubplan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSubplan.h new file mode 100644 index 0000000000000000000000000000000000000000..ad4014701f32a520e3994daff66a14e786c48527 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSubplan.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * nodeSubplan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSubplan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESUBPLAN_H +#define NODESUBPLAN_H + +#include "nodes/execnodes.h" + +extern SubPlanState *ExecInitSubPlan(SubPlan *subplan, PlanState *parent); + +extern Datum ExecSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull); + +extern void ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent); + +extern void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext); + +extern void ExecSetParamPlanMulti(const Bitmapset *params, ExprContext *econtext); + +#endif /* NODESUBPLAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeSubqueryscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeSubqueryscan.h new file mode 100644 index 0000000000000000000000000000000000000000..f3cdec581c643e3d883646aefebcb7a5cc8b2eb9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeSubqueryscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeSubqueryscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeSubqueryscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODESUBQUERYSCAN_H +#define NODESUBQUERYSCAN_H + +#include "nodes/execnodes.h" + +extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags); +extern void ExecEndSubqueryScan(SubqueryScanState *node); +extern void ExecReScanSubqueryScan(SubqueryScanState *node); + +#endif /* NODESUBQUERYSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeTableFuncscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeTableFuncscan.h new file mode 100644 index 0000000000000000000000000000000000000000..b0fab0728a2f0665e6498e460939543cb5c6524b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeTableFuncscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeTableFuncscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTableFuncscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETABLEFUNCSCAN_H +#define NODETABLEFUNCSCAN_H + +#include "nodes/execnodes.h" + +extern TableFuncScanState *ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags); +extern void ExecEndTableFuncScan(TableFuncScanState *node); +extern void ExecReScanTableFuncScan(TableFuncScanState *node); + +#endif /* NODETABLEFUNCSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeTidrangescan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeTidrangescan.h new file mode 100644 index 0000000000000000000000000000000000000000..1cfc7a07be9b4e66250ba9707f7fe5493bcdadca --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeTidrangescan.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * nodeTidrangescan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTidrangescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETIDRANGESCAN_H +#define NODETIDRANGESCAN_H + +#include "nodes/execnodes.h" + +extern TidRangeScanState *ExecInitTidRangeScan(TidRangeScan *node, + EState *estate, int eflags); +extern void ExecEndTidRangeScan(TidRangeScanState *node); +extern void ExecReScanTidRangeScan(TidRangeScanState *node); + +#endif /* NODETIDRANGESCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeTidscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeTidscan.h new file mode 100644 index 0000000000000000000000000000000000000000..b17de5dd3e9176f437e8058dda60cb7063dee40f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeTidscan.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeTidscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeTidscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODETIDSCAN_H +#define NODETIDSCAN_H + +#include "nodes/execnodes.h" + +extern TidScanState *ExecInitTidScan(TidScan *node, EState *estate, int eflags); +extern void ExecEndTidScan(TidScanState *node); +extern void ExecReScanTidScan(TidScanState *node); + +#endif /* NODETIDSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeUnique.h b/platform/dbops/binaries/postgres/include/server/executor/nodeUnique.h new file mode 100644 index 0000000000000000000000000000000000000000..9f1d39a0cc05d7aa72352441c80bf7862c2d1d80 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeUnique.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeUnique.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeUnique.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEUNIQUE_H +#define NODEUNIQUE_H + +#include "nodes/execnodes.h" + +extern UniqueState *ExecInitUnique(Unique *node, EState *estate, int eflags); +extern void ExecEndUnique(UniqueState *node); +extern void ExecReScanUnique(UniqueState *node); + +#endif /* NODEUNIQUE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeValuesscan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeValuesscan.h new file mode 100644 index 0000000000000000000000000000000000000000..56096ce3d86f6a138dfb228858ea4863cf761454 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeValuesscan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeValuesscan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeValuesscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEVALUESSCAN_H +#define NODEVALUESSCAN_H + +#include "nodes/execnodes.h" + +extern ValuesScanState *ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags); +extern void ExecReScanValuesScan(ValuesScanState *node); + +#endif /* NODEVALUESSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeWindowAgg.h b/platform/dbops/binaries/postgres/include/server/executor/nodeWindowAgg.h new file mode 100644 index 0000000000000000000000000000000000000000..1138af953a498abb8a8ceeccb9ebd83cfd7cafea --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeWindowAgg.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeWindowAgg.h + * prototypes for nodeWindowAgg.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeWindowAgg.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEWINDOWAGG_H +#define NODEWINDOWAGG_H + +#include "nodes/execnodes.h" + +extern WindowAggState *ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags); +extern void ExecEndWindowAgg(WindowAggState *node); +extern void ExecReScanWindowAgg(WindowAggState *node); + +#endif /* NODEWINDOWAGG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/nodeWorktablescan.h b/platform/dbops/binaries/postgres/include/server/executor/nodeWorktablescan.h new file mode 100644 index 0000000000000000000000000000000000000000..7198a67c33903aaa27fa131464b66b19c4e4911d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/nodeWorktablescan.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * nodeWorktablescan.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/nodeWorktablescan.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEWORKTABLESCAN_H +#define NODEWORKTABLESCAN_H + +#include "nodes/execnodes.h" + +extern WorkTableScanState *ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags); +extern void ExecReScanWorkTableScan(WorkTableScanState *node); + +#endif /* NODEWORKTABLESCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/spi.h b/platform/dbops/binaries/postgres/include/server/executor/spi.h new file mode 100644 index 0000000000000000000000000000000000000000..48b87730ea039e35e6e7143bf0a4151bedb73dc0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/spi.h @@ -0,0 +1,207 @@ +/*------------------------------------------------------------------------- + * + * spi.h + * Server Programming Interface public declarations + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/spi.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPI_H +#define SPI_H + +#include "commands/trigger.h" +#include "lib/ilist.h" +#include "parser/parser.h" +#include "utils/portal.h" + + +typedef struct SPITupleTable +{ + /* Public members */ + TupleDesc tupdesc; /* tuple descriptor */ + HeapTuple *vals; /* array of tuples */ + uint64 numvals; /* number of valid tuples */ + + /* Private members, not intended for external callers */ + uint64 alloced; /* allocated length of vals array */ + MemoryContext tuptabcxt; /* memory context of result table */ + slist_node next; /* link for internal bookkeeping */ + SubTransactionId subid; /* subxact in which tuptable was created */ +} SPITupleTable; + +/* Optional arguments for SPI_prepare_extended */ +typedef struct SPIPrepareOptions +{ + ParserSetupHook parserSetup; + void *parserSetupArg; + RawParseMode parseMode; + int cursorOptions; +} SPIPrepareOptions; + +/* Optional arguments for SPI_execute[_plan]_extended */ +typedef struct SPIExecuteOptions +{ + ParamListInfo params; + bool read_only; + bool allow_nonatomic; + bool must_return_tuples; + uint64 tcount; + DestReceiver *dest; + ResourceOwner owner; +} SPIExecuteOptions; + +/* Optional arguments for SPI_cursor_parse_open */ +typedef struct SPIParseOpenOptions +{ + ParamListInfo params; + int cursorOptions; + bool read_only; +} SPIParseOpenOptions; + +/* Plans are opaque structs for standard users of SPI */ +typedef struct _SPI_plan *SPIPlanPtr; + +#define SPI_ERROR_CONNECT (-1) +#define SPI_ERROR_COPY (-2) +#define SPI_ERROR_OPUNKNOWN (-3) +#define SPI_ERROR_UNCONNECTED (-4) +#define SPI_ERROR_CURSOR (-5) /* not used anymore */ +#define SPI_ERROR_ARGUMENT (-6) +#define SPI_ERROR_PARAM (-7) +#define SPI_ERROR_TRANSACTION (-8) +#define SPI_ERROR_NOATTRIBUTE (-9) +#define SPI_ERROR_NOOUTFUNC (-10) +#define SPI_ERROR_TYPUNKNOWN (-11) +#define SPI_ERROR_REL_DUPLICATE (-12) +#define SPI_ERROR_REL_NOT_FOUND (-13) + +#define SPI_OK_CONNECT 1 +#define SPI_OK_FINISH 2 +#define SPI_OK_FETCH 3 +#define SPI_OK_UTILITY 4 +#define SPI_OK_SELECT 5 +#define SPI_OK_SELINTO 6 +#define SPI_OK_INSERT 7 +#define SPI_OK_DELETE 8 +#define SPI_OK_UPDATE 9 +#define SPI_OK_CURSOR 10 +#define SPI_OK_INSERT_RETURNING 11 +#define SPI_OK_DELETE_RETURNING 12 +#define SPI_OK_UPDATE_RETURNING 13 +#define SPI_OK_REWRITTEN 14 +#define SPI_OK_REL_REGISTER 15 +#define SPI_OK_REL_UNREGISTER 16 +#define SPI_OK_TD_REGISTER 17 +#define SPI_OK_MERGE 18 +#define SPI_OK_MERGE_RETURNING 19 + +#define SPI_OPT_NONATOMIC (1 << 0) + +extern PGDLLIMPORT uint64 SPI_processed; +extern PGDLLIMPORT SPITupleTable *SPI_tuptable; +extern PGDLLIMPORT int SPI_result; + +extern int SPI_connect(void); +extern int SPI_connect_ext(int options); +extern int SPI_finish(void); +extern int SPI_execute(const char *src, bool read_only, long tcount); +extern int SPI_execute_extended(const char *src, + const SPIExecuteOptions *options); +extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, + bool read_only, long tcount); +extern int SPI_execute_plan_extended(SPIPlanPtr plan, + const SPIExecuteOptions *options); +extern int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, + ParamListInfo params, + bool read_only, long tcount); +extern int SPI_exec(const char *src, long tcount); +extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, + long tcount); +extern int SPI_execute_snapshot(SPIPlanPtr plan, + Datum *Values, const char *Nulls, + Snapshot snapshot, + Snapshot crosscheck_snapshot, + bool read_only, bool fire_triggers, long tcount); +extern int SPI_execute_with_args(const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, long tcount); +extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); +extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, + int cursorOptions); +extern SPIPlanPtr SPI_prepare_extended(const char *src, + const SPIPrepareOptions *options); +extern SPIPlanPtr SPI_prepare_params(const char *src, + ParserSetupHook parserSetup, + void *parserSetupArg, + int cursorOptions); +extern int SPI_keepplan(SPIPlanPtr plan); +extern SPIPlanPtr SPI_saveplan(SPIPlanPtr plan); +extern int SPI_freeplan(SPIPlanPtr plan); + +extern Oid SPI_getargtypeid(SPIPlanPtr plan, int argIndex); +extern int SPI_getargcount(SPIPlanPtr plan); +extern bool SPI_is_cursor_plan(SPIPlanPtr plan); +extern bool SPI_plan_is_valid(SPIPlanPtr plan); +extern const char *SPI_result_code_string(int code); + +extern List *SPI_plan_get_plan_sources(SPIPlanPtr plan); +extern CachedPlan *SPI_plan_get_cached_plan(SPIPlanPtr plan); + +extern HeapTuple SPI_copytuple(HeapTuple tuple); +extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc); +extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, + int *attnum, Datum *Values, const char *Nulls); +extern int SPI_fnumber(TupleDesc tupdesc, const char *fname); +extern char *SPI_fname(TupleDesc tupdesc, int fnumber); +extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber); +extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull); +extern char *SPI_gettype(TupleDesc tupdesc, int fnumber); +extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber); +extern char *SPI_getrelname(Relation rel); +extern char *SPI_getnspname(Relation rel); +extern void *SPI_palloc(Size size); +extern void *SPI_repalloc(void *pointer, Size size); +extern void SPI_pfree(void *pointer); +extern Datum SPI_datumTransfer(Datum value, bool typByVal, int typLen); +extern void SPI_freetuple(HeapTuple tuple); +extern void SPI_freetuptable(SPITupleTable *tuptable); + +extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, + Datum *Values, const char *Nulls, bool read_only); +extern Portal SPI_cursor_open_with_args(const char *name, + const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, int cursorOptions); +extern Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan, + ParamListInfo params, bool read_only); +extern Portal SPI_cursor_parse_open(const char *name, + const char *src, + const SPIParseOpenOptions *options); +extern Portal SPI_cursor_find(const char *name); +extern void SPI_cursor_fetch(Portal portal, bool forward, long count); +extern void SPI_cursor_move(Portal portal, bool forward, long count); +extern void SPI_scroll_cursor_fetch(Portal, FetchDirection direction, long count); +extern void SPI_scroll_cursor_move(Portal, FetchDirection direction, long count); +extern void SPI_cursor_close(Portal portal); + +extern int SPI_register_relation(EphemeralNamedRelation enr); +extern int SPI_unregister_relation(const char *name); +extern int SPI_register_trigger_data(TriggerData *tdata); + +extern void SPI_start_transaction(void); +extern void SPI_commit(void); +extern void SPI_commit_and_chain(void); +extern void SPI_rollback(void); +extern void SPI_rollback_and_chain(void); + +extern void AtEOXact_SPI(bool isCommit); +extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); +extern bool SPI_inside_nonatomic_context(void); + +#endif /* SPI_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/spi_priv.h b/platform/dbops/binaries/postgres/include/server/executor/spi_priv.h new file mode 100644 index 0000000000000000000000000000000000000000..1129ae094e2f1da50cb75aa2b2a1bfeff11b409e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/spi_priv.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * spi_priv.h + * Server Programming Interface private declarations + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/spi_priv.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPI_PRIV_H +#define SPI_PRIV_H + +#include "executor/spi.h" +#include "utils/queryenvironment.h" + + +#define _SPI_PLAN_MAGIC 569278163 + +typedef struct +{ + /* current results */ + uint64 processed; /* by Executor */ + SPITupleTable *tuptable; /* tuptable currently being built */ + + /* subtransaction in which current Executor call was started */ + SubTransactionId execSubid; + + /* resources of this execution context */ + slist_head tuptables; /* list of all live SPITupleTables */ + MemoryContext procCxt; /* procedure context */ + MemoryContext execCxt; /* executor context */ + MemoryContext savedcxt; /* context of SPI_connect's caller */ + SubTransactionId connectSubid; /* ID of connecting subtransaction */ + QueryEnvironment *queryEnv; /* query environment setup for SPI level */ + + /* transaction management support */ + bool atomic; /* atomic execution context, does not allow + * transactions */ + bool internal_xact; /* SPI-managed transaction boundary, skip + * cleanup */ + + /* saved values of API global variables for previous nesting level */ + uint64 outer_processed; + SPITupleTable *outer_tuptable; + int outer_result; +} _SPI_connection; + +/* + * SPI plans have three states: saved, unsaved, or temporary. + * + * Ordinarily, the _SPI_plan struct itself as well as the argtypes array + * are in a dedicated memory context identified by plancxt (which can be + * really small). All the other subsidiary state is in plancache entries + * identified by plancache_list (note: the list cells themselves are in + * plancxt). + * + * In an unsaved plan, the plancxt as well as the plancache entries' contexts + * are children of the SPI procedure context, so they'll all disappear at + * function exit. plancache.c also knows that the plancache entries are + * "unsaved", so it doesn't link them into its global list; hence they do + * not respond to inval events. This is OK since we are presumably holding + * adequate locks to prevent other backends from messing with the tables. + * + * For a saved plan, the plancxt is made a child of CacheMemoryContext + * since it should persist until explicitly destroyed. Likewise, the + * plancache entries will be under CacheMemoryContext since we tell + * plancache.c to save them. We rely on plancache.c to keep the cache + * entries up-to-date as needed in the face of invalidation events. + * + * There are also "temporary" SPI plans, in which the _SPI_plan struct is + * not even palloc'd but just exists in some function's local variable. + * The plancache entries are unsaved and exist under the SPI executor context, + * while additional data such as argtypes and list cells is loose in the SPI + * executor context. Such plans can be identified by having plancxt == NULL. + * + * We can also have "one-shot" SPI plans (which are typically temporary, + * as described above). These are meant to be executed once and discarded, + * and various optimizations are made on the assumption of single use. + * Note in particular that the CachedPlanSources within such an SPI plan + * are not "complete" until execution. + * + * Note: if the original query string contained only whitespace and comments, + * the plancache_list will be NIL and so there is no place to store the + * query string. We don't care about that, but we do care about the + * argument type array, which is why it's seemingly-redundantly stored. + */ +typedef struct _SPI_plan +{ + int magic; /* should equal _SPI_PLAN_MAGIC */ + bool saved; /* saved or unsaved plan? */ + bool oneshot; /* one-shot plan? */ + List *plancache_list; /* one CachedPlanSource per parsetree */ + MemoryContext plancxt; /* Context containing _SPI_plan and data */ + RawParseMode parse_mode; /* raw_parser() mode */ + int cursor_options; /* Cursor options used for planning */ + int nargs; /* number of plan arguments */ + Oid *argtypes; /* Argument types (NULL if nargs is 0) */ + ParserSetupHook parserSetup; /* alternative parameter spec method */ + void *parserSetupArg; +} _SPI_plan; + +#endif /* SPI_PRIV_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/tablefunc.h b/platform/dbops/binaries/postgres/include/server/executor/tablefunc.h new file mode 100644 index 0000000000000000000000000000000000000000..f8ceef387cf8fb76a1d51154005c7ae70a27548c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/tablefunc.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * tablefunc.h + * interface for TableFunc executor node + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tablefunc.h + * + *------------------------------------------------------------------------- + */ +#ifndef _TABLEFUNC_H +#define _TABLEFUNC_H + +/* Forward-declare this to avoid including execnodes.h here */ +struct TableFuncScanState; + +/* + * TableFuncRoutine holds function pointers used for generating content of + * table-producer functions, such as XMLTABLE. + * + * InitOpaque initializes table builder private objects. The output tuple + * descriptor, input functions for the columns, and typioparams are passed + * from executor state. + * + * SetDocument is called to define the input document. The table builder may + * apply additional transformations not exposed outside the table builder + * context. + * + * SetNamespace is called to pass namespace declarations from the table + * expression. This function may be NULL if namespaces are not supported by + * the table builder. Namespaces must be given before setting the row and + * column filters. If the name is given as NULL, the entry shall be for the + * default namespace. + * + * SetRowFilter is called do define the row-generating filter, which shall be + * used to extract each row from the input document. + * + * SetColumnFilter is called once for each column, to define the column- + * generating filter for the given column. + * + * FetchRow shall be called repeatedly until it returns that no more rows are + * found in the document. On each invocation it shall set state in the table + * builder context such that each subsequent GetValue call returns the values + * for the indicated column for the row being processed. + * + * DestroyOpaque shall release all resources associated with a table builder + * context. It may be called either because all rows have been consumed, or + * because an error occurred while processing the table expression. + */ +typedef struct TableFuncRoutine +{ + void (*InitOpaque) (struct TableFuncScanState *state, int natts); + void (*SetDocument) (struct TableFuncScanState *state, Datum value); + void (*SetNamespace) (struct TableFuncScanState *state, const char *name, + const char *uri); + void (*SetRowFilter) (struct TableFuncScanState *state, const char *path); + void (*SetColumnFilter) (struct TableFuncScanState *state, + const char *path, int colnum); + bool (*FetchRow) (struct TableFuncScanState *state); + Datum (*GetValue) (struct TableFuncScanState *state, int colnum, + Oid typid, int32 typmod, bool *isnull); + void (*DestroyOpaque) (struct TableFuncScanState *state); +} TableFuncRoutine; + +#endif /* _TABLEFUNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/tqueue.h b/platform/dbops/binaries/postgres/include/server/executor/tqueue.h new file mode 100644 index 0000000000000000000000000000000000000000..093a6b8875ce1739344834a1fef73085fef05b4d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/tqueue.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * tqueue.h + * Use shm_mq to send & receive tuples between parallel backends + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tqueue.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TQUEUE_H +#define TQUEUE_H + +#include "storage/shm_mq.h" +#include "tcop/dest.h" + +/* Opaque struct, only known inside tqueue.c. */ +typedef struct TupleQueueReader TupleQueueReader; + +/* Use this to send tuples to a shm_mq. */ +extern DestReceiver *CreateTupleQueueDestReceiver(shm_mq_handle *handle); + +/* Use these to receive tuples from a shm_mq. */ +extern TupleQueueReader *CreateTupleQueueReader(shm_mq_handle *handle); +extern void DestroyTupleQueueReader(TupleQueueReader *reader); +extern MinimalTuple TupleQueueReaderNext(TupleQueueReader *reader, + bool nowait, bool *done); + +#endif /* TQUEUE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/tstoreReceiver.h b/platform/dbops/binaries/postgres/include/server/executor/tstoreReceiver.h new file mode 100644 index 0000000000000000000000000000000000000000..a46adad031698c599dcbbada33a8d02d8001da12 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/tstoreReceiver.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * tstoreReceiver.h + * prototypes for tstoreReceiver.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tstoreReceiver.h + * + *------------------------------------------------------------------------- + */ + +#ifndef TSTORE_RECEIVER_H +#define TSTORE_RECEIVER_H + +#include "tcop/dest.h" +#include "utils/tuplestore.h" + + +extern DestReceiver *CreateTuplestoreDestReceiver(void); + +extern void SetTuplestoreDestReceiverParams(DestReceiver *self, + Tuplestorestate *tStore, + MemoryContext tContext, + bool detoast, + TupleDesc target_tupdesc, + const char *map_failure_msg); + +#endif /* TSTORE_RECEIVER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/executor/tuptable.h b/platform/dbops/binaries/postgres/include/server/executor/tuptable.h new file mode 100644 index 0000000000000000000000000000000000000000..b82655e7e55519ae7dc7220ab571de6766c8a153 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/executor/tuptable.h @@ -0,0 +1,523 @@ +/*------------------------------------------------------------------------- + * + * tuptable.h + * tuple table support stuff + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/executor/tuptable.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPTABLE_H +#define TUPTABLE_H + +#include "access/htup.h" +#include "access/htup_details.h" +#include "access/sysattr.h" +#include "access/tupdesc.h" +#include "storage/buf.h" + +/*---------- + * The executor stores tuples in a "tuple table" which is a List of + * independent TupleTableSlots. + * + * There's various different types of tuple table slots, each being able to + * store different types of tuples. Additional types of slots can be added + * without modifying core code. The type of a slot is determined by the + * TupleTableSlotOps* passed to the slot creation routine. The builtin types + * of slots are + * + * 1. physical tuple in a disk buffer page (TTSOpsBufferHeapTuple) + * 2. physical tuple constructed in palloc'ed memory (TTSOpsHeapTuple) + * 3. "minimal" physical tuple constructed in palloc'ed memory + * (TTSOpsMinimalTuple) + * 4. "virtual" tuple consisting of Datum/isnull arrays (TTSOpsVirtual) + * + * + * The first two cases are similar in that they both deal with "materialized" + * tuples, but resource management is different. For a tuple in a disk page + * we need to hold a pin on the buffer until the TupleTableSlot's reference + * to the tuple is dropped; while for a palloc'd tuple we usually want the + * tuple pfree'd when the TupleTableSlot's reference is dropped. + * + * A "minimal" tuple is handled similarly to a palloc'd regular tuple. + * At present, minimal tuples never are stored in buffers, so there is no + * parallel to case 1. Note that a minimal tuple has no "system columns". + * + * A "virtual" tuple is an optimization used to minimize physical data copying + * in a nest of plan nodes. Until materialized pass-by-reference Datums in + * the slot point to storage that is not directly associated with the + * TupleTableSlot; generally they will point to part of a tuple stored in a + * lower plan node's output TupleTableSlot, or to a function result + * constructed in a plan node's per-tuple econtext. It is the responsibility + * of the generating plan node to be sure these resources are not released for + * as long as the virtual tuple needs to be valid or is materialized. Note + * also that a virtual tuple does not have any "system columns". + * + * The Datum/isnull arrays of a TupleTableSlot serve double duty. For virtual + * slots they are the authoritative data. For the other builtin slots, + * the arrays contain data extracted from the tuple. (In this state, any + * pass-by-reference Datums point into the physical tuple.) The extracted + * information is built "lazily", ie, only as needed. This serves to avoid + * repeated extraction of data from the physical tuple. + * + * A TupleTableSlot can also be "empty", indicated by flag TTS_FLAG_EMPTY set + * in tts_flags, holding no valid data. This is the only valid state for a + * freshly-created slot that has not yet had a tuple descriptor assigned to + * it. In this state, TTS_FLAG_SHOULDFREE should not be set in tts_flags and + * tts_nvalid should be set to zero. + * + * The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot + * code. The caller of ExecSetSlotDescriptor() is responsible for providing + * a descriptor that will live as long as the slot does. (Typically, both + * slots and descriptors are in per-query memory and are freed by memory + * context deallocation at query end; so it's not worth providing any extra + * mechanism to do more. However, the slot will increment the tupdesc + * reference count if a reference-counted tupdesc is supplied.) + * + * When TTS_FLAG_SHOULDFREE is set in tts_flags, the physical tuple is "owned" + * by the slot and should be freed when the slot's reference to the tuple is + * dropped. + * + * tts_values/tts_isnull are allocated either when the slot is created (when + * the descriptor is provided), or when a descriptor is assigned to the slot; + * they are of length equal to the descriptor's natts. + * + * The TTS_FLAG_SLOW flag is saved state for + * slot_deform_heap_tuple, and should not be touched by any other code. + *---------- + */ + +/* true = slot is empty */ +#define TTS_FLAG_EMPTY (1 << 1) +#define TTS_EMPTY(slot) (((slot)->tts_flags & TTS_FLAG_EMPTY) != 0) + +/* should pfree tuple "owned" by the slot? */ +#define TTS_FLAG_SHOULDFREE (1 << 2) +#define TTS_SHOULDFREE(slot) (((slot)->tts_flags & TTS_FLAG_SHOULDFREE) != 0) + +/* saved state for slot_deform_heap_tuple */ +#define TTS_FLAG_SLOW (1 << 3) +#define TTS_SLOW(slot) (((slot)->tts_flags & TTS_FLAG_SLOW) != 0) + +/* fixed tuple descriptor */ +#define TTS_FLAG_FIXED (1 << 4) +#define TTS_FIXED(slot) (((slot)->tts_flags & TTS_FLAG_FIXED) != 0) + +struct TupleTableSlotOps; +typedef struct TupleTableSlotOps TupleTableSlotOps; + +/* base tuple table slot type */ +typedef struct TupleTableSlot +{ + NodeTag type; +#define FIELDNO_TUPLETABLESLOT_FLAGS 1 + uint16 tts_flags; /* Boolean states */ +#define FIELDNO_TUPLETABLESLOT_NVALID 2 + AttrNumber tts_nvalid; /* # of valid values in tts_values */ + const TupleTableSlotOps *const tts_ops; /* implementation of slot */ +#define FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR 4 + TupleDesc tts_tupleDescriptor; /* slot's tuple descriptor */ +#define FIELDNO_TUPLETABLESLOT_VALUES 5 + Datum *tts_values; /* current per-attribute values */ +#define FIELDNO_TUPLETABLESLOT_ISNULL 6 + bool *tts_isnull; /* current per-attribute isnull flags */ + MemoryContext tts_mcxt; /* slot itself is in this context */ + ItemPointerData tts_tid; /* stored tuple's tid */ + Oid tts_tableOid; /* table oid of tuple */ +} TupleTableSlot; + +/* routines for a TupleTableSlot implementation */ +struct TupleTableSlotOps +{ + /* Minimum size of the slot */ + size_t base_slot_size; + + /* Initialization. */ + void (*init) (TupleTableSlot *slot); + + /* Destruction. */ + void (*release) (TupleTableSlot *slot); + + /* + * Clear the contents of the slot. Only the contents are expected to be + * cleared and not the tuple descriptor. Typically an implementation of + * this callback should free the memory allocated for the tuple contained + * in the slot. + */ + void (*clear) (TupleTableSlot *slot); + + /* + * Fill up first natts entries of tts_values and tts_isnull arrays with + * values from the tuple contained in the slot. The function may be called + * with natts more than the number of attributes available in the tuple, + * in which case it should set tts_nvalid to the number of returned + * columns. + */ + void (*getsomeattrs) (TupleTableSlot *slot, int natts); + + /* + * Returns value of the given system attribute as a datum and sets isnull + * to false, if it's not NULL. Throws an error if the slot type does not + * support system attributes. + */ + Datum (*getsysattr) (TupleTableSlot *slot, int attnum, bool *isnull); + + /* + * Check if the tuple is created by the current transaction. Throws an + * error if the slot doesn't contain the storage tuple. + */ + bool (*is_current_xact_tuple) (TupleTableSlot *slot); + + /* + * Make the contents of the slot solely depend on the slot, and not on + * underlying resources (like another memory context, buffers, etc). + */ + void (*materialize) (TupleTableSlot *slot); + + /* + * Copy the contents of the source slot into the destination slot's own + * context. Invoked using callback of the destination slot. 'dstslot' and + * 'srcslot' can be assumed to have the same number of attributes. + */ + void (*copyslot) (TupleTableSlot *dstslot, TupleTableSlot *srcslot); + + /* + * Return a heap tuple "owned" by the slot. It is slot's responsibility to + * free the memory consumed by the heap tuple. If the slot can not "own" a + * heap tuple, it should not implement this callback and should set it as + * NULL. + */ + HeapTuple (*get_heap_tuple) (TupleTableSlot *slot); + + /* + * Return a minimal tuple "owned" by the slot. It is slot's responsibility + * to free the memory consumed by the minimal tuple. If the slot can not + * "own" a minimal tuple, it should not implement this callback and should + * set it as NULL. + */ + MinimalTuple (*get_minimal_tuple) (TupleTableSlot *slot); + + /* + * Return a copy of heap tuple representing the contents of the slot. The + * copy needs to be palloc'd in the current memory context. The slot + * itself is expected to remain unaffected. It is *not* expected to have + * meaningful "system columns" in the copy. The copy is not be "owned" by + * the slot i.e. the caller has to take responsibility to free memory + * consumed by the slot. + */ + HeapTuple (*copy_heap_tuple) (TupleTableSlot *slot); + + /* + * Return a copy of minimal tuple representing the contents of the slot. + * The copy needs to be palloc'd in the current memory context. The slot + * itself is expected to remain unaffected. It is *not* expected to have + * meaningful "system columns" in the copy. The copy is not be "owned" by + * the slot i.e. the caller has to take responsibility to free memory + * consumed by the slot. + */ + MinimalTuple (*copy_minimal_tuple) (TupleTableSlot *slot); +}; + +/* + * Predefined TupleTableSlotOps for various types of TupleTableSlotOps. The + * same are used to identify the type of a given slot. + */ +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsVirtual; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsHeapTuple; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsMinimalTuple; +extern PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple; + +#define TTS_IS_VIRTUAL(slot) ((slot)->tts_ops == &TTSOpsVirtual) +#define TTS_IS_HEAPTUPLE(slot) ((slot)->tts_ops == &TTSOpsHeapTuple) +#define TTS_IS_MINIMALTUPLE(slot) ((slot)->tts_ops == &TTSOpsMinimalTuple) +#define TTS_IS_BUFFERTUPLE(slot) ((slot)->tts_ops == &TTSOpsBufferHeapTuple) + + +/* + * Tuple table slot implementations. + */ + +typedef struct VirtualTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + + char *data; /* data for materialized slots */ +} VirtualTupleTableSlot; + +typedef struct HeapTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + +#define FIELDNO_HEAPTUPLETABLESLOT_TUPLE 1 + HeapTuple tuple; /* physical tuple */ +#define FIELDNO_HEAPTUPLETABLESLOT_OFF 2 + uint32 off; /* saved state for slot_deform_heap_tuple */ + HeapTupleData tupdata; /* optional workspace for storing tuple */ +} HeapTupleTableSlot; + +/* heap tuple residing in a buffer */ +typedef struct BufferHeapTupleTableSlot +{ + pg_node_attr(abstract) + + HeapTupleTableSlot base; + + /* + * If buffer is not InvalidBuffer, then the slot is holding a pin on the + * indicated buffer page; drop the pin when we release the slot's + * reference to that buffer. (TTS_FLAG_SHOULDFREE should not be set in + * such a case, since presumably base.tuple is pointing into the buffer.) + */ + Buffer buffer; /* tuple's buffer, or InvalidBuffer */ +} BufferHeapTupleTableSlot; + +typedef struct MinimalTupleTableSlot +{ + pg_node_attr(abstract) + + TupleTableSlot base; + + /* + * In a minimal slot tuple points at minhdr and the fields of that struct + * are set correctly for access to the minimal tuple; in particular, + * minhdr.t_data points MINIMAL_TUPLE_OFFSET bytes before mintuple. This + * allows column extraction to treat the case identically to regular + * physical tuples. + */ +#define FIELDNO_MINIMALTUPLETABLESLOT_TUPLE 1 + HeapTuple tuple; /* tuple wrapper */ + MinimalTuple mintuple; /* minimal tuple, or NULL if none */ + HeapTupleData minhdr; /* workspace for minimal-tuple-only case */ +#define FIELDNO_MINIMALTUPLETABLESLOT_OFF 4 + uint32 off; /* saved state for slot_deform_heap_tuple */ +} MinimalTupleTableSlot; + +/* + * TupIsNull -- is a TupleTableSlot empty? + */ +#define TupIsNull(slot) \ + ((slot) == NULL || TTS_EMPTY(slot)) + +/* in executor/execTuples.c */ +extern TupleTableSlot *MakeTupleTableSlot(TupleDesc tupleDesc, + const TupleTableSlotOps *tts_ops); +extern TupleTableSlot *ExecAllocTableSlot(List **tupleTable, TupleDesc desc, + const TupleTableSlotOps *tts_ops); +extern void ExecResetTupleTable(List *tupleTable, bool shouldFree); +extern TupleTableSlot *MakeSingleTupleTableSlot(TupleDesc tupdesc, + const TupleTableSlotOps *tts_ops); +extern void ExecDropSingleTupleTableSlot(TupleTableSlot *slot); +extern void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc); +extern TupleTableSlot *ExecStoreHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + bool shouldFree); +extern void ExecForceStoreHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + bool shouldFree); +extern TupleTableSlot *ExecStoreBufferHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + Buffer buffer); +extern TupleTableSlot *ExecStorePinnedBufferHeapTuple(HeapTuple tuple, + TupleTableSlot *slot, + Buffer buffer); +extern TupleTableSlot *ExecStoreMinimalTuple(MinimalTuple mtup, + TupleTableSlot *slot, + bool shouldFree); +extern void ExecForceStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, + bool shouldFree); +extern TupleTableSlot *ExecStoreVirtualTuple(TupleTableSlot *slot); +extern TupleTableSlot *ExecStoreAllNullTuple(TupleTableSlot *slot); +extern void ExecStoreHeapTupleDatum(Datum data, TupleTableSlot *slot); +extern HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree); +extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot, + bool *shouldFree); +extern Datum ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot); +extern void slot_getmissingattrs(TupleTableSlot *slot, int startAttNum, + int lastAttNum); +extern void slot_getsomeattrs_int(TupleTableSlot *slot, int attnum); + + +#ifndef FRONTEND + +/* + * This function forces the entries of the slot's Datum/isnull arrays to be + * valid at least up through the attnum'th entry. + */ +static inline void +slot_getsomeattrs(TupleTableSlot *slot, int attnum) +{ + if (slot->tts_nvalid < attnum) + slot_getsomeattrs_int(slot, attnum); +} + +/* + * slot_getallattrs + * This function forces all the entries of the slot's Datum/isnull + * arrays to be valid. The caller may then extract data directly + * from those arrays instead of using slot_getattr. + */ +static inline void +slot_getallattrs(TupleTableSlot *slot) +{ + slot_getsomeattrs(slot, slot->tts_tupleDescriptor->natts); +} + + +/* + * slot_attisnull + * + * Detect whether an attribute of the slot is null, without actually fetching + * it. + */ +static inline bool +slot_attisnull(TupleTableSlot *slot, int attnum) +{ + Assert(attnum > 0); + + if (attnum > slot->tts_nvalid) + slot_getsomeattrs(slot, attnum); + + return slot->tts_isnull[attnum - 1]; +} + +/* + * slot_getattr - fetch one attribute of the slot's contents. + */ +static inline Datum +slot_getattr(TupleTableSlot *slot, int attnum, + bool *isnull) +{ + Assert(attnum > 0); + + if (attnum > slot->tts_nvalid) + slot_getsomeattrs(slot, attnum); + + *isnull = slot->tts_isnull[attnum - 1]; + + return slot->tts_values[attnum - 1]; +} + +/* + * slot_getsysattr - fetch a system attribute of the slot's current tuple. + * + * If the slot type does not contain system attributes, this will throw an + * error. Hence before calling this function, callers should make sure that + * the slot type is the one that supports system attributes. + */ +static inline Datum +slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull) +{ + Assert(attnum < 0); /* caller error */ + + if (attnum == TableOidAttributeNumber) + { + *isnull = false; + return ObjectIdGetDatum(slot->tts_tableOid); + } + else if (attnum == SelfItemPointerAttributeNumber) + { + *isnull = false; + return PointerGetDatum(&slot->tts_tid); + } + + /* Fetch the system attribute from the underlying tuple. */ + return slot->tts_ops->getsysattr(slot, attnum, isnull); +} + +/* + * slot_is_current_xact_tuple - check if the slot's current tuple is created + * by the current transaction. + * + * If the slot does not contain a storage tuple, this will throw an error. + * Hence before calling this function, callers should make sure that the + * slot type supports storage tuples and that there is currently one inside + * the slot. + */ +static inline bool +slot_is_current_xact_tuple(TupleTableSlot *slot) +{ + return slot->tts_ops->is_current_xact_tuple(slot); +} + +/* + * ExecClearTuple - clear the slot's contents + */ +static inline TupleTableSlot * +ExecClearTuple(TupleTableSlot *slot) +{ + slot->tts_ops->clear(slot); + + return slot; +} + +/* ExecMaterializeSlot - force a slot into the "materialized" state. + * + * This causes the slot's tuple to be a local copy not dependent on any + * external storage (i.e. pointing into a Buffer, or having allocations in + * another memory context). + * + * A typical use for this operation is to prepare a computed tuple for being + * stored on disk. The original data may or may not be virtual, but in any + * case we need a private copy for heap_insert to scribble on. + */ +static inline void +ExecMaterializeSlot(TupleTableSlot *slot) +{ + slot->tts_ops->materialize(slot); +} + +/* + * ExecCopySlotHeapTuple - return HeapTuple allocated in caller's context + */ +static inline HeapTuple +ExecCopySlotHeapTuple(TupleTableSlot *slot) +{ + Assert(!TTS_EMPTY(slot)); + + return slot->tts_ops->copy_heap_tuple(slot); +} + +/* + * ExecCopySlotMinimalTuple - return MinimalTuple allocated in caller's context + */ +static inline MinimalTuple +ExecCopySlotMinimalTuple(TupleTableSlot *slot) +{ + return slot->tts_ops->copy_minimal_tuple(slot); +} + +/* + * ExecCopySlot - copy one slot's contents into another. + * + * If a source's system attributes are supposed to be accessed in the target + * slot, the target slot and source slot types need to match. + * + * Currently, 'dstslot' and 'srcslot' must have the same number of attributes. + * Future work could see this relaxed to allow the source to contain + * additional attributes and have the code here only copy over the leading + * attributes. + */ +static inline TupleTableSlot * +ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot) +{ + Assert(!TTS_EMPTY(srcslot)); + Assert(srcslot != dstslot); + Assert(dstslot->tts_tupleDescriptor->natts == + srcslot->tts_tupleDescriptor->natts); + + dstslot->tts_ops->copyslot(dstslot, srcslot); + + return dstslot; +} + +#endif /* FRONTEND */ + +#endif /* TUPTABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/extension/cube/cubedata.h b/platform/dbops/binaries/postgres/include/server/extension/cube/cubedata.h new file mode 100644 index 0000000000000000000000000000000000000000..96fa41a04e710bb31380d3caf87ab2ebe1dad437 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/cube/cubedata.h @@ -0,0 +1,72 @@ +/* contrib/cube/cubedata.h */ + +/* + * This limit is pretty arbitrary, but don't make it so large that you + * risk overflow in sizing calculations. + */ +#define CUBE_MAX_DIM (100) + +typedef struct NDBOX +{ + /* varlena header (do not touch directly!) */ + int32 vl_len_; + + /*---------- + * Header contains info about NDBOX. For binary compatibility with old + * versions, it is defined as "unsigned int". + * + * Following information is stored: + * + * bits 0-7 : number of cube dimensions; + * bits 8-30 : unused, initialize to zero; + * bit 31 : point flag. If set, the upper right coordinates are not + * stored, and are implicitly the same as the lower left + * coordinates. + *---------- + */ + unsigned int header; + + /* + * The lower left coordinates for each dimension come first, followed by + * upper right coordinates unless the point flag is set. + */ + double x[FLEXIBLE_ARRAY_MEMBER]; +} NDBOX; + +/* NDBOX access macros */ +#define POINT_BIT 0x80000000 +#define DIM_MASK 0x7fffffff + +#define IS_POINT(cube) ( ((cube)->header & POINT_BIT) != 0 ) +#define SET_POINT_BIT(cube) ( (cube)->header |= POINT_BIT ) +#define DIM(cube) ( (cube)->header & DIM_MASK ) +#define SET_DIM(cube, _dim) ( (cube)->header = ((cube)->header & ~DIM_MASK) | (_dim) ) + +#define LL_COORD(cube, i) ( (cube)->x[i] ) +#define UR_COORD(cube, i) ( IS_POINT(cube) ? (cube)->x[i] : (cube)->x[(i) + DIM(cube)] ) + +#define POINT_SIZE(_dim) (offsetof(NDBOX, x) + sizeof(double)*(_dim)) +#define CUBE_SIZE(_dim) (offsetof(NDBOX, x) + sizeof(double)*(_dim)*2) + +/* fmgr interface macros */ +#define DatumGetNDBOXP(x) ((NDBOX *) PG_DETOAST_DATUM(x)) +#define PG_GETARG_NDBOX_P(x) DatumGetNDBOXP(PG_GETARG_DATUM(x)) +#define PG_RETURN_NDBOX_P(x) PG_RETURN_POINTER(x) + +/* GiST operator strategy numbers */ +#define CubeKNNDistanceCoord 15 /* ~> */ +#define CubeKNNDistanceTaxicab 16 /* <#> */ +#define CubeKNNDistanceEuclid 17 /* <-> */ +#define CubeKNNDistanceChebyshev 18 /* <=> */ + +/* in cubescan.l */ +extern int cube_yylex(void); +extern void cube_yyerror(NDBOX **result, Size scanbuflen, + struct Node *escontext, + const char *message); +extern void cube_scanner_init(const char *str, Size *scanbuflen); +extern void cube_scanner_finish(void); + +/* in cubeparse.y */ +extern int cube_yyparse(NDBOX **result, Size scanbuflen, + struct Node *escontext); diff --git a/platform/dbops/binaries/postgres/include/server/extension/hstore/hstore.h b/platform/dbops/binaries/postgres/include/server/extension/hstore/hstore.h new file mode 100644 index 0000000000000000000000000000000000000000..897af244a4230592d07d0e4184839b71625d5cd8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/hstore/hstore.h @@ -0,0 +1,205 @@ +/* + * contrib/hstore/hstore.h + */ +#ifndef __HSTORE_H__ +#define __HSTORE_H__ + +#include "fmgr.h" +#include "utils/array.h" + + +/* + * HEntry: there is one of these for each key _and_ value in an hstore + * + * the position offset points to the _end_ so that we can get the length + * by subtraction from the previous entry. the ISFIRST flag lets us tell + * whether there is a previous entry. + */ +typedef struct +{ + uint32 entry; +} HEntry; + +#define HENTRY_ISFIRST 0x80000000 +#define HENTRY_ISNULL 0x40000000 +#define HENTRY_POSMASK 0x3FFFFFFF + +/* note possible multiple evaluations, also access to prior array element */ +#define HSE_ISFIRST(he_) (((he_).entry & HENTRY_ISFIRST) != 0) +#define HSE_ISNULL(he_) (((he_).entry & HENTRY_ISNULL) != 0) +#define HSE_ENDPOS(he_) ((he_).entry & HENTRY_POSMASK) +#define HSE_OFF(he_) (HSE_ISFIRST(he_) ? 0 : HSE_ENDPOS((&(he_))[-1])) +#define HSE_LEN(he_) (HSE_ISFIRST(he_) \ + ? HSE_ENDPOS(he_) \ + : HSE_ENDPOS(he_) - HSE_ENDPOS((&(he_))[-1])) + +/* + * determined by the size of "endpos" (ie HENTRY_POSMASK), though this is a + * bit academic since currently varlenas (and hence both the input and the + * whole hstore) have the same limit + */ +#define HSTORE_MAX_KEY_LEN 0x3FFFFFFF +#define HSTORE_MAX_VALUE_LEN 0x3FFFFFFF + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 size_; /* flags and number of items in hstore */ + /* array of HEntry follows */ +} HStore; + +/* + * It's not possible to get more than 2^28 items into an hstore, so we reserve + * the top few bits of the size field. See hstore_compat.c for one reason + * why. Some bits are left for future use here. MaxAllocSize makes the + * practical count limit slightly more than 2^28 / 3, or INT_MAX / 24, the + * limit for an hstore full of 4-byte keys and null values. Therefore, we + * don't explicitly check the format-imposed limit. + */ +#define HS_FLAG_NEWVERSION 0x80000000 + +#define HS_COUNT(hsp_) ((hsp_)->size_ & 0x0FFFFFFF) +#define HS_SETCOUNT(hsp_,c_) ((hsp_)->size_ = (c_) | HS_FLAG_NEWVERSION) + + +/* + * "x" comes from an existing HS_COUNT() (as discussed, <= INT_MAX/24) or a + * Pairs array length (due to MaxAllocSize, <= INT_MAX/40). "lenstr" is no + * more than INT_MAX, that extreme case arising in hstore_from_arrays(). + * Therefore, this calculation is limited to about INT_MAX / 5 + INT_MAX. + */ +#define HSHRDSIZE (sizeof(HStore)) +#define CALCDATASIZE(x, lenstr) ( (x) * 2 * sizeof(HEntry) + HSHRDSIZE + (lenstr) ) + +/* note multiple evaluations of x */ +#define ARRPTR(x) ( (HEntry*) ( (HStore*)(x) + 1 ) ) +#define STRPTR(x) ( (char*)(ARRPTR(x) + HS_COUNT((HStore*)(x)) * 2) ) + +/* note multiple/non evaluations */ +#define HSTORE_KEY(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)])) +#define HSTORE_VAL(arr_,str_,i_) ((str_) + HSE_OFF((arr_)[2*(i_)+1])) +#define HSTORE_KEYLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)])) +#define HSTORE_VALLEN(arr_,i_) (HSE_LEN((arr_)[2*(i_)+1])) +#define HSTORE_VALISNULL(arr_,i_) (HSE_ISNULL((arr_)[2*(i_)+1])) + +/* + * currently, these following macros are the _only_ places that rely + * on internal knowledge of HEntry. Everything else should be using + * the above macros. Exception: the in-place upgrade in hstore_compat.c + * messes with entries directly. + */ + +/* + * copy one key/value pair (which must be contiguous starting at + * sptr_) into an under-construction hstore; dent_ is an HEntry*, + * dbuf_ is the destination's string buffer, dptr_ is the current + * position in the destination. lots of modification and multiple + * evaluation here. + */ +#define HS_COPYITEM(dent_,dbuf_,dptr_,sptr_,klen_,vlen_,vnull_) \ + do { \ + memcpy((dptr_), (sptr_), (klen_)+(vlen_)); \ + (dptr_) += (klen_)+(vlen_); \ + (dent_)++->entry = ((dptr_) - (dbuf_) - (vlen_)) & HENTRY_POSMASK; \ + (dent_)++->entry = ((((dptr_) - (dbuf_)) & HENTRY_POSMASK) \ + | ((vnull_) ? HENTRY_ISNULL : 0)); \ + } while(0) + +/* + * add one key/item pair, from a Pairs structure, into an + * under-construction hstore + */ +#define HS_ADDITEM(dent_,dbuf_,dptr_,pair_) \ + do { \ + memcpy((dptr_), (pair_).key, (pair_).keylen); \ + (dptr_) += (pair_).keylen; \ + (dent_)++->entry = ((dptr_) - (dbuf_)) & HENTRY_POSMASK; \ + if ((pair_).isnull) \ + (dent_)++->entry = ((((dptr_) - (dbuf_)) & HENTRY_POSMASK) \ + | HENTRY_ISNULL); \ + else \ + { \ + memcpy((dptr_), (pair_).val, (pair_).vallen); \ + (dptr_) += (pair_).vallen; \ + (dent_)++->entry = ((dptr_) - (dbuf_)) & HENTRY_POSMASK; \ + } \ + } while (0) + +/* finalize a newly-constructed hstore */ +#define HS_FINALIZE(hsp_,count_,buf_,ptr_) \ + do { \ + int _buflen = (ptr_) - (buf_); \ + if ((count_)) \ + ARRPTR(hsp_)[0].entry |= HENTRY_ISFIRST; \ + if ((count_) != HS_COUNT((hsp_))) \ + { \ + HS_SETCOUNT((hsp_),(count_)); \ + memmove(STRPTR(hsp_), (buf_), _buflen); \ + } \ + SET_VARSIZE((hsp_), CALCDATASIZE((count_), _buflen)); \ + } while (0) + +/* ensure the varlena size of an existing hstore is correct */ +#define HS_FIXSIZE(hsp_,count_) \ + do { \ + int bl = (count_) ? HSE_ENDPOS(ARRPTR(hsp_)[2*(count_)-1]) : 0; \ + SET_VARSIZE((hsp_), CALCDATASIZE((count_),bl)); \ + } while (0) + +/* DatumGetHStoreP includes support for reading old-format hstore values */ +extern PGDLLEXPORT HStore *hstoreUpgrade(Datum orig); + +#define DatumGetHStoreP(d) hstoreUpgrade(d) + +#define PG_GETARG_HSTORE_P(x) DatumGetHStoreP(PG_GETARG_DATUM(x)) + + +/* + * Pairs is a "decompressed" representation of one key/value pair. + * The two strings are not necessarily null-terminated. + */ +typedef struct +{ + char *key; + char *val; + size_t keylen; + size_t vallen; + bool isnull; /* value is null? */ + bool needfree; /* need to pfree the value? */ +} Pairs; + +extern PGDLLEXPORT int hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen); +extern PGDLLEXPORT HStore *hstorePairs(Pairs *pairs, int32 pcount, int32 buflen); + +extern PGDLLEXPORT size_t hstoreCheckKeyLen(size_t len); +extern PGDLLEXPORT size_t hstoreCheckValLen(size_t len); + +extern PGDLLEXPORT int hstoreFindKey(HStore *hs, int *lowbound, char *key, int keylen); +extern PGDLLEXPORT Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs); + +#define HStoreContainsStrategyNumber 7 +#define HStoreExistsStrategyNumber 9 +#define HStoreExistsAnyStrategyNumber 10 +#define HStoreExistsAllStrategyNumber 11 +#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */ + +/* + * defining HSTORE_POLLUTE_NAMESPACE=0 will prevent use of old function names; + * for now, we default to on for the benefit of people restoring old dumps + */ +#ifndef HSTORE_POLLUTE_NAMESPACE +#define HSTORE_POLLUTE_NAMESPACE 1 +#endif + +#if HSTORE_POLLUTE_NAMESPACE +#define HSTORE_POLLUTE(newname_,oldname_) \ + PG_FUNCTION_INFO_V1(oldname_); \ + extern PGDLLEXPORT Datum newname_(PG_FUNCTION_ARGS); \ + Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \ + extern int no_such_variable +#else +#define HSTORE_POLLUTE(newname_,oldname_) \ + extern int no_such_variable +#endif + +#endif /* __HSTORE_H__ */ diff --git a/platform/dbops/binaries/postgres/include/server/extension/isn/isn.h b/platform/dbops/binaries/postgres/include/server/extension/isn/isn.h new file mode 100644 index 0000000000000000000000000000000000000000..2b499bcf3389a6aa8be5a9451fe409021e5da95c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/isn/isn.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * isn.h + * PostgreSQL type definitions for ISNs (ISBN, ISMN, ISSN, EAN13, UPC) + * + * Author: German Mendez Bravo (Kronuz) + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * contrib/isn/isn.h + * + *------------------------------------------------------------------------- + */ + +#ifndef ISN_H +#define ISN_H + +#include "fmgr.h" + +#undef ISN_DEBUG +#define ISN_WEAK_MODE + +/* + * uint64 is the internal storage format for ISNs. + */ +typedef uint64 ean13; + +#define EAN13_FORMAT UINT64_FORMAT + +#define PG_GETARG_EAN13(n) PG_GETARG_INT64(n) +#define PG_RETURN_EAN13(x) PG_RETURN_INT64(x) + +extern void initialize(void); + +#endif /* ISN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/extension/ltree/ltree.h b/platform/dbops/binaries/postgres/include/server/extension/ltree/ltree.h new file mode 100644 index 0000000000000000000000000000000000000000..5e0761641d32ac5db8e925a6c34d699eb21705ec --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/ltree/ltree.h @@ -0,0 +1,317 @@ +/* contrib/ltree/ltree.h */ + +#ifndef __LTREE_H__ +#define __LTREE_H__ + +#include "fmgr.h" +#include "tsearch/ts_locale.h" +#include "utils/memutils.h" + + +/* ltree */ + +/* + * We want the maximum length of a label to be encoding-independent, so + * set it somewhat arbitrarily at 1000 characters (not bytes), while using + * uint16 fields to hold the byte length. + */ +#define LTREE_LABEL_MAX_CHARS 1000 + +/* + * LOWER_NODE used to be defined in the Makefile via the compile flags. + * However the MSVC build scripts neglected to do the same which resulted in + * MSVC builds not using LOWER_NODE. Since then, the MSVC scripts have been + * modified to look for -D compile flags in Makefiles, so here, in order to + * get the historic behavior of LOWER_NODE not being defined on MSVC, we only + * define it when not building in that environment. This is important as we + * want to maintain the same LOWER_NODE behavior after a pg_upgrade. + */ +#ifndef _MSC_VER +#define LOWER_NODE +#endif + +typedef struct +{ + uint16 len; /* label string length in bytes */ + char name[FLEXIBLE_ARRAY_MEMBER]; +} ltree_level; + +#define LEVEL_HDRSIZE (offsetof(ltree_level,name)) +#define LEVEL_NEXT(x) ( (ltree_level*)( ((char*)(x)) + MAXALIGN(((ltree_level*)(x))->len + LEVEL_HDRSIZE) ) ) + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint16 numlevel; /* number of labels */ + /* Array of maxalign'd ltree_level structs follows: */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltree; + +#define LTREE_HDRSIZE MAXALIGN( offsetof(ltree, data) ) +#define LTREE_FIRST(x) ( (ltree_level*)( ((char*)(x))+LTREE_HDRSIZE ) ) +#define LTREE_MAX_LEVELS PG_UINT16_MAX /* ltree.numlevel is uint16 */ + + +/* lquery */ + +/* lquery_variant: one branch of some OR'ed alternatives */ +typedef struct +{ + int32 val; /* CRC of label string */ + uint16 len; /* label string length in bytes */ + uint8 flag; /* see LVAR_xxx flags below */ + char name[FLEXIBLE_ARRAY_MEMBER]; +} lquery_variant; + +/* + * Note: these macros contain too many MAXALIGN calls and so will sometimes + * overestimate the space needed for an lquery_variant. However, we can't + * change it without breaking on-disk compatibility for lquery. + */ +#define LVAR_HDRSIZE MAXALIGN(offsetof(lquery_variant, name)) +#define LVAR_NEXT(x) ( (lquery_variant*)( ((char*)(x)) + MAXALIGN(((lquery_variant*)(x))->len) + LVAR_HDRSIZE ) ) + +#define LVAR_ANYEND 0x01 /* '*' flag: prefix match */ +#define LVAR_INCASE 0x02 /* '@' flag: case-insensitive match */ +#define LVAR_SUBLEXEME 0x04 /* '%' flag: word-wise match */ + +/* + * In an lquery_level, "flag" contains the union of the variants' flags + * along with possible LQL_xxx flags; so those bit sets can't overlap. + * + * "low" and "high" are nominally the minimum and maximum number of matches. + * However, for backwards compatibility with pre-v13 on-disk lqueries, + * non-'*' levels (those with numvar > 0) only have valid low/high if the + * LQL_COUNT flag is set; otherwise those fields are zero, but the behavior + * is as if they were both 1. + */ +typedef struct +{ + uint16 totallen; /* total length of this level, in bytes */ + uint16 flag; /* see LQL_xxx and LVAR_xxx flags */ + uint16 numvar; /* number of variants; 0 means '*' */ + uint16 low; /* minimum repeat count */ + uint16 high; /* maximum repeat count */ + /* Array of maxalign'd lquery_variant structs follows: */ + char variants[FLEXIBLE_ARRAY_MEMBER]; +} lquery_level; + +#define LQL_HDRSIZE MAXALIGN( offsetof(lquery_level,variants) ) +#define LQL_NEXT(x) ( (lquery_level*)( ((char*)(x)) + MAXALIGN(((lquery_level*)(x))->totallen) ) ) +#define LQL_FIRST(x) ( (lquery_variant*)( ((char*)(x))+LQL_HDRSIZE ) ) + +#define LQL_NOT 0x10 /* level has '!' (NOT) prefix */ +#define LQL_COUNT 0x20 /* level is non-'*' and has repeat counts */ + +#ifdef LOWER_NODE +#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME ) ) == 0 ) +#else +#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME | LVAR_INCASE ) ) == 0 ) +#endif +#define LQL_CANLOOKSIGN(x) FLG_CANLOOKSIGN( ((lquery_level*)(x))->flag ) + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint16 numlevel; /* number of lquery_levels */ + uint16 firstgood; /* number of leading simple-match levels */ + uint16 flag; /* see LQUERY_xxx flags below */ + /* Array of maxalign'd lquery_level structs follows: */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} lquery; + +#define LQUERY_HDRSIZE MAXALIGN( offsetof(lquery, data) ) +#define LQUERY_FIRST(x) ( (lquery_level*)( ((char*)(x))+LQUERY_HDRSIZE ) ) +#define LQUERY_MAX_LEVELS PG_UINT16_MAX /* lquery.numlevel is uint16 */ + +#define LQUERY_HASNOT 0x01 + +/* valid label chars are alphanumerics, underscores and hyphens */ +#define ISLABEL(x) ( t_isalnum(x) || t_iseq(x, '_') || t_iseq(x, '-') ) + +/* full text query */ + +/* + * item in polish notation with back link + * to left operand + */ +typedef struct ITEM +{ + int16 type; + int16 left; + int32 val; + uint8 flag; + /* user-friendly value */ + uint8 length; + uint16 distance; +} ITEM; + +/* + *Storage: + * (len)(size)(array of ITEM)(array of operand in user-friendly form) + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltxtquery; + +#define HDRSIZEQT MAXALIGN(VARHDRSZ + sizeof(int32)) +#define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + (size) * sizeof(ITEM) + (lenofoperand) ) +#define LTXTQUERY_TOO_BIG(size,lenofoperand) \ + ((size) > (MaxAllocSize - HDRSIZEQT - (lenofoperand)) / sizeof(ITEM)) +#define GETQUERY(x) (ITEM*)( (char*)(x)+HDRSIZEQT ) +#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((ltxtquery*)x)->size * sizeof(ITEM) ) + +#define ISOPERATOR(x) ( (x)=='!' || (x)=='&' || (x)=='|' || (x)=='(' || (x)==')' ) + +#define END 0 +#define ERR 1 +#define VAL 2 +#define OPR 3 +#define OPEN 4 +#define CLOSE 5 +#define VALTRUE 6 /* for stop words */ +#define VALFALSE 7 + + +/* use in array iterator */ +PGDLLEXPORT Datum ltree_isparent(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltree_risparent(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltq_regex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltq_rregex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum lt_q_regex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum lt_q_rregex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltxtq_exec(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltxtq_rexec(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltq_regex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltq_rregex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _lt_q_regex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _lt_q_rregex(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltxtq_exec(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltxtq_rexec(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltree_isparent(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum _ltree_risparent(PG_FUNCTION_ARGS); + +/* Concatenation functions */ +PGDLLEXPORT Datum ltree_addltree(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltree_addtext(PG_FUNCTION_ARGS); +PGDLLEXPORT Datum ltree_textadd(PG_FUNCTION_ARGS); + +/* Util function */ +PGDLLEXPORT Datum ltree_in(PG_FUNCTION_ARGS); + +bool ltree_execute(ITEM *curitem, void *checkval, + bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)); + +int ltree_compare(const ltree *a, const ltree *b); +bool inner_isparent(const ltree *c, const ltree *p); +bool compare_subnode(ltree_level *t, char *qn, int len, + int (*cmpptr) (const char *, const char *, size_t), bool anyend); +ltree *lca_inner(ltree **a, int len); +int ltree_strncasecmp(const char *a, const char *b, size_t s); + +/* fmgr macros for ltree objects */ +#define DatumGetLtreeP(X) ((ltree *) PG_DETOAST_DATUM(X)) +#define DatumGetLtreePCopy(X) ((ltree *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LTREE_P(n) DatumGetLtreeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LTREE_P_COPY(n) DatumGetLtreePCopy(PG_GETARG_DATUM(n)) + +#define DatumGetLqueryP(X) ((lquery *) PG_DETOAST_DATUM(X)) +#define DatumGetLqueryPCopy(X) ((lquery *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LQUERY_P(n) DatumGetLqueryP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LQUERY_P_COPY(n) DatumGetLqueryPCopy(PG_GETARG_DATUM(n)) + +#define DatumGetLtxtqueryP(X) ((ltxtquery *) PG_DETOAST_DATUM(X)) +#define DatumGetLtxtqueryPCopy(X) ((ltxtquery *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LTXTQUERY_P(n) DatumGetLtxtqueryP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LTXTQUERY_P_COPY(n) DatumGetLtxtqueryPCopy(PG_GETARG_DATUM(n)) + +/* GiST support for ltree */ + +#define BITBYTE 8 +#define SIGLENBIT(siglen) ((siglen) * BITBYTE) +#define LTREE_SIGLEN_DEFAULT (2 * sizeof(int32)) +#define LTREE_SIGLEN_MAX GISTMaxIndexKeySize +#define LTREE_GET_SIGLEN() (PG_HAS_OPCLASS_OPTIONS() ? \ + ((LtreeGistOptions *) PG_GET_OPCLASS_OPTIONS())->siglen : \ + LTREE_SIGLEN_DEFAULT) + +typedef unsigned char *BITVECP; + +#define LOOPBYTE(siglen) \ + for(i = 0; i < (siglen); i++) + +#define GETBYTE(x,i) ( *( (BITVECP)(x) + (int)( (i) / BITBYTE ) ) ) +#define GETBITBYTE(x,i) ( ((unsigned char)(x)) >> i & 0x01 ) +#define CLRBIT(x,i) GETBYTE(x,i) &= ~( 0x01 << ( (i) % BITBYTE ) ) +#define SETBIT(x,i) GETBYTE(x,i) |= ( 0x01 << ( (i) % BITBYTE ) ) +#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 ) + +#define HASHVAL(val, siglen) (((unsigned int)(val)) % SIGLENBIT(siglen)) +#define HASH(sign, val, siglen) SETBIT((sign), HASHVAL(val, siglen)) + +/* + * type of index key for ltree. Tree are combined B-Tree and R-Tree + * Storage: + * Leaf pages + * (len)(flag)(ltree) + * Non-Leaf + * (len)(flag)(sign)(left_ltree)(right_ltree) + * ALLTRUE: (len)(flag)(left_ltree)(right_ltree) + * + */ + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 flag; + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltree_gist; + +#define LTG_ONENODE 0x01 +#define LTG_ALLTRUE 0x02 +#define LTG_NORIGHT 0x04 + +#define LTG_HDRSIZE MAXALIGN(VARHDRSZ + sizeof(uint32)) +#define LTG_SIGN(x) ( (BITVECP)( ((char*)(x))+LTG_HDRSIZE ) ) +#define LTG_NODE(x) ( (ltree*)( ((char*)(x))+LTG_HDRSIZE ) ) +#define LTG_ISONENODE(x) ( ((ltree_gist*)(x))->flag & LTG_ONENODE ) +#define LTG_ISALLTRUE(x) ( ((ltree_gist*)(x))->flag & LTG_ALLTRUE ) +#define LTG_ISNORIGHT(x) ( ((ltree_gist*)(x))->flag & LTG_NORIGHT ) +#define LTG_LNODE(x, siglen) ( (ltree*)( ( ((char*)(x))+LTG_HDRSIZE ) + ( LTG_ISALLTRUE(x) ? 0 : (siglen) ) ) ) +#define LTG_RENODE(x, siglen) ( (ltree*)( ((char*)LTG_LNODE(x, siglen)) + VARSIZE(LTG_LNODE(x, siglen))) ) +#define LTG_RNODE(x, siglen) ( LTG_ISNORIGHT(x) ? LTG_LNODE(x, siglen) : LTG_RENODE(x, siglen) ) + +#define LTG_GETLNODE(x, siglen) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_LNODE(x, siglen) ) +#define LTG_GETRNODE(x, siglen) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_RNODE(x, siglen) ) + +extern ltree_gist *ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen, + ltree *left, ltree *right); + +/* GiST support for ltree[] */ + +#define LTREE_ASIGLEN_DEFAULT (7 * sizeof(int32)) +#define LTREE_ASIGLEN_MAX GISTMaxIndexKeySize +#define LTREE_GET_ASIGLEN() (PG_HAS_OPCLASS_OPTIONS() ? \ + ((LtreeGistOptions *) PG_GET_OPCLASS_OPTIONS())->siglen : \ + LTREE_ASIGLEN_DEFAULT) +#define ASIGLENBIT(siglen) ((siglen) * BITBYTE) + +#define ALOOPBYTE(siglen) \ + for (i = 0; i < (siglen); i++) + +#define AHASHVAL(val, siglen) (((unsigned int)(val)) % ASIGLENBIT(siglen)) +#define AHASH(sign, val, siglen) SETBIT((sign), AHASHVAL(val, siglen)) + +/* gist_ltree_ops and gist__ltree_ops opclass options */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int siglen; /* signature length in bytes */ +} LtreeGistOptions; + +/* type of key is the same to ltree_gist */ + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/extension/seg/segdata.h b/platform/dbops/binaries/postgres/include/server/extension/seg/segdata.h new file mode 100644 index 0000000000000000000000000000000000000000..3d6e3e3f24506979f5c40f0933abc3e5c1808eb9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/seg/segdata.h @@ -0,0 +1,25 @@ +/* + * contrib/seg/segdata.h + */ +typedef struct SEG +{ + float4 lower; + float4 upper; + char l_sigd; + char u_sigd; + char l_ext; + char u_ext; +} SEG; + +/* in seg.c */ +extern int significant_digits(const char *s); + +/* in segscan.l */ +extern int seg_yylex(void); +extern void seg_yyerror(SEG *result, struct Node *escontext, + const char *message); +extern void seg_scanner_init(const char *str); +extern void seg_scanner_finish(void); + +/* in segparse.y */ +extern int seg_yyparse(SEG *result, struct Node *escontext); diff --git a/platform/dbops/binaries/postgres/include/server/extension/vector/halfvec.h b/platform/dbops/binaries/postgres/include/server/extension/vector/halfvec.h new file mode 100644 index 0000000000000000000000000000000000000000..a29f1b0e856b0dcd9adc2a5efd0e716c3019ea0a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/vector/halfvec.h @@ -0,0 +1,70 @@ +#ifndef HALFVEC_H +#define HALFVEC_H + +#define __STDC_WANT_IEC_60559_TYPES_EXT__ + +#include + +/* We use two types of dispatching: intrinsics and target_clones */ +/* TODO Move to better place */ +#ifndef DISABLE_DISPATCH +/* Only enable for more recent compilers to keep build process simple */ +#if defined(__x86_64__) && defined(__GNUC__) && __GNUC__ >= 9 +#define USE_DISPATCH +#elif defined(__x86_64__) && defined(__clang_major__) && __clang_major__ >= 7 +#define USE_DISPATCH +#elif defined(_M_AMD64) && defined(_MSC_VER) && _MSC_VER >= 1920 +#define USE_DISPATCH +#endif +#endif + +/* target_clones requires glibc */ +#if defined(USE_DISPATCH) && defined(__gnu_linux__) && defined(__has_attribute) +/* Use separate line for portability */ +#if __has_attribute(target_clones) +#define USE_TARGET_CLONES +#endif +#endif + +/* Apple clang check needed for universal binaries on Mac */ +#if defined(USE_DISPATCH) && (defined(HAVE__GET_CPUID) || defined(__apple_build_version__)) +#define USE__GET_CPUID +#endif + +#if defined(USE_DISPATCH) +#define HALFVEC_DISPATCH +#endif + +/* F16C has better performance than _Float16 (on x86-64) */ +#if defined(__F16C__) +#define F16C_SUPPORT +#elif defined(__FLT16_MAX__) && !defined(HALFVEC_DISPATCH) && !defined(__FreeBSD__) && (!defined(__i386__) || defined(__SSE2__)) +#define FLT16_SUPPORT +#endif + +#ifdef FLT16_SUPPORT +#define half _Float16 +#define HALF_MAX FLT16_MAX +#else +#define half uint16 +#define HALF_MAX 65504 +#endif + +#define HALFVEC_MAX_DIM 16000 + +#define HALFVEC_SIZE(_dim) (offsetof(HalfVector, x) + sizeof(half)*(_dim)) +#define DatumGetHalfVector(x) ((HalfVector *) PG_DETOAST_DATUM(x)) +#define PG_GETARG_HALFVEC_P(x) DatumGetHalfVector(PG_GETARG_DATUM(x)) +#define PG_RETURN_HALFVEC_P(x) PG_RETURN_POINTER(x) + +typedef struct HalfVector +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int16 dim; /* number of dimensions */ + int16 unused; /* reserved for future use, always zero */ + half x[FLEXIBLE_ARRAY_MEMBER]; +} HalfVector; + +HalfVector *InitHalfVector(int dim); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/extension/vector/sparsevec.h b/platform/dbops/binaries/postgres/include/server/extension/vector/sparsevec.h new file mode 100644 index 0000000000000000000000000000000000000000..e663c519af58a1c4430e9541e4fef7f767b23496 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/vector/sparsevec.h @@ -0,0 +1,40 @@ +#ifndef SPARSEVEC_H +#define SPARSEVEC_H + +#define SPARSEVEC_MAX_DIM 1000000000 +#define SPARSEVEC_MAX_NNZ 16000 + +#define DatumGetSparseVector(x) ((SparseVector *) PG_DETOAST_DATUM(x)) +#define PG_GETARG_SPARSEVEC_P(x) DatumGetSparseVector(PG_GETARG_DATUM(x)) +#define PG_RETURN_SPARSEVEC_P(x) PG_RETURN_POINTER(x) + +/* + * Indices use 0-based numbering for the on-disk (and binary) format (consistent with C) + * and are always sorted. Values come after indices. + */ +typedef struct SparseVector +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 dim; /* number of dimensions */ + int32 nnz; /* number of non-zero elements */ + int32 unused; /* reserved for future use, always zero */ + int32 indices[FLEXIBLE_ARRAY_MEMBER]; +} SparseVector; + +/* Use functions instead of macros to avoid double evaluation */ + +static inline Size +SPARSEVEC_SIZE(int nnz) +{ + return offsetof(SparseVector, indices) + (nnz * sizeof(int32)) + (nnz * sizeof(float)); +} + +static inline float * +SPARSEVEC_VALUES(SparseVector * x) +{ + return (float *) (((char *) x) + offsetof(SparseVector, indices) + (x->nnz * sizeof(int32))); +} + +SparseVector *InitSparseVector(int dim, int nnz); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/extension/vector/vector.h b/platform/dbops/binaries/postgres/include/server/extension/vector/vector.h new file mode 100644 index 0000000000000000000000000000000000000000..e29ccdc6a924a97ee1d78add3cde9d1fd8082b4b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/extension/vector/vector.h @@ -0,0 +1,30 @@ +#ifndef VECTOR_H +#define VECTOR_H + +#define VECTOR_MAX_DIM 16000 + +#define VECTOR_SIZE(_dim) (offsetof(Vector, x) + sizeof(float)*(_dim)) +#define DatumGetVector(x) ((Vector *) PG_DETOAST_DATUM(x)) +#define PG_GETARG_VECTOR_P(x) DatumGetVector(PG_GETARG_DATUM(x)) +#define PG_RETURN_VECTOR_P(x) PG_RETURN_POINTER(x) + +typedef struct Vector +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int16 dim; /* number of dimensions */ + int16 unused; /* reserved for future use, always zero */ + float x[FLEXIBLE_ARRAY_MEMBER]; +} Vector; + +Vector *InitVector(int dim); +void PrintVector(char *msg, Vector * vector); +int vector_cmp_internal(Vector * a, Vector * b); + +/* TODO Move to better place */ +#if PG_VERSION_NUM >= 160000 +#define FUNCTION_PREFIX +#else +#define FUNCTION_PREFIX PGDLLEXPORT +#endif + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/archive.h b/platform/dbops/binaries/postgres/include/server/fe_utils/archive.h new file mode 100644 index 0000000000000000000000000000000000000000..1df671978fadf2bb1c922c537c2693faa059d80e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/archive.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * archive.h + * Routines to access WAL archives from frontend + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/archive.h + * + *------------------------------------------------------------------------- + */ +#ifndef FE_ARCHIVE_H +#define FE_ARCHIVE_H + +extern int RestoreArchivedFile(const char *path, + const char *xlogfname, + off_t expectedSize, + const char *restoreCommand); + +#endif /* FE_ARCHIVE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/cancel.h b/platform/dbops/binaries/postgres/include/server/fe_utils/cancel.h new file mode 100644 index 0000000000000000000000000000000000000000..e934f6cdd4c0c81a40467f42205737b7043a8bc9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/cancel.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * Query cancellation support for frontend code + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/cancel.h + * + *------------------------------------------------------------------------- + */ + +#ifndef CANCEL_H +#define CANCEL_H + +#include + +#include "libpq-fe.h" + +extern PGDLLIMPORT volatile sig_atomic_t CancelRequested; + +extern void SetCancelConn(PGconn *conn); +extern void ResetCancelConn(void); + +/* + * A callback can be optionally set up to be called at cancellation + * time. + */ +extern void setup_cancel_handler(void (*query_cancel_callback) (void)); + +#endif /* CANCEL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/conditional.h b/platform/dbops/binaries/postgres/include/server/fe_utils/conditional.h new file mode 100644 index 0000000000000000000000000000000000000000..1da96ced2eefc8ce8f71744e78475882d5884e00 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/conditional.h @@ -0,0 +1,102 @@ +/*------------------------------------------------------------------------- + * A stack of automaton states to handle nested conditionals. + * + * This file describes a stack of automaton states which + * allow a manage nested conditionals. + * + * It is used by: + * - "psql" interpreter for handling \if ... \endif + * - "pgbench" interpreter for handling \if ... \endif + * - "pgbench" syntax checker to test for proper nesting + * + * The stack holds the state of enclosing conditionals (are we in + * a true branch? in a false branch? have we already encountered + * a true branch?) so that the interpreter knows whether to execute + * code and whether to evaluate conditions. + * + * Copyright (c) 2000-2024, PostgreSQL Global Development Group + * + * src/include/fe_utils/conditional.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONDITIONAL_H +#define CONDITIONAL_H + +/* + * Possible states of a single level of \if block. + */ +typedef enum ifState +{ + IFSTATE_NONE = 0, /* not currently in an \if block */ + IFSTATE_TRUE, /* currently in an \if or \elif that is true + * and all parent branches (if any) are true */ + IFSTATE_FALSE, /* currently in an \if or \elif that is false + * but no true branch has yet been seen, and + * all parent branches (if any) are true */ + IFSTATE_IGNORED, /* currently in an \elif that follows a true + * branch, or the whole \if is a child of a + * false parent branch */ + IFSTATE_ELSE_TRUE, /* currently in an \else that is true and all + * parent branches (if any) are true */ + IFSTATE_ELSE_FALSE, /* currently in an \else that is false or + * ignored */ +} ifState; + +/* + * The state of nested \ifs is stored in a stack. + * + * query_len is used to determine what accumulated text to throw away at the + * end of an inactive branch. (We could, perhaps, teach the lexer to not add + * stuff to the query buffer in the first place when inside an inactive branch; + * but that would be very invasive.) We also need to save and restore the + * lexer's parenthesis nesting depth when throwing away text. (We don't need + * to save and restore any of its other state, such as comment nesting depth, + * because a backslash command could never appear inside a comment or SQL + * literal.) + */ +typedef struct IfStackElem +{ + ifState if_state; /* current state, see enum above */ + int query_len; /* length of query_buf at last branch start */ + int paren_depth; /* parenthesis depth at last branch start */ + struct IfStackElem *next; /* next surrounding \if, if any */ +} IfStackElem; + +typedef struct ConditionalStackData +{ + IfStackElem *head; +} ConditionalStackData; + +typedef struct ConditionalStackData *ConditionalStack; + + +extern ConditionalStack conditional_stack_create(void); + +extern void conditional_stack_reset(ConditionalStack cstack); + +extern void conditional_stack_destroy(ConditionalStack cstack); + +extern int conditional_stack_depth(ConditionalStack cstack); + +extern void conditional_stack_push(ConditionalStack cstack, ifState new_state); + +extern bool conditional_stack_pop(ConditionalStack cstack); + +extern ifState conditional_stack_peek(ConditionalStack cstack); + +extern bool conditional_stack_poke(ConditionalStack cstack, ifState new_state); + +extern bool conditional_stack_empty(ConditionalStack cstack); + +extern bool conditional_active(ConditionalStack cstack); + +extern void conditional_stack_set_query_len(ConditionalStack cstack, int len); + +extern int conditional_stack_get_query_len(ConditionalStack cstack); + +extern void conditional_stack_set_paren_depth(ConditionalStack cstack, int depth); + +extern int conditional_stack_get_paren_depth(ConditionalStack cstack); + +#endif /* CONDITIONAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/connect_utils.h b/platform/dbops/binaries/postgres/include/server/fe_utils/connect_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..1267d7f8ce8c05e08fd6851180693aec9f74c572 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/connect_utils.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * Facilities for frontend code to connect to and disconnect from databases. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/connect_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONNECT_UTILS_H +#define CONNECT_UTILS_H + +#include "libpq-fe.h" + +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; + +/* Parameters needed by connectDatabase/connectMaintenanceDatabase */ +typedef struct _connParams +{ + /* These fields record the actual command line parameters */ + const char *dbname; /* this may be a connstring! */ + const char *pghost; + const char *pgport; + const char *pguser; + enum trivalue prompt_password; + /* If not NULL, this overrides the dbname obtained from command line */ + /* (but *only* the DB name, not anything else in the connstring) */ + const char *override_dbname; +} ConnParams; + +extern PGconn *connectDatabase(const ConnParams *cparams, + const char *progname, + bool echo, bool fail_ok, + bool allow_password_reuse); + +extern PGconn *connectMaintenanceDatabase(ConnParams *cparams, + const char *progname, bool echo); + +extern void disconnectDatabase(PGconn *conn); + +#endif /* CONNECT_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/mbprint.h b/platform/dbops/binaries/postgres/include/server/fe_utils/mbprint.h new file mode 100644 index 0000000000000000000000000000000000000000..d7f42f893d9f3f8c33c742815a4026aeef32b4f5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/mbprint.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * Multibyte character printing support for frontend code + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/mbprint.h + * + *------------------------------------------------------------------------- + */ +#ifndef MBPRINT_H +#define MBPRINT_H + +struct lineptr +{ + unsigned char *ptr; + int width; +}; + +extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding); +extern int pg_wcswidth(const char *pwcs, size_t len, int encoding); +extern void pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, + struct lineptr *lines, int count); +extern void pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, + int *result_width, int *result_height, + int *result_format_size); + +#endif /* MBPRINT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/option_utils.h b/platform/dbops/binaries/postgres/include/server/fe_utils/option_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..afd108fdabfa4ab3a922dd709f34a930f2c9098c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/option_utils.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * Command line option processing facilities for frontend code + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/option_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef OPTION_UTILS_H +#define OPTION_UTILS_H + +#include "postgres_fe.h" + +#include "common/file_utils.h" + +typedef void (*help_handler) (const char *progname); + +extern void handle_help_version_opts(int argc, char *argv[], + const char *fixed_progname, + help_handler hlp); +extern bool option_parse_int(const char *optarg, const char *optname, + int min_range, int max_range, + int *result); +extern bool parse_sync_method(const char *optarg, + DataDirSyncMethod *sync_method); + +#endif /* OPTION_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/parallel_slot.h b/platform/dbops/binaries/postgres/include/server/fe_utils/parallel_slot.h new file mode 100644 index 0000000000000000000000000000000000000000..4d79030aa6caf7078be0b6071c409fa0a77001e2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/parallel_slot.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * parallel_slot.h + * Parallel support for bin/scripts/ + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/fe_utils/parallel_slot.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARALLEL_SLOT_H +#define PARALLEL_SLOT_H + +#include "fe_utils/connect_utils.h" +#include "libpq-fe.h" + +typedef bool (*ParallelSlotResultHandler) (PGresult *res, PGconn *conn, + void *context); + +typedef struct ParallelSlot +{ + PGconn *connection; /* One connection */ + bool inUse; /* Is the slot being used? */ + + /* + * Prior to issuing a command or query on 'connection', a handler callback + * function may optionally be registered to be invoked to process the + * results, and context information may optionally be registered for use + * by the handler. If unset, these fields should be NULL. + */ + ParallelSlotResultHandler handler; + void *handler_context; +} ParallelSlot; + +typedef struct ParallelSlotArray +{ + int numslots; + ConnParams *cparams; + const char *progname; + bool echo; + const char *initcmd; + ParallelSlot slots[FLEXIBLE_ARRAY_MEMBER]; +} ParallelSlotArray; + +static inline void +ParallelSlotSetHandler(ParallelSlot *slot, ParallelSlotResultHandler handler, + void *context) +{ + slot->handler = handler; + slot->handler_context = context; +} + +static inline void +ParallelSlotClearHandler(ParallelSlot *slot) +{ + slot->handler = NULL; + slot->handler_context = NULL; +} + +extern ParallelSlot *ParallelSlotsGetIdle(ParallelSlotArray *sa, + const char *dbname); + +extern ParallelSlotArray *ParallelSlotsSetup(int numslots, ConnParams *cparams, + const char *progname, bool echo, + const char *initcmd); + +extern void ParallelSlotsAdoptConn(ParallelSlotArray *sa, PGconn *conn); + +extern void ParallelSlotsTerminate(ParallelSlotArray *sa); + +extern bool ParallelSlotsWaitCompletion(ParallelSlotArray *sa); + +extern bool TableCommandResultHandler(PGresult *res, PGconn *conn, + void *context); + +#endif /* PARALLEL_SLOT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/print.h b/platform/dbops/binaries/postgres/include/server/fe_utils/print.h new file mode 100644 index 0000000000000000000000000000000000000000..72824c5c2fa7c8ccfecd6826ee906bf74117a41d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/print.h @@ -0,0 +1,236 @@ +/*------------------------------------------------------------------------- + * + * Query-result printing support for frontend code + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/print.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINT_H +#define PRINT_H + +#include + +#include "libpq-fe.h" + + +/* This is not a particularly great place for this ... */ +#ifndef __CYGWIN__ +#define DEFAULT_PAGER "more" +#else +#define DEFAULT_PAGER "less" +#endif + +enum printFormat +{ + PRINT_NOTHING = 0, /* to make sure someone initializes this */ + PRINT_ALIGNED, + PRINT_ASCIIDOC, + PRINT_CSV, + PRINT_HTML, + PRINT_LATEX, + PRINT_LATEX_LONGTABLE, + PRINT_TROFF_MS, + PRINT_UNALIGNED, + PRINT_WRAPPED, + /* add your favourite output format here ... */ +}; + +typedef struct printTextLineFormat +{ + /* Line drawing characters to be used in various contexts */ + const char *hrule; /* horizontal line character */ + const char *leftvrule; /* left vertical line (+horizontal) */ + const char *midvrule; /* intra-column vertical line (+horizontal) */ + const char *rightvrule; /* right vertical line (+horizontal) */ +} printTextLineFormat; + +typedef enum printTextRule +{ + /* Additional context for selecting line drawing characters */ + PRINT_RULE_TOP, /* top horizontal line */ + PRINT_RULE_MIDDLE, /* intra-data horizontal line */ + PRINT_RULE_BOTTOM, /* bottom horizontal line */ + PRINT_RULE_DATA, /* data line (hrule is unused here) */ +} printTextRule; + +typedef enum printTextLineWrap +{ + /* Line wrapping conditions */ + PRINT_LINE_WRAP_NONE, /* No wrapping */ + PRINT_LINE_WRAP_WRAP, /* Wraparound due to overlength line */ + PRINT_LINE_WRAP_NEWLINE, /* Newline in data */ +} printTextLineWrap; + +typedef enum printXheaderWidthType +{ + /* Expanded header line width variants */ + PRINT_XHEADER_FULL, /* do not truncate header line (this is the + * default) */ + PRINT_XHEADER_COLUMN, /* only print header line above the first + * column */ + PRINT_XHEADER_PAGE, /* header line must not be longer than + * terminal width */ + PRINT_XHEADER_EXACT_WIDTH, /* explicitly specified width */ +} printXheaderWidthType; + +typedef struct printTextFormat +{ + /* A complete line style */ + const char *name; /* for display purposes */ + printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ + const char *midvrule_nl; /* vertical line for continue after newline */ + const char *midvrule_wrap; /* vertical line for wrapped data */ + const char *midvrule_blank; /* vertical line for blank data */ + const char *header_nl_left; /* left mark after newline */ + const char *header_nl_right; /* right mark for newline */ + const char *nl_left; /* left mark after newline */ + const char *nl_right; /* right mark for newline */ + const char *wrap_left; /* left mark after wrapped data */ + const char *wrap_right; /* right mark for wrapped data */ + bool wrap_right_border; /* use right-hand border for wrap marks + * when border=0? */ +} printTextFormat; + +typedef enum unicode_linestyle +{ + UNICODE_LINESTYLE_SINGLE = 0, + UNICODE_LINESTYLE_DOUBLE, +} unicode_linestyle; + +struct separator +{ + char *separator; + bool separator_zero; +}; + +typedef struct printTableOpt +{ + enum printFormat format; /* see enum above */ + unsigned short int expanded; /* expanded/vertical output (if supported + * by output format); 0=no, 1=yes, 2=auto */ + printXheaderWidthType expanded_header_width_type; /* width type for header + * line in expanded mode */ + int expanded_header_exact_width; /* explicit width for header + * line in expanded mode */ + unsigned short int border; /* Print a border around the table. 0=none, + * 1=dividing lines, 2=full */ + unsigned short int pager; /* use pager for output (if to stdout and + * stdout is a tty) 0=off 1=on 2=always */ + int pager_min_lines; /* don't use pager unless there are at + * least this many lines */ + bool tuples_only; /* don't output headers, row counts, etc. */ + bool start_table; /* print start decoration, eg */ + bool stop_table; /* print stop decoration, eg
*/ + bool default_footer; /* allow "(xx rows)" default footer */ + unsigned long prior_records; /* start offset for record counters */ + const printTextFormat *line_style; /* line style (NULL for default) */ + struct separator fieldSep; /* field separator for unaligned text mode */ + struct separator recordSep; /* record separator for unaligned text mode */ + char csvFieldSep[2]; /* field separator for csv format */ + bool numericLocale; /* locale-aware numeric units separator and + * decimal marker */ + char *tableAttr; /* attributes for HTML */ + int encoding; /* character encoding */ + int env_columns; /* $COLUMNS on psql start, 0 is unset */ + int columns; /* target width for wrapped format */ + unicode_linestyle unicode_border_linestyle; + unicode_linestyle unicode_column_linestyle; + unicode_linestyle unicode_header_linestyle; +} printTableOpt; + +/* + * Table footers are implemented as a singly-linked list. + * + * This is so that you don't need to know the number of footers in order to + * initialise the printTableContent struct, which is very convenient when + * preparing complex footers (as in describeOneTableDetails). + */ +typedef struct printTableFooter +{ + char *data; + struct printTableFooter *next; +} printTableFooter; + +/* + * The table content struct holds all the information which will be displayed + * by printTable(). + */ +typedef struct printTableContent +{ + const printTableOpt *opt; + const char *title; /* May be NULL */ + int ncolumns; /* Specified in Init() */ + int nrows; /* Specified in Init() */ + const char **headers; /* NULL-terminated array of header strings */ + const char **header; /* Pointer to the last added header */ + const char **cells; /* NULL-terminated array of cell content + * strings */ + const char **cell; /* Pointer to the last added cell */ + uint64 cellsadded; /* Number of cells added this far */ + bool *cellmustfree; /* true for cells that need to be free()d */ + printTableFooter *footers; /* Pointer to the first footer */ + printTableFooter *footer; /* Pointer to the last added footer */ + char *aligns; /* Array of alignment specifiers; 'l' or 'r', + * one per column */ + char *align; /* Pointer to the last added alignment */ +} printTableContent; + +typedef struct printQueryOpt +{ + printTableOpt topt; /* the options above */ + char *nullPrint; /* how to print null entities */ + char *title; /* override title */ + char **footers; /* override footer (default is "(xx rows)") */ + bool translate_header; /* do gettext on column headers */ + const bool *translate_columns; /* translate_columns[i-1] => do gettext on + * col i */ + int n_translate_columns; /* length of translate_columns[] */ +} printQueryOpt; + + +extern PGDLLIMPORT volatile sig_atomic_t cancel_pressed; + +extern PGDLLIMPORT const printTextFormat pg_asciiformat; +extern PGDLLIMPORT const printTextFormat pg_asciiformat_old; +extern PGDLLIMPORT printTextFormat pg_utf8format; /* ideally would be const, + * but... */ + + +extern void disable_sigpipe_trap(void); +extern void restore_sigpipe_trap(void); +extern void set_sigpipe_trap_state(bool ignore); + +extern FILE *PageOutput(int lines, const printTableOpt *topt); +extern void ClosePager(FILE *pagerpipe); + +extern void html_escaped_print(const char *in, FILE *fout); + +extern void printTableInit(printTableContent *const content, + const printTableOpt *opt, const char *title, + const int ncolumns, const int nrows); +extern void printTableAddHeader(printTableContent *const content, + char *header, const bool translate, const char align); +extern void printTableAddCell(printTableContent *const content, + char *cell, const bool translate, const bool mustfree); +extern void printTableAddFooter(printTableContent *const content, + const char *footer); +extern void printTableSetFooter(printTableContent *const content, + const char *footer); +extern void printTableCleanup(printTableContent *const content); +extern void printTable(const printTableContent *cont, + FILE *fout, bool is_pager, FILE *flog); +extern void printQuery(const PGresult *result, const printQueryOpt *opt, + FILE *fout, bool is_pager, FILE *flog); + +extern char column_type_alignment(Oid); + +extern void setDecimalLocale(void); +extern const printTextFormat *get_line_style(const printTableOpt *opt); +extern void refresh_utf8format(const printTableOpt *opt); + +#endif /* PRINT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan.h b/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan.h new file mode 100644 index 0000000000000000000000000000000000000000..ea489efbec26f89c7e5b05507a3f27f235685d97 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * psqlscan.h + * lexical scanner for SQL commands + * + * This lexer used to be part of psql, and that heritage is reflected in + * the file name as well as function and typedef names, though it can now + * be used by other frontend programs as well. It's also possible to extend + * this lexer with a compatible add-on lexer to handle program-specific + * backslash commands. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/psqlscan.h + * + *------------------------------------------------------------------------- + */ +#ifndef PSQLSCAN_H +#define PSQLSCAN_H + +#include "pqexpbuffer.h" + + +/* Abstract type for lexer's internal state */ +typedef struct PsqlScanStateData *PsqlScanState; + +/* Termination states for psql_scan() */ +typedef enum +{ + PSCAN_SEMICOLON, /* found command-ending semicolon */ + PSCAN_BACKSLASH, /* found backslash command */ + PSCAN_INCOMPLETE, /* end of line, SQL statement incomplete */ + PSCAN_EOL, /* end of line, SQL possibly complete */ +} PsqlScanResult; + +/* Prompt type returned by psql_scan() */ +typedef enum _promptStatus +{ + PROMPT_READY, + PROMPT_CONTINUE, + PROMPT_COMMENT, + PROMPT_SINGLEQUOTE, + PROMPT_DOUBLEQUOTE, + PROMPT_DOLLARQUOTE, + PROMPT_PAREN, + PROMPT_COPY, +} promptStatus_t; + +/* Quoting request types for get_variable() callback */ +typedef enum +{ + PQUOTE_PLAIN, /* just return the actual value */ + PQUOTE_SQL_LITERAL, /* add quotes to make a valid SQL literal */ + PQUOTE_SQL_IDENT, /* quote if needed to make a SQL identifier */ + PQUOTE_SHELL_ARG, /* quote if needed to be safe in a shell cmd */ +} PsqlScanQuoteType; + +/* Callback functions to be used by the lexer */ +typedef struct PsqlScanCallbacks +{ + /* Fetch value of a variable, as a free'able string; NULL if unknown */ + /* This pointer can be NULL if no variable substitution is wanted */ + char *(*get_variable) (const char *varname, PsqlScanQuoteType quote, + void *passthrough); +} PsqlScanCallbacks; + + +extern PsqlScanState psql_scan_create(const PsqlScanCallbacks *callbacks); +extern void psql_scan_destroy(PsqlScanState state); + +extern void psql_scan_set_passthrough(PsqlScanState state, void *passthrough); + +extern void psql_scan_setup(PsqlScanState state, + const char *line, int line_len, + int encoding, bool std_strings); +extern void psql_scan_finish(PsqlScanState state); + +extern PsqlScanResult psql_scan(PsqlScanState state, + PQExpBuffer query_buf, + promptStatus_t *prompt); + +extern void psql_scan_reset(PsqlScanState state); + +extern void psql_scan_reselect_sql_lexer(PsqlScanState state); + +extern bool psql_scan_in_quote(PsqlScanState state); + +#endif /* PSQLSCAN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan_int.h b/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan_int.h new file mode 100644 index 0000000000000000000000000000000000000000..be3524e37e31d49415367782419c9c2373eccf16 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/psqlscan_int.h @@ -0,0 +1,157 @@ +/*------------------------------------------------------------------------- + * + * psqlscan_int.h + * lexical scanner internal declarations + * + * This file declares the PsqlScanStateData structure used by psqlscan.l + * and shared by other lexers compatible with it, such as psqlscanslash.l. + * + * One difficult aspect of this code is that we need to work in multibyte + * encodings that are not ASCII-safe. A "safe" encoding is one in which each + * byte of a multibyte character has the high bit set (it's >= 0x80). Since + * all our lexing rules treat all high-bit-set characters alike, we don't + * really need to care whether such a byte is part of a sequence or not. + * In an "unsafe" encoding, we still expect the first byte of a multibyte + * sequence to be >= 0x80, but later bytes might not be. If we scan such + * a sequence as-is, the lexing rules could easily be fooled into matching + * such bytes to ordinary ASCII characters. Our solution for this is to + * substitute 0xFF for each non-first byte within the data presented to flex. + * The flex rules will then pass the FF's through unmolested. The + * psqlscan_emit() subroutine is responsible for looking back to the original + * string and replacing FF's with the corresponding original bytes. + * + * Another interesting thing we do here is scan different parts of the same + * input with physically separate flex lexers (ie, lexers written in separate + * .l files). We can get away with this because the only part of the + * persistent state of a flex lexer that depends on its parsing rule tables + * is the start state number, which is easy enough to manage --- usually, + * in fact, we just need to set it to INITIAL when changing lexers. But to + * make that work at all, we must use re-entrant lexers, so that all the + * relevant state is in the yyscan_t attached to the PsqlScanState; + * if we were using lexers with separate static state we would soon end up + * with dangling buffer pointers in one or the other. Also note that this + * is unlikely to work very nicely if the lexers aren't all built with the + * same flex version, or if they don't use the same flex options. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/psqlscan_int.h + * + *------------------------------------------------------------------------- + */ +#ifndef PSQLSCAN_INT_H +#define PSQLSCAN_INT_H + +#include "fe_utils/psqlscan.h" + +/* + * These are just to allow this file to be compilable standalone for header + * validity checking; in actual use, this file should always be included + * from the body of a flex file, where these symbols are already defined. + */ +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif + +/* + * We use a stack of flex buffers to handle substitution of psql variables. + * Each stacked buffer contains the as-yet-unread text from one psql variable. + * When we pop the stack all the way, we resume reading from the outer buffer + * identified by scanbufhandle. + */ +typedef struct StackElem +{ + YY_BUFFER_STATE buf; /* flex input control structure */ + char *bufstring; /* data actually being scanned by flex */ + char *origstring; /* copy of original data, if needed */ + char *varname; /* name of variable providing data, or NULL */ + struct StackElem *next; +} StackElem; + +/* + * All working state of the lexer must be stored in PsqlScanStateData + * between calls. This allows us to have multiple open lexer operations, + * which is needed for nested include files. The lexer itself is not + * recursive, but it must be re-entrant. + */ +typedef struct PsqlScanStateData +{ + yyscan_t scanner; /* Flex's state for this PsqlScanState */ + + PQExpBuffer output_buf; /* current output buffer */ + + StackElem *buffer_stack; /* stack of variable expansion buffers */ + + /* + * These variables always refer to the outer buffer, never to any stacked + * variable-expansion buffer. + */ + YY_BUFFER_STATE scanbufhandle; + char *scanbuf; /* start of outer-level input buffer */ + const char *scanline; /* current input line at outer level */ + + /* safe_encoding, curline, refline are used by emit() to replace FFs */ + int encoding; /* encoding being used now */ + bool safe_encoding; /* is current encoding "safe"? */ + bool std_strings; /* are string literals standard? */ + const char *curline; /* actual flex input string for cur buf */ + const char *refline; /* original data for cur buffer */ + + /* + * All this state lives across successive input lines, until explicitly + * reset by psql_scan_reset. start_state is adopted by yylex() on entry, + * and updated with its finishing state on exit. + */ + int start_state; /* yylex's starting/finishing state */ + int state_before_str_stop; /* start cond. before end quote */ + int paren_depth; /* depth of nesting in parentheses */ + int xcdepth; /* depth of nesting in slash-star comments */ + char *dolqstart; /* current $foo$ quote start string */ + + /* + * State to track boundaries of BEGIN ... END blocks in function + * definitions, so that semicolons do not send query too early. + */ + int identifier_count; /* identifiers since start of statement */ + char identifiers[4]; /* records the first few identifiers */ + int begin_depth; /* depth of begin/end pairs */ + + /* + * Callback functions provided by the program making use of the lexer, + * plus a void* callback passthrough argument. + */ + const PsqlScanCallbacks *callbacks; + void *cb_passthrough; +} PsqlScanStateData; + + +/* + * Functions exported by psqlscan.l, but only meant for use within + * compatible lexers. + */ +extern void psqlscan_push_new_buffer(PsqlScanState state, + const char *newstr, const char *varname); +extern void psqlscan_pop_buffer_stack(PsqlScanState state); +extern void psqlscan_select_top_buffer(PsqlScanState state); +extern bool psqlscan_var_is_current_source(PsqlScanState state, + const char *varname); +extern YY_BUFFER_STATE psqlscan_prepare_buffer(PsqlScanState state, + const char *txt, int len, + char **txtcopy); +extern void psqlscan_emit(PsqlScanState state, const char *txt, int len); +extern char *psqlscan_extract_substring(PsqlScanState state, + const char *txt, int len); +extern void psqlscan_escape_variable(PsqlScanState state, + const char *txt, int len, + PsqlScanQuoteType quote); +extern void psqlscan_test_variable(PsqlScanState state, + const char *txt, int len); + +#endif /* PSQLSCAN_INT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/query_utils.h b/platform/dbops/binaries/postgres/include/server/fe_utils/query_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..9a680d5bffe12c82e1b8e625d02db0e6cc08d50f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/query_utils.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * Facilities for frontend code to query a databases. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/query_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERY_UTILS_H +#define QUERY_UTILS_H + +#include "postgres_fe.h" + +#include "libpq-fe.h" + +extern PGresult *executeQuery(PGconn *conn, const char *query, bool echo); + +extern void executeCommand(PGconn *conn, const char *query, bool echo); + +extern bool executeMaintenanceCommand(PGconn *conn, const char *query, + bool echo); + +#endif /* QUERY_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/recovery_gen.h b/platform/dbops/binaries/postgres/include/server/fe_utils/recovery_gen.h new file mode 100644 index 0000000000000000000000000000000000000000..73c1aa8e59e1aad175a26498387013a2c5595bfc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/recovery_gen.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * Generator for recovery configuration + * + * Portions Copyright (c) 2011-2024, PostgreSQL Global Development Group + * + * src/include/fe_utils/recovery_gen.h + * + *------------------------------------------------------------------------- + */ +#ifndef RECOVERY_GEN_H +#define RECOVERY_GEN_H + +#include "libpq-fe.h" +#include "pqexpbuffer.h" + +/* + * recovery configuration is part of postgresql.conf in version 12 and up, and + * in recovery.conf before that. + */ +#define MINIMUM_VERSION_FOR_RECOVERY_GUC 120000 + +extern PQExpBuffer GenerateRecoveryConfig(PGconn *pgconn, + const char *replication_slot, + char *dbname); +extern void WriteRecoveryConfig(PGconn *pgconn, const char *target_dir, + PQExpBuffer contents); + +#endif /* RECOVERY_GEN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/simple_list.h b/platform/dbops/binaries/postgres/include/server/fe_utils/simple_list.h new file mode 100644 index 0000000000000000000000000000000000000000..d42ecded8ed5d63b21f47bd6bbf220e3901a34b7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/simple_list.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------------------- + * + * Simple list facilities for frontend code + * + * Data structures for simple lists of OIDs, strings, and pointers. The + * support for these is very primitive compared to the backend's List + * facilities, but it's all we need in, eg, pg_dump. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/simple_list.h + * + *------------------------------------------------------------------------- + */ +#ifndef SIMPLE_LIST_H +#define SIMPLE_LIST_H + +typedef struct SimpleOidListCell +{ + struct SimpleOidListCell *next; + Oid val; +} SimpleOidListCell; + +typedef struct SimpleOidList +{ + SimpleOidListCell *head; + SimpleOidListCell *tail; +} SimpleOidList; + +typedef struct SimpleStringListCell +{ + struct SimpleStringListCell *next; + bool touched; /* true, when this string was searched and + * touched */ + char val[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string here */ +} SimpleStringListCell; + +typedef struct SimpleStringList +{ + SimpleStringListCell *head; + SimpleStringListCell *tail; +} SimpleStringList; + +typedef struct SimplePtrListCell +{ + struct SimplePtrListCell *next; + void *ptr; +} SimplePtrListCell; + +typedef struct SimplePtrList +{ + SimplePtrListCell *head; + SimplePtrListCell *tail; +} SimplePtrList; + +extern void simple_oid_list_append(SimpleOidList *list, Oid val); +extern bool simple_oid_list_member(SimpleOidList *list, Oid val); +extern void simple_oid_list_destroy(SimpleOidList *list); + +extern void simple_string_list_append(SimpleStringList *list, const char *val); +extern bool simple_string_list_member(SimpleStringList *list, const char *val); +extern void simple_string_list_destroy(SimpleStringList *list); + +extern const char *simple_string_list_not_touched(SimpleStringList *list); + +extern void simple_ptr_list_append(SimplePtrList *list, void *ptr); + +#endif /* SIMPLE_LIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/fe_utils/string_utils.h b/platform/dbops/binaries/postgres/include/server/fe_utils/string_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..500f585a4a5858e426bceb9cbf795299e2259279 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/fe_utils/string_utils.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * String-processing utility routines for frontend code + * + * Utility functions that interpret backend output or quote strings for + * assorted contexts. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/fe_utils/string_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRING_UTILS_H +#define STRING_UTILS_H + +#include "libpq-fe.h" +#include "pqexpbuffer.h" + +/* Global variables controlling behavior of fmtId() and fmtQualifiedId() */ +extern PGDLLIMPORT int quote_all_identifiers; +extern PQExpBuffer (*getLocalPQExpBuffer) (void); + +/* Functions */ +extern const char *fmtId(const char *rawid); +extern const char *fmtIdEnc(const char *rawid, int encoding); +extern const char *fmtQualifiedId(const char *schema, const char *id); +extern const char *fmtQualifiedIdEnc(const char *schema, const char *id, int encoding); +extern void setFmtEncoding(int encoding); + +extern char *formatPGVersionNumber(int version_number, bool include_minor, + char *buf, size_t buflen); + +extern void appendStringLiteral(PQExpBuffer buf, const char *str, + int encoding, bool std_strings); +extern void appendStringLiteralConn(PQExpBuffer buf, const char *str, + PGconn *conn); +extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str, + const char *dqprefix); +extern void appendByteaLiteral(PQExpBuffer buf, + const unsigned char *str, size_t length, + bool std_strings); + +extern void appendShellString(PQExpBuffer buf, const char *str); +extern bool appendShellStringNoError(PQExpBuffer buf, const char *str); +extern void appendConnStrVal(PQExpBuffer buf, const char *str); +extern void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname); + +extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems); +extern void appendPGArray(PQExpBuffer buffer, const char *value); + +extern bool appendReloptionsArray(PQExpBuffer buffer, const char *reloptions, + const char *prefix, int encoding, bool std_strings); + +extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf, + const char *pattern, + bool have_where, bool force_escape, + const char *schemavar, const char *namevar, + const char *altnamevar, const char *visibilityrule, + PQExpBuffer dbnamebuf, int *dotcnt); + +extern void patternToSQLRegex(int encoding, PQExpBuffer dbnamebuf, + PQExpBuffer schemabuf, PQExpBuffer namebuf, + const char *pattern, bool force_escape, + bool want_literal_dbname, int *dotcnt); + +#endif /* STRING_UTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/foreign/fdwapi.h b/platform/dbops/binaries/postgres/include/server/foreign/fdwapi.h new file mode 100644 index 0000000000000000000000000000000000000000..fcde3876b288ed97f179c7a5cddb221076cb0e9b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/foreign/fdwapi.h @@ -0,0 +1,294 @@ +/*------------------------------------------------------------------------- + * + * fdwapi.h + * API for foreign-data wrappers + * + * Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * src/include/foreign/fdwapi.h + * + *------------------------------------------------------------------------- + */ +#ifndef FDWAPI_H +#define FDWAPI_H + +#include "access/parallel.h" +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" + +/* To avoid including explain.h here, reference ExplainState thus: */ +struct ExplainState; + + +/* + * Callback function signatures --- see fdwhandler.sgml for more info. + */ + +typedef void (*GetForeignRelSize_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid); + +typedef void (*GetForeignPaths_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid); + +typedef ForeignScan *(*GetForeignPlan_function) (PlannerInfo *root, + RelOptInfo *baserel, + Oid foreigntableid, + ForeignPath *best_path, + List *tlist, + List *scan_clauses, + Plan *outer_plan); + +typedef void (*BeginForeignScan_function) (ForeignScanState *node, + int eflags); + +typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState *node); + +typedef bool (*RecheckForeignScan_function) (ForeignScanState *node, + TupleTableSlot *slot); + +typedef void (*ReScanForeignScan_function) (ForeignScanState *node); + +typedef void (*EndForeignScan_function) (ForeignScanState *node); + +typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); + +typedef void (*GetForeignUpperPaths_function) (PlannerInfo *root, + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel, + void *extra); + +typedef void (*AddForeignUpdateTargets_function) (PlannerInfo *root, + Index rtindex, + RangeTblEntry *target_rte, + Relation target_relation); + +typedef List *(*PlanForeignModify_function) (PlannerInfo *root, + ModifyTable *plan, + Index resultRelation, + int subplan_index); + +typedef void (*BeginForeignModify_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + int eflags); + +typedef TupleTableSlot *(*ExecForeignInsert_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef TupleTableSlot **(*ExecForeignBatchInsert_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot **slots, + TupleTableSlot **planSlots, + int *numSlots); + +typedef int (*GetForeignModifyBatchSize_function) (ResultRelInfo *rinfo); + +typedef TupleTableSlot *(*ExecForeignUpdate_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef TupleTableSlot *(*ExecForeignDelete_function) (EState *estate, + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); + +typedef void (*EndForeignModify_function) (EState *estate, + ResultRelInfo *rinfo); + +typedef void (*BeginForeignInsert_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo); + +typedef void (*EndForeignInsert_function) (EState *estate, + ResultRelInfo *rinfo); + +typedef int (*IsForeignRelUpdatable_function) (Relation rel); + +typedef bool (*PlanDirectModify_function) (PlannerInfo *root, + ModifyTable *plan, + Index resultRelation, + int subplan_index); + +typedef void (*BeginDirectModify_function) (ForeignScanState *node, + int eflags); + +typedef TupleTableSlot *(*IterateDirectModify_function) (ForeignScanState *node); + +typedef void (*EndDirectModify_function) (ForeignScanState *node); + +typedef RowMarkType (*GetForeignRowMarkType_function) (RangeTblEntry *rte, + LockClauseStrength strength); + +typedef void (*RefetchForeignRow_function) (EState *estate, + ExecRowMark *erm, + Datum rowid, + TupleTableSlot *slot, + bool *updated); + +typedef void (*ExplainForeignScan_function) (ForeignScanState *node, + struct ExplainState *es); + +typedef void (*ExplainForeignModify_function) (ModifyTableState *mtstate, + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + struct ExplainState *es); + +typedef void (*ExplainDirectModify_function) (ForeignScanState *node, + struct ExplainState *es); + +typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel, + HeapTuple *rows, int targrows, + double *totalrows, + double *totaldeadrows); + +typedef bool (*AnalyzeForeignTable_function) (Relation relation, + AcquireSampleRowsFunc *func, + BlockNumber *totalpages); + +typedef List *(*ImportForeignSchema_function) (ImportForeignSchemaStmt *stmt, + Oid serverOid); + +typedef void (*ExecForeignTruncate_function) (List *rels, + DropBehavior behavior, + bool restart_seqs); + +typedef Size (*EstimateDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt); +typedef void (*InitializeDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt, + void *coordinate); +typedef void (*ReInitializeDSMForeignScan_function) (ForeignScanState *node, + ParallelContext *pcxt, + void *coordinate); +typedef void (*InitializeWorkerForeignScan_function) (ForeignScanState *node, + shm_toc *toc, + void *coordinate); +typedef void (*ShutdownForeignScan_function) (ForeignScanState *node); +typedef bool (*IsForeignScanParallelSafe_function) (PlannerInfo *root, + RelOptInfo *rel, + RangeTblEntry *rte); +typedef List *(*ReparameterizeForeignPathByChild_function) (PlannerInfo *root, + List *fdw_private, + RelOptInfo *child_rel); + +typedef bool (*IsForeignPathAsyncCapable_function) (ForeignPath *path); + +typedef void (*ForeignAsyncRequest_function) (AsyncRequest *areq); + +typedef void (*ForeignAsyncConfigureWait_function) (AsyncRequest *areq); + +typedef void (*ForeignAsyncNotify_function) (AsyncRequest *areq); + +/* + * FdwRoutine is the struct returned by a foreign-data wrapper's handler + * function. It provides pointers to the callback functions needed by the + * planner and executor. + * + * More function pointers are likely to be added in the future. Therefore + * it's recommended that the handler initialize the struct with + * makeNode(FdwRoutine) so that all fields are set to NULL. This will + * ensure that no fields are accidentally left undefined. + */ +typedef struct FdwRoutine +{ + NodeTag type; + + /* Functions for scanning foreign tables */ + GetForeignRelSize_function GetForeignRelSize; + GetForeignPaths_function GetForeignPaths; + GetForeignPlan_function GetForeignPlan; + BeginForeignScan_function BeginForeignScan; + IterateForeignScan_function IterateForeignScan; + ReScanForeignScan_function ReScanForeignScan; + EndForeignScan_function EndForeignScan; + + /* + * Remaining functions are optional. Set the pointer to NULL for any that + * are not provided. + */ + + /* Functions for remote-join planning */ + GetForeignJoinPaths_function GetForeignJoinPaths; + + /* Functions for remote upper-relation (post scan/join) planning */ + GetForeignUpperPaths_function GetForeignUpperPaths; + + /* Functions for updating foreign tables */ + AddForeignUpdateTargets_function AddForeignUpdateTargets; + PlanForeignModify_function PlanForeignModify; + BeginForeignModify_function BeginForeignModify; + ExecForeignInsert_function ExecForeignInsert; + ExecForeignBatchInsert_function ExecForeignBatchInsert; + GetForeignModifyBatchSize_function GetForeignModifyBatchSize; + ExecForeignUpdate_function ExecForeignUpdate; + ExecForeignDelete_function ExecForeignDelete; + EndForeignModify_function EndForeignModify; + BeginForeignInsert_function BeginForeignInsert; + EndForeignInsert_function EndForeignInsert; + IsForeignRelUpdatable_function IsForeignRelUpdatable; + PlanDirectModify_function PlanDirectModify; + BeginDirectModify_function BeginDirectModify; + IterateDirectModify_function IterateDirectModify; + EndDirectModify_function EndDirectModify; + + /* Functions for SELECT FOR UPDATE/SHARE row locking */ + GetForeignRowMarkType_function GetForeignRowMarkType; + RefetchForeignRow_function RefetchForeignRow; + RecheckForeignScan_function RecheckForeignScan; + + /* Support functions for EXPLAIN */ + ExplainForeignScan_function ExplainForeignScan; + ExplainForeignModify_function ExplainForeignModify; + ExplainDirectModify_function ExplainDirectModify; + + /* Support functions for ANALYZE */ + AnalyzeForeignTable_function AnalyzeForeignTable; + + /* Support functions for IMPORT FOREIGN SCHEMA */ + ImportForeignSchema_function ImportForeignSchema; + + /* Support functions for TRUNCATE */ + ExecForeignTruncate_function ExecForeignTruncate; + + /* Support functions for parallelism under Gather node */ + IsForeignScanParallelSafe_function IsForeignScanParallelSafe; + EstimateDSMForeignScan_function EstimateDSMForeignScan; + InitializeDSMForeignScan_function InitializeDSMForeignScan; + ReInitializeDSMForeignScan_function ReInitializeDSMForeignScan; + InitializeWorkerForeignScan_function InitializeWorkerForeignScan; + ShutdownForeignScan_function ShutdownForeignScan; + + /* Support functions for path reparameterization. */ + ReparameterizeForeignPathByChild_function ReparameterizeForeignPathByChild; + + /* Support functions for asynchronous execution */ + IsForeignPathAsyncCapable_function IsForeignPathAsyncCapable; + ForeignAsyncRequest_function ForeignAsyncRequest; + ForeignAsyncConfigureWait_function ForeignAsyncConfigureWait; + ForeignAsyncNotify_function ForeignAsyncNotify; +} FdwRoutine; + + +/* Functions in foreign/foreign.c */ +extern FdwRoutine *GetFdwRoutine(Oid fdwhandler); +extern Oid GetForeignServerIdByRelId(Oid relid); +extern FdwRoutine *GetFdwRoutineByServerId(Oid serverid); +extern FdwRoutine *GetFdwRoutineByRelId(Oid relid); +extern FdwRoutine *GetFdwRoutineForRelation(Relation relation, bool makecopy); +extern bool IsImportableForeignTable(const char *tablename, + ImportForeignSchemaStmt *stmt); +extern Path *GetExistingLocalJoinPath(RelOptInfo *joinrel); + +#endif /* FDWAPI_H */ diff --git a/platform/dbops/binaries/postgres/include/server/foreign/foreign.h b/platform/dbops/binaries/postgres/include/server/foreign/foreign.h new file mode 100644 index 0000000000000000000000000000000000000000..82b8153100fd19d391fea6dddac8e01526838b81 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/foreign/foreign.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * foreign.h + * support for foreign-data wrappers, servers and user mappings. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/foreign/foreign.h + * + *------------------------------------------------------------------------- + */ +#ifndef FOREIGN_H +#define FOREIGN_H + +#include "nodes/parsenodes.h" + + +/* Helper for obtaining username for user mapping */ +#define MappingUserName(userid) \ + (OidIsValid(userid) ? GetUserNameFromId(userid, false) : "public") + + +typedef struct ForeignDataWrapper +{ + Oid fdwid; /* FDW Oid */ + Oid owner; /* FDW owner user Oid */ + char *fdwname; /* Name of the FDW */ + Oid fdwhandler; /* Oid of handler function, or 0 */ + Oid fdwvalidator; /* Oid of validator function, or 0 */ + List *options; /* fdwoptions as DefElem list */ +} ForeignDataWrapper; + +typedef struct ForeignServer +{ + Oid serverid; /* server Oid */ + Oid fdwid; /* foreign-data wrapper */ + Oid owner; /* server owner user Oid */ + char *servername; /* name of the server */ + char *servertype; /* server type, optional */ + char *serverversion; /* server version, optional */ + List *options; /* srvoptions as DefElem list */ +} ForeignServer; + +typedef struct UserMapping +{ + Oid umid; /* Oid of user mapping */ + Oid userid; /* local user Oid */ + Oid serverid; /* server Oid */ + List *options; /* useoptions as DefElem list */ +} UserMapping; + +typedef struct ForeignTable +{ + Oid relid; /* relation Oid */ + Oid serverid; /* server Oid */ + List *options; /* ftoptions as DefElem list */ +} ForeignTable; + +/* Flags for GetForeignServerExtended */ +#define FSV_MISSING_OK 0x01 + +/* Flags for GetForeignDataWrapperExtended */ +#define FDW_MISSING_OK 0x01 + + +extern ForeignServer *GetForeignServer(Oid serverid); +extern ForeignServer *GetForeignServerExtended(Oid serverid, + bits16 flags); +extern ForeignServer *GetForeignServerByName(const char *srvname, + bool missing_ok); +extern UserMapping *GetUserMapping(Oid userid, Oid serverid); +extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid); +extern ForeignDataWrapper *GetForeignDataWrapperExtended(Oid fdwid, + bits16 flags); +extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *fdwname, + bool missing_ok); +extern ForeignTable *GetForeignTable(Oid relid); + +extern List *GetForeignColumnOptions(Oid relid, AttrNumber attnum); + +extern Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok); +extern Oid get_foreign_server_oid(const char *servername, bool missing_ok); + +#endif /* FOREIGN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/jit/SectionMemoryManager.h b/platform/dbops/binaries/postgres/include/server/jit/SectionMemoryManager.h new file mode 100644 index 0000000000000000000000000000000000000000..93cf97715706377e20c8cc084de4e221bad81e1e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/jit/SectionMemoryManager.h @@ -0,0 +1,226 @@ +/* + * This is a copy LLVM source code modified by the PostgreSQL project. + * See SectionMemoryManager.cpp for notes on provenance and license. + */ + +//===- SectionMemoryManager.h - Memory manager for MCJIT/RtDyld -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the declaration of a section-based memory manager used by +// the MCJIT execution engine and RuntimeDyld. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H +#define LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H + +#include "llvm/ADT/SmallVector.h" +#include "llvm/ExecutionEngine/RTDyldMemoryManager.h" +#include "llvm/Support/Alignment.h" +#include "llvm/Support/Memory.h" +#include +#include +#include + +namespace llvm { +namespace backport { + +/// This is a simple memory manager which implements the methods called by +/// the RuntimeDyld class to allocate memory for section-based loading of +/// objects, usually those generated by the MCJIT execution engine. +/// +/// This memory manager allocates all section memory as read-write. The +/// RuntimeDyld will copy JITed section memory into these allocated blocks +/// and perform any necessary linking and relocations. +/// +/// Any client using this memory manager MUST ensure that section-specific +/// page permissions have been applied before attempting to execute functions +/// in the JITed object. Permissions can be applied either by calling +/// MCJIT::finalizeObject or by calling SectionMemoryManager::finalizeMemory +/// directly. Clients of MCJIT should call MCJIT::finalizeObject. +class SectionMemoryManager : public RTDyldMemoryManager { +public: + /// This enum describes the various reasons to allocate pages from + /// allocateMappedMemory. + enum class AllocationPurpose { + Code, + ROData, + RWData, + }; + + /// Implementations of this interface are used by SectionMemoryManager to + /// request pages from the operating system. + class MemoryMapper { + public: + /// This method attempts to allocate \p NumBytes bytes of virtual memory for + /// \p Purpose. \p NearBlock may point to an existing allocation, in which + /// case an attempt is made to allocate more memory near the existing block. + /// The actual allocated address is not guaranteed to be near the requested + /// address. \p Flags is used to set the initial protection flags for the + /// block of the memory. \p EC [out] returns an object describing any error + /// that occurs. + /// + /// This method may allocate more than the number of bytes requested. The + /// actual number of bytes allocated is indicated in the returned + /// MemoryBlock. + /// + /// The start of the allocated block must be aligned with the system + /// allocation granularity (64K on Windows, page size on Linux). If the + /// address following \p NearBlock is not so aligned, it will be rounded up + /// to the next allocation granularity boundary. + /// + /// \r a non-null MemoryBlock if the function was successful, otherwise a + /// null MemoryBlock with \p EC describing the error. + virtual sys::MemoryBlock + allocateMappedMemory(AllocationPurpose Purpose, size_t NumBytes, + const sys::MemoryBlock *const NearBlock, + unsigned Flags, std::error_code &EC) = 0; + + /// This method sets the protection flags for a block of memory to the state + /// specified by \p Flags. The behavior is not specified if the memory was + /// not allocated using the allocateMappedMemory method. + /// \p Block describes the memory block to be protected. + /// \p Flags specifies the new protection state to be assigned to the block. + /// + /// If \p Flags is MF_WRITE, the actual behavior varies with the operating + /// system (i.e. MF_READ | MF_WRITE on Windows) and the target architecture + /// (i.e. MF_WRITE -> MF_READ | MF_WRITE on i386). + /// + /// \r error_success if the function was successful, or an error_code + /// describing the failure if an error occurred. + virtual std::error_code protectMappedMemory(const sys::MemoryBlock &Block, + unsigned Flags) = 0; + + /// This method releases a block of memory that was allocated with the + /// allocateMappedMemory method. It should not be used to release any memory + /// block allocated any other way. + /// \p Block describes the memory to be released. + /// + /// \r error_success if the function was successful, or an error_code + /// describing the failure if an error occurred. + virtual std::error_code releaseMappedMemory(sys::MemoryBlock &M) = 0; + + virtual ~MemoryMapper(); + }; + + /// Creates a SectionMemoryManager instance with \p MM as the associated + /// memory mapper. If \p MM is nullptr then a default memory mapper is used + /// that directly calls into the operating system. + /// + /// If \p ReserveAlloc is true all memory will be pre-allocated, and any + /// attempts to allocate beyond pre-allocated memory will fail. + SectionMemoryManager(MemoryMapper *MM = nullptr, bool ReserveAlloc = false); + SectionMemoryManager(const SectionMemoryManager &) = delete; + void operator=(const SectionMemoryManager &) = delete; + ~SectionMemoryManager() override; + + /// Enable reserveAllocationSpace when requested. + bool needsToReserveAllocationSpace() override { return ReserveAllocation; } + + /// Implements allocating all memory in a single block. This is required to + /// limit memory offsets to fit the ARM ABI; large memory systems may + /// otherwise allocate separate sections too far apart. +#if LLVM_VERSION_MAJOR < 16 + virtual void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign, + uintptr_t RODataSize, + uint32_t RODataAlign, + uintptr_t RWDataSize, + uint32_t RWDataAlign) override; +#else + void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign, + uintptr_t RODataSize, Align RODataAlign, + uintptr_t RWDataSize, Align RWDataAlign) override; +#endif + + /// Allocates a memory block of (at least) the given size suitable for + /// executable code. + /// + /// The value of \p Alignment must be a power of two. If \p Alignment is zero + /// a default alignment of 16 will be used. + uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID, + StringRef SectionName) override; + + /// Allocates a memory block of (at least) the given size suitable for + /// executable code. + /// + /// The value of \p Alignment must be a power of two. If \p Alignment is zero + /// a default alignment of 16 will be used. + uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, + unsigned SectionID, StringRef SectionName, + bool isReadOnly) override; + + /// Update section-specific memory permissions and other attributes. + /// + /// This method is called when object loading is complete and section page + /// permissions can be applied. It is up to the memory manager implementation + /// to decide whether or not to act on this method. The memory manager will + /// typically allocate all sections as read-write and then apply specific + /// permissions when this method is called. Code sections cannot be executed + /// until this function has been called. In addition, any cache coherency + /// operations needed to reliably use the memory are also performed. + /// + /// \returns true if an error occurred, false otherwise. + bool finalizeMemory(std::string *ErrMsg = nullptr) override; + + /// Invalidate instruction cache for code sections. + /// + /// Some platforms with separate data cache and instruction cache require + /// explicit cache flush, otherwise JIT code manipulations (like resolved + /// relocations) will get to the data cache but not to the instruction cache. + /// + /// This method is called from finalizeMemory. + virtual void invalidateInstructionCache(); + +private: + struct FreeMemBlock { + // The actual block of free memory + sys::MemoryBlock Free; + // If there is a pending allocation from the same reservation right before + // this block, store it's index in PendingMem, to be able to update the + // pending region if part of this block is allocated, rather than having to + // create a new one + unsigned PendingPrefixIndex; + }; + + struct MemoryGroup { + // PendingMem contains all blocks of memory (subblocks of AllocatedMem) + // which have not yet had their permissions applied, but have been given + // out to the user. FreeMem contains all block of memory, which have + // neither had their permissions applied, nor been given out to the user. + SmallVector PendingMem; + SmallVector FreeMem; + + // All memory blocks that have been requested from the system + SmallVector AllocatedMem; + + sys::MemoryBlock Near; + }; + + uint8_t *allocateSection(AllocationPurpose Purpose, uintptr_t Size, + unsigned Alignment); + + std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup, + unsigned Permissions); + + bool hasSpace(const MemoryGroup &MemGroup, uintptr_t Size) const; + + void anchor() override; + + MemoryGroup CodeMem; + MemoryGroup RWDataMem; + MemoryGroup RODataMem; + MemoryMapper *MMapper; + std::unique_ptr OwnedMMapper; + bool ReserveAllocation; +}; + +} // end namespace backport +} // end namespace llvm + +#endif // LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H diff --git a/platform/dbops/binaries/postgres/include/server/jit/jit.h b/platform/dbops/binaries/postgres/include/server/jit/jit.h new file mode 100644 index 0000000000000000000000000000000000000000..d9a080ce98f5045917e69d80c5a8daeb42670c52 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/jit/jit.h @@ -0,0 +1,106 @@ +/*------------------------------------------------------------------------- + * jit.h + * Provider independent JIT infrastructure. + * + * Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/jit/jit.h + * + *------------------------------------------------------------------------- + */ +#ifndef JIT_H +#define JIT_H + +#include "executor/instrument.h" +#include "utils/resowner.h" + + +/* Flags determining what kind of JIT operations to perform */ +#define PGJIT_NONE 0 +#define PGJIT_PERFORM (1 << 0) +#define PGJIT_OPT3 (1 << 1) +#define PGJIT_INLINE (1 << 2) +#define PGJIT_EXPR (1 << 3) +#define PGJIT_DEFORM (1 << 4) + + +typedef struct JitInstrumentation +{ + /* number of emitted functions */ + size_t created_functions; + + /* accumulated time to generate code */ + instr_time generation_counter; + + /* accumulated time to deform tuples, included into generation_counter */ + instr_time deform_counter; + + /* accumulated time for inlining */ + instr_time inlining_counter; + + /* accumulated time for optimization */ + instr_time optimization_counter; + + /* accumulated time for code emission */ + instr_time emission_counter; +} JitInstrumentation; + +/* + * DSM structure for accumulating jit instrumentation of all workers. + */ +typedef struct SharedJitInstrumentation +{ + int num_workers; + JitInstrumentation jit_instr[FLEXIBLE_ARRAY_MEMBER]; +} SharedJitInstrumentation; + +typedef struct JitContext +{ + /* see PGJIT_* above */ + int flags; + + JitInstrumentation instr; +} JitContext; + +typedef struct JitProviderCallbacks JitProviderCallbacks; + +extern PGDLLEXPORT void _PG_jit_provider_init(JitProviderCallbacks *cb); +typedef void (*JitProviderInit) (JitProviderCallbacks *cb); +typedef void (*JitProviderResetAfterErrorCB) (void); +typedef void (*JitProviderReleaseContextCB) (JitContext *context); +struct ExprState; +typedef bool (*JitProviderCompileExprCB) (struct ExprState *state); + +struct JitProviderCallbacks +{ + JitProviderResetAfterErrorCB reset_after_error; + JitProviderReleaseContextCB release_context; + JitProviderCompileExprCB compile_expr; +}; + + +/* GUCs */ +extern PGDLLIMPORT bool jit_enabled; +extern PGDLLIMPORT char *jit_provider; +extern PGDLLIMPORT bool jit_debugging_support; +extern PGDLLIMPORT bool jit_dump_bitcode; +extern PGDLLIMPORT bool jit_expressions; +extern PGDLLIMPORT bool jit_profiling_support; +extern PGDLLIMPORT bool jit_tuple_deforming; +extern PGDLLIMPORT double jit_above_cost; +extern PGDLLIMPORT double jit_inline_above_cost; +extern PGDLLIMPORT double jit_optimize_above_cost; + + +extern void jit_reset_after_error(void); +extern void jit_release_context(JitContext *context); + +/* + * Functions for attempting to JIT code. Callers must accept that these might + * not be able to perform JIT (i.e. return false). + */ +extern bool jit_compile_expr(struct ExprState *state); +extern void InstrJitAgg(JitInstrumentation *dst, JitInstrumentation *add); + + +#endif /* JIT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/jit/llvmjit.h b/platform/dbops/binaries/postgres/include/server/jit/llvmjit.h new file mode 100644 index 0000000000000000000000000000000000000000..dc0d86f4c1da9e5e0af0d0c50dae9d457fe1d7e1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/jit/llvmjit.h @@ -0,0 +1,152 @@ +/*------------------------------------------------------------------------- + * llvmjit.h + * LLVM JIT provider. + * + * Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/jit/llvmjit.h + * + *------------------------------------------------------------------------- + */ +#ifndef LLVMJIT_H +#define LLVMJIT_H + +/* + * To avoid breaking cpluspluscheck, allow including the file even when LLVM + * is not available. + */ +#ifdef USE_LLVM + +#include "jit/llvmjit_backport.h" + +#include +#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +#include +#endif + + +/* + * File needs to be includable by both C and C++ code, and include other + * headers doing the same. Therefore wrap C portion in our own extern "C" if + * in C++ mode. + */ +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "access/tupdesc.h" +#include "fmgr.h" +#include "jit/jit.h" +#include "nodes/pg_list.h" + +typedef struct LLVMJitContext +{ + JitContext base; + + /* used to ensure cleanup of context */ + ResourceOwner resowner; + + /* number of modules created */ + size_t module_generation; + + /* + * The LLVM Context used by this JIT context. An LLVM context is reused + * across many compilations, but occasionally reset to prevent it using + * too much memory due to more and more types accumulating. + */ + LLVMContextRef llvm_context; + + /* current, "open for write", module */ + LLVMModuleRef module; + + /* is there any pending code that needs to be emitted */ + bool compiled; + + /* # of objects emitted, used to generate non-conflicting names */ + int counter; + + /* list of handles for code emitted via Orc */ + List *handles; +} LLVMJitContext; + +/* type and struct definitions */ +extern PGDLLIMPORT LLVMTypeRef TypeParamBool; +extern PGDLLIMPORT LLVMTypeRef TypePGFunction; +extern PGDLLIMPORT LLVMTypeRef TypeSizeT; +extern PGDLLIMPORT LLVMTypeRef TypeStorageBool; + +extern PGDLLIMPORT LLVMTypeRef StructNullableDatum; +extern PGDLLIMPORT LLVMTypeRef StructTupleDescData; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleData; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleHeaderData; +extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleData; +extern PGDLLIMPORT LLVMTypeRef StructTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructHeapTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructMinimalTupleTableSlot; +extern PGDLLIMPORT LLVMTypeRef StructMemoryContextData; +extern PGDLLIMPORT LLVMTypeRef StructFunctionCallInfoData; +extern PGDLLIMPORT LLVMTypeRef StructExprContext; +extern PGDLLIMPORT LLVMTypeRef StructExprEvalStep; +extern PGDLLIMPORT LLVMTypeRef StructExprState; +extern PGDLLIMPORT LLVMTypeRef StructAggState; +extern PGDLLIMPORT LLVMTypeRef StructAggStatePerTransData; +extern PGDLLIMPORT LLVMTypeRef StructAggStatePerGroupData; +extern PGDLLIMPORT LLVMTypeRef StructPlanState; + +extern PGDLLIMPORT LLVMValueRef AttributeTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalBoolSubroutineTemplate; +extern PGDLLIMPORT LLVMValueRef ExecEvalSubroutineTemplate; + + +extern void llvm_enter_fatal_on_oom(void); +extern void llvm_leave_fatal_on_oom(void); +extern bool llvm_in_fatal_on_oom(void); +extern void llvm_reset_after_error(void); +extern void llvm_assert_in_fatal_section(void); + +extern LLVMJitContext *llvm_create_context(int jitFlags); +extern LLVMModuleRef llvm_mutable_module(LLVMJitContext *context); +extern char *llvm_expand_funcname(LLVMJitContext *context, const char *basename); +extern void *llvm_get_function(LLVMJitContext *context, const char *funcname); +extern void llvm_split_symbol_name(const char *name, char **modname, char **funcname); +extern LLVMTypeRef llvm_pg_var_type(const char *varname); +extern LLVMTypeRef llvm_pg_var_func_type(const char *varname); +extern LLVMValueRef llvm_pg_func(LLVMModuleRef mod, const char *funcname); +extern void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to); +extern LLVMValueRef llvm_function_reference(LLVMJitContext *context, + LLVMBuilderRef builder, + LLVMModuleRef mod, + FunctionCallInfo fcinfo); + +extern void llvm_inline_reset_caches(void); +extern void llvm_inline(LLVMModuleRef mod); + +/* + **************************************************************************** + * Code generation functions. + **************************************************************************** + */ +extern bool llvm_compile_expr(struct ExprState *state); +struct TupleTableSlotOps; +extern LLVMValueRef slot_compile_deform(struct LLVMJitContext *context, TupleDesc desc, + const struct TupleTableSlotOps *ops, int natts); + +/* + **************************************************************************** + * Extensions / Backward compatibility section of the LLVM C API + * Error handling related functions. + **************************************************************************** + */ +extern LLVMTypeRef LLVMGetFunctionReturnType(LLVMValueRef r); +extern LLVMTypeRef LLVMGetFunctionType(LLVMValueRef r); +#ifdef USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +extern LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSafeSectionMemoryManager(LLVMOrcExecutionSessionRef ES); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* USE_LLVM */ +#endif /* LLVMJIT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/jit/llvmjit_backport.h b/platform/dbops/binaries/postgres/include/server/jit/llvmjit_backport.h new file mode 100644 index 0000000000000000000000000000000000000000..92874f7998ca648cd6c4cd0b6b3de2159df2a013 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/jit/llvmjit_backport.h @@ -0,0 +1,25 @@ +/* + * A small header than can be included by backported LLVM code or PostgreSQL + * code, to control conditional compilation. + */ +#ifndef LLVMJIT_BACKPORT_H +#define LLVMJIT_BACKPORT_H + +#include + +/* + * LLVM's RuntimeDyld can produce code that crashes on larger memory ARM + * systems, because llvm::SectionMemoryManager allocates multiple pieces of + * memory that can be placed too far apart for the generated code. See + * src/backend/jit/llvm/SectionMemoryManager.cpp for the patched replacement + * class llvm::backport::SectionMemoryManager that we use as a workaround. + * This header controls whether we use it. + * + * We have adjusted it to compile against a range of LLVM versions, but not + * further back than 12 for now. + */ +#if defined(__aarch64__) && LLVM_VERSION_MAJOR > 11 +#define USE_LLVM_BACKPORT_SECTION_MEMORY_MANAGER +#endif + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/jit/llvmjit_emit.h b/platform/dbops/binaries/postgres/include/server/jit/llvmjit_emit.h new file mode 100644 index 0000000000000000000000000000000000000000..4f35f3dca139fad1e51e4bd3af294d6d3ec5ea45 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/jit/llvmjit_emit.h @@ -0,0 +1,336 @@ +/* + * llvmjit_emit.h + * Helpers to make emitting LLVM IR a bit more concise and pgindent proof. + * + * Copyright (c) 2018-2024, PostgreSQL Global Development Group + * + * src/include/jit/llvmjit_emit.h + */ +#ifndef LLVMJIT_EMIT_H +#define LLVMJIT_EMIT_H + +/* + * To avoid breaking cpluspluscheck, allow including the file even when LLVM + * is not available. + */ +#ifdef USE_LLVM + +#include +#include + +#include "jit/llvmjit.h" + + +/* + * Emit a non-LLVM pointer as an LLVM constant. + */ +static inline LLVMValueRef +l_ptr_const(void *ptr, LLVMTypeRef type) +{ + LLVMValueRef c = LLVMConstInt(TypeSizeT, (uintptr_t) ptr, false); + + return LLVMConstIntToPtr(c, type); +} + +/* + * Emit pointer. + */ +static inline LLVMTypeRef +l_ptr(LLVMTypeRef t) +{ + return LLVMPointerType(t, 0); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int8_const(LLVMContextRef lc, int8 i) +{ + return LLVMConstInt(LLVMInt8TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int16_const(LLVMContextRef lc, int16 i) +{ + return LLVMConstInt(LLVMInt16TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int32_const(LLVMContextRef lc, int32 i) +{ + return LLVMConstInt(LLVMInt32TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_int64_const(LLVMContextRef lc, int64 i) +{ + return LLVMConstInt(LLVMInt64TypeInContext(lc), i, false); +} + +/* + * Emit constant integer. + */ +static inline LLVMValueRef +l_sizet_const(size_t i) +{ + return LLVMConstInt(TypeSizeT, i, false); +} + +/* + * Emit constant boolean, as used for storage (e.g. global vars, structs). + */ +static inline LLVMValueRef +l_sbool_const(bool i) +{ + return LLVMConstInt(TypeStorageBool, (int) i, false); +} + +/* + * Emit constant boolean, as used for parameters (e.g. function parameters). + */ +static inline LLVMValueRef +l_pbool_const(bool i) +{ + return LLVMConstInt(TypeParamBool, (int) i, false); +} + +static inline LLVMValueRef +l_struct_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, int32 idx, const char *name) +{ +#if LLVM_VERSION_MAJOR < 16 + return LLVMBuildStructGEP(b, v, idx, ""); +#else + return LLVMBuildStructGEP2(b, t, v, idx, ""); +#endif +} + +static inline LLVMValueRef +l_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, LLVMValueRef *indices, int32 nindices, const char *name) +{ +#if LLVM_VERSION_MAJOR < 16 + return LLVMBuildGEP(b, v, indices, nindices, name); +#else + return LLVMBuildGEP2(b, t, v, indices, nindices, name); +#endif +} + +static inline LLVMValueRef +l_load(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, const char *name) +{ +#if LLVM_VERSION_MAJOR < 16 + return LLVMBuildLoad(b, v, name); +#else + return LLVMBuildLoad2(b, t, v, name); +#endif +} + +static inline LLVMValueRef +l_call(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef fn, LLVMValueRef *args, int32 nargs, const char *name) +{ +#if LLVM_VERSION_MAJOR < 16 + return LLVMBuildCall(b, fn, args, nargs, name); +#else + return LLVMBuildCall2(b, t, fn, args, nargs, name); +#endif +} + +/* + * Load a pointer member idx from a struct. + */ +static inline LLVMValueRef +l_load_struct_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, int32 idx, const char *name) +{ + return l_load(b, + LLVMStructGetTypeAtIndex(t, idx), + l_struct_gep(b, t, v, idx, ""), + name); +} + +/* + * Load value of a pointer, after applying one index operation. + */ +static inline LLVMValueRef +l_load_gep1(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, LLVMValueRef idx, const char *name) +{ + return l_load(b, t, l_gep(b, t, v, &idx, 1, ""), name); +} + +/* separate, because pg_attribute_printf(2, 3) can't appear in definition */ +static inline LLVMBasicBlockRef l_bb_before_v(LLVMBasicBlockRef r, const char *fmt,...) pg_attribute_printf(2, 3); + +/* + * Insert a new basic block, just before r, the name being determined by fmt + * and arguments. + */ +static inline LLVMBasicBlockRef +l_bb_before_v(LLVMBasicBlockRef r, const char *fmt,...) +{ + char buf[512]; + va_list args; + LLVMContextRef lc; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + lc = LLVMGetTypeContext(LLVMTypeOf(LLVMGetBasicBlockParent(r))); + + return LLVMInsertBasicBlockInContext(lc, r, buf); +} + +/* separate, because pg_attribute_printf(2, 3) can't appear in definition */ +static inline LLVMBasicBlockRef l_bb_append_v(LLVMValueRef f, const char *fmt,...) pg_attribute_printf(2, 3); + +/* + * Insert a new basic block after previous basic blocks, the name being + * determined by fmt and arguments. + */ +static inline LLVMBasicBlockRef +l_bb_append_v(LLVMValueRef f, const char *fmt,...) +{ + char buf[512]; + va_list args; + LLVMContextRef lc; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + lc = LLVMGetTypeContext(LLVMTypeOf(f)); + + return LLVMAppendBasicBlockInContext(lc, f, buf); +} + +/* + * Mark a callsite as readonly. + */ +static inline void +l_callsite_ro(LLVMValueRef f) +{ + const char argname[] = "readonly"; + LLVMAttributeRef ref; + + ref = LLVMCreateStringAttribute(LLVMGetTypeContext(LLVMTypeOf(f)), + argname, + sizeof(argname) - 1, + NULL, 0); + + LLVMAddCallSiteAttribute(f, LLVMAttributeFunctionIndex, ref); +} + +/* + * Mark a callsite as alwaysinline. + */ +static inline void +l_callsite_alwaysinline(LLVMValueRef f) +{ + const char argname[] = "alwaysinline"; + int id; + LLVMAttributeRef attr; + + id = LLVMGetEnumAttributeKindForName(argname, + sizeof(argname) - 1); + attr = LLVMCreateEnumAttribute(LLVMGetTypeContext(LLVMTypeOf(f)), id, 0); + LLVMAddCallSiteAttribute(f, LLVMAttributeFunctionIndex, attr); +} + +/* + * Emit code to switch memory context. + */ +static inline LLVMValueRef +l_mcxt_switch(LLVMModuleRef mod, LLVMBuilderRef b, LLVMValueRef nc) +{ + const char *cmc = "CurrentMemoryContext"; + LLVMValueRef cur; + LLVMValueRef ret; + + if (!(cur = LLVMGetNamedGlobal(mod, cmc))) + cur = LLVMAddGlobal(mod, l_ptr(StructMemoryContextData), cmc); + ret = l_load(b, l_ptr(StructMemoryContextData), cur, cmc); + LLVMBuildStore(b, nc, cur); + + return ret; +} + +/* + * Return pointer to the argno'th argument nullness. + */ +static inline LLVMValueRef +l_funcnullp(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + LLVMValueRef v_args; + LLVMValueRef v_argn; + + v_args = l_struct_gep(b, + StructFunctionCallInfoData, + v_fcinfo, + FIELDNO_FUNCTIONCALLINFODATA_ARGS, + ""); + v_argn = l_struct_gep(b, + LLVMArrayType(StructNullableDatum, 0), + v_args, + argno, + ""); + return l_struct_gep(b, + StructNullableDatum, + v_argn, + FIELDNO_NULLABLE_DATUM_ISNULL, + ""); +} + +/* + * Return pointer to the argno'th argument datum. + */ +static inline LLVMValueRef +l_funcvaluep(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + LLVMValueRef v_args; + LLVMValueRef v_argn; + + v_args = l_struct_gep(b, + StructFunctionCallInfoData, + v_fcinfo, + FIELDNO_FUNCTIONCALLINFODATA_ARGS, + ""); + v_argn = l_struct_gep(b, + LLVMArrayType(StructNullableDatum, 0), + v_args, + argno, + ""); + return l_struct_gep(b, + StructNullableDatum, + v_argn, + FIELDNO_NULLABLE_DATUM_DATUM, + ""); +} + +/* + * Return argno'th argument nullness. + */ +static inline LLVMValueRef +l_funcnull(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + return l_load(b, TypeStorageBool, l_funcnullp(b, v_fcinfo, argno), ""); +} + +/* + * Return argno'th argument datum. + */ +static inline LLVMValueRef +l_funcvalue(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno) +{ + return l_load(b, TypeSizeT, l_funcvaluep(b, v_fcinfo, argno), ""); +} + +#endif /* USE_LLVM */ +#endif diff --git a/platform/dbops/binaries/postgres/include/server/lib/binaryheap.h b/platform/dbops/binaries/postgres/include/server/lib/binaryheap.h new file mode 100644 index 0000000000000000000000000000000000000000..19025c08ef1f3814b89d03ed7e79448d743319d5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/binaryheap.h @@ -0,0 +1,69 @@ +/* + * binaryheap.h + * + * A simple binary heap implementation + * + * Portions Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + * src/include/lib/binaryheap.h + */ + +#ifndef BINARYHEAP_H +#define BINARYHEAP_H + +/* + * We provide a Datum-based API for backend code and a void *-based API for + * frontend code (since the Datum definitions are not available to frontend + * code). You should typically avoid using bh_node_type directly and instead + * use Datum or void * as appropriate. + */ +#ifdef FRONTEND +typedef void *bh_node_type; +#else +typedef Datum bh_node_type; +#endif + +/* + * For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b, + * and >0 iff a > b. For a min-heap, the conditions are reversed. + */ +typedef int (*binaryheap_comparator) (bh_node_type a, bh_node_type b, void *arg); + +/* + * binaryheap + * + * bh_size how many nodes are currently in "nodes" + * bh_space how many nodes can be stored in "nodes" + * bh_has_heap_property no unordered operations since last heap build + * bh_compare comparison function to define the heap property + * bh_arg user data for comparison function + * bh_nodes variable-length array of "space" nodes + */ +typedef struct binaryheap +{ + int bh_size; + int bh_space; + bool bh_has_heap_property; /* debugging cross-check */ + binaryheap_comparator bh_compare; + void *bh_arg; + bh_node_type bh_nodes[FLEXIBLE_ARRAY_MEMBER]; +} binaryheap; + +extern binaryheap *binaryheap_allocate(int capacity, + binaryheap_comparator compare, + void *arg); +extern void binaryheap_reset(binaryheap *heap); +extern void binaryheap_free(binaryheap *heap); +extern void binaryheap_add_unordered(binaryheap *heap, bh_node_type d); +extern void binaryheap_build(binaryheap *heap); +extern void binaryheap_add(binaryheap *heap, bh_node_type d); +extern bh_node_type binaryheap_first(binaryheap *heap); +extern bh_node_type binaryheap_remove_first(binaryheap *heap); +extern void binaryheap_remove_node(binaryheap *heap, int n); +extern void binaryheap_replace_first(binaryheap *heap, bh_node_type d); + +#define binaryheap_empty(h) ((h)->bh_size == 0) +#define binaryheap_size(h) ((h)->bh_size) +#define binaryheap_get_node(h, n) ((h)->bh_nodes[n]) + +#endif /* BINARYHEAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/bipartite_match.h b/platform/dbops/binaries/postgres/include/server/lib/bipartite_match.h new file mode 100644 index 0000000000000000000000000000000000000000..f34a7c151d20ee6709e8d0b8752b825672c61fd1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/bipartite_match.h @@ -0,0 +1,46 @@ +/* + * bipartite_match.h + * + * Copyright (c) 2015-2024, PostgreSQL Global Development Group + * + * src/include/lib/bipartite_match.h + */ +#ifndef BIPARTITE_MATCH_H +#define BIPARTITE_MATCH_H + +/* + * Given a bipartite graph consisting of nodes U numbered 1..nU, nodes V + * numbered 1..nV, and an adjacency map of undirected edges in the form + * adjacency[u] = [k, v1, v2, v3, ... vk], we wish to find a "maximum + * cardinality matching", which is defined as follows: a matching is a subset + * of the original edges such that no node has more than one edge, and a + * matching has maximum cardinality if there exists no other matching with a + * greater number of edges. + * + * This matching has various applications in graph theory, but the motivating + * example here is Dilworth's theorem: a partially-ordered set can be divided + * into the minimum number of chains (i.e. subsets X where x1 < x2 < x3 ...) by + * a bipartite graph construction. This gives us a polynomial-time solution to + * the problem of planning a collection of grouping sets with the provably + * minimal number of sort operations. + */ +typedef struct BipartiteMatchState +{ + /* inputs: */ + int u_size; /* size of U */ + int v_size; /* size of V */ + short **adjacency; /* adjacency[u] = [k, v1,v2,v3,...,vk] */ + /* outputs: */ + int matching; /* number of edges in matching */ + short *pair_uv; /* pair_uv[u] -> v */ + short *pair_vu; /* pair_vu[v] -> u */ + /* private state for matching algorithm: */ + short *distance; /* distance[u] */ + short *queue; /* queue storage for breadth search */ +} BipartiteMatchState; + +extern BipartiteMatchState *BipartiteMatch(int u_size, int v_size, short **adjacency); + +extern void BipartiteMatchFree(BipartiteMatchState *state); + +#endif /* BIPARTITE_MATCH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/bloomfilter.h b/platform/dbops/binaries/postgres/include/server/lib/bloomfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..6ec7173843fff7457b6f0e7570e2b51c42efa2da --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/bloomfilter.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * bloomfilter.h + * Space-efficient set membership testing + * + * Copyright (c) 2018-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/bloomfilter.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLOOMFILTER_H +#define BLOOMFILTER_H + +typedef struct bloom_filter bloom_filter; + +extern bloom_filter *bloom_create(int64 total_elems, int bloom_work_mem, + uint64 seed); +extern void bloom_free(bloom_filter *filter); +extern void bloom_add_element(bloom_filter *filter, unsigned char *elem, + size_t len); +extern bool bloom_lacks_element(bloom_filter *filter, unsigned char *elem, + size_t len); +extern double bloom_prop_bits_set(bloom_filter *filter); + +#endif /* BLOOMFILTER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/dshash.h b/platform/dbops/binaries/postgres/include/server/lib/dshash.h new file mode 100644 index 0000000000000000000000000000000000000000..7dda269b7535e80042e519eaa63e2a79934706b5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/dshash.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * dshash.h + * Concurrent hash tables backed by dynamic shared memory areas. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/lib/dshash.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSHASH_H +#define DSHASH_H + +#include "utils/dsa.h" + +/* The opaque type representing a hash table. */ +struct dshash_table; +typedef struct dshash_table dshash_table; + +/* A handle for a dshash_table which can be shared with other processes. */ +typedef dsa_pointer dshash_table_handle; + +/* Sentinel value to use for invalid dshash_table handles. */ +#define DSHASH_HANDLE_INVALID ((dshash_table_handle) InvalidDsaPointer) + +/* The type for hash values. */ +typedef uint32 dshash_hash; + +/* A function type for comparing keys. */ +typedef int (*dshash_compare_function) (const void *a, const void *b, + size_t size, void *arg); + +/* A function type for computing hash values for keys. */ +typedef dshash_hash (*dshash_hash_function) (const void *v, size_t size, + void *arg); + +/* A function type for copying keys. */ +typedef void (*dshash_copy_function) (void *dest, const void *src, size_t size, + void *arg); + +/* + * The set of parameters needed to create or attach to a hash table. The + * tranche_id member does not need to be initialized when attaching to an + * existing hash table. + * + * Compare, hash, and copy functions must be supplied even when attaching, + * because we can't safely share function pointers between backends in general. + * The user data pointer supplied to the create and attach functions will be + * passed to these functions. + */ +typedef struct dshash_parameters +{ + size_t key_size; /* Size of the key (initial bytes of entry) */ + size_t entry_size; /* Total size of entry */ + dshash_compare_function compare_function; /* Compare function */ + dshash_hash_function hash_function; /* Hash function */ + dshash_copy_function copy_function; /* Copy function */ + int tranche_id; /* The tranche ID to use for locks */ +} dshash_parameters; + +/* Forward declaration of private types for use only by dshash.c. */ +struct dshash_table_item; +typedef struct dshash_table_item dshash_table_item; + +/* + * Sequential scan state. The detail is exposed to let users know the storage + * size but it should be considered as an opaque type by callers. + */ +typedef struct dshash_seq_status +{ + dshash_table *hash_table; /* dshash table working on */ + int curbucket; /* bucket number we are at */ + int nbuckets; /* total number of buckets in the dshash */ + dshash_table_item *curitem; /* item we are currently at */ + dsa_pointer pnextitem; /* dsa-pointer to the next item */ + int curpartition; /* partition number we are at */ + bool exclusive; /* locking mode */ +} dshash_seq_status; + +/* Creating, sharing and destroying from hash tables. */ +extern dshash_table *dshash_create(dsa_area *area, + const dshash_parameters *params, + void *arg); +extern dshash_table *dshash_attach(dsa_area *area, + const dshash_parameters *params, + dshash_table_handle handle, + void *arg); +extern void dshash_detach(dshash_table *hash_table); +extern dshash_table_handle dshash_get_hash_table_handle(dshash_table *hash_table); +extern void dshash_destroy(dshash_table *hash_table); + +/* Finding, creating, deleting entries. */ +extern void *dshash_find(dshash_table *hash_table, + const void *key, bool exclusive); +extern void *dshash_find_or_insert(dshash_table *hash_table, + const void *key, bool *found); +extern bool dshash_delete_key(dshash_table *hash_table, const void *key); +extern void dshash_delete_entry(dshash_table *hash_table, void *entry); +extern void dshash_release_lock(dshash_table *hash_table, void *entry); + +/* seq scan support */ +extern void dshash_seq_init(dshash_seq_status *status, dshash_table *hash_table, + bool exclusive); +extern void *dshash_seq_next(dshash_seq_status *status); +extern void dshash_seq_term(dshash_seq_status *status); +extern void dshash_delete_current(dshash_seq_status *status); + +/* + * Convenience hash, compare, and copy functions wrapping memcmp, tag_hash, and + * memcpy. + */ +extern int dshash_memcmp(const void *a, const void *b, size_t size, void *arg); +extern dshash_hash dshash_memhash(const void *v, size_t size, void *arg); +extern void dshash_memcpy(void *dest, const void *src, size_t size, void *arg); + +/* + * Convenience hash, compare, and copy functions wrapping strcmp, string_hash, + * and strcpy. + */ +extern int dshash_strcmp(const void *a, const void *b, size_t size, void *arg); +extern dshash_hash dshash_strhash(const void *v, size_t size, void *arg); +extern void dshash_strcpy(void *dest, const void *src, size_t size, void *arg); + +/* Debugging support. */ +extern void dshash_dump(dshash_table *hash_table); + +#endif /* DSHASH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/hyperloglog.h b/platform/dbops/binaries/postgres/include/server/lib/hyperloglog.h new file mode 100644 index 0000000000000000000000000000000000000000..45f7de710bdc17b20b490c0fe675466d59fc0ded --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/hyperloglog.h @@ -0,0 +1,68 @@ +/* + * hyperloglog.h + * + * A simple HyperLogLog cardinality estimator implementation + * + * Portions Copyright (c) 2014-2024, PostgreSQL Global Development Group + * + * Based on Hideaki Ohno's C++ implementation. The copyright terms of Ohno's + * original version (the MIT license) follow. + * + * src/include/lib/hyperloglog.h + */ + +/* + * Copyright (c) 2013 Hideaki Ohno + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the 'Software'), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef HYPERLOGLOG_H +#define HYPERLOGLOG_H + +/* + * HyperLogLog is an approximate technique for computing the number of distinct + * entries in a set. Importantly, it does this by using a fixed amount of + * memory. See the 2007 paper "HyperLogLog: the analysis of a near-optimal + * cardinality estimation algorithm" for more. + * + * hyperLogLogState + * + * registerWidth register width, in bits ("k") + * nRegisters number of registers + * alphaMM alpha * m ^ 2 (see initHyperLogLog()) + * hashesArr array of hashes + * arrSize size of hashesArr + */ +typedef struct hyperLogLogState +{ + uint8 registerWidth; + Size nRegisters; + double alphaMM; + uint8 *hashesArr; + Size arrSize; +} hyperLogLogState; + +extern void initHyperLogLog(hyperLogLogState *cState, uint8 bwidth); +extern void initHyperLogLogError(hyperLogLogState *cState, double error); +extern void addHyperLogLog(hyperLogLogState *cState, uint32 hash); +extern double estimateHyperLogLog(hyperLogLogState *cState); +extern void freeHyperLogLog(hyperLogLogState *cState); + +#endif /* HYPERLOGLOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/ilist.h b/platform/dbops/binaries/postgres/include/server/lib/ilist.h new file mode 100644 index 0000000000000000000000000000000000000000..381f6158645e7af8c4dac937f03564b2ead2617a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/ilist.h @@ -0,0 +1,1159 @@ +/*------------------------------------------------------------------------- + * + * ilist.h + * integrated/inline doubly- and singly-linked lists + * + * These list types are useful when there are only a predetermined set of + * lists that an object could be in. List links are embedded directly into + * the objects, and thus no extra memory management overhead is required. + * (Of course, if only a small proportion of existing objects are in a list, + * the link fields in the remainder would be wasted space. But usually, + * it saves space to not have separately-allocated list nodes.) + * + * The doubly-linked list comes in 2 forms. dlist_head defines a head of a + * doubly-linked list of dlist_nodes, whereas dclist_head defines the head of + * a doubly-linked list of dlist_nodes with an additional 'count' field to + * keep track of how many items are contained within the given list. For + * simplicity, dlist_head and dclist_head share the same node and iterator + * types. The functions to manipulate a dlist_head always have a name + * starting with "dlist", whereas functions to manipulate a dclist_head have a + * name starting with "dclist". dclist_head comes with an additional function + * (dclist_count) to return the number of entries in the list. dclists are + * able to store a maximum of PG_UINT32_MAX elements. It is up to the caller + * to ensure no more than this many items are added to a dclist. + * + * None of the functions here allocate any memory; they just manipulate + * externally managed memory. With the exception doubly-linked count lists + * providing the ability to obtain the number of items in the list, the APIs + * for singly and both doubly linked lists are identical as far as + * capabilities of both allow. + * + * Each list has a list header, which exists even when the list is empty. + * An empty singly-linked list has a NULL pointer in its header. + * + * For both doubly-linked list types, there are two valid ways to represent an + * empty list. The head's 'next' pointer can either be NULL or the head's + * 'next' and 'prev' links can both point back to the list head (circular). + * (If a dlist is modified and then all its elements are deleted, it will be + * in the circular state.). We prefer circular dlists because there are some + * operations that can be done without branches (and thus faster) on lists + * that use circular representation. However, it is often convenient to + * initialize list headers to zeroes rather than setting them up with an + * explicit initialization function, so we also allow the NULL initialization. + * + * EXAMPLES + * + * Here's a simple example demonstrating how this can be used. Let's assume + * we want to store information about the tables contained in a database. + * + * #include "lib/ilist.h" + * + * // Define struct for the databases including a list header that will be + * // used to access the nodes in the table list later on. + * typedef struct my_database + * { + * char *datname; + * dlist_head tables; + * // ... + * } my_database; + * + * // Define struct for the tables. Note the list_node element which stores + * // prev/next list links. The list_node element need not be first. + * typedef struct my_table + * { + * char *tablename; + * dlist_node list_node; + * perm_t permissions; + * // ... + * } my_table; + * + * // create a database + * my_database *db = create_database(); + * + * // and add a few tables to its table list + * dlist_push_head(&db->tables, &create_table(db, "a")->list_node); + * ... + * dlist_push_head(&db->tables, &create_table(db, "b")->list_node); + * + * + * To iterate over the table list, we allocate an iterator variable and use + * a specialized looping construct. Inside a dlist_foreach, the iterator's + * 'cur' field can be used to access the current element. iter.cur points to + * a 'dlist_node', but most of the time what we want is the actual table + * information; dlist_container() gives us that, like so: + * + * dlist_iter iter; + * dlist_foreach(iter, &db->tables) + * { + * my_table *tbl = dlist_container(my_table, list_node, iter.cur); + * printf("we have a table: %s in database %s\n", + * tbl->tablename, db->datname); + * } + * + * + * While a simple iteration is useful, we sometimes also want to manipulate + * the list while iterating. There is a different iterator element and looping + * construct for that. Suppose we want to delete tables that meet a certain + * criterion: + * + * dlist_mutable_iter miter; + * dlist_foreach_modify(miter, &db->tables) + * { + * my_table *tbl = dlist_container(my_table, list_node, miter.cur); + * + * if (!tbl->to_be_deleted) + * continue; // don't touch this one + * + * // unlink the current table from the linked list + * dlist_delete(miter.cur); + * // as these lists never manage memory, we can still access the table + * // after it's been unlinked + * drop_table(db, tbl); + * } + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/lib/ilist.h + *------------------------------------------------------------------------- + */ +#ifndef ILIST_H +#define ILIST_H + +/* + * Enable for extra debugging. This is rather expensive, so it's not enabled by + * default even when USE_ASSERT_CHECKING. + */ +/* #define ILIST_DEBUG */ + +/* + * Node of a doubly linked list. + * + * Embed this in structs that need to be part of a doubly linked list. + */ +typedef struct dlist_node dlist_node; +struct dlist_node +{ + dlist_node *prev; + dlist_node *next; +}; + +/* + * Head of a doubly linked list. + * + * Non-empty lists are internally circularly linked. Circular lists have the + * advantage of not needing any branches in the most common list manipulations. + * An empty list can also be represented as a pair of NULL pointers, making + * initialization easier. + */ +typedef struct dlist_head +{ + /* + * head.next either points to the first element of the list; to &head if + * it's a circular empty list; or to NULL if empty and not circular. + * + * head.prev either points to the last element of the list; to &head if + * it's a circular empty list; or to NULL if empty and not circular. + */ + dlist_node head; +} dlist_head; + + +/* + * Doubly linked list iterator type for dlist_head and dclist_head types. + * + * Used as state in dlist_foreach() and dlist_reverse_foreach() (and the + * dclist variant thereof). + * + * To get the current element of the iteration use the 'cur' member. + * + * Iterations using this are *not* allowed to change the list while iterating! + * + * NB: We use an extra "end" field here to avoid multiple evaluations of + * arguments in the dlist_foreach() and dclist_foreach() macros. + */ +typedef struct dlist_iter +{ + dlist_node *cur; /* current element */ + dlist_node *end; /* last node we'll iterate to */ +} dlist_iter; + +/* + * Doubly linked list iterator for both dlist_head and dclist_head types. + * This iterator type allows some modifications while iterating. + * + * Used as state in dlist_foreach_modify() and dclist_foreach_modify(). + * + * To get the current element of the iteration use the 'cur' member. + * + * Iterations using this are only allowed to change the list at the current + * point of iteration. It is fine to delete the current node, but it is *not* + * fine to insert or delete adjacent nodes. + * + * NB: We need a separate type for mutable iterations so that we can store + * the 'next' node of the current node in case it gets deleted or modified. + */ +typedef struct dlist_mutable_iter +{ + dlist_node *cur; /* current element */ + dlist_node *next; /* next node we'll iterate to */ + dlist_node *end; /* last node we'll iterate to */ +} dlist_mutable_iter; + +/* + * Head of a doubly linked list with a count of the number of items + * + * This internally makes use of a dlist to implement the actual list. When + * items are added or removed from the list the count is updated to reflect + * the current number of items in the list. + */ +typedef struct dclist_head +{ + dlist_head dlist; /* the actual list header */ + uint32 count; /* the number of items in the list */ +} dclist_head; + +/* + * Node of a singly linked list. + * + * Embed this in structs that need to be part of a singly linked list. + */ +typedef struct slist_node slist_node; +struct slist_node +{ + slist_node *next; +}; + +/* + * Head of a singly linked list. + * + * Singly linked lists are not circularly linked, in contrast to doubly linked + * lists; we just set head.next to NULL if empty. This doesn't incur any + * additional branches in the usual manipulations. + */ +typedef struct slist_head +{ + slist_node head; +} slist_head; + +/* + * Singly linked list iterator. + * + * Used as state in slist_foreach(). To get the current element of the + * iteration use the 'cur' member. + * + * It's allowed to modify the list while iterating, with the exception of + * deleting the iterator's current node; deletion of that node requires + * care if the iteration is to be continued afterward. (Doing so and also + * deleting or inserting adjacent list elements might misbehave; also, if + * the user frees the current node's storage, continuing the iteration is + * not safe.) + * + * NB: this wouldn't really need to be an extra struct, we could use an + * slist_node * directly. We prefer a separate type for consistency. + */ +typedef struct slist_iter +{ + slist_node *cur; +} slist_iter; + +/* + * Singly linked list iterator allowing some modifications while iterating. + * + * Used as state in slist_foreach_modify(). To get the current element of the + * iteration use the 'cur' member. + * + * The only list modification allowed while iterating is to remove the current + * node via slist_delete_current() (*not* slist_delete()). Insertion or + * deletion of nodes adjacent to the current node would misbehave. + */ +typedef struct slist_mutable_iter +{ + slist_node *cur; /* current element */ + slist_node *next; /* next node we'll iterate to */ + slist_node *prev; /* prev node, for deletions */ +} slist_mutable_iter; + + +/* Static initializers */ +#define DLIST_STATIC_INIT(name) {{&(name).head, &(name).head}} +#define DCLIST_STATIC_INIT(name) {{{&(name).dlist.head, &(name).dlist.head}}, 0} +#define SLIST_STATIC_INIT(name) {{NULL}} + + +/* Prototypes for functions too big to be inline */ + +/* Caution: this is O(n); consider using slist_delete_current() instead */ +extern void slist_delete(slist_head *head, const slist_node *node); + +#ifdef ILIST_DEBUG +extern void dlist_member_check(const dlist_head *head, const dlist_node *node); +extern void dlist_check(const dlist_head *head); +extern void slist_check(const slist_head *head); +#else +/* + * These seemingly useless casts to void are here to keep the compiler quiet + * about the argument being unused in many functions in a non-debug compile, + * in which functions the only point of passing the list head pointer is to be + * able to run these checks. + */ +#define dlist_member_check(head, node) ((void) (head)) +#define dlist_check(head) ((void) (head)) +#define slist_check(head) ((void) (head)) +#endif /* ILIST_DEBUG */ + +/* doubly linked list implementation */ + +/* + * Initialize a doubly linked list. + * Previous state will be thrown away without any cleanup. + */ +static inline void +dlist_init(dlist_head *head) +{ + head->head.next = head->head.prev = &head->head; +} + +/* + * Initialize a doubly linked list element. + * + * This is only needed when dlist_node_is_detached() may be needed. + */ +static inline void +dlist_node_init(dlist_node *node) +{ + node->next = node->prev = NULL; +} + +/* + * Is the list empty? + * + * An empty list has either its first 'next' pointer set to NULL, or to itself. + */ +static inline bool +dlist_is_empty(const dlist_head *head) +{ + dlist_check(head); + + return head->head.next == NULL || head->head.next == &(head->head); +} + +/* + * Insert a node at the beginning of the list. + */ +static inline void +dlist_push_head(dlist_head *head, dlist_node *node) +{ + if (head->head.next == NULL) /* convert NULL header to circular */ + dlist_init(head); + + node->next = head->head.next; + node->prev = &head->head; + node->next->prev = node; + head->head.next = node; + + dlist_check(head); +} + +/* + * Insert a node at the end of the list. + */ +static inline void +dlist_push_tail(dlist_head *head, dlist_node *node) +{ + if (head->head.next == NULL) /* convert NULL header to circular */ + dlist_init(head); + + node->next = &head->head; + node->prev = head->head.prev; + node->prev->next = node; + head->head.prev = node; + + dlist_check(head); +} + +/* + * Insert a node after another *in the same list* + */ +static inline void +dlist_insert_after(dlist_node *after, dlist_node *node) +{ + node->prev = after; + node->next = after->next; + after->next = node; + node->next->prev = node; +} + +/* + * Insert a node before another *in the same list* + */ +static inline void +dlist_insert_before(dlist_node *before, dlist_node *node) +{ + node->prev = before->prev; + node->next = before; + before->prev = node; + node->prev->next = node; +} + +/* + * Delete 'node' from its list (it must be in one). + */ +static inline void +dlist_delete(dlist_node *node) +{ + node->prev->next = node->next; + node->next->prev = node->prev; +} + +/* + * Like dlist_delete(), but also sets next/prev to NULL to signal not being in + * a list. + */ +static inline void +dlist_delete_thoroughly(dlist_node *node) +{ + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = NULL; + node->prev = NULL; +} + +/* + * Same as dlist_delete, but performs checks in ILIST_DEBUG builds to ensure + * that 'node' belongs to 'head'. + */ +static inline void +dlist_delete_from(dlist_head *head, dlist_node *node) +{ + dlist_member_check(head, node); + dlist_delete(node); +} + +/* + * Like dlist_delete_from, but also sets next/prev to NULL to signal not + * being in a list. + */ +static inline void +dlist_delete_from_thoroughly(dlist_head *head, dlist_node *node) +{ + dlist_member_check(head, node); + dlist_delete_thoroughly(node); +} + +/* + * Remove and return the first node from a list (there must be one). + */ +static inline dlist_node * +dlist_pop_head_node(dlist_head *head) +{ + dlist_node *node; + + Assert(!dlist_is_empty(head)); + node = head->head.next; + dlist_delete(node); + return node; +} + +/* + * Move element from its current position in the list to the head position in + * the same list. + * + * Undefined behaviour if 'node' is not already part of the list. + */ +static inline void +dlist_move_head(dlist_head *head, dlist_node *node) +{ + /* fast path if it's already at the head */ + if (head->head.next == node) + return; + + dlist_delete(node); + dlist_push_head(head, node); + + dlist_check(head); +} + +/* + * Move element from its current position in the list to the tail position in + * the same list. + * + * Undefined behaviour if 'node' is not already part of the list. + */ +static inline void +dlist_move_tail(dlist_head *head, dlist_node *node) +{ + /* fast path if it's already at the tail */ + if (head->head.prev == node) + return; + + dlist_delete(node); + dlist_push_tail(head, node); + + dlist_check(head); +} + +/* + * Check whether 'node' has a following node. + * Caution: unreliable if 'node' is not in the list. + */ +static inline bool +dlist_has_next(const dlist_head *head, const dlist_node *node) +{ + return node->next != &head->head; +} + +/* + * Check whether 'node' has a preceding node. + * Caution: unreliable if 'node' is not in the list. + */ +static inline bool +dlist_has_prev(const dlist_head *head, const dlist_node *node) +{ + return node->prev != &head->head; +} + +/* + * Check if node is detached. A node is only detached if it either has been + * initialized with dlist_init_node(), or deleted with + * dlist_delete_thoroughly() / dlist_delete_from_thoroughly() / + * dclist_delete_from_thoroughly(). + */ +static inline bool +dlist_node_is_detached(const dlist_node *node) +{ + Assert((node->next == NULL && node->prev == NULL) || + (node->next != NULL && node->prev != NULL)); + + return node->next == NULL; +} + +/* + * Return the next node in the list (there must be one). + */ +static inline dlist_node * +dlist_next_node(dlist_head *head, dlist_node *node) +{ + Assert(dlist_has_next(head, node)); + return node->next; +} + +/* + * Return previous node in the list (there must be one). + */ +static inline dlist_node * +dlist_prev_node(dlist_head *head, dlist_node *node) +{ + Assert(dlist_has_prev(head, node)); + return node->prev; +} + +/* internal support function to get address of head element's struct */ +static inline void * +dlist_head_element_off(dlist_head *head, size_t off) +{ + Assert(!dlist_is_empty(head)); + return (char *) head->head.next - off; +} + +/* + * Return the first node in the list (there must be one). + */ +static inline dlist_node * +dlist_head_node(dlist_head *head) +{ + return (dlist_node *) dlist_head_element_off(head, 0); +} + +/* internal support function to get address of tail element's struct */ +static inline void * +dlist_tail_element_off(dlist_head *head, size_t off) +{ + Assert(!dlist_is_empty(head)); + return (char *) head->head.prev - off; +} + +/* + * Return the last node in the list (there must be one). + */ +static inline dlist_node * +dlist_tail_node(dlist_head *head) +{ + return (dlist_node *) dlist_tail_element_off(head, 0); +} + +/* + * Return the containing struct of 'type' where 'membername' is the dlist_node + * pointed at by 'ptr'. + * + * This is used to convert a dlist_node * back to its containing struct. + */ +#define dlist_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, dlist_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define dlist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (type *) dlist_head_element_off(lhead, offsetof(type, membername))) + +/* + * Return the address of the last element in the list. + * + * The list must not be empty. + */ +#define dlist_tail_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) dlist_tail_element_off(lhead, offsetof(type, membername)))) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * It is *not* allowed to manipulate the list during iteration. + */ +#define dlist_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->next ? (iter).end->next : (iter).end; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).cur->next) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * Iterations using this are only allowed to change the list at the current + * point of iteration. It is fine to delete the current node, but it is *not* + * fine to insert or delete adjacent nodes. + */ +#define dlist_foreach_modify(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->next ? (iter).end->next : (iter).end, \ + (iter).next = (iter).cur->next; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).next, (iter).next = (iter).cur->next) + +/* + * Iterate through the list in reverse order. + * + * It is *not* allowed to manipulate the list during iteration. + */ +#define dlist_reverse_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, dlist_iter), \ + AssertVariableIsOfTypeMacro(lhead, dlist_head *), \ + (iter).end = &(lhead)->head, \ + (iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end; \ + (iter).cur != (iter).end; \ + (iter).cur = (iter).cur->prev) + +/* doubly-linked count list implementation */ + +/* + * dclist_init + * Initialize a doubly linked count list. + * + * Previous state will be thrown away without any cleanup. + */ +static inline void +dclist_init(dclist_head *head) +{ + dlist_init(&head->dlist); + head->count = 0; +} + +/* + * dclist_is_empty + * Returns true if the list is empty, otherwise false. + */ +static inline bool +dclist_is_empty(const dclist_head *head) +{ + Assert(dlist_is_empty(&head->dlist) == (head->count == 0)); + return (head->count == 0); +} + +/* + * dclist_push_head + * Insert a node at the beginning of the list. + */ +static inline void +dclist_push_head(dclist_head *head, dlist_node *node) +{ + if (head->dlist.head.next == NULL) /* convert NULL header to circular */ + dclist_init(head); + + dlist_push_head(&head->dlist, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_push_tail + * Insert a node at the end of the list. + */ +static inline void +dclist_push_tail(dclist_head *head, dlist_node *node) +{ + if (head->dlist.head.next == NULL) /* convert NULL header to circular */ + dclist_init(head); + + dlist_push_tail(&head->dlist, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_insert_after + * Insert a node after another *in the same list* + * + * Caution: 'after' must be a member of 'head'. + */ +static inline void +dclist_insert_after(dclist_head *head, dlist_node *after, dlist_node *node) +{ + dlist_member_check(&head->dlist, after); + Assert(head->count > 0); /* must be at least 1 already */ + + dlist_insert_after(after, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_insert_before + * Insert a node before another *in the same list* + * + * Caution: 'before' must be a member of 'head'. + */ +static inline void +dclist_insert_before(dclist_head *head, dlist_node *before, dlist_node *node) +{ + dlist_member_check(&head->dlist, before); + Assert(head->count > 0); /* must be at least 1 already */ + + dlist_insert_before(before, node); + head->count++; + + Assert(head->count > 0); /* count overflow check */ +} + +/* + * dclist_delete_from + * Deletes 'node' from 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_delete_from(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + dlist_delete_from(&head->dlist, node); + head->count--; +} + +/* + * Like dclist_delete_from(), but also sets next/prev to NULL to signal not + * being in a list. + */ +static inline void +dclist_delete_from_thoroughly(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + dlist_delete_from_thoroughly(&head->dlist, node); + head->count--; +} + +/* + * dclist_pop_head_node + * Remove and return the first node from a list (there must be one). + */ +static inline dlist_node * +dclist_pop_head_node(dclist_head *head) +{ + dlist_node *node; + + Assert(head->count > 0); + + node = dlist_pop_head_node(&head->dlist); + head->count--; + return node; +} + +/* + * dclist_move_head + * Move 'node' from its current position in the list to the head position + * in 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_move_head(dclist_head *head, dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + dlist_move_head(&head->dlist, node); +} + +/* + * dclist_move_tail + * Move 'node' from its current position in the list to the tail position + * in 'head'. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline void +dclist_move_tail(dclist_head *head, dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + dlist_move_tail(&head->dlist, node); +} + +/* + * dclist_has_next + * Check whether 'node' has a following node. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline bool +dclist_has_next(const dclist_head *head, const dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + return dlist_has_next(&head->dlist, node); +} + +/* + * dclist_has_prev + * Check whether 'node' has a preceding node. + * + * Caution: 'node' must be a member of 'head'. + */ +static inline bool +dclist_has_prev(const dclist_head *head, const dlist_node *node) +{ + dlist_member_check(&head->dlist, node); + Assert(head->count > 0); + + return dlist_has_prev(&head->dlist, node); +} + +/* + * dclist_next_node + * Return the next node in the list (there must be one). + */ +static inline dlist_node * +dclist_next_node(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + return dlist_next_node(&head->dlist, node); +} + +/* + * dclist_prev_node + * Return the prev node in the list (there must be one). + */ +static inline dlist_node * +dclist_prev_node(dclist_head *head, dlist_node *node) +{ + Assert(head->count > 0); + + return dlist_prev_node(&head->dlist, node); +} + +/* internal support function to get address of head element's struct */ +static inline void * +dclist_head_element_off(dclist_head *head, size_t off) +{ + Assert(!dclist_is_empty(head)); + + return (char *) head->dlist.head.next - off; +} + +/* + * dclist_head_node + * Return the first node in the list (there must be one). + */ +static inline dlist_node * +dclist_head_node(dclist_head *head) +{ + Assert(head->count > 0); + + return (dlist_node *) dlist_head_element_off(&head->dlist, 0); +} + +/* internal support function to get address of tail element's struct */ +static inline void * +dclist_tail_element_off(dclist_head *head, size_t off) +{ + Assert(!dclist_is_empty(head)); + + return (char *) head->dlist.head.prev - off; +} + +/* + * Return the last node in the list (there must be one). + */ +static inline dlist_node * +dclist_tail_node(dclist_head *head) +{ + Assert(head->count > 0); + + return (dlist_node *) dlist_tail_element_off(&head->dlist, 0); +} + +/* + * dclist_count + * Returns the stored number of entries in 'head' + */ +static inline uint32 +dclist_count(const dclist_head *head) +{ + Assert(dlist_is_empty(&head->dlist) == (head->count == 0)); + + return head->count; +} + +/* + * Return the containing struct of 'type' where 'membername' is the dlist_node + * pointed at by 'ptr'. + * + * This is used to convert a dlist_node * back to its containing struct. + * + * Note: This is effectively just the same as dlist_container, so reuse that. + */ +#define dclist_container(type, membername, ptr) \ + dlist_container(type, membername, ptr) + + /* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define dclist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + (type *) dclist_head_element_off(lhead, offsetof(type, membername))) + + /* + * Return the address of the last element in the list. + * + * The list must not be empty. + */ +#define dclist_tail_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \ + ((type *) dclist_tail_element_off(lhead, offsetof(type, membername)))) + + +/* Iterators for dclists */ +#define dclist_foreach(iter, lhead) \ + dlist_foreach(iter, &((lhead)->dlist)) + +#define dclist_foreach_modify(iter, lhead) \ + dlist_foreach_modify(iter, &((lhead)->dlist)) + +#define dclist_reverse_foreach(iter, lhead) \ + dlist_reverse_foreach(iter, &((lhead)->dlist)) + +/* singly linked list implementation */ + +/* + * Initialize a singly linked list. + * Previous state will be thrown away without any cleanup. + */ +static inline void +slist_init(slist_head *head) +{ + head->head.next = NULL; +} + +/* + * Is the list empty? + */ +static inline bool +slist_is_empty(const slist_head *head) +{ + slist_check(head); + + return head->head.next == NULL; +} + +/* + * Insert a node at the beginning of the list. + */ +static inline void +slist_push_head(slist_head *head, slist_node *node) +{ + node->next = head->head.next; + head->head.next = node; + + slist_check(head); +} + +/* + * Insert a node after another *in the same list* + */ +static inline void +slist_insert_after(slist_node *after, slist_node *node) +{ + node->next = after->next; + after->next = node; +} + +/* + * Remove and return the first node from a list (there must be one). + */ +static inline slist_node * +slist_pop_head_node(slist_head *head) +{ + slist_node *node; + + Assert(!slist_is_empty(head)); + node = head->head.next; + head->head.next = node->next; + slist_check(head); + return node; +} + +/* + * Check whether 'node' has a following node. + */ +static inline bool +slist_has_next(const slist_head *head, const slist_node *node) +{ + slist_check(head); + + return node->next != NULL; +} + +/* + * Return the next node in the list (there must be one). + */ +static inline slist_node * +slist_next_node(slist_head *head, slist_node *node) +{ + Assert(slist_has_next(head, node)); + return node->next; +} + +/* internal support function to get address of head element's struct */ +static inline void * +slist_head_element_off(slist_head *head, size_t off) +{ + Assert(!slist_is_empty(head)); + return (char *) head->head.next - off; +} + +/* + * Return the first node in the list (there must be one). + */ +static inline slist_node * +slist_head_node(slist_head *head) +{ + return (slist_node *) slist_head_element_off(head, 0); +} + +/* + * Delete the list element the iterator currently points to. + * + * Caution: this modifies iter->cur, so don't use that again in the current + * loop iteration. + */ +static inline void +slist_delete_current(slist_mutable_iter *iter) +{ + /* + * Update previous element's forward link. If the iteration is at the + * first list element, iter->prev will point to the list header's "head" + * field, so we don't need a special case for that. + */ + iter->prev->next = iter->next; + + /* + * Reset cur to prev, so that prev will continue to point to the prior + * valid list element after slist_foreach_modify() advances to the next. + */ + iter->cur = iter->prev; +} + +/* + * Return the containing struct of 'type' where 'membername' is the slist_node + * pointed at by 'ptr'. + * + * This is used to convert a slist_node * back to its containing struct. + */ +#define slist_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, slist_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Return the address of the first element in the list. + * + * The list must not be empty. + */ +#define slist_head_element(type, membername, lhead) \ + (AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \ + (type *) slist_head_element_off(lhead, offsetof(type, membername))) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * It's allowed to modify the list while iterating, with the exception of + * deleting the iterator's current node; deletion of that node requires + * care if the iteration is to be continued afterward. (Doing so and also + * deleting or inserting adjacent list elements might misbehave; also, if + * the user frees the current node's storage, continuing the iteration is + * not safe.) + */ +#define slist_foreach(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, slist_iter), \ + AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + (iter).cur = (lhead)->head.next; \ + (iter).cur != NULL; \ + (iter).cur = (iter).cur->next) + +/* + * Iterate through the list pointed at by 'lhead' storing the state in 'iter'. + * + * Access the current element with iter.cur. + * + * The only list modification allowed while iterating is to remove the current + * node via slist_delete_current() (*not* slist_delete()). Insertion or + * deletion of nodes adjacent to the current node would misbehave. + */ +#define slist_foreach_modify(iter, lhead) \ + for (AssertVariableIsOfTypeMacro(iter, slist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, slist_head *), \ + (iter).prev = &(lhead)->head, \ + (iter).cur = (iter).prev->next, \ + (iter).next = (iter).cur ? (iter).cur->next : NULL; \ + (iter).cur != NULL; \ + (iter).prev = (iter).cur, \ + (iter).cur = (iter).next, \ + (iter).next = (iter).next ? (iter).next->next : NULL) + +#endif /* ILIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/integerset.h b/platform/dbops/binaries/postgres/include/server/lib/integerset.h new file mode 100644 index 0000000000000000000000000000000000000000..fb27466003c1e4f85746636c7961b069bc31dce5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/integerset.h @@ -0,0 +1,24 @@ +/* + * integerset.h + * In-memory data structure to hold a large set of integers efficiently + * + * Portions Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + * src/include/lib/integerset.h + */ +#ifndef INTEGERSET_H +#define INTEGERSET_H + +typedef struct IntegerSet IntegerSet; + +extern IntegerSet *intset_create(void); +extern void intset_add_member(IntegerSet *intset, uint64 x); +extern bool intset_is_member(IntegerSet *intset, uint64 x); + +extern uint64 intset_num_entries(IntegerSet *intset); +extern uint64 intset_memory_usage(IntegerSet *intset); + +extern void intset_begin_iterate(IntegerSet *intset); +extern bool intset_iterate_next(IntegerSet *intset, uint64 *next); + +#endif /* INTEGERSET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/knapsack.h b/platform/dbops/binaries/postgres/include/server/lib/knapsack.h new file mode 100644 index 0000000000000000000000000000000000000000..1a93841fdc46273ed041ec68d7342c03a8db3339 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/knapsack.h @@ -0,0 +1,16 @@ +/* + * knapsack.h + * + * Copyright (c) 2017-2024, PostgreSQL Global Development Group + * + * src/include/lib/knapsack.h + */ +#ifndef KNAPSACK_H +#define KNAPSACK_H + +#include "nodes/bitmapset.h" + +extern Bitmapset *DiscreteKnapsack(int max_weight, int num_items, + int *item_weights, double *item_values); + +#endif /* KNAPSACK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/pairingheap.h b/platform/dbops/binaries/postgres/include/server/lib/pairingheap.h new file mode 100644 index 0000000000000000000000000000000000000000..7eade81535a5e6eab44a0bc62c255b1a06e9da2f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/pairingheap.h @@ -0,0 +1,102 @@ +/* + * pairingheap.h + * + * A Pairing Heap implementation + * + * Portions Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + * src/include/lib/pairingheap.h + */ + +#ifndef PAIRINGHEAP_H +#define PAIRINGHEAP_H + +#include "lib/stringinfo.h" + +/* Enable if you need the pairingheap_dump() debug function */ +/* #define PAIRINGHEAP_DEBUG */ + +/* + * This represents an element stored in the heap. Embed this in a larger + * struct containing the actual data you're storing. + * + * A node can have multiple children, which form a double-linked list. + * first_child points to the node's first child, and the subsequent children + * can be found by following the next_sibling pointers. The last child has + * next_sibling == NULL. The prev_or_parent pointer points to the node's + * previous sibling, or if the node is its parent's first child, to the + * parent. + */ +typedef struct pairingheap_node +{ + struct pairingheap_node *first_child; + struct pairingheap_node *next_sibling; + struct pairingheap_node *prev_or_parent; +} pairingheap_node; + +/* + * Return the containing struct of 'type' where 'membername' is the + * pairingheap_node pointed at by 'ptr'. + * + * This is used to convert a pairingheap_node * back to its containing struct. + */ +#define pairingheap_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + ((type *) ((char *) (ptr) - offsetof(type, membername)))) + +/* + * Like pairingheap_container, but used when the pointer is 'const ptr' + */ +#define pairingheap_const_container(type, membername, ptr) \ + (AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \ + AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \ + ((const type *) ((const char *) (ptr) - offsetof(type, membername)))) + +/* + * For a max-heap, the comparator must return <0 iff a < b, 0 iff a == b, + * and >0 iff a > b. For a min-heap, the conditions are reversed. + */ +typedef int (*pairingheap_comparator) (const pairingheap_node *a, + const pairingheap_node *b, + void *arg); + +/* + * A pairing heap. + * + * You can use pairingheap_allocate() to create a new palloc'd heap, or embed + * this in a larger struct, set ph_compare and ph_arg directly and initialize + * ph_root to NULL. + */ +typedef struct pairingheap +{ + pairingheap_comparator ph_compare; /* comparison function */ + void *ph_arg; /* opaque argument to ph_compare */ + pairingheap_node *ph_root; /* current root of the heap */ +} pairingheap; + +extern pairingheap *pairingheap_allocate(pairingheap_comparator compare, + void *arg); +extern void pairingheap_free(pairingheap *heap); +extern void pairingheap_add(pairingheap *heap, pairingheap_node *node); +extern pairingheap_node *pairingheap_first(pairingheap *heap); +extern pairingheap_node *pairingheap_remove_first(pairingheap *heap); +extern void pairingheap_remove(pairingheap *heap, pairingheap_node *node); + +#ifdef PAIRINGHEAP_DEBUG +extern char *pairingheap_dump(pairingheap *heap, + void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), + void *opaque); +#endif + +/* Resets the heap to be empty. */ +#define pairingheap_reset(h) ((h)->ph_root = NULL) + +/* Is the heap empty? */ +#define pairingheap_is_empty(h) ((h)->ph_root == NULL) + +/* Is there exactly one node in the heap? */ +#define pairingheap_is_singular(h) \ + ((h)->ph_root && (h)->ph_root->first_child == NULL) + +#endif /* PAIRINGHEAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/qunique.h b/platform/dbops/binaries/postgres/include/server/lib/qunique.h new file mode 100644 index 0000000000000000000000000000000000000000..eda617fde5a0963f013d315efffea78c85a181e0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/qunique.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * qunique.h + * inline array unique functions + * Portions Copyright (c) 2019-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/qunique.h + *------------------------------------------------------------------------- + */ + +#ifndef QUNIQUE_H +#define QUNIQUE_H + +/* + * Remove duplicates from a pre-sorted array, according to a user-supplied + * comparator. Usually the array should have been sorted with qsort() using + * the same arguments. Return the new size. + */ +static inline size_t +qunique(void *array, size_t elements, size_t width, + int (*compare) (const void *, const void *)) +{ + char *bytes = (char *) array; + size_t i, + j; + + if (elements <= 1) + return elements; + + for (i = 1, j = 0; i < elements; ++i) + { + if (compare(bytes + i * width, bytes + j * width) != 0 && + ++j != i) + memcpy(bytes + j * width, bytes + i * width, width); + } + + return j + 1; +} + +/* + * Like qunique(), but takes a comparator with an extra user data argument + * which is passed through, for compatibility with qsort_arg(). + */ +static inline size_t +qunique_arg(void *array, size_t elements, size_t width, + int (*compare) (const void *, const void *, void *), + void *arg) +{ + char *bytes = (char *) array; + size_t i, + j; + + if (elements <= 1) + return elements; + + for (i = 1, j = 0; i < elements; ++i) + { + if (compare(bytes + i * width, bytes + j * width, arg) != 0 && + ++j != i) + memcpy(bytes + j * width, bytes + i * width, width); + } + + return j + 1; +} + +#endif /* QUNIQUE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/radixtree.h b/platform/dbops/binaries/postgres/include/server/lib/radixtree.h new file mode 100644 index 0000000000000000000000000000000000000000..4cbadf4f5ec604caf563f6dc4801e5ffec60ae8d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/radixtree.h @@ -0,0 +1,3066 @@ +/*------------------------------------------------------------------------- + * + * radixtree.h + * Template for adaptive radix tree. + * + * A template to generate an "adaptive radix tree", specialized for value + * types and for local/shared memory. + * + * The concept originates from the paper "The Adaptive Radix Tree: ARTful + * Indexing for Main-Memory Databases" by Viktor Leis, Alfons Kemper, + * and Thomas Neumann, 2013. + * + * Radix trees have some advantages over hash tables: + * - The keys are logically ordered, allowing efficient sorted iteration + * and range queries + * - Operations using keys that are lexicographically close together + * will have favorable memory locality + * - Memory use grows gradually rather than by doubling + * - The key does not need to be stored with the value, since the key + * is implicitly contained in the path to the value + * + * Some disadvantages are: + * - Point queries (along with insertion and deletion) are slower than + * a linear probing hash table as in simplehash.h + * - Memory usage varies by key distribution, so is difficult to predict + * + * A classic radix tree consists of nodes, each containing an array of + * pointers to child nodes. The size of the array is determined by the + * "span" of the tree, which is the number of bits of the key used to + * index into the array. For example, with a span of 6, a "chunk" + * of 6 bits is extracted from the key at each node traversal, and + * the arrays thus have a "fanout" of 2^6 or 64 entries. A large span + * allows a shorter tree, but requires larger arrays that may be mostly + * wasted space. + * + * The key idea of the adaptive radix tree is to choose different + * data structures based on the number of child nodes. A node will + * start out small when it is first populated, and when it is full, + * it is replaced by the next larger size. Conversely, when a node + * becomes mostly empty, it is replaced by the next smaller node. The + * bulk of the code complexity in this module stems from this dynamic + * switching. One mitigating factor is using a span of 8, since bytes + * are directly addressable. + * + * The ART paper mentions three ways to implement leaves: + * + * "- Single-value leaves: The values are stored using an addi- + * tional leaf node type which stores one value. + * - Multi-value leaves: The values are stored in one of four + * different leaf node types, which mirror the structure of + * inner nodes, but contain values instead of pointers. + * - Combined pointer/value slots: If values fit into point- + * ers, no separate node types are necessary. Instead, each + * pointer storage location in an inner node can either + * store a pointer or a value." + * + * We use a form of "combined pointer/value slots", as recommended. Values + * of size (if fixed at compile time) equal or smaller than the platform's + * pointer type are stored in the child slots of the last level node, + * while larger values are the same as "single-value" leaves above. This + * offers flexibility and efficiency. Variable-length types are currently + * treated as single-value leaves for simplicity, but future work may + * allow those to be stored in the child pointer arrays, when they're + * small enough. + * + * There are two other techniques described in the paper that are not + * implemented here: + * - path compression "...removes all inner nodes that have only a single child." + * - lazy path expansion "...inner nodes are only created if they are required + * to distinguish at least two leaf nodes." + * + * We do have a form of "poor man's path compression", however, enabled by + * only supporting unsigned integer keys (for now assumed to be 64-bit): + * A tree doesn't contain paths where the highest bytes of all keys are + * zero. That way, the tree's height adapts to the distribution of keys. + * + * To handle concurrency, we use a single reader-writer lock for the + * radix tree. If concurrent write operations are possible, the tree + * must be exclusively locked during write operations such as RT_SET() + * and RT_DELETE(), and share locked during read operations such as + * RT_FIND() and RT_BEGIN_ITERATE(). + * + * TODO: The current locking mechanism is not optimized for high + * concurrency with mixed read-write workloads. In the future it might + * be worthwhile to replace it with the Optimistic Lock Coupling or + * ROWEX mentioned in the paper "The ART of Practical Synchronization" + * by the same authors as the ART paper, 2016. + * + * To generate a radix tree and associated functions for a use case + * several macros have to be #define'ed before this file is included. + * Including the file #undef's all those, so a new radix tree can be + * generated afterwards. + * + * The relevant parameters are: + * - RT_PREFIX - prefix for all symbol names generated. A prefix of "foo" + * will result in radix tree type "foo_radix_tree" and functions like + * "foo_create"/"foo_free" and so forth. + * - RT_DECLARE - if defined function prototypes and type declarations are + * generated + * - RT_DEFINE - if defined function definitions are generated + * - RT_SCOPE - in which scope (e.g. extern, static inline) do function + * declarations reside + * - RT_VALUE_TYPE - the type of the value. + * - RT_VARLEN_VALUE_SIZE() - for variable length values, an expression + * involving a pointer to the value type, to calculate size. + * NOTE: implies that the value is in fact variable-length, + * so do not set for fixed-length values. + * - RT_RUNTIME_EMBEDDABLE_VALUE - for variable length values, allows + * storing the value in a child pointer slot, rather than as a single- + * value leaf, if small enough. This requires that the value, when + * read as a child pointer, can be tagged in the lowest bit. + * + * Optional parameters: + * - RT_SHMEM - if defined, the radix tree is created in the DSA area + * so that multiple processes can access it simultaneously. + * - RT_DEBUG - if defined add stats tracking and debugging functions + * + * Interface + * --------- + * + * RT_CREATE - Create a new, empty radix tree + * RT_FREE - Free the radix tree + * RT_FIND - Lookup the value for a given key + * RT_SET - Set a key-value pair + * RT_BEGIN_ITERATE - Begin iterating through all key-value pairs + * RT_ITERATE_NEXT - Return next key-value pair, if any + * RT_END_ITERATE - End iteration + * RT_MEMORY_USAGE - Get the memory as measured by space in memory context blocks + * + * Interface for Shared Memory + * --------- + * + * RT_ATTACH - Attach to the radix tree + * RT_DETACH - Detach from the radix tree + * RT_LOCK_EXCLUSIVE - Lock the radix tree in exclusive mode + * RT_LOCK_SHARE - Lock the radix tree in share mode + * RT_UNLOCK - Unlock the radix tree + * RT_GET_HANDLE - Return the handle of the radix tree + * + * Optional Interface + * --------- + * + * RT_DELETE - Delete a key-value pair. Declared/defined if RT_USE_DELETE is defined + * + * + * Copyright (c) 2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/radixtree.h + * + *------------------------------------------------------------------------- + */ + +#include "nodes/bitmapset.h" +#include "port/pg_bitutils.h" +#include "port/simd.h" +#include "utils/dsa.h" +#include "utils/memutils.h" +#ifdef RT_SHMEM +#include "miscadmin.h" +#include "storage/lwlock.h" +#endif + +/* helpers */ +#define RT_MAKE_PREFIX(a) CppConcat(a,_) +#define RT_MAKE_NAME(name) RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name) +#define RT_MAKE_NAME_(a,b) CppConcat(a,b) +/* + * stringify a macro constant, from https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html + */ +#define RT_STR(s) RT_STR_(s) +#define RT_STR_(s) #s + +/* function declarations */ +#define RT_CREATE RT_MAKE_NAME(create) +#define RT_FREE RT_MAKE_NAME(free) +#define RT_FIND RT_MAKE_NAME(find) +#ifdef RT_SHMEM +#define RT_ATTACH RT_MAKE_NAME(attach) +#define RT_DETACH RT_MAKE_NAME(detach) +#define RT_GET_HANDLE RT_MAKE_NAME(get_handle) +#define RT_LOCK_EXCLUSIVE RT_MAKE_NAME(lock_exclusive) +#define RT_LOCK_SHARE RT_MAKE_NAME(lock_share) +#define RT_UNLOCK RT_MAKE_NAME(unlock) +#endif +#define RT_SET RT_MAKE_NAME(set) +#define RT_BEGIN_ITERATE RT_MAKE_NAME(begin_iterate) +#define RT_ITERATE_NEXT RT_MAKE_NAME(iterate_next) +#define RT_END_ITERATE RT_MAKE_NAME(end_iterate) +#ifdef RT_USE_DELETE +#define RT_DELETE RT_MAKE_NAME(delete) +#endif +#define RT_MEMORY_USAGE RT_MAKE_NAME(memory_usage) +#define RT_DUMP_NODE RT_MAKE_NAME(dump_node) +#define RT_STATS RT_MAKE_NAME(stats) + +/* internal helper functions (no externally visible prototypes) */ +#define RT_CHILDPTR_IS_VALUE RT_MAKE_NAME(childptr_is_value) +#define RT_VALUE_IS_EMBEDDABLE RT_MAKE_NAME(value_is_embeddable) +#define RT_GET_SLOT_RECURSIVE RT_MAKE_NAME(get_slot_recursive) +#define RT_DELETE_RECURSIVE RT_MAKE_NAME(delete_recursive) +#define RT_ALLOC_NODE RT_MAKE_NAME(alloc_node) +#define RT_ALLOC_LEAF RT_MAKE_NAME(alloc_leaf) +#define RT_FREE_NODE RT_MAKE_NAME(free_node) +#define RT_FREE_LEAF RT_MAKE_NAME(free_leaf) +#define RT_FREE_RECURSE RT_MAKE_NAME(free_recurse) +#define RT_EXTEND_UP RT_MAKE_NAME(extend_up) +#define RT_EXTEND_DOWN RT_MAKE_NAME(extend_down) +#define RT_COPY_COMMON RT_MAKE_NAME(copy_common) +#define RT_PTR_SET_LOCAL RT_MAKE_NAME(ptr_set_local) +#define RT_NODE_16_SEARCH_EQ RT_MAKE_NAME(node_16_search_eq) +#define RT_NODE_4_GET_INSERTPOS RT_MAKE_NAME(node_4_get_insertpos) +#define RT_NODE_16_GET_INSERTPOS RT_MAKE_NAME(node_16_get_insertpos) +#define RT_SHIFT_ARRAYS_FOR_INSERT RT_MAKE_NAME(shift_arrays_for_insert) +#define RT_SHIFT_ARRAYS_AND_DELETE RT_MAKE_NAME(shift_arrays_and_delete) +#define RT_COPY_ARRAYS_FOR_INSERT RT_MAKE_NAME(copy_arrays_for_insert) +#define RT_COPY_ARRAYS_AND_DELETE RT_MAKE_NAME(copy_arrays_and_delete) +#define RT_NODE_48_IS_CHUNK_USED RT_MAKE_NAME(node_48_is_chunk_used) +#define RT_NODE_48_GET_CHILD RT_MAKE_NAME(node_48_get_child) +#define RT_NODE_256_IS_CHUNK_USED RT_MAKE_NAME(node_256_is_chunk_used) +#define RT_NODE_256_GET_CHILD RT_MAKE_NAME(node_256_get_child) +#define RT_KEY_GET_SHIFT RT_MAKE_NAME(key_get_shift) +#define RT_SHIFT_GET_MAX_VAL RT_MAKE_NAME(shift_get_max_val) +#define RT_NODE_SEARCH RT_MAKE_NAME(node_search) +#define RT_NODE_DELETE RT_MAKE_NAME(node_delete) +#define RT_NODE_INSERT RT_MAKE_NAME(node_insert) +#define RT_ADD_CHILD_4 RT_MAKE_NAME(add_child_4) +#define RT_ADD_CHILD_16 RT_MAKE_NAME(add_child_16) +#define RT_ADD_CHILD_48 RT_MAKE_NAME(add_child_48) +#define RT_ADD_CHILD_256 RT_MAKE_NAME(add_child_256) +#define RT_GROW_NODE_4 RT_MAKE_NAME(grow_node_4) +#define RT_GROW_NODE_16 RT_MAKE_NAME(grow_node_16) +#define RT_GROW_NODE_48 RT_MAKE_NAME(grow_node_48) +#define RT_REMOVE_CHILD_4 RT_MAKE_NAME(remove_child_4) +#define RT_REMOVE_CHILD_16 RT_MAKE_NAME(remove_child_16) +#define RT_REMOVE_CHILD_48 RT_MAKE_NAME(remove_child_48) +#define RT_REMOVE_CHILD_256 RT_MAKE_NAME(remove_child_256) +#define RT_SHRINK_NODE_16 RT_MAKE_NAME(shrink_child_16) +#define RT_SHRINK_NODE_48 RT_MAKE_NAME(shrink_child_48) +#define RT_SHRINK_NODE_256 RT_MAKE_NAME(shrink_child_256) +#define RT_NODE_ITERATE_NEXT RT_MAKE_NAME(node_iterate_next) +#define RT_VERIFY_NODE RT_MAKE_NAME(verify_node) + +/* type declarations */ +#define RT_RADIX_TREE RT_MAKE_NAME(radix_tree) +#define RT_RADIX_TREE_CONTROL RT_MAKE_NAME(radix_tree_control) +#define RT_ITER RT_MAKE_NAME(iter) +#ifdef RT_SHMEM +#define RT_HANDLE RT_MAKE_NAME(handle) +#endif +#define RT_NODE RT_MAKE_NAME(node) +#define RT_CHILD_PTR RT_MAKE_NAME(child_ptr) +#define RT_NODE_ITER RT_MAKE_NAME(node_iter) +#define RT_NODE_4 RT_MAKE_NAME(node_4) +#define RT_NODE_16 RT_MAKE_NAME(node_16) +#define RT_NODE_48 RT_MAKE_NAME(node_48) +#define RT_NODE_256 RT_MAKE_NAME(node_256) +#define RT_SIZE_CLASS RT_MAKE_NAME(size_class) +#define RT_SIZE_CLASS_ELEM RT_MAKE_NAME(size_class_elem) +#define RT_SIZE_CLASS_INFO RT_MAKE_NAME(size_class_info) +#define RT_CLASS_4 RT_MAKE_NAME(class_4) +#define RT_CLASS_16_LO RT_MAKE_NAME(class_32_min) +#define RT_CLASS_16_HI RT_MAKE_NAME(class_32_max) +#define RT_CLASS_48 RT_MAKE_NAME(class_48) +#define RT_CLASS_256 RT_MAKE_NAME(class_256) + +/* generate forward declarations necessary to use the radix tree */ +#ifdef RT_DECLARE + +typedef struct RT_RADIX_TREE RT_RADIX_TREE; +typedef struct RT_ITER RT_ITER; + +#ifdef RT_SHMEM +typedef dsa_pointer RT_HANDLE; +#endif + +#ifdef RT_SHMEM +RT_SCOPE RT_RADIX_TREE *RT_CREATE(MemoryContext ctx, dsa_area *dsa, int tranche_id); +RT_SCOPE RT_RADIX_TREE *RT_ATTACH(dsa_area *dsa, dsa_pointer dp); +RT_SCOPE void RT_DETACH(RT_RADIX_TREE * tree); +RT_SCOPE RT_HANDLE RT_GET_HANDLE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_LOCK_EXCLUSIVE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_LOCK_SHARE(RT_RADIX_TREE * tree); +RT_SCOPE void RT_UNLOCK(RT_RADIX_TREE * tree); +#else +RT_SCOPE RT_RADIX_TREE *RT_CREATE(MemoryContext ctx); +#endif +RT_SCOPE void RT_FREE(RT_RADIX_TREE * tree); + +RT_SCOPE RT_VALUE_TYPE *RT_FIND(RT_RADIX_TREE * tree, uint64 key); +RT_SCOPE bool RT_SET(RT_RADIX_TREE * tree, uint64 key, RT_VALUE_TYPE * value_p); + +#ifdef RT_USE_DELETE +RT_SCOPE bool RT_DELETE(RT_RADIX_TREE * tree, uint64 key); +#endif + +RT_SCOPE RT_ITER *RT_BEGIN_ITERATE(RT_RADIX_TREE * tree); +RT_SCOPE RT_VALUE_TYPE *RT_ITERATE_NEXT(RT_ITER * iter, uint64 *key_p); +RT_SCOPE void RT_END_ITERATE(RT_ITER * iter); + +RT_SCOPE uint64 RT_MEMORY_USAGE(RT_RADIX_TREE * tree); + +#ifdef RT_DEBUG +RT_SCOPE void RT_STATS(RT_RADIX_TREE * tree); +#endif + +#endif /* RT_DECLARE */ + + +/* generate implementation of the radix tree */ +#ifdef RT_DEFINE + +/* The number of bits encoded in one tree level */ +#define RT_SPAN BITS_PER_BYTE + +/* + * The number of possible partial keys, and thus the maximum number of + * child pointers, for a node. + */ +#define RT_NODE_MAX_SLOTS (1 << RT_SPAN) + +/* Mask for extracting a chunk from a key */ +#define RT_CHUNK_MASK ((1 << RT_SPAN) - 1) + +/* Maximum shift needed to extract a chunk from a key */ +#define RT_MAX_SHIFT RT_KEY_GET_SHIFT(UINT64_MAX) + +/* Maximum level a tree can reach for a key */ +#define RT_MAX_LEVEL ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN) + +/* Get a chunk from the key */ +#define RT_GET_KEY_CHUNK(key, shift) ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK)) + +/* For accessing bitmaps */ +#define RT_BM_IDX(x) ((x) / BITS_PER_BITMAPWORD) +#define RT_BM_BIT(x) ((x) % BITS_PER_BITMAPWORD) + +/* + * Node kinds + * + * The different node kinds are what make the tree "adaptive". + * + * Each node kind is associated with a different datatype and different + * search/set/delete/iterate algorithms adapted for its size. The largest + * kind, node256 is basically the same as a traditional radix tree, + * and would be most wasteful of memory when sparsely populated. The + * smaller nodes expend some additional CPU time to enable a smaller + * memory footprint. + * + * NOTE: There are 4 node kinds, and this should never be increased, + * for several reasons: + * 1. With 5 or more kinds, gcc tends to use a jump table for switch + * statements. + * 2. The 4 kinds can be represented with 2 bits, so we have the option + * in the future to tag the node pointer with the kind, even on + * platforms with 32-bit pointers. That would touch fewer cache lines + * during traversal and allow faster recovery from branch mispredicts. + * 3. We can have multiple size classes per node kind. + */ +#define RT_NODE_KIND_4 0x00 +#define RT_NODE_KIND_16 0x01 +#define RT_NODE_KIND_48 0x02 +#define RT_NODE_KIND_256 0x03 +#define RT_NODE_KIND_COUNT 4 + +/* + * Calculate the slab block size so that we can allocate at least 32 chunks + * from the block. + */ +#define RT_SLAB_BLOCK_SIZE(size) \ + Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32)) + +/* Common header for all nodes */ +typedef struct RT_NODE +{ + /* Node kind, one per search/set algorithm */ + uint8 kind; + + /* + * Max capacity for the current size class. Storing this in the node + * enables multiple size classes per node kind. uint8 is sufficient for + * all node kinds, because we only use this number to test if the node + * needs to grow. Since node256 never needs to grow, we let this overflow + * to zero. + */ + uint8 fanout; + + /* + * Number of children. uint8 is sufficient for all node kinds, because + * nodes shrink when this number gets lower than some threshold. Since + * node256 cannot possibly have zero children, we let the counter overflow + * and we interpret zero as "256" for this node kind. + */ + uint8 count; +} RT_NODE; + + +/* pointer returned by allocation */ +#ifdef RT_SHMEM +#define RT_PTR_ALLOC dsa_pointer +#define RT_INVALID_PTR_ALLOC InvalidDsaPointer +#define RT_PTR_ALLOC_IS_VALID(ptr) DsaPointerIsValid(ptr) +#else +#define RT_PTR_ALLOC RT_NODE * +#define RT_INVALID_PTR_ALLOC NULL +#define RT_PTR_ALLOC_IS_VALID(ptr) PointerIsValid(ptr) +#endif + +/* + * A convenience type used when we need to work with a DSA pointer as well + * as its local pointer. For local memory, both members are the same, so + * we use a union. + */ +#ifdef RT_SHMEM +typedef struct RT_CHILD_PTR +#else +typedef union RT_CHILD_PTR +#endif +{ + RT_PTR_ALLOC alloc; + RT_NODE *local; +} RT_CHILD_PTR; + + +/* + * Helper macros and functions for value storage. + * We either embed values in the child slots of the last level + * node or store pointers to values to the child slots, + * depending on the value size. + */ + +#ifdef RT_VARLEN_VALUE_SIZE +#define RT_GET_VALUE_SIZE(v) RT_VARLEN_VALUE_SIZE(v) +#else +#define RT_GET_VALUE_SIZE(v) sizeof(RT_VALUE_TYPE) +#endif + +/* + * Return true if the value can be stored in the child array + * of the lowest-level node, false otherwise. + */ +static inline bool +RT_VALUE_IS_EMBEDDABLE(RT_VALUE_TYPE * value_p) +{ +#ifdef RT_VARLEN_VALUE_SIZE + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC); +#else + return false; +#endif + +#else + return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC); +#endif +} + +/* + * Return true if the child pointer contains the value, false + * if the child pointer is a leaf pointer. + */ +static inline bool +RT_CHILDPTR_IS_VALUE(RT_PTR_ALLOC child) +{ +#ifdef RT_VARLEN_VALUE_SIZE + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + /* check for pointer tag */ +#ifdef RT_SHMEM + return child & 1; +#else + return ((uintptr_t) child) & 1; +#endif + +#else + return false; +#endif + +#else + return sizeof(RT_VALUE_TYPE) <= sizeof(RT_PTR_ALLOC); +#endif +} + +/* + * Symbols for maximum possible fanout are declared first as they are + * required to declare each node kind. The declarations of other fanout + * values are followed as they need the struct sizes of each node kind. + */ + +/* max possible key chunks without struct padding */ +#define RT_FANOUT_4_MAX (8 - sizeof(RT_NODE)) + +/* equal to two 128-bit SIMD registers, regardless of availability */ +#define RT_FANOUT_16_MAX 32 + +/* + * This also determines the number of bits necessary for the isset array, + * so we need to be mindful of the size of bitmapword. Since bitmapword + * can be 64 bits, the only values that make sense here are 64 and 128. + * The ART paper uses at most 64 for this node kind, and one advantage + * for us is that "isset" is a single bitmapword on most platforms, + * rather than an array, allowing the compiler to get rid of loops. + */ +#define RT_FANOUT_48_MAX 64 + +#define RT_FANOUT_256 RT_NODE_MAX_SLOTS + +/* + * Node structs, one for each "kind" + */ + +/* + * node4 and node16 use one array for key chunks and another + * array of the same length for children. The keys and children + * are stored at corresponding positions, sorted by chunk. + */ + +typedef struct RT_NODE_4 +{ + RT_NODE base; + + uint8 chunks[RT_FANOUT_4_MAX]; + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_4; + +typedef struct RT_NODE_16 +{ + RT_NODE base; + + uint8 chunks[RT_FANOUT_16_MAX]; + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_16; + +/* + * node48 uses a 256-element array indexed by key chunks. This array + * stores indexes into a second array containing the children. + */ +typedef struct RT_NODE_48 +{ + RT_NODE base; + + /* bitmap to track which slots are in use */ + bitmapword isset[RT_BM_IDX(RT_FANOUT_48_MAX)]; + + /* + * Lookup table for indexes into the children[] array. We make this the + * last fixed-size member so that it's convenient to memset separately + * from the previous members. + */ + uint8 slot_idxs[RT_NODE_MAX_SLOTS]; + +/* Invalid index */ +#define RT_INVALID_SLOT_IDX 0xFF + + /* number of children depends on size class */ + RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]; +} RT_NODE_48; + +/* + * node256 is the largest node type. This node has an array of + * children directly indexed by chunk. Unlike other node kinds, + * its array size is by definition fixed. + */ +typedef struct RT_NODE_256 +{ + RT_NODE base; + + /* bitmap to track which slots are in use */ + bitmapword isset[RT_BM_IDX(RT_FANOUT_256)]; + + /* slots for 256 children */ + RT_PTR_ALLOC children[RT_FANOUT_256]; +} RT_NODE_256; + +#if defined(RT_SHMEM) +/* + * Make sure the all nodes (except for node256) fit neatly into a DSA + * size class. We assume the RT_FANOUT_4 is in the range where DSA size + * classes increment by 8 (as of PG17 up to 64 bytes), so we just hard + * code that one. + */ + +#if SIZEOF_DSA_POINTER < 8 +#define RT_FANOUT_16_LO ((96 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (512 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC)) +#else +#define RT_FANOUT_16_LO ((160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (320 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC)) +#define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (768 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC)) +#endif /* SIZEOF_DSA_POINTER < 8 */ + +#else /* ! RT_SHMEM */ + +/* doesn't really matter, but may as well use the namesake */ +#define RT_FANOUT_16_LO 16 +/* use maximum possible */ +#define RT_FANOUT_16_HI RT_FANOUT_16_MAX +#define RT_FANOUT_48 RT_FANOUT_48_MAX + +#endif /* RT_SHMEM */ + +/* + * To save memory in trees with sparse keys, it would make sense to have two + * size classes for the smallest kind (perhaps a high class of 5 and a low class + * of 2), but it would be more effective to utilize lazy expansion and + * path compression. + */ +#define RT_FANOUT_4 4 + +StaticAssertDecl(RT_FANOUT_4 <= RT_FANOUT_4_MAX, "watch struct padding"); +StaticAssertDecl(RT_FANOUT_16_LO < RT_FANOUT_16_HI, "LO subclass bigger than HI"); +StaticAssertDecl(RT_FANOUT_48 <= RT_FANOUT_48_MAX, "more slots than isset bits"); + +/* + * Node size classes + * + * Nodes of different kinds necessarily belong to different size classes. + * One innovation in our implementation compared to the ART paper is + * decoupling the notion of size class from kind. + * + * The size classes within a given node kind have the same underlying + * type, but a variable number of children/values. This is possible + * because each type (except node256) contains metadata that work the + * same way regardless of how many child slots there are. The nodes + * can introspect their allocated capacity at runtime. + */ +typedef enum RT_SIZE_CLASS +{ + RT_CLASS_4 = 0, + RT_CLASS_16_LO, + RT_CLASS_16_HI, + RT_CLASS_48, + RT_CLASS_256 +} RT_SIZE_CLASS; + +/* Information for each size class */ +typedef struct RT_SIZE_CLASS_ELEM +{ + const char *name; + int fanout; + size_t allocsize; +} RT_SIZE_CLASS_ELEM; + + +static const RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_INFO[] = { + [RT_CLASS_4] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node4", + .fanout = RT_FANOUT_4, + .allocsize = sizeof(RT_NODE_4) + RT_FANOUT_4 * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_16_LO] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node16_lo", + .fanout = RT_FANOUT_16_LO, + .allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_LO * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_16_HI] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node16_hi", + .fanout = RT_FANOUT_16_HI, + .allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_HI * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_48] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node48", + .fanout = RT_FANOUT_48, + .allocsize = sizeof(RT_NODE_48) + RT_FANOUT_48 * sizeof(RT_PTR_ALLOC), + }, + [RT_CLASS_256] = { + .name = RT_STR(RT_PREFIX) "_radix_tree node256", + .fanout = RT_FANOUT_256, + .allocsize = sizeof(RT_NODE_256), + }, +}; + +#define RT_NUM_SIZE_CLASSES lengthof(RT_SIZE_CLASS_INFO) + +#ifdef RT_SHMEM +/* A magic value used to identify our radix tree */ +#define RT_RADIX_TREE_MAGIC 0x54A48167 +#endif + +/* Contains the actual tree, plus ancillary info */ +typedef struct RT_RADIX_TREE_CONTROL +{ +#ifdef RT_SHMEM + RT_HANDLE handle; + uint32 magic; + LWLock lock; +#endif + + RT_PTR_ALLOC root; + uint64 max_val; + int64 num_keys; + int start_shift; + + /* statistics */ +#ifdef RT_DEBUG + int64 num_nodes[RT_NUM_SIZE_CLASSES]; + int64 num_leaves; +#endif +} RT_RADIX_TREE_CONTROL; + +/* Entry point for allocating and accessing the tree */ +struct RT_RADIX_TREE +{ + MemoryContext context; + + /* pointing to either local memory or DSA */ + RT_RADIX_TREE_CONTROL *ctl; + +#ifdef RT_SHMEM + dsa_area *dsa; +#else + MemoryContextData *node_slabs[RT_NUM_SIZE_CLASSES]; + + /* leaf_context is used only for single-value leaves */ + MemoryContextData *leaf_context; +#endif + MemoryContextData *iter_context; +}; + +/* + * Iteration support. + * + * Iterating over the radix tree produces each key/value pair in ascending + * order of the key. + */ + +/* state for iterating over a single node */ +typedef struct RT_NODE_ITER +{ + RT_CHILD_PTR node; + + /* + * The next index of the chunk array in RT_NODE_KIND_4 and RT_NODE_KIND_16 + * nodes, or the next chunk in RT_NODE_KIND_48 and RT_NODE_KIND_256 nodes. + * 0 for the initial value. + */ + int idx; +} RT_NODE_ITER; + +/* state for iterating over the whole radix tree */ +struct RT_ITER +{ + RT_RADIX_TREE *tree; + + /* + * A stack to track iteration for each level. Level 0 is the lowest (or + * leaf) level + */ + RT_NODE_ITER node_iters[RT_MAX_LEVEL]; + int top_level; + int cur_level; + + /* The key constructed during iteration */ + uint64 key; +}; + + +/* verification (available only in assert-enabled builds) */ +static void RT_VERIFY_NODE(RT_NODE * node); + +static inline void +RT_PTR_SET_LOCAL(RT_RADIX_TREE * tree, RT_CHILD_PTR * node) +{ +#ifdef RT_SHMEM + node->local = dsa_get_address(tree->dsa, node->alloc); +#endif +} + +/* Convenience functions for node48 and node256 */ + +/* Return true if there is an entry for "chunk" */ +static inline bool +RT_NODE_48_IS_CHUNK_USED(RT_NODE_48 * node, uint8 chunk) +{ + return node->slot_idxs[chunk] != RT_INVALID_SLOT_IDX; +} + +static inline RT_PTR_ALLOC * +RT_NODE_48_GET_CHILD(RT_NODE_48 * node, uint8 chunk) +{ + return &node->children[node->slot_idxs[chunk]]; +} + +/* Return true if there is an entry for "chunk" */ +static inline bool +RT_NODE_256_IS_CHUNK_USED(RT_NODE_256 * node, uint8 chunk) +{ + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + return (node->isset[idx] & ((bitmapword) 1 << bitnum)) != 0; +} + +static inline RT_PTR_ALLOC * +RT_NODE_256_GET_CHILD(RT_NODE_256 * node, uint8 chunk) +{ + Assert(RT_NODE_256_IS_CHUNK_USED(node, chunk)); + return &node->children[chunk]; +} + +/* + * Return the smallest shift that will allowing storing the given key. + */ +static inline int +RT_KEY_GET_SHIFT(uint64 key) +{ + if (key == 0) + return 0; + else + return (pg_leftmost_one_pos64(key) / RT_SPAN) * RT_SPAN; +} + +/* + * Return the max value that can be stored in the tree with the given shift. + */ +static uint64 +RT_SHIFT_GET_MAX_VAL(int shift) +{ + if (shift == RT_MAX_SHIFT) + return UINT64_MAX; + else + return (UINT64CONST(1) << (shift + RT_SPAN)) - 1; +} + +/* + * Allocate a new node with the given node kind and size class. + */ +static inline RT_CHILD_PTR +RT_ALLOC_NODE(RT_RADIX_TREE * tree, const uint8 kind, const RT_SIZE_CLASS size_class) +{ + RT_CHILD_PTR allocnode; + RT_NODE *node; + size_t allocsize; + + allocsize = RT_SIZE_CLASS_INFO[size_class].allocsize; + +#ifdef RT_SHMEM + allocnode.alloc = dsa_allocate(tree->dsa, allocsize); +#else + allocnode.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->node_slabs[size_class], + allocsize); +#endif + + RT_PTR_SET_LOCAL(tree, &allocnode); + node = allocnode.local; + + /* initialize contents */ + + switch (kind) + { + case RT_NODE_KIND_4: + memset(node, 0, offsetof(RT_NODE_4, children)); + break; + case RT_NODE_KIND_16: + memset(node, 0, offsetof(RT_NODE_16, children)); + break; + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + + memset(n48, 0, offsetof(RT_NODE_48, slot_idxs)); + memset(n48->slot_idxs, RT_INVALID_SLOT_IDX, sizeof(n48->slot_idxs)); + break; + } + case RT_NODE_KIND_256: + memset(node, 0, offsetof(RT_NODE_256, children)); + break; + default: + pg_unreachable(); + } + + node->kind = kind; + + /* + * For node256, this will actually overflow to zero, but that's okay + * because that node doesn't need to introspect this value. + */ + node->fanout = RT_SIZE_CLASS_INFO[size_class].fanout; + +#ifdef RT_DEBUG + /* update the statistics */ + tree->ctl->num_nodes[size_class]++; +#endif + + return allocnode; +} + +/* + * Allocate a new leaf. + */ +static RT_CHILD_PTR +RT_ALLOC_LEAF(RT_RADIX_TREE * tree, size_t allocsize) +{ + RT_CHILD_PTR leaf; + +#ifdef RT_SHMEM + leaf.alloc = dsa_allocate(tree->dsa, allocsize); + RT_PTR_SET_LOCAL(tree, &leaf); +#else + leaf.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->leaf_context, allocsize); +#endif + +#ifdef RT_DEBUG + tree->ctl->num_leaves++; +#endif + + return leaf; +} + +/* + * Copy relevant members of the node header. + * This is a separate function in case other fields are added. + */ +static inline void +RT_COPY_COMMON(RT_CHILD_PTR newnode, RT_CHILD_PTR oldnode) +{ + (newnode.local)->count = (oldnode.local)->count; +} + +/* Free the given node */ +static void +RT_FREE_NODE(RT_RADIX_TREE * tree, RT_CHILD_PTR node) +{ +#ifdef RT_DEBUG + int i; + + /* update the statistics */ + + for (i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + if ((node.local)->fanout == RT_SIZE_CLASS_INFO[i].fanout) + break; + } + + /* + * The fanout of node256 will appear to be zero within the node header + * because of overflow, so we need an extra check here. + */ + if (i == RT_NUM_SIZE_CLASSES) + i = RT_CLASS_256; + + tree->ctl->num_nodes[i]--; + Assert(tree->ctl->num_nodes[i] >= 0); +#endif + +#ifdef RT_SHMEM + dsa_free(tree->dsa, node.alloc); +#else + pfree(node.alloc); +#endif +} + +static inline void +RT_FREE_LEAF(RT_RADIX_TREE * tree, RT_PTR_ALLOC leaf) +{ + Assert(leaf != tree->ctl->root); + +#ifdef RT_DEBUG + /* update the statistics */ + tree->ctl->num_leaves--; + Assert(tree->ctl->num_leaves >= 0); +#endif + +#ifdef RT_SHMEM + dsa_free(tree->dsa, leaf); +#else + pfree(leaf); +#endif +} + +/***************** SEARCH *****************/ + +/* + * Return the address of the child corresponding to "chunk", + * or NULL if there is no such element. + */ +static inline RT_PTR_ALLOC * +RT_NODE_16_SEARCH_EQ(RT_NODE_16 * node, uint8 chunk) +{ + int count = node->base.count; +#ifndef USE_NO_SIMD + Vector8 spread_chunk; + Vector8 haystack1; + Vector8 haystack2; + Vector8 cmp1; + Vector8 cmp2; + uint32 bitfield; + RT_PTR_ALLOC *slot_simd = NULL; +#endif + +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + RT_PTR_ALLOC *slot = NULL; + + for (int i = 0; i < count; i++) + { + if (node->chunks[i] == chunk) + { + slot = &node->children[i]; + break; + } + } +#endif + +#ifndef USE_NO_SIMD + /* replicate the search key */ + spread_chunk = vector8_broadcast(chunk); + + /* compare to all 32 keys stored in the node */ + vector8_load(&haystack1, &node->chunks[0]); + vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]); + cmp1 = vector8_eq(spread_chunk, haystack1); + cmp2 = vector8_eq(spread_chunk, haystack2); + + /* convert comparison to a bitfield */ + bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8)); + + /* mask off invalid entries */ + bitfield &= ((UINT64CONST(1) << count) - 1); + + /* convert bitfield to index by counting trailing zeros */ + if (bitfield) + slot_simd = &node->children[pg_rightmost_one_pos32(bitfield)]; + + Assert(slot_simd == slot); + return slot_simd; +#else + return slot; +#endif +} + +/* + * Search for the child pointer corresponding to "key" in the given node. + * + * Return child if the key is found, otherwise return NULL. + */ +static inline RT_PTR_ALLOC * +RT_NODE_SEARCH(RT_NODE * node, uint8 chunk) +{ + /* Make sure we already converted to local pointer */ + Assert(node != NULL); + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + for (int i = 0; i < n4->base.count; i++) + { + if (n4->chunks[i] == chunk) + return &n4->children[i]; + } + return NULL; + } + case RT_NODE_KIND_16: + return RT_NODE_16_SEARCH_EQ((RT_NODE_16 *) node, chunk); + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + int slotpos = n48->slot_idxs[chunk]; + + if (slotpos == RT_INVALID_SLOT_IDX) + return NULL; + + return RT_NODE_48_GET_CHILD(n48, chunk); + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + + if (!RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + return NULL; + + return RT_NODE_256_GET_CHILD(n256, chunk); + } + default: + pg_unreachable(); + } +} + +/* + * Search the given key in the radix tree. Return the pointer to the value if found, + * otherwise return NULL. + * + * Since the function returns a pointer (to support variable-length values), + * the caller is responsible for locking until it's finished with the value. + */ +RT_SCOPE RT_VALUE_TYPE * +RT_FIND(RT_RADIX_TREE * tree, uint64 key) +{ + RT_CHILD_PTR node; + RT_PTR_ALLOC *slot = NULL; + int shift; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + if (key > tree->ctl->max_val) + return NULL; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + node.alloc = tree->ctl->root; + shift = tree->ctl->start_shift; + + /* Descend the tree */ + while (shift >= 0) + { + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, RT_GET_KEY_CHUNK(key, shift)); + if (slot == NULL) + return NULL; + + node.alloc = *slot; + shift -= RT_SPAN; + } + + if (RT_CHILDPTR_IS_VALUE(*slot)) + return (RT_VALUE_TYPE *) slot; + else + { + RT_PTR_SET_LOCAL(tree, &node); + return (RT_VALUE_TYPE *) node.local; + } +} + +/***************** INSERTION *****************/ + +#define RT_NODE_MUST_GROW(node) \ + ((node)->count == (node)->fanout) + +/* + * Return index of the chunk and slot arrays for inserting into the node, + * such that the arrays remain ordered. + */ +static inline int +RT_NODE_4_GET_INSERTPOS(RT_NODE_4 * node, uint8 chunk, int count) +{ + int idx; + + for (idx = 0; idx < count; idx++) + { + if (node->chunks[idx] >= chunk) + break; + } + + return idx; +} + +/* + * Return index of the chunk and slot arrays for inserting into the node, + * such that the arrays remain ordered. + */ +static inline int +RT_NODE_16_GET_INSERTPOS(RT_NODE_16 * node, uint8 chunk) +{ + int count = node->base.count; +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + int index; +#endif + +#ifndef USE_NO_SIMD + Vector8 spread_chunk; + Vector8 haystack1; + Vector8 haystack2; + Vector8 cmp1; + Vector8 cmp2; + Vector8 min1; + Vector8 min2; + uint32 bitfield; + int index_simd; +#endif + + /* + * First compare the last element. There are two reasons to branch here: + * + * 1) A realistic pattern is inserting ordered keys. In that case, + * non-SIMD platforms must do a linear search to the last chunk to find + * the insert position. This will get slower as the node fills up. + * + * 2) On SIMD platforms, we must branch anyway to make sure we don't bit + * scan an empty bitfield. Doing the branch here eliminates some work that + * we might otherwise throw away. + */ + Assert(count > 0); + if (node->chunks[count - 1] < chunk) + return count; + +#if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING) + + for (index = 0; index < count; index++) + { + if (node->chunks[index] > chunk) + break; + } +#endif + +#ifndef USE_NO_SIMD + + /* + * This is a bit more complicated than RT_NODE_16_SEARCH_EQ(), because no + * unsigned uint8 comparison instruction exists, at least for SSE2. So we + * need to play some trickery using vector8_min() to effectively get >=. + * There'll never be any equal elements in current uses, but that's what + * we get here... + */ + spread_chunk = vector8_broadcast(chunk); + vector8_load(&haystack1, &node->chunks[0]); + vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]); + min1 = vector8_min(spread_chunk, haystack1); + min2 = vector8_min(spread_chunk, haystack2); + cmp1 = vector8_eq(spread_chunk, min1); + cmp2 = vector8_eq(spread_chunk, min2); + bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8)); + + Assert((bitfield & ((UINT64CONST(1) << count) - 1)) != 0); + index_simd = pg_rightmost_one_pos32(bitfield); + + Assert(index_simd == index); + return index_simd; +#else + return index; +#endif +} + +/* Shift the elements right at "insertpos" by one */ +static inline void +RT_SHIFT_ARRAYS_FOR_INSERT(uint8 *chunks, RT_PTR_ALLOC * children, int count, int insertpos) +{ + /* + * This is basically a memmove, but written in a simple loop for speed on + * small inputs. + */ + for (int i = count - 1; i >= insertpos; i--) + { + /* workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101481 */ +#ifdef __GNUC__ + __asm__(""); +#endif + chunks[i + 1] = chunks[i]; + children[i + 1] = children[i]; + } +} + +/* + * Copy both chunk and slot arrays into the right + * place. The caller is responsible for inserting the new element. + */ +static inline void +RT_COPY_ARRAYS_FOR_INSERT(uint8 *dst_chunks, RT_PTR_ALLOC * dst_children, + uint8 *src_chunks, RT_PTR_ALLOC * src_children, + int count, int insertpos) +{ + for (int i = 0; i < count; i++) + { + int sourceidx = i; + + /* use a branch-free computation to skip the index of the new element */ + int destidx = i + (i >= insertpos); + + dst_chunks[destidx] = src_chunks[sourceidx]; + dst_children[destidx] = src_children[sourceidx]; + } +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_256(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + /* Mark the slot used for "chunk" */ + n256->isset[idx] |= ((bitmapword) 1 << bitnum); + + n256->base.count++; + RT_VERIFY_NODE((RT_NODE *) n256); + + return RT_NODE_256_GET_CHILD(n256, chunk); +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + RT_CHILD_PTR newnode; + RT_NODE_256 *new256; + int i = 0; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_256, RT_CLASS_256); + new256 = (RT_NODE_256 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int word_num = 0; word_num < RT_BM_IDX(RT_NODE_MAX_SLOTS); word_num++) + { + bitmapword bitmap = 0; + + /* + * Bit manipulation is a surprisingly large portion of the overhead in + * the naive implementation. Doing stores word-at-a-time removes a lot + * of that overhead. + */ + for (int bit = 0; bit < BITS_PER_BITMAPWORD; bit++) + { + uint8 offset = n48->slot_idxs[i]; + + if (offset != RT_INVALID_SLOT_IDX) + { + bitmap |= ((bitmapword) 1 << bit); + new256->children[i] = n48->children[offset]; + } + + i++; + } + + new256->isset[word_num] = bitmap; + } + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return RT_ADD_CHILD_256(tree, newnode, chunk); +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_48(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + int insertpos; + int idx = 0; + bitmapword w, + inverse; + + /* get the first word with at least one bit not set */ + for (int i = 0; i < RT_BM_IDX(RT_FANOUT_48_MAX); i++) + { + w = n48->isset[i]; + if (w < ~((bitmapword) 0)) + { + idx = i; + break; + } + } + + /* To get the first unset bit in w, get the first set bit in ~w */ + inverse = ~w; + insertpos = idx * BITS_PER_BITMAPWORD; + insertpos += bmw_rightmost_one_pos(inverse); + Assert(insertpos < n48->base.fanout); + + /* mark the slot used by setting the rightmost zero bit */ + n48->isset[idx] |= w + 1; + + /* insert new chunk into place */ + n48->slot_idxs[chunk] = insertpos; + + n48->base.count++; + RT_VERIFY_NODE((RT_NODE *) n48); + + return &n48->children[insertpos]; +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int insertpos; + + if (n16->base.fanout < RT_FANOUT_16_HI) + { + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + + Assert(n16->base.fanout == RT_FANOUT_16_LO); + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_HI); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over existing entries */ + RT_COPY_COMMON(newnode, node); + Assert(n16->base.count == RT_FANOUT_16_LO); + insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk); + RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children, + n16->chunks, n16->children, + RT_FANOUT_16_LO, insertpos); + + /* insert new chunk into place */ + new16->chunks[insertpos] = chunk; + + new16->base.count++; + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update references */ + RT_FREE_NODE(tree, node); + *parent_slot = newnode.alloc; + + return &new16->children[insertpos]; + } + else + { + RT_CHILD_PTR newnode; + RT_NODE_48 *new48; + int idx, + bit; + + Assert(n16->base.fanout == RT_FANOUT_16_HI); + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_48, RT_CLASS_48); + new48 = (RT_NODE_48 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int i = 0; i < RT_FANOUT_16_HI; i++) + new48->slot_idxs[n16->chunks[i]] = i; + memcpy(&new48->children[0], &n16->children[0], RT_FANOUT_16_HI * sizeof(new48->children[0])); + + /* + * Since we just copied a dense array, we can fill "isset" using a + * single store, provided the length of that array is at most the + * number of bits in a bitmapword. + */ + Assert(RT_FANOUT_16_HI <= BITS_PER_BITMAPWORD); + new48->isset[0] = (bitmapword) (((uint64) 1 << RT_FANOUT_16_HI) - 1); + + /* put the new child at the end of the copied entries */ + insertpos = RT_FANOUT_16_HI; + idx = RT_BM_IDX(insertpos); + bit = RT_BM_BIT(insertpos); + + /* mark the slot used */ + new48->isset[idx] |= ((bitmapword) 1 << bit); + + /* insert new chunk into place */ + new48->slot_idxs[chunk] = insertpos; + + new48->base.count++; + RT_VERIFY_NODE((RT_NODE *) new48); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return &new48->children[insertpos]; + } +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_16(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk); + + /* shift chunks and children */ + RT_SHIFT_ARRAYS_FOR_INSERT(n16->chunks, n16->children, + n16->base.count, insertpos); + + /* insert new chunk into place */ + n16->chunks[insertpos] = chunk; + + n16->base.count++; + RT_VERIFY_NODE((RT_NODE *) n16); + + return &n16->children[insertpos]; +} + +static pg_noinline RT_PTR_ALLOC * +RT_GROW_NODE_4(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + int insertpos; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_LO); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over existing entries */ + RT_COPY_COMMON(newnode, node); + Assert(n4->base.count == RT_FANOUT_4); + insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, RT_FANOUT_4); + RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children, + n4->chunks, n4->children, + RT_FANOUT_4, insertpos); + + /* insert new chunk into place */ + new16->chunks[insertpos] = chunk; + + new16->base.count++; + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); + + return &new16->children[insertpos]; +} + +static inline RT_PTR_ALLOC * +RT_ADD_CHILD_4(RT_RADIX_TREE * tree, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + int count = n4->base.count; + int insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, count); + + /* shift chunks and children */ + RT_SHIFT_ARRAYS_FOR_INSERT(n4->chunks, n4->children, + count, insertpos); + + /* insert new chunk into place */ + n4->chunks[insertpos] = chunk; + + n4->base.count++; + RT_VERIFY_NODE((RT_NODE *) n4); + + return &n4->children[insertpos]; +} + +/* + * Reserve slot in "node"'s child array. The caller will populate it + * with the actual child pointer. + * + * "parent_slot" is the address of the parent's child pointer to "node". + * If the node we're inserting into needs to grow, we update the parent's + * child pointer with the pointer to the new larger node. + */ +static inline RT_PTR_ALLOC * +RT_NODE_INSERT(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, + uint8 chunk) +{ + RT_NODE *n = node.local; + + switch (n->kind) + { + case RT_NODE_KIND_4: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_4(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_4(tree, node, chunk); + } + case RT_NODE_KIND_16: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_16(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_16(tree, node, chunk); + } + case RT_NODE_KIND_48: + { + if (unlikely(RT_NODE_MUST_GROW(n))) + return RT_GROW_NODE_48(tree, parent_slot, node, chunk); + + return RT_ADD_CHILD_48(tree, node, chunk); + } + case RT_NODE_KIND_256: + return RT_ADD_CHILD_256(tree, node, chunk); + default: + pg_unreachable(); + } +} + +/* + * The radix tree doesn't have sufficient height. Put new node(s) on top, + * and move the old node below it. + */ +static pg_noinline void +RT_EXTEND_UP(RT_RADIX_TREE * tree, uint64 key) +{ + int target_shift = RT_KEY_GET_SHIFT(key); + int shift = tree->ctl->start_shift; + + Assert(shift < target_shift); + + /* Grow tree upwards until start shift can accommodate the key */ + while (shift < target_shift) + { + RT_CHILD_PTR node; + RT_NODE_4 *n4; + + node = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = 0; + n4->children[0] = tree->ctl->root; + + /* Update the root */ + tree->ctl->root = node.alloc; + + shift += RT_SPAN; + } + + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(target_shift); + tree->ctl->start_shift = target_shift; +} + +/* + * Insert a chain of nodes until we reach the lowest level, + * and return the address of a slot to be filled further up + * the call stack. + */ +static pg_noinline RT_PTR_ALLOC * +RT_EXTEND_DOWN(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift) +{ + RT_CHILD_PTR node, + child; + RT_NODE_4 *n4; + + /* + * The child pointer of the first node in the chain goes in the + * caller-provided slot. + */ + child = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + *parent_slot = child.alloc; + + node = child; + shift -= RT_SPAN; + + while (shift > 0) + { + child = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + + /* We open-code the insertion ourselves, for speed. */ + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, shift); + n4->children[0] = child.alloc; + + node = child; + shift -= RT_SPAN; + } + Assert(shift == 0); + + /* Reserve slot for the value. */ + n4 = (RT_NODE_4 *) node.local; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, 0); + n4->base.count = 1; + + return &n4->children[0]; +} + +/* + * Workhorse for RT_SET + * + * "parent_slot" is the address of the child pointer we just followed, + * in the parent's array of children, needed if inserting into the + * current node causes it to grow. + */ +static RT_PTR_ALLOC * +RT_GET_SLOT_RECURSIVE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift, bool *found) +{ + RT_PTR_ALLOC *slot; + RT_CHILD_PTR node; + uint8 chunk = RT_GET_KEY_CHUNK(key, shift); + + node.alloc = *parent_slot; + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, chunk); + + if (slot == NULL) + { + *found = false; + + /* reserve slot for the caller to populate */ + + slot = RT_NODE_INSERT(tree, parent_slot, node, chunk); + + if (shift == 0) + return slot; + else + return RT_EXTEND_DOWN(tree, slot, key, shift); + } + else + { + if (shift == 0) + { + *found = true; + return slot; + } + else + return RT_GET_SLOT_RECURSIVE(tree, slot, key, shift - RT_SPAN, found); + } +} + +/* + * Set key to value that value_p points to. If the entry already exists, we + * update its value and return true. Returns false if entry doesn't yet exist. + * + * Taking a lock in exclusive mode is the caller's responsibility. + */ +RT_SCOPE bool +RT_SET(RT_RADIX_TREE * tree, uint64 key, RT_VALUE_TYPE * value_p) +{ + bool found; + RT_PTR_ALLOC *slot; + size_t value_sz = RT_GET_VALUE_SIZE(value_p); + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + + /* Extend the tree if necessary */ + if (unlikely(key > tree->ctl->max_val)) + { + if (tree->ctl->num_keys == 0) + { + RT_CHILD_PTR node; + RT_NODE_4 *n4; + int start_shift = RT_KEY_GET_SHIFT(key); + + /* + * With an empty root node, we don't extend the tree upwards, + * since that would result in orphan empty nodes. Instead we open + * code inserting into the root node and extend downward from + * there. + */ + node.alloc = tree->ctl->root; + RT_PTR_SET_LOCAL(tree, &node); + n4 = (RT_NODE_4 *) node.local; + n4->base.count = 1; + n4->chunks[0] = RT_GET_KEY_CHUNK(key, start_shift); + + slot = RT_EXTEND_DOWN(tree, &n4->children[0], key, start_shift); + found = false; + tree->ctl->start_shift = start_shift; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(start_shift); + goto have_slot; + } + else + RT_EXTEND_UP(tree, key); + } + + slot = RT_GET_SLOT_RECURSIVE(tree, &tree->ctl->root, + key, tree->ctl->start_shift, &found); + +have_slot: + Assert(slot != NULL); + + if (RT_VALUE_IS_EMBEDDABLE(value_p)) + { + /* free the existing leaf */ + if (found && !RT_CHILDPTR_IS_VALUE(*slot)) + RT_FREE_LEAF(tree, *slot); + + /* store value directly in child pointer slot */ + memcpy(slot, value_p, value_sz); + +#ifdef RT_RUNTIME_EMBEDDABLE_VALUE + /* tag child pointer */ +#ifdef RT_SHMEM + *slot |= 1; +#else + *((uintptr_t *) slot) |= 1; +#endif +#endif + } + else + { + RT_CHILD_PTR leaf; + + if (found && !RT_CHILDPTR_IS_VALUE(*slot)) + { + Assert(RT_PTR_ALLOC_IS_VALID(*slot)); + leaf.alloc = *slot; + RT_PTR_SET_LOCAL(tree, &leaf); + + if (RT_GET_VALUE_SIZE((RT_VALUE_TYPE *) leaf.local) != value_sz) + { + /* + * different sizes, so first free the existing leaf before + * allocating a new one + */ + RT_FREE_LEAF(tree, *slot); + leaf = RT_ALLOC_LEAF(tree, value_sz); + *slot = leaf.alloc; + } + } + else + { + /* allocate new leaf and store it in the child array */ + leaf = RT_ALLOC_LEAF(tree, value_sz); + *slot = leaf.alloc; + } + + memcpy(leaf.local, value_p, value_sz); + } + + /* Update the statistics */ + if (!found) + tree->ctl->num_keys++; + + return found; +} + +/***************** SETUP / TEARDOWN *****************/ + +/* + * Create the radix tree in the given memory context and return it. + * + * All local memory required for a radix tree is allocated in the given + * memory context and its children. Note that RT_FREE() will delete all + * allocated space within the given memory context, so the dsa_area should + * be created in a different context. + */ +RT_SCOPE RT_RADIX_TREE * +#ifdef RT_SHMEM +RT_CREATE(MemoryContext ctx, dsa_area *dsa, int tranche_id) +#else +RT_CREATE(MemoryContext ctx) +#endif +{ + RT_RADIX_TREE *tree; + MemoryContext old_ctx; + RT_CHILD_PTR rootnode; +#ifdef RT_SHMEM + dsa_pointer dp; +#endif + + old_ctx = MemoryContextSwitchTo(ctx); + + tree = (RT_RADIX_TREE *) palloc0(sizeof(RT_RADIX_TREE)); + tree->context = ctx; + + /* + * Separate context for iteration in case the tree context doesn't support + * pfree + */ + tree->iter_context = AllocSetContextCreate(ctx, + RT_STR(RT_PREFIX) "_radix_tree iter context", + ALLOCSET_SMALL_SIZES); + +#ifdef RT_SHMEM + tree->dsa = dsa; + dp = dsa_allocate0(dsa, sizeof(RT_RADIX_TREE_CONTROL)); + tree->ctl = (RT_RADIX_TREE_CONTROL *) dsa_get_address(dsa, dp); + tree->ctl->handle = dp; + tree->ctl->magic = RT_RADIX_TREE_MAGIC; + LWLockInitialize(&tree->ctl->lock, tranche_id); +#else + tree->ctl = (RT_RADIX_TREE_CONTROL *) palloc0(sizeof(RT_RADIX_TREE_CONTROL)); + + /* Create a slab context for each size class */ + for (int i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i]; + size_t inner_blocksize = RT_SLAB_BLOCK_SIZE(size_class.allocsize); + + tree->node_slabs[i] = SlabContextCreate(ctx, + size_class.name, + inner_blocksize, + size_class.allocsize); + } + + /* By default we use the passed context for leaves. */ + tree->leaf_context = tree->context; + +#ifndef RT_VARLEN_VALUE_SIZE + + /* + * For leaves storing fixed-length values, we use a slab context to avoid + * the possibility of space wastage by power-of-2 rounding up. + */ + if (sizeof(RT_VALUE_TYPE) > sizeof(RT_PTR_ALLOC)) + tree->leaf_context = SlabContextCreate(ctx, + RT_STR(RT_PREFIX) "_radix_tree leaf context", + RT_SLAB_BLOCK_SIZE(sizeof(RT_VALUE_TYPE)), + sizeof(RT_VALUE_TYPE)); +#endif /* !RT_VARLEN_VALUE_SIZE */ +#endif /* RT_SHMEM */ + + /* add root node now so that RT_SET can assume it exists */ + rootnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + tree->ctl->root = rootnode.alloc; + tree->ctl->start_shift = 0; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(0); + + MemoryContextSwitchTo(old_ctx); + + return tree; +} + +#ifdef RT_SHMEM +RT_SCOPE RT_RADIX_TREE * +RT_ATTACH(dsa_area *dsa, RT_HANDLE handle) +{ + RT_RADIX_TREE *tree; + dsa_pointer control; + + tree = (RT_RADIX_TREE *) palloc0(sizeof(RT_RADIX_TREE)); + tree->context = CurrentMemoryContext; + + /* Find the control object in shared memory */ + control = handle; + + tree->dsa = dsa; + tree->ctl = (RT_RADIX_TREE_CONTROL *) dsa_get_address(dsa, control); + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + + /* + * Create the iteration context so that the attached backend also can + * begin the iteration. + */ + tree->iter_context = AllocSetContextCreate(CurrentMemoryContext, + RT_STR(RT_PREFIX) "_radix_tree iter context", + ALLOCSET_SMALL_SIZES); + + return tree; +} + +RT_SCOPE void +RT_DETACH(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + MemoryContextDelete(tree->iter_context); + pfree(tree); +} + +RT_SCOPE RT_HANDLE +RT_GET_HANDLE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + return tree->ctl->handle; +} + +RT_SCOPE void +RT_LOCK_EXCLUSIVE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockAcquire(&tree->ctl->lock, LW_EXCLUSIVE); +} + +RT_SCOPE void +RT_LOCK_SHARE(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockAcquire(&tree->ctl->lock, LW_SHARED); +} + +RT_SCOPE void +RT_UNLOCK(RT_RADIX_TREE * tree) +{ + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + LWLockRelease(&tree->ctl->lock); +} + +/* + * Recursively free all nodes allocated in the DSA area. + */ +static void +RT_FREE_RECURSE(RT_RADIX_TREE * tree, RT_PTR_ALLOC ptr, int shift) +{ + RT_CHILD_PTR node; + + check_stack_depth(); + + node.alloc = ptr; + RT_PTR_SET_LOCAL(tree, &node); + + switch (node.local->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node.local; + + for (int i = 0; i < n4->base.count; i++) + { + RT_PTR_ALLOC child = n4->children[i]; + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + + for (int i = 0; i < n16->base.count; i++) + { + RT_PTR_ALLOC child = n16->children[i]; + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + RT_PTR_ALLOC child; + + if (!RT_NODE_48_IS_CHUNK_USED(n48, i)) + continue; + + child = *RT_NODE_48_GET_CHILD(n48, i); + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + RT_PTR_ALLOC child; + + if (!RT_NODE_256_IS_CHUNK_USED(n256, i)) + continue; + + child = *RT_NODE_256_GET_CHILD(n256, i); + + if (shift > 0) + RT_FREE_RECURSE(tree, child, shift - RT_SPAN); + else if (!RT_CHILDPTR_IS_VALUE(child)) + dsa_free(tree->dsa, child); + } + + break; + } + } + + /* Free the inner node */ + dsa_free(tree->dsa, ptr); +} +#endif + +/* + * Free the radix tree, including all nodes and leaves. + */ +RT_SCOPE void +RT_FREE(RT_RADIX_TREE * tree) +{ +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + + /* Free all memory used for radix tree nodes */ + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + RT_FREE_RECURSE(tree, tree->ctl->root, tree->ctl->start_shift); + + /* + * Vandalize the control block to help catch programming error where other + * backends access the memory formerly occupied by this radix tree. + */ + tree->ctl->magic = 0; + dsa_free(tree->dsa, tree->ctl->handle); +#endif + + /* + * Free all space allocated within the tree's context and delete all child + * contexts such as those used for nodes. + */ + MemoryContextReset(tree->context); +} + +/***************** ITERATION *****************/ + +/* + * Create and return the iterator for the given radix tree. + * + * Taking a lock in shared mode during the iteration is the caller's + * responsibility. + */ +RT_SCOPE RT_ITER * +RT_BEGIN_ITERATE(RT_RADIX_TREE * tree) +{ + RT_ITER *iter; + RT_CHILD_PTR root; + + iter = (RT_ITER *) MemoryContextAllocZero(tree->iter_context, + sizeof(RT_ITER)); + iter->tree = tree; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + root.alloc = iter->tree->ctl->root; + RT_PTR_SET_LOCAL(tree, &root); + + iter->top_level = iter->tree->ctl->start_shift / RT_SPAN; + + /* Set the root to start */ + iter->cur_level = iter->top_level; + iter->node_iters[iter->cur_level].node = root; + iter->node_iters[iter->cur_level].idx = 0; + + return iter; +} + +/* + * Scan the inner node and return the next child pointer if one exists, otherwise + * return NULL. + */ +static inline RT_PTR_ALLOC * +RT_NODE_ITERATE_NEXT(RT_ITER * iter, int level) +{ + uint8 key_chunk = 0; + RT_NODE_ITER *node_iter; + RT_CHILD_PTR node; + RT_PTR_ALLOC *slot = NULL; + +#ifdef RT_SHMEM + Assert(iter->tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + node_iter = &(iter->node_iters[level]); + node = node_iter->node; + + Assert(node.local != NULL); + + switch ((node.local)->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local); + + if (node_iter->idx >= n4->base.count) + return NULL; + + slot = &n4->children[node_iter->idx]; + key_chunk = n4->chunks[node_iter->idx]; + node_iter->idx++; + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) (node.local); + + if (node_iter->idx >= n16->base.count) + return NULL; + + slot = &n16->children[node_iter->idx]; + key_chunk = n16->chunks[node_iter->idx]; + node_iter->idx++; + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) (node.local); + int chunk; + + for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + break; + } + + if (chunk >= RT_NODE_MAX_SLOTS) + return NULL; + + slot = RT_NODE_48_GET_CHILD(n48, chunk); + + key_chunk = chunk; + node_iter->idx = chunk + 1; + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) (node.local); + int chunk; + + for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + break; + } + + if (chunk >= RT_NODE_MAX_SLOTS) + return NULL; + + slot = RT_NODE_256_GET_CHILD(n256, chunk); + + key_chunk = chunk; + node_iter->idx = chunk + 1; + break; + } + } + + /* Update the key */ + iter->key &= ~(((uint64) RT_CHUNK_MASK) << (level * RT_SPAN)); + iter->key |= (((uint64) key_chunk) << (level * RT_SPAN)); + + return slot; +} + +/* + * Return pointer to value and set key_p as long as there is a key. Otherwise + * return NULL. + */ +RT_SCOPE RT_VALUE_TYPE * +RT_ITERATE_NEXT(RT_ITER * iter, uint64 *key_p) +{ + RT_PTR_ALLOC *slot = NULL; + + while (iter->cur_level <= iter->top_level) + { + RT_CHILD_PTR node; + + slot = RT_NODE_ITERATE_NEXT(iter, iter->cur_level); + + if (iter->cur_level == 0 && slot != NULL) + { + /* Found a value at the leaf node */ + *key_p = iter->key; + node.alloc = *slot; + + if (RT_CHILDPTR_IS_VALUE(*slot)) + return (RT_VALUE_TYPE *) slot; + else + { + RT_PTR_SET_LOCAL(iter->tree, &node); + return (RT_VALUE_TYPE *) node.local; + } + } + + if (slot != NULL) + { + /* Found the child slot, move down the tree */ + node.alloc = *slot; + RT_PTR_SET_LOCAL(iter->tree, &node); + + iter->cur_level--; + iter->node_iters[iter->cur_level].node = node; + iter->node_iters[iter->cur_level].idx = 0; + } + else + { + /* Not found the child slot, move up the tree */ + iter->cur_level++; + } + } + + /* We've visited all nodes, so the iteration finished */ + return NULL; +} + +/* + * Terminate the iteration. The caller is responsible for releasing any locks. + */ +RT_SCOPE void +RT_END_ITERATE(RT_ITER * iter) +{ + pfree(iter); +} + +/***************** DELETION *****************/ + +#ifdef RT_USE_DELETE + +/* Delete the element at "deletepos" */ +static inline void +RT_SHIFT_ARRAYS_AND_DELETE(uint8 *chunks, RT_PTR_ALLOC * children, int count, int deletepos) +{ + /* + * This is basically a memmove, but written in a simple loop for speed on + * small inputs. + */ + for (int i = deletepos; i < count - 1; i++) + { + /* workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101481 */ +#ifdef __GNUC__ + __asm__(""); +#endif + chunks[i] = chunks[i + 1]; + children[i] = children[i + 1]; + } +} + +/* + * Copy both chunk and slot arrays into the right + * place. The element at "deletepos" is deleted by skipping it. + */ +static inline void +RT_COPY_ARRAYS_AND_DELETE(uint8 *dst_chunks, RT_PTR_ALLOC * dst_children, + uint8 *src_chunks, RT_PTR_ALLOC * src_children, + int count, int deletepos) +{ + for (int i = 0; i < count - 1; i++) + { + /* + * use a branch-free computation to skip the index of the deleted + * element + */ + int sourceidx = i + (i >= deletepos); + int destidx = i; + + dst_chunks[destidx] = src_chunks[sourceidx]; + dst_children[destidx] = src_children[sourceidx]; + } +} + +/* + * Note: While all node-growing functions are called to perform an insertion + * when no more space is available, shrinking is not a hard-and-fast requirement. + * When shrinking nodes, we generally wait until the count is about 3/4 of + * the next lower node's fanout. This prevents ping-ponging between different + * node sizes. + * + * Some shrinking functions delete first and then shrink, either because we + * must or because it's fast and simple that way. Sometimes it's faster to + * delete while shrinking. + */ + +/* + * Move contents of a node256 to a node48. Any deletion should have happened + * in the caller. + */ +static void pg_noinline +RT_SHRINK_NODE_256(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + RT_CHILD_PTR newnode; + RT_NODE_48 *new48; + int slot_idx = 0; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_48, RT_CLASS_48); + new48 = (RT_NODE_48 *) newnode.local; + + /* copy over the entries */ + RT_COPY_COMMON(newnode, node); + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + if (RT_NODE_256_IS_CHUNK_USED(n256, i)) + { + new48->slot_idxs[i] = slot_idx; + new48->children[slot_idx] = n256->children[i]; + slot_idx++; + } + } + + /* + * Since we just copied a dense array, we can fill "isset" using a single + * store, provided the length of that array is at most the number of bits + * in a bitmapword. + */ + Assert(n256->base.count <= BITS_PER_BITMAPWORD); + new48->isset[0] = (bitmapword) (((uint64) 1 << n256->base.count) - 1); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_256(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + int shrink_threshold; + RT_NODE_256 *n256 = (RT_NODE_256 *) node.local; + int idx = RT_BM_IDX(chunk); + int bitnum = RT_BM_BIT(chunk); + + /* Mark the slot free for "chunk" */ + n256->isset[idx] &= ~((bitmapword) 1 << bitnum); + + n256->base.count--; + + /* + * A full node256 will have a count of zero because of overflow, so we + * delete first before checking the shrink threshold. + */ + Assert(n256->base.count > 0); + + /* This simplifies RT_SHRINK_NODE_256() */ + shrink_threshold = BITS_PER_BITMAPWORD; + shrink_threshold = Min(RT_FANOUT_48 / 4 * 3, shrink_threshold); + + if (n256->base.count <= shrink_threshold) + RT_SHRINK_NODE_256(tree, parent_slot, node, chunk); +} + +/* + * Move contents of a node48 to a node16. Any deletion should have happened + * in the caller. + */ +static void pg_noinline +RT_SHRINK_NODE_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_16 *new16; + int destidx = 0; + + /* + * Initialize new node. For now we skip the larger node16 size class for + * simplicity. + */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_16, RT_CLASS_16_LO); + new16 = (RT_NODE_16 *) newnode.local; + + /* copy over all existing entries */ + RT_COPY_COMMON(newnode, node); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (n48->slot_idxs[chunk] != RT_INVALID_SLOT_IDX) + { + new16->chunks[destidx] = chunk; + new16->children[destidx] = n48->children[n48->slot_idxs[chunk]]; + destidx++; + } + } + + Assert(destidx < new16->base.fanout); + + RT_VERIFY_NODE((RT_NODE *) new16); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_48(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk) +{ + RT_NODE_48 *n48 = (RT_NODE_48 *) node.local; + int deletepos = n48->slot_idxs[chunk]; + + /* For now we skip the larger node16 size class for simplicity */ + int shrink_threshold = RT_FANOUT_16_LO / 4 * 3; + int idx; + int bitnum; + + Assert(deletepos != RT_INVALID_SLOT_IDX); + + idx = RT_BM_IDX(deletepos); + bitnum = RT_BM_BIT(deletepos); + n48->isset[idx] &= ~((bitmapword) 1 << bitnum); + n48->slot_idxs[chunk] = RT_INVALID_SLOT_IDX; + + n48->base.count--; + + /* + * To keep shrinking simple, do it after deleting, which is fast for + * node48 anyway. + */ + if (n48->base.count <= shrink_threshold) + RT_SHRINK_NODE_48(tree, parent_slot, node, chunk); +} + +/* + * Move contents of a node16 to a node4, and delete the one at "deletepos". + * By deleting as we move, we can avoid memmove operations in the new + * node. + */ +static void pg_noinline +RT_SHRINK_NODE_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 deletepos) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) (node.local); + RT_CHILD_PTR newnode; + RT_NODE_4 *new4; + + /* initialize new node */ + newnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4); + new4 = (RT_NODE_4 *) newnode.local; + + /* copy over existing entries, except for the one at "deletepos" */ + RT_COPY_COMMON(newnode, node); + RT_COPY_ARRAYS_AND_DELETE(new4->chunks, new4->children, + n16->chunks, n16->children, + n16->base.count, deletepos); + + new4->base.count--; + RT_VERIFY_NODE((RT_NODE *) new4); + + /* free old node and update reference in parent */ + *parent_slot = newnode.alloc; + RT_FREE_NODE(tree, node); +} + +static inline void +RT_REMOVE_CHILD_16(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + RT_NODE_16 *n16 = (RT_NODE_16 *) node.local; + int deletepos = slot - n16->children; + + /* + * When shrinking to node4, 4 is hard-coded. After shrinking, the new node + * will end up with 3 elements and 3 is the largest count where linear + * search is faster than SIMD, at least on x86-64. + */ + if (n16->base.count <= 4) + { + RT_SHRINK_NODE_16(tree, parent_slot, node, deletepos); + return; + } + + Assert(deletepos >= 0); + Assert(n16->chunks[deletepos] == chunk); + + RT_SHIFT_ARRAYS_AND_DELETE(n16->chunks, n16->children, + n16->base.count, deletepos); + n16->base.count--; +} + +static inline void +RT_REMOVE_CHILD_4(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + RT_NODE_4 *n4 = (RT_NODE_4 *) node.local; + + if (n4->base.count == 1) + { + Assert(n4->chunks[0] == chunk); + + /* + * If we're deleting the last entry from the root child node don't + * free it, but mark both the tree and the root child node empty. That + * way, RT_SET can assume it exists. + */ + if (parent_slot == &tree->ctl->root) + { + n4->base.count = 0; + tree->ctl->start_shift = 0; + tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(0); + } + else + { + /* + * Deleting last entry, so just free the entire node. + * RT_DELETE_RECURSIVE has already freed the value and lower-level + * children. + */ + RT_FREE_NODE(tree, node); + + /* + * Also null out the parent's slot -- this tells the next higher + * level to delete its child pointer + */ + *parent_slot = RT_INVALID_PTR_ALLOC; + } + } + else + { + int deletepos = slot - n4->children; + + Assert(deletepos >= 0); + Assert(n4->chunks[deletepos] == chunk); + + RT_SHIFT_ARRAYS_AND_DELETE(n4->chunks, n4->children, + n4->base.count, deletepos); + + n4->base.count--; + } +} + +/* + * Delete the child pointer corresponding to "key" in the given node. + */ +static inline void +RT_NODE_DELETE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, RT_CHILD_PTR node, uint8 chunk, RT_PTR_ALLOC * slot) +{ + switch ((node.local)->kind) + { + case RT_NODE_KIND_4: + { + RT_REMOVE_CHILD_4(tree, parent_slot, node, chunk, slot); + return; + } + case RT_NODE_KIND_16: + { + RT_REMOVE_CHILD_16(tree, parent_slot, node, chunk, slot); + return; + } + case RT_NODE_KIND_48: + { + RT_REMOVE_CHILD_48(tree, parent_slot, node, chunk); + return; + } + case RT_NODE_KIND_256: + { + RT_REMOVE_CHILD_256(tree, parent_slot, node, chunk); + return; + } + default: + pg_unreachable(); + } +} + +/* workhorse for RT_DELETE */ +static bool +RT_DELETE_RECURSIVE(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int shift) +{ + RT_PTR_ALLOC *slot; + RT_CHILD_PTR node; + uint8 chunk = RT_GET_KEY_CHUNK(key, shift); + + node.alloc = *parent_slot; + RT_PTR_SET_LOCAL(tree, &node); + slot = RT_NODE_SEARCH(node.local, chunk); + + if (slot == NULL) + return false; + + if (shift == 0) + { + if (!RT_CHILDPTR_IS_VALUE(*slot)) + RT_FREE_LEAF(tree, *slot); + + RT_NODE_DELETE(tree, parent_slot, node, chunk, slot); + return true; + } + else + { + bool deleted; + + deleted = RT_DELETE_RECURSIVE(tree, slot, key, shift - RT_SPAN); + + /* Child node was freed, so delete its slot now */ + if (*slot == RT_INVALID_PTR_ALLOC) + { + Assert(deleted); + RT_NODE_DELETE(tree, parent_slot, node, chunk, slot); + } + + return deleted; + } +} + +/* + * Delete the given key from the radix tree. If the key is found delete it + * and return true, otherwise do nothing and return false. + * + * Taking a lock in exclusive mode is the caller's responsibility. + */ +RT_SCOPE bool +RT_DELETE(RT_RADIX_TREE * tree, uint64 key) +{ + bool deleted; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); +#endif + + if (key > tree->ctl->max_val) + return false; + + Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root)); + deleted = RT_DELETE_RECURSIVE(tree, &tree->ctl->root, + key, tree->ctl->start_shift); + + /* Found the key to delete. Update the statistics */ + if (deleted) + { + tree->ctl->num_keys--; + Assert(tree->ctl->num_keys >= 0); + } + + return deleted; +} + +#endif /* RT_USE_DELETE */ + +/***************** UTILITY FUNCTIONS *****************/ + +/* + * Return the statistics of the amount of memory used by the radix tree. + * + * Since dsa_get_total_size() does appropriate locking, the caller doesn't + * need to take a lock. + */ +RT_SCOPE uint64 +RT_MEMORY_USAGE(RT_RADIX_TREE * tree) +{ + size_t total = 0; + +#ifdef RT_SHMEM + Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC); + total = dsa_get_total_size(tree->dsa); +#else + total = MemoryContextMemAllocated(tree->context, true); +#endif + + return total; +} + +/* + * Perform some sanity checks on the given node. + */ +static void +RT_VERIFY_NODE(RT_NODE * node) +{ +#ifdef USE_ASSERT_CHECKING + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + /* RT_DUMP_NODE(node); */ + + for (int i = 1; i < n4->base.count; i++) + Assert(n4->chunks[i - 1] < n4->chunks[i]); + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node; + + /* RT_DUMP_NODE(node); */ + + for (int i = 1; i < n16->base.count; i++) + Assert(n16->chunks[i - 1] < n16->chunks[i]); + + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + int cnt = 0; + + /* RT_DUMP_NODE(node); */ + + for (int i = 0; i < RT_NODE_MAX_SLOTS; i++) + { + uint8 slot = n48->slot_idxs[i]; + int idx = RT_BM_IDX(slot); + int bitnum = RT_BM_BIT(slot); + + if (!RT_NODE_48_IS_CHUNK_USED(n48, i)) + continue; + + /* Check if the corresponding slot is used */ + Assert(slot < node->fanout); + Assert((n48->isset[idx] & ((bitmapword) 1 << bitnum)) != 0); + + cnt++; + } + + Assert(n48->base.count == cnt); + + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + int cnt = 0; + + /* RT_DUMP_NODE(node); */ + + for (int i = 0; i < RT_BM_IDX(RT_NODE_MAX_SLOTS); i++) + cnt += bmw_popcount(n256->isset[i]); + + /* + * Check if the number of used chunk matches, accounting for + * overflow + */ + if (cnt == RT_FANOUT_256) + Assert(n256->base.count == 0); + else + Assert(n256->base.count == cnt); + + break; + } + } +#endif +} + +/***************** DEBUG FUNCTIONS *****************/ + +#ifdef RT_DEBUG + +/* + * Print out tree stats, some of which are only collected in debugging builds. + */ +RT_SCOPE void +RT_STATS(RT_RADIX_TREE * tree) +{ + fprintf(stderr, "max_val = " UINT64_FORMAT "\n", tree->ctl->max_val); + fprintf(stderr, "num_keys = %lld\n", (long long) tree->ctl->num_keys); + +#ifdef RT_SHMEM + fprintf(stderr, "handle = " DSA_POINTER_FORMAT "\n", tree->ctl->handle); +#endif + + fprintf(stderr, "height = %d", tree->ctl->start_shift / RT_SPAN); + + for (int i = 0; i < RT_NUM_SIZE_CLASSES; i++) + { + RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i]; + + fprintf(stderr, ", n%d = %lld", size_class.fanout, (long long) tree->ctl->num_nodes[i]); + } + + fprintf(stderr, ", leaves = %lld", (long long) tree->ctl->num_leaves); + + fprintf(stderr, "\n"); +} + +/* + * Print out debugging information about the given node. + */ +static void +pg_attribute_unused() +RT_DUMP_NODE(RT_NODE * node) +{ +#ifdef RT_SHMEM +#define RT_CHILD_PTR_FORMAT DSA_POINTER_FORMAT +#else +#define RT_CHILD_PTR_FORMAT "%p" +#endif + + fprintf(stderr, "kind %d, fanout %d, count %u\n", + (node->kind == RT_NODE_KIND_4) ? 4 : + (node->kind == RT_NODE_KIND_16) ? 16 : + (node->kind == RT_NODE_KIND_48) ? 48 : 256, + node->fanout == 0 ? 256 : node->fanout, + node->count == 0 ? 256 : node->count); + + switch (node->kind) + { + case RT_NODE_KIND_4: + { + RT_NODE_4 *n4 = (RT_NODE_4 *) node; + + fprintf(stderr, "chunks and slots:\n"); + for (int i = 0; i < n4->base.count; i++) + { + fprintf(stderr, " [%d] chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + i, n4->chunks[i], n4->children[i]); + } + + break; + } + case RT_NODE_KIND_16: + { + RT_NODE_16 *n16 = (RT_NODE_16 *) node; + + fprintf(stderr, "chunks and slots:\n"); + for (int i = 0; i < n16->base.count; i++) + { + fprintf(stderr, " [%d] chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + i, n16->chunks[i], n16->children[i]); + } + break; + } + case RT_NODE_KIND_48: + { + RT_NODE_48 *n48 = (RT_NODE_48 *) node; + char *sep = ""; + + fprintf(stderr, "slot_idxs: \n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + continue; + + fprintf(stderr, " idx[%d] = %d\n", + chunk, n48->slot_idxs[chunk]); + } + + fprintf(stderr, "isset-bitmap: "); + for (int i = 0; i < (RT_FANOUT_48_MAX / BITS_PER_BYTE); i++) + { + fprintf(stderr, "%s%x", sep, ((uint8 *) n48->isset)[i]); + sep = " "; + } + fprintf(stderr, "\n"); + + fprintf(stderr, "chunks and slots:\n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_48_IS_CHUNK_USED(n48, chunk)) + continue; + + fprintf(stderr, " chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + chunk, + *RT_NODE_48_GET_CHILD(n48, chunk)); + } + break; + } + case RT_NODE_KIND_256: + { + RT_NODE_256 *n256 = (RT_NODE_256 *) node; + char *sep = ""; + + fprintf(stderr, "isset-bitmap: "); + for (int i = 0; i < (RT_FANOUT_256 / BITS_PER_BYTE); i++) + { + fprintf(stderr, "%s%x", sep, ((uint8 *) n256->isset)[i]); + sep = " "; + } + fprintf(stderr, "\n"); + + fprintf(stderr, "chunks and slots:\n"); + for (int chunk = 0; chunk < RT_NODE_MAX_SLOTS; chunk++) + { + if (!RT_NODE_256_IS_CHUNK_USED(n256, chunk)) + continue; + + fprintf(stderr, " chunk %x slot " RT_CHILD_PTR_FORMAT "\n", + chunk, + *RT_NODE_256_GET_CHILD(n256, chunk)); + } + break; + } + } +} +#endif /* RT_DEBUG */ + +#endif /* RT_DEFINE */ + + +/* undefine external parameters, so next radix tree can be defined */ +#undef RT_PREFIX +#undef RT_SCOPE +#undef RT_DECLARE +#undef RT_DEFINE +#undef RT_VALUE_TYPE +#undef RT_VARLEN_VALUE_SIZE +#undef RT_RUNTIME_EMBEDDABLE_VALUE +#undef RT_SHMEM +#undef RT_USE_DELETE +#undef RT_DEBUG + +/* locally declared macros */ +#undef RT_MAKE_PREFIX +#undef RT_MAKE_NAME +#undef RT_MAKE_NAME_ +#undef RT_STR +#undef RT_STR_ +#undef RT_SPAN +#undef RT_NODE_MAX_SLOTS +#undef RT_CHUNK_MASK +#undef RT_MAX_SHIFT +#undef RT_MAX_LEVEL +#undef RT_GET_KEY_CHUNK +#undef RT_BM_IDX +#undef RT_BM_BIT +#undef RT_NODE_MUST_GROW +#undef RT_NODE_KIND_COUNT +#undef RT_NUM_SIZE_CLASSES +#undef RT_INVALID_SLOT_IDX +#undef RT_SLAB_BLOCK_SIZE +#undef RT_RADIX_TREE_MAGIC +#undef RT_CHILD_PTR_FORMAT + +/* type declarations */ +#undef RT_RADIX_TREE +#undef RT_RADIX_TREE_CONTROL +#undef RT_CHILD_PTR +#undef RT_PTR_ALLOC +#undef RT_INVALID_PTR_ALLOC +#undef RT_HANDLE +#undef RT_ITER +#undef RT_NODE +#undef RT_NODE_ITER +#undef RT_NODE_KIND_4 +#undef RT_NODE_KIND_16 +#undef RT_NODE_KIND_48 +#undef RT_NODE_KIND_256 +#undef RT_NODE_4 +#undef RT_NODE_16 +#undef RT_NODE_48 +#undef RT_NODE_256 +#undef RT_SIZE_CLASS +#undef RT_SIZE_CLASS_ELEM +#undef RT_SIZE_CLASS_INFO +#undef RT_CLASS_4 +#undef RT_CLASS_16_LO +#undef RT_CLASS_16_HI +#undef RT_CLASS_48 +#undef RT_CLASS_256 +#undef RT_FANOUT_4 +#undef RT_FANOUT_4_MAX +#undef RT_FANOUT_16_LO +#undef RT_FANOUT_16_HI +#undef RT_FANOUT_16_MAX +#undef RT_FANOUT_48 +#undef RT_FANOUT_48_MAX +#undef RT_FANOUT_256 + +/* function declarations */ +#undef RT_CREATE +#undef RT_FREE +#undef RT_ATTACH +#undef RT_DETACH +#undef RT_LOCK_EXCLUSIVE +#undef RT_LOCK_SHARE +#undef RT_UNLOCK +#undef RT_GET_HANDLE +#undef RT_FIND +#undef RT_SET +#undef RT_BEGIN_ITERATE +#undef RT_ITERATE_NEXT +#undef RT_END_ITERATE +#undef RT_DELETE +#undef RT_MEMORY_USAGE +#undef RT_DUMP_NODE +#undef RT_STATS + +/* internal helper functions */ +#undef RT_GET_VALUE_SIZE +#undef RT_VALUE_IS_EMBEDDABLE +#undef RT_CHILDPTR_IS_VALUE +#undef RT_GET_SLOT_RECURSIVE +#undef RT_DELETE_RECURSIVE +#undef RT_ALLOC_NODE +#undef RT_ALLOC_LEAF +#undef RT_FREE_NODE +#undef RT_FREE_LEAF +#undef RT_FREE_RECURSE +#undef RT_EXTEND_UP +#undef RT_EXTEND_DOWN +#undef RT_COPY_COMMON +#undef RT_PTR_SET_LOCAL +#undef RT_PTR_ALLOC_IS_VALID +#undef RT_NODE_16_SEARCH_EQ +#undef RT_NODE_4_GET_INSERTPOS +#undef RT_NODE_16_GET_INSERTPOS +#undef RT_SHIFT_ARRAYS_FOR_INSERT +#undef RT_SHIFT_ARRAYS_AND_DELETE +#undef RT_COPY_ARRAYS_FOR_INSERT +#undef RT_COPY_ARRAYS_AND_DELETE +#undef RT_NODE_48_IS_CHUNK_USED +#undef RT_NODE_48_GET_CHILD +#undef RT_NODE_256_IS_CHUNK_USED +#undef RT_NODE_256_GET_CHILD +#undef RT_KEY_GET_SHIFT +#undef RT_SHIFT_GET_MAX_VAL +#undef RT_NODE_SEARCH +#undef RT_ADD_CHILD_4 +#undef RT_ADD_CHILD_16 +#undef RT_ADD_CHILD_48 +#undef RT_ADD_CHILD_256 +#undef RT_GROW_NODE_4 +#undef RT_GROW_NODE_16 +#undef RT_GROW_NODE_48 +#undef RT_REMOVE_CHILD_4 +#undef RT_REMOVE_CHILD_16 +#undef RT_REMOVE_CHILD_48 +#undef RT_REMOVE_CHILD_256 +#undef RT_SHRINK_NODE_16 +#undef RT_SHRINK_NODE_48 +#undef RT_SHRINK_NODE_256 +#undef RT_NODE_DELETE +#undef RT_NODE_INSERT +#undef RT_NODE_ITERATE_NEXT +#undef RT_VERIFY_NODE diff --git a/platform/dbops/binaries/postgres/include/server/lib/rbtree.h b/platform/dbops/binaries/postgres/include/server/lib/rbtree.h new file mode 100644 index 0000000000000000000000000000000000000000..16de4c012c8a2258127c2f3ad69bf0537be9af2c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/rbtree.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * rbtree.h + * interface for PostgreSQL generic Red-Black binary tree package + * + * Copyright (c) 2009-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/lib/rbtree.h + * + *------------------------------------------------------------------------- + */ +#ifndef RBTREE_H +#define RBTREE_H + +/* + * RBTNode is intended to be used as the first field of a larger struct, + * whose additional fields carry whatever payload data the caller needs + * for a tree entry. (The total size of that larger struct is passed to + * rbt_create.) RBTNode is declared here to support this usage, but + * callers must treat it as an opaque struct. + */ +typedef struct RBTNode +{ + char color; /* node's current color, red or black */ + struct RBTNode *left; /* left child, or RBTNIL if none */ + struct RBTNode *right; /* right child, or RBTNIL if none */ + struct RBTNode *parent; /* parent, or NULL (not RBTNIL!) if none */ +} RBTNode; + +/* Opaque struct representing a whole tree */ +typedef struct RBTree RBTree; + +/* Available tree iteration orderings */ +typedef enum RBTOrderControl +{ + LeftRightWalk, /* inorder: left child, node, right child */ + RightLeftWalk /* reverse inorder: right, node, left */ +} RBTOrderControl; + +/* + * RBTreeIterator holds state while traversing a tree. This is declared + * here so that callers can stack-allocate this, but must otherwise be + * treated as an opaque struct. + */ +typedef struct RBTreeIterator RBTreeIterator; + +struct RBTreeIterator +{ + RBTree *rbt; + RBTNode *(*iterate) (RBTreeIterator *iter); + RBTNode *last_visited; + bool is_over; +}; + +/* Support functions to be provided by caller */ +typedef int (*rbt_comparator) (const RBTNode *a, const RBTNode *b, void *arg); +typedef void (*rbt_combiner) (RBTNode *existing, const RBTNode *newdata, void *arg); +typedef RBTNode *(*rbt_allocfunc) (void *arg); +typedef void (*rbt_freefunc) (RBTNode *x, void *arg); + +extern RBTree *rbt_create(Size node_size, + rbt_comparator comparator, + rbt_combiner combiner, + rbt_allocfunc allocfunc, + rbt_freefunc freefunc, + void *arg); + +extern RBTNode *rbt_find(RBTree *rbt, const RBTNode *data); +extern RBTNode *rbt_find_great(RBTree *rbt, const RBTNode *data, bool equal_match); +extern RBTNode *rbt_find_less(RBTree *rbt, const RBTNode *data, bool equal_match); +extern RBTNode *rbt_leftmost(RBTree *rbt); + +extern RBTNode *rbt_insert(RBTree *rbt, const RBTNode *data, bool *isNew); +extern void rbt_delete(RBTree *rbt, RBTNode *node); + +extern void rbt_begin_iterate(RBTree *rbt, RBTOrderControl ctrl, + RBTreeIterator *iter); +extern RBTNode *rbt_iterate(RBTreeIterator *iter); + +#endif /* RBTREE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/lib/simplehash.h b/platform/dbops/binaries/postgres/include/server/lib/simplehash.h new file mode 100644 index 0000000000000000000000000000000000000000..3e1b1f946167d53ff6dcd6bfc9ec9f98ca61294a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/simplehash.h @@ -0,0 +1,1206 @@ +/* + * simplehash.h + * + * When included this file generates a "templated" (by way of macros) + * open-addressing hash table implementation specialized to user-defined + * types. + * + * It's probably not worthwhile to generate such a specialized implementation + * for hash tables that aren't performance or space sensitive. + * + * Compared to dynahash, simplehash has the following benefits: + * + * - Due to the "templated" code generation has known structure sizes and no + * indirect function calls (which show up substantially in dynahash + * profiles). These features considerably increase speed for small + * entries. + * - Open addressing has better CPU cache behavior than dynahash's chained + * hashtables. + * - The generated interface is type-safe and easier to use than dynahash, + * though at the cost of more complex setup. + * - Allocates memory in a MemoryContext or another allocator with a + * malloc/free style interface (which isn't easily usable in a shared + * memory context) + * - Does not require the overhead of a separate memory context. + * + * Usage notes: + * + * To generate a hash-table and associated functions for a use case several + * macros have to be #define'ed before this file is included. Including + * the file #undef's all those, so a new hash table can be generated + * afterwards. + * The relevant parameters are: + * - SH_PREFIX - prefix for all symbol names generated. A prefix of 'foo' + * will result in hash table type 'foo_hash' and functions like + * 'foo_insert'/'foo_lookup' and so forth. + * - SH_ELEMENT_TYPE - type of the contained elements + * - SH_KEY_TYPE - type of the hashtable's key + * - SH_DECLARE - if defined function prototypes and type declarations are + * generated + * - SH_DEFINE - if defined function definitions are generated + * - SH_SCOPE - in which scope (e.g. extern, static inline) do function + * declarations reside + * - SH_RAW_ALLOCATOR - if defined, memory contexts are not used; instead, + * use this to allocate bytes. The allocator must zero the returned space. + * - SH_USE_NONDEFAULT_ALLOCATOR - if defined no element allocator functions + * are defined, so you can supply your own + * The following parameters are only relevant when SH_DEFINE is defined: + * - SH_KEY - name of the element in SH_ELEMENT_TYPE containing the hash key + * - SH_EQUAL(table, a, b) - compare two table keys + * - SH_HASH_KEY(table, key) - generate hash for the key + * - SH_STORE_HASH - if defined the hash is stored in the elements + * - SH_GET_HASH(tb, a) - return the field to store the hash in + * + * The element type is required to contain a "status" member that can store + * the range of values defined in the SH_STATUS enum. + * + * While SH_STORE_HASH (and subsequently SH_GET_HASH) are optional, because + * the hash table implementation needs to compare hashes to move elements + * (particularly when growing the hash), it's preferable, if possible, to + * store the element's hash in the element's data type. If the hash is so + * stored, the hash table will also compare hashes before calling SH_EQUAL + * when comparing two keys. + * + * For convenience the hash table create functions accept a void pointer + * that will be stored in the hash table type's member private_data. This + * allows callbacks to reference caller provided data. + * + * For examples of usage look at tidbitmap.c (file local definition) and + * execnodes.h/execGrouping.c (exposed declaration, file local + * implementation). + * + * Hash table design: + * + * The hash table design chosen is a variant of linear open-addressing. The + * reason for doing so is that linear addressing is CPU cache & pipeline + * friendly. The biggest disadvantage of simple linear addressing schemes + * are highly variable lookup times due to clustering, and deletions + * leaving a lot of tombstones around. To address these issues a variant + * of "robin hood" hashing is employed. Robin hood hashing optimizes + * chaining lengths by moving elements close to their optimal bucket + * ("rich" elements), out of the way if a to-be-inserted element is further + * away from its optimal position (i.e. it's "poor"). While that can make + * insertions slower, the average lookup performance is a lot better, and + * higher fill factors can be used in a still performant manner. To avoid + * tombstones - which normally solve the issue that a deleted node's + * presence is relevant to determine whether a lookup needs to continue + * looking or is done - buckets following a deleted element are shifted + * backwards, unless they're empty or already at their optimal position. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/lib/simplehash.h + */ + +#include "port/pg_bitutils.h" + +/* helpers */ +#define SH_MAKE_PREFIX(a) CppConcat(a,_) +#define SH_MAKE_NAME(name) SH_MAKE_NAME_(SH_MAKE_PREFIX(SH_PREFIX),name) +#define SH_MAKE_NAME_(a,b) CppConcat(a,b) + +/* name macros for: */ + +/* type declarations */ +#define SH_TYPE SH_MAKE_NAME(hash) +#define SH_STATUS SH_MAKE_NAME(status) +#define SH_STATUS_EMPTY SH_MAKE_NAME(SH_EMPTY) +#define SH_STATUS_IN_USE SH_MAKE_NAME(SH_IN_USE) +#define SH_ITERATOR SH_MAKE_NAME(iterator) + +/* function declarations */ +#define SH_CREATE SH_MAKE_NAME(create) +#define SH_DESTROY SH_MAKE_NAME(destroy) +#define SH_RESET SH_MAKE_NAME(reset) +#define SH_INSERT SH_MAKE_NAME(insert) +#define SH_INSERT_HASH SH_MAKE_NAME(insert_hash) +#define SH_DELETE_ITEM SH_MAKE_NAME(delete_item) +#define SH_DELETE SH_MAKE_NAME(delete) +#define SH_LOOKUP SH_MAKE_NAME(lookup) +#define SH_LOOKUP_HASH SH_MAKE_NAME(lookup_hash) +#define SH_GROW SH_MAKE_NAME(grow) +#define SH_START_ITERATE SH_MAKE_NAME(start_iterate) +#define SH_START_ITERATE_AT SH_MAKE_NAME(start_iterate_at) +#define SH_ITERATE SH_MAKE_NAME(iterate) +#define SH_ALLOCATE SH_MAKE_NAME(allocate) +#define SH_FREE SH_MAKE_NAME(free) +#define SH_STAT SH_MAKE_NAME(stat) + +/* internal helper functions (no externally visible prototypes) */ +#define SH_COMPUTE_SIZE SH_MAKE_NAME(compute_size) +#define SH_UPDATE_PARAMETERS SH_MAKE_NAME(update_parameters) +#define SH_NEXT SH_MAKE_NAME(next) +#define SH_PREV SH_MAKE_NAME(prev) +#define SH_DISTANCE_FROM_OPTIMAL SH_MAKE_NAME(distance) +#define SH_INITIAL_BUCKET SH_MAKE_NAME(initial_bucket) +#define SH_ENTRY_HASH SH_MAKE_NAME(entry_hash) +#define SH_INSERT_HASH_INTERNAL SH_MAKE_NAME(insert_hash_internal) +#define SH_LOOKUP_HASH_INTERNAL SH_MAKE_NAME(lookup_hash_internal) + +/* generate forward declarations necessary to use the hash table */ +#ifdef SH_DECLARE + +/* type definitions */ +typedef struct SH_TYPE +{ + /* + * Size of data / bucket array, 64 bits to handle UINT32_MAX sized hash + * tables. Note that the maximum number of elements is lower + * (SH_MAX_FILLFACTOR) + */ + uint64 size; + + /* how many elements have valid contents */ + uint32 members; + + /* mask for bucket and size calculations, based on size */ + uint32 sizemask; + + /* boundary after which to grow hashtable */ + uint32 grow_threshold; + + /* hash buckets */ + SH_ELEMENT_TYPE *data; + +#ifndef SH_RAW_ALLOCATOR + /* memory context to use for allocations */ + MemoryContext ctx; +#endif + + /* user defined data, useful for callbacks */ + void *private_data; +} SH_TYPE; + +typedef enum SH_STATUS +{ + SH_STATUS_EMPTY = 0x00, + SH_STATUS_IN_USE = 0x01 +} SH_STATUS; + +typedef struct SH_ITERATOR +{ + uint32 cur; /* current element */ + uint32 end; + bool done; /* iterator exhausted? */ +} SH_ITERATOR; + +/* externally visible function prototypes */ +#ifdef SH_RAW_ALLOCATOR +/* _hash _create(uint32 nelements, void *private_data) */ +SH_SCOPE SH_TYPE *SH_CREATE(uint32 nelements, void *private_data); +#else +/* + * _hash _create(MemoryContext ctx, uint32 nelements, + * void *private_data) + */ +SH_SCOPE SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements, + void *private_data); +#endif + +/* void _destroy(_hash *tb) */ +SH_SCOPE void SH_DESTROY(SH_TYPE * tb); + +/* void _reset(_hash *tb) */ +SH_SCOPE void SH_RESET(SH_TYPE * tb); + +/* void _grow(_hash *tb, uint64 newsize) */ +SH_SCOPE void SH_GROW(SH_TYPE * tb, uint64 newsize); + +/* *_insert(_hash *tb, key, bool *found) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found); + +/* + * *_insert_hash(_hash *tb, key, uint32 hash, + * bool *found) + */ +SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT_HASH(SH_TYPE * tb, SH_KEY_TYPE key, + uint32 hash, bool *found); + +/* *_lookup(_hash *tb, key) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key); + +/* *_lookup_hash(_hash *tb, key, uint32 hash) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP_HASH(SH_TYPE * tb, SH_KEY_TYPE key, + uint32 hash); + +/* void _delete_item(_hash *tb, *entry) */ +SH_SCOPE void SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry); + +/* bool _delete(_hash *tb, key) */ +SH_SCOPE bool SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key); + +/* void _start_iterate(_hash *tb, _iterator *iter) */ +SH_SCOPE void SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); + +/* + * void _start_iterate_at(_hash *tb, _iterator *iter, + * uint32 at) + */ +SH_SCOPE void SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at); + +/* *_iterate(_hash *tb, _iterator *iter) */ +SH_SCOPE SH_ELEMENT_TYPE *SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); + +/* void _stat(_hash *tb */ +SH_SCOPE void SH_STAT(SH_TYPE * tb); + +#endif /* SH_DECLARE */ + + +/* generate implementation of the hash table */ +#ifdef SH_DEFINE + +#ifndef SH_RAW_ALLOCATOR +#include "utils/memutils.h" +#endif + +/* max data array size,we allow up to PG_UINT32_MAX buckets, including 0 */ +#define SH_MAX_SIZE (((uint64) PG_UINT32_MAX) + 1) + +/* normal fillfactor, unless already close to maximum */ +#ifndef SH_FILLFACTOR +#define SH_FILLFACTOR (0.9) +#endif +/* increase fillfactor if we otherwise would error out */ +#define SH_MAX_FILLFACTOR (0.98) +/* grow if actual and optimal location bigger than */ +#ifndef SH_GROW_MAX_DIB +#define SH_GROW_MAX_DIB 25 +#endif +/* grow if more than elements to move when inserting */ +#ifndef SH_GROW_MAX_MOVE +#define SH_GROW_MAX_MOVE 150 +#endif +#ifndef SH_GROW_MIN_FILLFACTOR +/* but do not grow due to SH_GROW_MAX_* if below */ +#define SH_GROW_MIN_FILLFACTOR 0.1 +#endif + +#ifdef SH_STORE_HASH +#define SH_COMPARE_KEYS(tb, ahash, akey, b) (ahash == SH_GET_HASH(tb, b) && SH_EQUAL(tb, b->SH_KEY, akey)) +#else +#define SH_COMPARE_KEYS(tb, ahash, akey, b) (SH_EQUAL(tb, b->SH_KEY, akey)) +#endif + +/* + * Wrap the following definitions in include guards, to avoid multiple + * definition errors if this header is included more than once. The rest of + * the file deliberately has no include guards, because it can be included + * with different parameters to define functions and types with non-colliding + * names. + */ +#ifndef SIMPLEHASH_H +#define SIMPLEHASH_H + +#ifdef FRONTEND +#define sh_error(...) pg_fatal(__VA_ARGS__) +#define sh_log(...) pg_log_info(__VA_ARGS__) +#else +#define sh_error(...) elog(ERROR, __VA_ARGS__) +#define sh_log(...) elog(LOG, __VA_ARGS__) +#endif + +#endif + +/* + * Compute allocation size for hashtable. Result can be passed to + * SH_UPDATE_PARAMETERS. + */ +static inline uint64 +SH_COMPUTE_SIZE(uint64 newsize) +{ + uint64 size; + + /* supporting zero sized hashes would complicate matters */ + size = Max(newsize, 2); + + /* round up size to the next power of 2, that's how bucketing works */ + size = pg_nextpower2_64(size); + Assert(size <= SH_MAX_SIZE); + + /* + * Verify that allocation of ->data is possible on this platform, without + * overflowing Size. + */ + if (unlikely((((uint64) sizeof(SH_ELEMENT_TYPE)) * size) >= SIZE_MAX / 2)) + sh_error("hash table too large"); + + return size; +} + +/* + * Update sizing parameters for hashtable. Called when creating and growing + * the hashtable. + */ +static inline void +SH_UPDATE_PARAMETERS(SH_TYPE * tb, uint64 newsize) +{ + uint64 size = SH_COMPUTE_SIZE(newsize); + + /* now set size */ + tb->size = size; + tb->sizemask = (uint32) (size - 1); + + /* + * Compute the next threshold at which we need to grow the hash table + * again. + */ + if (tb->size == SH_MAX_SIZE) + tb->grow_threshold = ((double) tb->size) * SH_MAX_FILLFACTOR; + else + tb->grow_threshold = ((double) tb->size) * SH_FILLFACTOR; +} + +/* return the optimal bucket for the hash */ +static inline uint32 +SH_INITIAL_BUCKET(SH_TYPE * tb, uint32 hash) +{ + return hash & tb->sizemask; +} + +/* return next bucket after the current, handling wraparound */ +static inline uint32 +SH_NEXT(SH_TYPE * tb, uint32 curelem, uint32 startelem) +{ + curelem = (curelem + 1) & tb->sizemask; + + Assert(curelem != startelem); + + return curelem; +} + +/* return bucket before the current, handling wraparound */ +static inline uint32 +SH_PREV(SH_TYPE * tb, uint32 curelem, uint32 startelem) +{ + curelem = (curelem - 1) & tb->sizemask; + + Assert(curelem != startelem); + + return curelem; +} + +/* return distance between bucket and its optimal position */ +static inline uint32 +SH_DISTANCE_FROM_OPTIMAL(SH_TYPE * tb, uint32 optimal, uint32 bucket) +{ + if (optimal <= bucket) + return bucket - optimal; + else + return (tb->size + bucket) - optimal; +} + +static inline uint32 +SH_ENTRY_HASH(SH_TYPE * tb, SH_ELEMENT_TYPE * entry) +{ +#ifdef SH_STORE_HASH + return SH_GET_HASH(tb, entry); +#else + return SH_HASH_KEY(tb, entry->SH_KEY); +#endif +} + +/* default memory allocator function */ +static inline void *SH_ALLOCATE(SH_TYPE * type, Size size); +static inline void SH_FREE(SH_TYPE * type, void *pointer); + +#ifndef SH_USE_NONDEFAULT_ALLOCATOR + +/* default memory allocator function */ +static inline void * +SH_ALLOCATE(SH_TYPE * type, Size size) +{ +#ifdef SH_RAW_ALLOCATOR + return SH_RAW_ALLOCATOR(size); +#else + return MemoryContextAllocExtended(type->ctx, size, + MCXT_ALLOC_HUGE | MCXT_ALLOC_ZERO); +#endif +} + +/* default memory free function */ +static inline void +SH_FREE(SH_TYPE * type, void *pointer) +{ + pfree(pointer); +} + +#endif + +/* + * Create a hash table with enough space for `nelements` distinct members. + * Memory for the hash table is allocated from the passed-in context. If + * desired, the array of elements can be allocated using a passed-in allocator; + * this could be useful in order to place the array of elements in a shared + * memory, or in a context that will outlive the rest of the hash table. + * Memory other than for the array of elements will still be allocated from + * the passed-in context. + */ +#ifdef SH_RAW_ALLOCATOR +SH_SCOPE SH_TYPE * +SH_CREATE(uint32 nelements, void *private_data) +#else +SH_SCOPE SH_TYPE * +SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data) +#endif +{ + SH_TYPE *tb; + uint64 size; + +#ifdef SH_RAW_ALLOCATOR + tb = (SH_TYPE *) SH_RAW_ALLOCATOR(sizeof(SH_TYPE)); +#else + tb = (SH_TYPE *) MemoryContextAllocZero(ctx, sizeof(SH_TYPE)); + tb->ctx = ctx; +#endif + tb->private_data = private_data; + + /* increase nelements by fillfactor, want to store nelements elements */ + size = Min((double) SH_MAX_SIZE, ((double) nelements) / SH_FILLFACTOR); + + size = SH_COMPUTE_SIZE(size); + + tb->data = (SH_ELEMENT_TYPE *) SH_ALLOCATE(tb, sizeof(SH_ELEMENT_TYPE) * size); + + SH_UPDATE_PARAMETERS(tb, size); + return tb; +} + +/* destroy a previously created hash table */ +SH_SCOPE void +SH_DESTROY(SH_TYPE * tb) +{ + SH_FREE(tb, tb->data); + pfree(tb); +} + +/* reset the contents of a previously created hash table */ +SH_SCOPE void +SH_RESET(SH_TYPE * tb) +{ + memset(tb->data, 0, sizeof(SH_ELEMENT_TYPE) * tb->size); + tb->members = 0; +} + +/* + * Grow a hash table to at least `newsize` buckets. + * + * Usually this will automatically be called by insertions/deletions, when + * necessary. But resizing to the exact input size can be advantageous + * performance-wise, when known at some point. + */ +SH_SCOPE void +SH_GROW(SH_TYPE * tb, uint64 newsize) +{ + uint64 oldsize = tb->size; + SH_ELEMENT_TYPE *olddata = tb->data; + SH_ELEMENT_TYPE *newdata; + uint32 i; + uint32 startelem = 0; + uint32 copyelem; + + Assert(oldsize == pg_nextpower2_64(oldsize)); + Assert(oldsize != SH_MAX_SIZE); + Assert(oldsize < newsize); + + newsize = SH_COMPUTE_SIZE(newsize); + + tb->data = (SH_ELEMENT_TYPE *) SH_ALLOCATE(tb, sizeof(SH_ELEMENT_TYPE) * newsize); + + /* + * Update parameters for new table after allocation succeeds to avoid + * inconsistent state on OOM. + */ + SH_UPDATE_PARAMETERS(tb, newsize); + + newdata = tb->data; + + /* + * Copy entries from the old data to newdata. We theoretically could use + * SH_INSERT here, to avoid code duplication, but that's more general than + * we need. We neither want tb->members increased, nor do we need to do + * deal with deleted elements, nor do we need to compare keys. So a + * special-cased implementation is lot faster. As resizing can be time + * consuming and frequent, that's worthwhile to optimize. + * + * To be able to simply move entries over, we have to start not at the + * first bucket (i.e olddata[0]), but find the first bucket that's either + * empty, or is occupied by an entry at its optimal position. Such a + * bucket has to exist in any table with a load factor under 1, as not all + * buckets are occupied, i.e. there always has to be an empty bucket. By + * starting at such a bucket we can move the entries to the larger table, + * without having to deal with conflicts. + */ + + /* search for the first element in the hash that's not wrapped around */ + for (i = 0; i < oldsize; i++) + { + SH_ELEMENT_TYPE *oldentry = &olddata[i]; + uint32 hash; + uint32 optimal; + + if (oldentry->status != SH_STATUS_IN_USE) + { + startelem = i; + break; + } + + hash = SH_ENTRY_HASH(tb, oldentry); + optimal = SH_INITIAL_BUCKET(tb, hash); + + if (optimal == i) + { + startelem = i; + break; + } + } + + /* and copy all elements in the old table */ + copyelem = startelem; + for (i = 0; i < oldsize; i++) + { + SH_ELEMENT_TYPE *oldentry = &olddata[copyelem]; + + if (oldentry->status == SH_STATUS_IN_USE) + { + uint32 hash; + uint32 startelem2; + uint32 curelem; + SH_ELEMENT_TYPE *newentry; + + hash = SH_ENTRY_HASH(tb, oldentry); + startelem2 = SH_INITIAL_BUCKET(tb, hash); + curelem = startelem2; + + /* find empty element to put data into */ + while (true) + { + newentry = &newdata[curelem]; + + if (newentry->status == SH_STATUS_EMPTY) + { + break; + } + + curelem = SH_NEXT(tb, curelem, startelem2); + } + + /* copy entry to new slot */ + memcpy(newentry, oldentry, sizeof(SH_ELEMENT_TYPE)); + } + + /* can't use SH_NEXT here, would use new size */ + copyelem++; + if (copyelem >= oldsize) + { + copyelem = 0; + } + } + + SH_FREE(tb, olddata); +} + +/* + * This is a separate static inline function, so it can be reliably be inlined + * into its wrapper functions even if SH_SCOPE is extern. + */ +static inline SH_ELEMENT_TYPE * +SH_INSERT_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash, bool *found) +{ + uint32 startelem; + uint32 curelem; + SH_ELEMENT_TYPE *data; + uint32 insertdist; + +restart: + insertdist = 0; + + /* + * We do the grow check even if the key is actually present, to avoid + * doing the check inside the loop. This also lets us avoid having to + * re-find our position in the hashtable after resizing. + * + * Note that this also reached when resizing the table due to + * SH_GROW_MAX_DIB / SH_GROW_MAX_MOVE. + */ + if (unlikely(tb->members >= tb->grow_threshold)) + { + if (unlikely(tb->size == SH_MAX_SIZE)) + sh_error("hash table size exceeded"); + + /* + * When optimizing, it can be very useful to print these out. + */ + /* SH_STAT(tb); */ + SH_GROW(tb, tb->size * 2); + /* SH_STAT(tb); */ + } + + /* perform insert, start bucket search at optimal location */ + data = tb->data; + startelem = SH_INITIAL_BUCKET(tb, hash); + curelem = startelem; + while (true) + { + uint32 curdist; + uint32 curhash; + uint32 curoptimal; + SH_ELEMENT_TYPE *entry = &data[curelem]; + + /* any empty bucket can directly be used */ + if (entry->status == SH_STATUS_EMPTY) + { + tb->members++; + entry->SH_KEY = key; +#ifdef SH_STORE_HASH + SH_GET_HASH(tb, entry) = hash; +#endif + entry->status = SH_STATUS_IN_USE; + *found = false; + return entry; + } + + /* + * If the bucket is not empty, we either found a match (in which case + * we're done), or we have to decide whether to skip over or move the + * colliding entry. When the colliding element's distance to its + * optimal position is smaller than the to-be-inserted entry's, we + * shift the colliding entry (and its followers) forward by one. + */ + + if (SH_COMPARE_KEYS(tb, hash, key, entry)) + { + Assert(entry->status == SH_STATUS_IN_USE); + *found = true; + return entry; + } + + curhash = SH_ENTRY_HASH(tb, entry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + curdist = SH_DISTANCE_FROM_OPTIMAL(tb, curoptimal, curelem); + + if (insertdist > curdist) + { + SH_ELEMENT_TYPE *lastentry = entry; + uint32 emptyelem = curelem; + uint32 moveelem; + int32 emptydist = 0; + + /* find next empty bucket */ + while (true) + { + SH_ELEMENT_TYPE *emptyentry; + + emptyelem = SH_NEXT(tb, emptyelem, startelem); + emptyentry = &data[emptyelem]; + + if (emptyentry->status == SH_STATUS_EMPTY) + { + lastentry = emptyentry; + break; + } + + /* + * To avoid negative consequences from overly imbalanced + * hashtables, grow the hashtable if collisions would require + * us to move a lot of entries. The most likely cause of such + * imbalance is filling a (currently) small table, from a + * currently big one, in hash-table order. Don't grow if the + * hashtable would be too empty, to prevent quick space + * explosion for some weird edge cases. + */ + if (unlikely(++emptydist > SH_GROW_MAX_MOVE) && + ((double) tb->members / tb->size) >= SH_GROW_MIN_FILLFACTOR) + { + tb->grow_threshold = 0; + goto restart; + } + } + + /* shift forward, starting at last occupied element */ + + /* + * TODO: This could be optimized to be one memcpy in many cases, + * excepting wrapping around at the end of ->data. Hasn't shown up + * in profiles so far though. + */ + moveelem = emptyelem; + while (moveelem != curelem) + { + SH_ELEMENT_TYPE *moveentry; + + moveelem = SH_PREV(tb, moveelem, startelem); + moveentry = &data[moveelem]; + + memcpy(lastentry, moveentry, sizeof(SH_ELEMENT_TYPE)); + lastentry = moveentry; + } + + /* and fill the now empty spot */ + tb->members++; + + entry->SH_KEY = key; +#ifdef SH_STORE_HASH + SH_GET_HASH(tb, entry) = hash; +#endif + entry->status = SH_STATUS_IN_USE; + *found = false; + return entry; + } + + curelem = SH_NEXT(tb, curelem, startelem); + insertdist++; + + /* + * To avoid negative consequences from overly imbalanced hashtables, + * grow the hashtable if collisions lead to large runs. The most + * likely cause of such imbalance is filling a (currently) small + * table, from a currently big one, in hash-table order. Don't grow + * if the hashtable would be too empty, to prevent quick space + * explosion for some weird edge cases. + */ + if (unlikely(insertdist > SH_GROW_MAX_DIB) && + ((double) tb->members / tb->size) >= SH_GROW_MIN_FILLFACTOR) + { + tb->grow_threshold = 0; + goto restart; + } + } +} + +/* + * Insert the key into the hash-table, set *found to true if the key already + * exists, false otherwise. Returns the hash-table entry in either case. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found) +{ + uint32 hash = SH_HASH_KEY(tb, key); + + return SH_INSERT_HASH_INTERNAL(tb, key, hash, found); +} + +/* + * Insert the key into the hash-table using an already-calculated hash. Set + * *found to true if the key already exists, false otherwise. Returns the + * hash-table entry in either case. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_INSERT_HASH(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash, bool *found) +{ + return SH_INSERT_HASH_INTERNAL(tb, key, hash, found); +} + +/* + * This is a separate static inline function, so it can be reliably be inlined + * into its wrapper functions even if SH_SCOPE is extern. + */ +static inline SH_ELEMENT_TYPE * +SH_LOOKUP_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash) +{ + const uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem = startelem; + + while (true) + { + SH_ELEMENT_TYPE *entry = &tb->data[curelem]; + + if (entry->status == SH_STATUS_EMPTY) + { + return NULL; + } + + Assert(entry->status == SH_STATUS_IN_USE); + + if (SH_COMPARE_KEYS(tb, hash, key, entry)) + return entry; + + /* + * TODO: we could stop search based on distance. If the current + * buckets's distance-from-optimal is smaller than what we've skipped + * already, the entry doesn't exist. Probably only do so if + * SH_STORE_HASH is defined, to avoid re-computing hashes? + */ + + curelem = SH_NEXT(tb, curelem, startelem); + } +} + +/* + * Lookup entry in hash table. Returns NULL if key not present. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key) +{ + uint32 hash = SH_HASH_KEY(tb, key); + + return SH_LOOKUP_HASH_INTERNAL(tb, key, hash); +} + +/* + * Lookup entry in hash table using an already-calculated hash. + * + * Returns NULL if key not present. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_LOOKUP_HASH(SH_TYPE * tb, SH_KEY_TYPE key, uint32 hash) +{ + return SH_LOOKUP_HASH_INTERNAL(tb, key, hash); +} + +/* + * Delete entry from hash table by key. Returns whether to-be-deleted key was + * present. + */ +SH_SCOPE bool +SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key) +{ + uint32 hash = SH_HASH_KEY(tb, key); + uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem = startelem; + + while (true) + { + SH_ELEMENT_TYPE *entry = &tb->data[curelem]; + + if (entry->status == SH_STATUS_EMPTY) + return false; + + if (entry->status == SH_STATUS_IN_USE && + SH_COMPARE_KEYS(tb, hash, key, entry)) + { + SH_ELEMENT_TYPE *lastentry = entry; + + tb->members--; + + /* + * Backward shift following elements till either an empty element + * or an element at its optimal position is encountered. + * + * While that sounds expensive, the average chain length is short, + * and deletions would otherwise require tombstones. + */ + while (true) + { + SH_ELEMENT_TYPE *curentry; + uint32 curhash; + uint32 curoptimal; + + curelem = SH_NEXT(tb, curelem, startelem); + curentry = &tb->data[curelem]; + + if (curentry->status != SH_STATUS_IN_USE) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + curhash = SH_ENTRY_HASH(tb, curentry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + + /* current is at optimal position, done */ + if (curoptimal == curelem) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + /* shift */ + memcpy(lastentry, curentry, sizeof(SH_ELEMENT_TYPE)); + + lastentry = curentry; + } + + return true; + } + + /* TODO: return false; if distance too big */ + + curelem = SH_NEXT(tb, curelem, startelem); + } +} + +/* + * Delete entry from hash table by entry pointer + */ +SH_SCOPE void +SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry) +{ + SH_ELEMENT_TYPE *lastentry = entry; + uint32 hash = SH_ENTRY_HASH(tb, entry); + uint32 startelem = SH_INITIAL_BUCKET(tb, hash); + uint32 curelem; + + /* Calculate the index of 'entry' */ + curelem = entry - &tb->data[0]; + + tb->members--; + + /* + * Backward shift following elements till either an empty element or an + * element at its optimal position is encountered. + * + * While that sounds expensive, the average chain length is short, and + * deletions would otherwise require tombstones. + */ + while (true) + { + SH_ELEMENT_TYPE *curentry; + uint32 curhash; + uint32 curoptimal; + + curelem = SH_NEXT(tb, curelem, startelem); + curentry = &tb->data[curelem]; + + if (curentry->status != SH_STATUS_IN_USE) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + curhash = SH_ENTRY_HASH(tb, curentry); + curoptimal = SH_INITIAL_BUCKET(tb, curhash); + + /* current is at optimal position, done */ + if (curoptimal == curelem) + { + lastentry->status = SH_STATUS_EMPTY; + break; + } + + /* shift */ + memcpy(lastentry, curentry, sizeof(SH_ELEMENT_TYPE)); + + lastentry = curentry; + } +} + +/* + * Initialize iterator. + */ +SH_SCOPE void +SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) +{ + uint64 startelem = PG_UINT64_MAX; + + /* + * Search for the first empty element. As deletions during iterations are + * supported, we want to start/end at an element that cannot be affected + * by elements being shifted. + */ + for (uint32 i = 0; i < tb->size; i++) + { + SH_ELEMENT_TYPE *entry = &tb->data[i]; + + if (entry->status != SH_STATUS_IN_USE) + { + startelem = i; + break; + } + } + + /* we should have found an empty element */ + Assert(startelem < SH_MAX_SIZE); + + /* + * Iterate backwards, that allows the current element to be deleted, even + * if there are backward shifts + */ + iter->cur = startelem; + iter->end = iter->cur; + iter->done = false; +} + +/* + * Initialize iterator to a specific bucket. That's really only useful for + * cases where callers are partially iterating over the hashspace, and that + * iteration deletes and inserts elements based on visited entries. Doing that + * repeatedly could lead to an unbalanced keyspace when always starting at the + * same position. + */ +SH_SCOPE void +SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at) +{ + /* + * Iterate backwards, that allows the current element to be deleted, even + * if there are backward shifts. + */ + iter->cur = at & tb->sizemask; /* ensure at is within a valid range */ + iter->end = iter->cur; + iter->done = false; +} + +/* + * Iterate over all entries in the hash-table. Return the next occupied entry, + * or NULL if done. + * + * During iteration the current entry in the hash table may be deleted, + * without leading to elements being skipped or returned twice. Additionally + * the rest of the table may be modified (i.e. there can be insertions or + * deletions), but if so, there's neither a guarantee that all nodes are + * visited at least once, nor a guarantee that a node is visited at most once. + */ +SH_SCOPE SH_ELEMENT_TYPE * +SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) +{ + while (!iter->done) + { + SH_ELEMENT_TYPE *elem; + + elem = &tb->data[iter->cur]; + + /* next element in backward direction */ + iter->cur = (iter->cur - 1) & tb->sizemask; + + if ((iter->cur & tb->sizemask) == (iter->end & tb->sizemask)) + iter->done = true; + if (elem->status == SH_STATUS_IN_USE) + { + return elem; + } + } + + return NULL; +} + +/* + * Report some statistics about the state of the hashtable. For + * debugging/profiling purposes only. + */ +SH_SCOPE void +SH_STAT(SH_TYPE * tb) +{ + uint32 max_chain_length = 0; + uint32 total_chain_length = 0; + double avg_chain_length; + double fillfactor; + uint32 i; + + uint32 *collisions = (uint32 *) palloc0(tb->size * sizeof(uint32)); + uint32 total_collisions = 0; + uint32 max_collisions = 0; + double avg_collisions; + + for (i = 0; i < tb->size; i++) + { + uint32 hash; + uint32 optimal; + uint32 dist; + SH_ELEMENT_TYPE *elem; + + elem = &tb->data[i]; + + if (elem->status != SH_STATUS_IN_USE) + continue; + + hash = SH_ENTRY_HASH(tb, elem); + optimal = SH_INITIAL_BUCKET(tb, hash); + dist = SH_DISTANCE_FROM_OPTIMAL(tb, optimal, i); + + if (dist > max_chain_length) + max_chain_length = dist; + total_chain_length += dist; + + collisions[optimal]++; + } + + for (i = 0; i < tb->size; i++) + { + uint32 curcoll = collisions[i]; + + if (curcoll == 0) + continue; + + /* single contained element is not a collision */ + curcoll--; + total_collisions += curcoll; + if (curcoll > max_collisions) + max_collisions = curcoll; + } + + /* large enough to be worth freeing, even if just used for debugging */ + pfree(collisions); + + if (tb->members > 0) + { + fillfactor = tb->members / ((double) tb->size); + avg_chain_length = ((double) total_chain_length) / tb->members; + avg_collisions = ((double) total_collisions) / tb->members; + } + else + { + fillfactor = 0; + avg_chain_length = 0; + avg_collisions = 0; + } + + sh_log("size: " UINT64_FORMAT ", members: %u, filled: %f, total chain: %u, max chain: %u, avg chain: %f, total_collisions: %u, max_collisions: %u, avg_collisions: %f", + tb->size, tb->members, fillfactor, total_chain_length, max_chain_length, avg_chain_length, + total_collisions, max_collisions, avg_collisions); +} + +#endif /* SH_DEFINE */ + + +/* undefine external parameters, so next hash table can be defined */ +#undef SH_PREFIX +#undef SH_KEY_TYPE +#undef SH_KEY +#undef SH_ELEMENT_TYPE +#undef SH_HASH_KEY +#undef SH_SCOPE +#undef SH_DECLARE +#undef SH_DEFINE +#undef SH_GET_HASH +#undef SH_STORE_HASH +#undef SH_USE_NONDEFAULT_ALLOCATOR +#undef SH_EQUAL + +/* undefine locally declared macros */ +#undef SH_MAKE_PREFIX +#undef SH_MAKE_NAME +#undef SH_MAKE_NAME_ +#undef SH_FILLFACTOR +#undef SH_MAX_FILLFACTOR +#undef SH_GROW_MAX_DIB +#undef SH_GROW_MAX_MOVE +#undef SH_GROW_MIN_FILLFACTOR +#undef SH_MAX_SIZE + +/* types */ +#undef SH_TYPE +#undef SH_STATUS +#undef SH_STATUS_EMPTY +#undef SH_STATUS_IN_USE +#undef SH_ITERATOR + +/* external function names */ +#undef SH_CREATE +#undef SH_DESTROY +#undef SH_RESET +#undef SH_INSERT +#undef SH_INSERT_HASH +#undef SH_DELETE_ITEM +#undef SH_DELETE +#undef SH_LOOKUP +#undef SH_LOOKUP_HASH +#undef SH_GROW +#undef SH_START_ITERATE +#undef SH_START_ITERATE_AT +#undef SH_ITERATE +#undef SH_ALLOCATE +#undef SH_FREE +#undef SH_STAT + +/* internal function names */ +#undef SH_COMPUTE_SIZE +#undef SH_UPDATE_PARAMETERS +#undef SH_COMPARE_KEYS +#undef SH_INITIAL_BUCKET +#undef SH_NEXT +#undef SH_PREV +#undef SH_DISTANCE_FROM_OPTIMAL +#undef SH_ENTRY_HASH +#undef SH_INSERT_HASH_INTERNAL +#undef SH_LOOKUP_HASH_INTERNAL diff --git a/platform/dbops/binaries/postgres/include/server/lib/sort_template.h b/platform/dbops/binaries/postgres/include/server/lib/sort_template.h new file mode 100644 index 0000000000000000000000000000000000000000..00a04a6da4878b51b3242ddc173a52a20eaf021b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/sort_template.h @@ -0,0 +1,445 @@ +/*------------------------------------------------------------------------- + * + * sort_template.h + * + * A template for a sort algorithm that supports varying degrees of + * specialization. + * + * Copyright (c) 2021-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1992-1994, Regents of the University of California + * + * Usage notes: + * + * To generate functions specialized for a type, the following parameter + * macros should be #define'd before this file is included. + * + * - ST_SORT - the name of a sort function to be generated + * - ST_ELEMENT_TYPE - type of the referenced elements + * - ST_DECLARE - if defined the functions and types are declared + * - ST_DEFINE - if defined the functions and types are defined + * - ST_SCOPE - scope (e.g. extern, static inline) for functions + * - ST_CHECK_FOR_INTERRUPTS - if defined the sort is interruptible + * + * Instead of ST_ELEMENT_TYPE, ST_ELEMENT_TYPE_VOID can be defined. Then + * the generated functions will automatically gain an "element_size" + * parameter. This allows us to generate a traditional qsort function. + * + * One of the following macros must be defined, to show how to compare + * elements. The first two options are arbitrary expressions depending + * on whether an extra pass-through argument is desired, and the third + * option should be defined if the sort function should receive a + * function pointer at runtime. + * + * - ST_COMPARE(a, b) - a simple comparison expression + * - ST_COMPARE(a, b, arg) - variant that takes an extra argument + * - ST_COMPARE_RUNTIME_POINTER - sort function takes a function pointer + * + * NB: If the comparator function is inlined, some compilers may produce + * worse code with the optimized comparison routines in common/int.h than + * with code with the following form: + * + * if (a < b) + * return -1; + * if (a > b) + * return 1; + * return 0; + * + * To say that the comparator and therefore also sort function should + * receive an extra pass-through argument, specify the type of the + * argument. + * + * - ST_COMPARE_ARG_TYPE - type of extra argument + * + * The prototype of the generated sort function is: + * + * void ST_SORT(ST_ELEMENT_TYPE *data, size_t n, + * [size_t element_size,] + * [ST_SORT_compare_function compare,] + * [ST_COMPARE_ARG_TYPE *arg]); + * + * ST_SORT_compare_function is a function pointer of the following type: + * + * int (*)(const ST_ELEMENT_TYPE *a, const ST_ELEMENT_TYPE *b, + * [ST_COMPARE_ARG_TYPE *arg]) + * + * HISTORY + * + * Modifications from vanilla NetBSD source: + * - Add do ... while() macro fix + * - Remove __inline, _DIAGASSERTs, __P + * - Remove ill-considered "swap_cnt" switch to insertion sort, in favor + * of a simple check for presorted input. + * - Take care to recurse on the smaller partition, to bound stack usage + * - Convert into a header that can generate specialized functions + * + * IDENTIFICATION + * src/include/lib/sort_template.h + * + *------------------------------------------------------------------------- + */ + +/* $NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Qsort routine based on J. L. Bentley and M. D. McIlroy, + * "Engineering a sort function", + * Software--Practice and Experience 23 (1993) 1249-1265. + * + * We have modified their original by adding a check for already-sorted + * input, which seems to be a win per discussions on pgsql-hackers around + * 2006-03-21. + * + * Also, we recurse on the smaller partition and iterate on the larger one, + * which ensures we cannot recurse more than log(N) levels (since the + * partition recursed to is surely no more than half of the input). Bentley + * and McIlroy explicitly rejected doing this on the grounds that it's "not + * worth the effort", but we have seen crashes in the field due to stack + * overrun, so that judgment seems wrong. + */ + +#define ST_MAKE_PREFIX(a) CppConcat(a,_) +#define ST_MAKE_NAME(a,b) ST_MAKE_NAME_(ST_MAKE_PREFIX(a),b) +#define ST_MAKE_NAME_(a,b) CppConcat(a,b) + +/* + * If the element type is void, we'll also need an element_size argument + * because we don't know the size. + */ +#ifdef ST_ELEMENT_TYPE_VOID +#define ST_ELEMENT_TYPE void +#define ST_SORT_PROTO_ELEMENT_SIZE , size_t element_size +#define ST_SORT_INVOKE_ELEMENT_SIZE , element_size +#else +#define ST_SORT_PROTO_ELEMENT_SIZE +#define ST_SORT_INVOKE_ELEMENT_SIZE +#endif + +/* + * If the user wants to be able to pass in compare functions at runtime, + * we'll need to make that an argument of the sort and med3 functions. + */ +#ifdef ST_COMPARE_RUNTIME_POINTER +/* + * The type of the comparator function pointer that ST_SORT will take, unless + * you've already declared a type name manually and want to use that instead of + * having a new one defined. + */ +#ifndef ST_COMPARATOR_TYPE_NAME +#define ST_COMPARATOR_TYPE_NAME ST_MAKE_NAME(ST_SORT, compare_function) +#endif +#define ST_COMPARE compare +#ifndef ST_COMPARE_ARG_TYPE +#define ST_SORT_PROTO_COMPARE , ST_COMPARATOR_TYPE_NAME compare +#define ST_SORT_INVOKE_COMPARE , compare +#else +#define ST_SORT_PROTO_COMPARE , ST_COMPARATOR_TYPE_NAME compare +#define ST_SORT_INVOKE_COMPARE , compare +#endif +#else +#define ST_SORT_PROTO_COMPARE +#define ST_SORT_INVOKE_COMPARE +#endif + +/* + * If the user wants to use a compare function or expression that takes an + * extra argument, we'll need to make that an argument of the sort, compare and + * med3 functions. + */ +#ifdef ST_COMPARE_ARG_TYPE +#define ST_SORT_PROTO_ARG , ST_COMPARE_ARG_TYPE *arg +#define ST_SORT_INVOKE_ARG , arg +#else +#define ST_SORT_PROTO_ARG +#define ST_SORT_INVOKE_ARG +#endif + +#ifdef ST_DECLARE + +#ifdef ST_COMPARE_RUNTIME_POINTER +typedef int (*ST_COMPARATOR_TYPE_NAME) (const ST_ELEMENT_TYPE *, + const ST_ELEMENT_TYPE * ST_SORT_PROTO_ARG); +#endif + +/* Declare the sort function. Note optional arguments at end. */ +ST_SCOPE void ST_SORT(ST_ELEMENT_TYPE * first, size_t n + ST_SORT_PROTO_ELEMENT_SIZE + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG); + +#endif + +#ifdef ST_DEFINE + +/* sort private helper functions */ +#define ST_MED3 ST_MAKE_NAME(ST_SORT, med3) +#define ST_SWAP ST_MAKE_NAME(ST_SORT, swap) +#define ST_SWAPN ST_MAKE_NAME(ST_SORT, swapn) + +/* Users expecting to run very large sorts may need them to be interruptible. */ +#ifdef ST_CHECK_FOR_INTERRUPTS +#define DO_CHECK_FOR_INTERRUPTS() CHECK_FOR_INTERRUPTS() +#else +#define DO_CHECK_FOR_INTERRUPTS() +#endif + +/* + * Create wrapper macros that know how to invoke compare, med3 and sort with + * the right arguments. + */ +#ifdef ST_COMPARE_RUNTIME_POINTER +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_) ST_SORT_INVOKE_ARG) +#elif defined(ST_COMPARE_ARG_TYPE) +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_), arg) +#else +#define DO_COMPARE(a_, b_) ST_COMPARE((a_), (b_)) +#endif +#define DO_MED3(a_, b_, c_) \ + ST_MED3((a_), (b_), (c_) \ + ST_SORT_INVOKE_COMPARE \ + ST_SORT_INVOKE_ARG) +#define DO_SORT(a_, n_) \ + ST_SORT((a_), (n_) \ + ST_SORT_INVOKE_ELEMENT_SIZE \ + ST_SORT_INVOKE_COMPARE \ + ST_SORT_INVOKE_ARG) + +/* + * If we're working with void pointers, we'll use pointer arithmetic based on + * uint8, and use the runtime element_size to step through the array and swap + * elements. Otherwise we'll work with ST_ELEMENT_TYPE. + */ +#ifndef ST_ELEMENT_TYPE_VOID +#define ST_POINTER_TYPE ST_ELEMENT_TYPE +#define ST_POINTER_STEP 1 +#define DO_SWAPN(a_, b_, n_) ST_SWAPN((a_), (b_), (n_)) +#define DO_SWAP(a_, b_) ST_SWAP((a_), (b_)) +#else +#define ST_POINTER_TYPE uint8 +#define ST_POINTER_STEP element_size +#define DO_SWAPN(a_, b_, n_) ST_SWAPN((a_), (b_), (n_)) +#define DO_SWAP(a_, b_) DO_SWAPN((a_), (b_), element_size) +#endif + +/* + * Find the median of three values. Currently, performance seems to be best + * if the comparator is inlined here, but the med3 function is not inlined + * in the qsort function. + * + * Refer to the comment at the top of this file for known caveats to consider + * when writing inlined comparator functions. + */ +static pg_noinline ST_ELEMENT_TYPE * +ST_MED3(ST_ELEMENT_TYPE * a, + ST_ELEMENT_TYPE * b, + ST_ELEMENT_TYPE * c + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG) +{ + return DO_COMPARE(a, b) < 0 ? + (DO_COMPARE(b, c) < 0 ? b : (DO_COMPARE(a, c) < 0 ? c : a)) + : (DO_COMPARE(b, c) > 0 ? b : (DO_COMPARE(a, c) < 0 ? a : c)); +} + +static inline void +ST_SWAP(ST_POINTER_TYPE * a, ST_POINTER_TYPE * b) +{ + ST_POINTER_TYPE tmp = *a; + + *a = *b; + *b = tmp; +} + +static inline void +ST_SWAPN(ST_POINTER_TYPE * a, ST_POINTER_TYPE * b, size_t n) +{ + for (size_t i = 0; i < n; ++i) + ST_SWAP(&a[i], &b[i]); +} + +/* + * Sort an array. + */ +ST_SCOPE void +ST_SORT(ST_ELEMENT_TYPE * data, size_t n + ST_SORT_PROTO_ELEMENT_SIZE + ST_SORT_PROTO_COMPARE + ST_SORT_PROTO_ARG) +{ + ST_POINTER_TYPE *a = (ST_POINTER_TYPE *) data, + *pa, + *pb, + *pc, + *pd, + *pl, + *pm, + *pn; + size_t d1, + d2; + int r, + presorted; + +loop: + DO_CHECK_FOR_INTERRUPTS(); + if (n < 7) + { + for (pm = a + ST_POINTER_STEP; pm < a + n * ST_POINTER_STEP; + pm += ST_POINTER_STEP) + for (pl = pm; pl > a && DO_COMPARE(pl - ST_POINTER_STEP, pl) > 0; + pl -= ST_POINTER_STEP) + DO_SWAP(pl, pl - ST_POINTER_STEP); + return; + } + presorted = 1; + for (pm = a + ST_POINTER_STEP; pm < a + n * ST_POINTER_STEP; + pm += ST_POINTER_STEP) + { + DO_CHECK_FOR_INTERRUPTS(); + if (DO_COMPARE(pm - ST_POINTER_STEP, pm) > 0) + { + presorted = 0; + break; + } + } + if (presorted) + return; + pm = a + (n / 2) * ST_POINTER_STEP; + if (n > 7) + { + pl = a; + pn = a + (n - 1) * ST_POINTER_STEP; + if (n > 40) + { + size_t d = (n / 8) * ST_POINTER_STEP; + + pl = DO_MED3(pl, pl + d, pl + 2 * d); + pm = DO_MED3(pm - d, pm, pm + d); + pn = DO_MED3(pn - 2 * d, pn - d, pn); + } + pm = DO_MED3(pl, pm, pn); + } + DO_SWAP(a, pm); + pa = pb = a + ST_POINTER_STEP; + pc = pd = a + (n - 1) * ST_POINTER_STEP; + for (;;) + { + while (pb <= pc && (r = DO_COMPARE(pb, a)) <= 0) + { + if (r == 0) + { + DO_SWAP(pa, pb); + pa += ST_POINTER_STEP; + } + pb += ST_POINTER_STEP; + DO_CHECK_FOR_INTERRUPTS(); + } + while (pb <= pc && (r = DO_COMPARE(pc, a)) >= 0) + { + if (r == 0) + { + DO_SWAP(pc, pd); + pd -= ST_POINTER_STEP; + } + pc -= ST_POINTER_STEP; + DO_CHECK_FOR_INTERRUPTS(); + } + if (pb > pc) + break; + DO_SWAP(pb, pc); + pb += ST_POINTER_STEP; + pc -= ST_POINTER_STEP; + } + pn = a + n * ST_POINTER_STEP; + d1 = Min(pa - a, pb - pa); + DO_SWAPN(a, pb - d1, d1); + d1 = Min(pd - pc, pn - pd - ST_POINTER_STEP); + DO_SWAPN(pb, pn - d1, d1); + d1 = pb - pa; + d2 = pd - pc; + if (d1 <= d2) + { + /* Recurse on left partition, then iterate on right partition */ + if (d1 > ST_POINTER_STEP) + DO_SORT(a, d1 / ST_POINTER_STEP); + if (d2 > ST_POINTER_STEP) + { + /* Iterate rather than recurse to save stack space */ + /* DO_SORT(pn - d2, d2 / ST_POINTER_STEP) */ + a = pn - d2; + n = d2 / ST_POINTER_STEP; + goto loop; + } + } + else + { + /* Recurse on right partition, then iterate on left partition */ + if (d2 > ST_POINTER_STEP) + DO_SORT(pn - d2, d2 / ST_POINTER_STEP); + if (d1 > ST_POINTER_STEP) + { + /* Iterate rather than recurse to save stack space */ + /* DO_SORT(a, d1 / ST_POINTER_STEP) */ + n = d1 / ST_POINTER_STEP; + goto loop; + } + } +} +#endif + +#undef DO_CHECK_FOR_INTERRUPTS +#undef DO_COMPARE +#undef DO_MED3 +#undef DO_SORT +#undef DO_SWAP +#undef DO_SWAPN +#undef ST_CHECK_FOR_INTERRUPTS +#undef ST_COMPARATOR_TYPE_NAME +#undef ST_COMPARE +#undef ST_COMPARE_ARG_TYPE +#undef ST_COMPARE_RUNTIME_POINTER +#undef ST_ELEMENT_TYPE +#undef ST_ELEMENT_TYPE_VOID +#undef ST_MAKE_NAME +#undef ST_MAKE_NAME_ +#undef ST_MAKE_PREFIX +#undef ST_MED3 +#undef ST_POINTER_STEP +#undef ST_POINTER_TYPE +#undef ST_SCOPE +#undef ST_SORT +#undef ST_SORT_INVOKE_ARG +#undef ST_SORT_INVOKE_COMPARE +#undef ST_SORT_INVOKE_ELEMENT_SIZE +#undef ST_SORT_PROTO_ARG +#undef ST_SORT_PROTO_COMPARE +#undef ST_SORT_PROTO_ELEMENT_SIZE +#undef ST_SWAP +#undef ST_SWAPN diff --git a/platform/dbops/binaries/postgres/include/server/lib/stringinfo.h b/platform/dbops/binaries/postgres/include/server/lib/stringinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..cd9632e3fcacf66e4506adb076383a3c77b62f82 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/lib/stringinfo.h @@ -0,0 +1,243 @@ +/*------------------------------------------------------------------------- + * + * stringinfo.h + * Declarations/definitions for "StringInfo" functions. + * + * StringInfo provides an extensible string data type (currently limited to a + * length of 1GB). It can be used to buffer either ordinary C strings + * (null-terminated text) or arbitrary binary data. All storage is allocated + * with palloc() (falling back to malloc in frontend code). + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/lib/stringinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef STRINGINFO_H +#define STRINGINFO_H + +/*------------------------- + * StringInfoData holds information about an extensible string. + * data is the current buffer for the string. + * len is the current string length. Except in the case of read-only + * strings described below, there is guaranteed to be a + * terminating '\0' at data[len]. + * maxlen is the allocated size in bytes of 'data', i.e. the maximum + * string size (including the terminating '\0' char) that we can + * currently store in 'data' without having to reallocate + * more space. We must always have maxlen > len, except + * in the read-only case described below. + * cursor is initialized to zero by makeStringInfo, initStringInfo, + * initReadOnlyStringInfo and initStringInfoFromString but is not + * otherwise touched by the stringinfo.c routines. Some routines + * use it to scan through a StringInfo. + * + * As a special case, a StringInfoData can be initialized with a read-only + * string buffer. In this case "data" does not necessarily point at a + * palloc'd chunk, and management of the buffer storage is the caller's + * responsibility. maxlen is set to zero to indicate that this is the case. + * Read-only StringInfoDatas cannot be appended to or reset. + * Also, it is caller's option whether a read-only string buffer has a + * terminating '\0' or not. This depends on the intended usage. + *------------------------- + */ +typedef struct StringInfoData +{ + char *data; + int len; + int maxlen; + int cursor; +} StringInfoData; + +typedef StringInfoData *StringInfo; + + +/*------------------------ + * There are four ways to create a StringInfo object initially: + * + * StringInfo stringptr = makeStringInfo(); + * Both the StringInfoData and the data buffer are palloc'd. + * + * StringInfoData string; + * initStringInfo(&string); + * The data buffer is palloc'd but the StringInfoData is just local. + * This is the easiest approach for a StringInfo object that will + * only live as long as the current routine. + * + * StringInfoData string; + * initReadOnlyStringInfo(&string, existingbuf, len); + * The StringInfoData's data field is set to point directly to the + * existing buffer and the StringInfoData's len is set to the given len. + * The given buffer can point to memory that's not managed by palloc or + * is pointing partway through a palloc'd chunk. The maxlen field is set + * to 0. A read-only StringInfo cannot be appended to using any of the + * appendStringInfo functions or reset with resetStringInfo(). The given + * buffer can optionally omit the trailing NUL. + * + * StringInfoData string; + * initStringInfoFromString(&string, palloced_buf, len); + * The StringInfoData's data field is set to point directly to the given + * buffer and the StringInfoData's len is set to the given len. This + * method of initialization is useful when the buffer already exists. + * StringInfos initialized this way can be appended to using the + * appendStringInfo functions and reset with resetStringInfo(). The + * given buffer must be NUL-terminated. The palloc'd buffer is assumed + * to be len + 1 in size. + * + * To destroy a StringInfo, pfree() the data buffer, and then pfree() the + * StringInfoData if it was palloc'd. For StringInfos created with + * makeStringInfo(), destroyStringInfo() is provided for this purpose. + * However, if the StringInfo was initialized using initReadOnlyStringInfo() + * then the caller will need to consider if it is safe to pfree the data + * buffer. + * + * NOTE: some routines build up a string using StringInfo, and then + * release the StringInfoData but return the data string itself to their + * caller. At that point the data string looks like a plain palloc'd + * string. + *------------------------- + */ + +/*------------------------ + * makeStringInfo + * Create an empty 'StringInfoData' & return a pointer to it. + */ +extern StringInfo makeStringInfo(void); + +/*------------------------ + * initStringInfo + * Initialize a StringInfoData struct (with previously undefined contents) + * to describe an empty string. + */ +extern void initStringInfo(StringInfo str); + +/*------------------------ + * initReadOnlyStringInfo + * Initialize a StringInfoData struct from an existing string without copying + * the string. The caller is responsible for ensuring the given string + * remains valid as long as the StringInfoData does. Calls to this are used + * in performance critical locations where allocating a new buffer and copying + * would be too costly. Read-only StringInfoData's may not be appended to + * using any of the appendStringInfo functions or reset with + * resetStringInfo(). + * + * 'data' does not need to point directly to a palloc'd chunk of memory and may + * omit the NUL termination character at data[len]. + */ +static inline void +initReadOnlyStringInfo(StringInfo str, char *data, int len) +{ + str->data = data; + str->len = len; + str->maxlen = 0; /* read-only */ + str->cursor = 0; +} + +/*------------------------ + * initStringInfoFromString + * Initialize a StringInfoData struct from an existing string without copying + * the string. 'data' must be a valid palloc'd chunk of memory that can have + * repalloc() called should more space be required during a call to any of the + * appendStringInfo functions. + * + * 'data' must be NUL terminated at 'len' bytes. + */ +static inline void +initStringInfoFromString(StringInfo str, char *data, int len) +{ + Assert(data[len] == '\0'); + + str->data = data; + str->len = len; + str->maxlen = len + 1; + str->cursor = 0; +} + +/*------------------------ + * resetStringInfo + * Clears the current content of the StringInfo, if any. The + * StringInfo remains valid. + */ +extern void resetStringInfo(StringInfo str); + +/*------------------------ + * appendStringInfo + * Format text data under the control of fmt (an sprintf-style format string) + * and append it to whatever is already in str. More space is allocated + * to str if necessary. This is sort of like a combination of sprintf and + * strcat. + */ +extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3); + +/*------------------------ + * appendStringInfoVA + * Attempt to format text data under the control of fmt (an sprintf-style + * format string) and append it to whatever is already in str. If successful + * return zero; if not (because there's not enough space), return an estimate + * of the space needed, without modifying str. Typically the caller should + * pass the return value to enlargeStringInfo() before trying again; see + * appendStringInfo for standard usage pattern. + */ +extern int appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0); + +/*------------------------ + * appendStringInfoString + * Append a null-terminated string to str. + * Like appendStringInfo(str, "%s", s) but faster. + */ +extern void appendStringInfoString(StringInfo str, const char *s); + +/*------------------------ + * appendStringInfoChar + * Append a single byte to str. + * Like appendStringInfo(str, "%c", ch) but much faster. + */ +extern void appendStringInfoChar(StringInfo str, char ch); + +/*------------------------ + * appendStringInfoCharMacro + * As above, but a macro for even more speed where it matters. + * Caution: str argument will be evaluated multiple times. + */ +#define appendStringInfoCharMacro(str,ch) \ + (((str)->len + 1 >= (str)->maxlen) ? \ + appendStringInfoChar(str, ch) : \ + (void)((str)->data[(str)->len] = (ch), (str)->data[++(str)->len] = '\0')) + +/*------------------------ + * appendStringInfoSpaces + * Append a given number of spaces to str. + */ +extern void appendStringInfoSpaces(StringInfo str, int count); + +/*------------------------ + * appendBinaryStringInfo + * Append arbitrary binary data to a StringInfo, allocating more space + * if necessary. + */ +extern void appendBinaryStringInfo(StringInfo str, + const void *data, int datalen); + +/*------------------------ + * appendBinaryStringInfoNT + * Append arbitrary binary data to a StringInfo, allocating more space + * if necessary. Does not ensure a trailing null-byte exists. + */ +extern void appendBinaryStringInfoNT(StringInfo str, + const void *data, int datalen); + +/*------------------------ + * enlargeStringInfo + * Make sure a StringInfo's buffer can hold at least 'needed' more bytes. + */ +extern void enlargeStringInfo(StringInfo str, int needed); + +/*------------------------ + * destroyStringInfo + * Frees a StringInfo and its buffer (opposite of makeStringInfo()). + */ +extern void destroyStringInfo(StringInfo str); + +#endif /* STRINGINFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/auth.h b/platform/dbops/binaries/postgres/include/server/libpq/auth.h new file mode 100644 index 0000000000000000000000000000000000000000..227b41daf656f478dc00ce0604659e539b94fdcf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/auth.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * auth.h + * Definitions for network authentication routines + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/auth.h + * + *------------------------------------------------------------------------- + */ +#ifndef AUTH_H +#define AUTH_H + +#include "libpq/libpq-be.h" + +extern PGDLLIMPORT char *pg_krb_server_keyfile; +extern PGDLLIMPORT bool pg_krb_caseins_users; +extern PGDLLIMPORT bool pg_gss_accept_delegation; + +extern void ClientAuthentication(Port *port); +extern void sendAuthRequest(Port *port, AuthRequest areq, const char *extradata, + int extralen); + +/* Hook for plugins to get control in ClientAuthentication() */ +typedef void (*ClientAuthentication_hook_type) (Port *, int); +extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; + +/* hook type for password manglers */ +typedef char *(*auth_password_hook_typ) (char *input); + +/* Default LDAP password mutator hook, can be overridden by a shared library */ +extern PGDLLIMPORT auth_password_hook_typ ldap_password_hook; + +#endif /* AUTH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/be-fsstubs.h b/platform/dbops/binaries/postgres/include/server/libpq/be-fsstubs.h new file mode 100644 index 0000000000000000000000000000000000000000..336b9cef125087921670fc940b4fd75526990497 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/be-fsstubs.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * be-fsstubs.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/be-fsstubs.h + * + *------------------------------------------------------------------------- + */ +#ifndef BE_FSSTUBS_H +#define BE_FSSTUBS_H + +/* + * These are not fmgr-callable, but are available to C code. + * Probably these should have had the underscore-free names, + * but too late now... + */ +extern int lo_read(int fd, char *buf, int len); +extern int lo_write(int fd, const char *buf, int len); + +/* + * Cleanup LOs at xact commit/abort + */ +extern void AtEOXact_LargeObject(bool isCommit); +extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +#endif /* BE_FSSTUBS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/be-gssapi-common.h b/platform/dbops/binaries/postgres/include/server/libpq/be-gssapi-common.h new file mode 100644 index 0000000000000000000000000000000000000000..474c3a6c1f1f6e1759271b643fc8f9d07ed71597 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/be-gssapi-common.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * be-gssapi-common.h + * Definitions for GSSAPI authentication and encryption handling + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/be-gssapi-common.h + * + *------------------------------------------------------------------------- + */ + +#ifndef BE_GSSAPI_COMMON_H +#define BE_GSSAPI_COMMON_H + +#ifdef ENABLE_GSS + +#if defined(HAVE_GSSAPI_H) +#include +#include +#else +#include +#include +#endif + +extern void pg_GSS_error(const char *errmsg, + OM_uint32 maj_stat, OM_uint32 min_stat); + +extern void pg_store_delegated_credential(gss_cred_id_t cred); +#endif /* ENABLE_GSS */ + +#endif /* BE_GSSAPI_COMMON_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/crypt.h b/platform/dbops/binaries/postgres/include/server/libpq/crypt.h new file mode 100644 index 0000000000000000000000000000000000000000..f744de4d202b616890d4ded6200f9fbadc0a34d8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/crypt.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * crypt.h + * Interface to libpq/crypt.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/crypt.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CRYPT_H +#define PG_CRYPT_H + +#include "datatype/timestamp.h" + +/* + * Types of password hashes or secrets. + * + * Plaintext passwords can be passed in by the user, in a CREATE/ALTER USER + * command. They will be encrypted to MD5 or SCRAM-SHA-256 format, before + * storing on-disk, so only MD5 and SCRAM-SHA-256 passwords should appear + * in pg_authid.rolpassword. They are also the allowed values for the + * password_encryption GUC. + */ +typedef enum PasswordType +{ + PASSWORD_TYPE_PLAINTEXT = 0, + PASSWORD_TYPE_MD5, + PASSWORD_TYPE_SCRAM_SHA_256, +} PasswordType; + +extern PasswordType get_password_type(const char *shadow_pass); +extern char *encrypt_password(PasswordType target_type, const char *role, + const char *password); + +extern char *get_role_password(const char *role, const char **logdetail); + +extern int md5_crypt_verify(const char *role, const char *shadow_pass, + const char *client_pass, const char *md5_salt, + int md5_salt_len, const char **logdetail); +extern int plain_crypt_verify(const char *role, const char *shadow_pass, + const char *client_pass, + const char **logdetail); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/libpq/hba.h b/platform/dbops/binaries/postgres/include/server/libpq/hba.h new file mode 100644 index 0000000000000000000000000000000000000000..8ea837ae82a6bd853f130d1b5368312ea36988ea --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/hba.h @@ -0,0 +1,186 @@ +/*------------------------------------------------------------------------- + * + * hba.h + * Interface to hba.c + * + * + * src/include/libpq/hba.h + * + *------------------------------------------------------------------------- + */ +#ifndef HBA_H +#define HBA_H + +#include "libpq/pqcomm.h" /* pgrminclude ignore */ /* needed for NetBSD */ +#include "nodes/pg_list.h" +#include "regex/regex.h" + + +/* + * The following enum represents the authentication methods that + * are supported by PostgreSQL. + * + * Note: keep this in sync with the UserAuthName array in hba.c. + */ +typedef enum UserAuth +{ + uaReject, + uaImplicitReject, /* Not a user-visible option */ + uaTrust, + uaIdent, + uaPassword, + uaMD5, + uaSCRAM, + uaGSS, + uaSSPI, + uaPAM, + uaBSD, + uaLDAP, + uaCert, + uaRADIUS, + uaPeer, +#define USER_AUTH_LAST uaPeer /* Must be last value of this enum */ +} UserAuth; + +/* + * Data structures representing pg_hba.conf entries + */ + +typedef enum IPCompareMethod +{ + ipCmpMask, + ipCmpSameHost, + ipCmpSameNet, + ipCmpAll, +} IPCompareMethod; + +typedef enum ConnType +{ + ctLocal, + ctHost, + ctHostSSL, + ctHostNoSSL, + ctHostGSS, + ctHostNoGSS, +} ConnType; + +typedef enum ClientCertMode +{ + clientCertOff, + clientCertCA, + clientCertFull, +} ClientCertMode; + +typedef enum ClientCertName +{ + clientCertCN, + clientCertDN, +} ClientCertName; + +/* + * A single string token lexed from an authentication configuration file + * (pg_ident.conf or pg_hba.conf), together with whether the token has + * been quoted. If "string" begins with a slash, it may optionally + * contain a regular expression (currently used for pg_ident.conf when + * building IdentLines and for pg_hba.conf when building HbaLines). + */ +typedef struct AuthToken +{ + char *string; + bool quoted; + regex_t *regex; +} AuthToken; + +typedef struct HbaLine +{ + char *sourcefile; + int linenumber; + char *rawline; + ConnType conntype; + List *databases; + List *roles; + struct sockaddr_storage addr; + int addrlen; /* zero if we don't have a valid addr */ + struct sockaddr_storage mask; + int masklen; /* zero if we don't have a valid mask */ + IPCompareMethod ip_cmp_method; + char *hostname; + UserAuth auth_method; + char *usermap; + char *pamservice; + bool pam_use_hostname; + bool ldaptls; + char *ldapscheme; + char *ldapserver; + int ldapport; + char *ldapbinddn; + char *ldapbindpasswd; + char *ldapsearchattribute; + char *ldapsearchfilter; + char *ldapbasedn; + int ldapscope; + char *ldapprefix; + char *ldapsuffix; + ClientCertMode clientcert; + ClientCertName clientcertname; + char *krb_realm; + bool include_realm; + bool compat_realm; + bool upn_username; + List *radiusservers; + char *radiusservers_s; + List *radiussecrets; + char *radiussecrets_s; + List *radiusidentifiers; + char *radiusidentifiers_s; + List *radiusports; + char *radiusports_s; +} HbaLine; + +typedef struct IdentLine +{ + int linenumber; + + char *usermap; + AuthToken *system_user; + AuthToken *pg_user; +} IdentLine; + +/* + * TokenizedAuthLine represents one line lexed from an authentication + * configuration file. Each item in the "fields" list is a sub-list of + * AuthTokens. We don't emit a TokenizedAuthLine for empty or all-comment + * lines, so "fields" is never NIL (nor are any of its sub-lists). + * + * Exception: if an error occurs during tokenization, we might have + * fields == NIL, in which case err_msg != NULL. + */ +typedef struct TokenizedAuthLine +{ + List *fields; /* List of lists of AuthTokens */ + char *file_name; /* File name of origin */ + int line_num; /* Line number */ + char *raw_line; /* Raw line text */ + char *err_msg; /* Error message if any */ +} TokenizedAuthLine; + +/* kluge to avoid including libpq/libpq-be.h here */ +typedef struct Port hbaPort; + +extern bool load_hba(void); +extern bool load_ident(void); +extern const char *hba_authname(UserAuth auth_method); +extern void hba_getauthmethod(hbaPort *port); +extern int check_usermap(const char *usermap_name, + const char *pg_user, const char *system_user, + bool case_insensitive); +extern HbaLine *parse_hba_line(TokenizedAuthLine *tok_line, int elevel); +extern IdentLine *parse_ident_line(TokenizedAuthLine *tok_line, int elevel); +extern bool pg_isblank(const char c); +extern FILE *open_auth_file(const char *filename, int elevel, int depth, + char **err_msg); +extern void free_auth_file(FILE *file, int depth); +extern void tokenize_auth_file(const char *filename, FILE *file, + List **tok_lines, int elevel, int depth); + +#endif /* HBA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/ifaddr.h b/platform/dbops/binaries/postgres/include/server/libpq/ifaddr.h new file mode 100644 index 0000000000000000000000000000000000000000..5a117d4fe1f0cec5d84d49c70b6dcbf660c1a964 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/ifaddr.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * ifaddr.h + * IP netmask calculations, and enumerating network interfaces. + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/libpq/ifaddr.h + * + *------------------------------------------------------------------------- + */ +#ifndef IFADDR_H +#define IFADDR_H + +#include "libpq/pqcomm.h" /* pgrminclude ignore */ + +typedef void (*PgIfAddrCallback) (struct sockaddr *addr, + struct sockaddr *netmask, + void *cb_data); + +extern int pg_range_sockaddr(const struct sockaddr_storage *addr, + const struct sockaddr_storage *netaddr, + const struct sockaddr_storage *netmask); + +extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, + char *numbits, int family); + +extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data); + +#endif /* IFADDR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/libpq-be-fe-helpers.h b/platform/dbops/binaries/postgres/include/server/libpq/libpq-be-fe-helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..fe508292743f6080738b3cc4b8e54c597dda7908 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/libpq-be-fe-helpers.h @@ -0,0 +1,457 @@ +/*------------------------------------------------------------------------- + * + * libpq-be-fe-helpers.h + * Helper functions for using libpq in extensions + * + * Code built directly into the backend is not allowed to link to libpq + * directly. Extension code is allowed to use libpq however. However, libpq + * used in extensions has to be careful not to block inside libpq, otherwise + * interrupts will not be processed, leading to issues like unresolvable + * deadlocks. Backend code also needs to take care to acquire/release an + * external fd for the connection, otherwise fd.c's accounting of fd's is + * broken. + * + * This file provides helper functions to make it easier to comply with these + * rules. It is a header only library as it needs to be linked into each + * extension using libpq, and it seems too small to be worth adding a + * dedicated static library for. + * + * TODO: For historical reasons the connections established here are not put + * into non-blocking mode. That can lead to blocking even when only the async + * libpq functions are used. This should be fixed. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-be-fe-helpers.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_BE_FE_HELPERS_H +#define LIBPQ_BE_FE_HELPERS_H + +/* + * Despite the name, BUILDING_DLL is set only when building code directly part + * of the backend. Which also is where libpq isn't allowed to be + * used. Obviously this doesn't protect against libpq-fe.h getting included + * otherwise, but perhaps still protects against a few mistakes... + */ +#ifdef BUILDING_DLL +#error "libpq may not be used code directly built into the backend" +#endif + +#include "libpq-fe.h" +#include "miscadmin.h" +#include "storage/fd.h" +#include "storage/latch.h" +#include "utils/timestamp.h" +#include "utils/wait_event.h" + + +static inline void libpqsrv_connect_prepare(void); +static inline void libpqsrv_connect_internal(PGconn *conn, uint32 wait_event_info); +static inline PGresult *libpqsrv_get_result_last(PGconn *conn, uint32 wait_event_info); +static inline PGresult *libpqsrv_get_result(PGconn *conn, uint32 wait_event_info); + + +/* + * PQconnectdb() wrapper that reserves a file descriptor and processes + * interrupts during connection establishment. + * + * Throws an error if AcquireExternalFD() fails, but does not throw if + * connection establishment itself fails. Callers need to use PQstatus() to + * check if connection establishment succeeded. + */ +static inline PGconn * +libpqsrv_connect(const char *conninfo, uint32 wait_event_info) +{ + PGconn *conn = NULL; + + libpqsrv_connect_prepare(); + + conn = PQconnectStart(conninfo); + + libpqsrv_connect_internal(conn, wait_event_info); + + return conn; +} + +/* + * Like libpqsrv_connect(), except that this is a wrapper for + * PQconnectdbParams(). + */ +static inline PGconn * +libpqsrv_connect_params(const char *const *keywords, + const char *const *values, + int expand_dbname, + uint32 wait_event_info) +{ + PGconn *conn = NULL; + + libpqsrv_connect_prepare(); + + conn = PQconnectStartParams(keywords, values, expand_dbname); + + libpqsrv_connect_internal(conn, wait_event_info); + + return conn; +} + +/* + * PQfinish() wrapper that additionally releases the reserved file descriptor. + * + * It is allowed to call this with a NULL pgconn iff NULL was returned by + * libpqsrv_connect*. + */ +static inline void +libpqsrv_disconnect(PGconn *conn) +{ + /* + * If no connection was established, we haven't reserved an FD for it (or + * already released it). This rule makes it easier to write PG_CATCH() + * handlers for this facility's users. + * + * See also libpqsrv_connect_internal(). + */ + if (conn == NULL) + return; + + ReleaseExternalFD(); + PQfinish(conn); +} + + +/* internal helper functions follow */ + + +/* + * Helper function for all connection establishment functions. + */ +static inline void +libpqsrv_connect_prepare(void) +{ + /* + * We must obey fd.c's limit on non-virtual file descriptors. Assume that + * a PGconn represents one long-lived FD. (Doing this here also ensures + * that VFDs are closed if needed to make room.) + */ + if (!AcquireExternalFD()) + { +#ifndef WIN32 /* can't write #if within ereport() macro */ + ereport(ERROR, + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not establish connection"), + errdetail("There are too many open files on the local server."), + errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits."))); +#else + ereport(ERROR, + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not establish connection"), + errdetail("There are too many open files on the local server."), + errhint("Raise the server's max_files_per_process setting."))); +#endif + } +} + +/* + * Helper function for all connection establishment functions. + */ +static inline void +libpqsrv_connect_internal(PGconn *conn, uint32 wait_event_info) +{ + /* + * With conn == NULL libpqsrv_disconnect() wouldn't release the FD. So do + * that here. + */ + if (conn == NULL) + { + ReleaseExternalFD(); + return; + } + + /* + * Can't wait without a socket. Note that we don't want to close the libpq + * connection yet, so callers can emit a useful error. + */ + if (PQstatus(conn) == CONNECTION_BAD) + return; + + /* + * WaitLatchOrSocket() can conceivably fail, handle that case here instead + * of requiring all callers to do so. + */ + PG_TRY(); + { + PostgresPollingStatusType status; + + /* + * Poll connection until we have OK or FAILED status. + * + * Per spec for PQconnectPoll, first wait till socket is write-ready. + */ + status = PGRES_POLLING_WRITING; + while (status != PGRES_POLLING_OK && status != PGRES_POLLING_FAILED) + { + int io_flag; + int rc; + + if (status == PGRES_POLLING_READING) + io_flag = WL_SOCKET_READABLE; +#ifdef WIN32 + + /* + * Windows needs a different test while waiting for + * connection-made + */ + else if (PQstatus(conn) == CONNECTION_STARTED) + io_flag = WL_SOCKET_CONNECTED; +#endif + else + io_flag = WL_SOCKET_WRITEABLE; + + rc = WaitLatchOrSocket(MyLatch, + WL_EXIT_ON_PM_DEATH | WL_LATCH_SET | io_flag, + PQsocket(conn), + 0, + wait_event_info); + + /* Interrupted? */ + if (rc & WL_LATCH_SET) + { + ResetLatch(MyLatch); + CHECK_FOR_INTERRUPTS(); + } + + /* If socket is ready, advance the libpq state machine */ + if (rc & io_flag) + status = PQconnectPoll(conn); + } + } + PG_CATCH(); + { + /* + * If an error is thrown here, the callers won't call + * libpqsrv_disconnect() with a conn, so release resources + * immediately. + */ + ReleaseExternalFD(); + PQfinish(conn); + + PG_RE_THROW(); + } + PG_END_TRY(); +} + +/* + * PQexec() wrapper that processes interrupts. + * + * Unless PQsetnonblocking(conn, 1) is in effect, this can't process + * interrupts while pushing the query text to the server. Consider that + * setting if query strings can be long relative to TCP buffer size. + * + * This has the preconditions of PQsendQuery(), not those of PQexec(). Most + * notably, PQexec() would silently discard any prior query results. + */ +static inline PGresult * +libpqsrv_exec(PGconn *conn, const char *query, uint32 wait_event_info) +{ + if (!PQsendQuery(conn, query)) + return NULL; + return libpqsrv_get_result_last(conn, wait_event_info); +} + +/* + * PQexecParams() wrapper that processes interrupts. + * + * See notes at libpqsrv_exec(). + */ +static inline PGresult * +libpqsrv_exec_params(PGconn *conn, + const char *command, + int nParams, + const Oid *paramTypes, + const char *const *paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat, + uint32 wait_event_info) +{ + if (!PQsendQueryParams(conn, command, nParams, paramTypes, paramValues, + paramLengths, paramFormats, resultFormat)) + return NULL; + return libpqsrv_get_result_last(conn, wait_event_info); +} + +/* + * Like PQexec(), loop over PQgetResult() until it returns NULL or another + * terminal state. Return the last non-NULL result or the terminal state. + */ +static inline PGresult * +libpqsrv_get_result_last(PGconn *conn, uint32 wait_event_info) +{ + PGresult *volatile lastResult = NULL; + + /* In what follows, do not leak any PGresults on an error. */ + PG_TRY(); + { + for (;;) + { + /* Wait for, and collect, the next PGresult. */ + PGresult *result; + + result = libpqsrv_get_result(conn, wait_event_info); + if (result == NULL) + break; /* query is complete, or failure */ + + /* + * Emulate PQexec()'s behavior of returning the last result when + * there are many. + */ + PQclear(lastResult); + lastResult = result; + + if (PQresultStatus(lastResult) == PGRES_COPY_IN || + PQresultStatus(lastResult) == PGRES_COPY_OUT || + PQresultStatus(lastResult) == PGRES_COPY_BOTH || + PQstatus(conn) == CONNECTION_BAD) + break; + } + } + PG_CATCH(); + { + PQclear(lastResult); + PG_RE_THROW(); + } + PG_END_TRY(); + + return lastResult; +} + +/* + * Perform the equivalent of PQgetResult(), but watch for interrupts. + */ +static inline PGresult * +libpqsrv_get_result(PGconn *conn, uint32 wait_event_info) +{ + /* + * Collect data until PQgetResult is ready to get the result without + * blocking. + */ + while (PQisBusy(conn)) + { + int rc; + + rc = WaitLatchOrSocket(MyLatch, + WL_EXIT_ON_PM_DEATH | WL_LATCH_SET | + WL_SOCKET_READABLE, + PQsocket(conn), + 0, + wait_event_info); + + /* Interrupted? */ + if (rc & WL_LATCH_SET) + { + ResetLatch(MyLatch); + CHECK_FOR_INTERRUPTS(); + } + + /* Consume whatever data is available from the socket */ + if (PQconsumeInput(conn) == 0) + { + /* trouble; expect PQgetResult() to return NULL */ + break; + } + } + + /* Now we can collect and return the next PGresult */ + return PQgetResult(conn); +} + +/* + * Submit a cancel request to the given connection, waiting only until + * the given time. + * + * We sleep interruptibly until we receive confirmation that the cancel + * request has been accepted, and if it is, return NULL; if the cancel + * request fails, return an error message string (which is not to be + * freed). + * + * For other problems (to wit: OOM when strdup'ing an error message from + * libpq), this function can ereport(ERROR). + * + * Note: this function leaks a string's worth of memory when reporting + * libpq errors. Make sure to call it in a transient memory context. + */ +static inline const char * +libpqsrv_cancel(PGconn *conn, TimestampTz endtime) +{ + PGcancelConn *cancel_conn; + const char *error = NULL; + + cancel_conn = PQcancelCreate(conn); + if (cancel_conn == NULL) + return "out of memory"; + + /* In what follows, do not leak any PGcancelConn on any errors. */ + + PG_TRY(); + { + if (!PQcancelStart(cancel_conn)) + { + error = pchomp(PQcancelErrorMessage(cancel_conn)); + goto exit; + } + + for (;;) + { + PostgresPollingStatusType pollres; + TimestampTz now; + long cur_timeout; + int waitEvents = WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH; + + pollres = PQcancelPoll(cancel_conn); + if (pollres == PGRES_POLLING_OK) + break; /* success! */ + + /* If timeout has expired, give up, else get sleep time. */ + now = GetCurrentTimestamp(); + cur_timeout = TimestampDifferenceMilliseconds(now, endtime); + if (cur_timeout <= 0) + { + error = "cancel request timed out"; + break; + } + + switch (pollres) + { + case PGRES_POLLING_READING: + waitEvents |= WL_SOCKET_READABLE; + break; + case PGRES_POLLING_WRITING: + waitEvents |= WL_SOCKET_WRITEABLE; + break; + default: + error = pchomp(PQcancelErrorMessage(cancel_conn)); + goto exit; + } + + /* Sleep until there's something to do */ + WaitLatchOrSocket(MyLatch, waitEvents, PQcancelSocket(cancel_conn), + cur_timeout, PG_WAIT_CLIENT); + + ResetLatch(MyLatch); + + CHECK_FOR_INTERRUPTS(); + } +exit: ; + } + PG_FINALLY(); + { + PQcancelFinish(cancel_conn); + } + PG_END_TRY(); + + return error; +} + +#endif /* LIBPQ_BE_FE_HELPERS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/libpq-be.h b/platform/dbops/binaries/postgres/include/server/libpq/libpq-be.h new file mode 100644 index 0000000000000000000000000000000000000000..6a1a2274c5538897c20d44d05d425e79cfab22e2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/libpq-be.h @@ -0,0 +1,361 @@ +/*------------------------------------------------------------------------- + * + * libpq-be.h + * This file contains definitions for structures and externs used + * by the postmaster during client authentication. + * + * Note that this is backend-internal and is NOT exported to clients. + * Structs that need to be client-visible are in pqcomm.h. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-be.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_BE_H +#define LIBPQ_BE_H + +#include +#ifdef USE_OPENSSL +#include +#include +#endif +#include + +#ifdef ENABLE_GSS +#if defined(HAVE_GSSAPI_H) +#include +#else +#include +#endif /* HAVE_GSSAPI_H */ +#endif /* ENABLE_GSS */ + +#ifdef ENABLE_SSPI +#define SECURITY_WIN32 +#if defined(WIN32) && !defined(_MSC_VER) +#include +#endif +#include +#undef SECURITY_WIN32 + +#ifndef ENABLE_GSS +/* + * Define a fake structure compatible with GSSAPI on Unix. + */ +typedef struct +{ + void *value; + int length; +} gss_buffer_desc; +#endif +#endif /* ENABLE_SSPI */ + +#include "datatype/timestamp.h" +#include "libpq/hba.h" +#include "libpq/pqcomm.h" + + +/* + * GSSAPI specific state information + */ +#if defined(ENABLE_GSS) | defined(ENABLE_SSPI) +typedef struct +{ + gss_buffer_desc outbuf; /* GSSAPI output token buffer */ +#ifdef ENABLE_GSS + gss_cred_id_t cred; /* GSSAPI connection cred's */ + gss_ctx_id_t ctx; /* GSSAPI connection context */ + gss_name_t name; /* GSSAPI client name */ + char *princ; /* GSSAPI Principal used for auth, NULL if + * GSSAPI auth was not used */ + bool auth; /* GSSAPI Authentication used */ + bool enc; /* GSSAPI encryption in use */ + bool delegated_creds; /* GSSAPI Delegated credentials */ +#endif +} pg_gssinfo; +#endif + +/* + * ClientConnectionInfo includes the fields describing the client connection + * that are copied over to parallel workers as nothing from Port does that. + * The same rules apply for allocations here as for Port (everything must be + * malloc'd or palloc'd in TopMemoryContext). + * + * If you add a struct member here, remember to also handle serialization in + * SerializeClientConnectionInfo() and co. + */ +typedef struct ClientConnectionInfo +{ + /* + * Authenticated identity. The meaning of this identifier is dependent on + * auth_method; it is the identity (if any) that the user presented during + * the authentication cycle, before they were assigned a database role. + * (It is effectively the "SYSTEM-USERNAME" of a pg_ident usermap -- + * though the exact string in use may be different, depending on pg_hba + * options.) + * + * authn_id is NULL if the user has not actually been authenticated, for + * example if the "trust" auth method is in use. + */ + const char *authn_id; + + /* + * The HBA method that determined the above authn_id. This only has + * meaning if authn_id is not NULL; otherwise it's undefined. + */ + UserAuth auth_method; +} ClientConnectionInfo; + +/* + * The Port structure holds state information about a client connection in a + * backend process. It is available in the global variable MyProcPort. The + * struct and all the data it points are kept in TopMemoryContext. + * + * remote_hostname is set if we did a successful reverse lookup of the + * client's IP address during connection setup. + * remote_hostname_resolv tracks the state of hostname verification: + * +1 = remote_hostname is known to resolve to client's IP address + * -1 = remote_hostname is known NOT to resolve to client's IP address + * 0 = we have not done the forward DNS lookup yet + * -2 = there was an error in name resolution + * If reverse lookup of the client IP address fails, remote_hostname will be + * left NULL while remote_hostname_resolv is set to -2. If reverse lookup + * succeeds but forward lookup fails, remote_hostname_resolv is also set to -2 + * (the case is distinguishable because remote_hostname isn't NULL). In + * either of the -2 cases, remote_hostname_errcode saves the lookup return + * code for possible later use with gai_strerror. + */ + +typedef struct Port +{ + pgsocket sock; /* File descriptor */ + bool noblock; /* is the socket in non-blocking mode? */ + ProtocolVersion proto; /* FE/BE protocol version */ + SockAddr laddr; /* local addr (postmaster) */ + SockAddr raddr; /* remote addr (client) */ + char *remote_host; /* name (or ip addr) of remote host */ + char *remote_hostname; /* name (not ip addr) of remote host, if + * available */ + int remote_hostname_resolv; /* see above */ + int remote_hostname_errcode; /* see above */ + char *remote_port; /* text rep of remote port */ + + /* + * Information that needs to be saved from the startup packet and passed + * into backend execution. "char *" fields are NULL if not set. + * guc_options points to a List of alternating option names and values. + */ + char *database_name; + char *user_name; + char *cmdline_options; + List *guc_options; + + /* + * The startup packet application name, only used here for the "connection + * authorized" log message. We shouldn't use this post-startup, instead + * the GUC should be used as application can change it afterward. + */ + char *application_name; + + /* + * Information that needs to be held during the authentication cycle. + */ + HbaLine *hba; + + /* + * TCP keepalive and user timeout settings. + * + * default values are 0 if AF_UNIX or not yet known; current values are 0 + * if AF_UNIX or using the default. Also, -1 in a default value means we + * were unable to find out the default (getsockopt failed). + */ + int default_keepalives_idle; + int default_keepalives_interval; + int default_keepalives_count; + int default_tcp_user_timeout; + int keepalives_idle; + int keepalives_interval; + int keepalives_count; + int tcp_user_timeout; + + /* + * GSSAPI structures. + */ +#if defined(ENABLE_GSS) || defined(ENABLE_SSPI) + + /* + * If GSSAPI is supported and used on this connection, store GSSAPI + * information. Even when GSSAPI is not compiled in, store a NULL pointer + * to keep struct offsets of the "SSL structures" below the same (for + * extension ABI compatibility). + */ + pg_gssinfo *gss; +#else + void *gss; +#endif + + /* + * SSL structures. + */ + bool ssl_in_use; + char *peer_cn; + char *peer_dn; + bool peer_cert_valid; + bool alpn_used; + + /* + * OpenSSL structures. + */ +#ifdef USE_OPENSSL + SSL *ssl; + X509 *peer; +#endif + + /* + * This is a bit of a hack. raw_buf is data that was previously read and + * buffered in a higher layer but then "unread" and needs to be read again + * while establishing an SSL connection via the SSL library layer. + * + * There's no API to "unread", the upper layer just places the data in the + * Port structure in raw_buf and sets raw_buf_remaining to the amount of + * bytes unread and raw_buf_consumed to 0. + * + * NB: the offsets of these fields depend on USE_OPENSSL. These should + * not be accessed in an extension because of the ABI incompatibility. + */ + char *raw_buf; + ssize_t raw_buf_consumed, + raw_buf_remaining; +} Port; + +/* + * ClientSocket holds a socket for an accepted connection, along with the + * information about the remote endpoint. This is passed from postmaster to + * the backend process. + */ +typedef struct ClientSocket +{ + pgsocket sock; /* File descriptor */ + SockAddr raddr; /* remote addr (client) */ +} ClientSocket; + +#ifdef USE_SSL +/* + * Hardcoded DH parameters, used in ephemeral DH keying. (See also + * README.SSL for more details on EDH.) + * + * This is the 2048-bit DH parameter from RFC 3526. The generation of the + * prime is specified in RFC 2412 Appendix E, which also discusses the + * design choice of the generator. Note that when loaded with OpenSSL + * this causes DH_check() to fail on DH_NOT_SUITABLE_GENERATOR, where + * leaking a bit is preferred. + */ +#define FILE_DH2048 \ +"-----BEGIN DH PARAMETERS-----\n\ +MIIBCAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb\n\ +IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft\n\ +awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT\n\ +mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh\n\ +fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq\n\ +5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAg==\n\ +-----END DH PARAMETERS-----\n" + +/* + * These functions are implemented by the glue code specific to each + * SSL implementation (e.g. be-secure-openssl.c) + */ + +/* + * Initialize global SSL context. + * + * If isServerStart is true, report any errors as FATAL (so we don't return). + * Otherwise, log errors at LOG level and return -1 to indicate trouble, + * preserving the old SSL state if any. Returns 0 if OK. + */ +extern int be_tls_init(bool isServerStart); + +/* + * Destroy global SSL context, if any. + */ +extern void be_tls_destroy(void); + +/* + * Attempt to negotiate SSL connection. + */ +extern int be_tls_open_server(Port *port); + +/* + * Close SSL connection. + */ +extern void be_tls_close(Port *port); + +/* + * Read data from a secure connection. + */ +extern ssize_t be_tls_read(Port *port, void *ptr, size_t len, int *waitfor); + +/* + * Write data to a secure connection. + */ +extern ssize_t be_tls_write(Port *port, void *ptr, size_t len, int *waitfor); + +/* + * Return information about the SSL connection. + */ +extern int be_tls_get_cipher_bits(Port *port); +extern const char *be_tls_get_version(Port *port); +extern const char *be_tls_get_cipher(Port *port); +extern void be_tls_get_peer_subject_name(Port *port, char *ptr, size_t len); +extern void be_tls_get_peer_issuer_name(Port *port, char *ptr, size_t len); +extern void be_tls_get_peer_serial(Port *port, char *ptr, size_t len); + +/* + * Get the server certificate hash for SCRAM channel binding type + * tls-server-end-point. + * + * The result is a palloc'd hash of the server certificate with its + * size, and NULL if there is no certificate available. + */ +extern char *be_tls_get_certificate_hash(Port *port, size_t *len); + +/* init hook for SSL, the default sets the password callback if appropriate */ +#ifdef USE_OPENSSL +typedef void (*openssl_tls_init_hook_typ) (SSL_CTX *context, bool isServerStart); +extern PGDLLIMPORT openssl_tls_init_hook_typ openssl_tls_init_hook; +#endif + +#endif /* USE_SSL */ + +#ifdef ENABLE_GSS +/* + * Return information about the GSSAPI authenticated connection + */ +extern bool be_gssapi_get_auth(Port *port); +extern bool be_gssapi_get_enc(Port *port); +extern const char *be_gssapi_get_princ(Port *port); +extern bool be_gssapi_get_delegation(Port *port); + +/* Read and write to a GSSAPI-encrypted connection. */ +extern ssize_t be_gssapi_read(Port *port, void *ptr, size_t len); +extern ssize_t be_gssapi_write(Port *port, void *ptr, size_t len); +#endif /* ENABLE_GSS */ + +extern PGDLLIMPORT ProtocolVersion FrontendProtocol; +extern PGDLLIMPORT ClientConnectionInfo MyClientConnectionInfo; + +/* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */ + +extern int pq_getkeepalivesidle(Port *port); +extern int pq_getkeepalivesinterval(Port *port); +extern int pq_getkeepalivescount(Port *port); +extern int pq_gettcpusertimeout(Port *port); + +extern int pq_setkeepalivesidle(int idle, Port *port); +extern int pq_setkeepalivesinterval(int interval, Port *port); +extern int pq_setkeepalivescount(int count, Port *port); +extern int pq_settcpusertimeout(int timeout, Port *port); + +#endif /* LIBPQ_BE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/libpq-fs.h b/platform/dbops/binaries/postgres/include/server/libpq/libpq-fs.h new file mode 100644 index 0000000000000000000000000000000000000000..dd4e4c2edda2d37e58fa649a88f982b4e2d5508e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/libpq-fs.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * libpq-fs.h + * definitions for using Inversion file system routines (ie, large objects) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq-fs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_FS_H +#define LIBPQ_FS_H + +/* + * Read/write mode flags for inversion (large object) calls + */ + +#define INV_WRITE 0x00020000 +#define INV_READ 0x00040000 + +#endif /* LIBPQ_FS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/libpq.h b/platform/dbops/binaries/postgres/include/server/libpq/libpq.h new file mode 100644 index 0000000000000000000000000000000000000000..142c98462ed66914c7eb5195002a8a69dbf440f6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/libpq.h @@ -0,0 +1,143 @@ +/*------------------------------------------------------------------------- + * + * libpq.h + * POSTGRES LIBPQ buffer structure definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/libpq.h + * + *------------------------------------------------------------------------- + */ +#ifndef LIBPQ_H +#define LIBPQ_H + +#include + +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" +#include "storage/latch.h" + + +/* + * Callers of pq_getmessage() must supply a maximum expected message size. + * By convention, if there's not any specific reason to use another value, + * use PQ_SMALL_MESSAGE_LIMIT for messages that shouldn't be too long, and + * PQ_LARGE_MESSAGE_LIMIT for messages that can be long. + */ +#define PQ_SMALL_MESSAGE_LIMIT 10000 +#define PQ_LARGE_MESSAGE_LIMIT (MaxAllocSize - 1) + +typedef struct +{ + void (*comm_reset) (void); + int (*flush) (void); + int (*flush_if_writable) (void); + bool (*is_send_pending) (void); + int (*putmessage) (char msgtype, const char *s, size_t len); + void (*putmessage_noblock) (char msgtype, const char *s, size_t len); +} PQcommMethods; + +extern const PGDLLIMPORT PQcommMethods *PqCommMethods; + +#define pq_comm_reset() (PqCommMethods->comm_reset()) +#define pq_flush() (PqCommMethods->flush()) +#define pq_flush_if_writable() (PqCommMethods->flush_if_writable()) +#define pq_is_send_pending() (PqCommMethods->is_send_pending()) +#define pq_putmessage(msgtype, s, len) \ + (PqCommMethods->putmessage(msgtype, s, len)) +#define pq_putmessage_noblock(msgtype, s, len) \ + (PqCommMethods->putmessage_noblock(msgtype, s, len)) + +/* + * External functions. + */ + +/* + * prototypes for functions in pqcomm.c + */ +extern PGDLLIMPORT WaitEventSet *FeBeWaitSet; + +#define FeBeWaitSetSocketPos 0 +#define FeBeWaitSetLatchPos 1 +#define FeBeWaitSetNEvents 3 + +extern int ListenServerPort(int family, const char *hostName, + unsigned short portNumber, const char *unixSocketDir, + pgsocket ListenSockets[], int *NumListenSockets, int MaxListen); +extern int AcceptConnection(pgsocket server_fd, ClientSocket *client_sock); +extern void TouchSocketFiles(void); +extern void RemoveSocketFiles(void); +extern Port *pq_init(ClientSocket *client_sock); +extern int pq_getbytes(char *s, size_t len); +extern void pq_startmsgread(void); +extern void pq_endmsgread(void); +extern bool pq_is_reading_msg(void); +extern int pq_getmessage(StringInfo s, int maxlen); +extern int pq_getbyte(void); +extern int pq_peekbyte(void); +extern int pq_getbyte_if_available(unsigned char *c); +extern ssize_t pq_buffer_remaining_data(void); +extern int pq_putmessage_v2(char msgtype, const char *s, size_t len); +extern bool pq_check_connection(void); + +/* + * prototypes for functions in be-secure.c + */ +extern PGDLLIMPORT char *ssl_library; +extern PGDLLIMPORT char *ssl_cert_file; +extern PGDLLIMPORT char *ssl_key_file; +extern PGDLLIMPORT char *ssl_ca_file; +extern PGDLLIMPORT char *ssl_crl_file; +extern PGDLLIMPORT char *ssl_crl_dir; +extern PGDLLIMPORT char *ssl_dh_params_file; +extern PGDLLIMPORT char *ssl_passphrase_command; +extern PGDLLIMPORT bool ssl_passphrase_command_supports_reload; +#ifdef USE_SSL +extern PGDLLIMPORT bool ssl_loaded_verify_locations; +#endif + +extern int secure_initialize(bool isServerStart); +extern bool secure_loaded_verify_locations(void); +extern void secure_destroy(void); +extern int secure_open_server(Port *port); +extern void secure_close(Port *port); +extern ssize_t secure_read(Port *port, void *ptr, size_t len); +extern ssize_t secure_write(Port *port, void *ptr, size_t len); +extern ssize_t secure_raw_read(Port *port, void *ptr, size_t len); +extern ssize_t secure_raw_write(Port *port, const void *ptr, size_t len); + +/* + * prototypes for functions in be-secure-gssapi.c + */ +#ifdef ENABLE_GSS +extern ssize_t secure_open_gssapi(Port *port); +#endif + +/* GUCs */ +extern PGDLLIMPORT char *SSLCipherSuites; +extern PGDLLIMPORT char *SSLECDHCurve; +extern PGDLLIMPORT bool SSLPreferServerCiphers; +extern PGDLLIMPORT int ssl_min_protocol_version; +extern PGDLLIMPORT int ssl_max_protocol_version; + +enum ssl_protocol_versions +{ + PG_TLS_ANY = 0, + PG_TLS1_VERSION, + PG_TLS1_1_VERSION, + PG_TLS1_2_VERSION, + PG_TLS1_3_VERSION, +}; + +/* + * prototypes for functions in be-secure-common.c + */ +extern int run_ssl_passphrase_command(const char *prompt, bool is_server_start, + char *buf, int size); +extern bool check_ssl_key_file_permissions(const char *ssl_key_file, + bool isServerStart); + +#endif /* LIBPQ_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/pqcomm.h b/platform/dbops/binaries/postgres/include/server/libpq/pqcomm.h new file mode 100644 index 0000000000000000000000000000000000000000..527735e3dba7a6d66417806d3aeb31f7827ceb12 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/pqcomm.h @@ -0,0 +1,169 @@ +/*------------------------------------------------------------------------- + * + * pqcomm.h + * Definitions common to frontends and backends. + * + * NOTE: for historical reasons, this does not correspond to pqcomm.c. + * pqcomm.c's routines are declared in libpq.h. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqcomm.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQCOMM_H +#define PQCOMM_H + +#include +#include +#include +#include + +/* + * The definitions for the request/response codes are kept in a separate file + * for ease of use in third party programs. + */ +#include "libpq/protocol.h" + +typedef struct +{ + struct sockaddr_storage addr; + socklen_t salen; +} SockAddr; + +typedef struct +{ + int family; + SockAddr addr; +} AddrInfo; + +/* Configure the UNIX socket location for the well known port. */ + +#define UNIXSOCK_PATH(path, port, sockdir) \ + (AssertMacro(sockdir), \ + AssertMacro(*(sockdir) != '\0'), \ + snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \ + (sockdir), (port))) + +/* + * The maximum workable length of a socket path is what will fit into + * struct sockaddr_un. This is usually only 100 or so bytes :-(. + * + * For consistency, always pass a MAXPGPATH-sized buffer to UNIXSOCK_PATH(), + * then complain if the resulting string is >= UNIXSOCK_PATH_BUFLEN bytes. + * (Because the standard API for getaddrinfo doesn't allow it to complain in + * a useful way when the socket pathname is too long, we have to test for + * this explicitly, instead of just letting the subroutine return an error.) + */ +#define UNIXSOCK_PATH_BUFLEN sizeof(((struct sockaddr_un *) NULL)->sun_path) + +/* + * A host that looks either like an absolute path or starts with @ is + * interpreted as a Unix-domain socket address. + */ +static inline bool +is_unixsock_path(const char *path) +{ + return is_absolute_path(path) || path[0] == '@'; +} + +/* + * These manipulate the frontend/backend protocol version number. + * + * The major number should be incremented for incompatible changes. The minor + * number should be incremented for compatible changes (eg. additional + * functionality). + * + * If a backend supports version m.n of the protocol it must actually support + * versions m.[0..n]. Backend support for version m-1 can be dropped after a + * `reasonable' length of time. + * + * A frontend isn't required to support anything other than the current + * version. + */ + +#define PG_PROTOCOL_MAJOR(v) ((v) >> 16) +#define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff) +#define PG_PROTOCOL(m,n) (((m) << 16) | (n)) + +/* + * The earliest and latest frontend/backend protocol version supported. + * (Only protocol version 3 is currently supported) + */ + +#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(3,0) +#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0) + +typedef uint32 ProtocolVersion; /* FE/BE protocol version number */ + +typedef ProtocolVersion MsgType; + + +/* + * Packet lengths are 4 bytes in network byte order. + * + * The initial length is omitted from the packet layouts appearing below. + */ + +typedef uint32 PacketLen; + +/* + * In protocol 3.0 and later, the startup packet length is not fixed, but + * we set an arbitrary limit on it anyway. This is just to prevent simple + * denial-of-service attacks via sending enough data to run the server + * out of memory. + */ +#define MAX_STARTUP_PACKET_LENGTH 10000 + + +typedef uint32 AuthRequest; + + +/* + * A client can also send a cancel-current-operation request to the postmaster. + * This is uglier than sending it directly to the client's backend, but it + * avoids depending on out-of-band communication facilities. + * + * The cancel request code must not match any protocol version number + * we're ever likely to use. This random choice should do. + */ +#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) + +typedef struct CancelRequestPacket +{ + /* Note that each field is stored in network byte order! */ + MsgType cancelRequestCode; /* code to identify a cancel request */ + uint32 backendPID; /* PID of client's backend */ + uint32 cancelAuthCode; /* secret key to authorize cancel */ +} CancelRequestPacket; + +/* Application-Layer Protocol Negotiation is required for direct connections + * to avoid protocol confusion attacks (e.g https://alpaca-attack.com/). + * + * ALPN is specified in RFC 7301 + * + * This string should be registered at: + * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids + * + * OpenSSL uses this wire-format for the list of alpn protocols even in the + * API. Both server and client take the same format parameter but the client + * actually sends it to the server as-is and the server it specifies the + * preference order to use to choose the one selected to send back. + * + * c.f. https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_alpn_select_cb.html + * + * The #define can be used to initialize a char[] vector to use directly in the API + */ +#define PG_ALPN_PROTOCOL "postgresql" +#define PG_ALPN_PROTOCOL_VECTOR { 10, 'p','o','s','t','g','r','e','s','q','l' } + +/* + * A client can also start by sending a SSL or GSSAPI negotiation request to + * get a secure channel. + */ +#define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) +#define NEGOTIATE_GSS_CODE PG_PROTOCOL(1234,5680) + +#endif /* PQCOMM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/pqformat.h b/platform/dbops/binaries/postgres/include/server/libpq/pqformat.h new file mode 100644 index 0000000000000000000000000000000000000000..7f48cbded97a72fa779deb4b5c875a434c500166 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/pqformat.h @@ -0,0 +1,209 @@ +/*------------------------------------------------------------------------- + * + * pqformat.h + * Definitions for formatting and parsing frontend/backend messages + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqformat.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQFORMAT_H +#define PQFORMAT_H + +#include "lib/stringinfo.h" +#include "mb/pg_wchar.h" +#include "port/pg_bswap.h" + +extern void pq_beginmessage(StringInfo buf, char msgtype); +extern void pq_beginmessage_reuse(StringInfo buf, char msgtype); +extern void pq_endmessage(StringInfo buf); +extern void pq_endmessage_reuse(StringInfo buf); + +extern void pq_sendbytes(StringInfo buf, const void *data, int datalen); +extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen); +extern void pq_sendtext(StringInfo buf, const char *str, int slen); +extern void pq_sendstring(StringInfo buf, const char *str); +extern void pq_send_ascii_string(StringInfo buf, const char *str); +extern void pq_sendfloat4(StringInfo buf, float4 f); +extern void pq_sendfloat8(StringInfo buf, float8 f); + +/* + * Append a [u]int8 to a StringInfo buffer, which already has enough space + * preallocated. + * + * The use of pg_restrict allows the compiler to optimize the code based on + * the assumption that buf, buf->len, buf->data and *buf->data don't + * overlap. Without the annotation buf->len etc cannot be kept in a register + * over subsequent pq_writeintN calls. + * + * The use of StringInfoData * rather than StringInfo is due to MSVC being + * overly picky and demanding a * before a restrict. + */ +static inline void +pq_writeint8(StringInfoData *pg_restrict buf, uint8 i) +{ + uint8 ni = i; + + Assert(buf->len + (int) sizeof(uint8) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint8)); + buf->len += sizeof(uint8); +} + +/* + * Append a [u]int16 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint16(StringInfoData *pg_restrict buf, uint16 i) +{ + uint16 ni = pg_hton16(i); + + Assert(buf->len + (int) sizeof(uint16) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint16)); + buf->len += sizeof(uint16); +} + +/* + * Append a [u]int32 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint32(StringInfoData *pg_restrict buf, uint32 i) +{ + uint32 ni = pg_hton32(i); + + Assert(buf->len + (int) sizeof(uint32) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint32)); + buf->len += sizeof(uint32); +} + +/* + * Append a [u]int64 to a StringInfo buffer, which already has enough space + * preallocated. + */ +static inline void +pq_writeint64(StringInfoData *pg_restrict buf, uint64 i) +{ + uint64 ni = pg_hton64(i); + + Assert(buf->len + (int) sizeof(uint64) <= buf->maxlen); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint64)); + buf->len += sizeof(uint64); +} + +/* + * Append a null-terminated text string (with conversion) to a buffer with + * preallocated space. + * + * NB: The pre-allocated space needs to be sufficient for the string after + * converting to client encoding. + * + * NB: passed text string must be null-terminated, and so is the data + * sent to the frontend. + */ +static inline void +pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str) +{ + int slen = strlen(str); + char *p; + + p = pg_server_to_client(str, slen); + if (p != str) /* actual conversion has been done? */ + slen = strlen(p); + + Assert(buf->len + slen + 1 <= buf->maxlen); + + memcpy(((char *pg_restrict) buf->data + buf->len), p, slen + 1); + buf->len += slen + 1; + + if (p != str) + pfree(p); +} + +/* append a binary [u]int8 to a StringInfo buffer */ +static inline void +pq_sendint8(StringInfo buf, uint8 i) +{ + enlargeStringInfo(buf, sizeof(uint8)); + pq_writeint8(buf, i); +} + +/* append a binary [u]int16 to a StringInfo buffer */ +static inline void +pq_sendint16(StringInfo buf, uint16 i) +{ + enlargeStringInfo(buf, sizeof(uint16)); + pq_writeint16(buf, i); +} + +/* append a binary [u]int32 to a StringInfo buffer */ +static inline void +pq_sendint32(StringInfo buf, uint32 i) +{ + enlargeStringInfo(buf, sizeof(uint32)); + pq_writeint32(buf, i); +} + +/* append a binary [u]int64 to a StringInfo buffer */ +static inline void +pq_sendint64(StringInfo buf, uint64 i) +{ + enlargeStringInfo(buf, sizeof(uint64)); + pq_writeint64(buf, i); +} + +/* append a binary byte to a StringInfo buffer */ +static inline void +pq_sendbyte(StringInfo buf, uint8 byt) +{ + pq_sendint8(buf, byt); +} + +/* + * Append a binary integer to a StringInfo buffer + * + * This function is deprecated; prefer use of the functions above. + */ +static inline void +pq_sendint(StringInfo buf, uint32 i, int b) +{ + switch (b) + { + case 1: + pq_sendint8(buf, (uint8) i); + break; + case 2: + pq_sendint16(buf, (uint16) i); + break; + case 4: + pq_sendint32(buf, (uint32) i); + break; + default: + elog(ERROR, "unsupported integer size %d", b); + break; + } +} + + +extern void pq_begintypsend(StringInfo buf); +extern bytea *pq_endtypsend(StringInfo buf); + +extern void pq_puttextmessage(char msgtype, const char *str); +extern void pq_putemptymessage(char msgtype); + +extern int pq_getmsgbyte(StringInfo msg); +extern unsigned int pq_getmsgint(StringInfo msg, int b); +extern int64 pq_getmsgint64(StringInfo msg); +extern float4 pq_getmsgfloat4(StringInfo msg); +extern float8 pq_getmsgfloat8(StringInfo msg); +extern const char *pq_getmsgbytes(StringInfo msg, int datalen); +extern void pq_copymsgbytes(StringInfo msg, char *buf, int datalen); +extern char *pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes); +extern const char *pq_getmsgstring(StringInfo msg); +extern const char *pq_getmsgrawstring(StringInfo msg); +extern void pq_getmsgend(StringInfo msg); + +#endif /* PQFORMAT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/pqmq.h b/platform/dbops/binaries/postgres/include/server/libpq/pqmq.h new file mode 100644 index 0000000000000000000000000000000000000000..227df8976f40f2c96909b182accc217dffe1085f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/pqmq.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * pqmq.h + * Use the frontend/backend protocol for communication over a shm_mq + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqmq.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQMQ_H +#define PQMQ_H + +#include "lib/stringinfo.h" +#include "storage/shm_mq.h" + +extern void pq_redirect_to_shm_mq(dsm_segment *seg, shm_mq_handle *mqh); +extern void pq_set_parallel_leader(pid_t pid, ProcNumber procNumber); + +extern void pq_parse_errornotice(StringInfo msg, ErrorData *edata); + +#endif /* PQMQ_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/pqsignal.h b/platform/dbops/binaries/postgres/include/server/libpq/pqsignal.h new file mode 100644 index 0000000000000000000000000000000000000000..cf6a3942f659861ffb0edf0718820b049bf477c3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/pqsignal.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pqsignal.h + * Backend signal(2) support (see also src/port/pqsignal.c) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/pqsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQSIGNAL_H +#define PQSIGNAL_H + +#include + +#ifdef WIN32 +/* Emulate POSIX sigset_t APIs on Windows */ +typedef int sigset_t; + +#define SA_RESTART 1 +#define SA_NODEFER 2 + +struct sigaction +{ + void (*sa_handler) (int); + /* sa_sigaction not yet implemented */ + sigset_t sa_mask; + int sa_flags; +}; + +extern int pqsigprocmask(int how, const sigset_t *set, sigset_t *oset); +extern int pqsigaction(int signum, const struct sigaction *act, + struct sigaction *oldact); + +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 +#define sigprocmask(how, set, oset) pqsigprocmask((how), (set), (oset)) +#define sigaction(signum, act, oldact) pqsigaction((signum), (act), (oldact)) +#define sigemptyset(set) (*(set) = 0) +#define sigfillset(set) (*(set) = ~0) +#define sigaddset(set, signum) (*(set) |= (sigmask(signum))) +#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) +#endif /* WIN32 */ + +extern PGDLLIMPORT sigset_t UnBlockSig; +extern PGDLLIMPORT sigset_t BlockSig; +extern PGDLLIMPORT sigset_t StartupBlockSig; + +extern void pqinitmask(void); + +#endif /* PQSIGNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/protocol.h b/platform/dbops/binaries/postgres/include/server/libpq/protocol.h new file mode 100644 index 0000000000000000000000000000000000000000..b71add1ec1508ef4782961c2130d556e1ed3a657 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/protocol.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * protocol.h + * Definitions of the request/response codes for the wire protocol. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/protocol.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROTOCOL_H +#define PROTOCOL_H + +/* These are the request codes sent by the frontend. */ + +#define PqMsg_Bind 'B' +#define PqMsg_Close 'C' +#define PqMsg_Describe 'D' +#define PqMsg_Execute 'E' +#define PqMsg_FunctionCall 'F' +#define PqMsg_Flush 'H' +#define PqMsg_Parse 'P' +#define PqMsg_Query 'Q' +#define PqMsg_Sync 'S' +#define PqMsg_Terminate 'X' +#define PqMsg_CopyFail 'f' +#define PqMsg_GSSResponse 'p' +#define PqMsg_PasswordMessage 'p' +#define PqMsg_SASLInitialResponse 'p' +#define PqMsg_SASLResponse 'p' + + +/* These are the response codes sent by the backend. */ + +#define PqMsg_ParseComplete '1' +#define PqMsg_BindComplete '2' +#define PqMsg_CloseComplete '3' +#define PqMsg_NotificationResponse 'A' +#define PqMsg_CommandComplete 'C' +#define PqMsg_DataRow 'D' +#define PqMsg_ErrorResponse 'E' +#define PqMsg_CopyInResponse 'G' +#define PqMsg_CopyOutResponse 'H' +#define PqMsg_EmptyQueryResponse 'I' +#define PqMsg_BackendKeyData 'K' +#define PqMsg_NoticeResponse 'N' +#define PqMsg_AuthenticationRequest 'R' +#define PqMsg_ParameterStatus 'S' +#define PqMsg_RowDescription 'T' +#define PqMsg_FunctionCallResponse 'V' +#define PqMsg_CopyBothResponse 'W' +#define PqMsg_ReadyForQuery 'Z' +#define PqMsg_NoData 'n' +#define PqMsg_PortalSuspended 's' +#define PqMsg_ParameterDescription 't' +#define PqMsg_NegotiateProtocolVersion 'v' + + +/* These are the codes sent by both the frontend and backend. */ + +#define PqMsg_CopyDone 'c' +#define PqMsg_CopyData 'd' + + +/* These are the codes sent by parallel workers to leader processes. */ +#define PqMsg_Progress 'P' + + +/* These are the authentication request codes sent by the backend. */ + +#define AUTH_REQ_OK 0 /* User is authenticated */ +#define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */ +#define AUTH_REQ_KRB5 2 /* Kerberos V5. Not supported any more. */ +#define AUTH_REQ_PASSWORD 3 /* Password */ +#define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */ +#define AUTH_REQ_MD5 5 /* md5 password */ +/* 6 is available. It was used for SCM creds, not supported any more. */ +#define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */ +#define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */ +#define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */ +#define AUTH_REQ_SASL 10 /* Begin SASL authentication */ +#define AUTH_REQ_SASL_CONT 11 /* Continue SASL authentication */ +#define AUTH_REQ_SASL_FIN 12 /* Final SASL message */ +#define AUTH_REQ_MAX AUTH_REQ_SASL_FIN /* maximum AUTH_REQ_* value */ + +#endif /* PROTOCOL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/sasl.h b/platform/dbops/binaries/postgres/include/server/libpq/sasl.h new file mode 100644 index 0000000000000000000000000000000000000000..7a1f970ccae65bf54c68af72790c51ef472b79ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/sasl.h @@ -0,0 +1,136 @@ +/*------------------------------------------------------------------------- + * + * sasl.h + * Defines the SASL mechanism interface for the backend. + * + * Each SASL mechanism defines a frontend and a backend callback structure. + * + * See src/interfaces/libpq/fe-auth-sasl.h for the frontend counterpart. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/sasl.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_SASL_H +#define PG_SASL_H + +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" + +/* Status codes for message exchange */ +#define PG_SASL_EXCHANGE_CONTINUE 0 +#define PG_SASL_EXCHANGE_SUCCESS 1 +#define PG_SASL_EXCHANGE_FAILURE 2 + +/* + * Backend SASL mechanism callbacks. + * + * To implement a backend mechanism, declare a pg_be_sasl_mech struct with + * appropriate callback implementations. Then pass the mechanism to + * CheckSASLAuth() during ClientAuthentication(), once the server has decided + * which authentication method to use. + */ +typedef struct pg_be_sasl_mech +{ + /*--------- + * get_mechanisms() + * + * Retrieves the list of SASL mechanism names supported by this + * implementation. + * + * Input parameters: + * + * port: The client Port + * + * Output parameters: + * + * buf: A StringInfo buffer that the callback should populate with + * supported mechanism names. The names are appended into this + * StringInfo, each one ending with '\0' bytes. + *--------- + */ + void (*get_mechanisms) (Port *port, StringInfo buf); + + /*--------- + * init() + * + * Initializes mechanism-specific state for a connection. This callback + * must return a pointer to its allocated state, which will be passed + * as-is as the first argument to the other callbacks. + * + * Input parameters: + * + * port: The client Port. + * + * mech: The actual mechanism name in use by the client. + * + * shadow_pass: The stored secret for the role being authenticated, or + * NULL if one does not exist. Mechanisms that do not use + * shadow entries may ignore this parameter. If a + * mechanism uses shadow entries but shadow_pass is NULL, + * the implementation must continue the exchange as if the + * user existed and the password did not match, to avoid + * disclosing valid user names. + *--------- + */ + void *(*init) (Port *port, const char *mech, const char *shadow_pass); + + /*--------- + * exchange() + * + * Produces a server challenge to be sent to the client. The callback + * must return one of the PG_SASL_EXCHANGE_* values, depending on + * whether the exchange continues, has finished successfully, or has + * failed. + * + * Input parameters: + * + * state: The opaque mechanism state returned by init() + * + * input: The response data sent by the client, or NULL if the + * mechanism is client-first but the client did not send an + * initial response. (This can only happen during the first + * message from the client.) This is guaranteed to be + * null-terminated for safety, but SASL allows embedded + * nulls in responses, so mechanisms must be careful to + * check inputlen. + * + * inputlen: The length of the challenge data sent by the server, or + * -1 if the client did not send an initial response + * + * Output parameters, to be set by the callback function: + * + * output: A palloc'd buffer containing either the server's next + * challenge (if PG_SASL_EXCHANGE_CONTINUE is returned) or + * the server's outcome data (if PG_SASL_EXCHANGE_SUCCESS is + * returned and the mechanism requires data to be sent during + * a successful outcome). The callback should set this to + * NULL if the exchange is over and no output should be sent, + * which should correspond to either PG_SASL_EXCHANGE_FAILURE + * or a PG_SASL_EXCHANGE_SUCCESS with no outcome data. + * + * outputlen: The length of the challenge data. Ignored if *output is + * NULL. + * + * logdetail: Set to an optional DETAIL message to be printed to the + * server log, to disambiguate failure modes. (The client + * will only ever see the same generic authentication + * failure message.) Ignored if the exchange is completed + * with PG_SASL_EXCHANGE_SUCCESS. + *--------- + */ + int (*exchange) (void *state, + const char *input, int inputlen, + char **output, int *outputlen, + const char **logdetail); +} pg_be_sasl_mech; + +/* Common implementation for auth.c */ +extern int CheckSASLAuth(const pg_be_sasl_mech *mech, Port *port, + char *shadow_pass, const char **logdetail); + +#endif /* PG_SASL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/libpq/scram.h b/platform/dbops/binaries/postgres/include/server/libpq/scram.h new file mode 100644 index 0000000000000000000000000000000000000000..2ae90105578e273d82ed552d22cfebaad3552779 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/libpq/scram.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * scram.h + * Interface to libpq/scram.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/libpq/scram.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SCRAM_H +#define PG_SCRAM_H + +#include "common/cryptohash.h" +#include "lib/stringinfo.h" +#include "libpq/libpq-be.h" +#include "libpq/sasl.h" + +/* Number of iterations when generating new secrets */ +extern PGDLLIMPORT int scram_sha_256_iterations; + +/* SASL implementation callbacks */ +extern PGDLLIMPORT const pg_be_sasl_mech pg_be_scram_mech; + +/* Routines to handle and check SCRAM-SHA-256 secret */ +extern char *pg_be_scram_build_secret(const char *password); +extern bool parse_scram_secret(const char *secret, + int *iterations, + pg_cryptohash_type *hash_type, + int *key_length, char **salt, + uint8 *stored_key, uint8 *server_key); +extern bool scram_verify_plain_password(const char *username, + const char *password, const char *secret); + +#endif /* PG_SCRAM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/mb/pg_wchar.h b/platform/dbops/binaries/postgres/include/server/mb/pg_wchar.h new file mode 100644 index 0000000000000000000000000000000000000000..08f6fa6e0858f3f6c6de99b51587cc0f0b45e7ef --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/mb/pg_wchar.h @@ -0,0 +1,793 @@ +/*------------------------------------------------------------------------- + * + * pg_wchar.h + * multibyte-character support + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/mb/pg_wchar.h + * + * NOTES + * This is used both by the backend and by frontends, but should not be + * included by libpq client programs. In particular, a libpq client + * should not assume that the encoding IDs used by the version of libpq + * it's linked to match up with the IDs declared here. + * To help prevent mistakes, relevant functions that are exported by + * libpq have a physically different name when being referenced + * statically. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_WCHAR_H +#define PG_WCHAR_H + +/* + * The pg_wchar type + */ +typedef unsigned int pg_wchar; + +/* + * Maximum byte length of multibyte characters in any backend encoding + */ +#define MAX_MULTIBYTE_CHAR_LEN 4 + +/* + * various definitions for EUC + */ +#define SS2 0x8e /* single shift 2 (JIS0201) */ +#define SS3 0x8f /* single shift 3 (JIS0212) */ + +/* + * SJIS validation macros + */ +#define ISSJISHEAD(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xfc)) +#define ISSJISTAIL(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc)) + +/*---------------------------------------------------- + * MULE Internal Encoding (MIC) + * + * This encoding follows the design used within XEmacs; it is meant to + * subsume many externally-defined character sets. Each character includes + * identification of the character set it belongs to, so the encoding is + * general but somewhat bulky. + * + * Currently PostgreSQL supports 5 types of MULE character sets: + * + * 1) 1-byte ASCII characters. Each byte is below 0x80. + * + * 2) "Official" single byte charsets such as ISO-8859-1 (Latin1). + * Each MULE character consists of 2 bytes: LC1 + C1, where LC1 is + * an identifier for the charset (in the range 0x81 to 0x8d) and C1 + * is the character code (in the range 0xa0 to 0xff). + * + * 3) "Private" single byte charsets such as SISHENG. Each MULE + * character consists of 3 bytes: LCPRV1 + LC12 + C1, where LCPRV1 + * is a private-charset flag, LC12 is an identifier for the charset, + * and C1 is the character code (in the range 0xa0 to 0xff). + * LCPRV1 is either 0x9a (if LC12 is in the range 0xa0 to 0xdf) + * or 0x9b (if LC12 is in the range 0xe0 to 0xef). + * + * 4) "Official" multibyte charsets such as JIS X0208. Each MULE + * character consists of 3 bytes: LC2 + C1 + C2, where LC2 is + * an identifier for the charset (in the range 0x90 to 0x99) and C1 + * and C2 form the character code (each in the range 0xa0 to 0xff). + * + * 5) "Private" multibyte charsets such as CNS 11643-1992 Plane 3. + * Each MULE character consists of 4 bytes: LCPRV2 + LC22 + C1 + C2, + * where LCPRV2 is a private-charset flag, LC22 is an identifier for + * the charset, and C1 and C2 form the character code (each in the range + * 0xa0 to 0xff). LCPRV2 is either 0x9c (if LC22 is in the range 0xf0 + * to 0xf4) or 0x9d (if LC22 is in the range 0xf5 to 0xfe). + * + * "Official" encodings are those that have been assigned code numbers by + * the XEmacs project; "private" encodings have Postgres-specific charset + * identifiers. + * + * See the "XEmacs Internals Manual", available at http://www.xemacs.org, + * for more details. Note that for historical reasons, Postgres' + * private-charset flag values do not match what XEmacs says they should be, + * so this isn't really exactly MULE (not that private charsets would be + * interoperable anyway). + * + * Note that XEmacs's implementation is different from what emacs does. + * We follow emacs's implementation, rather than XEmacs's. + *---------------------------------------------------- + */ + +/* + * Charset identifiers (also called "leading bytes" in the MULE documentation) + */ + +/* + * Charset IDs for official single byte encodings (0x81-0x8e) + */ +#define LC_ISO8859_1 0x81 /* ISO8859 Latin 1 */ +#define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */ +#define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */ +#define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */ +#define LC_TIS620 0x85 /* Thai (not supported yet) */ +#define LC_ISO8859_7 0x86 /* Greek (not supported yet) */ +#define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */ +#define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */ +#define LC_JISX0201K 0x89 /* Japanese 1 byte kana */ +#define LC_JISX0201R 0x8a /* Japanese 1 byte Roman */ +/* Note that 0x8b seems to be unused as of Emacs 20.7. + * However, there might be a chance that 0x8b could be used + * in later versions of Emacs. + */ +#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */ +#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */ +#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */ +#define LC_ISO8859_15 0x8e /* ISO8859 Latin 15 (not supported yet) */ +/* #define CONTROL_1 0x8f control characters (unused) */ + +/* Is a leading byte for "official" single byte encodings? */ +#define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d) + +/* + * Charset IDs for official multibyte encodings (0x90-0x99) + * 0x9a-0x9d are free. 0x9e and 0x9f are reserved. + */ +#define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */ +#define LC_GB2312_80 0x91 /* Chinese */ +#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */ +#define LC_KS5601 0x93 /* Korean */ +#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */ +#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */ +#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */ +#define LC_JISX0213_1 0x97 /* Japanese Kanji (JIS X 0213 Plane 1) + * (not supported) */ +#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not + * supported) */ +#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not + * supported) */ + +/* Is a leading byte for "official" multibyte encodings? */ +#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99) + +/* + * Postgres-specific prefix bytes for "private" single byte encodings + * (According to the MULE docs, we should be using 0x9e for this) + */ +#define LCPRV1_A 0x9a +#define LCPRV1_B 0x9b +#define IS_LCPRV1(c) ((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B) +#define IS_LCPRV1_A_RANGE(c) \ + ((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf) +#define IS_LCPRV1_B_RANGE(c) \ + ((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef) + +/* + * Postgres-specific prefix bytes for "private" multibyte encodings + * (According to the MULE docs, we should be using 0x9f for this) + */ +#define LCPRV2_A 0x9c +#define LCPRV2_B 0x9d +#define IS_LCPRV2(c) ((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B) +#define IS_LCPRV2_A_RANGE(c) \ + ((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4) +#define IS_LCPRV2_B_RANGE(c) \ + ((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe) + +/* + * Charset IDs for private single byte encodings (0xa0-0xef) + */ +#define LC_SISHENG 0xa0 /* Chinese SiSheng characters for + * PinYin/ZhuYin (not supported) */ +#define LC_IPA 0xa1 /* IPA (International Phonetic + * Association) (not supported) */ +#define LC_VISCII_LOWER 0xa2 /* Vietnamese VISCII1.1 lower-case (not + * supported) */ +#define LC_VISCII_UPPER 0xa3 /* Vietnamese VISCII1.1 upper-case (not + * supported) */ +#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */ +#define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */ +#define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with + * right-to-left direction (not + * supported) */ +#define LC_LAO 0xa7 /* Lao characters (ISO10646 0E80..0EDF) + * (not supported) */ +#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */ + +/* + * Charset IDs for private multibyte encodings (0xf0-0xff) + */ +#define LC_INDIAN_1_COLUMN 0xf0 /* Indian charset for 1-column width + * glyphs (not supported) */ +#define LC_TIBETAN_1_COLUMN 0xf1 /* Tibetan 1-column width glyphs (not + * supported) */ +#define LC_UNICODE_SUBSET_2 0xf2 /* Unicode characters of the range + * U+2500..U+33FF. (not supported) */ +#define LC_UNICODE_SUBSET_3 0xf3 /* Unicode characters of the range + * U+E000..U+FFFF. (not supported) */ +#define LC_UNICODE_SUBSET 0xf4 /* Unicode characters of the range + * U+0100..U+24FF. (not supported) */ +#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */ +#define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */ +#define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */ +#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */ +#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ +#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ +#define LC_INDIAN_2_COLUMN 0xfb /* Indian charset for 2-column width + * glyphs (not supported) */ +#define LC_TIBETAN 0xfc /* Tibetan (not supported) */ +/* #define FREE 0xfd free (unused) */ +/* #define FREE 0xfe free (unused) */ +/* #define FREE 0xff free (unused) */ + +/*---------------------------------------------------- + * end of MULE stuff + *---------------------------------------------------- + */ + +/* + * PostgreSQL encoding identifiers + * + * WARNING: If you add some encoding don't forget to update + * the pg_enc2name_tbl[] array (in src/common/encnames.c), + * the pg_enc2gettext_tbl[] array (in src/common/encnames.c) and + * the pg_wchar_table[] array (in src/common/wchar.c) and to check + * PG_ENCODING_BE_LAST macro. + * + * PG_SQL_ASCII is default encoding and must be = 0. + * + * XXX We must avoid renumbering any backend encoding until libpq's major + * version number is increased beyond 5; it turns out that the backend + * encoding IDs are effectively part of libpq's ABI as far as 8.2 initdb and + * psql are concerned. + */ +typedef enum pg_enc +{ + PG_SQL_ASCII = 0, /* SQL/ASCII */ + PG_EUC_JP, /* EUC for Japanese */ + PG_EUC_CN, /* EUC for Chinese */ + PG_EUC_KR, /* EUC for Korean */ + PG_EUC_TW, /* EUC for Taiwan */ + PG_EUC_JIS_2004, /* EUC-JIS-2004 */ + PG_UTF8, /* Unicode UTF8 */ + PG_MULE_INTERNAL, /* Mule internal code */ + PG_LATIN1, /* ISO-8859-1 Latin 1 */ + PG_LATIN2, /* ISO-8859-2 Latin 2 */ + PG_LATIN3, /* ISO-8859-3 Latin 3 */ + PG_LATIN4, /* ISO-8859-4 Latin 4 */ + PG_LATIN5, /* ISO-8859-9 Latin 5 */ + PG_LATIN6, /* ISO-8859-10 Latin6 */ + PG_LATIN7, /* ISO-8859-13 Latin7 */ + PG_LATIN8, /* ISO-8859-14 Latin8 */ + PG_LATIN9, /* ISO-8859-15 Latin9 */ + PG_LATIN10, /* ISO-8859-16 Latin10 */ + PG_WIN1256, /* windows-1256 */ + PG_WIN1258, /* Windows-1258 */ + PG_WIN866, /* (MS-DOS CP866) */ + PG_WIN874, /* windows-874 */ + PG_KOI8R, /* KOI8-R */ + PG_WIN1251, /* windows-1251 */ + PG_WIN1252, /* windows-1252 */ + PG_ISO_8859_5, /* ISO-8859-5 */ + PG_ISO_8859_6, /* ISO-8859-6 */ + PG_ISO_8859_7, /* ISO-8859-7 */ + PG_ISO_8859_8, /* ISO-8859-8 */ + PG_WIN1250, /* windows-1250 */ + PG_WIN1253, /* windows-1253 */ + PG_WIN1254, /* windows-1254 */ + PG_WIN1255, /* windows-1255 */ + PG_WIN1257, /* windows-1257 */ + PG_KOI8U, /* KOI8-U */ + /* PG_ENCODING_BE_LAST points to the above entry */ + + /* followings are for client encoding only */ + PG_SJIS, /* Shift JIS (Windows-932) */ + PG_BIG5, /* Big5 (Windows-950) */ + PG_GBK, /* GBK (Windows-936) */ + PG_UHC, /* UHC (Windows-949) */ + PG_GB18030, /* GB18030 */ + PG_JOHAB, /* EUC for Korean JOHAB */ + PG_SHIFT_JIS_2004, /* Shift-JIS-2004 */ + _PG_LAST_ENCODING_ /* mark only */ + +} pg_enc; + +#define PG_ENCODING_BE_LAST PG_KOI8U + +/* + * Please use these tests before access to pg_enc2name_tbl[] + * or to other places... + */ +#define PG_VALID_BE_ENCODING(_enc) \ + ((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST) + +#define PG_ENCODING_IS_CLIENT_ONLY(_enc) \ + ((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_) + +#define PG_VALID_ENCODING(_enc) \ + ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_) + +/* On FE are possible all encodings */ +#define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc) + +/* + * When converting strings between different encodings, we assume that space + * for converted result is 4-to-1 growth in the worst case. The rate for + * currently supported encoding pairs are within 3 (SJIS JIS X0201 half width + * kana -> UTF8 is the worst case). So "4" should be enough for the moment. + * + * Note that this is not the same as the maximum character width in any + * particular encoding. + */ +#define MAX_CONVERSION_GROWTH 4 + +/* + * Maximum byte length of a string that's required in any encoding to convert + * at least one character to any other encoding. In other words, if you feed + * MAX_CONVERSION_INPUT_LENGTH bytes to any encoding conversion function, it + * is guaranteed to be able to convert something without needing more input + * (assuming the input is valid). + * + * Currently, the maximum case is the conversion UTF8 -> SJIS JIS X0201 half + * width kana, where a pair of UTF-8 characters is converted into a single + * SHIFT_JIS_2004 character (the reverse of the worst case for + * MAX_CONVERSION_GROWTH). It needs 6 bytes of input. In theory, a + * user-defined conversion function might have more complicated cases, although + * for the reverse mapping you would probably also need to bump up + * MAX_CONVERSION_GROWTH. But there is no need to be stingy here, so make it + * generous. + */ +#define MAX_CONVERSION_INPUT_LENGTH 16 + +/* + * Maximum byte length of the string equivalent to any one Unicode code point, + * in any backend encoding. The current value assumes that a 4-byte UTF-8 + * character might expand by MAX_CONVERSION_GROWTH, which is a huge + * overestimate. But in current usage we don't allocate large multiples of + * this, so there's little point in being stingy. + */ +#define MAX_UNICODE_EQUIVALENT_STRING 16 + +/* + * Table for mapping an encoding number to official encoding name and + * possibly other subsidiary data. Be careful to check encoding number + * before accessing a table entry! + * + * if (PG_VALID_ENCODING(encoding)) + * pg_enc2name_tbl[ encoding ]; + */ +typedef struct pg_enc2name +{ + const char *name; + pg_enc encoding; +#ifdef WIN32 + unsigned codepage; /* codepage for WIN32 */ +#endif +} pg_enc2name; + +extern PGDLLIMPORT const pg_enc2name pg_enc2name_tbl[]; + +/* + * Encoding names for gettext + */ +extern PGDLLIMPORT const char *pg_enc2gettext_tbl[]; + +/* + * pg_wchar stuff + */ +typedef int (*mb2wchar_with_len_converter) (const unsigned char *from, + pg_wchar *to, + int len); + +typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from, + unsigned char *to, + int len); + +typedef int (*mblen_converter) (const unsigned char *mbstr); + +typedef int (*mbdisplaylen_converter) (const unsigned char *mbstr); + +typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len); + +typedef int (*mbchar_verifier) (const unsigned char *mbstr, int len); + +typedef int (*mbstr_verifier) (const unsigned char *mbstr, int len); + +typedef struct +{ + mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte + * string to a wchar */ + wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar string + * to a multibyte */ + mblen_converter mblen; /* get byte length of a char */ + mbdisplaylen_converter dsplen; /* get display width of a char */ + mbchar_verifier mbverifychar; /* verify multibyte character */ + mbstr_verifier mbverifystr; /* verify multibyte string */ + int maxmblen; /* max bytes for a char in this encoding */ +} pg_wchar_tbl; + +extern PGDLLIMPORT const pg_wchar_tbl pg_wchar_table[]; + +/* + * Data structures for conversions between UTF-8 and other encodings + * (UtfToLocal() and LocalToUtf()). In these data structures, characters of + * either encoding are represented by uint32 words; hence we can only support + * characters up to 4 bytes long. For example, the byte sequence 0xC2 0x89 + * would be represented by 0x0000C289, and 0xE8 0xA2 0xB4 by 0x00E8A2B4. + * + * There are three possible ways a character can be mapped: + * + * 1. Using a radix tree, from source to destination code. + * 2. Using a sorted array of source -> destination code pairs. This + * method is used for "combining" characters. There are so few of + * them that building a radix tree would be wasteful. + * 3. Using a conversion function. + */ + +/* + * Radix tree for character conversion. + * + * Logically, this is actually four different radix trees, for 1-byte, + * 2-byte, 3-byte and 4-byte inputs. The 1-byte tree is a simple lookup + * table from source to target code. The 2-byte tree consists of two levels: + * one lookup table for the first byte, where the value in the lookup table + * points to a lookup table for the second byte. And so on. + * + * Physically, all the trees are stored in one big array, in 'chars16' or + * 'chars32', depending on the maximum value that needs to be represented. For + * each level in each tree, we also store lower and upper bound of allowed + * values - values outside those bounds are considered invalid, and are left + * out of the tables. + * + * In the intermediate levels of the trees, the values stored are offsets + * into the chars[16|32] array. + * + * In the beginning of the chars[16|32] array, there is always a number of + * zeros, so that you safely follow an index from an intermediate table + * without explicitly checking for a zero. Following a zero any number of + * times will always bring you to the dummy, all-zeros table in the + * beginning. This helps to shave some cycles when looking up values. + */ +typedef struct +{ + /* + * Array containing all the values. Only one of chars16 or chars32 is + * used, depending on how wide the values we need to represent are. + */ + const uint16 *chars16; + const uint32 *chars32; + + /* Radix tree for 1-byte inputs */ + uint32 b1root; /* offset of table in the chars[16|32] array */ + uint8 b1_lower; /* min allowed value for a single byte input */ + uint8 b1_upper; /* max allowed value for a single byte input */ + + /* Radix tree for 2-byte inputs */ + uint32 b2root; /* offset of 1st byte's table */ + uint8 b2_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b2_1_upper; + uint8 b2_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b2_2_upper; + + /* Radix tree for 3-byte inputs */ + uint32 b3root; /* offset of 1st byte's table */ + uint8 b3_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b3_1_upper; + uint8 b3_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b3_2_upper; + uint8 b3_3_lower; /* min/max allowed value for 3rd input byte */ + uint8 b3_3_upper; + + /* Radix tree for 4-byte inputs */ + uint32 b4root; /* offset of 1st byte's table */ + uint8 b4_1_lower; /* min/max allowed value for 1st input byte */ + uint8 b4_1_upper; + uint8 b4_2_lower; /* min/max allowed value for 2nd input byte */ + uint8 b4_2_upper; + uint8 b4_3_lower; /* min/max allowed value for 3rd input byte */ + uint8 b4_3_upper; + uint8 b4_4_lower; /* min/max allowed value for 4th input byte */ + uint8 b4_4_upper; + +} pg_mb_radix_tree; + +/* + * UTF-8 to local code conversion map (for combined characters) + */ +typedef struct +{ + uint32 utf1; /* UTF-8 code 1 */ + uint32 utf2; /* UTF-8 code 2 */ + uint32 code; /* local code */ +} pg_utf_to_local_combined; + +/* + * local code to UTF-8 conversion map (for combined characters) + */ +typedef struct +{ + uint32 code; /* local code */ + uint32 utf1; /* UTF-8 code 1 */ + uint32 utf2; /* UTF-8 code 2 */ +} pg_local_to_utf_combined; + +/* + * callback function for algorithmic encoding conversions (in either direction) + * + * if function returns zero, it does not know how to convert the code + */ +typedef uint32 (*utf_local_conversion_func) (uint32 code); + +/* + * Support macro for encoding conversion functions to validate their + * arguments. (This could be made more compact if we included fmgr.h + * here, but we don't want to do that because this header file is also + * used by frontends.) + */ +#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding,destencoding) \ + check_encoding_conversion_args(PG_GETARG_INT32(0), \ + PG_GETARG_INT32(1), \ + PG_GETARG_INT32(4), \ + (srcencoding), \ + (destencoding)) + + +/* + * Some handy functions for Unicode-specific tests. + */ +static inline bool +is_valid_unicode_codepoint(pg_wchar c) +{ + return (c > 0 && c <= 0x10FFFF); +} + +static inline bool +is_utf16_surrogate_first(pg_wchar c) +{ + return (c >= 0xD800 && c <= 0xDBFF); +} + +static inline bool +is_utf16_surrogate_second(pg_wchar c) +{ + return (c >= 0xDC00 && c <= 0xDFFF); +} + +static inline pg_wchar +surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second) +{ + return ((first & 0x3FF) << 10) + 0x10000 + (second & 0x3FF); +} + +/* + * Convert a UTF-8 character to a Unicode code point. + * This is a one-character version of pg_utf2wchar_with_len. + * + * No error checks here, c must point to a long-enough string. + */ +static inline pg_wchar +utf8_to_unicode(const unsigned char *c) +{ + if ((*c & 0x80) == 0) + return (pg_wchar) c[0]; + else if ((*c & 0xe0) == 0xc0) + return (pg_wchar) (((c[0] & 0x1f) << 6) | + (c[1] & 0x3f)); + else if ((*c & 0xf0) == 0xe0) + return (pg_wchar) (((c[0] & 0x0f) << 12) | + ((c[1] & 0x3f) << 6) | + (c[2] & 0x3f)); + else if ((*c & 0xf8) == 0xf0) + return (pg_wchar) (((c[0] & 0x07) << 18) | + ((c[1] & 0x3f) << 12) | + ((c[2] & 0x3f) << 6) | + (c[3] & 0x3f)); + else + /* that is an invalid code on purpose */ + return 0xffffffff; +} + +/* + * Map a Unicode code point to UTF-8. utf8string must have at least + * unicode_utf8len(c) bytes available. + */ +static inline unsigned char * +unicode_to_utf8(pg_wchar c, unsigned char *utf8string) +{ + if (c <= 0x7F) + { + utf8string[0] = c; + } + else if (c <= 0x7FF) + { + utf8string[0] = 0xC0 | ((c >> 6) & 0x1F); + utf8string[1] = 0x80 | (c & 0x3F); + } + else if (c <= 0xFFFF) + { + utf8string[0] = 0xE0 | ((c >> 12) & 0x0F); + utf8string[1] = 0x80 | ((c >> 6) & 0x3F); + utf8string[2] = 0x80 | (c & 0x3F); + } + else + { + utf8string[0] = 0xF0 | ((c >> 18) & 0x07); + utf8string[1] = 0x80 | ((c >> 12) & 0x3F); + utf8string[2] = 0x80 | ((c >> 6) & 0x3F); + utf8string[3] = 0x80 | (c & 0x3F); + } + + return utf8string; +} + +/* + * Number of bytes needed to represent the given char in UTF8. + */ +static inline int +unicode_utf8len(pg_wchar c) +{ + if (c <= 0x7F) + return 1; + else if (c <= 0x7FF) + return 2; + else if (c <= 0xFFFF) + return 3; + else + return 4; +} + +/* + * The functions in this list are exported by libpq, and we need to be sure + * that we know which calls are satisfied by libpq and which are satisfied + * by static linkage to libpgcommon. (This is because we might be using a + * libpq.so that's of a different major version and has encoding IDs that + * differ from the current version's.) The nominal function names are what + * are actually used in and exported by libpq, while the names exported by + * libpgcommon.a and libpgcommon_srv.a end in "_private". + */ +#if defined(USE_PRIVATE_ENCODING_FUNCS) || !defined(FRONTEND) +#define pg_char_to_encoding pg_char_to_encoding_private +#define pg_encoding_to_char pg_encoding_to_char_private +#define pg_valid_server_encoding pg_valid_server_encoding_private +#define pg_valid_server_encoding_id pg_valid_server_encoding_id_private +#define pg_utf_mblen pg_utf_mblen_private +#endif + +/* + * These functions are considered part of libpq's exported API and + * are also declared in libpq-fe.h. + */ +extern int pg_char_to_encoding(const char *name); +extern const char *pg_encoding_to_char(int encoding); +extern int pg_valid_server_encoding_id(int encoding); + +/* + * These functions are available to frontend code that links with libpgcommon + * (in addition to the ones just above). The constant tables declared + * earlier in this file are also available from libpgcommon. + */ +extern void pg_encoding_set_invalid(int encoding, char *dst); +extern int pg_encoding_mblen(int encoding, const char *mbstr); +extern int pg_encoding_mblen_bounded(int encoding, const char *mbstr); +extern int pg_encoding_dsplen(int encoding, const char *mbstr); +extern int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len); +extern int pg_encoding_verifymbstr(int encoding, const char *mbstr, int len); +extern int pg_encoding_max_length(int encoding); +extern int pg_valid_client_encoding(const char *name); +extern int pg_valid_server_encoding(const char *name); +extern bool is_encoding_supported_by_icu(int encoding); +extern const char *get_encoding_name_for_icu(int encoding); + +extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8string); +extern pg_wchar utf8_to_unicode(const unsigned char *c); +extern bool pg_utf8_islegal(const unsigned char *source, int length); +extern int pg_utf_mblen(const unsigned char *s); +extern int pg_mule_mblen(const unsigned char *s); + +/* + * The remaining functions are backend-only. + */ +extern int pg_mb2wchar(const char *from, pg_wchar *to); +extern int pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len); +extern int pg_encoding_mb2wchar_with_len(int encoding, + const char *from, pg_wchar *to, int len); +extern int pg_wchar2mb(const pg_wchar *from, char *to); +extern int pg_wchar2mb_with_len(const pg_wchar *from, char *to, int len); +extern int pg_encoding_wchar2mb_with_len(int encoding, + const pg_wchar *from, char *to, int len); +extern int pg_char_and_wchar_strcmp(const char *s1, const pg_wchar *s2); +extern int pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n); +extern int pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n); +extern size_t pg_wchar_strlen(const pg_wchar *str); +extern int pg_mblen(const char *mbstr); +extern int pg_dsplen(const char *mbstr); +extern int pg_mbstrlen(const char *mbstr); +extern int pg_mbstrlen_with_len(const char *mbstr, int limit); +extern int pg_mbcliplen(const char *mbstr, int len, int limit); +extern int pg_encoding_mbcliplen(int encoding, const char *mbstr, + int len, int limit); +extern int pg_mbcharcliplen(const char *mbstr, int len, int limit); +extern int pg_database_encoding_max_length(void); +extern mbcharacter_incrementer pg_database_encoding_character_incrementer(void); + +extern int PrepareClientEncoding(int encoding); +extern int SetClientEncoding(int encoding); +extern void InitializeClientEncoding(void); +extern int pg_get_client_encoding(void); +extern const char *pg_get_client_encoding_name(void); + +extern void SetDatabaseEncoding(int encoding); +extern int GetDatabaseEncoding(void); +extern const char *GetDatabaseEncodingName(void); +extern void SetMessageEncoding(int encoding); +extern int GetMessageEncoding(void); + +#ifdef ENABLE_NLS +extern int pg_bind_textdomain_codeset(const char *domainname); +#endif + +extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len, + int src_encoding, + int dest_encoding); +extern int pg_do_encoding_conversion_buf(Oid proc, + int src_encoding, + int dest_encoding, + unsigned char *src, int srclen, + unsigned char *dest, int destlen, + bool noError); + +extern char *pg_client_to_server(const char *s, int len); +extern char *pg_server_to_client(const char *s, int len); +extern char *pg_any_to_server(const char *s, int len, int encoding); +extern char *pg_server_to_any(const char *s, int len, int encoding); + +extern void pg_unicode_to_server(pg_wchar c, unsigned char *s); +extern bool pg_unicode_to_server_noerror(pg_wchar c, unsigned char *s); + +extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc); +extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc); + +extern int UtfToLocal(const unsigned char *utf, int len, + unsigned char *iso, + const pg_mb_radix_tree *map, + const pg_utf_to_local_combined *cmap, int cmapsize, + utf_local_conversion_func conv_func, + int encoding, bool noError); +extern int LocalToUtf(const unsigned char *iso, int len, + unsigned char *utf, + const pg_mb_radix_tree *map, + const pg_local_to_utf_combined *cmap, int cmapsize, + utf_local_conversion_func conv_func, + int encoding, bool noError); + +extern bool pg_verifymbstr(const char *mbstr, int len, bool noError); +extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len, + bool noError); +extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len, + bool noError); + +extern void check_encoding_conversion_args(int src_encoding, + int dest_encoding, + int len, + int expected_src_encoding, + int expected_dest_encoding); + +extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn(); +extern void report_untranslatable_char(int src_encoding, int dest_encoding, + const char *mbstr, int len) pg_attribute_noreturn(); + +extern int local2local(const unsigned char *l, unsigned char *p, int len, + int src_encoding, int dest_encoding, + const unsigned char *tab, bool noError); +extern int latin2mic(const unsigned char *l, unsigned char *p, int len, + int lc, int encoding, bool noError); +extern int mic2latin(const unsigned char *mic, unsigned char *p, int len, + int lc, int encoding, bool noError); +extern int latin2mic_with_table(const unsigned char *l, unsigned char *p, + int len, int lc, int encoding, + const unsigned char *tab, bool noError); +extern int mic2latin_with_table(const unsigned char *mic, unsigned char *p, + int len, int lc, int encoding, + const unsigned char *tab, bool noError); + +#ifdef WIN32 +extern WCHAR *pgwin32_message_to_UTF16(const char *str, int len, int *utf16len); +#endif + +#endif /* PG_WCHAR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/mb/stringinfo_mb.h b/platform/dbops/binaries/postgres/include/server/mb/stringinfo_mb.h new file mode 100644 index 0000000000000000000000000000000000000000..bdef416e41a351beba65d80c1c4bc4f7c00c5150 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/mb/stringinfo_mb.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * stringinfo_mb.h + * multibyte support for StringInfo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/mb/stringinfo_mb.h + *------------------------------------------------------------------------- + */ +#ifndef STRINGINFO_MB_H +#define STRINGINFO_MB_H + + +#include "lib/stringinfo.h" + +/* + * Multibyte-aware StringInfo support function. + */ +extern void appendStringInfoStringQuoted(StringInfo str, + const char *s, int maxlen); + +#endif /* STRINGINFO_MB_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/bitmapset.h b/platform/dbops/binaries/postgres/include/server/nodes/bitmapset.h new file mode 100644 index 0000000000000000000000000000000000000000..283bea5ea961d20d92052d38ee5928e596fb5c3a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/bitmapset.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------------------- + * + * bitmapset.h + * PostgreSQL generic bitmap set package + * + * A bitmap set can represent any set of nonnegative integers, although + * it is mainly intended for sets where the maximum value is not large, + * say at most a few hundred. By convention, we always represent the + * empty set by a NULL pointer. + * + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/nodes/bitmapset.h + * + *------------------------------------------------------------------------- + */ +#ifndef BITMAPSET_H +#define BITMAPSET_H + +#include "nodes/nodes.h" + +/* + * Forward decl to save including pg_list.h + */ +struct List; + +/* + * Data representation + * + * Larger bitmap word sizes generally give better performance, so long as + * they're not wider than the processor can handle efficiently. We use + * 64-bit words if pointers are that large, else 32-bit words. + */ +#if SIZEOF_VOID_P >= 8 + +#define BITS_PER_BITMAPWORD 64 +typedef uint64 bitmapword; /* must be an unsigned type */ +typedef int64 signedbitmapword; /* must be the matching signed type */ + +#else + +#define BITS_PER_BITMAPWORD 32 +typedef uint32 bitmapword; /* must be an unsigned type */ +typedef int32 signedbitmapword; /* must be the matching signed type */ + +#endif + +typedef struct Bitmapset +{ + pg_node_attr(custom_copy_equal, special_read_write, no_query_jumble) + + NodeTag type; + int nwords; /* number of words in array */ + bitmapword words[FLEXIBLE_ARRAY_MEMBER]; /* really [nwords] */ +} Bitmapset; + + +/* result of bms_subset_compare */ +typedef enum +{ + BMS_EQUAL, /* sets are equal */ + BMS_SUBSET1, /* first set is a subset of the second */ + BMS_SUBSET2, /* second set is a subset of the first */ + BMS_DIFFERENT, /* neither set is a subset of the other */ +} BMS_Comparison; + +/* result of bms_membership */ +typedef enum +{ + BMS_EMPTY_SET, /* 0 members */ + BMS_SINGLETON, /* 1 member */ + BMS_MULTIPLE, /* >1 member */ +} BMS_Membership; + +/* Select appropriate bit-twiddling functions for bitmap word size */ +#if BITS_PER_BITMAPWORD == 32 +#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w) +#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w) +#define bmw_popcount(w) pg_popcount32(w) +#elif BITS_PER_BITMAPWORD == 64 +#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w) +#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w) +#define bmw_popcount(w) pg_popcount64(w) +#else +#error "invalid BITS_PER_BITMAPWORD" +#endif + + +/* + * function prototypes in nodes/bitmapset.c + */ + +extern Bitmapset *bms_copy(const Bitmapset *a); +extern bool bms_equal(const Bitmapset *a, const Bitmapset *b); +extern int bms_compare(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_make_singleton(int x); +extern void bms_free(Bitmapset *a); + +extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b); +extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b); +extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b); +extern bool bms_is_member(int x, const Bitmapset *a); +extern int bms_member_index(Bitmapset *a, int x); +extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b); +extern bool bms_overlap_list(const Bitmapset *a, const struct List *b); +extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b); +extern int bms_singleton_member(const Bitmapset *a); +extern bool bms_get_singleton_member(const Bitmapset *a, int *member); +extern int bms_num_members(const Bitmapset *a); + +/* optimized tests when we don't need to know exact membership count: */ +extern BMS_Membership bms_membership(const Bitmapset *a); + +/* NULL is now the only allowed representation of an empty bitmapset */ +#define bms_is_empty(a) ((a) == NULL) + +/* these routines recycle (modify or free) their non-const inputs: */ + +extern Bitmapset *bms_add_member(Bitmapset *a, int x); +extern Bitmapset *bms_del_member(Bitmapset *a, int x); +extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_replace_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_add_range(Bitmapset *a, int lower, int upper); +extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b); +extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b); + +/* support for iterating through the integer elements of a set: */ +extern int bms_next_member(const Bitmapset *a, int prevbit); +extern int bms_prev_member(const Bitmapset *a, int prevbit); + +/* support for hashtables using Bitmapsets as keys: */ +extern uint32 bms_hash_value(const Bitmapset *a); +extern uint32 bitmap_hash(const void *key, Size keysize); +extern int bitmap_match(const void *key1, const void *key2, Size keysize); + +#endif /* BITMAPSET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/execnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/execnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..17b0ec513864acff0de5cbbe07105d4eb8ee8a63 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/execnodes.h @@ -0,0 +1,2855 @@ +/*------------------------------------------------------------------------- + * + * execnodes.h + * definitions for executor state nodes + * + * Most plan node types declared in plannodes.h have a corresponding + * execution-state node type declared here. An exception is that + * expression nodes (subtypes of Expr) are usually represented by steps + * of an ExprState, and fully handled within execExpr* - but sometimes + * their state needs to be shared with other parts of the executor, as + * for example with SubPlanState, which nodeSubplan.c has to modify. + * + * Node types declared in this file do not have any copy/equal/out/read + * support. (That is currently hard-wired in gen_node_support.pl, rather + * than being explicitly represented by pg_node_attr decorations here.) + * There is no need for copy, equal, or read support for executor trees. + * Output support could be useful for debugging; but there are a lot of + * specialized fields that would require custom code, so for now it's + * not provided. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/execnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXECNODES_H +#define EXECNODES_H + +#include "access/tupconvert.h" +#include "executor/instrument.h" +#include "fmgr.h" +#include "lib/ilist.h" +#include "lib/pairingheap.h" +#include "nodes/miscnodes.h" +#include "nodes/params.h" +#include "nodes/plannodes.h" +#include "nodes/tidbitmap.h" +#include "partitioning/partdefs.h" +#include "storage/condition_variable.h" +#include "utils/hsearch.h" +#include "utils/queryenvironment.h" +#include "utils/reltrigger.h" +#include "utils/sharedtuplestore.h" +#include "utils/snapshot.h" +#include "utils/sortsupport.h" +#include "utils/tuplesort.h" +#include "utils/tuplestore.h" + +struct PlanState; /* forward references in this file */ +struct ParallelHashJoinState; +struct ExecRowMark; +struct ExprState; +struct ExprContext; +struct RangeTblEntry; /* avoid including parsenodes.h here */ +struct ExprEvalStep; /* avoid including execExpr.h everywhere */ +struct CopyMultiInsertBuffer; +struct LogicalTapeSet; + + +/* ---------------- + * ExprState node + * + * ExprState represents the evaluation state for a whole expression tree. + * It contains instructions (in ->steps) to evaluate the expression. + * ---------------- + */ +typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression, + struct ExprContext *econtext, + bool *isNull); + +/* Bits in ExprState->flags (see also execExpr.h for private flag bits): */ +/* expression is for use with ExecQual() */ +#define EEO_FLAG_IS_QUAL (1 << 0) + +typedef struct ExprState +{ + NodeTag type; + + uint8 flags; /* bitmask of EEO_FLAG_* bits, see above */ + + /* + * Storage for result value of a scalar expression, or for individual + * column results within expressions built by ExecBuildProjectionInfo(). + */ +#define FIELDNO_EXPRSTATE_RESNULL 2 + bool resnull; +#define FIELDNO_EXPRSTATE_RESVALUE 3 + Datum resvalue; + + /* + * If projecting a tuple result, this slot holds the result; else NULL. + */ +#define FIELDNO_EXPRSTATE_RESULTSLOT 4 + TupleTableSlot *resultslot; + + /* + * Instructions to compute expression's return value. + */ + struct ExprEvalStep *steps; + + /* + * Function that actually evaluates the expression. This can be set to + * different values depending on the complexity of the expression. + */ + ExprStateEvalFunc evalfunc; + + /* original expression tree, for debugging only */ + Expr *expr; + + /* private state for an evalfunc */ + void *evalfunc_private; + + /* + * XXX: following fields only needed during "compilation" (ExecInitExpr); + * could be thrown away afterwards. + */ + + int steps_len; /* number of steps currently */ + int steps_alloc; /* allocated length of steps array */ + +#define FIELDNO_EXPRSTATE_PARENT 11 + struct PlanState *parent; /* parent PlanState node, if any */ + ParamListInfo ext_params; /* for compiling PARAM_EXTERN nodes */ + + Datum *innermost_caseval; + bool *innermost_casenull; + + Datum *innermost_domainval; + bool *innermost_domainnull; + + /* + * For expression nodes that support soft errors. Should be set to NULL if + * the caller wants errors to be thrown. Callers that do not want errors + * thrown should set it to a valid ErrorSaveContext before calling + * ExecInitExprRec(). + */ + ErrorSaveContext *escontext; +} ExprState; + + +/* ---------------- + * IndexInfo information + * + * this struct holds the information needed to construct new index + * entries for a particular index. Used for both index_build and + * retail creation of index entries. + * + * NumIndexAttrs total number of columns in this index + * NumIndexKeyAttrs number of key columns in index + * IndexAttrNumbers underlying-rel attribute numbers used as keys + * (zeroes indicate expressions). It also contains + * info about included columns. + * Expressions expr trees for expression entries, or NIL if none + * ExpressionsState exec state for expressions, or NIL if none + * Predicate partial-index predicate, or NIL if none + * PredicateState exec state for predicate, or NIL if none + * ExclusionOps Per-column exclusion operators, or NULL if none + * ExclusionProcs Underlying function OIDs for ExclusionOps + * ExclusionStrats Opclass strategy numbers for ExclusionOps + * UniqueOps These are like Exclusion*, but for unique indexes + * UniqueProcs + * UniqueStrats + * Unique is it a unique index? + * OpclassOptions opclass-specific options, or NULL if none + * ReadyForInserts is it valid for inserts? + * CheckedUnchanged IndexUnchanged status determined yet? + * IndexUnchanged aminsert hint, cached for retail inserts + * Concurrent are we doing a concurrent index build? + * BrokenHotChain did we detect any broken HOT chains? + * Summarizing is it a summarizing index? + * ParallelWorkers # of workers requested (excludes leader) + * Am Oid of index AM + * AmCache private cache area for index AM + * Context memory context holding this IndexInfo + * + * ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only + * during index build; they're conventionally zeroed otherwise. + * ---------------- + */ +typedef struct IndexInfo +{ + NodeTag type; + int ii_NumIndexAttrs; /* total number of columns in index */ + int ii_NumIndexKeyAttrs; /* number of key columns in index */ + AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]; + List *ii_Expressions; /* list of Expr */ + List *ii_ExpressionsState; /* list of ExprState */ + List *ii_Predicate; /* list of Expr */ + ExprState *ii_PredicateState; + Oid *ii_ExclusionOps; /* array with one entry per column */ + Oid *ii_ExclusionProcs; /* array with one entry per column */ + uint16 *ii_ExclusionStrats; /* array with one entry per column */ + Oid *ii_UniqueOps; /* array with one entry per column */ + Oid *ii_UniqueProcs; /* array with one entry per column */ + uint16 *ii_UniqueStrats; /* array with one entry per column */ + bool ii_Unique; + bool ii_NullsNotDistinct; + bool ii_ReadyForInserts; + bool ii_CheckedUnchanged; + bool ii_IndexUnchanged; + bool ii_Concurrent; + bool ii_BrokenHotChain; + bool ii_Summarizing; + int ii_ParallelWorkers; + Oid ii_Am; + void *ii_AmCache; + MemoryContext ii_Context; +} IndexInfo; + +/* ---------------- + * ExprContext_CB + * + * List of callbacks to be called at ExprContext shutdown. + * ---------------- + */ +typedef void (*ExprContextCallbackFunction) (Datum arg); + +typedef struct ExprContext_CB +{ + struct ExprContext_CB *next; + ExprContextCallbackFunction function; + Datum arg; +} ExprContext_CB; + +/* ---------------- + * ExprContext + * + * This class holds the "current context" information + * needed to evaluate expressions for doing tuple qualifications + * and tuple projections. For example, if an expression refers + * to an attribute in the current inner tuple then we need to know + * what the current inner tuple is and so we look at the expression + * context. + * + * There are two memory contexts associated with an ExprContext: + * * ecxt_per_query_memory is a query-lifespan context, typically the same + * context the ExprContext node itself is allocated in. This context + * can be used for purposes such as storing function call cache info. + * * ecxt_per_tuple_memory is a short-term context for expression results. + * As the name suggests, it will typically be reset once per tuple, + * before we begin to evaluate expressions for that tuple. Each + * ExprContext normally has its very own per-tuple memory context. + * + * CurrentMemoryContext should be set to ecxt_per_tuple_memory before + * calling ExecEvalExpr() --- see ExecEvalExprSwitchContext(). + * ---------------- + */ +typedef struct ExprContext +{ + NodeTag type; + + /* Tuples that Var nodes in expression may refer to */ +#define FIELDNO_EXPRCONTEXT_SCANTUPLE 1 + TupleTableSlot *ecxt_scantuple; +#define FIELDNO_EXPRCONTEXT_INNERTUPLE 2 + TupleTableSlot *ecxt_innertuple; +#define FIELDNO_EXPRCONTEXT_OUTERTUPLE 3 + TupleTableSlot *ecxt_outertuple; + + /* Memory contexts for expression evaluation --- see notes above */ + MemoryContext ecxt_per_query_memory; + MemoryContext ecxt_per_tuple_memory; + + /* Values to substitute for Param nodes in expression */ + ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */ + ParamListInfo ecxt_param_list_info; /* for other param types */ + + /* + * Values to substitute for Aggref nodes in the expressions of an Agg + * node, or for WindowFunc nodes within a WindowAgg node. + */ +#define FIELDNO_EXPRCONTEXT_AGGVALUES 8 + Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */ +#define FIELDNO_EXPRCONTEXT_AGGNULLS 9 + bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */ + + /* Value to substitute for CaseTestExpr nodes in expression */ +#define FIELDNO_EXPRCONTEXT_CASEDATUM 10 + Datum caseValue_datum; +#define FIELDNO_EXPRCONTEXT_CASENULL 11 + bool caseValue_isNull; + + /* Value to substitute for CoerceToDomainValue nodes in expression */ +#define FIELDNO_EXPRCONTEXT_DOMAINDATUM 12 + Datum domainValue_datum; +#define FIELDNO_EXPRCONTEXT_DOMAINNULL 13 + bool domainValue_isNull; + + /* Link to containing EState (NULL if a standalone ExprContext) */ + struct EState *ecxt_estate; + + /* Functions to call back when ExprContext is shut down or rescanned */ + ExprContext_CB *ecxt_callbacks; +} ExprContext; + +/* + * Set-result status used when evaluating functions potentially returning a + * set. + */ +typedef enum +{ + ExprSingleResult, /* expression does not return a set */ + ExprMultipleResult, /* this result is an element of a set */ + ExprEndResult, /* there are no more elements in the set */ +} ExprDoneCond; + +/* + * Return modes for functions returning sets. Note values must be chosen + * as separate bits so that a bitmask can be formed to indicate supported + * modes. SFRM_Materialize_Random and SFRM_Materialize_Preferred are + * auxiliary flags about SFRM_Materialize mode, rather than separate modes. + */ +typedef enum +{ + SFRM_ValuePerCall = 0x01, /* one value returned per call */ + SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */ + SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */ + SFRM_Materialize_Preferred = 0x08, /* caller prefers Tuplestore */ +} SetFunctionReturnMode; + +/* + * When calling a function that might return a set (multiple rows), + * a node of this type is passed as fcinfo->resultinfo to allow + * return status to be passed back. A function returning set should + * raise an error if no such resultinfo is provided. + */ +typedef struct ReturnSetInfo +{ + NodeTag type; + /* values set by caller: */ + ExprContext *econtext; /* context function is being called in */ + TupleDesc expectedDesc; /* tuple descriptor expected by caller */ + int allowedModes; /* bitmask: return modes caller can handle */ + /* result status from function (but pre-initialized by caller): */ + SetFunctionReturnMode returnMode; /* actual return mode */ + ExprDoneCond isDone; /* status for ValuePerCall mode */ + /* fields filled by function in Materialize return mode: */ + Tuplestorestate *setResult; /* holds the complete returned tuple set */ + TupleDesc setDesc; /* actual descriptor for returned tuples */ +} ReturnSetInfo; + +/* ---------------- + * ProjectionInfo node information + * + * This is all the information needed to perform projections --- + * that is, form new tuples by evaluation of targetlist expressions. + * Nodes which need to do projections create one of these. + * + * The target tuple slot is kept in ProjectionInfo->pi_state.resultslot. + * ExecProject() evaluates the tlist, forms a tuple, and stores it + * in the given slot. Note that the result will be a "virtual" tuple + * unless ExecMaterializeSlot() is then called to force it to be + * converted to a physical tuple. The slot must have a tupledesc + * that matches the output of the tlist! + * ---------------- + */ +typedef struct ProjectionInfo +{ + NodeTag type; + /* instructions to evaluate projection */ + ExprState pi_state; + /* expression context in which to evaluate expression */ + ExprContext *pi_exprContext; +} ProjectionInfo; + +/* ---------------- + * JunkFilter + * + * This class is used to store information regarding junk attributes. + * A junk attribute is an attribute in a tuple that is needed only for + * storing intermediate information in the executor, and does not belong + * in emitted tuples. For example, when we do an UPDATE query, + * the planner adds a "junk" entry to the targetlist so that the tuples + * returned to ExecutePlan() contain an extra attribute: the ctid of + * the tuple to be updated. This is needed to do the update, but we + * don't want the ctid to be part of the stored new tuple! So, we + * apply a "junk filter" to remove the junk attributes and form the + * real output tuple. The junkfilter code also provides routines to + * extract the values of the junk attribute(s) from the input tuple. + * + * targetList: the original target list (including junk attributes). + * cleanTupType: the tuple descriptor for the "clean" tuple (with + * junk attributes removed). + * cleanMap: A map with the correspondence between the non-junk + * attribute numbers of the "original" tuple and the + * attribute numbers of the "clean" tuple. + * resultSlot: tuple slot used to hold cleaned tuple. + * ---------------- + */ +typedef struct JunkFilter +{ + NodeTag type; + List *jf_targetList; + TupleDesc jf_cleanTupType; + AttrNumber *jf_cleanMap; + TupleTableSlot *jf_resultSlot; +} JunkFilter; + +/* + * OnConflictSetState + * + * Executor state of an ON CONFLICT DO UPDATE operation. + */ +typedef struct OnConflictSetState +{ + NodeTag type; + + TupleTableSlot *oc_Existing; /* slot to store existing target tuple in */ + TupleTableSlot *oc_ProjSlot; /* CONFLICT ... SET ... projection target */ + ProjectionInfo *oc_ProjInfo; /* for ON CONFLICT DO UPDATE SET */ + ExprState *oc_WhereClause; /* state for the WHERE clause */ +} OnConflictSetState; + +/* ---------------- + * MergeActionState information + * + * Executor state for a MERGE action. + * ---------------- + */ +typedef struct MergeActionState +{ + NodeTag type; + + MergeAction *mas_action; /* associated MergeAction node */ + ProjectionInfo *mas_proj; /* projection of the action's targetlist for + * this rel */ + ExprState *mas_whenqual; /* WHEN [NOT] MATCHED AND conditions */ +} MergeActionState; + +/* + * ResultRelInfo + * + * Whenever we update an existing relation, we have to update indexes on the + * relation, and perhaps also fire triggers. ResultRelInfo holds all the + * information needed about a result relation, including indexes. + * + * Normally, a ResultRelInfo refers to a table that is in the query's range + * table; then ri_RangeTableIndex is the RT index and ri_RelationDesc is + * just a copy of the relevant es_relations[] entry. However, in some + * situations we create ResultRelInfos for relations that are not in the + * range table, namely for targets of tuple routing in a partitioned table, + * and when firing triggers in tables other than the target tables (See + * ExecGetTriggerResultRel). In these situations, ri_RangeTableIndex is 0 + * and ri_RelationDesc is a separately-opened relcache pointer that needs to + * be separately closed. + */ +typedef struct ResultRelInfo +{ + NodeTag type; + + /* result relation's range table index, or 0 if not in range table */ + Index ri_RangeTableIndex; + + /* relation descriptor for result relation */ + Relation ri_RelationDesc; + + /* # of indices existing on result relation */ + int ri_NumIndices; + + /* array of relation descriptors for indices */ + RelationPtr ri_IndexRelationDescs; + + /* array of key/attr info for indices */ + IndexInfo **ri_IndexRelationInfo; + + /* + * For UPDATE/DELETE result relations, the attribute number of the row + * identity junk attribute in the source plan's output tuples + */ + AttrNumber ri_RowIdAttNo; + + /* For UPDATE, attnums of generated columns to be computed */ + Bitmapset *ri_extraUpdatedCols; + + /* Projection to generate new tuple in an INSERT/UPDATE */ + ProjectionInfo *ri_projectNew; + /* Slot to hold that tuple */ + TupleTableSlot *ri_newTupleSlot; + /* Slot to hold the old tuple being updated */ + TupleTableSlot *ri_oldTupleSlot; + /* Have the projection and the slots above been initialized? */ + bool ri_projectNewInfoValid; + + /* updates do LockTuple() before oldtup read; see README.tuplock */ + bool ri_needLockTagTuple; + + /* triggers to be fired, if any */ + TriggerDesc *ri_TrigDesc; + + /* cached lookup info for trigger functions */ + FmgrInfo *ri_TrigFunctions; + + /* array of trigger WHEN expr states */ + ExprState **ri_TrigWhenExprs; + + /* optional runtime measurements for triggers */ + Instrumentation *ri_TrigInstrument; + + /* On-demand created slots for triggers / returning processing */ + TupleTableSlot *ri_ReturningSlot; /* for trigger output tuples */ + TupleTableSlot *ri_TrigOldSlot; /* for a trigger's old tuple */ + TupleTableSlot *ri_TrigNewSlot; /* for a trigger's new tuple */ + + /* FDW callback functions, if foreign table */ + struct FdwRoutine *ri_FdwRoutine; + + /* available to save private state of FDW */ + void *ri_FdwState; + + /* true when modifying foreign table directly */ + bool ri_usesFdwDirectModify; + + /* batch insert stuff */ + int ri_NumSlots; /* number of slots in the array */ + int ri_NumSlotsInitialized; /* number of initialized slots */ + int ri_BatchSize; /* max slots inserted in a single batch */ + TupleTableSlot **ri_Slots; /* input tuples for batch insert */ + TupleTableSlot **ri_PlanSlots; + + /* list of WithCheckOption's to be checked */ + List *ri_WithCheckOptions; + + /* list of WithCheckOption expr states */ + List *ri_WithCheckOptionExprs; + + /* array of constraint-checking expr states */ + ExprState **ri_ConstraintExprs; + + /* arrays of stored generated columns expr states, for INSERT and UPDATE */ + ExprState **ri_GeneratedExprsI; + ExprState **ri_GeneratedExprsU; + + /* number of stored generated columns we need to compute */ + int ri_NumGeneratedNeededI; + int ri_NumGeneratedNeededU; + + /* list of RETURNING expressions */ + List *ri_returningList; + + /* for computing a RETURNING list */ + ProjectionInfo *ri_projectReturning; + + /* list of arbiter indexes to use to check conflicts */ + List *ri_onConflictArbiterIndexes; + + /* ON CONFLICT evaluation state */ + OnConflictSetState *ri_onConflict; + + /* for MERGE, lists of MergeActionState (one per MergeMatchKind) */ + List *ri_MergeActions[NUM_MERGE_MATCH_KINDS]; + + /* for MERGE, expr state for checking the join condition */ + ExprState *ri_MergeJoinCondition; + + /* partition check expression state (NULL if not set up yet) */ + ExprState *ri_PartitionCheckExpr; + + /* + * Map to convert child result relation tuples to the format of the table + * actually mentioned in the query (called "root"). Computed only if + * needed. A NULL map value indicates that no conversion is needed, so we + * must have a separate flag to show if the map has been computed. + */ + TupleConversionMap *ri_ChildToRootMap; + bool ri_ChildToRootMapValid; + + /* + * As above, but in the other direction. + */ + TupleConversionMap *ri_RootToChildMap; + bool ri_RootToChildMapValid; + + /* + * Information needed by tuple routing target relations + * + * RootResultRelInfo gives the target relation mentioned in the query, if + * it's a partitioned table. It is not set if the target relation + * mentioned in the query is an inherited table, nor when tuple routing is + * not needed. + * + * PartitionTupleSlot is non-NULL if RootToChild conversion is needed and + * the relation is a partition. + */ + struct ResultRelInfo *ri_RootResultRelInfo; + TupleTableSlot *ri_PartitionTupleSlot; + + /* for use by copyfrom.c when performing multi-inserts */ + struct CopyMultiInsertBuffer *ri_CopyMultiInsertBuffer; + + /* + * Used when a leaf partition is involved in a cross-partition update of + * one of its ancestors; see ExecCrossPartitionUpdateForeignKey(). + */ + List *ri_ancestorResultRels; +} ResultRelInfo; + +/* ---------------- + * AsyncRequest + * + * State for an asynchronous tuple request. + * ---------------- + */ +typedef struct AsyncRequest +{ + struct PlanState *requestor; /* Node that wants a tuple */ + struct PlanState *requestee; /* Node from which a tuple is wanted */ + int request_index; /* Scratch space for requestor */ + bool callback_pending; /* Callback is needed */ + bool request_complete; /* Request complete, result valid */ + TupleTableSlot *result; /* Result (NULL or an empty slot if no more + * tuples) */ +} AsyncRequest; + +/* ---------------- + * EState information + * + * Working state for an Executor invocation + * ---------------- + */ +typedef struct EState +{ + NodeTag type; + + /* Basic state for all query types: */ + ScanDirection es_direction; /* current scan direction */ + Snapshot es_snapshot; /* time qual to use */ + Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */ + List *es_range_table; /* List of RangeTblEntry */ + Index es_range_table_size; /* size of the range table arrays */ + Relation *es_relations; /* Array of per-range-table-entry Relation + * pointers, or NULL if not yet opened */ + struct ExecRowMark **es_rowmarks; /* Array of per-range-table-entry + * ExecRowMarks, or NULL if none */ + List *es_rteperminfos; /* List of RTEPermissionInfo */ + PlannedStmt *es_plannedstmt; /* link to top of plan tree */ + const char *es_sourceText; /* Source text from QueryDesc */ + + JunkFilter *es_junkFilter; /* top-level junk filter, if any */ + + /* If query can insert/delete tuples, the command ID to mark them with */ + CommandId es_output_cid; + + /* Info about target table(s) for insert/update/delete queries: */ + ResultRelInfo **es_result_relations; /* Array of per-range-table-entry + * ResultRelInfo pointers, or NULL + * if not a target table */ + List *es_opened_result_relations; /* List of non-NULL entries in + * es_result_relations in no + * specific order */ + + PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */ + + /* + * The following list contains ResultRelInfos created by the tuple routing + * code for partitions that aren't found in the es_result_relations array. + */ + List *es_tuple_routing_result_relations; + + /* Stuff used for firing triggers: */ + List *es_trig_target_relations; /* trigger-only ResultRelInfos */ + + /* Parameter info: */ + ParamListInfo es_param_list_info; /* values of external params */ + ParamExecData *es_param_exec_vals; /* values of internal params */ + + QueryEnvironment *es_queryEnv; /* query environment */ + + /* Other working state: */ + MemoryContext es_query_cxt; /* per-query context in which EState lives */ + + List *es_tupleTable; /* List of TupleTableSlots */ + + uint64 es_processed; /* # of tuples processed during one + * ExecutorRun() call. */ + uint64 es_total_processed; /* total # of tuples aggregated across all + * ExecutorRun() calls. */ + + int es_top_eflags; /* eflags passed to ExecutorStart */ + int es_instrument; /* OR of InstrumentOption flags */ + bool es_finished; /* true when ExecutorFinish is done */ + + List *es_exprcontexts; /* List of ExprContexts within EState */ + + List *es_subplanstates; /* List of PlanState for SubPlans */ + + List *es_auxmodifytables; /* List of secondary ModifyTableStates */ + + /* + * this ExprContext is for per-output-tuple operations, such as constraint + * checks and index-value computations. It will be reset for each output + * tuple. Note that it will be created only if needed. + */ + ExprContext *es_per_tuple_exprcontext; + + /* + * If not NULL, this is an EPQState's EState. This is a field in EState + * both to allow EvalPlanQual aware executor nodes to detect that they + * need to perform EPQ related work, and to provide necessary information + * to do so. + */ + struct EPQState *es_epq_active; + + bool es_use_parallel_mode; /* can we use parallel workers? */ + + /* The per-query shared memory area to use for parallel execution. */ + struct dsa_area *es_query_dsa; + + /* + * JIT information. es_jit_flags indicates whether JIT should be performed + * and with which options. es_jit is created on-demand when JITing is + * performed. + * + * es_jit_worker_instr is the combined, on demand allocated, + * instrumentation from all workers. The leader's instrumentation is kept + * separate, and is combined on demand by ExplainPrintJITSummary(). + */ + int es_jit_flags; + struct JitContext *es_jit; + struct JitInstrumentation *es_jit_worker_instr; + + /* + * Lists of ResultRelInfos for foreign tables on which batch-inserts are + * to be executed and owning ModifyTableStates, stored in the same order. + */ + List *es_insert_pending_result_relations; + List *es_insert_pending_modifytables; +} EState; + + +/* + * ExecRowMark - + * runtime representation of FOR [KEY] UPDATE/SHARE clauses + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR [KEY] UPDATE/SHARE, we will have + * an ExecRowMark for each non-target relation in the query (except inheritance + * parent RTEs, which can be ignored at runtime). Virtual relations such as + * subqueries-in-FROM will have an ExecRowMark with relation == NULL. See + * PlanRowMark for details about most of the fields. In addition to fields + * directly derived from PlanRowMark, we store an activity flag (to denote + * inactive children of inheritance trees), curCtid, which is used by the + * WHERE CURRENT OF code, and ermExtra, which is available for use by the plan + * node that sources the relation (e.g., for a foreign table the FDW can use + * ermExtra to hold information). + * + * EState->es_rowmarks is an array of these structs, indexed by RT index, + * with NULLs for irrelevant RT indexes. es_rowmarks itself is NULL if + * there are no rowmarks. + */ +typedef struct ExecRowMark +{ + Relation relation; /* opened and suitably locked relation */ + Oid relid; /* its OID (or InvalidOid, if subquery) */ + Index rti; /* its range table index */ + Index prti; /* parent range table index, if child */ + Index rowmarkId; /* unique identifier for resjunk columns */ + RowMarkType markType; /* see enum in nodes/plannodes.h */ + LockClauseStrength strength; /* LockingClause's strength, or LCS_NONE */ + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ + bool ermActive; /* is this mark relevant for current tuple? */ + ItemPointerData curCtid; /* ctid of currently locked tuple, if any */ + void *ermExtra; /* available for use by relation source node */ +} ExecRowMark; + +/* + * ExecAuxRowMark - + * additional runtime representation of FOR [KEY] UPDATE/SHARE clauses + * + * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to + * deal with. In addition to a pointer to the related entry in es_rowmarks, + * this struct carries the column number(s) of the resjunk columns associated + * with the rowmark (see comments for PlanRowMark for more detail). + */ +typedef struct ExecAuxRowMark +{ + ExecRowMark *rowmark; /* related entry in es_rowmarks */ + AttrNumber ctidAttNo; /* resno of ctid junk attribute, if any */ + AttrNumber toidAttNo; /* resno of tableoid junk attribute, if any */ + AttrNumber wholeAttNo; /* resno of whole-row junk attribute, if any */ +} ExecAuxRowMark; + + +/* ---------------------------------------------------------------- + * Tuple Hash Tables + * + * All-in-memory tuple hash tables are used for a number of purposes. + * + * Note: tab_hash_funcs are for the key datatype(s) stored in the table, + * and tab_eq_funcs are non-cross-type equality operators for those types. + * Normally these are the only functions used, but FindTupleHashEntry() + * supports searching a hashtable using cross-data-type hashing. For that, + * the caller must supply hash functions for the LHS datatype as well as + * the cross-type equality operators to use. in_hash_funcs and cur_eq_func + * are set to point to the caller's function arrays while doing such a search. + * During LookupTupleHashEntry(), they point to tab_hash_funcs and + * tab_eq_func respectively. + * ---------------------------------------------------------------- + */ +typedef struct TupleHashEntryData *TupleHashEntry; +typedef struct TupleHashTableData *TupleHashTable; + +typedef struct TupleHashEntryData +{ + MinimalTuple firstTuple; /* copy of first tuple in this group */ + void *additional; /* user data */ + uint32 status; /* hash status */ + uint32 hash; /* hash value (cached) */ +} TupleHashEntryData; + +/* define parameters necessary to generate the tuple hash table interface */ +#define SH_PREFIX tuplehash +#define SH_ELEMENT_TYPE TupleHashEntryData +#define SH_KEY_TYPE MinimalTuple +#define SH_SCOPE extern +#define SH_DECLARE +#include "lib/simplehash.h" + +typedef struct TupleHashTableData +{ + tuplehash_hash *hashtab; /* underlying hash table */ + int numCols; /* number of columns in lookup key */ + AttrNumber *keyColIdx; /* attr numbers of key columns */ + FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */ + ExprState *tab_eq_func; /* comparator for table datatype(s) */ + Oid *tab_collations; /* collations for hash and comparison */ + MemoryContext tablecxt; /* memory context containing table */ + MemoryContext tempcxt; /* context for function evaluations */ + Size entrysize; /* actual size to make each hash entry */ + TupleTableSlot *tableslot; /* slot for referencing table entries */ + /* The following fields are set transiently for each table search: */ + TupleTableSlot *inputslot; /* current input tuple's slot */ + FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */ + ExprState *cur_eq_func; /* comparator for input vs. table */ + uint32 hash_iv; /* hash-function IV */ + ExprContext *exprcontext; /* expression context */ +} TupleHashTableData; + +typedef tuplehash_iterator TupleHashIterator; + +/* + * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan. + * Use ResetTupleHashIterator if the table can be frozen (in this case no + * explicit scan termination is needed). + */ +#define InitTupleHashIterator(htable, iter) \ + tuplehash_start_iterate(htable->hashtab, iter) +#define TermTupleHashIterator(iter) \ + ((void) 0) +#define ResetTupleHashIterator(htable, iter) \ + InitTupleHashIterator(htable, iter) +#define ScanTupleHashTable(htable, iter) \ + tuplehash_iterate(htable->hashtab, iter) + + +/* ---------------------------------------------------------------- + * Expression State Nodes + * + * Formerly, there was a separate executor expression state node corresponding + * to each node in a planned expression tree. That's no longer the case; for + * common expression node types, all the execution info is embedded into + * step(s) in a single ExprState node. But we still have a few executor state + * node types for selected expression node types, mostly those in which info + * has to be shared with other parts of the execution state tree. + * ---------------------------------------------------------------- + */ + +/* ---------------- + * WindowFuncExprState node + * ---------------- + */ +typedef struct WindowFuncExprState +{ + NodeTag type; + WindowFunc *wfunc; /* expression plan node */ + List *args; /* ExprStates for argument expressions */ + ExprState *aggfilter; /* FILTER expression */ + int wfuncno; /* ID number for wfunc within its plan node */ +} WindowFuncExprState; + + +/* ---------------- + * SetExprState node + * + * State for evaluating a potentially set-returning expression (like FuncExpr + * or OpExpr). In some cases, like some of the expressions in ROWS FROM(...) + * the expression might not be a SRF, but nonetheless it uses the same + * machinery as SRFs; it will be treated as a SRF returning a single row. + * ---------------- + */ +typedef struct SetExprState +{ + NodeTag type; + Expr *expr; /* expression plan node */ + List *args; /* ExprStates for argument expressions */ + + /* + * In ROWS FROM, functions can be inlined, removing the FuncExpr normally + * inside. In such a case this is the compiled expression (which cannot + * return a set), which'll be evaluated using regular ExecEvalExpr(). + */ + ExprState *elidedFuncState; + + /* + * Function manager's lookup info for the target function. If func.fn_oid + * is InvalidOid, we haven't initialized it yet (nor any of the following + * fields, except funcReturnsSet). + */ + FmgrInfo func; + + /* + * For a set-returning function (SRF) that returns a tuplestore, we keep + * the tuplestore here and dole out the result rows one at a time. The + * slot holds the row currently being returned. + */ + Tuplestorestate *funcResultStore; + TupleTableSlot *funcResultSlot; + + /* + * In some cases we need to compute a tuple descriptor for the function's + * output. If so, it's stored here. + */ + TupleDesc funcResultDesc; + bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */ + + /* + * Remember whether the function is declared to return a set. This is set + * by ExecInitExpr, and is valid even before the FmgrInfo is set up. + */ + bool funcReturnsSet; + + /* + * setArgsValid is true when we are evaluating a set-returning function + * that uses value-per-call mode and we are in the middle of a call + * series; we want to pass the same argument values to the function again + * (and again, until it returns ExprEndResult). This indicates that + * fcinfo_data already contains valid argument data. + */ + bool setArgsValid; + + /* + * Flag to remember whether we have registered a shutdown callback for + * this SetExprState. We do so only if funcResultStore or setArgsValid + * has been set at least once (since all the callback is for is to release + * the tuplestore or clear setArgsValid). + */ + bool shutdown_reg; /* a shutdown callback is registered */ + + /* + * Call parameter structure for the function. This has been initialized + * (by InitFunctionCallInfoData) if func.fn_oid is valid. It also saves + * argument values between calls, when setArgsValid is true. + */ + FunctionCallInfo fcinfo; +} SetExprState; + +/* ---------------- + * SubPlanState node + * ---------------- + */ +typedef struct SubPlanState +{ + NodeTag type; + SubPlan *subplan; /* expression plan node */ + struct PlanState *planstate; /* subselect plan's state tree */ + struct PlanState *parent; /* parent plan node's state tree */ + ExprState *testexpr; /* state of combining expression */ + List *args; /* states of argument expression(s) */ + HeapTuple curTuple; /* copy of most recent tuple from subplan */ + Datum curArray; /* most recent array from ARRAY() subplan */ + /* these are used when hashing the subselect's output: */ + TupleDesc descRight; /* subselect desc after projection */ + ProjectionInfo *projLeft; /* for projecting lefthand exprs */ + ProjectionInfo *projRight; /* for projecting subselect output */ + TupleHashTable hashtable; /* hash table for no-nulls subselect rows */ + TupleHashTable hashnulls; /* hash table for rows with null(s) */ + bool havehashrows; /* true if hashtable is not empty */ + bool havenullrows; /* true if hashnulls is not empty */ + MemoryContext hashtablecxt; /* memory context containing hash tables */ + MemoryContext hashtempcxt; /* temp memory context for hash tables */ + ExprContext *innerecontext; /* econtext for computing inner tuples */ + int numCols; /* number of columns being hashed */ + /* each of the remaining fields is an array of length numCols: */ + AttrNumber *keyColIdx; /* control data for hash tables */ + Oid *tab_eq_funcoids; /* equality func oids for table + * datatype(s) */ + Oid *tab_collations; /* collations for hash and comparison */ + FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */ + FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */ + FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */ + FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */ + ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */ +} SubPlanState; + +/* + * DomainConstraintState - one item to check during CoerceToDomain + * + * Note: we consider this to be part of an ExprState tree, so we give it + * a name following the xxxState convention. But there's no directly + * associated plan-tree node. + */ +typedef enum DomainConstraintType +{ + DOM_CONSTRAINT_NOTNULL, + DOM_CONSTRAINT_CHECK, +} DomainConstraintType; + +typedef struct DomainConstraintState +{ + NodeTag type; + DomainConstraintType constrainttype; /* constraint type */ + char *name; /* name of constraint (for error msgs) */ + Expr *check_expr; /* for CHECK, a boolean expression */ + ExprState *check_exprstate; /* check_expr's eval state, or NULL */ +} DomainConstraintState; + +/* + * State for JsonExpr evaluation, too big to inline. + * + * This contains the information going into and coming out of the + * EEOP_JSONEXPR_PATH eval step. + */ +typedef struct JsonExprState +{ + /* original expression node */ + JsonExpr *jsexpr; + + /* value/isnull for formatted_expr */ + NullableDatum formatted_expr; + + /* value/isnull for pathspec */ + NullableDatum pathspec; + + /* JsonPathVariable entries for passing_values */ + List *args; + + /* + * Output variables that drive the EEOP_JUMP_IF_NOT_TRUE steps that are + * added for ON ERROR and ON EMPTY expressions, if any. + * + * Reset for each evaluation of EEOP_JSONEXPR_PATH. + */ + + /* Set to true if jsonpath evaluation cause an error. */ + NullableDatum error; + + /* Set to true if the jsonpath evaluation returned 0 items. */ + NullableDatum empty; + + /* + * Addresses of steps that implement the non-ERROR variant of ON EMPTY and + * ON ERROR behaviors, respectively. + */ + int jump_empty; + int jump_error; + + /* + * Address of the step to coerce the result value of jsonpath evaluation + * to the RETURNING type. -1 if no coercion if JsonExpr.use_io_coercion + * is true. + */ + int jump_eval_coercion; + + /* + * Address to jump to when skipping all the steps after performing + * ExecEvalJsonExprPath() so as to return whatever the JsonPath* function + * returned as is, that is, in the cases where there's no error and no + * coercion is necessary. + */ + int jump_end; + + /* + * RETURNING type input function invocation info when + * JsonExpr.use_io_coercion is true. + */ + FunctionCallInfo input_fcinfo; + + /* + * For error-safe evaluation of coercions. When the ON ERROR behavior is + * not ERROR, a pointer to this is passed to ExecInitExprRec() when + * initializing the coercion expressions or to ExecInitJsonCoercion(). + * + * Reset for each evaluation of EEOP_JSONEXPR_PATH. + */ + ErrorSaveContext escontext; +} JsonExprState; + + +/* ---------------------------------------------------------------- + * Executor State Trees + * + * An executing query has a PlanState tree paralleling the Plan tree + * that describes the plan. + * ---------------------------------------------------------------- + */ + +/* ---------------- + * ExecProcNodeMtd + * + * This is the method called by ExecProcNode to return the next tuple + * from an executor node. It returns NULL, or an empty TupleTableSlot, + * if no more tuples are available. + * ---------------- + */ +typedef TupleTableSlot *(*ExecProcNodeMtd) (struct PlanState *pstate); + +/* ---------------- + * PlanState node + * + * We never actually instantiate any PlanState nodes; this is just the common + * abstract superclass for all PlanState-type nodes. + * ---------------- + */ +typedef struct PlanState +{ + pg_node_attr(abstract) + + NodeTag type; + + Plan *plan; /* associated Plan node */ + + EState *state; /* at execution time, states of individual + * nodes point to one EState for the whole + * top-level plan */ + + ExecProcNodeMtd ExecProcNode; /* function to return next tuple */ + ExecProcNodeMtd ExecProcNodeReal; /* actual function, if above is a + * wrapper */ + + Instrumentation *instrument; /* Optional runtime stats for this node */ + WorkerInstrumentation *worker_instrument; /* per-worker instrumentation */ + + /* Per-worker JIT instrumentation */ + struct SharedJitInstrumentation *worker_jit_instrument; + + /* + * Common structural data for all Plan types. These links to subsidiary + * state trees parallel links in the associated plan tree (except for the + * subPlan list, which does not exist in the plan tree). + */ + ExprState *qual; /* boolean qual condition */ + struct PlanState *lefttree; /* input plan tree(s) */ + struct PlanState *righttree; + + List *initPlan; /* Init SubPlanState nodes (un-correlated expr + * subselects) */ + List *subPlan; /* SubPlanState nodes in my expressions */ + + /* + * State for management of parameter-change-driven rescanning + */ + Bitmapset *chgParam; /* set of IDs of changed Params */ + + /* + * Other run-time state needed by most if not all node types. + */ + TupleDesc ps_ResultTupleDesc; /* node's return type */ + TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */ + ExprContext *ps_ExprContext; /* node's expression-evaluation context */ + ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */ + + bool async_capable; /* true if node is async-capable */ + + /* + * Scanslot's descriptor if known. This is a bit of a hack, but otherwise + * it's hard for expression compilation to optimize based on the + * descriptor, without encoding knowledge about all executor nodes. + */ + TupleDesc scandesc; + + /* + * Define the slot types for inner, outer and scanslots for expression + * contexts with this state as a parent. If *opsset is set, then + * *opsfixed indicates whether *ops is guaranteed to be the type of slot + * used. That means that every slot in the corresponding + * ExprContext.ecxt_*tuple will point to a slot of that type, while + * evaluating the expression. If *opsfixed is false, but *ops is set, + * that indicates the most likely type of slot. + * + * The scan* fields are set by ExecInitScanTupleSlot(). If that's not + * called, nodes can initialize the fields themselves. + * + * If outer/inneropsset is false, the information is inferred on-demand + * using ExecGetResultSlotOps() on ->righttree/lefttree, using the + * corresponding node's resultops* fields. + * + * The result* fields are automatically set when ExecInitResultSlot is + * used (be it directly or when the slot is created by + * ExecAssignScanProjectionInfo() / + * ExecConditionalAssignProjectionInfo()). If no projection is necessary + * ExecConditionalAssignProjectionInfo() defaults those fields to the scan + * operations. + */ + const TupleTableSlotOps *scanops; + const TupleTableSlotOps *outerops; + const TupleTableSlotOps *innerops; + const TupleTableSlotOps *resultops; + bool scanopsfixed; + bool outeropsfixed; + bool inneropsfixed; + bool resultopsfixed; + bool scanopsset; + bool outeropsset; + bool inneropsset; + bool resultopsset; +} PlanState; + +/* ---------------- + * these are defined to avoid confusion problems with "left" + * and "right" and "inner" and "outer". The convention is that + * the "left" plan is the "outer" plan and the "right" plan is + * the inner plan, but these make the code more readable. + * ---------------- + */ +#define innerPlanState(node) (((PlanState *)(node))->righttree) +#define outerPlanState(node) (((PlanState *)(node))->lefttree) + +/* Macros for inline access to certain instrumentation counters */ +#define InstrCountTuples2(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->ntuples2 += (delta); \ + } while (0) +#define InstrCountFiltered1(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->nfiltered1 += (delta); \ + } while(0) +#define InstrCountFiltered2(node, delta) \ + do { \ + if (((PlanState *)(node))->instrument) \ + ((PlanState *)(node))->instrument->nfiltered2 += (delta); \ + } while(0) + +/* + * EPQState is state for executing an EvalPlanQual recheck on a candidate + * tuples e.g. in ModifyTable or LockRows. + * + * To execute EPQ a separate EState is created (stored in ->recheckestate), + * which shares some resources, like the rangetable, with the main query's + * EState (stored in ->parentestate). The (sub-)tree of the plan that needs to + * be rechecked (in ->plan), is separately initialized (into + * ->recheckplanstate), but shares plan nodes with the corresponding nodes in + * the main query. The scan nodes in that separate executor tree are changed + * to return only the current tuple of interest for the respective + * table. Those tuples are either provided by the caller (using + * EvalPlanQualSlot), and/or found using the rowmark mechanism (non-locking + * rowmarks by the EPQ machinery itself, locking ones by the caller). + * + * While the plan to be checked may be changed using EvalPlanQualSetPlan(), + * all such plans need to share the same EState. + */ +typedef struct EPQState +{ + /* These are initialized by EvalPlanQualInit() and do not change later: */ + EState *parentestate; /* main query's EState */ + int epqParam; /* ID of Param to force scan node re-eval */ + List *resultRelations; /* integer list of RT indexes, or NIL */ + + /* + * relsubs_slot[scanrelid - 1] holds the EPQ test tuple to be returned by + * the scan node for the scanrelid'th RT index, in place of performing an + * actual table scan. Callers should use EvalPlanQualSlot() to fetch + * these slots. + */ + List *tuple_table; /* tuple table for relsubs_slot */ + TupleTableSlot **relsubs_slot; + + /* + * Initialized by EvalPlanQualInit(), may be changed later with + * EvalPlanQualSetPlan(): + */ + + Plan *plan; /* plan tree to be executed */ + List *arowMarks; /* ExecAuxRowMarks (non-locking only) */ + + + /* + * The original output tuple to be rechecked. Set by + * EvalPlanQualSetSlot(), before EvalPlanQualNext() or EvalPlanQual() may + * be called. + */ + TupleTableSlot *origslot; + + + /* Initialized or reset by EvalPlanQualBegin(): */ + + EState *recheckestate; /* EState for EPQ execution, see above */ + + /* + * Rowmarks that can be fetched on-demand using + * EvalPlanQualFetchRowMark(), indexed by scanrelid - 1. Only non-locking + * rowmarks. + */ + ExecAuxRowMark **relsubs_rowmark; + + /* + * relsubs_done[scanrelid - 1] is true if there is no EPQ tuple for this + * target relation or it has already been fetched in the current scan of + * this target relation within the current EvalPlanQual test. + */ + bool *relsubs_done; + + /* + * relsubs_blocked[scanrelid - 1] is true if there is no EPQ tuple for + * this target relation during the current EvalPlanQual test. We keep + * these flags set for all relids listed in resultRelations, but + * transiently clear the one for the relation whose tuple is actually + * passed to EvalPlanQual(). + */ + bool *relsubs_blocked; + + PlanState *recheckplanstate; /* EPQ specific exec nodes, for ->plan */ +} EPQState; + + +/* ---------------- + * ResultState information + * ---------------- + */ +typedef struct ResultState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *resconstantqual; + bool rs_done; /* are we done? */ + bool rs_checkqual; /* do we need to check the qual? */ +} ResultState; + +/* ---------------- + * ProjectSetState information + * + * Note: at least one of the "elems" will be a SetExprState; the rest are + * regular ExprStates. + * ---------------- + */ +typedef struct ProjectSetState +{ + PlanState ps; /* its first field is NodeTag */ + Node **elems; /* array of expression states */ + ExprDoneCond *elemdone; /* array of per-SRF is-done states */ + int nelems; /* length of elemdone[] array */ + bool pending_srf_tuples; /* still evaluating srfs in tlist? */ + MemoryContext argcontext; /* context for SRF arguments */ +} ProjectSetState; + + +/* flags for mt_merge_subcommands */ +#define MERGE_INSERT 0x01 +#define MERGE_UPDATE 0x02 +#define MERGE_DELETE 0x04 + +/* ---------------- + * ModifyTableState information + * ---------------- + */ +typedef struct ModifyTableState +{ + PlanState ps; /* its first field is NodeTag */ + CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */ + bool canSetTag; /* do we set the command tag/es_processed? */ + bool mt_done; /* are we done? */ + int mt_nrels; /* number of entries in resultRelInfo[] */ + ResultRelInfo *resultRelInfo; /* info about target relation(s) */ + + /* + * Target relation mentioned in the original statement, used to fire + * statement-level triggers and as the root for tuple routing. (This + * might point to one of the resultRelInfo[] entries, but it can also be a + * distinct struct.) + */ + ResultRelInfo *rootResultRelInfo; + + EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ + bool fireBSTriggers; /* do we need to fire stmt triggers? */ + + /* + * These fields are used for inherited UPDATE and DELETE, to track which + * target relation a given tuple is from. If there are a lot of target + * relations, we use a hash table to translate table OIDs to + * resultRelInfo[] indexes; otherwise mt_resultOidHash is NULL. + */ + int mt_resultOidAttno; /* resno of "tableoid" junk attr */ + Oid mt_lastResultOid; /* last-seen value of tableoid */ + int mt_lastResultIndex; /* corresponding index in resultRelInfo[] */ + HTAB *mt_resultOidHash; /* optional hash table to speed lookups */ + + /* + * Slot for storing tuples in the root partitioned table's rowtype during + * an UPDATE of a partitioned table. + */ + TupleTableSlot *mt_root_tuple_slot; + + /* Tuple-routing support info */ + struct PartitionTupleRouting *mt_partition_tuple_routing; + + /* controls transition table population for specified operation */ + struct TransitionCaptureState *mt_transition_capture; + + /* controls transition table population for INSERT...ON CONFLICT UPDATE */ + struct TransitionCaptureState *mt_oc_transition_capture; + + /* Flags showing which subcommands are present INS/UPD/DEL/DO NOTHING */ + int mt_merge_subcommands; + + /* For MERGE, the action currently being executed */ + MergeActionState *mt_merge_action; + + /* + * For MERGE, if there is a pending NOT MATCHED [BY TARGET] action to be + * performed, this will be the last tuple read from the subplan; otherwise + * it will be NULL --- see the comments in ExecMerge(). + */ + TupleTableSlot *mt_merge_pending_not_matched; + + /* tuple counters for MERGE */ + double mt_merge_inserted; + double mt_merge_updated; + double mt_merge_deleted; +} ModifyTableState; + +/* ---------------- + * AppendState information + * + * nplans how many plans are in the array + * whichplan which synchronous plan is being executed (0 .. n-1) + * or a special negative value. See nodeAppend.c. + * prune_state details required to allow partitions to be + * eliminated from the scan, or NULL if not possible. + * valid_subplans for runtime pruning, valid synchronous appendplans + * indexes to scan. + * ---------------- + */ + +struct AppendState; +typedef struct AppendState AppendState; +struct ParallelAppendState; +typedef struct ParallelAppendState ParallelAppendState; +struct PartitionPruneState; + +struct AppendState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **appendplans; /* array of PlanStates for my inputs */ + int as_nplans; + int as_whichplan; + bool as_begun; /* false means need to initialize */ + Bitmapset *as_asyncplans; /* asynchronous plans indexes */ + int as_nasyncplans; /* # of asynchronous plans */ + AsyncRequest **as_asyncrequests; /* array of AsyncRequests */ + TupleTableSlot **as_asyncresults; /* unreturned results of async plans */ + int as_nasyncresults; /* # of valid entries in as_asyncresults */ + bool as_syncdone; /* true if all synchronous plans done in + * asynchronous mode, else false */ + int as_nasyncremain; /* # of remaining asynchronous plans */ + Bitmapset *as_needrequest; /* asynchronous plans needing a new request */ + struct WaitEventSet *as_eventset; /* WaitEventSet used to configure file + * descriptor wait events */ + int as_first_partial_plan; /* Index of 'appendplans' containing + * the first partial plan */ + ParallelAppendState *as_pstate; /* parallel coordination info */ + Size pstate_len; /* size of parallel coordination info */ + struct PartitionPruneState *as_prune_state; + bool as_valid_subplans_identified; /* is as_valid_subplans valid? */ + Bitmapset *as_valid_subplans; + Bitmapset *as_valid_asyncplans; /* valid asynchronous plans indexes */ + bool (*choose_next_subplan) (AppendState *); +}; + +/* ---------------- + * MergeAppendState information + * + * nplans how many plans are in the array + * nkeys number of sort key columns + * sortkeys sort keys in SortSupport representation + * slots current output tuple of each subplan + * heap heap of active tuples + * initialized true if we have fetched first tuple from each subplan + * prune_state details required to allow partitions to be + * eliminated from the scan, or NULL if not possible. + * valid_subplans for runtime pruning, valid mergeplans indexes to + * scan. + * ---------------- + */ +typedef struct MergeAppendState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **mergeplans; /* array of PlanStates for my inputs */ + int ms_nplans; + int ms_nkeys; + SortSupport ms_sortkeys; /* array of length ms_nkeys */ + TupleTableSlot **ms_slots; /* array of length ms_nplans */ + struct binaryheap *ms_heap; /* binary heap of slot indices */ + bool ms_initialized; /* are subplans started? */ + struct PartitionPruneState *ms_prune_state; + Bitmapset *ms_valid_subplans; +} MergeAppendState; + +/* ---------------- + * RecursiveUnionState information + * + * RecursiveUnionState is used for performing a recursive union. + * + * recursing T when we're done scanning the non-recursive term + * intermediate_empty T if intermediate_table is currently empty + * working_table working table (to be scanned by recursive term) + * intermediate_table current recursive output (next generation of WT) + * ---------------- + */ +typedef struct RecursiveUnionState +{ + PlanState ps; /* its first field is NodeTag */ + bool recursing; + bool intermediate_empty; + Tuplestorestate *working_table; + Tuplestorestate *intermediate_table; + /* Remaining fields are unused in UNION ALL case */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + MemoryContext tempContext; /* short-term context for comparisons */ + TupleHashTable hashtable; /* hash table for tuples already seen */ + MemoryContext tableContext; /* memory context containing hash table */ +} RecursiveUnionState; + +/* ---------------- + * BitmapAndState information + * ---------------- + */ +typedef struct BitmapAndState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **bitmapplans; /* array of PlanStates for my inputs */ + int nplans; /* number of input plans */ +} BitmapAndState; + +/* ---------------- + * BitmapOrState information + * ---------------- + */ +typedef struct BitmapOrState +{ + PlanState ps; /* its first field is NodeTag */ + PlanState **bitmapplans; /* array of PlanStates for my inputs */ + int nplans; /* number of input plans */ +} BitmapOrState; + +/* ---------------------------------------------------------------- + * Scan State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * ScanState information + * + * ScanState extends PlanState for node types that represent + * scans of an underlying relation. It can also be used for nodes + * that scan the output of an underlying plan node --- in that case, + * only ScanTupleSlot is actually useful, and it refers to the tuple + * retrieved from the subplan. + * + * currentRelation relation being scanned (NULL if none) + * currentScanDesc current scan descriptor for scan (NULL if none) + * ScanTupleSlot pointer to slot in tuple table holding scan tuple + * ---------------- + */ +typedef struct ScanState +{ + PlanState ps; /* its first field is NodeTag */ + Relation ss_currentRelation; + struct TableScanDescData *ss_currentScanDesc; + TupleTableSlot *ss_ScanTupleSlot; +} ScanState; + +/* ---------------- + * SeqScanState information + * ---------------- + */ +typedef struct SeqScanState +{ + ScanState ss; /* its first field is NodeTag */ + Size pscan_len; /* size of parallel heap scan descriptor */ +} SeqScanState; + +/* ---------------- + * SampleScanState information + * ---------------- + */ +typedef struct SampleScanState +{ + ScanState ss; + List *args; /* expr states for TABLESAMPLE params */ + ExprState *repeatable; /* expr state for REPEATABLE expr */ + /* use struct pointer to avoid including tsmapi.h here */ + struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */ + void *tsm_state; /* tablesample method can keep state here */ + bool use_bulkread; /* use bulkread buffer access strategy? */ + bool use_pagemode; /* use page-at-a-time visibility checking? */ + bool begun; /* false means need to call BeginSampleScan */ + uint32 seed; /* random seed */ + int64 donetuples; /* number of tuples already returned */ + bool haveblock; /* has a block for sampling been determined */ + bool done; /* exhausted all tuples? */ +} SampleScanState; + +/* + * These structs store information about index quals that don't have simple + * constant right-hand sides. See comments for ExecIndexBuildScanKeys() + * for discussion. + */ +typedef struct +{ + struct ScanKeyData *scan_key; /* scankey to put value into */ + ExprState *key_expr; /* expr to evaluate to get value */ + bool key_toastable; /* is expr's result a toastable datatype? */ +} IndexRuntimeKeyInfo; + +typedef struct +{ + struct ScanKeyData *scan_key; /* scankey to put value into */ + ExprState *array_expr; /* expr to evaluate to get array value */ + int next_elem; /* next array element to use */ + int num_elems; /* number of elems in current array value */ + Datum *elem_values; /* array of num_elems Datums */ + bool *elem_nulls; /* array of num_elems is-null flags */ +} IndexArrayKeyInfo; + +/* ---------------- + * IndexScanState information + * + * indexqualorig execution state for indexqualorig expressions + * indexorderbyorig execution state for indexorderbyorig expressions + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * OrderByKeys Skey structures for index ordering operators + * NumOrderByKeys number of OrderByKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * + * ReorderQueue tuples that need reordering due to re-check + * ReachedEnd have we fetched all tuples from index already? + * OrderByValues values of ORDER BY exprs of last fetched tuple + * OrderByNulls null flags for OrderByValues + * SortSupport for reordering ORDER BY exprs + * OrderByTypByVals is the datatype of order by expression pass-by-value? + * OrderByTypLens typlens of the datatypes of order by expressions + * PscanLen size of parallel index scan descriptor + * ---------------- + */ +typedef struct IndexScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *indexqualorig; + List *indexorderbyorig; + struct ScanKeyData *iss_ScanKeys; + int iss_NumScanKeys; + struct ScanKeyData *iss_OrderByKeys; + int iss_NumOrderByKeys; + IndexRuntimeKeyInfo *iss_RuntimeKeys; + int iss_NumRuntimeKeys; + bool iss_RuntimeKeysReady; + ExprContext *iss_RuntimeContext; + Relation iss_RelationDesc; + struct IndexScanDescData *iss_ScanDesc; + + /* These are needed for re-checking ORDER BY expr ordering */ + pairingheap *iss_ReorderQueue; + bool iss_ReachedEnd; + Datum *iss_OrderByValues; + bool *iss_OrderByNulls; + SortSupport iss_SortSupport; + bool *iss_OrderByTypByVals; + int16 *iss_OrderByTypLens; + Size iss_PscanLen; +} IndexScanState; + +/* ---------------- + * IndexOnlyScanState information + * + * recheckqual execution state for recheckqual expressions + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * OrderByKeys Skey structures for index ordering operators + * NumOrderByKeys number of OrderByKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * TableSlot slot for holding tuples fetched from the table + * VMBuffer buffer in use for visibility map testing, if any + * PscanLen size of parallel index-only scan descriptor + * NameCStringAttNums attnums of name typed columns to pad to NAMEDATALEN + * NameCStringCount number of elements in the NameCStringAttNums array + * ---------------- + */ +typedef struct IndexOnlyScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *recheckqual; + struct ScanKeyData *ioss_ScanKeys; + int ioss_NumScanKeys; + struct ScanKeyData *ioss_OrderByKeys; + int ioss_NumOrderByKeys; + IndexRuntimeKeyInfo *ioss_RuntimeKeys; + int ioss_NumRuntimeKeys; + bool ioss_RuntimeKeysReady; + ExprContext *ioss_RuntimeContext; + Relation ioss_RelationDesc; + struct IndexScanDescData *ioss_ScanDesc; + TupleTableSlot *ioss_TableSlot; + Buffer ioss_VMBuffer; + Size ioss_PscanLen; + AttrNumber *ioss_NameCStringAttNums; + int ioss_NameCStringCount; +} IndexOnlyScanState; + +/* ---------------- + * BitmapIndexScanState information + * + * result bitmap to return output into, or NULL + * ScanKeys Skey structures for index quals + * NumScanKeys number of ScanKeys + * RuntimeKeys info about Skeys that must be evaluated at runtime + * NumRuntimeKeys number of RuntimeKeys + * ArrayKeys info about Skeys that come from ScalarArrayOpExprs + * NumArrayKeys number of ArrayKeys + * RuntimeKeysReady true if runtime Skeys have been computed + * RuntimeContext expr context for evaling runtime Skeys + * RelationDesc index relation descriptor + * ScanDesc index scan descriptor + * ---------------- + */ +typedef struct BitmapIndexScanState +{ + ScanState ss; /* its first field is NodeTag */ + TIDBitmap *biss_result; + struct ScanKeyData *biss_ScanKeys; + int biss_NumScanKeys; + IndexRuntimeKeyInfo *biss_RuntimeKeys; + int biss_NumRuntimeKeys; + IndexArrayKeyInfo *biss_ArrayKeys; + int biss_NumArrayKeys; + bool biss_RuntimeKeysReady; + ExprContext *biss_RuntimeContext; + Relation biss_RelationDesc; + struct IndexScanDescData *biss_ScanDesc; +} BitmapIndexScanState; + +/* ---------------- + * SharedBitmapState information + * + * BM_INITIAL TIDBitmap creation is not yet started, so first worker + * to see this state will set the state to BM_INPROGRESS + * and that process will be responsible for creating + * TIDBitmap. + * BM_INPROGRESS TIDBitmap creation is in progress; workers need to + * sleep until it's finished. + * BM_FINISHED TIDBitmap creation is done, so now all workers can + * proceed to iterate over TIDBitmap. + * ---------------- + */ +typedef enum +{ + BM_INITIAL, + BM_INPROGRESS, + BM_FINISHED, +} SharedBitmapState; + +/* ---------------- + * ParallelBitmapHeapState information + * tbmiterator iterator for scanning current pages + * prefetch_iterator iterator for prefetching ahead of current page + * mutex mutual exclusion for the prefetching variable + * and state + * prefetch_pages # pages prefetch iterator is ahead of current + * prefetch_target current target prefetch distance + * state current state of the TIDBitmap + * cv conditional wait variable + * ---------------- + */ +typedef struct ParallelBitmapHeapState +{ + dsa_pointer tbmiterator; + dsa_pointer prefetch_iterator; + slock_t mutex; + int prefetch_pages; + int prefetch_target; + SharedBitmapState state; + ConditionVariable cv; +} ParallelBitmapHeapState; + +/* ---------------- + * BitmapHeapScanState information + * + * bitmapqualorig execution state for bitmapqualorig expressions + * tbm bitmap obtained from child index scan(s) + * tbmiterator iterator for scanning current pages + * tbmres current-page data + * pvmbuffer buffer for visibility-map lookups of prefetched pages + * exact_pages total number of exact pages retrieved + * lossy_pages total number of lossy pages retrieved + * prefetch_iterator iterator for prefetching ahead of current page + * prefetch_pages # pages prefetch iterator is ahead of current + * prefetch_target current target prefetch distance + * prefetch_maximum maximum value for prefetch_target + * initialized is node is ready to iterate + * shared_tbmiterator shared iterator + * shared_prefetch_iterator shared iterator for prefetching + * pstate shared state for parallel bitmap scan + * ---------------- + */ +typedef struct BitmapHeapScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *bitmapqualorig; + TIDBitmap *tbm; + TBMIterator *tbmiterator; + TBMIterateResult *tbmres; + Buffer pvmbuffer; + long exact_pages; + long lossy_pages; + TBMIterator *prefetch_iterator; + int prefetch_pages; + int prefetch_target; + int prefetch_maximum; + bool initialized; + TBMSharedIterator *shared_tbmiterator; + TBMSharedIterator *shared_prefetch_iterator; + ParallelBitmapHeapState *pstate; +} BitmapHeapScanState; + +/* ---------------- + * TidScanState information + * + * tidexprs list of TidExpr structs (see nodeTidscan.c) + * isCurrentOf scan has a CurrentOfExpr qual + * NumTids number of tids in this scan + * TidPtr index of currently fetched tid + * TidList evaluated item pointers (array of size NumTids) + * ---------------- + */ +typedef struct TidScanState +{ + ScanState ss; /* its first field is NodeTag */ + List *tss_tidexprs; + bool tss_isCurrentOf; + int tss_NumTids; + int tss_TidPtr; + ItemPointerData *tss_TidList; +} TidScanState; + +/* ---------------- + * TidRangeScanState information + * + * trss_tidexprs list of TidOpExpr structs (see nodeTidrangescan.c) + * trss_mintid the lowest TID in the scan range + * trss_maxtid the highest TID in the scan range + * trss_inScan is a scan currently in progress? + * ---------------- + */ +typedef struct TidRangeScanState +{ + ScanState ss; /* its first field is NodeTag */ + List *trss_tidexprs; + ItemPointerData trss_mintid; + ItemPointerData trss_maxtid; + bool trss_inScan; +} TidRangeScanState; + +/* ---------------- + * SubqueryScanState information + * + * SubqueryScanState is used for scanning a sub-query in the range table. + * ScanTupleSlot references the current output tuple of the sub-query. + * ---------------- + */ +typedef struct SubqueryScanState +{ + ScanState ss; /* its first field is NodeTag */ + PlanState *subplan; +} SubqueryScanState; + +/* ---------------- + * FunctionScanState information + * + * Function nodes are used to scan the results of a + * function appearing in FROM (typically a function returning set). + * + * eflags node's capability flags + * ordinality is this scan WITH ORDINALITY? + * simple true if we have 1 function and no ordinality + * ordinal current ordinal column value + * nfuncs number of functions being executed + * funcstates per-function execution states (private in + * nodeFunctionscan.c) + * argcontext memory context to evaluate function arguments in + * ---------------- + */ +struct FunctionScanPerFuncState; + +typedef struct FunctionScanState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; + bool ordinality; + bool simple; + int64 ordinal; + int nfuncs; + struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */ + MemoryContext argcontext; +} FunctionScanState; + +/* ---------------- + * ValuesScanState information + * + * ValuesScan nodes are used to scan the results of a VALUES list + * + * rowcontext per-expression-list context + * exprlists array of expression lists being evaluated + * exprstatelists array of expression state lists, for SubPlans only + * array_len size of above arrays + * curr_idx current array index (0-based) + * + * Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection + * expressions attached to the node. We create a second ExprContext, + * rowcontext, in which to build the executor expression state for each + * Values sublist. Resetting this context lets us get rid of expression + * state for each row, avoiding major memory leakage over a long values list. + * However, that doesn't work for sublists containing SubPlans, because a + * SubPlan has to be connected up to the outer plan tree to work properly. + * Therefore, for only those sublists containing SubPlans, we do expression + * state construction at executor start, and store those pointers in + * exprstatelists[]. NULL entries in that array correspond to simple + * subexpressions that are handled as described above. + * ---------------- + */ +typedef struct ValuesScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprContext *rowcontext; + List **exprlists; + List **exprstatelists; + int array_len; + int curr_idx; +} ValuesScanState; + +/* ---------------- + * TableFuncScanState node + * + * Used in table-expression functions like XMLTABLE. + * ---------------- + */ +typedef struct TableFuncScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *docexpr; /* state for document expression */ + ExprState *rowexpr; /* state for row-generating expression */ + List *colexprs; /* state for column-generating expression */ + List *coldefexprs; /* state for column default expressions */ + List *colvalexprs; /* state for column value expressions */ + List *passingvalexprs; /* state for PASSING argument expressions */ + List *ns_names; /* same as TableFunc.ns_names */ + List *ns_uris; /* list of states of namespace URI exprs */ + Bitmapset *notnulls; /* nullability flag for each output column */ + void *opaque; /* table builder private space */ + const struct TableFuncRoutine *routine; /* table builder methods */ + FmgrInfo *in_functions; /* input function for each column */ + Oid *typioparams; /* typioparam for each column */ + int64 ordinal; /* row number to be output next */ + MemoryContext perTableCxt; /* per-table context */ + Tuplestorestate *tupstore; /* output tuple store */ +} TableFuncScanState; + +/* ---------------- + * CteScanState information + * + * CteScan nodes are used to scan a CommonTableExpr query. + * + * Multiple CteScan nodes can read out from the same CTE query. We use + * a tuplestore to hold rows that have been read from the CTE query but + * not yet consumed by all readers. + * ---------------- + */ +typedef struct CteScanState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; /* capability flags to pass to tuplestore */ + int readptr; /* index of my tuplestore read pointer */ + PlanState *cteplanstate; /* PlanState for the CTE query itself */ + /* Link to the "leader" CteScanState (possibly this same node) */ + struct CteScanState *leader; + /* The remaining fields are only valid in the "leader" CteScanState */ + Tuplestorestate *cte_table; /* rows already read from the CTE query */ + bool eof_cte; /* reached end of CTE query? */ +} CteScanState; + +/* ---------------- + * NamedTuplestoreScanState information + * + * NamedTuplestoreScan nodes are used to scan a Tuplestore created and + * named prior to execution of the query. An example is a transition + * table for an AFTER trigger. + * + * Multiple NamedTuplestoreScan nodes can read out from the same Tuplestore. + * ---------------- + */ +typedef struct NamedTuplestoreScanState +{ + ScanState ss; /* its first field is NodeTag */ + int readptr; /* index of my tuplestore read pointer */ + TupleDesc tupdesc; /* format of the tuples in the tuplestore */ + Tuplestorestate *relation; /* the rows */ +} NamedTuplestoreScanState; + +/* ---------------- + * WorkTableScanState information + * + * WorkTableScan nodes are used to scan the work table created by + * a RecursiveUnion node. We locate the RecursiveUnion node + * during executor startup. + * ---------------- + */ +typedef struct WorkTableScanState +{ + ScanState ss; /* its first field is NodeTag */ + RecursiveUnionState *rustate; +} WorkTableScanState; + +/* ---------------- + * ForeignScanState information + * + * ForeignScan nodes are used to scan foreign-data tables. + * ---------------- + */ +typedef struct ForeignScanState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */ + Size pscan_len; /* size of parallel coordination information */ + ResultRelInfo *resultRelInfo; /* result rel info, if UPDATE or DELETE */ + /* use struct pointer to avoid including fdwapi.h here */ + struct FdwRoutine *fdwroutine; + void *fdw_state; /* foreign-data wrapper can keep state here */ +} ForeignScanState; + +/* ---------------- + * CustomScanState information + * + * CustomScan nodes are used to execute custom code within executor. + * + * Core code must avoid assuming that the CustomScanState is only as large as + * the structure declared here; providers are allowed to make it the first + * element in a larger structure, and typically would need to do so. The + * struct is actually allocated by the CreateCustomScanState method associated + * with the plan node. Any additional fields can be initialized there, or in + * the BeginCustomScan method. + * ---------------- + */ +struct CustomExecMethods; + +typedef struct CustomScanState +{ + ScanState ss; + uint32 flags; /* mask of CUSTOMPATH_* flags, see + * nodes/extensible.h */ + List *custom_ps; /* list of child PlanState nodes, if any */ + Size pscan_len; /* size of parallel coordination information */ + const struct CustomExecMethods *methods; + const struct TupleTableSlotOps *slotOps; +} CustomScanState; + +/* ---------------------------------------------------------------- + * Join State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * JoinState information + * + * Superclass for state nodes of join plans. + * ---------------- + */ +typedef struct JoinState +{ + PlanState ps; + JoinType jointype; + bool single_match; /* True if we should skip to next outer tuple + * after finding one inner match */ + ExprState *joinqual; /* JOIN quals (in addition to ps.qual) */ +} JoinState; + +/* ---------------- + * NestLoopState information + * + * NeedNewOuter true if need new outer tuple on next call + * MatchedOuter true if found a join match for current outer tuple + * NullInnerTupleSlot prepared null tuple for left outer joins + * ---------------- + */ +typedef struct NestLoopState +{ + JoinState js; /* its first field is NodeTag */ + bool nl_NeedNewOuter; + bool nl_MatchedOuter; + TupleTableSlot *nl_NullInnerTupleSlot; +} NestLoopState; + +/* ---------------- + * MergeJoinState information + * + * NumClauses number of mergejoinable join clauses + * Clauses info for each mergejoinable clause + * JoinState current state of ExecMergeJoin state machine + * SkipMarkRestore true if we may skip Mark and Restore operations + * ExtraMarks true to issue extra Mark operations on inner scan + * ConstFalseJoin true if we have a constant-false joinqual + * FillOuter true if should emit unjoined outer tuples anyway + * FillInner true if should emit unjoined inner tuples anyway + * MatchedOuter true if found a join match for current outer tuple + * MatchedInner true if found a join match for current inner tuple + * OuterTupleSlot slot in tuple table for cur outer tuple + * InnerTupleSlot slot in tuple table for cur inner tuple + * MarkedTupleSlot slot in tuple table for marked tuple + * NullOuterTupleSlot prepared null tuple for right outer joins + * NullInnerTupleSlot prepared null tuple for left outer joins + * OuterEContext workspace for computing outer tuple's join values + * InnerEContext workspace for computing inner tuple's join values + * ---------------- + */ +/* private in nodeMergejoin.c: */ +typedef struct MergeJoinClauseData *MergeJoinClause; + +typedef struct MergeJoinState +{ + JoinState js; /* its first field is NodeTag */ + int mj_NumClauses; + MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */ + int mj_JoinState; + bool mj_SkipMarkRestore; + bool mj_ExtraMarks; + bool mj_ConstFalseJoin; + bool mj_FillOuter; + bool mj_FillInner; + bool mj_MatchedOuter; + bool mj_MatchedInner; + TupleTableSlot *mj_OuterTupleSlot; + TupleTableSlot *mj_InnerTupleSlot; + TupleTableSlot *mj_MarkedTupleSlot; + TupleTableSlot *mj_NullOuterTupleSlot; + TupleTableSlot *mj_NullInnerTupleSlot; + ExprContext *mj_OuterEContext; + ExprContext *mj_InnerEContext; +} MergeJoinState; + +/* ---------------- + * HashJoinState information + * + * hashclauses original form of the hashjoin condition + * hj_OuterHashKeys the outer hash keys in the hashjoin condition + * hj_HashOperators the join operators in the hashjoin condition + * hj_HashTable hash table for the hashjoin + * (NULL if table not built yet) + * hj_CurHashValue hash value for current outer tuple + * hj_CurBucketNo regular bucket# for current outer tuple + * hj_CurSkewBucketNo skew bucket# for current outer tuple + * hj_CurTuple last inner tuple matched to current outer + * tuple, or NULL if starting search + * (hj_CurXXX variables are undefined if + * OuterTupleSlot is empty!) + * hj_OuterTupleSlot tuple slot for outer tuples + * hj_HashTupleSlot tuple slot for inner (hashed) tuples + * hj_NullOuterTupleSlot prepared null tuple for right/right-anti/full + * outer joins + * hj_NullInnerTupleSlot prepared null tuple for left/full outer joins + * hj_FirstOuterTupleSlot first tuple retrieved from outer plan + * hj_JoinState current state of ExecHashJoin state machine + * hj_MatchedOuter true if found a join match for current outer + * hj_OuterNotEmpty true if outer relation known not empty + * ---------------- + */ + +/* these structs are defined in executor/hashjoin.h: */ +typedef struct HashJoinTupleData *HashJoinTuple; +typedef struct HashJoinTableData *HashJoinTable; + +typedef struct HashJoinState +{ + JoinState js; /* its first field is NodeTag */ + ExprState *hashclauses; + List *hj_OuterHashKeys; /* list of ExprState nodes */ + List *hj_HashOperators; /* list of operator OIDs */ + List *hj_Collations; + HashJoinTable hj_HashTable; + uint32 hj_CurHashValue; + int hj_CurBucketNo; + int hj_CurSkewBucketNo; + HashJoinTuple hj_CurTuple; + TupleTableSlot *hj_OuterTupleSlot; + TupleTableSlot *hj_HashTupleSlot; + TupleTableSlot *hj_NullOuterTupleSlot; + TupleTableSlot *hj_NullInnerTupleSlot; + TupleTableSlot *hj_FirstOuterTupleSlot; + int hj_JoinState; + bool hj_MatchedOuter; + bool hj_OuterNotEmpty; +} HashJoinState; + + +/* ---------------------------------------------------------------- + * Materialization State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * MaterialState information + * + * materialize nodes are used to materialize the results + * of a subplan into a temporary file. + * + * ss.ss_ScanTupleSlot refers to output of underlying plan. + * ---------------- + */ +typedef struct MaterialState +{ + ScanState ss; /* its first field is NodeTag */ + int eflags; /* capability flags to pass to tuplestore */ + bool eof_underlying; /* reached end of underlying plan? */ + Tuplestorestate *tuplestorestate; +} MaterialState; + +struct MemoizeEntry; +struct MemoizeTuple; +struct MemoizeKey; + +typedef struct MemoizeInstrumentation +{ + uint64 cache_hits; /* number of rescans where we've found the + * scan parameter values to be cached */ + uint64 cache_misses; /* number of rescans where we've not found the + * scan parameter values to be cached. */ + uint64 cache_evictions; /* number of cache entries removed due to + * the need to free memory */ + uint64 cache_overflows; /* number of times we've had to bypass the + * cache when filling it due to not being + * able to free enough space to store the + * current scan's tuples. */ + uint64 mem_peak; /* peak memory usage in bytes */ +} MemoizeInstrumentation; + +/* ---------------- + * Shared memory container for per-worker memoize information + * ---------------- + */ +typedef struct SharedMemoizeInfo +{ + int num_workers; + MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedMemoizeInfo; + +/* ---------------- + * MemoizeState information + * + * memoize nodes are used to cache recent and commonly seen results from + * a parameterized scan. + * ---------------- + */ +typedef struct MemoizeState +{ + ScanState ss; /* its first field is NodeTag */ + int mstatus; /* value of ExecMemoize state machine */ + int nkeys; /* number of cache keys */ + struct memoize_hash *hashtable; /* hash table for cache entries */ + TupleDesc hashkeydesc; /* tuple descriptor for cache keys */ + TupleTableSlot *tableslot; /* min tuple slot for existing cache entries */ + TupleTableSlot *probeslot; /* virtual slot used for hash lookups */ + ExprState *cache_eq_expr; /* Compare exec params to hash key */ + ExprState **param_exprs; /* exprs containing the parameters to this + * node */ + FmgrInfo *hashfunctions; /* lookup data for hash funcs nkeys in size */ + Oid *collations; /* collation for comparisons nkeys in size */ + uint64 mem_used; /* bytes of memory used by cache */ + uint64 mem_limit; /* memory limit in bytes for the cache */ + MemoryContext tableContext; /* memory context to store cache data */ + dlist_head lru_list; /* least recently used entry list */ + struct MemoizeTuple *last_tuple; /* Used to point to the last tuple + * returned during a cache hit and the + * tuple we last stored when + * populating the cache. */ + struct MemoizeEntry *entry; /* the entry that 'last_tuple' belongs to or + * NULL if 'last_tuple' is NULL. */ + bool singlerow; /* true if the cache entry is to be marked as + * complete after caching the first tuple. */ + bool binary_mode; /* true when cache key should be compared bit + * by bit, false when using hash equality ops */ + MemoizeInstrumentation stats; /* execution statistics */ + SharedMemoizeInfo *shared_info; /* statistics for parallel workers */ + Bitmapset *keyparamids; /* Param->paramids of expressions belonging to + * param_exprs */ +} MemoizeState; + +/* ---------------- + * When performing sorting by multiple keys, it's possible that the input + * dataset is already sorted on a prefix of those keys. We call these + * "presorted keys". + * PresortedKeyData represents information about one such key. + * ---------------- + */ +typedef struct PresortedKeyData +{ + FmgrInfo flinfo; /* comparison function info */ + FunctionCallInfo fcinfo; /* comparison function call info */ + OffsetNumber attno; /* attribute number in tuple */ +} PresortedKeyData; + +/* ---------------- + * Shared memory container for per-worker sort information + * ---------------- + */ +typedef struct SharedSortInfo +{ + int num_workers; + TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedSortInfo; + +/* ---------------- + * SortState information + * ---------------- + */ +typedef struct SortState +{ + ScanState ss; /* its first field is NodeTag */ + bool randomAccess; /* need random access to sort output? */ + bool bounded; /* is the result set bounded? */ + int64 bound; /* if bounded, how many tuples are needed */ + bool sort_Done; /* sort completed yet? */ + bool bounded_Done; /* value of bounded we did the sort with */ + int64 bound_Done; /* value of bound we did the sort with */ + void *tuplesortstate; /* private state of tuplesort.c */ + bool am_worker; /* are we a worker? */ + bool datumSort; /* Datum sort instead of tuple sort? */ + SharedSortInfo *shared_info; /* one entry per worker */ +} SortState; + +/* ---------------- + * Instrumentation information for IncrementalSort + * ---------------- + */ +typedef struct IncrementalSortGroupInfo +{ + int64 groupCount; + int64 maxDiskSpaceUsed; + int64 totalDiskSpaceUsed; + int64 maxMemorySpaceUsed; + int64 totalMemorySpaceUsed; + bits32 sortMethods; /* bitmask of TuplesortMethod */ +} IncrementalSortGroupInfo; + +typedef struct IncrementalSortInfo +{ + IncrementalSortGroupInfo fullsortGroupInfo; + IncrementalSortGroupInfo prefixsortGroupInfo; +} IncrementalSortInfo; + +/* ---------------- + * Shared memory container for per-worker incremental sort information + * ---------------- + */ +typedef struct SharedIncrementalSortInfo +{ + int num_workers; + IncrementalSortInfo sinfo[FLEXIBLE_ARRAY_MEMBER]; +} SharedIncrementalSortInfo; + +/* ---------------- + * IncrementalSortState information + * ---------------- + */ +typedef enum +{ + INCSORT_LOADFULLSORT, + INCSORT_LOADPREFIXSORT, + INCSORT_READFULLSORT, + INCSORT_READPREFIXSORT, +} IncrementalSortExecutionStatus; + +typedef struct IncrementalSortState +{ + ScanState ss; /* its first field is NodeTag */ + bool bounded; /* is the result set bounded? */ + int64 bound; /* if bounded, how many tuples are needed */ + bool outerNodeDone; /* finished fetching tuples from outer node */ + int64 bound_Done; /* value of bound we did the sort with */ + IncrementalSortExecutionStatus execution_status; + int64 n_fullsort_remaining; + Tuplesortstate *fullsort_state; /* private state of tuplesort.c */ + Tuplesortstate *prefixsort_state; /* private state of tuplesort.c */ + /* the keys by which the input path is already sorted */ + PresortedKeyData *presorted_keys; + + IncrementalSortInfo incsort_info; + + /* slot for pivot tuple defining values of presorted keys within group */ + TupleTableSlot *group_pivot; + TupleTableSlot *transfer_tuple; + bool am_worker; /* are we a worker? */ + SharedIncrementalSortInfo *shared_info; /* one entry per worker */ +} IncrementalSortState; + +/* --------------------- + * GroupState information + * --------------------- + */ +typedef struct GroupState +{ + ScanState ss; /* its first field is NodeTag */ + ExprState *eqfunction; /* equality function */ + bool grp_done; /* indicates completion of Group scan */ +} GroupState; + +/* --------------------- + * per-worker aggregate information + * --------------------- + */ +typedef struct AggregateInstrumentation +{ + Size hash_mem_peak; /* peak hash table memory usage */ + uint64 hash_disk_used; /* kB of disk space used */ + int hash_batches_used; /* batches used during entire execution */ +} AggregateInstrumentation; + +/* ---------------- + * Shared memory container for per-worker aggregate information + * ---------------- + */ +typedef struct SharedAggInfo +{ + int num_workers; + AggregateInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedAggInfo; + +/* --------------------- + * AggState information + * + * ss.ss_ScanTupleSlot refers to output of underlying plan. + * + * Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and + * ecxt_aggnulls arrays, which hold the computed agg values for the current + * input group during evaluation of an Agg node's output tuple(s). We + * create a second ExprContext, tmpcontext, in which to evaluate input + * expressions and run the aggregate transition functions. + * --------------------- + */ +/* these structs are private in nodeAgg.c: */ +typedef struct AggStatePerAggData *AggStatePerAgg; +typedef struct AggStatePerTransData *AggStatePerTrans; +typedef struct AggStatePerGroupData *AggStatePerGroup; +typedef struct AggStatePerPhaseData *AggStatePerPhase; +typedef struct AggStatePerHashData *AggStatePerHash; + +typedef struct AggState +{ + ScanState ss; /* its first field is NodeTag */ + List *aggs; /* all Aggref nodes in targetlist & quals */ + int numaggs; /* length of list (could be zero!) */ + int numtrans; /* number of pertrans items */ + AggStrategy aggstrategy; /* strategy mode */ + AggSplit aggsplit; /* agg-splitting mode, see nodes.h */ + AggStatePerPhase phase; /* pointer to current phase data */ + int numphases; /* number of phases (including phase 0) */ + int current_phase; /* current phase number */ + AggStatePerAgg peragg; /* per-Aggref information */ + AggStatePerTrans pertrans; /* per-Trans state information */ + ExprContext *hashcontext; /* econtexts for long-lived data (hashtable) */ + ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */ + ExprContext *tmpcontext; /* econtext for input expressions */ +#define FIELDNO_AGGSTATE_CURAGGCONTEXT 14 + ExprContext *curaggcontext; /* currently active aggcontext */ + AggStatePerAgg curperagg; /* currently active aggregate, if any */ +#define FIELDNO_AGGSTATE_CURPERTRANS 16 + AggStatePerTrans curpertrans; /* currently active trans state, if any */ + bool input_done; /* indicates end of input */ + bool agg_done; /* indicates completion of Agg scan */ + int projected_set; /* The last projected grouping set */ +#define FIELDNO_AGGSTATE_CURRENT_SET 20 + int current_set; /* The current grouping set being evaluated */ + Bitmapset *grouped_cols; /* grouped cols in current projection */ + List *all_grouped_cols; /* list of all grouped cols in DESC order */ + Bitmapset *colnos_needed; /* all columns needed from the outer plan */ + int max_colno_needed; /* highest colno needed from outer plan */ + bool all_cols_needed; /* are all cols from outer plan needed? */ + /* These fields are for grouping set phase data */ + int maxsets; /* The max number of sets in any phase */ + AggStatePerPhase phases; /* array of all phases */ + Tuplesortstate *sort_in; /* sorted input to phases > 1 */ + Tuplesortstate *sort_out; /* input is copied here for next phase */ + TupleTableSlot *sort_slot; /* slot for sort results */ + /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */ + AggStatePerGroup *pergroups; /* grouping set indexed array of per-group + * pointers */ + HeapTuple grp_firstTuple; /* copy of first tuple of current group */ + /* these fields are used in AGG_HASHED and AGG_MIXED modes: */ + bool table_filled; /* hash table filled yet? */ + int num_hashes; + MemoryContext hash_metacxt; /* memory for hash table itself */ + struct LogicalTapeSet *hash_tapeset; /* tape set for hash spill tapes */ + struct HashAggSpill *hash_spills; /* HashAggSpill for each grouping set, + * exists only during first pass */ + TupleTableSlot *hash_spill_rslot; /* for reading spill files */ + TupleTableSlot *hash_spill_wslot; /* for writing spill files */ + List *hash_batches; /* hash batches remaining to be processed */ + bool hash_ever_spilled; /* ever spilled during this execution? */ + bool hash_spill_mode; /* we hit a limit during the current batch + * and we must not create new groups */ + Size hash_mem_limit; /* limit before spilling hash table */ + uint64 hash_ngroups_limit; /* limit before spilling hash table */ + int hash_planned_partitions; /* number of partitions planned + * for first pass */ + double hashentrysize; /* estimate revised during execution */ + Size hash_mem_peak; /* peak hash table memory usage */ + uint64 hash_ngroups_current; /* number of groups currently in + * memory in all hash tables */ + uint64 hash_disk_used; /* kB of disk space used */ + int hash_batches_used; /* batches used during entire execution */ + + AggStatePerHash perhash; /* array of per-hashtable data */ + AggStatePerGroup *hash_pergroup; /* grouping set indexed array of + * per-group pointers */ + + /* support for evaluation of agg input expressions: */ +#define FIELDNO_AGGSTATE_ALL_PERGROUPS 53 + AggStatePerGroup *all_pergroups; /* array of first ->pergroups, than + * ->hash_pergroup */ + SharedAggInfo *shared_info; /* one entry per worker */ +} AggState; + +/* ---------------- + * WindowAggState information + * ---------------- + */ +/* these structs are private in nodeWindowAgg.c: */ +typedef struct WindowStatePerFuncData *WindowStatePerFunc; +typedef struct WindowStatePerAggData *WindowStatePerAgg; + +/* + * WindowAggStatus -- Used to track the status of WindowAggState + */ +typedef enum WindowAggStatus +{ + WINDOWAGG_DONE, /* No more processing to do */ + WINDOWAGG_RUN, /* Normal processing of window funcs */ + WINDOWAGG_PASSTHROUGH, /* Don't eval window funcs */ + WINDOWAGG_PASSTHROUGH_STRICT, /* Pass-through plus don't store new + * tuples during spool */ +} WindowAggStatus; + +typedef struct WindowAggState +{ + ScanState ss; /* its first field is NodeTag */ + + /* these fields are filled in by ExecInitExpr: */ + List *funcs; /* all WindowFunc nodes in targetlist */ + int numfuncs; /* total number of window functions */ + int numaggs; /* number that are plain aggregates */ + + WindowStatePerFunc perfunc; /* per-window-function information */ + WindowStatePerAgg peragg; /* per-plain-aggregate information */ + ExprState *partEqfunction; /* equality funcs for partition columns */ + ExprState *ordEqfunction; /* equality funcs for ordering columns */ + Tuplestorestate *buffer; /* stores rows of current partition */ + int current_ptr; /* read pointer # for current row */ + int framehead_ptr; /* read pointer # for frame head, if used */ + int frametail_ptr; /* read pointer # for frame tail, if used */ + int grouptail_ptr; /* read pointer # for group tail, if used */ + int64 spooled_rows; /* total # of rows in buffer */ + int64 currentpos; /* position of current row in partition */ + int64 frameheadpos; /* current frame head position */ + int64 frametailpos; /* current frame tail position (frame end+1) */ + /* use struct pointer to avoid including windowapi.h here */ + struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */ + int64 aggregatedbase; /* start row for current aggregates */ + int64 aggregatedupto; /* rows before this one are aggregated */ + WindowAggStatus status; /* run status of WindowAggState */ + + int frameOptions; /* frame_clause options, see WindowDef */ + ExprState *startOffset; /* expression for starting bound offset */ + ExprState *endOffset; /* expression for ending bound offset */ + Datum startOffsetValue; /* result of startOffset evaluation */ + Datum endOffsetValue; /* result of endOffset evaluation */ + + /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */ + FmgrInfo startInRangeFunc; /* in_range function for startOffset */ + FmgrInfo endInRangeFunc; /* in_range function for endOffset */ + Oid inRangeColl; /* collation for in_range tests */ + bool inRangeAsc; /* use ASC sort order for in_range tests? */ + bool inRangeNullsFirst; /* nulls sort first for in_range tests? */ + + /* these fields are used in GROUPS mode: */ + int64 currentgroup; /* peer group # of current row in partition */ + int64 frameheadgroup; /* peer group # of frame head row */ + int64 frametailgroup; /* peer group # of frame tail row */ + int64 groupheadpos; /* current row's peer group head position */ + int64 grouptailpos; /* " " " " tail position (group end+1) */ + + MemoryContext partcontext; /* context for partition-lifespan data */ + MemoryContext aggcontext; /* shared context for aggregate working data */ + MemoryContext curaggcontext; /* current aggregate's working data */ + ExprContext *tmpcontext; /* short-term evaluation context */ + + ExprState *runcondition; /* Condition which must remain true otherwise + * execution of the WindowAgg will finish or + * go into pass-through mode. NULL when there + * is no such condition. */ + + bool use_pass_through; /* When false, stop execution when + * runcondition is no longer true. Else + * just stop evaluating window funcs. */ + bool top_window; /* true if this is the top-most WindowAgg or + * the only WindowAgg in this query level */ + bool all_first; /* true if the scan is starting */ + bool partition_spooled; /* true if all tuples in current partition + * have been spooled into tuplestore */ + bool more_partitions; /* true if there's more partitions after + * this one */ + bool framehead_valid; /* true if frameheadpos is known up to + * date for current row */ + bool frametail_valid; /* true if frametailpos is known up to + * date for current row */ + bool grouptail_valid; /* true if grouptailpos is known up to + * date for current row */ + + TupleTableSlot *first_part_slot; /* first tuple of current or next + * partition */ + TupleTableSlot *framehead_slot; /* first tuple of current frame */ + TupleTableSlot *frametail_slot; /* first tuple after current frame */ + + /* temporary slots for tuples fetched back from tuplestore */ + TupleTableSlot *agg_row_slot; + TupleTableSlot *temp_slot_1; + TupleTableSlot *temp_slot_2; +} WindowAggState; + +/* ---------------- + * UniqueState information + * + * Unique nodes are used "on top of" sort nodes to discard + * duplicate tuples returned from the sort phase. Basically + * all it does is compare the current tuple from the subplan + * with the previously fetched tuple (stored in its result slot). + * If the two are identical in all interesting fields, then + * we just fetch another tuple from the sort and try again. + * ---------------- + */ +typedef struct UniqueState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *eqfunction; /* tuple equality qual */ +} UniqueState; + +/* ---------------- + * GatherState information + * + * Gather nodes launch 1 or more parallel workers, run a subplan + * in those workers, and collect the results. + * ---------------- + */ +typedef struct GatherState +{ + PlanState ps; /* its first field is NodeTag */ + bool initialized; /* workers launched? */ + bool need_to_scan_locally; /* need to read from local plan? */ + int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */ + /* these fields are set up once: */ + TupleTableSlot *funnel_slot; + struct ParallelExecutorInfo *pei; + /* all remaining fields are reinitialized during a rescan: */ + int nworkers_launched; /* original number of workers */ + int nreaders; /* number of still-active workers */ + int nextreader; /* next one to try to read from */ + struct TupleQueueReader **reader; /* array with nreaders active entries */ +} GatherState; + +/* ---------------- + * GatherMergeState information + * + * Gather merge nodes launch 1 or more parallel workers, run a + * subplan which produces sorted output in each worker, and then + * merge the results into a single sorted stream. + * ---------------- + */ +struct GMReaderTupleBuffer; /* private in nodeGatherMerge.c */ + +typedef struct GatherMergeState +{ + PlanState ps; /* its first field is NodeTag */ + bool initialized; /* workers launched? */ + bool gm_initialized; /* gather_merge_init() done? */ + bool need_to_scan_locally; /* need to read from local plan? */ + int64 tuples_needed; /* tuple bound, see ExecSetTupleBound */ + /* these fields are set up once: */ + TupleDesc tupDesc; /* descriptor for subplan result tuples */ + int gm_nkeys; /* number of sort columns */ + SortSupport gm_sortkeys; /* array of length gm_nkeys */ + struct ParallelExecutorInfo *pei; + /* all remaining fields are reinitialized during a rescan */ + /* (but the arrays are not reallocated, just cleared) */ + int nworkers_launched; /* original number of workers */ + int nreaders; /* number of active workers */ + TupleTableSlot **gm_slots; /* array with nreaders+1 entries */ + struct TupleQueueReader **reader; /* array with nreaders active entries */ + struct GMReaderTupleBuffer *gm_tuple_buffers; /* nreaders tuple buffers */ + struct binaryheap *gm_heap; /* binary heap of slot indices */ +} GatherMergeState; + +/* ---------------- + * Values displayed by EXPLAIN ANALYZE + * ---------------- + */ +typedef struct HashInstrumentation +{ + int nbuckets; /* number of buckets at end of execution */ + int nbuckets_original; /* planned number of buckets */ + int nbatch; /* number of batches at end of execution */ + int nbatch_original; /* planned number of batches */ + Size space_peak; /* peak memory usage in bytes */ +} HashInstrumentation; + +/* ---------------- + * Shared memory container for per-worker hash information + * ---------------- + */ +typedef struct SharedHashInfo +{ + int num_workers; + HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER]; +} SharedHashInfo; + +/* ---------------- + * HashState information + * ---------------- + */ +typedef struct HashState +{ + PlanState ps; /* its first field is NodeTag */ + HashJoinTable hashtable; /* hash table for the hashjoin */ + List *hashkeys; /* list of ExprState nodes */ + + /* + * In a parallelized hash join, the leader retains a pointer to the + * shared-memory stats area in its shared_info field, and then copies the + * shared-memory info back to local storage before DSM shutdown. The + * shared_info field remains NULL in workers, or in non-parallel joins. + */ + SharedHashInfo *shared_info; + + /* + * If we are collecting hash stats, this points to an initially-zeroed + * collection area, which could be either local storage or in shared + * memory; either way it's for just one process. + */ + HashInstrumentation *hinstrument; + + /* Parallel hash state. */ + struct ParallelHashJoinState *parallel_state; +} HashState; + +/* ---------------- + * SetOpState information + * + * Even in "sorted" mode, SetOp nodes are more complex than a simple + * Unique, since we have to count how many duplicates to return. But + * we also support hashing, so this is really more like a cut-down + * form of Agg. + * ---------------- + */ +/* this struct is private in nodeSetOp.c: */ +typedef struct SetOpStatePerGroupData *SetOpStatePerGroup; + +typedef struct SetOpState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *eqfunction; /* equality comparator */ + Oid *eqfuncoids; /* per-grouping-field equality fns */ + FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ + bool setop_done; /* indicates completion of output scan */ + long numOutput; /* number of dups left to output */ + /* these fields are used in SETOP_SORTED mode: */ + SetOpStatePerGroup pergroup; /* per-group working state */ + HeapTuple grp_firstTuple; /* copy of first tuple of current group */ + /* these fields are used in SETOP_HASHED mode: */ + TupleHashTable hashtable; /* hash table with one entry per group */ + MemoryContext tableContext; /* memory context containing hash table */ + bool table_filled; /* hash table filled yet? */ + TupleHashIterator hashiter; /* for iterating through hash table */ +} SetOpState; + +/* ---------------- + * LockRowsState information + * + * LockRows nodes are used to enforce FOR [KEY] UPDATE/SHARE locking. + * ---------------- + */ +typedef struct LockRowsState +{ + PlanState ps; /* its first field is NodeTag */ + List *lr_arowMarks; /* List of ExecAuxRowMarks */ + EPQState lr_epqstate; /* for evaluating EvalPlanQual rechecks */ +} LockRowsState; + +/* ---------------- + * LimitState information + * + * Limit nodes are used to enforce LIMIT/OFFSET clauses. + * They just select the desired subrange of their subplan's output. + * + * offset is the number of initial tuples to skip (0 does nothing). + * count is the number of tuples to return after skipping the offset tuples. + * If no limit count was specified, count is undefined and noCount is true. + * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet. + * ---------------- + */ +typedef enum +{ + LIMIT_INITIAL, /* initial state for LIMIT node */ + LIMIT_RESCAN, /* rescan after recomputing parameters */ + LIMIT_EMPTY, /* there are no returnable rows */ + LIMIT_INWINDOW, /* have returned a row in the window */ + LIMIT_WINDOWEND_TIES, /* have returned a tied row */ + LIMIT_SUBPLANEOF, /* at EOF of subplan (within window) */ + LIMIT_WINDOWEND, /* stepped off end of window */ + LIMIT_WINDOWSTART, /* stepped off beginning of window */ +} LimitStateCond; + +typedef struct LimitState +{ + PlanState ps; /* its first field is NodeTag */ + ExprState *limitOffset; /* OFFSET parameter, or NULL if none */ + ExprState *limitCount; /* COUNT parameter, or NULL if none */ + LimitOption limitOption; /* limit specification type */ + int64 offset; /* current OFFSET value */ + int64 count; /* current COUNT, if any */ + bool noCount; /* if true, ignore count */ + LimitStateCond lstate; /* state machine status, as above */ + int64 position; /* 1-based index of last tuple returned */ + TupleTableSlot *subSlot; /* tuple last obtained from subplan */ + ExprState *eqfunction; /* tuple equality qual in case of WITH TIES + * option */ + TupleTableSlot *last_slot; /* slot for evaluation of ties */ +} LimitState; + +#endif /* EXECNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/extensible.h b/platform/dbops/binaries/postgres/include/server/nodes/extensible.h new file mode 100644 index 0000000000000000000000000000000000000000..697a0282de41f3022f14deece7d6b6796e56c15e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/extensible.h @@ -0,0 +1,164 @@ +/*------------------------------------------------------------------------- + * + * extensible.h + * Definitions for extensible nodes and custom scans + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/extensible.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENSIBLE_H +#define EXTENSIBLE_H + +#include "access/parallel.h" +#include "commands/explain.h" +#include "nodes/execnodes.h" +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +/* maximum length of an extensible node identifier */ +#define EXTNODENAME_MAX_LEN 64 + +/* + * An extensible node is a new type of node defined by an extension. The + * type is always T_ExtensibleNode, while the extnodename identifies the + * specific type of node. extnodename can be looked up to find the + * ExtensibleNodeMethods for this node type. + */ +typedef struct ExtensibleNode +{ + pg_node_attr(custom_copy_equal, custom_read_write) + + NodeTag type; + const char *extnodename; /* identifier of ExtensibleNodeMethods */ +} ExtensibleNode; + +/* + * node_size is the size of an extensible node of this type in bytes. + * + * nodeCopy is a function which performs a deep copy from oldnode to newnode. + * It does not need to copy type or extnodename, which are copied by the + * core system. + * + * nodeEqual is a function which performs a deep equality comparison between + * a and b and returns true or false accordingly. It does not need to compare + * type or extnodename, which are compared by the core system. + * + * nodeOut is a serialization function for the node type. It should use the + * output conventions typical for outfuncs.c. It does not need to output + * type or extnodename; the core system handles those. + * + * nodeRead is a deserialization function for the node type. It does not need + * to read type or extnodename; the core system handles those. It should fetch + * the next token using pg_strtok() from the current input stream, and then + * reconstruct the private fields according to the manner in readfuncs.c. + * + * All callbacks are mandatory. + */ +typedef struct ExtensibleNodeMethods +{ + const char *extnodename; + Size node_size; + void (*nodeCopy) (struct ExtensibleNode *newnode, + const struct ExtensibleNode *oldnode); + bool (*nodeEqual) (const struct ExtensibleNode *a, + const struct ExtensibleNode *b); + void (*nodeOut) (struct StringInfoData *str, + const struct ExtensibleNode *node); + void (*nodeRead) (struct ExtensibleNode *node); +} ExtensibleNodeMethods; + +extern void RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *methods); +extern const ExtensibleNodeMethods *GetExtensibleNodeMethods(const char *extnodename, + bool missing_ok); + +/* + * Flags for custom paths, indicating what capabilities the resulting scan + * will have. The flags fields of CustomPath and CustomScan nodes are + * bitmasks of these flags. + */ +#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN 0x0001 +#define CUSTOMPATH_SUPPORT_MARK_RESTORE 0x0002 +#define CUSTOMPATH_SUPPORT_PROJECTION 0x0004 + +/* + * Custom path methods. Mostly, we just need to know how to convert a + * CustomPath to a plan. + */ +typedef struct CustomPathMethods +{ + const char *CustomName; + + /* Convert Path to a Plan */ + struct Plan *(*PlanCustomPath) (PlannerInfo *root, + RelOptInfo *rel, + struct CustomPath *best_path, + List *tlist, + List *clauses, + List *custom_plans); + struct List *(*ReparameterizeCustomPathByChild) (PlannerInfo *root, + List *custom_private, + RelOptInfo *child_rel); +} CustomPathMethods; + +/* + * Custom scan. Here again, there's not much to do: we need to be able to + * generate a ScanState corresponding to the scan. + */ +typedef struct CustomScanMethods +{ + const char *CustomName; + + /* Create execution state (CustomScanState) from a CustomScan plan node */ + Node *(*CreateCustomScanState) (CustomScan *cscan); +} CustomScanMethods; + +/* + * Execution-time methods for a CustomScanState. This is more complex than + * what we need for a custom path or scan. + */ +typedef struct CustomExecMethods +{ + const char *CustomName; + + /* Required executor methods */ + void (*BeginCustomScan) (CustomScanState *node, + EState *estate, + int eflags); + TupleTableSlot *(*ExecCustomScan) (CustomScanState *node); + void (*EndCustomScan) (CustomScanState *node); + void (*ReScanCustomScan) (CustomScanState *node); + + /* Optional methods: needed if mark/restore is supported */ + void (*MarkPosCustomScan) (CustomScanState *node); + void (*RestrPosCustomScan) (CustomScanState *node); + + /* Optional methods: needed if parallel execution is supported */ + Size (*EstimateDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt); + void (*InitializeDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt, + void *coordinate); + void (*ReInitializeDSMCustomScan) (CustomScanState *node, + ParallelContext *pcxt, + void *coordinate); + void (*InitializeWorkerCustomScan) (CustomScanState *node, + shm_toc *toc, + void *coordinate); + void (*ShutdownCustomScan) (CustomScanState *node); + + /* Optional: print additional information in EXPLAIN */ + void (*ExplainCustomScan) (CustomScanState *node, + List *ancestors, + ExplainState *es); +} CustomExecMethods; + +extern void RegisterCustomScanMethods(const CustomScanMethods *methods); +extern const CustomScanMethods *GetCustomScanMethods(const char *CustomName, + bool missing_ok); + +#endif /* EXTENSIBLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/lockoptions.h b/platform/dbops/binaries/postgres/include/server/nodes/lockoptions.h new file mode 100644 index 0000000000000000000000000000000000000000..044ef42ee101b2b2c467f8324c62078b241bfbe3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/lockoptions.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * lockoptions.h + * Common header for some locking-related declarations. + * + * + * Copyright (c) 2014-2024, PostgreSQL Global Development Group + * + * src/include/nodes/lockoptions.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKOPTIONS_H +#define LOCKOPTIONS_H + +/* + * This enum represents the different strengths of FOR UPDATE/SHARE clauses. + * The ordering here is important, because the highest numerical value takes + * precedence when a RTE is specified multiple ways. See applyLockingClause. + */ +typedef enum LockClauseStrength +{ + LCS_NONE, /* no such clause - only used in PlanRowMark */ + LCS_FORKEYSHARE, /* FOR KEY SHARE */ + LCS_FORSHARE, /* FOR SHARE */ + LCS_FORNOKEYUPDATE, /* FOR NO KEY UPDATE */ + LCS_FORUPDATE, /* FOR UPDATE */ +} LockClauseStrength; + +/* + * This enum controls how to deal with rows being locked by FOR UPDATE/SHARE + * clauses (i.e., it represents the NOWAIT and SKIP LOCKED options). + * The ordering here is important, because the highest numerical value takes + * precedence when a RTE is specified multiple ways. See applyLockingClause. + */ +typedef enum LockWaitPolicy +{ + /* Wait for the lock to become available (default behavior) */ + LockWaitBlock, + /* Skip rows that can't be locked (SKIP LOCKED) */ + LockWaitSkip, + /* Raise an error if a row cannot be locked (NOWAIT) */ + LockWaitError, +} LockWaitPolicy; + +/* + * Possible lock modes for a tuple. + */ +typedef enum LockTupleMode +{ + /* SELECT FOR KEY SHARE */ + LockTupleKeyShare, + /* SELECT FOR SHARE */ + LockTupleShare, + /* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */ + LockTupleNoKeyExclusive, + /* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */ + LockTupleExclusive, +} LockTupleMode; + +#endif /* LOCKOPTIONS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/makefuncs.h b/platform/dbops/binaries/postgres/include/server/nodes/makefuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..5209d3de89cd212664ee62a10b4ee6f8970a7ad5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/makefuncs.h @@ -0,0 +1,127 @@ +/*------------------------------------------------------------------------- + * + * makefuncs.h + * prototypes for the creator functions of various nodes + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/makefuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef MAKEFUNC_H +#define MAKEFUNC_H + +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + + +extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name, + Node *lexpr, Node *rexpr, int location); + +extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name, + Node *lexpr, Node *rexpr, int location); + +extern Var *makeVar(int varno, + AttrNumber varattno, + Oid vartype, + int32 vartypmod, + Oid varcollid, + Index varlevelsup); + +extern Var *makeVarFromTargetEntry(int varno, + TargetEntry *tle); + +extern Var *makeWholeRowVar(RangeTblEntry *rte, + int varno, + Index varlevelsup, + bool allowScalar); + +extern TargetEntry *makeTargetEntry(Expr *expr, + AttrNumber resno, + char *resname, + bool resjunk); + +extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle); + +extern FromExpr *makeFromExpr(List *fromlist, Node *quals); + +extern Const *makeConst(Oid consttype, + int32 consttypmod, + Oid constcollid, + int constlen, + Datum constvalue, + bool constisnull, + bool constbyval); + +extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid); + +extern Node *makeBoolConst(bool value, bool isnull); + +extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location); + +extern Alias *makeAlias(const char *aliasname, List *colnames); + +extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, + Oid rcollid, CoercionForm rformat); + +extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location); + +extern TypeName *makeTypeName(char *typnam); +extern TypeName *makeTypeNameFromNameList(List *names); +extern TypeName *makeTypeNameFromOid(Oid typeOid, int32 typmod); + +extern ColumnDef *makeColumnDef(const char *colname, + Oid typeOid, int32 typmod, Oid collOid); + +extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args, + Oid funccollid, Oid inputcollid, CoercionForm fformat); + +extern FuncCall *makeFuncCall(List *name, List *args, + CoercionForm funcformat, int location); + +extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset, + Expr *leftop, Expr *rightop, + Oid opcollid, Oid inputcollid); + +extern Expr *make_andclause(List *andclauses); +extern Expr *make_orclause(List *orclauses); +extern Expr *make_notclause(Expr *notclause); + +extern Node *make_and_qual(Node *qual1, Node *qual2); +extern Expr *make_ands_explicit(List *andclauses); +extern List *make_ands_implicit(Expr *clause); + +extern IndexInfo *makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, + List *expressions, List *predicates, + bool unique, bool nulls_not_distinct, + bool isready, bool concurrent, + bool summarizing); + +extern Node *makeStringConst(char *str, int location); +extern DefElem *makeDefElem(char *name, Node *arg, int location); +extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg, + DefElemAction defaction, int location); + +extern GroupingSet *makeGroupingSet(GroupingSetKind kind, List *content, int location); + +extern VacuumRelation *makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols); + +extern JsonFormat *makeJsonFormat(JsonFormatType type, JsonEncoding encoding, + int location); +extern JsonValueExpr *makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr, + JsonFormat *format); +extern Node *makeJsonKeyValue(Node *key, Node *value); +extern Node *makeJsonIsPredicate(Node *expr, JsonFormat *format, + JsonValueType item_type, bool unique_keys, + int location); +extern JsonBehavior *makeJsonBehavior(JsonBehaviorType btype, Node *expr, + int location); +extern JsonTablePath *makeJsonTablePath(Const *pathvalue, char *pathname); +extern JsonTablePathSpec *makeJsonTablePathSpec(char *string, char *name, + int string_location, + int name_location); + +#endif /* MAKEFUNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/memnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/memnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..c4c9fd3e3e1bb279e515c7d741a7ea43aad25aec --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/memnodes.h @@ -0,0 +1,152 @@ +/*------------------------------------------------------------------------- + * + * memnodes.h + * POSTGRES memory context node definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/memnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMNODES_H +#define MEMNODES_H + +#include "nodes/nodes.h" + +/* + * MemoryContextCounters + * Summarization state for MemoryContextStats collection. + * + * The set of counters in this struct is biased towards AllocSet; if we ever + * add any context types that are based on fundamentally different approaches, + * we might need more or different counters here. A possible API spec then + * would be to print only nonzero counters, but for now we just summarize in + * the format historically used by AllocSet. + */ +typedef struct MemoryContextCounters +{ + Size nblocks; /* Total number of malloc blocks */ + Size freechunks; /* Total number of free chunks */ + Size totalspace; /* Total bytes requested from malloc */ + Size freespace; /* The unused portion of totalspace */ +} MemoryContextCounters; + +/* + * MemoryContext + * A logical context in which memory allocations occur. + * + * MemoryContext itself is an abstract type that can have multiple + * implementations. + * The function pointers in MemoryContextMethods define one specific + * implementation of MemoryContext --- they are a virtual function table + * in C++ terms. + * + * Node types that are actual implementations of memory contexts must + * begin with the same fields as MemoryContextData. + * + * Note: for largely historical reasons, typedef MemoryContext is a pointer + * to the context struct rather than the struct type itself. + */ + +typedef void (*MemoryStatsPrintFunc) (MemoryContext context, void *passthru, + const char *stats_string, + bool print_to_stderr); + +typedef struct MemoryContextMethods +{ + /* + * Function to handle memory allocation requests of 'size' to allocate + * memory into the given 'context'. The function must handle flags + * MCXT_ALLOC_HUGE and MCXT_ALLOC_NO_OOM. MCXT_ALLOC_ZERO is handled by + * the calling function. + */ + void *(*alloc) (MemoryContext context, Size size, int flags); + + /* call this free_p in case someone #define's free() */ + void (*free_p) (void *pointer); + + /* + * Function to handle a size change request for an existing allocation. + * The implementation must handle flags MCXT_ALLOC_HUGE and + * MCXT_ALLOC_NO_OOM. MCXT_ALLOC_ZERO is handled by the calling function. + */ + void *(*realloc) (void *pointer, Size size, int flags); + + /* + * Invalidate all previous allocations in the given memory context and + * prepare the context for a new set of allocations. Implementations may + * optionally free() excess memory back to the OS during this time. + */ + void (*reset) (MemoryContext context); + + /* Free all memory consumed by the given MemoryContext. */ + void (*delete_context) (MemoryContext context); + + /* Return the MemoryContext that the given pointer belongs to. */ + MemoryContext (*get_chunk_context) (void *pointer); + + /* + * Return the number of bytes consumed by the given pointer within its + * memory context, including the overhead of alignment and chunk headers. + */ + Size (*get_chunk_space) (void *pointer); + + /* + * Return true if the given MemoryContext has not had any allocations + * since it was created or last reset. + */ + bool (*is_empty) (MemoryContext context); + void (*stats) (MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING + + /* + * Perform validation checks on the given context and raise any discovered + * anomalies as WARNINGs. + */ + void (*check) (MemoryContext context); +#endif +} MemoryContextMethods; + + +typedef struct MemoryContextData +{ + pg_node_attr(abstract) /* there are no nodes of this type */ + + NodeTag type; /* identifies exact kind of context */ + /* these two fields are placed here to minimize alignment wastage: */ + bool isReset; /* T = no space alloced since last reset */ + bool allowInCritSection; /* allow palloc in critical section */ + Size mem_allocated; /* track memory allocated for this context */ + const MemoryContextMethods *methods; /* virtual function table */ + MemoryContext parent; /* NULL if no parent (toplevel context) */ + MemoryContext firstchild; /* head of linked list of children */ + MemoryContext prevchild; /* previous child of same parent */ + MemoryContext nextchild; /* next child of same parent */ + const char *name; /* context name (just for debugging) */ + const char *ident; /* context ID if any (just for debugging) */ + MemoryContextCallback *reset_cbs; /* list of reset/delete callbacks */ +} MemoryContextData; + +/* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */ + + +/* + * MemoryContextIsValid + * True iff memory context is valid. + * + * Add new context types to the set accepted by this macro. + */ +#define MemoryContextIsValid(context) \ + ((context) != NULL && \ + (IsA((context), AllocSetContext) || \ + IsA((context), SlabContext) || \ + IsA((context), GenerationContext) || \ + IsA((context), BumpContext))) + +#endif /* MEMNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/miscnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/miscnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..1612b63acda0bf0a4d5ed038be84eb9815f88681 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/miscnodes.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * miscnodes.h + * Definitions for hard-to-classify node types. + * + * Node types declared here are not part of parse trees, plan trees, + * or execution state trees. We only assign them NodeTag values because + * IsA() tests provide a convenient way to disambiguate what kind of + * structure is being passed through assorted APIs, such as function + * "context" pointers. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/miscnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MISCNODES_H +#define MISCNODES_H + +#include "nodes/nodes.h" + +/* + * ErrorSaveContext - + * function call context node for handling of "soft" errors + * + * A caller wishing to trap soft errors must initialize a struct like this + * with all fields zero/NULL except for the NodeTag. Optionally, set + * details_wanted = true if more than the bare knowledge that a soft error + * occurred is required. The struct is then passed to a SQL-callable function + * via the FunctionCallInfo.context field; or below the level of SQL calls, + * it could be passed to a subroutine directly. + * + * After calling code that might report an error this way, check + * error_occurred to see if an error happened. If so, and if details_wanted + * is true, error_data has been filled with error details (stored in the + * callee's memory context!). FreeErrorData() can be called to release + * error_data, although that step is typically not necessary if the called + * code was run in a short-lived context. + */ +typedef struct ErrorSaveContext +{ + NodeTag type; + bool error_occurred; /* set to true if we detect a soft error */ + bool details_wanted; /* does caller want more info than that? */ + ErrorData *error_data; /* details of error, if so */ +} ErrorSaveContext; + +/* Often-useful macro for checking if a soft error was reported */ +#define SOFT_ERROR_OCCURRED(escontext) \ + ((escontext) != NULL && IsA(escontext, ErrorSaveContext) && \ + ((ErrorSaveContext *) (escontext))->error_occurred) + +#endif /* MISCNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/multibitmapset.h b/platform/dbops/binaries/postgres/include/server/nodes/multibitmapset.h new file mode 100644 index 0000000000000000000000000000000000000000..d6f23b87368c3284aec9f08de0083a3945e2432a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/multibitmapset.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * multibitmapset.h + * Lists of Bitmapsets + * + * A multibitmapset is useful in situations where members of a set can + * be identified by two small integers; for example, varno and varattno + * of a group of Vars within a query. The implementation is a List of + * Bitmapsets, so that the empty set can be represented by NIL. (But, + * as with Bitmapsets, that's not the only allowed representation.) + * The zero-based index of a List element is the first identifying value, + * and the (also zero-based) index of a bit within that Bitmapset is + * the second identifying value. There is no expectation that the + * Bitmapsets should all be the same size. + * + * The available operations on multibitmapsets are intended to parallel + * those on bitmapsets, for example union and intersection. So far only + * a small fraction of that has been built out; we'll add more as needed. + * + * + * Copyright (c) 2022-2024, PostgreSQL Global Development Group + * + * src/include/nodes/multibitmapset.h + * + *------------------------------------------------------------------------- + */ +#ifndef MULTIBITMAPSET_H +#define MULTIBITMAPSET_H + +#include "nodes/bitmapset.h" +#include "nodes/pg_list.h" + +extern List *mbms_add_member(List *a, int listidx, int bitidx); +extern List *mbms_add_members(List *a, const List *b); +extern List *mbms_int_members(List *a, const List *b); +extern bool mbms_is_member(int listidx, int bitidx, const List *a); +extern Bitmapset *mbms_overlap_sets(const List *a, const List *b); + +#endif /* MULTIBITMAPSET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/nodeFuncs.h b/platform/dbops/binaries/postgres/include/server/nodes/nodeFuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..eaba59bed834ba08cc85ca0155a4115176ae92c4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/nodeFuncs.h @@ -0,0 +1,222 @@ +/*------------------------------------------------------------------------- + * + * nodeFuncs.h + * Various general-purpose manipulations of Node trees + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/nodeFuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFUNCS_H +#define NODEFUNCS_H + +#include "nodes/parsenodes.h" + +struct PlanState; /* avoid including execnodes.h too */ + + +/* flags bits for query_tree_walker and query_tree_mutator */ +#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ +#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ +#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ +#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ +#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ +#define QTW_EXAMINE_RTES_BEFORE 0x10 /* examine RTE nodes before their + * contents */ +#define QTW_EXAMINE_RTES_AFTER 0x20 /* examine RTE nodes after their + * contents */ +#define QTW_DONT_COPY_QUERY 0x40 /* do not copy top Query */ +#define QTW_EXAMINE_SORTGROUP 0x80 /* include SortGroupClause lists */ + +/* callback function for check_functions_in_node */ +typedef bool (*check_function_callback) (Oid func_id, void *context); + +/* callback functions for tree walkers */ +typedef bool (*tree_walker_callback) (Node *node, void *context); +typedef bool (*planstate_tree_walker_callback) (struct PlanState *planstate, + void *context); + +/* callback functions for tree mutators */ +typedef Node *(*tree_mutator_callback) (Node *node, void *context); + + +extern Oid exprType(const Node *expr); +extern int32 exprTypmod(const Node *expr); +extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod); +extern Node *applyRelabelType(Node *arg, Oid rtype, int32 rtypmod, Oid rcollid, + CoercionForm rformat, int rlocation, + bool overwrite_ok); +extern Node *relabel_to_typmod(Node *expr, int32 typmod); +extern Node *strip_implicit_coercions(Node *node); +extern bool expression_returns_set(Node *clause); + +extern Oid exprCollation(const Node *expr); +extern Oid exprInputCollation(const Node *expr); +extern void exprSetCollation(Node *expr, Oid collation); +extern void exprSetInputCollation(Node *expr, Oid inputcollation); + +extern int exprLocation(const Node *expr); + +extern void fix_opfuncids(Node *node); +extern void set_opfuncid(OpExpr *opexpr); +extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); + +/* Is clause a FuncExpr clause? */ +static inline bool +is_funcclause(const void *clause) +{ + return clause != NULL && IsA(clause, FuncExpr); +} + +/* Is clause an OpExpr clause? */ +static inline bool +is_opclause(const void *clause) +{ + return clause != NULL && IsA(clause, OpExpr); +} + +/* Extract left arg of a binary opclause, or only arg of a unary opclause */ +static inline Node * +get_leftop(const void *clause) +{ + const OpExpr *expr = (const OpExpr *) clause; + + if (expr->args != NIL) + return (Node *) linitial(expr->args); + else + return NULL; +} + +/* Extract right arg of a binary opclause (NULL if it's a unary opclause) */ +static inline Node * +get_rightop(const void *clause) +{ + const OpExpr *expr = (const OpExpr *) clause; + + if (list_length(expr->args) >= 2) + return (Node *) lsecond(expr->args); + else + return NULL; +} + +/* Is clause an AND clause? */ +static inline bool +is_andclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == AND_EXPR); +} + +/* Is clause an OR clause? */ +static inline bool +is_orclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == OR_EXPR); +} + +/* Is clause a NOT clause? */ +static inline bool +is_notclause(const void *clause) +{ + return (clause != NULL && + IsA(clause, BoolExpr) && + ((const BoolExpr *) clause)->boolop == NOT_EXPR); +} + +/* Extract argument from a clause known to be a NOT clause */ +static inline Expr * +get_notclausearg(const void *notclause) +{ + return (Expr *) linitial(((const BoolExpr *) notclause)->args); +} + +extern bool check_functions_in_node(Node *node, check_function_callback checker, + void *context); + +/* + * The following functions are usually passed walker or mutator callbacks + * that are declared like "bool walker(Node *node, my_struct *context)" + * rather than "bool walker(Node *node, void *context)" as a strict reading + * of the C standard would require. Changing the callbacks' declarations + * to "void *" would create serious hazards of passing them the wrong context + * struct type, so we respectfully decline to support the standard's position + * that a pointer to struct is incompatible with "void *". Instead, silence + * related compiler warnings by inserting casts into these macro wrappers. + */ + +#define expression_tree_walker(n, w, c) \ + expression_tree_walker_impl(n, (tree_walker_callback) (w), c) +#define expression_tree_mutator(n, m, c) \ + expression_tree_mutator_impl(n, (tree_mutator_callback) (m), c) + +#define query_tree_walker(q, w, c, f) \ + query_tree_walker_impl(q, (tree_walker_callback) (w), c, f) +#define query_tree_mutator(q, m, c, f) \ + query_tree_mutator_impl(q, (tree_mutator_callback) (m), c, f) + +#define range_table_walker(rt, w, c, f) \ + range_table_walker_impl(rt, (tree_walker_callback) (w), c, f) +#define range_table_mutator(rt, m, c, f) \ + range_table_mutator_impl(rt, (tree_mutator_callback) (m), c, f) + +#define range_table_entry_walker(r, w, c, f) \ + range_table_entry_walker_impl(r, (tree_walker_callback) (w), c, f) + +#define query_or_expression_tree_walker(n, w, c, f) \ + query_or_expression_tree_walker_impl(n, (tree_walker_callback) (w), c, f) +#define query_or_expression_tree_mutator(n, m, c, f) \ + query_or_expression_tree_mutator_impl(n, (tree_mutator_callback) (m), c, f) + +#define raw_expression_tree_walker(n, w, c) \ + raw_expression_tree_walker_impl(n, (tree_walker_callback) (w), c) + +#define planstate_tree_walker(ps, w, c) \ + planstate_tree_walker_impl(ps, (planstate_tree_walker_callback) (w), c) + +extern bool expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context); +extern Node *expression_tree_mutator_impl(Node *node, + tree_mutator_callback mutator, + void *context); + +extern bool query_tree_walker_impl(Query *query, + tree_walker_callback walker, + void *context, int flags); +extern Query *query_tree_mutator_impl(Query *query, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool range_table_walker_impl(List *rtable, + tree_walker_callback walker, + void *context, int flags); +extern List *range_table_mutator_impl(List *rtable, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool range_table_entry_walker_impl(RangeTblEntry *rte, + tree_walker_callback walker, + void *context, int flags); + +extern bool query_or_expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context, int flags); +extern Node *query_or_expression_tree_mutator_impl(Node *node, + tree_mutator_callback mutator, + void *context, int flags); + +extern bool raw_expression_tree_walker_impl(Node *node, + tree_walker_callback walker, + void *context); + +extern bool planstate_tree_walker_impl(struct PlanState *planstate, + planstate_tree_walker_callback walker, + void *context); + +#endif /* NODEFUNCS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/nodes.h b/platform/dbops/binaries/postgres/include/server/nodes/nodes.h new file mode 100644 index 0000000000000000000000000000000000000000..855009fd6e208524b7faec83bfab37ff9d462873 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/nodes.h @@ -0,0 +1,434 @@ +/*------------------------------------------------------------------------- + * + * nodes.h + * Definitions for tagged nodes. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/nodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef NODES_H +#define NODES_H + +/* + * The first field of every node is NodeTag. Each node created (with makeNode) + * will have one of the following tags as the value of its first field. + * + * Note that inserting or deleting node types changes the numbers of other + * node types later in the list. This is no problem during development, since + * the node numbers are never stored on disk. But don't do it in a released + * branch, because that would represent an ABI break for extensions. + */ +typedef enum NodeTag +{ + T_Invalid = 0, + +#include "nodes/nodetags.h" +} NodeTag; + +/* + * pg_node_attr() - Used in node definitions to set extra information for + * gen_node_support.pl + * + * Attributes can be attached to a node as a whole (place the attribute + * specification on the first line after the struct's opening brace) + * or to a specific field (place it at the end of that field's line). The + * argument is a comma-separated list of attributes. Unrecognized attributes + * cause an error. + * + * Valid node attributes: + * + * - abstract: Abstract types are types that cannot be instantiated but that + * can be supertypes of other types. We track their fields, so that + * subtypes can use them, but we don't emit a node tag, so you can't + * instantiate them. + * + * - custom_copy_equal: Has custom implementations in copyfuncs.c and + * equalfuncs.c. + * + * - custom_read_write: Has custom implementations in outfuncs.c and + * readfuncs.c. + * + * - custom_query_jumble: Has custom implementation in queryjumblefuncs.c. + * + * - no_copy: Does not support copyObject() at all. + * + * - no_equal: Does not support equal() at all. + * + * - no_copy_equal: Shorthand for both no_copy and no_equal. + * + * - no_query_jumble: Does not support JumbleQuery() at all. + * + * - no_read: Does not support nodeRead() at all. + * + * - nodetag_only: Does not support copyObject(), equal(), jumbleQuery() + * outNode() or nodeRead(). + * + * - special_read_write: Has special treatment in outNode() and nodeRead(). + * + * - nodetag_number(VALUE): assign the specified nodetag number instead of + * an auto-generated number. Typically this would only be used in stable + * branches, to give a newly-added node type a number without breaking ABI + * by changing the numbers of existing node types. + * + * Node types can be supertypes of other types whether or not they are marked + * abstract: if a node struct appears as the first field of another struct + * type, then it is the supertype of that type. The no_copy, no_equal, + * no_query_jumble and no_read node attributes are automatically inherited + * from the supertype. (Notice that nodetag_only does not inherit, so it's + * not quite equivalent to a combination of other attributes.) + * + * Valid node field attributes: + * + * - array_size(OTHERFIELD): This field is a dynamically allocated array with + * size indicated by the mentioned other field. The other field is either a + * scalar or a list, in which case the length of the list is used. + * + * - copy_as(VALUE): In copyObject(), replace the field's value with VALUE. + * + * - copy_as_scalar: In copyObject(), copy the field as a scalar value + * (e.g. a pointer) even if it is a node-type pointer. + * + * - equal_as_scalar: In equal(), compare the field as a scalar value + * even if it is a node-type pointer. + * + * - equal_ignore: Ignore the field for equality. + * + * - equal_ignore_if_zero: Ignore the field for equality if it is zero. + * (Otherwise, compare normally.) + * + * - query_jumble_ignore: Ignore the field for the query jumbling. Note + * that typmod and collation information are usually irrelevant for the + * query jumbling. + * + * - query_jumble_location: Mark the field as a location to track. This is + * only allowed for integer fields that include "location" in their name. + * + * - read_as(VALUE): In nodeRead(), replace the field's value with VALUE. + * + * - read_write_ignore: Ignore the field for read/write. This is only allowed + * if the node type is marked no_read or read_as() is also specified. + * + * - write_only_relids, write_only_nondefault_pathtarget, write_only_req_outer: + * Special handling for Path struct; see there. + * + */ +#define pg_node_attr(...) + +/* + * The first field of a node of any type is guaranteed to be the NodeTag. + * Hence the type of any node can be gotten by casting it to Node. Declaring + * a variable to be of Node * (instead of void *) can also facilitate + * debugging. + */ +typedef struct Node +{ + NodeTag type; +} Node; + +#define nodeTag(nodeptr) (((const Node*)(nodeptr))->type) + +/* + * newNode - + * create a new node of the specified size and tag the node with the + * specified tag. + * + * !WARNING!: Avoid using newNode directly. You should be using the + * macro makeNode. eg. to create a Query node, use makeNode(Query) + */ +static inline Node * +newNode(size_t size, NodeTag tag) +{ + Node *result; + + Assert(size >= sizeof(Node)); /* need the tag, at least */ + result = (Node *) palloc0(size); + result->type = tag; + + return result; +} + +#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_)) +#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t)) + +#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_) + +/* + * castNode(type, ptr) casts ptr to "type *", and if assertions are enabled, + * verifies that the node has the appropriate type (using its nodeTag()). + * + * Use an inline function when assertions are enabled, to avoid multiple + * evaluations of the ptr argument (which could e.g. be a function call). + */ +#ifdef USE_ASSERT_CHECKING +static inline Node * +castNodeImpl(NodeTag type, void *ptr) +{ + Assert(ptr == NULL || nodeTag(ptr) == type); + return (Node *) ptr; +} +#define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr)) +#else +#define castNode(_type_, nodeptr) ((_type_ *) (nodeptr)) +#endif /* USE_ASSERT_CHECKING */ + + +/* ---------------------------------------------------------------- + * extern declarations follow + * ---------------------------------------------------------------- + */ + +/* + * nodes/{outfuncs.c,print.c} + */ +struct Bitmapset; /* not to include bitmapset.h here */ +struct StringInfoData; /* not to include stringinfo.h here */ + +extern void outNode(struct StringInfoData *str, const void *obj); +extern void outToken(struct StringInfoData *str, const char *s); +extern void outBitmapset(struct StringInfoData *str, + const struct Bitmapset *bms); +extern void outDatum(struct StringInfoData *str, uintptr_t value, + int typlen, bool typbyval); +extern char *nodeToString(const void *obj); +extern char *nodeToStringWithLocations(const void *obj); +extern char *bmsToString(const struct Bitmapset *bms); + +/* + * nodes/{readfuncs.c,read.c} + */ +extern void *stringToNode(const char *str); +#ifdef WRITE_READ_PARSE_PLAN_TREES +extern void *stringToNodeWithLocations(const char *str); +#endif +extern struct Bitmapset *readBitmapset(void); +extern uintptr_t readDatum(bool typbyval); +extern bool *readBoolCols(int numCols); +extern int *readIntCols(int numCols); +extern Oid *readOidCols(int numCols); +extern int16 *readAttrNumberCols(int numCols); + +/* + * nodes/copyfuncs.c + */ +extern void *copyObjectImpl(const void *from); + +/* cast result back to argument type, if supported by compiler */ +#ifdef HAVE_TYPEOF +#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj)) +#else +#define copyObject(obj) copyObjectImpl(obj) +#endif + +/* + * nodes/equalfuncs.c + */ +extern bool equal(const void *a, const void *b); + + +/* + * Typedef for parse location. This is just an int, but this way + * gen_node_support.pl knows which fields should get special treatment for + * location values. + * + * -1 is used for unknown. + */ +typedef int ParseLoc; + +/* + * Typedefs for identifying qualifier selectivities, plan costs, and row + * counts as such. These are just plain "double"s, but declaring a variable + * as Selectivity, Cost, or Cardinality makes the intent more obvious. + * + * These could have gone into plannodes.h or some such, but many files + * depend on them... + */ +typedef double Selectivity; /* fraction of tuples a qualifier will pass */ +typedef double Cost; /* execution cost (in page-access units) */ +typedef double Cardinality; /* (estimated) number of rows or other integer + * count */ + + +/* + * CmdType - + * enums for type of operation represented by a Query or PlannedStmt + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum CmdType +{ + CMD_UNKNOWN, + CMD_SELECT, /* select stmt */ + CMD_UPDATE, /* update stmt */ + CMD_INSERT, /* insert stmt */ + CMD_DELETE, /* delete stmt */ + CMD_MERGE, /* merge stmt */ + CMD_UTILITY, /* cmds like create, destroy, copy, vacuum, + * etc. */ + CMD_NOTHING, /* dummy command for instead nothing rules + * with qual */ +} CmdType; + + +/* + * JoinType - + * enums for types of relation joins + * + * JoinType determines the exact semantics of joining two relations using + * a matching qualification. For example, it tells what to do with a tuple + * that has no match in the other relation. + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum JoinType +{ + /* + * The canonical kinds of joins according to the SQL JOIN syntax. Only + * these codes can appear in parser output (e.g., JoinExpr nodes). + */ + JOIN_INNER, /* matching tuple pairs only */ + JOIN_LEFT, /* pairs + unmatched LHS tuples */ + JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */ + JOIN_RIGHT, /* pairs + unmatched RHS tuples */ + + /* + * Semijoins and anti-semijoins (as defined in relational theory) do not + * appear in the SQL JOIN syntax, but there are standard idioms for + * representing them (e.g., using EXISTS). The planner recognizes these + * cases and converts them to joins. So the planner and executor must + * support these codes. NOTE: in JOIN_SEMI output, it is unspecified + * which matching RHS row is joined to. In JOIN_ANTI output, the row is + * guaranteed to be null-extended. + */ + JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */ + JOIN_ANTI, /* 1 copy of each LHS row that has no match */ + JOIN_RIGHT_ANTI, /* 1 copy of each RHS row that has no match */ + + /* + * These codes are used internally in the planner, but are not supported + * by the executor (nor, indeed, by most of the planner). + */ + JOIN_UNIQUE_OUTER, /* LHS path must be made unique */ + JOIN_UNIQUE_INNER, /* RHS path must be made unique */ + + /* + * We might need additional join types someday. + */ +} JoinType; + +/* + * OUTER joins are those for which pushed-down quals must behave differently + * from the join's own quals. This is in fact everything except INNER and + * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols + * since those are temporary proxies for what will eventually be an INNER + * join. + * + * Note: semijoins are a hybrid case, but we choose to treat them as not + * being outer joins. This is okay principally because the SQL syntax makes + * it impossible to have a pushed-down qual that refers to the inner relation + * of a semijoin; so there is no strong need to distinguish join quals from + * pushed-down quals. This is convenient because for almost all purposes, + * quals attached to a semijoin can be treated the same as innerjoin quals. + */ +#define IS_OUTER_JOIN(jointype) \ + (((1 << (jointype)) & \ + ((1 << JOIN_LEFT) | \ + (1 << JOIN_FULL) | \ + (1 << JOIN_RIGHT) | \ + (1 << JOIN_ANTI) | \ + (1 << JOIN_RIGHT_ANTI))) != 0) + +/* + * AggStrategy - + * overall execution strategies for Agg plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ +typedef enum AggStrategy +{ + AGG_PLAIN, /* simple agg across all input rows */ + AGG_SORTED, /* grouped agg, input must be sorted */ + AGG_HASHED, /* grouped agg, use internal hashtable */ + AGG_MIXED, /* grouped agg, hash and sort both used */ +} AggStrategy; + +/* + * AggSplit - + * splitting (partial aggregation) modes for Agg plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ + +/* Primitive options supported by nodeAgg.c: */ +#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */ +#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */ +#define AGGSPLITOP_SERIALIZE 0x04 /* apply serialfn to output */ +#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserialfn to input */ + +/* Supported operating modes (i.e., useful combinations of these options): */ +typedef enum AggSplit +{ + /* Basic, non-split aggregation: */ + AGGSPLIT_SIMPLE = 0, + /* Initial phase of partial aggregation, with serialization: */ + AGGSPLIT_INITIAL_SERIAL = AGGSPLITOP_SKIPFINAL | AGGSPLITOP_SERIALIZE, + /* Final phase of partial aggregation, with deserialization: */ + AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE | AGGSPLITOP_DESERIALIZE, +} AggSplit; + +/* Test whether an AggSplit value selects each primitive option: */ +#define DO_AGGSPLIT_COMBINE(as) (((as) & AGGSPLITOP_COMBINE) != 0) +#define DO_AGGSPLIT_SKIPFINAL(as) (((as) & AGGSPLITOP_SKIPFINAL) != 0) +#define DO_AGGSPLIT_SERIALIZE(as) (((as) & AGGSPLITOP_SERIALIZE) != 0) +#define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0) + +/* + * SetOpCmd and SetOpStrategy - + * overall semantics and execution strategies for SetOp plan nodes + * + * This is needed in both pathnodes.h and plannodes.h, so put it here... + */ +typedef enum SetOpCmd +{ + SETOPCMD_INTERSECT, + SETOPCMD_INTERSECT_ALL, + SETOPCMD_EXCEPT, + SETOPCMD_EXCEPT_ALL, +} SetOpCmd; + +typedef enum SetOpStrategy +{ + SETOP_SORTED, /* input must be sorted */ + SETOP_HASHED, /* use internal hashtable */ +} SetOpStrategy; + +/* + * OnConflictAction - + * "ON CONFLICT" clause type of query + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum OnConflictAction +{ + ONCONFLICT_NONE, /* No "ON CONFLICT" clause */ + ONCONFLICT_NOTHING, /* ON CONFLICT ... DO NOTHING */ + ONCONFLICT_UPDATE, /* ON CONFLICT ... DO UPDATE */ +} OnConflictAction; + +/* + * LimitOption - + * LIMIT option of query + * + * This is needed in both parsenodes.h and plannodes.h, so put it here... + */ +typedef enum LimitOption +{ + LIMIT_OPTION_COUNT, /* FETCH FIRST... ONLY */ + LIMIT_OPTION_WITH_TIES, /* FETCH FIRST... WITH TIES */ +} LimitOption; + +#endif /* NODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/nodetags.h b/platform/dbops/binaries/postgres/include/server/nodes/nodetags.h new file mode 100644 index 0000000000000000000000000000000000000000..ee1fb29ce50ecda78e491a2698ac2a5074666eb2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/nodetags.h @@ -0,0 +1,491 @@ +/*------------------------------------------------------------------------- + * + * nodetags.h + * Generated node infrastructure code + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/nodes/gen_node_support.pl + * + *------------------------------------------------------------------------- + */ + T_List = 1, + T_Alias = 2, + T_RangeVar = 3, + T_TableFunc = 4, + T_IntoClause = 5, + T_Var = 6, + T_Const = 7, + T_Param = 8, + T_Aggref = 9, + T_GroupingFunc = 10, + T_WindowFunc = 11, + T_WindowFuncRunCondition = 12, + T_MergeSupportFunc = 13, + T_SubscriptingRef = 14, + T_FuncExpr = 15, + T_NamedArgExpr = 16, + T_OpExpr = 17, + T_DistinctExpr = 18, + T_NullIfExpr = 19, + T_ScalarArrayOpExpr = 20, + T_BoolExpr = 21, + T_SubLink = 22, + T_SubPlan = 23, + T_AlternativeSubPlan = 24, + T_FieldSelect = 25, + T_FieldStore = 26, + T_RelabelType = 27, + T_CoerceViaIO = 28, + T_ArrayCoerceExpr = 29, + T_ConvertRowtypeExpr = 30, + T_CollateExpr = 31, + T_CaseExpr = 32, + T_CaseWhen = 33, + T_CaseTestExpr = 34, + T_ArrayExpr = 35, + T_RowExpr = 36, + T_RowCompareExpr = 37, + T_CoalesceExpr = 38, + T_MinMaxExpr = 39, + T_SQLValueFunction = 40, + T_XmlExpr = 41, + T_JsonFormat = 42, + T_JsonReturning = 43, + T_JsonValueExpr = 44, + T_JsonConstructorExpr = 45, + T_JsonIsPredicate = 46, + T_JsonBehavior = 47, + T_JsonExpr = 48, + T_JsonTablePath = 49, + T_JsonTablePathScan = 50, + T_JsonTableSiblingJoin = 51, + T_NullTest = 52, + T_BooleanTest = 53, + T_MergeAction = 54, + T_CoerceToDomain = 55, + T_CoerceToDomainValue = 56, + T_SetToDefault = 57, + T_CurrentOfExpr = 58, + T_NextValueExpr = 59, + T_InferenceElem = 60, + T_TargetEntry = 61, + T_RangeTblRef = 62, + T_JoinExpr = 63, + T_FromExpr = 64, + T_OnConflictExpr = 65, + T_Query = 66, + T_TypeName = 67, + T_ColumnRef = 68, + T_ParamRef = 69, + T_A_Expr = 70, + T_A_Const = 71, + T_TypeCast = 72, + T_CollateClause = 73, + T_RoleSpec = 74, + T_FuncCall = 75, + T_A_Star = 76, + T_A_Indices = 77, + T_A_Indirection = 78, + T_A_ArrayExpr = 79, + T_ResTarget = 80, + T_MultiAssignRef = 81, + T_SortBy = 82, + T_WindowDef = 83, + T_RangeSubselect = 84, + T_RangeFunction = 85, + T_RangeTableFunc = 86, + T_RangeTableFuncCol = 87, + T_RangeTableSample = 88, + T_ColumnDef = 89, + T_TableLikeClause = 90, + T_IndexElem = 91, + T_DefElem = 92, + T_LockingClause = 93, + T_XmlSerialize = 94, + T_PartitionElem = 95, + T_PartitionSpec = 96, + T_PartitionBoundSpec = 97, + T_PartitionRangeDatum = 98, + T_SinglePartitionSpec = 99, + T_PartitionCmd = 100, + T_RangeTblEntry = 101, + T_RTEPermissionInfo = 102, + T_RangeTblFunction = 103, + T_TableSampleClause = 104, + T_WithCheckOption = 105, + T_SortGroupClause = 106, + T_GroupingSet = 107, + T_WindowClause = 108, + T_RowMarkClause = 109, + T_WithClause = 110, + T_InferClause = 111, + T_OnConflictClause = 112, + T_CTESearchClause = 113, + T_CTECycleClause = 114, + T_CommonTableExpr = 115, + T_MergeWhenClause = 116, + T_TriggerTransition = 117, + T_JsonOutput = 118, + T_JsonArgument = 119, + T_JsonFuncExpr = 120, + T_JsonTablePathSpec = 121, + T_JsonTable = 122, + T_JsonTableColumn = 123, + T_JsonKeyValue = 124, + T_JsonParseExpr = 125, + T_JsonScalarExpr = 126, + T_JsonSerializeExpr = 127, + T_JsonObjectConstructor = 128, + T_JsonArrayConstructor = 129, + T_JsonArrayQueryConstructor = 130, + T_JsonAggConstructor = 131, + T_JsonObjectAgg = 132, + T_JsonArrayAgg = 133, + T_RawStmt = 134, + T_InsertStmt = 135, + T_DeleteStmt = 136, + T_UpdateStmt = 137, + T_MergeStmt = 138, + T_SelectStmt = 139, + T_SetOperationStmt = 140, + T_ReturnStmt = 141, + T_PLAssignStmt = 142, + T_CreateSchemaStmt = 143, + T_AlterTableStmt = 144, + T_ReplicaIdentityStmt = 145, + T_AlterTableCmd = 146, + T_AlterCollationStmt = 147, + T_AlterDomainStmt = 148, + T_GrantStmt = 149, + T_ObjectWithArgs = 150, + T_AccessPriv = 151, + T_GrantRoleStmt = 152, + T_AlterDefaultPrivilegesStmt = 153, + T_CopyStmt = 154, + T_VariableSetStmt = 155, + T_VariableShowStmt = 156, + T_CreateStmt = 157, + T_Constraint = 158, + T_CreateTableSpaceStmt = 159, + T_DropTableSpaceStmt = 160, + T_AlterTableSpaceOptionsStmt = 161, + T_AlterTableMoveAllStmt = 162, + T_CreateExtensionStmt = 163, + T_AlterExtensionStmt = 164, + T_AlterExtensionContentsStmt = 165, + T_CreateFdwStmt = 166, + T_AlterFdwStmt = 167, + T_CreateForeignServerStmt = 168, + T_AlterForeignServerStmt = 169, + T_CreateForeignTableStmt = 170, + T_CreateUserMappingStmt = 171, + T_AlterUserMappingStmt = 172, + T_DropUserMappingStmt = 173, + T_ImportForeignSchemaStmt = 174, + T_CreatePolicyStmt = 175, + T_AlterPolicyStmt = 176, + T_CreateAmStmt = 177, + T_CreateTrigStmt = 178, + T_CreateEventTrigStmt = 179, + T_AlterEventTrigStmt = 180, + T_CreatePLangStmt = 181, + T_CreateRoleStmt = 182, + T_AlterRoleStmt = 183, + T_AlterRoleSetStmt = 184, + T_DropRoleStmt = 185, + T_CreateSeqStmt = 186, + T_AlterSeqStmt = 187, + T_DefineStmt = 188, + T_CreateDomainStmt = 189, + T_CreateOpClassStmt = 190, + T_CreateOpClassItem = 191, + T_CreateOpFamilyStmt = 192, + T_AlterOpFamilyStmt = 193, + T_DropStmt = 194, + T_TruncateStmt = 195, + T_CommentStmt = 196, + T_SecLabelStmt = 197, + T_DeclareCursorStmt = 198, + T_ClosePortalStmt = 199, + T_FetchStmt = 200, + T_IndexStmt = 201, + T_CreateStatsStmt = 202, + T_StatsElem = 203, + T_AlterStatsStmt = 204, + T_CreateFunctionStmt = 205, + T_FunctionParameter = 206, + T_AlterFunctionStmt = 207, + T_DoStmt = 208, + T_InlineCodeBlock = 209, + T_CallStmt = 210, + T_CallContext = 211, + T_RenameStmt = 212, + T_AlterObjectDependsStmt = 213, + T_AlterObjectSchemaStmt = 214, + T_AlterOwnerStmt = 215, + T_AlterOperatorStmt = 216, + T_AlterTypeStmt = 217, + T_RuleStmt = 218, + T_NotifyStmt = 219, + T_ListenStmt = 220, + T_UnlistenStmt = 221, + T_TransactionStmt = 222, + T_CompositeTypeStmt = 223, + T_CreateEnumStmt = 224, + T_CreateRangeStmt = 225, + T_AlterEnumStmt = 226, + T_ViewStmt = 227, + T_LoadStmt = 228, + T_CreatedbStmt = 229, + T_AlterDatabaseStmt = 230, + T_AlterDatabaseRefreshCollStmt = 231, + T_AlterDatabaseSetStmt = 232, + T_DropdbStmt = 233, + T_AlterSystemStmt = 234, + T_ClusterStmt = 235, + T_VacuumStmt = 236, + T_VacuumRelation = 237, + T_ExplainStmt = 238, + T_CreateTableAsStmt = 239, + T_RefreshMatViewStmt = 240, + T_CheckPointStmt = 241, + T_DiscardStmt = 242, + T_LockStmt = 243, + T_ConstraintsSetStmt = 244, + T_ReindexStmt = 245, + T_CreateConversionStmt = 246, + T_CreateCastStmt = 247, + T_CreateTransformStmt = 248, + T_PrepareStmt = 249, + T_ExecuteStmt = 250, + T_DeallocateStmt = 251, + T_DropOwnedStmt = 252, + T_ReassignOwnedStmt = 253, + T_AlterTSDictionaryStmt = 254, + T_AlterTSConfigurationStmt = 255, + T_PublicationTable = 256, + T_PublicationObjSpec = 257, + T_CreatePublicationStmt = 258, + T_AlterPublicationStmt = 259, + T_CreateSubscriptionStmt = 260, + T_AlterSubscriptionStmt = 261, + T_DropSubscriptionStmt = 262, + T_PlannerGlobal = 263, + T_PlannerInfo = 264, + T_RelOptInfo = 265, + T_IndexOptInfo = 266, + T_ForeignKeyOptInfo = 267, + T_StatisticExtInfo = 268, + T_JoinDomain = 269, + T_EquivalenceClass = 270, + T_EquivalenceMember = 271, + T_PathKey = 272, + T_GroupByOrdering = 273, + T_PathTarget = 274, + T_ParamPathInfo = 275, + T_Path = 276, + T_IndexPath = 277, + T_IndexClause = 278, + T_BitmapHeapPath = 279, + T_BitmapAndPath = 280, + T_BitmapOrPath = 281, + T_TidPath = 282, + T_TidRangePath = 283, + T_SubqueryScanPath = 284, + T_ForeignPath = 285, + T_CustomPath = 286, + T_AppendPath = 287, + T_MergeAppendPath = 288, + T_GroupResultPath = 289, + T_MaterialPath = 290, + T_MemoizePath = 291, + T_UniquePath = 292, + T_GatherPath = 293, + T_GatherMergePath = 294, + T_NestPath = 295, + T_MergePath = 296, + T_HashPath = 297, + T_ProjectionPath = 298, + T_ProjectSetPath = 299, + T_SortPath = 300, + T_IncrementalSortPath = 301, + T_GroupPath = 302, + T_UpperUniquePath = 303, + T_AggPath = 304, + T_GroupingSetData = 305, + T_RollupData = 306, + T_GroupingSetsPath = 307, + T_MinMaxAggPath = 308, + T_WindowAggPath = 309, + T_SetOpPath = 310, + T_RecursiveUnionPath = 311, + T_LockRowsPath = 312, + T_ModifyTablePath = 313, + T_LimitPath = 314, + T_RestrictInfo = 315, + T_PlaceHolderVar = 316, + T_SpecialJoinInfo = 317, + T_OuterJoinClauseInfo = 318, + T_AppendRelInfo = 319, + T_RowIdentityVarInfo = 320, + T_PlaceHolderInfo = 321, + T_MinMaxAggInfo = 322, + T_PlannerParamItem = 323, + T_AggInfo = 324, + T_AggTransInfo = 325, + T_PlannedStmt = 326, + T_Result = 327, + T_ProjectSet = 328, + T_ModifyTable = 329, + T_Append = 330, + T_MergeAppend = 331, + T_RecursiveUnion = 332, + T_BitmapAnd = 333, + T_BitmapOr = 334, + T_SeqScan = 335, + T_SampleScan = 336, + T_IndexScan = 337, + T_IndexOnlyScan = 338, + T_BitmapIndexScan = 339, + T_BitmapHeapScan = 340, + T_TidScan = 341, + T_TidRangeScan = 342, + T_SubqueryScan = 343, + T_FunctionScan = 344, + T_ValuesScan = 345, + T_TableFuncScan = 346, + T_CteScan = 347, + T_NamedTuplestoreScan = 348, + T_WorkTableScan = 349, + T_ForeignScan = 350, + T_CustomScan = 351, + T_NestLoop = 352, + T_NestLoopParam = 353, + T_MergeJoin = 354, + T_HashJoin = 355, + T_Material = 356, + T_Memoize = 357, + T_Sort = 358, + T_IncrementalSort = 359, + T_Group = 360, + T_Agg = 361, + T_WindowAgg = 362, + T_Unique = 363, + T_Gather = 364, + T_GatherMerge = 365, + T_Hash = 366, + T_SetOp = 367, + T_LockRows = 368, + T_Limit = 369, + T_PlanRowMark = 370, + T_PartitionPruneInfo = 371, + T_PartitionedRelPruneInfo = 372, + T_PartitionPruneStepOp = 373, + T_PartitionPruneStepCombine = 374, + T_PlanInvalItem = 375, + T_ExprState = 376, + T_IndexInfo = 377, + T_ExprContext = 378, + T_ReturnSetInfo = 379, + T_ProjectionInfo = 380, + T_JunkFilter = 381, + T_OnConflictSetState = 382, + T_MergeActionState = 383, + T_ResultRelInfo = 384, + T_EState = 385, + T_WindowFuncExprState = 386, + T_SetExprState = 387, + T_SubPlanState = 388, + T_DomainConstraintState = 389, + T_ResultState = 390, + T_ProjectSetState = 391, + T_ModifyTableState = 392, + T_AppendState = 393, + T_MergeAppendState = 394, + T_RecursiveUnionState = 395, + T_BitmapAndState = 396, + T_BitmapOrState = 397, + T_ScanState = 398, + T_SeqScanState = 399, + T_SampleScanState = 400, + T_IndexScanState = 401, + T_IndexOnlyScanState = 402, + T_BitmapIndexScanState = 403, + T_BitmapHeapScanState = 404, + T_TidScanState = 405, + T_TidRangeScanState = 406, + T_SubqueryScanState = 407, + T_FunctionScanState = 408, + T_ValuesScanState = 409, + T_TableFuncScanState = 410, + T_CteScanState = 411, + T_NamedTuplestoreScanState = 412, + T_WorkTableScanState = 413, + T_ForeignScanState = 414, + T_CustomScanState = 415, + T_JoinState = 416, + T_NestLoopState = 417, + T_MergeJoinState = 418, + T_HashJoinState = 419, + T_MaterialState = 420, + T_MemoizeState = 421, + T_SortState = 422, + T_IncrementalSortState = 423, + T_GroupState = 424, + T_AggState = 425, + T_WindowAggState = 426, + T_UniqueState = 427, + T_GatherState = 428, + T_GatherMergeState = 429, + T_HashState = 430, + T_SetOpState = 431, + T_LockRowsState = 432, + T_LimitState = 433, + T_IndexAmRoutine = 434, + T_TableAmRoutine = 435, + T_TsmRoutine = 436, + T_EventTriggerData = 437, + T_TriggerData = 438, + T_TupleTableSlot = 439, + T_FdwRoutine = 440, + T_Bitmapset = 441, + T_ExtensibleNode = 442, + T_ErrorSaveContext = 443, + T_IdentifySystemCmd = 444, + T_BaseBackupCmd = 445, + T_CreateReplicationSlotCmd = 446, + T_DropReplicationSlotCmd = 447, + T_AlterReplicationSlotCmd = 448, + T_StartReplicationCmd = 449, + T_ReadReplicationSlotCmd = 450, + T_TimeLineHistoryCmd = 451, + T_UploadManifestCmd = 452, + T_SupportRequestSimplify = 453, + T_SupportRequestSelectivity = 454, + T_SupportRequestCost = 455, + T_SupportRequestRows = 456, + T_SupportRequestIndexCondition = 457, + T_SupportRequestWFuncMonotonic = 458, + T_SupportRequestOptimizeWindowClause = 459, + T_Integer = 460, + T_Float = 461, + T_Boolean = 462, + T_String = 463, + T_BitString = 464, + T_ForeignKeyCacheInfo = 465, + T_IntList = 466, + T_OidList = 467, + T_XidList = 468, + T_AllocSetContext = 469, + T_GenerationContext = 470, + T_SlabContext = 471, + T_BumpContext = 472, + T_TIDBitmap = 473, + T_WindowObjectData = 474, diff --git a/platform/dbops/binaries/postgres/include/server/nodes/params.h b/platform/dbops/binaries/postgres/include/server/nodes/params.h new file mode 100644 index 0000000000000000000000000000000000000000..10c9fc5413b124d672341ec5a1563d623928951d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/params.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * params.h + * Support for finding the values associated with Param nodes. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/params.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARAMS_H +#define PARAMS_H + +/* Forward declarations, to avoid including other headers */ +struct Bitmapset; +struct ExprState; +struct Param; +struct ParseState; + + +/* + * ParamListInfo + * + * ParamListInfo structures are used to pass parameters into the executor + * for parameterized plans. We support two basic approaches to supplying + * parameter values, the "static" way and the "dynamic" way. + * + * In the static approach, per-parameter data is stored in an array of + * ParamExternData structs appended to the ParamListInfo struct. + * Each entry in the array defines the value to be substituted for a + * PARAM_EXTERN parameter. The "paramid" of a PARAM_EXTERN Param + * can range from 1 to numParams. + * + * Although parameter numbers are normally consecutive, we allow + * ptype == InvalidOid to signal an unused array entry. + * + * pflags is a flags field. Currently the only used bit is: + * PARAM_FLAG_CONST signals the planner that it may treat this parameter + * as a constant (i.e., generate a plan that works only for this value + * of the parameter). + * + * In the dynamic approach, all access to parameter values is done through + * hook functions found in the ParamListInfo struct. In this case, + * the ParamExternData array is typically unused and not allocated; + * but the legal range of paramid is still 1 to numParams. + * + * Although the data structure is really an array, not a list, we keep + * the old typedef name to avoid unnecessary code changes. + * + * There are 3 hook functions that can be associated with a ParamListInfo + * structure: + * + * If paramFetch isn't null, it is called to fetch the ParamExternData + * for a particular param ID, rather than accessing the relevant element + * of the ParamExternData array. This supports the case where the array + * isn't there at all, as well as cases where the data in the array + * might be obsolete or lazily evaluated. paramFetch must return the + * address of a ParamExternData struct describing the specified param ID; + * the convention above about ptype == InvalidOid signaling an invalid + * param ID still applies. The returned struct can either be placed in + * the "workspace" supplied by the caller, or it can be in storage + * controlled by the paramFetch hook if that's more convenient. + * (In either case, the struct is not expected to be long-lived.) + * If "speculative" is true, the paramFetch hook should not risk errors + * in trying to fetch the parameter value, and should report an invalid + * parameter instead. + * + * If paramCompile isn't null, then it controls what execExpr.c compiles + * for PARAM_EXTERN Param nodes --- typically, this hook would emit a + * EEOP_PARAM_CALLBACK step. This allows unnecessary work to be + * optimized away in compiled expressions. + * + * If parserSetup isn't null, then it is called to re-instantiate the + * original parsing hooks when a query needs to be re-parsed/planned. + * This is especially useful if the types of parameters might change + * from time to time, since it can replace the need to supply a fixed + * list of parameter types to the parser. + * + * Notice that the paramFetch and paramCompile hooks are actually passed + * the ParamListInfo struct's address; they can therefore access all + * three of the "arg" fields, and the distinction between paramFetchArg + * and paramCompileArg is rather arbitrary. + */ + +#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ + +typedef struct ParamExternData +{ + Datum value; /* parameter value */ + bool isnull; /* is it NULL? */ + uint16 pflags; /* flag bits, see above */ + Oid ptype; /* parameter's datatype, or 0 */ +} ParamExternData; + +typedef struct ParamListInfoData *ParamListInfo; + +typedef ParamExternData *(*ParamFetchHook) (ParamListInfo params, + int paramid, bool speculative, + ParamExternData *workspace); + +typedef void (*ParamCompileHook) (ParamListInfo params, struct Param *param, + struct ExprState *state, + Datum *resv, bool *resnull); + +typedef void (*ParserSetupHook) (struct ParseState *pstate, void *arg); + +typedef struct ParamListInfoData +{ + ParamFetchHook paramFetch; /* parameter fetch hook */ + void *paramFetchArg; + ParamCompileHook paramCompile; /* parameter compile hook */ + void *paramCompileArg; + ParserSetupHook parserSetup; /* parser setup hook */ + void *parserSetupArg; + char *paramValuesStr; /* params as a single string for errors */ + int numParams; /* nominal/maximum # of Params represented */ + + /* + * params[] may be of length zero if paramFetch is supplied; otherwise it + * must be of length numParams. + */ + ParamExternData params[FLEXIBLE_ARRAY_MEMBER]; +} ParamListInfoData; + + +/* ---------------- + * ParamExecData + * + * ParamExecData entries are used for executor internal parameters + * (that is, values being passed into or out of a sub-query). The + * paramid of a PARAM_EXEC Param is a (zero-based) index into an + * array of ParamExecData records, which is referenced through + * es_param_exec_vals or ecxt_param_exec_vals. + * + * If execPlan is not NULL, it points to a SubPlanState node that needs + * to be executed to produce the value. (This is done so that we can have + * lazy evaluation of InitPlans: they aren't executed until/unless a + * result value is needed.) Otherwise the value is assumed to be valid + * when needed. + * ---------------- + */ + +typedef struct ParamExecData +{ + void *execPlan; /* should be "SubPlanState *" */ + Datum value; + bool isnull; +} ParamExecData; + +/* type of argument for ParamsErrorCallback */ +typedef struct ParamsErrorCbData +{ + const char *portalName; + ParamListInfo params; +} ParamsErrorCbData; + +/* Functions found in src/backend/nodes/params.c */ +extern ParamListInfo makeParamList(int numParams); +extern ParamListInfo copyParamList(ParamListInfo from); +extern Size EstimateParamListSpace(ParamListInfo paramLI); +extern void SerializeParamList(ParamListInfo paramLI, char **start_address); +extern ParamListInfo RestoreParamList(char **start_address); +extern char *BuildParamLogString(ParamListInfo params, char **knownTextValues, + int maxlen); +extern void ParamsErrorCallback(void *arg); + +#endif /* PARAMS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/parsenodes.h b/platform/dbops/binaries/postgres/include/server/nodes/parsenodes.h new file mode 100644 index 0000000000000000000000000000000000000000..67c90a2bd328d56452640cbd8fccd09aab3a0f01 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/parsenodes.h @@ -0,0 +1,4233 @@ +/*------------------------------------------------------------------------- + * + * parsenodes.h + * definitions for parse tree nodes + * + * Many of the node types used in parsetrees include a "location" field. + * This is a byte (not character) offset in the original source text, to be + * used for positioning an error cursor when there is an error related to + * the node. Access to the original source text is needed to make use of + * the location. At the topmost (statement) level, we also provide a + * statement length, likewise measured in bytes, for convenience in + * identifying statement boundaries in multi-statement source strings. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/parsenodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSENODES_H +#define PARSENODES_H + +#include "common/relpath.h" +#include "nodes/bitmapset.h" +#include "nodes/lockoptions.h" +#include "nodes/primnodes.h" +#include "nodes/value.h" +#include "partitioning/partdefs.h" + + +/* Possible sources of a Query */ +typedef enum QuerySource +{ + QSRC_ORIGINAL, /* original parsetree (explicit query) */ + QSRC_PARSER, /* added by parse analysis (now unused) */ + QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */ + QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */ + QSRC_NON_INSTEAD_RULE, /* added by non-INSTEAD rule */ +} QuerySource; + +/* Sort ordering options for ORDER BY and CREATE INDEX */ +typedef enum SortByDir +{ + SORTBY_DEFAULT, + SORTBY_ASC, + SORTBY_DESC, + SORTBY_USING, /* not allowed in CREATE INDEX ... */ +} SortByDir; + +typedef enum SortByNulls +{ + SORTBY_NULLS_DEFAULT, + SORTBY_NULLS_FIRST, + SORTBY_NULLS_LAST, +} SortByNulls; + +/* Options for [ ALL | DISTINCT ] */ +typedef enum SetQuantifier +{ + SET_QUANTIFIER_DEFAULT, + SET_QUANTIFIER_ALL, + SET_QUANTIFIER_DISTINCT, +} SetQuantifier; + +/* + * Grantable rights are encoded so that we can OR them together in a bitmask. + * The present representation of AclItem limits us to 32 distinct rights, + * even though AclMode is defined as uint64. See utils/acl.h. + * + * Caution: changing these codes breaks stored ACLs, hence forces initdb. + */ +typedef uint64 AclMode; /* a bitmask of privilege bits */ + +#define ACL_INSERT (1<<0) /* for relations */ +#define ACL_SELECT (1<<1) +#define ACL_UPDATE (1<<2) +#define ACL_DELETE (1<<3) +#define ACL_TRUNCATE (1<<4) +#define ACL_REFERENCES (1<<5) +#define ACL_TRIGGER (1<<6) +#define ACL_EXECUTE (1<<7) /* for functions */ +#define ACL_USAGE (1<<8) /* for various object types */ +#define ACL_CREATE (1<<9) /* for namespaces and databases */ +#define ACL_CREATE_TEMP (1<<10) /* for databases */ +#define ACL_CONNECT (1<<11) /* for databases */ +#define ACL_SET (1<<12) /* for configuration parameters */ +#define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */ +#define ACL_MAINTAIN (1<<14) /* for relations */ +#define N_ACL_RIGHTS 15 /* 1 plus the last 1< 0 + */ + List *rteperminfos pg_node_attr(query_jumble_ignore); + FromExpr *jointree; /* table join tree (FROM and WHERE clauses); + * also USING clause for MERGE */ + + List *mergeActionList; /* list of actions for MERGE (only) */ + + /* + * rtable index of target relation for MERGE to pull data. Initially, this + * is the same as resultRelation, but after query rewriting, if the target + * relation is a trigger-updatable view, this is the index of the expanded + * view subquery, whereas resultRelation is the index of the target view. + */ + int mergeTargetRelation pg_node_attr(query_jumble_ignore); + + /* join condition between source and target for MERGE */ + Node *mergeJoinCondition; + + List *targetList; /* target list (of TargetEntry) */ + + /* OVERRIDING clause */ + OverridingKind override pg_node_attr(query_jumble_ignore); + + OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */ + + List *returningList; /* return-values list (of TargetEntry) */ + + List *groupClause; /* a list of SortGroupClause's */ + bool groupDistinct; /* is the group by clause distinct? */ + + List *groupingSets; /* a list of GroupingSet's if present */ + + Node *havingQual; /* qualifications applied to groups */ + + List *windowClause; /* a list of WindowClause's */ + + List *distinctClause; /* a list of SortGroupClause's */ + + List *sortClause; /* a list of SortGroupClause's */ + + Node *limitOffset; /* # of result tuples to skip (int8 expr) */ + Node *limitCount; /* # of result tuples to return (int8 expr) */ + LimitOption limitOption; /* limit type */ + + List *rowMarks; /* a list of RowMarkClause's */ + + Node *setOperations; /* set-operation tree if this is top level of + * a UNION/INTERSECT/EXCEPT query */ + + /* + * A list of pg_constraint OIDs that the query depends on to be + * semantically valid + */ + List *constraintDeps pg_node_attr(query_jumble_ignore); + + /* a list of WithCheckOption's (added during rewrite) */ + List *withCheckOptions pg_node_attr(query_jumble_ignore); + + /* + * The following two fields identify the portion of the source text string + * containing this query. They are typically only populated in top-level + * Queries, not in sub-queries. When not set, they might both be zero, or + * both be -1 meaning "unknown". + */ + /* start location, or -1 if unknown */ + ParseLoc stmt_location; + /* length in bytes; 0 means "rest of string" */ + ParseLoc stmt_len pg_node_attr(query_jumble_ignore); +} Query; + + +/**************************************************************************** + * Supporting data structures for Parse Trees + * + * Most of these node types appear in raw parsetrees output by the grammar, + * and get transformed to something else by the analyzer. A few of them + * are used as-is in transformed querytrees. + ****************************************************************************/ + +/* + * TypeName - specifies a type in definitions + * + * For TypeName structures generated internally, it is often easier to + * specify the type by OID than by name. If "names" is NIL then the + * actual type OID is given by typeOid, otherwise typeOid is unused. + * Similarly, if "typmods" is NIL then the actual typmod is expected to + * be prespecified in typemod, otherwise typemod is unused. + * + * If pct_type is true, then names is actually a field name and we look up + * the type of that field. Otherwise (the normal case), names is a type + * name possibly qualified with schema and database name. + */ +typedef struct TypeName +{ + NodeTag type; + List *names; /* qualified name (list of String nodes) */ + Oid typeOid; /* type identified by OID */ + bool setof; /* is a set? */ + bool pct_type; /* %TYPE specified? */ + List *typmods; /* type modifier expression(s) */ + int32 typemod; /* prespecified type modifier */ + List *arrayBounds; /* array bounds */ + ParseLoc location; /* token location, or -1 if unknown */ +} TypeName; + +/* + * ColumnRef - specifies a reference to a column, or possibly a whole tuple + * + * The "fields" list must be nonempty. It can contain String nodes + * (representing names) and A_Star nodes (representing occurrence of a '*'). + * Currently, A_Star must appear only as the last list element --- the grammar + * is responsible for enforcing this! + * + * Note: any container subscripting or selection of fields from composite columns + * is represented by an A_Indirection node above the ColumnRef. However, + * for simplicity in the normal case, initial field selection from a table + * name is represented within ColumnRef and not by adding A_Indirection. + */ +typedef struct ColumnRef +{ + NodeTag type; + List *fields; /* field names (String nodes) or A_Star */ + ParseLoc location; /* token location, or -1 if unknown */ +} ColumnRef; + +/* + * ParamRef - specifies a $n parameter reference + */ +typedef struct ParamRef +{ + NodeTag type; + int number; /* the number of the parameter */ + ParseLoc location; /* token location, or -1 if unknown */ +} ParamRef; + +/* + * A_Expr - infix, prefix, and postfix expressions + */ +typedef enum A_Expr_Kind +{ + AEXPR_OP, /* normal operator */ + AEXPR_OP_ANY, /* scalar op ANY (array) */ + AEXPR_OP_ALL, /* scalar op ALL (array) */ + AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */ + AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */ + AEXPR_NULLIF, /* NULLIF - name must be "=" */ + AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */ + AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */ + AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */ + AEXPR_SIMILAR, /* [NOT] SIMILAR - name must be "~" or "!~" */ + AEXPR_BETWEEN, /* name must be "BETWEEN" */ + AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */ + AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */ + AEXPR_NOT_BETWEEN_SYM, /* name must be "NOT BETWEEN SYMMETRIC" */ +} A_Expr_Kind; + +typedef struct A_Expr +{ + pg_node_attr(custom_read_write) + + NodeTag type; + A_Expr_Kind kind; /* see above */ + List *name; /* possibly-qualified name of operator */ + Node *lexpr; /* left argument, or NULL if none */ + Node *rexpr; /* right argument, or NULL if none */ + ParseLoc location; /* token location, or -1 if unknown */ +} A_Expr; + +/* + * A_Const - a literal constant + * + * Value nodes are inline for performance. You can treat 'val' as a node, + * as in IsA(&val, Integer). 'val' is not valid if isnull is true. + */ +union ValUnion +{ + Node node; + Integer ival; + Float fval; + Boolean boolval; + String sval; + BitString bsval; +}; + +typedef struct A_Const +{ + pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble) + + NodeTag type; + union ValUnion val; + bool isnull; /* SQL NULL constant */ + ParseLoc location; /* token location, or -1 if unknown */ +} A_Const; + +/* + * TypeCast - a CAST expression + */ +typedef struct TypeCast +{ + NodeTag type; + Node *arg; /* the expression being casted */ + TypeName *typeName; /* the target type */ + ParseLoc location; /* token location, or -1 if unknown */ +} TypeCast; + +/* + * CollateClause - a COLLATE expression + */ +typedef struct CollateClause +{ + NodeTag type; + Node *arg; /* input expression */ + List *collname; /* possibly-qualified collation name */ + ParseLoc location; /* token location, or -1 if unknown */ +} CollateClause; + +/* + * RoleSpec - a role name or one of a few special values. + */ +typedef enum RoleSpecType +{ + ROLESPEC_CSTRING, /* role name is stored as a C string */ + ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */ + ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */ + ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */ + ROLESPEC_PUBLIC, /* role name is "public" */ +} RoleSpecType; + +typedef struct RoleSpec +{ + NodeTag type; + RoleSpecType roletype; /* Type of this rolespec */ + char *rolename; /* filled only for ROLESPEC_CSTRING */ + ParseLoc location; /* token location, or -1 if unknown */ +} RoleSpec; + +/* + * FuncCall - a function or aggregate invocation + * + * agg_order (if not NIL) indicates we saw 'foo(... ORDER BY ...)', or if + * agg_within_group is true, it was 'foo(...) WITHIN GROUP (ORDER BY ...)'. + * agg_star indicates we saw a 'foo(*)' construct, while agg_distinct + * indicates we saw 'foo(DISTINCT ...)'. In any of these cases, the + * construct *must* be an aggregate call. Otherwise, it might be either an + * aggregate or some other kind of function. However, if FILTER or OVER is + * present it had better be an aggregate or window function. + * + * Normally, you'd initialize this via makeFuncCall() and then only change the + * parts of the struct its defaults don't match afterwards, as needed. + */ +typedef struct FuncCall +{ + NodeTag type; + List *funcname; /* qualified name of function */ + List *args; /* the arguments (list of exprs) */ + List *agg_order; /* ORDER BY (list of SortBy) */ + Node *agg_filter; /* FILTER clause, if any */ + struct WindowDef *over; /* OVER clause, if any */ + bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */ + bool agg_star; /* argument was really '*' */ + bool agg_distinct; /* arguments were labeled DISTINCT */ + bool func_variadic; /* last argument was labeled VARIADIC */ + CoercionForm funcformat; /* how to display this node */ + ParseLoc location; /* token location, or -1 if unknown */ +} FuncCall; + +/* + * A_Star - '*' representing all columns of a table or compound field + * + * This can appear within ColumnRef.fields, A_Indirection.indirection, and + * ResTarget.indirection lists. + */ +typedef struct A_Star +{ + NodeTag type; +} A_Star; + +/* + * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx]) + * + * In slice case, either or both of lidx and uidx can be NULL (omitted). + * In non-slice case, uidx holds the single subscript and lidx is always NULL. + */ +typedef struct A_Indices +{ + NodeTag type; + bool is_slice; /* true if slice (i.e., colon present) */ + Node *lidx; /* slice lower bound, if any */ + Node *uidx; /* subscript, or slice upper bound if any */ +} A_Indices; + +/* + * A_Indirection - select a field and/or array element from an expression + * + * The indirection list can contain A_Indices nodes (representing + * subscripting), String nodes (representing field selection --- the + * string value is the name of the field to select), and A_Star nodes + * (representing selection of all fields of a composite type). + * For example, a complex selection operation like + * (foo).field1[42][7].field2 + * would be represented with a single A_Indirection node having a 4-element + * indirection list. + * + * Currently, A_Star must appear only as the last list element --- the grammar + * is responsible for enforcing this! + */ +typedef struct A_Indirection +{ + NodeTag type; + Node *arg; /* the thing being selected from */ + List *indirection; /* subscripts and/or field names and/or * */ +} A_Indirection; + +/* + * A_ArrayExpr - an ARRAY[] construct + */ +typedef struct A_ArrayExpr +{ + NodeTag type; + List *elements; /* array element expressions */ + ParseLoc location; /* token location, or -1 if unknown */ +} A_ArrayExpr; + +/* + * ResTarget - + * result target (used in target list of pre-transformed parse trees) + * + * In a SELECT target list, 'name' is the column label from an + * 'AS ColumnLabel' clause, or NULL if there was none, and 'val' is the + * value expression itself. The 'indirection' field is not used. + * + * INSERT uses ResTarget in its target-column-names list. Here, 'name' is + * the name of the destination column, 'indirection' stores any subscripts + * attached to the destination, and 'val' is not used. + * + * In an UPDATE target list, 'name' is the name of the destination column, + * 'indirection' stores any subscripts attached to the destination, and + * 'val' is the expression to assign. + * + * See A_Indirection for more info about what can appear in 'indirection'. + */ +typedef struct ResTarget +{ + NodeTag type; + char *name; /* column name or NULL */ + List *indirection; /* subscripts, field names, and '*', or NIL */ + Node *val; /* the value expression to compute or assign */ + ParseLoc location; /* token location, or -1 if unknown */ +} ResTarget; + +/* + * MultiAssignRef - element of a row source expression for UPDATE + * + * In an UPDATE target list, when we have SET (a,b,c) = row-valued-expression, + * we generate separate ResTarget items for each of a,b,c. Their "val" trees + * are MultiAssignRef nodes numbered 1..n, linking to a common copy of the + * row-valued-expression (which parse analysis will process only once, when + * handling the MultiAssignRef with colno=1). + */ +typedef struct MultiAssignRef +{ + NodeTag type; + Node *source; /* the row-valued expression */ + int colno; /* column number for this target (1..n) */ + int ncolumns; /* number of targets in the construct */ +} MultiAssignRef; + +/* + * SortBy - for ORDER BY clause + */ +typedef struct SortBy +{ + NodeTag type; + Node *node; /* expression to sort on */ + SortByDir sortby_dir; /* ASC/DESC/USING/default */ + SortByNulls sortby_nulls; /* NULLS FIRST/LAST */ + List *useOp; /* name of op to use, if SORTBY_USING */ + ParseLoc location; /* operator location, or -1 if none/unknown */ +} SortBy; + +/* + * WindowDef - raw representation of WINDOW and OVER clauses + * + * For entries in a WINDOW list, "name" is the window name being defined. + * For OVER clauses, we use "name" for the "OVER window" syntax, or "refname" + * for the "OVER (window)" syntax, which is subtly different --- the latter + * implies overriding the window frame clause. + */ +typedef struct WindowDef +{ + NodeTag type; + char *name; /* window's own name */ + char *refname; /* referenced window name, if any */ + List *partitionClause; /* PARTITION BY expression list */ + List *orderClause; /* ORDER BY (list of SortBy) */ + int frameOptions; /* frame_clause options, see below */ + Node *startOffset; /* expression for starting bound, if any */ + Node *endOffset; /* expression for ending bound, if any */ + ParseLoc location; /* parse location, or -1 if none/unknown */ +} WindowDef; + +/* + * frameOptions is an OR of these bits. The NONDEFAULT and BETWEEN bits are + * used so that ruleutils.c can tell which properties were specified and + * which were defaulted; the correct behavioral bits must be set either way. + * The START_foo and END_foo options must come in pairs of adjacent bits for + * the convenience of gram.y, even though some of them are useless/invalid. + */ +#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ +#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ +#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ +#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */ +#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */ +#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */ +#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */ +#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */ +#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */ +#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */ +#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */ +#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */ +#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */ +#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */ +#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */ +#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */ +#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */ +#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */ + +#define FRAMEOPTION_START_OFFSET \ + (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING) +#define FRAMEOPTION_END_OFFSET \ + (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_OFFSET_FOLLOWING) +#define FRAMEOPTION_EXCLUSION \ + (FRAMEOPTION_EXCLUDE_CURRENT_ROW | FRAMEOPTION_EXCLUDE_GROUP | \ + FRAMEOPTION_EXCLUDE_TIES) + +#define FRAMEOPTION_DEFAULTS \ + (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \ + FRAMEOPTION_END_CURRENT_ROW) + +/* + * RangeSubselect - subquery appearing in a FROM clause + */ +typedef struct RangeSubselect +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + Node *subquery; /* the untransformed sub-select clause */ + Alias *alias; /* table alias & optional column aliases */ +} RangeSubselect; + +/* + * RangeFunction - function call appearing in a FROM clause + * + * functions is a List because we use this to represent the construct + * ROWS FROM(func1(...), func2(...), ...). Each element of this list is a + * two-element sublist, the first element being the untransformed function + * call tree, and the second element being a possibly-empty list of ColumnDef + * nodes representing any columndef list attached to that function within the + * ROWS FROM() syntax. + * + * alias and coldeflist represent any alias and/or columndef list attached + * at the top level. (We disallow coldeflist appearing both here and + * per-function, but that's checked in parse analysis, not by the grammar.) + */ +typedef struct RangeFunction +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + bool ordinality; /* does it have WITH ORDINALITY suffix? */ + bool is_rowsfrom; /* is result of ROWS FROM() syntax? */ + List *functions; /* per-function information, see above */ + Alias *alias; /* table alias & optional column aliases */ + List *coldeflist; /* list of ColumnDef nodes to describe result + * of function returning RECORD */ +} RangeFunction; + +/* + * RangeTableFunc - raw form of "table functions" such as XMLTABLE + * + * Note: JSON_TABLE is also a "table function", but it uses JsonTable node, + * not RangeTableFunc. + */ +typedef struct RangeTableFunc +{ + NodeTag type; + bool lateral; /* does it have LATERAL prefix? */ + Node *docexpr; /* document expression */ + Node *rowexpr; /* row generator expression */ + List *namespaces; /* list of namespaces as ResTarget */ + List *columns; /* list of RangeTableFuncCol */ + Alias *alias; /* table alias & optional column aliases */ + ParseLoc location; /* token location, or -1 if unknown */ +} RangeTableFunc; + +/* + * RangeTableFuncCol - one column in a RangeTableFunc->columns + * + * If for_ordinality is true (FOR ORDINALITY), then the column is an int4 + * column and the rest of the fields are ignored. + */ +typedef struct RangeTableFuncCol +{ + NodeTag type; + char *colname; /* name of generated column */ + TypeName *typeName; /* type of generated column */ + bool for_ordinality; /* does it have FOR ORDINALITY? */ + bool is_not_null; /* does it have NOT NULL? */ + Node *colexpr; /* column filter expression */ + Node *coldefexpr; /* column default value expression */ + ParseLoc location; /* token location, or -1 if unknown */ +} RangeTableFuncCol; + +/* + * RangeTableSample - TABLESAMPLE appearing in a raw FROM clause + * + * This node, appearing only in raw parse trees, represents + * TABLESAMPLE () REPEATABLE () + * Currently, the can only be a RangeVar, but we might in future + * allow RangeSubselect and other options. Note that the RangeTableSample + * is wrapped around the node representing the , rather than being + * a subfield of it. + */ +typedef struct RangeTableSample +{ + NodeTag type; + Node *relation; /* relation to be sampled */ + List *method; /* sampling method name (possibly qualified) */ + List *args; /* argument(s) for sampling method */ + Node *repeatable; /* REPEATABLE expression, or NULL if none */ + ParseLoc location; /* method name location, or -1 if unknown */ +} RangeTableSample; + +/* + * ColumnDef - column definition (used in various creates) + * + * If the column has a default value, we may have the value expression + * in either "raw" form (an untransformed parse tree) or "cooked" form + * (a post-parse-analysis, executable expression tree), depending on + * how this ColumnDef node was created (by parsing, or by inheritance + * from an existing relation). We should never have both in the same node! + * + * Similarly, we may have a COLLATE specification in either raw form + * (represented as a CollateClause with arg==NULL) or cooked form + * (the collation's OID). + * + * The constraints list may contain a CONSTR_DEFAULT item in a raw + * parsetree produced by gram.y, but transformCreateStmt will remove + * the item and set raw_default instead. CONSTR_DEFAULT items + * should not appear in any subsequent processing. + */ +typedef struct ColumnDef +{ + NodeTag type; + char *colname; /* name of column */ + TypeName *typeName; /* type of column */ + char *compression; /* compression method for column */ + int inhcount; /* number of times column is inherited */ + bool is_local; /* column has local (non-inherited) def'n */ + bool is_not_null; /* NOT NULL constraint specified? */ + bool is_from_type; /* column definition came from table type */ + char storage; /* attstorage setting, or 0 for default */ + char *storage_name; /* attstorage setting name or NULL for default */ + Node *raw_default; /* default value (untransformed parse tree) */ + Node *cooked_default; /* default value (transformed expr tree) */ + char identity; /* attidentity setting */ + RangeVar *identitySequence; /* to store identity sequence name for + * ALTER TABLE ... ADD COLUMN */ + char generated; /* attgenerated setting */ + CollateClause *collClause; /* untransformed COLLATE spec, if any */ + Oid collOid; /* collation OID (InvalidOid if not set) */ + List *constraints; /* other constraints on column */ + List *fdwoptions; /* per-column FDW options */ + ParseLoc location; /* parse location, or -1 if none/unknown */ +} ColumnDef; + +/* + * TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause + */ +typedef struct TableLikeClause +{ + NodeTag type; + RangeVar *relation; + bits32 options; /* OR of TableLikeOption flags */ + Oid relationOid; /* If table has been looked up, its OID */ +} TableLikeClause; + +typedef enum TableLikeOption +{ + CREATE_TABLE_LIKE_COMMENTS = 1 << 0, + CREATE_TABLE_LIKE_COMPRESSION = 1 << 1, + CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 2, + CREATE_TABLE_LIKE_DEFAULTS = 1 << 3, + CREATE_TABLE_LIKE_GENERATED = 1 << 4, + CREATE_TABLE_LIKE_IDENTITY = 1 << 5, + CREATE_TABLE_LIKE_INDEXES = 1 << 6, + CREATE_TABLE_LIKE_STATISTICS = 1 << 7, + CREATE_TABLE_LIKE_STORAGE = 1 << 8, + CREATE_TABLE_LIKE_ALL = PG_INT32_MAX +} TableLikeOption; + +/* + * IndexElem - index parameters (used in CREATE INDEX, and in ON CONFLICT) + * + * For a plain index attribute, 'name' is the name of the table column to + * index, and 'expr' is NULL. For an index expression, 'name' is NULL and + * 'expr' is the expression tree. + */ +typedef struct IndexElem +{ + NodeTag type; + char *name; /* name of attribute to index, or NULL */ + Node *expr; /* expression to index, or NULL */ + char *indexcolname; /* name for index column; NULL = default */ + List *collation; /* name of collation; NIL = default */ + List *opclass; /* name of desired opclass; NIL = default */ + List *opclassopts; /* opclass-specific options, or NIL */ + SortByDir ordering; /* ASC/DESC/default */ + SortByNulls nulls_ordering; /* FIRST/LAST/default */ +} IndexElem; + +/* + * DefElem - a generic "name = value" option definition + * + * In some contexts the name can be qualified. Also, certain SQL commands + * allow a SET/ADD/DROP action to be attached to option settings, so it's + * convenient to carry a field for that too. (Note: currently, it is our + * practice that the grammar allows namespace and action only in statements + * where they are relevant; C code can just ignore those fields in other + * statements.) + */ +typedef enum DefElemAction +{ + DEFELEM_UNSPEC, /* no action given */ + DEFELEM_SET, + DEFELEM_ADD, + DEFELEM_DROP, +} DefElemAction; + +typedef struct DefElem +{ + NodeTag type; + char *defnamespace; /* NULL if unqualified name */ + char *defname; + Node *arg; /* typically Integer, Float, String, or + * TypeName */ + DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */ + ParseLoc location; /* token location, or -1 if unknown */ +} DefElem; + +/* + * LockingClause - raw representation of FOR [NO KEY] UPDATE/[KEY] SHARE + * options + * + * Note: lockedRels == NIL means "all relations in query". Otherwise it + * is a list of RangeVar nodes. (We use RangeVar mainly because it carries + * a location field --- currently, parse analysis insists on unqualified + * names in LockingClause.) + */ +typedef struct LockingClause +{ + NodeTag type; + List *lockedRels; /* FOR [KEY] UPDATE/SHARE relations */ + LockClauseStrength strength; + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ +} LockingClause; + +/* + * XMLSERIALIZE (in raw parse tree only) + */ +typedef struct XmlSerialize +{ + NodeTag type; + XmlOptionType xmloption; /* DOCUMENT or CONTENT */ + Node *expr; + TypeName *typeName; + bool indent; /* [NO] INDENT */ + ParseLoc location; /* token location, or -1 if unknown */ +} XmlSerialize; + +/* Partitioning related definitions */ + +/* + * PartitionElem - parse-time representation of a single partition key + * + * expr can be either a raw expression tree or a parse-analyzed expression. + * We don't store these on-disk, though. + */ +typedef struct PartitionElem +{ + NodeTag type; + char *name; /* name of column to partition on, or NULL */ + Node *expr; /* expression to partition on, or NULL */ + List *collation; /* name of collation; NIL = default */ + List *opclass; /* name of desired opclass; NIL = default */ + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionElem; + +typedef enum PartitionStrategy +{ + PARTITION_STRATEGY_LIST = 'l', + PARTITION_STRATEGY_RANGE = 'r', + PARTITION_STRATEGY_HASH = 'h', +} PartitionStrategy; + +/* + * PartitionSpec - parse-time representation of a partition key specification + * + * This represents the key space we will be partitioning on. + */ +typedef struct PartitionSpec +{ + NodeTag type; + PartitionStrategy strategy; + List *partParams; /* List of PartitionElems */ + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionSpec; + +/* + * PartitionBoundSpec - a partition bound specification + * + * This represents the portion of the partition key space assigned to a + * particular partition. These are stored on disk in pg_class.relpartbound. + */ +struct PartitionBoundSpec +{ + NodeTag type; + + char strategy; /* see PARTITION_STRATEGY codes above */ + bool is_default; /* is it a default partition bound? */ + + /* Partitioning info for HASH strategy: */ + int modulus; + int remainder; + + /* Partitioning info for LIST strategy: */ + List *listdatums; /* List of Consts (or A_Consts in raw tree) */ + + /* Partitioning info for RANGE strategy: */ + List *lowerdatums; /* List of PartitionRangeDatums */ + List *upperdatums; /* List of PartitionRangeDatums */ + + ParseLoc location; /* token location, or -1 if unknown */ +}; + +/* + * PartitionRangeDatum - one of the values in a range partition bound + * + * This can be MINVALUE, MAXVALUE or a specific bounded value. + */ +typedef enum PartitionRangeDatumKind +{ + PARTITION_RANGE_DATUM_MINVALUE = -1, /* less than any other value */ + PARTITION_RANGE_DATUM_VALUE = 0, /* a specific (bounded) value */ + PARTITION_RANGE_DATUM_MAXVALUE = 1, /* greater than any other value */ +} PartitionRangeDatumKind; + +typedef struct PartitionRangeDatum +{ + NodeTag type; + + PartitionRangeDatumKind kind; + Node *value; /* Const (or A_Const in raw tree), if kind is + * PARTITION_RANGE_DATUM_VALUE, else NULL */ + + ParseLoc location; /* token location, or -1 if unknown */ +} PartitionRangeDatum; + +/* + * PartitionDesc - used in reverted ALTER TABLE SPLIT PARTITION command + * + * Kept as a stub for nodetag ABI compatibility. + */ +typedef struct SinglePartitionSpec +{ + NodeTag type; +} SinglePartitionSpec; + +/* + * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands + */ +typedef struct PartitionCmd +{ + NodeTag type; + RangeVar *name; /* name of partition to attach/detach */ + PartitionBoundSpec *bound; /* FOR VALUES, if attaching */ + bool concurrent; +} PartitionCmd; + +/**************************************************************************** + * Nodes for a Query tree + ****************************************************************************/ + +/*-------------------- + * RangeTblEntry - + * A range table is a List of RangeTblEntry nodes. + * + * A range table entry may represent a plain relation, a sub-select in + * FROM, or the result of a JOIN clause. (Only explicit JOIN syntax + * produces an RTE, not the implicit join resulting from multiple FROM + * items. This is because we only need the RTE to deal with SQL features + * like outer joins and join-output-column aliasing.) Other special + * RTE types also exist, as indicated by RTEKind. + * + * Note that we consider RTE_RELATION to cover anything that has a pg_class + * entry. relkind distinguishes the sub-cases. + * + * alias is an Alias node representing the AS alias-clause attached to the + * FROM expression, or NULL if no clause. + * + * eref is the table reference name and column reference names (either + * real or aliases). Note that system columns (OID etc) are not included + * in the column list. + * eref->aliasname is required to be present, and should generally be used + * to identify the RTE for error messages etc. + * + * In RELATION RTEs, the colnames in both alias and eref are indexed by + * physical attribute number; this means there must be colname entries for + * dropped columns. When building an RTE we insert empty strings ("") for + * dropped columns. Note however that a stored rule may have nonempty + * colnames for columns dropped since the rule was created (and for that + * matter the colnames might be out of date due to column renamings). + * The same comments apply to FUNCTION RTEs when a function's return type + * is a named composite type. + * + * In JOIN RTEs, the colnames in both alias and eref are one-to-one with + * joinaliasvars entries. A JOIN RTE will omit columns of its inputs when + * those columns are known to be dropped at parse time. Again, however, + * a stored rule might contain entries for columns dropped since the rule + * was created. (This is only possible for columns not actually referenced + * in the rule.) When loading a stored rule, we replace the joinaliasvars + * items for any such columns with null pointers. (We can't simply delete + * them from the joinaliasvars list, because that would affect the attnums + * of Vars referencing the rest of the list.) + * + * inFromCl marks those range variables that are listed in the FROM clause. + * It's false for RTEs that are added to a query behind the scenes, such + * as the NEW and OLD variables for a rule, or the subqueries of a UNION. + * This flag is not used during parsing (except in transformLockingClause, + * q.v.); the parser now uses a separate "namespace" data structure to + * control visibility. But it is needed by ruleutils.c to determine + * whether RTEs should be shown in decompiled queries. + * + * securityQuals is a list of security barrier quals (boolean expressions), + * to be tested in the listed order before returning a row from the + * relation. It is always NIL in parser output. Entries are added by the + * rewriter to implement security-barrier views and/or row-level security. + * Note that the planner turns each boolean expression into an implicitly + * AND'ed sublist, as is its usual habit with qualification expressions. + *-------------------- + */ +typedef enum RTEKind +{ + RTE_RELATION, /* ordinary relation reference */ + RTE_SUBQUERY, /* subquery in FROM */ + RTE_JOIN, /* join */ + RTE_FUNCTION, /* function in FROM */ + RTE_TABLEFUNC, /* TableFunc(.., column list) */ + RTE_VALUES, /* VALUES (), (), ... */ + RTE_CTE, /* common table expr (WITH list element) */ + RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for AFTER triggers */ + RTE_RESULT, /* RTE represents an empty FROM clause; such + * RTEs are added by the planner, they're not + * present during parsing or rewriting */ +} RTEKind; + +typedef struct RangeTblEntry +{ + pg_node_attr(custom_read_write) + + NodeTag type; + + /* + * Fields valid in all RTEs: + * + * put alias + eref first to make dump more legible + */ + /* user-written alias clause, if any */ + Alias *alias pg_node_attr(query_jumble_ignore); + /* expanded reference names */ + Alias *eref pg_node_attr(query_jumble_ignore); + + RTEKind rtekind; /* see above */ + + /* + * Fields valid for a plain relation RTE (else zero): + * + * inh is true for relation references that should be expanded to include + * inheritance children, if the rel has any. In the parser, this will + * only be true for RTE_RELATION entries. The planner also uses this + * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that + * it has flattened into pulled-up subqueries (creating a structure much + * like the effects of inheritance). + * + * rellockmode is really LOCKMODE, but it's declared int to avoid having + * to include lock-related headers here. It must be RowExclusiveLock if + * the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if + * the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock. + * + * Note: in some cases, rule expansion may result in RTEs that are marked + * with RowExclusiveLock even though they are not the target of the + * current query; this happens if a DO ALSO rule simply scans the original + * target table. We leave such RTEs with their original lockmode so as to + * avoid getting an additional, lesser lock. + * + * perminfoindex is 1-based index of the RTEPermissionInfo belonging to + * this RTE in the containing struct's list of same; 0 if permissions need + * not be checked for this RTE. + * + * As a special case, relid, relkind, rellockmode, and perminfoindex can + * also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we + * convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY + * containing the view's query. We still need to perform run-time locking + * and permission checks on the view, even though it's not directly used + * in the query anymore, and the most expedient way to do that is to + * retain these fields from the old state of the RTE. + * + * As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate + * that the tuple format of the tuplestore is the same as the referenced + * relation. This allows plans referencing AFTER trigger transition + * tables to be invalidated if the underlying table is altered. + */ + /* OID of the relation */ + Oid relid; + /* inheritance requested? */ + bool inh; + /* relation kind (see pg_class.relkind) */ + char relkind pg_node_attr(query_jumble_ignore); + /* lock level that query requires on the rel */ + int rellockmode pg_node_attr(query_jumble_ignore); + /* index of RTEPermissionInfo entry, or 0 */ + Index perminfoindex pg_node_attr(query_jumble_ignore); + /* sampling info, or NULL */ + struct TableSampleClause *tablesample; + + /* + * Fields valid for a subquery RTE (else NULL): + */ + /* the sub-query */ + Query *subquery; + /* is from security_barrier view? */ + bool security_barrier pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for a join RTE (else NULL/zero): + * + * joinaliasvars is a list of (usually) Vars corresponding to the columns + * of the join result. An alias Var referencing column K of the join + * result can be replaced by the K'th element of joinaliasvars --- but to + * simplify the task of reverse-listing aliases correctly, we do not do + * that until planning time. In detail: an element of joinaliasvars can + * be a Var of one of the join's input relations, or such a Var with an + * implicit coercion to the join's output column type, or a COALESCE + * expression containing the two input column Vars (possibly coerced). + * Elements beyond the first joinmergedcols entries are always just Vars, + * and are never referenced from elsewhere in the query (that is, join + * alias Vars are generated only for merged columns). We keep these + * entries only because they're needed in expandRTE() and similar code. + * + * Vars appearing within joinaliasvars are marked with varnullingrels sets + * that describe the nulling effects of this join and lower ones. This is + * essential for FULL JOIN cases, because the COALESCE expression only + * describes the semantics correctly if its inputs have been nulled by the + * join. For other cases, it allows expandRTE() to generate a valid + * representation of the join's output without consulting additional + * parser state. + * + * Within a Query loaded from a stored rule, it is possible for non-merged + * joinaliasvars items to be null pointers, which are placeholders for + * (necessarily unreferenced) columns dropped since the rule was made. + * Also, once planning begins, joinaliasvars items can be almost anything, + * as a result of subquery-flattening substitutions. + * + * joinleftcols is an integer list of physical column numbers of the left + * join input rel that are included in the join; likewise joinrighttcols + * for the right join input rel. (Which rels those are can be determined + * from the associated JoinExpr.) If the join is USING/NATURAL, then the + * first joinmergedcols entries in each list identify the merged columns. + * The merged columns come first in the join output, then remaining + * columns of the left input, then remaining columns of the right. + * + * Note that input columns could have been dropped after creation of a + * stored rule, if they are not referenced in the query (in particular, + * merged columns could not be dropped); this is not accounted for in + * joinleftcols/joinrighttcols. + */ + JoinType jointype; + /* number of merged (JOIN USING) columns */ + int joinmergedcols pg_node_attr(query_jumble_ignore); + /* list of alias-var expansions */ + List *joinaliasvars pg_node_attr(query_jumble_ignore); + /* left-side input column numbers */ + List *joinleftcols pg_node_attr(query_jumble_ignore); + /* right-side input column numbers */ + List *joinrightcols pg_node_attr(query_jumble_ignore); + + /* + * join_using_alias is an alias clause attached directly to JOIN/USING. It + * is different from the alias field (below) in that it does not hide the + * range variables of the tables being joined. + */ + Alias *join_using_alias pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for a function RTE (else NIL/zero): + * + * When funcordinality is true, the eref->colnames list includes an alias + * for the ordinality column. The ordinality column is otherwise + * implicit, and must be accounted for "by hand" in places such as + * expandRTE(). + */ + /* list of RangeTblFunction nodes */ + List *functions; + /* is this called WITH ORDINALITY? */ + bool funcordinality; + + /* + * Fields valid for a TableFunc RTE (else NULL): + */ + TableFunc *tablefunc; + + /* + * Fields valid for a values RTE (else NIL): + */ + /* list of expression lists */ + List *values_lists; + + /* + * Fields valid for a CTE RTE (else NULL/zero): + */ + /* name of the WITH list item */ + char *ctename; + /* number of query levels up */ + Index ctelevelsup; + /* is this a recursive self-reference? */ + bool self_reference pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL): + * + * We need these for CTE RTEs so that the types of self-referential + * columns are well-defined. For VALUES RTEs, storing these explicitly + * saves having to re-determine the info by scanning the values_lists. For + * ENRs, we store the types explicitly here (we could get the information + * from the catalogs if 'relid' was supplied, but we'd still need these + * for TupleDesc-based ENRs, so we might as well always store the type + * info here). For TableFuncs, these fields are redundant with data in + * the TableFunc node, but keeping them here allows some code sharing with + * the other cases. + * + * For ENRs only, we have to consider the possibility of dropped columns. + * A dropped column is included in these lists, but it will have zeroes in + * all three lists (as well as an empty-string entry in eref). Testing + * for zero coltype is the standard way to detect a dropped column. + */ + /* OID list of column type OIDs */ + List *coltypes pg_node_attr(query_jumble_ignore); + /* integer list of column typmods */ + List *coltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *colcollations pg_node_attr(query_jumble_ignore); + + /* + * Fields valid for ENR RTEs (else NULL/zero): + */ + /* name of ephemeral named relation */ + char *enrname; + /* estimated or actual from caller */ + Cardinality enrtuples pg_node_attr(query_jumble_ignore); + + /* + * Fields valid in all RTEs: + */ + /* was LATERAL specified? */ + bool lateral pg_node_attr(query_jumble_ignore); + /* present in FROM clause? */ + bool inFromCl pg_node_attr(query_jumble_ignore); + /* security barrier quals to apply, if any */ + List *securityQuals pg_node_attr(query_jumble_ignore); +} RangeTblEntry; + +/* + * RTEPermissionInfo + * Per-relation information for permission checking. Added to the Query + * node by the parser when adding the corresponding RTE to the query + * range table and subsequently editorialized on by the rewriter if + * needed after rule expansion. + * + * Only the relations directly mentioned in the query are checked for + * access permissions by the core executor, so only their RTEPermissionInfos + * are present in the Query. However, extensions may want to check inheritance + * children too, depending on the value of rte->inh, so it's copied in 'inh' + * for their perusal. + * + * requiredPerms and checkAsUser specify run-time access permissions checks + * to be performed at query startup. The user must have *all* of the + * permissions that are OR'd together in requiredPerms (never 0!). If + * checkAsUser is not zero, then do the permissions checks using the access + * rights of that user, not the current effective user ID. (This allows rules + * to act as setuid gateways.) + * + * For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide + * permissions then it is sufficient to have the permissions on all columns + * identified in selectedCols (for SELECT) and/or insertedCols and/or + * updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3). + * selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have + * negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber + * from column numbers before storing them in these fields. A whole-row Var + * reference is represented by setting the bit for InvalidAttrNumber. + * + * updatedCols is also used in some other places, for example, to determine + * which triggers to fire and in FDWs to know which changed columns they need + * to ship off. + */ +typedef struct RTEPermissionInfo +{ + NodeTag type; + + Oid relid; /* relation OID */ + bool inh; /* separately check inheritance children? */ + AclMode requiredPerms; /* bitmask of required access permissions */ + Oid checkAsUser; /* if valid, check access as this role */ + Bitmapset *selectedCols; /* columns needing SELECT permission */ + Bitmapset *insertedCols; /* columns needing INSERT permission */ + Bitmapset *updatedCols; /* columns needing UPDATE permission */ +} RTEPermissionInfo; + +/* + * RangeTblFunction - + * RangeTblEntry subsidiary data for one function in a FUNCTION RTE. + * + * If the function had a column definition list (required for an + * otherwise-unspecified RECORD result), funccolnames lists the names given + * in the definition list, funccoltypes lists their declared column types, + * funccoltypmods lists their typmods, funccolcollations their collations. + * Otherwise, those fields are NIL. + * + * Notice we don't attempt to store info about the results of functions + * returning named composite types, because those can change from time to + * time. We do however remember how many columns we thought the type had + * (including dropped columns!), so that we can successfully ignore any + * columns added after the query was parsed. + * + * The query jumbling only needs to track the function expression. + */ +typedef struct RangeTblFunction +{ + NodeTag type; + + Node *funcexpr; /* expression tree for func call */ + /* number of columns it contributes to RTE */ + int funccolcount pg_node_attr(query_jumble_ignore); + /* These fields record the contents of a column definition list, if any: */ + /* column names (list of String) */ + List *funccolnames pg_node_attr(query_jumble_ignore); + /* OID list of column type OIDs */ + List *funccoltypes pg_node_attr(query_jumble_ignore); + /* integer list of column typmods */ + List *funccoltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *funccolcollations pg_node_attr(query_jumble_ignore); + + /* This is set during planning for use by the executor: */ + /* PARAM_EXEC Param IDs affecting this func */ + Bitmapset *funcparams pg_node_attr(query_jumble_ignore); +} RangeTblFunction; + +/* + * TableSampleClause - TABLESAMPLE appearing in a transformed FROM clause + * + * Unlike RangeTableSample, this is a subnode of the relevant RangeTblEntry. + */ +typedef struct TableSampleClause +{ + NodeTag type; + Oid tsmhandler; /* OID of the tablesample handler function */ + List *args; /* tablesample argument expression(s) */ + Expr *repeatable; /* REPEATABLE expression, or NULL if none */ +} TableSampleClause; + +/* + * WithCheckOption - + * representation of WITH CHECK OPTION checks to be applied to new tuples + * when inserting/updating an auto-updatable view, or RLS WITH CHECK + * policies to be applied when inserting/updating a relation with RLS. + */ +typedef enum WCOKind +{ + WCO_VIEW_CHECK, /* WCO on an auto-updatable view */ + WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */ + WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */ + WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */ + WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */ + WCO_RLS_MERGE_DELETE_CHECK, /* RLS MERGE DELETE USING policy */ +} WCOKind; + +typedef struct WithCheckOption +{ + NodeTag type; + WCOKind kind; /* kind of WCO */ + char *relname; /* name of relation that specified the WCO */ + char *polname; /* name of RLS policy being checked */ + Node *qual; /* constraint qual to check */ + bool cascaded; /* true for a cascaded WCO on a view */ +} WithCheckOption; + +/* + * SortGroupClause - + * representation of ORDER BY, GROUP BY, PARTITION BY, + * DISTINCT, DISTINCT ON items + * + * You might think that ORDER BY is only interested in defining ordering, + * and GROUP/DISTINCT are only interested in defining equality. However, + * one way to implement grouping is to sort and then apply a "uniq"-like + * filter. So it's also interesting to keep track of possible sort operators + * for GROUP/DISTINCT, and in particular to try to sort for the grouping + * in a way that will also yield a requested ORDER BY ordering. So we need + * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates + * the decision to give them the same representation. + * + * tleSortGroupRef must match ressortgroupref of exactly one entry of the + * query's targetlist; that is the expression to be sorted or grouped by. + * eqop is the OID of the equality operator. + * sortop is the OID of the ordering operator (a "<" or ">" operator), + * or InvalidOid if not available. + * nulls_first means about what you'd expect. If sortop is InvalidOid + * then nulls_first is meaningless and should be set to false. + * hashable is true if eqop is hashable (note this condition also depends + * on the datatype of the input expression). + * + * In an ORDER BY item, all fields must be valid. (The eqop isn't essential + * here, but it's cheap to get it along with the sortop, and requiring it + * to be valid eases comparisons to grouping items.) Note that this isn't + * actually enough information to determine an ordering: if the sortop is + * collation-sensitive, a collation OID is needed too. We don't store the + * collation in SortGroupClause because it's not available at the time the + * parser builds the SortGroupClause; instead, consult the exposed collation + * of the referenced targetlist expression to find out what it is. + * + * In a grouping item, eqop must be valid. If the eqop is a btree equality + * operator, then sortop should be set to a compatible ordering operator. + * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that + * the query presents for the same tlist item. If there is none, we just + * use the default ordering op for the datatype. + * + * If the tlist item's type has a hash opclass but no btree opclass, then + * we will set eqop to the hash equality operator, sortop to InvalidOid, + * and nulls_first to false. A grouping item of this kind can only be + * implemented by hashing, and of course it'll never match an ORDER BY item. + * + * The hashable flag is provided since we generally have the requisite + * information readily available when the SortGroupClause is constructed, + * and it's relatively expensive to get it again later. Note there is no + * need for a "sortable" flag since OidIsValid(sortop) serves the purpose. + * + * A query might have both ORDER BY and DISTINCT (or DISTINCT ON) clauses. + * In SELECT DISTINCT, the distinctClause list is as long or longer than the + * sortClause list, while in SELECT DISTINCT ON it's typically shorter. + * The two lists must match up to the end of the shorter one --- the parser + * rearranges the distinctClause if necessary to make this true. (This + * restriction ensures that only one sort step is needed to both satisfy the + * ORDER BY and set up for the Unique step. This is semantically necessary + * for DISTINCT ON, and presents no real drawback for DISTINCT.) + */ +typedef struct SortGroupClause +{ + NodeTag type; + Index tleSortGroupRef; /* reference into targetlist */ + Oid eqop; /* the equality operator ('=' op) */ + Oid sortop; /* the ordering operator ('<' op), or 0 */ + bool nulls_first; /* do NULLs come before normal values? */ + /* can eqop be implemented by hashing? */ + bool hashable pg_node_attr(query_jumble_ignore); +} SortGroupClause; + +/* + * GroupingSet - + * representation of CUBE, ROLLUP and GROUPING SETS clauses + * + * In a Query with grouping sets, the groupClause contains a flat list of + * SortGroupClause nodes for each distinct expression used. The actual + * structure of the GROUP BY clause is given by the groupingSets tree. + * + * In the raw parser output, GroupingSet nodes (of all types except SIMPLE + * which is not used) are potentially mixed in with the expressions in the + * groupClause of the SelectStmt. (An expression can't contain a GroupingSet, + * but a list may mix GroupingSet and expression nodes.) At this stage, the + * content of each node is a list of expressions, some of which may be RowExprs + * which represent sublists rather than actual row constructors, and nested + * GroupingSet nodes where legal in the grammar. The structure directly + * reflects the query syntax. + * + * In parse analysis, the transformed expressions are used to build the tlist + * and groupClause list (of SortGroupClause nodes), and the groupingSets tree + * is eventually reduced to a fixed format: + * + * EMPTY nodes represent (), and obviously have no content + * + * SIMPLE nodes represent a list of one or more expressions to be treated as an + * atom by the enclosing structure; the content is an integer list of + * ressortgroupref values (see SortGroupClause) + * + * CUBE and ROLLUP nodes contain a list of one or more SIMPLE nodes. + * + * SETS nodes contain a list of EMPTY, SIMPLE, CUBE or ROLLUP nodes, but after + * parse analysis they cannot contain more SETS nodes; enough of the syntactic + * transforms of the spec have been applied that we no longer have arbitrarily + * deep nesting (though we still preserve the use of cube/rollup). + * + * Note that if the groupingSets tree contains no SIMPLE nodes (only EMPTY + * nodes at the leaves), then the groupClause will be empty, but this is still + * an aggregation query (similar to using aggs or HAVING without GROUP BY). + * + * As an example, the following clause: + * + * GROUP BY GROUPING SETS ((a,b), CUBE(c,(d,e))) + * + * looks like this after raw parsing: + * + * SETS( RowExpr(a,b) , CUBE( c, RowExpr(d,e) ) ) + * + * and parse analysis converts it to: + * + * SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) ) + */ +typedef enum GroupingSetKind +{ + GROUPING_SET_EMPTY, + GROUPING_SET_SIMPLE, + GROUPING_SET_ROLLUP, + GROUPING_SET_CUBE, + GROUPING_SET_SETS, +} GroupingSetKind; + +typedef struct GroupingSet +{ + NodeTag type; + GroupingSetKind kind pg_node_attr(query_jumble_ignore); + List *content; + ParseLoc location; +} GroupingSet; + +/* + * WindowClause - + * transformed representation of WINDOW and OVER clauses + * + * A parsed Query's windowClause list contains these structs. "name" is set + * if the clause originally came from WINDOW, and is NULL if it originally + * was an OVER clause (but note that we collapse out duplicate OVERs). + * partitionClause and orderClause are lists of SortGroupClause structs. + * partitionClause is sanitized by the query planner to remove any columns or + * expressions belonging to redundant PathKeys. + * If we have RANGE with offset PRECEDING/FOLLOWING, the semantics of that are + * specified by startInRangeFunc/inRangeColl/inRangeAsc/inRangeNullsFirst + * for the start offset, or endInRangeFunc/inRange* for the end offset. + * winref is an ID number referenced by WindowFunc nodes; it must be unique + * among the members of a Query's windowClause list. + * When refname isn't null, the partitionClause is always copied from there; + * the orderClause might or might not be copied (see copiedOrder); the framing + * options are never copied, per spec. + * + * The information relevant for the query jumbling is the partition clause + * type and its bounds. + */ +typedef struct WindowClause +{ + NodeTag type; + /* window name (NULL in an OVER clause) */ + char *name pg_node_attr(query_jumble_ignore); + /* referenced window name, if any */ + char *refname pg_node_attr(query_jumble_ignore); + List *partitionClause; /* PARTITION BY list */ + /* ORDER BY list */ + List *orderClause; + int frameOptions; /* frame_clause options, see WindowDef */ + Node *startOffset; /* expression for starting bound, if any */ + Node *endOffset; /* expression for ending bound, if any */ + /* in_range function for startOffset */ + Oid startInRangeFunc pg_node_attr(query_jumble_ignore); + /* in_range function for endOffset */ + Oid endInRangeFunc pg_node_attr(query_jumble_ignore); + /* collation for in_range tests */ + Oid inRangeColl pg_node_attr(query_jumble_ignore); + /* use ASC sort order for in_range tests? */ + bool inRangeAsc pg_node_attr(query_jumble_ignore); + /* nulls sort first for in_range tests? */ + bool inRangeNullsFirst pg_node_attr(query_jumble_ignore); + Index winref; /* ID referenced by window functions */ + /* did we copy orderClause from refname? */ + bool copiedOrder pg_node_attr(query_jumble_ignore); +} WindowClause; + +/* + * RowMarkClause - + * parser output representation of FOR [KEY] UPDATE/SHARE clauses + * + * Query.rowMarks contains a separate RowMarkClause node for each relation + * identified as a FOR [KEY] UPDATE/SHARE target. If one of these clauses + * is applied to a subquery, we generate RowMarkClauses for all normal and + * subquery rels in the subquery, but they are marked pushedDown = true to + * distinguish them from clauses that were explicitly written at this query + * level. Also, Query.hasForUpdate tells whether there were explicit FOR + * UPDATE/SHARE/KEY SHARE clauses in the current query level. + */ +typedef struct RowMarkClause +{ + NodeTag type; + Index rti; /* range table index of target relation */ + LockClauseStrength strength; + LockWaitPolicy waitPolicy; /* NOWAIT and SKIP LOCKED */ + bool pushedDown; /* pushed down from higher query level? */ +} RowMarkClause; + +/* + * WithClause - + * representation of WITH clause + * + * Note: WithClause does not propagate into the Query representation; + * but CommonTableExpr does. + */ +typedef struct WithClause +{ + NodeTag type; + List *ctes; /* list of CommonTableExprs */ + bool recursive; /* true = WITH RECURSIVE */ + ParseLoc location; /* token location, or -1 if unknown */ +} WithClause; + +/* + * InferClause - + * ON CONFLICT unique index inference clause + * + * Note: InferClause does not propagate into the Query representation. + */ +typedef struct InferClause +{ + NodeTag type; + List *indexElems; /* IndexElems to infer unique index */ + Node *whereClause; /* qualification (partial-index predicate) */ + char *conname; /* Constraint name, or NULL if unnamed */ + ParseLoc location; /* token location, or -1 if unknown */ +} InferClause; + +/* + * OnConflictClause - + * representation of ON CONFLICT clause + * + * Note: OnConflictClause does not propagate into the Query representation. + */ +typedef struct OnConflictClause +{ + NodeTag type; + OnConflictAction action; /* DO NOTHING or UPDATE? */ + InferClause *infer; /* Optional index inference clause */ + List *targetList; /* the target list (of ResTarget) */ + Node *whereClause; /* qualifications */ + ParseLoc location; /* token location, or -1 if unknown */ +} OnConflictClause; + +/* + * CommonTableExpr - + * representation of WITH list element + */ + +typedef enum CTEMaterialize +{ + CTEMaterializeDefault, /* no option specified */ + CTEMaterializeAlways, /* MATERIALIZED */ + CTEMaterializeNever, /* NOT MATERIALIZED */ +} CTEMaterialize; + +typedef struct CTESearchClause +{ + NodeTag type; + List *search_col_list; + bool search_breadth_first; + char *search_seq_column; + ParseLoc location; +} CTESearchClause; + +typedef struct CTECycleClause +{ + NodeTag type; + List *cycle_col_list; + char *cycle_mark_column; + Node *cycle_mark_value; + Node *cycle_mark_default; + char *cycle_path_column; + ParseLoc location; + /* These fields are set during parse analysis: */ + Oid cycle_mark_type; /* common type of _value and _default */ + int cycle_mark_typmod; + Oid cycle_mark_collation; + Oid cycle_mark_neop; /* <> operator for type */ +} CTECycleClause; + +typedef struct CommonTableExpr +{ + NodeTag type; + + /* + * Query name (never qualified). The string name is included in the query + * jumbling because RTE_CTE RTEs need it. + */ + char *ctename; + /* optional list of column names */ + List *aliascolnames pg_node_attr(query_jumble_ignore); + CTEMaterialize ctematerialized; /* is this an optimization fence? */ + /* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */ + Node *ctequery; /* the CTE's subquery */ + CTESearchClause *search_clause pg_node_attr(query_jumble_ignore); + CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ + /* These fields are set during parse analysis: */ + /* is this CTE actually recursive? */ + bool cterecursive pg_node_attr(query_jumble_ignore); + + /* + * Number of RTEs referencing this CTE (excluding internal + * self-references), irrelevant for query jumbling. + */ + int cterefcount pg_node_attr(query_jumble_ignore); + /* list of output column names */ + List *ctecolnames pg_node_attr(query_jumble_ignore); + /* OID list of output column type OIDs */ + List *ctecoltypes pg_node_attr(query_jumble_ignore); + /* integer list of output column typmods */ + List *ctecoltypmods pg_node_attr(query_jumble_ignore); + /* OID list of column collation OIDs */ + List *ctecolcollations pg_node_attr(query_jumble_ignore); +} CommonTableExpr; + +/* Convenience macro to get the output tlist of a CTE's query */ +#define GetCTETargetList(cte) \ + (AssertMacro(IsA((cte)->ctequery, Query)), \ + ((Query *) (cte)->ctequery)->commandType == CMD_SELECT ? \ + ((Query *) (cte)->ctequery)->targetList : \ + ((Query *) (cte)->ctequery)->returningList) + +/* + * MergeWhenClause - + * raw parser representation of a WHEN clause in a MERGE statement + * + * This is transformed into MergeAction by parse analysis + */ +typedef struct MergeWhenClause +{ + NodeTag type; + MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */ + CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */ + OverridingKind override; /* OVERRIDING clause */ + Node *condition; /* WHEN conditions (raw parser) */ + List *targetList; /* INSERT/UPDATE targetlist */ + /* the following members are only used in INSERT actions */ + List *values; /* VALUES to INSERT, or NULL */ +} MergeWhenClause; + +/* + * TriggerTransition - + * representation of transition row or table naming clause + * + * Only transition tables are initially supported in the syntax, and only for + * AFTER triggers, but other permutations are accepted by the parser so we can + * give a meaningful message from C code. + */ +typedef struct TriggerTransition +{ + NodeTag type; + char *name; + bool isNew; + bool isTable; +} TriggerTransition; + +/* Nodes for SQL/JSON support */ + +/* + * JsonOutput - + * representation of JSON output clause (RETURNING type [FORMAT format]) + */ +typedef struct JsonOutput +{ + NodeTag type; + TypeName *typeName; /* RETURNING type name, if specified */ + JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */ +} JsonOutput; + +/* + * JsonArgument - + * representation of argument from JSON PASSING clause + */ +typedef struct JsonArgument +{ + NodeTag type; + JsonValueExpr *val; /* argument value expression */ + char *name; /* argument name */ +} JsonArgument; + +/* + * JsonQuotes - + * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY() + */ +typedef enum JsonQuotes +{ + JS_QUOTES_UNSPEC, /* unspecified */ + JS_QUOTES_KEEP, /* KEEP QUOTES */ + JS_QUOTES_OMIT, /* OMIT QUOTES */ +} JsonQuotes; + +/* + * JsonFuncExpr - + * untransformed representation of function expressions for + * SQL/JSON query functions + */ +typedef struct JsonFuncExpr +{ + NodeTag type; + JsonExprOp op; /* expression type */ + char *column_name; /* JSON_TABLE() column name or NULL if this is + * not for a JSON_TABLE() */ + JsonValueExpr *context_item; /* context item expression */ + Node *pathspec; /* JSON path specification expression */ + List *passing; /* list of PASSING clause arguments, if any */ + JsonOutput *output; /* output clause, if specified */ + JsonBehavior *on_empty; /* ON EMPTY behavior */ + JsonBehavior *on_error; /* ON ERROR behavior */ + JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */ + JsonQuotes quotes; /* omit or keep quotes? (JSON_QUERY only) */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonFuncExpr; + +/* + * JsonTablePathSpec + * untransformed specification of JSON path expression with an optional + * name + */ +typedef struct JsonTablePathSpec +{ + NodeTag type; + + Node *string; + char *name; + ParseLoc name_location; + ParseLoc location; /* location of 'string' */ +} JsonTablePathSpec; + +/* + * JsonTable - + * untransformed representation of JSON_TABLE + */ +typedef struct JsonTable +{ + NodeTag type; + JsonValueExpr *context_item; /* context item expression */ + JsonTablePathSpec *pathspec; /* JSON path specification */ + List *passing; /* list of PASSING clause arguments, if any */ + List *columns; /* list of JsonTableColumn */ + JsonBehavior *on_error; /* ON ERROR behavior */ + Alias *alias; /* table alias in FROM clause */ + bool lateral; /* does it have LATERAL prefix? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonTable; + +/* + * JsonTableColumnType - + * enumeration of JSON_TABLE column types + */ +typedef enum JsonTableColumnType +{ + JTC_FOR_ORDINALITY, + JTC_REGULAR, + JTC_EXISTS, + JTC_FORMATTED, + JTC_NESTED, +} JsonTableColumnType; + +/* + * JsonTableColumn - + * untransformed representation of JSON_TABLE column + */ +typedef struct JsonTableColumn +{ + NodeTag type; + JsonTableColumnType coltype; /* column type */ + char *name; /* column name */ + TypeName *typeName; /* column type name */ + JsonTablePathSpec *pathspec; /* JSON path specification */ + JsonFormat *format; /* JSON format clause, if specified */ + JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */ + JsonQuotes quotes; /* omit or keep quotes on scalar strings? */ + List *columns; /* nested columns */ + JsonBehavior *on_empty; /* ON EMPTY behavior */ + JsonBehavior *on_error; /* ON ERROR behavior */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonTableColumn; + +/* + * JsonKeyValue - + * untransformed representation of JSON object key-value pair for + * JSON_OBJECT() and JSON_OBJECTAGG() + */ +typedef struct JsonKeyValue +{ + NodeTag type; + Expr *key; /* key expression */ + JsonValueExpr *value; /* JSON value expression */ +} JsonKeyValue; + +/* + * JsonParseExpr - + * untransformed representation of JSON() + */ +typedef struct JsonParseExpr +{ + NodeTag type; + JsonValueExpr *expr; /* string expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool unique_keys; /* WITH UNIQUE KEYS? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonParseExpr; + +/* + * JsonScalarExpr - + * untransformed representation of JSON_SCALAR() + */ +typedef struct JsonScalarExpr +{ + NodeTag type; + Expr *expr; /* scalar expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonScalarExpr; + +/* + * JsonSerializeExpr - + * untransformed representation of JSON_SERIALIZE() function + */ +typedef struct JsonSerializeExpr +{ + NodeTag type; + JsonValueExpr *expr; /* json value expression */ + JsonOutput *output; /* RETURNING clause, if specified */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonSerializeExpr; + +/* + * JsonObjectConstructor - + * untransformed representation of JSON_OBJECT() constructor + */ +typedef struct JsonObjectConstructor +{ + NodeTag type; + List *exprs; /* list of JsonKeyValue pairs */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool absent_on_null; /* skip NULL values? */ + bool unique; /* check key uniqueness? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonObjectConstructor; + +/* + * JsonArrayConstructor - + * untransformed representation of JSON_ARRAY(element,...) constructor + */ +typedef struct JsonArrayConstructor +{ + NodeTag type; + List *exprs; /* list of JsonValueExpr elements */ + JsonOutput *output; /* RETURNING clause, if specified */ + bool absent_on_null; /* skip NULL elements? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonArrayConstructor; + +/* + * JsonArrayQueryConstructor - + * untransformed representation of JSON_ARRAY(subquery) constructor + */ +typedef struct JsonArrayQueryConstructor +{ + NodeTag type; + Node *query; /* subquery */ + JsonOutput *output; /* RETURNING clause, if specified */ + JsonFormat *format; /* FORMAT clause for subquery, if specified */ + bool absent_on_null; /* skip NULL elements? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonArrayQueryConstructor; + +/* + * JsonAggConstructor - + * common fields of untransformed representation of + * JSON_ARRAYAGG() and JSON_OBJECTAGG() + */ +typedef struct JsonAggConstructor +{ + NodeTag type; + JsonOutput *output; /* RETURNING clause, if any */ + Node *agg_filter; /* FILTER clause, if any */ + List *agg_order; /* ORDER BY clause, if any */ + struct WindowDef *over; /* OVER clause, if any */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonAggConstructor; + +/* + * JsonObjectAgg - + * untransformed representation of JSON_OBJECTAGG() + */ +typedef struct JsonObjectAgg +{ + NodeTag type; + JsonAggConstructor *constructor; /* common fields */ + JsonKeyValue *arg; /* object key-value pair */ + bool absent_on_null; /* skip NULL values? */ + bool unique; /* check key uniqueness? */ +} JsonObjectAgg; + +/* + * JsonArrayAgg - + * untransformed representation of JSON_ARRAYAGG() + */ +typedef struct JsonArrayAgg +{ + NodeTag type; + JsonAggConstructor *constructor; /* common fields */ + JsonValueExpr *arg; /* array element expression */ + bool absent_on_null; /* skip NULL elements? */ +} JsonArrayAgg; + + +/***************************************************************************** + * Raw Grammar Output Statements + *****************************************************************************/ + +/* + * RawStmt --- container for any one statement's raw parse tree + * + * Parse analysis converts a raw parse tree headed by a RawStmt node into + * an analyzed statement headed by a Query node. For optimizable statements, + * the conversion is complex. For utility statements, the parser usually just + * transfers the raw parse tree (sans RawStmt) into the utilityStmt field of + * the Query node, and all the useful work happens at execution time. + * + * stmt_location/stmt_len identify the portion of the source text string + * containing this raw statement (useful for multi-statement strings). + * + * This is irrelevant for query jumbling, as this is not used in parsed + * queries. + */ +typedef struct RawStmt +{ + pg_node_attr(no_query_jumble) + + NodeTag type; + Node *stmt; /* raw parse tree */ + ParseLoc stmt_location; /* start location, or -1 if unknown */ + ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */ +} RawStmt; + +/***************************************************************************** + * Optimizable Statements + *****************************************************************************/ + +/* ---------------------- + * Insert Statement + * + * The source expression is represented by SelectStmt for both the + * SELECT and VALUES cases. If selectStmt is NULL, then the query + * is INSERT ... DEFAULT VALUES. + * ---------------------- + */ +typedef struct InsertStmt +{ + NodeTag type; + RangeVar *relation; /* relation to insert into */ + List *cols; /* optional: names of the target columns */ + Node *selectStmt; /* the source SELECT/VALUES, or NULL */ + OnConflictClause *onConflictClause; /* ON CONFLICT clause */ + List *returningList; /* list of expressions to return */ + WithClause *withClause; /* WITH clause */ + OverridingKind override; /* OVERRIDING clause */ +} InsertStmt; + +/* ---------------------- + * Delete Statement + * ---------------------- + */ +typedef struct DeleteStmt +{ + NodeTag type; + RangeVar *relation; /* relation to delete from */ + List *usingClause; /* optional using clause for more tables */ + Node *whereClause; /* qualifications */ + List *returningList; /* list of expressions to return */ + WithClause *withClause; /* WITH clause */ +} DeleteStmt; + +/* ---------------------- + * Update Statement + * ---------------------- + */ +typedef struct UpdateStmt +{ + NodeTag type; + RangeVar *relation; /* relation to update */ + List *targetList; /* the target list (of ResTarget) */ + Node *whereClause; /* qualifications */ + List *fromClause; /* optional from clause for more tables */ + List *returningList; /* list of expressions to return */ + WithClause *withClause; /* WITH clause */ +} UpdateStmt; + +/* ---------------------- + * Merge Statement + * ---------------------- + */ +typedef struct MergeStmt +{ + NodeTag type; + RangeVar *relation; /* target relation to merge into */ + Node *sourceRelation; /* source relation */ + Node *joinCondition; /* join condition between source and target */ + List *mergeWhenClauses; /* list of MergeWhenClause(es) */ + List *returningList; /* list of expressions to return */ + WithClause *withClause; /* WITH clause */ +} MergeStmt; + +/* ---------------------- + * Select Statement + * + * A "simple" SELECT is represented in the output of gram.y by a single + * SelectStmt node; so is a VALUES construct. A query containing set + * operators (UNION, INTERSECT, EXCEPT) is represented by a tree of SelectStmt + * nodes, in which the leaf nodes are component SELECTs and the internal nodes + * represent UNION, INTERSECT, or EXCEPT operators. Using the same node + * type for both leaf and internal nodes allows gram.y to stick ORDER BY, + * LIMIT, etc, clause values into a SELECT statement without worrying + * whether it is a simple or compound SELECT. + * ---------------------- + */ +typedef enum SetOperation +{ + SETOP_NONE = 0, + SETOP_UNION, + SETOP_INTERSECT, + SETOP_EXCEPT, +} SetOperation; + +typedef struct SelectStmt +{ + NodeTag type; + + /* + * These fields are used only in "leaf" SelectStmts. + */ + List *distinctClause; /* NULL, list of DISTINCT ON exprs, or + * lcons(NIL,NIL) for all (SELECT DISTINCT) */ + IntoClause *intoClause; /* target for SELECT INTO */ + List *targetList; /* the target list (of ResTarget) */ + List *fromClause; /* the FROM clause */ + Node *whereClause; /* WHERE qualification */ + List *groupClause; /* GROUP BY clauses */ + bool groupDistinct; /* Is this GROUP BY DISTINCT? */ + Node *havingClause; /* HAVING conditional-expression */ + List *windowClause; /* WINDOW window_name AS (...), ... */ + + /* + * In a "leaf" node representing a VALUES list, the above fields are all + * null, and instead this field is set. Note that the elements of the + * sublists are just expressions, without ResTarget decoration. Also note + * that a list element can be DEFAULT (represented as a SetToDefault + * node), regardless of the context of the VALUES list. It's up to parse + * analysis to reject that where not valid. + */ + List *valuesLists; /* untransformed list of expression lists */ + + /* + * These fields are used in both "leaf" SelectStmts and upper-level + * SelectStmts. + */ + List *sortClause; /* sort clause (a list of SortBy's) */ + Node *limitOffset; /* # of result tuples to skip */ + Node *limitCount; /* # of result tuples to return */ + LimitOption limitOption; /* limit type */ + List *lockingClause; /* FOR UPDATE (list of LockingClause's) */ + WithClause *withClause; /* WITH clause */ + + /* + * These fields are used only in upper-level SelectStmts. + */ + SetOperation op; /* type of set op */ + bool all; /* ALL specified? */ + struct SelectStmt *larg; /* left child */ + struct SelectStmt *rarg; /* right child */ + /* Eventually add fields for CORRESPONDING spec here */ +} SelectStmt; + + +/* ---------------------- + * Set Operation node for post-analysis query trees + * + * After parse analysis, a SELECT with set operations is represented by a + * top-level Query node containing the leaf SELECTs as subqueries in its + * range table. Its setOperations field shows the tree of set operations, + * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal + * nodes replaced by SetOperationStmt nodes. Information about the output + * column types is added, too. (Note that the child nodes do not necessarily + * produce these types directly, but we've checked that their output types + * can be coerced to the output column type.) Also, if it's not UNION ALL, + * information about the types' sort/group semantics is provided in the form + * of a SortGroupClause list (same representation as, eg, DISTINCT). + * The resolved common column collations are provided too; but note that if + * it's not UNION ALL, it's okay for a column to not have a common collation, + * so a member of the colCollations list could be InvalidOid even though the + * column has a collatable type. + * ---------------------- + */ +typedef struct SetOperationStmt +{ + NodeTag type; + SetOperation op; /* type of set op */ + bool all; /* ALL specified? */ + Node *larg; /* left child */ + Node *rarg; /* right child */ + /* Eventually add fields for CORRESPONDING spec here */ + + /* Fields derived during parse analysis (irrelevant for query jumbling): */ + /* OID list of output column type OIDs */ + List *colTypes pg_node_attr(query_jumble_ignore); + /* integer list of output column typmods */ + List *colTypmods pg_node_attr(query_jumble_ignore); + /* OID list of output column collation OIDs */ + List *colCollations pg_node_attr(query_jumble_ignore); + /* a list of SortGroupClause's */ + List *groupClauses pg_node_attr(query_jumble_ignore); + /* groupClauses is NIL if UNION ALL, but must be set otherwise */ +} SetOperationStmt; + + +/* + * RETURN statement (inside SQL function body) + */ +typedef struct ReturnStmt +{ + NodeTag type; + Node *returnval; +} ReturnStmt; + + +/* ---------------------- + * PL/pgSQL Assignment Statement + * + * Like SelectStmt, this is transformed into a SELECT Query. + * However, the targetlist of the result looks more like an UPDATE. + * ---------------------- + */ +typedef struct PLAssignStmt +{ + NodeTag type; + + char *name; /* initial column name */ + List *indirection; /* subscripts and field names, if any */ + int nnames; /* number of names to use in ColumnRef */ + SelectStmt *val; /* the PL/pgSQL expression to assign */ + ParseLoc location; /* name's token location, or -1 if unknown */ +} PLAssignStmt; + + +/***************************************************************************** + * Other Statements (no optimizations required) + * + * These are not touched by parser/analyze.c except to put them into + * the utilityStmt field of a Query. This is eventually passed to + * ProcessUtility (by-passing rewriting and planning). Some of the + * statements do need attention from parse analysis, and this is + * done by routines in parser/parse_utilcmd.c after ProcessUtility + * receives the command for execution. + * DECLARE CURSOR, EXPLAIN, and CREATE TABLE AS are special cases: + * they contain optimizable statements, which get processed normally + * by parser/analyze.c. + *****************************************************************************/ + +/* + * When a command can act on several kinds of objects with only one + * parse structure required, use these constants to designate the + * object type. Note that commands typically don't support all the types. + */ + +typedef enum ObjectType +{ + OBJECT_ACCESS_METHOD, + OBJECT_AGGREGATE, + OBJECT_AMOP, + OBJECT_AMPROC, + OBJECT_ATTRIBUTE, /* type's attribute, when distinct from column */ + OBJECT_CAST, + OBJECT_COLUMN, + OBJECT_COLLATION, + OBJECT_CONVERSION, + OBJECT_DATABASE, + OBJECT_DEFAULT, + OBJECT_DEFACL, + OBJECT_DOMAIN, + OBJECT_DOMCONSTRAINT, + OBJECT_EVENT_TRIGGER, + OBJECT_EXTENSION, + OBJECT_FDW, + OBJECT_FOREIGN_SERVER, + OBJECT_FOREIGN_TABLE, + OBJECT_FUNCTION, + OBJECT_INDEX, + OBJECT_LANGUAGE, + OBJECT_LARGEOBJECT, + OBJECT_MATVIEW, + OBJECT_OPCLASS, + OBJECT_OPERATOR, + OBJECT_OPFAMILY, + OBJECT_PARAMETER_ACL, + OBJECT_POLICY, + OBJECT_PROCEDURE, + OBJECT_PUBLICATION, + OBJECT_PUBLICATION_NAMESPACE, + OBJECT_PUBLICATION_REL, + OBJECT_ROLE, + OBJECT_ROUTINE, + OBJECT_RULE, + OBJECT_SCHEMA, + OBJECT_SEQUENCE, + OBJECT_SUBSCRIPTION, + OBJECT_STATISTIC_EXT, + OBJECT_TABCONSTRAINT, + OBJECT_TABLE, + OBJECT_TABLESPACE, + OBJECT_TRANSFORM, + OBJECT_TRIGGER, + OBJECT_TSCONFIGURATION, + OBJECT_TSDICTIONARY, + OBJECT_TSPARSER, + OBJECT_TSTEMPLATE, + OBJECT_TYPE, + OBJECT_USER_MAPPING, + OBJECT_VIEW, +} ObjectType; + +/* ---------------------- + * Create Schema Statement + * + * NOTE: the schemaElts list contains raw parsetrees for component statements + * of the schema, such as CREATE TABLE, GRANT, etc. These are analyzed and + * executed after the schema itself is created. + * ---------------------- + */ +typedef struct CreateSchemaStmt +{ + NodeTag type; + char *schemaname; /* the name of the schema to create */ + RoleSpec *authrole; /* the owner of the created schema */ + List *schemaElts; /* schema components (list of parsenodes) */ + bool if_not_exists; /* just do nothing if schema already exists? */ +} CreateSchemaStmt; + +typedef enum DropBehavior +{ + DROP_RESTRICT, /* drop fails if any dependent objects */ + DROP_CASCADE, /* remove dependent objects too */ +} DropBehavior; + +/* ---------------------- + * Alter Table + * ---------------------- + */ +typedef struct AlterTableStmt +{ + NodeTag type; + RangeVar *relation; /* table to work on */ + List *cmds; /* list of subcommands */ + ObjectType objtype; /* type of object */ + bool missing_ok; /* skip error if table missing */ +} AlterTableStmt; + +typedef enum AlterTableType +{ + AT_AddColumn, /* add column */ + AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */ + AT_ColumnDefault, /* alter column default */ + AT_CookedColumnDefault, /* add a pre-cooked column default */ + AT_DropNotNull, /* alter column drop not null */ + AT_SetNotNull, /* alter column set not null */ + AT_SetExpression, /* alter column set expression */ + AT_DropExpression, /* alter column drop expression */ + AT_CheckNotNull, /* check column is already marked not null */ + AT_SetStatistics, /* alter column set statistics */ + AT_SetOptions, /* alter column set ( options ) */ + AT_ResetOptions, /* alter column reset ( options ) */ + AT_SetStorage, /* alter column set storage */ + AT_SetCompression, /* alter column set compression */ + AT_DropColumn, /* drop column */ + AT_AddIndex, /* add index */ + AT_ReAddIndex, /* internal to commands/tablecmds.c */ + AT_AddConstraint, /* add constraint */ + AT_ReAddConstraint, /* internal to commands/tablecmds.c */ + AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */ + AT_AlterConstraint, /* alter constraint */ + AT_ValidateConstraint, /* validate constraint */ + AT_AddIndexConstraint, /* add constraint using existing index */ + AT_DropConstraint, /* drop constraint */ + AT_ReAddComment, /* internal to commands/tablecmds.c */ + AT_AlterColumnType, /* alter column type */ + AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ + AT_ChangeOwner, /* change owner */ + AT_ClusterOn, /* CLUSTER ON */ + AT_DropCluster, /* SET WITHOUT CLUSTER */ + AT_SetLogged, /* SET LOGGED */ + AT_SetUnLogged, /* SET UNLOGGED */ + AT_DropOids, /* SET WITHOUT OIDS */ + AT_SetAccessMethod, /* SET ACCESS METHOD */ + AT_SetTableSpace, /* SET TABLESPACE */ + AT_SetRelOptions, /* SET (...) -- AM specific parameters */ + AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */ + AT_ReplaceRelOptions, /* replace reloption list in its entirety */ + AT_EnableTrig, /* ENABLE TRIGGER name */ + AT_EnableAlwaysTrig, /* ENABLE ALWAYS TRIGGER name */ + AT_EnableReplicaTrig, /* ENABLE REPLICA TRIGGER name */ + AT_DisableTrig, /* DISABLE TRIGGER name */ + AT_EnableTrigAll, /* ENABLE TRIGGER ALL */ + AT_DisableTrigAll, /* DISABLE TRIGGER ALL */ + AT_EnableTrigUser, /* ENABLE TRIGGER USER */ + AT_DisableTrigUser, /* DISABLE TRIGGER USER */ + AT_EnableRule, /* ENABLE RULE name */ + AT_EnableAlwaysRule, /* ENABLE ALWAYS RULE name */ + AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */ + AT_DisableRule, /* DISABLE RULE name */ + AT_AddInherit, /* INHERIT parent */ + AT_DropInherit, /* NO INHERIT parent */ + AT_AddOf, /* OF */ + AT_DropOf, /* NOT OF */ + AT_ReplicaIdentity, /* REPLICA IDENTITY */ + AT_EnableRowSecurity, /* ENABLE ROW SECURITY */ + AT_DisableRowSecurity, /* DISABLE ROW SECURITY */ + AT_ForceRowSecurity, /* FORCE ROW SECURITY */ + AT_NoForceRowSecurity, /* NO FORCE ROW SECURITY */ + AT_GenericOptions, /* OPTIONS (...) */ + AT_AttachPartition, /* ATTACH PARTITION */ + AT_DetachPartition, /* DETACH PARTITION */ + AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */ + AT_AddIdentity, /* ADD IDENTITY */ + AT_SetIdentity, /* SET identity column options */ + AT_DropIdentity, /* DROP IDENTITY */ + AT_ReAddStatistics, /* internal to commands/tablecmds.c */ +} AlterTableType; + +typedef struct ReplicaIdentityStmt +{ + NodeTag type; + char identity_type; + char *name; +} ReplicaIdentityStmt; + +typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ +{ + NodeTag type; + AlterTableType subtype; /* Type of table alteration to apply */ + char *name; /* column, constraint, or trigger to act on, + * or tablespace, access method */ + int16 num; /* attribute number for columns referenced by + * number */ + RoleSpec *newowner; + Node *def; /* definition of new column, index, + * constraint, or parent table */ + DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ + bool missing_ok; /* skip error if missing? */ + bool recurse; /* exec-time recursion */ +} AlterTableCmd; + + +/* ---------------------- + * Alter Collation + * ---------------------- + */ +typedef struct AlterCollationStmt +{ + NodeTag type; + List *collname; +} AlterCollationStmt; + + +/* ---------------------- + * Alter Domain + * + * The fields are used in different ways by the different variants of + * this command. + * ---------------------- + */ +typedef struct AlterDomainStmt +{ + NodeTag type; + char subtype; /*------------ + * T = alter column default + * N = alter column drop not null + * O = alter column set not null + * C = add constraint + * X = drop constraint + *------------ + */ + List *typeName; /* domain to work on */ + char *name; /* column or constraint name to act on */ + Node *def; /* definition of default or constraint */ + DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ + bool missing_ok; /* skip error if missing? */ +} AlterDomainStmt; + + +/* ---------------------- + * Grant|Revoke Statement + * ---------------------- + */ +typedef enum GrantTargetType +{ + ACL_TARGET_OBJECT, /* grant on specific named object(s) */ + ACL_TARGET_ALL_IN_SCHEMA, /* grant on all objects in given schema(s) */ + ACL_TARGET_DEFAULTS, /* ALTER DEFAULT PRIVILEGES */ +} GrantTargetType; + +typedef struct GrantStmt +{ + NodeTag type; + bool is_grant; /* true = GRANT, false = REVOKE */ + GrantTargetType targtype; /* type of the grant target */ + ObjectType objtype; /* kind of object being operated on */ + List *objects; /* list of RangeVar nodes, ObjectWithArgs + * nodes, or plain names (as String values) */ + List *privileges; /* list of AccessPriv nodes */ + /* privileges == NIL denotes ALL PRIVILEGES */ + List *grantees; /* list of RoleSpec nodes */ + bool grant_option; /* grant or revoke grant option */ + RoleSpec *grantor; + DropBehavior behavior; /* drop behavior (for REVOKE) */ +} GrantStmt; + +/* + * ObjectWithArgs represents a function/procedure/operator name plus parameter + * identification. + * + * objargs includes only the types of the input parameters of the object. + * In some contexts, that will be all we have, and it's enough to look up + * objects according to the traditional Postgres rules (i.e., when only input + * arguments matter). + * + * objfuncargs, if not NIL, carries the full specification of the parameter + * list, including parameter mode annotations. + * + * Some grammar productions can set args_unspecified = true instead of + * providing parameter info. In this case, lookup will succeed only if + * the object name is unique. Note that otherwise, NIL parameter lists + * mean zero arguments. + */ +typedef struct ObjectWithArgs +{ + NodeTag type; + List *objname; /* qualified name of function/operator */ + List *objargs; /* list of Typename nodes (input args only) */ + List *objfuncargs; /* list of FunctionParameter nodes */ + bool args_unspecified; /* argument list was omitted? */ +} ObjectWithArgs; + +/* + * An access privilege, with optional list of column names + * priv_name == NULL denotes ALL PRIVILEGES (only used with a column list) + * cols == NIL denotes "all columns" + * Note that simple "ALL PRIVILEGES" is represented as a NIL list, not + * an AccessPriv with both fields null. + */ +typedef struct AccessPriv +{ + NodeTag type; + char *priv_name; /* string name of privilege */ + List *cols; /* list of String */ +} AccessPriv; + +/* ---------------------- + * Grant/Revoke Role Statement + * + * Note: because of the parsing ambiguity with the GRANT + * statement, granted_roles is a list of AccessPriv; the execution code + * should complain if any column lists appear. grantee_roles is a list + * of role names, as String values. + * ---------------------- + */ +typedef struct GrantRoleStmt +{ + NodeTag type; + List *granted_roles; /* list of roles to be granted/revoked */ + List *grantee_roles; /* list of member roles to add/delete */ + bool is_grant; /* true = GRANT, false = REVOKE */ + List *opt; /* options e.g. WITH GRANT OPTION */ + RoleSpec *grantor; /* set grantor to other than current role */ + DropBehavior behavior; /* drop behavior (for REVOKE) */ +} GrantRoleStmt; + +/* ---------------------- + * Alter Default Privileges Statement + * ---------------------- + */ +typedef struct AlterDefaultPrivilegesStmt +{ + NodeTag type; + List *options; /* list of DefElem */ + GrantStmt *action; /* GRANT/REVOKE action (with objects=NIL) */ +} AlterDefaultPrivilegesStmt; + +/* ---------------------- + * Copy Statement + * + * We support "COPY relation FROM file", "COPY relation TO file", and + * "COPY (query) TO file". In any given CopyStmt, exactly one of "relation" + * and "query" must be non-NULL. + * ---------------------- + */ +typedef struct CopyStmt +{ + NodeTag type; + RangeVar *relation; /* the relation to copy */ + Node *query; /* the query (SELECT or DML statement with + * RETURNING) to copy, as a raw parse tree */ + List *attlist; /* List of column names (as Strings), or NIL + * for all columns */ + bool is_from; /* TO or FROM */ + bool is_program; /* is 'filename' a program to popen? */ + char *filename; /* filename, or NULL for STDIN/STDOUT */ + List *options; /* List of DefElem nodes */ + Node *whereClause; /* WHERE condition (or NULL) */ +} CopyStmt; + +/* ---------------------- + * SET Statement (includes RESET) + * + * "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we + * preserve the distinction in VariableSetKind for CreateCommandTag(). + * ---------------------- + */ +typedef enum VariableSetKind +{ + VAR_SET_VALUE, /* SET var = value */ + VAR_SET_DEFAULT, /* SET var TO DEFAULT */ + VAR_SET_CURRENT, /* SET var FROM CURRENT */ + VAR_SET_MULTI, /* special case for SET TRANSACTION ... */ + VAR_RESET, /* RESET var */ + VAR_RESET_ALL, /* RESET ALL */ +} VariableSetKind; + +typedef struct VariableSetStmt +{ + NodeTag type; + VariableSetKind kind; + char *name; /* variable to be set */ + List *args; /* List of A_Const nodes */ + bool is_local; /* SET LOCAL? */ +} VariableSetStmt; + +/* ---------------------- + * Show Statement + * ---------------------- + */ +typedef struct VariableShowStmt +{ + NodeTag type; + char *name; +} VariableShowStmt; + +/* ---------------------- + * Create Table Statement + * + * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are + * intermixed in tableElts, and constraints is NIL. After parse analysis, + * tableElts contains just ColumnDefs, and constraints contains just + * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present + * implementation). + * ---------------------- + */ + +typedef struct CreateStmt +{ + NodeTag type; + RangeVar *relation; /* relation to create */ + List *tableElts; /* column definitions (list of ColumnDef) */ + List *inhRelations; /* relations to inherit from (list of + * RangeVar) */ + PartitionBoundSpec *partbound; /* FOR VALUES clause */ + PartitionSpec *partspec; /* PARTITION BY clause */ + TypeName *ofTypename; /* OF typename */ + List *constraints; /* constraints (list of Constraint nodes) */ + List *options; /* options from WITH clause */ + OnCommitAction oncommit; /* what do we do at COMMIT? */ + char *tablespacename; /* table space to use, or NULL */ + char *accessMethod; /* table access method */ + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateStmt; + +/* ---------- + * Definitions for constraints in CreateStmt + * + * Note that column defaults are treated as a type of constraint, + * even though that's a bit odd semantically. + * + * For constraints that use expressions (CONSTR_CHECK, CONSTR_DEFAULT) + * we may have the expression in either "raw" form (an untransformed + * parse tree) or "cooked" form (the nodeToString representation of + * an executable expression tree), depending on how this Constraint + * node was created (by parsing, or by inheritance from an existing + * relation). We should never have both in the same node! + * + * FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype + * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are + * stored into pg_constraint.confmatchtype. Changing the code values may + * require an initdb! + * + * If skip_validation is true then we skip checking that the existing rows + * in the table satisfy the constraint, and just install the catalog entries + * for the constraint. A new FK constraint is marked as valid iff + * initially_valid is true. (Usually skip_validation and initially_valid + * are inverses, but we can set both true if the table is known empty.) + * + * Constraint attributes (DEFERRABLE etc) are initially represented as + * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes + * a pass through the constraints list to insert the info into the appropriate + * Constraint node. + * ---------- + */ + +typedef enum ConstrType /* types of constraints */ +{ + CONSTR_NULL, /* not standard SQL, but a lot of people + * expect it */ + CONSTR_NOTNULL, + CONSTR_DEFAULT, + CONSTR_IDENTITY, + CONSTR_GENERATED, + CONSTR_CHECK, + CONSTR_PRIMARY, + CONSTR_UNIQUE, + CONSTR_EXCLUSION, + CONSTR_FOREIGN, + CONSTR_ATTR_DEFERRABLE, /* attributes for previous constraint node */ + CONSTR_ATTR_NOT_DEFERRABLE, + CONSTR_ATTR_DEFERRED, + CONSTR_ATTR_IMMEDIATE, +} ConstrType; + +/* Foreign key action codes */ +#define FKCONSTR_ACTION_NOACTION 'a' +#define FKCONSTR_ACTION_RESTRICT 'r' +#define FKCONSTR_ACTION_CASCADE 'c' +#define FKCONSTR_ACTION_SETNULL 'n' +#define FKCONSTR_ACTION_SETDEFAULT 'd' + +/* Foreign key matchtype codes */ +#define FKCONSTR_MATCH_FULL 'f' +#define FKCONSTR_MATCH_PARTIAL 'p' +#define FKCONSTR_MATCH_SIMPLE 's' + +typedef struct Constraint +{ + NodeTag type; + ConstrType contype; /* see above */ + char *conname; /* Constraint name, or NULL if unnamed */ + bool deferrable; /* DEFERRABLE? */ + bool initdeferred; /* INITIALLY DEFERRED? */ + bool skip_validation; /* skip validation of existing rows? */ + bool initially_valid; /* mark the new constraint as valid? */ + bool is_no_inherit; /* is constraint non-inheritable? */ + Node *raw_expr; /* CHECK or DEFAULT expression, as + * untransformed parse tree */ + char *cooked_expr; /* CHECK or DEFAULT expression, as + * nodeToString representation */ + char generated_when; /* ALWAYS or BY DEFAULT */ + int inhcount; /* initial inheritance count to apply, for + * "raw" NOT NULL constraints */ + bool nulls_not_distinct; /* null treatment for UNIQUE constraints */ + List *keys; /* String nodes naming referenced key + * column(s); for UNIQUE/PK/NOT NULL */ + List *including; /* String nodes naming referenced nonkey + * column(s); for UNIQUE/PK */ + List *exclusions; /* list of (IndexElem, operator name) pairs; + * for exclusion constraints */ + List *options; /* options from WITH clause */ + char *indexname; /* existing index to use; otherwise NULL */ + char *indexspace; /* index tablespace; NULL for default */ + bool reset_default_tblspc; /* reset default_tablespace prior to + * creating the index */ + char *access_method; /* index access method; NULL for default */ + Node *where_clause; /* partial index predicate */ + + /* Fields used for FOREIGN KEY constraints: */ + RangeVar *pktable; /* Primary key table */ + List *fk_attrs; /* Attributes of foreign key */ + List *pk_attrs; /* Corresponding attrs in PK table */ + char fk_matchtype; /* FULL, PARTIAL, SIMPLE */ + char fk_upd_action; /* ON UPDATE action */ + char fk_del_action; /* ON DELETE action */ + List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */ + List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */ + Oid old_pktable_oid; /* pg_constraint.confrelid of my former + * self */ + + ParseLoc location; /* token location, or -1 if unknown */ +} Constraint; + +/* ---------------------- + * Create/Drop Table Space Statements + * ---------------------- + */ + +typedef struct CreateTableSpaceStmt +{ + NodeTag type; + char *tablespacename; + RoleSpec *owner; + char *location; + List *options; +} CreateTableSpaceStmt; + +typedef struct DropTableSpaceStmt +{ + NodeTag type; + char *tablespacename; + bool missing_ok; /* skip error if missing? */ +} DropTableSpaceStmt; + +typedef struct AlterTableSpaceOptionsStmt +{ + NodeTag type; + char *tablespacename; + List *options; + bool isReset; +} AlterTableSpaceOptionsStmt; + +typedef struct AlterTableMoveAllStmt +{ + NodeTag type; + char *orig_tablespacename; + ObjectType objtype; /* Object type to move */ + List *roles; /* List of roles to move objects of */ + char *new_tablespacename; + bool nowait; +} AlterTableMoveAllStmt; + +/* ---------------------- + * Create/Alter Extension Statements + * ---------------------- + */ + +typedef struct CreateExtensionStmt +{ + NodeTag type; + char *extname; + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* List of DefElem nodes */ +} CreateExtensionStmt; + +/* Only used for ALTER EXTENSION UPDATE; later might need an action field */ +typedef struct AlterExtensionStmt +{ + NodeTag type; + char *extname; + List *options; /* List of DefElem nodes */ +} AlterExtensionStmt; + +typedef struct AlterExtensionContentsStmt +{ + NodeTag type; + char *extname; /* Extension's name */ + int action; /* +1 = add object, -1 = drop object */ + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ +} AlterExtensionContentsStmt; + +/* ---------------------- + * Create/Alter FOREIGN DATA WRAPPER Statements + * ---------------------- + */ + +typedef struct CreateFdwStmt +{ + NodeTag type; + char *fdwname; /* foreign-data wrapper name */ + List *func_options; /* HANDLER/VALIDATOR options */ + List *options; /* generic options to FDW */ +} CreateFdwStmt; + +typedef struct AlterFdwStmt +{ + NodeTag type; + char *fdwname; /* foreign-data wrapper name */ + List *func_options; /* HANDLER/VALIDATOR options */ + List *options; /* generic options to FDW */ +} AlterFdwStmt; + +/* ---------------------- + * Create/Alter FOREIGN SERVER Statements + * ---------------------- + */ + +typedef struct CreateForeignServerStmt +{ + NodeTag type; + char *servername; /* server name */ + char *servertype; /* optional server type */ + char *version; /* optional server version */ + char *fdwname; /* FDW name */ + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* generic options to server */ +} CreateForeignServerStmt; + +typedef struct AlterForeignServerStmt +{ + NodeTag type; + char *servername; /* server name */ + char *version; /* optional server version */ + List *options; /* generic options to server */ + bool has_version; /* version specified */ +} AlterForeignServerStmt; + +/* ---------------------- + * Create FOREIGN TABLE Statement + * ---------------------- + */ + +typedef struct CreateForeignTableStmt +{ + CreateStmt base; + char *servername; + List *options; +} CreateForeignTableStmt; + +/* ---------------------- + * Create/Drop USER MAPPING Statements + * ---------------------- + */ + +typedef struct CreateUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + bool if_not_exists; /* just do nothing if it already exists? */ + List *options; /* generic options to server */ +} CreateUserMappingStmt; + +typedef struct AlterUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + List *options; /* generic options to server */ +} AlterUserMappingStmt; + +typedef struct DropUserMappingStmt +{ + NodeTag type; + RoleSpec *user; /* user role */ + char *servername; /* server name */ + bool missing_ok; /* ignore missing mappings */ +} DropUserMappingStmt; + +/* ---------------------- + * Import Foreign Schema Statement + * ---------------------- + */ + +typedef enum ImportForeignSchemaType +{ + FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */ + FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */ + FDW_IMPORT_SCHEMA_EXCEPT, /* exclude listed tables from import */ +} ImportForeignSchemaType; + +typedef struct ImportForeignSchemaStmt +{ + NodeTag type; + char *server_name; /* FDW server name */ + char *remote_schema; /* remote schema name to query */ + char *local_schema; /* local schema to create objects in */ + ImportForeignSchemaType list_type; /* type of table list */ + List *table_list; /* List of RangeVar */ + List *options; /* list of options to pass to FDW */ +} ImportForeignSchemaStmt; + +/*---------------------- + * Create POLICY Statement + *---------------------- + */ +typedef struct CreatePolicyStmt +{ + NodeTag type; + char *policy_name; /* Policy's name */ + RangeVar *table; /* the table name the policy applies to */ + char *cmd_name; /* the command name the policy applies to */ + bool permissive; /* restrictive or permissive policy */ + List *roles; /* the roles associated with the policy */ + Node *qual; /* the policy's condition */ + Node *with_check; /* the policy's WITH CHECK condition. */ +} CreatePolicyStmt; + +/*---------------------- + * Alter POLICY Statement + *---------------------- + */ +typedef struct AlterPolicyStmt +{ + NodeTag type; + char *policy_name; /* Policy's name */ + RangeVar *table; /* the table name the policy applies to */ + List *roles; /* the roles associated with the policy */ + Node *qual; /* the policy's condition */ + Node *with_check; /* the policy's WITH CHECK condition. */ +} AlterPolicyStmt; + +/*---------------------- + * Create ACCESS METHOD Statement + *---------------------- + */ +typedef struct CreateAmStmt +{ + NodeTag type; + char *amname; /* access method name */ + List *handler_name; /* handler function name */ + char amtype; /* type of access method */ +} CreateAmStmt; + +/* ---------------------- + * Create TRIGGER Statement + * ---------------------- + */ +typedef struct CreateTrigStmt +{ + NodeTag type; + bool replace; /* replace trigger if already exists */ + bool isconstraint; /* This is a constraint trigger */ + char *trigname; /* TRIGGER's name */ + RangeVar *relation; /* relation trigger is on */ + List *funcname; /* qual. name of function to call */ + List *args; /* list of String or NIL */ + bool row; /* ROW/STATEMENT */ + /* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ + int16 timing; /* BEFORE, AFTER, or INSTEAD */ + /* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */ + int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */ + List *columns; /* column names, or NIL for all columns */ + Node *whenClause; /* qual expression, or NULL if none */ + /* explicitly named transition data */ + List *transitionRels; /* TriggerTransition nodes, or NIL if none */ + /* The remaining fields are only used for constraint triggers */ + bool deferrable; /* [NOT] DEFERRABLE */ + bool initdeferred; /* INITIALLY {DEFERRED|IMMEDIATE} */ + RangeVar *constrrel; /* opposite relation, if RI trigger */ +} CreateTrigStmt; + +/* ---------------------- + * Create EVENT TRIGGER Statement + * ---------------------- + */ +typedef struct CreateEventTrigStmt +{ + NodeTag type; + char *trigname; /* TRIGGER's name */ + char *eventname; /* event's identifier */ + List *whenclause; /* list of DefElems indicating filtering */ + List *funcname; /* qual. name of function to call */ +} CreateEventTrigStmt; + +/* ---------------------- + * Alter EVENT TRIGGER Statement + * ---------------------- + */ +typedef struct AlterEventTrigStmt +{ + NodeTag type; + char *trigname; /* TRIGGER's name */ + char tgenabled; /* trigger's firing configuration WRT + * session_replication_role */ +} AlterEventTrigStmt; + +/* ---------------------- + * Create LANGUAGE Statements + * ---------------------- + */ +typedef struct CreatePLangStmt +{ + NodeTag type; + bool replace; /* T => replace if already exists */ + char *plname; /* PL name */ + List *plhandler; /* PL call handler function (qual. name) */ + List *plinline; /* optional inline function (qual. name) */ + List *plvalidator; /* optional validator function (qual. name) */ + bool pltrusted; /* PL is trusted */ +} CreatePLangStmt; + +/* ---------------------- + * Create/Alter/Drop Role Statements + * + * Note: these node types are also used for the backwards-compatible + * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases + * there's really no need to distinguish what the original spelling was, + * but for CREATE we mark the type because the defaults vary. + * ---------------------- + */ +typedef enum RoleStmtType +{ + ROLESTMT_ROLE, + ROLESTMT_USER, + ROLESTMT_GROUP, +} RoleStmtType; + +typedef struct CreateRoleStmt +{ + NodeTag type; + RoleStmtType stmt_type; /* ROLE/USER/GROUP */ + char *role; /* role name */ + List *options; /* List of DefElem nodes */ +} CreateRoleStmt; + +typedef struct AlterRoleStmt +{ + NodeTag type; + RoleSpec *role; /* role */ + List *options; /* List of DefElem nodes */ + int action; /* +1 = add members, -1 = drop members */ +} AlterRoleStmt; + +typedef struct AlterRoleSetStmt +{ + NodeTag type; + RoleSpec *role; /* role */ + char *database; /* database name, or NULL */ + VariableSetStmt *setstmt; /* SET or RESET subcommand */ +} AlterRoleSetStmt; + +typedef struct DropRoleStmt +{ + NodeTag type; + List *roles; /* List of roles to remove */ + bool missing_ok; /* skip error if a role is missing? */ +} DropRoleStmt; + +/* ---------------------- + * {Create|Alter} SEQUENCE Statement + * ---------------------- + */ + +typedef struct CreateSeqStmt +{ + NodeTag type; + RangeVar *sequence; /* the sequence to create */ + List *options; + Oid ownerId; /* ID of owner, or InvalidOid for default */ + bool for_identity; + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateSeqStmt; + +typedef struct AlterSeqStmt +{ + NodeTag type; + RangeVar *sequence; /* the sequence to alter */ + List *options; + bool for_identity; + bool missing_ok; /* skip error if a role is missing? */ +} AlterSeqStmt; + +/* ---------------------- + * Create {Aggregate|Operator|Type} Statement + * ---------------------- + */ +typedef struct DefineStmt +{ + NodeTag type; + ObjectType kind; /* aggregate, operator, type */ + bool oldstyle; /* hack to signal old CREATE AGG syntax */ + List *defnames; /* qualified name (list of String) */ + List *args; /* a list of TypeName (if needed) */ + List *definition; /* a list of DefElem */ + bool if_not_exists; /* just do nothing if it already exists? */ + bool replace; /* replace if already exists? */ +} DefineStmt; + +/* ---------------------- + * Create Domain Statement + * ---------------------- + */ +typedef struct CreateDomainStmt +{ + NodeTag type; + List *domainname; /* qualified name (list of String) */ + TypeName *typeName; /* the base type */ + CollateClause *collClause; /* untransformed COLLATE spec, if any */ + List *constraints; /* constraints (list of Constraint nodes) */ +} CreateDomainStmt; + +/* ---------------------- + * Create Operator Class Statement + * ---------------------- + */ +typedef struct CreateOpClassStmt +{ + NodeTag type; + List *opclassname; /* qualified name (list of String) */ + List *opfamilyname; /* qualified name (ditto); NIL if omitted */ + char *amname; /* name of index AM opclass is for */ + TypeName *datatype; /* datatype of indexed column */ + List *items; /* List of CreateOpClassItem nodes */ + bool isDefault; /* Should be marked as default for type? */ +} CreateOpClassStmt; + +#define OPCLASS_ITEM_OPERATOR 1 +#define OPCLASS_ITEM_FUNCTION 2 +#define OPCLASS_ITEM_STORAGETYPE 3 + +typedef struct CreateOpClassItem +{ + NodeTag type; + int itemtype; /* see codes above */ + ObjectWithArgs *name; /* operator or function name and args */ + int number; /* strategy num or support proc num */ + List *order_family; /* only used for ordering operators */ + List *class_args; /* amproclefttype/amprocrighttype or + * amoplefttype/amoprighttype */ + /* fields used for a storagetype item: */ + TypeName *storedtype; /* datatype stored in index */ +} CreateOpClassItem; + +/* ---------------------- + * Create Operator Family Statement + * ---------------------- + */ +typedef struct CreateOpFamilyStmt +{ + NodeTag type; + List *opfamilyname; /* qualified name (list of String) */ + char *amname; /* name of index AM opfamily is for */ +} CreateOpFamilyStmt; + +/* ---------------------- + * Alter Operator Family Statement + * ---------------------- + */ +typedef struct AlterOpFamilyStmt +{ + NodeTag type; + List *opfamilyname; /* qualified name (list of String) */ + char *amname; /* name of index AM opfamily is for */ + bool isDrop; /* ADD or DROP the items? */ + List *items; /* List of CreateOpClassItem nodes */ +} AlterOpFamilyStmt; + +/* ---------------------- + * Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement + * ---------------------- + */ + +typedef struct DropStmt +{ + NodeTag type; + List *objects; /* list of names */ + ObjectType removeType; /* object type */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ + bool missing_ok; /* skip error if object is missing? */ + bool concurrent; /* drop index concurrently? */ +} DropStmt; + +/* ---------------------- + * Truncate Table Statement + * ---------------------- + */ +typedef struct TruncateStmt +{ + NodeTag type; + List *relations; /* relations (RangeVars) to be truncated */ + bool restart_seqs; /* restart owned sequences? */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ +} TruncateStmt; + +/* ---------------------- + * Comment On Statement + * ---------------------- + */ +typedef struct CommentStmt +{ + NodeTag type; + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ + char *comment; /* Comment to insert, or NULL to remove */ +} CommentStmt; + +/* ---------------------- + * SECURITY LABEL Statement + * ---------------------- + */ +typedef struct SecLabelStmt +{ + NodeTag type; + ObjectType objtype; /* Object's type */ + Node *object; /* Qualified name of the object */ + char *provider; /* Label provider (or NULL) */ + char *label; /* New security label to be assigned */ +} SecLabelStmt; + +/* ---------------------- + * Declare Cursor Statement + * + * The "query" field is initially a raw parse tree, and is converted to a + * Query node during parse analysis. Note that rewriting and planning + * of the query are always postponed until execution. + * ---------------------- + */ +#define CURSOR_OPT_BINARY 0x0001 /* BINARY */ +#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */ +#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */ +#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */ +#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */ +#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */ +/* these planner-control flags do not correspond to any SQL grammar: */ +#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */ +#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */ +#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */ +#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */ + +typedef struct DeclareCursorStmt +{ + NodeTag type; + char *portalname; /* name of the portal (cursor) */ + int options; /* bitmask of options (see above) */ + Node *query; /* the query (see comments above) */ +} DeclareCursorStmt; + +/* ---------------------- + * Close Portal Statement + * ---------------------- + */ +typedef struct ClosePortalStmt +{ + NodeTag type; + char *portalname; /* name of the portal (cursor) */ + /* NULL means CLOSE ALL */ +} ClosePortalStmt; + +/* ---------------------- + * Fetch Statement (also Move) + * ---------------------- + */ +typedef enum FetchDirection +{ + /* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */ + FETCH_FORWARD, + FETCH_BACKWARD, + /* for these, howMany indicates a position; only one row is fetched */ + FETCH_ABSOLUTE, + FETCH_RELATIVE, +} FetchDirection; + +#define FETCH_ALL LONG_MAX + +typedef struct FetchStmt +{ + NodeTag type; + FetchDirection direction; /* see above */ + long howMany; /* number of rows, or position argument */ + char *portalname; /* name of portal (cursor) */ + bool ismove; /* true if MOVE */ +} FetchStmt; + +/* ---------------------- + * Create Index Statement + * + * This represents creation of an index and/or an associated constraint. + * If isconstraint is true, we should create a pg_constraint entry along + * with the index. But if indexOid isn't InvalidOid, we are not creating an + * index, just a UNIQUE/PKEY constraint using an existing index. isconstraint + * must always be true in this case, and the fields describing the index + * properties are empty. + * ---------------------- + */ +typedef struct IndexStmt +{ + NodeTag type; + char *idxname; /* name of new index, or NULL for default */ + RangeVar *relation; /* relation to build index on */ + char *accessMethod; /* name of access method (eg. btree) */ + char *tableSpace; /* tablespace, or NULL for default */ + List *indexParams; /* columns to index: a list of IndexElem */ + List *indexIncludingParams; /* additional columns to index: a list + * of IndexElem */ + List *options; /* WITH clause options: a list of DefElem */ + Node *whereClause; /* qualification (partial-index predicate) */ + List *excludeOpNames; /* exclusion operator names, or NIL if none */ + char *idxcomment; /* comment to apply to index, or NULL */ + Oid indexOid; /* OID of an existing index, if any */ + RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */ + SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */ + SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid + * of oldNumber */ + bool unique; /* is index unique? */ + bool nulls_not_distinct; /* null treatment for UNIQUE constraints */ + bool primary; /* is index a primary key? */ + bool isconstraint; /* is it for a pkey/unique constraint? */ + bool deferrable; /* is the constraint DEFERRABLE? */ + bool initdeferred; /* is the constraint INITIALLY DEFERRED? */ + bool transformed; /* true when transformIndexStmt is finished */ + bool concurrent; /* should this be a concurrent index build? */ + bool if_not_exists; /* just do nothing if index already exists? */ + bool reset_default_tblspc; /* reset default_tablespace prior to + * executing */ +} IndexStmt; + +/* ---------------------- + * Create Statistics Statement + * ---------------------- + */ +typedef struct CreateStatsStmt +{ + NodeTag type; + List *defnames; /* qualified name (list of String) */ + List *stat_types; /* stat types (list of String) */ + List *exprs; /* expressions to build statistics on */ + List *relations; /* rels to build stats on (list of RangeVar) */ + char *stxcomment; /* comment to apply to stats, or NULL */ + bool transformed; /* true when transformStatsStmt is finished */ + bool if_not_exists; /* do nothing if stats name already exists */ +} CreateStatsStmt; + +/* + * StatsElem - statistics parameters (used in CREATE STATISTICS) + * + * For a plain attribute, 'name' is the name of the referenced table column + * and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the + * expression tree. + */ +typedef struct StatsElem +{ + NodeTag type; + char *name; /* name of attribute to index, or NULL */ + Node *expr; /* expression to index, or NULL */ +} StatsElem; + + +/* ---------------------- + * Alter Statistics Statement + * ---------------------- + */ +typedef struct AlterStatsStmt +{ + NodeTag type; + List *defnames; /* qualified name (list of String) */ + Node *stxstattarget; /* statistics target */ + bool missing_ok; /* skip error if statistics object is missing */ +} AlterStatsStmt; + +/* ---------------------- + * Create Function Statement + * ---------------------- + */ +typedef struct CreateFunctionStmt +{ + NodeTag type; + bool is_procedure; /* it's really CREATE PROCEDURE */ + bool replace; /* T => replace if already exists */ + List *funcname; /* qualified name of function to create */ + List *parameters; /* a list of FunctionParameter */ + TypeName *returnType; /* the return type */ + List *options; /* a list of DefElem */ + Node *sql_body; +} CreateFunctionStmt; + +typedef enum FunctionParameterMode +{ + /* the assigned enum values appear in pg_proc, don't change 'em! */ + FUNC_PARAM_IN = 'i', /* input only */ + FUNC_PARAM_OUT = 'o', /* output only */ + FUNC_PARAM_INOUT = 'b', /* both */ + FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */ + FUNC_PARAM_TABLE = 't', /* table function output column */ + /* this is not used in pg_proc: */ + FUNC_PARAM_DEFAULT = 'd', /* default; effectively same as IN */ +} FunctionParameterMode; + +typedef struct FunctionParameter +{ + NodeTag type; + char *name; /* parameter name, or NULL if not given */ + TypeName *argType; /* TypeName for parameter type */ + FunctionParameterMode mode; /* IN/OUT/etc */ + Node *defexpr; /* raw default expr, or NULL if not given */ +} FunctionParameter; + +typedef struct AlterFunctionStmt +{ + NodeTag type; + ObjectType objtype; + ObjectWithArgs *func; /* name and args of function */ + List *actions; /* list of DefElem */ +} AlterFunctionStmt; + +/* ---------------------- + * DO Statement + * + * DoStmt is the raw parser output, InlineCodeBlock is the execution-time API + * ---------------------- + */ +typedef struct DoStmt +{ + NodeTag type; + List *args; /* List of DefElem nodes */ +} DoStmt; + +typedef struct InlineCodeBlock +{ + pg_node_attr(nodetag_only) /* this is not a member of parse trees */ + + NodeTag type; + char *source_text; /* source text of anonymous code block */ + Oid langOid; /* OID of selected language */ + bool langIsTrusted; /* trusted property of the language */ + bool atomic; /* atomic execution context */ +} InlineCodeBlock; + +/* ---------------------- + * CALL statement + * + * OUT-mode arguments are removed from the transformed funcexpr. The outargs + * list contains copies of the expressions for all output arguments, in the + * order of the procedure's declared arguments. (outargs is never evaluated, + * but is useful to the caller as a reference for what to assign to.) + * The transformed call state is not relevant in the query jumbling, only the + * function call is. + * ---------------------- + */ +typedef struct CallStmt +{ + NodeTag type; + /* from the parser */ + FuncCall *funccall pg_node_attr(query_jumble_ignore); + /* transformed call, with only input args */ + FuncExpr *funcexpr; + /* transformed output-argument expressions */ + List *outargs; +} CallStmt; + +typedef struct CallContext +{ + pg_node_attr(nodetag_only) /* this is not a member of parse trees */ + + NodeTag type; + bool atomic; +} CallContext; + +/* ---------------------- + * Alter Object Rename Statement + * ---------------------- + */ +typedef struct RenameStmt +{ + NodeTag type; + ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */ + ObjectType relationType; /* if column name, associated relation type */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + char *subname; /* name of contained object (column, rule, + * trigger, etc) */ + char *newname; /* the new name */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ + bool missing_ok; /* skip error if missing? */ +} RenameStmt; + +/* ---------------------- + * ALTER object DEPENDS ON EXTENSION extname + * ---------------------- + */ +typedef struct AlterObjectDependsStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */ + RangeVar *relation; /* in case a table is involved */ + Node *object; /* name of the object */ + String *extname; /* extension name */ + bool remove; /* set true to remove dep rather than add */ +} AlterObjectDependsStmt; + +/* ---------------------- + * ALTER object SET SCHEMA Statement + * ---------------------- + */ +typedef struct AlterObjectSchemaStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + char *newschema; /* the new schema */ + bool missing_ok; /* skip error if missing? */ +} AlterObjectSchemaStmt; + +/* ---------------------- + * Alter Object Owner Statement + * ---------------------- + */ +typedef struct AlterOwnerStmt +{ + NodeTag type; + ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ + RangeVar *relation; /* in case it's a table */ + Node *object; /* in case it's some other object */ + RoleSpec *newowner; /* the new owner */ +} AlterOwnerStmt; + +/* ---------------------- + * Alter Operator Set ( this-n-that ) + * ---------------------- + */ +typedef struct AlterOperatorStmt +{ + NodeTag type; + ObjectWithArgs *opername; /* operator name and argument types */ + List *options; /* List of DefElem nodes */ +} AlterOperatorStmt; + +/* ------------------------ + * Alter Type Set ( this-n-that ) + * ------------------------ + */ +typedef struct AlterTypeStmt +{ + NodeTag type; + List *typeName; /* type name (possibly qualified) */ + List *options; /* List of DefElem nodes */ +} AlterTypeStmt; + +/* ---------------------- + * Create Rule Statement + * ---------------------- + */ +typedef struct RuleStmt +{ + NodeTag type; + RangeVar *relation; /* relation the rule is for */ + char *rulename; /* name of the rule */ + Node *whereClause; /* qualifications */ + CmdType event; /* SELECT, INSERT, etc */ + bool instead; /* is a 'do instead'? */ + List *actions; /* the action statements */ + bool replace; /* OR REPLACE */ +} RuleStmt; + +/* ---------------------- + * Notify Statement + * ---------------------- + */ +typedef struct NotifyStmt +{ + NodeTag type; + char *conditionname; /* condition name to notify */ + char *payload; /* the payload string, or NULL if none */ +} NotifyStmt; + +/* ---------------------- + * Listen Statement + * ---------------------- + */ +typedef struct ListenStmt +{ + NodeTag type; + char *conditionname; /* condition name to listen on */ +} ListenStmt; + +/* ---------------------- + * Unlisten Statement + * ---------------------- + */ +typedef struct UnlistenStmt +{ + NodeTag type; + char *conditionname; /* name to unlisten on, or NULL for all */ +} UnlistenStmt; + +/* ---------------------- + * {Begin|Commit|Rollback} Transaction Statement + * ---------------------- + */ +typedef enum TransactionStmtKind +{ + TRANS_STMT_BEGIN, + TRANS_STMT_START, /* semantically identical to BEGIN */ + TRANS_STMT_COMMIT, + TRANS_STMT_ROLLBACK, + TRANS_STMT_SAVEPOINT, + TRANS_STMT_RELEASE, + TRANS_STMT_ROLLBACK_TO, + TRANS_STMT_PREPARE, + TRANS_STMT_COMMIT_PREPARED, + TRANS_STMT_ROLLBACK_PREPARED, +} TransactionStmtKind; + +typedef struct TransactionStmt +{ + NodeTag type; + TransactionStmtKind kind; /* see above */ + List *options; /* for BEGIN/START commands */ + /* for savepoint commands */ + char *savepoint_name pg_node_attr(query_jumble_ignore); + /* for two-phase-commit related commands */ + char *gid pg_node_attr(query_jumble_ignore); + bool chain; /* AND CHAIN option */ + /* token location, or -1 if unknown */ + ParseLoc location pg_node_attr(query_jumble_location); +} TransactionStmt; + +/* ---------------------- + * Create Type Statement, composite types + * ---------------------- + */ +typedef struct CompositeTypeStmt +{ + NodeTag type; + RangeVar *typevar; /* the composite type to be created */ + List *coldeflist; /* list of ColumnDef nodes */ +} CompositeTypeStmt; + +/* ---------------------- + * Create Type Statement, enum types + * ---------------------- + */ +typedef struct CreateEnumStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + List *vals; /* enum values (list of String) */ +} CreateEnumStmt; + +/* ---------------------- + * Create Type Statement, range types + * ---------------------- + */ +typedef struct CreateRangeStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + List *params; /* range parameters (list of DefElem) */ +} CreateRangeStmt; + +/* ---------------------- + * Alter Type Statement, enum types + * ---------------------- + */ +typedef struct AlterEnumStmt +{ + NodeTag type; + List *typeName; /* qualified name (list of String) */ + char *oldVal; /* old enum value's name, if renaming */ + char *newVal; /* new enum value's name */ + char *newValNeighbor; /* neighboring enum value, if specified */ + bool newValIsAfter; /* place new enum value after neighbor? */ + bool skipIfNewValExists; /* no error if new already exists? */ +} AlterEnumStmt; + +/* ---------------------- + * Create View Statement + * ---------------------- + */ +typedef enum ViewCheckOption +{ + NO_CHECK_OPTION, + LOCAL_CHECK_OPTION, + CASCADED_CHECK_OPTION, +} ViewCheckOption; + +typedef struct ViewStmt +{ + NodeTag type; + RangeVar *view; /* the view to be created */ + List *aliases; /* target column names */ + Node *query; /* the SELECT query (as a raw parse tree) */ + bool replace; /* replace an existing view? */ + List *options; /* options from WITH clause */ + ViewCheckOption withCheckOption; /* WITH CHECK OPTION */ +} ViewStmt; + +/* ---------------------- + * Load Statement + * ---------------------- + */ +typedef struct LoadStmt +{ + NodeTag type; + char *filename; /* file to load */ +} LoadStmt; + +/* ---------------------- + * Createdb Statement + * ---------------------- + */ +typedef struct CreatedbStmt +{ + NodeTag type; + char *dbname; /* name of database to create */ + List *options; /* List of DefElem nodes */ +} CreatedbStmt; + +/* ---------------------- + * Alter Database + * ---------------------- + */ +typedef struct AlterDatabaseStmt +{ + NodeTag type; + char *dbname; /* name of database to alter */ + List *options; /* List of DefElem nodes */ +} AlterDatabaseStmt; + +typedef struct AlterDatabaseRefreshCollStmt +{ + NodeTag type; + char *dbname; +} AlterDatabaseRefreshCollStmt; + +typedef struct AlterDatabaseSetStmt +{ + NodeTag type; + char *dbname; /* database name */ + VariableSetStmt *setstmt; /* SET or RESET subcommand */ +} AlterDatabaseSetStmt; + +/* ---------------------- + * Dropdb Statement + * ---------------------- + */ +typedef struct DropdbStmt +{ + NodeTag type; + char *dbname; /* database to drop */ + bool missing_ok; /* skip error if db is missing? */ + List *options; /* currently only FORCE is supported */ +} DropdbStmt; + +/* ---------------------- + * Alter System Statement + * ---------------------- + */ +typedef struct AlterSystemStmt +{ + NodeTag type; + VariableSetStmt *setstmt; /* SET subcommand */ +} AlterSystemStmt; + +/* ---------------------- + * Cluster Statement (support pbrown's cluster index implementation) + * ---------------------- + */ +typedef struct ClusterStmt +{ + NodeTag type; + RangeVar *relation; /* relation being indexed, or NULL if all */ + char *indexname; /* original index defined */ + List *params; /* list of DefElem nodes */ +} ClusterStmt; + +/* ---------------------- + * Vacuum and Analyze Statements + * + * Even though these are nominally two statements, it's convenient to use + * just one node type for both. + * ---------------------- + */ +typedef struct VacuumStmt +{ + NodeTag type; + List *options; /* list of DefElem nodes */ + List *rels; /* list of VacuumRelation, or NIL for all */ + bool is_vacuumcmd; /* true for VACUUM, false for ANALYZE */ +} VacuumStmt; + +/* + * Info about a single target table of VACUUM/ANALYZE. + * + * If the OID field is set, it always identifies the table to process. + * Then the relation field can be NULL; if it isn't, it's used only to report + * failure to open/lock the relation. + */ +typedef struct VacuumRelation +{ + NodeTag type; + RangeVar *relation; /* table name to process, or NULL */ + Oid oid; /* table's OID; InvalidOid if not looked up */ + List *va_cols; /* list of column names, or NIL for all */ +} VacuumRelation; + +/* ---------------------- + * Explain Statement + * + * The "query" field is initially a raw parse tree, and is converted to a + * Query node during parse analysis. Note that rewriting and planning + * of the query are always postponed until execution. + * ---------------------- + */ +typedef struct ExplainStmt +{ + NodeTag type; + Node *query; /* the query (see comments above) */ + List *options; /* list of DefElem nodes */ +} ExplainStmt; + +/* ---------------------- + * CREATE TABLE AS Statement (a/k/a SELECT INTO) + * + * A query written as CREATE TABLE AS will produce this node type natively. + * A query written as SELECT ... INTO will be transformed to this form during + * parse analysis. + * A query written as CREATE MATERIALIZED view will produce this node type, + * during parse analysis, since it needs all the same data. + * + * The "query" field is handled similarly to EXPLAIN, though note that it + * can be a SELECT or an EXECUTE, but not other DML statements. + * ---------------------- + */ +typedef struct CreateTableAsStmt +{ + NodeTag type; + Node *query; /* the query (see comments above) */ + IntoClause *into; /* destination table */ + ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */ + bool is_select_into; /* it was written as SELECT INTO */ + bool if_not_exists; /* just do nothing if it already exists? */ +} CreateTableAsStmt; + +/* ---------------------- + * REFRESH MATERIALIZED VIEW Statement + * ---------------------- + */ +typedef struct RefreshMatViewStmt +{ + NodeTag type; + bool concurrent; /* allow concurrent access? */ + bool skipData; /* true for WITH NO DATA */ + RangeVar *relation; /* relation to insert into */ +} RefreshMatViewStmt; + +/* ---------------------- + * Checkpoint Statement + * ---------------------- + */ +typedef struct CheckPointStmt +{ + NodeTag type; +} CheckPointStmt; + +/* ---------------------- + * Discard Statement + * ---------------------- + */ + +typedef enum DiscardMode +{ + DISCARD_ALL, + DISCARD_PLANS, + DISCARD_SEQUENCES, + DISCARD_TEMP, +} DiscardMode; + +typedef struct DiscardStmt +{ + NodeTag type; + DiscardMode target; +} DiscardStmt; + +/* ---------------------- + * LOCK Statement + * ---------------------- + */ +typedef struct LockStmt +{ + NodeTag type; + List *relations; /* relations to lock */ + int mode; /* lock mode */ + bool nowait; /* no wait mode */ +} LockStmt; + +/* ---------------------- + * SET CONSTRAINTS Statement + * ---------------------- + */ +typedef struct ConstraintsSetStmt +{ + NodeTag type; + List *constraints; /* List of names as RangeVars */ + bool deferred; +} ConstraintsSetStmt; + +/* ---------------------- + * REINDEX Statement + * ---------------------- + */ +typedef enum ReindexObjectType +{ + REINDEX_OBJECT_INDEX, /* index */ + REINDEX_OBJECT_TABLE, /* table or materialized view */ + REINDEX_OBJECT_SCHEMA, /* schema */ + REINDEX_OBJECT_SYSTEM, /* system catalogs */ + REINDEX_OBJECT_DATABASE, /* database */ +} ReindexObjectType; + +typedef struct ReindexStmt +{ + NodeTag type; + ReindexObjectType kind; /* REINDEX_OBJECT_INDEX, REINDEX_OBJECT_TABLE, + * etc. */ + RangeVar *relation; /* Table or index to reindex */ + const char *name; /* name of database to reindex */ + List *params; /* list of DefElem nodes */ +} ReindexStmt; + +/* ---------------------- + * CREATE CONVERSION Statement + * ---------------------- + */ +typedef struct CreateConversionStmt +{ + NodeTag type; + List *conversion_name; /* Name of the conversion */ + char *for_encoding_name; /* source encoding name */ + char *to_encoding_name; /* destination encoding name */ + List *func_name; /* qualified conversion function name */ + bool def; /* is this a default conversion? */ +} CreateConversionStmt; + +/* ---------------------- + * CREATE CAST Statement + * ---------------------- + */ +typedef struct CreateCastStmt +{ + NodeTag type; + TypeName *sourcetype; + TypeName *targettype; + ObjectWithArgs *func; + CoercionContext context; + bool inout; +} CreateCastStmt; + +/* ---------------------- + * CREATE TRANSFORM Statement + * ---------------------- + */ +typedef struct CreateTransformStmt +{ + NodeTag type; + bool replace; + TypeName *type_name; + char *lang; + ObjectWithArgs *fromsql; + ObjectWithArgs *tosql; +} CreateTransformStmt; + +/* ---------------------- + * PREPARE Statement + * ---------------------- + */ +typedef struct PrepareStmt +{ + NodeTag type; + char *name; /* Name of plan, arbitrary */ + List *argtypes; /* Types of parameters (List of TypeName) */ + Node *query; /* The query itself (as a raw parsetree) */ +} PrepareStmt; + + +/* ---------------------- + * EXECUTE Statement + * ---------------------- + */ + +typedef struct ExecuteStmt +{ + NodeTag type; + char *name; /* The name of the plan to execute */ + List *params; /* Values to assign to parameters */ +} ExecuteStmt; + + +/* ---------------------- + * DEALLOCATE Statement + * ---------------------- + */ +typedef struct DeallocateStmt +{ + NodeTag type; + /* The name of the plan to remove, NULL if DEALLOCATE ALL */ + char *name pg_node_attr(query_jumble_ignore); + + /* + * True if DEALLOCATE ALL. This is redundant with "name == NULL", but we + * make it a separate field so that exactly this condition (and not the + * precise name) will be accounted for in query jumbling. + */ + bool isall; + /* token location, or -1 if unknown */ + ParseLoc location pg_node_attr(query_jumble_location); +} DeallocateStmt; + +/* + * DROP OWNED statement + */ +typedef struct DropOwnedStmt +{ + NodeTag type; + List *roles; + DropBehavior behavior; +} DropOwnedStmt; + +/* + * REASSIGN OWNED statement + */ +typedef struct ReassignOwnedStmt +{ + NodeTag type; + List *roles; + RoleSpec *newrole; +} ReassignOwnedStmt; + +/* + * TS Dictionary stmts: DefineStmt, RenameStmt and DropStmt are default + */ +typedef struct AlterTSDictionaryStmt +{ + NodeTag type; + List *dictname; /* qualified name (list of String) */ + List *options; /* List of DefElem nodes */ +} AlterTSDictionaryStmt; + +/* + * TS Configuration stmts: DefineStmt, RenameStmt and DropStmt are default + */ +typedef enum AlterTSConfigType +{ + ALTER_TSCONFIG_ADD_MAPPING, + ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN, + ALTER_TSCONFIG_REPLACE_DICT, + ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN, + ALTER_TSCONFIG_DROP_MAPPING, +} AlterTSConfigType; + +typedef struct AlterTSConfigurationStmt +{ + NodeTag type; + AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */ + List *cfgname; /* qualified name (list of String) */ + + /* + * dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is + * NIL, but tokentype isn't, DROP MAPPING was specified. + */ + List *tokentype; /* list of String */ + List *dicts; /* list of list of String */ + bool override; /* if true - remove old variant */ + bool replace; /* if true - replace dictionary by another */ + bool missing_ok; /* for DROP - skip error if missing? */ +} AlterTSConfigurationStmt; + +typedef struct PublicationTable +{ + NodeTag type; + RangeVar *relation; /* relation to be published */ + Node *whereClause; /* qualifications */ + List *columns; /* List of columns in a publication table */ +} PublicationTable; + +/* + * Publication object type + */ +typedef enum PublicationObjSpecType +{ + PUBLICATIONOBJ_TABLE, /* A table */ + PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */ + PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of + * search_path */ + PUBLICATIONOBJ_CONTINUATION, /* Continuation of previous type */ +} PublicationObjSpecType; + +typedef struct PublicationObjSpec +{ + NodeTag type; + PublicationObjSpecType pubobjtype; /* type of this publication object */ + char *name; + PublicationTable *pubtable; + ParseLoc location; /* token location, or -1 if unknown */ +} PublicationObjSpec; + +typedef struct CreatePublicationStmt +{ + NodeTag type; + char *pubname; /* Name of the publication */ + List *options; /* List of DefElem nodes */ + List *pubobjects; /* Optional list of publication objects */ + bool for_all_tables; /* Special publication for all tables in db */ +} CreatePublicationStmt; + +typedef enum AlterPublicationAction +{ + AP_AddObjects, /* add objects to publication */ + AP_DropObjects, /* remove objects from publication */ + AP_SetObjects, /* set list of objects */ +} AlterPublicationAction; + +typedef struct AlterPublicationStmt +{ + NodeTag type; + char *pubname; /* Name of the publication */ + + /* parameters used for ALTER PUBLICATION ... WITH */ + List *options; /* List of DefElem nodes */ + + /* + * Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication + * objects. + */ + List *pubobjects; /* Optional list of publication objects */ + bool for_all_tables; /* Special publication for all tables in db */ + AlterPublicationAction action; /* What action to perform with the given + * objects */ +} AlterPublicationStmt; + +typedef struct CreateSubscriptionStmt +{ + NodeTag type; + char *subname; /* Name of the subscription */ + char *conninfo; /* Connection string to publisher */ + List *publication; /* One or more publication to subscribe to */ + List *options; /* List of DefElem nodes */ +} CreateSubscriptionStmt; + +typedef enum AlterSubscriptionType +{ + ALTER_SUBSCRIPTION_OPTIONS, + ALTER_SUBSCRIPTION_CONNECTION, + ALTER_SUBSCRIPTION_SET_PUBLICATION, + ALTER_SUBSCRIPTION_ADD_PUBLICATION, + ALTER_SUBSCRIPTION_DROP_PUBLICATION, + ALTER_SUBSCRIPTION_REFRESH, + ALTER_SUBSCRIPTION_ENABLED, + ALTER_SUBSCRIPTION_SKIP, +} AlterSubscriptionType; + +typedef struct AlterSubscriptionStmt +{ + NodeTag type; + AlterSubscriptionType kind; /* ALTER_SUBSCRIPTION_OPTIONS, etc */ + char *subname; /* Name of the subscription */ + char *conninfo; /* Connection string to publisher */ + List *publication; /* One or more publication to subscribe to */ + List *options; /* List of DefElem nodes */ +} AlterSubscriptionStmt; + +typedef struct DropSubscriptionStmt +{ + NodeTag type; + char *subname; /* Name of the subscription */ + bool missing_ok; /* Skip error if missing? */ + DropBehavior behavior; /* RESTRICT or CASCADE behavior */ +} DropSubscriptionStmt; + +#endif /* PARSENODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/pathnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/pathnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..50b09781f25caeeda07364c058904bd0ad9d9af7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/pathnodes.h @@ -0,0 +1,3438 @@ +/*------------------------------------------------------------------------- + * + * pathnodes.h + * Definitions for planner's internal data structures, especially Paths. + * + * We don't support copying RelOptInfo, IndexOptInfo, or Path nodes. + * There are some subsidiary structs that are useful to copy, though. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/pathnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHNODES_H +#define PATHNODES_H + +#include "access/sdir.h" +#include "lib/stringinfo.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" +#include "storage/block.h" + + +/* + * Relids + * Set of relation identifiers (indexes into the rangetable). + */ +typedef Bitmapset *Relids; + +/* + * When looking for a "cheapest path", this enum specifies whether we want + * cheapest startup cost or cheapest total cost. + */ +typedef enum CostSelector +{ + STARTUP_COST, TOTAL_COST +} CostSelector; + +/* + * The cost estimate produced by cost_qual_eval() includes both a one-time + * (startup) cost, and a per-tuple cost. + */ +typedef struct QualCost +{ + Cost startup; /* one-time cost */ + Cost per_tuple; /* per-evaluation cost */ +} QualCost; + +/* + * Costing aggregate function execution requires these statistics about + * the aggregates to be executed by a given Agg node. Note that the costs + * include the execution costs of the aggregates' argument expressions as + * well as the aggregate functions themselves. Also, the fields must be + * defined so that initializing the struct to zeroes with memset is correct. + */ +typedef struct AggClauseCosts +{ + QualCost transCost; /* total per-input-row execution costs */ + QualCost finalCost; /* total per-aggregated-row costs */ + Size transitionSpace; /* space for pass-by-ref transition data */ +} AggClauseCosts; + +/* + * This enum identifies the different types of "upper" (post-scan/join) + * relations that we might deal with during planning. + */ +typedef enum UpperRelationKind +{ + UPPERREL_SETOP, /* result of UNION/INTERSECT/EXCEPT, if any */ + UPPERREL_PARTIAL_GROUP_AGG, /* result of partial grouping/aggregation, if + * any */ + UPPERREL_GROUP_AGG, /* result of grouping/aggregation, if any */ + UPPERREL_WINDOW, /* result of window functions, if any */ + UPPERREL_PARTIAL_DISTINCT, /* result of partial "SELECT DISTINCT", if any */ + UPPERREL_DISTINCT, /* result of "SELECT DISTINCT", if any */ + UPPERREL_ORDERED, /* result of ORDER BY, if any */ + UPPERREL_FINAL, /* result of any remaining top-level actions */ + /* NB: UPPERREL_FINAL must be last enum entry; it's used to size arrays */ +} UpperRelationKind; + +/*---------- + * PlannerGlobal + * Global information for planning/optimization + * + * PlannerGlobal holds state for an entire planner invocation; this state + * is shared across all levels of sub-Queries that exist in the command being + * planned. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type; in others, doing so would lead to infinite recursion.) + *---------- + */ +typedef struct PlannerGlobal +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* Param values provided to planner() */ + ParamListInfo boundParams pg_node_attr(read_write_ignore); + + /* Plans for SubPlan nodes */ + List *subplans; + + /* Paths from which the SubPlan Plans were made */ + List *subpaths; + + /* PlannerInfos for SubPlan nodes */ + List *subroots pg_node_attr(read_write_ignore); + + /* indices of subplans that require REWIND */ + Bitmapset *rewindPlanIDs; + + /* "flat" rangetable for executor */ + List *finalrtable; + + /* "flat" list of RTEPermissionInfos */ + List *finalrteperminfos; + + /* "flat" list of PlanRowMarks */ + List *finalrowmarks; + + /* "flat" list of integer RT indexes */ + List *resultRelations; + + /* "flat" list of AppendRelInfos */ + List *appendRelations; + + /* OIDs of relations the plan depends on */ + List *relationOids; + + /* other dependencies, as PlanInvalItems */ + List *invalItems; + + /* type OIDs for PARAM_EXEC Params */ + List *paramExecTypes; + + /* highest PlaceHolderVar ID assigned */ + Index lastPHId; + + /* highest PlanRowMark ID assigned */ + Index lastRowMarkId; + + /* highest plan node ID assigned */ + int lastPlanNodeId; + + /* redo plan when TransactionXmin changes? */ + bool transientPlan; + + /* is plan specific to current role? */ + bool dependsOnRole; + + /* parallel mode potentially OK? */ + bool parallelModeOK; + + /* parallel mode actually required? */ + bool parallelModeNeeded; + + /* worst PROPARALLEL hazard level */ + char maxParallelHazard; + + /* partition descriptors */ + PartitionDirectory partition_directory pg_node_attr(read_write_ignore); +} PlannerGlobal; + +/* macro for fetching the Plan associated with a SubPlan node */ +#define planner_subplan_get_plan(root, subplan) \ + ((Plan *) list_nth((root)->glob->subplans, (subplan)->plan_id - 1)) + + +/*---------- + * PlannerInfo + * Per-query information for planning/optimization + * + * This struct is conventionally called "root" in all the planner routines. + * It holds links to all of the planner's working state, in addition to the + * original Query. Note that at present the planner extensively modifies + * the passed-in Query data structure; someday that should stop. + * + * For reasons explained in optimizer/optimizer.h, we define the typedef + * either here or in that header, whichever is read first. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type; in others, doing so would lead to infinite recursion or + * bloat dump output more than seems useful.) + *---------- + */ +#ifndef HAVE_PLANNERINFO_TYPEDEF +typedef struct PlannerInfo PlannerInfo; +#define HAVE_PLANNERINFO_TYPEDEF 1 +#endif + +struct PlannerInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* the Query being planned */ + Query *parse; + + /* global info for current planner run */ + PlannerGlobal *glob; + + /* 1 at the outermost Query */ + Index query_level; + + /* NULL at outermost Query */ + PlannerInfo *parent_root pg_node_attr(read_write_ignore); + + /* + * plan_params contains the expressions that this query level needs to + * make available to a lower query level that is currently being planned. + * outer_params contains the paramIds of PARAM_EXEC Params that outer + * query levels will make available to this query level. + */ + /* list of PlannerParamItems, see below */ + List *plan_params; + Bitmapset *outer_params; + + /* + * simple_rel_array holds pointers to "base rels" and "other rels" (see + * comments for RelOptInfo for more info). It is indexed by rangetable + * index (so entry 0 is always wasted). Entries can be NULL when an RTE + * does not correspond to a base relation, such as a join RTE or an + * unreferenced view RTE; or if the RelOptInfo hasn't been made yet. + */ + struct RelOptInfo **simple_rel_array pg_node_attr(array_size(simple_rel_array_size)); + /* allocated size of array */ + int simple_rel_array_size; + + /* + * simple_rte_array is the same length as simple_rel_array and holds + * pointers to the associated rangetable entries. Using this is a shade + * faster than using rt_fetch(), mostly due to fewer indirections. (Not + * printed because it'd be redundant with parse->rtable.) + */ + RangeTblEntry **simple_rte_array pg_node_attr(read_write_ignore); + + /* + * append_rel_array is the same length as the above arrays, and holds + * pointers to the corresponding AppendRelInfo entry indexed by + * child_relid, or NULL if the rel is not an appendrel child. The array + * itself is not allocated if append_rel_list is empty. (Not printed + * because it'd be redundant with append_rel_list.) + */ + struct AppendRelInfo **append_rel_array pg_node_attr(read_write_ignore); + + /* + * all_baserels is a Relids set of all base relids (but not joins or + * "other" rels) in the query. This is computed in deconstruct_jointree. + */ + Relids all_baserels; + + /* + * outer_join_rels is a Relids set of all outer-join relids in the query. + * This is computed in deconstruct_jointree. + */ + Relids outer_join_rels; + + /* + * all_query_rels is a Relids set of all base relids and outer join relids + * (but not "other" relids) in the query. This is the Relids identifier + * of the final join we need to form. This is computed in + * deconstruct_jointree. + */ + Relids all_query_rels; + + /* + * join_rel_list is a list of all join-relation RelOptInfos we have + * considered in this planning run. For small problems we just scan the + * list to do lookups, but when there are many join relations we build a + * hash table for faster lookups. The hash table is present and valid + * when join_rel_hash is not NULL. Note that we still maintain the list + * even when using the hash table for lookups; this simplifies life for + * GEQO. + */ + List *join_rel_list; + struct HTAB *join_rel_hash pg_node_attr(read_write_ignore); + + /* + * When doing a dynamic-programming-style join search, join_rel_level[k] + * is a list of all join-relation RelOptInfos of level k, and + * join_cur_level is the current level. New join-relation RelOptInfos are + * automatically added to the join_rel_level[join_cur_level] list. + * join_rel_level is NULL if not in use. + * + * Note: we've already printed all baserel and joinrel RelOptInfos above, + * so we don't dump join_rel_level or other lists of RelOptInfos. + */ + /* lists of join-relation RelOptInfos */ + List **join_rel_level pg_node_attr(read_write_ignore); + /* index of list being extended */ + int join_cur_level; + + /* init SubPlans for query */ + List *init_plans; + + /* + * per-CTE-item list of subplan IDs (or -1 if no subplan was made for that + * CTE) + */ + List *cte_plan_ids; + + /* List of Lists of Params for MULTIEXPR subquery outputs */ + List *multiexpr_params; + + /* list of JoinDomains used in the query (higher ones first) */ + List *join_domains; + + /* list of active EquivalenceClasses */ + List *eq_classes; + + /* set true once ECs are canonical */ + bool ec_merging_done; + + /* list of "canonical" PathKeys */ + List *canon_pathkeys; + + /* + * list of OuterJoinClauseInfos for mergejoinable outer join clauses + * w/nonnullable var on left + */ + List *left_join_clauses; + + /* + * list of OuterJoinClauseInfos for mergejoinable outer join clauses + * w/nonnullable var on right + */ + List *right_join_clauses; + + /* + * list of OuterJoinClauseInfos for mergejoinable full join clauses + */ + List *full_join_clauses; + + /* list of SpecialJoinInfos */ + List *join_info_list; + + /* counter for assigning RestrictInfo serial numbers */ + int last_rinfo_serial; + + /* + * all_result_relids is empty for SELECT, otherwise it contains at least + * parse->resultRelation. For UPDATE/DELETE/MERGE across an inheritance + * or partitioning tree, the result rel's child relids are added. When + * using multi-level partitioning, intermediate partitioned rels are + * included. leaf_result_relids is similar except that only actual result + * tables, not partitioned tables, are included in it. + */ + /* set of all result relids */ + Relids all_result_relids; + /* set of all leaf relids */ + Relids leaf_result_relids; + + /* + * list of AppendRelInfos + * + * Note: for AppendRelInfos describing partitions of a partitioned table, + * we guarantee that partitions that come earlier in the partitioned + * table's PartitionDesc will appear earlier in append_rel_list. + */ + List *append_rel_list; + + /* list of RowIdentityVarInfos */ + List *row_identity_vars; + + /* list of PlanRowMarks */ + List *rowMarks; + + /* list of PlaceHolderInfos */ + List *placeholder_list; + + /* array of PlaceHolderInfos indexed by phid */ + struct PlaceHolderInfo **placeholder_array pg_node_attr(read_write_ignore, array_size(placeholder_array_size)); + /* allocated size of array */ + int placeholder_array_size pg_node_attr(read_write_ignore); + + /* list of ForeignKeyOptInfos */ + List *fkey_list; + + /* desired pathkeys for query_planner() */ + List *query_pathkeys; + + /* groupClause pathkeys, if any */ + List *group_pathkeys; + + /* + * The number of elements in the group_pathkeys list which belong to the + * GROUP BY clause. Additional ones belong to ORDER BY / DISTINCT + * aggregates. + */ + int num_groupby_pathkeys; + + /* pathkeys of bottom window, if any */ + List *window_pathkeys; + /* distinctClause pathkeys, if any */ + List *distinct_pathkeys; + /* sortClause pathkeys, if any */ + List *sort_pathkeys; + /* set operator pathkeys, if any */ + List *setop_pathkeys; + + /* Canonicalised partition schemes used in the query. */ + List *part_schemes pg_node_attr(read_write_ignore); + + /* RelOptInfos we are now trying to join */ + List *initial_rels pg_node_attr(read_write_ignore); + + /* + * Upper-rel RelOptInfos. Use fetch_upper_rel() to get any particular + * upper rel. + */ + List *upper_rels[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore); + + /* Result tlists chosen by grouping_planner for upper-stage processing */ + struct PathTarget *upper_targets[UPPERREL_FINAL + 1] pg_node_attr(read_write_ignore); + + /* + * The fully-processed groupClause is kept here. It differs from + * parse->groupClause in that we remove any items that we can prove + * redundant, so that only the columns named here actually need to be + * compared to determine grouping. Note that it's possible for *all* the + * items to be proven redundant, implying that there is only one group + * containing all the query's rows. Hence, if you want to check whether + * GROUP BY was specified, test for nonempty parse->groupClause, not for + * nonempty processed_groupClause. Optimizer chooses specific order of + * group-by clauses during the upper paths generation process, attempting + * to use different strategies to minimize number of sorts or engage + * incremental sort. See preprocess_groupclause() and + * get_useful_group_keys_orderings() for details. + * + * Currently, when grouping sets are specified we do not attempt to + * optimize the groupClause, so that processed_groupClause will be + * identical to parse->groupClause. + */ + List *processed_groupClause; + + /* + * The fully-processed distinctClause is kept here. It differs from + * parse->distinctClause in that we remove any items that we can prove + * redundant, so that only the columns named here actually need to be + * compared to determine uniqueness. Note that it's possible for *all* + * the items to be proven redundant, implying that there should be only + * one output row. Hence, if you want to check whether DISTINCT was + * specified, test for nonempty parse->distinctClause, not for nonempty + * processed_distinctClause. + */ + List *processed_distinctClause; + + /* + * The fully-processed targetlist is kept here. It differs from + * parse->targetList in that (for INSERT) it's been reordered to match the + * target table, and defaults have been filled in. Also, additional + * resjunk targets may be present. preprocess_targetlist() does most of + * that work, but note that more resjunk targets can get added during + * appendrel expansion. (Hence, upper_targets mustn't get set up till + * after that.) + */ + List *processed_tlist; + + /* + * For UPDATE, this list contains the target table's attribute numbers to + * which the first N entries of processed_tlist are to be assigned. (Any + * additional entries in processed_tlist must be resjunk.) DO NOT use the + * resnos in processed_tlist to identify the UPDATE target columns. + */ + List *update_colnos; + + /* + * Fields filled during create_plan() for use in setrefs.c + */ + /* for GroupingFunc fixup (can't print: array length not known here) */ + AttrNumber *grouping_map pg_node_attr(read_write_ignore); + /* List of MinMaxAggInfos */ + List *minmax_aggs; + + /* context holding PlannerInfo */ + MemoryContext planner_cxt pg_node_attr(read_write_ignore); + + /* # of pages in all non-dummy tables of query */ + Cardinality total_table_pages; + + /* tuple_fraction passed to query_planner */ + Selectivity tuple_fraction; + /* limit_tuples passed to query_planner */ + Cardinality limit_tuples; + + /* + * Minimum security_level for quals. Note: qual_security_level is zero if + * there are no securityQuals. + */ + Index qual_security_level; + + /* true if any RTEs are RTE_JOIN kind */ + bool hasJoinRTEs; + /* true if any RTEs are marked LATERAL */ + bool hasLateralRTEs; + /* true if havingQual was non-null */ + bool hasHavingQual; + /* true if any RestrictInfo has pseudoconstant = true */ + bool hasPseudoConstantQuals; + /* true if we've made any of those */ + bool hasAlternativeSubPlans; + /* true once we're no longer allowed to add PlaceHolderInfos */ + bool placeholdersFrozen; + /* true if planning a recursive WITH item */ + bool hasRecursion; + + /* + * Information about aggregates. Filled by preprocess_aggrefs(). + */ + /* AggInfo structs */ + List *agginfos; + /* AggTransInfo structs */ + List *aggtransinfos; + /* number of aggs with DISTINCT/ORDER BY/WITHIN GROUP */ + int numOrderedAggs; + /* does any agg not support partial mode? */ + bool hasNonPartialAggs; + /* is any partial agg non-serializable? */ + bool hasNonSerialAggs; + + /* + * These fields are used only when hasRecursion is true: + */ + /* PARAM_EXEC ID for the work table */ + int wt_param_id; + /* a path for non-recursive term */ + struct Path *non_recursive_path; + + /* + * These fields are workspace for createplan.c + */ + /* outer rels above current node */ + Relids curOuterRels; + /* not-yet-assigned NestLoopParams */ + List *curOuterParams; + + /* + * These fields are workspace for setrefs.c. Each is an array + * corresponding to glob->subplans. (We could probably teach + * gen_node_support.pl how to determine the array length, but it doesn't + * seem worth the trouble, so just mark them read_write_ignore.) + */ + bool *isAltSubplan pg_node_attr(read_write_ignore); + bool *isUsedSubplan pg_node_attr(read_write_ignore); + + /* optional private data for join_search_hook, e.g., GEQO */ + void *join_search_private pg_node_attr(read_write_ignore); + + /* Does this query modify any partition key columns? */ + bool partColsUpdated; +}; + + +/* + * In places where it's known that simple_rte_array[] must have been prepared + * already, we just index into it to fetch RTEs. In code that might be + * executed before or after entering query_planner(), use this macro. + */ +#define planner_rt_fetch(rti, root) \ + ((root)->simple_rte_array ? (root)->simple_rte_array[rti] : \ + rt_fetch(rti, (root)->parse->rtable)) + +/* + * If multiple relations are partitioned the same way, all such partitions + * will have a pointer to the same PartitionScheme. A list of PartitionScheme + * objects is attached to the PlannerInfo. By design, the partition scheme + * incorporates only the general properties of the partition method (LIST vs. + * RANGE, number of partitioning columns and the type information for each) + * and not the specific bounds. + * + * We store the opclass-declared input data types instead of the partition key + * datatypes since the former rather than the latter are used to compare + * partition bounds. Since partition key data types and the opclass declared + * input data types are expected to be binary compatible (per ResolveOpClass), + * both of those should have same byval and length properties. + */ +typedef struct PartitionSchemeData +{ + char strategy; /* partition strategy */ + int16 partnatts; /* number of partition attributes */ + Oid *partopfamily; /* OIDs of operator families */ + Oid *partopcintype; /* OIDs of opclass declared input data types */ + Oid *partcollation; /* OIDs of partitioning collations */ + + /* Cached information about partition key data types. */ + int16 *parttyplen; + bool *parttypbyval; + + /* Cached information about partition comparison functions. */ + struct FmgrInfo *partsupfunc; +} PartitionSchemeData; + +typedef struct PartitionSchemeData *PartitionScheme; + +/*---------- + * RelOptInfo + * Per-relation information for planning/optimization + * + * For planning purposes, a "base rel" is either a plain relation (a table) + * or the output of a sub-SELECT or function that appears in the range table. + * In either case it is uniquely identified by an RT index. A "joinrel" + * is the joining of two or more base rels. A joinrel is identified by + * the set of RT indexes for its component baserels, along with RT indexes + * for any outer joins it has computed. We create RelOptInfo nodes for each + * baserel and joinrel, and store them in the PlannerInfo's simple_rel_array + * and join_rel_list respectively. + * + * Note that there is only one joinrel for any given set of component + * baserels, no matter what order we assemble them in; so an unordered + * set is the right datatype to identify it with. + * + * We also have "other rels", which are like base rels in that they refer to + * single RT indexes; but they are not part of the join tree, and are given + * a different RelOptKind to identify them. + * Currently the only kind of otherrels are those made for member relations + * of an "append relation", that is an inheritance set or UNION ALL subquery. + * An append relation has a parent RTE that is a base rel, which represents + * the entire append relation. The member RTEs are otherrels. The parent + * is present in the query join tree but the members are not. The member + * RTEs and otherrels are used to plan the scans of the individual tables or + * subqueries of the append set; then the parent baserel is given Append + * and/or MergeAppend paths comprising the best paths for the individual + * member rels. (See comments for AppendRelInfo for more information.) + * + * At one time we also made otherrels to represent join RTEs, for use in + * handling join alias Vars. Currently this is not needed because all join + * alias Vars are expanded to non-aliased form during preprocess_expression. + * + * We also have relations representing joins between child relations of + * different partitioned tables. These relations are not added to + * join_rel_level lists as they are not joined directly by the dynamic + * programming algorithm. + * + * There is also a RelOptKind for "upper" relations, which are RelOptInfos + * that describe post-scan/join processing steps, such as aggregation. + * Many of the fields in these RelOptInfos are meaningless, but their Path + * fields always hold Paths showing ways to do that processing step. + * + * Parts of this data structure are specific to various scan and join + * mechanisms. It didn't seem worth creating new node types for them. + * + * relids - Set of relation identifiers (RT indexes). This is a base + * relation if there is just one, a join relation if more; + * in the join case, RT indexes of any outer joins formed + * at or below this join are included along with baserels + * rows - estimated number of tuples in the relation after restriction + * clauses have been applied (ie, output rows of a plan for it) + * consider_startup - true if there is any value in keeping plain paths for + * this rel on the basis of having cheap startup cost + * consider_param_startup - the same for parameterized paths + * reltarget - Default Path output tlist for this rel; normally contains + * Var and PlaceHolderVar nodes for the values we need to + * output from this relation. + * List is in no particular order, but all rels of an + * appendrel set must use corresponding orders. + * NOTE: in an appendrel child relation, may contain + * arbitrary expressions pulled up from a subquery! + * pathlist - List of Path nodes, one for each potentially useful + * method of generating the relation + * ppilist - ParamPathInfo nodes for parameterized Paths, if any + * cheapest_startup_path - the pathlist member with lowest startup cost + * (regardless of ordering) among the unparameterized paths; + * or NULL if there is no unparameterized path + * cheapest_total_path - the pathlist member with lowest total cost + * (regardless of ordering) among the unparameterized paths; + * or if there is no unparameterized path, the path with lowest + * total cost among the paths with minimum parameterization + * cheapest_unique_path - for caching cheapest path to produce unique + * (no duplicates) output from relation; NULL if not yet requested + * cheapest_parameterized_paths - best paths for their parameterizations; + * always includes cheapest_total_path, even if that's unparameterized + * direct_lateral_relids - rels this rel has direct LATERAL references to + * lateral_relids - required outer rels for LATERAL, as a Relids set + * (includes both direct and indirect lateral references) + * + * If the relation is a base relation it will have these fields set: + * + * relid - RTE index (this is redundant with the relids field, but + * is provided for convenience of access) + * rtekind - copy of RTE's rtekind field + * min_attr, max_attr - range of valid AttrNumbers for rel + * attr_needed - array of bitmapsets indicating the highest joinrel + * in which each attribute is needed; if bit 0 is set then + * the attribute is needed as part of final targetlist + * attr_widths - cache space for per-attribute width estimates; + * zero means not computed yet + * nulling_relids - relids of outer joins that can null this rel + * lateral_vars - lateral cross-references of rel, if any (list of + * Vars and PlaceHolderVars) + * lateral_referencers - relids of rels that reference this one laterally + * (includes both direct and indirect lateral references) + * indexlist - list of IndexOptInfo nodes for relation's indexes + * (always NIL if it's not a table or partitioned table) + * pages - number of disk pages in relation (zero if not a table) + * tuples - number of tuples in relation (not considering restrictions) + * allvisfrac - fraction of disk pages that are marked all-visible + * eclass_indexes - EquivalenceClasses that mention this rel (filled + * only after EC merging is complete) + * subroot - PlannerInfo for subquery (NULL if it's not a subquery) + * subplan_params - list of PlannerParamItems to be passed to subquery + * + * Note: for a subquery, tuples and subroot are not set immediately + * upon creation of the RelOptInfo object; they are filled in when + * set_subquery_pathlist processes the object. + * + * For otherrels that are appendrel members, these fields are filled + * in just as for a baserel, except we don't bother with lateral_vars. + * + * If the relation is either a foreign table or a join of foreign tables that + * all belong to the same foreign server and are assigned to the same user to + * check access permissions as (cf checkAsUser), these fields will be set: + * + * serverid - OID of foreign server, if foreign table (else InvalidOid) + * userid - OID of user to check access as (InvalidOid means current user) + * useridiscurrent - we've assumed that userid equals current user + * fdwroutine - function hooks for FDW, if foreign table (else NULL) + * fdw_private - private state for FDW, if foreign table (else NULL) + * + * Two fields are used to cache knowledge acquired during the join search + * about whether this rel is provably unique when being joined to given other + * relation(s), ie, it can have at most one row matching any given row from + * that join relation. Currently we only attempt such proofs, and thus only + * populate these fields, for base rels; but someday they might be used for + * join rels too: + * + * unique_for_rels - list of Relid sets, each one being a set of other + * rels for which this one has been proven unique + * non_unique_for_rels - list of Relid sets, each one being a set of + * other rels for which we have tried and failed to prove + * this one unique + * + * The presence of the following fields depends on the restrictions + * and joins that the relation participates in: + * + * baserestrictinfo - List of RestrictInfo nodes, containing info about + * each non-join qualification clause in which this relation + * participates (only used for base rels) + * baserestrictcost - Estimated cost of evaluating the baserestrictinfo + * clauses at a single tuple (only used for base rels) + * baserestrict_min_security - Smallest security_level found among + * clauses in baserestrictinfo + * joininfo - List of RestrictInfo nodes, containing info about each + * join clause in which this relation participates (but + * note this excludes clauses that might be derivable from + * EquivalenceClasses) + * has_eclass_joins - flag that EquivalenceClass joins are possible + * + * Note: Keeping a restrictinfo list in the RelOptInfo is useful only for + * base rels, because for a join rel the set of clauses that are treated as + * restrict clauses varies depending on which sub-relations we choose to join. + * (For example, in a 3-base-rel join, a clause relating rels 1 and 2 must be + * treated as a restrictclause if we join {1} and {2 3} to make {1 2 3}; but + * if we join {1 2} and {3} then that clause will be a restrictclause in {1 2} + * and should not be processed again at the level of {1 2 3}.) Therefore, + * the restrictinfo list in the join case appears in individual JoinPaths + * (field joinrestrictinfo), not in the parent relation. But it's OK for + * the RelOptInfo to store the joininfo list, because that is the same + * for a given rel no matter how we form it. + * + * We store baserestrictcost in the RelOptInfo (for base relations) because + * we know we will need it at least once (to price the sequential scan) + * and may need it multiple times to price index scans. + * + * A join relation is considered to be partitioned if it is formed from a + * join of two relations that are partitioned, have matching partitioning + * schemes, and are joined on an equijoin of the partitioning columns. + * Under those conditions we can consider the join relation to be partitioned + * by either relation's partitioning keys, though some care is needed if + * either relation can be forced to null by outer-joining. For example, an + * outer join like (A LEFT JOIN B ON A.a = B.b) may produce rows with B.b + * NULL. These rows may not fit the partitioning conditions imposed on B. + * Hence, strictly speaking, the join is not partitioned by B.b and thus + * partition keys of an outer join should include partition key expressions + * from the non-nullable side only. However, if a subsequent join uses + * strict comparison operators (and all commonly-used equijoin operators are + * strict), the presence of nulls doesn't cause a problem: such rows couldn't + * match anything on the other side and thus they don't create a need to do + * any cross-partition sub-joins. Hence we can treat such values as still + * partitioning the join output for the purpose of additional partitionwise + * joining, so long as a strict join operator is used by the next join. + * + * If the relation is partitioned, these fields will be set: + * + * part_scheme - Partitioning scheme of the relation + * nparts - Number of partitions + * boundinfo - Partition bounds + * partbounds_merged - true if partition bounds are merged ones + * partition_qual - Partition constraint if not the root + * part_rels - RelOptInfos for each partition + * all_partrels - Relids set of all partition relids + * partexprs, nullable_partexprs - Partition key expressions + * + * The partexprs and nullable_partexprs arrays each contain + * part_scheme->partnatts elements. Each of the elements is a list of + * partition key expressions. For partitioned base relations, there is one + * expression in each partexprs element, and nullable_partexprs is empty. + * For partitioned join relations, each base relation within the join + * contributes one partition key expression per partitioning column; + * that expression goes in the partexprs[i] list if the base relation + * is not nullable by this join or any lower outer join, or in the + * nullable_partexprs[i] list if the base relation is nullable. + * Furthermore, FULL JOINs add extra nullable_partexprs expressions + * corresponding to COALESCE expressions of the left and right join columns, + * to simplify matching join clauses to those lists. + * + * Not all fields are printed. (In some cases, there is no print support for + * the field type.) + *---------- + */ + +/* Bitmask of flags supported by table AMs */ +#define AMFLAG_HAS_TID_RANGE (1 << 0) + +typedef enum RelOptKind +{ + RELOPT_BASEREL, + RELOPT_JOINREL, + RELOPT_OTHER_MEMBER_REL, + RELOPT_OTHER_JOINREL, + RELOPT_UPPER_REL, + RELOPT_OTHER_UPPER_REL, +} RelOptKind; + +/* + * Is the given relation a simple relation i.e a base or "other" member + * relation? + */ +#define IS_SIMPLE_REL(rel) \ + ((rel)->reloptkind == RELOPT_BASEREL || \ + (rel)->reloptkind == RELOPT_OTHER_MEMBER_REL) + +/* Is the given relation a join relation? */ +#define IS_JOIN_REL(rel) \ + ((rel)->reloptkind == RELOPT_JOINREL || \ + (rel)->reloptkind == RELOPT_OTHER_JOINREL) + +/* Is the given relation an upper relation? */ +#define IS_UPPER_REL(rel) \ + ((rel)->reloptkind == RELOPT_UPPER_REL || \ + (rel)->reloptkind == RELOPT_OTHER_UPPER_REL) + +/* Is the given relation an "other" relation? */ +#define IS_OTHER_REL(rel) \ + ((rel)->reloptkind == RELOPT_OTHER_MEMBER_REL || \ + (rel)->reloptkind == RELOPT_OTHER_JOINREL || \ + (rel)->reloptkind == RELOPT_OTHER_UPPER_REL) + +typedef struct RelOptInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + RelOptKind reloptkind; + + /* + * all relations included in this RelOptInfo; set of base + OJ relids + * (rangetable indexes) + */ + Relids relids; + + /* + * size estimates generated by planner + */ + /* estimated number of result tuples */ + Cardinality rows; + + /* + * per-relation planner control flags + */ + /* keep cheap-startup-cost paths? */ + bool consider_startup; + /* ditto, for parameterized paths? */ + bool consider_param_startup; + /* consider parallel paths? */ + bool consider_parallel; + + /* + * default result targetlist for Paths scanning this relation; list of + * Vars/Exprs, cost, width + */ + struct PathTarget *reltarget; + + /* + * materialization information + */ + List *pathlist; /* Path structures */ + List *ppilist; /* ParamPathInfos used in pathlist */ + List *partial_pathlist; /* partial Paths */ + struct Path *cheapest_startup_path; + struct Path *cheapest_total_path; + struct Path *cheapest_unique_path; + List *cheapest_parameterized_paths; + + /* + * parameterization information needed for both base rels and join rels + * (see also lateral_vars and lateral_referencers) + */ + /* rels directly laterally referenced */ + Relids direct_lateral_relids; + /* minimum parameterization of rel */ + Relids lateral_relids; + + /* + * information about a base rel (not set for join rels!) + */ + Index relid; + /* containing tablespace */ + Oid reltablespace; + /* RELATION, SUBQUERY, FUNCTION, etc */ + RTEKind rtekind; + /* smallest attrno of rel (often <0) */ + AttrNumber min_attr; + /* largest attrno of rel */ + AttrNumber max_attr; + /* array indexed [min_attr .. max_attr] */ + Relids *attr_needed pg_node_attr(read_write_ignore); + /* array indexed [min_attr .. max_attr] */ + int32 *attr_widths pg_node_attr(read_write_ignore); + + /* + * Zero-based set containing attnums of NOT NULL columns. Not populated + * for rels corresponding to non-partitioned inh==true RTEs. + */ + Bitmapset *notnullattnums; + /* relids of outer joins that can null this baserel */ + Relids nulling_relids; + /* LATERAL Vars and PHVs referenced by rel */ + List *lateral_vars; + /* rels that reference this baserel laterally */ + Relids lateral_referencers; + /* list of IndexOptInfo */ + List *indexlist; + /* list of StatisticExtInfo */ + List *statlist; + /* size estimates derived from pg_class */ + BlockNumber pages; + Cardinality tuples; + double allvisfrac; + /* indexes in PlannerInfo's eq_classes list of ECs that mention this rel */ + Bitmapset *eclass_indexes; + PlannerInfo *subroot; /* if subquery */ + List *subplan_params; /* if subquery */ + /* wanted number of parallel workers */ + int rel_parallel_workers; + /* Bitmask of optional features supported by the table AM */ + uint32 amflags; + + /* + * Information about foreign tables and foreign joins + */ + /* identifies server for the table or join */ + Oid serverid; + /* identifies user to check access as; 0 means to check as current user */ + Oid userid; + /* join is only valid for current user */ + bool useridiscurrent; + /* use "struct FdwRoutine" to avoid including fdwapi.h here */ + struct FdwRoutine *fdwroutine pg_node_attr(read_write_ignore); + void *fdw_private pg_node_attr(read_write_ignore); + + /* + * cache space for remembering if we have proven this relation unique + */ + /* known unique for these other relid set(s) */ + List *unique_for_rels; + /* known not unique for these set(s) */ + List *non_unique_for_rels; + + /* + * used by various scans and joins: + */ + /* RestrictInfo structures (if base rel) */ + List *baserestrictinfo; + /* cost of evaluating the above */ + QualCost baserestrictcost; + /* min security_level found in baserestrictinfo */ + Index baserestrict_min_security; + /* RestrictInfo structures for join clauses involving this rel */ + List *joininfo; + /* T means joininfo is incomplete */ + bool has_eclass_joins; + + /* + * used by partitionwise joins: + */ + /* consider partitionwise join paths? (if partitioned rel) */ + bool consider_partitionwise_join; + + /* + * inheritance links, if this is an otherrel (otherwise NULL): + */ + /* Immediate parent relation (dumping it would be too verbose) */ + struct RelOptInfo *parent pg_node_attr(read_write_ignore); + /* Topmost parent relation (dumping it would be too verbose) */ + struct RelOptInfo *top_parent pg_node_attr(read_write_ignore); + /* Relids of topmost parent (redundant, but handy) */ + Relids top_parent_relids; + + /* + * used for partitioned relations: + */ + /* Partitioning scheme */ + PartitionScheme part_scheme pg_node_attr(read_write_ignore); + + /* + * Number of partitions; -1 if not yet set; in case of a join relation 0 + * means it's considered unpartitioned + */ + int nparts; + /* Partition bounds */ + struct PartitionBoundInfoData *boundinfo pg_node_attr(read_write_ignore); + /* True if partition bounds were created by partition_bounds_merge() */ + bool partbounds_merged; + /* Partition constraint, if not the root */ + List *partition_qual; + + /* + * Array of RelOptInfos of partitions, stored in the same order as bounds + * (don't print, too bulky and duplicative) + */ + struct RelOptInfo **part_rels pg_node_attr(read_write_ignore); + + /* + * Bitmap with members acting as indexes into the part_rels[] array to + * indicate which partitions survived partition pruning. + */ + Bitmapset *live_parts; + /* Relids set of all partition relids */ + Relids all_partrels; + + /* + * These arrays are of length partkey->partnatts, which we don't have at + * hand, so don't try to print + */ + + /* Non-nullable partition key expressions */ + List **partexprs pg_node_attr(read_write_ignore); + /* Nullable partition key expressions */ + List **nullable_partexprs pg_node_attr(read_write_ignore); +} RelOptInfo; + +/* + * Is given relation partitioned? + * + * It's not enough to test whether rel->part_scheme is set, because it might + * be that the basic partitioning properties of the input relations matched + * but the partition bounds did not. Also, if we are able to prove a rel + * dummy (empty), we should henceforth treat it as unpartitioned. + */ +#define IS_PARTITIONED_REL(rel) \ + ((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \ + (rel)->part_rels && !IS_DUMMY_REL(rel)) + +/* + * Convenience macro to make sure that a partitioned relation has all the + * required members set. + */ +#define REL_HAS_ALL_PART_PROPS(rel) \ + ((rel)->part_scheme && (rel)->boundinfo && (rel)->nparts > 0 && \ + (rel)->part_rels && (rel)->partexprs && (rel)->nullable_partexprs) + +/* + * IndexOptInfo + * Per-index information for planning/optimization + * + * indexkeys[], indexcollations[] each have ncolumns entries. + * opfamily[], and opcintype[] each have nkeycolumns entries. They do + * not contain any information about included attributes. + * + * sortopfamily[], reverse_sort[], and nulls_first[] have + * nkeycolumns entries, if the index is ordered; but if it is unordered, + * those pointers are NULL. + * + * Zeroes in the indexkeys[] array indicate index columns that are + * expressions; there is one element in indexprs for each such column. + * + * For an ordered index, reverse_sort[] and nulls_first[] describe the + * sort ordering of a forward indexscan; we can also consider a backward + * indexscan, which will generate the reverse ordering. + * + * The indexprs and indpred expressions have been run through + * prepqual.c and eval_const_expressions() for ease of matching to + * WHERE clauses. indpred is in implicit-AND form. + * + * indextlist is a TargetEntry list representing the index columns. + * It provides an equivalent base-relation Var for each simple column, + * and links to the matching indexprs element for each expression column. + * + * While most of these fields are filled when the IndexOptInfo is created + * (by plancat.c), indrestrictinfo and predOK are set later, in + * check_index_predicates(). + */ +#ifndef HAVE_INDEXOPTINFO_TYPEDEF +typedef struct IndexOptInfo IndexOptInfo; +#define HAVE_INDEXOPTINFO_TYPEDEF 1 +#endif + +struct IndexPath; /* avoid including pathnodes.h here */ +struct PlannerInfo; /* avoid including pathnodes.h here */ + +struct IndexOptInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* OID of the index relation */ + Oid indexoid; + /* tablespace of index (not table) */ + Oid reltablespace; + /* back-link to index's table; don't print, else infinite recursion */ + RelOptInfo *rel pg_node_attr(read_write_ignore); + + /* + * index-size statistics (from pg_class and elsewhere) + */ + /* number of disk pages in index */ + BlockNumber pages; + /* number of index tuples in index */ + Cardinality tuples; + /* index tree height, or -1 if unknown */ + int tree_height; + + /* + * index descriptor information + */ + /* number of columns in index */ + int ncolumns; + /* number of key columns in index */ + int nkeycolumns; + + /* + * table column numbers of index's columns (both key and included + * columns), or 0 for expression columns + */ + int *indexkeys pg_node_attr(array_size(ncolumns)); + /* OIDs of collations of index columns */ + Oid *indexcollations pg_node_attr(array_size(nkeycolumns)); + /* OIDs of operator families for columns */ + Oid *opfamily pg_node_attr(array_size(nkeycolumns)); + /* OIDs of opclass declared input data types */ + Oid *opcintype pg_node_attr(array_size(nkeycolumns)); + /* OIDs of btree opfamilies, if orderable. NULL if partitioned index */ + Oid *sortopfamily pg_node_attr(array_size(nkeycolumns)); + /* is sort order descending? or NULL if partitioned index */ + bool *reverse_sort pg_node_attr(array_size(nkeycolumns)); + /* do NULLs come first in the sort order? or NULL if partitioned index */ + bool *nulls_first pg_node_attr(array_size(nkeycolumns)); + /* opclass-specific options for columns */ + bytea **opclassoptions pg_node_attr(read_write_ignore); + /* which index cols can be returned in an index-only scan? */ + bool *canreturn pg_node_attr(array_size(ncolumns)); + /* OID of the access method (in pg_am) */ + Oid relam; + + /* + * expressions for non-simple index columns; redundant to print since we + * print indextlist + */ + List *indexprs pg_node_attr(read_write_ignore); + /* predicate if a partial index, else NIL */ + List *indpred; + + /* targetlist representing index columns */ + List *indextlist; + + /* + * parent relation's baserestrictinfo list, less any conditions implied by + * the index's predicate (unless it's a target rel, see comments in + * check_index_predicates()) + */ + List *indrestrictinfo; + + /* true if index predicate matches query */ + bool predOK; + /* true if a unique index */ + bool unique; + /* is uniqueness enforced immediately? */ + bool immediate; + /* true if index doesn't really exist */ + bool hypothetical; + + /* + * Remaining fields are copied from the index AM's API struct + * (IndexAmRoutine). These fields are not set for partitioned indexes. + */ + bool amcanorderbyop; + bool amoptionalkey; + bool amsearcharray; + bool amsearchnulls; + /* does AM have amgettuple interface? */ + bool amhasgettuple; + /* does AM have amgetbitmap interface? */ + bool amhasgetbitmap; + bool amcanparallel; + /* does AM have ammarkpos interface? */ + bool amcanmarkpos; + /* AM's cost estimator */ + /* Rather than include amapi.h here, we declare amcostestimate like this */ + void (*amcostestimate) (struct PlannerInfo *, struct IndexPath *, double, Cost *, Cost *, Selectivity *, double *, double *) pg_node_attr(read_write_ignore); +}; + +/* + * ForeignKeyOptInfo + * Per-foreign-key information for planning/optimization + * + * The per-FK-column arrays can be fixed-size because we allow at most + * INDEX_MAX_KEYS columns in a foreign key constraint. Each array has + * nkeys valid entries. + */ +typedef struct ForeignKeyOptInfo +{ + pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* + * Basic data about the foreign key (fetched from catalogs): + */ + + /* RT index of the referencing table */ + Index con_relid; + /* RT index of the referenced table */ + Index ref_relid; + /* number of columns in the foreign key */ + int nkeys; + /* cols in referencing table */ + AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* cols in referenced table */ + AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* PK = FK operator OIDs */ + Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + + /* + * Derived info about whether FK's equality conditions match the query: + */ + + /* # of FK cols matched by ECs */ + int nmatched_ec; + /* # of these ECs that are ec_has_const */ + int nconst_ec; + /* # of FK cols matched by non-EC rinfos */ + int nmatched_rcols; + /* total # of non-EC rinfos matched to FK */ + int nmatched_ri; + /* Pointer to eclass matching each column's condition, if there is one */ + struct EquivalenceClass *eclass[INDEX_MAX_KEYS]; + /* Pointer to eclass member for the referencing Var, if there is one */ + struct EquivalenceMember *fk_eclass_member[INDEX_MAX_KEYS]; + /* List of non-EC RestrictInfos matching each column's condition */ + List *rinfos[INDEX_MAX_KEYS]; +} ForeignKeyOptInfo; + +/* + * StatisticExtInfo + * Information about extended statistics for planning/optimization + * + * Each pg_statistic_ext row is represented by one or more nodes of this + * type, or even zero if ANALYZE has not computed them. + */ +typedef struct StatisticExtInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* OID of the statistics row */ + Oid statOid; + + /* includes child relations */ + bool inherit; + + /* back-link to statistic's table; don't print, else infinite recursion */ + RelOptInfo *rel pg_node_attr(read_write_ignore); + + /* statistics kind of this entry */ + char kind; + + /* attnums of the columns covered */ + Bitmapset *keys; + + /* expressions */ + List *exprs; +} StatisticExtInfo; + +/* + * JoinDomains + * + * A "join domain" defines the scope of applicability of deductions made via + * the EquivalenceClass mechanism. Roughly speaking, a join domain is a set + * of base+OJ relations that are inner-joined together. More precisely, it is + * the set of relations at which equalities deduced from an EquivalenceClass + * can be enforced or should be expected to hold. The topmost JoinDomain + * covers the whole query (so its jd_relids should equal all_query_rels). + * An outer join creates a new JoinDomain that includes all base+OJ relids + * within its nullable side, but (by convention) not the OJ's own relid. + * A FULL join creates two new JoinDomains, one for each side. + * + * Notice that a rel that is below outer join(s) will thus appear to belong + * to multiple join domains. However, any of its Vars that appear in + * EquivalenceClasses belonging to higher join domains will have nullingrel + * bits preventing them from being evaluated at the rel's scan level, so that + * we will not be able to derive enforceable-at-the-rel-scan-level clauses + * from such ECs. We define the join domain relid sets this way so that + * domains can be said to be "higher" or "lower" when one domain relid set + * includes another. + * + * The JoinDomains for a query are computed in deconstruct_jointree. + * We do not copy JoinDomain structs once made, so they can be compared + * for equality by simple pointer equality. + */ +typedef struct JoinDomain +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Relids jd_relids; /* all relids contained within the domain */ +} JoinDomain; + +/* + * EquivalenceClasses + * + * Whenever we identify a mergejoinable equality clause A = B that is + * not an outer-join clause, we create an EquivalenceClass containing + * the expressions A and B to record this knowledge. If we later find another + * equivalence B = C, we add C to the existing EquivalenceClass; this may + * require merging two existing EquivalenceClasses. At the end of the qual + * distribution process, we have sets of values that are known all transitively + * equal to each other, where "equal" is according to the rules of the btree + * operator family(s) shown in ec_opfamilies, as well as the collation shown + * by ec_collation. (We restrict an EC to contain only equalities whose + * operators belong to the same set of opfamilies. This could probably be + * relaxed, but for now it's not worth the trouble, since nearly all equality + * operators belong to only one btree opclass anyway. Similarly, we suppose + * that all or none of the input datatypes are collatable, so that a single + * collation value is sufficient.) + * + * Strictly speaking, deductions from an EquivalenceClass hold only within + * a "join domain", that is a set of relations that are innerjoined together + * (see JoinDomain above). For the most part we don't need to account for + * this explicitly, because equality clauses from different join domains + * will contain Vars that are not equal() because they have different + * nullingrel sets, and thus we will never falsely merge ECs from different + * join domains. But Var-free (pseudoconstant) expressions lack that safety + * feature. We handle that by marking "const" EC members with the JoinDomain + * of the clause they came from; two nominally-equal const members will be + * considered different if they came from different JoinDomains. This ensures + * no false EquivalenceClass merges will occur. + * + * We also use EquivalenceClasses as the base structure for PathKeys, letting + * us represent knowledge about different sort orderings being equivalent. + * Since every PathKey must reference an EquivalenceClass, we will end up + * with single-member EquivalenceClasses whenever a sort key expression has + * not been equivalenced to anything else. It is also possible that such an + * EquivalenceClass will contain a volatile expression ("ORDER BY random()"), + * which is a case that can't arise otherwise since clauses containing + * volatile functions are never considered mergejoinable. We mark such + * EquivalenceClasses specially to prevent them from being merged with + * ordinary EquivalenceClasses. Also, for volatile expressions we have + * to be careful to match the EquivalenceClass to the correct targetlist + * entry: consider SELECT random() AS a, random() AS b ... ORDER BY b,a. + * So we record the SortGroupRef of the originating sort clause. + * + * NB: if ec_merged isn't NULL, this class has been merged into another, and + * should be ignored in favor of using the pointed-to class. + * + * NB: EquivalenceClasses are never copied after creation. Therefore, + * copyObject() copies pointers to them as pointers, and equal() compares + * pointers to EquivalenceClasses via pointer equality. This is implemented + * by putting copy_as_scalar and equal_as_scalar attributes on fields that + * are pointers to EquivalenceClasses. The same goes for EquivalenceMembers. + */ +typedef struct EquivalenceClass +{ + pg_node_attr(custom_read_write, no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + List *ec_opfamilies; /* btree operator family OIDs */ + Oid ec_collation; /* collation, if datatypes are collatable */ + List *ec_members; /* list of EquivalenceMembers */ + List *ec_sources; /* list of generating RestrictInfos */ + List *ec_derives; /* list of derived RestrictInfos */ + Relids ec_relids; /* all relids appearing in ec_members, except + * for child members (see below) */ + bool ec_has_const; /* any pseudoconstants in ec_members? */ + bool ec_has_volatile; /* the (sole) member is a volatile expr */ + bool ec_broken; /* failed to generate needed clauses? */ + Index ec_sortref; /* originating sortclause label, or 0 */ + Index ec_min_security; /* minimum security_level in ec_sources */ + Index ec_max_security; /* maximum security_level in ec_sources */ + struct EquivalenceClass *ec_merged; /* set if merged into another EC */ +} EquivalenceClass; + +/* + * If an EC contains a constant, any PathKey depending on it must be + * redundant, since there's only one possible value of the key. + */ +#define EC_MUST_BE_REDUNDANT(eclass) \ + ((eclass)->ec_has_const) + +/* + * EquivalenceMember - one member expression of an EquivalenceClass + * + * em_is_child signifies that this element was built by transposing a member + * for an appendrel parent relation to represent the corresponding expression + * for an appendrel child. These members are used for determining the + * pathkeys of scans on the child relation and for explicitly sorting the + * child when necessary to build a MergeAppend path for the whole appendrel + * tree. An em_is_child member has no impact on the properties of the EC as a + * whole; in particular the EC's ec_relids field does NOT include the child + * relation. An em_is_child member should never be marked em_is_const nor + * cause ec_has_const or ec_has_volatile to be set, either. Thus, em_is_child + * members are not really full-fledged members of the EC, but just reflections + * or doppelgangers of real members. Most operations on EquivalenceClasses + * should ignore em_is_child members, and those that don't should test + * em_relids to make sure they only consider relevant members. + * + * em_datatype is usually the same as exprType(em_expr), but can be + * different when dealing with a binary-compatible opfamily; in particular + * anyarray_ops would never work without this. Use em_datatype when + * looking up a specific btree operator to work with this expression. + */ +typedef struct EquivalenceMember +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Expr *em_expr; /* the expression represented */ + Relids em_relids; /* all relids appearing in em_expr */ + bool em_is_const; /* expression is pseudoconstant? */ + bool em_is_child; /* derived version for a child relation? */ + Oid em_datatype; /* the "nominal type" used by the opfamily */ + JoinDomain *em_jdomain; /* join domain containing the source clause */ + /* if em_is_child is true, this links to corresponding EM for top parent */ + struct EquivalenceMember *em_parent pg_node_attr(read_write_ignore); +} EquivalenceMember; + +/* + * PathKeys + * + * The sort ordering of a path is represented by a list of PathKey nodes. + * An empty list implies no known ordering. Otherwise the first item + * represents the primary sort key, the second the first secondary sort key, + * etc. The value being sorted is represented by linking to an + * EquivalenceClass containing that value and including pk_opfamily among its + * ec_opfamilies. The EquivalenceClass tells which collation to use, too. + * This is a convenient method because it makes it trivial to detect + * equivalent and closely-related orderings. (See optimizer/README for more + * information.) + * + * Note: pk_strategy is either BTLessStrategyNumber (for ASC) or + * BTGreaterStrategyNumber (for DESC). We assume that all ordering-capable + * index types will use btree-compatible strategy numbers. + */ +typedef struct PathKey +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* the value that is ordered */ + EquivalenceClass *pk_eclass pg_node_attr(copy_as_scalar, equal_as_scalar); + Oid pk_opfamily; /* btree opfamily defining the ordering */ + int pk_strategy; /* sort direction (ASC or DESC) */ + bool pk_nulls_first; /* do NULLs come before normal values? */ +} PathKey; + +/* + * Contains an order of group-by clauses and the corresponding list of + * pathkeys. + * + * The elements of 'clauses' list should have the same order as the head of + * 'pathkeys' list. The tleSortGroupRef of the clause should be equal to + * ec_sortref of the pathkey equivalence class. If there are redundant + * clauses with the same tleSortGroupRef, they must be grouped together. + */ +typedef struct GroupByOrdering +{ + NodeTag type; + + List *pathkeys; + List *clauses; +} GroupByOrdering; + +/* + * VolatileFunctionStatus -- allows nodes to cache their + * contain_volatile_functions properties. VOLATILITY_UNKNOWN means not yet + * determined. + */ +typedef enum VolatileFunctionStatus +{ + VOLATILITY_UNKNOWN = 0, + VOLATILITY_VOLATILE, + VOLATILITY_NOVOLATILE, +} VolatileFunctionStatus; + +/* + * PathTarget + * + * This struct contains what we need to know during planning about the + * targetlist (output columns) that a Path will compute. Each RelOptInfo + * includes a default PathTarget, which its individual Paths may simply + * reference. However, in some cases a Path may compute outputs different + * from other Paths, and in that case we make a custom PathTarget for it. + * For example, an indexscan might return index expressions that would + * otherwise need to be explicitly calculated. (Note also that "upper" + * relations generally don't have useful default PathTargets.) + * + * exprs contains bare expressions; they do not have TargetEntry nodes on top, + * though those will appear in finished Plans. + * + * sortgrouprefs[] is an array of the same length as exprs, containing the + * corresponding sort/group refnos, or zeroes for expressions not referenced + * by sort/group clauses. If sortgrouprefs is NULL (which it generally is in + * RelOptInfo.reltarget targets; only upper-level Paths contain this info), + * we have not identified sort/group columns in this tlist. This allows us to + * deal with sort/group refnos when needed with less expense than including + * TargetEntry nodes in the exprs list. + */ +typedef struct PathTarget +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* list of expressions to be computed */ + List *exprs; + + /* corresponding sort/group refnos, or 0 */ + Index *sortgrouprefs pg_node_attr(array_size(exprs)); + + /* cost of evaluating the expressions */ + QualCost cost; + + /* estimated avg width of result tuples */ + int width; + + /* indicates if exprs contain any volatile functions */ + VolatileFunctionStatus has_volatile_expr; +} PathTarget; + +/* Convenience macro to get a sort/group refno from a PathTarget */ +#define get_pathtarget_sortgroupref(target, colno) \ + ((target)->sortgrouprefs ? (target)->sortgrouprefs[colno] : (Index) 0) + + +/* + * ParamPathInfo + * + * All parameterized paths for a given relation with given required outer rels + * link to a single ParamPathInfo, which stores common information such as + * the estimated rowcount for this parameterization. We do this partly to + * avoid recalculations, but mostly to ensure that the estimated rowcount + * is in fact the same for every such path. + * + * Note: ppi_clauses is only used in ParamPathInfos for base relation paths; + * in join cases it's NIL because the set of relevant clauses varies depending + * on how the join is formed. The relevant clauses will appear in each + * parameterized join path's joinrestrictinfo list, instead. ParamPathInfos + * for append relations don't bother with this, either. + * + * ppi_serials is the set of rinfo_serial numbers for quals that are enforced + * by this path. As with ppi_clauses, it's only maintained for baserels. + * (We could construct it on-the-fly from ppi_clauses, but it seems better + * to materialize a copy.) + */ +typedef struct ParamPathInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Relids ppi_req_outer; /* rels supplying parameters used by path */ + Cardinality ppi_rows; /* estimated number of result tuples */ + List *ppi_clauses; /* join clauses available from outer rels */ + Bitmapset *ppi_serials; /* set of rinfo_serial for enforced quals */ +} ParamPathInfo; + + +/* + * Type "Path" is used as-is for sequential-scan paths, as well as some other + * simple plan types that we don't need any extra information in the path for. + * For other path types it is the first component of a larger struct. + * + * "pathtype" is the NodeTag of the Plan node we could build from this Path. + * It is partially redundant with the Path's NodeTag, but allows us to use + * the same Path type for multiple Plan types when there is no need to + * distinguish the Plan type during path processing. + * + * "parent" identifies the relation this Path scans, and "pathtarget" + * describes the precise set of output columns the Path would compute. + * In simple cases all Paths for a given rel share the same targetlist, + * which we represent by having path->pathtarget equal to parent->reltarget. + * + * "param_info", if not NULL, links to a ParamPathInfo that identifies outer + * relation(s) that provide parameter values to each scan of this path. + * That means this path can only be joined to those rels by means of nestloop + * joins with this path on the inside. Also note that a parameterized path + * is responsible for testing all "movable" joinclauses involving this rel + * and the specified outer rel(s). + * + * "rows" is the same as parent->rows in simple paths, but in parameterized + * paths and UniquePaths it can be less than parent->rows, reflecting the + * fact that we've filtered by extra join conditions or removed duplicates. + * + * "pathkeys" is a List of PathKey nodes (see above), describing the sort + * ordering of the path's output rows. + * + * We do not support copying Path trees, mainly because the circular linkages + * between RelOptInfo and Path nodes can't be handled easily in a simple + * depth-first traversal. We also don't have read support at the moment. + */ +typedef struct Path +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* tag identifying scan/join method */ + NodeTag pathtype; + + /* + * the relation this path can build + * + * We do NOT print the parent, else we'd be in infinite recursion. We can + * print the parent's relids for identification purposes, though. + */ + RelOptInfo *parent pg_node_attr(write_only_relids); + + /* + * list of Vars/Exprs, cost, width + * + * We print the pathtarget only if it's not the default one for the rel. + */ + PathTarget *pathtarget pg_node_attr(write_only_nondefault_pathtarget); + + /* + * parameterization info, or NULL if none + * + * We do not print the whole of param_info, since it's printed via + * RelOptInfo; it's sufficient and less cluttering to print just the + * required outer relids. + */ + ParamPathInfo *param_info pg_node_attr(write_only_req_outer); + + /* engage parallel-aware logic? */ + bool parallel_aware; + /* OK to use as part of parallel plan? */ + bool parallel_safe; + /* desired # of workers; 0 = not parallel */ + int parallel_workers; + + /* estimated size/costs for path (see costsize.c for more info) */ + Cardinality rows; /* estimated number of result tuples */ + Cost startup_cost; /* cost expended before fetching any tuples */ + Cost total_cost; /* total cost (assuming all tuples fetched) */ + + /* sort ordering of path's output; a List of PathKey nodes; see above */ + List *pathkeys; +} Path; + +/* Macro for extracting a path's parameterization relids; beware double eval */ +#define PATH_REQ_OUTER(path) \ + ((path)->param_info ? (path)->param_info->ppi_req_outer : (Relids) NULL) + +/*---------- + * IndexPath represents an index scan over a single index. + * + * This struct is used for both regular indexscans and index-only scans; + * path.pathtype is T_IndexScan or T_IndexOnlyScan to show which is meant. + * + * 'indexinfo' is the index to be scanned. + * + * 'indexclauses' is a list of IndexClause nodes, each representing one + * index-checkable restriction, with implicit AND semantics across the list. + * An empty list implies a full index scan. + * + * 'indexorderbys', if not NIL, is a list of ORDER BY expressions that have + * been found to be usable as ordering operators for an amcanorderbyop index. + * The list must match the path's pathkeys, ie, one expression per pathkey + * in the same order. These are not RestrictInfos, just bare expressions, + * since they generally won't yield booleans. It's guaranteed that each + * expression has the index key on the left side of the operator. + * + * 'indexorderbycols' is an integer list of index column numbers (zero-based) + * of the same length as 'indexorderbys', showing which index column each + * ORDER BY expression is meant to be used with. (There is no restriction + * on which index column each ORDER BY can be used with.) + * + * 'indexscandir' is one of: + * ForwardScanDirection: forward scan of an index + * BackwardScanDirection: backward scan of an ordered index + * Unordered indexes will always have an indexscandir of ForwardScanDirection. + * + * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that + * we need not recompute them when considering using the same index in a + * bitmap index/heap scan (see BitmapHeapPath). The costs of the IndexPath + * itself represent the costs of an IndexScan or IndexOnlyScan plan type. + *---------- + */ +typedef struct IndexPath +{ + Path path; + IndexOptInfo *indexinfo; + List *indexclauses; + List *indexorderbys; + List *indexorderbycols; + ScanDirection indexscandir; + Cost indextotalcost; + Selectivity indexselectivity; +} IndexPath; + +/* + * Each IndexClause references a RestrictInfo node from the query's WHERE + * or JOIN conditions, and shows how that restriction can be applied to + * the particular index. We support both indexclauses that are directly + * usable by the index machinery, which are typically of the form + * "indexcol OP pseudoconstant", and those from which an indexable qual + * can be derived. The simplest such transformation is that a clause + * of the form "pseudoconstant OP indexcol" can be commuted to produce an + * indexable qual (the index machinery expects the indexcol to be on the + * left always). Another example is that we might be able to extract an + * indexable range condition from a LIKE condition, as in "x LIKE 'foo%bar'" + * giving rise to "x >= 'foo' AND x < 'fop'". Derivation of such lossy + * conditions is done by a planner support function attached to the + * indexclause's top-level function or operator. + * + * indexquals is a list of RestrictInfos for the directly-usable index + * conditions associated with this IndexClause. In the simplest case + * it's a one-element list whose member is iclause->rinfo. Otherwise, + * it contains one or more directly-usable indexqual conditions extracted + * from the given clause. The 'lossy' flag indicates whether the + * indexquals are semantically equivalent to the original clause, or + * represent a weaker condition. + * + * Normally, indexcol is the index of the single index column the clause + * works on, and indexcols is NIL. But if the clause is a RowCompareExpr, + * indexcol is the index of the leading column, and indexcols is a list of + * all the affected columns. (Note that indexcols matches up with the + * columns of the actual indexable RowCompareExpr in indexquals, which + * might be different from the original in rinfo.) + * + * An IndexPath's IndexClause list is required to be ordered by index + * column, i.e. the indexcol values must form a nondecreasing sequence. + * (The order of multiple clauses for the same index column is unspecified.) + */ +typedef struct IndexClause +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + struct RestrictInfo *rinfo; /* original restriction or join clause */ + List *indexquals; /* indexqual(s) derived from it */ + bool lossy; /* are indexquals a lossy version of clause? */ + AttrNumber indexcol; /* index column the clause uses (zero-based) */ + List *indexcols; /* multiple index columns, if RowCompare */ +} IndexClause; + +/* + * BitmapHeapPath represents one or more indexscans that generate TID bitmaps + * instead of directly accessing the heap, followed by AND/OR combinations + * to produce a single bitmap, followed by a heap scan that uses the bitmap. + * Note that the output is always considered unordered, since it will come + * out in physical heap order no matter what the underlying indexes did. + * + * The individual indexscans are represented by IndexPath nodes, and any + * logic on top of them is represented by a tree of BitmapAndPath and + * BitmapOrPath nodes. Notice that we can use the same IndexPath node both + * to represent a regular (or index-only) index scan plan, and as the child + * of a BitmapHeapPath that represents scanning the same index using a + * BitmapIndexScan. The startup_cost and total_cost figures of an IndexPath + * always represent the costs to use it as a regular (or index-only) + * IndexScan. The costs of a BitmapIndexScan can be computed using the + * IndexPath's indextotalcost and indexselectivity. + */ +typedef struct BitmapHeapPath +{ + Path path; + Path *bitmapqual; /* IndexPath, BitmapAndPath, BitmapOrPath */ +} BitmapHeapPath; + +/* + * BitmapAndPath represents a BitmapAnd plan node; it can only appear as + * part of the substructure of a BitmapHeapPath. The Path structure is + * a bit more heavyweight than we really need for this, but for simplicity + * we make it a derivative of Path anyway. + */ +typedef struct BitmapAndPath +{ + Path path; + List *bitmapquals; /* IndexPaths and BitmapOrPaths */ + Selectivity bitmapselectivity; +} BitmapAndPath; + +/* + * BitmapOrPath represents a BitmapOr plan node; it can only appear as + * part of the substructure of a BitmapHeapPath. The Path structure is + * a bit more heavyweight than we really need for this, but for simplicity + * we make it a derivative of Path anyway. + */ +typedef struct BitmapOrPath +{ + Path path; + List *bitmapquals; /* IndexPaths and BitmapAndPaths */ + Selectivity bitmapselectivity; +} BitmapOrPath; + +/* + * TidPath represents a scan by TID + * + * tidquals is an implicitly OR'ed list of qual expressions of the form + * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)", + * or a CurrentOfExpr for the relation. + */ +typedef struct TidPath +{ + Path path; + List *tidquals; /* qual(s) involving CTID = something */ +} TidPath; + +/* + * TidRangePath represents a scan by a contiguous range of TIDs + * + * tidrangequals is an implicitly AND'ed list of qual expressions of the form + * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=. + */ +typedef struct TidRangePath +{ + Path path; + List *tidrangequals; +} TidRangePath; + +/* + * SubqueryScanPath represents a scan of an unflattened subquery-in-FROM + * + * Note that the subpath comes from a different planning domain; for example + * RTE indexes within it mean something different from those known to the + * SubqueryScanPath. path.parent->subroot is the planning context needed to + * interpret the subpath. + */ +typedef struct SubqueryScanPath +{ + Path path; + Path *subpath; /* path representing subquery execution */ +} SubqueryScanPath; + +/* + * ForeignPath represents a potential scan of a foreign table, foreign join + * or foreign upper-relation. + * + * In the case of a foreign join, fdw_restrictinfo stores the RestrictInfos to + * apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * + * fdw_private stores FDW private data about the scan. While fdw_private is + * not actually touched by the core code during normal operations, it's + * generally a good idea to use a representation that can be dumped by + * nodeToString(), so that you can examine the structure during debugging + * with tools like pprint(). + */ +typedef struct ForeignPath +{ + Path path; + Path *fdw_outerpath; + List *fdw_restrictinfo; + List *fdw_private; +} ForeignPath; + +/* + * CustomPath represents a table scan or a table join done by some out-of-core + * extension. + * + * We provide a set of hooks here - which the provider must take care to set + * up correctly - to allow extensions to supply their own methods of scanning + * a relation or join relations. For example, a provider might provide GPU + * acceleration, a cache-based scan, or some other kind of logic we haven't + * dreamed up yet. + * + * CustomPaths can be injected into the planning process for a base or join + * relation by set_rel_pathlist_hook or set_join_pathlist_hook functions, + * respectively. + * + * In the case of a table join, custom_restrictinfo stores the RestrictInfos + * to apply to the join, which are used by createplan.c to get pseudoconstant + * clauses evaluated as one-time quals in a gating Result plan node. + * + * Core code must avoid assuming that the CustomPath is only as large as + * the structure declared here; providers are allowed to make it the first + * element in a larger structure. (Since the planner never copies Paths, + * this doesn't add any complication.) However, for consistency with the + * FDW case, we provide a "custom_private" field in CustomPath; providers + * may prefer to use that rather than define another struct type. + */ + +struct CustomPathMethods; + +typedef struct CustomPath +{ + Path path; + uint32 flags; /* mask of CUSTOMPATH_* flags, see + * nodes/extensible.h */ + List *custom_paths; /* list of child Path nodes, if any */ + List *custom_restrictinfo; + List *custom_private; + const struct CustomPathMethods *methods; +} CustomPath; + +/* + * AppendPath represents an Append plan, ie, successive execution of + * several member plans. + * + * For partial Append, 'subpaths' contains non-partial subpaths followed by + * partial subpaths. + * + * Note: it is possible for "subpaths" to contain only one, or even no, + * elements. These cases are optimized during create_append_plan. + * In particular, an AppendPath with no subpaths is a "dummy" path that + * is created to represent the case that a relation is provably empty. + * (This is a convenient representation because it means that when we build + * an appendrel and find that all its children have been excluded, no extra + * action is needed to recognize the relation as dummy.) + */ +typedef struct AppendPath +{ + Path path; + List *subpaths; /* list of component Paths */ + /* Index of first partial path in subpaths; list_length(subpaths) if none */ + int first_partial_path; + Cardinality limit_tuples; /* hard limit on output tuples, or -1 */ +} AppendPath; + +#define IS_DUMMY_APPEND(p) \ + (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL) + +/* + * A relation that's been proven empty will have one path that is dummy + * (but might have projection paths on top). For historical reasons, + * this is provided as a macro that wraps is_dummy_rel(). + */ +#define IS_DUMMY_REL(r) is_dummy_rel(r) +extern bool is_dummy_rel(RelOptInfo *rel); + +/* + * MergeAppendPath represents a MergeAppend plan, ie, the merging of sorted + * results from several member plans to produce similarly-sorted output. + */ +typedef struct MergeAppendPath +{ + Path path; + List *subpaths; /* list of component Paths */ + Cardinality limit_tuples; /* hard limit on output tuples, or -1 */ +} MergeAppendPath; + +/* + * GroupResultPath represents use of a Result plan node to compute the + * output of a degenerate GROUP BY case, wherein we know we should produce + * exactly one row, which might then be filtered by a HAVING qual. + * + * Note that quals is a list of bare clauses, not RestrictInfos. + */ +typedef struct GroupResultPath +{ + Path path; + List *quals; +} GroupResultPath; + +/* + * MaterialPath represents use of a Material plan node, i.e., caching of + * the output of its subpath. This is used when the subpath is expensive + * and needs to be scanned repeatedly, or when we need mark/restore ability + * and the subpath doesn't have it. + */ +typedef struct MaterialPath +{ + Path path; + Path *subpath; +} MaterialPath; + +/* + * MemoizePath represents a Memoize plan node, i.e., a cache that caches + * tuples from parameterized paths to save the underlying node from having to + * be rescanned for parameter values which are already cached. + */ +typedef struct MemoizePath +{ + Path path; + Path *subpath; /* outerpath to cache tuples from */ + List *hash_operators; /* OIDs of hash equality ops for cache keys */ + List *param_exprs; /* expressions that are cache keys */ + bool singlerow; /* true if the cache entry is to be marked as + * complete after caching the first record. */ + bool binary_mode; /* true when cache key should be compared bit + * by bit, false when using hash equality ops */ + Cardinality calls; /* expected number of rescans */ + uint32 est_entries; /* The maximum number of entries that the + * planner expects will fit in the cache, or 0 + * if unknown */ +} MemoizePath; + +/* + * UniquePath represents elimination of distinct rows from the output of + * its subpath. + * + * This can represent significantly different plans: either hash-based or + * sort-based implementation, or a no-op if the input path can be proven + * distinct already. The decision is sufficiently localized that it's not + * worth having separate Path node types. (Note: in the no-op case, we could + * eliminate the UniquePath node entirely and just return the subpath; but + * it's convenient to have a UniquePath in the path tree to signal upper-level + * routines that the input is known distinct.) + */ +typedef enum UniquePathMethod +{ + UNIQUE_PATH_NOOP, /* input is known unique already */ + UNIQUE_PATH_HASH, /* use hashing */ + UNIQUE_PATH_SORT, /* use sorting */ +} UniquePathMethod; + +typedef struct UniquePath +{ + Path path; + Path *subpath; + UniquePathMethod umethod; + List *in_operators; /* equality operators of the IN clause */ + List *uniq_exprs; /* expressions to be made unique */ +} UniquePath; + +/* + * GatherPath runs several copies of a plan in parallel and collects the + * results. The parallel leader may also execute the plan, unless the + * single_copy flag is set. + */ +typedef struct GatherPath +{ + Path path; + Path *subpath; /* path for each worker */ + bool single_copy; /* don't execute path more than once */ + int num_workers; /* number of workers sought to help */ +} GatherPath; + +/* + * GatherMergePath runs several copies of a plan in parallel and collects + * the results, preserving their common sort order. + */ +typedef struct GatherMergePath +{ + Path path; + Path *subpath; /* path for each worker */ + int num_workers; /* number of workers sought to help */ +} GatherMergePath; + + +/* + * All join-type paths share these fields. + */ + +typedef struct JoinPath +{ + pg_node_attr(abstract) + + Path path; + + JoinType jointype; + + bool inner_unique; /* each outer tuple provably matches no more + * than one inner tuple */ + + Path *outerjoinpath; /* path for the outer side of the join */ + Path *innerjoinpath; /* path for the inner side of the join */ + + List *joinrestrictinfo; /* RestrictInfos to apply to join */ + + /* + * See the notes for RelOptInfo and ParamPathInfo to understand why + * joinrestrictinfo is needed in JoinPath, and can't be merged into the + * parent RelOptInfo. + */ +} JoinPath; + +/* + * A nested-loop path needs no special fields. + */ + +typedef struct NestPath +{ + JoinPath jpath; +} NestPath; + +/* + * A mergejoin path has these fields. + * + * Unlike other path types, a MergePath node doesn't represent just a single + * run-time plan node: it can represent up to four. Aside from the MergeJoin + * node itself, there can be a Sort node for the outer input, a Sort node + * for the inner input, and/or a Material node for the inner input. We could + * represent these nodes by separate path nodes, but considering how many + * different merge paths are investigated during a complex join problem, + * it seems better to avoid unnecessary palloc overhead. + * + * path_mergeclauses lists the clauses (in the form of RestrictInfos) + * that will be used in the merge. + * + * Note that the mergeclauses are a subset of the parent relation's + * restriction-clause list. Any join clauses that are not mergejoinable + * appear only in the parent's restrict list, and must be checked by a + * qpqual at execution time. + * + * outersortkeys (resp. innersortkeys) is NIL if the outer path + * (resp. inner path) is already ordered appropriately for the + * mergejoin. If it is not NIL then it is a PathKeys list describing + * the ordering that must be created by an explicit Sort node. + * + * skip_mark_restore is true if the executor need not do mark/restore calls. + * Mark/restore overhead is usually required, but can be skipped if we know + * that the executor need find only one match per outer tuple, and that the + * mergeclauses are sufficient to identify a match. In such cases the + * executor can immediately advance the outer relation after processing a + * match, and therefore it need never back up the inner relation. + * + * materialize_inner is true if a Material node should be placed atop the + * inner input. This may appear with or without an inner Sort step. + */ + +typedef struct MergePath +{ + JoinPath jpath; + List *path_mergeclauses; /* join clauses to be used for merge */ + List *outersortkeys; /* keys for explicit sort, if any */ + List *innersortkeys; /* keys for explicit sort, if any */ + bool skip_mark_restore; /* can executor skip mark/restore? */ + bool materialize_inner; /* add Materialize to inner? */ +} MergePath; + +/* + * A hashjoin path has these fields. + * + * The remarks above for mergeclauses apply for hashclauses as well. + * + * Hashjoin does not care what order its inputs appear in, so we have + * no need for sortkeys. + */ + +typedef struct HashPath +{ + JoinPath jpath; + List *path_hashclauses; /* join clauses used for hashing */ + int num_batches; /* number of batches expected */ + Cardinality inner_rows_total; /* total inner rows expected */ +} HashPath; + +/* + * ProjectionPath represents a projection (that is, targetlist computation) + * + * Nominally, this path node represents using a Result plan node to do a + * projection step. However, if the input plan node supports projection, + * we can just modify its output targetlist to do the required calculations + * directly, and not need a Result. In some places in the planner we can just + * jam the desired PathTarget into the input path node (and adjust its cost + * accordingly), so we don't need a ProjectionPath. But in other places + * it's necessary to not modify the input path node, so we need a separate + * ProjectionPath node, which is marked dummy to indicate that we intend to + * assign the work to the input plan node. The estimated cost for the + * ProjectionPath node will account for whether a Result will be used or not. + */ +typedef struct ProjectionPath +{ + Path path; + Path *subpath; /* path representing input source */ + bool dummypp; /* true if no separate Result is needed */ +} ProjectionPath; + +/* + * ProjectSetPath represents evaluation of a targetlist that includes + * set-returning function(s), which will need to be implemented by a + * ProjectSet plan node. + */ +typedef struct ProjectSetPath +{ + Path path; + Path *subpath; /* path representing input source */ +} ProjectSetPath; + +/* + * SortPath represents an explicit sort step + * + * The sort keys are, by definition, the same as path.pathkeys. + * + * Note: the Sort plan node cannot project, so path.pathtarget must be the + * same as the input's pathtarget. + */ +typedef struct SortPath +{ + Path path; + Path *subpath; /* path representing input source */ +} SortPath; + +/* + * IncrementalSortPath represents an incremental sort step + * + * This is like a regular sort, except some leading key columns are assumed + * to be ordered already. + */ +typedef struct IncrementalSortPath +{ + SortPath spath; + int nPresortedCols; /* number of presorted columns */ +} IncrementalSortPath; + +/* + * GroupPath represents grouping (of presorted input) + * + * groupClause represents the columns to be grouped on; the input path + * must be at least that well sorted. + * + * We can also apply a qual to the grouped rows (equivalent of HAVING) + */ +typedef struct GroupPath +{ + Path path; + Path *subpath; /* path representing input source */ + List *groupClause; /* a list of SortGroupClause's */ + List *qual; /* quals (HAVING quals), if any */ +} GroupPath; + +/* + * UpperUniquePath represents adjacent-duplicate removal (in presorted input) + * + * The columns to be compared are the first numkeys columns of the path's + * pathkeys. The input is presumed already sorted that way. + */ +typedef struct UpperUniquePath +{ + Path path; + Path *subpath; /* path representing input source */ + int numkeys; /* number of pathkey columns to compare */ +} UpperUniquePath; + +/* + * AggPath represents generic computation of aggregate functions + * + * This may involve plain grouping (but not grouping sets), using either + * sorted or hashed grouping; for the AGG_SORTED case, the input must be + * appropriately presorted. + */ +typedef struct AggPath +{ + Path path; + Path *subpath; /* path representing input source */ + AggStrategy aggstrategy; /* basic strategy, see nodes.h */ + AggSplit aggsplit; /* agg-splitting mode, see nodes.h */ + Cardinality numGroups; /* estimated number of groups in input */ + uint64 transitionSpace; /* for pass-by-ref transition data */ + List *groupClause; /* a list of SortGroupClause's */ + List *qual; /* quals (HAVING quals), if any */ +} AggPath; + +/* + * Various annotations used for grouping sets in the planner. + */ + +typedef struct GroupingSetData +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + List *set; /* grouping set as list of sortgrouprefs */ + Cardinality numGroups; /* est. number of result groups */ +} GroupingSetData; + +typedef struct RollupData +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + List *groupClause; /* applicable subset of parse->groupClause */ + List *gsets; /* lists of integer indexes into groupClause */ + List *gsets_data; /* list of GroupingSetData */ + Cardinality numGroups; /* est. number of result groups */ + bool hashable; /* can be hashed */ + bool is_hashed; /* to be implemented as a hashagg */ +} RollupData; + +/* + * GroupingSetsPath represents a GROUPING SETS aggregation + */ + +typedef struct GroupingSetsPath +{ + Path path; + Path *subpath; /* path representing input source */ + AggStrategy aggstrategy; /* basic strategy */ + List *rollups; /* list of RollupData */ + List *qual; /* quals (HAVING quals), if any */ + uint64 transitionSpace; /* for pass-by-ref transition data */ +} GroupingSetsPath; + +/* + * MinMaxAggPath represents computation of MIN/MAX aggregates from indexes + */ +typedef struct MinMaxAggPath +{ + Path path; + List *mmaggregates; /* list of MinMaxAggInfo */ + List *quals; /* HAVING quals, if any */ +} MinMaxAggPath; + +/* + * WindowAggPath represents generic computation of window functions + */ +typedef struct WindowAggPath +{ + Path path; + Path *subpath; /* path representing input source */ + WindowClause *winclause; /* WindowClause we'll be using */ + List *qual; /* lower-level WindowAgg runconditions */ + List *runCondition; /* OpExpr List to short-circuit execution */ + bool topwindow; /* false for all apart from the WindowAgg + * that's closest to the root of the plan */ +} WindowAggPath; + +/* + * SetOpPath represents a set-operation, that is INTERSECT or EXCEPT + */ +typedef struct SetOpPath +{ + Path path; + Path *subpath; /* path representing input source */ + SetOpCmd cmd; /* what to do, see nodes.h */ + SetOpStrategy strategy; /* how to do it, see nodes.h */ + List *distinctList; /* SortGroupClauses identifying target cols */ + AttrNumber flagColIdx; /* where is the flag column, if any */ + int firstFlag; /* flag value for first input relation */ + Cardinality numGroups; /* estimated number of groups in input */ +} SetOpPath; + +/* + * RecursiveUnionPath represents a recursive UNION node + */ +typedef struct RecursiveUnionPath +{ + Path path; + Path *leftpath; /* paths representing input sources */ + Path *rightpath; + List *distinctList; /* SortGroupClauses identifying target cols */ + int wtParam; /* ID of Param representing work table */ + Cardinality numGroups; /* estimated number of groups in input */ +} RecursiveUnionPath; + +/* + * LockRowsPath represents acquiring row locks for SELECT FOR UPDATE/SHARE + */ +typedef struct LockRowsPath +{ + Path path; + Path *subpath; /* path representing input source */ + List *rowMarks; /* a list of PlanRowMark's */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ +} LockRowsPath; + +/* + * ModifyTablePath represents performing INSERT/UPDATE/DELETE/MERGE + * + * We represent most things that will be in the ModifyTable plan node + * literally, except we have a child Path not Plan. But analysis of the + * OnConflictExpr is deferred to createplan.c, as is collection of FDW data. + */ +typedef struct ModifyTablePath +{ + Path path; + Path *subpath; /* Path producing source data */ + CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */ + bool canSetTag; /* do we set the command tag/es_processed? */ + Index nominalRelation; /* Parent RT index for use of EXPLAIN */ + Index rootRelation; /* Root RT index, if partitioned/inherited */ + bool partColsUpdated; /* some part key in hierarchy updated? */ + List *resultRelations; /* integer list of RT indexes */ + List *updateColnosLists; /* per-target-table update_colnos lists */ + List *withCheckOptionLists; /* per-target-table WCO lists */ + List *returningLists; /* per-target-table RETURNING tlists */ + List *rowMarks; /* PlanRowMarks (non-locking only) */ + OnConflictExpr *onconflict; /* ON CONFLICT clause, or NULL */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ + List *mergeActionLists; /* per-target-table lists of actions for + * MERGE */ + List *mergeJoinConditions; /* per-target-table join conditions + * for MERGE */ +} ModifyTablePath; + +/* + * LimitPath represents applying LIMIT/OFFSET restrictions + */ +typedef struct LimitPath +{ + Path path; + Path *subpath; /* path representing input source */ + Node *limitOffset; /* OFFSET parameter, or NULL if none */ + Node *limitCount; /* COUNT parameter, or NULL if none */ + LimitOption limitOption; /* FETCH FIRST with ties or exact number */ +} LimitPath; + + +/* + * Restriction clause info. + * + * We create one of these for each AND sub-clause of a restriction condition + * (WHERE or JOIN/ON clause). Since the restriction clauses are logically + * ANDed, we can use any one of them or any subset of them to filter out + * tuples, without having to evaluate the rest. The RestrictInfo node itself + * stores data used by the optimizer while choosing the best query plan. + * + * If a restriction clause references a single base relation, it will appear + * in the baserestrictinfo list of the RelOptInfo for that base rel. + * + * If a restriction clause references more than one base+OJ relation, it will + * appear in the joininfo list of every RelOptInfo that describes a strict + * subset of the relations mentioned in the clause. The joininfo lists are + * used to drive join tree building by selecting plausible join candidates. + * The clause cannot actually be applied until we have built a join rel + * containing all the relations it references, however. + * + * When we construct a join rel that includes all the relations referenced + * in a multi-relation restriction clause, we place that clause into the + * joinrestrictinfo lists of paths for the join rel, if neither left nor + * right sub-path includes all relations referenced in the clause. The clause + * will be applied at that join level, and will not propagate any further up + * the join tree. (Note: the "predicate migration" code was once intended to + * push restriction clauses up and down the plan tree based on evaluation + * costs, but it's dead code and is unlikely to be resurrected in the + * foreseeable future.) + * + * Note that in the presence of more than two rels, a multi-rel restriction + * might reach different heights in the join tree depending on the join + * sequence we use. So, these clauses cannot be associated directly with + * the join RelOptInfo, but must be kept track of on a per-join-path basis. + * + * RestrictInfos that represent equivalence conditions (i.e., mergejoinable + * equalities that are not outerjoin-delayed) are handled a bit differently. + * Initially we attach them to the EquivalenceClasses that are derived from + * them. When we construct a scan or join path, we look through all the + * EquivalenceClasses and generate derived RestrictInfos representing the + * minimal set of conditions that need to be checked for this particular scan + * or join to enforce that all members of each EquivalenceClass are in fact + * equal in all rows emitted by the scan or join. + * + * The clause_relids field lists the base plus outer-join RT indexes that + * actually appear in the clause. required_relids lists the minimum set of + * relids needed to evaluate the clause; while this is often equal to + * clause_relids, it can be more. We will add relids to required_relids when + * we need to force an outer join ON clause to be evaluated exactly at the + * level of the outer join, which is true except when it is a "degenerate" + * condition that references only Vars from the nullable side of the join. + * + * RestrictInfo nodes contain a flag to indicate whether a qual has been + * pushed down to a lower level than its original syntactic placement in the + * join tree would suggest. If an outer join prevents us from pushing a qual + * down to its "natural" semantic level (the level associated with just the + * base rels used in the qual) then we mark the qual with a "required_relids" + * value including more than just the base rels it actually uses. By + * pretending that the qual references all the rels required to form the outer + * join, we prevent it from being evaluated below the outer join's joinrel. + * When we do form the outer join's joinrel, we still need to distinguish + * those quals that are actually in that join's JOIN/ON condition from those + * that appeared elsewhere in the tree and were pushed down to the join rel + * because they used no other rels. That's what the is_pushed_down flag is + * for; it tells us that a qual is not an OUTER JOIN qual for the set of base + * rels listed in required_relids. A clause that originally came from WHERE + * or an INNER JOIN condition will *always* have its is_pushed_down flag set. + * It's possible for an OUTER JOIN clause to be marked is_pushed_down too, + * if we decide that it can be pushed down into the nullable side of the join. + * In that case it acts as a plain filter qual for wherever it gets evaluated. + * (In short, is_pushed_down is only false for non-degenerate outer join + * conditions. Possibly we should rename it to reflect that meaning? But + * see also the comments for RINFO_IS_PUSHED_DOWN, below.) + * + * There is also an incompatible_relids field, which is a set of outer-join + * relids above which we cannot evaluate the clause (because they might null + * Vars it uses that should not be nulled yet). In principle this could be + * filled in any RestrictInfo as the set of OJ relids that appear above the + * clause and null Vars that it uses. In practice we only bother to populate + * it for "clone" clauses, as it's currently only needed to prevent multiple + * clones of the same clause from being accepted for evaluation at the same + * join level. + * + * There is also an outer_relids field, which is NULL except for outer join + * clauses; for those, it is the set of relids on the outer side of the + * clause's outer join. (These are rels that the clause cannot be applied to + * in parameterized scans, since pushing it into the join's outer side would + * lead to wrong answers.) + * + * To handle security-barrier conditions efficiently, we mark RestrictInfo + * nodes with a security_level field, in which higher values identify clauses + * coming from less-trusted sources. The exact semantics are that a clause + * cannot be evaluated before another clause with a lower security_level value + * unless the first clause is leakproof. As with outer-join clauses, this + * creates a reason for clauses to sometimes need to be evaluated higher in + * the join tree than their contents would suggest; and even at a single plan + * node, this rule constrains the order of application of clauses. + * + * In general, the referenced clause might be arbitrarily complex. The + * kinds of clauses we can handle as indexscan quals, mergejoin clauses, + * or hashjoin clauses are limited (e.g., no volatile functions). The code + * for each kind of path is responsible for identifying the restrict clauses + * it can use and ignoring the rest. Clauses not implemented by an indexscan, + * mergejoin, or hashjoin will be placed in the plan qual or joinqual field + * of the finished Plan node, where they will be enforced by general-purpose + * qual-expression-evaluation code. (But we are still entitled to count + * their selectivity when estimating the result tuple count, if we + * can guess what it is...) + * + * When the referenced clause is an OR clause, we generate a modified copy + * in which additional RestrictInfo nodes are inserted below the top-level + * OR/AND structure. This is a convenience for OR indexscan processing: + * indexquals taken from either the top level or an OR subclause will have + * associated RestrictInfo nodes. + * + * The can_join flag is set true if the clause looks potentially useful as + * a merge or hash join clause, that is if it is a binary opclause with + * nonoverlapping sets of relids referenced in the left and right sides. + * (Whether the operator is actually merge or hash joinable isn't checked, + * however.) + * + * The pseudoconstant flag is set true if the clause contains no Vars of + * the current query level and no volatile functions. Such a clause can be + * pulled out and used as a one-time qual in a gating Result node. We keep + * pseudoconstant clauses in the same lists as other RestrictInfos so that + * the regular clause-pushing machinery can assign them to the correct join + * level, but they need to be treated specially for cost and selectivity + * estimates. Note that a pseudoconstant clause can never be an indexqual + * or merge or hash join clause, so it's of no interest to large parts of + * the planner. + * + * When we generate multiple versions of a clause so as to have versions + * that will work after commuting some left joins per outer join identity 3, + * we mark the one with the fewest nullingrels bits with has_clone = true, + * and the rest with is_clone = true. This allows proper filtering of + * these redundant clauses, so that we apply only one version of them. + * + * When join clauses are generated from EquivalenceClasses, there may be + * several equally valid ways to enforce join equivalence, of which we need + * apply only one. We mark clauses of this kind by setting parent_ec to + * point to the generating EquivalenceClass. Multiple clauses with the same + * parent_ec in the same join are redundant. + * + * Most fields are ignored for equality, since they may not be set yet, and + * should be derivable from the clause anyway. + * + * parent_ec, left_ec, right_ec are not printed, lest it lead to infinite + * recursion in plan tree dump. + */ + +typedef struct RestrictInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* the represented clause of WHERE or JOIN */ + Expr *clause; + + /* true if clause was pushed down in level */ + bool is_pushed_down; + + /* see comment above */ + bool can_join pg_node_attr(equal_ignore); + + /* see comment above */ + bool pseudoconstant pg_node_attr(equal_ignore); + + /* see comment above */ + bool has_clone; + bool is_clone; + + /* true if known to contain no leaked Vars */ + bool leakproof pg_node_attr(equal_ignore); + + /* indicates if clause contains any volatile functions */ + VolatileFunctionStatus has_volatile pg_node_attr(equal_ignore); + + /* see comment above */ + Index security_level; + + /* number of base rels in clause_relids */ + int num_base_rels pg_node_attr(equal_ignore); + + /* The relids (varnos+varnullingrels) actually referenced in the clause: */ + Relids clause_relids pg_node_attr(equal_ignore); + + /* The set of relids required to evaluate the clause: */ + Relids required_relids; + + /* Relids above which we cannot evaluate the clause (see comment above) */ + Relids incompatible_relids; + + /* If an outer-join clause, the outer-side relations, else NULL: */ + Relids outer_relids; + + /* + * Relids in the left/right side of the clause. These fields are set for + * any binary opclause. + */ + Relids left_relids pg_node_attr(equal_ignore); + Relids right_relids pg_node_attr(equal_ignore); + + /* + * Modified clause with RestrictInfos. This field is NULL unless clause + * is an OR clause. + */ + Expr *orclause pg_node_attr(equal_ignore); + + /*---------- + * Serial number of this RestrictInfo. This is unique within the current + * PlannerInfo context, with a few critical exceptions: + * 1. When we generate multiple clones of the same qual condition to + * cope with outer join identity 3, all the clones get the same serial + * number. This reflects that we only want to apply one of them in any + * given plan. + * 2. If we manufacture a commuted version of a qual to use as an index + * condition, it copies the original's rinfo_serial, since it is in + * practice the same condition. + * 3. If we reduce a qual to constant-FALSE, the new constant-FALSE qual + * copies the original's rinfo_serial, since it is in practice the same + * condition. + * 4. RestrictInfos made for a child relation copy their parent's + * rinfo_serial. Likewise, when an EquivalenceClass makes a derived + * equality clause for a child relation, it copies the rinfo_serial of + * the matching equality clause for the parent. This allows detection + * of redundant pushed-down equality clauses. + *---------- + */ + int rinfo_serial; + + /* + * Generating EquivalenceClass. This field is NULL unless clause is + * potentially redundant. + */ + EquivalenceClass *parent_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + + /* + * cache space for cost and selectivity + */ + + /* eval cost of clause; -1 if not yet set */ + QualCost eval_cost pg_node_attr(equal_ignore); + + /* selectivity for "normal" (JOIN_INNER) semantics; -1 if not yet set */ + Selectivity norm_selec pg_node_attr(equal_ignore); + /* selectivity for outer join semantics; -1 if not yet set */ + Selectivity outer_selec pg_node_attr(equal_ignore); + + /* + * opfamilies containing clause operator; valid if clause is + * mergejoinable, else NIL + */ + List *mergeopfamilies pg_node_attr(equal_ignore); + + /* + * cache space for mergeclause processing; NULL if not yet set + */ + + /* EquivalenceClass containing lefthand */ + EquivalenceClass *left_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + /* EquivalenceClass containing righthand */ + EquivalenceClass *right_ec pg_node_attr(copy_as_scalar, equal_ignore, read_write_ignore); + /* EquivalenceMember for lefthand */ + EquivalenceMember *left_em pg_node_attr(copy_as_scalar, equal_ignore); + /* EquivalenceMember for righthand */ + EquivalenceMember *right_em pg_node_attr(copy_as_scalar, equal_ignore); + + /* + * List of MergeScanSelCache structs. Those aren't Nodes, so hard to + * copy; instead replace with NIL. That has the effect that copying will + * just reset the cache. Likewise, can't compare or print them. + */ + List *scansel_cache pg_node_attr(copy_as(NIL), equal_ignore, read_write_ignore); + + /* + * transient workspace for use while considering a specific join path; T = + * outer var on left, F = on right + */ + bool outer_is_left pg_node_attr(equal_ignore); + + /* + * copy of clause operator; valid if clause is hashjoinable, else + * InvalidOid + */ + Oid hashjoinoperator pg_node_attr(equal_ignore); + + /* + * cache space for hashclause processing; -1 if not yet set + */ + /* avg bucketsize of left side */ + Selectivity left_bucketsize pg_node_attr(equal_ignore); + /* avg bucketsize of right side */ + Selectivity right_bucketsize pg_node_attr(equal_ignore); + /* left side's most common val's freq */ + Selectivity left_mcvfreq pg_node_attr(equal_ignore); + /* right side's most common val's freq */ + Selectivity right_mcvfreq pg_node_attr(equal_ignore); + + /* hash equality operators used for memoize nodes, else InvalidOid */ + Oid left_hasheqoperator pg_node_attr(equal_ignore); + Oid right_hasheqoperator pg_node_attr(equal_ignore); +} RestrictInfo; + +/* + * This macro embodies the correct way to test whether a RestrictInfo is + * "pushed down" to a given outer join, that is, should be treated as a filter + * clause rather than a join clause at that outer join. This is certainly so + * if is_pushed_down is true; but examining that is not sufficient anymore, + * because outer-join clauses will get pushed down to lower outer joins when + * we generate a path for the lower outer join that is parameterized by the + * LHS of the upper one. We can detect such a clause by noting that its + * required_relids exceed the scope of the join. + */ +#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids) \ + ((rinfo)->is_pushed_down || \ + !bms_is_subset((rinfo)->required_relids, joinrelids)) + +/* + * Since mergejoinscansel() is a relatively expensive function, and would + * otherwise be invoked many times while planning a large join tree, + * we go out of our way to cache its results. Each mergejoinable + * RestrictInfo carries a list of the specific sort orderings that have + * been considered for use with it, and the resulting selectivities. + */ +typedef struct MergeScanSelCache +{ + /* Ordering details (cache lookup key) */ + Oid opfamily; /* btree opfamily defining the ordering */ + Oid collation; /* collation for the ordering */ + int strategy; /* sort direction (ASC or DESC) */ + bool nulls_first; /* do NULLs come before normal values? */ + /* Results */ + Selectivity leftstartsel; /* first-join fraction for clause left side */ + Selectivity leftendsel; /* last-join fraction for clause left side */ + Selectivity rightstartsel; /* first-join fraction for clause right side */ + Selectivity rightendsel; /* last-join fraction for clause right side */ +} MergeScanSelCache; + +/* + * Placeholder node for an expression to be evaluated below the top level + * of a plan tree. This is used during planning to represent the contained + * expression. At the end of the planning process it is replaced by either + * the contained expression or a Var referring to a lower-level evaluation of + * the contained expression. Generally the evaluation occurs below an outer + * join, and Var references above the outer join might thereby yield NULL + * instead of the expression value. + * + * phrels and phlevelsup correspond to the varno/varlevelsup fields of a + * plain Var, except that phrels has to be a relid set since the evaluation + * level of a PlaceHolderVar might be a join rather than a base relation. + * Likewise, phnullingrels corresponds to varnullingrels. + * + * Although the planner treats this as an expression node type, it is not + * recognized by the parser or executor, so we declare it here rather than + * in primnodes.h. + * + * We intentionally do not compare phexpr. Two PlaceHolderVars with the + * same ID and levelsup should be considered equal even if the contained + * expressions have managed to mutate to different states. This will + * happen during final plan construction when there are nested PHVs, since + * the inner PHV will get replaced by a Param in some copies of the outer + * PHV. Another way in which it can happen is that initplan sublinks + * could get replaced by differently-numbered Params when sublink folding + * is done. (The end result of such a situation would be some + * unreferenced initplans, which is annoying but not really a problem.) + * On the same reasoning, there is no need to examine phrels. But we do + * need to compare phnullingrels, as that represents effects that are + * external to the original value of the PHV. + */ + +typedef struct PlaceHolderVar +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + + /* the represented expression */ + Expr *phexpr pg_node_attr(equal_ignore); + + /* base+OJ relids syntactically within expr src */ + Relids phrels pg_node_attr(equal_ignore); + + /* RT indexes of outer joins that can null PHV's value */ + Relids phnullingrels; + + /* ID for PHV (unique within planner run) */ + Index phid; + + /* > 0 if PHV belongs to outer query */ + Index phlevelsup; +} PlaceHolderVar; + +/* + * "Special join" info. + * + * One-sided outer joins constrain the order of joining partially but not + * completely. We flatten such joins into the planner's top-level list of + * relations to join, but record information about each outer join in a + * SpecialJoinInfo struct. These structs are kept in the PlannerInfo node's + * join_info_list. + * + * Similarly, semijoins and antijoins created by flattening IN (subselect) + * and EXISTS(subselect) clauses create partial constraints on join order. + * These are likewise recorded in SpecialJoinInfo structs. + * + * We make SpecialJoinInfos for FULL JOINs even though there is no flexibility + * of planning for them, because this simplifies make_join_rel()'s API. + * + * min_lefthand and min_righthand are the sets of base+OJ relids that must be + * available on each side when performing the special join. + * It is not valid for either min_lefthand or min_righthand to be empty sets; + * if they were, this would break the logic that enforces join order. + * + * syn_lefthand and syn_righthand are the sets of base+OJ relids that are + * syntactically below this special join. (These are needed to help compute + * min_lefthand and min_righthand for higher joins.) + * + * jointype is never JOIN_RIGHT; a RIGHT JOIN is handled by switching + * the inputs to make it a LEFT JOIN. It's never JOIN_RIGHT_ANTI either. + * So the allowed values of jointype in a join_info_list member are only + * LEFT, FULL, SEMI, or ANTI. + * + * ojrelid is the RT index of the join RTE representing this outer join, + * if there is one. It is zero when jointype is INNER or SEMI, and can be + * zero for jointype ANTI (if the join was transformed from a SEMI join). + * One use for this field is that when constructing the output targetlist of a + * join relation that implements this OJ, we add ojrelid to the varnullingrels + * and phnullingrels fields of nullable (RHS) output columns, so that the + * output Vars and PlaceHolderVars correctly reflect the nulling that has + * potentially happened to them. + * + * commute_above_l is filled with the relids of syntactically-higher outer + * joins that have been found to commute with this one per outer join identity + * 3 (see optimizer/README), when this join is in the LHS of the upper join + * (so, this is the lower join in the first form of the identity). + * + * commute_above_r is filled with the relids of syntactically-higher outer + * joins that have been found to commute with this one per outer join identity + * 3, when this join is in the RHS of the upper join (so, this is the lower + * join in the second form of the identity). + * + * commute_below_l is filled with the relids of syntactically-lower outer + * joins that have been found to commute with this one per outer join identity + * 3 and are in the LHS of this join (so, this is the upper join in the first + * form of the identity). + * + * commute_below_r is filled with the relids of syntactically-lower outer + * joins that have been found to commute with this one per outer join identity + * 3 and are in the RHS of this join (so, this is the upper join in the second + * form of the identity). + * + * lhs_strict is true if the special join's condition cannot succeed when the + * LHS variables are all NULL (this means that an outer join can commute with + * upper-level outer joins even if it appears in their RHS). We don't bother + * to set lhs_strict for FULL JOINs, however. + * + * For a semijoin, we also extract the join operators and their RHS arguments + * and set semi_operators, semi_rhs_exprs, semi_can_btree, and semi_can_hash. + * This is done in support of possibly unique-ifying the RHS, so we don't + * bother unless at least one of semi_can_btree and semi_can_hash can be set + * true. (You might expect that this information would be computed during + * join planning; but it's helpful to have it available during planning of + * parameterized table scans, so we store it in the SpecialJoinInfo structs.) + * + * For purposes of join selectivity estimation, we create transient + * SpecialJoinInfo structures for regular inner joins; so it is possible + * to have jointype == JOIN_INNER in such a structure, even though this is + * not allowed within join_info_list. We also create transient + * SpecialJoinInfos with jointype == JOIN_INNER for outer joins, since for + * cost estimation purposes it is sometimes useful to know the join size under + * plain innerjoin semantics. Note that lhs_strict and the semi_xxx fields + * are not set meaningfully within such structs. + * + * We also create transient SpecialJoinInfos for child joins during + * partitionwise join planning, which are also not present in join_info_list. + */ +#ifndef HAVE_SPECIALJOININFO_TYPEDEF +typedef struct SpecialJoinInfo SpecialJoinInfo; +#define HAVE_SPECIALJOININFO_TYPEDEF 1 +#endif + +struct SpecialJoinInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + Relids min_lefthand; /* base+OJ relids in minimum LHS for join */ + Relids min_righthand; /* base+OJ relids in minimum RHS for join */ + Relids syn_lefthand; /* base+OJ relids syntactically within LHS */ + Relids syn_righthand; /* base+OJ relids syntactically within RHS */ + JoinType jointype; /* always INNER, LEFT, FULL, SEMI, or ANTI */ + Index ojrelid; /* outer join's RT index; 0 if none */ + Relids commute_above_l; /* commuting OJs above this one, if LHS */ + Relids commute_above_r; /* commuting OJs above this one, if RHS */ + Relids commute_below_l; /* commuting OJs in this one's LHS */ + Relids commute_below_r; /* commuting OJs in this one's RHS */ + bool lhs_strict; /* joinclause is strict for some LHS rel */ + /* Remaining fields are set only for JOIN_SEMI jointype: */ + bool semi_can_btree; /* true if semi_operators are all btree */ + bool semi_can_hash; /* true if semi_operators are all hash */ + List *semi_operators; /* OIDs of equality join operators */ + List *semi_rhs_exprs; /* righthand-side expressions of these ops */ +}; + +/* + * Transient outer-join clause info. + * + * We set aside every outer join ON clause that looks mergejoinable, + * and process it specially at the end of qual distribution. + */ +typedef struct OuterJoinClauseInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + RestrictInfo *rinfo; /* a mergejoinable outer-join clause */ + SpecialJoinInfo *sjinfo; /* the outer join's SpecialJoinInfo */ +} OuterJoinClauseInfo; + +/* + * Append-relation info. + * + * When we expand an inheritable table or a UNION-ALL subselect into an + * "append relation" (essentially, a list of child RTEs), we build an + * AppendRelInfo for each child RTE. The list of AppendRelInfos indicates + * which child RTEs must be included when expanding the parent, and each node + * carries information needed to translate between columns of the parent and + * columns of the child. + * + * These structs are kept in the PlannerInfo node's append_rel_list, with + * append_rel_array[] providing a convenient lookup method for the struct + * associated with a particular child relid (there can be only one, though + * parent rels may have many entries in append_rel_list). + * + * Note: after completion of the planner prep phase, any given RTE is an + * append parent having entries in append_rel_list if and only if its + * "inh" flag is set. We clear "inh" for plain tables that turn out not + * to have inheritance children, and (in an abuse of the original meaning + * of the flag) we set "inh" for subquery RTEs that turn out to be + * flattenable UNION ALL queries. This lets us avoid useless searches + * of append_rel_list. + * + * Note: the data structure assumes that append-rel members are single + * baserels. This is OK for inheritance, but it prevents us from pulling + * up a UNION ALL member subquery if it contains a join. While that could + * be fixed with a more complex data structure, at present there's not much + * point because no improvement in the plan could result. + */ + +typedef struct AppendRelInfo +{ + pg_node_attr(no_query_jumble) + + NodeTag type; + + /* + * These fields uniquely identify this append relationship. There can be + * (in fact, always should be) multiple AppendRelInfos for the same + * parent_relid, but never more than one per child_relid, since a given + * RTE cannot be a child of more than one append parent. + */ + Index parent_relid; /* RT index of append parent rel */ + Index child_relid; /* RT index of append child rel */ + + /* + * For an inheritance appendrel, the parent and child are both regular + * relations, and we store their rowtype OIDs here for use in translating + * whole-row Vars. For a UNION-ALL appendrel, the parent and child are + * both subqueries with no named rowtype, and we store InvalidOid here. + */ + Oid parent_reltype; /* OID of parent's composite type */ + Oid child_reltype; /* OID of child's composite type */ + + /* + * The N'th element of this list is a Var or expression representing the + * child column corresponding to the N'th column of the parent. This is + * used to translate Vars referencing the parent rel into references to + * the child. A list element is NULL if it corresponds to a dropped + * column of the parent (this is only possible for inheritance cases, not + * UNION ALL). The list elements are always simple Vars for inheritance + * cases, but can be arbitrary expressions in UNION ALL cases. + * + * Notice we only store entries for user columns (attno > 0). Whole-row + * Vars are special-cased, and system columns (attno < 0) need no special + * translation since their attnos are the same for all tables. + * + * Caution: the Vars have varlevelsup = 0. Be careful to adjust as needed + * when copying into a subquery. + */ + List *translated_vars; /* Expressions in the child's Vars */ + + /* + * This array simplifies translations in the reverse direction, from + * child's column numbers to parent's. The entry at [ccolno - 1] is the + * 1-based parent column number for child column ccolno, or zero if that + * child column is dropped or doesn't exist in the parent. + */ + int num_child_cols; /* length of array */ + AttrNumber *parent_colnos pg_node_attr(array_size(num_child_cols)); + + /* + * We store the parent table's OID here for inheritance, or InvalidOid for + * UNION ALL. This is only needed to help in generating error messages if + * an attempt is made to reference a dropped parent column. + */ + Oid parent_reloid; /* OID of parent relation */ +} AppendRelInfo; + +/* + * Information about a row-identity "resjunk" column in UPDATE/DELETE/MERGE. + * + * In partitioned UPDATE/DELETE/MERGE it's important for child partitions to + * share row-identity columns whenever possible, so as not to chew up too many + * targetlist columns. We use these structs to track which identity columns + * have been requested. In the finished plan, each of these will give rise + * to one resjunk entry in the targetlist of the ModifyTable's subplan node. + * + * All the Vars stored in RowIdentityVarInfos must have varno ROWID_VAR, for + * convenience of detecting duplicate requests. We'll replace that, in the + * final plan, with the varno of the generating rel. + * + * Outside this list, a Var with varno ROWID_VAR and varattno k is a reference + * to the k-th element of the row_identity_vars list (k counting from 1). + * We add such a reference to root->processed_tlist when creating the entry, + * and it propagates into the plan tree from there. + */ +typedef struct RowIdentityVarInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Var *rowidvar; /* Var to be evaluated (but varno=ROWID_VAR) */ + int32 rowidwidth; /* estimated average width */ + char *rowidname; /* name of the resjunk column */ + Relids rowidrels; /* RTE indexes of target rels using this */ +} RowIdentityVarInfo; + +/* + * For each distinct placeholder expression generated during planning, we + * store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list. + * This stores info that is needed centrally rather than in each copy of the + * PlaceHolderVar. The phid fields identify which PlaceHolderInfo goes with + * each PlaceHolderVar. Note that phid is unique throughout a planner run, + * not just within a query level --- this is so that we need not reassign ID's + * when pulling a subquery into its parent. + * + * The idea is to evaluate the expression at (only) the ph_eval_at join level, + * then allow it to bubble up like a Var until the ph_needed join level. + * ph_needed has the same definition as attr_needed for a regular Var. + * + * The PlaceHolderVar's expression might contain LATERAL references to vars + * coming from outside its syntactic scope. If so, those rels are *not* + * included in ph_eval_at, but they are recorded in ph_lateral. + * + * Notice that when ph_eval_at is a join rather than a single baserel, the + * PlaceHolderInfo may create constraints on join order: the ph_eval_at join + * has to be formed below any outer joins that should null the PlaceHolderVar. + * + * We create a PlaceHolderInfo only after determining that the PlaceHolderVar + * is actually referenced in the plan tree, so that unreferenced placeholders + * don't result in unnecessary constraints on join order. + */ + +typedef struct PlaceHolderInfo +{ + pg_node_attr(no_read, no_query_jumble) + + NodeTag type; + + /* ID for PH (unique within planner run) */ + Index phid; + + /* + * copy of PlaceHolderVar tree (should be redundant for comparison, could + * be ignored) + */ + PlaceHolderVar *ph_var; + + /* lowest level we can evaluate value at */ + Relids ph_eval_at; + + /* relids of contained lateral refs, if any */ + Relids ph_lateral; + + /* highest level the value is needed at */ + Relids ph_needed; + + /* estimated attribute width */ + int32 ph_width; +} PlaceHolderInfo; + +/* + * This struct describes one potentially index-optimizable MIN/MAX aggregate + * function. MinMaxAggPath contains a list of these, and if we accept that + * path, the list is stored into root->minmax_aggs for use during setrefs.c. + */ +typedef struct MinMaxAggInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* pg_proc Oid of the aggregate */ + Oid aggfnoid; + + /* Oid of its sort operator */ + Oid aggsortop; + + /* expression we are aggregating on */ + Expr *target; + + /* + * modified "root" for planning the subquery; not printed, too large, not + * interesting enough + */ + PlannerInfo *subroot pg_node_attr(read_write_ignore); + + /* access path for subquery */ + Path *path; + + /* estimated cost to fetch first row */ + Cost pathcost; + + /* param for subplan's output */ + Param *param; +} MinMaxAggInfo; + +/* + * At runtime, PARAM_EXEC slots are used to pass values around from one plan + * node to another. They can be used to pass values down into subqueries (for + * outer references in subqueries), or up out of subqueries (for the results + * of a subplan), or from a NestLoop plan node into its inner relation (when + * the inner scan is parameterized with values from the outer relation). + * The planner is responsible for assigning nonconflicting PARAM_EXEC IDs to + * the PARAM_EXEC Params it generates. + * + * Outer references are managed via root->plan_params, which is a list of + * PlannerParamItems. While planning a subquery, each parent query level's + * plan_params contains the values required from it by the current subquery. + * During create_plan(), we use plan_params to track values that must be + * passed from outer to inner sides of NestLoop plan nodes. + * + * The item a PlannerParamItem represents can be one of three kinds: + * + * A Var: the slot represents a variable of this level that must be passed + * down because subqueries have outer references to it, or must be passed + * from a NestLoop node to its inner scan. The varlevelsup value in the Var + * will always be zero. + * + * A PlaceHolderVar: this works much like the Var case, except that the + * entry is a PlaceHolderVar node with a contained expression. The PHV + * will have phlevelsup = 0, and the contained expression is adjusted + * to match in level. + * + * An Aggref (with an expression tree representing its argument): the slot + * represents an aggregate expression that is an outer reference for some + * subquery. The Aggref itself has agglevelsup = 0, and its argument tree + * is adjusted to match in level. + * + * Note: we detect duplicate Var and PlaceHolderVar parameters and coalesce + * them into one slot, but we do not bother to do that for Aggrefs. + * The scope of duplicate-elimination only extends across the set of + * parameters passed from one query level into a single subquery, or for + * nestloop parameters across the set of nestloop parameters used in a single + * query level. So there is no possibility of a PARAM_EXEC slot being used + * for conflicting purposes. + * + * In addition, PARAM_EXEC slots are assigned for Params representing outputs + * from subplans (values that are setParam items for those subplans). These + * IDs need not be tracked via PlannerParamItems, since we do not need any + * duplicate-elimination nor later processing of the represented expressions. + * Instead, we just record the assignment of the slot number by appending to + * root->glob->paramExecTypes. + */ +typedef struct PlannerParamItem +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + Node *item; /* the Var, PlaceHolderVar, or Aggref */ + int paramId; /* its assigned PARAM_EXEC slot number */ +} PlannerParamItem; + +/* + * When making cost estimates for a SEMI/ANTI/inner_unique join, there are + * some correction factors that are needed in both nestloop and hash joins + * to account for the fact that the executor can stop scanning inner rows + * as soon as it finds a match to the current outer row. These numbers + * depend only on the selected outer and inner join relations, not on the + * particular paths used for them, so it's worthwhile to calculate them + * just once per relation pair not once per considered path. This struct + * is filled by compute_semi_anti_join_factors and must be passed along + * to the join cost estimation functions. + * + * outer_match_frac is the fraction of the outer tuples that are + * expected to have at least one match. + * match_count is the average number of matches expected for + * outer tuples that have at least one match. + */ +typedef struct SemiAntiJoinFactors +{ + Selectivity outer_match_frac; + Selectivity match_count; +} SemiAntiJoinFactors; + +/* + * Struct for extra information passed to subroutines of add_paths_to_joinrel + * + * restrictlist contains all of the RestrictInfo nodes for restriction + * clauses that apply to this join + * mergeclause_list is a list of RestrictInfo nodes for available + * mergejoin clauses in this join + * inner_unique is true if each outer tuple provably matches no more + * than one inner tuple + * sjinfo is extra info about special joins for selectivity estimation + * semifactors is as shown above (only valid for SEMI/ANTI/inner_unique joins) + * param_source_rels are OK targets for parameterization of result paths + */ +typedef struct JoinPathExtraData +{ + List *restrictlist; + List *mergeclause_list; + bool inner_unique; + SpecialJoinInfo *sjinfo; + SemiAntiJoinFactors semifactors; + Relids param_source_rels; +} JoinPathExtraData; + +/* + * Various flags indicating what kinds of grouping are possible. + * + * GROUPING_CAN_USE_SORT should be set if it's possible to perform + * sort-based implementations of grouping. When grouping sets are in use, + * this will be true if sorting is potentially usable for any of the grouping + * sets, even if it's not usable for all of them. + * + * GROUPING_CAN_USE_HASH should be set if it's possible to perform + * hash-based implementations of grouping. + * + * GROUPING_CAN_PARTIAL_AGG should be set if the aggregation is of a type + * for which we support partial aggregation (not, for example, grouping sets). + * It says nothing about parallel-safety or the availability of suitable paths. + */ +#define GROUPING_CAN_USE_SORT 0x0001 +#define GROUPING_CAN_USE_HASH 0x0002 +#define GROUPING_CAN_PARTIAL_AGG 0x0004 + +/* + * What kind of partitionwise aggregation is in use? + * + * PARTITIONWISE_AGGREGATE_NONE: Not used. + * + * PARTITIONWISE_AGGREGATE_FULL: Aggregate each partition separately, and + * append the results. + * + * PARTITIONWISE_AGGREGATE_PARTIAL: Partially aggregate each partition + * separately, append the results, and then finalize aggregation. + */ +typedef enum +{ + PARTITIONWISE_AGGREGATE_NONE, + PARTITIONWISE_AGGREGATE_FULL, + PARTITIONWISE_AGGREGATE_PARTIAL, +} PartitionwiseAggregateType; + +/* + * Struct for extra information passed to subroutines of create_grouping_paths + * + * flags indicating what kinds of grouping are possible. + * partial_costs_set is true if the agg_partial_costs and agg_final_costs + * have been initialized. + * agg_partial_costs gives partial aggregation costs. + * agg_final_costs gives finalization costs. + * target_parallel_safe is true if target is parallel safe. + * havingQual gives list of quals to be applied after aggregation. + * targetList gives list of columns to be projected. + * patype is the type of partitionwise aggregation that is being performed. + */ +typedef struct +{ + /* Data which remains constant once set. */ + int flags; + bool partial_costs_set; + AggClauseCosts agg_partial_costs; + AggClauseCosts agg_final_costs; + + /* Data which may differ across partitions. */ + bool target_parallel_safe; + Node *havingQual; + List *targetList; + PartitionwiseAggregateType patype; +} GroupPathExtraData; + +/* + * Struct for extra information passed to subroutines of grouping_planner + * + * limit_needed is true if we actually need a Limit plan node. + * limit_tuples is an estimated bound on the number of output tuples, + * or -1 if no LIMIT or couldn't estimate. + * count_est and offset_est are the estimated values of the LIMIT and OFFSET + * expressions computed by preprocess_limit() (see comments for + * preprocess_limit() for more information). + */ +typedef struct +{ + bool limit_needed; + Cardinality limit_tuples; + int64 count_est; + int64 offset_est; +} FinalPathExtraData; + +/* + * For speed reasons, cost estimation for join paths is performed in two + * phases: the first phase tries to quickly derive a lower bound for the + * join cost, and then we check if that's sufficient to reject the path. + * If not, we come back for a more refined cost estimate. The first phase + * fills a JoinCostWorkspace struct with its preliminary cost estimates + * and possibly additional intermediate values. The second phase takes + * these values as inputs to avoid repeating work. + * + * (Ideally we'd declare this in cost.h, but it's also needed in pathnode.h, + * so seems best to put it here.) + */ +typedef struct JoinCostWorkspace +{ + /* Preliminary cost estimates --- must not be larger than final ones! */ + Cost startup_cost; /* cost expended before fetching any tuples */ + Cost total_cost; /* total cost (assuming all tuples fetched) */ + + /* Fields below here should be treated as private to costsize.c */ + Cost run_cost; /* non-startup cost components */ + + /* private for cost_nestloop code */ + Cost inner_run_cost; /* also used by cost_mergejoin code */ + Cost inner_rescan_run_cost; + + /* private for cost_mergejoin code */ + Cardinality outer_rows; + Cardinality inner_rows; + Cardinality outer_skip_rows; + Cardinality inner_skip_rows; + + /* private for cost_hashjoin code */ + int numbuckets; + int numbatches; + Cardinality inner_rows_total; +} JoinCostWorkspace; + +/* + * AggInfo holds information about an aggregate that needs to be computed. + * Multiple Aggrefs in a query can refer to the same AggInfo by having the + * same 'aggno' value, so that the aggregate is computed only once. + */ +typedef struct AggInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* + * List of Aggref exprs that this state value is for. + * + * There will always be at least one, but there can be multiple identical + * Aggref's sharing the same per-agg. + */ + List *aggrefs; + + /* Transition state number for this aggregate */ + int transno; + + /* + * "shareable" is false if this agg cannot share state values with other + * aggregates because the final function is read-write. + */ + bool shareable; + + /* Oid of the final function, or InvalidOid if none */ + Oid finalfn_oid; +} AggInfo; + +/* + * AggTransInfo holds information about transition state that is used by one + * or more aggregates in the query. Multiple aggregates can share the same + * transition state, if they have the same inputs and the same transition + * function. Aggrefs that share the same transition info have the same + * 'aggtransno' value. + */ +typedef struct AggTransInfo +{ + pg_node_attr(no_copy_equal, no_read, no_query_jumble) + + NodeTag type; + + /* Inputs for this transition state */ + List *args; + Expr *aggfilter; + + /* Oid of the state transition function */ + Oid transfn_oid; + + /* Oid of the serialization function, or InvalidOid if none */ + Oid serialfn_oid; + + /* Oid of the deserialization function, or InvalidOid if none */ + Oid deserialfn_oid; + + /* Oid of the combine function, or InvalidOid if none */ + Oid combinefn_oid; + + /* Oid of state value's datatype */ + Oid aggtranstype; + + /* Additional data about transtype */ + int32 aggtranstypmod; + int transtypeLen; + bool transtypeByVal; + + /* Space-consumption estimate */ + int32 aggtransspace; + + /* Initial value from pg_aggregate entry */ + Datum initValue pg_node_attr(read_write_ignore); + bool initValueIsNull; +} AggTransInfo; + +#endif /* PATHNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/pg_list.h b/platform/dbops/binaries/postgres/include/server/nodes/pg_list.h new file mode 100644 index 0000000000000000000000000000000000000000..d131350e107468d8475fe35fcb95b9ae6b2ae765 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/pg_list.h @@ -0,0 +1,686 @@ +/*------------------------------------------------------------------------- + * + * pg_list.h + * interface for PostgreSQL generic list package + * + * Once upon a time, parts of Postgres were written in Lisp and used real + * cons-cell lists for major data structures. When that code was rewritten + * in C, we initially had a faithful emulation of cons-cell lists, which + * unsurprisingly was a performance bottleneck. A couple of major rewrites + * later, these data structures are actually simple expansible arrays; + * but the "List" name and a lot of the notation survives. + * + * One important concession to the original implementation is that an empty + * list is always represented by a null pointer (preferentially written NIL). + * Non-empty lists have a header, which will not be relocated as long as the + * list remains non-empty, and an expansible data array. + * + * We support four types of lists: + * + * T_List: lists of pointers + * (in practice usually pointers to Nodes, but not always; + * declared as "void *" to minimize casting annoyances) + * T_IntList: lists of integers + * T_OidList: lists of Oids + * T_XidList: lists of TransactionIds + * (the XidList infrastructure is less complete than the other cases) + * + * (At the moment, ints, Oids, and XIDs are the same size, but they may not + * always be so; be careful to use the appropriate list type for your data.) + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/pg_list.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LIST_H +#define PG_LIST_H + +#include "nodes/nodes.h" + + +typedef union ListCell +{ + void *ptr_value; + int int_value; + Oid oid_value; + TransactionId xid_value; +} ListCell; + +typedef struct List +{ + NodeTag type; /* T_List, T_IntList, T_OidList, or T_XidList */ + int length; /* number of elements currently present */ + int max_length; /* allocated length of elements[] */ + ListCell *elements; /* re-allocatable array of cells */ + /* We may allocate some cells along with the List header: */ + ListCell initial_elements[FLEXIBLE_ARRAY_MEMBER]; + /* If elements == initial_elements, it's not a separate allocation */ +} List; + +/* + * The *only* valid representation of an empty list is NIL; in other + * words, a non-NIL list is guaranteed to have length >= 1. + */ +#define NIL ((List *) NULL) + +/* + * State structs for various looping macros below. + */ +typedef struct ForEachState +{ + const List *l; /* list we're looping through */ + int i; /* current element index */ +} ForEachState; + +typedef struct ForBothState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + int i; /* common element index */ +} ForBothState; + +typedef struct ForBothCellState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + int i1; /* current element indexes */ + int i2; +} ForBothCellState; + +typedef struct ForThreeState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + int i; /* common element index */ +} ForThreeState; + +typedef struct ForFourState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + const List *l4; + int i; /* common element index */ +} ForFourState; + +typedef struct ForFiveState +{ + const List *l1; /* lists we're looping through */ + const List *l2; + const List *l3; + const List *l4; + const List *l5; + int i; /* common element index */ +} ForFiveState; + +/* + * These routines are small enough, and used often enough, to justify being + * inline. + */ + +/* Fetch address of list's first cell; NULL if empty list */ +static inline ListCell * +list_head(const List *l) +{ + return l ? &l->elements[0] : NULL; +} + +/* Fetch address of list's last cell; NULL if empty list */ +static inline ListCell * +list_tail(const List *l) +{ + return l ? &l->elements[l->length - 1] : NULL; +} + +/* Fetch address of list's second cell, if it has one, else NULL */ +static inline ListCell * +list_second_cell(const List *l) +{ + if (l && l->length >= 2) + return &l->elements[1]; + else + return NULL; +} + +/* Fetch list's length */ +static inline int +list_length(const List *l) +{ + return l ? l->length : 0; +} + +/* + * Macros to access the data values within List cells. + * + * Note that with the exception of the "xxx_node" macros, these are + * lvalues and can be assigned to. + * + * NB: There is an unfortunate legacy from a previous incarnation of + * the List API: the macro lfirst() was used to mean "the data in this + * cons cell". To avoid changing every usage of lfirst(), that meaning + * has been kept. As a result, lfirst() takes a ListCell and returns + * the data it contains; to get the data in the first cell of a + * List, use linitial(). Worse, lsecond() is more closely related to + * linitial() than lfirst(): given a List, lsecond() returns the data + * in the second list cell. + */ +#define lfirst(lc) ((lc)->ptr_value) +#define lfirst_int(lc) ((lc)->int_value) +#define lfirst_oid(lc) ((lc)->oid_value) +#define lfirst_xid(lc) ((lc)->xid_value) +#define lfirst_node(type,lc) castNode(type, lfirst(lc)) + +#define linitial(l) lfirst(list_nth_cell(l, 0)) +#define linitial_int(l) lfirst_int(list_nth_cell(l, 0)) +#define linitial_oid(l) lfirst_oid(list_nth_cell(l, 0)) +#define linitial_node(type,l) castNode(type, linitial(l)) + +#define lsecond(l) lfirst(list_nth_cell(l, 1)) +#define lsecond_int(l) lfirst_int(list_nth_cell(l, 1)) +#define lsecond_oid(l) lfirst_oid(list_nth_cell(l, 1)) +#define lsecond_node(type,l) castNode(type, lsecond(l)) + +#define lthird(l) lfirst(list_nth_cell(l, 2)) +#define lthird_int(l) lfirst_int(list_nth_cell(l, 2)) +#define lthird_oid(l) lfirst_oid(list_nth_cell(l, 2)) +#define lthird_node(type,l) castNode(type, lthird(l)) + +#define lfourth(l) lfirst(list_nth_cell(l, 3)) +#define lfourth_int(l) lfirst_int(list_nth_cell(l, 3)) +#define lfourth_oid(l) lfirst_oid(list_nth_cell(l, 3)) +#define lfourth_node(type,l) castNode(type, lfourth(l)) + +#define llast(l) lfirst(list_last_cell(l)) +#define llast_int(l) lfirst_int(list_last_cell(l)) +#define llast_oid(l) lfirst_oid(list_last_cell(l)) +#define llast_xid(l) lfirst_xid(list_last_cell(l)) +#define llast_node(type,l) castNode(type, llast(l)) + +/* + * Convenience macros for building fixed-length lists + */ +#define list_make_ptr_cell(v) ((ListCell) {.ptr_value = (v)}) +#define list_make_int_cell(v) ((ListCell) {.int_value = (v)}) +#define list_make_oid_cell(v) ((ListCell) {.oid_value = (v)}) +#define list_make_xid_cell(v) ((ListCell) {.xid_value = (v)}) + +#define list_make1(x1) \ + list_make1_impl(T_List, list_make_ptr_cell(x1)) +#define list_make2(x1,x2) \ + list_make2_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2)) +#define list_make3(x1,x2,x3) \ + list_make3_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3)) +#define list_make4(x1,x2,x3,x4) \ + list_make4_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3), list_make_ptr_cell(x4)) +#define list_make5(x1,x2,x3,x4,x5) \ + list_make5_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2), \ + list_make_ptr_cell(x3), list_make_ptr_cell(x4), \ + list_make_ptr_cell(x5)) + +#define list_make1_int(x1) \ + list_make1_impl(T_IntList, list_make_int_cell(x1)) +#define list_make2_int(x1,x2) \ + list_make2_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2)) +#define list_make3_int(x1,x2,x3) \ + list_make3_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3)) +#define list_make4_int(x1,x2,x3,x4) \ + list_make4_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3), list_make_int_cell(x4)) +#define list_make5_int(x1,x2,x3,x4,x5) \ + list_make5_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2), \ + list_make_int_cell(x3), list_make_int_cell(x4), \ + list_make_int_cell(x5)) + +#define list_make1_oid(x1) \ + list_make1_impl(T_OidList, list_make_oid_cell(x1)) +#define list_make2_oid(x1,x2) \ + list_make2_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2)) +#define list_make3_oid(x1,x2,x3) \ + list_make3_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3)) +#define list_make4_oid(x1,x2,x3,x4) \ + list_make4_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3), list_make_oid_cell(x4)) +#define list_make5_oid(x1,x2,x3,x4,x5) \ + list_make5_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2), \ + list_make_oid_cell(x3), list_make_oid_cell(x4), \ + list_make_oid_cell(x5)) + +#define list_make1_xid(x1) \ + list_make1_impl(T_XidList, list_make_xid_cell(x1)) +#define list_make2_xid(x1,x2) \ + list_make2_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2)) +#define list_make3_xid(x1,x2,x3) \ + list_make3_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3)) +#define list_make4_xid(x1,x2,x3,x4) \ + list_make4_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3), list_make_xid_cell(x4)) +#define list_make5_xid(x1,x2,x3,x4,x5) \ + list_make5_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2), \ + list_make_xid_cell(x3), list_make_xid_cell(x4), \ + list_make_xid_cell(x5)) + +/* + * Locate the n'th cell (counting from 0) of the list. + * It is an assertion failure if there is no such cell. + */ +static inline ListCell * +list_nth_cell(const List *list, int n) +{ + Assert(list != NIL); + Assert(n >= 0 && n < list->length); + return &list->elements[n]; +} + +/* + * Return the last cell in a non-NIL List. + */ +static inline ListCell * +list_last_cell(const List *list) +{ + Assert(list != NIL); + return &list->elements[list->length - 1]; +} + +/* + * Return the pointer value contained in the n'th element of the + * specified list. (List elements begin at 0.) + */ +static inline void * +list_nth(const List *list, int n) +{ + Assert(IsA(list, List)); + return lfirst(list_nth_cell(list, n)); +} + +/* + * Return the integer value contained in the n'th element of the + * specified list. + */ +static inline int +list_nth_int(const List *list, int n) +{ + Assert(IsA(list, IntList)); + return lfirst_int(list_nth_cell(list, n)); +} + +/* + * Return the OID value contained in the n'th element of the specified + * list. + */ +static inline Oid +list_nth_oid(const List *list, int n) +{ + Assert(IsA(list, OidList)); + return lfirst_oid(list_nth_cell(list, n)); +} + +#define list_nth_node(type,list,n) castNode(type, list_nth(list, n)) + +/* + * Get the given ListCell's index (from 0) in the given List. + */ +static inline int +list_cell_number(const List *l, const ListCell *c) +{ + Assert(c >= &l->elements[0] && c < &l->elements[l->length]); + return c - l->elements; +} + +/* + * Get the address of the next cell after "c" within list "l", or NULL if none. + */ +static inline ListCell * +lnext(const List *l, const ListCell *c) +{ + Assert(c >= &l->elements[0] && c < &l->elements[l->length]); + c++; + if (c < &l->elements[l->length]) + return (ListCell *) c; + else + return NULL; +} + +/* + * foreach - + * a convenience macro for looping through a list + * + * "cell" must be the name of a "ListCell *" variable; it's made to point + * to each List element in turn. "cell" will be NULL after normal exit from + * the loop, but an early "break" will leave it pointing at the current + * List element. + * + * Beware of changing the List object while the loop is iterating. + * The current semantics are that we examine successive list indices in + * each iteration, so that insertion or deletion of list elements could + * cause elements to be re-visited or skipped unexpectedly. Previous + * implementations of foreach() behaved differently. However, it's safe + * to append elements to the List (or in general, insert them after the + * current element); such new elements are guaranteed to be visited. + * Also, the current element of the List can be deleted, if you use + * foreach_delete_current() to do so. BUT: either of these actions will + * invalidate the "cell" pointer for the remainder of the current iteration. + */ +#define foreach(cell, lst) \ + for (ForEachState cell##__state = {(lst), 0}; \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +/* + * foreach_delete_current - + * delete the current list element from the List associated with a + * surrounding foreach() or foreach_*() loop, returning the new List + * pointer; pass the name of the iterator variable. + * + * This is similar to list_delete_cell(), but it also adjusts the loop's state + * so that no list elements will be missed. Do not delete elements from an + * active foreach or foreach_* loop's list in any other way! + */ +#define foreach_delete_current(lst, var_or_cell) \ + ((List *) (var_or_cell##__state.l = list_delete_nth_cell(lst, var_or_cell##__state.i--))) + +/* + * foreach_current_index - + * get the zero-based list index of a surrounding foreach() or foreach_*() + * loop's current element; pass the name of the iterator variable. + * + * Beware of using this after foreach_delete_current(); the value will be + * out of sync for the rest of the current loop iteration. Anyway, since + * you just deleted the current element, the value is pretty meaningless. + */ +#define foreach_current_index(var_or_cell) (var_or_cell##__state.i) + +/* + * for_each_from - + * Like foreach(), but start from the N'th (zero-based) list element, + * not necessarily the first one. + * + * It's okay for N to exceed the list length, but not for it to be negative. + * + * The caveats for foreach() apply equally here. + */ +#define for_each_from(cell, lst, N) \ + for (ForEachState cell##__state = for_each_from_setup(lst, N); \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +static inline ForEachState +for_each_from_setup(const List *lst, int N) +{ + ForEachState r = {lst, N}; + + Assert(N >= 0); + return r; +} + +/* + * for_each_cell - + * a convenience macro which loops through a list starting from a + * specified cell + * + * The caveats for foreach() apply equally here. + */ +#define for_each_cell(cell, lst, initcell) \ + for (ForEachState cell##__state = for_each_cell_setup(lst, initcell); \ + (cell##__state.l != NIL && \ + cell##__state.i < cell##__state.l->length) ? \ + (cell = &cell##__state.l->elements[cell##__state.i], true) : \ + (cell = NULL, false); \ + cell##__state.i++) + +static inline ForEachState +for_each_cell_setup(const List *lst, const ListCell *initcell) +{ + ForEachState r = {lst, + initcell ? list_cell_number(lst, initcell) : list_length(lst)}; + + return r; +} + +/* + * Convenience macros that loop through a list without needing a separate + * "ListCell *" variable. Instead, the macros declare a locally-scoped loop + * variable with the provided name and the appropriate type. + * + * Since the variable is scoped to the loop, it's not possible to detect an + * early break by checking its value after the loop completes, as is common + * practice. If you need to do this, you can either use foreach() instead or + * manually track early breaks with a separate variable declared outside of the + * loop. + * + * Note that the caveats described in the comment above the foreach() macro + * also apply to these convenience macros. + */ +#define foreach_ptr(type, var, lst) foreach_internal(type, *, var, lst, lfirst) +#define foreach_int(var, lst) foreach_internal(int, , var, lst, lfirst_int) +#define foreach_oid(var, lst) foreach_internal(Oid, , var, lst, lfirst_oid) +#define foreach_xid(var, lst) foreach_internal(TransactionId, , var, lst, lfirst_xid) + +/* + * The internal implementation of the above macros. Do not use directly. + * + * This macro actually generates two loops in order to declare two variables of + * different types. The outer loop only iterates once, so we expect optimizing + * compilers will unroll it, thereby optimizing it away. + */ +#define foreach_internal(type, pointer, var, lst, func) \ + for (type pointer var = 0, pointer var##__outerloop = (type pointer) 1; \ + var##__outerloop; \ + var##__outerloop = 0) \ + for (ForEachState var##__state = {(lst), 0}; \ + (var##__state.l != NIL && \ + var##__state.i < var##__state.l->length && \ + (var = (type pointer) func(&var##__state.l->elements[var##__state.i]), true)); \ + var##__state.i++) + +/* + * foreach_node - + * The same as foreach_ptr, but asserts that the element is of the specified + * node type. + */ +#define foreach_node(type, var, lst) \ + for (type * var = 0, *var##__outerloop = (type *) 1; \ + var##__outerloop; \ + var##__outerloop = 0) \ + for (ForEachState var##__state = {(lst), 0}; \ + (var##__state.l != NIL && \ + var##__state.i < var##__state.l->length && \ + (var = lfirst_node(type, &var##__state.l->elements[var##__state.i]), true)); \ + var##__state.i++) + +/* + * forboth - + * a convenience macro for advancing through two linked lists + * simultaneously. This macro loops through both lists at the same + * time, stopping when either list runs out of elements. Depending + * on the requirements of the call site, it may also be wise to + * assert that the lengths of the two lists are equal. (But, if they + * are not, some callers rely on the ending cell values being separately + * NULL or non-NULL as defined here; don't try to optimize that.) + * + * The caveats for foreach() apply equally here. + */ +#define forboth(cell1, list1, cell2, list2) \ + for (ForBothState cell1##__state = {(list1), (list2), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + (cell1 != NULL && cell2 != NULL); \ + cell1##__state.i++) + +#define multi_for_advance_cell(cell, state, l, i) \ + (cell = (state.l != NIL && state.i < state.l->length) ? \ + &state.l->elements[state.i] : NULL) + +/* + * for_both_cell - + * a convenience macro which loops through two lists starting from the + * specified cells of each. This macro loops through both lists at the same + * time, stopping when either list runs out of elements. Depending on the + * requirements of the call site, it may also be wise to assert that the + * lengths of the two lists are equal, and initcell1 and initcell2 are at + * the same position in the respective lists. + * + * The caveats for foreach() apply equally here. + */ +#define for_both_cell(cell1, list1, initcell1, cell2, list2, initcell2) \ + for (ForBothCellState cell1##__state = \ + for_both_cell_setup(list1, initcell1, list2, initcell2); \ + multi_for_advance_cell(cell1, cell1##__state, l1, i1), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i2), \ + (cell1 != NULL && cell2 != NULL); \ + cell1##__state.i1++, cell1##__state.i2++) + +static inline ForBothCellState +for_both_cell_setup(const List *list1, const ListCell *initcell1, + const List *list2, const ListCell *initcell2) +{ + ForBothCellState r = {list1, list2, + initcell1 ? list_cell_number(list1, initcell1) : list_length(list1), + initcell2 ? list_cell_number(list2, initcell2) : list_length(list2)}; + + return r; +} + +/* + * forthree - + * the same for three lists + */ +#define forthree(cell1, list1, cell2, list2, cell3, list3) \ + for (ForThreeState cell1##__state = {(list1), (list2), (list3), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL); \ + cell1##__state.i++) + +/* + * forfour - + * the same for four lists + */ +#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4) \ + for (ForFourState cell1##__state = {(list1), (list2), (list3), (list4), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + multi_for_advance_cell(cell4, cell1##__state, l4, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL && cell4 != NULL); \ + cell1##__state.i++) + +/* + * forfive - + * the same for five lists + */ +#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5) \ + for (ForFiveState cell1##__state = {(list1), (list2), (list3), (list4), (list5), 0}; \ + multi_for_advance_cell(cell1, cell1##__state, l1, i), \ + multi_for_advance_cell(cell2, cell1##__state, l2, i), \ + multi_for_advance_cell(cell3, cell1##__state, l3, i), \ + multi_for_advance_cell(cell4, cell1##__state, l4, i), \ + multi_for_advance_cell(cell5, cell1##__state, l5, i), \ + (cell1 != NULL && cell2 != NULL && cell3 != NULL && \ + cell4 != NULL && cell5 != NULL); \ + cell1##__state.i++) + +/* Functions in src/backend/nodes/list.c */ + +extern List *list_make1_impl(NodeTag t, ListCell datum1); +extern List *list_make2_impl(NodeTag t, ListCell datum1, ListCell datum2); +extern List *list_make3_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3); +extern List *list_make4_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3, ListCell datum4); +extern List *list_make5_impl(NodeTag t, ListCell datum1, ListCell datum2, + ListCell datum3, ListCell datum4, + ListCell datum5); + +extern pg_nodiscard List *lappend(List *list, void *datum); +extern pg_nodiscard List *lappend_int(List *list, int datum); +extern pg_nodiscard List *lappend_oid(List *list, Oid datum); +extern pg_nodiscard List *lappend_xid(List *list, TransactionId datum); + +extern pg_nodiscard List *list_insert_nth(List *list, int pos, void *datum); +extern pg_nodiscard List *list_insert_nth_int(List *list, int pos, int datum); +extern pg_nodiscard List *list_insert_nth_oid(List *list, int pos, Oid datum); + +extern pg_nodiscard List *lcons(void *datum, List *list); +extern pg_nodiscard List *lcons_int(int datum, List *list); +extern pg_nodiscard List *lcons_oid(Oid datum, List *list); + +extern pg_nodiscard List *list_concat(List *list1, const List *list2); +extern pg_nodiscard List *list_concat_copy(const List *list1, const List *list2); + +extern pg_nodiscard List *list_truncate(List *list, int new_size); + +extern bool list_member(const List *list, const void *datum); +extern bool list_member_ptr(const List *list, const void *datum); +extern bool list_member_int(const List *list, int datum); +extern bool list_member_oid(const List *list, Oid datum); +extern bool list_member_xid(const List *list, TransactionId datum); + +extern pg_nodiscard List *list_delete(List *list, void *datum); +extern pg_nodiscard List *list_delete_ptr(List *list, void *datum); +extern pg_nodiscard List *list_delete_int(List *list, int datum); +extern pg_nodiscard List *list_delete_oid(List *list, Oid datum); +extern pg_nodiscard List *list_delete_first(List *list); +extern pg_nodiscard List *list_delete_last(List *list); +extern pg_nodiscard List *list_delete_first_n(List *list, int n); +extern pg_nodiscard List *list_delete_nth_cell(List *list, int n); +extern pg_nodiscard List *list_delete_cell(List *list, ListCell *cell); + +extern List *list_union(const List *list1, const List *list2); +extern List *list_union_ptr(const List *list1, const List *list2); +extern List *list_union_int(const List *list1, const List *list2); +extern List *list_union_oid(const List *list1, const List *list2); + +extern List *list_intersection(const List *list1, const List *list2); +extern List *list_intersection_int(const List *list1, const List *list2); + +/* currently, there's no need for list_intersection_ptr etc */ + +extern List *list_difference(const List *list1, const List *list2); +extern List *list_difference_ptr(const List *list1, const List *list2); +extern List *list_difference_int(const List *list1, const List *list2); +extern List *list_difference_oid(const List *list1, const List *list2); + +extern pg_nodiscard List *list_append_unique(List *list, void *datum); +extern pg_nodiscard List *list_append_unique_ptr(List *list, void *datum); +extern pg_nodiscard List *list_append_unique_int(List *list, int datum); +extern pg_nodiscard List *list_append_unique_oid(List *list, Oid datum); + +extern pg_nodiscard List *list_concat_unique(List *list1, const List *list2); +extern pg_nodiscard List *list_concat_unique_ptr(List *list1, const List *list2); +extern pg_nodiscard List *list_concat_unique_int(List *list1, const List *list2); +extern pg_nodiscard List *list_concat_unique_oid(List *list1, const List *list2); + +extern void list_deduplicate_oid(List *list); + +extern void list_free(List *list); +extern void list_free_deep(List *list); + +extern pg_nodiscard List *list_copy(const List *oldlist); +extern pg_nodiscard List *list_copy_head(const List *oldlist, int len); +extern pg_nodiscard List *list_copy_tail(const List *oldlist, int nskip); +extern pg_nodiscard List *list_copy_deep(const List *oldlist); + +typedef int (*list_sort_comparator) (const ListCell *a, const ListCell *b); +extern void list_sort(List *list, list_sort_comparator cmp); + +extern int list_int_cmp(const ListCell *p1, const ListCell *p2); +extern int list_oid_cmp(const ListCell *p1, const ListCell *p2); + +#endif /* PG_LIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/plannodes.h b/platform/dbops/binaries/postgres/include/server/nodes/plannodes.h new file mode 100644 index 0000000000000000000000000000000000000000..1aeeaec95e14c5622f6170ba8760cf6027274ce6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/plannodes.h @@ -0,0 +1,1593 @@ +/*------------------------------------------------------------------------- + * + * plannodes.h + * definitions for query plan nodes + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/plannodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANNODES_H +#define PLANNODES_H + +#include "access/sdir.h" +#include "access/stratnum.h" +#include "common/relpath.h" +#include "lib/stringinfo.h" +#include "nodes/bitmapset.h" +#include "nodes/lockoptions.h" +#include "nodes/primnodes.h" + + +/* ---------------------------------------------------------------- + * node definitions + * ---------------------------------------------------------------- + */ + +/* ---------------- + * PlannedStmt node + * + * The output of the planner is a Plan tree headed by a PlannedStmt node. + * PlannedStmt holds the "one time" information needed by the executor. + * + * For simplicity in APIs, we also wrap utility statements in PlannedStmt + * nodes; in such cases, commandType == CMD_UTILITY, the statement itself + * is in the utilityStmt field, and the rest of the struct is mostly dummy. + * (We do use canSetTag, stmt_location, stmt_len, and possibly queryId.) + * + * PlannedStmt, as well as all varieties of Plan, do not support equal(), + * not because it's not sensible but because we currently have no need. + * ---------------- + */ +typedef struct PlannedStmt +{ + pg_node_attr(no_equal, no_query_jumble) + + NodeTag type; + + CmdType commandType; /* select|insert|update|delete|merge|utility */ + + uint64 queryId; /* query identifier (copied from Query) */ + + bool hasReturning; /* is it insert|update|delete|merge RETURNING? */ + + bool hasModifyingCTE; /* has insert|update|delete|merge in WITH? */ + + bool canSetTag; /* do I set the command result tag? */ + + bool transientPlan; /* redo plan when TransactionXmin changes? */ + + bool dependsOnRole; /* is plan specific to current role? */ + + bool parallelModeNeeded; /* parallel mode required to execute? */ + + int jitFlags; /* which forms of JIT should be performed */ + + struct Plan *planTree; /* tree of Plan nodes */ + + List *rtable; /* list of RangeTblEntry nodes */ + + List *permInfos; /* list of RTEPermissionInfo nodes for rtable + * entries needing one */ + + /* rtable indexes of target relations for INSERT/UPDATE/DELETE/MERGE */ + List *resultRelations; /* integer list of RT indexes, or NIL */ + + List *appendRelations; /* list of AppendRelInfo nodes */ + + List *subplans; /* Plan trees for SubPlan expressions; note + * that some could be NULL */ + + Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */ + + List *rowMarks; /* a list of PlanRowMark's */ + + List *relationOids; /* OIDs of relations the plan depends on */ + + List *invalItems; /* other dependencies, as PlanInvalItems */ + + List *paramExecTypes; /* type OIDs for PARAM_EXEC Params */ + + Node *utilityStmt; /* non-null if this is utility stmt */ + + /* statement location in source string (copied from Query) */ + ParseLoc stmt_location; /* start location, or -1 if unknown */ + ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */ +} PlannedStmt; + +/* macro for fetching the Plan associated with a SubPlan node */ +#define exec_subplan_get_plan(plannedstmt, subplan) \ + ((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1)) + + +/* ---------------- + * Plan node + * + * All plan nodes "derive" from the Plan structure by having the + * Plan structure as the first field. This ensures that everything works + * when nodes are cast to Plan's. (node pointers are frequently cast to Plan* + * when passed around generically in the executor) + * + * We never actually instantiate any Plan nodes; this is just the common + * abstract superclass for all Plan-type nodes. + * ---------------- + */ +typedef struct Plan +{ + pg_node_attr(abstract, no_equal, no_query_jumble) + + NodeTag type; + + /* + * estimated execution costs for plan (see costsize.c for more info) + */ + Cost startup_cost; /* cost expended before fetching any tuples */ + Cost total_cost; /* total cost (assuming all tuples fetched) */ + + /* + * planner's estimate of result size of this plan step + */ + Cardinality plan_rows; /* number of rows plan is expected to emit */ + int plan_width; /* average row width in bytes */ + + /* + * information needed for parallel query + */ + bool parallel_aware; /* engage parallel-aware logic? */ + bool parallel_safe; /* OK to use as part of parallel plan? */ + + /* + * information needed for asynchronous execution + */ + bool async_capable; /* engage asynchronous-capable logic? */ + + /* + * Common structural data for all Plan types. + */ + int plan_node_id; /* unique across entire final plan tree */ + List *targetlist; /* target list to be computed at this node */ + List *qual; /* implicitly-ANDed qual conditions */ + struct Plan *lefttree; /* input plan tree(s) */ + struct Plan *righttree; + List *initPlan; /* Init Plan nodes (un-correlated expr + * subselects) */ + + /* + * Information for management of parameter-change-driven rescanning + * + * extParam includes the paramIDs of all external PARAM_EXEC params + * affecting this plan node or its children. setParam params from the + * node's initPlans are not included, but their extParams are. + * + * allParam includes all the extParam paramIDs, plus the IDs of local + * params that affect the node (i.e., the setParams of its initplans). + * These are _all_ the PARAM_EXEC params that affect this node. + */ + Bitmapset *extParam; + Bitmapset *allParam; +} Plan; + +/* ---------------- + * these are defined to avoid confusion problems with "left" + * and "right" and "inner" and "outer". The convention is that + * the "left" plan is the "outer" plan and the "right" plan is + * the inner plan, but these make the code more readable. + * ---------------- + */ +#define innerPlan(node) (((Plan *)(node))->righttree) +#define outerPlan(node) (((Plan *)(node))->lefttree) + + +/* ---------------- + * Result node - + * If no outer plan, evaluate a variable-free targetlist. + * If outer plan, return tuples from outer plan (after a level of + * projection as shown by targetlist). + * + * If resconstantqual isn't NULL, it represents a one-time qualification + * test (i.e., one that doesn't depend on any variables from the outer plan, + * so needs to be evaluated only once). + * ---------------- + */ +typedef struct Result +{ + Plan plan; + Node *resconstantqual; +} Result; + +/* ---------------- + * ProjectSet node - + * Apply a projection that includes set-returning functions to the + * output tuples of the outer plan. + * ---------------- + */ +typedef struct ProjectSet +{ + Plan plan; +} ProjectSet; + +/* ---------------- + * ModifyTable node - + * Apply rows produced by outer plan to result table(s), + * by inserting, updating, or deleting. + * + * If the originally named target table is a partitioned table or inheritance + * tree, both nominalRelation and rootRelation contain the RT index of the + * partition root or appendrel RTE, which is not otherwise mentioned in the + * plan. Otherwise rootRelation is zero. However, nominalRelation will + * always be set, as it's the rel that EXPLAIN should claim is the + * INSERT/UPDATE/DELETE/MERGE target. + * + * Note that rowMarks and epqParam are presumed to be valid for all the + * table(s); they can't contain any info that varies across tables. + * ---------------- + */ +typedef struct ModifyTable +{ + Plan plan; + CmdType operation; /* INSERT, UPDATE, DELETE, or MERGE */ + bool canSetTag; /* do we set the command tag/es_processed? */ + Index nominalRelation; /* Parent RT index for use of EXPLAIN */ + Index rootRelation; /* Root RT index, if partitioned/inherited */ + bool partColsUpdated; /* some part key in hierarchy updated? */ + List *resultRelations; /* integer list of RT indexes */ + List *updateColnosLists; /* per-target-table update_colnos lists */ + List *withCheckOptionLists; /* per-target-table WCO lists */ + List *returningLists; /* per-target-table RETURNING tlists */ + List *fdwPrivLists; /* per-target-table FDW private data lists */ + Bitmapset *fdwDirectModifyPlans; /* indices of FDW DM plans */ + List *rowMarks; /* PlanRowMarks (non-locking only) */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ + OnConflictAction onConflictAction; /* ON CONFLICT action */ + List *arbiterIndexes; /* List of ON CONFLICT arbiter index OIDs */ + List *onConflictSet; /* INSERT ON CONFLICT DO UPDATE targetlist */ + List *onConflictCols; /* target column numbers for onConflictSet */ + Node *onConflictWhere; /* WHERE for ON CONFLICT UPDATE */ + Index exclRelRTI; /* RTI of the EXCLUDED pseudo relation */ + List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */ + List *mergeActionLists; /* per-target-table lists of actions for + * MERGE */ + List *mergeJoinConditions; /* per-target-table join conditions + * for MERGE */ +} ModifyTable; + +struct PartitionPruneInfo; /* forward reference to struct below */ + +/* ---------------- + * Append node - + * Generate the concatenation of the results of sub-plans. + * ---------------- + */ +typedef struct Append +{ + Plan plan; + Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */ + List *appendplans; + int nasyncplans; /* # of asynchronous plans */ + + /* + * All 'appendplans' preceding this index are non-partial plans. All + * 'appendplans' from this index onwards are partial plans. + */ + int first_partial_plan; + + /* Info for run-time subplan pruning; NULL if we're not doing that */ + struct PartitionPruneInfo *part_prune_info; +} Append; + +/* ---------------- + * MergeAppend node - + * Merge the results of pre-sorted sub-plans to preserve the ordering. + * ---------------- + */ +typedef struct MergeAppend +{ + Plan plan; + + /* RTIs of appendrel(s) formed by this node */ + Bitmapset *apprelids; + + List *mergeplans; + + /* these fields are just like the sort-key info in struct Sort: */ + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); + + /* Info for run-time subplan pruning; NULL if we're not doing that */ + struct PartitionPruneInfo *part_prune_info; +} MergeAppend; + +/* ---------------- + * RecursiveUnion node - + * Generate a recursive union of two subplans. + * + * The "outer" subplan is always the non-recursive term, and the "inner" + * subplan is the recursive term. + * ---------------- + */ +typedef struct RecursiveUnion +{ + Plan plan; + + /* ID of Param representing work table */ + int wtParam; + + /* Remaining fields are zero/null in UNION ALL case */ + + /* number of columns to check for duplicate-ness */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *dupColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *dupOperators pg_node_attr(array_size(numCols)); + Oid *dupCollations pg_node_attr(array_size(numCols)); + + /* estimated number of groups in input */ + long numGroups; +} RecursiveUnion; + +/* ---------------- + * BitmapAnd node - + * Generate the intersection of the results of sub-plans. + * + * The subplans must be of types that yield tuple bitmaps. The targetlist + * and qual fields of the plan are unused and are always NIL. + * ---------------- + */ +typedef struct BitmapAnd +{ + Plan plan; + List *bitmapplans; +} BitmapAnd; + +/* ---------------- + * BitmapOr node - + * Generate the union of the results of sub-plans. + * + * The subplans must be of types that yield tuple bitmaps. The targetlist + * and qual fields of the plan are unused and are always NIL. + * ---------------- + */ +typedef struct BitmapOr +{ + Plan plan; + bool isshared; + List *bitmapplans; +} BitmapOr; + +/* + * ========== + * Scan nodes + * + * Scan is an abstract type that all relation scan plan types inherit from. + * ========== + */ +typedef struct Scan +{ + pg_node_attr(abstract) + + Plan plan; + Index scanrelid; /* relid is index into the range table */ +} Scan; + +/* ---------------- + * sequential scan node + * ---------------- + */ +typedef struct SeqScan +{ + Scan scan; +} SeqScan; + +/* ---------------- + * table sample scan node + * ---------------- + */ +typedef struct SampleScan +{ + Scan scan; + /* use struct pointer to avoid including parsenodes.h here */ + struct TableSampleClause *tablesample; +} SampleScan; + +/* ---------------- + * index scan node + * + * indexqualorig is an implicitly-ANDed list of index qual expressions, each + * in the same form it appeared in the query WHERE condition. Each should + * be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey). + * The indexkey is a Var or expression referencing column(s) of the index's + * base table. The comparisonval might be any expression, but it won't use + * any columns of the base table. The expressions are ordered by index + * column position (but items referencing the same index column can appear + * in any order). indexqualorig is used at runtime only if we have to recheck + * a lossy indexqual. + * + * indexqual has the same form, but the expressions have been commuted if + * necessary to put the indexkeys on the left, and the indexkeys are replaced + * by Var nodes identifying the index columns (their varno is INDEX_VAR and + * their varattno is the index column number). + * + * indexorderbyorig is similarly the original form of any ORDER BY expressions + * that are being implemented by the index, while indexorderby is modified to + * have index column Vars on the left-hand side. Here, multiple expressions + * must appear in exactly the ORDER BY order, and this is not necessarily the + * index column order. Only the expressions are provided, not the auxiliary + * sort-order information from the ORDER BY SortGroupClauses; it's assumed + * that the sort ordering is fully determinable from the top-level operators. + * indexorderbyorig is used at runtime to recheck the ordering, if the index + * cannot calculate an accurate ordering. It is also needed for EXPLAIN. + * + * indexorderbyops is a list of the OIDs of the operators used to sort the + * ORDER BY expressions. This is used together with indexorderbyorig to + * recheck ordering at run time. (Note that indexorderby, indexorderbyorig, + * and indexorderbyops are used for amcanorderbyop cases, not amcanorder.) + * + * indexorderdir specifies the scan ordering, for indexscans on amcanorder + * indexes (for other indexes it should be "don't care"). + * ---------------- + */ +typedef struct IndexScan +{ + Scan scan; + Oid indexid; /* OID of index to scan */ + List *indexqual; /* list of index quals (usually OpExprs) */ + List *indexqualorig; /* the same in original form */ + List *indexorderby; /* list of index ORDER BY exprs */ + List *indexorderbyorig; /* the same in original form */ + List *indexorderbyops; /* OIDs of sort ops for ORDER BY exprs */ + ScanDirection indexorderdir; /* forward or backward or don't care */ +} IndexScan; + +/* ---------------- + * index-only scan node + * + * IndexOnlyScan is very similar to IndexScan, but it specifies an + * index-only scan, in which the data comes from the index not the heap. + * Because of this, *all* Vars in the plan node's targetlist, qual, and + * index expressions reference index columns and have varno = INDEX_VAR. + * + * We could almost use indexqual directly against the index's output tuple + * when rechecking lossy index operators, but that won't work for quals on + * index columns that are not retrievable. Hence, recheckqual is needed + * for rechecks: it expresses the same condition as indexqual, but using + * only index columns that are retrievable. (We will not generate an + * index-only scan if this is not possible. An example is that if an + * index has table column "x" in a retrievable index column "ind1", plus + * an expression f(x) in a non-retrievable column "ind2", an indexable + * query on f(x) will use "ind2" in indexqual and f(ind1) in recheckqual. + * Without the "ind1" column, an index-only scan would be disallowed.) + * + * We don't currently need a recheckable equivalent of indexorderby, + * because we don't support lossy operators in index ORDER BY. + * + * To help EXPLAIN interpret the index Vars for display, we provide + * indextlist, which represents the contents of the index as a targetlist + * with one TLE per index column. Vars appearing in this list reference + * the base table, and this is the only field in the plan node that may + * contain such Vars. Also, for the convenience of setrefs.c, TLEs in + * indextlist are marked as resjunk if they correspond to columns that + * the index AM cannot reconstruct. + * ---------------- + */ +typedef struct IndexOnlyScan +{ + Scan scan; + Oid indexid; /* OID of index to scan */ + List *indexqual; /* list of index quals (usually OpExprs) */ + List *recheckqual; /* index quals in recheckable form */ + List *indexorderby; /* list of index ORDER BY exprs */ + List *indextlist; /* TargetEntry list describing index's cols */ + ScanDirection indexorderdir; /* forward or backward or don't care */ +} IndexOnlyScan; + +/* ---------------- + * bitmap index scan node + * + * BitmapIndexScan delivers a bitmap of potential tuple locations; + * it does not access the heap itself. The bitmap is used by an + * ancestor BitmapHeapScan node, possibly after passing through + * intermediate BitmapAnd and/or BitmapOr nodes to combine it with + * the results of other BitmapIndexScans. + * + * The fields have the same meanings as for IndexScan, except we don't + * store a direction flag because direction is uninteresting. + * + * In a BitmapIndexScan plan node, the targetlist and qual fields are + * not used and are always NIL. The indexqualorig field is unused at + * run time too, but is saved for the benefit of EXPLAIN. + * ---------------- + */ +typedef struct BitmapIndexScan +{ + Scan scan; + Oid indexid; /* OID of index to scan */ + bool isshared; /* Create shared bitmap if set */ + List *indexqual; /* list of index quals (OpExprs) */ + List *indexqualorig; /* the same in original form */ +} BitmapIndexScan; + +/* ---------------- + * bitmap sequential scan node + * + * This needs a copy of the qual conditions being used by the input index + * scans because there are various cases where we need to recheck the quals; + * for example, when the bitmap is lossy about the specific rows on a page + * that meet the index condition. + * ---------------- + */ +typedef struct BitmapHeapScan +{ + Scan scan; + List *bitmapqualorig; /* index quals, in standard expr form */ +} BitmapHeapScan; + +/* ---------------- + * tid scan node + * + * tidquals is an implicitly OR'ed list of qual expressions of the form + * "CTID = pseudoconstant", or "CTID = ANY(pseudoconstant_array)", + * or a CurrentOfExpr for the relation. + * ---------------- + */ +typedef struct TidScan +{ + Scan scan; + List *tidquals; /* qual(s) involving CTID = something */ +} TidScan; + +/* ---------------- + * tid range scan node + * + * tidrangequals is an implicitly AND'ed list of qual expressions of the form + * "CTID relop pseudoconstant", where relop is one of >,>=,<,<=. + * ---------------- + */ +typedef struct TidRangeScan +{ + Scan scan; + List *tidrangequals; /* qual(s) involving CTID op something */ +} TidRangeScan; + +/* ---------------- + * subquery scan node + * + * SubqueryScan is for scanning the output of a sub-query in the range table. + * We often need an extra plan node above the sub-query's plan to perform + * expression evaluations (which we can't push into the sub-query without + * risking changing its semantics). Although we are not scanning a physical + * relation, we make this a descendant of Scan anyway for code-sharing + * purposes. + * + * SubqueryScanStatus caches the trivial_subqueryscan property of the node. + * SUBQUERY_SCAN_UNKNOWN means not yet determined. This is only used during + * planning. + * + * Note: we store the sub-plan in the type-specific subplan field, not in + * the generic lefttree field as you might expect. This is because we do + * not want plan-tree-traversal routines to recurse into the subplan without + * knowing that they are changing Query contexts. + * ---------------- + */ +typedef enum SubqueryScanStatus +{ + SUBQUERY_SCAN_UNKNOWN, + SUBQUERY_SCAN_TRIVIAL, + SUBQUERY_SCAN_NONTRIVIAL, +} SubqueryScanStatus; + +typedef struct SubqueryScan +{ + Scan scan; + Plan *subplan; + SubqueryScanStatus scanstatus; +} SubqueryScan; + +/* ---------------- + * FunctionScan node + * ---------------- + */ +typedef struct FunctionScan +{ + Scan scan; + List *functions; /* list of RangeTblFunction nodes */ + bool funcordinality; /* WITH ORDINALITY */ +} FunctionScan; + +/* ---------------- + * ValuesScan node + * ---------------- + */ +typedef struct ValuesScan +{ + Scan scan; + List *values_lists; /* list of expression lists */ +} ValuesScan; + +/* ---------------- + * TableFunc scan node + * ---------------- + */ +typedef struct TableFuncScan +{ + Scan scan; + TableFunc *tablefunc; /* table function node */ +} TableFuncScan; + +/* ---------------- + * CteScan node + * ---------------- + */ +typedef struct CteScan +{ + Scan scan; + int ctePlanId; /* ID of init SubPlan for CTE */ + int cteParam; /* ID of Param representing CTE output */ +} CteScan; + +/* ---------------- + * NamedTuplestoreScan node + * ---------------- + */ +typedef struct NamedTuplestoreScan +{ + Scan scan; + char *enrname; /* Name given to Ephemeral Named Relation */ +} NamedTuplestoreScan; + +/* ---------------- + * WorkTableScan node + * ---------------- + */ +typedef struct WorkTableScan +{ + Scan scan; + int wtParam; /* ID of Param representing work table */ +} WorkTableScan; + +/* ---------------- + * ForeignScan node + * + * fdw_exprs and fdw_private are both under the control of the foreign-data + * wrapper, but fdw_exprs is presumed to contain expression trees and will + * be post-processed accordingly by the planner; fdw_private won't be. + * Note that everything in both lists must be copiable by copyObject(). + * One way to store an arbitrary blob of bytes is to represent it as a bytea + * Const. Usually, though, you'll be better off choosing a representation + * that can be dumped usefully by nodeToString(). + * + * fdw_scan_tlist is a targetlist describing the contents of the scan tuple + * returned by the FDW; it can be NIL if the scan tuple matches the declared + * rowtype of the foreign table, which is the normal case for a simple foreign + * table scan. (If the plan node represents a foreign join, fdw_scan_tlist + * is required since there is no rowtype available from the system catalogs.) + * When fdw_scan_tlist is provided, Vars in the node's tlist and quals must + * have varno INDEX_VAR, and their varattnos correspond to resnos in the + * fdw_scan_tlist (which are also column numbers in the actual scan tuple). + * fdw_scan_tlist is never actually executed; it just holds expression trees + * describing what is in the scan tuple's columns. + * + * fdw_recheck_quals should contain any quals which the core system passed to + * the FDW but which were not added to scan.plan.qual; that is, it should + * contain the quals being checked remotely. This is needed for correct + * behavior during EvalPlanQual rechecks. + * + * When the plan node represents a foreign join, scan.scanrelid is zero and + * fs_relids must be consulted to identify the join relation. (fs_relids + * is valid for simple scans as well, but will always match scan.scanrelid.) + * fs_relids includes outer joins; fs_base_relids does not. + * + * If the FDW's PlanDirectModify() callback decides to repurpose a ForeignScan + * node to perform the UPDATE or DELETE operation directly in the remote + * server, it sets 'operation' and 'resultRelation' to identify the operation + * type and target relation. Note that these fields are only set if the + * modification is performed *fully* remotely; otherwise, the modification is + * driven by a local ModifyTable node and 'operation' is left to CMD_SELECT. + * ---------------- + */ +typedef struct ForeignScan +{ + Scan scan; + CmdType operation; /* SELECT/INSERT/UPDATE/DELETE */ + Index resultRelation; /* direct modification target's RT index */ + Oid checkAsUser; /* user to perform the scan as; 0 means to + * check as current user */ + Oid fs_server; /* OID of foreign server */ + List *fdw_exprs; /* expressions that FDW may evaluate */ + List *fdw_private; /* private data for FDW */ + List *fdw_scan_tlist; /* optional tlist describing scan tuple */ + List *fdw_recheck_quals; /* original quals not in scan.plan.qual */ + Bitmapset *fs_relids; /* base+OJ RTIs generated by this scan */ + Bitmapset *fs_base_relids; /* base RTIs generated by this scan */ + bool fsSystemCol; /* true if any "system column" is needed */ +} ForeignScan; + +/* ---------------- + * CustomScan node + * + * The comments for ForeignScan's fdw_exprs, fdw_private, fdw_scan_tlist, + * and fs_relids fields apply equally to CustomScan's custom_exprs, + * custom_private, custom_scan_tlist, and custom_relids fields. The + * convention of setting scan.scanrelid to zero for joins applies as well. + * + * Note that since Plan trees can be copied, custom scan providers *must* + * fit all plan data they need into those fields; embedding CustomScan in + * a larger struct will not work. + * ---------------- + */ +struct CustomScanMethods; + +typedef struct CustomScan +{ + Scan scan; + uint32 flags; /* mask of CUSTOMPATH_* flags, see + * nodes/extensible.h */ + List *custom_plans; /* list of Plan nodes, if any */ + List *custom_exprs; /* expressions that custom code may evaluate */ + List *custom_private; /* private data for custom code */ + List *custom_scan_tlist; /* optional tlist describing scan tuple */ + Bitmapset *custom_relids; /* RTIs generated by this scan */ + + /* + * NOTE: The method field of CustomScan is required to be a pointer to a + * static table of callback functions. So we don't copy the table itself, + * just reference the original one. + */ + const struct CustomScanMethods *methods; +} CustomScan; + +/* + * ========== + * Join nodes + * ========== + */ + +/* ---------------- + * Join node + * + * jointype: rule for joining tuples from left and right subtrees + * inner_unique each outer tuple can match to no more than one inner tuple + * joinqual: qual conditions that came from JOIN/ON or JOIN/USING + * (plan.qual contains conditions that came from WHERE) + * + * When jointype is INNER, joinqual and plan.qual are semantically + * interchangeable. For OUTER jointypes, the two are *not* interchangeable; + * only joinqual is used to determine whether a match has been found for + * the purpose of deciding whether to generate null-extended tuples. + * (But plan.qual is still applied before actually returning a tuple.) + * For an outer join, only joinquals are allowed to be used as the merge + * or hash condition of a merge or hash join. + * + * inner_unique is set if the joinquals are such that no more than one inner + * tuple could match any given outer tuple. This allows the executor to + * skip searching for additional matches. (This must be provable from just + * the joinquals, ignoring plan.qual, due to where the executor tests it.) + * ---------------- + */ +typedef struct Join +{ + pg_node_attr(abstract) + + Plan plan; + JoinType jointype; + bool inner_unique; + List *joinqual; /* JOIN quals (in addition to plan.qual) */ +} Join; + +/* ---------------- + * nest loop join node + * + * The nestParams list identifies any executor Params that must be passed + * into execution of the inner subplan carrying values from the current row + * of the outer subplan. Currently we restrict these values to be simple + * Vars, but perhaps someday that'd be worth relaxing. (Note: during plan + * creation, the paramval can actually be a PlaceHolderVar expression; but it + * must be a Var with varno OUTER_VAR by the time it gets to the executor.) + * ---------------- + */ +typedef struct NestLoop +{ + Join join; + List *nestParams; /* list of NestLoopParam nodes */ +} NestLoop; + +typedef struct NestLoopParam +{ + pg_node_attr(no_equal, no_query_jumble) + + NodeTag type; + int paramno; /* number of the PARAM_EXEC Param to set */ + Var *paramval; /* outer-relation Var to assign to Param */ +} NestLoopParam; + +/* ---------------- + * merge join node + * + * The expected ordering of each mergeable column is described by a btree + * opfamily OID, a collation OID, a direction (BTLessStrategyNumber or + * BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides + * of each mergeclause may be of different datatypes, but they are ordered the + * same way according to the common opfamily and collation. The operator in + * each mergeclause must be an equality operator of the indicated opfamily. + * ---------------- + */ +typedef struct MergeJoin +{ + Join join; + + /* Can we skip mark/restore calls? */ + bool skip_mark_restore; + + /* mergeclauses as expression trees */ + List *mergeclauses; + + /* these are arrays, but have the same length as the mergeclauses list: */ + + /* per-clause OIDs of btree opfamilies */ + Oid *mergeFamilies pg_node_attr(array_size(mergeclauses)); + + /* per-clause OIDs of collations */ + Oid *mergeCollations pg_node_attr(array_size(mergeclauses)); + + /* per-clause ordering (ASC or DESC) */ + int *mergeStrategies pg_node_attr(array_size(mergeclauses)); + + /* per-clause nulls ordering */ + bool *mergeNullsFirst pg_node_attr(array_size(mergeclauses)); +} MergeJoin; + +/* ---------------- + * hash join node + * ---------------- + */ +typedef struct HashJoin +{ + Join join; + List *hashclauses; + List *hashoperators; + List *hashcollations; + + /* + * List of expressions to be hashed for tuples from the outer plan, to + * perform lookups in the hashtable over the inner plan. + */ + List *hashkeys; +} HashJoin; + +/* ---------------- + * materialization node + * ---------------- + */ +typedef struct Material +{ + Plan plan; +} Material; + +/* ---------------- + * memoize node + * ---------------- + */ +typedef struct Memoize +{ + Plan plan; + + /* size of the two arrays below */ + int numKeys; + + /* hash operators for each key */ + Oid *hashOperators pg_node_attr(array_size(numKeys)); + + /* collations for each key */ + Oid *collations pg_node_attr(array_size(numKeys)); + + /* cache keys in the form of exprs containing parameters */ + List *param_exprs; + + /* + * true if the cache entry should be marked as complete after we store the + * first tuple in it. + */ + bool singlerow; + + /* + * true when cache key should be compared bit by bit, false when using + * hash equality ops + */ + bool binary_mode; + + /* + * The maximum number of entries that the planner expects will fit in the + * cache, or 0 if unknown + */ + uint32 est_entries; + + /* paramids from param_exprs */ + Bitmapset *keyparamids; +} Memoize; + +/* ---------------- + * sort node + * ---------------- + */ +typedef struct Sort +{ + Plan plan; + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); +} Sort; + +/* ---------------- + * incremental sort node + * ---------------- + */ +typedef struct IncrementalSort +{ + Sort sort; + int nPresortedCols; /* number of presorted columns */ +} IncrementalSort; + +/* --------------- + * group node - + * Used for queries with GROUP BY (but no aggregates) specified. + * The input must be presorted according to the grouping columns. + * --------------- + */ +typedef struct Group +{ + Plan plan; + + /* number of grouping columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *grpColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *grpOperators pg_node_attr(array_size(numCols)); + Oid *grpCollations pg_node_attr(array_size(numCols)); +} Group; + +/* --------------- + * aggregate node + * + * An Agg node implements plain or grouped aggregation. For grouped + * aggregation, we can work with presorted input or unsorted input; + * the latter strategy uses an internal hashtable. + * + * Notice the lack of any direct info about the aggregate functions to be + * computed. They are found by scanning the node's tlist and quals during + * executor startup. (It is possible that there are no aggregate functions; + * this could happen if they get optimized away by constant-folding, or if + * we are using the Agg node to implement hash-based grouping.) + * --------------- + */ +typedef struct Agg +{ + Plan plan; + + /* basic strategy, see nodes.h */ + AggStrategy aggstrategy; + + /* agg-splitting mode, see nodes.h */ + AggSplit aggsplit; + + /* number of grouping columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *grpColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *grpOperators pg_node_attr(array_size(numCols)); + Oid *grpCollations pg_node_attr(array_size(numCols)); + + /* estimated number of groups in input */ + long numGroups; + + /* for pass-by-ref transition data */ + uint64 transitionSpace; + + /* IDs of Params used in Aggref inputs */ + Bitmapset *aggParams; + + /* Note: planner provides numGroups & aggParams only in HASHED/MIXED case */ + + /* grouping sets to use */ + List *groupingSets; + + /* chained Agg/Sort nodes */ + List *chain; +} Agg; + +/* ---------------- + * window aggregate node + * ---------------- + */ +typedef struct WindowAgg +{ + Plan plan; + + /* ID referenced by window functions */ + Index winref; + + /* number of columns in partition clause */ + int partNumCols; + + /* their indexes in the target list */ + AttrNumber *partColIdx pg_node_attr(array_size(partNumCols)); + + /* equality operators for partition columns */ + Oid *partOperators pg_node_attr(array_size(partNumCols)); + + /* collations for partition columns */ + Oid *partCollations pg_node_attr(array_size(partNumCols)); + + /* number of columns in ordering clause */ + int ordNumCols; + + /* their indexes in the target list */ + AttrNumber *ordColIdx pg_node_attr(array_size(ordNumCols)); + + /* equality operators for ordering columns */ + Oid *ordOperators pg_node_attr(array_size(ordNumCols)); + + /* collations for ordering columns */ + Oid *ordCollations pg_node_attr(array_size(ordNumCols)); + + /* frame_clause options, see WindowDef */ + int frameOptions; + + /* expression for starting bound, if any */ + Node *startOffset; + + /* expression for ending bound, if any */ + Node *endOffset; + + /* qual to help short-circuit execution */ + List *runCondition; + + /* runCondition for display in EXPLAIN */ + List *runConditionOrig; + + /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */ + + /* in_range function for startOffset */ + Oid startInRangeFunc; + + /* in_range function for endOffset */ + Oid endInRangeFunc; + + /* collation for in_range tests */ + Oid inRangeColl; + + /* use ASC sort order for in_range tests? */ + bool inRangeAsc; + + /* nulls sort first for in_range tests? */ + bool inRangeNullsFirst; + + /* + * false for all apart from the WindowAgg that's closest to the root of + * the plan + */ + bool topWindow; +} WindowAgg; + +/* ---------------- + * unique node + * ---------------- + */ +typedef struct Unique +{ + Plan plan; + + /* number of columns to check for uniqueness */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *uniqColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *uniqOperators pg_node_attr(array_size(numCols)); + + /* collations for equality comparisons */ + Oid *uniqCollations pg_node_attr(array_size(numCols)); +} Unique; + +/* ------------ + * gather node + * + * Note: rescan_param is the ID of a PARAM_EXEC parameter slot. That slot + * will never actually contain a value, but the Gather node must flag it as + * having changed whenever it is rescanned. The child parallel-aware scan + * nodes are marked as depending on that parameter, so that the rescan + * machinery is aware that their output is likely to change across rescans. + * In some cases we don't need a rescan Param, so rescan_param is set to -1. + * ------------ + */ +typedef struct Gather +{ + Plan plan; + int num_workers; /* planned number of worker processes */ + int rescan_param; /* ID of Param that signals a rescan, or -1 */ + bool single_copy; /* don't execute plan more than once */ + bool invisible; /* suppress EXPLAIN display (for testing)? */ + Bitmapset *initParam; /* param id's of initplans which are referred + * at gather or one of it's child node */ +} Gather; + +/* ------------ + * gather merge node + * ------------ + */ +typedef struct GatherMerge +{ + Plan plan; + + /* planned number of worker processes */ + int num_workers; + + /* ID of Param that signals a rescan, or -1 */ + int rescan_param; + + /* remaining fields are just like the sort-key info in struct Sort */ + + /* number of sort-key columns */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *sortColIdx pg_node_attr(array_size(numCols)); + + /* OIDs of operators to sort them by */ + Oid *sortOperators pg_node_attr(array_size(numCols)); + + /* OIDs of collations */ + Oid *collations pg_node_attr(array_size(numCols)); + + /* NULLS FIRST/LAST directions */ + bool *nullsFirst pg_node_attr(array_size(numCols)); + + /* + * param id's of initplans which are referred at gather merge or one of + * it's child node + */ + Bitmapset *initParam; +} GatherMerge; + +/* ---------------- + * hash build node + * + * If the executor is supposed to try to apply skew join optimization, then + * skewTable/skewColumn/skewInherit identify the outer relation's join key + * column, from which the relevant MCV statistics can be fetched. + * ---------------- + */ +typedef struct Hash +{ + Plan plan; + + /* + * List of expressions to be hashed for tuples from Hash's outer plan, + * needed to put them into the hashtable. + */ + List *hashkeys; /* hash keys for the hashjoin condition */ + Oid skewTable; /* outer join key's table OID, or InvalidOid */ + AttrNumber skewColumn; /* outer join key's column #, or zero */ + bool skewInherit; /* is outer join rel an inheritance tree? */ + /* all other info is in the parent HashJoin node */ + Cardinality rows_total; /* estimate total rows if parallel_aware */ +} Hash; + +/* ---------------- + * setop node + * ---------------- + */ +typedef struct SetOp +{ + Plan plan; + + /* what to do, see nodes.h */ + SetOpCmd cmd; + + /* how to do it, see nodes.h */ + SetOpStrategy strategy; + + /* number of columns to check for duplicate-ness */ + int numCols; + + /* their indexes in the target list */ + AttrNumber *dupColIdx pg_node_attr(array_size(numCols)); + + /* equality operators to compare with */ + Oid *dupOperators pg_node_attr(array_size(numCols)); + Oid *dupCollations pg_node_attr(array_size(numCols)); + + /* where is the flag column, if any */ + AttrNumber flagColIdx; + + /* flag value for first input relation */ + int firstFlag; + + /* estimated number of groups in input */ + long numGroups; +} SetOp; + +/* ---------------- + * lock-rows node + * + * rowMarks identifies the rels to be locked by this node; it should be + * a subset of the rowMarks listed in the top-level PlannedStmt. + * epqParam is a Param that all scan nodes below this one must depend on. + * It is used to force re-evaluation of the plan during EvalPlanQual. + * ---------------- + */ +typedef struct LockRows +{ + Plan plan; + List *rowMarks; /* a list of PlanRowMark's */ + int epqParam; /* ID of Param for EvalPlanQual re-eval */ +} LockRows; + +/* ---------------- + * limit node + * + * Note: as of Postgres 8.2, the offset and count expressions are expected + * to yield int8, rather than int4 as before. + * ---------------- + */ +typedef struct Limit +{ + Plan plan; + + /* OFFSET parameter, or NULL if none */ + Node *limitOffset; + + /* COUNT parameter, or NULL if none */ + Node *limitCount; + + /* limit type */ + LimitOption limitOption; + + /* number of columns to check for similarity */ + int uniqNumCols; + + /* their indexes in the target list */ + AttrNumber *uniqColIdx pg_node_attr(array_size(uniqNumCols)); + + /* equality operators to compare with */ + Oid *uniqOperators pg_node_attr(array_size(uniqNumCols)); + + /* collations for equality comparisons */ + Oid *uniqCollations pg_node_attr(array_size(uniqNumCols)); +} Limit; + + +/* + * RowMarkType - + * enums for types of row-marking operations + * + * The first four of these values represent different lock strengths that + * we can take on tuples according to SELECT FOR [KEY] UPDATE/SHARE requests. + * We support these on regular tables, as well as on foreign tables whose FDWs + * report support for late locking. For other foreign tables, any locking + * that might be done for such requests must happen during the initial row + * fetch; their FDWs provide no mechanism for going back to lock a row later. + * This means that the semantics will be a bit different than for a local + * table; in particular we are likely to lock more rows than would be locked + * locally, since remote rows will be locked even if they then fail + * locally-checked restriction or join quals. However, the prospect of + * doing a separate remote query to lock each selected row is usually pretty + * unappealing, so early locking remains a credible design choice for FDWs. + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we have to uniquely + * identify all the source rows, not only those from the target relations, so + * that we can perform EvalPlanQual rechecking at need. For plain tables we + * can just fetch the TID, much as for a target relation; this case is + * represented by ROW_MARK_REFERENCE. Otherwise (for example for VALUES or + * FUNCTION scans) we have to copy the whole row value. ROW_MARK_COPY is + * pretty inefficient, since most of the time we'll never need the data; but + * fortunately the overhead is usually not performance-critical in practice. + * By default we use ROW_MARK_COPY for foreign tables, but if the FDW has + * a concept of rowid it can request to use ROW_MARK_REFERENCE instead. + * (Again, this probably doesn't make sense if a physical remote fetch is + * needed, but for FDWs that map to local storage it might be credible.) + */ +typedef enum RowMarkType +{ + ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */ + ROW_MARK_NOKEYEXCLUSIVE, /* obtain no-key exclusive tuple lock */ + ROW_MARK_SHARE, /* obtain shared tuple lock */ + ROW_MARK_KEYSHARE, /* obtain keyshare tuple lock */ + ROW_MARK_REFERENCE, /* just fetch the TID, don't lock it */ + ROW_MARK_COPY, /* physically copy the row value */ +} RowMarkType; + +#define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_KEYSHARE) + +/* + * PlanRowMark - + * plan-time representation of FOR [KEY] UPDATE/SHARE clauses + * + * When doing UPDATE/DELETE/MERGE/SELECT FOR UPDATE/SHARE, we create a separate + * PlanRowMark node for each non-target relation in the query. Relations that + * are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if + * regular tables or supported foreign tables) or ROW_MARK_COPY (if not). + * + * Initially all PlanRowMarks have rti == prti and isParent == false. + * When the planner discovers that a relation is the root of an inheritance + * tree, it sets isParent true, and adds an additional PlanRowMark to the + * list for each child relation (including the target rel itself in its role + * as a child, if it is not a partitioned table). Any non-leaf partitioned + * child relations will also have entries with isParent = true. The child + * entries have rti == child rel's RT index and prti == top parent's RT index, + * and can therefore be recognized as children by the fact that prti != rti. + * The parent's allMarkTypes field gets the OR of (1<0 means N levels up + */ + Index varlevelsup; + + /* + * varnosyn/varattnosyn are ignored for equality, because Vars with + * different syntactic identifiers are semantically the same as long as + * their varno/varattno match. + */ + /* syntactic relation index (0 if unknown) */ + Index varnosyn pg_node_attr(equal_ignore, query_jumble_ignore); + /* syntactic attribute number */ + AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore); + + /* token location, or -1 if unknown */ + ParseLoc location; +} Var; + +/* + * Const + * + * Note: for varlena data types, we make a rule that a Const node's value + * must be in non-extended form (4-byte header, no compression or external + * references). This ensures that the Const node is self-contained and makes + * it more likely that equal() will see logically identical values as equal. + * + * Only the constant type OID is relevant for the query jumbling. + */ +typedef struct Const +{ + pg_node_attr(custom_copy_equal, custom_read_write) + + Expr xpr; + /* pg_type OID of the constant's datatype */ + Oid consttype; + /* typmod value, if any */ + int32 consttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid constcollid pg_node_attr(query_jumble_ignore); + /* typlen of the constant's datatype */ + int constlen pg_node_attr(query_jumble_ignore); + /* the constant's value */ + Datum constvalue pg_node_attr(query_jumble_ignore); + /* whether the constant is null (if true, constvalue is undefined) */ + bool constisnull pg_node_attr(query_jumble_ignore); + + /* + * Whether this datatype is passed by value. If true, then all the + * information is stored in the Datum. If false, then the Datum contains + * a pointer to the information. + */ + bool constbyval pg_node_attr(query_jumble_ignore); + + /* + * token location, or -1 if unknown. All constants are tracked as + * locations in query jumbling, to be marked as parameters. + */ + ParseLoc location pg_node_attr(query_jumble_location); +} Const; + +/* + * Param + * + * paramkind specifies the kind of parameter. The possible values + * for this field are: + * + * PARAM_EXTERN: The parameter value is supplied from outside the plan. + * Such parameters are numbered from 1 to n. + * + * PARAM_EXEC: The parameter is an internal executor parameter, used + * for passing values into and out of sub-queries or from + * nestloop joins to their inner scans. + * For historical reasons, such parameters are numbered from 0. + * These numbers are independent of PARAM_EXTERN numbers. + * + * PARAM_SUBLINK: The parameter represents an output column of a SubLink + * node's sub-select. The column number is contained in the + * `paramid' field. (This type of Param is converted to + * PARAM_EXEC during planning.) + * + * PARAM_MULTIEXPR: Like PARAM_SUBLINK, the parameter represents an + * output column of a SubLink node's sub-select, but here, the + * SubLink is always a MULTIEXPR SubLink. The high-order 16 bits + * of the `paramid' field contain the SubLink's subLinkId, and + * the low-order 16 bits contain the column number. (This type + * of Param is also converted to PARAM_EXEC during planning.) + */ +typedef enum ParamKind +{ + PARAM_EXTERN, + PARAM_EXEC, + PARAM_SUBLINK, + PARAM_MULTIEXPR, +} ParamKind; + +typedef struct Param +{ + Expr xpr; + ParamKind paramkind; /* kind of parameter. See above */ + int paramid; /* numeric ID for parameter */ + Oid paramtype; /* pg_type OID of parameter's datatype */ + /* typmod value, if known */ + int32 paramtypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid paramcollid pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} Param; + +/* + * Aggref + * + * The aggregate's args list is a targetlist, ie, a list of TargetEntry nodes. + * + * For a normal (non-ordered-set) aggregate, the non-resjunk TargetEntries + * represent the aggregate's regular arguments (if any) and resjunk TLEs can + * be added at the end to represent ORDER BY expressions that are not also + * arguments. As in a top-level Query, the TLEs can be marked with + * ressortgroupref indexes to let them be referenced by SortGroupClause + * entries in the aggorder and/or aggdistinct lists. This represents ORDER BY + * and DISTINCT operations to be applied to the aggregate input rows before + * they are passed to the transition function. The grammar only allows a + * simple "DISTINCT" specifier for the arguments, but we use the full + * query-level representation to allow more code sharing. + * + * For an ordered-set aggregate, the args list represents the WITHIN GROUP + * (aggregated) arguments, all of which will be listed in the aggorder list. + * DISTINCT is not supported in this case, so aggdistinct will be NIL. + * The direct arguments appear in aggdirectargs (as a list of plain + * expressions, not TargetEntry nodes). + * + * aggtranstype is the data type of the state transition values for this + * aggregate (resolved to an actual type, if agg's transtype is polymorphic). + * This is determined during planning and is InvalidOid before that. + * + * aggargtypes is an OID list of the data types of the direct and regular + * arguments. Normally it's redundant with the aggdirectargs and args lists, + * but in a combining aggregate, it's not because the args list has been + * replaced with a single argument representing the partial-aggregate + * transition values. + * + * aggpresorted is set by the query planner for ORDER BY and DISTINCT + * aggregates where the chosen plan provides presorted input for this + * aggregate during execution. + * + * aggsplit indicates the expected partial-aggregation mode for the Aggref's + * parent plan node. It's always set to AGGSPLIT_SIMPLE in the parser, but + * the planner might change it to something else. We use this mainly as + * a crosscheck that the Aggrefs match the plan; but note that when aggsplit + * indicates a non-final mode, aggtype reflects the transition data type + * not the SQL-level output type of the aggregate. + * + * aggno and aggtransno are -1 in the parse stage, and are set in planning. + * Aggregates with the same 'aggno' represent the same aggregate expression, + * and can share the result. Aggregates with same 'transno' but different + * 'aggno' can share the same transition state, only the final function needs + * to be called separately. + * + * Information related to collations, transition types and internal states + * are irrelevant for the query jumbling. + */ +typedef struct Aggref +{ + Expr xpr; + + /* pg_proc Oid of the aggregate */ + Oid aggfnoid; + + /* type Oid of result of the aggregate */ + Oid aggtype pg_node_attr(query_jumble_ignore); + + /* OID of collation of result */ + Oid aggcollid pg_node_attr(query_jumble_ignore); + + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* + * type Oid of aggregate's transition value; ignored for equal since it + * might not be set yet + */ + Oid aggtranstype pg_node_attr(equal_ignore, query_jumble_ignore); + + /* type Oids of direct and aggregated args */ + List *aggargtypes pg_node_attr(query_jumble_ignore); + + /* direct arguments, if an ordered-set agg */ + List *aggdirectargs; + + /* aggregated arguments and sort expressions */ + List *args; + + /* ORDER BY (list of SortGroupClause) */ + List *aggorder; + + /* DISTINCT (list of SortGroupClause) */ + List *aggdistinct; + + /* FILTER expression, if any */ + Expr *aggfilter; + + /* true if argument list was really '*' */ + bool aggstar pg_node_attr(query_jumble_ignore); + + /* + * true if variadic arguments have been combined into an array last + * argument + */ + bool aggvariadic pg_node_attr(query_jumble_ignore); + + /* aggregate kind (see pg_aggregate.h) */ + char aggkind pg_node_attr(query_jumble_ignore); + + /* aggregate input already sorted */ + bool aggpresorted pg_node_attr(equal_ignore, query_jumble_ignore); + + /* > 0 if agg belongs to outer query */ + Index agglevelsup pg_node_attr(query_jumble_ignore); + + /* expected agg-splitting mode of parent Agg */ + AggSplit aggsplit pg_node_attr(query_jumble_ignore); + + /* unique ID within the Agg node */ + int aggno pg_node_attr(query_jumble_ignore); + + /* unique ID of transition state in the Agg */ + int aggtransno pg_node_attr(query_jumble_ignore); + + /* token location, or -1 if unknown */ + ParseLoc location; +} Aggref; + +/* + * GroupingFunc + * + * A GroupingFunc is a GROUPING(...) expression, which behaves in many ways + * like an aggregate function (e.g. it "belongs" to a specific query level, + * which might not be the one immediately containing it), but also differs in + * an important respect: it never evaluates its arguments, they merely + * designate expressions from the GROUP BY clause of the query level to which + * it belongs. + * + * The spec defines the evaluation of GROUPING() purely by syntactic + * replacement, but we make it a real expression for optimization purposes so + * that one Agg node can handle multiple grouping sets at once. Evaluating the + * result only needs the column positions to check against the grouping set + * being projected. However, for EXPLAIN to produce meaningful output, we have + * to keep the original expressions around, since expression deparse does not + * give us any feasible way to get at the GROUP BY clause. + * + * Also, we treat two GroupingFunc nodes as equal if they have equal arguments + * lists and agglevelsup, without comparing the refs and cols annotations. + * + * In raw parse output we have only the args list; parse analysis fills in the + * refs list, and the planner fills in the cols list. + * + * All the fields used as information for an internal state are irrelevant + * for the query jumbling. + */ +typedef struct GroupingFunc +{ + Expr xpr; + + /* arguments, not evaluated but kept for benefit of EXPLAIN etc. */ + List *args pg_node_attr(query_jumble_ignore); + + /* ressortgrouprefs of arguments */ + List *refs pg_node_attr(equal_ignore); + + /* actual column positions set by planner */ + List *cols pg_node_attr(equal_ignore, query_jumble_ignore); + + /* same as Aggref.agglevelsup */ + Index agglevelsup; + + /* token location */ + ParseLoc location; +} GroupingFunc; + +/* + * WindowFunc + * + * Collation information is irrelevant for the query jumbling, as is the + * internal state information of the node like "winstar" and "winagg". + */ +typedef struct WindowFunc +{ + Expr xpr; + /* pg_proc Oid of the function */ + Oid winfnoid; + /* type Oid of result of the window function */ + Oid wintype pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid wincollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* arguments to the window function */ + List *args; + /* FILTER expression, if any */ + Expr *aggfilter; + /* List of WindowFuncRunConditions to help short-circuit execution */ + List *runCondition pg_node_attr(query_jumble_ignore); + /* index of associated WindowClause */ + Index winref; + /* true if argument list was really '*' */ + bool winstar pg_node_attr(query_jumble_ignore); + /* is function a simple aggregate? */ + bool winagg pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} WindowFunc; + +/* + * WindowFuncRunCondition + * + * Represents intermediate OpExprs which will be used by WindowAgg to + * short-circuit execution. + */ +typedef struct WindowFuncRunCondition +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* + * true of WindowFunc belongs on the left of the resulting OpExpr or false + * if the WindowFunc is on the right. + */ + bool wfunc_left; + + /* + * The Expr being compared to the WindowFunc to use in the OpExpr in the + * WindowAgg's runCondition + */ + Expr *arg; +} WindowFuncRunCondition; + +/* + * MergeSupportFunc + * + * A MergeSupportFunc is a merge support function expression that can only + * appear in the RETURNING list of a MERGE command. It returns information + * about the currently executing merge action. + * + * Currently, the only supported function is MERGE_ACTION(), which returns the + * command executed ("INSERT", "UPDATE", or "DELETE"). + */ +typedef struct MergeSupportFunc +{ + Expr xpr; + /* type Oid of result */ + Oid msftype; + /* OID of collation, or InvalidOid if none */ + Oid msfcollid; + /* token location, or -1 if unknown */ + ParseLoc location; +} MergeSupportFunc; + +/* + * SubscriptingRef: describes a subscripting operation over a container + * (array, etc). + * + * A SubscriptingRef can describe fetching a single element from a container, + * fetching a part of a container (e.g. an array slice), storing a single + * element into a container, or storing a slice. The "store" cases work with + * an initial container value and a source value that is inserted into the + * appropriate part of the container; the result of the operation is an + * entire new modified container value. + * + * If reflowerindexpr = NIL, then we are fetching or storing a single container + * element at the subscripts given by refupperindexpr. Otherwise we are + * fetching or storing a container slice, that is a rectangular subcontainer + * with lower and upper bounds given by the index expressions. + * reflowerindexpr must be the same length as refupperindexpr when it + * is not NIL. + * + * In the slice case, individual expressions in the subscript lists can be + * NULL, meaning "substitute the array's current lower or upper bound". + * (Non-array containers may or may not support this.) + * + * refcontainertype is the actual container type that determines the + * subscripting semantics. (This will generally be either the exposed type of + * refexpr, or the base type if that is a domain.) refelemtype is the type of + * the container's elements; this is saved for the use of the subscripting + * functions, but is not used by the core code. refrestype, reftypmod, and + * refcollid describe the type of the SubscriptingRef's result. In a store + * expression, refrestype will always match refcontainertype; in a fetch, + * it could be refelemtype for an element fetch, or refcontainertype for a + * slice fetch, or possibly something else as determined by type-specific + * subscripting logic. Likewise, reftypmod and refcollid will match the + * container's properties in a store, but could be different in a fetch. + * + * Any internal state data is ignored for the query jumbling. + * + * Note: for the cases where a container is returned, if refexpr yields a R/W + * expanded container, then the implementation is allowed to modify that + * object in-place and return the same object. + */ +typedef struct SubscriptingRef +{ + Expr xpr; + /* type of the container proper */ + Oid refcontainertype pg_node_attr(query_jumble_ignore); + /* the container type's pg_type.typelem */ + Oid refelemtype pg_node_attr(query_jumble_ignore); + /* type of the SubscriptingRef's result */ + Oid refrestype pg_node_attr(query_jumble_ignore); + /* typmod of the result */ + int32 reftypmod pg_node_attr(query_jumble_ignore); + /* collation of result, or InvalidOid if none */ + Oid refcollid pg_node_attr(query_jumble_ignore); + /* expressions that evaluate to upper container indexes */ + List *refupperindexpr; + + /* + * expressions that evaluate to lower container indexes, or NIL for single + * container element. + */ + List *reflowerindexpr; + /* the expression that evaluates to a container value */ + Expr *refexpr; + /* expression for the source value, or NULL if fetch */ + Expr *refassgnexpr; +} SubscriptingRef; + +/* + * CoercionContext - distinguishes the allowed set of type casts + * + * NB: ordering of the alternatives is significant; later (larger) values + * allow more casts than earlier ones. + */ +typedef enum CoercionContext +{ + COERCION_IMPLICIT, /* coercion in context of expression */ + COERCION_ASSIGNMENT, /* coercion in context of assignment */ + COERCION_PLPGSQL, /* if no assignment cast, use CoerceViaIO */ + COERCION_EXPLICIT, /* explicit cast operation */ +} CoercionContext; + +/* + * CoercionForm - how to display a FuncExpr or related node + * + * "Coercion" is a bit of a misnomer, since this value records other + * special syntaxes besides casts, but for now we'll keep this naming. + * + * NB: equal() ignores CoercionForm fields, therefore this *must* not carry + * any semantically significant information. We need that behavior so that + * the planner will consider equivalent implicit and explicit casts to be + * equivalent. In cases where those actually behave differently, the coercion + * function's arguments will be different. + */ +typedef enum CoercionForm +{ + COERCE_EXPLICIT_CALL, /* display as a function call */ + COERCE_EXPLICIT_CAST, /* display as an explicit cast */ + COERCE_IMPLICIT_CAST, /* implicit cast, so hide it */ + COERCE_SQL_SYNTAX, /* display with SQL-mandated special syntax */ +} CoercionForm; + +/* + * FuncExpr - expression node for a function call + * + * Collation information is irrelevant for the query jumbling, only the + * arguments and the function OID matter. + */ +typedef struct FuncExpr +{ + Expr xpr; + /* PG_PROC OID of the function */ + Oid funcid; + /* PG_TYPE OID of result value */ + Oid funcresulttype pg_node_attr(query_jumble_ignore); + /* true if function returns set */ + bool funcretset pg_node_attr(query_jumble_ignore); + + /* + * true if variadic arguments have been combined into an array last + * argument + */ + bool funcvariadic pg_node_attr(query_jumble_ignore); + /* how to display this function call */ + CoercionForm funcformat pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid funccollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* arguments to the function */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} FuncExpr; + +/* + * NamedArgExpr - a named argument of a function + * + * This node type can only appear in the args list of a FuncCall or FuncExpr + * node. We support pure positional call notation (no named arguments), + * named notation (all arguments are named), and mixed notation (unnamed + * arguments followed by named ones). + * + * Parse analysis sets argnumber to the positional index of the argument, + * but doesn't rearrange the argument list. + * + * The planner will convert argument lists to pure positional notation + * during expression preprocessing, so execution never sees a NamedArgExpr. + */ +typedef struct NamedArgExpr +{ + Expr xpr; + /* the argument expression */ + Expr *arg; + /* the name */ + char *name pg_node_attr(query_jumble_ignore); + /* argument's number in positional notation */ + int argnumber; + /* argument name location, or -1 if unknown */ + ParseLoc location; +} NamedArgExpr; + +/* + * OpExpr - expression node for an operator invocation + * + * Semantically, this is essentially the same as a function call. + * + * Note that opfuncid is not necessarily filled in immediately on creation + * of the node. The planner makes sure it is valid before passing the node + * tree to the executor, but during parsing/planning opfuncid can be 0. + * Therefore, equal() will accept a zero value as being equal to other values. + * + * Internal state information and collation data is irrelevant for the query + * jumbling. + */ +typedef struct OpExpr +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + + /* PG_PROC OID of underlying function */ + Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_TYPE OID of result value */ + Oid opresulttype pg_node_attr(query_jumble_ignore); + + /* true if operator returns set */ + bool opretset pg_node_attr(query_jumble_ignore); + + /* OID of collation of result */ + Oid opcollid pg_node_attr(query_jumble_ignore); + + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* arguments to the operator (1 or 2) */ + List *args; + + /* token location, or -1 if unknown */ + ParseLoc location; +} OpExpr; + +/* + * DistinctExpr - expression node for "x IS DISTINCT FROM y" + * + * Except for the nodetag, this is represented identically to an OpExpr + * referencing the "=" operator for x and y. + * We use "=", not the more obvious "<>", because more datatypes have "=" + * than "<>". This means the executor must invert the operator result. + * Note that the operator function won't be called at all if either input + * is NULL, since then the result can be determined directly. + */ +typedef OpExpr DistinctExpr; + +/* + * NullIfExpr - a NULLIF expression + * + * Like DistinctExpr, this is represented the same as an OpExpr referencing + * the "=" operator for x and y. + */ +typedef OpExpr NullIfExpr; + +/* + * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)" + * + * The operator must yield boolean. It is applied to the left operand + * and each element of the righthand array, and the results are combined + * with OR or AND (for ANY or ALL respectively). The node representation + * is almost the same as for the underlying operator, but we need a useOr + * flag to remember whether it's ANY or ALL, and we don't have to store + * the result type (or the collation) because it must be boolean. + * + * A ScalarArrayOpExpr with a valid hashfuncid is evaluated during execution + * by building a hash table containing the Const values from the RHS arg. + * This table is probed during expression evaluation. The planner will set + * hashfuncid to the hash function which must be used to build and probe the + * hash table. The executor determines if it should use hash-based checks or + * the more traditional means based on if the hashfuncid is set or not. + * + * When performing hashed NOT IN, the negfuncid will also be set to the + * equality function which the hash table must use to build and probe the hash + * table. opno and opfuncid will remain set to the <> operator and its + * corresponding function and won't be used during execution. For + * non-hashtable based NOT INs, negfuncid will be set to InvalidOid. See + * convert_saop_to_hashed_saop(). + * + * Similar to OpExpr, opfuncid, hashfuncid, and negfuncid are not necessarily + * filled in right away, so will be ignored for equality if they are not set + * yet. + * + * OID entries of the internal function types are irrelevant for the query + * jumbling, but the operator OID and the arguments are. + */ +typedef struct ScalarArrayOpExpr +{ + Expr xpr; + + /* PG_OPERATOR OID of the operator */ + Oid opno; + + /* PG_PROC OID of comparison function */ + Oid opfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_PROC OID of hash func or InvalidOid */ + Oid hashfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* PG_PROC OID of negator of opfuncid function or InvalidOid. See above */ + Oid negfuncid pg_node_attr(equal_ignore_if_zero, query_jumble_ignore); + + /* true for ANY, false for ALL */ + bool useOr; + + /* OID of collation that operator should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + + /* the scalar and array operands */ + List *args; + + /* token location, or -1 if unknown */ + ParseLoc location; +} ScalarArrayOpExpr; + +/* + * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT + * + * Notice the arguments are given as a List. For NOT, of course the list + * must always have exactly one element. For AND and OR, there can be two + * or more arguments. + */ +typedef enum BoolExprType +{ + AND_EXPR, OR_EXPR, NOT_EXPR +} BoolExprType; + +typedef struct BoolExpr +{ + pg_node_attr(custom_read_write) + + Expr xpr; + BoolExprType boolop; + List *args; /* arguments to this expression */ + ParseLoc location; /* token location, or -1 if unknown */ +} BoolExpr; + +/* + * SubLink + * + * A SubLink represents a subselect appearing in an expression, and in some + * cases also the combining operator(s) just above it. The subLinkType + * indicates the form of the expression represented: + * EXISTS_SUBLINK EXISTS(SELECT ...) + * ALL_SUBLINK (lefthand) op ALL (SELECT ...) + * ANY_SUBLINK (lefthand) op ANY (SELECT ...) + * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...) + * EXPR_SUBLINK (SELECT with single targetlist item ...) + * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...) + * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...) + * CTE_SUBLINK WITH query (never actually part of an expression) + * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the + * same length as the subselect's targetlist. ROWCOMPARE will *always* have + * a list with more than one entry; if the subselect has just one target + * then the parser will create an EXPR_SUBLINK instead (and any operator + * above the subselect will be represented separately). + * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most + * one row (if it returns no rows, the result is NULL). + * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean + * results. ALL and ANY combine the per-row results using AND and OR + * semantics respectively. + * ARRAY requires just one target column, and creates an array of the target + * column's type using any number of rows resulting from the subselect. + * + * SubLink is classed as an Expr node, but it is not actually executable; + * it must be replaced in the expression tree by a SubPlan node during + * planning. + * + * NOTE: in the raw output of gram.y, testexpr contains just the raw form + * of the lefthand expression (if any), and operName is the String name of + * the combining operator. Also, subselect is a raw parsetree. During parse + * analysis, the parser transforms testexpr into a complete boolean expression + * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the + * output columns of the subselect. And subselect is transformed to a Query. + * This is the representation seen in saved rules and in the rewriter. + * + * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName + * are unused and are always null. + * + * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in + * other SubLinks. This number identifies different multiple-assignment + * subqueries within an UPDATE statement's SET list. It is unique only + * within a particular targetlist. The output column(s) of the MULTIEXPR + * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist. + * + * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used + * in SubPlans generated for WITH subqueries. + */ +typedef enum SubLinkType +{ + EXISTS_SUBLINK, + ALL_SUBLINK, + ANY_SUBLINK, + ROWCOMPARE_SUBLINK, + EXPR_SUBLINK, + MULTIEXPR_SUBLINK, + ARRAY_SUBLINK, + CTE_SUBLINK, /* for SubPlans only */ +} SubLinkType; + + +typedef struct SubLink +{ + Expr xpr; + SubLinkType subLinkType; /* see above */ + int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */ + Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */ + /* originally specified operator name */ + List *operName pg_node_attr(query_jumble_ignore); + /* subselect as Query* or raw parsetree */ + Node *subselect; + ParseLoc location; /* token location, or -1 if unknown */ +} SubLink; + +/* + * SubPlan - executable expression node for a subplan (sub-SELECT) + * + * The planner replaces SubLink nodes in expression trees with SubPlan + * nodes after it has finished planning the subquery. SubPlan references + * a sub-plantree stored in the subplans list of the toplevel PlannedStmt. + * (We avoid a direct link to make it easier to copy expression trees + * without causing multiple processing of the subplan.) + * + * In an ordinary subplan, testexpr points to an executable expression + * (OpExpr, an AND/OR tree of OpExprs, or RowCompareExpr) for the combining + * operator(s); the left-hand arguments are the original lefthand expressions, + * and the right-hand arguments are PARAM_EXEC Param nodes representing the + * outputs of the sub-select. (NOTE: runtime coercion functions may be + * inserted as well.) This is just the same expression tree as testexpr in + * the original SubLink node, but the PARAM_SUBLINK nodes are replaced by + * suitably numbered PARAM_EXEC nodes. + * + * If the sub-select becomes an initplan rather than a subplan, the executable + * expression is part of the outer plan's expression tree (and the SubPlan + * node itself is not, but rather is found in the outer plan's initPlan + * list). In this case testexpr is NULL to avoid duplication. + * + * The planner also derives lists of the values that need to be passed into + * and out of the subplan. Input values are represented as a list "args" of + * expressions to be evaluated in the outer-query context (currently these + * args are always just Vars, but in principle they could be any expression). + * The values are assigned to the global PARAM_EXEC params indexed by parParam + * (the parParam and args lists must have the same ordering). setParam is a + * list of the PARAM_EXEC params that are computed by the sub-select, if it + * is an initplan or MULTIEXPR plan; they are listed in order by sub-select + * output column position. (parParam and setParam are integer Lists, not + * Bitmapsets, because their ordering is significant.) + * + * Also, the planner computes startup and per-call costs for use of the + * SubPlan. Note that these include the cost of the subquery proper, + * evaluation of the testexpr if any, and any hashtable management overhead. + */ +typedef struct SubPlan +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + /* Fields copied from original SubLink: */ + SubLinkType subLinkType; /* see above */ + /* The combining operators, transformed to an executable expression: */ + Node *testexpr; /* OpExpr or RowCompareExpr expression tree */ + List *paramIds; /* IDs of Params embedded in the above */ + /* Identification of the Plan tree to use: */ + int plan_id; /* Index (from 1) in PlannedStmt.subplans */ + /* Identification of the SubPlan for EXPLAIN and debugging purposes: */ + char *plan_name; /* A name assigned during planning */ + /* Extra data useful for determining subplan's output type: */ + Oid firstColType; /* Type of first column of subplan result */ + int32 firstColTypmod; /* Typmod of first column of subplan result */ + Oid firstColCollation; /* Collation of first column of subplan + * result */ + /* Information about execution strategy: */ + bool useHashTable; /* true to store subselect output in a hash + * table (implies we are doing "IN") */ + bool unknownEqFalse; /* true if it's okay to return FALSE when the + * spec result is UNKNOWN; this allows much + * simpler handling of null values */ + bool parallel_safe; /* is the subplan parallel-safe? */ + /* Note: parallel_safe does not consider contents of testexpr or args */ + /* Information for passing params into and out of the subselect: */ + /* setParam and parParam are lists of integers (param IDs) */ + List *setParam; /* initplan and MULTIEXPR subqueries have to + * set these Params for parent plan */ + List *parParam; /* indices of input Params from parent plan */ + List *args; /* exprs to pass as parParam values */ + /* Estimated execution costs: */ + Cost startup_cost; /* one-time setup cost */ + Cost per_call_cost; /* cost for each subplan evaluation */ +} SubPlan; + +/* + * AlternativeSubPlan - expression node for a choice among SubPlans + * + * This is used only transiently during planning: by the time the plan + * reaches the executor, all AlternativeSubPlan nodes have been removed. + * + * The subplans are given as a List so that the node definition need not + * change if there's ever more than two alternatives. For the moment, + * though, there are always exactly two; and the first one is the fast-start + * plan. + */ +typedef struct AlternativeSubPlan +{ + pg_node_attr(no_query_jumble) + + Expr xpr; + List *subplans; /* SubPlan(s) with equivalent results */ +} AlternativeSubPlan; + +/* ---------------- + * FieldSelect + * + * FieldSelect represents the operation of extracting one field from a tuple + * value. At runtime, the input expression is expected to yield a rowtype + * Datum. The specified field number is extracted and returned as a Datum. + * ---------------- + */ + +typedef struct FieldSelect +{ + Expr xpr; + Expr *arg; /* input expression */ + AttrNumber fieldnum; /* attribute number of field to extract */ + /* type of the field (result type of this node) */ + Oid resulttype pg_node_attr(query_jumble_ignore); + /* output typmod (usually -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation of the field */ + Oid resultcollid pg_node_attr(query_jumble_ignore); +} FieldSelect; + +/* ---------------- + * FieldStore + * + * FieldStore represents the operation of modifying one field in a tuple + * value, yielding a new tuple value (the input is not touched!). Like + * the assign case of SubscriptingRef, this is used to implement UPDATE of a + * portion of a column. + * + * resulttype is always a named composite type (not a domain). To update + * a composite domain value, apply CoerceToDomain to the FieldStore. + * + * A single FieldStore can actually represent updates of several different + * fields. The parser only generates FieldStores with single-element lists, + * but the planner will collapse multiple updates of the same base column + * into one FieldStore. + * ---------------- + */ + +typedef struct FieldStore +{ + Expr xpr; + Expr *arg; /* input tuple value */ + List *newvals; /* new value(s) for field(s) */ + /* integer list of field attnums */ + List *fieldnums pg_node_attr(query_jumble_ignore); + /* type of result (same as type of arg) */ + Oid resulttype pg_node_attr(query_jumble_ignore); + /* Like RowExpr, we deliberately omit a typmod and collation here */ +} FieldStore; + +/* ---------------- + * RelabelType + * + * RelabelType represents a "dummy" type coercion between two binary- + * compatible datatypes, such as reinterpreting the result of an OID + * expression as an int4. It is a no-op at runtime; we only need it + * to provide a place to store the correct type to be attributed to + * the expression result during type resolution. (We can't get away + * with just overwriting the type field of the input expression node, + * so we need a separate node to show the coercion's result type.) + * ---------------- + */ + +typedef struct RelabelType +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type of coercion expression */ + /* output typmod (usually -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm relabelformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} RelabelType; + +/* ---------------- + * CoerceViaIO + * + * CoerceViaIO represents a type coercion between two types whose textual + * representations are compatible, implemented by invoking the source type's + * typoutput function then the destination type's typinput function. + * ---------------- + */ + +typedef struct CoerceViaIO +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type of coercion */ + /* output typmod is not stored, but is presumed -1 */ + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coerceformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} CoerceViaIO; + +/* ---------------- + * ArrayCoerceExpr + * + * ArrayCoerceExpr represents a type coercion from one array type to another, + * which is implemented by applying the per-element coercion expression + * "elemexpr" to each element of the source array. Within elemexpr, the + * source element is represented by a CaseTestExpr node. Note that even if + * elemexpr is a no-op (that is, just CaseTestExpr + RelabelType), the + * coercion still requires some effort: we have to fix the element type OID + * stored in the array header. + * ---------------- + */ + +typedef struct ArrayCoerceExpr +{ + Expr xpr; + Expr *arg; /* input expression (yields an array) */ + Expr *elemexpr; /* expression representing per-element work */ + Oid resulttype; /* output type of coercion (an array type) */ + /* output typmod (also element typmod) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coerceformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} ArrayCoerceExpr; + +/* ---------------- + * ConvertRowtypeExpr + * + * ConvertRowtypeExpr represents a type coercion from one composite type + * to another, where the source type is guaranteed to contain all the columns + * needed for the destination type plus possibly others; the columns need not + * be in the same positions, but are matched up by name. This is primarily + * used to convert a whole-row value of an inheritance child table into a + * valid whole-row value of its parent table's rowtype. Both resulttype + * and the exposed type of "arg" must be named composite types (not domains). + * ---------------- + */ + +typedef struct ConvertRowtypeExpr +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* output type (always a composite type) */ + /* Like RowExpr, we deliberately omit a typmod and collation here */ + /* how to display this node */ + CoercionForm convertformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} ConvertRowtypeExpr; + +/*---------- + * CollateExpr - COLLATE + * + * The planner replaces CollateExpr with RelabelType during expression + * preprocessing, so execution never sees a CollateExpr. + *---------- + */ +typedef struct CollateExpr +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid collOid; /* collation's OID */ + ParseLoc location; /* token location, or -1 if unknown */ +} CollateExpr; + +/*---------- + * CaseExpr - a CASE expression + * + * We support two distinct forms of CASE expression: + * CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ] + * CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ] + * These are distinguishable by the "arg" field being NULL in the first case + * and the testexpr in the second case. + * + * In the raw grammar output for the second form, the condition expressions + * of the WHEN clauses are just the comparison values. Parse analysis + * converts these to valid boolean expressions of the form + * CaseTestExpr '=' compexpr + * where the CaseTestExpr node is a placeholder that emits the correct + * value at runtime. This structure is used so that the testexpr need be + * evaluated only once. Note that after parse analysis, the condition + * expressions always yield boolean. + * + * Note: we can test whether a CaseExpr has been through parse analysis + * yet by checking whether casetype is InvalidOid or not. + *---------- + */ +typedef struct CaseExpr +{ + Expr xpr; + /* type of expression result */ + Oid casetype pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid casecollid pg_node_attr(query_jumble_ignore); + Expr *arg; /* implicit equality comparison argument */ + List *args; /* the arguments (list of WHEN clauses) */ + Expr *defresult; /* the default result (ELSE clause) */ + ParseLoc location; /* token location, or -1 if unknown */ +} CaseExpr; + +/* + * CaseWhen - one arm of a CASE expression + */ +typedef struct CaseWhen +{ + Expr xpr; + Expr *expr; /* condition expression */ + Expr *result; /* substitution result */ + ParseLoc location; /* token location, or -1 if unknown */ +} CaseWhen; + +/* + * Placeholder node for the test value to be processed by a CASE expression. + * This is effectively like a Param, but can be implemented more simply + * since we need only one replacement value at a time. + * + * We also abuse this node type for some other purposes, including: + * * Placeholder for the current array element value in ArrayCoerceExpr; + * see build_coercion_expression(). + * * Nested FieldStore/SubscriptingRef assignment expressions in INSERT/UPDATE; + * see transformAssignmentIndirection(). + * * Placeholder for intermediate results in some SQL/JSON expression nodes, + * such as JsonConstructorExpr. + * + * The uses in CaseExpr and ArrayCoerceExpr are safe only to the extent that + * there is not any other CaseExpr or ArrayCoerceExpr between the value source + * node and its child CaseTestExpr(s). This is true in the parse analysis + * output, but the planner's function-inlining logic has to be careful not to + * break it. + * + * The nested-assignment-expression case is safe because the only node types + * that can be above such CaseTestExprs are FieldStore and SubscriptingRef. + */ +typedef struct CaseTestExpr +{ + Expr xpr; + Oid typeId; /* type for substituted value */ + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); +} CaseTestExpr; + +/* + * ArrayExpr - an ARRAY[] expression + * + * Note: if multidims is false, the constituent expressions all yield the + * scalar type identified by element_typeid. If multidims is true, the + * constituent expressions all yield arrays of element_typeid (ie, the same + * type as array_typeid); at runtime we must check for compatible subscripts. + */ +typedef struct ArrayExpr +{ + Expr xpr; + /* type of expression result */ + Oid array_typeid pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid array_collid pg_node_attr(query_jumble_ignore); + /* common type of array elements */ + Oid element_typeid pg_node_attr(query_jumble_ignore); + /* the array elements or sub-arrays */ + List *elements; + /* true if elements are sub-arrays */ + bool multidims pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} ArrayExpr; + +/* + * RowExpr - a ROW() expression + * + * Note: the list of fields must have a one-for-one correspondence with + * physical fields of the associated rowtype, although it is okay for it + * to be shorter than the rowtype. That is, the N'th list element must + * match up with the N'th physical field. When the N'th physical field + * is a dropped column (attisdropped) then the N'th list element can just + * be a NULL constant. (This case can only occur for named composite types, + * not RECORD types, since those are built from the RowExpr itself rather + * than vice versa.) It is important not to assume that length(args) is + * the same as the number of columns logically present in the rowtype. + * + * colnames provides field names if the ROW() result is of type RECORD. + * Names *must* be provided if row_typeid is RECORDOID; but if it is a + * named composite type, colnames will be ignored in favor of using the + * type's cataloged field names, so colnames should be NIL. Like the + * args list, colnames is defined to be one-for-one with physical fields + * of the rowtype (although dropped columns shouldn't appear in the + * RECORD case, so this fine point is currently moot). + */ +typedef struct RowExpr +{ + Expr xpr; + List *args; /* the fields */ + + /* RECORDOID or a composite type's ID */ + Oid row_typeid pg_node_attr(query_jumble_ignore); + + /* + * row_typeid cannot be a domain over composite, only plain composite. To + * create a composite domain value, apply CoerceToDomain to the RowExpr. + * + * Note: we deliberately do NOT store a typmod. Although a typmod will be + * associated with specific RECORD types at runtime, it will differ for + * different backends, and so cannot safely be stored in stored + * parsetrees. We must assume typmod -1 for a RowExpr node. + * + * We don't need to store a collation either. The result type is + * necessarily composite, and composite types never have a collation. + */ + + /* how to display this node */ + CoercionForm row_format pg_node_attr(query_jumble_ignore); + + /* list of String, or NIL */ + List *colnames pg_node_attr(query_jumble_ignore); + + ParseLoc location; /* token location, or -1 if unknown */ +} RowExpr; + +/* + * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2) + * + * We support row comparison for any operator that can be determined to + * act like =, <>, <, <=, >, or >= (we determine this by looking for the + * operator in btree opfamilies). Note that the same operator name might + * map to a different operator for each pair of row elements, since the + * element datatypes can vary. + * + * A RowCompareExpr node is only generated for the < <= > >= cases; + * the = and <> cases are translated to simple AND or OR combinations + * of the pairwise comparisons. However, we include = and <> in the + * RowCompareType enum for the convenience of parser logic. + */ +typedef enum RowCompareType +{ + /* Values of this enum are chosen to match btree strategy numbers */ + ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */ + ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */ + ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */ + ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */ + ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */ + ROWCOMPARE_NE = 6, /* no such btree strategy */ +} RowCompareType; + +typedef struct RowCompareExpr +{ + Expr xpr; + + /* LT LE GE or GT, never EQ or NE */ + RowCompareType rctype; + /* OID list of pairwise comparison ops */ + List *opnos pg_node_attr(query_jumble_ignore); + /* OID list of containing operator families */ + List *opfamilies pg_node_attr(query_jumble_ignore); + /* OID list of collations for comparisons */ + List *inputcollids pg_node_attr(query_jumble_ignore); + /* the left-hand input arguments */ + List *largs; + /* the right-hand input arguments */ + List *rargs; +} RowCompareExpr; + +/* + * CoalesceExpr - a COALESCE expression + */ +typedef struct CoalesceExpr +{ + Expr xpr; + /* type of expression result */ + Oid coalescetype pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid coalescecollid pg_node_attr(query_jumble_ignore); + /* the arguments */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} CoalesceExpr; + +/* + * MinMaxExpr - a GREATEST or LEAST function + */ +typedef enum MinMaxOp +{ + IS_GREATEST, + IS_LEAST +} MinMaxOp; + +typedef struct MinMaxExpr +{ + Expr xpr; + /* common type of arguments and result */ + Oid minmaxtype pg_node_attr(query_jumble_ignore); + /* OID of collation of result */ + Oid minmaxcollid pg_node_attr(query_jumble_ignore); + /* OID of collation that function should use */ + Oid inputcollid pg_node_attr(query_jumble_ignore); + /* function to execute */ + MinMaxOp op; + /* the arguments */ + List *args; + /* token location, or -1 if unknown */ + ParseLoc location; +} MinMaxExpr; + +/* + * SQLValueFunction - parameterless functions with special grammar productions + * + * The SQL standard categorizes some of these as + * and others as . We call 'em SQLValueFunctions + * for lack of a better term. We store type and typmod of the result so that + * some code doesn't need to know each function individually, and because + * we would need to store typmod anyway for some of the datetime functions. + * Note that currently, all variants return non-collating datatypes, so we do + * not need a collation field; also, all these functions are stable. + */ +typedef enum SQLValueFunctionOp +{ + SVFOP_CURRENT_DATE, + SVFOP_CURRENT_TIME, + SVFOP_CURRENT_TIME_N, + SVFOP_CURRENT_TIMESTAMP, + SVFOP_CURRENT_TIMESTAMP_N, + SVFOP_LOCALTIME, + SVFOP_LOCALTIME_N, + SVFOP_LOCALTIMESTAMP, + SVFOP_LOCALTIMESTAMP_N, + SVFOP_CURRENT_ROLE, + SVFOP_CURRENT_USER, + SVFOP_USER, + SVFOP_SESSION_USER, + SVFOP_CURRENT_CATALOG, + SVFOP_CURRENT_SCHEMA, +} SQLValueFunctionOp; + +typedef struct SQLValueFunction +{ + Expr xpr; + SQLValueFunctionOp op; /* which function this is */ + + /* + * Result type/typmod. Type is fully determined by "op", so no need to + * include this Oid in the query jumbling. + */ + Oid type pg_node_attr(query_jumble_ignore); + int32 typmod; + ParseLoc location; /* token location, or -1 if unknown */ +} SQLValueFunction; + +/* + * XmlExpr - various SQL/XML functions requiring special grammar productions + * + * 'name' carries the "NAME foo" argument (already XML-escaped). + * 'named_args' and 'arg_names' represent an xml_attribute list. + * 'args' carries all other arguments. + * + * Note: result type/typmod/collation are not stored, but can be deduced + * from the XmlExprOp. The type/typmod fields are just used for display + * purposes, and are NOT necessarily the true result type of the node. + */ +typedef enum XmlExprOp +{ + IS_XMLCONCAT, /* XMLCONCAT(args) */ + IS_XMLELEMENT, /* XMLELEMENT(name, xml_attributes, args) */ + IS_XMLFOREST, /* XMLFOREST(xml_attributes) */ + IS_XMLPARSE, /* XMLPARSE(text, is_doc, preserve_ws) */ + IS_XMLPI, /* XMLPI(name [, args]) */ + IS_XMLROOT, /* XMLROOT(xml, version, standalone) */ + IS_XMLSERIALIZE, /* XMLSERIALIZE(is_document, xmlval, indent) */ + IS_DOCUMENT, /* xmlval IS DOCUMENT */ +} XmlExprOp; + +typedef enum XmlOptionType +{ + XMLOPTION_DOCUMENT, + XMLOPTION_CONTENT, +} XmlOptionType; + +typedef struct XmlExpr +{ + Expr xpr; + /* xml function ID */ + XmlExprOp op; + /* name in xml(NAME foo ...) syntaxes */ + char *name pg_node_attr(query_jumble_ignore); + /* non-XML expressions for xml_attributes */ + List *named_args; + /* parallel list of String values */ + List *arg_names pg_node_attr(query_jumble_ignore); + /* list of expressions */ + List *args; + /* DOCUMENT or CONTENT */ + XmlOptionType xmloption pg_node_attr(query_jumble_ignore); + /* INDENT option for XMLSERIALIZE */ + bool indent; + /* target type/typmod for XMLSERIALIZE */ + Oid type pg_node_attr(query_jumble_ignore); + int32 typmod pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} XmlExpr; + +/* + * JsonEncoding - + * representation of JSON ENCODING clause + */ +typedef enum JsonEncoding +{ + JS_ENC_DEFAULT, /* unspecified */ + JS_ENC_UTF8, + JS_ENC_UTF16, + JS_ENC_UTF32, +} JsonEncoding; + +/* + * JsonFormatType - + * enumeration of JSON formats used in JSON FORMAT clause + */ +typedef enum JsonFormatType +{ + JS_FORMAT_DEFAULT, /* unspecified */ + JS_FORMAT_JSON, /* FORMAT JSON [ENCODING ...] */ + JS_FORMAT_JSONB, /* implicit internal format for RETURNING + * jsonb */ +} JsonFormatType; + +/* + * JsonFormat - + * representation of JSON FORMAT clause + */ +typedef struct JsonFormat +{ + NodeTag type; + JsonFormatType format_type; /* format type */ + JsonEncoding encoding; /* JSON encoding */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonFormat; + +/* + * JsonReturning - + * transformed representation of JSON RETURNING clause + */ +typedef struct JsonReturning +{ + NodeTag type; + JsonFormat *format; /* output JSON format */ + Oid typid; /* target type Oid */ + int32 typmod; /* target type modifier */ +} JsonReturning; + +/* + * JsonValueExpr - + * representation of JSON value expression (expr [FORMAT JsonFormat]) + * + * raw_expr is the user-specified value, while formatted_expr is the value + * obtained by coercing raw_expr to the type required by either the FORMAT + * clause or an enclosing node's RETURNING clause. + * + * When deparsing a JsonValueExpr, get_rule_expr() prints raw_expr. However, + * during the evaluation of a JsonValueExpr, the value of formatted_expr + * takes precedence over that of raw_expr. + */ +typedef struct JsonValueExpr +{ + NodeTag type; + Expr *raw_expr; /* user-specified expression */ + Expr *formatted_expr; /* coerced formatted expression */ + JsonFormat *format; /* FORMAT clause, if specified */ +} JsonValueExpr; + +typedef enum JsonConstructorType +{ + JSCTOR_JSON_OBJECT = 1, + JSCTOR_JSON_ARRAY = 2, + JSCTOR_JSON_OBJECTAGG = 3, + JSCTOR_JSON_ARRAYAGG = 4, + JSCTOR_JSON_PARSE = 5, + JSCTOR_JSON_SCALAR = 6, + JSCTOR_JSON_SERIALIZE = 7, +} JsonConstructorType; + +/* + * JsonConstructorExpr - + * wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors + */ +typedef struct JsonConstructorExpr +{ + Expr xpr; + JsonConstructorType type; /* constructor type */ + List *args; + Expr *func; /* underlying json[b]_xxx() function call */ + Expr *coercion; /* coercion to RETURNING type */ + JsonReturning *returning; /* RETURNING clause */ + bool absent_on_null; /* ABSENT ON NULL? */ + bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */ + ParseLoc location; +} JsonConstructorExpr; + +/* + * JsonValueType - + * representation of JSON item type in IS JSON predicate + */ +typedef enum JsonValueType +{ + JS_TYPE_ANY, /* IS JSON [VALUE] */ + JS_TYPE_OBJECT, /* IS JSON OBJECT */ + JS_TYPE_ARRAY, /* IS JSON ARRAY */ + JS_TYPE_SCALAR, /* IS JSON SCALAR */ +} JsonValueType; + +/* + * JsonIsPredicate - + * representation of IS JSON predicate + */ +typedef struct JsonIsPredicate +{ + NodeTag type; + Node *expr; /* subject expression */ + JsonFormat *format; /* FORMAT clause, if specified */ + JsonValueType item_type; /* JSON item type */ + bool unique_keys; /* check key uniqueness? */ + ParseLoc location; /* token location, or -1 if unknown */ +} JsonIsPredicate; + +/* Nodes used in SQL/JSON query functions */ + +/* + * JsonWrapper - + * representation of WRAPPER clause for JSON_QUERY() + */ +typedef enum JsonWrapper +{ + JSW_UNSPEC, + JSW_NONE, + JSW_CONDITIONAL, + JSW_UNCONDITIONAL, +} JsonWrapper; + +/* + * JsonBehaviorType - + * enumeration of behavior types used in SQL/JSON ON ERROR/EMPTY clauses + * + * If enum members are reordered, get_json_behavior() from ruleutils.c + * must be updated accordingly. + */ +typedef enum JsonBehaviorType +{ + JSON_BEHAVIOR_NULL = 0, + JSON_BEHAVIOR_ERROR, + JSON_BEHAVIOR_EMPTY, + JSON_BEHAVIOR_TRUE, + JSON_BEHAVIOR_FALSE, + JSON_BEHAVIOR_UNKNOWN, + JSON_BEHAVIOR_EMPTY_ARRAY, + JSON_BEHAVIOR_EMPTY_OBJECT, + JSON_BEHAVIOR_DEFAULT, +} JsonBehaviorType; + +/* + * JsonBehavior + * Specifications for ON ERROR / ON EMPTY behaviors of SQL/JSON + * query functions specified by a JsonExpr + * + * 'expr' is the expression to emit when a given behavior (EMPTY or ERROR) + * occurs on evaluating the SQL/JSON query function. 'coerce' is set to true + * if 'expr' isn't already of the expected target type given by + * JsonExpr.returning. + */ +typedef struct JsonBehavior +{ + NodeTag type; + + JsonBehaviorType btype; + Node *expr; + bool coerce; + ParseLoc location; /* token location, or -1 if unknown */ +} JsonBehavior; + +/* + * JsonExprOp - + * enumeration of SQL/JSON query function types + */ +typedef enum JsonExprOp +{ + JSON_EXISTS_OP, /* JSON_EXISTS() */ + JSON_QUERY_OP, /* JSON_QUERY() */ + JSON_VALUE_OP, /* JSON_VALUE() */ + JSON_TABLE_OP, /* JSON_TABLE() */ +} JsonExprOp; + +/* + * JsonExpr - + * Transformed representation of JSON_VALUE(), JSON_QUERY(), and + * JSON_EXISTS() + */ +typedef struct JsonExpr +{ + Expr xpr; + + JsonExprOp op; + + char *column_name; /* JSON_TABLE() column name or NULL if this is + * not for a JSON_TABLE() */ + + /* jsonb-valued expression to query */ + Node *formatted_expr; + + /* Format of the above expression needed by ruleutils.c */ + JsonFormat *format; + + /* jsonpath-valued expression containing the query pattern */ + Node *path_spec; + + /* Expected type/format of the output. */ + JsonReturning *returning; + + /* Information about the PASSING argument expressions */ + List *passing_names; + List *passing_values; + + /* User-specified or default ON EMPTY and ON ERROR behaviors */ + JsonBehavior *on_empty; + JsonBehavior *on_error; + + /* + * Information about converting the result of jsonpath functions + * JsonPathQuery() and JsonPathValue() to the RETURNING type. + */ + bool use_io_coercion; + bool use_json_coercion; + + /* WRAPPER specification for JSON_QUERY */ + JsonWrapper wrapper; + + /* KEEP or OMIT QUOTES for singleton scalars returned by JSON_QUERY() */ + bool omit_quotes; + + /* JsonExpr's collation. */ + Oid collation; + + /* Original JsonFuncExpr's location */ + ParseLoc location; +} JsonExpr; + +/* + * JsonTablePath + * A JSON path expression to be computed as part of evaluating + * a JSON_TABLE plan node + */ +typedef struct JsonTablePath +{ + NodeTag type; + + Const *value; + char *name; +} JsonTablePath; + +/* + * JsonTablePlan - + * Abstract class to represent different types of JSON_TABLE "plans". + * A plan is used to generate a "row pattern" value by evaluating a JSON + * path expression against an input JSON document, which is then used for + * populating JSON_TABLE() columns + */ +typedef struct JsonTablePlan +{ + pg_node_attr(abstract) + + NodeTag type; +} JsonTablePlan; + +/* + * JSON_TABLE plan to evaluate a JSON path expression and NESTED paths, if + * any. + */ +typedef struct JsonTablePathScan +{ + JsonTablePlan plan; + + /* JSON path to evaluate */ + JsonTablePath *path; + + /* + * ERROR/EMPTY ON ERROR behavior; only significant in the plan for the + * top-level path. + */ + bool errorOnError; + + /* Plan(s) for nested columns, if any. */ + JsonTablePlan *child; + + /* + * 0-based index in TableFunc.colvalexprs of the 1st and the last column + * covered by this plan. Both are -1 if all columns are nested and thus + * computed by the child plan(s). + */ + int colMin; + int colMax; +} JsonTablePathScan; + +/* + * JsonTableSiblingJoin - + * Plan to join rows of sibling NESTED COLUMNS clauses in the same parent + * COLUMNS clause + */ +typedef struct JsonTableSiblingJoin +{ + JsonTablePlan plan; + + JsonTablePlan *lplan; + JsonTablePlan *rplan; +} JsonTableSiblingJoin; + +/* ---------------- + * NullTest + * + * NullTest represents the operation of testing a value for NULLness. + * The appropriate test is performed and returned as a boolean Datum. + * + * When argisrow is false, this simply represents a test for the null value. + * + * When argisrow is true, the input expression must yield a rowtype, and + * the node implements "row IS [NOT] NULL" per the SQL standard. This + * includes checking individual fields for NULLness when the row datum + * itself isn't NULL. + * + * NOTE: the combination of a rowtype input and argisrow==false does NOT + * correspond to the SQL notation "row IS [NOT] NULL"; instead, this case + * represents the SQL notation "row IS [NOT] DISTINCT FROM NULL". + * ---------------- + */ + +typedef enum NullTestType +{ + IS_NULL, IS_NOT_NULL +} NullTestType; + +typedef struct NullTest +{ + Expr xpr; + Expr *arg; /* input expression */ + NullTestType nulltesttype; /* IS NULL, IS NOT NULL */ + /* T to perform field-by-field null checks */ + bool argisrow pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} NullTest; + +/* + * BooleanTest + * + * BooleanTest represents the operation of determining whether a boolean + * is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations + * are supported. Note that a NULL input does *not* cause a NULL result. + * The appropriate test is performed and returned as a boolean Datum. + */ + +typedef enum BoolTestType +{ + IS_TRUE, IS_NOT_TRUE, IS_FALSE, IS_NOT_FALSE, IS_UNKNOWN, IS_NOT_UNKNOWN +} BoolTestType; + +typedef struct BooleanTest +{ + Expr xpr; + Expr *arg; /* input expression */ + BoolTestType booltesttype; /* test type */ + ParseLoc location; /* token location, or -1 if unknown */ +} BooleanTest; + + +/* + * MergeAction + * + * Transformed representation of a WHEN clause in a MERGE statement + */ + +typedef enum MergeMatchKind +{ + MERGE_WHEN_MATCHED, + MERGE_WHEN_NOT_MATCHED_BY_SOURCE, + MERGE_WHEN_NOT_MATCHED_BY_TARGET +} MergeMatchKind; + +#define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1) + +typedef struct MergeAction +{ + NodeTag type; + MergeMatchKind matchKind; /* MATCHED/NOT MATCHED BY SOURCE/TARGET */ + CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */ + /* OVERRIDING clause */ + OverridingKind override pg_node_attr(query_jumble_ignore); + Node *qual; /* transformed WHEN conditions */ + List *targetList; /* the target list (of TargetEntry) */ + /* target attribute numbers of an UPDATE */ + List *updateColnos pg_node_attr(query_jumble_ignore); +} MergeAction; + +/* + * CoerceToDomain + * + * CoerceToDomain represents the operation of coercing a value to a domain + * type. At runtime (and not before) the precise set of constraints to be + * checked will be determined. If the value passes, it is returned as the + * result; if not, an error is raised. Note that this is equivalent to + * RelabelType in the scenario where no constraints are applied. + */ +typedef struct CoerceToDomain +{ + Expr xpr; + Expr *arg; /* input expression */ + Oid resulttype; /* domain type ID (result type) */ + /* output typmod (currently always -1) */ + int32 resulttypmod pg_node_attr(query_jumble_ignore); + /* OID of collation, or InvalidOid if none */ + Oid resultcollid pg_node_attr(query_jumble_ignore); + /* how to display this node */ + CoercionForm coercionformat pg_node_attr(query_jumble_ignore); + ParseLoc location; /* token location, or -1 if unknown */ +} CoerceToDomain; + +/* + * Placeholder node for the value to be processed by a domain's check + * constraint. This is effectively like a Param, but can be implemented more + * simply since we need only one replacement value at a time. + * + * Note: the typeId/typeMod/collation will be set from the domain's base type, + * not the domain itself. This is because we shouldn't consider the value + * to be a member of the domain if we haven't yet checked its constraints. + */ +typedef struct CoerceToDomainValue +{ + Expr xpr; + /* type for substituted value */ + Oid typeId; + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} CoerceToDomainValue; + +/* + * Placeholder node for a DEFAULT marker in an INSERT or UPDATE command. + * + * This is not an executable expression: it must be replaced by the actual + * column default expression during rewriting. But it is convenient to + * treat it as an expression node during parsing and rewriting. + */ +typedef struct SetToDefault +{ + Expr xpr; + /* type for substituted value */ + Oid typeId; + /* typemod for substituted value */ + int32 typeMod pg_node_attr(query_jumble_ignore); + /* collation for the substituted value */ + Oid collation pg_node_attr(query_jumble_ignore); + /* token location, or -1 if unknown */ + ParseLoc location; +} SetToDefault; + +/* + * Node representing [WHERE] CURRENT OF cursor_name + * + * CURRENT OF is a bit like a Var, in that it carries the rangetable index + * of the target relation being constrained; this aids placing the expression + * correctly during planning. We can assume however that its "levelsup" is + * always zero, due to the syntactic constraints on where it can appear. + * Also, cvarno will always be a true RT index, never INNER_VAR etc. + * + * The referenced cursor can be represented either as a hardwired string + * or as a reference to a run-time parameter of type REFCURSOR. The latter + * case is for the convenience of plpgsql. + */ +typedef struct CurrentOfExpr +{ + Expr xpr; + Index cvarno; /* RT index of target relation */ + char *cursor_name; /* name of referenced cursor, or NULL */ + int cursor_param; /* refcursor parameter number, or 0 */ +} CurrentOfExpr; + +/* + * NextValueExpr - get next value from sequence + * + * This has the same effect as calling the nextval() function, but it does not + * check permissions on the sequence. This is used for identity columns, + * where the sequence is an implicit dependency without its own permissions. + */ +typedef struct NextValueExpr +{ + Expr xpr; + Oid seqid; + Oid typeId; +} NextValueExpr; + +/* + * InferenceElem - an element of a unique index inference specification + * + * This mostly matches the structure of IndexElems, but having a dedicated + * primnode allows for a clean separation between the use of index parameters + * by utility commands, and this node. + */ +typedef struct InferenceElem +{ + Expr xpr; + Node *expr; /* expression to infer from, or NULL */ + Oid infercollid; /* OID of collation, or InvalidOid */ + Oid inferopclass; /* OID of att opclass, or InvalidOid */ +} InferenceElem; + +/*-------------------- + * TargetEntry - + * a target entry (used in query target lists) + * + * Strictly speaking, a TargetEntry isn't an expression node (since it can't + * be evaluated by ExecEvalExpr). But we treat it as one anyway, since in + * very many places it's convenient to process a whole query targetlist as a + * single expression tree. + * + * In a SELECT's targetlist, resno should always be equal to the item's + * ordinal position (counting from 1). However, in an INSERT or UPDATE + * targetlist, resno represents the attribute number of the destination + * column for the item; so there may be missing or out-of-order resnos. + * It is even legal to have duplicated resnos; consider + * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ... + * In an INSERT, the rewriter and planner will normalize the tlist by + * reordering it into physical column order and filling in default values + * for any columns not assigned values by the original query. In an UPDATE, + * after the rewriter merges multiple assignments for the same column, the + * planner extracts the target-column numbers into a separate "update_colnos" + * list, and then renumbers the tlist elements serially. Thus, tlist resnos + * match ordinal position in all tlists seen by the executor; but it is wrong + * to assume that before planning has happened. + * + * resname is required to represent the correct column name in non-resjunk + * entries of top-level SELECT targetlists, since it will be used as the + * column title sent to the frontend. In most other contexts it is only + * a debugging aid, and may be wrong or even NULL. (In particular, it may + * be wrong in a tlist from a stored rule, if the referenced column has been + * renamed by ALTER TABLE since the rule was made. Also, the planner tends + * to store NULL rather than look up a valid name for tlist entries in + * non-toplevel plan nodes.) In resjunk entries, resname should be either + * a specific system-generated name (such as "ctid") or NULL; anything else + * risks confusing ExecGetJunkAttribute! + * + * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and + * DISTINCT items. Targetlist entries with ressortgroupref=0 are not + * sort/group items. If ressortgroupref>0, then this item is an ORDER BY, + * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist + * may have the same nonzero ressortgroupref --- but there is no particular + * meaning to the nonzero values, except as tags. (For example, one must + * not assume that lower ressortgroupref means a more significant sort key.) + * The order of the associated SortGroupClause lists determine the semantics. + * + * resorigtbl/resorigcol identify the source of the column, if it is a + * simple reference to a column of a base table (or view). If it is not + * a simple reference, these fields are zeroes. + * + * If resjunk is true then the column is a working column (such as a sort key) + * that should be removed from the final output of the query. Resjunk columns + * must have resnos that cannot duplicate any regular column's resno. Also + * note that there are places that assume resjunk columns come after non-junk + * columns. + *-------------------- + */ +typedef struct TargetEntry +{ + Expr xpr; + /* expression to evaluate */ + Expr *expr; + /* attribute number (see notes above) */ + AttrNumber resno; + /* name of the column (could be NULL) */ + char *resname pg_node_attr(query_jumble_ignore); + /* nonzero if referenced by a sort/group clause */ + Index ressortgroupref; + /* OID of column's source table */ + Oid resorigtbl pg_node_attr(query_jumble_ignore); + /* column's number in source table */ + AttrNumber resorigcol pg_node_attr(query_jumble_ignore); + /* set to true to eliminate the attribute from final target list */ + bool resjunk pg_node_attr(query_jumble_ignore); +} TargetEntry; + + +/* ---------------------------------------------------------------- + * node types for join trees + * + * The leaves of a join tree structure are RangeTblRef nodes. Above + * these, JoinExpr nodes can appear to denote a specific kind of join + * or qualified join. Also, FromExpr nodes can appear to denote an + * ordinary cross-product join ("FROM foo, bar, baz WHERE ..."). + * FromExpr is like a JoinExpr of jointype JOIN_INNER, except that it + * may have any number of child nodes, not just two. + * + * NOTE: the top level of a Query's jointree is always a FromExpr. + * Even if the jointree contains no rels, there will be a FromExpr. + * + * NOTE: the qualification expressions present in JoinExpr nodes are + * *in addition to* the query's main WHERE clause, which appears as the + * qual of the top-level FromExpr. The reason for associating quals with + * specific nodes in the jointree is that the position of a qual is critical + * when outer joins are present. (If we enforce a qual too soon or too late, + * that may cause the outer join to produce the wrong set of NULL-extended + * rows.) If all joins are inner joins then all the qual positions are + * semantically interchangeable. + * + * NOTE: in the raw output of gram.y, a join tree contains RangeVar, + * RangeSubselect, and RangeFunction nodes, which are all replaced by + * RangeTblRef nodes during the parse analysis phase. Also, the top-level + * FromExpr is added during parse analysis; the grammar regards FROM and + * WHERE as separate. + * ---------------------------------------------------------------- + */ + +/* + * RangeTblRef - reference to an entry in the query's rangetable + * + * We could use direct pointers to the RT entries and skip having these + * nodes, but multiple pointers to the same node in a querytree cause + * lots of headaches, so it seems better to store an index into the RT. + */ +typedef struct RangeTblRef +{ + NodeTag type; + int rtindex; +} RangeTblRef; + +/*---------- + * JoinExpr - for SQL JOIN expressions + * + * isNatural, usingClause, and quals are interdependent. The user can write + * only one of NATURAL, USING(), or ON() (this is enforced by the grammar). + * If he writes NATURAL then parse analysis generates the equivalent USING() + * list, and from that fills in "quals" with the right equality comparisons. + * If he writes USING() then "quals" is filled with equality comparisons. + * If he writes ON() then only "quals" is set. Note that NATURAL/USING + * are not equivalent to ON() since they also affect the output column list. + * + * alias is an Alias node representing the AS alias-clause attached to the + * join expression, or NULL if no clause. NB: presence or absence of the + * alias has a critical impact on semantics, because a join with an alias + * restricts visibility of the tables/columns inside it. + * + * join_using_alias is an Alias node representing the join correlation + * name that SQL:2016 and later allow to be attached to JOIN/USING. + * Its column alias list includes only the common column names from USING, + * and it does not restrict visibility of the join's input tables. + * + * During parse analysis, an RTE is created for the Join, and its index + * is filled into rtindex. This RTE is present mainly so that Vars can + * be created that refer to the outputs of the join. The planner sometimes + * generates JoinExprs internally; these can have rtindex = 0 if there are + * no join alias variables referencing such joins. + *---------- + */ +typedef struct JoinExpr +{ + NodeTag type; + JoinType jointype; /* type of join */ + bool isNatural; /* Natural join? Will need to shape table */ + Node *larg; /* left subtree */ + Node *rarg; /* right subtree */ + /* USING clause, if any (list of String) */ + List *usingClause pg_node_attr(query_jumble_ignore); + /* alias attached to USING clause, if any */ + Alias *join_using_alias pg_node_attr(query_jumble_ignore); + /* qualifiers on join, if any */ + Node *quals; + /* user-written alias clause, if any */ + Alias *alias pg_node_attr(query_jumble_ignore); + /* RT index assigned for join, or 0 */ + int rtindex; +} JoinExpr; + +/*---------- + * FromExpr - represents a FROM ... WHERE ... construct + * + * This is both more flexible than a JoinExpr (it can have any number of + * children, including zero) and less so --- we don't need to deal with + * aliases and so on. The output column set is implicitly just the union + * of the outputs of the children. + *---------- + */ +typedef struct FromExpr +{ + NodeTag type; + List *fromlist; /* List of join subtrees */ + Node *quals; /* qualifiers on join, if any */ +} FromExpr; + +/*---------- + * OnConflictExpr - represents an ON CONFLICT DO ... expression + * + * The optimizer requires a list of inference elements, and optionally a WHERE + * clause to infer a unique index. The unique index (or, occasionally, + * indexes) inferred are used to arbitrate whether or not the alternative ON + * CONFLICT path is taken. + *---------- + */ +typedef struct OnConflictExpr +{ + NodeTag type; + OnConflictAction action; /* DO NOTHING or UPDATE? */ + + /* Arbiter */ + List *arbiterElems; /* unique index arbiter list (of + * InferenceElem's) */ + Node *arbiterWhere; /* unique index arbiter WHERE clause */ + Oid constraint; /* pg_constraint OID for arbiter */ + + /* ON CONFLICT UPDATE */ + List *onConflictSet; /* List of ON CONFLICT SET TargetEntrys */ + Node *onConflictWhere; /* qualifiers to restrict UPDATE to */ + int exclRelIndex; /* RT index of 'excluded' relation */ + List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */ +} OnConflictExpr; + +#endif /* PRIMNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/print.h b/platform/dbops/binaries/postgres/include/server/nodes/print.h new file mode 100644 index 0000000000000000000000000000000000000000..333103a4051b0f50d7f8b6725564799e08ed6cf1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/print.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * print.h + * definitions for nodes/print.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/print.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRINT_H +#define PRINT_H + +#include "executor/tuptable.h" + + +#define nodeDisplay(x) pprint(x) + +extern void print(const void *obj); +extern void pprint(const void *obj); +extern void elog_node_display(int lev, const char *title, + const void *obj, bool pretty); +extern char *format_node_dump(const char *dump); +extern char *pretty_format_node_dump(const char *dump); +extern void print_rt(const List *rtable); +extern void print_expr(const Node *expr, const List *rtable); +extern void print_pathkeys(const List *pathkeys, const List *rtable); +extern void print_tl(const List *tlist, const List *rtable); +extern void print_slot(TupleTableSlot *slot); + +#endif /* PRINT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/queryjumble.h b/platform/dbops/binaries/postgres/include/server/nodes/queryjumble.h new file mode 100644 index 0000000000000000000000000000000000000000..f1c55c8067f406dbd458dbf90a7d4725c14dc1b7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/queryjumble.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * + * queryjumble.h + * Query normalization and fingerprinting. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/nodes/queryjumble.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERYJUMBLE_H +#define QUERYJUMBLE_H + +#include "nodes/parsenodes.h" + +/* + * Struct for tracking locations/lengths of constants during normalization + */ +typedef struct LocationLen +{ + int location; /* start offset in query text */ + int length; /* length in bytes, or -1 to ignore */ +} LocationLen; + +/* + * Working state for computing a query jumble and producing a normalized + * query string + */ +typedef struct JumbleState +{ + /* Jumble of current query tree */ + unsigned char *jumble; + + /* Number of bytes used in jumble[] */ + Size jumble_len; + + /* Array of locations of constants that should be removed */ + LocationLen *clocations; + + /* Allocated length of clocations array */ + int clocations_buf_size; + + /* Current number of valid entries in clocations array */ + int clocations_count; + + /* highest Param id we've seen, in order to start normalization correctly */ + int highest_extern_param_id; +} JumbleState; + +/* Values for the compute_query_id GUC */ +enum ComputeQueryIdType +{ + COMPUTE_QUERY_ID_OFF, + COMPUTE_QUERY_ID_ON, + COMPUTE_QUERY_ID_AUTO, + COMPUTE_QUERY_ID_REGRESS, +}; + +/* GUC parameters */ +extern PGDLLIMPORT int compute_query_id; + + +extern const char *CleanQuerytext(const char *query, int *location, int *len); +extern JumbleState *JumbleQuery(Query *query); +extern void EnableQueryId(void); + +extern PGDLLIMPORT bool query_id_enabled; + +/* + * Returns whether query identifier computation has been enabled, either + * directly in the GUC or by a module when the setting is 'auto'. + */ +static inline bool +IsQueryIdEnabled(void) +{ + if (compute_query_id == COMPUTE_QUERY_ID_OFF) + return false; + if (compute_query_id == COMPUTE_QUERY_ID_ON) + return true; + return query_id_enabled; +} + +#endif /* QUERYJUMBLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/readfuncs.h b/platform/dbops/binaries/postgres/include/server/nodes/readfuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..8466038ed06773859829d8a56e98b1d80ae1fced --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/readfuncs.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * readfuncs.h + * header file for read.c and readfuncs.c. These functions are internal + * to the stringToNode interface and should not be used by anyone else. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/readfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef READFUNCS_H +#define READFUNCS_H + +#include "nodes/nodes.h" + +/* + * variable in read.c that needs to be accessible to readfuncs.c + */ +#ifdef WRITE_READ_PARSE_PLAN_TREES +extern PGDLLIMPORT bool restore_location_fields; +#endif + +/* + * prototypes for functions in read.c (the lisp token parser) + */ +extern const char *pg_strtok(int *length); +extern char *debackslash(const char *token, int length); +extern void *nodeRead(const char *token, int tok_len); + +/* + * prototypes for functions in readfuncs.c + */ +extern Node *parseNodeString(void); + +#endif /* READFUNCS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/replnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/replnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..ed23333e9286aae2ddca87f4c0ba6fdabebc3388 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/replnodes.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------------------- + * + * replnodes.h + * definitions for replication grammar parse nodes + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/replnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef REPLNODES_H +#define REPLNODES_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +typedef enum ReplicationKind +{ + REPLICATION_KIND_PHYSICAL, + REPLICATION_KIND_LOGICAL, +} ReplicationKind; + + +/* ---------------------- + * IDENTIFY_SYSTEM command + * ---------------------- + */ +typedef struct IdentifySystemCmd +{ + NodeTag type; +} IdentifySystemCmd; + + +/* ---------------------- + * BASE_BACKUP command + * ---------------------- + */ +typedef struct BaseBackupCmd +{ + NodeTag type; + List *options; +} BaseBackupCmd; + + +/* ---------------------- + * CREATE_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct CreateReplicationSlotCmd +{ + NodeTag type; + char *slotname; + ReplicationKind kind; + char *plugin; + bool temporary; + List *options; +} CreateReplicationSlotCmd; + + +/* ---------------------- + * DROP_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct DropReplicationSlotCmd +{ + NodeTag type; + char *slotname; + bool wait; +} DropReplicationSlotCmd; + + +/* ---------------------- + * ALTER_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct AlterReplicationSlotCmd +{ + NodeTag type; + char *slotname; + List *options; +} AlterReplicationSlotCmd; + + +/* ---------------------- + * START_REPLICATION command + * ---------------------- + */ +typedef struct StartReplicationCmd +{ + NodeTag type; + ReplicationKind kind; + char *slotname; + TimeLineID timeline; + XLogRecPtr startpoint; + List *options; +} StartReplicationCmd; + + +/* ---------------------- + * READ_REPLICATION_SLOT command + * ---------------------- + */ +typedef struct ReadReplicationSlotCmd +{ + NodeTag type; + char *slotname; +} ReadReplicationSlotCmd; + + +/* ---------------------- + * TIMELINE_HISTORY command + * ---------------------- + */ +typedef struct TimeLineHistoryCmd +{ + NodeTag type; + TimeLineID timeline; +} TimeLineHistoryCmd; + +/* ---------------------- + * UPLOAD_MANIFEST command + * ---------------------- + */ +typedef struct UploadManifestCmd +{ + NodeTag type; +} UploadManifestCmd; + +#endif /* REPLNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/subscripting.h b/platform/dbops/binaries/postgres/include/server/nodes/subscripting.h new file mode 100644 index 0000000000000000000000000000000000000000..597209ba42d0ec7bf252d4b6ea33bf0e26bd8f09 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/subscripting.h @@ -0,0 +1,167 @@ +/*------------------------------------------------------------------------- + * + * subscripting.h + * API for generic type subscripting + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/subscripting.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUBSCRIPTING_H +#define SUBSCRIPTING_H + +#include "nodes/primnodes.h" + +/* Forward declarations, to avoid including other headers */ +struct ParseState; +struct SubscriptingRefState; +struct SubscriptExecSteps; + +/* + * The SQL-visible function that defines a subscripting method is declared + * subscripting_function(internal) returns internal + * but it actually is not passed any parameter. It must return a pointer + * to a "struct SubscriptRoutines" that provides pointers to the individual + * subscript parsing and execution methods. Typically the pointer will point + * to a "static const" variable, but at need it can point to palloc'd space. + * The type (after domain-flattening) of the head variable or expression + * of a subscripting construct determines which subscripting function is + * called for that construct. + * + * In addition to the method pointers, struct SubscriptRoutines includes + * several bool flags that specify properties of the subscripting actions + * this data type can perform: + * + * fetch_strict indicates that a fetch SubscriptRef is strict, i.e., returns + * NULL if any input (either the container or any subscript) is NULL. + * + * fetch_leakproof indicates that a fetch SubscriptRef is leakproof, i.e., + * will not throw any data-value-dependent errors. Typically this requires + * silently returning NULL for invalid subscripts. + * + * store_leakproof similarly indicates whether an assignment SubscriptRef is + * leakproof. (It is common to prefer throwing errors for invalid subscripts + * in assignments; that's fine, but it makes the operation not leakproof. + * In current usage there is no advantage in making assignments leakproof.) + * + * There is no store_strict flag. Such behavior would generally be + * undesirable, since for example a null subscript in an assignment would + * cause the entire container to become NULL. + * + * Regardless of these flags, all SubscriptRefs are expected to be immutable, + * that is they must always give the same results for the same inputs. + * They are expected to always be parallel-safe, as well. + */ + +/* + * The transform method is called during parse analysis of a subscripting + * construct. The SubscriptingRef node has been constructed, but some of + * its fields still need to be filled in, and the subscript expression(s) + * are still in raw form. The transform method is responsible for doing + * parse analysis of each subscript expression (using transformExpr), + * coercing the subscripts to whatever type it needs, and building the + * refupperindexpr and reflowerindexpr lists from those results. The + * reflowerindexpr list must be empty for an element operation, or the + * same length as refupperindexpr for a slice operation. Insert NULLs + * (that is, an empty parse tree, not a null Const node) for any omitted + * subscripts in a slice operation. (Of course, if the transform method + * does not care to support slicing, it can just throw an error if isSlice.) + * See array_subscript_transform() for sample code. + * + * The transform method is also responsible for identifying the result type + * of the subscripting operation. At call, refcontainertype and reftypmod + * describe the container type (this will be a base type not a domain), and + * refelemtype is set to the container type's pg_type.typelem value. The + * transform method must set refrestype and reftypmod to describe the result + * of subscripting. For arrays, refrestype is set to refelemtype for an + * element operation or refcontainertype for a slice, while reftypmod stays + * the same in either case; but other types might use other rules. The + * transform method should ignore refcollid, as that's determined later on + * during parsing. + * + * At call, refassgnexpr has not been filled in, so the SubscriptingRef node + * always looks like a fetch; refrestype should be set as though for a + * fetch, too. (The isAssignment parameter is typically only useful if the + * transform method wishes to throw an error for not supporting assignment.) + * To complete processing of an assignment, the core parser will coerce the + * element/slice source expression to the returned refrestype and reftypmod + * before putting it into refassgnexpr. It will then set refrestype and + * reftypmod to again describe the container type, since that's what an + * assignment must return. + */ +typedef void (*SubscriptTransform) (SubscriptingRef *sbsref, + List *indirection, + struct ParseState *pstate, + bool isSlice, + bool isAssignment); + +/* + * The exec_setup method is called during executor-startup compilation of a + * SubscriptingRef node in an expression. It must fill *methods with pointers + * to functions that can be called for execution of the node. Optionally, + * exec_setup can initialize sbsrefstate->workspace to point to some palloc'd + * workspace for execution. (Typically, such workspace is used to hold + * looked-up catalog data and/or provide space for the check_subscripts step + * to pass data forward to the other step functions.) See executor/execExpr.h + * for the definitions of these structs and other ones used in expression + * execution. + * + * The methods to be provided are: + * + * sbs_check_subscripts: examine the just-computed subscript values available + * in sbsrefstate's arrays, and possibly convert them into another form + * (stored in sbsrefstate->workspace). Return TRUE to continue with + * evaluation of the subscripting construct, or FALSE to skip it and return an + * overall NULL result. If this is a fetch and the data type's fetch_strict + * flag is true, then sbs_check_subscripts must return FALSE if there are any + * NULL subscripts. Otherwise it can choose to throw an error, or return + * FALSE, or let sbs_fetch or sbs_assign deal with the null subscripts. + * + * sbs_fetch: perform a subscripting fetch, using the container value in + * *op->resvalue and the subscripts from sbs_check_subscripts. If + * fetch_strict is true then all these inputs can be assumed non-NULL, + * otherwise sbs_fetch must check for null inputs. Place the result in + * *op->resvalue / *op->resnull. + * + * sbs_assign: perform a subscripting assignment, using the original + * container value in *op->resvalue / *op->resnull, the subscripts from + * sbs_check_subscripts, and the new element/slice value in + * sbsrefstate->replacevalue/replacenull. Any of these inputs might be NULL + * (unless sbs_check_subscripts rejected null subscripts). Place the result + * (an entire new container value) in *op->resvalue / *op->resnull. + * + * sbs_fetch_old: this is only used in cases where an element or slice + * assignment involves an assignment to a sub-field or sub-element + * (i.e., nested containers are involved). It must fetch the existing + * value of the target element or slice. This is exactly the same as + * sbs_fetch except that (a) it must cope with a NULL container, and + * with NULL subscripts if sbs_check_subscripts allows them (typically, + * returning NULL is good enough); and (b) the result must be placed in + * sbsrefstate->prevvalue/prevnull, without overwriting *op->resvalue. + * + * Subscripting implementations that do not support assignment need not + * provide sbs_assign or sbs_fetch_old methods. It might be reasonable + * to also omit sbs_check_subscripts, in which case the sbs_fetch method must + * combine the functionality of sbs_check_subscripts and sbs_fetch. (The + * main reason to have a separate sbs_check_subscripts method is so that + * sbs_fetch_old and sbs_assign need not duplicate subscript processing.) + * Set the relevant pointers to NULL for any omitted methods. + */ +typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref, + struct SubscriptingRefState *sbsrefstate, + struct SubscriptExecSteps *methods); + +/* Struct returned by the SQL-visible subscript handler function */ +typedef struct SubscriptRoutines +{ + SubscriptTransform transform; /* parse analysis function */ + SubscriptExecSetup exec_setup; /* expression compilation function */ + bool fetch_strict; /* is fetch SubscriptRef strict? */ + bool fetch_leakproof; /* is fetch SubscriptRef leakproof? */ + bool store_leakproof; /* is assignment SubscriptRef leakproof? */ +} SubscriptRoutines; + +#endif /* SUBSCRIPTING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/supportnodes.h b/platform/dbops/binaries/postgres/include/server/nodes/supportnodes.h new file mode 100644 index 0000000000000000000000000000000000000000..5f7bcde891c7bf5f4f576c07875810ff959e0744 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/supportnodes.h @@ -0,0 +1,346 @@ +/*------------------------------------------------------------------------- + * + * supportnodes.h + * Definitions for planner support functions. + * + * This file defines the API for "planner support functions", which + * are SQL functions (normally written in C) that can be attached to + * another "target" function to give the system additional knowledge + * about the target function. All the current capabilities have to do + * with planning queries that use the target function, though it is + * possible that future extensions will add functionality to be invoked + * by the parser or executor. + * + * A support function must have the SQL signature + * supportfn(internal) returns internal + * The argument is a pointer to one of the Node types defined in this file. + * The result is usually also a Node pointer, though its type depends on + * which capability is being invoked. In all cases, a NULL pointer result + * (that's PG_RETURN_POINTER(NULL), not PG_RETURN_NULL()) indicates that + * the support function cannot do anything useful for the given request. + * Support functions must return a NULL pointer, not fail, if they do not + * recognize the request node type or cannot handle the given case; this + * allows for future extensions of the set of request cases. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/nodes/supportnodes.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUPPORTNODES_H +#define SUPPORTNODES_H + +#include "nodes/plannodes.h" + +struct PlannerInfo; /* avoid including pathnodes.h here */ +struct IndexOptInfo; +struct SpecialJoinInfo; +struct WindowClause; + +/* + * The Simplify request allows the support function to perform plan-time + * simplification of a call to its target function. For example, a varchar + * length coercion that does not decrease the allowed length of its argument + * could be replaced by a RelabelType node, or "x + 0" could be replaced by + * "x". This is invoked during the planner's constant-folding pass, so the + * function's arguments can be presumed already simplified. + * + * The planner's PlannerInfo "root" is typically not needed, but can be + * consulted if it's necessary to obtain info about Vars present in + * the given node tree. Beware that root could be NULL in some usages. + * + * "fcall" will be a FuncExpr invoking the support function's target + * function. (This is true even if the original parsetree node was an + * operator call; a FuncExpr is synthesized for this purpose.) + * + * The result should be a semantically-equivalent transformed node tree, + * or NULL if no simplification could be performed. Do *not* return or + * modify *fcall, as it isn't really a separately allocated Node. But + * it's okay to use fcall->args, or parts of it, in the result tree. + */ +typedef struct SupportRequestSimplify +{ + NodeTag type; + + struct PlannerInfo *root; /* Planner's infrastructure */ + FuncExpr *fcall; /* Function call to be simplified */ +} SupportRequestSimplify; + +/* + * The Selectivity request allows the support function to provide a + * selectivity estimate for a function appearing at top level of a WHERE + * clause (so it applies only to functions returning boolean). + * + * The input arguments are the same as are supplied to operator restriction + * and join estimators, except that we unify those two APIs into just one + * request type. See clause_selectivity() for the details. + * + * If an estimate can be made, store it into the "selectivity" field and + * return the address of the SupportRequestSelectivity node; the estimate + * must be between 0 and 1 inclusive. Return NULL if no estimate can be + * made (in which case the planner will fall back to a default estimate, + * traditionally 1/3). + * + * If the target function is being used as the implementation of an operator, + * the support function will not be used for this purpose; the operator's + * restriction or join estimator is consulted instead. + */ +typedef struct SupportRequestSelectivity +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure */ + Oid funcid; /* function we are inquiring about */ + List *args; /* pre-simplified arguments to function */ + Oid inputcollid; /* function's input collation */ + bool is_join; /* is this a join or restriction case? */ + int varRelid; /* if restriction, RTI of target relation */ + JoinType jointype; /* if join, outer join type */ + struct SpecialJoinInfo *sjinfo; /* if outer join, info about join */ + + /* Output fields: */ + Selectivity selectivity; /* returned selectivity estimate */ +} SupportRequestSelectivity; + +/* + * The Cost request allows the support function to provide an execution + * cost estimate for its target function. The cost estimate can include + * both a one-time (query startup) component and a per-execution component. + * The estimate should *not* include the costs of evaluating the target + * function's arguments, only the target function itself. + * + * The "node" argument is normally the parse node that is invoking the + * target function. This is a FuncExpr in the simplest case, but it could + * also be an OpExpr, DistinctExpr, NullIfExpr, or WindowFunc, or possibly + * other cases in future. NULL is passed if the function cannot presume + * its arguments to be equivalent to what the calling node presents as + * arguments; that happens for, e.g., aggregate support functions and + * per-column comparison operators used by RowExprs. + * + * If an estimate can be made, store it into the cost fields and return the + * address of the SupportRequestCost node. Return NULL if no estimate can be + * made, in which case the planner will rely on the target function's procost + * field. (Note: while procost is automatically scaled by cpu_operator_cost, + * this is not the case for the outputs of the Cost request; the support + * function must scale its results appropriately on its own.) + */ +typedef struct SupportRequestCost +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure (could be NULL) */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function, or NULL */ + + /* Output fields: */ + Cost startup; /* one-time cost */ + Cost per_tuple; /* per-evaluation cost */ +} SupportRequestCost; + +/* + * The Rows request allows the support function to provide an output rowcount + * estimate for its target function (so it applies only to set-returning + * functions). + * + * The "node" argument is the parse node that is invoking the target function; + * currently this will always be a FuncExpr or OpExpr. + * + * If an estimate can be made, store it into the rows field and return the + * address of the SupportRequestRows node. Return NULL if no estimate can be + * made, in which case the planner will rely on the target function's prorows + * field. + */ +typedef struct SupportRequestRows +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure (could be NULL) */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function */ + + /* Output fields: */ + double rows; /* number of rows expected to be returned */ +} SupportRequestRows; + +/* + * The IndexCondition request allows the support function to generate + * a directly-indexable condition based on a target function call that is + * not itself indexable. The target function call must appear at the top + * level of WHERE or JOIN/ON, so this applies only to functions returning + * boolean. + * + * The "node" argument is the parse node that is invoking the target function; + * currently this will always be a FuncExpr or OpExpr. The call is made + * only if at least one function argument matches an index column's variable + * or expression. "indexarg" identifies the matching argument (it's the + * argument's zero-based index in the node's args list). + * + * If the transformation is possible, return a List of directly-indexable + * condition expressions, else return NULL. (A List is used because it's + * sometimes useful to generate more than one indexable condition, such as + * when a LIKE with constant prefix gives rise to both >= and < conditions.) + * + * "Directly indexable" means that the condition must be directly executable + * by the index machinery. Typically this means that it is a binary OpExpr + * with the index column value on the left, a pseudo-constant on the right, + * and an operator that is in the index column's operator family. Other + * possibilities include RowCompareExpr, ScalarArrayOpExpr, and NullTest, + * depending on the index type; but those seem less likely to be useful for + * derived index conditions. "Pseudo-constant" means that the right-hand + * expression must not contain any volatile functions, nor any Vars of the + * table the index is for; use is_pseudo_constant_for_index() to check this. + * (Note: if the passed "node" is an OpExpr, the core planner already verified + * that the non-indexkey operand is pseudo-constant; but when the "node" + * is a FuncExpr, it does not check, since it doesn't know which of the + * function's arguments you might need to use in an index comparison value.) + * + * In many cases, an index condition can be generated but it is weaker than + * the function condition itself; for example, a LIKE with a constant prefix + * can produce an index range check based on the prefix, but we still need + * to execute the LIKE operator to verify the rest of the pattern. We say + * that such an index condition is "lossy". When returning an index condition, + * you should set the "lossy" request field to true if the condition is lossy, + * or false if it is an exact equivalent of the function's result. The core + * code will initialize that field to true, which is the common case. + * + * It is important to verify that the index operator family is the correct + * one for the condition you want to generate. Core support functions tend + * to use the known OID of a built-in opfamily for this, but extensions need + * to work harder, since their OIDs aren't fixed. A possibly workable + * answer for an index on an extension datatype is to verify the index AM's + * OID instead, and then assume that there's only one relevant opclass for + * your datatype so the opfamily must be the right one. Generating OpExpr + * nodes may also require knowing extension datatype OIDs (often you can + * find these out by applying exprType() to a function argument) and + * operator OIDs (which you can look up using get_opfamily_member). + */ +typedef struct SupportRequestIndexCondition +{ + NodeTag type; + + /* Input fields: */ + struct PlannerInfo *root; /* Planner's infrastructure */ + Oid funcid; /* function we are inquiring about */ + Node *node; /* parse node invoking function */ + int indexarg; /* index of function arg matching indexcol */ + struct IndexOptInfo *index; /* planner's info about target index */ + int indexcol; /* index of target index column (0-based) */ + Oid opfamily; /* index column's operator family */ + Oid indexcollation; /* index column's collation */ + + /* Output fields: */ + bool lossy; /* set to false if index condition is an exact + * equivalent of the function call */ +} SupportRequestIndexCondition; + +/* ---------- + * To support more efficient query execution of any monotonically increasing + * and/or monotonically decreasing window functions, we support calling the + * window function's prosupport function passing along this struct whenever + * the planner sees an OpExpr qual directly reference a window function in a + * subquery. When the planner encounters this, we populate this struct and + * pass it along to the window function's prosupport function so that it can + * evaluate if the given WindowFunc is; + * + * a) monotonically increasing, or + * b) monotonically decreasing, or + * c) both monotonically increasing and decreasing, or + * d) none of the above. + * + * A function that is monotonically increasing can never return a value that + * is lower than a value returned in a "previous call". A monotonically + * decreasing function can never return a value higher than a value returned + * in a previous call. A function that is both must return the same value + * each time. + * + * We define "previous call" to mean a previous call to the same WindowFunc + * struct in the same window partition. + * + * row_number() is an example of a monotonically increasing function. The + * return value will be reset back to 1 in each new partition. An example of + * a monotonically increasing and decreasing function is COUNT(*) OVER (). + * Since there is no ORDER BY clause in this example, all rows in the + * partition are peers and all rows within the partition will be within the + * frame bound. Likewise for COUNT(*) OVER(ORDER BY a ROWS BETWEEN UNBOUNDED + * PRECEDING AND UNBOUNDED FOLLOWING). + * + * COUNT(*) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + * is an example of a monotonically decreasing function. + * + * Implementations must only concern themselves with the given WindowFunc + * being monotonic in a single partition. + * + * Inputs: + * 'window_func' is the pointer to the window function being called. + * + * 'window_clause' pointer to the WindowClause data. Support functions can + * use this to check frame bounds, etc. + * + * Outputs: + * 'monotonic' the resulting MonotonicFunction value for the given input + * window function and window clause. + * ---------- + */ +typedef struct SupportRequestWFuncMonotonic +{ + NodeTag type; + + /* Input fields: */ + WindowFunc *window_func; /* Pointer to the window function data */ + struct WindowClause *window_clause; /* Pointer to the window clause data */ + + /* Output fields: */ + MonotonicFunction monotonic; +} SupportRequestWFuncMonotonic; + +/* + * Some WindowFunc behavior might not be affected by certain variations in + * the WindowClause's frameOptions. For example, row_number() is coded in + * such a way that the frame options don't change the returned row number. + * nodeWindowAgg.c will have less work to do if the ROWS option is used + * instead of the RANGE option as no check needs to be done for peer rows. + * Since RANGE is included in the default frame options, window functions + * such as row_number() might want to change that to ROW. + * + * Here we allow a WindowFunc's support function to determine which, if + * anything, can be changed about the WindowClause which the WindowFunc + * belongs to. Currently only the frameOptions can be modified. However, + * we may want to allow more optimizations in the future. + * + * The support function is responsible for ensuring the optimized version of + * the frameOptions doesn't affect the result of the window function. The + * planner is responsible for only changing the frame options when all + * WindowFuncs using this particular WindowClause agree on what the optimized + * version of the frameOptions are. If a particular WindowFunc being used + * does not have a support function then the planner will not make any changes + * to the WindowClause's frameOptions. + * + * 'window_func' and 'window_clause' are set by the planner before calling the + * support function so that the support function has these fields available. + * These may be required in order to determine which optimizations are + * possible. + * + * 'frameOptions' is set by the planner to WindowClause.frameOptions. The + * support function must only adjust this if optimizations are possible for + * the given WindowFunc. + */ +typedef struct SupportRequestOptimizeWindowClause +{ + NodeTag type; + + /* Input fields: */ + WindowFunc *window_func; /* Pointer to the window function data */ + struct WindowClause *window_clause; /* Pointer to the window clause data */ + + /* Input/Output fields: */ + int frameOptions; /* New frameOptions, or left untouched if no + * optimizations are possible. */ +} SupportRequestOptimizeWindowClause; + +#endif /* SUPPORTNODES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/tidbitmap.h b/platform/dbops/binaries/postgres/include/server/nodes/tidbitmap.h new file mode 100644 index 0000000000000000000000000000000000000000..1945f0639bf15667878ab58916667a23fc10a5b4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/tidbitmap.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * tidbitmap.h + * PostgreSQL tuple-id (TID) bitmap package + * + * This module provides bitmap data structures that are spiritually + * similar to Bitmapsets, but are specially adapted to store sets of + * tuple identifiers (TIDs), or ItemPointers. In particular, the division + * of an ItemPointer into BlockNumber and OffsetNumber is catered for. + * Also, since we wish to be able to store very large tuple sets in + * memory with this data structure, we support "lossy" storage, in which + * we no longer remember individual tuple offsets on a page but only the + * fact that a particular page needs to be visited. + * + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/nodes/tidbitmap.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIDBITMAP_H +#define TIDBITMAP_H + +#include "storage/itemptr.h" +#include "utils/dsa.h" + + +/* + * Actual bitmap representation is private to tidbitmap.c. Callers can + * do IsA(x, TIDBitmap) on it, but nothing else. + */ +typedef struct TIDBitmap TIDBitmap; + +/* Likewise, TBMIterator is private */ +typedef struct TBMIterator TBMIterator; +typedef struct TBMSharedIterator TBMSharedIterator; + +/* Result structure for tbm_iterate */ +typedef struct TBMIterateResult +{ + BlockNumber blockno; /* page number containing tuples */ + int ntuples; /* -1 indicates lossy result */ + bool recheck; /* should the tuples be rechecked? */ + /* Note: recheck is always true if ntuples < 0 */ + OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; +} TBMIterateResult; + +/* function prototypes in nodes/tidbitmap.c */ + +extern TIDBitmap *tbm_create(long maxbytes, dsa_area *dsa); +extern void tbm_free(TIDBitmap *tbm); +extern void tbm_free_shared_area(dsa_area *dsa, dsa_pointer dp); + +extern void tbm_add_tuples(TIDBitmap *tbm, + const ItemPointer tids, int ntids, + bool recheck); +extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno); + +extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); +extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b); + +extern bool tbm_is_empty(const TIDBitmap *tbm); + +extern TBMIterator *tbm_begin_iterate(TIDBitmap *tbm); +extern dsa_pointer tbm_prepare_shared_iterate(TIDBitmap *tbm); +extern TBMIterateResult *tbm_iterate(TBMIterator *iterator); +extern TBMIterateResult *tbm_shared_iterate(TBMSharedIterator *iterator); +extern void tbm_end_iterate(TBMIterator *iterator); +extern void tbm_end_shared_iterate(TBMSharedIterator *iterator); +extern TBMSharedIterator *tbm_attach_shared_iterate(dsa_area *dsa, + dsa_pointer dp); +extern long tbm_calculate_entries(double maxbytes); + +#endif /* TIDBITMAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/nodes/value.h b/platform/dbops/binaries/postgres/include/server/nodes/value.h new file mode 100644 index 0000000000000000000000000000000000000000..8072cfb33f9bb3b56743141a118c27acb9f4808f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/nodes/value.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * value.h + * interface for value nodes + * + * + * Copyright (c) 2003-2024, PostgreSQL Global Development Group + * + * src/include/nodes/value.h + * + *------------------------------------------------------------------------- + */ + +#ifndef VALUE_H +#define VALUE_H + +#include "nodes/nodes.h" + +/* + * The node types Integer, Float, String, and BitString are used to represent + * literals in the lexer and are also used to pass constants around in the + * parser. One difference between these node types and, say, a plain int or + * char * is that the nodes can be put into a List. + * + * (There used to be a Value node, which encompassed all these different node types. Hence the name of this file.) + */ + +typedef struct Integer +{ + pg_node_attr(special_read_write) + + NodeTag type; + int ival; +} Integer; + +/* + * Float is internally represented as string. Using T_Float as the node type + * simply indicates that the contents of the string look like a valid numeric + * literal. The value might end up being converted to NUMERIC, so we can't + * store it internally as a C double, since that could lose precision. Since + * these nodes are generally only used in the parsing process, not for runtime + * data, it's better to use the more general representation. + * + * Note that an integer-looking string will get lexed as T_Float if the value + * is too large to fit in an 'int'. + */ +typedef struct Float +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *fval; +} Float; + +typedef struct Boolean +{ + pg_node_attr(special_read_write) + + NodeTag type; + bool boolval; +} Boolean; + +typedef struct String +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *sval; +} String; + +typedef struct BitString +{ + pg_node_attr(special_read_write) + + NodeTag type; + char *bsval; +} BitString; + +#define intVal(v) (castNode(Integer, v)->ival) +#define floatVal(v) atof(castNode(Float, v)->fval) +#define boolVal(v) (castNode(Boolean, v)->boolval) +#define strVal(v) (castNode(String, v)->sval) + +extern Integer *makeInteger(int i); +extern Float *makeFloat(char *numericStr); +extern Boolean *makeBoolean(bool val); +extern String *makeString(char *str); +extern BitString *makeBitString(char *str); + +#endif /* VALUE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/appendinfo.h b/platform/dbops/binaries/postgres/include/server/optimizer/appendinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..cc12c9c743da81f32612071f6de7537d683ce537 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/appendinfo.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * appendinfo.h + * Routines for mapping expressions between append rel parent(s) and + * children + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/appendinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef APPENDINFO_H +#define APPENDINFO_H + +#include "nodes/pathnodes.h" +#include "utils/relcache.h" + +extern AppendRelInfo *make_append_rel_info(Relation parentrel, + Relation childrel, + Index parentRTindex, Index childRTindex); +extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node, + int nappinfos, AppendRelInfo **appinfos); +extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node, + RelOptInfo *childrel, + RelOptInfo *parentrel); +extern Relids adjust_child_relids(Relids relids, int nappinfos, + AppendRelInfo **appinfos); +extern Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids, + RelOptInfo *childrel, + RelOptInfo *parentrel); +extern List *adjust_inherited_attnums(List *attnums, AppendRelInfo *context); +extern List *adjust_inherited_attnums_multilevel(PlannerInfo *root, + List *attnums, + Index child_relid, + Index top_parent_relid); +extern void get_translated_update_targetlist(PlannerInfo *root, Index relid, + List **processed_tlist, + List **update_colnos); +extern AppendRelInfo **find_appinfos_by_relids(PlannerInfo *root, + Relids relids, int *nappinfos); +extern void add_row_identity_var(PlannerInfo *root, Var *orig_var, + Index rtindex, const char *rowid_name); +extern void add_row_identity_columns(PlannerInfo *root, Index rtindex, + RangeTblEntry *target_rte, + Relation target_relation); +extern void distribute_row_identity_vars(PlannerInfo *root); + +#endif /* APPENDINFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/clauses.h b/platform/dbops/binaries/postgres/include/server/optimizer/clauses.h new file mode 100644 index 0000000000000000000000000000000000000000..34b301e537f52d3bb5c6cca0b481e550eea42bee --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/clauses.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * clauses.h + * prototypes for clauses.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/clauses.h + * + *------------------------------------------------------------------------- + */ +#ifndef CLAUSES_H +#define CLAUSES_H + +#include "nodes/pathnodes.h" + +typedef struct +{ + int numWindowFuncs; /* total number of WindowFuncs found */ + Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */ + List **windowFuncs; /* lists of WindowFuncs for each winref */ +} WindowFuncLists; + +extern bool contain_agg_clause(Node *clause); + +extern bool contain_window_function(Node *clause); +extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef); + +extern double expression_returns_set_rows(PlannerInfo *root, Node *clause); + +extern bool contain_subplans(Node *clause); + +extern char max_parallel_hazard(Query *parse); +extern bool is_parallel_safe(PlannerInfo *root, Node *node); +extern bool contain_nonstrict_functions(Node *clause); +extern bool contain_exec_param(Node *clause, List *param_ids); +extern bool contain_leaked_vars(Node *clause); + +extern Relids find_nonnullable_rels(Node *clause); +extern List *find_nonnullable_vars(Node *clause); +extern List *find_forced_null_vars(Node *node); +extern Var *find_forced_null_var(Node *node); + +extern bool is_pseudo_constant_clause(Node *clause); +extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids); + +extern int NumRelids(PlannerInfo *root, Node *clause); + +extern void CommuteOpExpr(OpExpr *clause); + +extern Query *inline_set_returning_function(PlannerInfo *root, + RangeTblEntry *rte); + +extern Bitmapset *pull_paramids(Expr *expr); + +#endif /* CLAUSES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/cost.h b/platform/dbops/binaries/postgres/include/server/optimizer/cost.h new file mode 100644 index 0000000000000000000000000000000000000000..b1c51a4e70ffc0a444100d6c258cbb16fa7fead7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/cost.h @@ -0,0 +1,216 @@ +/*------------------------------------------------------------------------- + * + * cost.h + * prototypes for costsize.c and clausesel.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/cost.h + * + *------------------------------------------------------------------------- + */ +#ifndef COST_H +#define COST_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* defaults for costsize.c's Cost parameters */ +/* NB: cost-estimation code should use the variables, not these constants! */ +/* If you change these, update backend/utils/misc/postgresql.conf.sample */ +#define DEFAULT_SEQ_PAGE_COST 1.0 +#define DEFAULT_RANDOM_PAGE_COST 4.0 +#define DEFAULT_CPU_TUPLE_COST 0.01 +#define DEFAULT_CPU_INDEX_TUPLE_COST 0.005 +#define DEFAULT_CPU_OPERATOR_COST 0.0025 +#define DEFAULT_PARALLEL_TUPLE_COST 0.1 +#define DEFAULT_PARALLEL_SETUP_COST 1000.0 + +/* defaults for non-Cost parameters */ +#define DEFAULT_RECURSIVE_WORKTABLE_FACTOR 10.0 +#define DEFAULT_EFFECTIVE_CACHE_SIZE 524288 /* measured in pages */ + +typedef enum +{ + CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ + CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ + CONSTRAINT_EXCLUSION_PARTITION, /* apply c_e to otherrels only */ +} ConstraintExclusionType; + + +/* + * prototypes for costsize.c + * routines to compute costs and sizes + */ + +/* parameter variables and flags (see also optimizer.h) */ +extern PGDLLIMPORT Cost disable_cost; +extern PGDLLIMPORT int max_parallel_workers_per_gather; +extern PGDLLIMPORT bool enable_seqscan; +extern PGDLLIMPORT bool enable_indexscan; +extern PGDLLIMPORT bool enable_indexonlyscan; +extern PGDLLIMPORT bool enable_bitmapscan; +extern PGDLLIMPORT bool enable_tidscan; +extern PGDLLIMPORT bool enable_sort; +extern PGDLLIMPORT bool enable_incremental_sort; +extern PGDLLIMPORT bool enable_hashagg; +extern PGDLLIMPORT bool enable_nestloop; +extern PGDLLIMPORT bool enable_material; +extern PGDLLIMPORT bool enable_memoize; +extern PGDLLIMPORT bool enable_mergejoin; +extern PGDLLIMPORT bool enable_hashjoin; +extern PGDLLIMPORT bool enable_gathermerge; +extern PGDLLIMPORT bool enable_partitionwise_join; +extern PGDLLIMPORT bool enable_partitionwise_aggregate; +extern PGDLLIMPORT bool enable_parallel_append; +extern PGDLLIMPORT bool enable_parallel_hash; +extern PGDLLIMPORT bool enable_partition_pruning; +extern PGDLLIMPORT bool enable_presorted_aggregate; +extern PGDLLIMPORT bool enable_async_append; +extern PGDLLIMPORT int constraint_exclusion; + +extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, + double index_pages, PlannerInfo *root); +extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info); +extern void cost_samplescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info); +extern void cost_index(IndexPath *path, PlannerInfo *root, + double loop_count, bool partial_path); +extern void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, + ParamPathInfo *param_info, + Path *bitmapqual, double loop_count); +extern void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root); +extern void cost_bitmap_or_node(BitmapOrPath *path, PlannerInfo *root); +extern void cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec); +extern void cost_tidscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, List *tidquals, ParamPathInfo *param_info); +extern void cost_tidrangescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, List *tidrangequals, + ParamPathInfo *param_info); +extern void cost_subqueryscan(SubqueryScanPath *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info, + bool trivial_pathtarget); +extern void cost_functionscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_valuesscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_tablefuncscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_ctescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_namedtuplestorescan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_resultscan(Path *path, PlannerInfo *root, + RelOptInfo *baserel, ParamPathInfo *param_info); +extern void cost_recursive_union(Path *runion, Path *nrterm, Path *rterm); +extern void cost_sort(Path *path, PlannerInfo *root, + List *pathkeys, Cost input_cost, double tuples, int width, + Cost comparison_cost, int sort_mem, + double limit_tuples); +extern void cost_incremental_sort(Path *path, + PlannerInfo *root, List *pathkeys, int presorted_keys, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples, int width, Cost comparison_cost, int sort_mem, + double limit_tuples); +extern void cost_append(AppendPath *apath); +extern void cost_merge_append(Path *path, PlannerInfo *root, + List *pathkeys, int n_streams, + Cost input_startup_cost, Cost input_total_cost, + double tuples); +extern void cost_material(Path *path, + Cost input_startup_cost, Cost input_total_cost, + double tuples, int width); +extern void cost_agg(Path *path, PlannerInfo *root, + AggStrategy aggstrategy, const AggClauseCosts *aggcosts, + int numGroupCols, double numGroups, + List *quals, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples, double input_width); +extern void cost_windowagg(Path *path, PlannerInfo *root, + List *windowFuncs, WindowClause *winclause, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples); +extern void cost_group(Path *path, PlannerInfo *root, + int numGroupCols, double numGroups, + List *quals, + Cost input_startup_cost, Cost input_total_cost, + double input_tuples); +extern void initial_cost_nestloop(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + Path *outer_path, Path *inner_path, + JoinPathExtraData *extra); +extern void final_cost_nestloop(PlannerInfo *root, NestPath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void initial_cost_mergejoin(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + List *mergeclauses, + Path *outer_path, Path *inner_path, + List *outersortkeys, List *innersortkeys, + JoinPathExtraData *extra); +extern void final_cost_mergejoin(PlannerInfo *root, MergePath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void initial_cost_hashjoin(PlannerInfo *root, + JoinCostWorkspace *workspace, + JoinType jointype, + List *hashclauses, + Path *outer_path, Path *inner_path, + JoinPathExtraData *extra, + bool parallel_hash); +extern void final_cost_hashjoin(PlannerInfo *root, HashPath *path, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra); +extern void cost_gather(GatherPath *path, PlannerInfo *root, + RelOptInfo *rel, ParamPathInfo *param_info, double *rows); +extern void cost_gather_merge(GatherMergePath *path, PlannerInfo *root, + RelOptInfo *rel, ParamPathInfo *param_info, + Cost input_startup_cost, Cost input_total_cost, + double *rows); +extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan); +extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root); +extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root); +extern void compute_semi_anti_join_factors(PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + SpecialJoinInfo *sjinfo, + List *restrictlist, + SemiAntiJoinFactors *semifactors); +extern void set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern double get_parameterized_baserel_size(PlannerInfo *root, + RelOptInfo *rel, + List *param_clauses); +extern double get_parameterized_joinrel_size(PlannerInfo *root, + RelOptInfo *rel, + Path *outer_path, + Path *inner_path, + SpecialJoinInfo *sjinfo, + List *restrict_clauses); +extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo, + List *restrictlist); +extern void set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, + double cte_rows); +extern void set_tablefunc_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_namedtuplestore_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_result_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel); +extern PathTarget *set_pathtarget_cost_width(PlannerInfo *root, PathTarget *target); +extern double compute_bitmap_pages(PlannerInfo *root, RelOptInfo *baserel, + Path *bitmapqual, double loop_count, + Cost *cost_p, double *tuples_p); + +#endif /* COST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo.h new file mode 100644 index 0000000000000000000000000000000000000000..c52906d0916e17d4faea005e94aedcacf9d5928e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * geqo.h + * prototypes for various files in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_H +#define GEQO_H + +#include "common/pg_prng.h" +#include "nodes/pathnodes.h" +#include "optimizer/geqo_gene.h" + + +/* GEQO debug flag */ +/* + #define GEQO_DEBUG + */ + +/* choose one recombination mechanism here */ +/* + #define ERX + #define PMX + #define CX + #define PX + #define OX1 + #define OX2 + */ +#define ERX + + +/* + * Configuration options + * + * If you change these, update backend/utils/misc/postgresql.conf.sample + */ +extern PGDLLIMPORT int Geqo_effort; /* 1 .. 10, knob for adjustment of + * defaults */ + +#define DEFAULT_GEQO_EFFORT 5 +#define MIN_GEQO_EFFORT 1 +#define MAX_GEQO_EFFORT 10 + +extern PGDLLIMPORT int Geqo_pool_size; /* 2 .. inf, or 0 to use default */ + +extern PGDLLIMPORT int Geqo_generations; /* 1 .. inf, or 0 to use default */ + +extern PGDLLIMPORT double Geqo_selection_bias; + +#define DEFAULT_GEQO_SELECTION_BIAS 2.0 +#define MIN_GEQO_SELECTION_BIAS 1.5 +#define MAX_GEQO_SELECTION_BIAS 2.0 + +extern PGDLLIMPORT double Geqo_seed; /* 0 .. 1 */ + + +/* + * Private state for a GEQO run --- accessible via root->join_search_private + */ +typedef struct +{ + List *initial_rels; /* the base relations we are joining */ + pg_prng_state random_state; /* PRNG state */ +} GeqoPrivateData; + + +/* routines in geqo_main.c */ +extern RelOptInfo *geqo(PlannerInfo *root, + int number_of_rels, List *initial_rels); + +/* routines in geqo_eval.c */ +extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene); +extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene); + +#endif /* GEQO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_copy.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_copy.h new file mode 100644 index 0000000000000000000000000000000000000000..b204dad5d373b34de6ad2b0e339a74fdf16b58d7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_copy.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * geqo_copy.h + * prototypes for copy functions in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_copy.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_COPY_H +#define GEQO_COPY_H + +#include "optimizer/geqo.h" + + +extern void geqo_copy(PlannerInfo *root, Chromosome *chromo1, Chromosome *chromo2, int string_length); + +#endif /* GEQO_COPY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_gene.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_gene.h new file mode 100644 index 0000000000000000000000000000000000000000..49b31bae30f80f6f5424f4ec28b4be2c938bfc07 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_gene.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * geqo_gene.h + * genome representation in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_gene.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_GENE_H +#define GEQO_GENE_H + +#include "nodes/nodes.h" + +/* we presume that int instead of Relid + is o.k. for Gene; so don't change it! */ +typedef int Gene; + +typedef struct Chromosome +{ + Gene *string; + Cost worth; +} Chromosome; + +typedef struct Pool +{ + Chromosome *data; + int size; + int string_length; +} Pool; + +#endif /* GEQO_GENE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_misc.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_misc.h new file mode 100644 index 0000000000000000000000000000000000000000..722399de30adff545a052ab86baa0b9685d08940 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_misc.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * geqo_misc.h + * prototypes for printout routines in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_misc.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_MISC_H +#define GEQO_MISC_H + +#include "optimizer/geqo_recombination.h" + +#ifdef GEQO_DEBUG + +extern void print_pool(FILE *fp, Pool *pool, int start, int stop); +extern void print_gen(FILE *fp, Pool *pool, int generation); +extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene); +#endif /* GEQO_DEBUG */ + +#endif /* GEQO_MISC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_mutation.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_mutation.h new file mode 100644 index 0000000000000000000000000000000000000000..f6f2247c992c4511919d162b1b5769aac218a113 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_mutation.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * geqo_mutation.h + * prototypes for mutation functions in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_mutation.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +#ifndef GEQO_MUTATION_H +#define GEQO_MUTATION_H + +#include "optimizer/geqo.h" + + +extern void geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene); + +#endif /* GEQO_MUTATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_pool.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_pool.h new file mode 100644 index 0000000000000000000000000000000000000000..b5e8055472457f4cc7e6c430d18d562ed35ac276 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_pool.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * geqo_pool.h + * pool representation in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_pool.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_POOL_H +#define GEQO_POOL_H + +#include "optimizer/geqo.h" + + +extern Pool *alloc_pool(PlannerInfo *root, int pool_size, int string_length); +extern void free_pool(PlannerInfo *root, Pool *pool); + +extern void random_init_pool(PlannerInfo *root, Pool *pool); +extern Chromosome *alloc_chromo(PlannerInfo *root, int string_length); +extern void free_chromo(PlannerInfo *root, Chromosome *chromo); + +extern void spread_chromo(PlannerInfo *root, Chromosome *chromo, Pool *pool); + +extern void sort_pool(PlannerInfo *root, Pool *pool); + +#endif /* GEQO_POOL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_random.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_random.h new file mode 100644 index 0000000000000000000000000000000000000000..236f5954c158a4dded55ba953b702237b02dff6d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_random.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * geqo_random.h + * random number generator + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_random.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +/* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ + +#ifndef GEQO_RANDOM_H +#define GEQO_RANDOM_H + +#include "optimizer/geqo.h" + + +extern void geqo_set_seed(PlannerInfo *root, double seed); + +/* geqo_rand returns a random float value in the range [0.0, 1.0) */ +extern double geqo_rand(PlannerInfo *root); + +/* geqo_randint returns integer value between lower and upper inclusive */ +extern int geqo_randint(PlannerInfo *root, int upper, int lower); + +#endif /* GEQO_RANDOM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_recombination.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_recombination.h new file mode 100644 index 0000000000000000000000000000000000000000..5d38276efb4f8cb72961c0f33c82cf77fc707dab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_recombination.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * geqo_recombination.h + * prototypes for recombination in the genetic query optimizer + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_recombination.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + +/* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */ + +#ifndef GEQO_RECOMBINATION_H +#define GEQO_RECOMBINATION_H + +#include "optimizer/geqo.h" + + +extern void init_tour(PlannerInfo *root, Gene *tour, int num_gene); + + +/* edge recombination crossover [ERX] */ + +typedef struct Edge +{ + Gene edge_list[4]; /* list of edges */ + int total_edges; + int unused_edges; +} Edge; + +extern Edge *alloc_edge_table(PlannerInfo *root, int num_gene); +extern void free_edge_table(PlannerInfo *root, Edge *edge_table); + +extern float gimme_edge_table(PlannerInfo *root, Gene *tour1, Gene *tour2, + int num_gene, Edge *edge_table); + +extern int gimme_tour(PlannerInfo *root, Edge *edge_table, Gene *new_gene, + int num_gene); + + +/* partially matched crossover [PMX] */ + +#define DAD 1 /* indicator for gene from dad */ +#define MOM 0 /* indicator for gene from mom */ + +extern void pmx(PlannerInfo *root, + Gene *tour1, Gene *tour2, + Gene *offspring, int num_gene); + + +typedef struct City +{ + int tour2_position; + int tour1_position; + int used; + int select_list; +} City; + +extern City * alloc_city_table(PlannerInfo *root, int num_gene); +extern void free_city_table(PlannerInfo *root, City * city_table); + +/* cycle crossover [CX] */ +extern int cx(PlannerInfo *root, Gene *tour1, Gene *tour2, + Gene *offspring, int num_gene, City * city_table); + +/* position crossover [PX] */ +extern void px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, + int num_gene, City * city_table); + +/* order crossover [OX1] according to Davis */ +extern void ox1(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, + int num_gene, City * city_table); + +/* order crossover [OX2] according to Syswerda */ +extern void ox2(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, + int num_gene, City * city_table); + +#endif /* GEQO_RECOMBINATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/geqo_selection.h b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_selection.h new file mode 100644 index 0000000000000000000000000000000000000000..fb1dcecdca84366e50735509eda43b5d33d8a99d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/geqo_selection.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * geqo_selection.h + * prototypes for selection routines in optimizer/geqo + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/geqo_selection.h + * + *------------------------------------------------------------------------- + */ + +/* contributed by: + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + * Martin Utesch * Institute of Automatic Control * + = = University of Mining and Technology = + * utesch@aut.tu-freiberg.de * Freiberg, Germany * + =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + */ + + +#ifndef GEQO_SELECTION_H +#define GEQO_SELECTION_H + +#include "optimizer/geqo.h" + + +extern void geqo_selection(PlannerInfo *root, + Chromosome *momma, Chromosome *daddy, + Pool *pool, double bias); + +#endif /* GEQO_SELECTION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/inherit.h b/platform/dbops/binaries/postgres/include/server/optimizer/inherit.h new file mode 100644 index 0000000000000000000000000000000000000000..c36c11837874f9e3303b4916da0645db4e04dc97 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/inherit.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * inherit.h + * prototypes for inherit.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/inherit.h + * + *------------------------------------------------------------------------- + */ +#ifndef INHERIT_H +#define INHERIT_H + +#include "nodes/pathnodes.h" + + +extern void expand_inherited_rtentry(PlannerInfo *root, RelOptInfo *rel, + RangeTblEntry *rte, Index rti); + +extern Bitmapset *get_rel_all_updated_cols(PlannerInfo *root, RelOptInfo *rel); + +extern bool apply_child_basequals(PlannerInfo *root, RelOptInfo *parentrel, + RelOptInfo *childrel, RangeTblEntry *childRTE, + AppendRelInfo *appinfo); + +#endif /* INHERIT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/joininfo.h b/platform/dbops/binaries/postgres/include/server/optimizer/joininfo.h new file mode 100644 index 0000000000000000000000000000000000000000..da48a6b6c3bd3340c90c981684e47958b78f8fcd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/joininfo.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * joininfo.h + * prototypes for joininfo.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/joininfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef JOININFO_H +#define JOININFO_H + +#include "nodes/pathnodes.h" + + +extern bool have_relevant_joinclause(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); + +extern void add_join_clause_to_rels(PlannerInfo *root, + RestrictInfo *restrictinfo, + Relids join_relids); +extern void remove_join_clause_from_rels(PlannerInfo *root, + RestrictInfo *restrictinfo, + Relids join_relids); + +#endif /* JOININFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/optimizer.h b/platform/dbops/binaries/postgres/include/server/optimizer/optimizer.h new file mode 100644 index 0000000000000000000000000000000000000000..7b63c5cf718dbe8c5a4cfe020268b396c2896b36 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/optimizer.h @@ -0,0 +1,205 @@ +/*------------------------------------------------------------------------- + * + * optimizer.h + * External API for the Postgres planner. + * + * This header is meant to define everything that the core planner + * exposes for use by non-planner modules. + * + * Note that there are files outside src/backend/optimizer/ that are + * considered planner modules, because they're too much in bed with + * planner operations to be treated otherwise. FDW planning code is an + * example. For the most part, however, code outside the core planner + * should not need to include any optimizer/ header except this one. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/optimizer.h + * + *------------------------------------------------------------------------- + */ +#ifndef OPTIMIZER_H +#define OPTIMIZER_H + +#include "nodes/parsenodes.h" + +/* + * We don't want to include nodes/pathnodes.h here, because non-planner + * code should generally treat PlannerInfo as an opaque typedef. + * But we'd like such code to use that typedef name, so define the + * typedef either here or in pathnodes.h, whichever is read first. + */ +#ifndef HAVE_PLANNERINFO_TYPEDEF +typedef struct PlannerInfo PlannerInfo; +#define HAVE_PLANNERINFO_TYPEDEF 1 +#endif + +/* Likewise for IndexOptInfo and SpecialJoinInfo. */ +#ifndef HAVE_INDEXOPTINFO_TYPEDEF +typedef struct IndexOptInfo IndexOptInfo; +#define HAVE_INDEXOPTINFO_TYPEDEF 1 +#endif +#ifndef HAVE_SPECIALJOININFO_TYPEDEF +typedef struct SpecialJoinInfo SpecialJoinInfo; +#define HAVE_SPECIALJOININFO_TYPEDEF 1 +#endif + +/* It also seems best not to include plannodes.h, params.h, or htup.h here */ +struct PlannedStmt; +struct ParamListInfoData; +struct HeapTupleData; + + +/* in path/clausesel.c: */ + +extern Selectivity clause_selectivity(PlannerInfo *root, + Node *clause, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); +extern Selectivity clause_selectivity_ext(PlannerInfo *root, + Node *clause, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + bool use_extended_stats); +extern Selectivity clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); +extern Selectivity clauselist_selectivity_ext(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + bool use_extended_stats); + +/* in path/costsize.c: */ + +/* widely used cost parameters */ +extern PGDLLIMPORT double seq_page_cost; +extern PGDLLIMPORT double random_page_cost; +extern PGDLLIMPORT double cpu_tuple_cost; +extern PGDLLIMPORT double cpu_index_tuple_cost; +extern PGDLLIMPORT double cpu_operator_cost; +extern PGDLLIMPORT double parallel_tuple_cost; +extern PGDLLIMPORT double parallel_setup_cost; +extern PGDLLIMPORT double recursive_worktable_factor; +extern PGDLLIMPORT int effective_cache_size; + +extern double clamp_row_est(double nrows); +extern int32 clamp_width_est(int64 tuple_width); +extern long clamp_cardinality_to_long(Cardinality x); + +/* in path/indxpath.c: */ + +extern bool is_pseudo_constant_for_index(PlannerInfo *root, Node *expr, + IndexOptInfo *index); + +/* in plan/planner.c: */ + +/* possible values for debug_parallel_query */ +typedef enum +{ + DEBUG_PARALLEL_OFF, + DEBUG_PARALLEL_ON, + DEBUG_PARALLEL_REGRESS, +} DebugParallelMode; + +/* GUC parameters */ +extern PGDLLIMPORT int debug_parallel_query; +extern PGDLLIMPORT bool parallel_leader_participation; + +extern struct PlannedStmt *planner(Query *parse, const char *query_string, + int cursorOptions, + struct ParamListInfoData *boundParams); + +extern Expr *expression_planner(Expr *expr); +extern Expr *expression_planner_with_deps(Expr *expr, + List **relationOids, + List **invalItems); + +extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid); +extern int plan_create_index_workers(Oid tableOid, Oid indexOid); + +/* in plan/setrefs.c: */ + +extern void extract_query_dependencies(Node *query, + List **relationOids, + List **invalItems, + bool *hasRowSecurity); + +/* in prep/prepqual.c: */ + +extern Node *negate_clause(Node *node); +extern Expr *canonicalize_qual(Expr *qual, bool is_check); + +/* in util/clauses.c: */ + +extern bool contain_mutable_functions(Node *clause); +extern bool contain_mutable_functions_after_planning(Expr *expr); +extern bool contain_volatile_functions(Node *clause); +extern bool contain_volatile_functions_after_planning(Expr *expr); +extern bool contain_volatile_functions_not_nextval(Node *clause); + +extern Node *eval_const_expressions(PlannerInfo *root, Node *node); + +extern void convert_saop_to_hashed_saop(Node *node); + +extern Node *estimate_expression_value(PlannerInfo *root, Node *node); + +extern Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod, + Oid result_collation); + +extern List *expand_function_arguments(List *args, bool include_out_arguments, + Oid result_type, + struct HeapTupleData *func_tuple); + +/* in util/predtest.c: */ + +extern bool predicate_implied_by(List *predicate_list, List *clause_list, + bool weak); +extern bool predicate_refuted_by(List *predicate_list, List *clause_list, + bool weak); + +/* in util/tlist.c: */ + +extern int count_nonjunk_tlist_entries(List *tlist); +extern TargetEntry *get_sortgroupref_tle(Index sortref, + List *targetList); +extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause, + List *targetList); +extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause, + List *targetList); +extern List *get_sortgrouplist_exprs(List *sgClauses, + List *targetList); +extern SortGroupClause *get_sortgroupref_clause(Index sortref, + List *clauses); +extern SortGroupClause *get_sortgroupref_clause_noerr(Index sortref, + List *clauses); + +/* in util/var.c: */ + +/* Bits that can be OR'd into the flags argument of pull_var_clause() */ +#define PVC_INCLUDE_AGGREGATES 0x0001 /* include Aggrefs in output list */ +#define PVC_RECURSE_AGGREGATES 0x0002 /* recurse into Aggref arguments */ +#define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */ +#define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */ +#define PVC_INCLUDE_PLACEHOLDERS 0x0010 /* include PlaceHolderVars in + * output list */ +#define PVC_RECURSE_PLACEHOLDERS 0x0020 /* recurse into PlaceHolderVar + * arguments */ + +extern Bitmapset *pull_varnos(PlannerInfo *root, Node *node); +extern Bitmapset *pull_varnos_of_level(PlannerInfo *root, Node *node, int levelsup); +extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos); +extern List *pull_vars_of_level(Node *node, int levelsup); +extern bool contain_var_clause(Node *node); +extern bool contain_vars_of_level(Node *node, int levelsup); +extern int locate_var_of_level(Node *node, int levelsup); +extern List *pull_var_clause(Node *node, int flags); +extern Node *flatten_join_alias_vars(PlannerInfo *root, Query *query, Node *node); + +#endif /* OPTIMIZER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/orclauses.h b/platform/dbops/binaries/postgres/include/server/optimizer/orclauses.h new file mode 100644 index 0000000000000000000000000000000000000000..3ef275357556c17f541716f3c54e219fcfd780b5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/orclauses.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * orclauses.h + * prototypes for orclauses.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/orclauses.h + * + *------------------------------------------------------------------------- + */ +#ifndef ORCLAUSES_H +#define ORCLAUSES_H + +#include "nodes/pathnodes.h" + +extern void extract_restriction_or_clauses(PlannerInfo *root); + +#endif /* ORCLAUSES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/paramassign.h b/platform/dbops/binaries/postgres/include/server/optimizer/paramassign.h new file mode 100644 index 0000000000000000000000000000000000000000..4026b74fab459a927431c2e94749fedd67bb6421 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/paramassign.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * paramassign.h + * Functions for assigning PARAM_EXEC slots during planning. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/paramassign.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARAMASSIGN_H +#define PARAMASSIGN_H + +#include "nodes/pathnodes.h" + +extern Param *replace_outer_var(PlannerInfo *root, Var *var); +extern Param *replace_outer_placeholdervar(PlannerInfo *root, + PlaceHolderVar *phv); +extern Param *replace_outer_agg(PlannerInfo *root, Aggref *agg); +extern Param *replace_outer_grouping(PlannerInfo *root, GroupingFunc *grp); +extern Param *replace_outer_merge_support(PlannerInfo *root, + MergeSupportFunc *msf); +extern Param *replace_nestloop_param_var(PlannerInfo *root, Var *var); +extern Param *replace_nestloop_param_placeholdervar(PlannerInfo *root, + PlaceHolderVar *phv); +extern void process_subquery_nestloop_params(PlannerInfo *root, + List *subplan_params); +extern List *identify_current_nestloop_params(PlannerInfo *root, + Relids leftrelids); +extern Param *generate_new_exec_param(PlannerInfo *root, Oid paramtype, + int32 paramtypmod, Oid paramcollation); +extern int assign_special_exec_param(PlannerInfo *root); + +#endif /* PARAMASSIGN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/pathnode.h b/platform/dbops/binaries/postgres/include/server/optimizer/pathnode.h new file mode 100644 index 0000000000000000000000000000000000000000..112e7c23d4e1a7e5edc4ee5e4e387d219265b992 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/pathnode.h @@ -0,0 +1,351 @@ +/*------------------------------------------------------------------------- + * + * pathnode.h + * prototypes for pathnode.c, relnode.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/pathnode.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHNODE_H +#define PATHNODE_H + +#include "nodes/bitmapset.h" +#include "nodes/pathnodes.h" + + +/* + * prototypes for pathnode.c + */ +extern int compare_path_costs(Path *path1, Path *path2, + CostSelector criterion); +extern int compare_fractional_path_costs(Path *path1, Path *path2, + double fraction); +extern void set_cheapest(RelOptInfo *parent_rel); +extern void add_path(RelOptInfo *parent_rel, Path *new_path); +extern bool add_path_precheck(RelOptInfo *parent_rel, + Cost startup_cost, Cost total_cost, + List *pathkeys, Relids required_outer); +extern void add_partial_path(RelOptInfo *parent_rel, Path *new_path); +extern bool add_partial_path_precheck(RelOptInfo *parent_rel, + Cost total_cost, List *pathkeys); + +extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer, int parallel_workers); +extern Path *create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern IndexPath *create_index_path(PlannerInfo *root, + IndexOptInfo *index, + List *indexclauses, + List *indexorderbys, + List *indexorderbycols, + List *pathkeys, + ScanDirection indexscandir, + bool indexonly, + Relids required_outer, + double loop_count, + bool partial_path); +extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root, + RelOptInfo *rel, + Path *bitmapqual, + Relids required_outer, + double loop_count, + int parallel_degree); +extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root, + RelOptInfo *rel, + List *bitmapquals); +extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root, + RelOptInfo *rel, + List *bitmapquals); +extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, + List *tidquals, Relids required_outer); +extern TidRangePath *create_tidrangescan_path(PlannerInfo *root, + RelOptInfo *rel, + List *tidrangequals, + Relids required_outer); +extern AppendPath *create_append_path(PlannerInfo *root, RelOptInfo *rel, + List *subpaths, List *partial_subpaths, + List *pathkeys, Relids required_outer, + int parallel_workers, bool parallel_aware, + double rows); +extern MergeAppendPath *create_merge_append_path(PlannerInfo *root, + RelOptInfo *rel, + List *subpaths, + List *pathkeys, + Relids required_outer); +extern GroupResultPath *create_group_result_path(PlannerInfo *root, + RelOptInfo *rel, + PathTarget *target, + List *havingqual); +extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath); +extern MemoizePath *create_memoize_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *param_exprs, + List *hash_operators, + bool singlerow, + bool binary_mode, + double calls); +extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, SpecialJoinInfo *sjinfo); +extern GatherPath *create_gather_path(PlannerInfo *root, + RelOptInfo *rel, Path *subpath, PathTarget *target, + Relids required_outer, double *rows); +extern GatherMergePath *create_gather_merge_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + List *pathkeys, + Relids required_outer, + double *rows); +extern SubqueryScanPath *create_subqueryscan_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + bool trivial_pathtarget, + List *pathkeys, + Relids required_outer); +extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, + List *pathkeys, Relids required_outer); +extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, + List *pathkeys, Relids required_outer); +extern Path *create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_resultscan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, + Relids required_outer); +extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, Cost startup_cost, Cost total_cost, + List *pathkeys, + Relids required_outer, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); +extern ForeignPath *create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, Cost startup_cost, Cost total_cost, + List *pathkeys, + Relids required_outer, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); +extern ForeignPath *create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel, + PathTarget *target, + double rows, Cost startup_cost, Cost total_cost, + List *pathkeys, + Path *fdw_outerpath, + List *fdw_restrictinfo, + List *fdw_private); + +extern Relids calc_nestloop_required_outer(Relids outerrelids, + Relids outer_paramrels, + Relids innerrelids, + Relids inner_paramrels); +extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path); + +extern NestPath *create_nestloop_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + List *restrict_clauses, + List *pathkeys, + Relids required_outer); + +extern MergePath *create_mergejoin_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + List *restrict_clauses, + List *pathkeys, + Relids required_outer, + List *mergeclauses, + List *outersortkeys, + List *innersortkeys); + +extern HashPath *create_hashjoin_path(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + JoinCostWorkspace *workspace, + JoinPathExtraData *extra, + Path *outer_path, + Path *inner_path, + bool parallel_hash, + List *restrict_clauses, + Relids required_outer, + List *hashclauses); + +extern ProjectionPath *create_projection_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target); +extern Path *apply_projection_to_path(PlannerInfo *root, + RelOptInfo *rel, + Path *path, + PathTarget *target); +extern ProjectSetPath *create_set_projection_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target); +extern SortPath *create_sort_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *pathkeys, + double limit_tuples); +extern IncrementalSortPath *create_incremental_sort_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *pathkeys, + int presorted_keys, + double limit_tuples); +extern GroupPath *create_group_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *groupClause, + List *qual, + double numGroups); +extern UpperUniquePath *create_upper_unique_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + int numCols, + double numGroups); +extern AggPath *create_agg_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + AggStrategy aggstrategy, + AggSplit aggsplit, + List *groupClause, + List *qual, + const AggClauseCosts *aggcosts, + double numGroups); +extern GroupingSetsPath *create_groupingsets_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + List *having_qual, + AggStrategy aggstrategy, + List *rollups, + const AggClauseCosts *agg_costs); +extern MinMaxAggPath *create_minmaxagg_path(PlannerInfo *root, + RelOptInfo *rel, + PathTarget *target, + List *mmaggregates, + List *quals); +extern WindowAggPath *create_windowagg_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + PathTarget *target, + List *windowFuncs, + List *runCondition, + WindowClause *winclause, + List *qual, + bool topwindow); +extern SetOpPath *create_setop_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + SetOpCmd cmd, + SetOpStrategy strategy, + List *distinctList, + AttrNumber flagColIdx, + int firstFlag, + double numGroups, + double outputRows); +extern RecursiveUnionPath *create_recursiveunion_path(PlannerInfo *root, + RelOptInfo *rel, + Path *leftpath, + Path *rightpath, + PathTarget *target, + List *distinctList, + int wtParam, + double numGroups); +extern LockRowsPath *create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, List *rowMarks, int epqParam); +extern ModifyTablePath *create_modifytable_path(PlannerInfo *root, + RelOptInfo *rel, + Path *subpath, + CmdType operation, bool canSetTag, + Index nominalRelation, Index rootRelation, + bool partColsUpdated, + List *resultRelations, + List *updateColnosLists, + List *withCheckOptionLists, List *returningLists, + List *rowMarks, OnConflictExpr *onconflict, + List *mergeActionLists, List *mergeJoinConditions, + int epqParam); +extern LimitPath *create_limit_path(PlannerInfo *root, RelOptInfo *rel, + Path *subpath, + Node *limitOffset, Node *limitCount, + LimitOption limitOption, + int64 offset_est, int64 count_est); +extern void adjust_limit_rows_costs(double *rows, + Cost *startup_cost, Cost *total_cost, + int64 offset_est, int64 count_est); + +extern Path *reparameterize_path(PlannerInfo *root, Path *path, + Relids required_outer, + double loop_count); +extern Path *reparameterize_path_by_child(PlannerInfo *root, Path *path, + RelOptInfo *child_rel); +extern bool path_is_reparameterizable_by_child(Path *path, + RelOptInfo *child_rel); + +/* + * prototypes for relnode.c + */ +extern void setup_simple_rel_arrays(PlannerInfo *root); +extern void expand_planner_arrays(PlannerInfo *root, int add_size); +extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid, + RelOptInfo *parent); +extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid); +extern RelOptInfo *find_base_rel_noerr(PlannerInfo *root, int relid); +extern RelOptInfo *find_base_rel_ignore_join(PlannerInfo *root, int relid); +extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids); +extern RelOptInfo *build_join_rel(PlannerInfo *root, + Relids joinrelids, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo, + List *pushed_down_joins, + List **restrictlist_ptr); +extern Relids min_join_parameterization(PlannerInfo *root, + Relids joinrelids, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel); +extern RelOptInfo *fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, + Relids relids); +extern Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel); +extern ParamPathInfo *get_baserel_parampathinfo(PlannerInfo *root, + RelOptInfo *baserel, + Relids required_outer); +extern ParamPathInfo *get_joinrel_parampathinfo(PlannerInfo *root, + RelOptInfo *joinrel, + Path *outer_path, + Path *inner_path, + SpecialJoinInfo *sjinfo, + Relids required_outer, + List **restrict_clauses); +extern ParamPathInfo *get_appendrel_parampathinfo(RelOptInfo *appendrel, + Relids required_outer); +extern ParamPathInfo *find_param_path_info(RelOptInfo *rel, + Relids required_outer); +extern Bitmapset *get_param_path_clause_serials(Path *path); +extern RelOptInfo *build_child_join_rel(PlannerInfo *root, + RelOptInfo *outer_rel, RelOptInfo *inner_rel, + RelOptInfo *parent_joinrel, List *restrictlist, + SpecialJoinInfo *sjinfo); + +#endif /* PATHNODE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/paths.h b/platform/dbops/binaries/postgres/include/server/optimizer/paths.h new file mode 100644 index 0000000000000000000000000000000000000000..5e88c0224a4175535c99e82fc6e1a2b08adc790c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/paths.h @@ -0,0 +1,271 @@ +/*------------------------------------------------------------------------- + * + * paths.h + * prototypes for various files in optimizer/path + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/paths.h + * + *------------------------------------------------------------------------- + */ +#ifndef PATHS_H +#define PATHS_H + +#include "nodes/pathnodes.h" + + +/* + * allpaths.c + */ +extern PGDLLIMPORT bool enable_geqo; +extern PGDLLIMPORT int geqo_threshold; +extern PGDLLIMPORT int min_parallel_table_scan_size; +extern PGDLLIMPORT int min_parallel_index_scan_size; +extern PGDLLIMPORT bool enable_group_by_reordering; + +/* Hook for plugins to get control in set_rel_pathlist() */ +typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, + RelOptInfo *rel, + Index rti, + RangeTblEntry *rte); +extern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook; + +/* Hook for plugins to get control in add_paths_to_joinrel() */ +typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root, + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); +extern PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook; + +/* Hook for plugins to replace standard_join_search() */ +typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root, + int levels_needed, + List *initial_rels); +extern PGDLLIMPORT join_search_hook_type join_search_hook; + + +extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist); +extern RelOptInfo *standard_join_search(PlannerInfo *root, int levels_needed, + List *initial_rels); + +extern void generate_gather_paths(PlannerInfo *root, RelOptInfo *rel, + bool override_rows); +extern void generate_useful_gather_paths(PlannerInfo *root, RelOptInfo *rel, + bool override_rows); +extern int compute_parallel_worker(RelOptInfo *rel, double heap_pages, + double index_pages, int max_workers); +extern void create_partial_bitmap_paths(PlannerInfo *root, RelOptInfo *rel, + Path *bitmapqual); +extern void generate_partitionwise_join_paths(PlannerInfo *root, + RelOptInfo *rel); + +/* + * indxpath.c + * routines to generate index paths + */ +extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel); +extern bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, + List *restrictlist, + List *exprlist, List *oprlist); +extern bool indexcol_is_bool_constant_for_query(PlannerInfo *root, + IndexOptInfo *index, + int indexcol); +extern bool match_index_to_operand(Node *operand, int indexcol, + IndexOptInfo *index); +extern void check_index_predicates(PlannerInfo *root, RelOptInfo *rel); + +/* + * tidpath.c + * routines to generate tid paths + */ +extern void create_tidscan_paths(PlannerInfo *root, RelOptInfo *rel); + +/* + * joinpath.c + * routines to create join paths + */ +extern void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, + RelOptInfo *outerrel, RelOptInfo *innerrel, + JoinType jointype, SpecialJoinInfo *sjinfo, + List *restrictlist); + +/* + * joinrels.c + * routines to determine which relations to join + */ +extern void join_search_one_level(PlannerInfo *root, int level); +extern RelOptInfo *make_join_rel(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern Relids add_outer_joins_to_relids(PlannerInfo *root, Relids input_relids, + SpecialJoinInfo *sjinfo, + List **pushed_down_joins); +extern bool have_join_order_restriction(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern bool have_dangerous_phv(PlannerInfo *root, + Relids outer_relids, Relids inner_params); +extern void mark_dummy_rel(RelOptInfo *rel); +extern void init_dummy_sjinfo(SpecialJoinInfo *sjinfo, Relids left_relids, + Relids right_relids); + +/* + * equivclass.c + * routines for managing EquivalenceClasses + */ +typedef bool (*ec_matches_callback_type) (PlannerInfo *root, + RelOptInfo *rel, + EquivalenceClass *ec, + EquivalenceMember *em, + void *arg); + +extern bool process_equivalence(PlannerInfo *root, + RestrictInfo **p_restrictinfo, + JoinDomain *jdomain); +extern Expr *canonicalize_ec_expression(Expr *expr, + Oid req_type, Oid req_collation); +extern void reconsider_outer_join_clauses(PlannerInfo *root); +extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root, + Expr *expr, + List *opfamilies, + Oid opcintype, + Oid collation, + Index sortref, + Relids rel, + bool create_it); +extern EquivalenceMember *find_ec_member_matching_expr(EquivalenceClass *ec, + Expr *expr, + Relids relids); +extern EquivalenceMember *find_computable_ec_member(PlannerInfo *root, + EquivalenceClass *ec, + List *exprs, + Relids relids, + bool require_parallel_safe); +extern bool relation_can_be_sorted_early(PlannerInfo *root, RelOptInfo *rel, + EquivalenceClass *ec, + bool require_parallel_safe); +extern void generate_base_implied_equalities(PlannerInfo *root); +extern List *generate_join_implied_equalities(PlannerInfo *root, + Relids join_relids, + Relids outer_relids, + RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo); +extern List *generate_join_implied_equalities_for_ecs(PlannerInfo *root, + List *eclasses, + Relids join_relids, + Relids outer_relids, + RelOptInfo *inner_rel); +extern bool exprs_known_equal(PlannerInfo *root, Node *item1, Node *item2); +extern EquivalenceClass *match_eclasses_to_foreign_key_col(PlannerInfo *root, + ForeignKeyOptInfo *fkinfo, + int colno); +extern RestrictInfo *find_derived_clause_for_ec_member(EquivalenceClass *ec, + EquivalenceMember *em); +extern void add_child_rel_equivalences(PlannerInfo *root, + AppendRelInfo *appinfo, + RelOptInfo *parent_rel, + RelOptInfo *child_rel); +extern void add_child_join_rel_equivalences(PlannerInfo *root, + int nappinfos, + AppendRelInfo **appinfos, + RelOptInfo *parent_joinrel, + RelOptInfo *child_joinrel); +extern void add_setop_child_rel_equivalences(PlannerInfo *root, + RelOptInfo *child_rel, + List *child_tlist, + List *setop_pathkeys); +extern List *generate_implied_equalities_for_column(PlannerInfo *root, + RelOptInfo *rel, + ec_matches_callback_type callback, + void *callback_arg, + Relids prohibited_rels); +extern bool have_relevant_eclass_joinclause(PlannerInfo *root, + RelOptInfo *rel1, RelOptInfo *rel2); +extern bool has_relevant_eclass_joinclause(PlannerInfo *root, + RelOptInfo *rel1); +extern bool eclass_useful_for_merging(PlannerInfo *root, + EquivalenceClass *eclass, + RelOptInfo *rel); +extern bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist); +extern bool is_redundant_with_indexclauses(RestrictInfo *rinfo, + List *indexclauses); + +/* + * pathkeys.c + * utilities for matching and building path keys + */ +typedef enum +{ + PATHKEYS_EQUAL, /* pathkeys are identical */ + PATHKEYS_BETTER1, /* pathkey 1 is a superset of pathkey 2 */ + PATHKEYS_BETTER2, /* vice versa */ + PATHKEYS_DIFFERENT, /* neither pathkey includes the other */ +} PathKeysComparison; + +extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2); +extern bool pathkeys_contained_in(List *keys1, List *keys2); +extern bool pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common); +extern List *get_useful_group_keys_orderings(PlannerInfo *root, Path *path); +extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys, + Relids required_outer, + CostSelector cost_criterion, + bool require_parallel_safe); +extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths, + List *pathkeys, + Relids required_outer, + double fraction); +extern Path *get_cheapest_parallel_safe_total_inner(List *paths); +extern List *build_index_pathkeys(PlannerInfo *root, IndexOptInfo *index, + ScanDirection scandir); +extern List *build_partition_pathkeys(PlannerInfo *root, RelOptInfo *partrel, + ScanDirection scandir, bool *partialkeys); +extern List *build_expression_pathkey(PlannerInfo *root, Expr *expr, + Oid opno, + Relids rel, bool create_it); +extern List *convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, + List *subquery_pathkeys, + List *subquery_tlist); +extern List *build_join_pathkeys(PlannerInfo *root, + RelOptInfo *joinrel, + JoinType jointype, + List *outer_pathkeys); +extern List *make_pathkeys_for_sortclauses(PlannerInfo *root, + List *sortclauses, + List *tlist); +extern List *make_pathkeys_for_sortclauses_extended(PlannerInfo *root, + List **sortclauses, + List *tlist, + bool remove_redundant, + bool *sortable, + bool set_ec_sortref); +extern void initialize_mergeclause_eclasses(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern void update_mergeclause_eclasses(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern List *find_mergeclauses_for_outer_pathkeys(PlannerInfo *root, + List *pathkeys, + List *restrictinfos); +extern List *select_outer_pathkeys_for_merge(PlannerInfo *root, + List *mergeclauses, + RelOptInfo *joinrel); +extern List *make_inner_pathkeys_for_merge(PlannerInfo *root, + List *mergeclauses, + List *outer_pathkeys); +extern List *trim_mergeclauses_for_inner_pathkeys(PlannerInfo *root, + List *mergeclauses, + List *pathkeys); +extern List *truncate_useless_pathkeys(PlannerInfo *root, + RelOptInfo *rel, + List *pathkeys); +extern bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel); +extern List *append_pathkeys(List *target, List *source); +extern PathKey *make_canonical_pathkey(PlannerInfo *root, + EquivalenceClass *eclass, Oid opfamily, + int strategy, bool nulls_first); +extern void add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel, + List *live_childrels); + +#endif /* PATHS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/placeholder.h b/platform/dbops/binaries/postgres/include/server/optimizer/placeholder.h new file mode 100644 index 0000000000000000000000000000000000000000..d8610863fc5cae4d83e294a2a49498b21d5bb4a3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/placeholder.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * placeholder.h + * prototypes for optimizer/util/placeholder.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/placeholder.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLACEHOLDER_H +#define PLACEHOLDER_H + +#include "nodes/pathnodes.h" + + +extern PlaceHolderVar *make_placeholder_expr(PlannerInfo *root, Expr *expr, + Relids phrels); +extern PlaceHolderInfo *find_placeholder_info(PlannerInfo *root, + PlaceHolderVar *phv); +extern void find_placeholders_in_jointree(PlannerInfo *root); +extern void fix_placeholder_input_needed_levels(PlannerInfo *root); +extern void add_placeholders_to_base_rels(PlannerInfo *root); +extern void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, + RelOptInfo *outer_rel, RelOptInfo *inner_rel, + SpecialJoinInfo *sjinfo); +extern bool contain_placeholder_references_to(PlannerInfo *root, Node *clause, + int relid); + +#endif /* PLACEHOLDER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/plancat.h b/platform/dbops/binaries/postgres/include/server/optimizer/plancat.h new file mode 100644 index 0000000000000000000000000000000000000000..f59b77b10125cc9478096b34c2d6f40b24f339b6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/plancat.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------------------- + * + * plancat.h + * prototypes for plancat.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/plancat.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANCAT_H +#define PLANCAT_H + +#include "nodes/pathnodes.h" +#include "utils/relcache.h" + +/* Hook for plugins to get control in get_relation_info() */ +typedef void (*get_relation_info_hook_type) (PlannerInfo *root, + Oid relationObjectId, + bool inhparent, + RelOptInfo *rel); +extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; + + +extern void get_relation_info(PlannerInfo *root, Oid relationObjectId, + bool inhparent, RelOptInfo *rel); + +extern List *infer_arbiter_indexes(PlannerInfo *root); + +extern void estimate_rel_size(Relation rel, int32 *attr_widths, + BlockNumber *pages, double *tuples, double *allvisfrac); + +extern int32 get_rel_data_width(Relation rel, int32 *attr_widths); +extern int32 get_relation_data_width(Oid relid, int32 *attr_widths); + +extern bool relation_excluded_by_constraints(PlannerInfo *root, + RelOptInfo *rel, RangeTblEntry *rte); + +extern List *build_physical_tlist(PlannerInfo *root, RelOptInfo *rel); + +extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno); + +extern Selectivity restriction_selectivity(PlannerInfo *root, + Oid operatorid, + List *args, + Oid inputcollid, + int varRelid); + +extern Selectivity join_selectivity(PlannerInfo *root, + Oid operatorid, + List *args, + Oid inputcollid, + JoinType jointype, + SpecialJoinInfo *sjinfo); + +extern Selectivity function_selectivity(PlannerInfo *root, + Oid funcid, + List *args, + Oid inputcollid, + bool is_join, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo); + +extern void add_function_cost(PlannerInfo *root, Oid funcid, Node *node, + QualCost *cost); + +extern double get_function_rows(PlannerInfo *root, Oid funcid, Node *node); + +extern bool has_row_triggers(PlannerInfo *root, Index rti, CmdType event); + +extern bool has_stored_generated_columns(PlannerInfo *root, Index rti); + +extern Bitmapset *get_dependent_generated_columns(PlannerInfo *root, Index rti, + Bitmapset *target_cols); + +#endif /* PLANCAT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/planmain.h b/platform/dbops/binaries/postgres/include/server/optimizer/planmain.h new file mode 100644 index 0000000000000000000000000000000000000000..aafc17379215158dee58c5b041f87b37b9263fed --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/planmain.h @@ -0,0 +1,123 @@ +/*------------------------------------------------------------------------- + * + * planmain.h + * prototypes for various files in optimizer/plan + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/planmain.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANMAIN_H +#define PLANMAIN_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +/* GUC parameters */ +#define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 +extern PGDLLIMPORT double cursor_tuple_fraction; + +/* query_planner callback to compute query_pathkeys */ +typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra); + +/* + * prototypes for plan/planmain.c + */ +extern RelOptInfo *query_planner(PlannerInfo *root, + query_pathkeys_callback qp_callback, void *qp_extra); + +/* + * prototypes for plan/planagg.c + */ +extern void preprocess_minmax_aggregates(PlannerInfo *root); + +/* + * prototypes for plan/createplan.c + */ +extern Plan *create_plan(PlannerInfo *root, Path *best_path); +extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual, + Index scanrelid, List *fdw_exprs, List *fdw_private, + List *fdw_scan_tlist, List *fdw_recheck_quals, + Plan *outer_plan); +extern Plan *change_plan_targetlist(Plan *subplan, List *tlist, + bool tlist_parallel_safe); +extern Plan *materialize_finished_plan(Plan *subplan); +extern bool is_projection_capable_path(Path *path); +extern bool is_projection_capable_plan(Plan *plan); + +/* External use of these functions is deprecated: */ +extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree); +extern Agg *make_agg(List *tlist, List *qual, + AggStrategy aggstrategy, AggSplit aggsplit, + int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, + List *groupingSets, List *chain, double dNumGroups, + Size transitionSpace, Plan *lefttree); +extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount, + LimitOption limitOption, int uniqNumCols, + AttrNumber *uniqColIdx, Oid *uniqOperators, + Oid *uniqCollations); + +/* + * prototypes for plan/initsplan.c + */ +extern PGDLLIMPORT int from_collapse_limit; +extern PGDLLIMPORT int join_collapse_limit; + +extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode); +extern void add_other_rels_to_query(PlannerInfo *root); +extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist); +extern void add_vars_to_targetlist(PlannerInfo *root, List *vars, + Relids where_needed); +extern void find_lateral_references(PlannerInfo *root); +extern void create_lateral_join_info(PlannerInfo *root); +extern List *deconstruct_jointree(PlannerInfo *root); +extern bool restriction_is_always_true(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern bool restriction_is_always_false(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern void distribute_restrictinfo_to_rels(PlannerInfo *root, + RestrictInfo *restrictinfo); +extern RestrictInfo *process_implied_equality(PlannerInfo *root, + Oid opno, + Oid collation, + Expr *item1, + Expr *item2, + Relids qualscope, + Index security_level, + bool both_const); +extern RestrictInfo *build_implied_join_equality(PlannerInfo *root, + Oid opno, + Oid collation, + Expr *item1, + Expr *item2, + Relids qualscope, + Index security_level); +extern void match_foreign_keys_to_quals(PlannerInfo *root); + +/* + * prototypes for plan/analyzejoins.c + */ +extern List *remove_useless_joins(PlannerInfo *root, List *joinlist); +extern void reduce_unique_semijoins(PlannerInfo *root); +extern bool query_supports_distinctness(Query *query); +extern bool query_is_distinct_for(Query *query, List *colnos, List *opids); +extern bool innerrel_is_unique(PlannerInfo *root, + Relids joinrelids, Relids outerrelids, RelOptInfo *innerrel, + JoinType jointype, List *restrictlist, bool force_cache); + +/* + * prototypes for plan/setrefs.c + */ +extern Plan *set_plan_references(PlannerInfo *root, Plan *plan); +extern bool trivial_subqueryscan(SubqueryScan *plan); +extern Param *find_minmax_agg_replacement_param(PlannerInfo *root, + Aggref *aggref); +extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid); +extern void record_plan_type_dependency(PlannerInfo *root, Oid typid); +extern bool extract_query_dependencies_walker(Node *node, PlannerInfo *context); + +#endif /* PLANMAIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/planner.h b/platform/dbops/binaries/postgres/include/server/optimizer/planner.h new file mode 100644 index 0000000000000000000000000000000000000000..5aeff21b967f074991044f68d818a00f86555436 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/planner.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * planner.h + * prototypes for planner.c. + * + * Note that the primary entry points for planner.c are declared in + * optimizer/optimizer.h, because they're intended to be called from + * non-planner code. Declarations here are meant for use by other + * planner modules. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/planner.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANNER_H +#define PLANNER_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* Hook for plugins to get control in planner() */ +typedef PlannedStmt *(*planner_hook_type) (Query *parse, + const char *query_string, + int cursorOptions, + ParamListInfo boundParams); +extern PGDLLIMPORT planner_hook_type planner_hook; + +/* Hook for plugins to get control when grouping_planner() plans upper rels */ +typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel, + void *extra); +extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; + + +extern PlannedStmt *standard_planner(Query *parse, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); + +extern PlannerInfo *subquery_planner(PlannerGlobal *glob, Query *parse, + PlannerInfo *parent_root, + bool hasRecursion, double tuple_fraction, + SetOperationStmt *setops); + +extern RowMarkType select_rowmark_type(RangeTblEntry *rte, + LockClauseStrength strength); + +extern bool limit_needed(Query *parse); + +extern void mark_partial_aggref(Aggref *agg, AggSplit aggsplit); + +extern Path *get_cheapest_fractional_path(RelOptInfo *rel, + double tuple_fraction); + +extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr); + +#endif /* PLANNER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/prep.h b/platform/dbops/binaries/postgres/include/server/optimizer/prep.h new file mode 100644 index 0000000000000000000000000000000000000000..a52dec285d569970c49e702f8c0d41aa2505d279 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/prep.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * prep.h + * prototypes for files in optimizer/prep/ + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/prep.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREP_H +#define PREP_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + + +/* + * prototypes for prepjointree.c + */ +extern void transform_MERGE_to_join(Query *parse); +extern void replace_empty_jointree(Query *parse); +extern void pull_up_sublinks(PlannerInfo *root); +extern void preprocess_function_rtes(PlannerInfo *root); +extern void pull_up_subqueries(PlannerInfo *root); +extern void flatten_simple_union_all(PlannerInfo *root); +extern void reduce_outer_joins(PlannerInfo *root); +extern void remove_useless_result_rtes(PlannerInfo *root); +extern Relids get_relids_in_jointree(Node *jtnode, bool include_outer_joins, + bool include_inner_joins); +extern Relids get_relids_for_join(Query *query, int joinrelid); + +/* + * prototypes for preptlist.c + */ +extern void preprocess_targetlist(PlannerInfo *root); + +extern List *extract_update_targetlist_colnos(List *tlist); + +extern PlanRowMark *get_plan_rowmark(List *rowmarks, Index rtindex); + +/* + * prototypes for prepagg.c + */ +extern void get_agg_clause_costs(PlannerInfo *root, AggSplit aggsplit, + AggClauseCosts *costs); +extern void preprocess_aggrefs(PlannerInfo *root, Node *clause); + +/* + * prototypes for prepunion.c + */ +extern RelOptInfo *plan_set_operations(PlannerInfo *root); +extern bool set_operation_ordered_results_useful(SetOperationStmt *setop); + +#endif /* PREP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/restrictinfo.h b/platform/dbops/binaries/postgres/include/server/optimizer/restrictinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..1b42c832c5923737f915ad2d4ec0ec4ef6e4209e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/restrictinfo.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * restrictinfo.h + * prototypes for restrictinfo.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/restrictinfo.h + * + *------------------------------------------------------------------------- + */ +#ifndef RESTRICTINFO_H +#define RESTRICTINFO_H + +#include "nodes/pathnodes.h" + + +/* Convenience macro for the common case of a valid-everywhere qual */ +#define make_simple_restrictinfo(root, clause) \ + make_restrictinfo(root, clause, true, false, false, false, 0, \ + NULL, NULL, NULL) + +extern RestrictInfo *make_restrictinfo(PlannerInfo *root, + Expr *clause, + bool is_pushed_down, + bool has_clone, + bool is_clone, + bool pseudoconstant, + Index security_level, + Relids required_relids, + Relids incompatible_relids, + Relids outer_relids); +extern RestrictInfo *commute_restrictinfo(RestrictInfo *rinfo, Oid comm_op); +extern bool restriction_is_or_clause(RestrictInfo *restrictinfo); +extern bool restriction_is_securely_promotable(RestrictInfo *restrictinfo, + RelOptInfo *rel); +extern List *get_actual_clauses(List *restrictinfo_list); +extern List *extract_actual_clauses(List *restrictinfo_list, + bool pseudoconstant); +extern void extract_actual_join_clauses(List *restrictinfo_list, + Relids joinrelids, + List **joinquals, + List **otherquals); +extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel); +extern bool join_clause_is_movable_into(RestrictInfo *rinfo, + Relids currentrelids, + Relids current_and_outer); + +#endif /* RESTRICTINFO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/subselect.h b/platform/dbops/binaries/postgres/include/server/optimizer/subselect.h new file mode 100644 index 0000000000000000000000000000000000000000..c20bd9924b85bb5f5b8ab61cf3c7e1f82007fc69 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/subselect.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * subselect.h + * Planning routines for subselects. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/subselect.h + * + *------------------------------------------------------------------------- + */ +#ifndef SUBSELECT_H +#define SUBSELECT_H + +#include "nodes/pathnodes.h" +#include "nodes/plannodes.h" + +extern void SS_process_ctes(PlannerInfo *root); +extern JoinExpr *convert_ANY_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + Relids available_rels); +extern JoinExpr *convert_EXISTS_sublink_to_join(PlannerInfo *root, + SubLink *sublink, + bool under_not, + Relids available_rels); +extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr); +extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual); +extern void SS_identify_outer_params(PlannerInfo *root); +extern void SS_charge_for_initplans(PlannerInfo *root, RelOptInfo *final_rel); +extern void SS_compute_initplan_cost(List *init_plans, + Cost *initplan_cost_p, + bool *unsafe_initplans_p); +extern void SS_attach_initplans(PlannerInfo *root, Plan *plan); +extern void SS_finalize_plan(PlannerInfo *root, Plan *plan); +extern Param *SS_make_initplan_output_param(PlannerInfo *root, + Oid resulttype, int32 resulttypmod, + Oid resultcollation); +extern void SS_make_initplan_from_plan(PlannerInfo *root, + PlannerInfo *subroot, Plan *plan, + Param *prm); + +#endif /* SUBSELECT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/optimizer/tlist.h b/platform/dbops/binaries/postgres/include/server/optimizer/tlist.h new file mode 100644 index 0000000000000000000000000000000000000000..15f8f4a4b0061e8e71c4ad67bd4e88d65b6de962 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/optimizer/tlist.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * tlist.h + * prototypes for tlist.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/optimizer/tlist.h + * + *------------------------------------------------------------------------- + */ +#ifndef TLIST_H +#define TLIST_H + +#include "nodes/pathnodes.h" + + +extern TargetEntry *tlist_member(Expr *node, List *targetlist); + +extern List *add_to_flat_tlist(List *tlist, List *exprs); + +extern List *get_tlist_exprs(List *tlist, bool includeJunk); + +extern bool tlist_same_exprs(List *tlist1, List *tlist2); + +extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); +extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK); + +extern void apply_tlist_labeling(List *dest_tlist, List *src_tlist); + +extern Oid *extract_grouping_ops(List *groupClause); +extern Oid *extract_grouping_collations(List *groupClause, List *tlist); +extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist); +extern bool grouping_is_sortable(List *groupClause); +extern bool grouping_is_hashable(List *groupClause); + +extern PathTarget *make_pathtarget_from_tlist(List *tlist); +extern List *make_tlist_from_pathtarget(PathTarget *target); +extern PathTarget *copy_pathtarget(PathTarget *src); +extern PathTarget *create_empty_pathtarget(void); +extern void add_column_to_pathtarget(PathTarget *target, + Expr *expr, Index sortgroupref); +extern void add_new_column_to_pathtarget(PathTarget *target, Expr *expr); +extern void add_new_columns_to_pathtarget(PathTarget *target, List *exprs); +extern void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target); +extern void split_pathtarget_at_srfs(PlannerInfo *root, + PathTarget *target, PathTarget *input_target, + List **targets, List **targets_contain_srfs); + +/* Convenience macro to get a PathTarget with valid cost/width fields */ +#define create_pathtarget(root, tlist) \ + set_pathtarget_cost_width(root, make_pathtarget_from_tlist(tlist)) + +#endif /* TLIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/analyze.h b/platform/dbops/binaries/postgres/include/server/parser/analyze.h new file mode 100644 index 0000000000000000000000000000000000000000..28b66fccb433934af2c61b19d27339202140cbf4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/analyze.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * analyze.h + * parse analysis for optimizable statements + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/analyze.h + * + *------------------------------------------------------------------------- + */ +#ifndef ANALYZE_H +#define ANALYZE_H + +#include "nodes/params.h" +#include "nodes/queryjumble.h" +#include "parser/parse_node.h" + +/* Hook for plugins to get control at end of parse analysis */ +typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, + Query *query, + JumbleState *jstate); +extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; + + +extern Query *parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText, + const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv); +extern Query *parse_analyze_varparams(RawStmt *parseTree, const char *sourceText, + Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv); +extern Query *parse_analyze_withcb(RawStmt *parseTree, const char *sourceText, + ParserSetupHook parserSetup, + void *parserSetupArg, + QueryEnvironment *queryEnv); + +extern Query *parse_sub_analyze(Node *parseTree, ParseState *parentParseState, + CommonTableExpr *parentCTE, + bool locked_from_parent, + bool resolve_unknowns); + +extern List *transformInsertRow(ParseState *pstate, List *exprlist, + List *stmtcols, List *icolumns, List *attrnos, + bool strip_indirection); +extern List *transformUpdateTargetList(ParseState *pstate, + List *origTlist); +extern List *transformReturningList(ParseState *pstate, List *returningList, + ParseExprKind exprKind); +extern Query *transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree); +extern Query *transformStmt(ParseState *pstate, Node *parseTree); + +extern bool stmt_requires_parse_analysis(RawStmt *parseTree); +extern bool analyze_requires_snapshot(RawStmt *parseTree); + +extern const char *LCS_asString(LockClauseStrength strength); +extern void CheckSelectLocking(Query *qry, LockClauseStrength strength); +extern void applyLockingClause(Query *qry, Index rtindex, + LockClauseStrength strength, + LockWaitPolicy waitPolicy, bool pushedDown); + +extern List *BuildOnConflictExcludedTargetlist(Relation targetrel, + Index exclRelIndex); + +extern SortGroupClause *makeSortGroupClauseForSetOp(Oid rescoltype, bool require_hash); + +#endif /* ANALYZE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/kwlist.h b/platform/dbops/binaries/postgres/include/server/parser/kwlist.h new file mode 100644 index 0000000000000000000000000000000000000000..658d7ff6a9814561e566d5b15aab3f6274d2ecf8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/kwlist.h @@ -0,0 +1,518 @@ +/*------------------------------------------------------------------------- + * + * kwlist.h + * + * The keyword lists are kept in their own source files for use by + * automatic tools. The exact representation of a keyword is determined + * by the PG_KEYWORD macro, which is not defined in this file; it can + * be defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/parser/kwlist.h + * + *------------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef KWLIST_H here */ + +/* + * List of keyword (name, token-value, category, bare-label-status) entries. + * + * Note: gen_keywordlist.pl requires the entries to appear in ASCII order. + */ + +/* name, value, category, is-bare-label */ +PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("absent", ABSENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("add", ADD_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("admin", ADMIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("after", AFTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("aggregate", AGGREGATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("all", ALL, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("also", ALSO, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("alter", ALTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("always", ALWAYS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("analyse", ANALYSE, RESERVED_KEYWORD, BARE_LABEL) /* British spelling */ +PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("and", AND, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("any", ANY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("as", AS, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("asc", ASC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("asensitive", ASENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("assertion", ASSERTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("assignment", ASSIGNMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("asymmetric", ASYMMETRIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("at", AT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("atomic", ATOMIC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("attach", ATTACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("attribute", ATTRIBUTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("before", BEFORE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("begin", BEGIN_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("both", BOTH, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("breadth", BREADTH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("by", BY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cache", CACHE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("call", CALL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("called", CALLED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cascade", CASCADE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cascaded", CASCADED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("case", CASE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cast", CAST, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("catalog", CATALOG_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("chain", CHAIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("char", CHAR_P, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("character", CHARACTER, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("check", CHECK, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("checkpoint", CHECKPOINT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("class", CLASS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("collation", COLLATION, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("columns", COLUMNS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("compression", COMPRESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("conditional", CONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("conflict", CONFLICT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("constraint", CONSTRAINT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("constraints", CONSTRAINTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("content", CONTENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("continue", CONTINUE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("conversion", CONVERSION_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("copy", COPY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cost", COST, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("create", CREATE, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("cross", CROSS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("csv", CSV, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cube", CUBE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current", CURRENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_catalog", CURRENT_CATALOG, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_date", CURRENT_DATE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_role", CURRENT_ROLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_schema", CURRENT_SCHEMA, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_time", CURRENT_TIME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("current_user", CURRENT_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cursor", CURSOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("cycle", CYCLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("data", DATA_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("database", DATABASE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("day", DAY_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("deallocate", DEALLOCATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("dec", DEC, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("decimal", DECIMAL_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("declare", DECLARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("default", DEFAULT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("defaults", DEFAULTS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("deferrable", DEFERRABLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("deferred", DEFERRED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("definer", DEFINER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delete", DELETE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delimiter", DELIMITER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("delimiters", DELIMITERS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("depends", DEPENDS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("depth", DEPTH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("desc", DESC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("detach", DETACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("dictionary", DICTIONARY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("disable", DISABLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("discard", DISCARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("distinct", DISTINCT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("do", DO, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("document", DOCUMENT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("domain", DOMAIN_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("else", ELSE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("empty", EMPTY_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("end", END_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("error", ERROR_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("event", EVENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("exclude", EXCLUDE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("expression", EXPRESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("false", FALSE_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("family", FAMILY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("fetch", FETCH, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("filter", FILTER, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("finalize", FINALIZE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("first", FIRST_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("float", FLOAT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("for", FOR, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("format", FORMAT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("from", FROM, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("full", FULL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("function", FUNCTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("functions", FUNCTIONS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("generated", GENERATED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("global", GLOBAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("grant", GRANT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("granted", GRANTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("greatest", GREATEST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("group", GROUP_P, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("grouping", GROUPING, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("groups", GROUPS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("handler", HANDLER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("having", HAVING, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("immutable", IMMUTABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("implicit", IMPLICIT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("import", IMPORT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("in", IN_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("include", INCLUDE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("indent", INDENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inherit", INHERIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inherits", INHERITS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("initially", INITIALLY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inline", INLINE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("inner", INNER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("inout", INOUT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("input", INPUT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("insensitive", INSENSITIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("insert", INSERT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("instead", INSTEAD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("int", INT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("into", INTO, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("invoker", INVOKER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json", JSON, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_array", JSON_ARRAY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_arrayagg", JSON_ARRAYAGG, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_exists", JSON_EXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_object", JSON_OBJECT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_objectagg", JSON_OBJECTAGG, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_query", JSON_QUERY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_scalar", JSON_SCALAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_serialize", JSON_SERIALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_table", JSON_TABLE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("json_value", JSON_VALUE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("keep", KEEP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("keys", KEYS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("lateral", LATERAL_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("like", LIKE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("limit", LIMIT, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("listen", LISTEN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("load", LOAD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("local", LOCAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("localtime", LOCALTIME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("locked", LOCKED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("logged", LOGGED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("matched", MATCHED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("materialized", MATERIALIZED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("merge", MERGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("merge_action", MERGE_ACTION, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("method", METHOD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nested", NESTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("new", NEW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfc", NFC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfd", NFD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfkc", NFKC, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nfkd", NFKD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("no", NO, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("none", NONE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("normalize", NORMALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("normalized", NORMALIZED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("not", NOT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("nowait", NOWAIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("null", NULL_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("nullif", NULLIF, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("nulls", NULLS_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("numeric", NUMERIC, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("object", OBJECT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("of", OF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("old", OLD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("omit", OMIT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("on", ON, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("only", ONLY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("option", OPTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("options", OPTIONS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("or", OR, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("order", ORDER, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("ordinality", ORDINALITY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("others", OTHERS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("out", OUT_P, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("over", OVER, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("overlay", OVERLAY, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("overriding", OVERRIDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("owned", OWNED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parallel", PARALLEL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parameter", PARAMETER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("path", PATH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("plan", PLAN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("policy", POLICY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("preceding", PRECEDING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("precision", PRECISION, COL_NAME_KEYWORD, AS_LABEL) +PG_KEYWORD("prepare", PREPARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("prepared", PREPARED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("preserve", PRESERVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("primary", PRIMARY, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("prior", PRIOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("privileges", PRIVILEGES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedural", PROCEDURAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedure", PROCEDURE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("procedures", PROCEDURES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("program", PROGRAM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("publication", PUBLICATION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("quotes", QUOTES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("reassign", REASSIGN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("recheck", RECHECK, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ref", REF_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("referencing", REFERENCING, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("refresh", REFRESH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("repeatable", REPEATABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("replace", REPLACE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("replica", REPLICA, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("reset", RESET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("restart", RESTART, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("restrict", RESTRICT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("return", RETURN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("returning", RETURNING, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("returns", RETURNS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("revoke", REVOKE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("right", RIGHT, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("role", ROLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rollback", ROLLBACK, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rollup", ROLLUP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("routine", ROUTINE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("routines", ROUTINES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("row", ROW, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("scalar", SCALAR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("schemas", SCHEMAS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("search", SEARCH, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("second", SECOND_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("security", SECURITY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("select", SELECT, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sequence", SEQUENCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sequences", SEQUENCES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("serializable", SERIALIZABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("server", SERVER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("session", SESSION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("session_user", SESSION_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("set", SET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("setof", SETOF, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("sets", SETS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("skip", SKIP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("snapshot", SNAPSHOT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("some", SOME, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("source", SOURCE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sql", SQL_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("standalone", STANDALONE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("start", START, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("statement", STATEMENT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("statistics", STATISTICS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stdin", STDIN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("stored", STORED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("string", STRING_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("subscription", SUBSCRIPTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("support", SUPPORT, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("system_user", SYSTEM_USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("table", TABLE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("tablesample", TABLESAMPLE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("tablespace", TABLESPACE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("target", TARGET, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("temp", TEMP, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("template", TEMPLATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("temporary", TEMPORARY, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("text", TEXT_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("then", THEN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("ties", TIES, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("time", TIME, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("timestamp", TIMESTAMP, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("to", TO, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("trailing", TRAILING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("transaction", TRANSACTION, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("transform", TRANSFORM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("treat", TREAT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("trigger", TRIGGER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("trim", TRIM, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("true", TRUE_P, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("truncate", TRUNCATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("trusted", TRUSTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("type", TYPE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("uescape", UESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unconditional", UNCONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("union", UNION, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unknown", UNKNOWN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unlisten", UNLISTEN, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("unlogged", UNLOGGED, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("until", UNTIL, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("update", UPDATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("user", USER, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("using", USING, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("vacuum", VACUUM, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("valid", VALID, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("validate", VALIDATE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("validator", VALIDATOR, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("value", VALUE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("values", VALUES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("varchar", VARCHAR, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("variadic", VARIADIC, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("varying", VARYING, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("version", VERSION_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("view", VIEW, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("views", VIEWS, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("volatile", VOLATILE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("when", WHEN, RESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("where", WHERE, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("window", WINDOW, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("with", WITH, RESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("within", WITHIN, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("without", WITHOUT, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("work", WORK, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("wrapper", WRAPPER, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("write", WRITE, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("xml", XML_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlconcat", XMLCONCAT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlelement", XMLELEMENT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlexists", XMLEXISTS, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlforest", XMLFOREST, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlnamespaces", XMLNAMESPACES, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlparse", XMLPARSE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlpi", XMLPI, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlroot", XMLROOT, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("xmltable", XMLTABLE, COL_NAME_KEYWORD, BARE_LABEL) +PG_KEYWORD("year", YEAR_P, UNRESERVED_KEYWORD, AS_LABEL) +PG_KEYWORD("yes", YES_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("zone", ZONE, UNRESERVED_KEYWORD, BARE_LABEL) diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_agg.h b/platform/dbops/binaries/postgres/include/server/parser/parse_agg.h new file mode 100644 index 0000000000000000000000000000000000000000..4df9b37e6d96696862e9f6e8029c3aba8ad0f038 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_agg.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * parse_agg.h + * handle aggregates and window functions in parser + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_agg.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_AGG_H +#define PARSE_AGG_H + +#include "parser/parse_node.h" + +extern void transformAggregateCall(ParseState *pstate, Aggref *agg, + List *args, List *aggorder, + bool agg_distinct); + +extern Node *transformGroupingFunc(ParseState *pstate, GroupingFunc *p); + +extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, + WindowDef *windef); + +extern void parseCheckAggregates(ParseState *pstate, Query *qry); + +extern List *expand_grouping_sets(List *groupingSets, bool groupDistinct, int limit); + +extern int get_aggregate_argtypes(Aggref *aggref, Oid *inputTypes); + +extern Oid resolve_aggregate_transtype(Oid aggfuncid, + Oid aggtranstype, + Oid *inputTypes, + int numArguments); + +extern bool agg_args_support_sendreceive(Aggref *aggref); + +extern void build_aggregate_transfn_expr(Oid *agg_input_types, + int agg_num_inputs, + int agg_num_direct_inputs, + bool agg_variadic, + Oid agg_state_type, + Oid agg_input_collation, + Oid transfn_oid, + Oid invtransfn_oid, + Expr **transfnexpr, + Expr **invtransfnexpr); + +extern void build_aggregate_serialfn_expr(Oid serialfn_oid, + Expr **serialfnexpr); + +extern void build_aggregate_deserialfn_expr(Oid deserialfn_oid, + Expr **deserialfnexpr); + +extern void build_aggregate_finalfn_expr(Oid *agg_input_types, + int num_finalfn_inputs, + Oid agg_state_type, + Oid agg_result_type, + Oid agg_input_collation, + Oid finalfn_oid, + Expr **finalfnexpr); + +#endif /* PARSE_AGG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_clause.h b/platform/dbops/binaries/postgres/include/server/parser/parse_clause.h new file mode 100644 index 0000000000000000000000000000000000000000..e71762b10cff0b22c23ef7ee13cd76651b7f1bb5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_clause.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * parse_clause.h + * handle clauses in parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_clause.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_CLAUSE_H +#define PARSE_CLAUSE_H + +#include "parser/parse_node.h" + +extern void transformFromClause(ParseState *pstate, List *frmList); +extern int setTargetTable(ParseState *pstate, RangeVar *relation, + bool inh, bool alsoSource, AclMode requiredPerms); + +extern Node *transformWhereClause(ParseState *pstate, Node *clause, + ParseExprKind exprKind, const char *constructName); +extern Node *transformLimitClause(ParseState *pstate, Node *clause, + ParseExprKind exprKind, const char *constructName, + LimitOption limitOption); +extern List *transformGroupClause(ParseState *pstate, List *grouplist, + List **groupingSets, + List **targetlist, List *sortClause, + ParseExprKind exprKind, bool useSQL99); +extern List *transformSortClause(ParseState *pstate, List *orderlist, + List **targetlist, ParseExprKind exprKind, + bool useSQL99); + +extern List *transformWindowDefinitions(ParseState *pstate, + List *windowdefs, + List **targetlist); + +extern List *transformDistinctClause(ParseState *pstate, + List **targetlist, List *sortClause, bool is_agg); +extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist, + List **targetlist, List *sortClause); +extern void transformOnConflictArbiter(ParseState *pstate, + OnConflictClause *onConflictClause, + List **arbiterExpr, Node **arbiterWhere, + Oid *constraint); + +extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle, + List *sortlist, List *targetlist, SortBy *sortby); +extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); +extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); + +/* functions in parse_jsontable.c */ +extern ParseNamespaceItem *transformJsonTable(ParseState *pstate, JsonTable *jt); + +#endif /* PARSE_CLAUSE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_coerce.h b/platform/dbops/binaries/postgres/include/server/parser/parse_coerce.h new file mode 100644 index 0000000000000000000000000000000000000000..41ef39433fd5d923d605d4ccb150c0d622ac13e9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_coerce.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * parse_coerce.h + * Routines for type coercion. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_coerce.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_COERCE_H +#define PARSE_COERCE_H + +#include "parser/parse_node.h" + + +/* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */ +typedef char TYPCATEGORY; + +/* Result codes for find_coercion_pathway */ +typedef enum CoercionPathType +{ + COERCION_PATH_NONE, /* failed to find any coercion pathway */ + COERCION_PATH_FUNC, /* apply the specified coercion function */ + COERCION_PATH_RELABELTYPE, /* binary-compatible cast, no function */ + COERCION_PATH_ARRAYCOERCE, /* need an ArrayCoerceExpr node */ + COERCION_PATH_COERCEVIAIO, /* need a CoerceViaIO node */ +} CoercionPathType; + + +extern bool IsBinaryCoercible(Oid srctype, Oid targettype); +extern bool IsBinaryCoercibleWithCast(Oid srctype, Oid targettype, + Oid *castoid); +extern bool IsPreferredType(TYPCATEGORY category, Oid type); +extern TYPCATEGORY TypeCategory(Oid type); + +extern Node *coerce_to_target_type(ParseState *pstate, + Node *expr, Oid exprtype, + Oid targettype, int32 targettypmod, + CoercionContext ccontext, + CoercionForm cformat, + int location); +extern bool can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids, + CoercionContext ccontext); +extern Node *coerce_type(ParseState *pstate, Node *node, + Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, + CoercionContext ccontext, CoercionForm cformat, int location); +extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, + Oid typeId, + CoercionContext ccontext, CoercionForm cformat, int location, + bool hideInputCoercion); + +extern Node *coerce_to_boolean(ParseState *pstate, Node *node, + const char *constructName); +extern Node *coerce_to_specific_type(ParseState *pstate, Node *node, + Oid targetTypeId, + const char *constructName); + +extern Node *coerce_to_specific_type_typmod(ParseState *pstate, Node *node, + Oid targetTypeId, int32 targetTypmod, + const char *constructName); + +extern Node *coerce_null_to_domain(Oid typid, int32 typmod, Oid collation, + int typlen, bool typbyval); + +extern int parser_coercion_errposition(ParseState *pstate, + int coerce_location, + Node *input_expr); + +extern Oid select_common_type(ParseState *pstate, List *exprs, + const char *context, Node **which_expr); +extern Node *coerce_to_common_type(ParseState *pstate, Node *node, + Oid targetTypeId, + const char *context); +extern bool verify_common_type(Oid common_type, List *exprs); + +extern int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type); + +extern bool check_generic_type_consistency(const Oid *actual_arg_types, + const Oid *declared_arg_types, + int nargs); +extern Oid enforce_generic_type_consistency(const Oid *actual_arg_types, + Oid *declared_arg_types, + int nargs, + Oid rettype, + bool allow_poly); + +extern char *check_valid_polymorphic_signature(Oid ret_type, + const Oid *declared_arg_types, + int nargs); +extern char *check_valid_internal_signature(Oid ret_type, + const Oid *declared_arg_types, + int nargs); + +extern CoercionPathType find_coercion_pathway(Oid targetTypeId, + Oid sourceTypeId, + CoercionContext ccontext, + Oid *funcid); +extern CoercionPathType find_typmod_coercion_function(Oid typeId, + Oid *funcid); + +#endif /* PARSE_COERCE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_collate.h b/platform/dbops/binaries/postgres/include/server/parser/parse_collate.h new file mode 100644 index 0000000000000000000000000000000000000000..af69d13f5c1d5c4b5ccd044ab693f241317d667b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_collate.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * parse_collate.h + * Routines for assigning collation information. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_collate.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_COLLATE_H +#define PARSE_COLLATE_H + +#include "parser/parse_node.h" + +extern void assign_query_collations(ParseState *pstate, Query *query); + +extern void assign_list_collations(ParseState *pstate, List *exprs); + +extern void assign_expr_collations(ParseState *pstate, Node *expr); + +extern Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok); + +#endif /* PARSE_COLLATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_cte.h b/platform/dbops/binaries/postgres/include/server/parser/parse_cte.h new file mode 100644 index 0000000000000000000000000000000000000000..96547d420b38b19dc7ccdef8b60895a5090c8a50 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_cte.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * parse_cte.h + * handle CTEs (common table expressions) in parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_cte.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_CTE_H +#define PARSE_CTE_H + +#include "parser/parse_node.h" + +extern List *transformWithClause(ParseState *pstate, WithClause *withClause); + +extern void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, + List *tlist); + +#endif /* PARSE_CTE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_enr.h b/platform/dbops/binaries/postgres/include/server/parser/parse_enr.h new file mode 100644 index 0000000000000000000000000000000000000000..5e259e1e311e686b5aa2fa3c42766d253e392389 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_enr.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * parse_enr.h + * Internal definitions for parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_enr.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_ENR_H +#define PARSE_ENR_H + +#include "parser/parse_node.h" + +extern bool name_matches_visible_ENR(ParseState *pstate, const char *refname); +extern EphemeralNamedRelationMetadata get_visible_ENR(ParseState *pstate, const char *refname); + +#endif /* PARSE_ENR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_expr.h b/platform/dbops/binaries/postgres/include/server/parser/parse_expr.h new file mode 100644 index 0000000000000000000000000000000000000000..9b46dfd9ecc68ac29664c183daec8c65c914f96b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_expr.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * parse_expr.h + * handle expressions in parser + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_expr.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_EXPR_H +#define PARSE_EXPR_H + +#include "parser/parse_node.h" + +/* GUC parameters */ +extern PGDLLIMPORT bool Transform_null_equals; + +extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind); + +extern const char *ParseExprKindName(ParseExprKind exprKind); + +#endif /* PARSE_EXPR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_func.h b/platform/dbops/binaries/postgres/include/server/parser/parse_func.h new file mode 100644 index 0000000000000000000000000000000000000000..c7ba99dee74aab288e3861359720581d4952de40 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_func.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * parse_func.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_func.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_FUNC_H +#define PARSE_FUNC_H + +#include "catalog/namespace.h" +#include "parser/parse_node.h" + + +/* Result codes for func_get_detail */ +typedef enum +{ + FUNCDETAIL_NOTFOUND, /* no matching function */ + FUNCDETAIL_MULTIPLE, /* too many matching functions */ + FUNCDETAIL_NORMAL, /* found a matching regular function */ + FUNCDETAIL_PROCEDURE, /* found a matching procedure */ + FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */ + FUNCDETAIL_WINDOWFUNC, /* found a matching window function */ + FUNCDETAIL_COERCION, /* it's a type coercion request */ +} FuncDetailCode; + + +extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, + Node *last_srf, FuncCall *fn, bool proc_call, + int location); + +extern FuncDetailCode func_get_detail(List *funcname, + List *fargs, List *fargnames, + int nargs, Oid *argtypes, + bool expand_variadic, bool expand_defaults, + bool include_out_arguments, + Oid *funcid, Oid *rettype, + bool *retset, int *nvargs, Oid *vatype, + Oid **true_typeids, List **argdefaults); + +extern int func_match_argtypes(int nargs, + Oid *input_typeids, + FuncCandidateList raw_candidates, + FuncCandidateList *candidates); + +extern FuncCandidateList func_select_candidate(int nargs, + Oid *input_typeids, + FuncCandidateList candidates); + +extern void make_fn_arguments(ParseState *pstate, + List *fargs, + Oid *actual_arg_types, + Oid *declared_arg_types); + +extern const char *funcname_signature_string(const char *funcname, int nargs, + List *argnames, const Oid *argtypes); +extern const char *func_signature_string(List *funcname, int nargs, + List *argnames, const Oid *argtypes); + +extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, + bool missing_ok); +extern Oid LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, + bool missing_ok); + +extern void check_srf_call_placement(ParseState *pstate, Node *last_srf, + int location); + +#endif /* PARSE_FUNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_merge.h b/platform/dbops/binaries/postgres/include/server/parser/parse_merge.h new file mode 100644 index 0000000000000000000000000000000000000000..3fad202ae60ecc6adbfc42cfb74a615e0b1434e9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_merge.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * parse_merge.h + * handle MERGE statement in parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_merge.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_MERGE_H +#define PARSE_MERGE_H + +#include "parser/parse_node.h" + +extern Query *transformMergeStmt(ParseState *pstate, MergeStmt *stmt); + +#endif /* PARSE_MERGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_node.h b/platform/dbops/binaries/postgres/include/server/parser/parse_node.h new file mode 100644 index 0000000000000000000000000000000000000000..5b781d87a9d24c816115b8d8fc035aff2cb3d33e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_node.h @@ -0,0 +1,358 @@ +/*------------------------------------------------------------------------- + * + * parse_node.h + * Internal definitions for parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_node.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_NODE_H +#define PARSE_NODE_H + +#include "nodes/parsenodes.h" +#include "utils/queryenvironment.h" +#include "utils/relcache.h" + + +/* Forward references for some structs declared below */ +typedef struct ParseState ParseState; +typedef struct ParseNamespaceItem ParseNamespaceItem; +typedef struct ParseNamespaceColumn ParseNamespaceColumn; + +/* + * Expression kinds distinguished by transformExpr(). Many of these are not + * semantically distinct so far as expression transformation goes; rather, + * we distinguish them so that context-specific error messages can be printed. + * + * Note: EXPR_KIND_OTHER is not used in the core code, but is left for use + * by extension code that might need to call transformExpr(). The core code + * will not enforce any context-driven restrictions on EXPR_KIND_OTHER + * expressions, so the caller would have to check for sub-selects, aggregates, + * window functions, SRFs, etc if those need to be disallowed. + */ +typedef enum ParseExprKind +{ + EXPR_KIND_NONE = 0, /* "not in an expression" */ + EXPR_KIND_OTHER, /* reserved for extensions */ + EXPR_KIND_JOIN_ON, /* JOIN ON */ + EXPR_KIND_JOIN_USING, /* JOIN USING */ + EXPR_KIND_FROM_SUBSELECT, /* sub-SELECT in FROM clause */ + EXPR_KIND_FROM_FUNCTION, /* function in FROM clause */ + EXPR_KIND_WHERE, /* WHERE */ + EXPR_KIND_HAVING, /* HAVING */ + EXPR_KIND_FILTER, /* FILTER */ + EXPR_KIND_WINDOW_PARTITION, /* window definition PARTITION BY */ + EXPR_KIND_WINDOW_ORDER, /* window definition ORDER BY */ + EXPR_KIND_WINDOW_FRAME_RANGE, /* window frame clause with RANGE */ + EXPR_KIND_WINDOW_FRAME_ROWS, /* window frame clause with ROWS */ + EXPR_KIND_WINDOW_FRAME_GROUPS, /* window frame clause with GROUPS */ + EXPR_KIND_SELECT_TARGET, /* SELECT target list item */ + EXPR_KIND_INSERT_TARGET, /* INSERT target list item */ + EXPR_KIND_UPDATE_SOURCE, /* UPDATE assignment source item */ + EXPR_KIND_UPDATE_TARGET, /* UPDATE assignment target item */ + EXPR_KIND_MERGE_WHEN, /* MERGE WHEN [NOT] MATCHED condition */ + EXPR_KIND_GROUP_BY, /* GROUP BY */ + EXPR_KIND_ORDER_BY, /* ORDER BY */ + EXPR_KIND_DISTINCT_ON, /* DISTINCT ON */ + EXPR_KIND_LIMIT, /* LIMIT */ + EXPR_KIND_OFFSET, /* OFFSET */ + EXPR_KIND_RETURNING, /* RETURNING in INSERT/UPDATE/DELETE */ + EXPR_KIND_MERGE_RETURNING, /* RETURNING in MERGE */ + EXPR_KIND_VALUES, /* VALUES */ + EXPR_KIND_VALUES_SINGLE, /* single-row VALUES (in INSERT only) */ + EXPR_KIND_CHECK_CONSTRAINT, /* CHECK constraint for a table */ + EXPR_KIND_DOMAIN_CHECK, /* CHECK constraint for a domain */ + EXPR_KIND_COLUMN_DEFAULT, /* default value for a table column */ + EXPR_KIND_FUNCTION_DEFAULT, /* default parameter value for function */ + EXPR_KIND_INDEX_EXPRESSION, /* index expression */ + EXPR_KIND_INDEX_PREDICATE, /* index predicate */ + EXPR_KIND_STATS_EXPRESSION, /* extended statistics expression */ + EXPR_KIND_ALTER_COL_TRANSFORM, /* transform expr in ALTER COLUMN TYPE */ + EXPR_KIND_EXECUTE_PARAMETER, /* parameter value in EXECUTE */ + EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */ + EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */ + EXPR_KIND_PARTITION_BOUND, /* partition bound expression */ + EXPR_KIND_PARTITION_EXPRESSION, /* PARTITION BY expression */ + EXPR_KIND_CALL_ARGUMENT, /* procedure argument in CALL */ + EXPR_KIND_COPY_WHERE, /* WHERE condition in COPY FROM */ + EXPR_KIND_GENERATED_COLUMN, /* generation expression for a column */ + EXPR_KIND_CYCLE_MARK, /* cycle mark value */ +} ParseExprKind; + + +/* + * Function signatures for parser hooks + */ +typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref); +typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var); +typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref); +typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, + Oid targetTypeId, int32 targetTypeMod, + int location); + + +/* + * State information used during parse analysis + * + * parentParseState: NULL in a top-level ParseState. When parsing a subquery, + * links to current parse state of outer query. + * + * p_sourcetext: source string that generated the raw parsetree being + * analyzed, or NULL if not available. (The string is used only to + * generate cursor positions in error messages: we need it to convert + * byte-wise locations in parse structures to character-wise cursor + * positions.) + * + * p_rtable: list of RTEs that will become the rangetable of the query. + * Note that neither relname nor refname of these entries are necessarily + * unique; searching the rtable by name is a bad idea. + * + * p_rteperminfos: list of RTEPermissionInfo containing an entry corresponding + * to each RTE_RELATION entry in p_rtable. + * + * p_joinexprs: list of JoinExpr nodes associated with p_rtable entries. + * This is one-for-one with p_rtable, but contains NULLs for non-join + * RTEs, and may be shorter than p_rtable if the last RTE(s) aren't joins. + * + * p_nullingrels: list of Bitmapsets associated with p_rtable entries, each + * containing the set of outer-join RTE indexes that can null that relation + * at the current point in the parse tree. This is one-for-one with p_rtable, + * but may be shorter than p_rtable, in which case the missing entries are + * implicitly empty (NULL). That rule allows us to save work when the query + * contains no outer joins. + * + * p_joinlist: list of join items (RangeTblRef and JoinExpr nodes) that + * will become the fromlist of the query's top-level FromExpr node. + * + * p_namespace: list of ParseNamespaceItems that represents the current + * namespace for table and column lookup. (The RTEs listed here may be just + * a subset of the whole rtable. See ParseNamespaceItem comments below.) + * + * p_lateral_active: true if we are currently parsing a LATERAL subexpression + * of this parse level. This makes p_lateral_only namespace items visible, + * whereas they are not visible when p_lateral_active is FALSE. + * + * p_ctenamespace: list of CommonTableExprs (WITH items) that are visible + * at the moment. This is entirely different from p_namespace because a CTE + * is not an RTE, rather "visibility" means you could make an RTE from it. + * + * p_future_ctes: list of CommonTableExprs (WITH items) that are not yet + * visible due to scope rules. This is used to help improve error messages. + * + * p_parent_cte: CommonTableExpr that immediately contains the current query, + * if any. + * + * p_target_relation: target relation, if query is INSERT/UPDATE/DELETE/MERGE + * + * p_target_nsitem: target relation's ParseNamespaceItem. + * + * p_is_insert: true to process assignment expressions like INSERT, false + * to process them like UPDATE. (Note this can change intra-statement, for + * cases like INSERT ON CONFLICT UPDATE.) + * + * p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses. + * We collect these while transforming expressions and then transform them + * afterwards (so that any resjunk tlist items needed for the sort/group + * clauses end up at the end of the query tlist). A WindowDef's location in + * this list, counting from 1, is the winref number to use to reference it. + * + * p_expr_kind: kind of expression we're currently parsing, as per enum above; + * EXPR_KIND_NONE when not in an expression. + * + * p_next_resno: next TargetEntry.resno to assign, starting from 1. + * + * p_multiassign_exprs: partially-processed MultiAssignRef source expressions. + * + * p_locking_clause: query's FOR UPDATE/FOR SHARE clause, if any. + * + * p_locked_from_parent: true if parent query level applies FOR UPDATE/SHARE + * to this subquery as a whole. + * + * p_resolve_unknowns: resolve unknown-type SELECT output columns as type TEXT + * (this is true by default). + * + * p_hasAggs, p_hasWindowFuncs, etc: true if we've found any of the indicated + * constructs in the query. + * + * p_last_srf: the set-returning FuncExpr or OpExpr most recently found in + * the query, or NULL if none. + * + * p_pre_columnref_hook, etc: optional parser hook functions for modifying the + * interpretation of ColumnRefs and ParamRefs. + * + * p_ref_hook_state: passthrough state for the parser hook functions. + */ +struct ParseState +{ + ParseState *parentParseState; /* stack link */ + const char *p_sourcetext; /* source text, or NULL if not available */ + List *p_rtable; /* range table so far */ + List *p_rteperminfos; /* list of RTEPermissionInfo nodes for each + * RTE_RELATION entry in rtable */ + List *p_joinexprs; /* JoinExprs for RTE_JOIN p_rtable entries */ + List *p_nullingrels; /* Bitmapsets showing nulling outer joins */ + List *p_joinlist; /* join items so far (will become FromExpr + * node's fromlist) */ + List *p_namespace; /* currently-referenceable RTEs (List of + * ParseNamespaceItem) */ + bool p_lateral_active; /* p_lateral_only items visible? */ + List *p_ctenamespace; /* current namespace for common table exprs */ + List *p_future_ctes; /* common table exprs not yet in namespace */ + CommonTableExpr *p_parent_cte; /* this query's containing CTE */ + Relation p_target_relation; /* INSERT/UPDATE/DELETE/MERGE target rel */ + ParseNamespaceItem *p_target_nsitem; /* target rel's NSItem, or NULL */ + bool p_is_insert; /* process assignment like INSERT not UPDATE */ + List *p_windowdefs; /* raw representations of window clauses */ + ParseExprKind p_expr_kind; /* what kind of expression we're parsing */ + int p_next_resno; /* next targetlist resno to assign */ + List *p_multiassign_exprs; /* junk tlist entries for multiassign */ + List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */ + bool p_locked_from_parent; /* parent has marked this subquery + * with FOR UPDATE/FOR SHARE */ + bool p_resolve_unknowns; /* resolve unknown-type SELECT outputs as + * type text */ + + QueryEnvironment *p_queryEnv; /* curr env, incl refs to enclosing env */ + + /* Flags telling about things found in the query: */ + bool p_hasAggs; + bool p_hasWindowFuncs; + bool p_hasTargetSRFs; + bool p_hasSubLinks; + bool p_hasModifyingCTE; + + Node *p_last_srf; /* most recent set-returning func/op found */ + + /* + * Optional hook functions for parser callbacks. These are null unless + * set up by the caller of make_parsestate. + */ + PreParseColumnRefHook p_pre_columnref_hook; + PostParseColumnRefHook p_post_columnref_hook; + ParseParamRefHook p_paramref_hook; + CoerceParamHook p_coerce_param_hook; + void *p_ref_hook_state; /* common passthrough link for above */ +}; + +/* + * An element of a namespace list. + * + * p_names contains the table name and column names exposed by this nsitem. + * (Typically it's equal to p_rte->eref, but for a JOIN USING alias it's + * equal to p_rte->join_using_alias. Since the USING columns will be the + * join's first N columns, the net effect is just that we expose only those + * join columns via this nsitem.) + * + * p_rte and p_rtindex link to the underlying rangetable entry, and + * p_perminfo to the entry in rteperminfos. + * + * The p_nscolumns array contains info showing how to construct Vars + * referencing the names appearing in the p_names->colnames list. + * + * Namespace items with p_rel_visible set define which RTEs are accessible by + * qualified names, while those with p_cols_visible set define which RTEs are + * accessible by unqualified names. These sets are different because a JOIN + * without an alias does not hide the contained tables (so they must be + * visible for qualified references) but it does hide their columns + * (unqualified references to the columns refer to the JOIN, not the member + * tables, so we must not complain that such a reference is ambiguous). + * Conversely, a subquery without an alias does not hide the columns selected + * by the subquery, but it does hide the auto-generated relation name (so the + * subquery columns are visible for unqualified references only). Various + * special RTEs such as NEW/OLD for rules may also appear with only one flag + * set. + * + * While processing the FROM clause, namespace items may appear with + * p_lateral_only set, meaning they are visible only to LATERAL + * subexpressions. (The pstate's p_lateral_active flag tells whether we are + * inside such a subexpression at the moment.) If p_lateral_ok is not set, + * it's an error to actually use such a namespace item. One might think it + * would be better to just exclude such items from visibility, but the wording + * of SQL:2008 requires us to do it this way. We also use p_lateral_ok to + * forbid LATERAL references to an UPDATE/DELETE target table. + * + * At no time should a namespace list contain two entries that conflict + * according to the rules in checkNameSpaceConflicts; but note that those + * are more complicated than "must have different alias names", so in practice + * code searching a namespace list has to check for ambiguous references. + */ +struct ParseNamespaceItem +{ + Alias *p_names; /* Table and column names */ + RangeTblEntry *p_rte; /* The relation's rangetable entry */ + int p_rtindex; /* The relation's index in the rangetable */ + RTEPermissionInfo *p_perminfo; /* The relation's rteperminfos entry */ + /* array of same length as p_names->colnames: */ + ParseNamespaceColumn *p_nscolumns; /* per-column data */ + bool p_rel_visible; /* Relation name is visible? */ + bool p_cols_visible; /* Column names visible as unqualified refs? */ + bool p_lateral_only; /* Is only visible to LATERAL expressions? */ + bool p_lateral_ok; /* If so, does join type allow use? */ +}; + +/* + * Data about one column of a ParseNamespaceItem. + * + * We track the info needed to construct a Var referencing the column + * (but only for user-defined columns; system column references and + * whole-row references are handled separately). + * + * p_varno and p_varattno identify the semantic referent, which is a + * base-relation column unless the reference is to a join USING column that + * isn't semantically equivalent to either join input column (because it is a + * FULL join or the input column requires a type coercion). In those cases + * p_varno and p_varattno refer to the JOIN RTE. + * + * p_varnosyn and p_varattnosyn are either identical to p_varno/p_varattno, + * or they specify the column's position in an aliased JOIN RTE that hides + * the semantic referent RTE's refname. (That could be either the JOIN RTE + * in which this ParseNamespaceColumn entry exists, or some lower join level.) + * + * If an RTE contains a dropped column, its ParseNamespaceColumn struct + * is all-zeroes. (Conventionally, test for p_varno == 0 to detect this.) + */ +struct ParseNamespaceColumn +{ + Index p_varno; /* rangetable index */ + AttrNumber p_varattno; /* attribute number of the column */ + Oid p_vartype; /* pg_type OID */ + int32 p_vartypmod; /* type modifier value */ + Oid p_varcollid; /* OID of collation, or InvalidOid */ + Index p_varnosyn; /* rangetable index of syntactic referent */ + AttrNumber p_varattnosyn; /* attribute number of syntactic referent */ + bool p_dontexpand; /* not included in star expansion */ +}; + +/* Support for parser_errposition_callback function */ +typedef struct ParseCallbackState +{ + ParseState *pstate; + int location; + ErrorContextCallback errcallback; +} ParseCallbackState; + + +extern ParseState *make_parsestate(ParseState *parentParseState); +extern void free_parsestate(ParseState *pstate); +extern int parser_errposition(ParseState *pstate, int location); + +extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate, + ParseState *pstate, int location); +extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate); + +extern void transformContainerType(Oid *containerType, int32 *containerTypmod); + +extern SubscriptingRef *transformContainerSubscripts(ParseState *pstate, + Node *containerBase, + Oid containerType, + int32 containerTypMod, + List *indirection, + bool isAssignment); +extern Const *make_const(ParseState *pstate, A_Const *aconst); + +#endif /* PARSE_NODE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_oper.h b/platform/dbops/binaries/postgres/include/server/parser/parse_oper.h new file mode 100644 index 0000000000000000000000000000000000000000..beffe144c9a7114c52b97c0ce26d8f6e21081cb5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_oper.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * parse_oper.h + * handle operator things for parser + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_oper.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_OPER_H +#define PARSE_OPER_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" + + +typedef HeapTuple Operator; + +/* Routines to look up an operator given name and exact input type(s) */ +extern Oid LookupOperName(ParseState *pstate, List *opername, + Oid oprleft, Oid oprright, + bool noError, int location); +extern Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError); + +/* Routines to find operators matching a name and given input types */ +/* NB: the selected operator may require coercion of the input types! */ +extern Operator oper(ParseState *pstate, List *opname, Oid ltypeId, + Oid rtypeId, bool noError, int location); +extern Operator left_oper(ParseState *pstate, List *op, Oid arg, + bool noError, int location); + +/* Routines to find operators that DO NOT require coercion --- ie, their */ +/* input types are either exactly as given, or binary-compatible */ +extern Operator compatible_oper(ParseState *pstate, List *op, + Oid arg1, Oid arg2, + bool noError, int location); + +/* currently no need for compatible_left_oper/compatible_right_oper */ + +/* Error reporting support */ +extern const char *op_signature_string(List *op, Oid arg1, Oid arg2); + +/* Routines for identifying "<", "=", ">" operators for a type */ +extern void get_sort_group_operators(Oid argtype, + bool needLT, bool needEQ, bool needGT, + Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, + bool *isHashable); + +/* Convenience routines for common calls on the above */ +extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError); + +/* Extract operator OID or underlying-function OID from an Operator tuple */ +extern Oid oprid(Operator op); +extern Oid oprfuncid(Operator op); + +/* Build expression tree for an operator invocation */ +extern Expr *make_op(ParseState *pstate, List *opname, + Node *ltree, Node *rtree, Node *last_srf, int location); +extern Expr *make_scalar_array_op(ParseState *pstate, List *opname, + bool useOr, + Node *ltree, Node *rtree, int location); + +#endif /* PARSE_OPER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_param.h b/platform/dbops/binaries/postgres/include/server/parser/parse_param.h new file mode 100644 index 0000000000000000000000000000000000000000..6459d4ab6f3eaeccc0c5193087f4ecada07408b9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_param.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * parse_param.h + * handle parameters in parser + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_param.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_PARAM_H +#define PARSE_PARAM_H + +#include "parser/parse_node.h" + +extern void setup_parse_fixed_parameters(ParseState *pstate, + const Oid *paramTypes, int numParams); +extern void setup_parse_variable_parameters(ParseState *pstate, + Oid **paramTypes, int *numParams); +extern void check_variable_parameters(ParseState *pstate, Query *query); +extern bool query_contains_extern_params(Query *query); + +#endif /* PARSE_PARAM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_relation.h b/platform/dbops/binaries/postgres/include/server/parser/parse_relation.h new file mode 100644 index 0000000000000000000000000000000000000000..bea2da549617a6e58cf168be3a1ce91ab832a420 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_relation.h @@ -0,0 +1,129 @@ +/*------------------------------------------------------------------------- + * + * parse_relation.h + * prototypes for parse_relation.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_relation.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_RELATION_H +#define PARSE_RELATION_H + +#include "parser/parse_node.h" + + +extern ParseNamespaceItem *refnameNamespaceItem(ParseState *pstate, + const char *schemaname, + const char *refname, + int location, + int *sublevels_up); +extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate, + const char *refname, + Index *ctelevelsup); +extern bool scanNameSpaceForENR(ParseState *pstate, const char *refname); +extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, + List *namespace2); +extern ParseNamespaceItem *GetNSItemByRangeTablePosn(ParseState *pstate, + int varno, + int sublevels_up); +extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate, + int varno, + int sublevels_up); +extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, + int rtelevelsup); +extern Node *scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, const char *colname, + int location); +extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonly, + int location); +extern void markNullableIfNeeded(ParseState *pstate, Var *var); +extern void markVarForSelectPriv(ParseState *pstate, Var *var); +extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, + int lockmode); +extern ParseNamespaceItem *addRangeTableEntry(ParseState *pstate, + RangeVar *relation, + Alias *alias, + bool inh, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForRelation(ParseState *pstate, + Relation rel, + int lockmode, + Alias *alias, + bool inh, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForSubquery(ParseState *pstate, + Query *subquery, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForFunction(ParseState *pstate, + List *funcnames, + List *funcexprs, + List *coldeflists, + RangeFunction *rangefunc, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForValues(ParseState *pstate, + List *exprs, + List *coltypes, + List *coltypmods, + List *colcollations, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForTableFunc(ParseState *pstate, + TableFunc *tf, + Alias *alias, + bool lateral, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForJoin(ParseState *pstate, + List *colnames, + ParseNamespaceColumn *nscolumns, + JoinType jointype, + int nummergedcols, + List *aliasvars, + List *leftcols, + List *rightcols, + Alias *join_using_alias, + Alias *alias, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForCTE(ParseState *pstate, + CommonTableExpr *cte, + Index levelsup, + RangeVar *rv, + bool inFromCl); +extern ParseNamespaceItem *addRangeTableEntryForENR(ParseState *pstate, + RangeVar *rv, + bool inFromCl); +extern RTEPermissionInfo *addRTEPermissionInfo(List **rteperminfos, + RangeTblEntry *rte); +extern RTEPermissionInfo *getRTEPermissionInfo(List *rteperminfos, + RangeTblEntry *rte); +extern bool isLockedRefname(ParseState *pstate, const char *refname); +extern void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, + bool addToJoinList, + bool addToRelNameSpace, bool addToVarNameSpace); +extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn(); +extern void errorMissingColumn(ParseState *pstate, + const char *relname, const char *colname, int location) pg_attribute_noreturn(); +extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, + int location, bool include_dropped, + List **colnames, List **colvars); +extern List *expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, int location, + List **colnames); +extern List *expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, + int sublevels_up, bool require_col_privs, + int location); +extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK); +extern const NameData *attnumAttName(Relation rd, int attid); +extern Oid attnumTypeId(Relation rd, int attid); +extern Oid attnumCollationId(Relation rd, int attid); +extern bool isQueryUsingTempRelation(Query *query); + +#endif /* PARSE_RELATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_target.h b/platform/dbops/binaries/postgres/include/server/parser/parse_target.h new file mode 100644 index 0000000000000000000000000000000000000000..3281f6349463103281b13306ea9074c991e2170d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_target.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * parse_target.h + * handle target lists + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_target.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_TARGET_H +#define PARSE_TARGET_H + +#include "parser/parse_node.h" + + +extern List *transformTargetList(ParseState *pstate, List *targetlist, + ParseExprKind exprKind); +extern List *transformExpressionList(ParseState *pstate, List *exprlist, + ParseExprKind exprKind, bool allowDefault); +extern void resolveTargetListUnknowns(ParseState *pstate, List *targetlist); +extern void markTargetListOrigins(ParseState *pstate, List *targetlist); +extern TargetEntry *transformTargetEntry(ParseState *pstate, + Node *node, Node *expr, ParseExprKind exprKind, + char *colname, bool resjunk); +extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr, + ParseExprKind exprKind, + const char *colname, + int attrno, + List *indirection, + int location); +extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, + char *colname, int attrno, + List *indirection, + int location); +extern Node *transformAssignmentIndirection(ParseState *pstate, + Node *basenode, + const char *targetName, + bool targetIsSubscripting, + Oid targetTypeId, + int32 targetTypMod, + Oid targetCollation, + List *indirection, + ListCell *indirection_cell, + Node *rhs, + CoercionContext ccontext, + int location); +extern List *checkInsertTargets(ParseState *pstate, List *cols, + List **attrnos); +extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var, + int levelsup); +extern char *FigureColname(Node *node); +extern char *FigureIndexColname(Node *node); + +#endif /* PARSE_TARGET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_type.h b/platform/dbops/binaries/postgres/include/server/parser/parse_type.h new file mode 100644 index 0000000000000000000000000000000000000000..b62e7a6ce99a800a5db76583ee6bf707fc2e20a4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_type.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * parse_type.h + * handle type operations for parser + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_type.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_TYPE_H +#define PARSE_TYPE_H + +#include "access/htup.h" +#include "parser/parse_node.h" + + +typedef HeapTuple Type; + +extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName, + int32 *typmod_p, bool missing_ok); +extern Type LookupTypeNameExtended(ParseState *pstate, + const TypeName *typeName, int32 *typmod_p, + bool temp_ok, bool missing_ok); +extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, + bool missing_ok); +extern Type typenameType(ParseState *pstate, const TypeName *typeName, + int32 *typmod_p); +extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName); +extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, + Oid *typeid_p, int32 *typmod_p); + +extern char *TypeNameToString(const TypeName *typeName); +extern char *TypeNameListToString(List *typenames); + +extern Oid LookupCollation(ParseState *pstate, List *collnames, int location); +extern Oid GetColumnDefCollation(ParseState *pstate, const ColumnDef *coldef, Oid typeOid); + +extern Type typeidType(Oid id); + +extern Oid typeTypeId(Type tp); +extern int16 typeLen(Type t); +extern bool typeByVal(Type t); +extern char *typeTypeName(Type t); +extern Oid typeTypeRelid(Type typ); +extern Oid typeTypeCollation(Type typ); +extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod); + +extern Oid typeidTypeRelid(Oid type_id); +extern Oid typeOrDomainTypeRelid(Oid type_id); + +extern TypeName *typeStringToTypeName(const char *str, Node *escontext); +extern bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, + Node *escontext); + +/* true if typeid is composite, or domain over composite, but not RECORD */ +#define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid) + +#endif /* PARSE_TYPE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parse_utilcmd.h b/platform/dbops/binaries/postgres/include/server/parser/parse_utilcmd.h new file mode 100644 index 0000000000000000000000000000000000000000..1406589477942b3df8ec4ef5fe02acc71fe668eb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parse_utilcmd.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * parse_utilcmd.h + * parse analysis for utility commands + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parse_utilcmd.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSE_UTILCMD_H +#define PARSE_UTILCMD_H + +#include "parser/parse_node.h" + +struct AttrMap; /* avoid including attmap.h here */ + + +extern List *transformCreateStmt(CreateStmt *stmt, const char *queryString); +extern AlterTableStmt *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, + const char *queryString, + List **beforeStmts, + List **afterStmts); +extern IndexStmt *transformIndexStmt(Oid relid, IndexStmt *stmt, + const char *queryString); +extern CreateStatsStmt *transformStatsStmt(Oid relid, CreateStatsStmt *stmt, + const char *queryString); +extern void transformRuleStmt(RuleStmt *stmt, const char *queryString, + List **actions, Node **whereClause); +extern List *transformCreateSchemaStmtElements(List *schemaElts, + const char *schemaName); +extern PartitionBoundSpec *transformPartitionBound(ParseState *pstate, Relation parent, + PartitionBoundSpec *spec); +extern List *expandTableLikeClause(RangeVar *heapRel, + TableLikeClause *table_like_clause); +extern IndexStmt *generateClonedIndexStmt(RangeVar *heapRel, + Relation source_idx, + const struct AttrMap *attmap, + Oid *constraintOid); + +#endif /* PARSE_UTILCMD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parser.h b/platform/dbops/binaries/postgres/include/server/parser/parser.h new file mode 100644 index 0000000000000000000000000000000000000000..be184ec50667c4c6c7daa0a1c15b46963186f8b5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parser.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * parser.h + * Definitions for the "raw" parser (flex and bison phases only) + * + * This is the external API for the raw lexing/parsing functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parser.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSER_H +#define PARSER_H + +#include "nodes/parsenodes.h" + + +/* + * RawParseMode determines the form of the string that raw_parser() accepts: + * + * RAW_PARSE_DEFAULT: parse a semicolon-separated list of SQL commands, + * and return a List of RawStmt nodes. + * + * RAW_PARSE_TYPE_NAME: parse a type name, and return a one-element List + * containing a TypeName node. + * + * RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return + * a one-element List containing a RawStmt node. + * + * RAW_PARSE_PLPGSQL_ASSIGNn: parse a PL/pgSQL assignment statement, + * and return a one-element List containing a RawStmt node. "n" + * gives the number of dotted names comprising the target ColumnRef. + */ +typedef enum +{ + RAW_PARSE_DEFAULT = 0, + RAW_PARSE_TYPE_NAME, + RAW_PARSE_PLPGSQL_EXPR, + RAW_PARSE_PLPGSQL_ASSIGN1, + RAW_PARSE_PLPGSQL_ASSIGN2, + RAW_PARSE_PLPGSQL_ASSIGN3, +} RawParseMode; + +/* Values for the backslash_quote GUC */ +typedef enum +{ + BACKSLASH_QUOTE_OFF, + BACKSLASH_QUOTE_ON, + BACKSLASH_QUOTE_SAFE_ENCODING, +} BackslashQuoteType; + +/* GUC variables in scan.l (every one of these is a bad idea :-() */ +extern PGDLLIMPORT int backslash_quote; +extern PGDLLIMPORT bool escape_string_warning; +extern PGDLLIMPORT bool standard_conforming_strings; + + +/* Primary entry point for the raw parsing functions */ +extern List *raw_parser(const char *str, RawParseMode mode); + +/* Utility functions exported by gram.y (perhaps these should be elsewhere) */ +extern List *SystemFuncName(char *name); +extern TypeName *SystemTypeName(char *name); + +#endif /* PARSER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/parsetree.h b/platform/dbops/binaries/postgres/include/server/parser/parsetree.h new file mode 100644 index 0000000000000000000000000000000000000000..3d51cd1530f5d92d9ca0bb11cdcd98d95b59f320 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/parsetree.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * parsetree.h + * Routines to access various components and subcomponents of + * parse trees. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/parsetree.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARSETREE_H +#define PARSETREE_H + +#include "nodes/parsenodes.h" + + +/* ---------------- + * range table operations + * ---------------- + */ + +/* + * rt_fetch + * + * NB: this will crash and burn if handed an out-of-range RT index + */ +#define rt_fetch(rangetable_index, rangetable) \ + ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1)) + +/* + * Given an RTE and an attribute number, return the appropriate + * variable name or alias for that attribute of that RTE. + */ +extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum); + +/* + * Check whether an attribute of an RTE has been dropped + */ +extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte, + AttrNumber attnum); + + +/* ---------------- + * target list operations + * ---------------- + */ + +extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); + +/* ---------------- + * FOR UPDATE/SHARE info + * ---------------- + */ + +extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex); + +#endif /* PARSETREE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/scanner.h b/platform/dbops/binaries/postgres/include/server/parser/scanner.h new file mode 100644 index 0000000000000000000000000000000000000000..d6293b1e8787213a0a93ffb441087243f3b820fd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/scanner.h @@ -0,0 +1,150 @@ +/*------------------------------------------------------------------------- + * + * scanner.h + * API for the core scanner (flex machine) + * + * The core scanner is also used by PL/pgSQL, so we provide a public API + * for it. However, the rest of the backend is only expected to use the + * higher-level API provided by parser.h. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/scanner.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCANNER_H +#define SCANNER_H + +#include "common/keywords.h" + +/* + * The scanner returns extra data about scanned tokens in this union type. + * Note that this is a subset of the fields used in YYSTYPE of the bison + * parsers built atop the scanner. + */ +typedef union core_YYSTYPE +{ + int ival; /* for integer literals */ + char *str; /* for identifiers and non-integer literals */ + const char *keyword; /* canonical spelling of keywords */ +} core_YYSTYPE; + +/* + * We track token locations in terms of byte offsets from the start of the + * source string, not the column number/line number representation that + * bison uses by default. Also, to minimize overhead we track only one + * location (usually the first token location) for each construct, not + * the beginning and ending locations as bison does by default. It's + * therefore sufficient to make YYLTYPE an int. + */ +#define YYLTYPE int + +/* + * Another important component of the scanner's API is the token code numbers. + * However, those are not defined in this file, because bison insists on + * defining them for itself. The token codes used by the core scanner are + * the ASCII characters plus these: + * %token IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op + * %token ICONST PARAM + * %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER + * %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS + * The above token definitions *must* be the first ones declared in any + * bison parser built atop this scanner, so that they will have consistent + * numbers assigned to them (specifically, IDENT = 258 and so on). + */ + +/* + * The YY_EXTRA data that a flex scanner allows us to pass around. + * Private state needed by the core scanner goes here. Note that the actual + * yy_extra struct may be larger and have this as its first component, thus + * allowing the calling parser to keep some fields of its own in YY_EXTRA. + */ +typedef struct core_yy_extra_type +{ + /* + * The string the scanner is physically scanning. We keep this mainly so + * that we can cheaply compute the offset of the current token (yytext). + */ + char *scanbuf; + Size scanbuflen; + + /* + * The keyword list to use, and the associated grammar token codes. + */ + const ScanKeywordList *keywordlist; + const uint16 *keyword_tokens; + + /* + * Scanner settings to use. These are initialized from the corresponding + * GUC variables by scanner_init(). Callers can modify them after + * scanner_init() if they don't want the scanner's behavior to follow the + * prevailing GUC settings. + */ + int backslash_quote; + bool escape_string_warning; + bool standard_conforming_strings; + + /* + * literalbuf is used to accumulate literal values when multiple rules are + * needed to parse a single literal. Call startlit() to reset buffer to + * empty, addlit() to add text. NOTE: the string in literalbuf is NOT + * necessarily null-terminated, but there always IS room to add a trailing + * null at offset literallen. We store a null only when we need it. + */ + char *literalbuf; /* palloc'd expandable buffer */ + int literallen; /* actual current string length */ + int literalalloc; /* current allocated buffer size */ + + /* + * Random assorted scanner state. + */ + int state_before_str_stop; /* start cond. before end quote */ + int xcdepth; /* depth of nesting in slash-star comments */ + char *dolqstart; /* current $foo$ quote start string */ + YYLTYPE save_yylloc; /* one-element stack for PUSH_YYLLOC() */ + + /* first part of UTF16 surrogate pair for Unicode escapes */ + int32 utf16_first_part; + + /* state variables for literal-lexing warnings */ + bool warn_on_first_escape; + bool saw_non_ascii; +} core_yy_extra_type; + +/* + * The type of yyscanner is opaque outside scan.l. + */ +typedef void *core_yyscan_t; + +/* Support for scanner_errposition_callback function */ +typedef struct ScannerCallbackState +{ + core_yyscan_t yyscanner; + int location; + ErrorContextCallback errcallback; +} ScannerCallbackState; + + +/* Constant data exported from parser/scan.l */ +extern PGDLLIMPORT const uint16 ScanKeywordTokens[]; + +/* Entry points in parser/scan.l */ +extern core_yyscan_t scanner_init(const char *str, + core_yy_extra_type *yyext, + const ScanKeywordList *keywordlist, + const uint16 *keyword_tokens); +extern void scanner_finish(core_yyscan_t yyscanner); +extern int core_yylex(core_YYSTYPE *yylval_param, YYLTYPE *yylloc_param, + core_yyscan_t yyscanner); +extern int scanner_errposition(int location, core_yyscan_t yyscanner); +extern void setup_scanner_errposition_callback(ScannerCallbackState *scbstate, + core_yyscan_t yyscanner, + int location); +extern void cancel_scanner_errposition_callback(ScannerCallbackState *scbstate); +extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn(); + +#endif /* SCANNER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/parser/scansup.h b/platform/dbops/binaries/postgres/include/server/parser/scansup.h new file mode 100644 index 0000000000000000000000000000000000000000..4b68ddc2d8dac390df212a42484d8303438083a3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/parser/scansup.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * scansup.h + * scanner support routines used by the core lexer + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/parser/scansup.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SCANSUP_H +#define SCANSUP_H + +extern char *downcase_truncate_identifier(const char *ident, int len, + bool warn); + +extern char *downcase_identifier(const char *ident, int len, + bool warn, bool truncate); + +extern void truncate_identifier(char *ident, int len, bool warn); + +extern bool scanner_isspace(char ch); + +#endif /* SCANSUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/partitioning/partbounds.h b/platform/dbops/binaries/postgres/include/server/partitioning/partbounds.h new file mode 100644 index 0000000000000000000000000000000000000000..3d9cc1031f7319b1b16a1d06027f73e273299d86 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/partitioning/partbounds.h @@ -0,0 +1,146 @@ +/*------------------------------------------------------------------------- + * + * partbounds.h + * + * Copyright (c) 2007-2024, PostgreSQL Global Development Group + * + * src/include/partitioning/partbounds.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTBOUNDS_H +#define PARTBOUNDS_H + +#include "fmgr.h" +#include "parser/parse_node.h" +#include "partitioning/partdefs.h" + +struct RelOptInfo; /* avoid including pathnodes.h here */ + + +/* + * PartitionBoundInfoData encapsulates a set of partition bounds. It is + * usually associated with partitioned tables as part of its partition + * descriptor, but may also be used to represent a virtual partitioned + * table such as a partitioned joinrel within the planner. + * + * A list partition datum that is known to be NULL is never put into the + * datums array. Instead, it is tracked using the null_index field. + * + * In the case of range partitioning, ndatums will typically be far less than + * 2 * nparts, because a partition's upper bound and the next partition's lower + * bound are the same in most common cases, and we only store one of them (the + * upper bound). In case of hash partitioning, ndatums will be the same as the + * number of partitions. + * + * For range and list partitioned tables, datums is an array of datum-tuples + * with key->partnatts datums each. For hash partitioned tables, it is an array + * of datum-tuples with 2 datums, modulus and remainder, corresponding to a + * given partition. + * + * The datums in datums array are arranged in increasing order as defined by + * functions qsort_partition_rbound_cmp(), qsort_partition_list_value_cmp() and + * qsort_partition_hbound_cmp() for range, list and hash partitioned tables + * respectively. For range and list partitions this simply means that the + * datums in the datums array are arranged in increasing order as defined by + * the partition key's operator classes and collations. + * + * In the case of list partitioning, the indexes array stores one entry for + * each datum-array entry, which is the index of the partition that accepts + * rows matching that datum. So nindexes == ndatums. + * + * In the case of range partitioning, the indexes array stores one entry per + * distinct range datum, which is the index of the partition for which that + * datum is an upper bound (or -1 for a "gap" that has no partition). It is + * convenient to have an extra -1 entry representing values above the last + * range datum, so nindexes == ndatums + 1. + * + * In the case of hash partitioning, the number of entries in the indexes + * array is the same as the greatest modulus amongst all partitions (which + * is a multiple of all partition moduli), so nindexes == greatest modulus. + * The indexes array is indexed according to the hash key's remainder modulo + * the greatest modulus, and it contains either the partition index accepting + * that remainder, or -1 if there is no partition for that remainder. + * + * For LIST partitioned tables, we track the partition indexes of partitions + * which are possibly "interleaved" partitions. A partition is considered + * interleaved if it allows multiple values and there exists at least one + * other partition which could contain a value that lies between those values. + * For example, if a partition exists FOR VALUES IN(3,5) and another partition + * exists FOR VALUES IN (4), then the IN(3,5) partition is an interleaved + * partition. The same is possible with DEFAULT partitions since they can + * contain any value that does not belong in another partition. This field + * only serves as proof that a particular partition is not interleaved, not + * proof that it is interleaved. When we're uncertain, we marked the + * partition as interleaved. The interleaved_parts field is only ever set for + * RELOPT_BASEREL and RELOPT_OTHER_MEMBER_REL, it is always left NULL for join + * relations. + */ +typedef struct PartitionBoundInfoData +{ + PartitionStrategy strategy; /* hash, list or range? */ + int ndatums; /* Length of the datums[] array */ + Datum **datums; + PartitionRangeDatumKind **kind; /* The kind of each range bound datum; + * NULL for hash and list partitioned + * tables */ + Bitmapset *interleaved_parts; /* Partition indexes of partitions which + * may be interleaved. See above. This is + * only set for LIST partitioned tables */ + int nindexes; /* Length of the indexes[] array */ + int *indexes; /* Partition indexes */ + int null_index; /* Index of the null-accepting partition; -1 + * if there isn't one */ + int default_index; /* Index of the default partition; -1 if there + * isn't one */ +} PartitionBoundInfoData; + +#define partition_bound_accepts_nulls(bi) ((bi)->null_index != -1) +#define partition_bound_has_default(bi) ((bi)->default_index != -1) + +extern int get_hash_partition_greatest_modulus(PartitionBoundInfo bound); +extern uint64 compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc, + const Oid *partcollation, + const Datum *values, const bool *isnull); +extern List *get_qual_from_partbound(Relation parent, + PartitionBoundSpec *spec); +extern PartitionBoundInfo partition_bounds_create(PartitionBoundSpec **boundspecs, + int nparts, PartitionKey key, int **mapping); +extern bool partition_bounds_equal(int partnatts, int16 *parttyplen, + bool *parttypbyval, PartitionBoundInfo b1, + PartitionBoundInfo b2); +extern PartitionBoundInfo partition_bounds_copy(PartitionBoundInfo src, + PartitionKey key); +extern PartitionBoundInfo partition_bounds_merge(int partnatts, + FmgrInfo *partsupfunc, + Oid *partcollation, + struct RelOptInfo *outer_rel, + struct RelOptInfo *inner_rel, + JoinType jointype, + List **outer_parts, + List **inner_parts); +extern bool partitions_are_ordered(PartitionBoundInfo boundinfo, + Bitmapset *live_parts); +extern void check_new_partition_bound(char *relname, Relation parent, + PartitionBoundSpec *spec, + ParseState *pstate); +extern void check_default_partition_contents(Relation parent, + Relation default_rel, + PartitionBoundSpec *new_spec); + +extern int32 partition_rbound_datum_cmp(FmgrInfo *partsupfunc, + Oid *partcollation, + Datum *rb_datums, PartitionRangeDatumKind *rb_kind, + Datum *tuple_datums, int n_tuple_datums); +extern int partition_list_bsearch(FmgrInfo *partsupfunc, + Oid *partcollation, + PartitionBoundInfo boundinfo, + Datum value, bool *is_equal); +extern int partition_range_datum_bsearch(FmgrInfo *partsupfunc, + Oid *partcollation, + PartitionBoundInfo boundinfo, + int nvalues, Datum *values, bool *is_equal); +extern int partition_hash_bsearch(PartitionBoundInfo boundinfo, + int modulus, int remainder); + +#endif /* PARTBOUNDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/partitioning/partdefs.h b/platform/dbops/binaries/postgres/include/server/partitioning/partdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..fcfd18f2ba1aa81b233bd0f3f8bcf5c165cff8af --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/partitioning/partdefs.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * partdefs.h + * Base definitions for partitioned table handling + * + * Copyright (c) 2007-2024, PostgreSQL Global Development Group + * + * src/include/partitioning/partdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTDEFS_H +#define PARTDEFS_H + + +typedef struct PartitionBoundInfoData *PartitionBoundInfo; + +typedef struct PartitionKeyData *PartitionKey; + +typedef struct PartitionBoundSpec PartitionBoundSpec; + +typedef struct PartitionDescData *PartitionDesc; + +typedef struct PartitionDirectoryData *PartitionDirectory; + +#endif /* PARTDEFS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/partitioning/partdesc.h b/platform/dbops/binaries/postgres/include/server/partitioning/partdesc.h new file mode 100644 index 0000000000000000000000000000000000000000..87abfd76d78891b2bcbdfb22d782b625e881a6b2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/partitioning/partdesc.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * partdesc.h + * + * Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/partitioning/partdesc.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PARTDESC_H +#define PARTDESC_H + +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* + * Information about partitions of a partitioned table. + * + * For partitioned tables where detached partitions exist, we only cache + * descriptors that include all partitions, including detached; when we're + * requested a descriptor without the detached partitions, we create one + * afresh each time. (The reason for this is that the set of detached + * partitions that are visible to each caller depends on the snapshot it has, + * so it's pretty much impossible to evict a descriptor from cache at the + * right time.) + */ +typedef struct PartitionDescData +{ + int nparts; /* Number of partitions */ + bool detached_exist; /* Are there any detached partitions? */ + Oid *oids; /* Array of 'nparts' elements containing + * partition OIDs in order of their bounds */ + bool *is_leaf; /* Array of 'nparts' elements storing whether + * the corresponding 'oids' element belongs to + * a leaf partition or not */ + PartitionBoundInfo boundinfo; /* collection of partition bounds */ + + /* Caching fields to cache lookups in get_partition_for_tuple() */ + + /* + * Index into the PartitionBoundInfo's datum array for the last found + * partition or -1 if none. + */ + int last_found_datum_index; + + /* + * Partition index of the last found partition or -1 if none has been + * found yet. + */ + int last_found_part_index; + + /* + * For LIST partitioning, this is the number of times in a row that the + * datum we're looking for a partition for matches the datum in the + * last_found_datum_index index of the boundinfo->datums array. For RANGE + * partitioning, this is the number of times in a row we've found that the + * datum we're looking for a partition for falls into the range of the + * partition corresponding to the last_found_datum_index index of the + * boundinfo->datums array. + */ + int last_found_count; +} PartitionDescData; + + +extern PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached); + +extern PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached); +extern PartitionDesc PartitionDirectoryLookup(PartitionDirectory, Relation); +extern void DestroyPartitionDirectory(PartitionDirectory pdir); + +extern Oid get_default_oid_from_partdesc(PartitionDesc partdesc); + +#endif /* PARTCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/partitioning/partprune.h b/platform/dbops/binaries/postgres/include/server/partitioning/partprune.h new file mode 100644 index 0000000000000000000000000000000000000000..bd490d154f3553b796d2f459ea8313794bebd048 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/partitioning/partprune.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * partprune.h + * prototypes for partprune.c + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/partitioning/partprune.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTPRUNE_H +#define PARTPRUNE_H + +#include "nodes/execnodes.h" +#include "partitioning/partdefs.h" + +struct PlannerInfo; /* avoid including pathnodes.h here */ +struct RelOptInfo; + + +/* + * PartitionPruneContext + * Stores information needed at runtime for pruning computations + * related to a single partitioned table. + * + * strategy Partition strategy, e.g. LIST, RANGE, HASH. + * partnatts Number of columns in the partition key. + * nparts Number of partitions in this partitioned table. + * boundinfo Partition boundary info for the partitioned table. + * partcollation Array of partnatts elements, storing the collations of the + * partition key columns. + * partsupfunc Array of FmgrInfos for the comparison or hashing functions + * associated with the partition keys (partnatts elements). + * (This points into the partrel's partition key, typically.) + * stepcmpfuncs Array of FmgrInfos for the comparison or hashing function + * for each pruning step and partition key. + * ppccontext Memory context holding this PartitionPruneContext's + * subsidiary data, such as the FmgrInfos. + * planstate Points to the parent plan node's PlanState when called + * during execution; NULL when called from the planner. + * exprcontext ExprContext to use when evaluating pruning expressions + * exprstates Array of ExprStates, indexed as per PruneCxtStateIdx; one + * for each partition key in each pruning step. Allocated if + * planstate is non-NULL, otherwise NULL. + */ +typedef struct PartitionPruneContext +{ + char strategy; + int partnatts; + int nparts; + PartitionBoundInfo boundinfo; + Oid *partcollation; + FmgrInfo *partsupfunc; + FmgrInfo *stepcmpfuncs; + MemoryContext ppccontext; + PlanState *planstate; + ExprContext *exprcontext; + ExprState **exprstates; +} PartitionPruneContext; + +/* + * PruneCxtStateIdx() computes the correct index into the stepcmpfuncs[] + * and exprstates[] arrays for step step_id and partition key column keyno. + * (Note: there is code that assumes the entries for a given step are + * sequential, so this is not chosen freely.) + */ +#define PruneCxtStateIdx(partnatts, step_id, keyno) \ + ((partnatts) * (step_id) + (keyno)) + +extern PartitionPruneInfo *make_partition_pruneinfo(struct PlannerInfo *root, + struct RelOptInfo *parentrel, + List *subpaths, + List *prunequal); +extern Bitmapset *prune_append_rel_partitions(struct RelOptInfo *rel); +extern Bitmapset *get_matching_partitions(PartitionPruneContext *context, + List *pruning_steps); + +#endif /* PARTPRUNE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics.h b/platform/dbops/binaries/postgres/include/server/port/atomics.h new file mode 100644 index 0000000000000000000000000000000000000000..36a9b0925e131b708c58793787c95d2faf1c7fc3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics.h @@ -0,0 +1,606 @@ +/*------------------------------------------------------------------------- + * + * atomics.h + * Atomic operations. + * + * Hardware and compiler dependent functions for manipulating memory + * atomically and dealing with cache coherency. Used to implement locking + * facilities and lockless algorithms/data structures. + * + * To bring up postgres on a platform/compiler at the very least + * implementations for the following operations should be provided: + * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier() + * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32() + * * pg_atomic_test_set_flag(), pg_atomic_init_flag(), pg_atomic_clear_flag() + * * PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY should be defined if appropriate. + * + * There exist generic, hardware independent, implementations for several + * compilers which might be sufficient, although possibly not optimal, for a + * new platform. If no such generic implementation is available spinlocks (or + * even OS provided semaphores) will be used to implement the API. + * + * Implement _u64 atomics if and only if your platform can use them + * efficiently (and obviously correctly). + * + * Use higher level functionality (lwlocks, spinlocks, heavyweight locks) + * whenever possible. Writing correct code using these facilities is hard. + * + * For an introduction to using memory barriers within the PostgreSQL backend, + * see src/backend/storage/lmgr/README.barrier + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATOMICS_H +#define ATOMICS_H + +#ifdef FRONTEND +#error "atomics.h may not be included from frontend code" +#endif + +#define INSIDE_ATOMICS_H + +#include + +/* + * First a set of architecture specific files is included. + * + * These files can provide the full set of atomics or can do pretty much + * nothing if all the compilers commonly used on these platforms provide + * usable generics. + * + * Don't add an inline assembly of the actual atomic operations if all the + * common implementations of your platform provide intrinsics. Intrinsics are + * much easier to understand and potentially support more architectures. + * + * It will often make sense to define memory barrier semantics here, since + * e.g. generic compiler intrinsics for x86 memory barriers can't know that + * postgres doesn't need x86 read/write barriers do anything more than a + * compiler barrier. + * + */ +#if defined(__arm__) || defined(__arm) || defined(__aarch64__) +#include "port/atomics/arch-arm.h" +#elif defined(__i386__) || defined(__i386) || defined(__x86_64__) +#include "port/atomics/arch-x86.h" +#elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) +#include "port/atomics/arch-ppc.h" +#elif defined(__hppa) || defined(__hppa__) +#include "port/atomics/arch-hppa.h" +#endif + +/* + * Compiler specific, but architecture independent implementations. + * + * Provide architecture independent implementations of the atomic + * facilities. At the very least compiler barriers should be provided, but a + * full implementation of + * * pg_compiler_barrier(), pg_write_barrier(), pg_read_barrier() + * * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32() + * using compiler intrinsics are a good idea. + */ +/* + * gcc or compatible, including clang and icc. + */ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#include "port/atomics/generic-gcc.h" +#elif defined(_MSC_VER) +#include "port/atomics/generic-msvc.h" +#elif defined(__SUNPRO_C) && !defined(__GNUC__) +#include "port/atomics/generic-sunpro.h" +#else +/* + * Unsupported compiler, we'll likely use slower fallbacks... At least + * compiler barriers should really be provided. + */ +#endif + +/* + * Provide a full fallback of the pg_*_barrier(), pg_atomic**_flag and + * pg_atomic_* APIs for platforms without sufficient spinlock and/or atomics + * support. In the case of spinlock backed atomics the emulation is expected + * to be efficient, although less so than native atomics support. + */ +#include "port/atomics/fallback.h" + +/* + * Provide additional operations using supported infrastructure. These are + * expected to be efficient if the underlying atomic operations are efficient. + */ +#include "port/atomics/generic.h" + + +/* + * pg_compiler_barrier - prevent the compiler from moving code across + * + * A compiler barrier need not (and preferably should not) emit any actual + * machine code, but must act as an optimization fence: the compiler must not + * reorder loads or stores to main memory around the barrier. However, the + * CPU may still reorder loads or stores at runtime, if the architecture's + * memory model permits this. + */ +#define pg_compiler_barrier() pg_compiler_barrier_impl() + +/* + * pg_memory_barrier - prevent the CPU from reordering memory access + * + * A memory barrier must act as a compiler barrier, and in addition must + * guarantee that all loads and stores issued prior to the barrier are + * completed before any loads or stores issued after the barrier. Unless + * loads and stores are totally ordered (which is not the case on most + * architectures) this requires issuing some sort of memory fencing + * instruction. + */ +#define pg_memory_barrier() pg_memory_barrier_impl() + +/* + * pg_(read|write)_barrier - prevent the CPU from reordering memory access + * + * A read barrier must act as a compiler barrier, and in addition must + * guarantee that any loads issued prior to the barrier are completed before + * any loads issued after the barrier. Similarly, a write barrier acts + * as a compiler barrier, and also orders stores. Read and write barriers + * are thus weaker than a full memory barrier, but stronger than a compiler + * barrier. In practice, on machines with strong memory ordering, read and + * write barriers may require nothing more than a compiler barrier. + */ +#define pg_read_barrier() pg_read_barrier_impl() +#define pg_write_barrier() pg_write_barrier_impl() + +/* + * Spinloop delay - Allow CPU to relax in busy loops + */ +#define pg_spin_delay() pg_spin_delay_impl() + +/* + * pg_atomic_init_flag - initialize atomic flag. + * + * No barrier semantics. + */ +static inline void +pg_atomic_init_flag(volatile pg_atomic_flag *ptr) +{ + pg_atomic_init_flag_impl(ptr); +} + +/* + * pg_atomic_test_set_flag - TAS() + * + * Returns true if the flag has successfully been set, false otherwise. + * + * Acquire (including read barrier) semantics. + */ +static inline bool +pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_test_set_flag_impl(ptr); +} + +/* + * pg_atomic_unlocked_test_flag - Check if the lock is free + * + * Returns true if the flag currently is not set, false otherwise. + * + * No barrier semantics. + */ +static inline bool +pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_unlocked_test_flag_impl(ptr); +} + +/* + * pg_atomic_clear_flag - release lock set by TAS() + * + * Release (including write barrier) semantics. + */ +static inline void +pg_atomic_clear_flag(volatile pg_atomic_flag *ptr) +{ + pg_atomic_clear_flag_impl(ptr); +} + + +/* + * pg_atomic_init_u32 - initialize atomic variable + * + * Has to be done before any concurrent usage.. + * + * No barrier semantics. + */ +static inline void +pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_init_u32_impl(ptr, val); +} + +/* + * pg_atomic_read_u32 - unlocked read from atomic variable. + * + * The read is guaranteed to return a value as it has been written by this or + * another process at some point in the past. There's however no cache + * coherency interaction guaranteeing the value hasn't since been written to + * again. + * + * No barrier semantics. + */ +static inline uint32 +pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_read_u32_impl(ptr); +} + +/* + * pg_atomic_read_membarrier_u32 - read with barrier semantics. + * + * This read is guaranteed to return the current value, provided that the value + * is only ever updated via operations with barrier semantics, such as + * pg_atomic_compare_exchange_u32() and pg_atomic_write_membarrier_u32(). + * While this may be less performant than pg_atomic_read_u32(), it may be + * easier to reason about correctness with this function in less performance- + * sensitive code. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_read_membarrier_u32(volatile pg_atomic_uint32 *ptr) +{ + AssertPointerAlignment(ptr, 4); + + return pg_atomic_read_membarrier_u32_impl(ptr); +} + +/* + * pg_atomic_write_u32 - write to atomic variable. + * + * The write is guaranteed to succeed as a whole, i.e. it's not possible to + * observe a partial write for any reader. Note that this correctly interacts + * with pg_atomic_compare_exchange_u32, in contrast to + * pg_atomic_unlocked_write_u32(). + * + * No barrier semantics. + */ +static inline void +pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_write_u32_impl(ptr, val); +} + +/* + * pg_atomic_unlocked_write_u32 - unlocked write to atomic variable. + * + * The write is guaranteed to succeed as a whole, i.e. it's not possible to + * observe a partial write for any reader. But note that writing this way is + * not guaranteed to correctly interact with read-modify-write operations like + * pg_atomic_compare_exchange_u32. This should only be used in cases where + * minor performance regressions due to atomics emulation are unacceptable. + * + * No barrier semantics. + */ +static inline void +pg_atomic_unlocked_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_unlocked_write_u32_impl(ptr, val); +} + +/* + * pg_atomic_write_membarrier_u32 - write with barrier semantics. + * + * The write is guaranteed to succeed as a whole, i.e., it's not possible to + * observe a partial write for any reader. Note that this correctly interacts + * with both pg_atomic_compare_exchange_u32() and + * pg_atomic_read_membarrier_u32(). While this may be less performant than + * pg_atomic_write_u32(), it may be easier to reason about correctness with + * this function in less performance-sensitive code. + * + * Full barrier semantics. + */ +static inline void +pg_atomic_write_membarrier_u32(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + AssertPointerAlignment(ptr, 4); + + pg_atomic_write_membarrier_u32_impl(ptr, val); +} + +/* + * pg_atomic_exchange_u32 - exchange newval with current value + * + * Returns the old value of 'ptr' before the swap. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + AssertPointerAlignment(ptr, 4); + + return pg_atomic_exchange_u32_impl(ptr, newval); +} + +/* + * pg_atomic_compare_exchange_u32 - CAS operation + * + * Atomically compare the current value of ptr with *expected and store newval + * iff ptr and *expected have the same value. The current value of *ptr will + * always be stored in *expected. + * + * Return true if values have been exchanged, false otherwise. + * + * Full barrier semantics. + */ +static inline bool +pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + AssertPointerAlignment(ptr, 4); + AssertPointerAlignment(expected, 4); + + return pg_atomic_compare_exchange_u32_impl(ptr, expected, newval); +} + +/* + * pg_atomic_fetch_add_u32 - atomically add to variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_add_u32_impl(ptr, add_); +} + +/* + * pg_atomic_fetch_sub_u32 - atomically subtract from variable + * + * Returns the value of ptr before the arithmetic operation. Note that sub_ + * may not be INT_MIN due to platform limitations. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + AssertPointerAlignment(ptr, 4); + Assert(sub_ != INT_MIN); + return pg_atomic_fetch_sub_u32_impl(ptr, sub_); +} + +/* + * pg_atomic_fetch_and_u32 - atomically bit-and and_ with variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_and_u32_impl(ptr, and_); +} + +/* + * pg_atomic_fetch_or_u32 - atomically bit-or or_ with variable + * + * Returns the value of ptr before the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_fetch_or_u32_impl(ptr, or_); +} + +/* + * pg_atomic_add_fetch_u32 - atomically add to variable + * + * Returns the value of ptr after the arithmetic operation. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + AssertPointerAlignment(ptr, 4); + return pg_atomic_add_fetch_u32_impl(ptr, add_); +} + +/* + * pg_atomic_sub_fetch_u32 - atomically subtract from variable + * + * Returns the value of ptr after the arithmetic operation. Note that sub_ may + * not be INT_MIN due to platform limitations. + * + * Full barrier semantics. + */ +static inline uint32 +pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + AssertPointerAlignment(ptr, 4); + Assert(sub_ != INT_MIN); + return pg_atomic_sub_fetch_u32_impl(ptr, sub_); +} + +/* ---- + * The 64 bit operations have the same semantics as their 32bit counterparts + * if they are available. Check the corresponding 32bit function for + * documentation. + * ---- + */ +static inline void +pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * Can't necessarily enforce alignment - and don't need it - when using + * the spinlock based fallback implementation. Therefore only assert when + * not using it. + */ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_init_u64_impl(ptr, val); +} + +static inline uint64 +pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_read_u64_impl(ptr); +} + +static inline uint64 +pg_atomic_read_membarrier_u64(volatile pg_atomic_uint64 *ptr) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_read_membarrier_u64_impl(ptr); +} + +static inline void +pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_write_u64_impl(ptr, val); +} + +static inline void +pg_atomic_write_membarrier_u64(volatile pg_atomic_uint64 *ptr, uint64 val) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + pg_atomic_write_membarrier_u64_impl(ptr, val); +} + +static inline uint64 +pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_exchange_u64_impl(ptr, newval); +} + +static inline bool +pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_compare_exchange_u64_impl(ptr, expected, newval); +} + +static inline uint64 +pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_add_u64_impl(ptr, add_); +} + +static inline uint64 +pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + Assert(sub_ != PG_INT64_MIN); + return pg_atomic_fetch_sub_u64_impl(ptr, sub_); +} + +static inline uint64 +pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_and_u64_impl(ptr, and_); +} + +static inline uint64 +pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_fetch_or_u64_impl(ptr, or_); +} + +static inline uint64 +pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + return pg_atomic_add_fetch_u64_impl(ptr, add_); +} + +static inline uint64 +pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + Assert(sub_ != PG_INT64_MIN); + return pg_atomic_sub_fetch_u64_impl(ptr, sub_); +} + +/* + * Monotonically advance the given variable using only atomic operations until + * it's at least the target value. Returns the latest value observed, which + * may or may not be the target value. + * + * Full barrier semantics (even when value is unchanged). + */ +static inline uint64 +pg_atomic_monotonic_advance_u64(volatile pg_atomic_uint64 *ptr, uint64 target) +{ + uint64 currval; + +#ifndef PG_HAVE_ATOMIC_U64_SIMULATION + AssertPointerAlignment(ptr, 8); +#endif + + currval = pg_atomic_read_u64_impl(ptr); + if (currval >= target) + { + pg_memory_barrier(); + return currval; + } + + while (currval < target) + { + if (pg_atomic_compare_exchange_u64(ptr, &currval, target)) + return target; + } + + return currval; +} + +#undef INSIDE_ATOMICS_H + +#endif /* ATOMICS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/arch-arm.h b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-arm.h new file mode 100644 index 0000000000000000000000000000000000000000..3ca2dbbd2da6d3e6fcf686efb1fb62fb687dd04d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-arm.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * arch-arm.h + * Atomic operations considerations specific to ARM + * + * Portions Copyright (c) 2013-2024, PostgreSQL Global Development Group + * + * NOTES: + * + * src/include/port/atomics/arch-arm.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +/* + * 64 bit atomics on ARM32 are implemented using kernel fallbacks and thus + * might be slow, so disable entirely. On ARM64 that problem doesn't exist. + */ +#if !defined(__aarch64__) +#define PG_DISABLE_64_BIT_ATOMICS +#else +/* + * Architecture Reference Manual for ARMv8 states aligned read/write to/from + * general purpose register is atomic. + */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY +#endif /* __aarch64__ */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/arch-hppa.h b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-hppa.h new file mode 100644 index 0000000000000000000000000000000000000000..50812a7f317885fd6f58bf2bca3fc63f194fecb8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-hppa.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * arch-hppa.h + * Atomic operations considerations specific to HPPA + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * src/include/port/atomics/arch-hppa.h + * + *------------------------------------------------------------------------- + */ + +/* HPPA doesn't do either read or write reordering */ +#define pg_memory_barrier_impl() pg_compiler_barrier_impl() diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/arch-ppc.h b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-ppc.h new file mode 100644 index 0000000000000000000000000000000000000000..edaab7c8957fc626cd8fb9103187fd5244816191 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-ppc.h @@ -0,0 +1,256 @@ +/*------------------------------------------------------------------------- + * + * arch-ppc.h + * Atomic operations considerations specific to PowerPC + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * src/include/port/atomics/arch-ppc.h + * + *------------------------------------------------------------------------- + */ + +#if defined(__GNUC__) + +/* + * lwsync orders loads with respect to each other, and similarly with stores. + * But a load can be performed before a subsequent store, so sync must be used + * for a full memory barrier. + */ +#define pg_memory_barrier_impl() __asm__ __volatile__ ("sync" : : : "memory") +#define pg_read_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory") +#define pg_write_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory") +#endif + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +/* 64bit atomics are only supported in 64bit mode */ +#if SIZEOF_VOID_P >= 8 +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif + +/* + * This mimics gcc __atomic_compare_exchange_n(..., __ATOMIC_SEQ_CST), but + * code generation differs at the end. __atomic_compare_exchange_n(): + * 100: isync + * 104: mfcr r3 + * 108: rlwinm r3,r3,3,31,31 + * 10c: bne 120 <.eb+0x10> + * 110: clrldi r3,r3,63 + * 114: addi r1,r1,112 + * 118: blr + * 11c: nop + * 120: clrldi r3,r3,63 + * 124: stw r9,0(r4) + * 128: addi r1,r1,112 + * 12c: blr + * + * This: + * f0: isync + * f4: mfcr r9 + * f8: rldicl. r3,r9,35,63 + * fc: bne 104 <.eb> + * 100: stw r10,0(r4) + * 104: addi r1,r1,112 + * 108: blr + * + * This implementation may or may not have materially different performance. + * It's not exploiting the fact that cr0 still holds the relevant comparison + * bits, set during the __asm__. One could fix that by moving more code into + * the __asm__. (That would remove the freedom to eliminate dead stores when + * the caller ignores "expected", but few callers do.) + * + * Recognizing constant "newval" would be superfluous, because there's no + * immediate-operand version of stwcx. + */ +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + uint32 found; + uint32 condition_register; + bool ret; + +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(*expected) && + (int32) *expected <= PG_INT16_MAX && + (int32) *expected >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " lwarx %0,0,%5,1 \n" + " cmpwi %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stwcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to lwarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "i"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " lwarx %0,0,%5,1 \n" + " cmpw %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stwcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to lwarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "r"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + + ret = (condition_register >> 29) & 1; /* test eq bit of cr0 */ + if (!ret) + *expected = found; + return ret; +} + +/* + * This mirrors gcc __sync_fetch_and_add(). + * + * Like tas(), use constraint "=&b" to avoid allocating r0. + */ +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 _t; + uint32 res; + +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(add_) && + add_ <= PG_INT16_MAX && add_ >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " lwarx %1,0,%4,1 \n" + " addi %0,%1,%3 \n" + " stwcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to lwarx */ + " lwsync \n" +: "=&r"(_t), "=&b"(res), "+m"(ptr->value) +: "i"(add_), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " lwarx %1,0,%4,1 \n" + " add %0,%1,%3 \n" + " stwcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to lwarx */ + " lwsync \n" +: "=&r"(_t), "=&r"(res), "+m"(ptr->value) +: "r"(add_), "r"(&ptr->value) +: "memory", "cc"); + + return res; +} + +#ifdef PG_HAVE_ATOMIC_U64_SUPPORT + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + uint64 found; + uint32 condition_register; + bool ret; + + AssertPointerAlignment(expected, 8); + + /* Like u32, but s/lwarx/ldarx/; s/stwcx/stdcx/; s/cmpw/cmpd/ */ +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(*expected) && + (int64) *expected <= PG_INT16_MAX && + (int64) *expected >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " ldarx %0,0,%5,1 \n" + " cmpdi %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stdcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to ldarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "i"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " ldarx %0,0,%5,1 \n" + " cmpd %0,%3 \n" + " bne $+12 \n" /* branch to lwsync */ + " stdcx. %4,0,%5 \n" + " bne $-16 \n" /* branch to ldarx */ + " lwsync \n" + " mfcr %1 \n" +: "=&r"(found), "=r"(condition_register), "+m"(ptr->value) +: "r"(*expected), "r"(newval), "r"(&ptr->value) +: "memory", "cc"); + + ret = (condition_register >> 29) & 1; /* test eq bit of cr0 */ + if (!ret) + *expected = found; + return ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 _t; + uint64 res; + + /* Like u32, but s/lwarx/ldarx/; s/stwcx/stdcx/ */ +#ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P + if (__builtin_constant_p(add_) && + add_ <= PG_INT16_MAX && add_ >= PG_INT16_MIN) + __asm__ __volatile__( + " sync \n" + " ldarx %1,0,%4,1 \n" + " addi %0,%1,%3 \n" + " stdcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to ldarx */ + " lwsync \n" +: "=&r"(_t), "=&b"(res), "+m"(ptr->value) +: "i"(add_), "r"(&ptr->value) +: "memory", "cc"); + else +#endif + __asm__ __volatile__( + " sync \n" + " ldarx %1,0,%4,1 \n" + " add %0,%1,%3 \n" + " stdcx. %0,0,%4 \n" + " bne $-12 \n" /* branch to ldarx */ + " lwsync \n" +: "=&r"(_t), "=&r"(res), "+m"(ptr->value) +: "r"(add_), "r"(&ptr->value) +: "memory", "cc"); + + return res; +} + +#endif /* PG_HAVE_ATOMIC_U64_SUPPORT */ + +/* per architecture manual doubleword accesses have single copy atomicity */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/arch-x86.h b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-x86.h new file mode 100644 index 0000000000000000000000000000000000000000..2a8eca30fcf9d0e58a0b225336d0efa5f1890450 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/arch-x86.h @@ -0,0 +1,254 @@ +/*------------------------------------------------------------------------- + * + * arch-x86.h + * Atomic operations considerations specific to intel x86 + * + * Note that we actually require a 486 upwards because the 386 doesn't have + * support for xadd and cmpxchg. Given that the 386 isn't supported anywhere + * anymore that's not much of a restriction luckily. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * src/include/port/atomics/arch-x86.h + * + *------------------------------------------------------------------------- + */ + +/* + * Both 32 and 64 bit x86 do not allow loads to be reordered with other loads, + * or stores to be reordered with other stores, but a load can be performed + * before a subsequent store. + * + * Technically, some x86-ish chips support uncached memory access and/or + * special instructions that are weakly ordered. In those cases we'd need + * the read and write barriers to be lfence and sfence. But since we don't + * do those things, a compiler barrier should be enough. + * + * "lock; addl" has worked for longer than "mfence". It's also rumored to be + * faster in many scenarios. + */ + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if defined(__i386__) || defined(__i386) +#define pg_memory_barrier_impl() \ + __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory", "cc") +#elif defined(__x86_64__) +#define pg_memory_barrier_impl() \ + __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory", "cc") +#endif +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +#define pg_read_barrier_impl() pg_compiler_barrier_impl() +#define pg_write_barrier_impl() pg_compiler_barrier_impl() + +/* + * Provide implementation for atomics using inline assembly on x86 gcc. It's + * nice to support older gcc's and the compare/exchange implementation here is + * actually more efficient than the * __sync variant. + */ +#if defined(HAVE_ATOMICS) + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) + +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef struct pg_atomic_flag +{ + volatile char value; +} pg_atomic_flag; + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +/* + * It's too complicated to write inline asm for 64bit types on 32bit and the + * 486 can't do it anyway. + */ +#ifdef __x86_64__ +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + /* alignment guaranteed due to being on a 64bit platform */ + volatile uint64 value; +} pg_atomic_uint64; +#endif /* __x86_64__ */ + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +#endif /* defined(HAVE_ATOMICS) */ + +#if !defined(PG_HAVE_SPIN_DELAY) +/* + * This sequence is equivalent to the PAUSE instruction ("rep" is + * ignored by old IA32 processors if the following instruction is + * not a string operation); the IA-32 Architecture Software + * Developer's Manual, Vol. 3, Section 7.7.2 describes why using + * PAUSE in the inner loop of a spin lock is necessary for good + * performance: + * + * The PAUSE instruction improves the performance of IA-32 + * processors supporting Hyper-Threading Technology when + * executing spin-wait loops and other routines where one + * thread is accessing a shared lock or semaphore in a tight + * polling loop. When executing a spin-wait loop, the + * processor can suffer a severe performance penalty when + * exiting the loop because it detects a possible memory order + * violation and flushes the core processor's pipeline. The + * PAUSE instruction provides a hint to the processor that the + * code sequence is a spin-wait loop. The processor uses this + * hint to avoid the memory order violation and prevent the + * pipeline flush. In addition, the PAUSE instruction + * de-pipelines the spin-wait loop to prevent it from + * consuming execution resources excessively. + */ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#define PG_HAVE_SPIN_DELAY +static __inline__ void +pg_spin_delay_impl(void) +{ + __asm__ __volatile__(" rep; nop \n"); +} +#elif defined(_MSC_VER) && defined(__x86_64__) +#define PG_HAVE_SPIN_DELAY +static __forceinline void +pg_spin_delay_impl(void) +{ + _mm_pause(); +} +#elif defined(_MSC_VER) +#define PG_HAVE_SPIN_DELAY +static __forceinline void +pg_spin_delay_impl(void) +{ + /* See comment for gcc code. Same code, MASM syntax */ + __asm rep nop; +} +#endif +#endif /* !defined(PG_HAVE_SPIN_DELAY) */ + + +#if defined(HAVE_ATOMICS) + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + char _res = 1; + + __asm__ __volatile__( + " lock \n" + " xchgb %0,%1 \n" +: "+q"(_res), "+m"(ptr->value) +: +: "memory"); + return _res == 0; +} + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* + * On a TSO architecture like x86 it's sufficient to use a compiler + * barrier to achieve release semantics. + */ + __asm__ __volatile__("" ::: "memory"); + ptr->value = 0; +} + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + char ret; + + /* + * Perform cmpxchg and use the zero flag which it implicitly sets when + * equal to measure the success. + */ + __asm__ __volatile__( + " lock \n" + " cmpxchgl %4,%5 \n" + " setz %2 \n" +: "=a" (*expected), "=m"(ptr->value), "=q" (ret) +: "a" (*expected), "r" (newval), "m"(ptr->value) +: "memory", "cc"); + return (bool) ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 res; + __asm__ __volatile__( + " lock \n" + " xaddl %0,%1 \n" +: "=q"(res), "=m"(ptr->value) +: "0" (add_), "m"(ptr->value) +: "memory", "cc"); + return res; +} + +#ifdef __x86_64__ + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + char ret; + + AssertPointerAlignment(expected, 8); + + /* + * Perform cmpxchg and use the zero flag which it implicitly sets when + * equal to measure the success. + */ + __asm__ __volatile__( + " lock \n" + " cmpxchgq %4,%5 \n" + " setz %2 \n" +: "=a" (*expected), "=m"(ptr->value), "=q" (ret) +: "a" (*expected), "r" (newval), "m"(ptr->value) +: "memory", "cc"); + return (bool) ret; +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 res; + __asm__ __volatile__( + " lock \n" + " xaddq %0,%1 \n" +: "=q"(res), "=m"(ptr->value) +: "0" (add_), "m"(ptr->value) +: "memory", "cc"); + return res; +} + +#endif /* __x86_64__ */ + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + +/* + * 8 byte reads / writes have single-copy atomicity on 32 bit x86 platforms + * since at least the 586. As well as on all x86-64 cpus. + */ +#if defined(__i568__) || defined(__i668__) || /* gcc i586+ */ \ + (defined(_M_IX86) && _M_IX86 >= 500) || /* msvc i586+ */ \ + defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) /* gcc, sunpro, msvc */ +#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY +#endif /* 8 byte single-copy atomicity */ + +#endif /* HAVE_ATOMICS */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/fallback.h b/platform/dbops/binaries/postgres/include/server/port/atomics/fallback.h new file mode 100644 index 0000000000000000000000000000000000000000..71c1df5d28ce7e9d337f0cf981a0478d44285f41 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/fallback.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * fallback.h + * Fallback for platforms without spinlock and/or atomics support. Slower + * than native atomics support, but not unusably slow. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics/fallback.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +# error "should be included via atomics.h" +#endif + +#ifndef pg_memory_barrier_impl +/* + * If we have no memory barrier implementation for this architecture, we + * fall back to acquiring and releasing a spinlock. This might, in turn, + * fall back to the semaphore-based spinlock implementation, which will be + * amazingly slow. + * + * It's not self-evident that every possible legal implementation of a + * spinlock acquire-and-release would be equivalent to a full memory barrier. + * For example, I'm not sure that Itanium's acq and rel add up to a full + * fence. But all of our actual implementations seem OK in this regard. + */ +#define PG_HAVE_MEMORY_BARRIER_EMULATION + +extern void pg_spinlock_barrier(void); +#define pg_memory_barrier_impl pg_spinlock_barrier +#endif + +#ifndef pg_compiler_barrier_impl +/* + * If the compiler/arch combination does not provide compiler barriers, + * provide a fallback. The fallback simply consists of a function call into + * an externally defined function. That should guarantee compiler barrier + * semantics except for compilers that do inter translation unit/global + * optimization - those better provide an actual compiler barrier. + * + * A native compiler barrier for sure is a lot faster than this... + */ +#define PG_HAVE_COMPILER_BARRIER_EMULATION +extern void pg_extern_compiler_barrier(void); +#define pg_compiler_barrier_impl pg_extern_compiler_barrier +#endif + + +/* + * If we have atomics implementation for this platform, fall back to providing + * the atomics API using a spinlock to protect the internal state. Possibly + * the spinlock implementation uses semaphores internally... + * + * We have to be a bit careful here, as it's not guaranteed that atomic + * variables are mapped to the same address in every process (e.g. dynamic + * shared memory segments). We can't just hash the address and use that to map + * to a spinlock. Instead assign a spinlock on initialization of the atomic + * variable. + */ +#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) && !defined(PG_HAVE_ATOMIC_U32_SUPPORT) + +#define PG_HAVE_ATOMIC_FLAG_SIMULATION +#define PG_HAVE_ATOMIC_FLAG_SUPPORT + +typedef struct pg_atomic_flag +{ + /* + * To avoid circular includes we can't use s_lock as a type here. Instead + * just reserve enough space for all spinlock types. Some platforms would + * be content with just one byte instead of 4, but that's not too much + * waste. + */ +#if defined(__hppa) || defined(__hppa__) /* HP PA-RISC, GCC and HP compilers */ + int sema[4]; +#else + int sema; +#endif + volatile bool value; +} pg_atomic_flag; + +#endif /* PG_HAVE_ATOMIC_FLAG_SUPPORT */ + +#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT) + +#define PG_HAVE_ATOMIC_U32_SIMULATION + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + /* Check pg_atomic_flag's definition above for an explanation */ +#if defined(__hppa) || defined(__hppa__) /* HP PA-RISC */ + int sema[4]; +#else + int sema; +#endif + volatile uint32 value; +} pg_atomic_uint32; + +#endif /* PG_HAVE_ATOMIC_U32_SUPPORT */ + +#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT) + +#define PG_HAVE_ATOMIC_U64_SIMULATION + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + /* Check pg_atomic_flag's definition above for an explanation */ +#if defined(__hppa) || defined(__hppa__) /* HP PA-RISC */ + int sema[4]; +#else + int sema; +#endif + volatile uint64 value; +} pg_atomic_uint64; + +#endif /* PG_HAVE_ATOMIC_U64_SUPPORT */ + +#ifdef PG_HAVE_ATOMIC_FLAG_SIMULATION + +#define PG_HAVE_ATOMIC_INIT_FLAG +extern void pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr); + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +extern bool pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr); + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +extern void pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr); + +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +extern bool pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr); + +#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */ + +#ifdef PG_HAVE_ATOMIC_U32_SIMULATION + +#define PG_HAVE_ATOMIC_INIT_U32 +extern void pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_); + +#define PG_HAVE_ATOMIC_WRITE_U32 +extern void pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val); + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +extern bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval); + +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +extern uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_); + +#endif /* PG_HAVE_ATOMIC_U32_SIMULATION */ + + +#ifdef PG_HAVE_ATOMIC_U64_SIMULATION + +#define PG_HAVE_ATOMIC_INIT_U64 +extern void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_); + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +extern bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval); + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +extern uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_); + +#endif /* PG_HAVE_ATOMIC_U64_SIMULATION */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/generic-gcc.h b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-gcc.h new file mode 100644 index 0000000000000000000000000000000000000000..872d2f02af4a2c37ac901f3b95e2fca4292ed597 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-gcc.h @@ -0,0 +1,323 @@ +/*------------------------------------------------------------------------- + * + * generic-gcc.h + * Atomic operations, implemented using gcc (or compatible) intrinsics. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * Documentation: + * * Legacy __sync Built-in Functions for Atomic Memory Access + * https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fsync-Builtins.html + * * Built-in functions for memory model aware atomic operations + * https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fatomic-Builtins.html + * + * src/include/port/atomics/generic-gcc.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +/* + * An empty asm block should be a sufficient compiler barrier. + */ +#define pg_compiler_barrier_impl() __asm__ __volatile__("" ::: "memory") + +/* + * If we're on GCC 4.1.0 or higher, we should be able to get a memory barrier + * out of this compiler built-in. But we prefer to rely on platform specific + * definitions where possible, and use this only as a fallback. + */ +#if !defined(pg_memory_barrier_impl) +# if defined(HAVE_GCC__ATOMIC_INT32_CAS) +# define pg_memory_barrier_impl() __atomic_thread_fence(__ATOMIC_SEQ_CST) +# elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +# define pg_memory_barrier_impl() __sync_synchronize() +# endif +#endif /* !defined(pg_memory_barrier_impl) */ + +#if !defined(pg_read_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +/* acquire semantics include read barrier semantics */ +# define pg_read_barrier_impl() __atomic_thread_fence(__ATOMIC_ACQUIRE) +#endif + +#if !defined(pg_write_barrier_impl) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +/* release semantics include write barrier semantics */ +# define pg_write_barrier_impl() __atomic_thread_fence(__ATOMIC_RELEASE) +#endif + + +#ifdef HAVE_ATOMICS + +/* generic gcc based atomic flag implementation */ +#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) \ + && (defined(HAVE_GCC__SYNC_INT32_TAS) || defined(HAVE_GCC__SYNC_CHAR_TAS)) + +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef struct pg_atomic_flag +{ + /* + * If we have a choice, use int-width TAS, because that is more efficient + * and/or more reliably implemented on most non-Intel platforms. (Note + * that this code isn't used on x86[_64]; see arch-x86.h for that.) + */ +#ifdef HAVE_GCC__SYNC_INT32_TAS + volatile int value; +#else + volatile char value; +#endif +} pg_atomic_flag; + +#endif /* !ATOMIC_FLAG_SUPPORT && SYNC_INT32_TAS */ + +/* generic gcc based atomic uint32 implementation */ +#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT) \ + && (defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS)) + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#endif /* defined(HAVE_GCC__ATOMIC_INT32_CAS) || defined(HAVE_GCC__SYNC_INT32_CAS) */ + +/* generic gcc based atomic uint64 implementation */ +#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT) \ + && !defined(PG_DISABLE_64_BIT_ATOMICS) \ + && (defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS)) + +#define PG_HAVE_ATOMIC_U64_SUPPORT + +typedef struct pg_atomic_uint64 +{ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */ + +#ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT + +#if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS) + +#ifndef PG_HAVE_ATOMIC_TEST_SET_FLAG +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* NB: only an acquire barrier, not a full one */ + /* some platform only support a 1 here */ + return __sync_lock_test_and_set(&ptr->value, 1) == 0; +} +#endif + +#endif /* defined(HAVE_GCC__SYNC_*_TAS) */ + +#ifndef PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return ptr->value == 0; +} +#endif + +#ifndef PG_HAVE_ATOMIC_CLEAR_FLAG +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + __sync_lock_release(&ptr->value); +} +#endif + +#ifndef PG_HAVE_ATOMIC_INIT_FLAG +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_clear_flag_impl(ptr); +} +#endif + +#endif /* defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) */ + +/* prefer __atomic, it has a better API */ +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + /* FIXME: we can probably use a lower consistency model */ + return __atomic_compare_exchange_n(&ptr->value, expected, newval, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + current = __sync_val_compare_and_swap(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} +#endif + +/* + * __sync_lock_test_and_set() only supports setting the value to 1 on some + * platforms, so we only provide an __atomic implementation for + * pg_atomic_exchange. + * + * We assume the availability of 32-bit __atomic_compare_exchange_n() implies + * the availability of 32-bit __atomic_exchange_n(). + */ +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS) +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return __atomic_exchange_n(&ptr->value, newval, __ATOMIC_SEQ_CST); +} +#endif + +/* if we have 32-bit __sync_val_compare_and_swap, assume we have these too: */ + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return __sync_fetch_and_add(&ptr->value, add_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_SUB_U32 +static inline uint32 +pg_atomic_fetch_sub_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return __sync_fetch_and_sub(&ptr->value, sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_AND_U32 +static inline uint32 +pg_atomic_fetch_and_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + return __sync_fetch_and_and(&ptr->value, and_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U32) && defined(HAVE_GCC__SYNC_INT32_CAS) +#define PG_HAVE_ATOMIC_FETCH_OR_U32 +static inline uint32 +pg_atomic_fetch_or_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + return __sync_fetch_and_or(&ptr->value, or_); +} +#endif + + +#if !defined(PG_DISABLE_64_BIT_ATOMICS) + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__ATOMIC_INT64_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + AssertPointerAlignment(expected, 8); + return __atomic_compare_exchange_n(&ptr->value, expected, newval, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + + AssertPointerAlignment(expected, 8); + current = __sync_val_compare_and_swap(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} +#endif + +/* + * __sync_lock_test_and_set() only supports setting the value to 1 on some + * platforms, so we only provide an __atomic implementation for + * pg_atomic_exchange. + * + * We assume the availability of 64-bit __atomic_compare_exchange_n() implies + * the availability of 64-bit __atomic_exchange_n(). + */ +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U64) && defined(HAVE_GCC__ATOMIC_INT64_CAS) +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return __atomic_exchange_n(&ptr->value, newval, __ATOMIC_SEQ_CST); +} +#endif + +/* if we have 64-bit __sync_val_compare_and_swap, assume we have these too: */ + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return __sync_fetch_and_add(&ptr->value, add_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_SUB_U64 +static inline uint64 +pg_atomic_fetch_sub_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return __sync_fetch_and_sub(&ptr->value, sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_AND_U64 +static inline uint64 +pg_atomic_fetch_and_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ + return __sync_fetch_and_and(&ptr->value, and_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U64) && defined(HAVE_GCC__SYNC_INT64_CAS) +#define PG_HAVE_ATOMIC_FETCH_OR_U64 +static inline uint64 +pg_atomic_fetch_or_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ + return __sync_fetch_and_or(&ptr->value, or_); +} +#endif + +#endif /* !defined(PG_DISABLE_64_BIT_ATOMICS) */ + +#endif /* defined(HAVE_ATOMICS) */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/generic-msvc.h b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-msvc.h new file mode 100644 index 0000000000000000000000000000000000000000..c013aca5e7cfd489096be6d4b00f5acb788169e2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-msvc.h @@ -0,0 +1,119 @@ +/*------------------------------------------------------------------------- + * + * generic-msvc.h + * Atomic operations support when using MSVC + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES: + * + * Documentation: + * * Interlocked Variable Access + * http://msdn.microsoft.com/en-us/library/ms684122%28VS.85%29.aspx + * + * src/include/port/atomics/generic-msvc.h + * + *------------------------------------------------------------------------- + */ +#include + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +#error "should be included via atomics.h" +#endif + +#pragma intrinsic(_ReadWriteBarrier) +#define pg_compiler_barrier_impl() _ReadWriteBarrier() + +#ifndef pg_memory_barrier_impl +#define pg_memory_barrier_impl() MemoryBarrier() +#endif + +#if defined(HAVE_ATOMICS) + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_attribute_aligned(8) pg_atomic_uint64 +{ + volatile uint64 value; +} pg_atomic_uint64; + + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + current = InterlockedCompareExchange(&ptr->value, newval, *expected); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return InterlockedExchange(&ptr->value, newval); +} + +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return InterlockedExchangeAdd(&ptr->value, add_); +} + +/* + * The non-intrinsics versions are only available in vista upwards, so use the + * intrinsic version. Only supported on >486, but we require XP as a minimum + * baseline, which doesn't support the 486, so we don't need to add checks for + * that case. + */ +#pragma intrinsic(_InterlockedCompareExchange64) + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + current = _InterlockedCompareExchange64(&ptr->value, newval, *expected); + ret = current == *expected; + *expected = current; + return ret; +} + +/* Only implemented on 64bit builds */ +#ifdef _WIN64 + +#pragma intrinsic(_InterlockedExchange64) + +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return _InterlockedExchange64(&ptr->value, newval); +} + +#pragma intrinsic(_InterlockedExchangeAdd64) + +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return _InterlockedExchangeAdd64(&ptr->value, add_); +} + +#endif /* _WIN64 */ + +#endif /* HAVE_ATOMICS */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/generic-sunpro.h b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-sunpro.h new file mode 100644 index 0000000000000000000000000000000000000000..840a45e7788c7484a91e7304f7b5dbdd0ce0fd7f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/generic-sunpro.h @@ -0,0 +1,121 @@ +/*------------------------------------------------------------------------- + * + * generic-sunpro.h + * Atomic operations for solaris' CC + * + * Portions Copyright (c) 2013-2024, PostgreSQL Global Development Group + * + * NOTES: + * + * Documentation: + * * manpage for atomic_cas(3C) + * http://www.unix.com/man-page/opensolaris/3c/atomic_cas/ + * http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html + * + * src/include/port/atomics/generic-sunpro.h + * + * ------------------------------------------------------------------------- + */ + +#if defined(HAVE_ATOMICS) + +#ifdef HAVE_MBARRIER_H +#include + +#define pg_compiler_barrier_impl() __compiler_barrier() + +#ifndef pg_memory_barrier_impl +/* + * Despite the name this is actually a full barrier. Expanding to mfence/ + * membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad on x86/sparc + * respectively. + */ +# define pg_memory_barrier_impl() __machine_rw_barrier() +#endif +#ifndef pg_read_barrier_impl +# define pg_read_barrier_impl() __machine_r_barrier() +#endif +#ifndef pg_write_barrier_impl +# define pg_write_barrier_impl() __machine_w_barrier() +#endif + +#endif /* HAVE_MBARRIER_H */ + +/* Older versions of the compiler don't have atomic.h... */ +#ifdef HAVE_ATOMIC_H + +#include + +#define PG_HAVE_ATOMIC_U32_SUPPORT +typedef struct pg_atomic_uint32 +{ + volatile uint32 value; +} pg_atomic_uint32; + +#define PG_HAVE_ATOMIC_U64_SUPPORT +typedef struct pg_atomic_uint64 +{ + /* + * Syntax to enforce variable alignment should be supported by versions + * supporting atomic.h, but it's hard to find accurate documentation. If + * it proves to be a problem, we'll have to add more version checks for 64 + * bit support. + */ + volatile uint64 value pg_attribute_aligned(8); +} pg_atomic_uint64; + +#endif /* HAVE_ATOMIC_H */ + +#endif /* defined(HAVE_ATOMICS) */ + + +#if defined(HAVE_ATOMICS) + +#ifdef HAVE_ATOMIC_H + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32 +static inline bool +pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, + uint32 *expected, uint32 newval) +{ + bool ret; + uint32 current; + + current = atomic_cas_32(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval) +{ + return atomic_swap_32(&ptr->value, newval); +} + +#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64 +static inline bool +pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, + uint64 *expected, uint64 newval) +{ + bool ret; + uint64 current; + + AssertPointerAlignment(expected, 8); + current = atomic_cas_64(&ptr->value, *expected, newval); + ret = current == *expected; + *expected = current; + return ret; +} + +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval) +{ + return atomic_swap_64(&ptr->value, newval); +} + +#endif /* HAVE_ATOMIC_H */ + +#endif /* defined(HAVE_ATOMICS) */ diff --git a/platform/dbops/binaries/postgres/include/server/port/atomics/generic.h b/platform/dbops/binaries/postgres/include/server/port/atomics/generic.h new file mode 100644 index 0000000000000000000000000000000000000000..6113ab62a31ad2d2bc226d08cedd1f529879b600 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/atomics/generic.h @@ -0,0 +1,437 @@ +/*------------------------------------------------------------------------- + * + * generic.h + * Implement higher level operations based on some lower level atomic + * operations. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/atomics/generic.h + * + *------------------------------------------------------------------------- + */ + +/* intentionally no include guards, should only be included by atomics.h */ +#ifndef INSIDE_ATOMICS_H +# error "should be included via atomics.h" +#endif + +/* + * If read or write barriers are undefined, we upgrade them to full memory + * barriers. + */ +#if !defined(pg_read_barrier_impl) +# define pg_read_barrier_impl pg_memory_barrier_impl +#endif +#if !defined(pg_write_barrier_impl) +# define pg_write_barrier_impl pg_memory_barrier_impl +#endif + +#ifndef PG_HAVE_SPIN_DELAY +#define PG_HAVE_SPIN_DELAY +#define pg_spin_delay_impl() ((void)0) +#endif + + +/* provide fallback */ +#if !defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) && defined(PG_HAVE_ATOMIC_U32_SUPPORT) +#define PG_HAVE_ATOMIC_FLAG_SUPPORT +typedef pg_atomic_uint32 pg_atomic_flag; +#endif + +#ifndef PG_HAVE_ATOMIC_READ_U32 +#define PG_HAVE_ATOMIC_READ_U32 +static inline uint32 +pg_atomic_read_u32_impl(volatile pg_atomic_uint32 *ptr) +{ + return ptr->value; +} +#endif + +#ifndef PG_HAVE_ATOMIC_WRITE_U32 +#define PG_HAVE_ATOMIC_WRITE_U32 +static inline void +pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + ptr->value = val; +} +#endif + +#ifndef PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32 +#define PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32 +static inline void +pg_atomic_unlocked_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + ptr->value = val; +} +#endif + +/* + * provide fallback for test_and_set using atomic_exchange if available + */ +#if !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_EXCHANGE_U32) + +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_write_u32_impl(ptr, 0); +} + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_exchange_u32_impl(ptr, 1) == 0; +} + +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_read_u32_impl(ptr) == 0; +} + + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* XXX: release semantics suffice? */ + pg_memory_barrier_impl(); + pg_atomic_write_u32_impl(ptr, 0); +} + +/* + * provide fallback for test_and_set using atomic_compare_exchange if + * available. + */ +#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) + +#define PG_HAVE_ATOMIC_INIT_FLAG +static inline void +pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr) +{ + pg_atomic_write_u32_impl(ptr, 0); +} + +#define PG_HAVE_ATOMIC_TEST_SET_FLAG +static inline bool +pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr) +{ + uint32 value = 0; + return pg_atomic_compare_exchange_u32_impl(ptr, &value, 1); +} + +#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG +static inline bool +pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr) +{ + return pg_atomic_read_u32_impl(ptr) == 0; +} + +#define PG_HAVE_ATOMIC_CLEAR_FLAG +static inline void +pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) +{ + /* + * Use a memory barrier + plain write if we have a native memory + * barrier. But don't do so if memory barriers use spinlocks - that'd lead + * to circularity if flags are used to implement spinlocks. + */ +#ifndef PG_HAVE_MEMORY_BARRIER_EMULATION + /* XXX: release semantics suffice? */ + pg_memory_barrier_impl(); + pg_atomic_write_u32_impl(ptr, 0); +#else + uint32 value = 1; + pg_atomic_compare_exchange_u32_impl(ptr, &value, 0); +#endif +} + +#elif !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) +# error "No pg_atomic_test_and_set provided" +#endif /* !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) */ + + +#ifndef PG_HAVE_ATOMIC_INIT_U32 +#define PG_HAVE_ATOMIC_INIT_U32 +static inline void +pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_) +{ + ptr->value = val_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_EXCHANGE_U32 +static inline uint32 +pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 xchg_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, xchg_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_ADD_U32 +static inline uint32 +pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old + add_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_SUB_U32 +static inline uint32 +pg_atomic_fetch_sub_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return pg_atomic_fetch_add_u32_impl(ptr, -sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_AND_U32 +static inline uint32 +pg_atomic_fetch_and_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 and_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old & and_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U32) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_FETCH_OR_U32 +static inline uint32 +pg_atomic_fetch_or_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 or_) +{ + uint32 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u32_impl(ptr, &old, old | or_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) +#define PG_HAVE_ATOMIC_ADD_FETCH_U32 +static inline uint32 +pg_atomic_add_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) +{ + return pg_atomic_fetch_add_u32_impl(ptr, add_) + add_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U32) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U32) +#define PG_HAVE_ATOMIC_SUB_FETCH_U32 +static inline uint32 +pg_atomic_sub_fetch_u32_impl(volatile pg_atomic_uint32 *ptr, int32 sub_) +{ + return pg_atomic_fetch_sub_u32_impl(ptr, sub_) - sub_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_READ_MEMBARRIER_U32) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U32) +#define PG_HAVE_ATOMIC_READ_MEMBARRIER_U32 +static inline uint32 +pg_atomic_read_membarrier_u32_impl(volatile pg_atomic_uint32 *ptr) +{ + return pg_atomic_fetch_add_u32_impl(ptr, 0); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U32) && defined(PG_HAVE_ATOMIC_EXCHANGE_U32) +#define PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U32 +static inline void +pg_atomic_write_membarrier_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val) +{ + (void) pg_atomic_exchange_u32_impl(ptr, val); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_EXCHANGE_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_EXCHANGE_U64 +static inline uint64 +pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 xchg_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, xchg_)) + /* skip */; + return old; +} +#endif + +#ifndef PG_HAVE_ATOMIC_WRITE_U64 +#define PG_HAVE_ATOMIC_WRITE_U64 + +#if defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY) && \ + !defined(PG_HAVE_ATOMIC_U64_SIMULATION) + +static inline void +pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * On this platform aligned 64bit writes are guaranteed to be atomic, + * except if using the fallback implementation, where can't guarantee the + * required alignment. + */ + AssertPointerAlignment(ptr, 8); + ptr->value = val; +} + +#else + +static inline void +pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + /* + * 64 bit writes aren't safe on all platforms. In the generic + * implementation implement them as an atomic exchange. + */ + pg_atomic_exchange_u64_impl(ptr, val); +} + +#endif /* PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY && !PG_HAVE_ATOMIC_U64_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_WRITE_U64 */ + +#ifndef PG_HAVE_ATOMIC_READ_U64 +#define PG_HAVE_ATOMIC_READ_U64 + +#if defined(PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY) && \ + !defined(PG_HAVE_ATOMIC_U64_SIMULATION) + +static inline uint64 +pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + /* + * On this platform aligned 64-bit reads are guaranteed to be atomic. + */ + AssertPointerAlignment(ptr, 8); + return ptr->value; +} + +#else + +static inline uint64 +pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + uint64 old = 0; + + /* + * 64-bit reads aren't atomic on all platforms. In the generic + * implementation implement them as a compare/exchange with 0. That'll + * fail or succeed, but always return the old value. Possibly might store + * a 0, but only if the previous value also was a 0 - i.e. harmless. + */ + pg_atomic_compare_exchange_u64_impl(ptr, &old, 0); + + return old; +} +#endif /* PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY && !PG_HAVE_ATOMIC_U64_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_READ_U64 */ + +#ifndef PG_HAVE_ATOMIC_INIT_U64 +#define PG_HAVE_ATOMIC_INIT_U64 +static inline void +pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_) +{ + ptr->value = val_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_ADD_U64 +static inline uint64 +pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old + add_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_SUB_U64 +static inline uint64 +pg_atomic_fetch_sub_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return pg_atomic_fetch_add_u64_impl(ptr, -sub_); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_AND_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_AND_U64 +static inline uint64 +pg_atomic_fetch_and_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 and_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old & and_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_FETCH_OR_U64) && defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_FETCH_OR_U64 +static inline uint64 +pg_atomic_fetch_or_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 or_) +{ + uint64 old; + old = ptr->value; /* ok if read is not atomic */ + while (!pg_atomic_compare_exchange_u64_impl(ptr, &old, old | or_)) + /* skip */; + return old; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_ADD_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) +#define PG_HAVE_ATOMIC_ADD_FETCH_U64 +static inline uint64 +pg_atomic_add_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) +{ + return pg_atomic_fetch_add_u64_impl(ptr, add_) + add_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_SUB_FETCH_U64) && defined(PG_HAVE_ATOMIC_FETCH_SUB_U64) +#define PG_HAVE_ATOMIC_SUB_FETCH_U64 +static inline uint64 +pg_atomic_sub_fetch_u64_impl(volatile pg_atomic_uint64 *ptr, int64 sub_) +{ + return pg_atomic_fetch_sub_u64_impl(ptr, sub_) - sub_; +} +#endif + +#if !defined(PG_HAVE_ATOMIC_READ_MEMBARRIER_U64) && defined(PG_HAVE_ATOMIC_FETCH_ADD_U64) +#define PG_HAVE_ATOMIC_READ_MEMBARRIER_U64 +static inline uint64 +pg_atomic_read_membarrier_u64_impl(volatile pg_atomic_uint64 *ptr) +{ + return pg_atomic_fetch_add_u64_impl(ptr, 0); +} +#endif + +#if !defined(PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U64) && defined(PG_HAVE_ATOMIC_EXCHANGE_U64) +#define PG_HAVE_ATOMIC_WRITE_MEMBARRIER_U64 +static inline void +pg_atomic_write_membarrier_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val) +{ + (void) pg_atomic_exchange_u64_impl(ptr, val); +} +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/cygwin.h b/platform/dbops/binaries/postgres/include/server/port/cygwin.h new file mode 100644 index 0000000000000000000000000000000000000000..44bf8533729cc6c4d214a8c637c2f1e6d5b171ed --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/cygwin.h @@ -0,0 +1,23 @@ +/* src/include/port/cygwin.h */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Cygwin has a strtof() which is literally just (float)strtod(), which means + * we get misrounding _and_ silent over/underflow. Using our wrapper doesn't + * fix the misrounding but does fix the error checks, which cuts down on the + * number of test variant files needed. + */ +#define HAVE_BUGGY_STRTOF 1 diff --git a/platform/dbops/binaries/postgres/include/server/port/darwin.h b/platform/dbops/binaries/postgres/include/server/port/darwin.h new file mode 100644 index 0000000000000000000000000000000000000000..15fb69d6dbb4bcf60b26640146f6f850296bcc63 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/darwin.h @@ -0,0 +1,8 @@ +/* src/include/port/darwin.h */ + +#define __darwin__ 1 + +#if HAVE_DECL_F_FULLFSYNC /* not present before macOS 10.3 */ +#define HAVE_FSYNC_WRITETHROUGH + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/freebsd.h b/platform/dbops/binaries/postgres/include/server/port/freebsd.h new file mode 100644 index 0000000000000000000000000000000000000000..c604187acdd3a529d978f18d0a569b8ef4c135a7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/freebsd.h @@ -0,0 +1,8 @@ +/* src/include/port/freebsd.h */ + +/* + * Set the default wal_sync_method to fdatasync. xlogdefs.h's normal rules + * would prefer open_datasync on FreeBSD 13+, but that is not a good choice on + * many systems. + */ +#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC diff --git a/platform/dbops/binaries/postgres/include/server/port/linux.h b/platform/dbops/binaries/postgres/include/server/port/linux.h new file mode 100644 index 0000000000000000000000000000000000000000..8101af2b93f55e1c7a7b5bd4845e346cd41d38fa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/linux.h @@ -0,0 +1,22 @@ +/* src/include/port/linux.h */ + +/* + * As of July 2007, all known versions of the Linux kernel will sometimes + * return EIDRM for a shmctl() operation when EINVAL is correct (it happens + * when the low-order 15 bits of the supplied shm ID match the slot number + * assigned to a newer shmem segment). We deal with this by assuming that + * EIDRM means EINVAL in PGSharedMemoryIsInUse(). This is reasonably safe + * since in fact Linux has no excuse for ever returning EIDRM; it doesn't + * track removed segments in a way that would allow distinguishing them from + * private ones. But someday that code might get upgraded, and we'd have + * to have a kernel version test here. + */ +#define HAVE_LINUX_EIDRM_BUG + +/* + * Set the default wal_sync_method to fdatasync. With recent Linux versions, + * xlogdefs.h's normal rules will prefer open_datasync, which (a) doesn't + * perform better and (b) causes outright failures on ext4 data=journal + * filesystems, because those don't support O_DIRECT. + */ +#define PLATFORM_DEFAULT_WAL_SYNC_METHOD WAL_SYNC_METHOD_FDATASYNC diff --git a/platform/dbops/binaries/postgres/include/server/port/netbsd.h b/platform/dbops/binaries/postgres/include/server/port/netbsd.h new file mode 100644 index 0000000000000000000000000000000000000000..590233fbdb47fbed00905ab1d06a00885135086e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/netbsd.h @@ -0,0 +1 @@ +/* src/include/port/netbsd.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/openbsd.h b/platform/dbops/binaries/postgres/include/server/port/openbsd.h new file mode 100644 index 0000000000000000000000000000000000000000..395319bd77c6e3bb62925c6807a27fa2fbfead14 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/openbsd.h @@ -0,0 +1 @@ +/* src/include/port/openbsd.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_bitutils.h b/platform/dbops/binaries/postgres/include/server/port/pg_bitutils.h new file mode 100644 index 0000000000000000000000000000000000000000..4d88478c9c24d78da7e3069d06837e0692cc679d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_bitutils.h @@ -0,0 +1,421 @@ +/*------------------------------------------------------------------------- + * + * pg_bitutils.h + * Miscellaneous functions for bit-wise operations. + * + * + * Copyright (c) 2019-2024, PostgreSQL Global Development Group + * + * src/include/port/pg_bitutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_BITUTILS_H +#define PG_BITUTILS_H + +#ifdef _MSC_VER +#include +#define HAVE_BITSCAN_FORWARD +#define HAVE_BITSCAN_REVERSE + +#else +#if defined(HAVE__BUILTIN_CTZ) +#define HAVE_BITSCAN_FORWARD +#endif + +#if defined(HAVE__BUILTIN_CLZ) +#define HAVE_BITSCAN_REVERSE +#endif +#endif /* _MSC_VER */ + +extern PGDLLIMPORT const uint8 pg_leftmost_one_pos[256]; +extern PGDLLIMPORT const uint8 pg_rightmost_one_pos[256]; +extern PGDLLIMPORT const uint8 pg_number_of_ones[256]; + +/* + * pg_leftmost_one_pos32 + * Returns the position of the most significant set bit in "word", + * measured from the least significant bit. word must not be 0. + */ +static inline int +pg_leftmost_one_pos32(uint32 word) +{ +#ifdef HAVE__BUILTIN_CLZ + Assert(word != 0); + + return 31 - __builtin_clz(word); +#elif defined(_MSC_VER) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanReverse(&result, word); + return (int) result; +#else + int shift = 32 - 8; + + Assert(word != 0); + + while ((word >> shift) == 0) + shift -= 8; + + return shift + pg_leftmost_one_pos[(word >> shift) & 255]; +#endif /* HAVE__BUILTIN_CLZ */ +} + +/* + * pg_leftmost_one_pos64 + * As above, but for a 64-bit word. + */ +static inline int +pg_leftmost_one_pos64(uint64 word) +{ +#ifdef HAVE__BUILTIN_CLZ + Assert(word != 0); + +#if defined(HAVE_LONG_INT_64) + return 63 - __builtin_clzl(word); +#elif defined(HAVE_LONG_LONG_INT_64) + return 63 - __builtin_clzll(word); +#else +#error must have a working 64-bit integer datatype +#endif /* HAVE_LONG_INT_64 */ + +#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64)) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanReverse64(&result, word); + return (int) result; +#else + int shift = 64 - 8; + + Assert(word != 0); + + while ((word >> shift) == 0) + shift -= 8; + + return shift + pg_leftmost_one_pos[(word >> shift) & 255]; +#endif /* HAVE__BUILTIN_CLZ */ +} + +/* + * pg_rightmost_one_pos32 + * Returns the position of the least significant set bit in "word", + * measured from the least significant bit. word must not be 0. + */ +static inline int +pg_rightmost_one_pos32(uint32 word) +{ +#ifdef HAVE__BUILTIN_CTZ + Assert(word != 0); + + return __builtin_ctz(word); +#elif defined(_MSC_VER) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanForward(&result, word); + return (int) result; +#else + int result = 0; + + Assert(word != 0); + + while ((word & 255) == 0) + { + word >>= 8; + result += 8; + } + result += pg_rightmost_one_pos[word & 255]; + return result; +#endif /* HAVE__BUILTIN_CTZ */ +} + +/* + * pg_rightmost_one_pos64 + * As above, but for a 64-bit word. + */ +static inline int +pg_rightmost_one_pos64(uint64 word) +{ +#ifdef HAVE__BUILTIN_CTZ + Assert(word != 0); + +#if defined(HAVE_LONG_INT_64) + return __builtin_ctzl(word); +#elif defined(HAVE_LONG_LONG_INT_64) + return __builtin_ctzll(word); +#else +#error must have a working 64-bit integer datatype +#endif /* HAVE_LONG_INT_64 */ + +#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_ARM64)) + unsigned long result; + bool non_zero; + + Assert(word != 0); + + non_zero = _BitScanForward64(&result, word); + return (int) result; +#else + int result = 0; + + Assert(word != 0); + + while ((word & 255) == 0) + { + word >>= 8; + result += 8; + } + result += pg_rightmost_one_pos[word & 255]; + return result; +#endif /* HAVE__BUILTIN_CTZ */ +} + +/* + * pg_nextpower2_32 + * Returns the next higher power of 2 above 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0 or be above PG_UINT32_MAX / 2 + 1. + */ +static inline uint32 +pg_nextpower2_32(uint32 num) +{ + Assert(num > 0 && num <= PG_UINT32_MAX / 2 + 1); + + /* + * A power 2 number has only 1 bit set. Subtracting 1 from such a number + * will turn on all previous bits resulting in no common bits being set + * between num and num-1. + */ + if ((num & (num - 1)) == 0) + return num; /* already power 2 */ + + return ((uint32) 1) << (pg_leftmost_one_pos32(num) + 1); +} + +/* + * pg_nextpower2_64 + * Returns the next higher power of 2 above 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0 or be above PG_UINT64_MAX / 2 + 1. + */ +static inline uint64 +pg_nextpower2_64(uint64 num) +{ + Assert(num > 0 && num <= PG_UINT64_MAX / 2 + 1); + + /* + * A power 2 number has only 1 bit set. Subtracting 1 from such a number + * will turn on all previous bits resulting in no common bits being set + * between num and num-1. + */ + if ((num & (num - 1)) == 0) + return num; /* already power 2 */ + + return ((uint64) 1) << (pg_leftmost_one_pos64(num) + 1); +} + +/* + * pg_prevpower2_32 + * Returns the next lower power of 2 below 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0. + */ +static inline uint32 +pg_prevpower2_32(uint32 num) +{ + return ((uint32) 1) << pg_leftmost_one_pos32(num); +} + +/* + * pg_prevpower2_64 + * Returns the next lower power of 2 below 'num', or 'num' if it's + * already a power of 2. + * + * 'num' mustn't be 0. + */ +static inline uint64 +pg_prevpower2_64(uint64 num) +{ + return ((uint64) 1) << pg_leftmost_one_pos64(num); +} + +/* + * pg_ceil_log2_32 + * Returns equivalent of ceil(log2(num)) + */ +static inline uint32 +pg_ceil_log2_32(uint32 num) +{ + if (num < 2) + return 0; + else + return pg_leftmost_one_pos32(num - 1) + 1; +} + +/* + * pg_ceil_log2_64 + * Returns equivalent of ceil(log2(num)) + */ +static inline uint64 +pg_ceil_log2_64(uint64 num) +{ + if (num < 2) + return 0; + else + return pg_leftmost_one_pos64(num - 1) + 1; +} + +/* + * With MSVC on x86_64 builds, try using native popcnt instructions via the + * __popcnt and __popcnt64 intrinsics. These don't work the same as GCC's + * __builtin_popcount* intrinsic functions as they always emit popcnt + * instructions. + */ +#if defined(_MSC_VER) && defined(_M_AMD64) +#define HAVE_X86_64_POPCNTQ +#endif + +/* + * On x86_64, we can use the hardware popcount instruction, but only if + * we can verify that the CPU supports it via the cpuid instruction. + * + * Otherwise, we fall back to a hand-rolled implementation. + */ +#ifdef HAVE_X86_64_POPCNTQ +#if defined(HAVE__GET_CPUID) || defined(HAVE__CPUID) +#define TRY_POPCNT_FAST 1 +#endif +#endif + +#ifdef TRY_POPCNT_FAST +/* Attempt to use the POPCNT instruction, but perform a runtime check first */ +extern PGDLLIMPORT int (*pg_popcount32) (uint32 word); +extern PGDLLIMPORT int (*pg_popcount64) (uint64 word); +extern PGDLLIMPORT uint64 (*pg_popcount_optimized) (const char *buf, int bytes); +extern PGDLLIMPORT uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask); + +/* + * We can also try to use the AVX-512 popcount instruction on some systems. + * The implementation of that is located in its own file because it may + * require special compiler flags that we don't want to apply to any other + * files. + */ +#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK +extern bool pg_popcount_avx512_available(void); +extern uint64 pg_popcount_avx512(const char *buf, int bytes); +extern uint64 pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask); +#endif + +#else +/* Use a portable implementation -- no need for a function pointer. */ +extern int pg_popcount32(uint32 word); +extern int pg_popcount64(uint64 word); +extern uint64 pg_popcount_optimized(const char *buf, int bytes); +extern uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask); + +#endif /* TRY_POPCNT_FAST */ + +/* + * Returns the number of 1-bits in buf. + * + * If there aren't many bytes to process, the function call overhead of the + * optimized versions isn't worth taking, so we inline a loop that consults + * pg_number_of_ones in that case. If there are many bytes to process, we + * accept the function call overhead because the optimized versions are likely + * to be faster. + */ +static inline uint64 +pg_popcount(const char *buf, int bytes) +{ + /* + * We set the threshold to the point at which we'll first use special + * instructions in the optimized version. + */ +#if SIZEOF_VOID_P >= 8 + int threshold = 8; +#else + int threshold = 4; +#endif + + if (bytes < threshold) + { + uint64 popcnt = 0; + + while (bytes--) + popcnt += pg_number_of_ones[(unsigned char) *buf++]; + return popcnt; + } + + return pg_popcount_optimized(buf, bytes); +} + +/* + * Returns the number of 1-bits in buf after applying the mask to each byte. + * + * Similar to pg_popcount(), we only take on the function pointer overhead when + * it's likely to be faster. + */ +static inline uint64 +pg_popcount_masked(const char *buf, int bytes, bits8 mask) +{ + /* + * We set the threshold to the point at which we'll first use special + * instructions in the optimized version. + */ +#if SIZEOF_VOID_P >= 8 + int threshold = 8; +#else + int threshold = 4; +#endif + + if (bytes < threshold) + { + uint64 popcnt = 0; + + while (bytes--) + popcnt += pg_number_of_ones[(unsigned char) *buf++ & mask]; + return popcnt; + } + + return pg_popcount_masked_optimized(buf, bytes, mask); +} + +/* + * Rotate the bits of "word" to the right/left by n bits. + */ +static inline uint32 +pg_rotate_right32(uint32 word, int n) +{ + return (word >> n) | (word << (32 - n)); +} + +static inline uint32 +pg_rotate_left32(uint32 word, int n) +{ + return (word << n) | (word >> (32 - n)); +} + +/* size_t variants of the above, as required */ + +#if SIZEOF_SIZE_T == 4 +#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos32 +#define pg_nextpower2_size_t pg_nextpower2_32 +#define pg_prevpower2_size_t pg_prevpower2_32 +#else +#define pg_leftmost_one_pos_size_t pg_leftmost_one_pos64 +#define pg_nextpower2_size_t pg_nextpower2_64 +#define pg_prevpower2_size_t pg_prevpower2_64 +#endif + +#endif /* PG_BITUTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_bswap.h b/platform/dbops/binaries/postgres/include/server/port/pg_bswap.h new file mode 100644 index 0000000000000000000000000000000000000000..2379513f6570c8739747eeaa433a032f95bc1418 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_bswap.h @@ -0,0 +1,161 @@ +/*------------------------------------------------------------------------- + * + * pg_bswap.h + * Byte swapping. + * + * Macros for reversing the byte order of 16, 32 and 64-bit unsigned integers. + * For example, 0xAABBCCDD becomes 0xDDCCBBAA. These are just wrappers for + * built-in functions provided by the compiler where support exists. + * + * Note that all of these functions accept unsigned integers as arguments and + * return the same. Use caution when using these wrapper macros with signed + * integers. + * + * Copyright (c) 2015-2024, PostgreSQL Global Development Group + * + * src/include/port/pg_bswap.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_BSWAP_H +#define PG_BSWAP_H + + +/* + * In all supported versions msvc provides _byteswap_* functions in stdlib.h, + * already included by c.h. + */ + + +/* implementation of uint16 pg_bswap16(uint16) */ +#if defined(HAVE__BUILTIN_BSWAP16) + +#define pg_bswap16(x) __builtin_bswap16(x) + +#elif defined(_MSC_VER) + +#define pg_bswap16(x) _byteswap_ushort(x) + +#else + +static inline uint16 +pg_bswap16(uint16 x) +{ + return + ((x << 8) & 0xff00) | + ((x >> 8) & 0x00ff); +} + +#endif /* HAVE__BUILTIN_BSWAP16 */ + + +/* implementation of uint32 pg_bswap32(uint32) */ +#if defined(HAVE__BUILTIN_BSWAP32) + +#define pg_bswap32(x) __builtin_bswap32(x) + +#elif defined(_MSC_VER) + +#define pg_bswap32(x) _byteswap_ulong(x) + +#else + +static inline uint32 +pg_bswap32(uint32 x) +{ + return + ((x << 24) & 0xff000000) | + ((x << 8) & 0x00ff0000) | + ((x >> 8) & 0x0000ff00) | + ((x >> 24) & 0x000000ff); +} + +#endif /* HAVE__BUILTIN_BSWAP32 */ + + +/* implementation of uint64 pg_bswap64(uint64) */ +#if defined(HAVE__BUILTIN_BSWAP64) + +#define pg_bswap64(x) __builtin_bswap64(x) + + +#elif defined(_MSC_VER) + +#define pg_bswap64(x) _byteswap_uint64(x) + +#else + +static inline uint64 +pg_bswap64(uint64 x) +{ + return + ((x << 56) & UINT64CONST(0xff00000000000000)) | + ((x << 40) & UINT64CONST(0x00ff000000000000)) | + ((x << 24) & UINT64CONST(0x0000ff0000000000)) | + ((x << 8) & UINT64CONST(0x000000ff00000000)) | + ((x >> 8) & UINT64CONST(0x00000000ff000000)) | + ((x >> 24) & UINT64CONST(0x0000000000ff0000)) | + ((x >> 40) & UINT64CONST(0x000000000000ff00)) | + ((x >> 56) & UINT64CONST(0x00000000000000ff)); +} +#endif /* HAVE__BUILTIN_BSWAP64 */ + + +/* + * Portable and fast equivalents for ntohs, ntohl, htons, htonl, + * additionally extended to 64 bits. + */ +#ifdef WORDS_BIGENDIAN + +#define pg_hton16(x) (x) +#define pg_hton32(x) (x) +#define pg_hton64(x) (x) + +#define pg_ntoh16(x) (x) +#define pg_ntoh32(x) (x) +#define pg_ntoh64(x) (x) + +#else + +#define pg_hton16(x) pg_bswap16(x) +#define pg_hton32(x) pg_bswap32(x) +#define pg_hton64(x) pg_bswap64(x) + +#define pg_ntoh16(x) pg_bswap16(x) +#define pg_ntoh32(x) pg_bswap32(x) +#define pg_ntoh64(x) pg_bswap64(x) + +#endif /* WORDS_BIGENDIAN */ + + +/* + * Rearrange the bytes of a Datum from big-endian order into the native byte + * order. On big-endian machines, this does nothing at all. Note that the C + * type Datum is an unsigned integer type on all platforms. + * + * One possible application of the DatumBigEndianToNative() macro is to make + * bitwise comparisons cheaper. A simple 3-way comparison of Datums + * transformed by the macro (based on native, unsigned comparisons) will return + * the same result as a memcmp() of the corresponding original Datums, but can + * be much cheaper. It's generally safe to do this on big-endian systems + * without any special transformation occurring first. + * + * If SIZEOF_DATUM is not defined, then postgres.h wasn't included and these + * macros probably shouldn't be used, so we define nothing. Note that + * SIZEOF_DATUM == 8 would evaluate as 0 == 8 in that case, potentially + * leading to the wrong implementation being selected and confusing errors, so + * defining nothing is safest. + */ +#ifdef SIZEOF_DATUM +#ifdef WORDS_BIGENDIAN +#define DatumBigEndianToNative(x) (x) +#else /* !WORDS_BIGENDIAN */ +#if SIZEOF_DATUM == 8 +#define DatumBigEndianToNative(x) pg_bswap64(x) +#else /* SIZEOF_DATUM != 8 */ +#define DatumBigEndianToNative(x) pg_bswap32(x) +#endif /* SIZEOF_DATUM == 8 */ +#endif /* WORDS_BIGENDIAN */ +#endif /* SIZEOF_DATUM */ + +#endif /* PG_BSWAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_crc32c.h b/platform/dbops/binaries/postgres/include/server/port/pg_crc32c.h new file mode 100644 index 0000000000000000000000000000000000000000..63c8e3a00b638f1f5ea2c07e5261c49cf14cbd33 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_crc32c.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * pg_crc32c.h + * Routines for computing CRC-32C checksums. + * + * The speed of CRC-32C calculation has a big impact on performance, so we + * jump through some hoops to get the best implementation for each + * platform. Some CPU architectures have special instructions for speeding + * up CRC calculations (e.g. Intel SSE 4.2), on other platforms we use the + * Slicing-by-8 algorithm which uses lookup tables. + * + * The public interface consists of four macros: + * + * INIT_CRC32C(crc) + * Initialize a CRC accumulator + * + * COMP_CRC32C(crc, data, len) + * Accumulate some (more) bytes into a CRC + * + * FIN_CRC32C(crc) + * Finish a CRC calculation + * + * EQ_CRC32C(c1, c2) + * Check for equality of two CRCs. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/pg_crc32c.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_CRC32C_H +#define PG_CRC32C_H + +#include "port/pg_bswap.h" + +typedef uint32 pg_crc32c; + +/* The INIT and EQ macros are the same for all implementations. */ +#define INIT_CRC32C(crc) ((crc) = 0xFFFFFFFF) +#define EQ_CRC32C(c1, c2) ((c1) == (c2)) + +#if defined(USE_SSE42_CRC32C) +/* Use Intel SSE4.2 instructions. */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_sse42((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len); + +#elif defined(USE_ARMV8_CRC32C) +/* Use ARMv8 CRC Extension instructions. */ + +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_armv8((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len); + +#elif defined(USE_LOONGARCH_CRC32C) +/* Use LoongArch CRCC instructions. */ + +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_loongarch((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_loongarch(pg_crc32c crc, const void *data, size_t len); + +#elif defined(USE_SSE42_CRC32C_WITH_RUNTIME_CHECK) || defined(USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK) + +/* + * Use Intel SSE 4.2 or ARMv8 instructions, but perform a runtime check first + * to check that they are available. + */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c((crc), (data), (len))) +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) + +extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len); +extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len); + +#ifdef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK +extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len); +#endif +#ifdef USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK +extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len); +#endif + +#else +/* + * Use slicing-by-8 algorithm. + * + * On big-endian systems, the intermediate value is kept in reverse byte + * order, to avoid byte-swapping during the calculation. FIN_CRC32C reverses + * the bytes to the final order. + */ +#define COMP_CRC32C(crc, data, len) \ + ((crc) = pg_comp_crc32c_sb8((crc), (data), (len))) +#ifdef WORDS_BIGENDIAN +#define FIN_CRC32C(crc) ((crc) = pg_bswap32(crc) ^ 0xFFFFFFFF) +#else +#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF) +#endif + +extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len); + +#endif + +#endif /* PG_CRC32C_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_iovec.h b/platform/dbops/binaries/postgres/include/server/port/pg_iovec.h new file mode 100644 index 0000000000000000000000000000000000000000..e5fe677b3711efb60ce0a5e35c577f781e64f07a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_iovec.h @@ -0,0 +1,117 @@ +/*------------------------------------------------------------------------- + * + * pg_iovec.h + * Header for vectored I/O functions, to use in place of . + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/pg_iovec.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_IOVEC_H +#define PG_IOVEC_H + +#ifndef WIN32 + +#include +#include +#include + +#else + +/* POSIX requires at least 16 as a maximum iovcnt. */ +#define IOV_MAX 16 + +/* Define our own POSIX-compatible iovec struct. */ +struct iovec +{ + void *iov_base; + size_t iov_len; +}; + +#endif + +/* Define a reasonable maximum that is safe to use on the stack. */ +#define PG_IOV_MAX Min(IOV_MAX, 32) + +/* + * Like preadv(), but with a prefix to remind us of a side-effect: on Windows + * this changes the current file position. + */ +static inline ssize_t +pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) +{ +#if HAVE_DECL_PREADV + /* + * Avoid a small amount of argument copying overhead in the kernel if + * there is only one iovec. + */ + if (iovcnt == 1) + return pread(fd, iov[0].iov_base, iov[0].iov_len, offset); + else + return preadv(fd, iov, iovcnt, offset); +#else + ssize_t sum = 0; + ssize_t part; + + for (int i = 0; i < iovcnt; ++i) + { + part = pg_pread(fd, iov[i].iov_base, iov[i].iov_len, offset); + if (part < 0) + { + if (i == 0) + return -1; + else + return sum; + } + sum += part; + offset += part; + if ((size_t) part < iov[i].iov_len) + return sum; + } + return sum; +#endif +} + +/* + * Like pwritev(), but with a prefix to remind us of a side-effect: on Windows + * this changes the current file position. + */ +static inline ssize_t +pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset) +{ +#if HAVE_DECL_PWRITEV + /* + * Avoid a small amount of argument copying overhead in the kernel if + * there is only one iovec. + */ + if (iovcnt == 1) + return pwrite(fd, iov[0].iov_base, iov[0].iov_len, offset); + else + return pwritev(fd, iov, iovcnt, offset); +#else + ssize_t sum = 0; + ssize_t part; + + for (int i = 0; i < iovcnt; ++i) + { + part = pg_pwrite(fd, iov[i].iov_base, iov[i].iov_len, offset); + if (part < 0) + { + if (i == 0) + return -1; + else + return sum; + } + sum += part; + offset += part; + if ((size_t) part < iov[i].iov_len) + return sum; + } + return sum; +#endif +} + +#endif /* PG_IOVEC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_lfind.h b/platform/dbops/binaries/postgres/include/server/port/pg_lfind.h new file mode 100644 index 0000000000000000000000000000000000000000..4b1431ed00201777575ef7d41492a75d68b2416b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_lfind.h @@ -0,0 +1,209 @@ +/*------------------------------------------------------------------------- + * + * pg_lfind.h + * Optimized linear search routines using SIMD intrinsics where + * available. + * + * Copyright (c) 2022-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/port/pg_lfind.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LFIND_H +#define PG_LFIND_H + +#include "port/simd.h" + +/* + * pg_lfind8 + * + * Return true if there is an element in 'base' that equals 'key', otherwise + * return false. + */ +static inline bool +pg_lfind8(uint8 key, uint8 *base, uint32 nelem) +{ + uint32 i; + + /* round down to multiple of vector length */ + uint32 tail_idx = nelem & ~(sizeof(Vector8) - 1); + Vector8 chunk; + + for (i = 0; i < tail_idx; i += sizeof(Vector8)) + { + vector8_load(&chunk, &base[i]); + if (vector8_has(chunk, key)) + return true; + } + + /* Process the remaining elements one at a time. */ + for (; i < nelem; i++) + { + if (key == base[i]) + return true; + } + + return false; +} + +/* + * pg_lfind8_le + * + * Return true if there is an element in 'base' that is less than or equal to + * 'key', otherwise return false. + */ +static inline bool +pg_lfind8_le(uint8 key, uint8 *base, uint32 nelem) +{ + uint32 i; + + /* round down to multiple of vector length */ + uint32 tail_idx = nelem & ~(sizeof(Vector8) - 1); + Vector8 chunk; + + for (i = 0; i < tail_idx; i += sizeof(Vector8)) + { + vector8_load(&chunk, &base[i]); + if (vector8_has_le(chunk, key)) + return true; + } + + /* Process the remaining elements one at a time. */ + for (; i < nelem; i++) + { + if (base[i] <= key) + return true; + } + + return false; +} + +/* + * pg_lfind32_one_by_one_helper + * + * Searches the array of integers one-by-one. The caller is responsible for + * ensuring that there are at least "nelem" integers in the array. + */ +static inline bool +pg_lfind32_one_by_one_helper(uint32 key, const uint32 *base, uint32 nelem) +{ + for (uint32 i = 0; i < nelem; i++) + { + if (key == base[i]) + return true; + } + + return false; +} + +#ifndef USE_NO_SIMD +/* + * pg_lfind32_simd_helper + * + * Searches one 4-register-block of integers. The caller is responsible for + * ensuring that there are at least 4-registers-worth of integers remaining. + */ +static inline bool +pg_lfind32_simd_helper(const Vector32 keys, const uint32 *base) +{ + const uint32 nelem_per_vector = sizeof(Vector32) / sizeof(uint32); + Vector32 vals1, + vals2, + vals3, + vals4, + result1, + result2, + result3, + result4, + tmp1, + tmp2, + result; + + /* load the next block into 4 registers */ + vector32_load(&vals1, base); + vector32_load(&vals2, &base[nelem_per_vector]); + vector32_load(&vals3, &base[nelem_per_vector * 2]); + vector32_load(&vals4, &base[nelem_per_vector * 3]); + + /* compare each value to the key */ + result1 = vector32_eq(keys, vals1); + result2 = vector32_eq(keys, vals2); + result3 = vector32_eq(keys, vals3); + result4 = vector32_eq(keys, vals4); + + /* combine the results into a single variable */ + tmp1 = vector32_or(result1, result2); + tmp2 = vector32_or(result3, result4); + result = vector32_or(tmp1, tmp2); + + /* return whether there was a match */ + return vector32_is_highbit_set(result); +} +#endif /* ! USE_NO_SIMD */ + +/* + * pg_lfind32 + * + * Return true if there is an element in 'base' that equals 'key', otherwise + * return false. + */ +static inline bool +pg_lfind32(uint32 key, const uint32 *base, uint32 nelem) +{ +#ifndef USE_NO_SIMD + uint32 i = 0; + + /* + * For better instruction-level parallelism, each loop iteration operates + * on a block of four registers. + */ + const Vector32 keys = vector32_broadcast(key); /* load copies of key */ + const uint32 nelem_per_vector = sizeof(Vector32) / sizeof(uint32); + const uint32 nelem_per_iteration = 4 * nelem_per_vector; + + /* round down to multiple of elements per iteration */ + const uint32 tail_idx = nelem & ~(nelem_per_iteration - 1); + +#if defined(USE_ASSERT_CHECKING) + bool assert_result = pg_lfind32_one_by_one_helper(key, base, nelem); +#endif + + /* + * If there aren't enough elements for the SIMD code, use the standard + * one-by-one linear search code. + */ + if (nelem < nelem_per_iteration) + return pg_lfind32_one_by_one_helper(key, base, nelem); + + /* + * Process as many elements as possible with a block of 4 registers. + */ + do + { + if (pg_lfind32_simd_helper(keys, &base[i])) + { + Assert(assert_result == true); + return true; + } + + i += nelem_per_iteration; + + } while (i < tail_idx); + + /* + * Process the last 'nelem_per_iteration' elements in the array with a + * 4-register block. This will cause us to check a subset of the elements + * more than once, but that won't affect correctness, and testing has + * demonstrated that this helps more cases than it harms. + */ + Assert(assert_result == pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration])); + return pg_lfind32_simd_helper(keys, &base[nelem - nelem_per_iteration]); +#else + /* Process the elements one at a time. */ + return pg_lfind32_one_by_one_helper(key, base, nelem); +#endif +} + +#endif /* PG_LFIND_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/pg_pthread.h b/platform/dbops/binaries/postgres/include/server/port/pg_pthread.h new file mode 100644 index 0000000000000000000000000000000000000000..d102ce9d6f33e10deddf9895daf5fd81f3d79fd0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/pg_pthread.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * Declarations for missing POSIX thread components. + * + * Currently this supplies an implementation of pthread_barrier_t for the + * benefit of macOS, which lacks it. These declarations are not in port.h, + * because that'd require to be included by every translation + * unit. + * + *------------------------------------------------------------------------- + */ + +#ifndef PG_PTHREAD_H +#define PG_PTHREAD_H + +#include + +#ifndef HAVE_PTHREAD_BARRIER_WAIT + +#ifndef PTHREAD_BARRIER_SERIAL_THREAD +#define PTHREAD_BARRIER_SERIAL_THREAD (-1) +#endif + +typedef struct pg_pthread_barrier +{ + bool sense; /* we only need a one bit phase */ + int count; /* number of threads expected */ + int arrived; /* number of threads that have arrived */ + pthread_mutex_t mutex; + pthread_cond_t cond; +} pthread_barrier_t; + +extern int pthread_barrier_init(pthread_barrier_t *barrier, + const void *attr, + int count); +extern int pthread_barrier_wait(pthread_barrier_t *barrier); +extern int pthread_barrier_destroy(pthread_barrier_t *barrier); + +#endif + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/simd.h b/platform/dbops/binaries/postgres/include/server/port/simd.h new file mode 100644 index 0000000000000000000000000000000000000000..597496f2fb7eddf20257fd597796265b5e09fefa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/simd.h @@ -0,0 +1,422 @@ +/*------------------------------------------------------------------------- + * + * simd.h + * Support for platform-specific vector operations. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/simd.h + * + * NOTES + * - VectorN in this file refers to a register where the element operands + * are N bits wide. The vector width is platform-specific, so users that care + * about that will need to inspect "sizeof(VectorN)". + * + *------------------------------------------------------------------------- + */ +#ifndef SIMD_H +#define SIMD_H + +#if (defined(__x86_64__) || defined(_M_AMD64)) +/* + * SSE2 instructions are part of the spec for the 64-bit x86 ISA. We assume + * that compilers targeting this architecture understand SSE2 intrinsics. + * + * We use emmintrin.h rather than the comprehensive header immintrin.h in + * order to exclude extensions beyond SSE2. This is because MSVC, at least, + * will allow the use of intrinsics that haven't been enabled at compile + * time. + */ +#include +#define USE_SSE2 +typedef __m128i Vector8; +typedef __m128i Vector32; + +#elif defined(__aarch64__) && defined(__ARM_NEON) +/* + * We use the Neon instructions if the compiler provides access to them (as + * indicated by __ARM_NEON) and we are on aarch64. While Neon support is + * technically optional for aarch64, it appears that all available 64-bit + * hardware does have it. Neon exists in some 32-bit hardware too, but we + * could not realistically use it there without a run-time check, which seems + * not worth the trouble for now. + */ +#include +#define USE_NEON +typedef uint8x16_t Vector8; +typedef uint32x4_t Vector32; + +#else +/* + * If no SIMD instructions are available, we can in some cases emulate vector + * operations using bitwise operations on unsigned integers. Note that many + * of the functions in this file presently do not have non-SIMD + * implementations. In particular, none of the functions involving Vector32 + * are implemented without SIMD since it's likely not worthwhile to represent + * two 32-bit integers using a uint64. + */ +#define USE_NO_SIMD +typedef uint64 Vector8; +#endif + +/* load/store operations */ +static inline void vector8_load(Vector8 *v, const uint8 *s); +#ifndef USE_NO_SIMD +static inline void vector32_load(Vector32 *v, const uint32 *s); +#endif + +/* assignment operations */ +static inline Vector8 vector8_broadcast(const uint8 c); +#ifndef USE_NO_SIMD +static inline Vector32 vector32_broadcast(const uint32 c); +#endif + +/* element-wise comparisons to a scalar */ +static inline bool vector8_has(const Vector8 v, const uint8 c); +static inline bool vector8_has_zero(const Vector8 v); +static inline bool vector8_has_le(const Vector8 v, const uint8 c); +static inline bool vector8_is_highbit_set(const Vector8 v); +#ifndef USE_NO_SIMD +static inline bool vector32_is_highbit_set(const Vector32 v); +static inline uint32 vector8_highbit_mask(const Vector8 v); +#endif + +/* arithmetic operations */ +static inline Vector8 vector8_or(const Vector8 v1, const Vector8 v2); +#ifndef USE_NO_SIMD +static inline Vector32 vector32_or(const Vector32 v1, const Vector32 v2); +static inline Vector8 vector8_ssub(const Vector8 v1, const Vector8 v2); +#endif + +/* + * comparisons between vectors + * + * Note: These return a vector rather than boolean, which is why we don't + * have non-SIMD implementations. + */ +#ifndef USE_NO_SIMD +static inline Vector8 vector8_eq(const Vector8 v1, const Vector8 v2); +static inline Vector8 vector8_min(const Vector8 v1, const Vector8 v2); +static inline Vector32 vector32_eq(const Vector32 v1, const Vector32 v2); +#endif + +/* + * Load a chunk of memory into the given vector. + */ +static inline void +vector8_load(Vector8 *v, const uint8 *s) +{ +#if defined(USE_SSE2) + *v = _mm_loadu_si128((const __m128i *) s); +#elif defined(USE_NEON) + *v = vld1q_u8(s); +#else + memcpy(v, s, sizeof(Vector8)); +#endif +} + +#ifndef USE_NO_SIMD +static inline void +vector32_load(Vector32 *v, const uint32 *s) +{ +#ifdef USE_SSE2 + *v = _mm_loadu_si128((const __m128i *) s); +#elif defined(USE_NEON) + *v = vld1q_u32(s); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Create a vector with all elements set to the same value. + */ +static inline Vector8 +vector8_broadcast(const uint8 c) +{ +#if defined(USE_SSE2) + return _mm_set1_epi8(c); +#elif defined(USE_NEON) + return vdupq_n_u8(c); +#else + return ~UINT64CONST(0) / 0xFF * c; +#endif +} + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_broadcast(const uint32 c) +{ +#ifdef USE_SSE2 + return _mm_set1_epi32(c); +#elif defined(USE_NEON) + return vdupq_n_u32(c); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return true if any elements in the vector are equal to the given scalar. + */ +static inline bool +vector8_has(const Vector8 v, const uint8 c) +{ + bool result; + + /* pre-compute the result for assert checking */ +#ifdef USE_ASSERT_CHECKING + bool assert_result = false; + + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] == c) + { + assert_result = true; + break; + } + } +#endif /* USE_ASSERT_CHECKING */ + +#if defined(USE_NO_SIMD) + /* any bytes in v equal to c will evaluate to zero via XOR */ + result = vector8_has_zero(v ^ vector8_broadcast(c)); +#else + result = vector8_is_highbit_set(vector8_eq(v, vector8_broadcast(c))); +#endif + + Assert(assert_result == result); + return result; +} + +/* + * Convenience function equivalent to vector8_has(v, 0) + */ +static inline bool +vector8_has_zero(const Vector8 v) +{ +#if defined(USE_NO_SIMD) + /* + * We cannot call vector8_has() here, because that would lead to a + * circular definition. + */ + return vector8_has_le(v, 0); +#else + return vector8_has(v, 0); +#endif +} + +/* + * Return true if any elements in the vector are less than or equal to the + * given scalar. + */ +static inline bool +vector8_has_le(const Vector8 v, const uint8 c) +{ + bool result = false; + + /* pre-compute the result for assert checking */ +#ifdef USE_ASSERT_CHECKING + bool assert_result = false; + + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] <= c) + { + assert_result = true; + break; + } + } +#endif /* USE_ASSERT_CHECKING */ + +#if defined(USE_NO_SIMD) + + /* + * To find bytes <= c, we can use bitwise operations to find bytes < c+1, + * but it only works if c+1 <= 128 and if the highest bit in v is not set. + * Adapted from + * https://graphics.stanford.edu/~seander/bithacks.html#HasLessInWord + */ + if ((int64) v >= 0 && c < 0x80) + result = (v - vector8_broadcast(c + 1)) & ~v & vector8_broadcast(0x80); + else + { + /* one byte at a time */ + for (Size i = 0; i < sizeof(Vector8); i++) + { + if (((const uint8 *) &v)[i] <= c) + { + result = true; + break; + } + } + } +#else + + /* + * Use saturating subtraction to find bytes <= c, which will present as + * NUL bytes. This approach is a workaround for the lack of unsigned + * comparison instructions on some architectures. + */ + result = vector8_has_zero(vector8_ssub(v, vector8_broadcast(c))); +#endif + + Assert(assert_result == result); + return result; +} + +/* + * Return true if the high bit of any element is set + */ +static inline bool +vector8_is_highbit_set(const Vector8 v) +{ +#ifdef USE_SSE2 + return _mm_movemask_epi8(v) != 0; +#elif defined(USE_NEON) + return vmaxvq_u8(v) > 0x7F; +#else + return v & vector8_broadcast(0x80); +#endif +} + +/* + * Exactly like vector8_is_highbit_set except for the input type, so it + * looks at each byte separately. + * + * XXX x86 uses the same underlying type for 8-bit, 16-bit, and 32-bit + * integer elements, but Arm does not, hence the need for a separate + * function. We could instead adopt the behavior of Arm's vmaxvq_u32(), i.e. + * check each 32-bit element, but that would require an additional mask + * operation on x86. + */ +#ifndef USE_NO_SIMD +static inline bool +vector32_is_highbit_set(const Vector32 v) +{ +#if defined(USE_NEON) + return vector8_is_highbit_set((Vector8) v); +#else + return vector8_is_highbit_set(v); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return a bitmask formed from the high-bit of each element. + */ +#ifndef USE_NO_SIMD +static inline uint32 +vector8_highbit_mask(const Vector8 v) +{ +#ifdef USE_SSE2 + return (uint32) _mm_movemask_epi8(v); +#elif defined(USE_NEON) + /* + * Note: It would be faster to use vget_lane_u64 and vshrn_n_u16, but that + * returns a uint64, making it inconvenient to combine mask values from + * multiple vectors. + */ + static const uint8 mask[16] = { + 1 << 0, 1 << 1, 1 << 2, 1 << 3, + 1 << 4, 1 << 5, 1 << 6, 1 << 7, + 1 << 0, 1 << 1, 1 << 2, 1 << 3, + 1 << 4, 1 << 5, 1 << 6, 1 << 7, + }; + + uint8x16_t masked = vandq_u8(vld1q_u8(mask), (uint8x16_t) vshrq_n_s8((int8x16_t) v, 7)); + uint8x16_t maskedhi = vextq_u8(masked, masked, 8); + + return (uint32) vaddvq_u16((uint16x8_t) vzip1q_u8(masked, maskedhi)); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return the bitwise OR of the inputs + */ +static inline Vector8 +vector8_or(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_or_si128(v1, v2); +#elif defined(USE_NEON) + return vorrq_u8(v1, v2); +#else + return v1 | v2; +#endif +} + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_or(const Vector32 v1, const Vector32 v2) +{ +#ifdef USE_SSE2 + return _mm_or_si128(v1, v2); +#elif defined(USE_NEON) + return vorrq_u32(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return the result of subtracting the respective elements of the input + * vectors using saturation (i.e., if the operation would yield a value less + * than zero, zero is returned instead). For more information on saturation + * arithmetic, see https://en.wikipedia.org/wiki/Saturation_arithmetic + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_ssub(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_subs_epu8(v1, v2); +#elif defined(USE_NEON) + return vqsubq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Return a vector with all bits set in each lane where the corresponding + * lanes in the inputs are equal. + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_eq(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_cmpeq_epi8(v1, v2); +#elif defined(USE_NEON) + return vceqq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +#ifndef USE_NO_SIMD +static inline Vector32 +vector32_eq(const Vector32 v1, const Vector32 v2) +{ +#ifdef USE_SSE2 + return _mm_cmpeq_epi32(v1, v2); +#elif defined(USE_NEON) + return vceqq_u32(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* + * Given two vectors, return a vector with the minimum element of each. + */ +#ifndef USE_NO_SIMD +static inline Vector8 +vector8_min(const Vector8 v1, const Vector8 v2) +{ +#ifdef USE_SSE2 + return _mm_min_epu8(v1, v2); +#elif defined(USE_NEON) + return vminq_u8(v1, v2); +#endif +} +#endif /* ! USE_NO_SIMD */ + +#endif /* SIMD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/solaris.h b/platform/dbops/binaries/postgres/include/server/port/solaris.h new file mode 100644 index 0000000000000000000000000000000000000000..e63a3bd824d6dc6fa2d8cc35029ba76b61a03370 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/solaris.h @@ -0,0 +1,26 @@ +/* src/include/port/solaris.h */ + +/* + * Sort this out for all operating systems some time. The __xxx + * symbols are defined on both GCC and Solaris CC, although GCC + * doesn't document them. The __xxx__ symbols are only on GCC. + */ +#if defined(__i386) && !defined(__i386__) +#define __i386__ +#endif + +#if defined(__amd64) && !defined(__amd64__) +#define __amd64__ +#endif + +#if defined(__x86_64) && !defined(__x86_64__) +#define __x86_64__ +#endif + +#if defined(__sparc) && !defined(__sparc__) +#define __sparc__ +#endif + +#if defined(__i386__) +#include +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/win32.h b/platform/dbops/binaries/postgres/include/server/port/win32.h new file mode 100644 index 0000000000000000000000000000000000000000..d6c13d0bb8f08bb88ca23bf4df87b85242ab0338 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32.h @@ -0,0 +1,59 @@ +/* src/include/port/win32.h */ + +/* + * We always rely on the WIN32 macro being set by our build system, + * but _WIN32 is the compiler pre-defined macro. So make sure we define + * WIN32 whenever _WIN32 is set, to facilitate standalone building. + */ +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + +/* + * Make sure _WIN32_WINNT has the minimum required value. + * Leave a higher value in place. The minimum requirement is Windows 10. + */ +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif + +#define _WIN32_WINNT 0x0A00 + +/* + * We need to prevent from defining a symbol conflicting with + * our errcode() function. Since it's likely to get included by standard + * system headers, pre-emptively include it now. + */ +#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H) +#define errcode __msvc_errcode +#include +#undef errcode +#endif + +/* + * defines for dynamic linking on Win32 platform + */ + +/* + * Variables declared in the core backend and referenced by loadable + * modules need to be marked "dllimport" in the core build, but + * "dllexport" when the declaration is read in a loadable module. + * No special markings should be used when compiling frontend code. + */ +#ifndef FRONTEND +#ifdef BUILDING_DLL +#define PGDLLIMPORT __declspec (dllexport) +#else +#define PGDLLIMPORT __declspec (dllimport) +#endif +#endif + +/* + * Functions exported by a loadable module must be marked "dllexport". + * + * While mingw would otherwise fall back to + * __attribute__((visibility("default"))), that appears to only work as long + * as no symbols are declared with __declspec(dllexport). But we can end up + * with some, e.g. plpython's Py_Init. + */ +#define PGDLLEXPORT __declspec (dllexport) diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/arpa/inet.h b/platform/dbops/binaries/postgres/include/server/port/win32/arpa/inet.h new file mode 100644 index 0000000000000000000000000000000000000000..ad1803179c7aea4717338ba920d26b3432d89eef --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/arpa/inet.h @@ -0,0 +1,3 @@ +/* src/include/port/win32/arpa/inet.h */ + +#include diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/dlfcn.h b/platform/dbops/binaries/postgres/include/server/port/win32/dlfcn.h new file mode 100644 index 0000000000000000000000000000000000000000..b6e43c091d620d0750f11de48f451ac98c117a2f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/dlfcn.h @@ -0,0 +1 @@ +/* src/include/port/win32/dlfcn.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/grp.h b/platform/dbops/binaries/postgres/include/server/port/win32/grp.h new file mode 100644 index 0000000000000000000000000000000000000000..8b4f21310e9ebeb9b7148ecb7c53dfd0e9811141 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/grp.h @@ -0,0 +1 @@ +/* src/include/port/win32/grp.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/netdb.h b/platform/dbops/binaries/postgres/include/server/port/win32/netdb.h new file mode 100644 index 0000000000000000000000000000000000000000..9ed13e457b8cdbdc2ee8b3f2886332559b4c1a74 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/netdb.h @@ -0,0 +1,7 @@ +/* src/include/port/win32/netdb.h */ +#ifndef WIN32_NETDB_H +#define WIN32_NETDB_H + +#include + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/netinet/in.h b/platform/dbops/binaries/postgres/include/server/port/win32/netinet/in.h new file mode 100644 index 0000000000000000000000000000000000000000..a4e22f89f4961ad53b9b720813cbce8d6e8a1677 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/netinet/in.h @@ -0,0 +1,3 @@ +/* src/include/port/win32/netinet/in.h */ + +#include diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/netinet/tcp.h b/platform/dbops/binaries/postgres/include/server/port/win32/netinet/tcp.h new file mode 100644 index 0000000000000000000000000000000000000000..1d377b6adc242346e7fd1309558afb49ee1c8993 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/netinet/tcp.h @@ -0,0 +1,7 @@ +/* src/include/port/win32/netinet/tcp.h */ +#ifndef WIN32_NETINET_TCP_H +#define WIN32_NETINET_TCP_H + +#include + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/pwd.h b/platform/dbops/binaries/postgres/include/server/port/win32/pwd.h new file mode 100644 index 0000000000000000000000000000000000000000..b8c7178fc06c082f4c41c11f84db94a0f24233be --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/pwd.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/pwd.h + */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/sys/resource.h b/platform/dbops/binaries/postgres/include/server/port/win32/sys/resource.h new file mode 100644 index 0000000000000000000000000000000000000000..a14feeb5844636084b289ba6b80e421e45dd7794 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/sys/resource.h @@ -0,0 +1,20 @@ +/* + * Replacement for for Windows. + */ +#ifndef WIN32_SYS_RESOURCE_H +#define WIN32_SYS_RESOURCE_H + +#include /* for struct timeval */ + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) + +struct rusage +{ + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ +}; + +extern int getrusage(int who, struct rusage *rusage); + +#endif /* WIN32_SYS_RESOURCE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/sys/select.h b/platform/dbops/binaries/postgres/include/server/port/win32/sys/select.h new file mode 100644 index 0000000000000000000000000000000000000000..f8a877accd67c97820152dab7e152f516de53d80 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/sys/select.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/sys/select.h + */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/sys/socket.h b/platform/dbops/binaries/postgres/include/server/port/win32/sys/socket.h new file mode 100644 index 0000000000000000000000000000000000000000..f2b475df5e5e0122f98d8eb009d8e2445c5af4fd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/sys/socket.h @@ -0,0 +1,34 @@ +/* + * src/include/port/win32/sys/socket.h + */ +#ifndef WIN32_SYS_SOCKET_H +#define WIN32_SYS_SOCKET_H + +/* + * Unfortunately, of VC++ also defines ERROR. + * To avoid the conflict, we include here and undefine ERROR + * immediately. + * + * Note: Don't include directly. It causes compile errors. + */ +#include +#include +#include + +#undef ERROR +#undef small + +/* Restore old ERROR value */ +#ifdef PGERROR +#define ERROR PGERROR +#endif + +/* + * We don't use the Windows gai_strerror[A] function because it is not + * thread-safe. We define our own in src/port/win32gai_strerror.c. + */ +#undef gai_strerror + +extern const char *gai_strerror(int ecode); + +#endif /* WIN32_SYS_SOCKET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/sys/un.h b/platform/dbops/binaries/postgres/include/server/port/win32/sys/un.h new file mode 100644 index 0000000000000000000000000000000000000000..4fc13a23fd1303fef3d74137d206ebd1cee29e38 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/sys/un.h @@ -0,0 +1,17 @@ +/* + * src/include/port/win32/sys/un.h + */ +#ifndef WIN32_SYS_UN_H +#define WIN32_SYS_UN_H + +/* + * Windows defines this structure in , but not all tool chains have + * the header yet, so we define it here for now. + */ +struct sockaddr_un +{ + unsigned short sun_family; + char sun_path[108]; +}; + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/win32/sys/wait.h b/platform/dbops/binaries/postgres/include/server/port/win32/sys/wait.h new file mode 100644 index 0000000000000000000000000000000000000000..eaeb5661c98fa1f0b0e3a144dbcecb18013d8aa9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32/sys/wait.h @@ -0,0 +1,3 @@ +/* + * src/include/port/win32/sys/wait.h + */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/dirent.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/dirent.h new file mode 100644 index 0000000000000000000000000000000000000000..62799db0014169a8125119771950896a918f8649 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/dirent.h @@ -0,0 +1,34 @@ +/* + * Headers for port/dirent.c, win32 native implementation of dirent functions + * + * src/include/port/win32_msvc/dirent.h + */ + +#ifndef _WIN32VC_DIRENT_H +#define _WIN32VC_DIRENT_H +struct dirent +{ + long d_ino; + unsigned short d_reclen; + unsigned char d_type; + unsigned short d_namlen; + char d_name[MAX_PATH]; +}; + +typedef struct DIR DIR; + +DIR *opendir(const char *); +struct dirent *readdir(DIR *); +int closedir(DIR *); + +/* File types for 'd_type'. */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#endif diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/file.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/file.h new file mode 100644 index 0000000000000000000000000000000000000000..76be3e77740ef0f057ea5b4cf9343e1b74f235a5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/file.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/file.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/param.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/param.h new file mode 100644 index 0000000000000000000000000000000000000000..160df3b25e1af839b43736889f1d976c4a95db4f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/param.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/param.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/time.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/time.h new file mode 100644 index 0000000000000000000000000000000000000000..9d943ecc6fa4de213ad981dc74ace6c986d805e7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/sys/time.h @@ -0,0 +1 @@ +/* src/include/port/win32_msvc/sys/time.h */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/unistd.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/unistd.h new file mode 100644 index 0000000000000000000000000000000000000000..b7795ba03c4ed146f0d87445d6d3da878aabf37d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/unistd.h @@ -0,0 +1,9 @@ +/* src/include/port/win32_msvc/unistd.h */ + +/* + * MSVC does not define these, nor does _fileno(stdin) etc reliably work + * (returns -1 if stdin/out/err are closed). + */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_msvc/utime.h b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/utime.h new file mode 100644 index 0000000000000000000000000000000000000000..c78e79c33d34fa6ea12287ec74e5194bf705491e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_msvc/utime.h @@ -0,0 +1,3 @@ +/* src/include/port/win32_msvc/utime.h */ + +#include /* for non-unicode version */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32_port.h b/platform/dbops/binaries/postgres/include/server/port/win32_port.h new file mode 100644 index 0000000000000000000000000000000000000000..2d4d2c5868941649fc0dd2c43265483551af7075 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32_port.h @@ -0,0 +1,582 @@ +/*------------------------------------------------------------------------- + * + * win32_port.h + * Windows-specific compatibility stuff. + * + * Note this is read in MinGW as well as native Windows builds, + * but not in Cygwin builds. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/win32_port.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_WIN32_PORT_H +#define PG_WIN32_PORT_H + +/* + * Always build with SSPI support. Keep it as a #define in case + * we want a switch to disable it sometime in the future. + */ +#define ENABLE_SSPI 1 + +/* undefine and redefine after #include */ +#undef mkdir + +#undef ERROR + +/* + * VS2013 and later issue warnings about using the old Winsock API, + * which we don't really want to hear about. + */ +#ifdef _MSC_VER +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + +/* + * The MinGW64 headers choke if this is already defined - they + * define it themselves. + */ +#if !defined(__MINGW64_VERSION_MAJOR) || defined(_MSC_VER) +#define _WINSOCKAPI_ +#endif + +/* + * windows.h includes a lot of other headers, slowing down compilation + * significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to + * remove the include of windows.h (as well as indirect inclusions of it) from + * such a central place, but until then... + * + * To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by + * temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about + * macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in + * turn requires including ntstatus.h, winternl.h to get common symbols. + */ +#define WIN32_LEAN_AND_MEAN +#define UMDF_USING_NTSTATUS + +#include +#include +#include +#include +#include + +#undef small +#include +#include +#include +#undef near + +/* needed before sys/stat hacking below: */ +#define fstat microsoft_native_fstat +#define stat microsoft_native_stat +#include +#undef fstat +#undef stat + +/* Must be here to avoid conflicting with prototype in windows.h */ +#define mkdir(a,b) mkdir(a) + +/* Windows doesn't have fsync() as such, use _commit() */ +#define fsync(fd) _commit(fd) + +#define USES_WINSOCK + +/* + * IPC defines + */ +#undef HAVE_UNION_SEMUN +#define HAVE_UNION_SEMUN 1 + +#define IPC_RMID 256 +#define IPC_CREAT 512 +#define IPC_EXCL 1024 +#define IPC_PRIVATE 234564 +#define IPC_NOWAIT 2048 +#define IPC_STAT 4096 + +#define EACCESS 2048 +#ifndef EIDRM +#define EIDRM 4096 +#endif + +#define SETALL 8192 +#define GETNCNT 16384 +#define GETVAL 65536 +#define SETVAL 131072 +#define GETPID 262144 + + +/* + * Signal stuff + * + * For WIN32, there is no wait() call so there are no wait() macros + * to interpret the return value of system(). Instead, system() + * return values < 0x100 are used for exit() termination, and higher + * values are used to indicate non-exit() termination, which is + * similar to a unix-style signal exit (think SIGSEGV == + * STATUS_ACCESS_VIOLATION). Return values are broken up into groups: + * + * https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values + * + * NT_SUCCESS 0 - 0x3FFFFFFF + * NT_INFORMATION 0x40000000 - 0x7FFFFFFF + * NT_WARNING 0x80000000 - 0xBFFFFFFF + * NT_ERROR 0xC0000000 - 0xFFFFFFFF + * + * Effectively, we don't care on the severity of the return value from + * system(), we just need to know if it was because of exit() or generated + * by the system, and it seems values >= 0x100 are system-generated. + * See this URL for a list of WIN32 STATUS_* values: + * + * Wine (URL used in our error messages) - + * http://source.winehq.org/source/include/ntstatus.h + * Descriptions - + * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55 + * + * The comprehensive exception list is included in ntstatus.h from the + * Windows Driver Kit (WDK). A subset of the list is also included in + * winnt.h from the Windows SDK. Defining WIN32_NO_STATUS before including + * windows.h helps to avoid any conflicts. + * + * Some day we might want to print descriptions for the most common + * exceptions, rather than printing an include file name. We could use + * RtlNtStatusToDosError() and pass to FormatMessage(), which can print + * the text of error values, but MinGW does not support + * RtlNtStatusToDosError(). + */ +#define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0) +#define WIFSIGNALED(w) (!WIFEXITED(w)) +#define WEXITSTATUS(w) (w) +#define WTERMSIG(w) (w) + +#define sigmask(sig) ( 1 << ((sig)-1) ) + +/* Signal function return values */ +#undef SIG_DFL +#undef SIG_ERR +#undef SIG_IGN +#define SIG_DFL ((pqsigfunc)0) +#define SIG_ERR ((pqsigfunc)-1) +#define SIG_IGN ((pqsigfunc)1) + +/* Some extra signals */ +#define SIGHUP 1 +#define SIGQUIT 3 +#define SIGTRAP 5 +#define SIGABRT 22 /* Set to match W32 value -- not UNIX value */ +#define SIGKILL 9 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGWINCH 28 +#define SIGUSR1 30 +#define SIGUSR2 31 + +/* MinGW has gettimeofday(), but MSVC doesn't */ +#ifdef _MSC_VER +/* Last parameter not used */ +extern int gettimeofday(struct timeval *tp, void *tzp); +#endif + +/* for setitimer in backend/port/win32/timer.c */ +#define ITIMER_REAL 0 +struct itimerval +{ + struct timeval it_interval; + struct timeval it_value; +}; + +int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue); + +/* Convenience wrapper for GetFileType() */ +extern DWORD pgwin32_get_file_type(HANDLE hFile); + +/* + * WIN32 does not provide 64-bit off_t, but does provide the functions operating + * with 64-bit offsets. Also, fseek() might not give an error for unseekable + * streams, so harden that function with our version. + */ +#define pgoff_t __int64 + +#ifdef _MSC_VER +extern int _pgfseeko64(FILE *stream, pgoff_t offset, int origin); +extern pgoff_t _pgftello64(FILE *stream); +#define fseeko(stream, offset, origin) _pgfseeko64(stream, offset, origin) +#define ftello(stream) _pgftello64(stream) +#else +#ifndef fseeko +#define fseeko(stream, offset, origin) fseeko64(stream, offset, origin) +#endif +#ifndef ftello +#define ftello(stream) ftello64(stream) +#endif +#endif + +/* + * Win32 also doesn't have symlinks, but we can emulate them with + * junction points on newer Win32 versions. + * + * Cygwin has its own symlinks which work on Win95/98/ME where + * junction points don't, so use those instead. We have no way of + * knowing what type of system Cygwin binaries will be run on. + * Note: Some CYGWIN includes might #define WIN32. + */ +extern int pgsymlink(const char *oldpath, const char *newpath); +extern int pgreadlink(const char *path, char *buf, size_t size); + +#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath) +#define readlink(path, buf, size) pgreadlink(path, buf, size) + +/* + * Supplement to . + * + * Perl already has typedefs for uid_t and gid_t. + */ +#ifndef PLPERL_HAVE_UID_GID +typedef int uid_t; +typedef int gid_t; +#endif +typedef long key_t; + +#ifdef _MSC_VER +typedef int pid_t; +#endif + +/* + * Supplement to . + * + * We must pull in sys/stat.h before this part, else our overrides lose. + * + * stat() is not guaranteed to set the st_size field on win32, so we + * redefine it to our own implementation. See src/port/win32stat.c. + * + * The struct stat is 32 bit in MSVC, so we redefine it as a copy of + * struct __stat64. This also fixes the struct size for MINGW builds. + */ +struct stat /* This should match struct __stat64 */ +{ + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; +}; + +extern int _pgfstat64(int fileno, struct stat *buf); +extern int _pgstat64(const char *name, struct stat *buf); +extern int _pglstat64(const char *name, struct stat *buf); + +#define fstat(fileno, sb) _pgfstat64(fileno, sb) +#define stat(path, sb) _pgstat64(path, sb) +#define lstat(path, sb) _pglstat64(path, sb) + +/* These macros are not provided by older MinGW, nor by MSVC */ +#ifndef S_IRUSR +#define S_IRUSR _S_IREAD +#endif +#ifndef S_IWUSR +#define S_IWUSR _S_IWRITE +#endif +#ifndef S_IXUSR +#define S_IXUSR _S_IEXEC +#endif +#ifndef S_IRWXU +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#ifndef S_IRGRP +#define S_IRGRP 0 +#endif +#ifndef S_IWGRP +#define S_IWGRP 0 +#endif +#ifndef S_IXGRP +#define S_IXGRP 0 +#endif +#ifndef S_IRWXG +#define S_IRWXG 0 +#endif +#ifndef S_IROTH +#define S_IROTH 0 +#endif +#ifndef S_IWOTH +#define S_IWOTH 0 +#endif +#ifndef S_IXOTH +#define S_IXOTH 0 +#endif +#ifndef S_IRWXO +#define S_IRWXO 0 +#endif +#ifndef S_ISDIR +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +/* + * In order for lstat() to be able to report junction points as symlinks, we + * need to hijack a bit in st_mode, since neither MSVC nor MinGW provides + * S_ISLNK and there aren't any spare bits. We'll steal the one for character + * devices, because we don't otherwise make use of those. + */ +#ifdef S_ISLNK +#error "S_ISLNK is already defined" +#endif +#ifdef S_IFLNK +#error "S_IFLNK is already defined" +#endif +#define S_IFLNK S_IFCHR +#define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK) + +/* + * Supplement to . + * This is the same value as _O_NOINHERIT in the MS header file. This is + * to ensure that we don't collide with a future definition. It means + * we cannot use _O_NOINHERIT ourselves. + */ +#define O_DSYNC 0x0080 + +/* + * Our open() replacement does not create inheritable handles, so it is safe to + * ignore O_CLOEXEC. (If we were using Windows' own open(), it might be + * necessary to convert this to _O_NOINHERIT.) + */ +#define O_CLOEXEC 0 + +/* + * Supplement to . + * + * We redefine network-related Berkeley error symbols as the corresponding WSA + * constants. This allows strerror.c to recognize them as being in the Winsock + * error code range and pass them off to win32_socket_strerror(), since + * Windows' version of plain strerror() won't cope. Note that this will break + * if these names are used for anything else besides Windows Sockets errors. + * See TranslateSocketError() when changing this list. + */ +#undef EAGAIN +#define EAGAIN WSAEWOULDBLOCK +#undef EINTR +#define EINTR WSAEINTR +#undef EMSGSIZE +#define EMSGSIZE WSAEMSGSIZE +#undef EAFNOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK +#undef ECONNABORTED +#define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET +#define ECONNRESET WSAECONNRESET +#undef EINPROGRESS +#define EINPROGRESS WSAEINPROGRESS +#undef EISCONN +#define EISCONN WSAEISCONN +#undef ENOBUFS +#define ENOBUFS WSAENOBUFS +#undef EPROTONOSUPPORT +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#undef ECONNREFUSED +#define ECONNREFUSED WSAECONNREFUSED +#undef ENOTSOCK +#define ENOTSOCK WSAENOTSOCK +#undef EOPNOTSUPP +#define EOPNOTSUPP WSAEOPNOTSUPP +#undef EADDRINUSE +#define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef EHOSTDOWN +#define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH +#define EHOSTUNREACH WSAEHOSTUNREACH +#undef ENETDOWN +#define ENETDOWN WSAENETDOWN +#undef ENETRESET +#define ENETRESET WSAENETRESET +#undef ENETUNREACH +#define ENETUNREACH WSAENETUNREACH +#undef ENOTCONN +#define ENOTCONN WSAENOTCONN +#undef ETIMEDOUT +#define ETIMEDOUT WSAETIMEDOUT + +/* + * Locale stuff. + * + * Extended locale functions with gratuitous underscore prefixes. + * (These APIs are nevertheless fully documented by Microsoft.) + */ +#define locale_t _locale_t +#define tolower_l _tolower_l +#define toupper_l _toupper_l +#define towlower_l _towlower_l +#define towupper_l _towupper_l +#define isdigit_l _isdigit_l +#define iswdigit_l _iswdigit_l +#define isalpha_l _isalpha_l +#define iswalpha_l _iswalpha_l +#define isalnum_l _isalnum_l +#define iswalnum_l _iswalnum_l +#define isupper_l _isupper_l +#define iswupper_l _iswupper_l +#define islower_l _islower_l +#define iswlower_l _iswlower_l +#define isgraph_l _isgraph_l +#define iswgraph_l _iswgraph_l +#define isprint_l _isprint_l +#define iswprint_l _iswprint_l +#define ispunct_l _ispunct_l +#define iswpunct_l _iswpunct_l +#define isspace_l _isspace_l +#define iswspace_l _iswspace_l +#define strcoll_l _strcoll_l +#define strxfrm_l _strxfrm_l +#define wcscoll_l _wcscoll_l + +/* + * Versions of libintl >= 0.18? try to replace setlocale() with a macro + * to their own versions. Remove the macro, if it exists, because it + * ends up calling the wrong version when the backend and libintl use + * different versions of msvcrt. + */ +#if defined(setlocale) +#undef setlocale +#endif + +/* + * Define our own wrapper macro around setlocale() to work around bugs in + * Windows' native setlocale() function. + */ +extern char *pgwin32_setlocale(int category, const char *locale); + +#define setlocale(a,b) pgwin32_setlocale(a,b) + + +/* In backend/port/win32/signal.c */ +extern PGDLLIMPORT volatile int pg_signal_queue; +extern PGDLLIMPORT int pg_signal_mask; +extern PGDLLIMPORT HANDLE pgwin32_signal_event; +extern PGDLLIMPORT HANDLE pgwin32_initial_signal_pipe; + +#define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask) +#define PG_SIGNAL_COUNT 32 + +extern void pgwin32_signal_initialize(void); +extern HANDLE pgwin32_create_signal_listener(pid_t pid); +extern void pgwin32_dispatch_queued_signals(void); +extern void pg_queue_signal(int signum); + +/* In src/port/kill.c */ +#define kill(pid,sig) pgkill(pid,sig) +extern int pgkill(int pid, int sig); + +/* In backend/port/win32/socket.c */ +#ifndef FRONTEND +#define socket(af, type, protocol) pgwin32_socket(af, type, protocol) +#define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen) +#define listen(s, backlog) pgwin32_listen(s, backlog) +#define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen) +#define connect(s, name, namelen) pgwin32_connect(s, name, namelen) +#define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout) +#define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags) +#define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags) + +extern SOCKET pgwin32_socket(int af, int type, int protocol); +extern int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen); +extern int pgwin32_listen(SOCKET s, int backlog); +extern SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen); +extern int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen); +extern int pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout); +extern int pgwin32_recv(SOCKET s, char *buf, int len, int flags); +extern int pgwin32_send(SOCKET s, const void *buf, int len, int flags); +extern int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout); + +extern PGDLLIMPORT int pgwin32_noblock; + +#endif /* FRONTEND */ + +/* in backend/port/win32_shmem.c */ +extern int pgwin32_ReserveSharedMemoryRegion(HANDLE); + +/* in backend/port/win32/crashdump.c */ +extern void pgwin32_install_crashdump_handler(void); + +/* in port/win32dlopen.c */ +extern void *dlopen(const char *file, int mode); +extern void *dlsym(void *handle, const char *symbol); +extern int dlclose(void *handle); +extern char *dlerror(void); + +#define RTLD_NOW 1 +#define RTLD_GLOBAL 0 + +/* in port/win32error.c */ +extern void _dosmaperr(unsigned long); + +/* in port/win32env.c */ +extern int pgwin32_putenv(const char *); +extern int pgwin32_setenv(const char *name, const char *value, int overwrite); +extern int pgwin32_unsetenv(const char *name); + +#define putenv(x) pgwin32_putenv(x) +#define setenv(x,y,z) pgwin32_setenv(x,y,z) +#define unsetenv(x) pgwin32_unsetenv(x) + +/* in port/win32security.c */ +extern int pgwin32_is_service(void); +extern int pgwin32_is_admin(void); + +/* Windows security token manipulation (in src/common/exec.c) */ +extern BOOL AddUserToTokenDacl(HANDLE hToken); + +/* Things that exist in MinGW headers, but need to be added to MSVC */ +#ifdef _MSC_VER + +#ifndef _WIN64 +typedef long ssize_t; +#else +typedef __int64 ssize_t; +#endif + +typedef unsigned short mode_t; + +#define F_OK 0 +#define W_OK 2 +#define R_OK 4 + +#endif /* _MSC_VER */ + +#if defined(__MINGW32__) || defined(__MINGW64__) +/* + * Mingw claims to have a strtof, and my reading of its source code suggests + * that it ought to work (and not need this hack), but the regression test + * results disagree with me; whether this is a version issue or not is not + * clear. However, using our wrapper (and the misrounded-input variant file, + * already required for supporting ancient systems) can't make things any + * worse, except for a tiny performance loss when reading zeros. + * + * See also cygwin.h for another instance of this. + */ +#define HAVE_BUGGY_STRTOF 1 +#endif + +/* in port/win32pread.c */ +extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset); + +/* in port/win32pwrite.c */ +extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset); + +#endif /* PG_WIN32_PORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/port/win32ntdll.h b/platform/dbops/binaries/postgres/include/server/port/win32ntdll.h new file mode 100644 index 0000000000000000000000000000000000000000..c8d22734832ca9dd46df9c9cc5a448b128949053 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/port/win32ntdll.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * win32ntdll.h + * Dynamically loaded Windows NT functions. + * + * Portions Copyright (c) 2021-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/port/win32ntdll.h + * + *------------------------------------------------------------------------- + */ + +#ifndef WIN32NTDLL_H +#define WIN32NTDLL_H + +#include +#include + +#ifndef FLUSH_FLAGS_FILE_DATA_SYNC_ONLY +#define FLUSH_FLAGS_FILE_DATA_SYNC_ONLY 0x4 +#endif + +typedef NTSTATUS (__stdcall * RtlGetLastNtStatus_t) (void); +typedef ULONG (__stdcall * RtlNtStatusToDosError_t) (NTSTATUS); +typedef NTSTATUS (__stdcall * NtFlushBuffersFileEx_t) (HANDLE, ULONG, PVOID, ULONG, PIO_STATUS_BLOCK); + +extern PGDLLIMPORT RtlGetLastNtStatus_t pg_RtlGetLastNtStatus; +extern PGDLLIMPORT RtlNtStatusToDosError_t pg_RtlNtStatusToDosError; +extern PGDLLIMPORT NtFlushBuffersFileEx_t pg_NtFlushBuffersFileEx; + +extern int initialize_ntdll(void); + +#endif /* WIN32NTDLL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/portability/instr_time.h b/platform/dbops/binaries/postgres/include/server/portability/instr_time.h new file mode 100644 index 0000000000000000000000000000000000000000..a6fc1922f2080d5d536bd391d21c06626f31a398 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/portability/instr_time.h @@ -0,0 +1,197 @@ +/*------------------------------------------------------------------------- + * + * instr_time.h + * portable high-precision interval timing + * + * This file provides an abstraction layer to hide portability issues in + * interval timing. On Unix we use clock_gettime(), and on Windows we use + * QueryPerformanceCounter(). These macros also give some breathing room to + * use other high-precision-timing APIs. + * + * The basic data type is instr_time, which all callers should treat as an + * opaque typedef. instr_time can store either an absolute time (of + * unspecified reference time) or an interval. The operations provided + * for it are: + * + * INSTR_TIME_IS_ZERO(t) is t equal to zero? + * + * INSTR_TIME_SET_ZERO(t) set t to zero (memset is acceptable too) + * + * INSTR_TIME_SET_CURRENT(t) set t to current time + * + * INSTR_TIME_SET_CURRENT_LAZY(t) set t to current time if t is zero, + * evaluates to whether t changed + * + * INSTR_TIME_ADD(x, y) x += y + * + * INSTR_TIME_SUBTRACT(x, y) x -= y + * + * INSTR_TIME_ACCUM_DIFF(x, y, z) x += (y - z) + * + * INSTR_TIME_GET_DOUBLE(t) convert t to double (in seconds) + * + * INSTR_TIME_GET_MILLISEC(t) convert t to double (in milliseconds) + * + * INSTR_TIME_GET_MICROSEC(t) convert t to uint64 (in microseconds) + * + * INSTR_TIME_GET_NANOSEC(t) convert t to uint64 (in nanoseconds) + * + * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert + * absolute times to intervals. The INSTR_TIME_GET_xxx operations are + * only useful on intervals. + * + * When summing multiple measurements, it's recommended to leave the + * running sum in instr_time form (ie, use INSTR_TIME_ADD or + * INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end. + * + * Beware of multiple evaluations of the macro arguments. + * + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/portability/instr_time.h + * + *------------------------------------------------------------------------- + */ +#ifndef INSTR_TIME_H +#define INSTR_TIME_H + + +/* + * We store interval times as an int64 integer on all platforms, as int64 is + * cheap to add/subtract, the most common operation for instr_time. The + * acquisition of time and converting to specific units of time is platform + * specific. + * + * To avoid users of the API relying on the integer representation, we wrap + * the 64bit integer in a struct. + */ +typedef struct instr_time +{ + int64 ticks; /* in platforms specific unit */ +} instr_time; + + +/* helpers macros used in platform specific code below */ + +#define NS_PER_S INT64CONST(1000000000) +#define NS_PER_MS INT64CONST(1000000) +#define NS_PER_US INT64CONST(1000) + + +#ifndef WIN32 + + +/* Use clock_gettime() */ + +#include + +/* + * The best clockid to use according to the POSIX spec is CLOCK_MONOTONIC, + * since that will give reliable interval timing even in the face of changes + * to the system clock. However, POSIX doesn't require implementations to + * provide anything except CLOCK_REALTIME, so fall back to that if we don't + * find CLOCK_MONOTONIC. + * + * Also, some implementations have nonstandard clockids with better properties + * than CLOCK_MONOTONIC. In particular, as of macOS 10.12, Apple provides + * CLOCK_MONOTONIC_RAW which is both faster to read and higher resolution than + * their version of CLOCK_MONOTONIC. + */ +#if defined(__darwin__) && defined(CLOCK_MONOTONIC_RAW) +#define PG_INSTR_CLOCK CLOCK_MONOTONIC_RAW +#elif defined(CLOCK_MONOTONIC) +#define PG_INSTR_CLOCK CLOCK_MONOTONIC +#else +#define PG_INSTR_CLOCK CLOCK_REALTIME +#endif + +/* helper for INSTR_TIME_SET_CURRENT */ +static inline instr_time +pg_clock_gettime_ns(void) +{ + instr_time now; + struct timespec tmp; + + clock_gettime(PG_INSTR_CLOCK, &tmp); + now.ticks = tmp.tv_sec * NS_PER_S + tmp.tv_nsec; + + return now; +} + +#define INSTR_TIME_SET_CURRENT(t) \ + ((t) = pg_clock_gettime_ns()) + +#define INSTR_TIME_GET_NANOSEC(t) \ + ((int64) (t).ticks) + + +#else /* WIN32 */ + + +/* Use QueryPerformanceCounter() */ + +/* helper for INSTR_TIME_SET_CURRENT */ +static inline instr_time +pg_query_performance_counter(void) +{ + instr_time now; + LARGE_INTEGER tmp; + + QueryPerformanceCounter(&tmp); + now.ticks = tmp.QuadPart; + + return now; +} + +static inline double +GetTimerFrequency(void) +{ + LARGE_INTEGER f; + + QueryPerformanceFrequency(&f); + return (double) f.QuadPart; +} + +#define INSTR_TIME_SET_CURRENT(t) \ + ((t) = pg_query_performance_counter()) + +#define INSTR_TIME_GET_NANOSEC(t) \ + ((int64) ((t).ticks * ((double) NS_PER_S / GetTimerFrequency()))) + +#endif /* WIN32 */ + + +/* + * Common macros + */ + +#define INSTR_TIME_IS_ZERO(t) ((t).ticks == 0) + + +#define INSTR_TIME_SET_ZERO(t) ((t).ticks = 0) + +#define INSTR_TIME_SET_CURRENT_LAZY(t) \ + (INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT(t), true : false) + + +#define INSTR_TIME_ADD(x,y) \ + ((x).ticks += (y).ticks) + +#define INSTR_TIME_SUBTRACT(x,y) \ + ((x).ticks -= (y).ticks) + +#define INSTR_TIME_ACCUM_DIFF(x,y,z) \ + ((x).ticks += (y).ticks - (z).ticks) + + +#define INSTR_TIME_GET_DOUBLE(t) \ + ((double) INSTR_TIME_GET_NANOSEC(t) / NS_PER_S) + +#define INSTR_TIME_GET_MILLISEC(t) \ + ((double) INSTR_TIME_GET_NANOSEC(t) / NS_PER_MS) + +#define INSTR_TIME_GET_MICROSEC(t) \ + (INSTR_TIME_GET_NANOSEC(t) / NS_PER_US) + +#endif /* INSTR_TIME_H */ diff --git a/platform/dbops/binaries/postgres/include/server/portability/mem.h b/platform/dbops/binaries/postgres/include/server/portability/mem.h new file mode 100644 index 0000000000000000000000000000000000000000..2cd05313b829cbcae89e531fe94d1a68d2f01daf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/portability/mem.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * mem.h + * portability definitions for various memory operations + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/portability/mem.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEM_H +#define MEM_H + +#define IPCProtection (0600) /* access/modify by user only */ + +#ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */ +#define PG_SHMAT_FLAGS SHM_SHARE_MMU +#else +#define PG_SHMAT_FLAGS 0 +#endif + +/* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */ +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +/* BSD-derived systems have MAP_HASSEMAPHORE, but it's not present (or needed) on Linux. */ +#ifndef MAP_HASSEMAPHORE +#define MAP_HASSEMAPHORE 0 +#endif + +/* + * BSD-derived systems use the MAP_NOSYNC flag to prevent dirty mmap(2) + * pages from being gratuitously flushed to disk. + */ +#ifndef MAP_NOSYNC +#define MAP_NOSYNC 0 +#endif + +#define PG_MMAP_FLAGS (MAP_SHARED|MAP_ANONYMOUS|MAP_HASSEMAPHORE) + +/* Some really old systems don't define MAP_FAILED. */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *) -1) +#endif + +#endif /* MEM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/autovacuum.h b/platform/dbops/binaries/postgres/include/server/postmaster/autovacuum.h new file mode 100644 index 0000000000000000000000000000000000000000..cae1e8b3294f2727ad9b6dd6928c2a13ddaebc73 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/autovacuum.h @@ -0,0 +1,69 @@ +/*------------------------------------------------------------------------- + * + * autovacuum.h + * header file for integrated autovacuum daemon + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/autovacuum.h + * + *------------------------------------------------------------------------- + */ +#ifndef AUTOVACUUM_H +#define AUTOVACUUM_H + +#include "storage/block.h" + +/* + * Other processes can request specific work from autovacuum, identified by + * AutoVacuumWorkItem elements. + */ +typedef enum +{ + AVW_BRINSummarizeRange, +} AutoVacuumWorkItemType; + + +/* GUC variables */ +extern PGDLLIMPORT bool autovacuum_start_daemon; +extern PGDLLIMPORT int autovacuum_max_workers; +extern PGDLLIMPORT int autovacuum_work_mem; +extern PGDLLIMPORT int autovacuum_naptime; +extern PGDLLIMPORT int autovacuum_vac_thresh; +extern PGDLLIMPORT double autovacuum_vac_scale; +extern PGDLLIMPORT int autovacuum_vac_ins_thresh; +extern PGDLLIMPORT double autovacuum_vac_ins_scale; +extern PGDLLIMPORT int autovacuum_anl_thresh; +extern PGDLLIMPORT double autovacuum_anl_scale; +extern PGDLLIMPORT int autovacuum_freeze_max_age; +extern PGDLLIMPORT int autovacuum_multixact_freeze_max_age; +extern PGDLLIMPORT double autovacuum_vac_cost_delay; +extern PGDLLIMPORT int autovacuum_vac_cost_limit; + +/* autovacuum launcher PID, only valid when worker is shutting down */ +extern PGDLLIMPORT int AutovacuumLauncherPid; + +extern PGDLLIMPORT int Log_autovacuum_min_duration; + +/* Status inquiry functions */ +extern bool AutoVacuumingActive(void); + +/* called from postmaster at server startup */ +extern void autovac_init(void); + +/* called from postmaster when a worker could not be forked */ +extern void AutoVacWorkerFailed(void); + +extern void AutoVacLauncherMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); +extern void AutoVacWorkerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +extern bool AutoVacuumRequestWork(AutoVacuumWorkItemType type, + Oid relationId, BlockNumber blkno); + +/* shared memory stuff */ +extern Size AutoVacuumShmemSize(void); +extern void AutoVacuumShmemInit(void); + +#endif /* AUTOVACUUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/auxprocess.h b/platform/dbops/binaries/postgres/include/server/postmaster/auxprocess.h new file mode 100644 index 0000000000000000000000000000000000000000..4e80b1cfec7f3ea41e71461718755cd8a63708a7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/auxprocess.h @@ -0,0 +1,18 @@ +/*------------------------------------------------------------------------- + * auxprocess.h + * include file for functions related to auxiliary processes. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/auxprocess.h + *------------------------------------------------------------------------- + */ +#ifndef AUXPROCESS_H +#define AUXPROCESS_H + +extern void AuxiliaryProcessMainCommon(void); + +#endif /* AUXPROCESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/bgworker.h b/platform/dbops/binaries/postgres/include/server/postmaster/bgworker.h new file mode 100644 index 0000000000000000000000000000000000000000..22fc49ec27f4efd51795aa6b2e7c906d00149099 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/bgworker.h @@ -0,0 +1,164 @@ +/*-------------------------------------------------------------------- + * bgworker.h + * POSTGRES pluggable background workers interface + * + * A background worker is a process able to run arbitrary, user-supplied code, + * including normal transactions. + * + * Any external module loaded via shared_preload_libraries can register a + * worker. Workers can also be registered dynamically at runtime. In either + * case, the worker process is forked from the postmaster and runs the + * user-supplied "main" function. This code may connect to a database and + * run transactions. Workers can remain active indefinitely, but will be + * terminated if a shutdown or crash occurs. + * + * If the fork() call fails in the postmaster, it will try again later. Note + * that the failure can only be transient (fork failure due to high load, + * memory pressure, too many processes, etc); more permanent problems, like + * failure to connect to a database, are detected later in the worker and dealt + * with just by having the worker exit normally. A worker which exits with + * a return code of 0 will never be restarted and will be removed from worker + * list. A worker which exits with a return code of 1 will be restarted after + * the configured restart interval (unless that interval is BGW_NEVER_RESTART). + * The TerminateBackgroundWorker() function can be used to terminate a + * dynamically registered background worker; the worker will be sent a SIGTERM + * and will not be restarted after it exits. Whenever the postmaster knows + * that a worker will not be restarted, it unregisters the worker, freeing up + * that worker's slot for use by a new worker. + * + * Note that there might be more than one worker in a database concurrently, + * and the same module may request more than one worker running the same (or + * different) code. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/bgworker.h + *-------------------------------------------------------------------- + */ +#ifndef BGWORKER_H +#define BGWORKER_H + +/*--------------------------------------------------------------------- + * External module API. + *--------------------------------------------------------------------- + */ + +/* + * Pass this flag to have your worker be able to connect to shared memory. + * This flag is required. + */ +#define BGWORKER_SHMEM_ACCESS 0x0001 + +/* + * This flag means the bgworker requires a database connection. The connection + * is not established automatically; the worker must establish it later. + * It requires that BGWORKER_SHMEM_ACCESS was passed too. + */ +#define BGWORKER_BACKEND_DATABASE_CONNECTION 0x0002 + +/* + * This class is used internally for parallel queries, to keep track of the + * number of active parallel workers and make sure we never launch more than + * max_parallel_workers parallel workers at the same time. Third party + * background workers should not use this class. + */ +#define BGWORKER_CLASS_PARALLEL 0x0010 +/* add additional bgworker classes here */ + + +typedef void (*bgworker_main_type) (Datum main_arg); + +/* + * Points in time at which a bgworker can request to be started + */ +typedef enum +{ + BgWorkerStart_PostmasterStart, + BgWorkerStart_ConsistentState, + BgWorkerStart_RecoveryFinished, +} BgWorkerStartTime; + +#define BGW_DEFAULT_RESTART_INTERVAL 60 +#define BGW_NEVER_RESTART -1 +#define BGW_MAXLEN 96 +#define BGW_EXTRALEN 128 + +typedef struct BackgroundWorker +{ + char bgw_name[BGW_MAXLEN]; + char bgw_type[BGW_MAXLEN]; + int bgw_flags; + BgWorkerStartTime bgw_start_time; + int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */ + char bgw_library_name[MAXPGPATH]; + char bgw_function_name[BGW_MAXLEN]; + Datum bgw_main_arg; + char bgw_extra[BGW_EXTRALEN]; + pid_t bgw_notify_pid; /* SIGUSR1 this backend on start/stop */ +} BackgroundWorker; + +typedef enum BgwHandleStatus +{ + BGWH_STARTED, /* worker is running */ + BGWH_NOT_YET_STARTED, /* worker hasn't been started yet */ + BGWH_STOPPED, /* worker has exited */ + BGWH_POSTMASTER_DIED, /* postmaster died; worker status unclear */ +} BgwHandleStatus; + +struct BackgroundWorkerHandle; +typedef struct BackgroundWorkerHandle BackgroundWorkerHandle; + +/* Register a new bgworker during shared_preload_libraries */ +extern void RegisterBackgroundWorker(BackgroundWorker *worker); + +/* Register a new bgworker from a regular backend */ +extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker, + BackgroundWorkerHandle **handle); + +/* Query the status of a bgworker */ +extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle, + pid_t *pidp); +extern BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pidp); +extern BgwHandleStatus + WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *); +extern const char *GetBackgroundWorkerTypeByPid(pid_t pid); + +/* Terminate a bgworker */ +extern void TerminateBackgroundWorker(BackgroundWorkerHandle *handle); + +/* This is valid in a running worker */ +extern PGDLLIMPORT BackgroundWorker *MyBgworkerEntry; + +/* + * Connect to the specified database, as the specified user. Only a worker + * that passed BGWORKER_BACKEND_DATABASE_CONNECTION during registration may + * call this. + * + * If username is NULL, bootstrapping superuser is used. + * If dbname is NULL, connection is made to no specific database; + * only shared catalogs can be accessed. + */ +extern void BackgroundWorkerInitializeConnection(const char *dbname, const char *username, uint32 flags); + +/* Just like the above, but specifying database and user by OID. */ +extern void BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid, uint32 flags); + +/* + * Flags to BackgroundWorkerInitializeConnection et al + * + * + * Allow bypassing datallowconn restrictions and login check when connecting + * to database + */ +#define BGWORKER_BYPASS_ALLOWCONN 0x0001 +#define BGWORKER_BYPASS_ROLELOGINCHECK 0x0002 + + +/* Block/unblock signals in a background worker process */ +extern void BackgroundWorkerBlockSignals(void); +extern void BackgroundWorkerUnblockSignals(void); + +#endif /* BGWORKER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/bgworker_internals.h b/platform/dbops/binaries/postgres/include/server/postmaster/bgworker_internals.h new file mode 100644 index 0000000000000000000000000000000000000000..9106a0ef3f08ed5e7da065e4061a7b2e1c688bf2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/bgworker_internals.h @@ -0,0 +1,60 @@ +/*-------------------------------------------------------------------- + * bgworker_internals.h + * POSTGRES pluggable background workers internals + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/bgworker_internals.h + *-------------------------------------------------------------------- + */ +#ifndef BGWORKER_INTERNALS_H +#define BGWORKER_INTERNALS_H + +#include "datatype/timestamp.h" +#include "lib/ilist.h" +#include "postmaster/bgworker.h" + +/* GUC options */ + +/* + * Maximum possible value of parallel workers. + */ +#define MAX_PARALLEL_WORKER_LIMIT 1024 + +/* + * List of background workers, private to postmaster. + * + * A worker that requests a database connection during registration will have + * rw_backend set, and will be present in BackendList. Note: do not rely on + * rw_backend being non-NULL for shmem-connected workers! + */ +typedef struct RegisteredBgWorker +{ + BackgroundWorker rw_worker; /* its registry entry */ + struct bkend *rw_backend; /* its BackendList entry, or NULL */ + pid_t rw_pid; /* 0 if not running */ + int rw_child_slot; + TimestampTz rw_crashed_at; /* if not 0, time it last crashed */ + int rw_shmem_slot; + bool rw_terminate; + slist_node rw_lnode; /* list link */ +} RegisteredBgWorker; + +extern PGDLLIMPORT slist_head BackgroundWorkerList; + +extern Size BackgroundWorkerShmemSize(void); +extern void BackgroundWorkerShmemInit(void); +extern void BackgroundWorkerStateChange(bool allow_new_workers); +extern void ForgetBackgroundWorker(slist_mutable_iter *cur); +extern void ReportBackgroundWorkerPID(RegisteredBgWorker *); +extern void ReportBackgroundWorkerExit(slist_mutable_iter *cur); +extern void BackgroundWorkerStopNotifications(pid_t pid); +extern void ForgetUnstartedBackgroundWorkers(void); +extern void ResetBackgroundWorkerCrashTimes(void); + +/* Entry point for background worker processes */ +extern void BackgroundWorkerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +#endif /* BGWORKER_INTERNALS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/bgwriter.h b/platform/dbops/binaries/postgres/include/server/postmaster/bgwriter.h new file mode 100644 index 0000000000000000000000000000000000000000..407f26e53025f97cae3a82179334243bd00a16ff --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/bgwriter.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * bgwriter.h + * Exports from postmaster/bgwriter.c and postmaster/checkpointer.c. + * + * The bgwriter process used to handle checkpointing duties too. Now + * there is a separate process, but we did not bother to split this header. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/postmaster/bgwriter.h + * + *------------------------------------------------------------------------- + */ +#ifndef _BGWRITER_H +#define _BGWRITER_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "storage/sync.h" + + +/* GUC options */ +extern PGDLLIMPORT int BgWriterDelay; +extern PGDLLIMPORT int CheckPointTimeout; +extern PGDLLIMPORT int CheckPointWarning; +extern PGDLLIMPORT double CheckPointCompletionTarget; + +extern void BackgroundWriterMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); +extern void CheckpointerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +extern void RequestCheckpoint(int flags); +extern void CheckpointWriteDelay(int flags, double progress); + +extern bool ForwardSyncRequest(const FileTag *ftag, SyncRequestType type); + +extern void AbsorbSyncRequests(void); + +extern Size CheckpointerShmemSize(void); +extern void CheckpointerShmemInit(void); + +extern bool FirstCallSinceLastCheckpoint(void); + +#endif /* _BGWRITER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/fork_process.h b/platform/dbops/binaries/postgres/include/server/postmaster/fork_process.h new file mode 100644 index 0000000000000000000000000000000000000000..d27d3d28fef5893d5f6c21c67683e1e4dde5c7b9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/fork_process.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * fork_process.h + * Exports from postmaster/fork_process.c. + * + * Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/postmaster/fork_process.h + * + *------------------------------------------------------------------------- + */ +#ifndef FORK_PROCESS_H +#define FORK_PROCESS_H + +extern pid_t fork_process(void); + +#endif /* FORK_PROCESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/interrupt.h b/platform/dbops/binaries/postgres/include/server/postmaster/interrupt.h new file mode 100644 index 0000000000000000000000000000000000000000..341a09d83fe46b29870ff7812f985d56ea0f749f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/interrupt.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * interrupt.h + * Interrupt handling routines. + * + * Responses to interrupts are fairly varied and many types of backends + * have their own implementations, but we provide a few generic things + * here to facilitate code reuse. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/postmaster/interrupt.h + * + *------------------------------------------------------------------------- + */ + +#ifndef INTERRUPT_H +#define INTERRUPT_H + +#include + +extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; +extern PGDLLIMPORT volatile sig_atomic_t ShutdownRequestPending; + +extern void HandleMainLoopInterrupts(void); +extern void SignalHandlerForConfigReload(SIGNAL_ARGS); +extern void SignalHandlerForCrashExit(SIGNAL_ARGS); +extern void SignalHandlerForShutdownRequest(SIGNAL_ARGS); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/pgarch.h b/platform/dbops/binaries/postgres/include/server/postmaster/pgarch.h new file mode 100644 index 0000000000000000000000000000000000000000..a7a417226b01218979e90333166c46068c04234a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/pgarch.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------------------------- + * + * pgarch.h + * Exports from postmaster/pgarch.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/pgarch.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PGARCH_H +#define _PGARCH_H + +/* ---------- + * Archiver control info. + * + * We expect that archivable files within pg_wal will have names between + * MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters + * appearing in VALID_XFN_CHARS. The status files in archive_status have + * corresponding names with ".ready" or ".done" appended. + * ---------- + */ +#define MIN_XFN_CHARS 16 +#define MAX_XFN_CHARS 40 +#define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial" + +extern Size PgArchShmemSize(void); +extern void PgArchShmemInit(void); +extern bool PgArchCanRestart(void); +extern void PgArchiverMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); +extern void PgArchWakeup(void); +extern void PgArchForceDirScan(void); + +#endif /* _PGARCH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/postmaster.h b/platform/dbops/binaries/postgres/include/server/postmaster/postmaster.h new file mode 100644 index 0000000000000000000000000000000000000000..89ad13b788b1edc5bb842f5701dbb8e306706249 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/postmaster.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * postmaster.h + * Exports from postmaster/postmaster.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/postmaster/postmaster.h + * + *------------------------------------------------------------------------- + */ +#ifndef _POSTMASTER_H +#define _POSTMASTER_H + +#include "miscadmin.h" + +/* GUC options */ +extern PGDLLIMPORT bool EnableSSL; +extern PGDLLIMPORT int SuperuserReservedConnections; +extern PGDLLIMPORT int ReservedConnections; +extern PGDLLIMPORT int PostPortNumber; +extern PGDLLIMPORT int Unix_socket_permissions; +extern PGDLLIMPORT char *Unix_socket_group; +extern PGDLLIMPORT char *Unix_socket_directories; +extern PGDLLIMPORT char *ListenAddresses; +extern PGDLLIMPORT bool ClientAuthInProgress; +extern PGDLLIMPORT int PreAuthDelay; +extern PGDLLIMPORT int AuthenticationTimeout; +extern PGDLLIMPORT bool Log_connections; +extern PGDLLIMPORT bool log_hostname; +extern PGDLLIMPORT bool enable_bonjour; +extern PGDLLIMPORT char *bonjour_name; +extern PGDLLIMPORT bool restart_after_crash; +extern PGDLLIMPORT bool remove_temp_files_after_crash; +extern PGDLLIMPORT bool send_abort_for_crash; +extern PGDLLIMPORT bool send_abort_for_kill; + +#ifdef WIN32 +extern PGDLLIMPORT HANDLE PostmasterHandle; +#else +extern PGDLLIMPORT int postmaster_alive_fds[2]; + +/* + * Constants that represent which of postmaster_alive_fds is held by + * postmaster, and which is used in children to check for postmaster death. + */ +#define POSTMASTER_FD_WATCH 0 /* used in children to check for + * postmaster death */ +#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ +#endif + +extern PGDLLIMPORT const char *progname; + +extern PGDLLIMPORT bool LoadedSSL; + +extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn(); +extern void ClosePostmasterPorts(bool am_syslogger); +extern void InitProcessGlobals(void); + +extern int MaxLivePostmasterChildren(void); + +extern bool PostmasterMarkPIDForWorkerNotify(int); + +extern void processCancelRequest(int backendPID, int32 cancelAuthCode); + +#ifdef EXEC_BACKEND +extern Size ShmemBackendArraySize(void); +extern void ShmemBackendArrayAllocation(void); + +#ifdef WIN32 +extern void pgwin32_register_deadchild_callback(HANDLE procHandle, DWORD procId); +#endif +#endif + +/* defined in globals.c */ +extern PGDLLIMPORT struct ClientSocket *MyClientSocket; + +/* prototypes for functions in launch_backend.c */ +extern pid_t postmaster_child_launch(BackendType child_type, + char *startup_data, + size_t startup_data_len, + struct ClientSocket *client_sock); +const char *PostmasterChildName(BackendType child_type); +#ifdef EXEC_BACKEND +extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn(); +#endif + +/* + * Note: MAX_BACKENDS is limited to 2^18-1 because that's the width reserved + * for buffer references in buf_internals.h. This limitation could be lifted + * by using a 64bit state; but it's unlikely to be worthwhile as 2^18-1 + * backends exceed currently realistic configurations. Even if that limitation + * were removed, we still could not a) exceed 2^23-1 because inval.c stores + * the ProcNumber as a 3-byte signed integer, b) INT_MAX/4 because some places + * compute 4*MaxBackends without any overflow check. This is rechecked in the + * relevant GUC check hooks and in RegisterBackgroundWorker(). + */ +#define MAX_BACKENDS 0x3FFFF + +#endif /* _POSTMASTER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/startup.h b/platform/dbops/binaries/postgres/include/server/postmaster/startup.h new file mode 100644 index 0000000000000000000000000000000000000000..dde7ebde88124474f68b002e2f74580804aeb6ca --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/startup.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * startup.h + * Exports from postmaster/startup.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/postmaster/startup.h + * + *------------------------------------------------------------------------- + */ +#ifndef _STARTUP_H +#define _STARTUP_H + +/* + * Log the startup progress message if a timer has expired. + */ +#define ereport_startup_progress(msg, ...) \ + do { \ + long secs; \ + int usecs; \ + if (has_startup_progress_timeout_expired(&secs, &usecs)) \ + ereport(LOG, errmsg(msg, secs, (usecs / 10000), __VA_ARGS__ )); \ + } while(0) + +extern PGDLLIMPORT int log_startup_progress_interval; + +extern void HandleStartupProcInterrupts(void); +extern void StartupProcessMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); +extern void PreRestoreCommand(void); +extern void PostRestoreCommand(void); +extern bool IsPromoteSignaled(void); +extern void ResetPromoteSignaled(void); + +extern void enable_startup_progress_timeout(void); +extern void disable_startup_progress_timeout(void); +extern void begin_startup_progress_phase(void); +extern void startup_progress_timeout_handler(void); +extern bool has_startup_progress_timeout_expired(long *secs, int *usecs); + +#endif /* _STARTUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/syslogger.h b/platform/dbops/binaries/postgres/include/server/postmaster/syslogger.h new file mode 100644 index 0000000000000000000000000000000000000000..0f28ebcba55154576d3760b131097942575e67b0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/syslogger.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * syslogger.h + * Exports from postmaster/syslogger.c. + * + * Copyright (c) 2004-2024, PostgreSQL Global Development Group + * + * src/include/postmaster/syslogger.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SYSLOGGER_H +#define _SYSLOGGER_H + +#include /* for PIPE_BUF */ + + +/* + * Primitive protocol structure for writing to syslogger pipe(s). The idea + * here is to divide long messages into chunks that are not more than + * PIPE_BUF bytes long, which according to POSIX spec must be written into + * the pipe atomically. The pipe reader then uses the protocol headers to + * reassemble the parts of a message into a single string. The reader can + * also cope with non-protocol data coming down the pipe, though we cannot + * guarantee long strings won't get split apart. + * + * We use non-nul bytes in is_last to make the protocol a tiny bit + * more robust against finding a false double nul byte prologue. But + * we still might find it in the len and/or pid bytes unless we're careful. + */ + +#ifdef PIPE_BUF +/* Are there any systems with PIPE_BUF > 64K? Unlikely, but ... */ +#if PIPE_BUF > 65536 +#define PIPE_CHUNK_SIZE 65536 +#else +#define PIPE_CHUNK_SIZE ((int) PIPE_BUF) +#endif +#else /* not defined */ +/* POSIX says the value of PIPE_BUF must be at least 512, so use that */ +#define PIPE_CHUNK_SIZE 512 +#endif + +typedef struct +{ + char nuls[2]; /* always \0\0 */ + uint16 len; /* size of this chunk (counts data only) */ + int32 pid; /* writer's pid */ + bits8 flags; /* bitmask of PIPE_PROTO_* */ + char data[FLEXIBLE_ARRAY_MEMBER]; /* data payload starts here */ +} PipeProtoHeader; + +typedef union +{ + PipeProtoHeader proto; + char filler[PIPE_CHUNK_SIZE]; +} PipeProtoChunk; + +#define PIPE_HEADER_SIZE offsetof(PipeProtoHeader, data) +#define PIPE_MAX_PAYLOAD ((int) (PIPE_CHUNK_SIZE - PIPE_HEADER_SIZE)) + +/* flag bits for PipeProtoHeader->flags */ +#define PIPE_PROTO_IS_LAST 0x01 /* last chunk of message? */ +/* log destinations */ +#define PIPE_PROTO_DEST_STDERR 0x10 +#define PIPE_PROTO_DEST_CSVLOG 0x20 +#define PIPE_PROTO_DEST_JSONLOG 0x40 + +/* GUC options */ +extern PGDLLIMPORT bool Logging_collector; +extern PGDLLIMPORT int Log_RotationAge; +extern PGDLLIMPORT int Log_RotationSize; +extern PGDLLIMPORT char *Log_directory; +extern PGDLLIMPORT char *Log_filename; +extern PGDLLIMPORT bool Log_truncate_on_rotation; +extern PGDLLIMPORT int Log_file_mode; + +#ifndef WIN32 +extern PGDLLIMPORT int syslogPipe[2]; +#else +extern PGDLLIMPORT HANDLE syslogPipe[2]; +#endif + + +extern int SysLogger_Start(void); + +extern void write_syslogger_file(const char *buffer, int count, int destination); + +extern void SysLoggerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +extern bool CheckLogrotateSignal(void); +extern void RemoveLogrotateSignalFiles(void); + +/* + * Name of files saving meta-data information about the log + * files currently in use by the syslogger + */ +#define LOG_METAINFO_DATAFILE "current_logfiles" +#define LOG_METAINFO_DATAFILE_TMP LOG_METAINFO_DATAFILE ".tmp" + +#endif /* _SYSLOGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/walsummarizer.h b/platform/dbops/binaries/postgres/include/server/postmaster/walsummarizer.h new file mode 100644 index 0000000000000000000000000000000000000000..aedca556764c45e5b302ad15d40aa8341ee86736 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/walsummarizer.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------- + * + * walsummarizer.h + * + * Header file for background WAL summarization process. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/postmaster/walsummarizer.h + * + *------------------------------------------------------------------------- + */ +#ifndef WALSUMMARIZER_H +#define WALSUMMARIZER_H + +#include "access/xlogdefs.h" + +extern PGDLLIMPORT bool summarize_wal; +extern PGDLLIMPORT int wal_summary_keep_time; + +extern Size WalSummarizerShmemSize(void); +extern void WalSummarizerShmemInit(void); +extern void WalSummarizerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +extern void GetWalSummarizerState(TimeLineID *summarized_tli, + XLogRecPtr *summarized_lsn, + XLogRecPtr *pending_lsn, + int *summarizer_pid); +extern XLogRecPtr GetOldestUnsummarizedLSN(TimeLineID *tli, + bool *lsn_is_exact); +extern void SetWalSummarizerLatch(void); +extern void WaitForWalSummarization(XLogRecPtr lsn); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/postmaster/walwriter.h b/platform/dbops/binaries/postgres/include/server/postmaster/walwriter.h new file mode 100644 index 0000000000000000000000000000000000000000..5884d69fed110d9dd10daa2539c1dc5bf679bb4f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/postmaster/walwriter.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * walwriter.h + * Exports from postmaster/walwriter.c. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/postmaster/walwriter.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALWRITER_H +#define _WALWRITER_H + +#define DEFAULT_WAL_WRITER_FLUSH_AFTER ((1024 * 1024) / XLOG_BLCKSZ) + +/* GUC options */ +extern PGDLLIMPORT int WalWriterDelay; +extern PGDLLIMPORT int WalWriterFlushAfter; + +extern void WalWriterMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +#endif /* _WALWRITER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/regex/regcustom.h b/platform/dbops/binaries/postgres/include/server/regex/regcustom.h new file mode 100644 index 0000000000000000000000000000000000000000..af0fe97c796d2a5f3c47cb174a5c567299b901ad --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/regex/regcustom.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regcustom.h + */ + +/* headers if any */ + +/* + * It's against Postgres coding conventions to include postgres.h in a + * header file, but we allow the violation here because the regexp library + * files specifically intend this file to supply application-dependent + * headers, and are careful to include this file before anything else. + */ +#include "postgres.h" + +#include +#include +#include + +#include "mb/pg_wchar.h" + +#include "miscadmin.h" /* needed by rstacktoodeep */ + + +/* overrides for regguts.h definitions, if any */ +#define FUNCPTR(name, args) (*name) args +#define MALLOC(n) palloc_extended((n), MCXT_ALLOC_NO_OOM) +#define FREE(p) pfree(VS(p)) +#define REALLOC(p,n) repalloc_extended(VS(p),(n), MCXT_ALLOC_NO_OOM) +#define INTERRUPT(re) CHECK_FOR_INTERRUPTS() +#define assert(x) Assert(x) + +/* internal character type and related */ +typedef pg_wchar chr; /* the type itself */ +typedef unsigned uchr; /* unsigned type that will hold a chr */ + +#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */ +#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ +#define CHRBITS 32 /* bits in a chr; must not use sizeof */ +#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ +#define CHR_MAX 0x7ffffffe /* CHR_MAX-CHR_MIN+1 must fit in an int, and + * CHR_MAX+1 must fit in a chr variable */ + +/* + * Check if a chr value is in range. Ideally we'd just write this as + * ((c) >= CHR_MIN && (c) <= CHR_MAX) + * However, if chr is unsigned and CHR_MIN is zero, the first part of that + * is a no-op, and certain overly-nannyish compilers give warnings about it. + * So we leave that out here. If you want to make chr signed and/or CHR_MIN + * not zero, redefine this macro as above. Callers should assume that the + * macro may multiply evaluate its argument, even though it does not today. + */ +#define CHR_IS_IN_RANGE(c) ((c) <= CHR_MAX) + +/* + * MAX_SIMPLE_CHR is the cutoff between "simple" and "complicated" processing + * in the color map logic. It should usually be chosen high enough to ensure + * that all common characters are <= MAX_SIMPLE_CHR. However, very large + * values will be counterproductive since they cause more regex setup time. + * Also, small values can be helpful for testing the high-color-map logic + * with plain old ASCII input. + */ +#define MAX_SIMPLE_CHR 0x7FF /* suitable value for Unicode */ + +/* functions operating on chr */ +#define iscalnum(x) pg_wc_isalnum(x) +#define iscalpha(x) pg_wc_isalpha(x) +#define iscdigit(x) pg_wc_isdigit(x) +#define iscspace(x) pg_wc_isspace(x) + +/* and pick up the standard header */ +#include "regex.h" diff --git a/platform/dbops/binaries/postgres/include/server/regex/regerrs.h b/platform/dbops/binaries/postgres/include/server/regex/regerrs.h new file mode 100644 index 0000000000000000000000000000000000000000..2c8873eb81038a4e02d18215d6509271d5e27747 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/regex/regerrs.h @@ -0,0 +1,83 @@ +/* + * src/include/regex/regerrs.h + */ + +{ + REG_OKAY, "REG_OKAY", "no errors detected" +}, + +{ + REG_NOMATCH, "REG_NOMATCH", "failed to match" +}, + +{ + REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)" +}, + +{ + REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" +}, + +{ + REG_ECTYPE, "REG_ECTYPE", "invalid character class" +}, + +{ + REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence" +}, + +{ + REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" +}, + +{ + REG_EBRACK, "REG_EBRACK", "brackets [] not balanced" +}, + +{ + REG_EPAREN, "REG_EPAREN", "parentheses () not balanced" +}, + +{ + REG_EBRACE, "REG_EBRACE", "braces {} not balanced" +}, + +{ + REG_BADBR, "REG_BADBR", "invalid repetition count(s)" +}, + +{ + REG_ERANGE, "REG_ERANGE", "invalid character range" +}, + +{ + REG_ESPACE, "REG_ESPACE", "out of memory" +}, + +{ + REG_BADRPT, "REG_BADRPT", "quantifier operand invalid" +}, + +{ + REG_ASSERT, "REG_ASSERT", "\"cannot happen\" -- you found a bug" +}, + +{ + REG_INVARG, "REG_INVARG", "invalid argument to regex function" +}, + +{ + REG_MIXED, "REG_MIXED", "character widths of regex and string differ" +}, + +{ + REG_BADOPT, "REG_BADOPT", "invalid embedded option" +}, + +{ + REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" +}, + +{ + REG_ECOLORS, "REG_ECOLORS", "too many colors" +}, diff --git a/platform/dbops/binaries/postgres/include/server/regex/regex.h b/platform/dbops/binaries/postgres/include/server/regex/regex.h new file mode 100644 index 0000000000000000000000000000000000000000..f34ee3a85bd576dd4e7121c761cdfa91a0a68941 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/regex/regex.h @@ -0,0 +1,272 @@ +#ifndef _PG_REGEX_H_ +#define _PG_REGEX_H_ /* never again */ +/* + * regular expressions + * + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regex.h + */ + +/* + * This is an implementation of POSIX regex_t, so it clashes with the + * system-provided header. That header might be unintentionally + * included already, so we force that to happen now on all systems to show that + * we can cope and that we completely replace the system regex interfaces. + * + * Note that we avoided using _REGEX_H_ as an include guard, as that confuses + * matters on BSD family systems including macOS that use the same include + * guard. + */ +#ifndef _WIN32 +#include +#endif + +/* Avoid redefinition errors due to the system header. */ +#undef REG_UBACKREF +#undef REG_ULOOKAROUND +#undef REG_UBOUNDS +#undef REG_UBRACES +#undef REG_UBSALNUM +#undef REG_UPBOTCH +#undef REG_UBBS +#undef REG_UNONPOSIX +#undef REG_UUNSPEC +#undef REG_UUNPORT +#undef REG_ULOCALE +#undef REG_UEMPTYMATCH +#undef REG_UIMPOSSIBLE +#undef REG_USHORTEST +#undef REG_BASIC +#undef REG_EXTENDED +#undef REG_ADVF +#undef REG_ADVANCED +#undef REG_QUOTE +#undef REG_NOSPEC +#undef REG_ICASE +#undef REG_NOSUB +#undef REG_EXPANDED +#undef REG_NLSTOP +#undef REG_NLANCH +#undef REG_NEWLINE +#undef REG_PEND +#undef REG_EXPECT +#undef REG_BOSONLY +#undef REG_DUMP +#undef REG_FAKE +#undef REG_PROGRESS +#undef REG_NOTBOL +#undef REG_NOTEOL +#undef REG_STARTEND +#undef REG_FTRACE +#undef REG_MTRACE +#undef REG_SMALL +#undef REG_OKAY +#undef REG_NOMATCH +#undef REG_BADPAT +#undef REG_ECOLLATE +#undef REG_ECTYPE +#undef REG_EESCAPE +#undef REG_ESUBREG +#undef REG_EBRACK +#undef REG_EPAREN +#undef REG_EBRACE +#undef REG_BADBR +#undef REG_ERANGE +#undef REG_ESPACE +#undef REG_BADRPT +#undef REG_ASSERT +#undef REG_INVARG +#undef REG_MIXED +#undef REG_BADOPT +#undef REG_ETOOBIG +#undef REG_ECOLORS +#undef REG_ATOI +#undef REG_ITOA +#undef REG_PREFIX +#undef REG_EXACT + +/* + * Add your own defines, if needed, here. + */ +#include "mb/pg_wchar.h" + +/* + * interface types etc. + */ + +/* + * regoff_t has to be large enough to hold either off_t or ssize_t, + * and must be signed; it's only a guess that long is suitable. + */ +typedef long pg_regoff_t; + +/* + * other interface types + */ + +/* the biggie, a compiled RE (or rather, a front end to same) */ +typedef struct +{ + int re_magic; /* magic number */ + size_t re_nsub; /* number of subexpressions */ + long re_info; /* bitmask of the following flags: */ +#define REG_UBACKREF 000001 /* has back-reference (\n) */ +#define REG_ULOOKAROUND 000002 /* has lookahead/lookbehind constraint */ +#define REG_UBOUNDS 000004 /* has bounded quantifier ({m,n}) */ +#define REG_UBRACES 000010 /* has { that doesn't begin a quantifier */ +#define REG_UBSALNUM 000020 /* has backslash-alphanumeric in non-ARE */ +#define REG_UPBOTCH 000040 /* has unmatched right paren in ERE (legal + * per spec, but that was a mistake) */ +#define REG_UBBS 000100 /* has backslash within bracket expr */ +#define REG_UNONPOSIX 000200 /* has any construct that extends POSIX */ +#define REG_UUNSPEC 000400 /* has any case disallowed by POSIX, e.g. + * an empty branch */ +#define REG_UUNPORT 001000 /* has numeric character code dependency */ +#define REG_ULOCALE 002000 /* has locale dependency */ +#define REG_UEMPTYMATCH 004000 /* can match a zero-length string */ +#define REG_UIMPOSSIBLE 010000 /* provably cannot match anything */ +#define REG_USHORTEST 020000 /* has non-greedy quantifier */ + int re_csize; /* sizeof(character) */ + char *re_endp; /* backward compatibility kludge */ + Oid re_collation; /* Collation that defines LC_CTYPE behavior */ + /* the rest is opaque pointers to hidden innards */ + char *re_guts; /* `char *' is more portable than `void *' */ + char *re_fns; +} pg_regex_t; + +/* result reporting (may acquire more fields later) */ +typedef struct +{ + pg_regoff_t rm_so; /* start of substring */ + pg_regoff_t rm_eo; /* end of substring */ +} pg_regmatch_t; + +/* supplementary control and reporting */ +typedef struct +{ + pg_regmatch_t rm_extend; /* see REG_EXPECT */ +} rm_detail_t; + + + +/* + * regex compilation flags + */ +#define REG_BASIC 000000 /* BREs (convenience) */ +#define REG_EXTENDED 000001 /* EREs */ +#define REG_ADVF 000002 /* advanced features in EREs */ +#define REG_ADVANCED 000003 /* AREs (which are also EREs) */ +#define REG_QUOTE 000004 /* no special characters, none */ +#define REG_NOSPEC REG_QUOTE /* historical synonym */ +#define REG_ICASE 000010 /* ignore case */ +#define REG_NOSUB 000020 /* caller doesn't need subexpr match data */ +#define REG_EXPANDED 000040 /* expanded format, white space & comments */ +#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ +#define REG_NLANCH 000200 /* ^ matches after \n, $ before */ +#define REG_NEWLINE 000300 /* newlines are line terminators */ +#define REG_PEND 000400 /* ugh -- backward-compatibility hack */ +#define REG_EXPECT 001000 /* report details on partial/limited matches */ +#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ +#define REG_DUMP 004000 /* none of your business :-) */ +#define REG_FAKE 010000 /* none of your business :-) */ +#define REG_PROGRESS 020000 /* none of your business :-) */ + + + +/* + * regex execution flags + */ +#define REG_NOTBOL 0001 /* BOS is not BOL */ +#define REG_NOTEOL 0002 /* EOS is not EOL */ +#define REG_STARTEND 0004 /* backward compatibility kludge */ +#define REG_FTRACE 0010 /* none of your business */ +#define REG_MTRACE 0020 /* none of your business */ +#define REG_SMALL 0040 /* none of your business */ + + +/* + * error reporting + * Be careful if modifying the list of error codes -- the table used by + * regerror() is generated automatically from this file! + */ +#define REG_OKAY 0 /* no errors detected */ +#define REG_NOMATCH 1 /* failed to match */ +#define REG_BADPAT 2 /* invalid regexp */ +#define REG_ECOLLATE 3 /* invalid collating element */ +#define REG_ECTYPE 4 /* invalid character class */ +#define REG_EESCAPE 5 /* invalid escape \ sequence */ +#define REG_ESUBREG 6 /* invalid backreference number */ +#define REG_EBRACK 7 /* brackets [] not balanced */ +#define REG_EPAREN 8 /* parentheses () not balanced */ +#define REG_EBRACE 9 /* braces {} not balanced */ +#define REG_BADBR 10 /* invalid repetition count(s) */ +#define REG_ERANGE 11 /* invalid character range */ +#define REG_ESPACE 12 /* out of memory */ +#define REG_BADRPT 13 /* quantifier operand invalid */ +#define REG_ASSERT 15 /* "can't happen" -- you found a bug */ +#define REG_INVARG 16 /* invalid argument to regex function */ +#define REG_MIXED 17 /* character widths of regex and string differ */ +#define REG_BADOPT 18 /* invalid embedded option */ +#define REG_ETOOBIG 19 /* regular expression is too complex */ +#define REG_ECOLORS 20 /* too many colors */ +/* two specials for debugging and testing */ +#define REG_ATOI 101 /* convert error-code name to number */ +#define REG_ITOA 102 /* convert error-code number to name */ +/* non-error result codes for pg_regprefix */ +#define REG_PREFIX (-1) /* identified a common prefix */ +#define REG_EXACT (-2) /* identified an exact match */ + + +/* Redirect the standard typenames to our typenames. */ +#define regoff_t pg_regoff_t +#define regex_t pg_regex_t +#define regmatch_t pg_regmatch_t + + +/* + * the prototypes for exported functions + */ + +/* regcomp.c */ +extern int pg_regcomp(regex_t *re, const pg_wchar *string, size_t len, + int flags, Oid collation); +extern int pg_regexec(regex_t *re, const pg_wchar *string, size_t len, + size_t search_start, rm_detail_t *details, + size_t nmatch, regmatch_t pmatch[], int flags); +extern int pg_regprefix(regex_t *re, pg_wchar **string, size_t *slength); +extern void pg_regfree(regex_t *re); +extern size_t pg_regerror(int errcode, const regex_t *preg, char *errbuf, + size_t errbuf_size); + +/* regexp.c */ +extern regex_t *RE_compile_and_cache(text *text_re, int cflags, Oid collation); +extern bool RE_compile_and_execute(text *text_re, char *dat, int dat_len, + int cflags, Oid collation, + int nmatch, regmatch_t *pmatch); + +#endif /* _PG_REGEX_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/regex/regexport.h b/platform/dbops/binaries/postgres/include/server/regex/regexport.h new file mode 100644 index 0000000000000000000000000000000000000000..ada36990f6f3a3c82f9ccd1cf89dc7aa4f812ee8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/regex/regexport.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * regexport.h + * Declarations for exporting info about a regex's NFA (nondeterministic + * finite automaton) + * + * The functions declared here provide accessors to extract the NFA state + * graph and color character sets of a successfully-compiled regex. + * + * An NFA contains one or more states, numbered 0..N-1. There is an initial + * state, as well as a final state --- reaching the final state denotes + * successful matching of an input string. Each state except the final one + * has some out-arcs that lead to successor states, each arc being labeled + * with a color that represents one or more concrete character codes. + * (The colors of a state's out-arcs need not be distinct, since this is an + * NFA not a DFA.) There are also "pseudocolors" representing start/end of + * line and start/end of string. Colors are numbered 0..C-1, but note that + * color 0 is "white" (all unused characters) and can generally be ignored. + * + * Portions Copyright (c) 2013-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1998, 1999 Henry Spencer + * + * IDENTIFICATION + * src/include/regex/regexport.h + * + *------------------------------------------------------------------------- + */ +#ifndef _REGEXPORT_H_ +#define _REGEXPORT_H_ + +#include "regex/regex.h" + +/* These macros must match corresponding ones in regguts.h: */ +#define COLOR_WHITE 0 /* color for chars not appearing in regex */ +#define COLOR_RAINBOW (-2) /* represents all colors except pseudocolors */ + +/* information about one arc of a regex's NFA */ +typedef struct +{ + int co; /* label (character-set color) of arc */ + int to; /* next state number */ +} regex_arc_t; + + +/* Functions for gathering information about NFA states and arcs */ +extern int pg_reg_getnumstates(const regex_t *regex); +extern int pg_reg_getinitialstate(const regex_t *regex); +extern int pg_reg_getfinalstate(const regex_t *regex); +extern int pg_reg_getnumoutarcs(const regex_t *regex, int st); +extern void pg_reg_getoutarcs(const regex_t *regex, int st, + regex_arc_t *arcs, int arcs_len); + +/* Functions for gathering information about colors */ +extern int pg_reg_getnumcolors(const regex_t *regex); +extern int pg_reg_colorisbegin(const regex_t *regex, int co); +extern int pg_reg_colorisend(const regex_t *regex, int co); +extern int pg_reg_getnumcharacters(const regex_t *regex, int co); +extern void pg_reg_getcharacters(const regex_t *regex, int co, + pg_wchar *chars, int chars_len); + +#endif /* _REGEXPORT_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/regex/regguts.h b/platform/dbops/binaries/postgres/include/server/regex/regguts.h new file mode 100644 index 0000000000000000000000000000000000000000..fd69299a16d2459e4af5471983135a7de8244938 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/regex/regguts.h @@ -0,0 +1,550 @@ +/* + * Internal interface definitions, etc., for the reg package + * + * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. + * + * Development of this software was funded, in part, by Cray Research Inc., + * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics + * Corporation, none of whom are responsible for the results. The author + * thanks all of them. + * + * Redistribution and use in source and binary forms -- with or without + * modification -- are permitted for any purpose, provided that + * redistributions in source form retain this entire copyright notice and + * indicate the origin and nature of any modifications. + * + * I'd appreciate being given credit for this package in the documentation + * of software which uses it, but that is not a requirement. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * src/include/regex/regguts.h + */ + + + +/* + * Environmental customization. It should not (I hope) be necessary to + * alter the file you are now reading -- regcustom.h should handle it all, + * given care here and elsewhere. + */ +#include "regcustom.h" + + + +/* + * Things that regcustom.h might override. + */ + +/* assertions */ +#ifndef assert +#ifndef REG_DEBUG +#define NDEBUG /* no assertions */ +#endif +#include +#endif + +/* voids */ +#ifndef DISCARD +#define DISCARD void /* for throwing values away */ +#endif +#ifndef VS +#define VS(x) ((void *)(x)) /* cast something to generic ptr */ +#endif + +/* function-pointer declarator */ +#ifndef FUNCPTR +#define FUNCPTR(name, args) (*(name)) args +#endif + +/* memory allocation */ +#ifndef MALLOC +#define MALLOC(n) malloc(n) +#endif +#ifndef REALLOC +#define REALLOC(p, n) realloc(VS(p), n) +#endif +#ifndef FREE +#define FREE(p) free(VS(p)) +#endif + +/* interruption */ +#ifndef INTERRUPT +#define INTERRUPT(re) +#endif + +/* want size of a char in bits, and max value in bounded quantifiers */ +#ifndef _POSIX2_RE_DUP_MAX +#define _POSIX2_RE_DUP_MAX 255 /* normally from */ +#endif + + + +/* + * misc + */ + +#define NOTREACHED 0 + +#define DUPMAX _POSIX2_RE_DUP_MAX +#define DUPINF (DUPMAX+1) + +#define REMAGIC 0xfed7 /* magic number for main struct */ + +/* Type codes for lookaround constraints */ +#define LATYPE_AHEAD_POS 03 /* positive lookahead */ +#define LATYPE_AHEAD_NEG 02 /* negative lookahead */ +#define LATYPE_BEHIND_POS 01 /* positive lookbehind */ +#define LATYPE_BEHIND_NEG 00 /* negative lookbehind */ +#define LATYPE_IS_POS(la) ((la) & 01) +#define LATYPE_IS_AHEAD(la) ((la) & 02) + + +/* + * debugging facilities + */ +#ifdef REG_DEBUG +/* FDEBUG does finite-state tracing */ +#define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; } +/* MDEBUG does higher-level tracing */ +#define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; } +#else +#define FDEBUG(arglist) {} +#define MDEBUG(arglist) {} +#endif + + + +/* + * bitmap manipulation + */ +#define UBITS (CHAR_BIT * sizeof(unsigned)) +#define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS)) +#define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS))) + + +/* + * known character classes + */ +enum char_classes +{ + CC_ALNUM, CC_ALPHA, CC_ASCII, CC_BLANK, CC_CNTRL, CC_DIGIT, CC_GRAPH, + CC_LOWER, CC_PRINT, CC_PUNCT, CC_SPACE, CC_UPPER, CC_XDIGIT, CC_WORD +}; + +#define NUM_CCLASSES 14 + + +/* + * As soon as possible, we map chrs into equivalence classes -- "colors" -- + * which are of much more manageable number. + * + * To further reduce the number of arcs in NFAs and DFAs, we also have a + * special RAINBOW "color" that can be assigned to an arc. This is not a + * real color, in that it has no entry in color maps. + */ +typedef short color; /* colors of characters */ + +#define MAX_COLOR 32767 /* max color (must fit in 'color' datatype) */ +#define COLORLESS (-1) /* impossible color */ +#define RAINBOW (-2) /* represents all colors except pseudocolors */ +#define WHITE 0 /* default color, parent of all others */ +/* Note: various places in the code know that WHITE is zero */ + + +/* + * Per-color data structure for the compile-time color machinery + * + * If "sub" is not NOSUB then it is the number of the color's current + * subcolor, i.e. we are in process of dividing this color (character + * equivalence class) into two colors. See src/backend/regex/README for + * discussion of subcolors. + * + * Currently-unused colors have the FREECOL bit set and are linked into a + * freelist using their "sub" fields, but only if their color numbers are + * less than colormap.max. Any array entries beyond "max" are just garbage. + */ +struct colordesc +{ + int nschrs; /* number of simple chars of this color */ + int nuchrs; /* number of upper map entries of this color */ + color sub; /* open subcolor, if any; or free-chain ptr */ +#define NOSUB COLORLESS /* value of "sub" when no open subcolor */ + struct arc *arcs; /* chain of all arcs of this color */ + chr firstchr; /* simple char first assigned to this color */ + int flags; /* bitmask of the following flags: */ +#define FREECOL 01 /* currently free */ +#define PSEUDO 02 /* pseudocolor, no real chars */ +#define COLMARK 04 /* temporary marker used in some functions */ +}; + +#define UNUSEDCOLOR(cd) ((cd)->flags & FREECOL) + +/* + * The color map itself + * + * This struct holds both data used only at compile time, and the chr to + * color mapping information, used at both compile and run time. The latter + * is the bulk of the space, so it's not really worth separating out the + * compile-only portion. + * + * Ideally, the mapping data would just be an array of colors indexed by + * chr codes; but for large character sets that's impractical. Fortunately, + * common characters have smaller codes, so we can use a simple array for chr + * codes up to MAX_SIMPLE_CHR, and do something more complex for codes above + * that, without much loss of performance. The "something more complex" is a + * 2-D array of color entries, where row indexes correspond to individual chrs + * or chr ranges that have been mentioned in the regex (with row zero + * representing all other chrs), and column indexes correspond to different + * sets of locale-dependent character classes such as "isalpha". The + * classbits[k] entry is zero if we do not care about the k'th character class + * in this regex, and otherwise it is the bit to be OR'd into the column index + * if the character in question is a member of that class. We find the color + * of a high-valued chr by identifying which colormaprange it is in to get + * the row index (use row zero if it's in none of them), identifying which of + * the interesting cclasses it's in to get the column index, and then indexing + * into the 2-D hicolormap array. + * + * The colormapranges are required to be nonempty, nonoverlapping, and to + * appear in increasing chr-value order. + */ + +typedef struct colormaprange +{ + chr cmin; /* range represents cmin..cmax inclusive */ + chr cmax; + int rownum; /* row index in hicolormap array (>= 1) */ +} colormaprange; + +struct colormap +{ + int magic; +#define CMMAGIC 0x876 + struct vars *v; /* for compile error reporting */ + size_t ncds; /* allocated length of colordescs array */ + size_t max; /* highest color number currently in use */ + color free; /* beginning of free chain (if non-0) */ + struct colordesc *cd; /* pointer to array of colordescs */ +#define CDEND(cm) (&(cm)->cd[(cm)->max + 1]) + + /* mapping data for chrs <= MAX_SIMPLE_CHR: */ + color *locolormap; /* simple array indexed by chr code */ + + /* mapping data for chrs > MAX_SIMPLE_CHR: */ + int classbits[NUM_CCLASSES]; /* see comment above */ + int numcmranges; /* number of colormapranges */ + colormaprange *cmranges; /* ranges of high chrs */ + color *hicolormap; /* 2-D array of color entries */ + int maxarrayrows; /* number of array rows allocated */ + int hiarrayrows; /* number of array rows in use */ + int hiarraycols; /* number of array columns (2^N) */ + + /* If we need up to NINLINECDS, we store them here to save a malloc */ +#define NINLINECDS ((size_t) 10) + struct colordesc cdspace[NINLINECDS]; +}; + +/* fetch color for chr; beware of multiple evaluation of c argument */ +#define GETCOLOR(cm, c) \ + ((c) <= MAX_SIMPLE_CHR ? (cm)->locolormap[(c) - CHR_MIN] : pg_reg_getcolor(cm, c)) + + +/* + * Interface definitions for locale-interface functions in regc_locale.c. + */ + +/* + * Representation of a set of characters. chrs[] represents individual + * code points, ranges[] represents ranges in the form min..max inclusive. + * + * If the cvec represents a locale-specific character class, eg [[:alpha:]], + * then the chrs[] and ranges[] arrays contain only members of that class + * up to MAX_SIMPLE_CHR (inclusive). cclasscode is set to regc_locale.c's + * code for the class, rather than being -1 as it is in an ordinary cvec. + * + * Note that in cvecs gotten from newcvec() and intended to be freed by + * freecvec(), both arrays of chrs are after the end of the struct, not + * separately malloc'd; so chrspace and rangespace are effectively immutable. + */ +struct cvec +{ + int nchrs; /* number of chrs */ + int chrspace; /* number of chrs allocated in chrs[] */ + chr *chrs; /* pointer to vector of chrs */ + int nranges; /* number of ranges (chr pairs) */ + int rangespace; /* number of ranges allocated in ranges[] */ + chr *ranges; /* pointer to vector of chr pairs */ + int cclasscode; /* value of "enum classes", or -1 */ +}; + + +/* + * definitions for NFA internal representation + */ +struct state; + +struct arc +{ + int type; /* 0 if free, else an NFA arc type code */ + color co; /* color the arc matches (possibly RAINBOW) */ + struct state *from; /* where it's from */ + struct state *to; /* where it's to */ + struct arc *outchain; /* link in *from's outs chain or free chain */ + struct arc *outchainRev; /* back-link in *from's outs chain */ +#define freechain outchain /* we do not maintain "freechainRev" */ + struct arc *inchain; /* link in *to's ins chain */ + struct arc *inchainRev; /* back-link in *to's ins chain */ + /* these fields are not used when co == RAINBOW: */ + struct arc *colorchain; /* link in color's arc chain */ + struct arc *colorchainRev; /* back-link in color's arc chain */ +}; + +struct arcbatch +{ /* for bulk allocation of arcs */ + struct arcbatch *next; /* chain link */ + size_t narcs; /* number of arcs allocated in this arcbatch */ + struct arc a[FLEXIBLE_ARRAY_MEMBER]; +}; +#define ARCBATCHSIZE(n) ((n) * sizeof(struct arc) + offsetof(struct arcbatch, a)) +/* first batch will have FIRSTABSIZE arcs; then double it until MAXABSIZE */ +#define FIRSTABSIZE 64 +#define MAXABSIZE 1024 + +struct state +{ + int no; /* state number, zero and up; or FREESTATE */ +#define FREESTATE (-1) + char flag; /* marks special states */ + int nins; /* number of inarcs */ + int nouts; /* number of outarcs */ + struct arc *ins; /* chain of inarcs */ + struct arc *outs; /* chain of outarcs */ + struct state *tmp; /* temporary for traversal algorithms */ + struct state *next; /* chain for traversing all live states */ + /* the "next" field is also used to chain free states together */ + struct state *prev; /* back-link in chain of all live states */ +}; + +struct statebatch +{ /* for bulk allocation of states */ + struct statebatch *next; /* chain link */ + size_t nstates; /* number of states allocated in this batch */ + struct state s[FLEXIBLE_ARRAY_MEMBER]; +}; +#define STATEBATCHSIZE(n) ((n) * sizeof(struct state) + offsetof(struct statebatch, s)) +/* first batch will have FIRSTSBSIZE states; then double it until MAXSBSIZE */ +#define FIRSTSBSIZE 32 +#define MAXSBSIZE 1024 + +struct nfa +{ + struct state *pre; /* pre-initial state */ + struct state *init; /* initial state */ + struct state *final; /* final state */ + struct state *post; /* post-final state */ + int nstates; /* for numbering states */ + struct state *states; /* chain of live states */ + struct state *slast; /* tail of the chain */ + struct state *freestates; /* chain of free states */ + struct arc *freearcs; /* chain of free arcs */ + struct statebatch *lastsb; /* chain of statebatches */ + struct arcbatch *lastab; /* chain of arcbatches */ + size_t lastsbused; /* number of states consumed from *lastsb */ + size_t lastabused; /* number of arcs consumed from *lastab */ + struct colormap *cm; /* the color map */ + color bos[2]; /* colors, if any, assigned to BOS and BOL */ + color eos[2]; /* colors, if any, assigned to EOS and EOL */ + int flags; /* flags to pass forward to cNFA */ + int minmatchall; /* min number of chrs to match, if matchall */ + int maxmatchall; /* max number of chrs to match, or DUPINF */ + struct vars *v; /* simplifies compile error reporting */ + struct nfa *parent; /* parent NFA, if any */ +}; + + + +/* + * definitions for compacted NFA + * + * The main space savings in a compacted NFA is from making the arcs as small + * as possible. We store only the transition color and next-state number for + * each arc. The list of out arcs for each state is an array beginning at + * cnfa.states[statenumber], and terminated by a dummy carc struct with + * co == COLORLESS. + * + * The non-dummy carc structs are of two types: plain arcs and LACON arcs. + * Plain arcs just store the transition color number as "co". LACON arcs + * store the lookaround constraint number plus cnfa.ncolors as "co". LACON + * arcs can be distinguished from plain by testing for co >= cnfa.ncolors. + * + * Note that in a plain arc, "co" can be RAINBOW; since that's negative, + * it doesn't break the rule about how to recognize LACON arcs. + * + * We have special markings for "trivial" NFAs that can match any string + * (possibly with limits on the number of characters therein). In such a + * case, flags & MATCHALL is set (and HASLACONS can't be set). Then the + * fields minmatchall and maxmatchall give the minimum and maximum numbers + * of characters to match. For example, ".*" produces minmatchall = 0 + * and maxmatchall = DUPINF, while ".+" produces minmatchall = 1 and + * maxmatchall = DUPINF. + */ +struct carc +{ + color co; /* COLORLESS is list terminator */ + int to; /* next-state number */ +}; + +struct cnfa +{ + int nstates; /* number of states */ + int ncolors; /* number of colors (max color in use + 1) */ + int flags; /* bitmask of the following flags: */ +#define HASLACONS 01 /* uses lookaround constraints */ +#define MATCHALL 02 /* matches all strings of a range of lengths */ +#define HASCANTMATCH 04 /* contains CANTMATCH arcs */ + /* Note: HASCANTMATCH appears in nfa structs' flags, but never in cnfas */ + int pre; /* setup state number */ + int post; /* teardown state number */ + color bos[2]; /* colors, if any, assigned to BOS and BOL */ + color eos[2]; /* colors, if any, assigned to EOS and EOL */ + char *stflags; /* vector of per-state flags bytes */ +#define CNFA_NOPROGRESS 01 /* flag bit for a no-progress state */ + struct carc **states; /* vector of pointers to outarc lists */ + /* states[n] are pointers into a single malloc'd array of arcs */ + struct carc *arcs; /* the area for the lists */ + /* these fields are used only in a MATCHALL NFA (else they're -1): */ + int minmatchall; /* min number of chrs to match */ + int maxmatchall; /* max number of chrs to match, or DUPINF */ +}; + +/* + * When debugging, it's helpful if an un-filled CNFA is all-zeroes. + * In production, though, we only require nstates to be zero. + */ +#ifdef REG_DEBUG +#define ZAPCNFA(cnfa) memset(&(cnfa), 0, sizeof(cnfa)) +#else +#define ZAPCNFA(cnfa) ((cnfa).nstates = 0) +#endif +#define NULLCNFA(cnfa) ((cnfa).nstates == 0) + +/* + * This symbol limits the transient heap space used by the regex compiler, + * and thereby also the maximum complexity of NFAs that we'll deal with. + * Currently we only count NFA states and arcs against this; the other + * transient data is generally not large enough to notice compared to those. + * Note that we do not charge anything for the final output data structures + * (the compacted NFA and the colormap). + * The scaling here is based on an empirical measurement that very large + * NFAs tend to have about 4 arcs/state. + */ +#ifndef REG_MAX_COMPILE_SPACE +#define REG_MAX_COMPILE_SPACE \ + (500000 * (sizeof(struct state) + 4 * sizeof(struct arc))) +#endif + +/* + * subexpression tree + * + * "op" is one of: + * '=' plain regex without interesting substructure (implemented as DFA) + * 'b' back-reference (has no substructure either) + * '(' no-op capture node: captures the match of its single child + * '.' concatenation: matches a match for first child, then second child + * '|' alternation: matches a match for any of its children + * '*' iteration: matches some number of matches of its single child + * + * An alternation node can have any number of children (but at least two), + * linked through their sibling fields. + * + * A concatenation node must have exactly two children. It might be useful + * to support more, but that would complicate the executor. Note that it is + * the first child's greediness that determines the node's preference for + * where to split a match. + * + * Note: when a backref is directly quantified, we stick the min/max counts + * into the backref rather than plastering an iteration node on top. This is + * for efficiency: there is no need to search for possible division points. + */ +struct subre +{ + char op; /* see type codes above */ + char flags; +#define LONGER 01 /* prefers longer match */ +#define SHORTER 02 /* prefers shorter match */ +#define MIXED 04 /* mixed preference below */ +#define CAP 010 /* capturing parens here or below */ +#define BACKR 020 /* back reference here or below */ +#define BRUSE 040 /* is referenced by a back reference */ +#define INUSE 0100 /* in use in final tree */ +#define UPPROP (MIXED|CAP|BACKR) /* flags which should propagate up */ +#define LMIX(f) ((f)<<2) /* LONGER -> MIXED */ +#define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */ +#define UP(f) (((f)&UPPROP) | (LMIX(f) & SMIX(f) & MIXED)) +#define MESSY(f) ((f)&(MIXED|CAP|BACKR)) +#define PREF(f) ((f)&(LONGER|SHORTER)) +#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2)) +#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2)) + char latype; /* LATYPE code, if lookaround constraint */ + int id; /* ID of subre (1..ntree-1) */ + int capno; /* if capture node, subno to capture into */ + int backno; /* if backref node, subno it refers to */ + short min; /* min repetitions for iteration or backref */ + short max; /* max repetitions for iteration or backref */ + struct subre *child; /* first child, if any (also freelist chain) */ + struct subre *sibling; /* next child of same parent, if any */ + struct state *begin; /* outarcs from here... */ + struct state *end; /* ...ending in inarcs here */ + struct cnfa cnfa; /* compacted NFA, if any */ + struct subre *chain; /* for bookkeeping and error cleanup */ +}; + + + +/* + * table of function pointers for generic manipulation functions + * A regex_t's re_fns points to one of these. + */ +struct fns +{ + void FUNCPTR(free, (regex_t *)); + int FUNCPTR(stack_too_deep, (void)); +}; + +#define STACK_TOO_DEEP(re) \ + ((*((struct fns *) (re)->re_fns)->stack_too_deep) ()) + + +/* + * the insides of a regex_t, hidden behind a void * + */ +struct guts +{ + int magic; +#define GUTSMAGIC 0xfed9 + int cflags; /* copy of compile flags */ + long info; /* copy of re_info */ + size_t nsub; /* copy of re_nsub */ + struct subre *tree; + struct cnfa search; /* for fast preliminary search */ + int ntree; /* number of subre's, plus one */ + struct colormap cmap; + int FUNCPTR(compare, (const chr *, const chr *, size_t)); + struct subre *lacons; /* lookaround-constraint vector */ + int nlacons; /* size of lacons[]; note that only slots + * numbered 1 .. nlacons-1 are used */ +}; + + +/* prototypes for functions that are exported from regcomp.c to regexec.c */ +extern void pg_set_regex_collation(Oid collation); +extern color pg_reg_getcolor(struct colormap *cm, chr c); diff --git a/platform/dbops/binaries/postgres/include/server/replication/decode.h b/platform/dbops/binaries/postgres/include/server/replication/decode.h new file mode 100644 index 0000000000000000000000000000000000000000..17a5b5e95ab84e636e5c6b1c4eab931c30d82e0e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/decode.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * decode.h + * PostgreSQL WAL to logical transformation + * + * Portions Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef DECODE_H +#define DECODE_H + +#include "access/xlogreader.h" +#include "access/xlogrecord.h" +#include "replication/logical.h" +#include "replication/reorderbuffer.h" + +typedef struct XLogRecordBuffer +{ + XLogRecPtr origptr; + XLogRecPtr endptr; + XLogReaderState *record; +} XLogRecordBuffer; + +extern void xlog_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void heap_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void standby_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); +extern void logicalmsg_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf); + +extern void LogicalDecodingProcessRecord(LogicalDecodingContext *ctx, + XLogReaderState *record); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/replication/logical.h b/platform/dbops/binaries/postgres/include/server/replication/logical.h new file mode 100644 index 0000000000000000000000000000000000000000..aff38e8d049f236c3797752314c3bb2676326f4f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/logical.h @@ -0,0 +1,155 @@ +/*------------------------------------------------------------------------- + * logical.h + * PostgreSQL logical decoding coordination + * + * Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICAL_H +#define LOGICAL_H + +#include "access/xlog.h" +#include "access/xlogreader.h" +#include "replication/output_plugin.h" +#include "replication/slot.h" + +struct LogicalDecodingContext; + +typedef void (*LogicalOutputPluginWriterWrite) (struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid, + bool last_write +); + +typedef LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite; + +typedef void (*LogicalOutputPluginWriterUpdateProgress) (struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid, + bool skipped_xact +); + +typedef struct LogicalDecodingContext +{ + /* memory context this is all allocated in */ + MemoryContext context; + + /* The associated replication slot */ + ReplicationSlot *slot; + + /* infrastructure pieces for decoding */ + XLogReaderState *reader; + struct ReorderBuffer *reorder; + struct SnapBuild *snapshot_builder; + + /* + * Marks the logical decoding context as fast forward decoding one. Such a + * context does not have plugin loaded so most of the following properties + * are unused. + */ + bool fast_forward; + + OutputPluginCallbacks callbacks; + OutputPluginOptions options; + + /* + * User specified options + */ + List *output_plugin_options; + + /* + * User-Provided callback for writing/streaming out data. + */ + LogicalOutputPluginWriterPrepareWrite prepare_write; + LogicalOutputPluginWriterWrite write; + LogicalOutputPluginWriterUpdateProgress update_progress; + + /* + * Output buffer. + */ + StringInfo out; + + /* + * Private data pointer of the output plugin. + */ + void *output_plugin_private; + + /* + * Private data pointer for the data writer. + */ + void *output_writer_private; + + /* + * Does the output plugin support streaming, and is it enabled? + */ + bool streaming; + + /* + * Does the output plugin support two-phase decoding, and is it enabled? + */ + bool twophase; + + /* + * Is two-phase option given by output plugin? + * + * This flag indicates that the plugin passed in the two-phase option as + * part of the START_STREAMING command. We can't rely solely on the + * twophase flag which only tells whether the plugin provided all the + * necessary two-phase callbacks. + */ + bool twophase_opt_given; + + /* + * State for writing output. + */ + bool accept_writes; + bool prepared_write; + XLogRecPtr write_location; + TransactionId write_xid; + /* Are we processing the end LSN of a transaction? */ + bool end_xact; + + /* Do we need to process any change in fast_forward mode? */ + bool processing_required; +} LogicalDecodingContext; + + +extern void CheckLogicalDecodingRequirements(void); + +extern LogicalDecodingContext *CreateInitDecodingContext(const char *plugin, + List *output_plugin_options, + bool need_full_snapshot, + XLogRecPtr restart_lsn, + XLogReaderRoutine *xl_routine, + LogicalOutputPluginWriterPrepareWrite prepare_write, + LogicalOutputPluginWriterWrite do_write, + LogicalOutputPluginWriterUpdateProgress update_progress); +extern LogicalDecodingContext *CreateDecodingContext(XLogRecPtr start_lsn, + List *output_plugin_options, + bool fast_forward, + XLogReaderRoutine *xl_routine, + LogicalOutputPluginWriterPrepareWrite prepare_write, + LogicalOutputPluginWriterWrite do_write, + LogicalOutputPluginWriterUpdateProgress update_progress); +extern void DecodingContextFindStartpoint(LogicalDecodingContext *ctx); +extern bool DecodingContextReady(LogicalDecodingContext *ctx); +extern void FreeDecodingContext(LogicalDecodingContext *ctx); + +extern void LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, + TransactionId xmin); +extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, + XLogRecPtr restart_lsn); +extern void LogicalConfirmReceivedLocation(XLogRecPtr lsn); + +extern bool filter_prepare_cb_wrapper(LogicalDecodingContext *ctx, + TransactionId xid, const char *gid); +extern bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id); +extern void ResetLogicalStreamingState(void); +extern void UpdateDecodingStats(LogicalDecodingContext *ctx); + +extern bool LogicalReplicationSlotHasPendingWal(XLogRecPtr end_of_wal); +extern XLogRecPtr LogicalSlotAdvanceAndCheckSnapState(XLogRecPtr moveto, + bool *found_consistent_snapshot); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/replication/logicallauncher.h b/platform/dbops/binaries/postgres/include/server/replication/logicallauncher.h new file mode 100644 index 0000000000000000000000000000000000000000..ff0438b5bb72342d41c064f44e2ea7dbff0a9664 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/logicallauncher.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------- + * + * logicallauncher.h + * Exports for logical replication launcher. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/replication/logicallauncher.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALLAUNCHER_H +#define LOGICALLAUNCHER_H + +extern PGDLLIMPORT int max_logical_replication_workers; +extern PGDLLIMPORT int max_sync_workers_per_subscription; +extern PGDLLIMPORT int max_parallel_apply_workers_per_subscription; + +extern void ApplyLauncherRegister(void); +extern void ApplyLauncherMain(Datum main_arg); + +extern Size ApplyLauncherShmemSize(void); +extern void ApplyLauncherShmemInit(void); + +extern void ApplyLauncherForgetWorkerStartTime(Oid subid); + +extern void ApplyLauncherWakeupAtCommit(void); +extern void AtEOXact_ApplyLauncher(bool isCommit); + +extern bool IsLogicalLauncher(void); + +extern pid_t GetLeaderApplyWorkerPid(pid_t pid); + +#endif /* LOGICALLAUNCHER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/logicalproto.h b/platform/dbops/binaries/postgres/include/server/replication/logicalproto.h new file mode 100644 index 0000000000000000000000000000000000000000..c409638a2eff6fd2745f2715093190784d7a2597 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/logicalproto.h @@ -0,0 +1,274 @@ +/*------------------------------------------------------------------------- + * + * logicalproto.h + * logical replication protocol + * + * Copyright (c) 2015-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/logicalproto.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICAL_PROTO_H +#define LOGICAL_PROTO_H + +#include "access/xact.h" +#include "executor/tuptable.h" +#include "replication/reorderbuffer.h" +#include "utils/rel.h" + +/* + * Protocol capabilities + * + * LOGICALREP_PROTO_VERSION_NUM is our native protocol. + * LOGICALREP_PROTO_MAX_VERSION_NUM is the greatest version we can support. + * LOGICALREP_PROTO_MIN_VERSION_NUM is the oldest version we + * have backwards compatibility for. The client requests protocol version at + * connect time. + * + * LOGICALREP_PROTO_STREAM_VERSION_NUM is the minimum protocol version with + * support for streaming large transactions. Introduced in PG14. + * + * LOGICALREP_PROTO_TWOPHASE_VERSION_NUM is the minimum protocol version with + * support for two-phase commit decoding (at prepare time). Introduced in PG15. + * + * LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM is the minimum protocol version + * where we support applying large streaming transactions in parallel. + * Introduced in PG16. + */ +#define LOGICALREP_PROTO_MIN_VERSION_NUM 1 +#define LOGICALREP_PROTO_VERSION_NUM 1 +#define LOGICALREP_PROTO_STREAM_VERSION_NUM 2 +#define LOGICALREP_PROTO_TWOPHASE_VERSION_NUM 3 +#define LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM 4 +#define LOGICALREP_PROTO_MAX_VERSION_NUM LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM + +/* + * Logical message types + * + * Used by logical replication wire protocol. + * + * Note: though this is an enum, the values are used to identify message types + * in logical replication protocol, which uses a single byte to identify a + * message type. Hence the values should be single-byte wide and preferably + * human-readable characters. + */ +typedef enum LogicalRepMsgType +{ + LOGICAL_REP_MSG_BEGIN = 'B', + LOGICAL_REP_MSG_COMMIT = 'C', + LOGICAL_REP_MSG_ORIGIN = 'O', + LOGICAL_REP_MSG_INSERT = 'I', + LOGICAL_REP_MSG_UPDATE = 'U', + LOGICAL_REP_MSG_DELETE = 'D', + LOGICAL_REP_MSG_TRUNCATE = 'T', + LOGICAL_REP_MSG_RELATION = 'R', + LOGICAL_REP_MSG_TYPE = 'Y', + LOGICAL_REP_MSG_MESSAGE = 'M', + LOGICAL_REP_MSG_BEGIN_PREPARE = 'b', + LOGICAL_REP_MSG_PREPARE = 'P', + LOGICAL_REP_MSG_COMMIT_PREPARED = 'K', + LOGICAL_REP_MSG_ROLLBACK_PREPARED = 'r', + LOGICAL_REP_MSG_STREAM_START = 'S', + LOGICAL_REP_MSG_STREAM_STOP = 'E', + LOGICAL_REP_MSG_STREAM_COMMIT = 'c', + LOGICAL_REP_MSG_STREAM_ABORT = 'A', + LOGICAL_REP_MSG_STREAM_PREPARE = 'p', +} LogicalRepMsgType; + +/* + * This struct stores a tuple received via logical replication. + * Keep in mind that the columns correspond to the *remote* table. + */ +typedef struct LogicalRepTupleData +{ + /* Array of StringInfos, one per column; some may be unused */ + StringInfoData *colvalues; + /* Array of markers for null/unchanged/text/binary, one per column */ + char *colstatus; + /* Length of above arrays */ + int ncols; +} LogicalRepTupleData; + +/* Possible values for LogicalRepTupleData.colstatus[colnum] */ +/* These values are also used in the on-the-wire protocol */ +#define LOGICALREP_COLUMN_NULL 'n' +#define LOGICALREP_COLUMN_UNCHANGED 'u' +#define LOGICALREP_COLUMN_TEXT 't' +#define LOGICALREP_COLUMN_BINARY 'b' /* added in PG14 */ + +typedef uint32 LogicalRepRelId; + +/* Relation information */ +typedef struct LogicalRepRelation +{ + /* Info coming from the remote side. */ + LogicalRepRelId remoteid; /* unique id of the relation */ + char *nspname; /* schema name */ + char *relname; /* relation name */ + int natts; /* number of columns */ + char **attnames; /* column names */ + Oid *atttyps; /* column types */ + char replident; /* replica identity */ + char relkind; /* remote relation kind */ + Bitmapset *attkeys; /* Bitmap of key columns */ +} LogicalRepRelation; + +/* Type mapping info */ +typedef struct LogicalRepTyp +{ + Oid remoteid; /* unique id of the remote type */ + char *nspname; /* schema name of remote type */ + char *typname; /* name of the remote type */ +} LogicalRepTyp; + +/* Transaction info */ +typedef struct LogicalRepBeginData +{ + XLogRecPtr final_lsn; + TimestampTz committime; + TransactionId xid; +} LogicalRepBeginData; + +typedef struct LogicalRepCommitData +{ + XLogRecPtr commit_lsn; + XLogRecPtr end_lsn; + TimestampTz committime; +} LogicalRepCommitData; + +/* + * Prepared transaction protocol information for begin_prepare, and prepare. + */ +typedef struct LogicalRepPreparedTxnData +{ + XLogRecPtr prepare_lsn; + XLogRecPtr end_lsn; + TimestampTz prepare_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepPreparedTxnData; + +/* + * Prepared transaction protocol information for commit prepared. + */ +typedef struct LogicalRepCommitPreparedTxnData +{ + XLogRecPtr commit_lsn; + XLogRecPtr end_lsn; + TimestampTz commit_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepCommitPreparedTxnData; + +/* + * Rollback Prepared transaction protocol information. The prepare information + * prepare_end_lsn and prepare_time are used to check if the downstream has + * received this prepared transaction in which case it can apply the rollback, + * otherwise, it can skip the rollback operation. The gid alone is not + * sufficient because the downstream node can have a prepared transaction with + * same identifier. + */ +typedef struct LogicalRepRollbackPreparedTxnData +{ + XLogRecPtr prepare_end_lsn; + XLogRecPtr rollback_end_lsn; + TimestampTz prepare_time; + TimestampTz rollback_time; + TransactionId xid; + char gid[GIDSIZE]; +} LogicalRepRollbackPreparedTxnData; + +/* + * Transaction protocol information for stream abort. + */ +typedef struct LogicalRepStreamAbortData +{ + TransactionId xid; + TransactionId subxid; + XLogRecPtr abort_lsn; + TimestampTz abort_time; +} LogicalRepStreamAbortData; + +extern void logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn); +extern void logicalrep_read_begin(StringInfo in, + LogicalRepBeginData *begin_data); +extern void logicalrep_write_commit(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern void logicalrep_read_commit(StringInfo in, + LogicalRepCommitData *commit_data); +extern void logicalrep_write_begin_prepare(StringInfo out, ReorderBufferTXN *txn); +extern void logicalrep_read_begin_prepare(StringInfo in, + LogicalRepPreparedTxnData *begin_data); +extern void logicalrep_write_prepare(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); +extern void logicalrep_read_prepare(StringInfo in, + LogicalRepPreparedTxnData *prepare_data); +extern void logicalrep_write_commit_prepared(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern void logicalrep_read_commit_prepared(StringInfo in, + LogicalRepCommitPreparedTxnData *prepare_data); +extern void logicalrep_write_rollback_prepared(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); +extern void logicalrep_read_rollback_prepared(StringInfo in, + LogicalRepRollbackPreparedTxnData *rollback_data); +extern void logicalrep_write_stream_prepare(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); +extern void logicalrep_read_stream_prepare(StringInfo in, + LogicalRepPreparedTxnData *prepare_data); + +extern void logicalrep_write_origin(StringInfo out, const char *origin, + XLogRecPtr origin_lsn); +extern char *logicalrep_read_origin(StringInfo in, XLogRecPtr *origin_lsn); +extern void logicalrep_write_insert(StringInfo out, TransactionId xid, + Relation rel, + TupleTableSlot *newslot, + bool binary, Bitmapset *columns); +extern LogicalRepRelId logicalrep_read_insert(StringInfo in, LogicalRepTupleData *newtup); +extern void logicalrep_write_update(StringInfo out, TransactionId xid, + Relation rel, + TupleTableSlot *oldslot, + TupleTableSlot *newslot, bool binary, Bitmapset *columns); +extern LogicalRepRelId logicalrep_read_update(StringInfo in, + bool *has_oldtuple, LogicalRepTupleData *oldtup, + LogicalRepTupleData *newtup); +extern void logicalrep_write_delete(StringInfo out, TransactionId xid, + Relation rel, TupleTableSlot *oldslot, + bool binary, Bitmapset *columns); +extern LogicalRepRelId logicalrep_read_delete(StringInfo in, + LogicalRepTupleData *oldtup); +extern void logicalrep_write_truncate(StringInfo out, TransactionId xid, + int nrelids, Oid relids[], + bool cascade, bool restart_seqs); +extern List *logicalrep_read_truncate(StringInfo in, + bool *cascade, bool *restart_seqs); +extern void logicalrep_write_message(StringInfo out, TransactionId xid, XLogRecPtr lsn, + bool transactional, const char *prefix, Size sz, const char *message); +extern void logicalrep_write_rel(StringInfo out, TransactionId xid, + Relation rel, Bitmapset *columns); +extern LogicalRepRelation *logicalrep_read_rel(StringInfo in); +extern void logicalrep_write_typ(StringInfo out, TransactionId xid, + Oid typoid); +extern void logicalrep_read_typ(StringInfo in, LogicalRepTyp *ltyp); +extern void logicalrep_write_stream_start(StringInfo out, TransactionId xid, + bool first_segment); +extern TransactionId logicalrep_read_stream_start(StringInfo in, + bool *first_segment); +extern void logicalrep_write_stream_stop(StringInfo out); +extern void logicalrep_write_stream_commit(StringInfo out, ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); +extern TransactionId logicalrep_read_stream_commit(StringInfo in, + LogicalRepCommitData *commit_data); +extern void logicalrep_write_stream_abort(StringInfo out, TransactionId xid, + TransactionId subxid, + XLogRecPtr abort_lsn, + TimestampTz abort_time, + bool write_abort_info); +extern void logicalrep_read_stream_abort(StringInfo in, + LogicalRepStreamAbortData *abort_data, + bool read_abort_info); +extern const char *logicalrep_message_type(LogicalRepMsgType action); + +#endif /* LOGICAL_PROTO_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/logicalrelation.h b/platform/dbops/binaries/postgres/include/server/replication/logicalrelation.h new file mode 100644 index 0000000000000000000000000000000000000000..e687b40a566f1c4b21fd5495c406f4a9b92fd442 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/logicalrelation.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * logicalrelation.h + * Relation definitions for logical replication relation mapping. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/replication/logicalrelation.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALRELATION_H +#define LOGICALRELATION_H + +#include "access/attmap.h" +#include "catalog/index.h" +#include "replication/logicalproto.h" + +typedef struct LogicalRepRelMapEntry +{ + LogicalRepRelation remoterel; /* key is remoterel.remoteid */ + + /* + * Validity flag -- when false, revalidate all derived info at next + * logicalrep_rel_open. (While the localrel is open, we assume our lock + * on that rel ensures the info remains good.) + */ + bool localrelvalid; + + /* Mapping to local relation. */ + Oid localreloid; /* local relation id */ + Relation localrel; /* relcache entry (NULL when closed) */ + AttrMap *attrmap; /* map of local attributes to remote ones */ + bool updatable; /* Can apply updates/deletes? */ + Oid localindexoid; /* which index to use, or InvalidOid if none */ + + /* Sync state. */ + char state; + XLogRecPtr statelsn; +} LogicalRepRelMapEntry; + +extern void logicalrep_relmap_update(LogicalRepRelation *remoterel); +extern void logicalrep_partmap_reset_relmap(LogicalRepRelation *remoterel); + +extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid, + LOCKMODE lockmode); +extern LogicalRepRelMapEntry *logicalrep_partition_open(LogicalRepRelMapEntry *root, + Relation partrel, AttrMap *map); +extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel, + LOCKMODE lockmode); +extern bool IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo, AttrMap *attrmap); +extern Oid GetRelationIdentityOrPK(Relation rel); + +#endif /* LOGICALRELATION_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/logicalworker.h b/platform/dbops/binaries/postgres/include/server/replication/logicalworker.h new file mode 100644 index 0000000000000000000000000000000000000000..a18d79d1b2817feb589b265576d9f8ae5ab28580 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/logicalworker.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * logicalworker.h + * Exports for logical replication workers. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/replication/logicalworker.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOGICALWORKER_H +#define LOGICALWORKER_H + +#include + +extern PGDLLIMPORT volatile sig_atomic_t ParallelApplyMessagePending; + +extern void ApplyWorkerMain(Datum main_arg); +extern void ParallelApplyWorkerMain(Datum main_arg); +extern void TablesyncWorkerMain(Datum main_arg); + +extern bool IsLogicalWorker(void); +extern bool IsLogicalParallelApplyWorker(void); + +extern void HandleParallelApplyMessageInterrupt(void); +extern void HandleParallelApplyMessages(void); + +extern void LogicalRepWorkersWakeupAtCommit(Oid subid); + +extern void AtEOXact_LogicalRepWorkers(bool isCommit); + +#endif /* LOGICALWORKER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/message.h b/platform/dbops/binaries/postgres/include/server/replication/message.h new file mode 100644 index 0000000000000000000000000000000000000000..d5fb2fe017205c651caa18201f622dd096b02c67 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/message.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * message.h + * Exports from replication/logical/message.c + * + * Copyright (c) 2013-2024, PostgreSQL Global Development Group + * + * src/include/replication/message.h + *------------------------------------------------------------------------- + */ +#ifndef PG_LOGICAL_MESSAGE_H +#define PG_LOGICAL_MESSAGE_H + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "access/xlogreader.h" + +/* + * Generic logical decoding message wal record. + */ +typedef struct xl_logical_message +{ + Oid dbId; /* database Oid emitted from */ + bool transactional; /* is message transactional? */ + Size prefix_size; /* length of prefix */ + Size message_size; /* size of the message */ + /* payload, including null-terminated prefix of length prefix_size */ + char message[FLEXIBLE_ARRAY_MEMBER]; +} xl_logical_message; + +#define SizeOfLogicalMessage (offsetof(xl_logical_message, message)) + +extern XLogRecPtr LogLogicalMessage(const char *prefix, const char *message, + size_t size, bool transactional, + bool flush); + +/* RMGR API */ +#define XLOG_LOGICAL_MESSAGE 0x00 +extern void logicalmsg_redo(XLogReaderState *record); +extern void logicalmsg_desc(StringInfo buf, XLogReaderState *record); +extern const char *logicalmsg_identify(uint8 info); + +#endif /* PG_LOGICAL_MESSAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/origin.h b/platform/dbops/binaries/postgres/include/server/replication/origin.h new file mode 100644 index 0000000000000000000000000000000000000000..7189ba9e7693adc42c0a154341fcb0a77d7ef643 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/origin.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * origin.h + * Exports from replication/logical/origin.c + * + * Copyright (c) 2013-2024, PostgreSQL Global Development Group + * + * src/include/replication/origin.h + *------------------------------------------------------------------------- + */ +#ifndef PG_ORIGIN_H +#define PG_ORIGIN_H + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "access/xlogreader.h" +#include "catalog/pg_replication_origin.h" + +typedef struct xl_replorigin_set +{ + XLogRecPtr remote_lsn; + RepOriginId node_id; + bool force; +} xl_replorigin_set; + +typedef struct xl_replorigin_drop +{ + RepOriginId node_id; +} xl_replorigin_drop; + +#define XLOG_REPLORIGIN_SET 0x00 +#define XLOG_REPLORIGIN_DROP 0x10 + +#define InvalidRepOriginId 0 +#define DoNotReplicateId PG_UINT16_MAX + +extern PGDLLIMPORT RepOriginId replorigin_session_origin; +extern PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn; +extern PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp; + +/* API for querying & manipulating replication origins */ +extern RepOriginId replorigin_by_name(const char *roname, bool missing_ok); +extern RepOriginId replorigin_create(const char *roname); +extern void replorigin_drop_by_name(const char *name, bool missing_ok, bool nowait); +extern bool replorigin_by_oid(RepOriginId roident, bool missing_ok, + char **roname); + +/* API for querying & manipulating replication progress tracking */ +extern void replorigin_advance(RepOriginId node, + XLogRecPtr remote_commit, + XLogRecPtr local_commit, + bool go_backward, bool wal_log); +extern XLogRecPtr replorigin_get_progress(RepOriginId node, bool flush); + +extern void replorigin_session_advance(XLogRecPtr remote_commit, + XLogRecPtr local_commit); +extern void replorigin_session_setup(RepOriginId node, int acquired_by); +extern void replorigin_session_reset(void); +extern XLogRecPtr replorigin_session_get_progress(bool flush); + +/* Checkpoint/Startup integration */ +extern void CheckPointReplicationOrigin(void); +extern void StartupReplicationOrigin(void); + +/* WAL logging */ +extern void replorigin_redo(XLogReaderState *record); +extern void replorigin_desc(StringInfo buf, XLogReaderState *record); +extern const char *replorigin_identify(uint8 info); + +/* shared memory allocation */ +extern Size ReplicationOriginShmemSize(void); +extern void ReplicationOriginShmemInit(void); + +#endif /* PG_ORIGIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/output_plugin.h b/platform/dbops/binaries/postgres/include/server/replication/output_plugin.h new file mode 100644 index 0000000000000000000000000000000000000000..44988ebdd89e9d786de85b7907dba17d5b925c57 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/output_plugin.h @@ -0,0 +1,250 @@ +/*------------------------------------------------------------------------- + * output_plugin.h + * PostgreSQL Logical Decode Plugin Interface + * + * Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef OUTPUT_PLUGIN_H +#define OUTPUT_PLUGIN_H + +#include "replication/reorderbuffer.h" + +struct LogicalDecodingContext; +struct OutputPluginCallbacks; + +typedef enum OutputPluginOutputType +{ + OUTPUT_PLUGIN_BINARY_OUTPUT, + OUTPUT_PLUGIN_TEXTUAL_OUTPUT, +} OutputPluginOutputType; + +/* + * Options set by the output plugin, in the startup callback. + */ +typedef struct OutputPluginOptions +{ + OutputPluginOutputType output_type; + bool receive_rewrites; +} OutputPluginOptions; + +/* + * Type of the shared library symbol _PG_output_plugin_init that is looked up + * when loading an output plugin shared library. + */ +typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb); + +extern PGDLLEXPORT void _PG_output_plugin_init(struct OutputPluginCallbacks *cb); + +/* + * Callback that gets called in a user-defined plugin. ctx->private_data can + * be set to some private data. + * + * "is_init" will be set to "true" if the decoding slot just got defined. When + * the same slot is used from there one, it will be "false". + */ +typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx, + OutputPluginOptions *options, + bool is_init); + +/* + * Callback called for every (explicit or implicit) BEGIN of a successful + * transaction. + */ +typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Callback for every individual change in a successful transaction. + */ +typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* + * Callback for every TRUNCATE in a successful transaction. + */ +typedef void (*LogicalDecodeTruncateCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* + * Called for every (explicit or implicit) COMMIT of a successful transaction. + */ +typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Called for the generic logical decoding messages. + */ +typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, + Size message_size, + const char *message); + +/* + * Filter changes by origin. + */ +typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx, + RepOriginId origin_id); + +/* + * Called to shutdown an output plugin. + */ +typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx); + +/* + * Called before decoding of PREPARE record to decide whether this + * transaction should be decoded with separate calls to prepare and + * commit_prepared/rollback_prepared callbacks or wait till COMMIT PREPARED + * and sent as usual transaction. + */ +typedef bool (*LogicalDecodeFilterPrepareCB) (struct LogicalDecodingContext *ctx, + TransactionId xid, + const char *gid); + +/* + * Callback called for every BEGIN of a prepared transaction. + */ +typedef void (*LogicalDecodeBeginPrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called for PREPARE record unless it was filtered by filter_prepare() + * callback. + */ +typedef void (*LogicalDecodePrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* + * Called for COMMIT PREPARED. + */ +typedef void (*LogicalDecodeCommitPreparedCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Called for ROLLBACK PREPARED. + */ +typedef void (*LogicalDecodeRollbackPreparedCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); + + +/* + * Called when starting to stream a block of changes from in-progress + * transaction (may be called repeatedly, if it's streamed in multiple + * chunks). + */ +typedef void (*LogicalDecodeStreamStartCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called when stopping to stream a block of changes from in-progress + * transaction to a remote node (may be called repeatedly, if it's streamed + * in multiple chunks). + */ +typedef void (*LogicalDecodeStreamStopCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn); + +/* + * Called to discard changes streamed to remote node from in-progress + * transaction. + */ +typedef void (*LogicalDecodeStreamAbortCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr abort_lsn); + +/* + * Called to prepare changes streamed to remote node from in-progress + * transaction. This is called as part of a two-phase commit. + */ +typedef void (*LogicalDecodeStreamPrepareCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* + * Called to apply changes streamed to remote node from in-progress + * transaction. + */ +typedef void (*LogicalDecodeStreamCommitCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* + * Callback for streaming individual changes from in-progress transactions. + */ +typedef void (*LogicalDecodeStreamChangeCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* + * Callback for streaming generic logical decoding messages from in-progress + * transactions. + */ +typedef void (*LogicalDecodeStreamMessageCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, + Size message_size, + const char *message); + +/* + * Callback for streaming truncates from in-progress transactions. + */ +typedef void (*LogicalDecodeStreamTruncateCB) (struct LogicalDecodingContext *ctx, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* + * Output plugin callbacks + */ +typedef struct OutputPluginCallbacks +{ + LogicalDecodeStartupCB startup_cb; + LogicalDecodeBeginCB begin_cb; + LogicalDecodeChangeCB change_cb; + LogicalDecodeTruncateCB truncate_cb; + LogicalDecodeCommitCB commit_cb; + LogicalDecodeMessageCB message_cb; + LogicalDecodeFilterByOriginCB filter_by_origin_cb; + LogicalDecodeShutdownCB shutdown_cb; + + /* streaming of changes at prepare time */ + LogicalDecodeFilterPrepareCB filter_prepare_cb; + LogicalDecodeBeginPrepareCB begin_prepare_cb; + LogicalDecodePrepareCB prepare_cb; + LogicalDecodeCommitPreparedCB commit_prepared_cb; + LogicalDecodeRollbackPreparedCB rollback_prepared_cb; + + /* streaming of changes */ + LogicalDecodeStreamStartCB stream_start_cb; + LogicalDecodeStreamStopCB stream_stop_cb; + LogicalDecodeStreamAbortCB stream_abort_cb; + LogicalDecodeStreamPrepareCB stream_prepare_cb; + LogicalDecodeStreamCommitCB stream_commit_cb; + LogicalDecodeStreamChangeCB stream_change_cb; + LogicalDecodeStreamMessageCB stream_message_cb; + LogicalDecodeStreamTruncateCB stream_truncate_cb; +} OutputPluginCallbacks; + +/* Functions in replication/logical/logical.c */ +extern void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool last_write); +extern void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write); +extern void OutputPluginUpdateProgress(struct LogicalDecodingContext *ctx, bool skipped_xact); + +#endif /* OUTPUT_PLUGIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/pgoutput.h b/platform/dbops/binaries/postgres/include/server/replication/pgoutput.h new file mode 100644 index 0000000000000000000000000000000000000000..89f94e114726fbbad02092f21e6ba6222d192f03 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/pgoutput.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pgoutput.h + * Logical Replication output plugin + * + * Copyright (c) 2015-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/pgoutput.h + * + *------------------------------------------------------------------------- + */ +#ifndef PGOUTPUT_H +#define PGOUTPUT_H + +#include "nodes/pg_list.h" + +typedef struct PGOutputData +{ + MemoryContext context; /* private memory context for transient + * allocations */ + MemoryContext cachectx; /* private memory context for cache data */ + + bool in_streaming; /* true if we are streaming a chunk of + * transaction */ + + /* client-supplied info: */ + uint32 protocol_version; + List *publication_names; + List *publications; + bool binary; + char streaming; + bool messages; + bool two_phase; + bool publish_no_origin; +} PGOutputData; + +#endif /* PGOUTPUT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/reorderbuffer.h b/platform/dbops/binaries/postgres/include/server/replication/reorderbuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..7de50462dcfa1057326de57c6d15800259d12c6f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/reorderbuffer.h @@ -0,0 +1,734 @@ +/* + * reorderbuffer.h + * PostgreSQL logical replay/reorder buffer management. + * + * Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + * src/include/replication/reorderbuffer.h + */ +#ifndef REORDERBUFFER_H +#define REORDERBUFFER_H + +#include "access/htup_details.h" +#include "lib/ilist.h" +#include "lib/pairingheap.h" +#include "storage/sinval.h" +#include "utils/hsearch.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" +#include "utils/timestamp.h" + +/* GUC variables */ +extern PGDLLIMPORT int logical_decoding_work_mem; +extern PGDLLIMPORT int debug_logical_replication_streaming; + +/* possible values for debug_logical_replication_streaming */ +typedef enum +{ + DEBUG_LOGICAL_REP_STREAMING_BUFFERED, + DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE, +} DebugLogicalRepStreamingMode; + +/* + * Types of the change passed to a 'change' callback. + * + * For efficiency and simplicity reasons we want to keep Snapshots, CommandIds + * and ComboCids in the same list with the user visible INSERT/UPDATE/DELETE + * changes. Users of the decoding facilities will never see changes with + * *_INTERNAL_* actions. + * + * The INTERNAL_SPEC_INSERT and INTERNAL_SPEC_CONFIRM, and INTERNAL_SPEC_ABORT + * changes concern "speculative insertions", their confirmation, and abort + * respectively. They're used by INSERT .. ON CONFLICT .. UPDATE. Users of + * logical decoding don't have to care about these. + */ +typedef enum ReorderBufferChangeType +{ + REORDER_BUFFER_CHANGE_INSERT, + REORDER_BUFFER_CHANGE_UPDATE, + REORDER_BUFFER_CHANGE_DELETE, + REORDER_BUFFER_CHANGE_MESSAGE, + REORDER_BUFFER_CHANGE_INVALIDATION, + REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT, + REORDER_BUFFER_CHANGE_INTERNAL_COMMAND_ID, + REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_CONFIRM, + REORDER_BUFFER_CHANGE_INTERNAL_SPEC_ABORT, + REORDER_BUFFER_CHANGE_TRUNCATE, +} ReorderBufferChangeType; + +/* forward declaration */ +struct ReorderBufferTXN; + +/* + * a single 'change', can be an insert (with one tuple), an update (old, new), + * or a delete (old). + * + * The same struct is also used internally for other purposes but that should + * never be visible outside reorderbuffer.c. + */ +typedef struct ReorderBufferChange +{ + XLogRecPtr lsn; + + /* The type of change. */ + ReorderBufferChangeType action; + + /* Transaction this change belongs to. */ + struct ReorderBufferTXN *txn; + + RepOriginId origin_id; + + /* + * Context data for the change. Which part of the union is valid depends + * on action. + */ + union + { + /* Old, new tuples when action == *_INSERT|UPDATE|DELETE */ + struct + { + /* relation that has been changed */ + RelFileLocator rlocator; + + /* no previously reassembled toast chunks are necessary anymore */ + bool clear_toast_afterwards; + + /* valid for DELETE || UPDATE */ + HeapTuple oldtuple; + /* valid for INSERT || UPDATE */ + HeapTuple newtuple; + } tp; + + /* + * Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one + * set of relations to be truncated. + */ + struct + { + Size nrelids; + bool cascade; + bool restart_seqs; + Oid *relids; + } truncate; + + /* Message with arbitrary data. */ + struct + { + char *prefix; + Size message_size; + char *message; + } msg; + + /* New snapshot, set when action == *_INTERNAL_SNAPSHOT */ + Snapshot snapshot; + + /* + * New command id for existing snapshot in a catalog changing tx. Set + * when action == *_INTERNAL_COMMAND_ID. + */ + CommandId command_id; + + /* + * New cid mapping for catalog changing transaction, set when action + * == *_INTERNAL_TUPLECID. + */ + struct + { + RelFileLocator locator; + ItemPointerData tid; + CommandId cmin; + CommandId cmax; + CommandId combocid; + } tuplecid; + + /* Invalidation. */ + struct + { + uint32 ninvalidations; /* Number of messages */ + SharedInvalidationMessage *invalidations; /* invalidation message */ + } inval; + } data; + + /* + * While in use this is how a change is linked into a transactions, + * otherwise it's the preallocated list. + */ + dlist_node node; +} ReorderBufferChange; + +/* ReorderBufferTXN txn_flags */ +#define RBTXN_HAS_CATALOG_CHANGES 0x0001 +#define RBTXN_IS_SUBXACT 0x0002 +#define RBTXN_IS_SERIALIZED 0x0004 +#define RBTXN_IS_SERIALIZED_CLEAR 0x0008 +#define RBTXN_IS_STREAMED 0x0010 +#define RBTXN_HAS_PARTIAL_CHANGE 0x0020 +#define RBTXN_PREPARE 0x0040 +#define RBTXN_SKIPPED_PREPARE 0x0080 +#define RBTXN_HAS_STREAMABLE_CHANGE 0x0100 + +/* Does the transaction have catalog changes? */ +#define rbtxn_has_catalog_changes(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_CATALOG_CHANGES) != 0 \ +) + +/* Is the transaction known as a subxact? */ +#define rbtxn_is_known_subxact(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SUBXACT) != 0 \ +) + +/* Has this transaction been spilled to disk? */ +#define rbtxn_is_serialized(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SERIALIZED) != 0 \ +) + +/* Has this transaction ever been spilled to disk? */ +#define rbtxn_is_serialized_clear(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_SERIALIZED_CLEAR) != 0 \ +) + +/* Has this transaction contains partial changes? */ +#define rbtxn_has_partial_change(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_PARTIAL_CHANGE) != 0 \ +) + +/* Does this transaction contain streamable changes? */ +#define rbtxn_has_streamable_change(txn) \ +( \ + ((txn)->txn_flags & RBTXN_HAS_STREAMABLE_CHANGE) != 0 \ +) + +/* + * Has this transaction been streamed to downstream? + * + * (It's not possible to deduce this from nentries and nentries_mem for + * various reasons. For example, all changes may be in subtransactions in + * which case we'd have nentries==0 for the toplevel one, which would say + * nothing about the streaming. So we maintain this flag, but only for the + * toplevel transaction.) + */ +#define rbtxn_is_streamed(txn) \ +( \ + ((txn)->txn_flags & RBTXN_IS_STREAMED) != 0 \ +) + +/* Has this transaction been prepared? */ +#define rbtxn_prepared(txn) \ +( \ + ((txn)->txn_flags & RBTXN_PREPARE) != 0 \ +) + +/* prepare for this transaction skipped? */ +#define rbtxn_skip_prepared(txn) \ +( \ + ((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \ +) + +/* Is this a top-level transaction? */ +#define rbtxn_is_toptxn(txn) \ +( \ + (txn)->toptxn == NULL \ +) + +/* Is this a subtransaction? */ +#define rbtxn_is_subtxn(txn) \ +( \ + (txn)->toptxn != NULL \ +) + +/* Get the top-level transaction of this (sub)transaction. */ +#define rbtxn_get_toptxn(txn) \ +( \ + rbtxn_is_subtxn(txn) ? (txn)->toptxn : (txn) \ +) + +typedef struct ReorderBufferTXN +{ + /* See above */ + bits32 txn_flags; + + /* The transaction's transaction id, can be a toplevel or sub xid. */ + TransactionId xid; + + /* Xid of top-level transaction, if known */ + TransactionId toplevel_xid; + + /* + * Global transaction id required for identification of prepared + * transactions. + */ + char *gid; + + /* + * LSN of the first data carrying, WAL record with knowledge about this + * xid. This is allowed to *not* be first record adorned with this xid, if + * the previous records aren't relevant for logical decoding. + */ + XLogRecPtr first_lsn; + + /* ---- + * LSN of the record that lead to this xact to be prepared or committed or + * aborted. This can be a + * * plain commit record + * * plain commit record, of a parent transaction + * * prepared transaction + * * prepared transaction commit + * * plain abort record + * * prepared transaction abort + * + * This can also become set to earlier values than transaction end when + * a transaction is spilled to disk; specifically it's set to the LSN of + * the latest change written to disk so far. + * ---- + */ + XLogRecPtr final_lsn; + + /* + * LSN pointing to the end of the commit record + 1. + */ + XLogRecPtr end_lsn; + + /* Toplevel transaction for this subxact (NULL for top-level). */ + struct ReorderBufferTXN *toptxn; + + /* + * LSN of the last lsn at which snapshot information reside, so we can + * restart decoding from there and fully recover this transaction from + * WAL. + */ + XLogRecPtr restart_decoding_lsn; + + /* origin of the change that caused this transaction */ + RepOriginId origin_id; + XLogRecPtr origin_lsn; + + /* + * Commit or Prepare time, only known when we read the actual commit or + * prepare record. + */ + union + { + TimestampTz commit_time; + TimestampTz prepare_time; + TimestampTz abort_time; + } xact_time; + + /* + * The base snapshot is used to decode all changes until either this + * transaction modifies the catalog, or another catalog-modifying + * transaction commits. + */ + Snapshot base_snapshot; + XLogRecPtr base_snapshot_lsn; + dlist_node base_snapshot_node; /* link in txns_by_base_snapshot_lsn */ + + /* + * Snapshot/CID from the previous streaming run. Only valid for already + * streamed transactions (NULL/InvalidCommandId otherwise). + */ + Snapshot snapshot_now; + CommandId command_id; + + /* + * How many ReorderBufferChange's do we have in this txn. + * + * Changes in subtransactions are *not* included but tracked separately. + */ + uint64 nentries; + + /* + * How many of the above entries are stored in memory in contrast to being + * spilled to disk. + */ + uint64 nentries_mem; + + /* + * List of ReorderBufferChange structs, including new Snapshots, new + * CommandIds and command invalidation messages. + */ + dlist_head changes; + + /* + * List of (relation, ctid) => (cmin, cmax) mappings for catalog tuples. + * Those are always assigned to the toplevel transaction. (Keep track of + * #entries to create a hash of the right size) + */ + dlist_head tuplecids; + uint64 ntuplecids; + + /* + * On-demand built hash for looking up the above values. + */ + HTAB *tuplecid_hash; + + /* + * Hash containing (potentially partial) toast entries. NULL if no toast + * tuples have been found for the current change. + */ + HTAB *toast_hash; + + /* + * non-hierarchical list of subtransactions that are *not* aborted. Only + * used in toplevel transactions. + */ + dlist_head subtxns; + uint32 nsubtxns; + + /* + * Stored cache invalidations. This is not a linked list because we get + * all the invalidations at once. + */ + uint32 ninvalidations; + SharedInvalidationMessage *invalidations; + + /* --- + * Position in one of three lists: + * * list of subtransactions if we are *known* to be subxact + * * list of toplevel xacts (can be an as-yet unknown subxact) + * * list of preallocated ReorderBufferTXNs (if unused) + * --- + */ + dlist_node node; + + /* + * A node in the list of catalog modifying transactions + */ + dlist_node catchange_node; + + /* + * A node in txn_heap + */ + pairingheap_node txn_node; + + /* + * Size of this transaction (changes currently in memory, in bytes). + */ + Size size; + + /* Size of top-transaction including sub-transactions. */ + Size total_size; + + /* If we have detected concurrent abort then ignore future changes. */ + bool concurrent_abort; + + /* + * Private data pointer of the output plugin. + */ + void *output_plugin_private; +} ReorderBufferTXN; + +/* so we can define the callbacks used inside struct ReorderBuffer itself */ +typedef struct ReorderBuffer ReorderBuffer; + +/* change callback signature */ +typedef void (*ReorderBufferApplyChangeCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* truncate callback signature */ +typedef void (*ReorderBufferApplyTruncateCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* begin callback signature */ +typedef void (*ReorderBufferBeginCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn); + +/* commit callback signature */ +typedef void (*ReorderBufferCommitCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* message callback signature */ +typedef void (*ReorderBufferMessageCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, Size sz, + const char *message); + +/* begin prepare callback signature */ +typedef void (*ReorderBufferBeginPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn); + +/* prepare callback signature */ +typedef void (*ReorderBufferPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* commit prepared callback signature */ +typedef void (*ReorderBufferCommitPreparedCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* rollback prepared callback signature */ +typedef void (*ReorderBufferRollbackPreparedCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_end_lsn, + TimestampTz prepare_time); + +/* start streaming transaction callback signature */ +typedef void (*ReorderBufferStreamStartCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr first_lsn); + +/* stop streaming transaction callback signature */ +typedef void (*ReorderBufferStreamStopCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr last_lsn); + +/* discard streamed transaction callback signature */ +typedef void (*ReorderBufferStreamAbortCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr abort_lsn); + +/* prepare streamed transaction callback signature */ +typedef void (*ReorderBufferStreamPrepareCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr prepare_lsn); + +/* commit streamed transaction callback signature */ +typedef void (*ReorderBufferStreamCommitCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); + +/* stream change callback signature */ +typedef void (*ReorderBufferStreamChangeCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); + +/* stream message callback signature */ +typedef void (*ReorderBufferStreamMessageCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, Size sz, + const char *message); + +/* stream truncate callback signature */ +typedef void (*ReorderBufferStreamTruncateCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + int nrelations, + Relation relations[], + ReorderBufferChange *change); + +/* update progress txn callback signature */ +typedef void (*ReorderBufferUpdateProgressTxnCB) (ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr lsn); + +struct ReorderBuffer +{ + /* + * xid => ReorderBufferTXN lookup table + */ + HTAB *by_txn; + + /* + * Transactions that could be a toplevel xact, ordered by LSN of the first + * record bearing that xid. + */ + dlist_head toplevel_by_lsn; + + /* + * Transactions and subtransactions that have a base snapshot, ordered by + * LSN of the record which caused us to first obtain the base snapshot. + * This is not the same as toplevel_by_lsn, because we only set the base + * snapshot on the first logical-decoding-relevant record (eg. heap + * writes), whereas the initial LSN could be set by other operations. + */ + dlist_head txns_by_base_snapshot_lsn; + + /* + * Transactions and subtransactions that have modified system catalogs. + */ + dclist_head catchange_txns; + + /* + * one-entry sized cache for by_txn. Very frequently the same txn gets + * looked up over and over again. + */ + TransactionId by_txn_last_xid; + ReorderBufferTXN *by_txn_last_txn; + + /* + * Callbacks to be called when a transactions commits. + */ + ReorderBufferBeginCB begin; + ReorderBufferApplyChangeCB apply_change; + ReorderBufferApplyTruncateCB apply_truncate; + ReorderBufferCommitCB commit; + ReorderBufferMessageCB message; + + /* + * Callbacks to be called when streaming a transaction at prepare time. + */ + ReorderBufferBeginCB begin_prepare; + ReorderBufferPrepareCB prepare; + ReorderBufferCommitPreparedCB commit_prepared; + ReorderBufferRollbackPreparedCB rollback_prepared; + + /* + * Callbacks to be called when streaming a transaction. + */ + ReorderBufferStreamStartCB stream_start; + ReorderBufferStreamStopCB stream_stop; + ReorderBufferStreamAbortCB stream_abort; + ReorderBufferStreamPrepareCB stream_prepare; + ReorderBufferStreamCommitCB stream_commit; + ReorderBufferStreamChangeCB stream_change; + ReorderBufferStreamMessageCB stream_message; + ReorderBufferStreamTruncateCB stream_truncate; + + /* + * Callback to be called when updating progress during sending data of a + * transaction (and its subtransactions) to the output plugin. + */ + ReorderBufferUpdateProgressTxnCB update_progress_txn; + + /* + * Pointer that will be passed untouched to the callbacks. + */ + void *private_data; + + /* + * Saved output plugin option + */ + bool output_rewrites; + + /* + * Private memory context. + */ + MemoryContext context; + + /* + * Memory contexts for specific types objects + */ + MemoryContext change_context; + MemoryContext txn_context; + MemoryContext tup_context; + + XLogRecPtr current_restart_decoding_lsn; + + /* buffer for disk<->memory conversions */ + char *outbuf; + Size outbufsize; + + /* memory accounting */ + Size size; + + /* Max-heap for sizes of all top-level and sub transactions */ + pairingheap *txn_heap; + + /* + * Statistics about transactions spilled to disk. + * + * A single transaction may be spilled repeatedly, which is why we keep + * two different counters. For spilling, the transaction counter includes + * both toplevel transactions and subtransactions. + */ + int64 spillTxns; /* number of transactions spilled to disk */ + int64 spillCount; /* spill-to-disk invocation counter */ + int64 spillBytes; /* amount of data spilled to disk */ + + /* Statistics about transactions streamed to the decoding output plugin */ + int64 streamTxns; /* number of transactions streamed */ + int64 streamCount; /* streaming invocation counter */ + int64 streamBytes; /* amount of data decoded */ + + /* + * Statistics about all the transactions sent to the decoding output + * plugin + */ + int64 totalTxns; /* total number of transactions sent */ + int64 totalBytes; /* total amount of data decoded */ +}; + + +extern ReorderBuffer *ReorderBufferAllocate(void); +extern void ReorderBufferFree(ReorderBuffer *rb); + +extern HeapTuple ReorderBufferGetTupleBuf(ReorderBuffer *rb, + Size tuple_len); +extern void ReorderBufferReturnTupleBuf(HeapTuple tuple); + +extern ReorderBufferChange *ReorderBufferGetChange(ReorderBuffer *rb); +extern void ReorderBufferReturnChange(ReorderBuffer *rb, + ReorderBufferChange *change, bool upd_mem); + +extern Oid *ReorderBufferGetRelids(ReorderBuffer *rb, int nrelids); +extern void ReorderBufferReturnRelids(ReorderBuffer *rb, Oid *relids); + +extern void ReorderBufferQueueChange(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, ReorderBufferChange *change, + bool toast_insert); +extern void ReorderBufferQueueMessage(ReorderBuffer *rb, TransactionId xid, + Snapshot snap, XLogRecPtr lsn, + bool transactional, const char *prefix, + Size message_size, const char *message); +extern void ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr commit_lsn, XLogRecPtr end_lsn, + TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn); +extern void ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr commit_lsn, XLogRecPtr end_lsn, + XLogRecPtr two_phase_at, + TimestampTz commit_time, + RepOriginId origin_id, XLogRecPtr origin_lsn, + char *gid, bool is_commit); +extern void ReorderBufferAssignChild(ReorderBuffer *rb, TransactionId xid, + TransactionId subxid, XLogRecPtr lsn); +extern void ReorderBufferCommitChild(ReorderBuffer *rb, TransactionId xid, + TransactionId subxid, XLogRecPtr commit_lsn, + XLogRecPtr end_lsn); +extern void ReorderBufferAbort(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn, + TimestampTz abort_time); +extern void ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid); +extern void ReorderBufferForget(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); +extern void ReorderBufferInvalidate(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); + +extern void ReorderBufferSetBaseSnapshot(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, Snapshot snap); +extern void ReorderBufferAddSnapshot(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, Snapshot snap); +extern void ReorderBufferAddNewCommandId(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, CommandId cid); +extern void ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr lsn, RelFileLocator locator, + ItemPointerData tid, + CommandId cmin, CommandId cmax, CommandId combocid); +extern void ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn, + Size nmsgs, SharedInvalidationMessage *msgs); +extern void ReorderBufferImmediateInvalidation(ReorderBuffer *rb, uint32 ninvalidations, + SharedInvalidationMessage *invalidations); +extern void ReorderBufferProcessXid(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); + +extern void ReorderBufferXidSetCatalogChanges(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn); +extern bool ReorderBufferXidHasCatalogChanges(ReorderBuffer *rb, TransactionId xid); +extern bool ReorderBufferXidHasBaseSnapshot(ReorderBuffer *rb, TransactionId xid); + +extern bool ReorderBufferRememberPrepareInfo(ReorderBuffer *rb, TransactionId xid, + XLogRecPtr prepare_lsn, XLogRecPtr end_lsn, + TimestampTz prepare_time, + RepOriginId origin_id, XLogRecPtr origin_lsn); +extern void ReorderBufferSkipPrepare(ReorderBuffer *rb, TransactionId xid); +extern void ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, char *gid); +extern ReorderBufferTXN *ReorderBufferGetOldestTXN(ReorderBuffer *rb); +extern TransactionId ReorderBufferGetOldestXmin(ReorderBuffer *rb); +extern TransactionId *ReorderBufferGetCatalogChangesXacts(ReorderBuffer *rb); + +extern void ReorderBufferSetRestartPoint(ReorderBuffer *rb, XLogRecPtr ptr); + +extern void StartupReorderBuffer(void); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/replication/slot.h b/platform/dbops/binaries/postgres/include/server/replication/slot.h new file mode 100644 index 0000000000000000000000000000000000000000..07561bc4742928a7494719de7ef5638765be5a21 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/slot.h @@ -0,0 +1,289 @@ +/*------------------------------------------------------------------------- + * slot.h + * Replication slot management. + * + * Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + *------------------------------------------------------------------------- + */ +#ifndef SLOT_H +#define SLOT_H + +#include "access/xlog.h" +#include "access/xlogreader.h" +#include "storage/condition_variable.h" +#include "storage/lwlock.h" +#include "storage/shmem.h" +#include "storage/spin.h" +#include "replication/walreceiver.h" + +/* + * Behaviour of replication slots, upon release or crash. + * + * Slots marked as PERSISTENT are crash-safe and will not be dropped when + * released. Slots marked as EPHEMERAL will be dropped when released or after + * restarts. Slots marked TEMPORARY will be dropped at the end of a session + * or on error. + * + * EPHEMERAL is used as a not-quite-ready state when creating persistent + * slots. EPHEMERAL slots can be made PERSISTENT by calling + * ReplicationSlotPersist(). For a slot that goes away at the end of a + * session, TEMPORARY is the appropriate choice. + */ +typedef enum ReplicationSlotPersistency +{ + RS_PERSISTENT, + RS_EPHEMERAL, + RS_TEMPORARY, +} ReplicationSlotPersistency; + +/* + * Slots can be invalidated, e.g. due to max_slot_wal_keep_size. If so, the + * 'invalidated' field is set to a value other than _NONE. + * + * When adding a new invalidation cause here, remember to update + * SlotInvalidationCauses and RS_INVAL_MAX_CAUSES. + */ +typedef enum ReplicationSlotInvalidationCause +{ + RS_INVAL_NONE, + /* required WAL has been removed */ + RS_INVAL_WAL_REMOVED, + /* required rows have been removed */ + RS_INVAL_HORIZON, + /* wal_level insufficient for slot */ + RS_INVAL_WAL_LEVEL, +} ReplicationSlotInvalidationCause; + +extern PGDLLIMPORT const char *const SlotInvalidationCauses[]; + +/* + * On-Disk data of a replication slot, preserved across restarts. + */ +typedef struct ReplicationSlotPersistentData +{ + /* The slot's identifier */ + NameData name; + + /* database the slot is active on */ + Oid database; + + /* + * The slot's behaviour when being dropped (or restored after a crash). + */ + ReplicationSlotPersistency persistency; + + /* + * xmin horizon for data + * + * NB: This may represent a value that hasn't been written to disk yet; + * see notes for effective_xmin, below. + */ + TransactionId xmin; + + /* + * xmin horizon for catalog tuples + * + * NB: This may represent a value that hasn't been written to disk yet; + * see notes for effective_xmin, below. + */ + TransactionId catalog_xmin; + + /* oldest LSN that might be required by this replication slot */ + XLogRecPtr restart_lsn; + + /* RS_INVAL_NONE if valid, or the reason for having been invalidated */ + ReplicationSlotInvalidationCause invalidated; + + /* + * Oldest LSN that the client has acked receipt for. This is used as the + * start_lsn point in case the client doesn't specify one, and also as a + * safety measure to jump forwards in case the client specifies a + * start_lsn that's further in the past than this value. + */ + XLogRecPtr confirmed_flush; + + /* + * LSN at which we enabled two_phase commit for this slot or LSN at which + * we found a consistent point at the time of slot creation. + */ + XLogRecPtr two_phase_at; + + /* + * Allow decoding of prepared transactions? + */ + bool two_phase; + + /* plugin name */ + NameData plugin; + + /* + * Was this slot synchronized from the primary server? + */ + char synced; + + /* + * Is this a failover slot (sync candidate for standbys)? Only relevant + * for logical slots on the primary server. + */ + bool failover; +} ReplicationSlotPersistentData; + +/* + * Shared memory state of a single replication slot. + * + * The in-memory data of replication slots follows a locking model based + * on two linked concepts: + * - A replication slot's in_use flag is switched when added or discarded using + * the LWLock ReplicationSlotControlLock, which needs to be hold in exclusive + * mode when updating the flag by the backend owning the slot and doing the + * operation, while readers (concurrent backends not owning the slot) need + * to hold it in shared mode when looking at replication slot data. + * - Individual fields are protected by mutex where only the backend owning + * the slot is authorized to update the fields from its own slot. The + * backend owning the slot does not need to take this lock when reading its + * own fields, while concurrent backends not owning this slot should take the + * lock when reading this slot's data. + */ +typedef struct ReplicationSlot +{ + /* lock, on same cacheline as effective_xmin */ + slock_t mutex; + + /* is this slot defined */ + bool in_use; + + /* Who is streaming out changes for this slot? 0 in unused slots. */ + pid_t active_pid; + + /* any outstanding modifications? */ + bool just_dirtied; + bool dirty; + + /* + * For logical decoding, it's extremely important that we never remove any + * data that's still needed for decoding purposes, even after a crash; + * otherwise, decoding will produce wrong answers. Ordinary streaming + * replication also needs to prevent old row versions from being removed + * too soon, but the worst consequence we might encounter there is + * unwanted query cancellations on the standby. Thus, for logical + * decoding, this value represents the latest xmin that has actually been + * written to disk, whereas for streaming replication, it's just the same + * as the persistent value (data.xmin). + */ + TransactionId effective_xmin; + TransactionId effective_catalog_xmin; + + /* data surviving shutdowns and crashes */ + ReplicationSlotPersistentData data; + + /* is somebody performing io on this slot? */ + LWLock io_in_progress_lock; + + /* Condition variable signaled when active_pid changes */ + ConditionVariable active_cv; + + /* all the remaining data is only used for logical slots */ + + /* + * When the client has confirmed flushes >= candidate_xmin_lsn we can + * advance the catalog xmin. When restart_valid has been passed, + * restart_lsn can be increased. + */ + TransactionId candidate_catalog_xmin; + XLogRecPtr candidate_xmin_lsn; + XLogRecPtr candidate_restart_valid; + XLogRecPtr candidate_restart_lsn; + + /* + * This value tracks the last confirmed_flush LSN flushed which is used + * during a shutdown checkpoint to decide if logical's slot data should be + * forcibly flushed or not. + */ + XLogRecPtr last_saved_confirmed_flush; + + /* + * The time when the slot became inactive. For synced slots on a standby + * server, it represents the time when slot synchronization was most + * recently stopped. + */ + TimestampTz inactive_since; +} ReplicationSlot; + +#define SlotIsPhysical(slot) ((slot)->data.database == InvalidOid) +#define SlotIsLogical(slot) ((slot)->data.database != InvalidOid) + +/* + * Shared memory control area for all of replication slots. + */ +typedef struct ReplicationSlotCtlData +{ + /* + * This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some + * reason you can't do that in an otherwise-empty struct. + */ + ReplicationSlot replication_slots[1]; +} ReplicationSlotCtlData; + +/* + * Pointers to shared memory + */ +extern PGDLLIMPORT ReplicationSlotCtlData *ReplicationSlotCtl; +extern PGDLLIMPORT ReplicationSlot *MyReplicationSlot; + +/* GUCs */ +extern PGDLLIMPORT int max_replication_slots; +extern PGDLLIMPORT char *synchronized_standby_slots; + +/* shmem initialization functions */ +extern Size ReplicationSlotsShmemSize(void); +extern void ReplicationSlotsShmemInit(void); + +/* management of individual slots */ +extern void ReplicationSlotCreate(const char *name, bool db_specific, + ReplicationSlotPersistency persistency, + bool two_phase, bool failover, + bool synced); +extern void ReplicationSlotPersist(void); +extern void ReplicationSlotDrop(const char *name, bool nowait); +extern void ReplicationSlotDropAcquired(void); +extern void ReplicationSlotAlter(const char *name, bool failover); + +extern void ReplicationSlotAcquire(const char *name, bool nowait); +extern void ReplicationSlotRelease(void); +extern void ReplicationSlotCleanup(bool synced_only); +extern void ReplicationSlotSave(void); +extern void ReplicationSlotMarkDirty(void); + +/* misc stuff */ +extern void ReplicationSlotInitialize(void); +extern bool ReplicationSlotValidateName(const char *name, int elevel); +extern void ReplicationSlotReserveWal(void); +extern void ReplicationSlotsComputeRequiredXmin(bool already_locked); +extern void ReplicationSlotsComputeRequiredLSN(void); +extern XLogRecPtr ReplicationSlotsComputeLogicalRestartLSN(void); +extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive); +extern void ReplicationSlotsDropDBSlots(Oid dboid); +extern bool InvalidateObsoleteReplicationSlots(ReplicationSlotInvalidationCause cause, + XLogSegNo oldestSegno, + Oid dboid, + TransactionId snapshotConflictHorizon); +extern ReplicationSlot *SearchNamedReplicationSlot(const char *name, bool need_lock); +extern int ReplicationSlotIndex(ReplicationSlot *slot); +extern bool ReplicationSlotName(int index, Name name); +extern void ReplicationSlotNameForTablesync(Oid suboid, Oid relid, char *syncslotname, Size szslot); +extern void ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missing_ok); + +extern void StartupReplicationSlots(void); +extern void CheckPointReplicationSlots(bool is_shutdown); + +extern void CheckSlotRequirements(void); +extern void CheckSlotPermissions(void); +extern ReplicationSlotInvalidationCause + GetSlotInvalidationCause(const char *invalidation_reason); + +extern bool SlotExistsInSyncStandbySlots(const char *slot_name); +extern bool StandbySlotsHaveCaughtup(XLogRecPtr wait_for_lsn, int elevel); +extern void WaitForStandbyConfirmation(XLogRecPtr wait_for_lsn); + +#endif /* SLOT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/slotsync.h b/platform/dbops/binaries/postgres/include/server/replication/slotsync.h new file mode 100644 index 0000000000000000000000000000000000000000..e03c2a005a429b4b5070c5d6786d51cb2ffbc776 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/slotsync.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * slotsync.h + * Exports for slot synchronization. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/replication/slotsync.h + * + *------------------------------------------------------------------------- + */ +#ifndef SLOTSYNC_H +#define SLOTSYNC_H + +#include "replication/walreceiver.h" + +extern PGDLLIMPORT bool sync_replication_slots; + +/* + * GUCs needed by slot sync worker to connect to the primary + * server and carry on with slots synchronization. + */ +extern PGDLLIMPORT char *PrimaryConnInfo; +extern PGDLLIMPORT char *PrimarySlotName; + +extern char *CheckAndGetDbnameFromConninfo(void); +extern bool ValidateSlotSyncParams(int elevel); + +extern void ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +extern void ShutDownSlotSync(void); +extern bool SlotSyncWorkerCanRestart(void); +extern bool IsSyncingReplicationSlots(void); +extern Size SlotSyncShmemSize(void); +extern void SlotSyncShmemInit(void); +extern void SyncReplicationSlots(WalReceiverConn *wrconn); + +#endif /* SLOTSYNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/snapbuild.h b/platform/dbops/binaries/postgres/include/server/replication/snapbuild.h new file mode 100644 index 0000000000000000000000000000000000000000..caa5113ff81a8da3827c7e1c272079d533763969 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/snapbuild.h @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * + * snapbuild.h + * Exports from replication/logical/snapbuild.c. + * + * Copyright (c) 2012-2024, PostgreSQL Global Development Group + * + * src/include/replication/snapbuild.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPBUILD_H +#define SNAPBUILD_H + +#include "access/xlogdefs.h" +#include "utils/snapmgr.h" + +typedef enum +{ + /* + * Initial state, we can't do much yet. + */ + SNAPBUILD_START = -1, + + /* + * Collecting committed transactions, to build the initial catalog + * snapshot. + */ + SNAPBUILD_BUILDING_SNAPSHOT = 0, + + /* + * We have collected enough information to decode tuples in transactions + * that started after this. + * + * Once we reached this we start to collect changes. We cannot apply them + * yet, because they might be based on transactions that were still + * running when FULL_SNAPSHOT was reached. + */ + SNAPBUILD_FULL_SNAPSHOT = 1, + + /* + * Found a point after SNAPBUILD_FULL_SNAPSHOT where all transactions that + * were running at that point finished. Till we reach that we hold off + * calling any commit callbacks. + */ + SNAPBUILD_CONSISTENT = 2, +} SnapBuildState; + +/* forward declare so we don't have to expose the struct to the public */ +struct SnapBuild; +typedef struct SnapBuild SnapBuild; + +/* forward declare so we don't have to include reorderbuffer.h */ +struct ReorderBuffer; + +/* forward declare so we don't have to include heapam_xlog.h */ +struct xl_heap_new_cid; +struct xl_running_xacts; + +extern void CheckPointSnapBuild(void); + +extern SnapBuild *AllocateSnapshotBuilder(struct ReorderBuffer *reorder, + TransactionId xmin_horizon, XLogRecPtr start_lsn, + bool need_full_snapshot, + bool in_slot_creation, + XLogRecPtr two_phase_at); +extern void FreeSnapshotBuilder(SnapBuild *builder); + +extern void SnapBuildSnapDecRefcount(Snapshot snap); + +extern Snapshot SnapBuildInitialSnapshot(SnapBuild *builder); +extern const char *SnapBuildExportSnapshot(SnapBuild *builder); +extern void SnapBuildClearExportedSnapshot(void); +extern void SnapBuildResetExportedSnapshotState(void); + +extern SnapBuildState SnapBuildCurrentState(SnapBuild *builder); +extern Snapshot SnapBuildGetOrBuildSnapshot(SnapBuild *builder); + +extern bool SnapBuildXactNeedsSkip(SnapBuild *builder, XLogRecPtr ptr); +extern XLogRecPtr SnapBuildGetTwoPhaseAt(SnapBuild *builder); +extern void SnapBuildSetTwoPhaseAt(SnapBuild *builder, XLogRecPtr ptr); + +extern void SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, + TransactionId xid, int nsubxacts, + TransactionId *subxacts, uint32 xinfo); +extern bool SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, + XLogRecPtr lsn); +extern void SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid, + XLogRecPtr lsn, + struct xl_heap_new_cid *xlrec); +extern void SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, + struct xl_running_xacts *running); +extern void SnapBuildSerializationPoint(SnapBuild *builder, XLogRecPtr lsn); + +extern bool SnapBuildSnapshotExists(XLogRecPtr lsn); + +#endif /* SNAPBUILD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/syncrep.h b/platform/dbops/binaries/postgres/include/server/replication/syncrep.h new file mode 100644 index 0000000000000000000000000000000000000000..ea439e6da600436cd8dfd2b288612f926acf7711 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/syncrep.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------------------- + * + * syncrep.h + * Exports from replication/syncrep.c. + * + * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/replication/syncrep.h + * + *------------------------------------------------------------------------- + */ +#ifndef _SYNCREP_H +#define _SYNCREP_H + +#include "access/xlogdefs.h" + +#define SyncRepRequested() \ + (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH) + +/* SyncRepWaitMode */ +#define SYNC_REP_NO_WAIT (-1) +#define SYNC_REP_WAIT_WRITE 0 +#define SYNC_REP_WAIT_FLUSH 1 +#define SYNC_REP_WAIT_APPLY 2 + +#define NUM_SYNC_REP_WAIT_MODE 3 + +/* syncRepState */ +#define SYNC_REP_NOT_WAITING 0 +#define SYNC_REP_WAITING 1 +#define SYNC_REP_WAIT_COMPLETE 2 + +/* syncrep_method of SyncRepConfigData */ +#define SYNC_REP_PRIORITY 0 +#define SYNC_REP_QUORUM 1 + +/* + * SyncRepGetCandidateStandbys returns an array of these structs, + * one per candidate synchronous walsender. + */ +typedef struct SyncRepStandbyData +{ + /* Copies of relevant fields from WalSnd shared-memory struct */ + pid_t pid; + XLogRecPtr write; + XLogRecPtr flush; + XLogRecPtr apply; + int sync_standby_priority; + /* Index of this walsender in the WalSnd shared-memory array */ + int walsnd_index; + /* This flag indicates whether this struct is about our own process */ + bool is_me; +} SyncRepStandbyData; + +/* + * Struct for the configuration of synchronous replication. + * + * Note: this must be a flat representation that can be held in a single + * chunk of malloc'd memory, so that it can be stored as the "extra" data + * for the synchronous_standby_names GUC. + */ +typedef struct SyncRepConfigData +{ + int config_size; /* total size of this struct, in bytes */ + int num_sync; /* number of sync standbys that we need to + * wait for */ + uint8 syncrep_method; /* method to choose sync standbys */ + int nmembers; /* number of members in the following list */ + /* member_names contains nmembers consecutive nul-terminated C strings */ + char member_names[FLEXIBLE_ARRAY_MEMBER]; +} SyncRepConfigData; + +extern PGDLLIMPORT SyncRepConfigData *SyncRepConfig; + +/* communication variables for parsing synchronous_standby_names GUC */ +extern PGDLLIMPORT SyncRepConfigData *syncrep_parse_result; +extern PGDLLIMPORT char *syncrep_parse_error_msg; + +/* user-settable parameters for synchronous replication */ +extern PGDLLIMPORT char *SyncRepStandbyNames; + +/* called by user backend */ +extern void SyncRepWaitForLSN(XLogRecPtr lsn, bool commit); + +/* called at backend exit */ +extern void SyncRepCleanupAtProcExit(void); + +/* called by wal sender */ +extern void SyncRepInitConfig(void); +extern void SyncRepReleaseWaiters(void); + +/* called by wal sender and user backend */ +extern int SyncRepGetCandidateStandbys(SyncRepStandbyData **standbys); + +/* called by checkpointer */ +extern void SyncRepUpdateSyncStandbysDefined(void); + +/* + * Internal functions for parsing synchronous_standby_names grammar, + * in syncrep_gram.y and syncrep_scanner.l + */ +extern int syncrep_yyparse(void); +extern int syncrep_yylex(void); +extern void syncrep_yyerror(const char *str); +extern void syncrep_scanner_init(const char *str); +extern void syncrep_scanner_finish(void); + +#endif /* _SYNCREP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/walreceiver.h b/platform/dbops/binaries/postgres/include/server/replication/walreceiver.h new file mode 100644 index 0000000000000000000000000000000000000000..12f71fa99b0caf9b4617925e4b1ee0adadfc0f50 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/walreceiver.h @@ -0,0 +1,504 @@ +/*------------------------------------------------------------------------- + * + * walreceiver.h + * Exports from replication/walreceiverfuncs.c. + * + * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * src/include/replication/walreceiver.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALRECEIVER_H +#define _WALRECEIVER_H + +#include + +#include "access/xlog.h" +#include "access/xlogdefs.h" +#include "pgtime.h" +#include "port/atomics.h" +#include "replication/logicalproto.h" +#include "replication/walsender.h" +#include "storage/condition_variable.h" +#include "storage/latch.h" +#include "storage/spin.h" +#include "utils/tuplestore.h" + +/* user-settable parameters */ +extern PGDLLIMPORT int wal_receiver_status_interval; +extern PGDLLIMPORT int wal_receiver_timeout; +extern PGDLLIMPORT bool hot_standby_feedback; + +/* + * MAXCONNINFO: maximum size of a connection string. + * + * XXX: Should this move to pg_config_manual.h? + */ +#define MAXCONNINFO 1024 + +/* Can we allow the standby to accept replication connection from another standby? */ +#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0) + +/* + * Values for WalRcv->walRcvState. + */ +typedef enum +{ + WALRCV_STOPPED, /* stopped and mustn't start up again */ + WALRCV_STARTING, /* launched, but the process hasn't + * initialized yet */ + WALRCV_STREAMING, /* walreceiver is streaming */ + WALRCV_WAITING, /* stopped streaming, waiting for orders */ + WALRCV_RESTARTING, /* asked to restart streaming */ + WALRCV_STOPPING, /* requested to stop, but still running */ +} WalRcvState; + +/* Shared memory area for management of walreceiver process */ +typedef struct +{ + /* + * PID of currently active walreceiver process, its current state and + * start time (actually, the time at which it was requested to be + * started). + */ + pid_t pid; + WalRcvState walRcvState; + ConditionVariable walRcvStoppedCV; + pg_time_t startTime; + + /* + * receiveStart and receiveStartTLI indicate the first byte position and + * timeline that will be received. When startup process starts the + * walreceiver, it sets these to the point where it wants the streaming to + * begin. + */ + XLogRecPtr receiveStart; + TimeLineID receiveStartTLI; + + /* + * flushedUpto-1 is the last byte position that has already been received, + * and receivedTLI is the timeline it came from. At the first startup of + * walreceiver, these are set to receiveStart and receiveStartTLI. After + * that, walreceiver updates these whenever it flushes the received WAL to + * disk. + */ + XLogRecPtr flushedUpto; + TimeLineID receivedTLI; + + /* + * latestChunkStart is the starting byte position of the current "batch" + * of received WAL. It's actually the same as the previous value of + * flushedUpto before the last flush to disk. Startup process can use + * this to detect whether it's keeping up or not. + */ + XLogRecPtr latestChunkStart; + + /* + * Time of send and receive of any message received. + */ + TimestampTz lastMsgSendTime; + TimestampTz lastMsgReceiptTime; + + /* + * Latest reported end of WAL on the sender + */ + XLogRecPtr latestWalEnd; + TimestampTz latestWalEndTime; + + /* + * connection string; initially set to connect to the primary, and later + * clobbered to hide security-sensitive fields. + */ + char conninfo[MAXCONNINFO]; + + /* + * Host name (this can be a host name, an IP address, or a directory path) + * and port number of the active replication connection. + */ + char sender_host[NI_MAXHOST]; + int sender_port; + + /* + * replication slot name; is also used for walreceiver to connect with the + * primary + */ + char slotname[NAMEDATALEN]; + + /* + * If it's a temporary replication slot, it needs to be recreated when + * connecting. + */ + bool is_temp_slot; + + /* set true once conninfo is ready to display (obfuscated pwds etc) */ + bool ready_to_display; + + /* + * Latch used by startup process to wake up walreceiver after telling it + * where to start streaming (after setting receiveStart and + * receiveStartTLI), and also to tell it to send apply feedback to the + * primary whenever specially marked commit records are applied. This is + * normally mapped to procLatch when walreceiver is running. + */ + Latch *latch; + + slock_t mutex; /* locks shared variables shown above */ + + /* + * Like flushedUpto, but advanced after writing and before flushing, + * without the need to acquire the spin lock. Data can be read by another + * process up to this point, but shouldn't be used for data integrity + * purposes. + */ + pg_atomic_uint64 writtenUpto; + + /* + * force walreceiver reply? This doesn't need to be locked; memory + * barriers for ordering are sufficient. But we do need atomic fetch and + * store semantics, so use sig_atomic_t. + */ + sig_atomic_t force_reply; /* used as a bool */ +} WalRcvData; + +extern PGDLLIMPORT WalRcvData *WalRcv; + +typedef struct +{ + bool logical; /* True if this is logical replication stream, + * false if physical stream. */ + char *slotname; /* Name of the replication slot or NULL. */ + XLogRecPtr startpoint; /* LSN of starting point. */ + + union + { + struct + { + TimeLineID startpointTLI; /* Starting timeline */ + } physical; + struct + { + uint32 proto_version; /* Logical protocol version */ + List *publication_names; /* String list of publications */ + bool binary; /* Ask publisher to use binary */ + char *streaming_str; /* Streaming of large transactions */ + bool twophase; /* Streaming of two-phase transactions at + * prepare time */ + char *origin; /* Only publish data originating from the + * specified origin */ + } logical; + } proto; +} WalRcvStreamOptions; + +struct WalReceiverConn; +typedef struct WalReceiverConn WalReceiverConn; + +/* + * Status of walreceiver query execution. + * + * We only define statuses that are currently used. + */ +typedef enum +{ + WALRCV_ERROR, /* There was error when executing the query. */ + WALRCV_OK_COMMAND, /* Query executed utility or replication + * command. */ + WALRCV_OK_TUPLES, /* Query returned tuples. */ + WALRCV_OK_COPY_IN, /* Query started COPY FROM. */ + WALRCV_OK_COPY_OUT, /* Query started COPY TO. */ + WALRCV_OK_COPY_BOTH, /* Query started COPY BOTH replication + * protocol. */ +} WalRcvExecStatus; + +/* + * Return value for walrcv_exec, returns the status of the execution and + * tuples if any. + */ +typedef struct WalRcvExecResult +{ + WalRcvExecStatus status; + int sqlstate; + char *err; + Tuplestorestate *tuplestore; + TupleDesc tupledesc; +} WalRcvExecResult; + +/* WAL receiver - libpqwalreceiver hooks */ + +/* + * walrcv_connect_fn + * + * Establish connection to a cluster. 'replication' is true if the + * connection is a replication connection, and false if it is a + * regular connection. If it is a replication connection, it could + * be either logical or physical based on input argument 'logical'. + * 'appname' is a name associated to the connection, to use for example + * with fallback_application_name or application_name. Returns the + * details about the connection established, as defined by + * WalReceiverConn for each WAL receiver module. On error, NULL is + * returned with 'err' including the error generated. + */ +typedef WalReceiverConn *(*walrcv_connect_fn) (const char *conninfo, + bool replication, + bool logical, + bool must_use_password, + const char *appname, + char **err); + +/* + * walrcv_check_conninfo_fn + * + * Parse and validate the connection string given as of 'conninfo'. + */ +typedef void (*walrcv_check_conninfo_fn) (const char *conninfo, + bool must_use_password); + +/* + * walrcv_get_conninfo_fn + * + * Returns a user-displayable conninfo string. Note that any + * security-sensitive fields should be obfuscated. + */ +typedef char *(*walrcv_get_conninfo_fn) (WalReceiverConn *conn); + +/* + * walrcv_get_senderinfo_fn + * + * Provide information of the WAL sender this WAL receiver is connected + * to, as of 'sender_host' for the host of the sender and 'sender_port' + * for its port. + */ +typedef void (*walrcv_get_senderinfo_fn) (WalReceiverConn *conn, + char **sender_host, + int *sender_port); + +/* + * walrcv_identify_system_fn + * + * Run IDENTIFY_SYSTEM on the cluster connected to and validate the + * identity of the cluster. Returns the system ID of the cluster + * connected to. 'primary_tli' is the timeline ID of the sender. + */ +typedef char *(*walrcv_identify_system_fn) (WalReceiverConn *conn, + TimeLineID *primary_tli); + +/* + * walrcv_get_dbname_from_conninfo_fn + * + * Returns the database name from the primary_conninfo + */ +typedef char *(*walrcv_get_dbname_from_conninfo_fn) (const char *conninfo); + +/* + * walrcv_server_version_fn + * + * Returns the version number of the cluster connected to. + */ +typedef int (*walrcv_server_version_fn) (WalReceiverConn *conn); + +/* + * walrcv_readtimelinehistoryfile_fn + * + * Fetch from cluster the timeline history file for timeline 'tli'. + * Returns the name of the timeline history file as of 'filename', its + * contents as of 'content' and its 'size'. + */ +typedef void (*walrcv_readtimelinehistoryfile_fn) (WalReceiverConn *conn, + TimeLineID tli, + char **filename, + char **content, + int *size); + +/* + * walrcv_startstreaming_fn + * + * Start streaming WAL data from given streaming options. Returns true + * if the connection has switched successfully to copy-both mode and false + * if the server received the command and executed it successfully, but + * didn't switch to copy-mode. + */ +typedef bool (*walrcv_startstreaming_fn) (WalReceiverConn *conn, + const WalRcvStreamOptions *options); + +/* + * walrcv_endstreaming_fn + * + * Stop streaming of WAL data. Returns the next timeline ID of the cluster + * connected to in 'next_tli', or 0 if there was no report. + */ +typedef void (*walrcv_endstreaming_fn) (WalReceiverConn *conn, + TimeLineID *next_tli); + +/* + * walrcv_receive_fn + * + * Receive a message available from the WAL stream. 'buffer' is a pointer + * to a buffer holding the message received. Returns the length of the data, + * 0 if no data is available yet ('wait_fd' is a socket descriptor which can + * be waited on before a retry), and -1 if the cluster ended the COPY. + */ +typedef int (*walrcv_receive_fn) (WalReceiverConn *conn, + char **buffer, + pgsocket *wait_fd); + +/* + * walrcv_send_fn + * + * Send a message of size 'nbytes' to the WAL stream with 'buffer' as + * contents. + */ +typedef void (*walrcv_send_fn) (WalReceiverConn *conn, + const char *buffer, + int nbytes); + +/* + * walrcv_create_slot_fn + * + * Create a new replication slot named 'slotname'. 'temporary' defines + * if the slot is temporary. 'snapshot_action' defines the behavior wanted + * for an exported snapshot (see replication protocol for more details). + * 'lsn' includes the LSN position at which the created slot became + * consistent. Returns the name of the exported snapshot for a logical + * slot, or NULL for a physical slot. + */ +typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn, + const char *slotname, + bool temporary, + bool two_phase, + bool failover, + CRSSnapshotAction snapshot_action, + XLogRecPtr *lsn); + +/* + * walrcv_alter_slot_fn + * + * Change the definition of a replication slot. Currently, it only supports + * changing the failover property of the slot. + */ +typedef void (*walrcv_alter_slot_fn) (WalReceiverConn *conn, + const char *slotname, + bool failover); + +/* + * walrcv_get_backend_pid_fn + * + * Returns the PID of the remote backend process. + */ +typedef pid_t (*walrcv_get_backend_pid_fn) (WalReceiverConn *conn); + +/* + * walrcv_exec_fn + * + * Send generic queries (and commands) to the remote cluster. 'nRetTypes' + * is the expected number of returned attributes, and 'retTypes' an array + * including their type OIDs. Returns the status of the execution and + * tuples if any. + */ +typedef WalRcvExecResult *(*walrcv_exec_fn) (WalReceiverConn *conn, + const char *query, + const int nRetTypes, + const Oid *retTypes); + +/* + * walrcv_disconnect_fn + * + * Disconnect with the cluster. + */ +typedef void (*walrcv_disconnect_fn) (WalReceiverConn *conn); + +typedef struct WalReceiverFunctionsType +{ + walrcv_connect_fn walrcv_connect; + walrcv_check_conninfo_fn walrcv_check_conninfo; + walrcv_get_conninfo_fn walrcv_get_conninfo; + walrcv_get_senderinfo_fn walrcv_get_senderinfo; + walrcv_identify_system_fn walrcv_identify_system; + walrcv_get_dbname_from_conninfo_fn walrcv_get_dbname_from_conninfo; + walrcv_server_version_fn walrcv_server_version; + walrcv_readtimelinehistoryfile_fn walrcv_readtimelinehistoryfile; + walrcv_startstreaming_fn walrcv_startstreaming; + walrcv_endstreaming_fn walrcv_endstreaming; + walrcv_receive_fn walrcv_receive; + walrcv_send_fn walrcv_send; + walrcv_create_slot_fn walrcv_create_slot; + walrcv_alter_slot_fn walrcv_alter_slot; + walrcv_get_backend_pid_fn walrcv_get_backend_pid; + walrcv_exec_fn walrcv_exec; + walrcv_disconnect_fn walrcv_disconnect; +} WalReceiverFunctionsType; + +extern PGDLLIMPORT WalReceiverFunctionsType *WalReceiverFunctions; + +#define walrcv_connect(conninfo, replication, logical, must_use_password, appname, err) \ + WalReceiverFunctions->walrcv_connect(conninfo, replication, logical, must_use_password, appname, err) +#define walrcv_check_conninfo(conninfo, must_use_password) \ + WalReceiverFunctions->walrcv_check_conninfo(conninfo, must_use_password) +#define walrcv_get_conninfo(conn) \ + WalReceiverFunctions->walrcv_get_conninfo(conn) +#define walrcv_get_senderinfo(conn, sender_host, sender_port) \ + WalReceiverFunctions->walrcv_get_senderinfo(conn, sender_host, sender_port) +#define walrcv_identify_system(conn, primary_tli) \ + WalReceiverFunctions->walrcv_identify_system(conn, primary_tli) +#define walrcv_get_dbname_from_conninfo(conninfo) \ + WalReceiverFunctions->walrcv_get_dbname_from_conninfo(conninfo) +#define walrcv_server_version(conn) \ + WalReceiverFunctions->walrcv_server_version(conn) +#define walrcv_readtimelinehistoryfile(conn, tli, filename, content, size) \ + WalReceiverFunctions->walrcv_readtimelinehistoryfile(conn, tli, filename, content, size) +#define walrcv_startstreaming(conn, options) \ + WalReceiverFunctions->walrcv_startstreaming(conn, options) +#define walrcv_endstreaming(conn, next_tli) \ + WalReceiverFunctions->walrcv_endstreaming(conn, next_tli) +#define walrcv_receive(conn, buffer, wait_fd) \ + WalReceiverFunctions->walrcv_receive(conn, buffer, wait_fd) +#define walrcv_send(conn, buffer, nbytes) \ + WalReceiverFunctions->walrcv_send(conn, buffer, nbytes) +#define walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn) \ + WalReceiverFunctions->walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn) +#define walrcv_alter_slot(conn, slotname, failover) \ + WalReceiverFunctions->walrcv_alter_slot(conn, slotname, failover) +#define walrcv_get_backend_pid(conn) \ + WalReceiverFunctions->walrcv_get_backend_pid(conn) +#define walrcv_exec(conn, exec, nRetTypes, retTypes) \ + WalReceiverFunctions->walrcv_exec(conn, exec, nRetTypes, retTypes) +#define walrcv_disconnect(conn) \ + WalReceiverFunctions->walrcv_disconnect(conn) + +static inline void +walrcv_clear_result(WalRcvExecResult *walres) +{ + if (!walres) + return; + + if (walres->err) + pfree(walres->err); + + if (walres->tuplestore) + tuplestore_end(walres->tuplestore); + + if (walres->tupledesc) + FreeTupleDesc(walres->tupledesc); + + pfree(walres); +} + +/* prototypes for functions in walreceiver.c */ +extern void WalReceiverMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); +extern void ProcessWalRcvInterrupts(void); +extern void WalRcvForceReply(void); + +/* prototypes for functions in walreceiverfuncs.c */ +extern Size WalRcvShmemSize(void); +extern void WalRcvShmemInit(void); +extern void ShutdownWalRcv(void); +extern bool WalRcvStreaming(void); +extern bool WalRcvRunning(void); +extern void RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, + const char *conninfo, const char *slotname, + bool create_temp_slot); +extern XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI); +extern XLogRecPtr GetWalRcvWriteRecPtr(void); +extern int GetReplicationApplyDelay(void); +extern int GetReplicationTransferLatency(void); + +#endif /* _WALRECEIVER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/walsender.h b/platform/dbops/binaries/postgres/include/server/replication/walsender.h new file mode 100644 index 0000000000000000000000000000000000000000..f2d8297f016ea25a22fd80eacb08d40d77e6692e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/walsender.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------------------- + * + * walsender.h + * Exports from replication/walsender.c. + * + * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * src/include/replication/walsender.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALSENDER_H +#define _WALSENDER_H + +#include "access/xlogdefs.h" + +/* + * What to do with a snapshot in create replication slot command. + */ +typedef enum +{ + CRS_EXPORT_SNAPSHOT, + CRS_NOEXPORT_SNAPSHOT, + CRS_USE_SNAPSHOT, +} CRSSnapshotAction; + +/* global state */ +extern PGDLLIMPORT bool am_walsender; +extern PGDLLIMPORT bool am_cascading_walsender; +extern PGDLLIMPORT bool am_db_walsender; +extern PGDLLIMPORT bool wake_wal_senders; + +/* user-settable parameters */ +extern PGDLLIMPORT int max_wal_senders; +extern PGDLLIMPORT int wal_sender_timeout; +extern PGDLLIMPORT bool log_replication_commands; + +extern void InitWalSender(void); +extern bool exec_replication_command(const char *cmd_string); +extern void WalSndErrorCleanup(void); +extern void WalSndResourceCleanup(bool isCommit); +extern void PhysicalWakeupLogicalWalSnd(void); +extern XLogRecPtr GetStandbyFlushRecPtr(TimeLineID *tli); +extern void WalSndSignals(void); +extern Size WalSndShmemSize(void); +extern void WalSndShmemInit(void); +extern void WalSndWakeup(bool physical, bool logical); +extern void WalSndInitStopping(void); +extern void WalSndWaitStopping(void); +extern void HandleWalSndInitStopping(void); +extern void WalSndRqstFileReload(void); + +/* + * Remember that we want to wakeup walsenders later + * + * This is separated from doing the actual wakeup because the writeout is done + * while holding contended locks. + */ +#define WalSndWakeupRequest() \ + do { wake_wal_senders = true; } while (0) + +/* + * wakeup walsenders if there is work to be done + */ +static inline void +WalSndWakeupProcessRequests(bool physical, bool logical) +{ + if (wake_wal_senders) + { + wake_wal_senders = false; + if (max_wal_senders > 0) + WalSndWakeup(physical, logical); + } +} + +#endif /* _WALSENDER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/walsender_private.h b/platform/dbops/binaries/postgres/include/server/replication/walsender_private.h new file mode 100644 index 0000000000000000000000000000000000000000..cf32ac2488a8d16a1a2621ab8599220611b0d214 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/walsender_private.h @@ -0,0 +1,144 @@ +/*------------------------------------------------------------------------- + * + * walsender_private.h + * Private definitions from replication/walsender.c. + * + * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group + * + * src/include/replication/walsender_private.h + * + *------------------------------------------------------------------------- + */ +#ifndef _WALSENDER_PRIVATE_H +#define _WALSENDER_PRIVATE_H + +#include "access/xlog.h" +#include "lib/ilist.h" +#include "nodes/nodes.h" +#include "nodes/replnodes.h" +#include "replication/syncrep.h" +#include "storage/condition_variable.h" +#include "storage/latch.h" +#include "storage/shmem.h" +#include "storage/spin.h" + +typedef enum WalSndState +{ + WALSNDSTATE_STARTUP = 0, + WALSNDSTATE_BACKUP, + WALSNDSTATE_CATCHUP, + WALSNDSTATE_STREAMING, + WALSNDSTATE_STOPPING, +} WalSndState; + +/* + * Each walsender has a WalSnd struct in shared memory. + * + * This struct is protected by its 'mutex' spinlock field, except that some + * members are only written by the walsender process itself, and thus that + * process is free to read those members without holding spinlock. pid and + * needreload always require the spinlock to be held for all accesses. + */ +typedef struct WalSnd +{ + pid_t pid; /* this walsender's PID, or 0 if not active */ + + WalSndState state; /* this walsender's state */ + XLogRecPtr sentPtr; /* WAL has been sent up to this point */ + bool needreload; /* does currently-open file need to be + * reloaded? */ + + /* + * The xlog locations that have been written, flushed, and applied by + * standby-side. These may be invalid if the standby-side has not offered + * values yet. + */ + XLogRecPtr write; + XLogRecPtr flush; + XLogRecPtr apply; + + /* Measured lag times, or -1 for unknown/none. */ + TimeOffset writeLag; + TimeOffset flushLag; + TimeOffset applyLag; + + /* + * The priority order of the standby managed by this WALSender, as listed + * in synchronous_standby_names, or 0 if not-listed. + */ + int sync_standby_priority; + + /* Protects shared variables in this structure. */ + slock_t mutex; + + /* + * Pointer to the walsender's latch. Used by backends to wake up this + * walsender when it has work to do. NULL if the walsender isn't active. + */ + Latch *latch; + + /* + * Timestamp of the last message received from standby. + */ + TimestampTz replyTime; + + ReplicationKind kind; +} WalSnd; + +extern PGDLLIMPORT WalSnd *MyWalSnd; + +/* There is one WalSndCtl struct for the whole database cluster */ +typedef struct +{ + /* + * Synchronous replication queue with one queue per request type. + * Protected by SyncRepLock. + */ + dlist_head SyncRepQueue[NUM_SYNC_REP_WAIT_MODE]; + + /* + * Current location of the head of the queue. All waiters should have a + * waitLSN that follows this value. Protected by SyncRepLock. + */ + XLogRecPtr lsn[NUM_SYNC_REP_WAIT_MODE]; + + /* + * Are any sync standbys defined? Waiting backends can't reload the + * config file safely, so checkpointer updates this value as needed. + * Protected by SyncRepLock. + */ + bool sync_standbys_defined; + + /* used as a registry of physical / logical walsenders to wake */ + ConditionVariable wal_flush_cv; + ConditionVariable wal_replay_cv; + + /* + * Used by physical walsenders holding slots specified in + * synchronized_standby_slots to wake up logical walsenders holding + * logical failover slots when a walreceiver confirms the receipt of LSN. + */ + ConditionVariable wal_confirm_rcv_cv; + + WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]; +} WalSndCtlData; + +extern PGDLLIMPORT WalSndCtlData *WalSndCtl; + + +extern void WalSndSetState(WalSndState state); + +/* + * Internal functions for parsing the replication grammar, in repl_gram.y and + * repl_scanner.l + */ +extern int replication_yyparse(void); +extern int replication_yylex(void); +extern void replication_yyerror(const char *message) pg_attribute_noreturn(); +extern void replication_scanner_init(const char *str); +extern void replication_scanner_finish(void); +extern bool replication_scanner_is_replication_command(void); + +extern PGDLLIMPORT Node *replication_parse_result; + +#endif /* _WALSENDER_PRIVATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/replication/worker_internal.h b/platform/dbops/binaries/postgres/include/server/replication/worker_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..515aefd519125d39550d8d00feb342cea6894026 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/replication/worker_internal.h @@ -0,0 +1,353 @@ +/*------------------------------------------------------------------------- + * + * worker_internal.h + * Internal headers shared by logical replication workers. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * src/include/replication/worker_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef WORKER_INTERNAL_H +#define WORKER_INTERNAL_H + +#include "access/xlogdefs.h" +#include "catalog/pg_subscription.h" +#include "datatype/timestamp.h" +#include "miscadmin.h" +#include "replication/logicalrelation.h" +#include "replication/walreceiver.h" +#include "storage/buffile.h" +#include "storage/fileset.h" +#include "storage/lock.h" +#include "storage/shm_mq.h" +#include "storage/shm_toc.h" +#include "storage/spin.h" + +/* Different types of worker */ +typedef enum LogicalRepWorkerType +{ + WORKERTYPE_UNKNOWN = 0, + WORKERTYPE_TABLESYNC, + WORKERTYPE_APPLY, + WORKERTYPE_PARALLEL_APPLY, +} LogicalRepWorkerType; + +typedef struct LogicalRepWorker +{ + /* What type of worker is this? */ + LogicalRepWorkerType type; + + /* Time at which this worker was launched. */ + TimestampTz launch_time; + + /* Indicates if this slot is used or free. */ + bool in_use; + + /* Increased every time the slot is taken by new worker. */ + uint16 generation; + + /* Pointer to proc array. NULL if not running. */ + PGPROC *proc; + + /* Database id to connect to. */ + Oid dbid; + + /* User to use for connection (will be same as owner of subscription). */ + Oid userid; + + /* Subscription id for the worker. */ + Oid subid; + + /* Used for initial table synchronization. */ + Oid relid; + char relstate; + XLogRecPtr relstate_lsn; + slock_t relmutex; + + /* + * Used to create the changes and subxact files for the streaming + * transactions. Upon the arrival of the first streaming transaction or + * when the first-time leader apply worker times out while sending changes + * to the parallel apply worker, the fileset will be initialized, and it + * will be deleted when the worker exits. Under this, separate buffiles + * would be created for each transaction which will be deleted after the + * transaction is finished. + */ + FileSet *stream_fileset; + + /* + * PID of leader apply worker if this slot is used for a parallel apply + * worker, InvalidPid otherwise. + */ + pid_t leader_pid; + + /* Indicates whether apply can be performed in parallel. */ + bool parallel_apply; + + /* Stats. */ + XLogRecPtr last_lsn; + TimestampTz last_send_time; + TimestampTz last_recv_time; + XLogRecPtr reply_lsn; + TimestampTz reply_time; +} LogicalRepWorker; + +/* + * State of the transaction in parallel apply worker. + * + * The enum values must have the same order as the transaction state + * transitions. + */ +typedef enum ParallelTransState +{ + PARALLEL_TRANS_UNKNOWN, + PARALLEL_TRANS_STARTED, + PARALLEL_TRANS_FINISHED, +} ParallelTransState; + +/* + * State of fileset used to communicate changes from leader to parallel + * apply worker. + * + * FS_EMPTY indicates an initial state where the leader doesn't need to use + * the file to communicate with the parallel apply worker. + * + * FS_SERIALIZE_IN_PROGRESS indicates that the leader is serializing changes + * to the file. + * + * FS_SERIALIZE_DONE indicates that the leader has serialized all changes to + * the file. + * + * FS_READY indicates that it is now ok for a parallel apply worker to + * read the file. + */ +typedef enum PartialFileSetState +{ + FS_EMPTY, + FS_SERIALIZE_IN_PROGRESS, + FS_SERIALIZE_DONE, + FS_READY, +} PartialFileSetState; + +/* + * Struct for sharing information between leader apply worker and parallel + * apply workers. + */ +typedef struct ParallelApplyWorkerShared +{ + slock_t mutex; + + TransactionId xid; + + /* + * State used to ensure commit ordering. + * + * The parallel apply worker will set it to PARALLEL_TRANS_FINISHED after + * handling the transaction finish commands while the apply leader will + * wait for it to become PARALLEL_TRANS_FINISHED before proceeding in + * transaction finish commands (e.g. STREAM_COMMIT/STREAM_PREPARE/ + * STREAM_ABORT). + */ + ParallelTransState xact_state; + + /* Information from the corresponding LogicalRepWorker slot. */ + uint16 logicalrep_worker_generation; + int logicalrep_worker_slot_no; + + /* + * Indicates whether there are pending streaming blocks in the queue. The + * parallel apply worker will check it before starting to wait. + */ + pg_atomic_uint32 pending_stream_count; + + /* + * XactLastCommitEnd from the parallel apply worker. This is required by + * the leader worker so it can update the lsn_mappings. + */ + XLogRecPtr last_commit_end; + + /* + * After entering PARTIAL_SERIALIZE mode, the leader apply worker will + * serialize changes to the file, and share the fileset with the parallel + * apply worker when processing the transaction finish command. Then the + * parallel apply worker will apply all the spooled messages. + * + * FileSet is used here instead of SharedFileSet because we need it to + * survive after releasing the shared memory so that the leader apply + * worker can re-use the same fileset for the next streaming transaction. + */ + PartialFileSetState fileset_state; + FileSet fileset; +} ParallelApplyWorkerShared; + +/* + * Information which is used to manage the parallel apply worker. + */ +typedef struct ParallelApplyWorkerInfo +{ + /* + * This queue is used to send changes from the leader apply worker to the + * parallel apply worker. + */ + shm_mq_handle *mq_handle; + + /* + * This queue is used to transfer error messages from the parallel apply + * worker to the leader apply worker. + */ + shm_mq_handle *error_mq_handle; + + dsm_segment *dsm_seg; + + /* + * Indicates whether the leader apply worker needs to serialize the + * remaining changes to a file due to timeout when attempting to send data + * to the parallel apply worker via shared memory. + */ + bool serialize_changes; + + /* + * True if the worker is being used to process a parallel apply + * transaction. False indicates this worker is available for re-use. + */ + bool in_use; + + ParallelApplyWorkerShared *shared; +} ParallelApplyWorkerInfo; + +/* Main memory context for apply worker. Permanent during worker lifetime. */ +extern PGDLLIMPORT MemoryContext ApplyContext; + +extern PGDLLIMPORT MemoryContext ApplyMessageContext; + +extern PGDLLIMPORT ErrorContextCallback *apply_error_context_stack; + +extern PGDLLIMPORT ParallelApplyWorkerShared *MyParallelShared; + +/* libpqreceiver connection */ +extern PGDLLIMPORT struct WalReceiverConn *LogRepWorkerWalRcvConn; + +/* Worker and subscription objects. */ +extern PGDLLIMPORT Subscription *MySubscription; +extern PGDLLIMPORT LogicalRepWorker *MyLogicalRepWorker; + +extern PGDLLIMPORT bool in_remote_transaction; + +extern PGDLLIMPORT bool InitializingApplyWorker; + +extern void logicalrep_worker_attach(int slot); +extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid, + bool only_running); +extern List *logicalrep_workers_find(Oid subid, bool only_running); +extern bool logicalrep_worker_launch(LogicalRepWorkerType wtype, + Oid dbid, Oid subid, const char *subname, + Oid userid, Oid relid, + dsm_handle subworker_dsm); +extern void logicalrep_worker_stop(Oid subid, Oid relid); +extern void logicalrep_pa_worker_stop(ParallelApplyWorkerInfo *winfo); +extern void logicalrep_worker_wakeup(Oid subid, Oid relid); +extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker); + +extern int logicalrep_sync_worker_count(Oid subid); + +extern void ReplicationOriginNameForLogicalRep(Oid suboid, Oid relid, + char *originname, Size szoriginname); + +extern bool AllTablesyncsReady(void); +extern void UpdateTwoPhaseState(Oid suboid, char new_state); + +extern void process_syncing_tables(XLogRecPtr current_lsn); +extern void invalidate_syncing_table_states(Datum arg, int cacheid, + uint32 hashvalue); + +extern void stream_start_internal(TransactionId xid, bool first_segment); +extern void stream_stop_internal(TransactionId xid); + +/* Common streaming function to apply all the spooled messages */ +extern void apply_spooled_messages(FileSet *stream_fileset, TransactionId xid, + XLogRecPtr lsn); + +extern void apply_dispatch(StringInfo s); + +extern void maybe_reread_subscription(void); + +extern void stream_cleanup_files(Oid subid, TransactionId xid); + +extern void set_stream_options(WalRcvStreamOptions *options, + char *slotname, + XLogRecPtr *origin_startpos); + +extern void start_apply(XLogRecPtr origin_startpos); + +extern void InitializeLogRepWorker(void); + +extern void SetupApplyOrSyncWorker(int worker_slot); + +extern void DisableSubscriptionAndExit(void); + +extern void store_flush_position(XLogRecPtr remote_lsn, XLogRecPtr local_lsn); + +/* Function for apply error callback */ +extern void apply_error_callback(void *arg); +extern void set_apply_error_context_origin(char *originname); + +/* Parallel apply worker setup and interactions */ +extern void pa_allocate_worker(TransactionId xid); +extern ParallelApplyWorkerInfo *pa_find_worker(TransactionId xid); +extern void pa_detach_all_error_mq(void); + +extern bool pa_send_data(ParallelApplyWorkerInfo *winfo, Size nbytes, + const void *data); +extern void pa_switch_to_partial_serialize(ParallelApplyWorkerInfo *winfo, + bool stream_locked); + +extern void pa_set_xact_state(ParallelApplyWorkerShared *wshared, + ParallelTransState xact_state); +extern void pa_set_stream_apply_worker(ParallelApplyWorkerInfo *winfo); + +extern void pa_start_subtrans(TransactionId current_xid, + TransactionId top_xid); +extern void pa_reset_subtrans(void); +extern void pa_stream_abort(LogicalRepStreamAbortData *abort_data); +extern void pa_set_fileset_state(ParallelApplyWorkerShared *wshared, + PartialFileSetState fileset_state); + +extern void pa_lock_stream(TransactionId xid, LOCKMODE lockmode); +extern void pa_unlock_stream(TransactionId xid, LOCKMODE lockmode); + +extern void pa_lock_transaction(TransactionId xid, LOCKMODE lockmode); +extern void pa_unlock_transaction(TransactionId xid, LOCKMODE lockmode); + +extern void pa_decr_and_wait_stream_block(void); + +extern void pa_xact_finish(ParallelApplyWorkerInfo *winfo, + XLogRecPtr remote_lsn); + +#define isParallelApplyWorker(worker) ((worker)->in_use && \ + (worker)->type == WORKERTYPE_PARALLEL_APPLY) +#define isTablesyncWorker(worker) ((worker)->in_use && \ + (worker)->type == WORKERTYPE_TABLESYNC) + +static inline bool +am_tablesync_worker(void) +{ + return isTablesyncWorker(MyLogicalRepWorker); +} + +static inline bool +am_leader_apply_worker(void) +{ + Assert(MyLogicalRepWorker->in_use); + return (MyLogicalRepWorker->type == WORKERTYPE_APPLY); +} + +static inline bool +am_parallel_apply_worker(void) +{ + Assert(MyLogicalRepWorker->in_use); + return isParallelApplyWorker(MyLogicalRepWorker); +} + +#endif /* WORKER_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/prs2lock.h b/platform/dbops/binaries/postgres/include/server/rewrite/prs2lock.h new file mode 100644 index 0000000000000000000000000000000000000000..fcc9beb0c92d95ea7eae40bfe643b5d19f6c541f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/prs2lock.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * prs2lock.h + * data structures for POSTGRES Rule System II (rewrite rules only) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/prs2lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef PRS2LOCK_H +#define PRS2LOCK_H + +#include "access/attnum.h" +#include "nodes/pg_list.h" + +/* + * RewriteRule - + * holds an info for a rewrite rule + * + */ +typedef struct RewriteRule +{ + Oid ruleId; + CmdType event; + Node *qual; + List *actions; + char enabled; + bool isInstead; +} RewriteRule; + +/* + * RuleLock - + * all rules that apply to a particular relation. Even though we only + * have the rewrite rule system left and these are not really "locks", + * the name is kept for historical reasons. + */ +typedef struct RuleLock +{ + int numLocks; + RewriteRule **rules; +} RuleLock; + +#endif /* PRS2LOCK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteDefine.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteDefine.h new file mode 100644 index 0000000000000000000000000000000000000000..30569a1fde1c1aa15c8d94dbd0b3a8765b95e090 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteDefine.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * rewriteDefine.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteDefine.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEDEFINE_H +#define REWRITEDEFINE_H + +#include "catalog/objectaddress.h" +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +#define RULE_FIRES_ON_ORIGIN 'O' +#define RULE_FIRES_ALWAYS 'A' +#define RULE_FIRES_ON_REPLICA 'R' +#define RULE_DISABLED 'D' + +extern ObjectAddress DefineRule(RuleStmt *stmt, const char *queryString); + +extern ObjectAddress DefineQueryRewrite(const char *rulename, + Oid event_relid, + Node *event_qual, + CmdType event_type, + bool is_instead, + bool replace, + List *action); + +extern ObjectAddress RenameRewriteRule(RangeVar *relation, const char *oldName, + const char *newName); + +extern void setRuleCheckAsUser(Node *node, Oid userid); + +extern void EnableDisableRule(Relation rel, const char *rulename, + char fires_when); + +#endif /* REWRITEDEFINE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteHandler.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteHandler.h new file mode 100644 index 0000000000000000000000000000000000000000..1b65cda71cfc7ee6e3df011e66d2ab3c62e46517 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteHandler.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * rewriteHandler.h + * External interface to query rewriter. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteHandler.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEHANDLER_H +#define REWRITEHANDLER_H + +#include "nodes/parsenodes.h" +#include "utils/relcache.h" + +extern List *QueryRewrite(Query *parsetree); +extern void AcquireRewriteLocks(Query *parsetree, + bool forExecute, + bool forUpdatePushedDown); + +extern Node *build_column_default(Relation rel, int attrno); + +extern Query *get_view_query(Relation view); +extern bool view_has_instead_trigger(Relation view, CmdType event, + List *mergeActionList); +extern const char *view_query_is_auto_updatable(Query *viewquery, + bool check_cols); +extern int relation_is_updatable(Oid reloid, + List *outer_reloids, + bool include_triggers, + Bitmapset *include_cols); +extern void error_view_not_updatable(Relation view, + CmdType command, + List *mergeActionList, + const char *detail); + +#endif /* REWRITEHANDLER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteManip.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteManip.h new file mode 100644 index 0000000000000000000000000000000000000000..ac6d2049e8006eeb078e5d1377153bfbdeb9f76d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteManip.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * rewriteManip.h + * Querytree manipulation subroutines for query rewriter. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteManip.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEMANIP_H +#define REWRITEMANIP_H + +#include "nodes/parsenodes.h" + +struct AttrMap; /* avoid including attmap.h here */ + + +typedef struct replace_rte_variables_context replace_rte_variables_context; + +typedef Node *(*replace_rte_variables_callback) (Var *var, + replace_rte_variables_context *context); + +struct replace_rte_variables_context +{ + replace_rte_variables_callback callback; /* callback function */ + void *callback_arg; /* context data for callback function */ + int target_varno; /* RTE index to search for */ + int sublevels_up; /* (current) nesting depth */ + bool inserted_sublink; /* have we inserted a SubLink? */ +}; + +typedef enum ReplaceVarsNoMatchOption +{ + REPLACEVARS_REPORT_ERROR, /* throw error if no match */ + REPLACEVARS_CHANGE_VARNO, /* change the Var's varno, nothing else */ + REPLACEVARS_SUBSTITUTE_NULL, /* replace with a NULL Const */ +} ReplaceVarsNoMatchOption; + + +extern void CombineRangeTables(List **dst_rtable, List **dst_perminfos, + List *src_rtable, List *src_perminfos); +extern void OffsetVarNodes(Node *node, int offset, int sublevels_up); +extern void ChangeVarNodes(Node *node, int rt_index, int new_index, + int sublevels_up); +extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, + int min_sublevels_up); +extern void IncrementVarSublevelsUp_rtable(List *rtable, + int delta_sublevels_up, int min_sublevels_up); + +extern bool rangeTableEntry_used(Node *node, int rt_index, + int sublevels_up); + +extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr); + +extern void AddQual(Query *parsetree, Node *qual); +extern void AddInvertedQual(Query *parsetree, Node *qual); + +extern bool contain_aggs_of_level(Node *node, int levelsup); +extern int locate_agg_of_level(Node *node, int levelsup); +extern bool contain_windowfuncs(Node *node); +extern int locate_windowfunc(Node *node); +extern bool checkExprHasSubLink(Node *node); + +extern Node *add_nulling_relids(Node *node, + const Bitmapset *target_relids, + const Bitmapset *added_relids); +extern Node *remove_nulling_relids(Node *node, + const Bitmapset *removable_relids, + const Bitmapset *except_relids); + +extern Node *replace_rte_variables(Node *node, + int target_varno, int sublevels_up, + replace_rte_variables_callback callback, + void *callback_arg, + bool *outer_hasSubLinks); +extern Node *replace_rte_variables_mutator(Node *node, + replace_rte_variables_context *context); + +extern Node *map_variable_attnos(Node *node, + int target_varno, int sublevels_up, + const struct AttrMap *attno_map, + Oid to_rowtype, bool *found_whole_row); + +extern Node *ReplaceVarsFromTargetList(Node *node, + int target_varno, int sublevels_up, + RangeTblEntry *target_rte, + List *targetlist, + ReplaceVarsNoMatchOption nomatch_option, + int nomatch_varno, + bool *outer_hasSubLinks); + +#endif /* REWRITEMANIP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteRemove.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteRemove.h new file mode 100644 index 0000000000000000000000000000000000000000..fb439e88babebd9ab9437fa63d912773752fc812 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteRemove.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * rewriteRemove.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteRemove.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITEREMOVE_H +#define REWRITEREMOVE_H + +#include "nodes/parsenodes.h" + +extern void RemoveRewriteRuleById(Oid ruleOid); + +#endif /* REWRITEREMOVE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSearchCycle.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSearchCycle.h new file mode 100644 index 0000000000000000000000000000000000000000..ce809731b404c52198764cbea2950676c670ad16 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSearchCycle.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * rewriteSearchCycle.h + * Support for rewriting SEARCH and CYCLE clauses. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteSearchCycle.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITESEARCHCYCLE_H +#define REWRITESEARCHCYCLE_H + +#include "nodes/parsenodes.h" + +extern CommonTableExpr *rewriteSearchAndCycle(CommonTableExpr *cte); + +#endif /* REWRITESEARCHCYCLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSupport.h b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSupport.h new file mode 100644 index 0000000000000000000000000000000000000000..381713554844c18f97803cb04241afe1a0d15d60 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rewriteSupport.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * rewriteSupport.h + * + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/rewrite/rewriteSupport.h + * + *------------------------------------------------------------------------- + */ +#ifndef REWRITESUPPORT_H +#define REWRITESUPPORT_H + +/* The ON SELECT rule of a view is always named this: */ +#define ViewSelectRuleName "_RETURN" + +extern bool IsDefinedRewriteRule(Oid owningRel, const char *ruleName); + +extern void SetRelationRuleStatus(Oid relationId, bool relHasRules); + +extern Oid get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok); + +#endif /* REWRITESUPPORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/rewrite/rowsecurity.h b/platform/dbops/binaries/postgres/include/server/rewrite/rowsecurity.h new file mode 100644 index 0000000000000000000000000000000000000000..1717ed4e5e82a92b4e015b7ea6f27b8bca28f4be --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/rewrite/rowsecurity.h @@ -0,0 +1,49 @@ +/* ------------------------------------------------------------------------- + * + * rowsecurity.h + * + * prototypes for rewrite/rowsecurity.c and the structures for managing + * the row security policies for relations in relcache. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * ------------------------------------------------------------------------- + */ +#ifndef ROWSECURITY_H +#define ROWSECURITY_H + +#include "nodes/parsenodes.h" +#include "utils/array.h" +#include "utils/relcache.h" + +typedef struct RowSecurityPolicy +{ + char *policy_name; /* Name of the policy */ + char polcmd; /* Type of command policy is for */ + ArrayType *roles; /* Array of roles policy is for */ + bool permissive; /* restrictive or permissive policy */ + Expr *qual; /* Expression to filter rows */ + Expr *with_check_qual; /* Expression to limit rows allowed */ + bool hassublinks; /* If either expression has sublinks */ +} RowSecurityPolicy; + +typedef struct RowSecurityDesc +{ + MemoryContext rscxt; /* row security memory context */ + List *policies; /* list of row security policies */ +} RowSecurityDesc; + +typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, + Relation relation); + +extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive; + +extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive; + +extern void get_row_security_policies(Query *root, + RangeTblEntry *rte, int rt_index, + List **securityQuals, List **withCheckOptions, + bool *hasRowSecurity, bool *hasSubLinks); + +#endif /* ROWSECURITY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/snowball/header.h b/platform/dbops/binaries/postgres/include/server/snowball/header.h new file mode 100644 index 0000000000000000000000000000000000000000..0495fd53b6310c35cb1e4cef7b8b613f41790631 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/header.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------------------- + * + * header.h + * Replacement header file for Snowball stemmer modules + * + * The Snowball stemmer modules do #include "header.h", and think they + * are including snowball/libstemmer/header.h. We adjust the CPPFLAGS + * so that this file is found instead, and thereby we can modify the + * headers they see. The main point here is to ensure that pg_config.h + * is included before any system headers such as ; without that, + * we have portability issues on some platforms due to variation in + * largefile options across different modules in the backend. + * + * NOTE: this file should not be included into any non-snowball sources! + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/snowball/header.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNOWBALL_HEADR_H +#define SNOWBALL_HEADR_H + +/* + * It's against Postgres coding conventions to include postgres.h in a + * header file, but we allow the violation here because the alternative is + * to modify the machine-generated .c files provided by the Snowball project. + */ +#include "postgres.h" + +/* Some platforms define MAXINT and/or MININT, causing conflicts */ +#ifdef MAXINT +#undef MAXINT +#endif +#ifdef MININT +#undef MININT +#endif + +/* Now we can include the original Snowball header.h */ +#include "snowball/libstemmer/header.h" /* pgrminclude ignore */ + +/* + * Redefine standard memory allocation interface to pgsql's one. + * This allows us to control where the Snowball code allocates stuff. + */ +#ifdef malloc +#undef malloc +#endif +#define malloc(a) palloc(a) + +#ifdef calloc +#undef calloc +#endif +#define calloc(a,b) palloc0((a) * (b)) + +#ifdef realloc +#undef realloc +#endif +#define realloc(a,b) repalloc(a,b) + +#ifdef free +#undef free +#endif +#define free(a) pfree(a) + +#endif /* SNOWBALL_HEADR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/api.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/api.h new file mode 100644 index 0000000000000000000000000000000000000000..ba9d1c14bcae1f6e14a6d1154199099858e8a551 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/api.h @@ -0,0 +1,32 @@ + +typedef unsigned char symbol; + +/* Or replace 'char' above with 'short' for 16 bit characters. + + More precisely, replace 'char' with whatever type guarantees the + character width you need. Note however that sizeof(symbol) should divide + HEAD, defined in header.h as 2*sizeof(int), without remainder, otherwise + there is an alignment problem. In the unlikely event of a problem here, + consult Martin Porter. + +*/ + +struct SN_env { + symbol * p; + int c; int l; int lb; int bra; int ket; + symbol * * S; + int * I; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * SN_create_env(int S_size, int I_size); +extern void SN_close_env(struct SN_env * z, int S_size); + +extern int SN_set_current(struct SN_env * z, int size, const symbol * s); + +#ifdef __cplusplus +} +#endif diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/header.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/header.h new file mode 100644 index 0000000000000000000000000000000000000000..ef5a5464067e927776470670913067b1aae078fd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/header.h @@ -0,0 +1,61 @@ + +#include + +#include "api.h" + +#define MAXINT INT_MAX +#define MININT INT_MIN + +#define HEAD 2*sizeof(int) + +#define SIZE(p) ((int *)(p))[-1] +#define SET_SIZE(p, n) ((int *)(p))[-1] = n +#define CAPACITY(p) ((int *)(p))[-2] + +struct among +{ int s_size; /* number of chars in string */ + const symbol * s; /* search string */ + int substring_i;/* index to longest matching substring */ + int result; /* result of the lookup */ + int (* function)(struct SN_env *); +}; + +extern symbol * create_s(void); +extern void lose_s(symbol * p); + +extern int skip_utf8(const symbol * p, int c, int limit, int n); + +extern int skip_b_utf8(const symbol * p, int c, int limit, int n); + +extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); +extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat); + +extern int eq_s(struct SN_env * z, int s_size, const symbol * s); +extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s); +extern int eq_v(struct SN_env * z, const symbol * p); +extern int eq_v_b(struct SN_env * z, const symbol * p); + +extern int find_among(struct SN_env * z, const struct among * v, int v_size); +extern int find_among_b(struct SN_env * z, const struct among * v, int v_size); + +extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjptr); +extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s); +extern int slice_from_v(struct SN_env * z, const symbol * p); +extern int slice_del(struct SN_env * z); + +extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s); +extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p); + +extern symbol * slice_to(struct SN_env * z, symbol * p); +extern symbol * assign_to(struct SN_env * z, symbol * p); + +extern int len_utf8(const symbol * p); + +extern void debug(struct SN_env * z, int number, int line_count); diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_basque.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_basque.h new file mode 100644 index 0000000000000000000000000000000000000000..bffb6e9043e1920695b59ef1c2c0ab1f47fae923 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_basque.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_ISO_8859_1_create_env(void); +extern void basque_ISO_8859_1_close_env(struct SN_env * z); + +extern int basque_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h new file mode 100644 index 0000000000000000000000000000000000000000..96e97ddfa2a7b4585852802701930d6823622e52 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_catalan.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_ISO_8859_1_create_env(void); +extern void catalan_ISO_8859_1_close_env(struct SN_env * z); + +extern int catalan_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_danish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_danish.h new file mode 100644 index 0000000000000000000000000000000000000000..965436d9a1e259220113a117c63fd31740ae4bbc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_danish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_ISO_8859_1_create_env(void); +extern void danish_ISO_8859_1_close_env(struct SN_env * z); + +extern int danish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h new file mode 100644 index 0000000000000000000000000000000000000000..64f1c6d916329e3a8b0198a13be95a72f001a1bb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_dutch.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_ISO_8859_1_create_env(void); +extern void dutch_ISO_8859_1_close_env(struct SN_env * z); + +extern int dutch_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_english.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_english.h new file mode 100644 index 0000000000000000000000000000000000000000..ea90984b0024643d4f5536f9073e90313ea318e3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_english.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_ISO_8859_1_create_env(void); +extern void english_ISO_8859_1_close_env(struct SN_env * z); + +extern int english_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h new file mode 100644 index 0000000000000000000000000000000000000000..2c80e4cdead31e67e2687f2af1e7dda905b5b0b1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_finnish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_ISO_8859_1_create_env(void); +extern void finnish_ISO_8859_1_close_env(struct SN_env * z); + +extern int finnish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_french.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_french.h new file mode 100644 index 0000000000000000000000000000000000000000..1febb49d20448fb08834e4576ec9ce72f1e1b0a3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_french.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_ISO_8859_1_create_env(void); +extern void french_ISO_8859_1_close_env(struct SN_env * z); + +extern int french_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_german.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_german.h new file mode 100644 index 0000000000000000000000000000000000000000..98696bb336dc9ab86f24381c57c957f8da49b96a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_german.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_ISO_8859_1_create_env(void); +extern void german_ISO_8859_1_close_env(struct SN_env * z); + +extern int german_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h new file mode 100644 index 0000000000000000000000000000000000000000..d998b41b2cfb82ccedff20e786527f45e8bbd2e1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_indonesian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_ISO_8859_1_create_env(void); +extern void indonesian_ISO_8859_1_close_env(struct SN_env * z); + +extern int indonesian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_irish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_irish.h new file mode 100644 index 0000000000000000000000000000000000000000..d91d231790614d89b38d843c45b2c260af7e7622 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_irish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_ISO_8859_1_create_env(void); +extern void irish_ISO_8859_1_close_env(struct SN_env * z); + +extern int irish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_italian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_italian.h new file mode 100644 index 0000000000000000000000000000000000000000..22950bd2347ebe6636196869d2e2178c99b6d734 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_italian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_ISO_8859_1_create_env(void); +extern void italian_ISO_8859_1_close_env(struct SN_env * z); + +extern int italian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h new file mode 100644 index 0000000000000000000000000000000000000000..53930960569253f0f823fc72cf1f0cd2295621cd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_norwegian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void); +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); + +extern int norwegian_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_porter.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_porter.h new file mode 100644 index 0000000000000000000000000000000000000000..f504be101a60f77408f17273e1dc88cc9c9fd6e6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_porter.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_ISO_8859_1_create_env(void); +extern void porter_ISO_8859_1_close_env(struct SN_env * z); + +extern int porter_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h new file mode 100644 index 0000000000000000000000000000000000000000..c7b517c0912749233c52fa362f5ac604cdc063a9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_portuguese.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void); +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); + +extern int portuguese_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h new file mode 100644 index 0000000000000000000000000000000000000000..b066b4fc26fa2ba0cba5f8ba2f88bba4b5e1d46b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_spanish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_ISO_8859_1_create_env(void); +extern void spanish_ISO_8859_1_close_env(struct SN_env * z); + +extern int spanish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h new file mode 100644 index 0000000000000000000000000000000000000000..7b5ec75523c744831732aa43a104f75dc7a0f158 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_1_swedish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_ISO_8859_1_create_env(void); +extern void swedish_ISO_8859_1_close_env(struct SN_env * z); + +extern int swedish_ISO_8859_1_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h new file mode 100644 index 0000000000000000000000000000000000000000..be6ebf685ab2ba3a1838b8ad89ece116ecabeac7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_hungarian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_ISO_8859_2_create_env(void); +extern void hungarian_ISO_8859_2_close_env(struct SN_env * z); + +extern int hungarian_ISO_8859_2_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_romanian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_romanian.h new file mode 100644 index 0000000000000000000000000000000000000000..a7acc38e17d468bc9de8d854069b1604229c0882 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_ISO_8859_2_romanian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * romanian_ISO_8859_2_create_env(void); +extern void romanian_ISO_8859_2_close_env(struct SN_env * z); + +extern int romanian_ISO_8859_2_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_KOI8_R_russian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_KOI8_R_russian.h new file mode 100644 index 0000000000000000000000000000000000000000..42a8518b953fb8ab87d3697d7bf66bdae6f74cf1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_KOI8_R_russian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_KOI8_R_create_env(void); +extern void russian_KOI8_R_close_env(struct SN_env * z); + +extern int russian_KOI8_R_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_arabic.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_arabic.h new file mode 100644 index 0000000000000000000000000000000000000000..cad02f3453a920a3d9226b3aa7abbce88ba88af0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_arabic.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * arabic_UTF_8_create_env(void); +extern void arabic_UTF_8_close_env(struct SN_env * z); + +extern int arabic_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_armenian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_armenian.h new file mode 100644 index 0000000000000000000000000000000000000000..793fd09e6c07abe1c3c4890be99584dc6ca75636 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_armenian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * armenian_UTF_8_create_env(void); +extern void armenian_UTF_8_close_env(struct SN_env * z); + +extern int armenian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_basque.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_basque.h new file mode 100644 index 0000000000000000000000000000000000000000..79ddc983af478d420bee2685c77e74428f09f748 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_basque.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * basque_UTF_8_create_env(void); +extern void basque_UTF_8_close_env(struct SN_env * z); + +extern int basque_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_catalan.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_catalan.h new file mode 100644 index 0000000000000000000000000000000000000000..58c9995d71c61bd7e6ee43c12dc2e634daa28ebe --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_catalan.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * catalan_UTF_8_create_env(void); +extern void catalan_UTF_8_close_env(struct SN_env * z); + +extern int catalan_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_danish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_danish.h new file mode 100644 index 0000000000000000000000000000000000000000..a5084dc60f228b1fd35771bde415175178291ca7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_danish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * danish_UTF_8_create_env(void); +extern void danish_UTF_8_close_env(struct SN_env * z); + +extern int danish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_dutch.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_dutch.h new file mode 100644 index 0000000000000000000000000000000000000000..16cb995413f1fab6e47bbce909c2ece22b04ff35 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_dutch.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * dutch_UTF_8_create_env(void); +extern void dutch_UTF_8_close_env(struct SN_env * z); + +extern int dutch_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_english.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_english.h new file mode 100644 index 0000000000000000000000000000000000000000..11fa090e7dbe4936d588bd523f5053dc196ba872 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_english.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * english_UTF_8_create_env(void); +extern void english_UTF_8_close_env(struct SN_env * z); + +extern int english_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_finnish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_finnish.h new file mode 100644 index 0000000000000000000000000000000000000000..eebaa2de9e939e3c45fbf607bf5b87a5f2b125ea --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_finnish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * finnish_UTF_8_create_env(void); +extern void finnish_UTF_8_close_env(struct SN_env * z); + +extern int finnish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_french.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_french.h new file mode 100644 index 0000000000000000000000000000000000000000..22158b07c78d395dc2ac28e9787d19bf35ad8208 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_french.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * french_UTF_8_create_env(void); +extern void french_UTF_8_close_env(struct SN_env * z); + +extern int french_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_german.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_german.h new file mode 100644 index 0000000000000000000000000000000000000000..f276c53b265c64cf1a903d4925af4eb65fdd0c68 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_german.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * german_UTF_8_create_env(void); +extern void german_UTF_8_close_env(struct SN_env * z); + +extern int german_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_greek.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_greek.h new file mode 100644 index 0000000000000000000000000000000000000000..77667a31f009a42eec095ed268b5a906f2edccbb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_greek.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * greek_UTF_8_create_env(void); +extern void greek_UTF_8_close_env(struct SN_env * z); + +extern int greek_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hindi.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hindi.h new file mode 100644 index 0000000000000000000000000000000000000000..bbc2e9b72313a45eacbef2ab42d8e5011372c349 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hindi.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hindi_UTF_8_create_env(void); +extern void hindi_UTF_8_close_env(struct SN_env * z); + +extern int hindi_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hungarian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hungarian.h new file mode 100644 index 0000000000000000000000000000000000000000..cc29d77b9975f08fc0d14ea6ae635eacdde193eb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_hungarian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * hungarian_UTF_8_create_env(void); +extern void hungarian_UTF_8_close_env(struct SN_env * z); + +extern int hungarian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_indonesian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_indonesian.h new file mode 100644 index 0000000000000000000000000000000000000000..9f51324ca92708a22d141d561fb2a30734d95dce --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_indonesian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * indonesian_UTF_8_create_env(void); +extern void indonesian_UTF_8_close_env(struct SN_env * z); + +extern int indonesian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_irish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_irish.h new file mode 100644 index 0000000000000000000000000000000000000000..f06da96d4c7a01d80e2511f91cc855f3c8ae7fd4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_irish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * irish_UTF_8_create_env(void); +extern void irish_UTF_8_close_env(struct SN_env * z); + +extern int irish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_italian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_italian.h new file mode 100644 index 0000000000000000000000000000000000000000..f00dcaa5dc107ff988e65977bb3ef6be78f20254 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_italian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * italian_UTF_8_create_env(void); +extern void italian_UTF_8_close_env(struct SN_env * z); + +extern int italian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_lithuanian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_lithuanian.h new file mode 100644 index 0000000000000000000000000000000000000000..e62ff1c9d581552bcd13e0dddcb09a91599ecd06 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_lithuanian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * lithuanian_UTF_8_create_env(void); +extern void lithuanian_UTF_8_close_env(struct SN_env * z); + +extern int lithuanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_nepali.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_nepali.h new file mode 100644 index 0000000000000000000000000000000000000000..f8f50af8a0c2167e1c83e7b2149ce5d71b0f64f8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_nepali.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * nepali_UTF_8_create_env(void); +extern void nepali_UTF_8_close_env(struct SN_env * z); + +extern int nepali_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_norwegian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_norwegian.h new file mode 100644 index 0000000000000000000000000000000000000000..72aab40230d07330668635700833e89ee8d8acfa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_norwegian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * norwegian_UTF_8_create_env(void); +extern void norwegian_UTF_8_close_env(struct SN_env * z); + +extern int norwegian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_porter.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_porter.h new file mode 100644 index 0000000000000000000000000000000000000000..00685b2c96ad1608ed03fc47e7ad9b24facab3f2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_porter.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * porter_UTF_8_create_env(void); +extern void porter_UTF_8_close_env(struct SN_env * z); + +extern int porter_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_portuguese.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_portuguese.h new file mode 100644 index 0000000000000000000000000000000000000000..7be43352c14e3044ec0200b4998cbb0e2c8a17a4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_portuguese.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * portuguese_UTF_8_create_env(void); +extern void portuguese_UTF_8_close_env(struct SN_env * z); + +extern int portuguese_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_romanian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_romanian.h new file mode 100644 index 0000000000000000000000000000000000000000..c93cd335b90bc31e259a82a2ec6a7d2c90a83c8d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_romanian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * romanian_UTF_8_create_env(void); +extern void romanian_UTF_8_close_env(struct SN_env * z); + +extern int romanian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_russian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_russian.h new file mode 100644 index 0000000000000000000000000000000000000000..ca1d88216ca4286997484c04e344054b3fb63114 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_russian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * russian_UTF_8_create_env(void); +extern void russian_UTF_8_close_env(struct SN_env * z); + +extern int russian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_serbian.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_serbian.h new file mode 100644 index 0000000000000000000000000000000000000000..1df04f64674e3432f9a79f2eab207d66bcea2189 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_serbian.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * serbian_UTF_8_create_env(void); +extern void serbian_UTF_8_close_env(struct SN_env * z); + +extern int serbian_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_spanish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_spanish.h new file mode 100644 index 0000000000000000000000000000000000000000..dfd8dc3649d7fa005673ff7c2e52483d551b321d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_spanish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * spanish_UTF_8_create_env(void); +extern void spanish_UTF_8_close_env(struct SN_env * z); + +extern int spanish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_swedish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_swedish.h new file mode 100644 index 0000000000000000000000000000000000000000..ca08a64750ecff98c38925f781892d8c39ec7ea6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_swedish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * swedish_UTF_8_create_env(void); +extern void swedish_UTF_8_close_env(struct SN_env * z); + +extern int swedish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_tamil.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_tamil.h new file mode 100644 index 0000000000000000000000000000000000000000..5f5ae352baa1c23203579c226ac63d1124b4180b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_tamil.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * tamil_UTF_8_create_env(void); +extern void tamil_UTF_8_close_env(struct SN_env * z); + +extern int tamil_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_turkish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_turkish.h new file mode 100644 index 0000000000000000000000000000000000000000..68405929c3bae7abb9ecf85287d32fff87649992 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_turkish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * turkish_UTF_8_create_env(void); +extern void turkish_UTF_8_close_env(struct SN_env * z); + +extern int turkish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_yiddish.h b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_yiddish.h new file mode 100644 index 0000000000000000000000000000000000000000..55b66256a27aca8a544a20e617b019404c36ddb4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/snowball/libstemmer/stem_UTF_8_yiddish.h @@ -0,0 +1,15 @@ +/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct SN_env * yiddish_UTF_8_create_env(void); +extern void yiddish_UTF_8_close_env(struct SN_env * z); + +extern int yiddish_UTF_8_stem(struct SN_env * z); + +#ifdef __cplusplus +} +#endif + diff --git a/platform/dbops/binaries/postgres/include/server/statistics/extended_stats_internal.h b/platform/dbops/binaries/postgres/include/server/statistics/extended_stats_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..8eed9b338d4db6b764500a8469c5665c602554bd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/statistics/extended_stats_internal.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * extended_stats_internal.h + * POSTGRES extended statistics internal declarations + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/statistics/extended_stats_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXTENDED_STATS_INTERNAL_H +#define EXTENDED_STATS_INTERNAL_H + +#include "statistics/statistics.h" +#include "utils/sortsupport.h" + +typedef struct +{ + Oid eqopr; /* '=' operator for datatype, if any */ + Oid eqfunc; /* and associated function */ + Oid ltopr; /* '<' operator for datatype, if any */ +} StdAnalyzeData; + +typedef struct +{ + Datum value; /* a data value */ + int tupno; /* position index for tuple it came from */ +} ScalarItem; + +/* (de)serialization info */ +typedef struct DimensionInfo +{ + int nvalues; /* number of deduplicated values */ + int nbytes; /* number of bytes (serialized) */ + int nbytes_aligned; /* size of deserialized data with alignment */ + int typlen; /* pg_type.typlen */ + bool typbyval; /* pg_type.typbyval */ +} DimensionInfo; + +/* multi-sort */ +typedef struct MultiSortSupportData +{ + int ndims; /* number of dimensions */ + /* sort support data for each dimension: */ + SortSupportData ssup[FLEXIBLE_ARRAY_MEMBER]; +} MultiSortSupportData; + +typedef MultiSortSupportData *MultiSortSupport; + +typedef struct SortItem +{ + Datum *values; + bool *isnull; + int count; +} SortItem; + +/* a unified representation of the data the statistics is built on */ +typedef struct StatsBuildData +{ + int numrows; + int nattnums; + AttrNumber *attnums; + VacAttrStats **stats; + Datum **values; + bool **nulls; +} StatsBuildData; + + +extern MVNDistinct *statext_ndistinct_build(double totalrows, StatsBuildData *data); +extern bytea *statext_ndistinct_serialize(MVNDistinct *ndistinct); +extern MVNDistinct *statext_ndistinct_deserialize(bytea *data); + +extern MVDependencies *statext_dependencies_build(StatsBuildData *data); +extern bytea *statext_dependencies_serialize(MVDependencies *dependencies); +extern MVDependencies *statext_dependencies_deserialize(bytea *data); + +extern MCVList *statext_mcv_build(StatsBuildData *data, + double totalrows, int stattarget); +extern bytea *statext_mcv_serialize(MCVList *mcvlist, VacAttrStats **stats); +extern MCVList *statext_mcv_deserialize(bytea *data); + +extern MultiSortSupport multi_sort_init(int ndims); +extern void multi_sort_add_dimension(MultiSortSupport mss, int sortdim, + Oid oper, Oid collation); +extern int multi_sort_compare(const void *a, const void *b, void *arg); +extern int multi_sort_compare_dim(int dim, const SortItem *a, + const SortItem *b, MultiSortSupport mss); +extern int multi_sort_compare_dims(int start, int end, const SortItem *a, + const SortItem *b, MultiSortSupport mss); +extern int compare_scalars_simple(const void *a, const void *b, void *arg); +extern int compare_datums_simple(Datum a, Datum b, SortSupport ssup); + +extern AttrNumber *build_attnums_array(Bitmapset *attrs, int nexprs, int *numattrs); + +extern SortItem *build_sorted_items(StatsBuildData *data, int *nitems, + MultiSortSupport mss, + int numattrs, AttrNumber *attnums); + +extern bool examine_opclause_args(List *args, Node **exprp, + Const **cstp, bool *expronleftp); + +extern Selectivity mcv_combine_selectivities(Selectivity simple_sel, + Selectivity mcv_sel, + Selectivity mcv_basesel, + Selectivity mcv_totalsel); + +extern Selectivity mcv_clauselist_selectivity(PlannerInfo *root, + StatisticExtInfo *stat, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Selectivity *basesel, + Selectivity *totalsel); + +extern Selectivity mcv_clause_selectivity_or(PlannerInfo *root, + StatisticExtInfo *stat, + MCVList *mcv, + Node *clause, + bool **or_matches, + Selectivity *basesel, + Selectivity *overlap_mcvsel, + Selectivity *overlap_basesel, + Selectivity *totalsel); + +#endif /* EXTENDED_STATS_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/statistics/statistics.h b/platform/dbops/binaries/postgres/include/server/statistics/statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..7f2bf18716d486152c44c7560fa251a589ffd7d6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/statistics/statistics.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * statistics.h + * Extended statistics and selectivity estimation functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/statistics/statistics.h + * + *------------------------------------------------------------------------- + */ +#ifndef STATISTICS_H +#define STATISTICS_H + +#include "commands/vacuum.h" +#include "nodes/pathnodes.h" + +#define STATS_MAX_DIMENSIONS 8 /* max number of attributes */ + +/* Multivariate distinct coefficients */ +#define STATS_NDISTINCT_MAGIC 0xA352BFA4 /* struct identifier */ +#define STATS_NDISTINCT_TYPE_BASIC 1 /* struct version */ + +/* MVNDistinctItem represents a single combination of columns */ +typedef struct MVNDistinctItem +{ + double ndistinct; /* ndistinct value for this combination */ + int nattributes; /* number of attributes */ + AttrNumber *attributes; /* attribute numbers */ +} MVNDistinctItem; + +/* A MVNDistinct object, comprising all possible combinations of columns */ +typedef struct MVNDistinct +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of ndistinct (BASIC) */ + uint32 nitems; /* number of items in the statistic */ + MVNDistinctItem items[FLEXIBLE_ARRAY_MEMBER]; +} MVNDistinct; + +/* Multivariate functional dependencies */ +#define STATS_DEPS_MAGIC 0xB4549A2C /* marks serialized bytea */ +#define STATS_DEPS_TYPE_BASIC 1 /* basic dependencies type */ + +/* + * Functional dependencies, tracking column-level relationships (values + * in one column determine values in another one). + */ +typedef struct MVDependency +{ + double degree; /* degree of validity (0-1) */ + AttrNumber nattributes; /* number of attributes */ + AttrNumber attributes[FLEXIBLE_ARRAY_MEMBER]; /* attribute numbers */ +} MVDependency; + +typedef struct MVDependencies +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of MV Dependencies (BASIC) */ + uint32 ndeps; /* number of dependencies */ + MVDependency *deps[FLEXIBLE_ARRAY_MEMBER]; /* dependencies */ +} MVDependencies; + +/* used to flag stats serialized to bytea */ +#define STATS_MCV_MAGIC 0xE1A651C2 /* marks serialized bytea */ +#define STATS_MCV_TYPE_BASIC 1 /* basic MCV list type */ + +/* max items in MCV list */ +#define STATS_MCVLIST_MAX_ITEMS MAX_STATISTICS_TARGET + +/* + * Multivariate MCV (most-common value) lists + * + * A straightforward extension of MCV items - i.e. a list (array) of + * combinations of attribute values, together with a frequency and null flags. + */ +typedef struct MCVItem +{ + double frequency; /* frequency of this combination */ + double base_frequency; /* frequency if independent */ + bool *isnull; /* NULL flags */ + Datum *values; /* item values */ +} MCVItem; + +/* multivariate MCV list - essentially an array of MCV items */ +typedef struct MCVList +{ + uint32 magic; /* magic constant marker */ + uint32 type; /* type of MCV list (BASIC) */ + uint32 nitems; /* number of MCV items in the array */ + AttrNumber ndimensions; /* number of dimensions */ + Oid types[STATS_MAX_DIMENSIONS]; /* OIDs of data types */ + MCVItem items[FLEXIBLE_ARRAY_MEMBER]; /* array of MCV items */ +} MCVList; + +extern MVNDistinct *statext_ndistinct_load(Oid mvoid, bool inh); +extern MVDependencies *statext_dependencies_load(Oid mvoid, bool inh); +extern MCVList *statext_mcv_load(Oid mvoid, bool inh); + +extern void BuildRelationExtStatistics(Relation onerel, bool inh, double totalrows, + int numrows, HeapTuple *rows, + int natts, VacAttrStats **vacattrstats); +extern int ComputeExtStatisticsRows(Relation onerel, + int natts, VacAttrStats **vacattrstats); +extern bool statext_is_kind_built(HeapTuple htup, char type); +extern Selectivity dependencies_clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Bitmapset **estimatedclauses); +extern Selectivity statext_clauselist_selectivity(PlannerInfo *root, + List *clauses, + int varRelid, + JoinType jointype, + SpecialJoinInfo *sjinfo, + RelOptInfo *rel, + Bitmapset **estimatedclauses, + bool is_or); +extern bool has_stats_of_kind(List *stats, char requiredkind); +extern StatisticExtInfo *choose_best_statistics(List *stats, char requiredkind, + bool inh, + Bitmapset **clause_attnums, + List **clause_exprs, + int nclauses); +extern HeapTuple statext_expressions_load(Oid stxoid, bool inh, int idx); + +#endif /* STATISTICS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/barrier.h b/platform/dbops/binaries/postgres/include/server/storage/barrier.h new file mode 100644 index 0000000000000000000000000000000000000000..6bb1f665c8e141f744a6a0691ccbf1263e4d6bd7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/barrier.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * barrier.h + * Barriers for synchronizing cooperating processes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/barrier.h + * + *------------------------------------------------------------------------- + */ +#ifndef BARRIER_H +#define BARRIER_H + +/* + * For the header previously known as "barrier.h", please include + * "port/atomics.h", which deals with atomics, compiler barriers and memory + * barriers. + */ + +#include "storage/condition_variable.h" +#include "storage/spin.h" + +typedef struct Barrier +{ + slock_t mutex; + int phase; /* phase counter */ + int participants; /* the number of participants attached */ + int arrived; /* the number of participants that have + * arrived */ + int elected; /* highest phase elected */ + bool static_party; /* used only for assertions */ + ConditionVariable condition_variable; +} Barrier; + +extern void BarrierInit(Barrier *barrier, int participants); +extern bool BarrierArriveAndWait(Barrier *barrier, uint32 wait_event_info); +extern bool BarrierArriveAndDetach(Barrier *barrier); +extern bool BarrierArriveAndDetachExceptLast(Barrier *barrier); +extern int BarrierAttach(Barrier *barrier); +extern bool BarrierDetach(Barrier *barrier); +extern int BarrierPhase(Barrier *barrier); +extern int BarrierParticipants(Barrier *barrier); + +#endif /* BARRIER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/block.h b/platform/dbops/binaries/postgres/include/server/storage/block.h new file mode 100644 index 0000000000000000000000000000000000000000..ecde8e051822ff85e8ebdeef44de2cd43019acd9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/block.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * + * block.h + * POSTGRES disk block definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/block.h + * + *------------------------------------------------------------------------- + */ +#ifndef BLOCK_H +#define BLOCK_H + +/* + * BlockNumber: + * + * each data file (heap or index) is divided into postgres disk blocks + * (which may be thought of as the unit of i/o -- a postgres buffer + * contains exactly one disk block). the blocks are numbered + * sequentially, 0 to 0xFFFFFFFE. + * + * InvalidBlockNumber is the same thing as P_NEW in bufmgr.h. + * + * the access methods, the buffer manager and the storage manager are + * more or less the only pieces of code that should be accessing disk + * blocks directly. + */ +typedef uint32 BlockNumber; + +#define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF) + +#define MaxBlockNumber ((BlockNumber) 0xFFFFFFFE) + +/* + * BlockId: + * + * this is a storage type for BlockNumber. in other words, this type + * is used for on-disk structures (e.g., in HeapTupleData) whereas + * BlockNumber is the type on which calculations are performed (e.g., + * in access method code). + * + * there doesn't appear to be any reason to have separate types except + * for the fact that BlockIds can be SHORTALIGN'd (and therefore any + * structures that contains them, such as ItemPointerData, can also be + * SHORTALIGN'd). this is an important consideration for reducing the + * space requirements of the line pointer (ItemIdData) array on each + * page and the header of each heap or index tuple, so it doesn't seem + * wise to change this without good reason. + */ +typedef struct BlockIdData +{ + uint16 bi_hi; + uint16 bi_lo; +} BlockIdData; + +typedef BlockIdData *BlockId; /* block identifier */ + +/* ---------------- + * support functions + * ---------------- + */ + +/* + * BlockNumberIsValid + * True iff blockNumber is valid. + */ +static inline bool +BlockNumberIsValid(BlockNumber blockNumber) +{ + return blockNumber != InvalidBlockNumber; +} + +/* + * BlockIdSet + * Sets a block identifier to the specified value. + */ +static inline void +BlockIdSet(BlockIdData *blockId, BlockNumber blockNumber) +{ + blockId->bi_hi = blockNumber >> 16; + blockId->bi_lo = blockNumber & 0xffff; +} + +/* + * BlockIdEquals + * Check for block number equality. + */ +static inline bool +BlockIdEquals(const BlockIdData *blockId1, const BlockIdData *blockId2) +{ + return (blockId1->bi_hi == blockId2->bi_hi && + blockId1->bi_lo == blockId2->bi_lo); +} + +/* + * BlockIdGetBlockNumber + * Retrieve the block number from a block identifier. + */ +static inline BlockNumber +BlockIdGetBlockNumber(const BlockIdData *blockId) +{ + return (((BlockNumber) blockId->bi_hi) << 16) | ((BlockNumber) blockId->bi_lo); +} + +#endif /* BLOCK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/buf.h b/platform/dbops/binaries/postgres/include/server/storage/buf.h new file mode 100644 index 0000000000000000000000000000000000000000..64a1ad9d2c47a70bb4499bf54f982f029ff9fbbf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/buf.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------- + * + * buf.h + * Basic buffer manager data types. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buf.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUF_H +#define BUF_H + +/* + * Buffer identifiers. + * + * Zero is invalid, positive is the index of a shared buffer (1..NBuffers), + * negative is the index of a local buffer (-1 .. -NLocBuffer). + */ +typedef int Buffer; + +#define InvalidBuffer 0 + +/* + * BufferIsInvalid + * True iff the buffer is invalid. + */ +#define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer) + +/* + * BufferIsLocal + * True iff the buffer is local (not visible to other backends). + */ +#define BufferIsLocal(buffer) ((buffer) < 0) + +/* + * Buffer access strategy objects. + * + * BufferAccessStrategyData is private to freelist.c + */ +typedef struct BufferAccessStrategyData *BufferAccessStrategy; + +#endif /* BUF_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/buf_internals.h b/platform/dbops/binaries/postgres/include/server/storage/buf_internals.h new file mode 100644 index 0000000000000000000000000000000000000000..f190e6e5e462b0f5c6d54e8105cd9272ce2e74ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/buf_internals.h @@ -0,0 +1,468 @@ +/*------------------------------------------------------------------------- + * + * buf_internals.h + * Internal definitions for buffer manager and the buffer replacement + * strategy. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buf_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_INTERNALS_H +#define BUFMGR_INTERNALS_H + +#include "pgstat.h" +#include "port/atomics.h" +#include "storage/buf.h" +#include "storage/bufmgr.h" +#include "storage/condition_variable.h" +#include "storage/latch.h" +#include "storage/lwlock.h" +#include "storage/shmem.h" +#include "storage/smgr.h" +#include "storage/spin.h" +#include "utils/relcache.h" +#include "utils/resowner.h" + +/* + * Buffer state is a single 32-bit variable where following data is combined. + * + * - 18 bits refcount + * - 4 bits usage count + * - 10 bits of flags + * + * Combining these values allows to perform some operations without locking + * the buffer header, by modifying them together with a CAS loop. + * + * The definition of buffer state components is below. + */ +#define BUF_REFCOUNT_ONE 1 +#define BUF_REFCOUNT_MASK ((1U << 18) - 1) +#define BUF_USAGECOUNT_MASK 0x003C0000U +#define BUF_USAGECOUNT_ONE (1U << 18) +#define BUF_USAGECOUNT_SHIFT 18 +#define BUF_FLAG_MASK 0xFFC00000U + +/* Get refcount and usagecount from buffer state */ +#define BUF_STATE_GET_REFCOUNT(state) ((state) & BUF_REFCOUNT_MASK) +#define BUF_STATE_GET_USAGECOUNT(state) (((state) & BUF_USAGECOUNT_MASK) >> BUF_USAGECOUNT_SHIFT) + +/* + * Flags for buffer descriptors + * + * Note: BM_TAG_VALID essentially means that there is a buffer hashtable + * entry associated with the buffer's tag. + */ +#define BM_LOCKED (1U << 22) /* buffer header is locked */ +#define BM_DIRTY (1U << 23) /* data needs writing */ +#define BM_VALID (1U << 24) /* data is valid */ +#define BM_TAG_VALID (1U << 25) /* tag is assigned */ +#define BM_IO_IN_PROGRESS (1U << 26) /* read or write in progress */ +#define BM_IO_ERROR (1U << 27) /* previous I/O failed */ +#define BM_JUST_DIRTIED (1U << 28) /* dirtied since write started */ +#define BM_PIN_COUNT_WAITER (1U << 29) /* have waiter for sole pin */ +#define BM_CHECKPOINT_NEEDED (1U << 30) /* must write for checkpoint */ +#define BM_PERMANENT (1U << 31) /* permanent buffer (not unlogged, + * or init fork) */ +/* + * The maximum allowed value of usage_count represents a tradeoff between + * accuracy and speed of the clock-sweep buffer management algorithm. A + * large value (comparable to NBuffers) would approximate LRU semantics. + * But it can take as many as BM_MAX_USAGE_COUNT+1 complete cycles of + * clock sweeps to find a free buffer, so in practice we don't want the + * value to be very large. + */ +#define BM_MAX_USAGE_COUNT 5 + +/* + * Buffer tag identifies which disk block the buffer contains. + * + * Note: the BufferTag data must be sufficient to determine where to write the + * block, without reference to pg_class or pg_tablespace entries. It's + * possible that the backend flushing the buffer doesn't even believe the + * relation is visible yet (its xact may have started before the xact that + * created the rel). The storage manager must be able to cope anyway. + * + * Note: if there's any pad bytes in the struct, InitBufferTag will have + * to be fixed to zero them, since this struct is used as a hash key. + */ +typedef struct buftag +{ + Oid spcOid; /* tablespace oid */ + Oid dbOid; /* database oid */ + RelFileNumber relNumber; /* relation file number */ + ForkNumber forkNum; /* fork number */ + BlockNumber blockNum; /* blknum relative to begin of reln */ +} BufferTag; + +static inline RelFileNumber +BufTagGetRelNumber(const BufferTag *tag) +{ + return tag->relNumber; +} + +static inline ForkNumber +BufTagGetForkNum(const BufferTag *tag) +{ + return tag->forkNum; +} + +static inline void +BufTagSetRelForkDetails(BufferTag *tag, RelFileNumber relnumber, + ForkNumber forknum) +{ + tag->relNumber = relnumber; + tag->forkNum = forknum; +} + +static inline RelFileLocator +BufTagGetRelFileLocator(const BufferTag *tag) +{ + RelFileLocator rlocator; + + rlocator.spcOid = tag->spcOid; + rlocator.dbOid = tag->dbOid; + rlocator.relNumber = BufTagGetRelNumber(tag); + + return rlocator; +} + +static inline void +ClearBufferTag(BufferTag *tag) +{ + tag->spcOid = InvalidOid; + tag->dbOid = InvalidOid; + BufTagSetRelForkDetails(tag, InvalidRelFileNumber, InvalidForkNumber); + tag->blockNum = InvalidBlockNumber; +} + +static inline void +InitBufferTag(BufferTag *tag, const RelFileLocator *rlocator, + ForkNumber forkNum, BlockNumber blockNum) +{ + tag->spcOid = rlocator->spcOid; + tag->dbOid = rlocator->dbOid; + BufTagSetRelForkDetails(tag, rlocator->relNumber, forkNum); + tag->blockNum = blockNum; +} + +static inline bool +BufferTagsEqual(const BufferTag *tag1, const BufferTag *tag2) +{ + return (tag1->spcOid == tag2->spcOid) && + (tag1->dbOid == tag2->dbOid) && + (tag1->relNumber == tag2->relNumber) && + (tag1->blockNum == tag2->blockNum) && + (tag1->forkNum == tag2->forkNum); +} + +static inline bool +BufTagMatchesRelFileLocator(const BufferTag *tag, + const RelFileLocator *rlocator) +{ + return (tag->spcOid == rlocator->spcOid) && + (tag->dbOid == rlocator->dbOid) && + (BufTagGetRelNumber(tag) == rlocator->relNumber); +} + + +/* + * The shared buffer mapping table is partitioned to reduce contention. + * To determine which partition lock a given tag requires, compute the tag's + * hash code with BufTableHashCode(), then apply BufMappingPartitionLock(). + * NB: NUM_BUFFER_PARTITIONS must be a power of 2! + */ +static inline uint32 +BufTableHashPartition(uint32 hashcode) +{ + return hashcode % NUM_BUFFER_PARTITIONS; +} + +static inline LWLock * +BufMappingPartitionLock(uint32 hashcode) +{ + return &MainLWLockArray[BUFFER_MAPPING_LWLOCK_OFFSET + + BufTableHashPartition(hashcode)].lock; +} + +static inline LWLock * +BufMappingPartitionLockByIndex(uint32 index) +{ + return &MainLWLockArray[BUFFER_MAPPING_LWLOCK_OFFSET + index].lock; +} + +/* + * BufferDesc -- shared descriptor/state data for a single shared buffer. + * + * Note: Buffer header lock (BM_LOCKED flag) must be held to examine or change + * tag, state or wait_backend_pgprocno fields. In general, buffer header lock + * is a spinlock which is combined with flags, refcount and usagecount into + * single atomic variable. This layout allow us to do some operations in a + * single atomic operation, without actually acquiring and releasing spinlock; + * for instance, increase or decrease refcount. buf_id field never changes + * after initialization, so does not need locking. freeNext is protected by + * the buffer_strategy_lock not buffer header lock. The LWLock can take care + * of itself. The buffer header lock is *not* used to control access to the + * data in the buffer! + * + * It's assumed that nobody changes the state field while buffer header lock + * is held. Thus buffer header lock holder can do complex updates of the + * state variable in single write, simultaneously with lock release (cleaning + * BM_LOCKED flag). On the other hand, updating of state without holding + * buffer header lock is restricted to CAS, which ensures that BM_LOCKED flag + * is not set. Atomic increment/decrement, OR/AND etc. are not allowed. + * + * An exception is that if we have the buffer pinned, its tag can't change + * underneath us, so we can examine the tag without locking the buffer header. + * Also, in places we do one-time reads of the flags without bothering to + * lock the buffer header; this is generally for situations where we don't + * expect the flag bit being tested to be changing. + * + * We can't physically remove items from a disk page if another backend has + * the buffer pinned. Hence, a backend may need to wait for all other pins + * to go away. This is signaled by storing its own pgprocno into + * wait_backend_pgprocno and setting flag bit BM_PIN_COUNT_WAITER. At present, + * there can be only one such waiter per buffer. + * + * We use this same struct for local buffer headers, but the locks are not + * used and not all of the flag bits are useful either. To avoid unnecessary + * overhead, manipulations of the state field should be done without actual + * atomic operations (i.e. only pg_atomic_read_u32() and + * pg_atomic_unlocked_write_u32()). + * + * Be careful to avoid increasing the size of the struct when adding or + * reordering members. Keeping it below 64 bytes (the most common CPU + * cache line size) is fairly important for performance. + * + * Per-buffer I/O condition variables are currently kept outside this struct in + * a separate array. They could be moved in here and still fit within that + * limit on common systems, but for now that is not done. + */ +typedef struct BufferDesc +{ + BufferTag tag; /* ID of page contained in buffer */ + int buf_id; /* buffer's index number (from 0) */ + + /* state of the tag, containing flags, refcount and usagecount */ + pg_atomic_uint32 state; + + int wait_backend_pgprocno; /* backend of pin-count waiter */ + int freeNext; /* link in freelist chain */ + LWLock content_lock; /* to lock access to buffer contents */ +} BufferDesc; + +/* + * Concurrent access to buffer headers has proven to be more efficient if + * they're cache line aligned. So we force the start of the BufferDescriptors + * array to be on a cache line boundary and force the elements to be cache + * line sized. + * + * XXX: As this is primarily matters in highly concurrent workloads which + * probably all are 64bit these days, and the space wastage would be a bit + * more noticeable on 32bit systems, we don't force the stride to be cache + * line sized on those. If somebody does actual performance testing, we can + * reevaluate. + * + * Note that local buffer descriptors aren't forced to be aligned - as there's + * no concurrent access to those it's unlikely to be beneficial. + * + * We use a 64-byte cache line size here, because that's the most common + * size. Making it bigger would be a waste of memory. Even if running on a + * platform with either 32 or 128 byte line sizes, it's good to align to + * boundaries and avoid false sharing. + */ +#define BUFFERDESC_PAD_TO_SIZE (SIZEOF_VOID_P == 8 ? 64 : 1) + +typedef union BufferDescPadded +{ + BufferDesc bufferdesc; + char pad[BUFFERDESC_PAD_TO_SIZE]; +} BufferDescPadded; + +/* + * The PendingWriteback & WritebackContext structure are used to keep + * information about pending flush requests to be issued to the OS. + */ +typedef struct PendingWriteback +{ + /* could store different types of pending flushes here */ + BufferTag tag; +} PendingWriteback; + +/* struct forward declared in bufmgr.h */ +typedef struct WritebackContext +{ + /* pointer to the max number of writeback requests to coalesce */ + int *max_pending; + + /* current number of pending writeback requests */ + int nr_pending; + + /* pending requests */ + PendingWriteback pending_writebacks[WRITEBACK_MAX_PENDING_FLUSHES]; +} WritebackContext; + +/* in buf_init.c */ +extern PGDLLIMPORT BufferDescPadded *BufferDescriptors; +extern PGDLLIMPORT ConditionVariableMinimallyPadded *BufferIOCVArray; +extern PGDLLIMPORT WritebackContext BackendWritebackContext; + +/* in localbuf.c */ +extern PGDLLIMPORT BufferDesc *LocalBufferDescriptors; + + +static inline BufferDesc * +GetBufferDescriptor(uint32 id) +{ + return &(BufferDescriptors[id]).bufferdesc; +} + +static inline BufferDesc * +GetLocalBufferDescriptor(uint32 id) +{ + return &LocalBufferDescriptors[id]; +} + +static inline Buffer +BufferDescriptorGetBuffer(const BufferDesc *bdesc) +{ + return (Buffer) (bdesc->buf_id + 1); +} + +static inline ConditionVariable * +BufferDescriptorGetIOCV(const BufferDesc *bdesc) +{ + return &(BufferIOCVArray[bdesc->buf_id]).cv; +} + +static inline LWLock * +BufferDescriptorGetContentLock(const BufferDesc *bdesc) +{ + return (LWLock *) (&bdesc->content_lock); +} + +/* + * The freeNext field is either the index of the next freelist entry, + * or one of these special values: + */ +#define FREENEXT_END_OF_LIST (-1) +#define FREENEXT_NOT_IN_LIST (-2) + +/* + * Functions for acquiring/releasing a shared buffer header's spinlock. Do + * not apply these to local buffers! + */ +extern uint32 LockBufHdr(BufferDesc *desc); + +static inline void +UnlockBufHdr(BufferDesc *desc, uint32 buf_state) +{ + pg_write_barrier(); + pg_atomic_write_u32(&desc->state, buf_state & (~BM_LOCKED)); +} + +/* in bufmgr.c */ + +/* + * Structure to sort buffers per file on checkpoints. + * + * This structure is allocated per buffer in shared memory, so it should be + * kept as small as possible. + */ +typedef struct CkptSortItem +{ + Oid tsId; + RelFileNumber relNumber; + ForkNumber forkNum; + BlockNumber blockNum; + int buf_id; +} CkptSortItem; + +extern PGDLLIMPORT CkptSortItem *CkptBufferIds; + +/* ResourceOwner callbacks to hold buffer I/Os and pins */ +extern PGDLLIMPORT const ResourceOwnerDesc buffer_io_resowner_desc; +extern PGDLLIMPORT const ResourceOwnerDesc buffer_pin_resowner_desc; + +/* Convenience wrappers over ResourceOwnerRemember/Forget */ +static inline void +ResourceOwnerRememberBuffer(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerRemember(owner, Int32GetDatum(buffer), &buffer_pin_resowner_desc); +} +static inline void +ResourceOwnerForgetBuffer(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerForget(owner, Int32GetDatum(buffer), &buffer_pin_resowner_desc); +} +static inline void +ResourceOwnerRememberBufferIO(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerRemember(owner, Int32GetDatum(buffer), &buffer_io_resowner_desc); +} +static inline void +ResourceOwnerForgetBufferIO(ResourceOwner owner, Buffer buffer) +{ + ResourceOwnerForget(owner, Int32GetDatum(buffer), &buffer_io_resowner_desc); +} + +/* + * Internal buffer management routines + */ +/* bufmgr.c */ +extern void WritebackContextInit(WritebackContext *context, int *max_pending); +extern void IssuePendingWritebacks(WritebackContext *wb_context, IOContext io_context); +extern void ScheduleBufferTagForWriteback(WritebackContext *wb_context, + IOContext io_context, BufferTag *tag); + +/* freelist.c */ +extern IOContext IOContextForStrategy(BufferAccessStrategy strategy); +extern BufferDesc *StrategyGetBuffer(BufferAccessStrategy strategy, + uint32 *buf_state, bool *from_ring); +extern void StrategyFreeBuffer(BufferDesc *buf); +extern bool StrategyRejectBuffer(BufferAccessStrategy strategy, + BufferDesc *buf, bool from_ring); + +extern int StrategySyncStart(uint32 *complete_passes, uint32 *num_buf_alloc); +extern void StrategyNotifyBgWriter(int bgwprocno); + +extern Size StrategyShmemSize(void); +extern void StrategyInitialize(bool init); +extern bool have_free_buffer(void); + +/* buf_table.c */ +extern Size BufTableShmemSize(int size); +extern void InitBufTable(int size); +extern uint32 BufTableHashCode(BufferTag *tagPtr); +extern int BufTableLookup(BufferTag *tagPtr, uint32 hashcode); +extern int BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id); +extern void BufTableDelete(BufferTag *tagPtr, uint32 hashcode); + +/* localbuf.c */ +extern bool PinLocalBuffer(BufferDesc *buf_hdr, bool adjust_usagecount); +extern void UnpinLocalBuffer(Buffer buffer); +extern void UnpinLocalBufferNoOwner(Buffer buffer); +extern PrefetchBufferResult PrefetchLocalBuffer(SMgrRelation smgr, + ForkNumber forkNum, + BlockNumber blockNum); +extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, + BlockNumber blockNum, bool *foundPtr); +extern BlockNumber ExtendBufferedRelLocal(BufferManagerRelation bmr, + ForkNumber fork, + uint32 flags, + uint32 extend_by, + BlockNumber extend_upto, + Buffer *buffers, + uint32 *extended_by); +extern void MarkLocalBufferDirty(Buffer buffer); +extern void DropRelationLocalBuffers(RelFileLocator rlocator, + ForkNumber forkNum, + BlockNumber firstDelBlock); +extern void DropRelationAllLocalBuffers(RelFileLocator rlocator); +extern void AtEOXact_LocalBuffers(bool isCommit); + +#endif /* BUFMGR_INTERNALS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/buffile.h b/platform/dbops/binaries/postgres/include/server/storage/buffile.h new file mode 100644 index 0000000000000000000000000000000000000000..5f6d7c8e3ffbad272a49ba3d3d2cc044d40948b9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/buffile.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * buffile.h + * Management of large buffered temporary files. + * + * The BufFile routines provide a partial replacement for stdio atop + * virtual file descriptors managed by fd.c. Currently they only support + * buffered access to a virtual file, without any of stdio's formatting + * features. That's enough for immediate needs, but the set of facilities + * could be expanded if necessary. + * + * BufFile also supports working with temporary files that exceed the OS + * file size limit and/or the largest offset representable in an int. + * It might be better to split that out as a separately accessible module, + * but currently we have no need for oversize temp files without buffered + * access. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/buffile.h + * + *------------------------------------------------------------------------- + */ + +#ifndef BUFFILE_H +#define BUFFILE_H + +#include "storage/fileset.h" + +/* BufFile is an opaque type whose details are not known outside buffile.c. */ + +typedef struct BufFile BufFile; + +/* + * prototypes for functions in buffile.c + */ + +extern BufFile *BufFileCreateTemp(bool interXact); +extern void BufFileClose(BufFile *file); +extern pg_nodiscard size_t BufFileRead(BufFile *file, void *ptr, size_t size); +extern void BufFileReadExact(BufFile *file, void *ptr, size_t size); +extern size_t BufFileReadMaybeEOF(BufFile *file, void *ptr, size_t size, bool eofOK); +extern void BufFileWrite(BufFile *file, const void *ptr, size_t size); +extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); +extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); +extern int BufFileSeekBlock(BufFile *file, int64 blknum); +extern int64 BufFileSize(BufFile *file); +extern int64 BufFileAppend(BufFile *target, BufFile *source); + +extern BufFile *BufFileCreateFileSet(FileSet *fileset, const char *name); +extern void BufFileExportFileSet(BufFile *file); +extern BufFile *BufFileOpenFileSet(FileSet *fileset, const char *name, + int mode, bool missing_ok); +extern void BufFileDeleteFileSet(FileSet *fileset, const char *name, + bool missing_ok); +extern void BufFileTruncateFileSet(BufFile *file, int fileno, off_t offset); + +#endif /* BUFFILE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/bufmgr.h b/platform/dbops/binaries/postgres/include/server/storage/bufmgr.h new file mode 100644 index 0000000000000000000000000000000000000000..a1e71013d328f2afd54f1fb2085b436604a32ce7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/bufmgr.h @@ -0,0 +1,411 @@ +/*------------------------------------------------------------------------- + * + * bufmgr.h + * POSTGRES buffer manager definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bufmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_H +#define BUFMGR_H + +#include "port/pg_iovec.h" +#include "storage/block.h" +#include "storage/buf.h" +#include "storage/bufpage.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" +#include "utils/snapmgr.h" + +typedef void *Block; + +/* + * Possible arguments for GetAccessStrategy(). + * + * If adding a new BufferAccessStrategyType, also add a new IOContext so + * IO statistics using this strategy are tracked. + */ +typedef enum BufferAccessStrategyType +{ + BAS_NORMAL, /* Normal random access */ + BAS_BULKREAD, /* Large read-only scan (hint bit updates are + * ok) */ + BAS_BULKWRITE, /* Large multi-block write (e.g. COPY IN) */ + BAS_VACUUM, /* VACUUM */ +} BufferAccessStrategyType; + +/* Possible modes for ReadBufferExtended() */ +typedef enum +{ + RBM_NORMAL, /* Normal read */ + RBM_ZERO_AND_LOCK, /* Don't read from disk, caller will + * initialize. Also locks the page. */ + RBM_ZERO_AND_CLEANUP_LOCK, /* Like RBM_ZERO_AND_LOCK, but locks the page + * in "cleanup" mode */ + RBM_ZERO_ON_ERROR, /* Read, but return an all-zeros page on error */ + RBM_NORMAL_NO_LOG, /* Don't log page as invalid during WAL + * replay; otherwise same as RBM_NORMAL */ +} ReadBufferMode; + +/* + * Type returned by PrefetchBuffer(). + */ +typedef struct PrefetchBufferResult +{ + Buffer recent_buffer; /* If valid, a hit (recheck needed!) */ + bool initiated_io; /* If true, a miss resulting in async I/O */ +} PrefetchBufferResult; + +/* + * Flags influencing the behaviour of ExtendBufferedRel* + */ +typedef enum ExtendBufferedFlags +{ + /* + * Don't acquire extension lock. This is safe only if the relation isn't + * shared, an access exclusive lock is held or if this is the startup + * process. + */ + EB_SKIP_EXTENSION_LOCK = (1 << 0), + + /* Is this extension part of recovery? */ + EB_PERFORMING_RECOVERY = (1 << 1), + + /* + * Should the fork be created if it does not currently exist? This likely + * only ever makes sense for relation forks. + */ + EB_CREATE_FORK_IF_NEEDED = (1 << 2), + + /* Should the first (possibly only) return buffer be returned locked? */ + EB_LOCK_FIRST = (1 << 3), + + /* Should the smgr size cache be cleared? */ + EB_CLEAR_SIZE_CACHE = (1 << 4), + + /* internal flags follow */ + EB_LOCK_TARGET = (1 << 5), +} ExtendBufferedFlags; + +/* + * Some functions identify relations either by relation or smgr + + * relpersistence. Used via the BMR_REL()/BMR_SMGR() macros below. This + * allows us to use the same function for both recovery and normal operation. + */ +typedef struct BufferManagerRelation +{ + Relation rel; + struct SMgrRelationData *smgr; + char relpersistence; +} BufferManagerRelation; + +#define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel}) +#define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence}) + +/* Zero out page if reading fails. */ +#define READ_BUFFERS_ZERO_ON_ERROR (1 << 0) +/* Call smgrprefetch() if I/O necessary. */ +#define READ_BUFFERS_ISSUE_ADVICE (1 << 1) + +struct ReadBuffersOperation +{ + /* + * The following members should be set by the caller. If only smgr is + * provided without rel, then smgr_persistence can be set to override the + * default assumption of RELPERSISTENCE_PERMANENT. + */ + Relation rel; + struct SMgrRelationData *smgr; + char smgr_persistence; + ForkNumber forknum; + BufferAccessStrategy strategy; + + /* + * The following private members are private state for communication + * between StartReadBuffers() and WaitReadBuffers(), initialized only if + * an actual read is required, and should not be modified. + */ + Buffer *buffers; + BlockNumber blocknum; + int flags; + int16 nblocks; + int16 io_buffers_len; +}; + +typedef struct ReadBuffersOperation ReadBuffersOperation; + +/* forward declared, to avoid having to expose buf_internals.h here */ +struct WritebackContext; + +/* forward declared, to avoid including smgr.h here */ +struct SMgrRelationData; + +/* in globals.c ... this duplicates miscadmin.h */ +extern PGDLLIMPORT int NBuffers; + +/* in bufmgr.c */ +extern PGDLLIMPORT bool zero_damaged_pages; +extern PGDLLIMPORT int bgwriter_lru_maxpages; +extern PGDLLIMPORT double bgwriter_lru_multiplier; +extern PGDLLIMPORT bool track_io_timing; + +/* only applicable when prefetching is available */ +#ifdef USE_PREFETCH +#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 1 +#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 10 +#else +#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0 +#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 0 +#endif +extern PGDLLIMPORT int effective_io_concurrency; +extern PGDLLIMPORT int maintenance_io_concurrency; + +#define MAX_IO_COMBINE_LIMIT PG_IOV_MAX +#define DEFAULT_IO_COMBINE_LIMIT Min(MAX_IO_COMBINE_LIMIT, (128 * 1024) / BLCKSZ) +extern PGDLLIMPORT int io_combine_limit; + +extern PGDLLIMPORT int checkpoint_flush_after; +extern PGDLLIMPORT int backend_flush_after; +extern PGDLLIMPORT int bgwriter_flush_after; + +/* in buf_init.c */ +extern PGDLLIMPORT char *BufferBlocks; + +/* in localbuf.c */ +extern PGDLLIMPORT int NLocBuffer; +extern PGDLLIMPORT Block *LocalBufferBlockPointers; +extern PGDLLIMPORT int32 *LocalRefCount; + +/* upper limit for effective_io_concurrency */ +#define MAX_IO_CONCURRENCY 1000 + +/* special block number for ReadBuffer() */ +#define P_NEW InvalidBlockNumber /* grow the file to get a new page */ + +/* + * Buffer content lock modes (mode argument for LockBuffer()) + */ +#define BUFFER_LOCK_UNLOCK 0 +#define BUFFER_LOCK_SHARE 1 +#define BUFFER_LOCK_EXCLUSIVE 2 + + +/* + * prototypes for functions in bufmgr.c + */ +extern PrefetchBufferResult PrefetchSharedBuffer(struct SMgrRelationData *smgr_reln, + ForkNumber forkNum, + BlockNumber blockNum); +extern PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum, + BlockNumber blockNum); +extern bool ReadRecentBuffer(RelFileLocator rlocator, ForkNumber forkNum, + BlockNumber blockNum, Buffer recent_buffer); +extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); +extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, + BlockNumber blockNum, ReadBufferMode mode, + BufferAccessStrategy strategy); +extern Buffer ReadBufferWithoutRelcache(RelFileLocator rlocator, + ForkNumber forkNum, BlockNumber blockNum, + ReadBufferMode mode, BufferAccessStrategy strategy, + bool permanent); + +extern bool StartReadBuffer(ReadBuffersOperation *operation, + Buffer *buffer, + BlockNumber blocknum, + int flags); +extern bool StartReadBuffers(ReadBuffersOperation *operation, + Buffer *buffers, + BlockNumber blockNum, + int *nblocks, + int flags); +extern void WaitReadBuffers(ReadBuffersOperation *operation); + +extern void ReleaseBuffer(Buffer buffer); +extern void UnlockReleaseBuffer(Buffer buffer); +extern bool BufferIsExclusiveLocked(Buffer buffer); +extern bool BufferIsDirty(Buffer buffer); +extern void MarkBufferDirty(Buffer buffer); +extern void IncrBufferRefCount(Buffer buffer); +extern void CheckBufferIsPinnedOnce(Buffer buffer); +extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, + BlockNumber blockNum); + +extern Buffer ExtendBufferedRel(BufferManagerRelation bmr, + ForkNumber forkNum, + BufferAccessStrategy strategy, + uint32 flags); +extern BlockNumber ExtendBufferedRelBy(BufferManagerRelation bmr, + ForkNumber fork, + BufferAccessStrategy strategy, + uint32 flags, + uint32 extend_by, + Buffer *buffers, + uint32 *extended_by); +extern Buffer ExtendBufferedRelTo(BufferManagerRelation bmr, + ForkNumber fork, + BufferAccessStrategy strategy, + uint32 flags, + BlockNumber extend_to, + ReadBufferMode mode); + +extern void InitBufferPoolAccess(void); +extern void AtEOXact_Buffers(bool isCommit); +extern char *DebugPrintBufferRefcount(Buffer buffer); +extern void CheckPointBuffers(int flags); +extern BlockNumber BufferGetBlockNumber(Buffer buffer); +extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, + ForkNumber forkNum); +extern void FlushOneBuffer(Buffer buffer); +extern void FlushRelationBuffers(Relation rel); +extern void FlushRelationsAllBuffers(struct SMgrRelationData **smgrs, int nrels); +extern void CreateAndCopyRelationData(RelFileLocator src_rlocator, + RelFileLocator dst_rlocator, + bool permanent); +extern void FlushDatabaseBuffers(Oid dbid); +extern void DropRelationBuffers(struct SMgrRelationData *smgr_reln, + ForkNumber *forkNum, + int nforks, BlockNumber *firstDelBlock); +extern void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln, + int nlocators); +extern void DropDatabaseBuffers(Oid dbid); + +#define RelationGetNumberOfBlocks(reln) \ + RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM) + +extern bool BufferIsPermanent(Buffer buffer); +extern XLogRecPtr BufferGetLSNAtomic(Buffer buffer); + +#ifdef NOT_USED +extern void PrintPinnedBufs(void); +#endif +extern void BufferGetTag(Buffer buffer, RelFileLocator *rlocator, + ForkNumber *forknum, BlockNumber *blknum); + +extern void MarkBufferDirtyHint(Buffer buffer, bool buffer_std); + +extern void UnlockBuffers(void); +extern void LockBuffer(Buffer buffer, int mode); +extern bool ConditionalLockBuffer(Buffer buffer); +extern void LockBufferForCleanup(Buffer buffer); +extern bool ConditionalLockBufferForCleanup(Buffer buffer); +extern bool IsBufferCleanupOK(Buffer buffer); +extern bool HoldingBufferPinThatDelaysRecovery(void); + +extern bool BgBufferSync(struct WritebackContext *wb_context); + +extern void LimitAdditionalPins(uint32 *additional_pins); +extern void LimitAdditionalLocalPins(uint32 *additional_pins); + +extern bool EvictUnpinnedBuffer(Buffer buf); + +/* in buf_init.c */ +extern void InitBufferPool(void); +extern Size BufferShmemSize(void); + +/* in localbuf.c */ +extern void AtProcExit_LocalBuffers(void); + +/* in freelist.c */ + +extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype); +extern BufferAccessStrategy GetAccessStrategyWithSize(BufferAccessStrategyType btype, + int ring_size_kb); +extern int GetAccessStrategyBufferCount(BufferAccessStrategy strategy); +extern int GetAccessStrategyPinLimit(BufferAccessStrategy strategy); + +extern void FreeAccessStrategy(BufferAccessStrategy strategy); + + +/* inline functions */ + +/* + * Although this header file is nominally backend-only, certain frontend + * programs like pg_waldump include it. For compilers that emit static + * inline functions even when they're unused, that leads to unsatisfied + * external references; hence hide these with #ifndef FRONTEND. + */ + +#ifndef FRONTEND + +/* + * BufferIsValid + * True iff the given buffer number is valid (either as a shared + * or local buffer). + * + * Note: For a long time this was defined the same as BufferIsPinned, + * that is it would say False if you didn't hold a pin on the buffer. + * I believe this was bogus and served only to mask logic errors. + * Code should always know whether it has a buffer reference, + * independently of the pin state. + * + * Note: For a further long time this was not quite the inverse of the + * BufferIsInvalid() macro, in that it also did sanity checks to verify + * that the buffer number was in range. Most likely, this macro was + * originally intended only to be used in assertions, but its use has + * since expanded quite a bit, and the overhead of making those checks + * even in non-assert-enabled builds can be significant. Thus, we've + * now demoted the range checks to assertions within the macro itself. + */ +static inline bool +BufferIsValid(Buffer bufnum) +{ + Assert(bufnum <= NBuffers); + Assert(bufnum >= -NLocBuffer); + + return bufnum != InvalidBuffer; +} + +/* + * BufferGetBlock + * Returns a reference to a disk page image associated with a buffer. + * + * Note: + * Assumes buffer is valid. + */ +static inline Block +BufferGetBlock(Buffer buffer) +{ + Assert(BufferIsValid(buffer)); + + if (BufferIsLocal(buffer)) + return LocalBufferBlockPointers[-buffer - 1]; + else + return (Block) (BufferBlocks + ((Size) (buffer - 1)) * BLCKSZ); +} + +/* + * BufferGetPageSize + * Returns the page size within a buffer. + * + * Notes: + * Assumes buffer is valid. + * + * The buffer can be a raw disk block and need not contain a valid + * (formatted) disk page. + */ +/* XXX should dig out of buffer descriptor */ +static inline Size +BufferGetPageSize(Buffer buffer) +{ + AssertMacro(BufferIsValid(buffer)); + return (Size) BLCKSZ; +} + +/* + * BufferGetPage + * Returns the page associated with a buffer. + */ +static inline Page +BufferGetPage(Buffer buffer) +{ + return (Page) BufferGetBlock(buffer); +} + +#endif /* FRONTEND */ + +#endif /* BUFMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/bufpage.h b/platform/dbops/binaries/postgres/include/server/storage/bufpage.h new file mode 100644 index 0000000000000000000000000000000000000000..d0df02d39c5268dce460d750e63ae5018b9a4ab9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/bufpage.h @@ -0,0 +1,510 @@ +/*------------------------------------------------------------------------- + * + * bufpage.h + * Standard POSTGRES buffer page definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bufpage.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUFPAGE_H +#define BUFPAGE_H + +#include "access/xlogdefs.h" +#include "storage/block.h" +#include "storage/item.h" +#include "storage/off.h" + +/* + * A postgres disk page is an abstraction layered on top of a postgres + * disk block (which is simply a unit of i/o, see block.h). + * + * specifically, while a disk block can be unformatted, a postgres + * disk page is always a slotted page of the form: + * + * +----------------+---------------------------------+ + * | PageHeaderData | linp1 linp2 linp3 ... | + * +-----------+----+---------------------------------+ + * | ... linpN | | + * +-----------+--------------------------------------+ + * | ^ pd_lower | + * | | + * | v pd_upper | + * +-------------+------------------------------------+ + * | | tupleN ... | + * +-------------+------------------+-----------------+ + * | ... tuple3 tuple2 tuple1 | "special space" | + * +--------------------------------+-----------------+ + * ^ pd_special + * + * a page is full when nothing can be added between pd_lower and + * pd_upper. + * + * all blocks written out by an access method must be disk pages. + * + * EXCEPTIONS: + * + * obviously, a page is not formatted before it is initialized by + * a call to PageInit. + * + * NOTES: + * + * linp1..N form an ItemId (line pointer) array. ItemPointers point + * to a physical block number and a logical offset (line pointer + * number) within that block/page. Note that OffsetNumbers + * conventionally start at 1, not 0. + * + * tuple1..N are added "backwards" on the page. Since an ItemPointer + * offset is used to access an ItemId entry rather than an actual + * byte-offset position, tuples can be physically shuffled on a page + * whenever the need arises. This indirection also keeps crash recovery + * relatively simple, because the low-level details of page space + * management can be controlled by standard buffer page code during + * logging, and during recovery. + * + * AM-generic per-page information is kept in PageHeaderData. + * + * AM-specific per-page data (if any) is kept in the area marked "special + * space"; each AM has an "opaque" structure defined somewhere that is + * stored as the page trailer. an access method should always + * initialize its pages with PageInit and then set its own opaque + * fields. + */ + +typedef Pointer Page; + + +/* + * location (byte offset) within a page. + * + * note that this is actually limited to 2^15 because we have limited + * ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h). + */ +typedef uint16 LocationIndex; + + +/* + * For historical reasons, the 64-bit LSN value is stored as two 32-bit + * values. + */ +typedef struct +{ + uint32 xlogid; /* high bits */ + uint32 xrecoff; /* low bits */ +} PageXLogRecPtr; + +static inline XLogRecPtr +PageXLogRecPtrGet(PageXLogRecPtr val) +{ + return (uint64) val.xlogid << 32 | val.xrecoff; +} + +#define PageXLogRecPtrSet(ptr, lsn) \ + ((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn)) + +/* + * disk page organization + * + * space management information generic to any page + * + * pd_lsn - identifies xlog record for last change to this page. + * pd_checksum - page checksum, if set. + * pd_flags - flag bits. + * pd_lower - offset to start of free space. + * pd_upper - offset to end of free space. + * pd_special - offset to start of special space. + * pd_pagesize_version - size in bytes and page layout version number. + * pd_prune_xid - oldest XID among potentially prunable tuples on page. + * + * The LSN is used by the buffer manager to enforce the basic rule of WAL: + * "thou shalt write xlog before data". A dirty buffer cannot be dumped + * to disk until xlog has been flushed at least as far as the page's LSN. + * + * pd_checksum stores the page checksum, if it has been set for this page; + * zero is a valid value for a checksum. If a checksum is not in use then + * we leave the field unset. This will typically mean the field is zero + * though non-zero values may also be present if databases have been + * pg_upgraded from releases prior to 9.3, when the same byte offset was + * used to store the current timelineid when the page was last updated. + * Note that there is no indication on a page as to whether the checksum + * is valid or not, a deliberate design choice which avoids the problem + * of relying on the page contents to decide whether to verify it. Hence + * there are no flag bits relating to checksums. + * + * pd_prune_xid is a hint field that helps determine whether pruning will be + * useful. It is currently unused in index pages. + * + * The page version number and page size are packed together into a single + * uint16 field. This is for historical reasons: before PostgreSQL 7.3, + * there was no concept of a page version number, and doing it this way + * lets us pretend that pre-7.3 databases have page version number zero. + * We constrain page sizes to be multiples of 256, leaving the low eight + * bits available for a version number. + * + * Minimum possible page size is perhaps 64B to fit page header, opaque space + * and a minimal tuple; of course, in reality you want it much bigger, so + * the constraint on pagesize mod 256 is not an important restriction. + * On the high end, we can only support pages up to 32KB because lp_off/lp_len + * are 15 bits. + */ + +typedef struct PageHeaderData +{ + /* XXX LSN is member of *any* block, not only page-organized ones */ + PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog + * record for last change to this page */ + uint16 pd_checksum; /* checksum */ + uint16 pd_flags; /* flag bits, see below */ + LocationIndex pd_lower; /* offset to start of free space */ + LocationIndex pd_upper; /* offset to end of free space */ + LocationIndex pd_special; /* offset to start of special space */ + uint16 pd_pagesize_version; + TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */ + ItemIdData pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */ +} PageHeaderData; + +typedef PageHeaderData *PageHeader; + +/* + * pd_flags contains the following flag bits. Undefined bits are initialized + * to zero and may be used in the future. + * + * PD_HAS_FREE_LINES is set if there are any LP_UNUSED line pointers before + * pd_lower. This should be considered a hint rather than the truth, since + * changes to it are not WAL-logged. + * + * PD_PAGE_FULL is set if an UPDATE doesn't find enough free space in the + * page for its new tuple version; this suggests that a prune is needed. + * Again, this is just a hint. + */ +#define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */ +#define PD_PAGE_FULL 0x0002 /* not enough free space for new tuple? */ +#define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to + * everyone */ + +#define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */ + +/* + * Page layout version number 0 is for pre-7.3 Postgres releases. + * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout. + * Release 8.0 uses 2; it changed the HeapTupleHeader layout again. + * Release 8.1 uses 3; it redefined HeapTupleHeader infomask bits. + * Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and + * added the pd_flags field (by stealing some bits from pd_tli), + * as well as adding the pd_prune_xid field (which enlarges the header). + * + * As of Release 9.3, the checksum version must also be considered when + * handling pages. + */ +#define PG_PAGE_LAYOUT_VERSION 4 +#define PG_DATA_CHECKSUM_VERSION 1 + +/* ---------------------------------------------------------------- + * page support functions + * ---------------------------------------------------------------- + */ + +/* + * line pointer(s) do not count as part of header + */ +#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp)) + +/* + * PageIsEmpty + * returns true iff no itemid has been allocated on the page + */ +static inline bool +PageIsEmpty(Page page) +{ + return ((PageHeader) page)->pd_lower <= SizeOfPageHeaderData; +} + +/* + * PageIsNew + * returns true iff page has not been initialized (by PageInit) + */ +static inline bool +PageIsNew(Page page) +{ + return ((PageHeader) page)->pd_upper == 0; +} + +/* + * PageGetItemId + * Returns an item identifier of a page. + */ +static inline ItemId +PageGetItemId(Page page, OffsetNumber offsetNumber) +{ + return &((PageHeader) page)->pd_linp[offsetNumber - 1]; +} + +/* + * PageGetContents + * To be used in cases where the page does not contain line pointers. + * + * Note: prior to 8.3 this was not guaranteed to yield a MAXALIGN'd result. + * Now it is. Beware of old code that might think the offset to the contents + * is just SizeOfPageHeaderData rather than MAXALIGN(SizeOfPageHeaderData). + */ +static inline char * +PageGetContents(Page page) +{ + return (char *) page + MAXALIGN(SizeOfPageHeaderData); +} + +/* ---------------- + * functions to access page size info + * ---------------- + */ + +/* + * PageGetPageSize + * Returns the page size of a page. + * + * this can only be called on a formatted page (unlike + * BufferGetPageSize, which can be called on an unformatted page). + * however, it can be called on a page that is not stored in a buffer. + */ +static inline Size +PageGetPageSize(Page page) +{ + return (Size) (((PageHeader) page)->pd_pagesize_version & (uint16) 0xFF00); +} + +/* + * PageGetPageLayoutVersion + * Returns the page layout version of a page. + */ +static inline uint8 +PageGetPageLayoutVersion(Page page) +{ + return (((PageHeader) page)->pd_pagesize_version & 0x00FF); +} + +/* + * PageSetPageSizeAndVersion + * Sets the page size and page layout version number of a page. + * + * We could support setting these two values separately, but there's + * no real need for it at the moment. + */ +static inline void +PageSetPageSizeAndVersion(Page page, Size size, uint8 version) +{ + Assert((size & 0xFF00) == size); + Assert((version & 0x00FF) == version); + + ((PageHeader) page)->pd_pagesize_version = size | version; +} + +/* ---------------- + * page special data functions + * ---------------- + */ +/* + * PageGetSpecialSize + * Returns size of special space on a page. + */ +static inline uint16 +PageGetSpecialSize(Page page) +{ + return (PageGetPageSize(page) - ((PageHeader) page)->pd_special); +} + +/* + * Using assertions, validate that the page special pointer is OK. + * + * This is intended to catch use of the pointer before page initialization. + */ +static inline void +PageValidateSpecialPointer(Page page) +{ + Assert(page); + Assert(((PageHeader) page)->pd_special <= BLCKSZ); + Assert(((PageHeader) page)->pd_special >= SizeOfPageHeaderData); +} + +/* + * PageGetSpecialPointer + * Returns pointer to special space on a page. + */ +static inline char * +PageGetSpecialPointer(Page page) +{ + PageValidateSpecialPointer(page); + return (char *) page + ((PageHeader) page)->pd_special; +} + +/* + * PageGetItem + * Retrieves an item on the given page. + * + * Note: + * This does not change the status of any of the resources passed. + * The semantics may change in the future. + */ +static inline Item +PageGetItem(Page page, ItemId itemId) +{ + Assert(page); + Assert(ItemIdHasStorage(itemId)); + + return (Item) (((char *) page) + ItemIdGetOffset(itemId)); +} + +/* + * PageGetMaxOffsetNumber + * Returns the maximum offset number used by the given page. + * Since offset numbers are 1-based, this is also the number + * of items on the page. + * + * NOTE: if the page is not initialized (pd_lower == 0), we must + * return zero to ensure sane behavior. + */ +static inline OffsetNumber +PageGetMaxOffsetNumber(Page page) +{ + PageHeader pageheader = (PageHeader) page; + + if (pageheader->pd_lower <= SizeOfPageHeaderData) + return 0; + else + return (pageheader->pd_lower - SizeOfPageHeaderData) / sizeof(ItemIdData); +} + +/* + * Additional functions for access to page headers. + */ +static inline XLogRecPtr +PageGetLSN(Page page) +{ + return PageXLogRecPtrGet(((PageHeader) page)->pd_lsn); +} +static inline void +PageSetLSN(Page page, XLogRecPtr lsn) +{ + PageXLogRecPtrSet(((PageHeader) page)->pd_lsn, lsn); +} + +static inline bool +PageHasFreeLinePointers(Page page) +{ + return ((PageHeader) page)->pd_flags & PD_HAS_FREE_LINES; +} +static inline void +PageSetHasFreeLinePointers(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_HAS_FREE_LINES; +} +static inline void +PageClearHasFreeLinePointers(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_HAS_FREE_LINES; +} + +static inline bool +PageIsFull(Page page) +{ + return ((PageHeader) page)->pd_flags & PD_PAGE_FULL; +} +static inline void +PageSetFull(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_PAGE_FULL; +} +static inline void +PageClearFull(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_PAGE_FULL; +} + +static inline bool +PageIsAllVisible(Page page) +{ + return ((PageHeader) page)->pd_flags & PD_ALL_VISIBLE; +} +static inline void +PageSetAllVisible(Page page) +{ + ((PageHeader) page)->pd_flags |= PD_ALL_VISIBLE; +} +static inline void +PageClearAllVisible(Page page) +{ + ((PageHeader) page)->pd_flags &= ~PD_ALL_VISIBLE; +} + +/* + * These two require "access/transam.h", so left as macros. + */ +#define PageSetPrunable(page, xid) \ +do { \ + Assert(TransactionIdIsNormal(xid)); \ + if (!TransactionIdIsValid(((PageHeader) (page))->pd_prune_xid) || \ + TransactionIdPrecedes(xid, ((PageHeader) (page))->pd_prune_xid)) \ + ((PageHeader) (page))->pd_prune_xid = (xid); \ +} while (0) +#define PageClearPrunable(page) \ + (((PageHeader) (page))->pd_prune_xid = InvalidTransactionId) + + +/* ---------------------------------------------------------------- + * extern declarations + * ---------------------------------------------------------------- + */ + +/* flags for PageAddItemExtended() */ +#define PAI_OVERWRITE (1 << 0) +#define PAI_IS_HEAP (1 << 1) + +/* flags for PageIsVerifiedExtended() */ +#define PIV_LOG_WARNING (1 << 0) +#define PIV_REPORT_STAT (1 << 1) + +#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \ + PageAddItemExtended(page, item, size, offsetNumber, \ + ((overwrite) ? PAI_OVERWRITE : 0) | \ + ((is_heap) ? PAI_IS_HEAP : 0)) + +#define PageIsVerified(page, blkno) \ + PageIsVerifiedExtended(page, blkno, \ + PIV_LOG_WARNING | PIV_REPORT_STAT) + +/* + * Check that BLCKSZ is a multiple of sizeof(size_t). In + * PageIsVerifiedExtended(), it is much faster to check if a page is + * full of zeroes using the native word size. Note that this assertion + * is kept within a header to make sure that StaticAssertDecl() works + * across various combinations of platforms and compilers. + */ +StaticAssertDecl(BLCKSZ == ((BLCKSZ / sizeof(size_t)) * sizeof(size_t)), + "BLCKSZ has to be a multiple of sizeof(size_t)"); + +extern void PageInit(Page page, Size pageSize, Size specialSize); +extern bool PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags); +extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size, + OffsetNumber offsetNumber, int flags); +extern Page PageGetTempPage(Page page); +extern Page PageGetTempPageCopy(Page page); +extern Page PageGetTempPageCopySpecial(Page page); +extern void PageRestoreTempPage(Page tempPage, Page oldPage); +extern void PageRepairFragmentation(Page page); +extern void PageTruncateLinePointerArray(Page page); +extern Size PageGetFreeSpace(Page page); +extern Size PageGetFreeSpaceForMultipleTuples(Page page, int ntups); +extern Size PageGetExactFreeSpace(Page page); +extern Size PageGetHeapFreeSpace(Page page); +extern void PageIndexTupleDelete(Page page, OffsetNumber offnum); +extern void PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems); +extern void PageIndexTupleDeleteNoCompact(Page page, OffsetNumber offnum); +extern bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum, + Item newtup, Size newsize); +extern char *PageSetChecksumCopy(Page page, BlockNumber blkno); +extern void PageSetChecksumInplace(Page page, BlockNumber blkno); + +#endif /* BUFPAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/bulk_write.h b/platform/dbops/binaries/postgres/include/server/storage/bulk_write.h new file mode 100644 index 0000000000000000000000000000000000000000..cf6f6fcb3f2868686149c8ba2b88c3f75d758fde --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/bulk_write.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * bulk_write.h + * Efficiently and reliably populate a new relation + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/bulk_write.h + * + *------------------------------------------------------------------------- + */ +#ifndef BULK_WRITE_H +#define BULK_WRITE_H + +#include "storage/smgr.h" +#include "utils/rel.h" + +/* Bulk writer state, contents are private to bulk_write.c */ +typedef struct BulkWriteState BulkWriteState; + +/* + * Temporary buffer to hold a page to until it's written out. Use + * smgr_bulk_get_buf() to reserve one of these. This is a separate typedef to + * distinguish it from other block-sized buffers passed around in the system. + */ +typedef PGIOAlignedBlock *BulkWriteBuffer; + +/* forward declared from smgr.h */ +struct SMgrRelationData; + +extern BulkWriteState *smgr_bulk_start_rel(Relation rel, ForkNumber forknum); +extern BulkWriteState *smgr_bulk_start_smgr(struct SMgrRelationData *smgr, ForkNumber forknum, bool use_wal); + +extern BulkWriteBuffer smgr_bulk_get_buf(BulkWriteState *bulkstate); +extern void smgr_bulk_write(BulkWriteState *bulkstate, BlockNumber blocknum, BulkWriteBuffer buf, bool page_std); + +extern void smgr_bulk_finish(BulkWriteState *bulkstate); + +#endif /* BULK_WRITE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/checksum.h b/platform/dbops/binaries/postgres/include/server/storage/checksum.h new file mode 100644 index 0000000000000000000000000000000000000000..08e9d598ce61c4d77c02509e75cacd3300142bf5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/checksum.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * checksum.h + * Checksum implementation for data pages. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/checksum.h + * + *------------------------------------------------------------------------- + */ +#ifndef CHECKSUM_H +#define CHECKSUM_H + +#include "storage/block.h" + +/* + * Compute the checksum for a Postgres page. The page must be aligned on a + * 4-byte boundary. + */ +extern uint16 pg_checksum_page(char *page, BlockNumber blkno); + +#endif /* CHECKSUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/checksum_impl.h b/platform/dbops/binaries/postgres/include/server/storage/checksum_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..7f20de373b4ea14a4f5efd7240e4407932086e39 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/checksum_impl.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------------------- + * + * checksum_impl.h + * Checksum implementation for data pages. + * + * This file exists for the benefit of external programs that may wish to + * check Postgres page checksums. They can #include this to get the code + * referenced by storage/checksum.h. (Note: you may need to redefine + * Assert() as empty to compile this successfully externally.) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/checksum_impl.h + * + *------------------------------------------------------------------------- + */ + +/* + * The algorithm used to checksum pages is chosen for very fast calculation. + * Workloads where the database working set fits into OS file cache but not + * into shared buffers can read in pages at a very fast pace and the checksum + * algorithm itself can become the largest bottleneck. + * + * The checksum algorithm itself is based on the FNV-1a hash (FNV is shorthand + * for Fowler/Noll/Vo). The primitive of a plain FNV-1a hash folds in data 1 + * byte at a time according to the formula: + * + * hash = (hash ^ value) * FNV_PRIME + * + * FNV-1a algorithm is described at http://www.isthe.com/chongo/tech/comp/fnv/ + * + * PostgreSQL doesn't use FNV-1a hash directly because it has bad mixing of + * high bits - high order bits in input data only affect high order bits in + * output data. To resolve this we xor in the value prior to multiplication + * shifted right by 17 bits. The number 17 was chosen because it doesn't + * have common denominator with set bit positions in FNV_PRIME and empirically + * provides the fastest mixing for high order bits of final iterations quickly + * avalanche into lower positions. For performance reasons we choose to combine + * 4 bytes at a time. The actual hash formula used as the basis is: + * + * hash = (hash ^ value) * FNV_PRIME ^ ((hash ^ value) >> 17) + * + * The main bottleneck in this calculation is the multiplication latency. To + * hide the latency and to make use of SIMD parallelism multiple hash values + * are calculated in parallel. The page is treated as a 32 column two + * dimensional array of 32 bit values. Each column is aggregated separately + * into a partial checksum. Each partial checksum uses a different initial + * value (offset basis in FNV terminology). The initial values actually used + * were chosen randomly, as the values themselves don't matter as much as that + * they are different and don't match anything in real data. After initializing + * partial checksums each value in the column is aggregated according to the + * above formula. Finally two more iterations of the formula are performed with + * value 0 to mix the bits of the last value added. + * + * The partial checksums are then folded together using xor to form a single + * 32-bit checksum. The caller can safely reduce the value to 16 bits + * using modulo 2^16-1. That will cause a very slight bias towards lower + * values but this is not significant for the performance of the + * checksum. + * + * The algorithm choice was based on what instructions are available in SIMD + * instruction sets. This meant that a fast and good algorithm needed to use + * multiplication as the main mixing operator. The simplest multiplication + * based checksum primitive is the one used by FNV. The prime used is chosen + * for good dispersion of values. It has no known simple patterns that result + * in collisions. Test of 5-bit differentials of the primitive over 64bit keys + * reveals no differentials with 3 or more values out of 100000 random keys + * colliding. Avalanche test shows that only high order bits of the last word + * have a bias. Tests of 1-4 uncorrelated bit errors, stray 0 and 0xFF bytes, + * overwriting page from random position to end with 0 bytes, and overwriting + * random segments of page with 0x00, 0xFF and random data all show optimal + * 2e-16 false positive rate within margin of error. + * + * Vectorization of the algorithm requires 32bit x 32bit -> 32bit integer + * multiplication instruction. As of 2013 the corresponding instruction is + * available on x86 SSE4.1 extensions (pmulld) and ARM NEON (vmul.i32). + * Vectorization requires a compiler to do the vectorization for us. For recent + * GCC versions the flags -msse4.1 -funroll-loops -ftree-vectorize are enough + * to achieve vectorization. + * + * The optimal amount of parallelism to use depends on CPU specific instruction + * latency, SIMD instruction width, throughput and the amount of registers + * available to hold intermediate state. Generally, more parallelism is better + * up to the point that state doesn't fit in registers and extra load-store + * instructions are needed to swap values in/out. The number chosen is a fixed + * part of the algorithm because changing the parallelism changes the checksum + * result. + * + * The parallelism number 32 was chosen based on the fact that it is the + * largest state that fits into architecturally visible x86 SSE registers while + * leaving some free registers for intermediate values. For future processors + * with 256bit vector registers this will leave some performance on the table. + * When vectorization is not available it might be beneficial to restructure + * the computation to calculate a subset of the columns at a time and perform + * multiple passes to avoid register spilling. This optimization opportunity + * is not used. Current coding also assumes that the compiler has the ability + * to unroll the inner loop to avoid loop overhead and minimize register + * spilling. For less sophisticated compilers it might be beneficial to + * manually unroll the inner loop. + */ + +#include "storage/bufpage.h" + +/* number of checksums to calculate in parallel */ +#define N_SUMS 32 +/* prime multiplier of FNV-1a hash */ +#define FNV_PRIME 16777619 + +/* Use a union so that this code is valid under strict aliasing */ +typedef union +{ + PageHeaderData phdr; + uint32 data[BLCKSZ / (sizeof(uint32) * N_SUMS)][N_SUMS]; +} PGChecksummablePage; + +/* + * Base offsets to initialize each of the parallel FNV hashes into a + * different initial state. + */ +static const uint32 checksumBaseOffsets[N_SUMS] = { + 0x5B1F36E9, 0xB8525960, 0x02AB50AA, 0x1DE66D2A, + 0x79FF467A, 0x9BB9F8A3, 0x217E7CD2, 0x83E13D2C, + 0xF8D4474F, 0xE39EB970, 0x42C6AE16, 0x993216FA, + 0x7B093B5D, 0x98DAFF3C, 0xF718902A, 0x0B1C9CDB, + 0xE58F764B, 0x187636BC, 0x5D7B3BB1, 0xE73DE7DE, + 0x92BEC979, 0xCCA6C0B2, 0x304A0979, 0x85AA43D4, + 0x783125BB, 0x6CA8EAA2, 0xE407EAC6, 0x4B5CFC3E, + 0x9FBF8C76, 0x15CA20BE, 0xF2CA9FD3, 0x959BD756 +}; + +/* + * Calculate one round of the checksum. + */ +#define CHECKSUM_COMP(checksum, value) \ +do { \ + uint32 __tmp = (checksum) ^ (value); \ + (checksum) = __tmp * FNV_PRIME ^ (__tmp >> 17); \ +} while (0) + +/* + * Block checksum algorithm. The page must be adequately aligned + * (at least on 4-byte boundary). + */ +static uint32 +pg_checksum_block(const PGChecksummablePage *page) +{ + uint32 sums[N_SUMS]; + uint32 result = 0; + uint32 i, + j; + + /* ensure that the size is compatible with the algorithm */ + Assert(sizeof(PGChecksummablePage) == BLCKSZ); + + /* initialize partial checksums to their corresponding offsets */ + memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets)); + + /* main checksum calculation */ + for (i = 0; i < (uint32) (BLCKSZ / (sizeof(uint32) * N_SUMS)); i++) + for (j = 0; j < N_SUMS; j++) + CHECKSUM_COMP(sums[j], page->data[i][j]); + + /* finally add in two rounds of zeroes for additional mixing */ + for (i = 0; i < 2; i++) + for (j = 0; j < N_SUMS; j++) + CHECKSUM_COMP(sums[j], 0); + + /* xor fold partial checksums together */ + for (i = 0; i < N_SUMS; i++) + result ^= sums[i]; + + return result; +} + +/* + * Compute the checksum for a Postgres page. + * + * The page must be adequately aligned (at least on a 4-byte boundary). + * Beware also that the checksum field of the page is transiently zeroed. + * + * The checksum includes the block number (to detect the case where a page is + * somehow moved to a different location), the page header (excluding the + * checksum itself), and the page data. + */ +uint16 +pg_checksum_page(char *page, BlockNumber blkno) +{ + PGChecksummablePage *cpage = (PGChecksummablePage *) page; + uint16 save_checksum; + uint32 checksum; + + /* We only calculate the checksum for properly-initialized pages */ + Assert(!PageIsNew((Page) page)); + + /* + * Save pd_checksum and temporarily set it to zero, so that the checksum + * calculation isn't affected by the old checksum stored on the page. + * Restore it after, because actually updating the checksum is NOT part of + * the API of this function. + */ + save_checksum = cpage->phdr.pd_checksum; + cpage->phdr.pd_checksum = 0; + checksum = pg_checksum_block(cpage); + cpage->phdr.pd_checksum = save_checksum; + + /* Mix in the block number to detect transposed pages */ + checksum ^= blkno; + + /* + * Reduce to a uint16 (to fit in the pd_checksum field) with an offset of + * one. That avoids checksums of zero, which seems like a good idea. + */ + return (uint16) ((checksum % 65535) + 1); +} diff --git a/platform/dbops/binaries/postgres/include/server/storage/condition_variable.h b/platform/dbops/binaries/postgres/include/server/storage/condition_variable.h new file mode 100644 index 0000000000000000000000000000000000000000..d4720d4bb525d912d6942dbf5ba6e15ec1626c0a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/condition_variable.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * condition_variable.h + * Condition variables + * + * A condition variable is a method of waiting until a certain condition + * becomes true. Conventionally, a condition variable supports three + * operations: (1) sleep; (2) signal, which wakes up one process sleeping + * on the condition variable; and (3) broadcast, which wakes up every + * process sleeping on the condition variable. In our implementation, + * condition variables put a process into an interruptible sleep (so it + * can be canceled prior to the fulfillment of the condition) and do not + * use pointers internally (so that they are safe to use within DSMs). + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/condition_variable.h + * + *------------------------------------------------------------------------- + */ +#ifndef CONDITION_VARIABLE_H +#define CONDITION_VARIABLE_H + +#include "storage/proclist_types.h" +#include "storage/spin.h" + +typedef struct +{ + slock_t mutex; /* spinlock protecting the wakeup list */ + proclist_head wakeup; /* list of wake-able processes */ +} ConditionVariable; + +/* + * Pad a condition variable to a power-of-two size so that an array of + * condition variables does not cross a cache line boundary. + */ +#define CV_MINIMAL_SIZE (sizeof(ConditionVariable) <= 16 ? 16 : 32) +typedef union ConditionVariableMinimallyPadded +{ + ConditionVariable cv; + char pad[CV_MINIMAL_SIZE]; +} ConditionVariableMinimallyPadded; + +/* Initialize a condition variable. */ +extern void ConditionVariableInit(ConditionVariable *cv); + +/* + * To sleep on a condition variable, a process should use a loop which first + * checks the condition, exiting the loop if it is met, and then calls + * ConditionVariableSleep. Spurious wakeups are possible, but should be + * infrequent. After exiting the loop, ConditionVariableCancelSleep must + * be called to ensure that the process is no longer in the wait list for + * the condition variable. + */ +extern void ConditionVariableSleep(ConditionVariable *cv, uint32 wait_event_info); +extern bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, + uint32 wait_event_info); +extern bool ConditionVariableCancelSleep(void); + +/* + * Optionally, ConditionVariablePrepareToSleep can be called before entering + * the test-and-sleep loop described above. Doing so is more efficient if + * at least one sleep is needed, whereas not doing so is more efficient when + * no sleep is needed because the test condition is true the first time. + */ +extern void ConditionVariablePrepareToSleep(ConditionVariable *cv); + +/* Wake up a single waiter (via signal) or all waiters (via broadcast). */ +extern void ConditionVariableSignal(ConditionVariable *cv); +extern void ConditionVariableBroadcast(ConditionVariable *cv); + +#endif /* CONDITION_VARIABLE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/copydir.h b/platform/dbops/binaries/postgres/include/server/storage/copydir.h new file mode 100644 index 0000000000000000000000000000000000000000..a25e258f4797e46891ed8ce0fc559e09c6542140 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/copydir.h @@ -0,0 +1,19 @@ +/*------------------------------------------------------------------------- + * + * copydir.h + * Copy a directory. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/copydir.h + * + *------------------------------------------------------------------------- + */ +#ifndef COPYDIR_H +#define COPYDIR_H + +extern void copydir(const char *fromdir, const char *todir, bool recurse); +extern void copy_file(const char *fromfile, const char *tofile); + +#endif /* COPYDIR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/dsm.h b/platform/dbops/binaries/postgres/include/server/storage/dsm.h new file mode 100644 index 0000000000000000000000000000000000000000..1a22b32df1a4d3851bf5c8ae552149d5d121a893 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/dsm.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * dsm.h + * manage dynamic shared memory segments + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_H +#define DSM_H + +#include "storage/dsm_impl.h" + +typedef struct dsm_segment dsm_segment; + +#define DSM_CREATE_NULL_IF_MAXSEGMENTS 0x0001 + +/* Startup and shutdown functions. */ +struct PGShmemHeader; /* avoid including pg_shmem.h */ +extern void dsm_cleanup_using_control_segment(dsm_handle old_control_handle); +extern void dsm_postmaster_startup(struct PGShmemHeader *); +extern void dsm_backend_shutdown(void); +extern void dsm_detach_all(void); + +extern size_t dsm_estimate_size(void); +extern void dsm_shmem_init(void); + +#ifdef EXEC_BACKEND +extern void dsm_set_control_handle(dsm_handle h); +#endif + +/* Functions that create or remove mappings. */ +extern dsm_segment *dsm_create(Size size, int flags); +extern dsm_segment *dsm_attach(dsm_handle h); +extern void dsm_detach(dsm_segment *seg); + +/* Resource management functions. */ +extern void dsm_pin_mapping(dsm_segment *seg); +extern void dsm_unpin_mapping(dsm_segment *seg); +extern void dsm_pin_segment(dsm_segment *seg); +extern void dsm_unpin_segment(dsm_handle handle); +extern dsm_segment *dsm_find_mapping(dsm_handle handle); + +/* Informational functions. */ +extern void *dsm_segment_address(dsm_segment *seg); +extern Size dsm_segment_map_length(dsm_segment *seg); +extern dsm_handle dsm_segment_handle(dsm_segment *seg); + +/* Cleanup hooks. */ +typedef void (*on_dsm_detach_callback) (dsm_segment *, Datum arg); +extern void on_dsm_detach(dsm_segment *seg, + on_dsm_detach_callback function, Datum arg); +extern void cancel_on_dsm_detach(dsm_segment *seg, + on_dsm_detach_callback function, Datum arg); +extern void reset_on_dsm_detach(void); + +#endif /* DSM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/dsm_impl.h b/platform/dbops/binaries/postgres/include/server/storage/dsm_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..882269603daf7ad0e881de1b87ea7d742a967829 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/dsm_impl.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------------------- + * + * dsm_impl.h + * low-level dynamic shared memory primitives + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm_impl.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_IMPL_H +#define DSM_IMPL_H + +/* Dynamic shared memory implementations. */ +#define DSM_IMPL_POSIX 1 +#define DSM_IMPL_SYSV 2 +#define DSM_IMPL_WINDOWS 3 +#define DSM_IMPL_MMAP 4 + +/* + * Determine which dynamic shared memory implementations will be supported + * on this platform, and which one will be the default. + */ +#ifdef WIN32 +#define USE_DSM_WINDOWS +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_WINDOWS +#else +#ifdef HAVE_SHM_OPEN +#define USE_DSM_POSIX +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_POSIX +#endif +#define USE_DSM_SYSV +#ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV +#endif +#define USE_DSM_MMAP +#endif + +/* GUC. */ +extern PGDLLIMPORT int dynamic_shared_memory_type; +extern PGDLLIMPORT int min_dynamic_shared_memory; + +/* + * Directory for on-disk state. + * + * This is used by all implementations for crash recovery and by the mmap + * implementation for storage. + */ +#define PG_DYNSHMEM_DIR "pg_dynshmem" +#define PG_DYNSHMEM_MMAP_FILE_PREFIX "mmap." + +/* A "name" for a dynamic shared memory segment. */ +typedef uint32 dsm_handle; + +/* Sentinel value to use for invalid DSM handles. */ +#define DSM_HANDLE_INVALID ((dsm_handle) 0) + +/* All the shared-memory operations we know about. */ +typedef enum +{ + DSM_OP_CREATE, + DSM_OP_ATTACH, + DSM_OP_DETACH, + DSM_OP_DESTROY, +} dsm_op; + +/* Create, attach to, detach from, resize, or destroy a segment. */ +extern bool dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size, + void **impl_private, void **mapped_address, Size *mapped_size, + int elevel); + +/* Implementation-dependent actions required to keep segment until shutdown. */ +extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private, + void **impl_private_pm_handle); +extern void dsm_impl_unpin_segment(dsm_handle handle, void **impl_private); + +#endif /* DSM_IMPL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/dsm_registry.h b/platform/dbops/binaries/postgres/include/server/storage/dsm_registry.h new file mode 100644 index 0000000000000000000000000000000000000000..5fa79731d28014acb75a4a41d29767376ddaf002 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/dsm_registry.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * dsm_registry.h + * Functions for interfacing with the dynamic shared memory registry. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/dsm_registry.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSM_REGISTRY_H +#define DSM_REGISTRY_H + +extern void *GetNamedDSMSegment(const char *name, size_t size, + void (*init_callback) (void *ptr), + bool *found); + +extern Size DSMRegistryShmemSize(void); +extern void DSMRegistryShmemInit(void); + +#endif /* DSM_REGISTRY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/fd.h b/platform/dbops/binaries/postgres/include/server/storage/fd.h new file mode 100644 index 0000000000000000000000000000000000000000..1456ab383a4240e41bc8c70dda539bde39083403 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/fd.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------- + * + * fd.h + * Virtual file descriptor definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fd.h + * + *------------------------------------------------------------------------- + */ + +/* + * calls: + * + * File {Close, Read, ReadV, Write, WriteV, Size, Sync} + * {Path Name Open, Allocate, Free} File + * + * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES. + * Use them for all file activity... + * + * File fd; + * fd = PathNameOpenFile("foo", O_RDONLY); + * + * AllocateFile(); + * FreeFile(); + * + * Use AllocateFile, not fopen, if you need a stdio file (FILE*); then + * use FreeFile, not fclose, to close it. AVOID using stdio for files + * that you intend to hold open for any length of time, since there is + * no way for them to share kernel file descriptors with other files. + * + * Likewise, use AllocateDir/FreeDir, not opendir/closedir, to allocate + * open directories (DIR*), and OpenTransientFile/CloseTransientFile for an + * unbuffered file descriptor. + * + * If you really can't use any of the above, at least call AcquireExternalFD + * or ReserveExternalFD to report any file descriptors that are held for any + * length of time. Failure to do so risks unnecessary EMFILE errors. + */ +#ifndef FD_H +#define FD_H + +#include "port/pg_iovec.h" + +#include +#include + +typedef int File; + + +#define IO_DIRECT_DATA 0x01 +#define IO_DIRECT_WAL 0x02 +#define IO_DIRECT_WAL_INIT 0x04 + + +/* GUC parameter */ +extern PGDLLIMPORT int max_files_per_process; +extern PGDLLIMPORT bool data_sync_retry; +extern PGDLLIMPORT int recovery_init_sync_method; +extern PGDLLIMPORT int io_direct_flags; + +/* + * This is private to fd.c, but exported for save/restore_backend_variables() + */ +extern PGDLLIMPORT int max_safe_fds; + +/* + * On Windows, we have to interpret EACCES as possibly meaning the same as + * ENOENT, because if a file is unlinked-but-not-yet-gone on that platform, + * that's what you get. Ugh. This code is designed so that we don't + * actually believe these cases are okay without further evidence (namely, + * a pending fsync request getting canceled ... see ProcessSyncRequests). + */ +#ifndef WIN32 +#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT) +#else +#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT || (err) == EACCES) +#endif + +/* + * O_DIRECT is not standard, but almost every Unix has it. We translate it + * to the appropriate Windows flag in src/port/open.c. We simulate it with + * fcntl(F_NOCACHE) on macOS inside fd.c's open() wrapper. We use the name + * PG_O_DIRECT rather than defining O_DIRECT in that case (probably not a good + * idea on a Unix). We can only use it if the compiler will correctly align + * PGIOAlignedBlock for us, though. + */ +#if defined(O_DIRECT) && defined(pg_attribute_aligned) +#define PG_O_DIRECT O_DIRECT +#elif defined(F_NOCACHE) +#define PG_O_DIRECT 0x80000000 +#define PG_O_DIRECT_USE_F_NOCACHE +#else +#define PG_O_DIRECT 0 +#endif + +/* + * prototypes for functions in fd.c + */ + +/* Operations on virtual Files --- equivalent to Unix kernel file ops */ +extern File PathNameOpenFile(const char *fileName, int fileFlags); +extern File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); +extern File OpenTemporaryFile(bool interXact); +extern void FileClose(File file); +extern int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info); +extern ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info); +extern ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info); +extern int FileSync(File file, uint32 wait_event_info); +extern int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info); +extern int FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info); + +extern off_t FileSize(File file); +extern int FileTruncate(File file, off_t offset, uint32 wait_event_info); +extern void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info); +extern char *FilePathName(File file); +extern int FileGetRawDesc(File file); +extern int FileGetRawFlags(File file); +extern mode_t FileGetRawMode(File file); + +/* Operations used for sharing named temporary files */ +extern File PathNameCreateTemporaryFile(const char *path, bool error_on_failure); +extern File PathNameOpenTemporaryFile(const char *path, int mode); +extern bool PathNameDeleteTemporaryFile(const char *path, bool error_on_failure); +extern void PathNameCreateTemporaryDir(const char *basedir, const char *directory); +extern void PathNameDeleteTemporaryDir(const char *dirname); +extern void TempTablespacePath(char *path, Oid tablespace); + +/* Operations that allow use of regular stdio --- USE WITH CAUTION */ +extern FILE *AllocateFile(const char *name, const char *mode); +extern int FreeFile(FILE *file); + +/* Operations that allow use of pipe streams (popen/pclose) */ +extern FILE *OpenPipeStream(const char *command, const char *mode); +extern int ClosePipeStream(FILE *file); + +/* Operations to allow use of the library routines */ +extern DIR *AllocateDir(const char *dirname); +extern struct dirent *ReadDir(DIR *dir, const char *dirname); +extern struct dirent *ReadDirExtended(DIR *dir, const char *dirname, + int elevel); +extern int FreeDir(DIR *dir); + +/* Operations to allow use of a plain kernel FD, with automatic cleanup */ +extern int OpenTransientFile(const char *fileName, int fileFlags); +extern int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode); +extern int CloseTransientFile(int fd); + +/* If you've really really gotta have a plain kernel FD, use this */ +extern int BasicOpenFile(const char *fileName, int fileFlags); +extern int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); + +/* Use these for other cases, and also for long-lived BasicOpenFile FDs */ +extern bool AcquireExternalFD(void); +extern void ReserveExternalFD(void); +extern void ReleaseExternalFD(void); + +/* Make a directory with default permissions */ +extern int MakePGDirectory(const char *directoryName); + +/* Miscellaneous support routines */ +extern void InitFileAccess(void); +extern void InitTemporaryFileAccess(void); +extern void set_max_safe_fds(void); +extern void closeAllVfds(void); +extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces); +extern bool TempTablespacesAreSet(void); +extern int GetTempTablespaces(Oid *tableSpaces, int numSpaces); +extern Oid GetNextTempTableSpace(void); +extern void AtEOXact_Files(bool isCommit); +extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); +extern void RemovePgTempFiles(void); +extern void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, + bool unlink_all); +extern bool looks_like_temp_rel_name(const char *name); + +extern int pg_fsync(int fd); +extern int pg_fsync_no_writethrough(int fd); +extern int pg_fsync_writethrough(int fd); +extern int pg_fdatasync(int fd); +extern bool pg_file_exists(const char *name); +extern void pg_flush_data(int fd, off_t offset, off_t nbytes); +extern int pg_truncate(const char *path, off_t length); +extern void fsync_fname(const char *fname, bool isdir); +extern int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel); +extern int durable_rename(const char *oldfile, const char *newfile, int elevel); +extern int durable_unlink(const char *fname, int elevel); +extern void SyncDataDirectory(void); +extern int data_sync_elevel(int elevel); + +static inline ssize_t +FileRead(File file, void *buffer, size_t amount, off_t offset, + uint32 wait_event_info) +{ + struct iovec iov = { + .iov_base = buffer, + .iov_len = amount + }; + + return FileReadV(file, &iov, 1, offset, wait_event_info); +} + +static inline ssize_t +FileWrite(File file, const void *buffer, size_t amount, off_t offset, + uint32 wait_event_info) +{ + struct iovec iov = { + .iov_base = unconstify(void *, buffer), + .iov_len = amount + }; + + return FileWriteV(file, &iov, 1, offset, wait_event_info); +} + +#endif /* FD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/fileset.h b/platform/dbops/binaries/postgres/include/server/storage/fileset.h new file mode 100644 index 0000000000000000000000000000000000000000..1674f086d4ff6ac90f4eda9504e8f54846e355bf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/fileset.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * fileset.h + * Management of named temporary files. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fileset.h + * + *------------------------------------------------------------------------- + */ + +#ifndef FILESET_H +#define FILESET_H + +#include "storage/fd.h" + +/* + * A set of temporary files. + */ +typedef struct FileSet +{ + pid_t creator_pid; /* PID of the creating process */ + uint32 number; /* per-PID identifier */ + int ntablespaces; /* number of tablespaces to use */ + Oid tablespaces[8]; /* OIDs of tablespaces to use. Assumes that + * it's rare that there more than temp + * tablespaces. */ +} FileSet; + +extern void FileSetInit(FileSet *fileset); +extern File FileSetCreate(FileSet *fileset, const char *name); +extern File FileSetOpen(FileSet *fileset, const char *name, + int mode); +extern bool FileSetDelete(FileSet *fileset, const char *name, + bool error_on_failure); +extern void FileSetDeleteAll(FileSet *fileset); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/storage/freespace.h b/platform/dbops/binaries/postgres/include/server/storage/freespace.h new file mode 100644 index 0000000000000000000000000000000000000000..d64a634be35c6cff8dc25479e55a5bcce03a4959 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/freespace.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * freespace.h + * POSTGRES free space map for quickly finding free space in relations + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/freespace.h + * + *------------------------------------------------------------------------- + */ +#ifndef FREESPACE_H_ +#define FREESPACE_H_ + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +/* prototypes for public functions in freespace.c */ +extern Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk); +extern BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded); +extern BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, + BlockNumber oldPage, + Size oldSpaceAvail, + Size spaceNeeded); +extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, + Size spaceAvail); +extern void XLogRecordPageWithFreeSpace(RelFileLocator rlocator, BlockNumber heapBlk, + Size spaceAvail); + +extern BlockNumber FreeSpaceMapPrepareTruncateRel(Relation rel, + BlockNumber nblocks); +extern void FreeSpaceMapVacuum(Relation rel); +extern void FreeSpaceMapVacuumRange(Relation rel, BlockNumber start, + BlockNumber end); + +#endif /* FREESPACE_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/fsm_internals.h b/platform/dbops/binaries/postgres/include/server/storage/fsm_internals.h new file mode 100644 index 0000000000000000000000000000000000000000..a922e691fe067b936a6e3d74d67f267245c14a0b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/fsm_internals.h @@ -0,0 +1,72 @@ +/*------------------------------------------------------------------------- + * + * fsm_internals.h + * internal functions for free space map + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/fsm_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef FSM_INTERNALS_H +#define FSM_INTERNALS_H + +#include "storage/buf.h" +#include "storage/bufpage.h" + +/* + * Structure of a FSM page. See src/backend/storage/freespace/README for + * details. + */ +typedef struct +{ + /* + * fsm_search_avail() tries to spread the load of multiple backends by + * returning different pages to different backends in a round-robin + * fashion. fp_next_slot points to the next slot to be returned (assuming + * there's enough space on it for the request). It's defined as an int, + * because it's updated without an exclusive lock. uint16 would be more + * appropriate, but int is more likely to be atomically + * fetchable/storable. + */ + int fp_next_slot; + + /* + * fp_nodes contains the binary tree, stored in array. The first + * NonLeafNodesPerPage elements are upper nodes, and the following + * LeafNodesPerPage elements are leaf nodes. Unused nodes are zero. + */ + uint8 fp_nodes[FLEXIBLE_ARRAY_MEMBER]; +} FSMPageData; + +typedef FSMPageData *FSMPage; + +/* + * Number of non-leaf and leaf nodes, and nodes in total, on an FSM page. + * These definitions are internal to fsmpage.c. + */ +#define NodesPerPage (BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - \ + offsetof(FSMPageData, fp_nodes)) + +#define NonLeafNodesPerPage (BLCKSZ / 2 - 1) +#define LeafNodesPerPage (NodesPerPage - NonLeafNodesPerPage) + +/* + * Number of FSM "slots" on a FSM page. This is what should be used + * outside fsmpage.c. + */ +#define SlotsPerFSMPage LeafNodesPerPage + +/* Prototypes for functions in fsmpage.c */ +extern int fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, + bool exclusive_lock_held); +extern uint8 fsm_get_avail(Page page, int slot); +extern uint8 fsm_get_max_avail(Page page); +extern bool fsm_set_avail(Page page, int slot, uint8 value); +extern bool fsm_truncate_avail(Page page, int nslots); +extern bool fsm_rebuild_page(Page page); + +#endif /* FSM_INTERNALS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/indexfsm.h b/platform/dbops/binaries/postgres/include/server/storage/indexfsm.h new file mode 100644 index 0000000000000000000000000000000000000000..ad376b1131933eb03f7d844b27b3ebe1ec610af1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/indexfsm.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * indexfsm.h + * POSTGRES free space map for quickly finding an unused page in index + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/indexfsm.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEXFSM_H_ +#define INDEXFSM_H_ + +#include "storage/block.h" +#include "utils/relcache.h" + +extern BlockNumber GetFreeIndexPage(Relation rel); +extern void RecordFreeIndexPage(Relation rel, BlockNumber freeBlock); +extern void RecordUsedIndexPage(Relation rel, BlockNumber usedBlock); + +extern void IndexFreeSpaceMapVacuum(Relation rel); + +#endif /* INDEXFSM_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/ipc.h b/platform/dbops/binaries/postgres/include/server/storage/ipc.h new file mode 100644 index 0000000000000000000000000000000000000000..b2d062781ecdb1b256bd48444e871df7a4055871 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/ipc.h @@ -0,0 +1,87 @@ +/*------------------------------------------------------------------------- + * + * ipc.h + * POSTGRES inter-process communication definitions. + * + * This file is misnamed, as it no longer has much of anything directly + * to do with IPC. The functionality here is concerned with managing + * exit-time cleanup for either a postmaster or a backend. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/ipc.h + * + *------------------------------------------------------------------------- + */ +#ifndef IPC_H +#define IPC_H + +typedef void (*pg_on_exit_callback) (int code, Datum arg); +typedef void (*shmem_startup_hook_type) (void); + +/*---------- + * API for handling cleanup that must occur during either ereport(ERROR) + * or ereport(FATAL) exits from a block of code. (Typical examples are + * undoing transient changes to shared-memory state.) + * + * PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg); + * { + * ... code that might throw ereport(ERROR) or ereport(FATAL) ... + * } + * PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg); + * + * where the cleanup code is in a function declared per pg_on_exit_callback. + * The Datum value "arg" can carry any information the cleanup function + * needs. + * + * This construct ensures that cleanup_function() will be called during + * either ERROR or FATAL exits. It will not be called on successful + * exit from the controlled code. (If you want it to happen then too, + * call the function yourself from just after the construct.) + * + * Note: the macro arguments are multiply evaluated, so avoid side-effects. + *---------- + */ +#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ + do { \ + before_shmem_exit(cleanup_function, arg); \ + PG_TRY() + +#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ + cancel_before_shmem_exit(cleanup_function, arg); \ + PG_CATCH(); \ + { \ + cancel_before_shmem_exit(cleanup_function, arg); \ + cleanup_function (0, arg); \ + PG_RE_THROW(); \ + } \ + PG_END_TRY(); \ + } while (0) + + +/* ipc.c */ +extern PGDLLIMPORT bool proc_exit_inprogress; +extern PGDLLIMPORT bool shmem_exit_inprogress; + +extern void proc_exit(int code) pg_attribute_noreturn(); +extern void shmem_exit(int code); +extern void on_proc_exit(pg_on_exit_callback function, Datum arg); +extern void on_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void before_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg); +extern void on_exit_reset(void); +extern void check_on_shmem_exit_lists_are_empty(void); + +/* ipci.c */ +extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; + +extern Size CalculateShmemSize(int *num_semaphores); +extern void CreateSharedMemoryAndSemaphores(void); +#ifdef EXEC_BACKEND +extern void AttachSharedMemoryStructs(void); +#endif +extern void InitializeShmemGUCs(void); + +#endif /* IPC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/item.h b/platform/dbops/binaries/postgres/include/server/storage/item.h new file mode 100644 index 0000000000000000000000000000000000000000..d524246fb125b83615b7bad4291a3299f8a93875 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/item.h @@ -0,0 +1,19 @@ +/*------------------------------------------------------------------------- + * + * item.h + * POSTGRES disk item definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/item.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEM_H +#define ITEM_H + +typedef Pointer Item; + +#endif /* ITEM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/itemid.h b/platform/dbops/binaries/postgres/include/server/storage/itemid.h new file mode 100644 index 0000000000000000000000000000000000000000..6d29722ec1fe70906af4e738a081481371bcfa84 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/itemid.h @@ -0,0 +1,184 @@ +/*------------------------------------------------------------------------- + * + * itemid.h + * Standard POSTGRES buffer page item identifier/line pointer definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/itemid.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMID_H +#define ITEMID_H + +/* + * A line pointer on a buffer page. See buffer page definitions and comments + * for an explanation of how line pointers are used. + * + * In some cases a line pointer is "in use" but does not have any associated + * storage on the page. By convention, lp_len == 0 in every line pointer + * that does not have storage, independently of its lp_flags state. + */ +typedef struct ItemIdData +{ + unsigned lp_off:15, /* offset to tuple (from start of page) */ + lp_flags:2, /* state of line pointer, see below */ + lp_len:15; /* byte length of tuple */ +} ItemIdData; + +typedef ItemIdData *ItemId; + +/* + * lp_flags has these possible states. An UNUSED line pointer is available + * for immediate re-use, the other states are not. + */ +#define LP_UNUSED 0 /* unused (should always have lp_len=0) */ +#define LP_NORMAL 1 /* used (should always have lp_len>0) */ +#define LP_REDIRECT 2 /* HOT redirect (should have lp_len=0) */ +#define LP_DEAD 3 /* dead, may or may not have storage */ + +/* + * Item offsets and lengths are represented by these types when + * they're not actually stored in an ItemIdData. + */ +typedef uint16 ItemOffset; +typedef uint16 ItemLength; + + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * ItemIdGetLength + */ +#define ItemIdGetLength(itemId) \ + ((itemId)->lp_len) + +/* + * ItemIdGetOffset + */ +#define ItemIdGetOffset(itemId) \ + ((itemId)->lp_off) + +/* + * ItemIdGetFlags + */ +#define ItemIdGetFlags(itemId) \ + ((itemId)->lp_flags) + +/* + * ItemIdGetRedirect + * In a REDIRECT pointer, lp_off holds offset number for next line pointer + */ +#define ItemIdGetRedirect(itemId) \ + ((itemId)->lp_off) + +/* + * ItemIdIsValid + * True iff item identifier is valid. + * This is a pretty weak test, probably useful only in Asserts. + */ +#define ItemIdIsValid(itemId) PointerIsValid(itemId) + +/* + * ItemIdIsUsed + * True iff item identifier is in use. + */ +#define ItemIdIsUsed(itemId) \ + ((itemId)->lp_flags != LP_UNUSED) + +/* + * ItemIdIsNormal + * True iff item identifier is in state NORMAL. + */ +#define ItemIdIsNormal(itemId) \ + ((itemId)->lp_flags == LP_NORMAL) + +/* + * ItemIdIsRedirected + * True iff item identifier is in state REDIRECT. + */ +#define ItemIdIsRedirected(itemId) \ + ((itemId)->lp_flags == LP_REDIRECT) + +/* + * ItemIdIsDead + * True iff item identifier is in state DEAD. + */ +#define ItemIdIsDead(itemId) \ + ((itemId)->lp_flags == LP_DEAD) + +/* + * ItemIdHasStorage + * True iff item identifier has associated storage. + */ +#define ItemIdHasStorage(itemId) \ + ((itemId)->lp_len != 0) + +/* + * ItemIdSetUnused + * Set the item identifier to be UNUSED, with no storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetUnused(itemId) \ +( \ + (itemId)->lp_flags = LP_UNUSED, \ + (itemId)->lp_off = 0, \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdSetNormal + * Set the item identifier to be NORMAL, with the specified storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetNormal(itemId, off, len) \ +( \ + (itemId)->lp_flags = LP_NORMAL, \ + (itemId)->lp_off = (off), \ + (itemId)->lp_len = (len) \ +) + +/* + * ItemIdSetRedirect + * Set the item identifier to be REDIRECT, with the specified link. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetRedirect(itemId, link) \ +( \ + (itemId)->lp_flags = LP_REDIRECT, \ + (itemId)->lp_off = (link), \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdSetDead + * Set the item identifier to be DEAD, with no storage. + * Beware of multiple evaluations of itemId! + */ +#define ItemIdSetDead(itemId) \ +( \ + (itemId)->lp_flags = LP_DEAD, \ + (itemId)->lp_off = 0, \ + (itemId)->lp_len = 0 \ +) + +/* + * ItemIdMarkDead + * Set the item identifier to be DEAD, keeping its existing storage. + * + * Note: in indexes, this is used as if it were a hint-bit mechanism; + * we trust that multiple processors can do this in parallel and get + * the same result. + */ +#define ItemIdMarkDead(itemId) \ +( \ + (itemId)->lp_flags = LP_DEAD \ +) + +#endif /* ITEMID_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/itemptr.h b/platform/dbops/binaries/postgres/include/server/storage/itemptr.h new file mode 100644 index 0000000000000000000000000000000000000000..cfe21df765067d1c4545fc115cb8f588aece408c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/itemptr.h @@ -0,0 +1,245 @@ +/*------------------------------------------------------------------------- + * + * itemptr.h + * POSTGRES disk item pointer definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/itemptr.h + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMPTR_H +#define ITEMPTR_H + +#include "storage/block.h" +#include "storage/off.h" + +/* + * ItemPointer: + * + * This is a pointer to an item within a disk page of a known file + * (for example, a cross-link from an index to its parent table). + * ip_blkid tells us which block, ip_posid tells us which entry in + * the linp (ItemIdData) array we want. + * + * Note: because there is an item pointer in each tuple header and index + * tuple header on disk, it's very important not to waste space with + * structure padding bytes. The struct is designed to be six bytes long + * (it contains three int16 fields) but a few compilers will pad it to + * eight bytes unless coerced. We apply appropriate persuasion where + * possible. If your compiler can't be made to play along, you'll waste + * lots of space. + */ +typedef struct ItemPointerData +{ + BlockIdData ip_blkid; + OffsetNumber ip_posid; +} + +/* If compiler understands packed and aligned pragmas, use those */ +#if defined(pg_attribute_packed) && defined(pg_attribute_aligned) + pg_attribute_packed() + pg_attribute_aligned(2) +#endif +ItemPointerData; + +typedef ItemPointerData *ItemPointer; + +/* ---------------- + * special values used in heap tuples (t_ctid) + * ---------------- + */ + +/* + * If a heap tuple holds a speculative insertion token rather than a real + * TID, ip_posid is set to SpecTokenOffsetNumber, and the token is stored in + * ip_blkid. SpecTokenOffsetNumber must be higher than MaxOffsetNumber, so + * that it can be distinguished from a valid offset number in a regular item + * pointer. + */ +#define SpecTokenOffsetNumber 0xfffe + +/* + * When a tuple is moved to a different partition by UPDATE, the t_ctid of + * the old tuple version is set to this magic value. + */ +#define MovedPartitionsOffsetNumber 0xfffd +#define MovedPartitionsBlockNumber InvalidBlockNumber + + +/* ---------------- + * support functions + * ---------------- + */ + +/* + * ItemPointerIsValid + * True iff the disk item pointer is not NULL. + */ +static inline bool +ItemPointerIsValid(const ItemPointerData *pointer) +{ + return PointerIsValid(pointer) && pointer->ip_posid != 0; +} + +/* + * ItemPointerGetBlockNumberNoCheck + * Returns the block number of a disk item pointer. + */ +static inline BlockNumber +ItemPointerGetBlockNumberNoCheck(const ItemPointerData *pointer) +{ + return BlockIdGetBlockNumber(&pointer->ip_blkid); +} + +/* + * ItemPointerGetBlockNumber + * As above, but verifies that the item pointer looks valid. + */ +static inline BlockNumber +ItemPointerGetBlockNumber(const ItemPointerData *pointer) +{ + Assert(ItemPointerIsValid(pointer)); + return ItemPointerGetBlockNumberNoCheck(pointer); +} + +/* + * ItemPointerGetOffsetNumberNoCheck + * Returns the offset number of a disk item pointer. + */ +static inline OffsetNumber +ItemPointerGetOffsetNumberNoCheck(const ItemPointerData *pointer) +{ + return pointer->ip_posid; +} + +/* + * ItemPointerGetOffsetNumber + * As above, but verifies that the item pointer looks valid. + */ +static inline OffsetNumber +ItemPointerGetOffsetNumber(const ItemPointerData *pointer) +{ + Assert(ItemPointerIsValid(pointer)); + return ItemPointerGetOffsetNumberNoCheck(pointer); +} + +/* + * ItemPointerSet + * Sets a disk item pointer to the specified block and offset. + */ +static inline void +ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, blockNumber); + pointer->ip_posid = offNum; +} + +/* + * ItemPointerSetBlockNumber + * Sets a disk item pointer to the specified block. + */ +static inline void +ItemPointerSetBlockNumber(ItemPointerData *pointer, BlockNumber blockNumber) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, blockNumber); +} + +/* + * ItemPointerSetOffsetNumber + * Sets a disk item pointer to the specified offset. + */ +static inline void +ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber) +{ + Assert(PointerIsValid(pointer)); + pointer->ip_posid = offsetNumber; +} + +/* + * ItemPointerCopy + * Copies the contents of one disk item pointer to another. + * + * Should there ever be padding in an ItemPointer this would need to be handled + * differently as it's used as hash key. + */ +static inline void +ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer) +{ + Assert(PointerIsValid(toPointer)); + Assert(PointerIsValid(fromPointer)); + *toPointer = *fromPointer; +} + +/* + * ItemPointerSetInvalid + * Sets a disk item pointer to be invalid. + */ +static inline void +ItemPointerSetInvalid(ItemPointerData *pointer) +{ + Assert(PointerIsValid(pointer)); + BlockIdSet(&pointer->ip_blkid, InvalidBlockNumber); + pointer->ip_posid = InvalidOffsetNumber; +} + +/* + * ItemPointerIndicatesMovedPartitions + * True iff the block number indicates the tuple has moved to another + * partition. + */ +static inline bool +ItemPointerIndicatesMovedPartitions(const ItemPointerData *pointer) +{ + return + ItemPointerGetOffsetNumber(pointer) == MovedPartitionsOffsetNumber && + ItemPointerGetBlockNumberNoCheck(pointer) == MovedPartitionsBlockNumber; +} + +/* + * ItemPointerSetMovedPartitions + * Indicate that the item referenced by the itempointer has moved into a + * different partition. + */ +static inline void +ItemPointerSetMovedPartitions(ItemPointerData *pointer) +{ + ItemPointerSet(pointer, MovedPartitionsBlockNumber, MovedPartitionsOffsetNumber); +} + +/* ---------------- + * externs + * ---------------- + */ + +extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); +extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); +extern void ItemPointerInc(ItemPointer pointer); +extern void ItemPointerDec(ItemPointer pointer); + +/* ---------------- + * Datum conversion functions + * ---------------- + */ + +static inline ItemPointer +DatumGetItemPointer(Datum X) +{ + return (ItemPointer) DatumGetPointer(X); +} + +static inline Datum +ItemPointerGetDatum(const ItemPointerData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_ITEMPOINTER(n) DatumGetItemPointer(PG_GETARG_DATUM(n)) +#define PG_RETURN_ITEMPOINTER(x) return ItemPointerGetDatum(x) + +#endif /* ITEMPTR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/large_object.h b/platform/dbops/binaries/postgres/include/server/storage/large_object.h new file mode 100644 index 0000000000000000000000000000000000000000..9cfb7aa777a6fe258ece10876b0fc292d5413ac0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/large_object.h @@ -0,0 +1,100 @@ +/*------------------------------------------------------------------------- + * + * large_object.h + * Declarations for PostgreSQL large objects. POSTGRES 4.2 supported + * zillions of large objects (internal, external, jaquith, inversion). + * Now we only support inversion. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/large_object.h + * + *------------------------------------------------------------------------- + */ +#ifndef LARGE_OBJECT_H +#define LARGE_OBJECT_H + +#include "utils/snapshot.h" + + +/*---------- + * Data about a currently-open large object. + * + * id is the logical OID of the large object + * snapshot is the snapshot to use for read/write operations + * subid is the subtransaction that opened the desc (or currently owns it) + * offset is the current seek offset within the LO + * flags contains some flag bits + * + * NOTE: as of v11, permission checks are made when the large object is + * opened; therefore IFS_RDLOCK/IFS_WRLOCK indicate that read or write mode + * has been requested *and* the corresponding permission has been checked. + * + * NOTE: before 7.1, we also had to store references to the separate table + * and index of a specific large object. Now they all live in pg_largeobject + * and are accessed via a common relation descriptor. + *---------- + */ +typedef struct LargeObjectDesc +{ + Oid id; /* LO's identifier */ + Snapshot snapshot; /* snapshot to use */ + SubTransactionId subid; /* owning subtransaction ID */ + uint64 offset; /* current seek pointer */ + int flags; /* see flag bits below */ + +/* bits in flags: */ +#define IFS_RDLOCK (1 << 0) /* LO was opened for reading */ +#define IFS_WRLOCK (1 << 1) /* LO was opened for writing */ + +} LargeObjectDesc; + + +/* + * Each "page" (tuple) of a large object can hold this much data + * + * We could set this as high as BLCKSZ less some overhead, but it seems + * better to make it a smaller value, so that not as much space is used + * up when a page-tuple is updated. Note that the value is deliberately + * chosen large enough to trigger the tuple toaster, so that we will + * attempt to compress page tuples in-line. (But they won't be moved off + * unless the user creates a toast-table for pg_largeobject...) + * + * Also, it seems to be a smart move to make the page size be a power of 2, + * since clients will often be written to send data in power-of-2 blocks. + * This avoids unnecessary tuple updates caused by partial-page writes. + * + * NB: Changing LOBLKSIZE requires an initdb. + */ +#define LOBLKSIZE (BLCKSZ / 4) + +/* + * Maximum length in bytes for a large object. To make this larger, we'd + * have to widen pg_largeobject.pageno as well as various internal variables. + */ +#define MAX_LARGE_OBJECT_SIZE ((int64) INT_MAX * LOBLKSIZE) + + +/* + * GUC: backwards-compatibility flag to suppress LO permission checks + */ +extern PGDLLIMPORT bool lo_compat_privileges; + +/* + * Function definitions... + */ + +/* inversion stuff in inv_api.c */ +extern void close_lo_relation(bool isCommit); +extern Oid inv_create(Oid lobjId); +extern LargeObjectDesc *inv_open(Oid lobjId, int flags, MemoryContext mcxt); +extern void inv_close(LargeObjectDesc *obj_desc); +extern int inv_drop(Oid lobjId); +extern int64 inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence); +extern int64 inv_tell(LargeObjectDesc *obj_desc); +extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); +extern int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes); +extern void inv_truncate(LargeObjectDesc *obj_desc, int64 len); + +#endif /* LARGE_OBJECT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/latch.h b/platform/dbops/binaries/postgres/include/server/storage/latch.h new file mode 100644 index 0000000000000000000000000000000000000000..7e194d536f05510376ad954be5f8b02229ded7d9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/latch.h @@ -0,0 +1,196 @@ +/*------------------------------------------------------------------------- + * + * latch.h + * Routines for interprocess latches + * + * A latch is a boolean variable, with operations that let processes sleep + * until it is set. A latch can be set from another process, or a signal + * handler within the same process. + * + * The latch interface is a reliable replacement for the common pattern of + * using pg_usleep() or select() to wait until a signal arrives, where the + * signal handler sets a flag variable. Because on some platforms an + * incoming signal doesn't interrupt sleep, and even on platforms where it + * does there is a race condition if the signal arrives just before + * entering the sleep, the common pattern must periodically wake up and + * poll the flag variable. The pselect() system call was invented to solve + * this problem, but it is not portable enough. Latches are designed to + * overcome these limitations, allowing you to sleep without polling and + * ensuring quick response to signals from other processes. + * + * There are two kinds of latches: local and shared. A local latch is + * initialized by InitLatch, and can only be set from the same process. + * A local latch can be used to wait for a signal to arrive, by calling + * SetLatch in the signal handler. A shared latch resides in shared memory, + * and must be initialized at postmaster startup by InitSharedLatch. Before + * a shared latch can be waited on, it must be associated with a process + * with OwnLatch. Only the process owning the latch can wait on it, but any + * process can set it. + * + * There are three basic operations on a latch: + * + * SetLatch - Sets the latch + * ResetLatch - Clears the latch, allowing it to be set again + * WaitLatch - Waits for the latch to become set + * + * WaitLatch includes a provision for timeouts (which should be avoided + * when possible, as they incur extra overhead) and a provision for + * postmaster child processes to wake up immediately on postmaster death. + * See latch.c for detailed specifications for the exported functions. + * + * The correct pattern to wait for event(s) is: + * + * for (;;) + * { + * ResetLatch(); + * if (work to do) + * Do Stuff(); + * WaitLatch(); + * } + * + * It's important to reset the latch *before* checking if there's work to + * do. Otherwise, if someone sets the latch between the check and the + * ResetLatch call, you will miss it and Wait will incorrectly block. + * + * Another valid coding pattern looks like: + * + * for (;;) + * { + * if (work to do) + * Do Stuff(); // in particular, exit loop if some condition satisfied + * WaitLatch(); + * ResetLatch(); + * } + * + * This is useful to reduce latch traffic if it's expected that the loop's + * termination condition will often be satisfied in the first iteration; + * the cost is an extra loop iteration before blocking when it is not. + * What must be avoided is placing any checks for asynchronous events after + * WaitLatch and before ResetLatch, as that creates a race condition. + * + * To wake up the waiter, you must first set a global flag or something + * else that the wait loop tests in the "if (work to do)" part, and call + * SetLatch *after* that. SetLatch is designed to return quickly if the + * latch is already set. + * + * On some platforms, signals will not interrupt the latch wait primitive + * by themselves. Therefore, it is critical that any signal handler that + * is meant to terminate a WaitLatch wait calls SetLatch. + * + * Note that use of the process latch (PGPROC.procLatch) is generally better + * than an ad-hoc shared latch for signaling auxiliary processes. This is + * because generic signal handlers will call SetLatch on the process latch + * only, so using any latch other than the process latch effectively precludes + * use of any generic handler. + * + * + * WaitEventSets allow to wait for latches being set and additional events - + * postmaster dying and socket readiness of several sockets currently - at the + * same time. On many platforms using a long lived event set is more + * efficient than using WaitLatch or WaitLatchOrSocket. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/latch.h + * + *------------------------------------------------------------------------- + */ +#ifndef LATCH_H +#define LATCH_H + +#include + +#include "utils/resowner.h" + +/* + * Latch structure should be treated as opaque and only accessed through + * the public functions. It is defined here to allow embedding Latches as + * part of bigger structs. + */ +typedef struct Latch +{ + sig_atomic_t is_set; + sig_atomic_t maybe_sleeping; + bool is_shared; + int owner_pid; +#ifdef WIN32 + HANDLE event; +#endif +} Latch; + +/* + * Bitmasks for events that may wake-up WaitLatch(), WaitLatchOrSocket(), or + * WaitEventSetWait(). + */ +#define WL_LATCH_SET (1 << 0) +#define WL_SOCKET_READABLE (1 << 1) +#define WL_SOCKET_WRITEABLE (1 << 2) +#define WL_TIMEOUT (1 << 3) /* not for WaitEventSetWait() */ +#define WL_POSTMASTER_DEATH (1 << 4) +#define WL_EXIT_ON_PM_DEATH (1 << 5) +#ifdef WIN32 +#define WL_SOCKET_CONNECTED (1 << 6) +#else +/* avoid having to deal with case on platforms not requiring it */ +#define WL_SOCKET_CONNECTED WL_SOCKET_WRITEABLE +#endif +#define WL_SOCKET_CLOSED (1 << 7) +#ifdef WIN32 +#define WL_SOCKET_ACCEPT (1 << 8) +#else +/* avoid having to deal with case on platforms not requiring it */ +#define WL_SOCKET_ACCEPT WL_SOCKET_READABLE +#endif +#define WL_SOCKET_MASK (WL_SOCKET_READABLE | \ + WL_SOCKET_WRITEABLE | \ + WL_SOCKET_CONNECTED | \ + WL_SOCKET_ACCEPT | \ + WL_SOCKET_CLOSED) + +typedef struct WaitEvent +{ + int pos; /* position in the event data structure */ + uint32 events; /* triggered events */ + pgsocket fd; /* socket fd associated with event */ + void *user_data; /* pointer provided in AddWaitEventToSet */ +#ifdef WIN32 + bool reset; /* Is reset of the event required? */ +#endif +} WaitEvent; + +/* forward declaration to avoid exposing latch.c implementation details */ +typedef struct WaitEventSet WaitEventSet; + +/* + * prototypes for functions in latch.c + */ +extern void InitializeLatchSupport(void); +extern void InitLatch(Latch *latch); +extern void InitSharedLatch(Latch *latch); +extern void OwnLatch(Latch *latch); +extern void DisownLatch(Latch *latch); +extern void SetLatch(Latch *latch); +extern void ResetLatch(Latch *latch); +extern void ShutdownLatchSupport(void); + +extern WaitEventSet *CreateWaitEventSet(ResourceOwner resowner, int nevents); +extern void FreeWaitEventSet(WaitEventSet *set); +extern void FreeWaitEventSetAfterFork(WaitEventSet *set); +extern int AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, + Latch *latch, void *user_data); +extern void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch); + +extern int WaitEventSetWait(WaitEventSet *set, long timeout, + WaitEvent *occurred_events, int nevents, + uint32 wait_event_info); +extern int WaitLatch(Latch *latch, int wakeEvents, long timeout, + uint32 wait_event_info); +extern int WaitLatchOrSocket(Latch *latch, int wakeEvents, + pgsocket sock, long timeout, uint32 wait_event_info); +extern void InitializeLatchWaitSet(void); +extern int GetNumRegisteredWaitEvents(WaitEventSet *set); +extern bool WaitEventSetCanReportClosed(void); + +#endif /* LATCH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/lmgr.h b/platform/dbops/binaries/postgres/include/server/storage/lmgr.h new file mode 100644 index 0000000000000000000000000000000000000000..ce15125ac3bc0d0acd77ccce4a7fee5fadd3226d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/lmgr.h @@ -0,0 +1,126 @@ +/*------------------------------------------------------------------------- + * + * lmgr.h + * POSTGRES lock manager definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef LMGR_H +#define LMGR_H + +#include "lib/stringinfo.h" +#include "storage/itemptr.h" +#include "storage/lock.h" +#include "utils/rel.h" + + +/* XactLockTableWait operations */ +typedef enum XLTW_Oper +{ + XLTW_None, + XLTW_Update, + XLTW_Delete, + XLTW_Lock, + XLTW_LockUpdated, + XLTW_InsertIndex, + XLTW_InsertIndexUnique, + XLTW_FetchUpdated, + XLTW_RecheckExclusionConstr, +} XLTW_Oper; + +extern void RelationInitLockInfo(Relation relation); + +/* Lock a relation */ +extern void LockRelationOid(Oid relid, LOCKMODE lockmode); +extern void LockRelationId(LockRelId *relid, LOCKMODE lockmode); +extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode); +extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode); +extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode); + +extern void LockRelation(Relation relation, LOCKMODE lockmode); +extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode); +extern void UnlockRelation(Relation relation, LOCKMODE lockmode); +extern bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode, + bool orstronger); +extern bool CheckRelationOidLockedByMe(Oid relid, LOCKMODE lockmode, + bool orstronger); +extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode); + +extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); +extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode); + +/* Lock a relation for extension */ +extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode); +extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode); +extern bool ConditionalLockRelationForExtension(Relation relation, + LOCKMODE lockmode); +extern int RelationExtensionLockWaiterCount(Relation relation); + +/* Lock to recompute pg_database.datfrozenxid in the current database */ +extern void LockDatabaseFrozenIds(LOCKMODE lockmode); + +/* Lock a page (currently only used within indexes) */ +extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); +extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); +extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); + +/* Lock a tuple (see heap_lock_tuple before assuming you understand this) */ +extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); +extern bool ConditionalLockTuple(Relation relation, ItemPointer tid, + LOCKMODE lockmode); +extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); + +/* Lock an XID (used to wait for a transaction to finish) */ +extern void XactLockTableInsert(TransactionId xid); +extern void XactLockTableDelete(TransactionId xid); +extern void XactLockTableWait(TransactionId xid, Relation rel, + ItemPointer ctid, XLTW_Oper oper); +extern bool ConditionalXactLockTableWait(TransactionId xid); + +/* Lock VXIDs, specified by conflicting locktags */ +extern void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode, bool progress); +extern void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress); + +/* Lock an XID for tuple insertion (used to wait for an insertion to finish) */ +extern uint32 SpeculativeInsertionLockAcquire(TransactionId xid); +extern void SpeculativeInsertionLockRelease(TransactionId xid); +extern void SpeculativeInsertionWait(TransactionId xid, uint32 token); + +/* Lock a general object (other than a relation) of the current database */ +extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern bool ConditionalLockDatabaseObject(Oid classid, Oid objid, + uint16 objsubid, LOCKMODE lockmode); +extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +/* Lock a shared-across-databases object (other than a relation) */ +extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern bool ConditionalLockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); +extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, + LOCKMODE lockmode); + +extern void LockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid, + LOCKMODE lockmode); +extern void UnlockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid, + LOCKMODE lockmode); + +/* Describe a locktag for error messages */ +extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag); + +extern const char *GetLockNameFromTagType(uint16 locktag_type); + +#endif /* LMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/lock.h b/platform/dbops/binaries/postgres/include/server/storage/lock.h new file mode 100644 index 0000000000000000000000000000000000000000..cc1f6e78c396c1a6c590d167e08a898e54bc3d9f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/lock.h @@ -0,0 +1,624 @@ +/*------------------------------------------------------------------------- + * + * lock.h + * POSTGRES low-level lock mechanism + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCK_H_ +#define LOCK_H_ + +#ifdef FRONTEND +#error "lock.h may not be included from frontend code" +#endif + +#include "lib/ilist.h" +#include "storage/lockdefs.h" +#include "storage/lwlock.h" +#include "storage/procnumber.h" +#include "storage/shmem.h" +#include "utils/timestamp.h" + +/* struct PGPROC is declared in proc.h, but must forward-reference it */ +typedef struct PGPROC PGPROC; + +/* GUC variables */ +extern PGDLLIMPORT int max_locks_per_xact; + +#ifdef LOCK_DEBUG +extern PGDLLIMPORT int Trace_lock_oidmin; +extern PGDLLIMPORT bool Trace_locks; +extern PGDLLIMPORT bool Trace_userlocks; +extern PGDLLIMPORT int Trace_lock_table; +extern PGDLLIMPORT bool Debug_deadlocks; +#endif /* LOCK_DEBUG */ + + +/* + * Top-level transactions are identified by VirtualTransactionIDs comprising + * PGPROC fields procNumber and lxid. For recovered prepared transactions, the + * LocalTransactionId is an ordinary XID; LOCKTAG_VIRTUALTRANSACTION never + * refers to that kind. These are guaranteed unique over the short term, but + * will be reused after a database restart or XID wraparound; hence they + * should never be stored on disk. + * + * Note that struct VirtualTransactionId can not be assumed to be atomically + * assignable as a whole. However, type LocalTransactionId is assumed to + * be atomically assignable, and the proc number doesn't change often enough + * to be a problem, so we can fetch or assign the two fields separately. + * We deliberately refrain from using the struct within PGPROC, to prevent + * coding errors from trying to use struct assignment with it; instead use + * GET_VXID_FROM_PGPROC(). + */ +typedef struct +{ + ProcNumber procNumber; /* proc number of the PGPROC */ + LocalTransactionId localTransactionId; /* lxid from PGPROC */ +} VirtualTransactionId; + +#define InvalidLocalTransactionId 0 +#define LocalTransactionIdIsValid(lxid) ((lxid) != InvalidLocalTransactionId) +#define VirtualTransactionIdIsValid(vxid) \ + (LocalTransactionIdIsValid((vxid).localTransactionId)) +#define VirtualTransactionIdIsRecoveredPreparedXact(vxid) \ + ((vxid).procNumber == INVALID_PROC_NUMBER) +#define VirtualTransactionIdEquals(vxid1, vxid2) \ + ((vxid1).procNumber == (vxid2).procNumber && \ + (vxid1).localTransactionId == (vxid2).localTransactionId) +#define SetInvalidVirtualTransactionId(vxid) \ + ((vxid).procNumber = INVALID_PROC_NUMBER, \ + (vxid).localTransactionId = InvalidLocalTransactionId) +#define GET_VXID_FROM_PGPROC(vxid_dst, proc) \ + ((vxid_dst).procNumber = (proc).vxid.procNumber, \ + (vxid_dst).localTransactionId = (proc).vxid.lxid) + +/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */ +#define MAX_LOCKMODES 10 + +#define LOCKBIT_ON(lockmode) (1 << (lockmode)) +#define LOCKBIT_OFF(lockmode) (~(1 << (lockmode))) + + +/* + * This data structure defines the locking semantics associated with a + * "lock method". The semantics specify the meaning of each lock mode + * (by defining which lock modes it conflicts with). + * All of this data is constant and is kept in const tables. + * + * numLockModes -- number of lock modes (READ,WRITE,etc) that + * are defined in this lock method. Must be less than MAX_LOCKMODES. + * + * conflictTab -- this is an array of bitmasks showing lock + * mode conflicts. conflictTab[i] is a mask with the j-th bit + * turned on if lock modes i and j conflict. Lock modes are + * numbered 1..numLockModes; conflictTab[0] is unused. + * + * lockModeNames -- ID strings for debug printouts. + * + * trace_flag -- pointer to GUC trace flag for this lock method. (The + * GUC variable is not constant, but we use "const" here to denote that + * it can't be changed through this reference.) + */ +typedef struct LockMethodData +{ + int numLockModes; + const LOCKMASK *conflictTab; + const char *const *lockModeNames; + const bool *trace_flag; +} LockMethodData; + +typedef const LockMethodData *LockMethod; + +/* + * Lock methods are identified by LOCKMETHODID. (Despite the declaration as + * uint16, we are constrained to 256 lockmethods by the layout of LOCKTAG.) + */ +typedef uint16 LOCKMETHODID; + +/* These identify the known lock methods */ +#define DEFAULT_LOCKMETHOD 1 +#define USER_LOCKMETHOD 2 + +/* + * LOCKTAG is the key information needed to look up a LOCK item in the + * lock hashtable. A LOCKTAG value uniquely identifies a lockable object. + * + * The LockTagType enum defines the different kinds of objects we can lock. + * We can handle up to 256 different LockTagTypes. + */ +typedef enum LockTagType +{ + LOCKTAG_RELATION, /* whole relation */ + LOCKTAG_RELATION_EXTEND, /* the right to extend a relation */ + LOCKTAG_DATABASE_FROZEN_IDS, /* pg_database.datfrozenxid */ + LOCKTAG_PAGE, /* one page of a relation */ + LOCKTAG_TUPLE, /* one physical tuple */ + LOCKTAG_TRANSACTION, /* transaction (for waiting for xact done) */ + LOCKTAG_VIRTUALTRANSACTION, /* virtual transaction (ditto) */ + LOCKTAG_SPECULATIVE_TOKEN, /* speculative insertion Xid and token */ + LOCKTAG_OBJECT, /* non-relation database object */ + LOCKTAG_USERLOCK, /* reserved for old contrib/userlock code */ + LOCKTAG_ADVISORY, /* advisory user locks */ + LOCKTAG_APPLY_TRANSACTION, /* transaction being applied on a logical + * replication subscriber */ +} LockTagType; + +#define LOCKTAG_LAST_TYPE LOCKTAG_APPLY_TRANSACTION + +extern PGDLLIMPORT const char *const LockTagTypeNames[]; + +/* + * The LOCKTAG struct is defined with malice aforethought to fit into 16 + * bytes with no padding. Note that this would need adjustment if we were + * to widen Oid, BlockNumber, or TransactionId to more than 32 bits. + * + * We include lockmethodid in the locktag so that a single hash table in + * shared memory can store locks of different lockmethods. + */ +typedef struct LOCKTAG +{ + uint32 locktag_field1; /* a 32-bit ID field */ + uint32 locktag_field2; /* a 32-bit ID field */ + uint32 locktag_field3; /* a 32-bit ID field */ + uint16 locktag_field4; /* a 16-bit ID field */ + uint8 locktag_type; /* see enum LockTagType */ + uint8 locktag_lockmethodid; /* lockmethod indicator */ +} LOCKTAG; + +/* + * These macros define how we map logical IDs of lockable objects into + * the physical fields of LOCKTAG. Use these to set up LOCKTAG values, + * rather than accessing the fields directly. Note multiple eval of target! + */ + +/* ID info for a relation is DB OID + REL OID; DB OID = 0 if shared */ +#define SET_LOCKTAG_RELATION(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_RELATION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* same ID info as RELATION */ +#define SET_LOCKTAG_RELATION_EXTEND(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_RELATION_EXTEND, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for frozen IDs is DB OID */ +#define SET_LOCKTAG_DATABASE_FROZEN_IDS(locktag,dboid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = 0, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_DATABASE_FROZEN_IDS, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a page is RELATION info + BlockNumber */ +#define SET_LOCKTAG_PAGE(locktag,dboid,reloid,blocknum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_PAGE, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a tuple is PAGE info + OffsetNumber */ +#define SET_LOCKTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = (offnum), \ + (locktag).locktag_type = LOCKTAG_TUPLE, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a transaction is its TransactionId */ +#define SET_LOCKTAG_TRANSACTION(locktag,xid) \ + ((locktag).locktag_field1 = (xid), \ + (locktag).locktag_field2 = 0, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_TRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* ID info for a virtual transaction is its VirtualTransactionId */ +#define SET_LOCKTAG_VIRTUALTRANSACTION(locktag,vxid) \ + ((locktag).locktag_field1 = (vxid).procNumber, \ + (locktag).locktag_field2 = (vxid).localTransactionId, \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_VIRTUALTRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * ID info for a speculative insert is TRANSACTION info + + * its speculative insert counter. + */ +#define SET_LOCKTAG_SPECULATIVE_INSERTION(locktag,xid,token) \ + ((locktag).locktag_field1 = (xid), \ + (locktag).locktag_field2 = (token), \ + (locktag).locktag_field3 = 0, \ + (locktag).locktag_field4 = 0, \ + (locktag).locktag_type = LOCKTAG_SPECULATIVE_TOKEN, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * ID info for an object is DB OID + CLASS OID + OBJECT OID + SUBID + * + * Note: object ID has same representation as in pg_depend and + * pg_description, but notice that we are constraining SUBID to 16 bits. + * Also, we use DB OID = 0 for shared objects such as tablespaces. + */ +#define SET_LOCKTAG_OBJECT(locktag,dboid,classoid,objoid,objsubid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (classoid), \ + (locktag).locktag_field3 = (objoid), \ + (locktag).locktag_field4 = (objsubid), \ + (locktag).locktag_type = LOCKTAG_OBJECT, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +#define SET_LOCKTAG_ADVISORY(locktag,id1,id2,id3,id4) \ + ((locktag).locktag_field1 = (id1), \ + (locktag).locktag_field2 = (id2), \ + (locktag).locktag_field3 = (id3), \ + (locktag).locktag_field4 = (id4), \ + (locktag).locktag_type = LOCKTAG_ADVISORY, \ + (locktag).locktag_lockmethodid = USER_LOCKMETHOD) + +/* + * ID info for a remote transaction on a logical replication subscriber is: DB + * OID + SUBSCRIPTION OID + TRANSACTION ID + OBJID + */ +#define SET_LOCKTAG_APPLY_TRANSACTION(locktag,dboid,suboid,xid,objid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (suboid), \ + (locktag).locktag_field3 = (xid), \ + (locktag).locktag_field4 = (objid), \ + (locktag).locktag_type = LOCKTAG_APPLY_TRANSACTION, \ + (locktag).locktag_lockmethodid = DEFAULT_LOCKMETHOD) + +/* + * Per-locked-object lock information: + * + * tag -- uniquely identifies the object being locked + * grantMask -- bitmask for all lock types currently granted on this object. + * waitMask -- bitmask for all lock types currently awaited on this object. + * procLocks -- list of PROCLOCK objects for this lock. + * waitProcs -- queue of processes waiting for this lock. + * requested -- count of each lock type currently requested on the lock + * (includes requests already granted!!). + * nRequested -- total requested locks of all types. + * granted -- count of each lock type currently granted on the lock. + * nGranted -- total granted locks of all types. + * + * Note: these counts count 1 for each backend. Internally to a backend, + * there may be multiple grabs on a particular lock, but this is not reflected + * into shared memory. + */ +typedef struct LOCK +{ + /* hash key */ + LOCKTAG tag; /* unique identifier of lockable object */ + + /* data */ + LOCKMASK grantMask; /* bitmask for lock types already granted */ + LOCKMASK waitMask; /* bitmask for lock types awaited */ + dlist_head procLocks; /* list of PROCLOCK objects assoc. with lock */ + dclist_head waitProcs; /* list of PGPROC objects waiting on lock */ + int requested[MAX_LOCKMODES]; /* counts of requested locks */ + int nRequested; /* total of requested[] array */ + int granted[MAX_LOCKMODES]; /* counts of granted locks */ + int nGranted; /* total of granted[] array */ +} LOCK; + +#define LOCK_LOCKMETHOD(lock) ((LOCKMETHODID) (lock).tag.locktag_lockmethodid) +#define LOCK_LOCKTAG(lock) ((LockTagType) (lock).tag.locktag_type) + + +/* + * We may have several different backends holding or awaiting locks + * on the same lockable object. We need to store some per-holder/waiter + * information for each such holder (or would-be holder). This is kept in + * a PROCLOCK struct. + * + * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the + * proclock hashtable. A PROCLOCKTAG value uniquely identifies the combination + * of a lockable object and a holder/waiter for that object. (We can use + * pointers here because the PROCLOCKTAG need only be unique for the lifespan + * of the PROCLOCK, and it will never outlive the lock or the proc.) + * + * Internally to a backend, it is possible for the same lock to be held + * for different purposes: the backend tracks transaction locks separately + * from session locks. However, this is not reflected in the shared-memory + * state: we only track which backend(s) hold the lock. This is OK since a + * backend can never block itself. + * + * The holdMask field shows the already-granted locks represented by this + * proclock. Note that there will be a proclock object, possibly with + * zero holdMask, for any lock that the process is currently waiting on. + * Otherwise, proclock objects whose holdMasks are zero are recycled + * as soon as convenient. + * + * releaseMask is workspace for LockReleaseAll(): it shows the locks due + * to be released during the current call. This must only be examined or + * set by the backend owning the PROCLOCK. + * + * Each PROCLOCK object is linked into lists for both the associated LOCK + * object and the owning PGPROC object. Note that the PROCLOCK is entered + * into these lists as soon as it is created, even if no lock has yet been + * granted. A PGPROC that is waiting for a lock to be granted will also be + * linked into the lock's waitProcs queue. + */ +typedef struct PROCLOCKTAG +{ + /* NB: we assume this struct contains no padding! */ + LOCK *myLock; /* link to per-lockable-object information */ + PGPROC *myProc; /* link to PGPROC of owning backend */ +} PROCLOCKTAG; + +typedef struct PROCLOCK +{ + /* tag */ + PROCLOCKTAG tag; /* unique identifier of proclock object */ + + /* data */ + PGPROC *groupLeader; /* proc's lock group leader, or proc itself */ + LOCKMASK holdMask; /* bitmask for lock types currently held */ + LOCKMASK releaseMask; /* bitmask for lock types to be released */ + dlist_node lockLink; /* list link in LOCK's list of proclocks */ + dlist_node procLink; /* list link in PGPROC's list of proclocks */ +} PROCLOCK; + +#define PROCLOCK_LOCKMETHOD(proclock) \ + LOCK_LOCKMETHOD(*((proclock).tag.myLock)) + +/* + * Each backend also maintains a local hash table with information about each + * lock it is currently interested in. In particular the local table counts + * the number of times that lock has been acquired. This allows multiple + * requests for the same lock to be executed without additional accesses to + * shared memory. We also track the number of lock acquisitions per + * ResourceOwner, so that we can release just those locks belonging to a + * particular ResourceOwner. + * + * When holding a lock taken "normally", the lock and proclock fields always + * point to the associated objects in shared memory. However, if we acquired + * the lock via the fast-path mechanism, the lock and proclock fields are set + * to NULL, since there probably aren't any such objects in shared memory. + * (If the lock later gets promoted to normal representation, we may eventually + * update our locallock's lock/proclock fields after finding the shared + * objects.) + * + * Caution: a locallock object can be left over from a failed lock acquisition + * attempt. In this case its lock/proclock fields are untrustworthy, since + * the shared lock object is neither held nor awaited, and hence is available + * to be reclaimed. If nLocks > 0 then these pointers must either be valid or + * NULL, but when nLocks == 0 they should be considered garbage. + */ +typedef struct LOCALLOCKTAG +{ + LOCKTAG lock; /* identifies the lockable object */ + LOCKMODE mode; /* lock mode for this table entry */ +} LOCALLOCKTAG; + +typedef struct LOCALLOCKOWNER +{ + /* + * Note: if owner is NULL then the lock is held on behalf of the session; + * otherwise it is held on behalf of my current transaction. + * + * Must use a forward struct reference to avoid circularity. + */ + struct ResourceOwnerData *owner; + int64 nLocks; /* # of times held by this owner */ +} LOCALLOCKOWNER; + +typedef struct LOCALLOCK +{ + /* tag */ + LOCALLOCKTAG tag; /* unique identifier of locallock entry */ + + /* data */ + uint32 hashcode; /* copy of LOCKTAG's hash value */ + LOCK *lock; /* associated LOCK object, if any */ + PROCLOCK *proclock; /* associated PROCLOCK object, if any */ + int64 nLocks; /* total number of times lock is held */ + int numLockOwners; /* # of relevant ResourceOwners */ + int maxLockOwners; /* allocated size of array */ + LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */ + bool holdsStrongLockCount; /* bumped FastPathStrongRelationLocks */ + bool lockCleared; /* we read all sinval msgs for lock */ +} LOCALLOCK; + +#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.locktag_lockmethodid) +#define LOCALLOCK_LOCKTAG(llock) ((LockTagType) (llock).tag.lock.locktag_type) + + +/* + * These structures hold information passed from lmgr internals to the lock + * listing user-level functions (in lockfuncs.c). + */ + +typedef struct LockInstanceData +{ + LOCKTAG locktag; /* tag for locked object */ + LOCKMASK holdMask; /* locks held by this PGPROC */ + LOCKMODE waitLockMode; /* lock awaited by this PGPROC, if any */ + VirtualTransactionId vxid; /* virtual transaction ID of this PGPROC */ + TimestampTz waitStart; /* time at which this PGPROC started waiting + * for lock */ + int pid; /* pid of this PGPROC */ + int leaderPid; /* pid of group leader; = pid if no group */ + bool fastpath; /* taken via fastpath? */ +} LockInstanceData; + +typedef struct LockData +{ + int nelements; /* The length of the array */ + LockInstanceData *locks; /* Array of per-PROCLOCK information */ +} LockData; + +typedef struct BlockedProcData +{ + int pid; /* pid of a blocked PGPROC */ + /* Per-PROCLOCK information about PROCLOCKs of the lock the pid awaits */ + /* (these fields refer to indexes in BlockedProcsData.locks[]) */ + int first_lock; /* index of first relevant LockInstanceData */ + int num_locks; /* number of relevant LockInstanceDatas */ + /* PIDs of PGPROCs that are ahead of "pid" in the lock's wait queue */ + /* (these fields refer to indexes in BlockedProcsData.waiter_pids[]) */ + int first_waiter; /* index of first preceding waiter */ + int num_waiters; /* number of preceding waiters */ +} BlockedProcData; + +typedef struct BlockedProcsData +{ + BlockedProcData *procs; /* Array of per-blocked-proc information */ + LockInstanceData *locks; /* Array of per-PROCLOCK information */ + int *waiter_pids; /* Array of PIDs of other blocked PGPROCs */ + int nprocs; /* # of valid entries in procs[] array */ + int maxprocs; /* Allocated length of procs[] array */ + int nlocks; /* # of valid entries in locks[] array */ + int maxlocks; /* Allocated length of locks[] array */ + int npids; /* # of valid entries in waiter_pids[] array */ + int maxpids; /* Allocated length of waiter_pids[] array */ +} BlockedProcsData; + + +/* Result codes for LockAcquire() */ +typedef enum +{ + LOCKACQUIRE_NOT_AVAIL, /* lock not available, and dontWait=true */ + LOCKACQUIRE_OK, /* lock successfully acquired */ + LOCKACQUIRE_ALREADY_HELD, /* incremented count for lock already held */ + LOCKACQUIRE_ALREADY_CLEAR, /* incremented count for lock already clear */ +} LockAcquireResult; + +/* Deadlock states identified by DeadLockCheck() */ +typedef enum +{ + DS_NOT_YET_CHECKED, /* no deadlock check has run yet */ + DS_NO_DEADLOCK, /* no deadlock detected */ + DS_SOFT_DEADLOCK, /* deadlock avoided by queue rearrangement */ + DS_HARD_DEADLOCK, /* deadlock, no way out but ERROR */ + DS_BLOCKED_BY_AUTOVACUUM, /* no deadlock; queue blocked by autovacuum + * worker */ +} DeadLockState; + +/* + * The lockmgr's shared hash tables are partitioned to reduce contention. + * To determine which partition a given locktag belongs to, compute the tag's + * hash code with LockTagHashCode(), then apply one of these macros. + * NB: NUM_LOCK_PARTITIONS must be a power of 2! + */ +#define LockHashPartition(hashcode) \ + ((hashcode) % NUM_LOCK_PARTITIONS) +#define LockHashPartitionLock(hashcode) \ + (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + \ + LockHashPartition(hashcode)].lock) +#define LockHashPartitionLockByIndex(i) \ + (&MainLWLockArray[LOCK_MANAGER_LWLOCK_OFFSET + (i)].lock) + +/* + * The deadlock detector needs to be able to access lockGroupLeader and + * related fields in the PGPROC, so we arrange for those fields to be protected + * by one of the lock hash partition locks. Since the deadlock detector + * acquires all such locks anyway, this makes it safe for it to access these + * fields without doing anything extra. To avoid contention as much as + * possible, we map different PGPROCs to different partition locks. The lock + * used for a given lock group is determined by the group leader's pgprocno. + */ +#define LockHashPartitionLockByProc(leader_pgproc) \ + LockHashPartitionLock(GetNumberFromPGProc(leader_pgproc)) + +/* + * function prototypes + */ +extern void InitLocks(void); +extern LockMethod GetLocksMethodTable(const LOCK *lock); +extern LockMethod GetLockTagsMethodTable(const LOCKTAG *locktag); +extern uint32 LockTagHashCode(const LOCKTAG *locktag); +extern bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2); +extern LockAcquireResult LockAcquire(const LOCKTAG *locktag, + LOCKMODE lockmode, + bool sessionLock, + bool dontWait); +extern LockAcquireResult LockAcquireExtended(const LOCKTAG *locktag, + LOCKMODE lockmode, + bool sessionLock, + bool dontWait, + bool reportMemoryError, + LOCALLOCK **locallockp); +extern void AbortStrongLockAcquire(void); +extern void MarkLockClear(LOCALLOCK *locallock); +extern bool LockRelease(const LOCKTAG *locktag, + LOCKMODE lockmode, bool sessionLock); +extern void LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks); +extern void LockReleaseSession(LOCKMETHODID lockmethodid); +extern void LockReleaseCurrentOwner(LOCALLOCK **locallocks, int nlocks); +extern void LockReassignCurrentOwner(LOCALLOCK **locallocks, int nlocks); +extern bool LockHeldByMe(const LOCKTAG *locktag, + LOCKMODE lockmode, bool orstronger); +#ifdef USE_ASSERT_CHECKING +extern HTAB *GetLockMethodLocalHash(void); +#endif +extern bool LockHasWaiters(const LOCKTAG *locktag, + LOCKMODE lockmode, bool sessionLock); +extern VirtualTransactionId *GetLockConflicts(const LOCKTAG *locktag, + LOCKMODE lockmode, int *countp); +extern void AtPrepare_Locks(void); +extern void PostPrepare_Locks(TransactionId xid); +extern bool LockCheckConflicts(LockMethod lockMethodTable, + LOCKMODE lockmode, + LOCK *lock, PROCLOCK *proclock); +extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode); +extern void GrantAwaitedLock(void); +extern void RemoveFromWaitQueue(PGPROC *proc, uint32 hashcode); +extern Size LockShmemSize(void); +extern LockData *GetLockStatusData(void); +extern BlockedProcsData *GetBlockerStatusData(int blocked_pid); + +extern xl_standby_lock *GetRunningTransactionLocks(int *nlocks); +extern const char *GetLockmodeName(LOCKMETHODID lockmethodid, LOCKMODE mode); + +extern void lock_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postcommit(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_postabort(TransactionId xid, uint16 info, + void *recdata, uint32 len); +extern void lock_twophase_standby_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +extern DeadLockState DeadLockCheck(PGPROC *proc); +extern PGPROC *GetBlockingAutoVacuumPgproc(void); +extern void DeadLockReport(void) pg_attribute_noreturn(); +extern void RememberSimpleDeadLock(PGPROC *proc1, + LOCKMODE lockmode, + LOCK *lock, + PGPROC *proc2); +extern void InitDeadLockChecking(void); + +extern int LockWaiterCount(const LOCKTAG *locktag); + +#ifdef LOCK_DEBUG +extern void DumpLocks(PGPROC *proc); +extern void DumpAllLocks(void); +#endif + +/* Lock a VXID (used to wait for a transaction to finish) */ +extern void VirtualXactLockTableInsert(VirtualTransactionId vxid); +extern void VirtualXactLockTableCleanup(void); +extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait); + +#endif /* LOCK_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/lockdefs.h b/platform/dbops/binaries/postgres/include/server/storage/lockdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..810b297edf95b2e7cfdf041694ed51ac97d1a91b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/lockdefs.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * lockdefs.h + * Frontend exposed parts of postgres' low level lock mechanism + * + * The split between lockdefs.h and lock.h is not very principled. This file + * contains definition that have to (indirectly) be available when included by + * FRONTEND code. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/lockdefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef LOCKDEFS_H_ +#define LOCKDEFS_H_ + +/* + * LOCKMODE is an integer (1..N) indicating a lock type. LOCKMASK is a bit + * mask indicating a set of held or requested lock types (the bit 1<lwWaitMode, + * when waiting for lock to become free. Not + * to be used as LWLockAcquire argument */ +} LWLockMode; + + +#ifdef LOCK_DEBUG +extern PGDLLIMPORT bool Trace_lwlocks; +#endif + +extern bool LWLockAcquire(LWLock *lock, LWLockMode mode); +extern bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode); +extern bool LWLockAcquireOrWait(LWLock *lock, LWLockMode mode); +extern void LWLockRelease(LWLock *lock); +extern void LWLockReleaseClearVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val); +extern void LWLockReleaseAll(void); +extern bool LWLockHeldByMe(LWLock *lock); +extern bool LWLockAnyHeldByMe(LWLock *lock, int nlocks, size_t stride); +extern bool LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode); + +extern bool LWLockWaitForVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 oldval, uint64 *newval); +extern void LWLockUpdateVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val); + +extern Size LWLockShmemSize(void); +extern void CreateLWLocks(void); +extern void InitLWLockAccess(void); + +extern const char *GetLWLockIdentifier(uint32 classId, uint16 eventId); + +/* + * Extensions (or core code) can obtain an LWLocks by calling + * RequestNamedLWLockTranche() during postmaster startup. Subsequently, + * call GetNamedLWLockTranche() to obtain a pointer to an array containing + * the number of LWLocks requested. + */ +extern void RequestNamedLWLockTranche(const char *tranche_name, int num_lwlocks); +extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name); + +/* + * There is another, more flexible method of obtaining lwlocks. First, call + * LWLockNewTrancheId just once to obtain a tranche ID; this allocates from + * a shared counter. Next, each individual process using the tranche should + * call LWLockRegisterTranche() to associate that tranche ID with a name. + * Finally, LWLockInitialize should be called just once per lwlock, passing + * the tranche ID as an argument. + * + * It may seem strange that each process using the tranche must register it + * separately, but dynamic shared memory segments aren't guaranteed to be + * mapped at the same address in all coordinating backends, so storing the + * registration in the main shared memory segment wouldn't work for that case. + */ +extern int LWLockNewTrancheId(void); +extern void LWLockRegisterTranche(int tranche_id, const char *tranche_name); +extern void LWLockInitialize(LWLock *lock, int tranche_id); + +/* + * Every tranche ID less than NUM_INDIVIDUAL_LWLOCKS is reserved; also, + * we reserve additional tranche IDs for builtin tranches not included in + * the set of individual LWLocks. A call to LWLockNewTrancheId will never + * return a value less than LWTRANCHE_FIRST_USER_DEFINED. + */ +typedef enum BuiltinTrancheIds +{ + LWTRANCHE_XACT_BUFFER = NUM_INDIVIDUAL_LWLOCKS, + LWTRANCHE_COMMITTS_BUFFER, + LWTRANCHE_SUBTRANS_BUFFER, + LWTRANCHE_MULTIXACTOFFSET_BUFFER, + LWTRANCHE_MULTIXACTMEMBER_BUFFER, + LWTRANCHE_NOTIFY_BUFFER, + LWTRANCHE_SERIAL_BUFFER, + LWTRANCHE_WAL_INSERT, + LWTRANCHE_BUFFER_CONTENT, + LWTRANCHE_REPLICATION_ORIGIN_STATE, + LWTRANCHE_REPLICATION_SLOT_IO, + LWTRANCHE_LOCK_FASTPATH, + LWTRANCHE_BUFFER_MAPPING, + LWTRANCHE_LOCK_MANAGER, + LWTRANCHE_PREDICATE_LOCK_MANAGER, + LWTRANCHE_PARALLEL_HASH_JOIN, + LWTRANCHE_PARALLEL_QUERY_DSA, + LWTRANCHE_PER_SESSION_DSA, + LWTRANCHE_PER_SESSION_RECORD_TYPE, + LWTRANCHE_PER_SESSION_RECORD_TYPMOD, + LWTRANCHE_SHARED_TUPLESTORE, + LWTRANCHE_SHARED_TIDBITMAP, + LWTRANCHE_PARALLEL_APPEND, + LWTRANCHE_PER_XACT_PREDICATE_LIST, + LWTRANCHE_PGSTATS_DSA, + LWTRANCHE_PGSTATS_HASH, + LWTRANCHE_PGSTATS_DATA, + LWTRANCHE_LAUNCHER_DSA, + LWTRANCHE_LAUNCHER_HASH, + LWTRANCHE_DSM_REGISTRY_DSA, + LWTRANCHE_DSM_REGISTRY_HASH, + LWTRANCHE_COMMITTS_SLRU, + LWTRANCHE_MULTIXACTMEMBER_SLRU, + LWTRANCHE_MULTIXACTOFFSET_SLRU, + LWTRANCHE_NOTIFY_SLRU, + LWTRANCHE_SERIAL_SLRU, + LWTRANCHE_SUBTRANS_SLRU, + LWTRANCHE_XACT_SLRU, + LWTRANCHE_PARALLEL_VACUUM_DSA, + LWTRANCHE_FIRST_USER_DEFINED, +} BuiltinTrancheIds; + +/* + * Prior to PostgreSQL 9.4, we used an enum type called LWLockId to refer + * to LWLocks. New code should instead use LWLock *. However, for the + * convenience of third-party code, we include the following typedef. + */ +typedef LWLock *LWLockId; + +#endif /* LWLOCK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/lwlocklist.h b/platform/dbops/binaries/postgres/include/server/storage/lwlocklist.h new file mode 100644 index 0000000000000000000000000000000000000000..6a2f64c54fb5700719bc6a21369dbdf0b1406781 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/lwlocklist.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * lwlocklist.h + * + * The predefined LWLock list is kept in its own source file for use by + * automatic tools. The exact representation of a keyword is determined by + * the PG_LWLOCK macro, which is not defined in this file; it can be + * defined by the caller for special purposes. + * + * Also, generate-lwlocknames.pl processes this file to create lwlocknames.h. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/storage/lwlocklist.h + * + *------------------------------------------------------------------------- + */ + +/* + * Some commonly-used locks have predefined positions within MainLWLockArray; + * these are defined here. If you add a lock, add it to the end to avoid + * renumbering the existing locks; if you remove a lock, consider leaving a gap + * in the numbering sequence for the benefit of DTrace and other external + * debugging scripts. Also, do not forget to update the section + * WaitEventLWLock of src/backend/utils/activity/wait_event_names.txt. + * + * Note that the names here don't include the Lock suffix, to appease the + * C preprocessor; it's added elsewhere. + */ + +/* 0 is available; was formerly BufFreelistLock */ +PG_LWLOCK(1, ShmemIndex) +PG_LWLOCK(2, OidGen) +PG_LWLOCK(3, XidGen) +PG_LWLOCK(4, ProcArray) +PG_LWLOCK(5, SInvalRead) +PG_LWLOCK(6, SInvalWrite) +PG_LWLOCK(7, WALBufMapping) +PG_LWLOCK(8, WALWrite) +PG_LWLOCK(9, ControlFile) +/* 10 was CheckpointLock */ +/* 11 was XactSLRULock */ +/* 12 was SubtransSLRULock */ +PG_LWLOCK(13, MultiXactGen) +/* 14 was MultiXactOffsetSLRULock */ +/* 15 was MultiXactMemberSLRULock */ +PG_LWLOCK(16, RelCacheInit) +PG_LWLOCK(17, CheckpointerComm) +PG_LWLOCK(18, TwoPhaseState) +PG_LWLOCK(19, TablespaceCreate) +PG_LWLOCK(20, BtreeVacuum) +PG_LWLOCK(21, AddinShmemInit) +PG_LWLOCK(22, Autovacuum) +PG_LWLOCK(23, AutovacuumSchedule) +PG_LWLOCK(24, SyncScan) +PG_LWLOCK(25, RelationMapping) +/* 26 was NotifySLRULock */ +PG_LWLOCK(27, NotifyQueue) +PG_LWLOCK(28, SerializableXactHash) +PG_LWLOCK(29, SerializableFinishedList) +PG_LWLOCK(30, SerializablePredicateList) +/* 31 was SerialSLRULock */ +PG_LWLOCK(32, SyncRep) +PG_LWLOCK(33, BackgroundWorker) +PG_LWLOCK(34, DynamicSharedMemoryControl) +PG_LWLOCK(35, AutoFile) +PG_LWLOCK(36, ReplicationSlotAllocation) +PG_LWLOCK(37, ReplicationSlotControl) +/* 38 was CommitTsSLRULock */ +PG_LWLOCK(39, CommitTs) +PG_LWLOCK(40, ReplicationOrigin) +PG_LWLOCK(41, MultiXactTruncation) +/* 42 was OldSnapshotTimeMapLock */ +PG_LWLOCK(43, LogicalRepWorker) +PG_LWLOCK(44, XactTruncation) +/* 45 was XactTruncationLock until removal of BackendRandomLock */ +PG_LWLOCK(46, WrapLimitsVacuum) +PG_LWLOCK(47, NotifyQueueTail) +PG_LWLOCK(48, WaitEventCustom) +PG_LWLOCK(49, WALSummarizer) +PG_LWLOCK(50, DSMRegistry) +PG_LWLOCK(51, InjectionPoint) +PG_LWLOCK(52, SerialControl) diff --git a/platform/dbops/binaries/postgres/include/server/storage/lwlocknames.h b/platform/dbops/binaries/postgres/include/server/storage/lwlocknames.h new file mode 100644 index 0000000000000000000000000000000000000000..0d2d41b422ba33cd0b9895d93792b0433e626b42 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/lwlocknames.h @@ -0,0 +1,47 @@ +/* autogenerated from src/include/storage/lwlocklist.h, do not edit */ +/* there is deliberately not an #ifndef LWLOCKNAMES_H here */ + +#define ShmemIndexLock (&MainLWLockArray[1].lock) +#define OidGenLock (&MainLWLockArray[2].lock) +#define XidGenLock (&MainLWLockArray[3].lock) +#define ProcArrayLock (&MainLWLockArray[4].lock) +#define SInvalReadLock (&MainLWLockArray[5].lock) +#define SInvalWriteLock (&MainLWLockArray[6].lock) +#define WALBufMappingLock (&MainLWLockArray[7].lock) +#define WALWriteLock (&MainLWLockArray[8].lock) +#define ControlFileLock (&MainLWLockArray[9].lock) +#define MultiXactGenLock (&MainLWLockArray[13].lock) +#define RelCacheInitLock (&MainLWLockArray[16].lock) +#define CheckpointerCommLock (&MainLWLockArray[17].lock) +#define TwoPhaseStateLock (&MainLWLockArray[18].lock) +#define TablespaceCreateLock (&MainLWLockArray[19].lock) +#define BtreeVacuumLock (&MainLWLockArray[20].lock) +#define AddinShmemInitLock (&MainLWLockArray[21].lock) +#define AutovacuumLock (&MainLWLockArray[22].lock) +#define AutovacuumScheduleLock (&MainLWLockArray[23].lock) +#define SyncScanLock (&MainLWLockArray[24].lock) +#define RelationMappingLock (&MainLWLockArray[25].lock) +#define NotifyQueueLock (&MainLWLockArray[27].lock) +#define SerializableXactHashLock (&MainLWLockArray[28].lock) +#define SerializableFinishedListLock (&MainLWLockArray[29].lock) +#define SerializablePredicateListLock (&MainLWLockArray[30].lock) +#define SyncRepLock (&MainLWLockArray[32].lock) +#define BackgroundWorkerLock (&MainLWLockArray[33].lock) +#define DynamicSharedMemoryControlLock (&MainLWLockArray[34].lock) +#define AutoFileLock (&MainLWLockArray[35].lock) +#define ReplicationSlotAllocationLock (&MainLWLockArray[36].lock) +#define ReplicationSlotControlLock (&MainLWLockArray[37].lock) +#define CommitTsLock (&MainLWLockArray[39].lock) +#define ReplicationOriginLock (&MainLWLockArray[40].lock) +#define MultiXactTruncationLock (&MainLWLockArray[41].lock) +#define LogicalRepWorkerLock (&MainLWLockArray[43].lock) +#define XactTruncationLock (&MainLWLockArray[44].lock) +#define WrapLimitsVacuumLock (&MainLWLockArray[46].lock) +#define NotifyQueueTailLock (&MainLWLockArray[47].lock) +#define WaitEventCustomLock (&MainLWLockArray[48].lock) +#define WALSummarizerLock (&MainLWLockArray[49].lock) +#define DSMRegistryLock (&MainLWLockArray[50].lock) +#define InjectionPointLock (&MainLWLockArray[51].lock) +#define SerialControlLock (&MainLWLockArray[52].lock) + +#define NUM_INDIVIDUAL_LWLOCKS 53 diff --git a/platform/dbops/binaries/postgres/include/server/storage/md.h b/platform/dbops/binaries/postgres/include/server/storage/md.h new file mode 100644 index 0000000000000000000000000000000000000000..5dbd0033c6f256d2abb0699585d809bd286a48ff --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/md.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * md.h + * magnetic disk storage manager public interface declarations. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/md.h + * + *------------------------------------------------------------------------- + */ +#ifndef MD_H +#define MD_H + +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "storage/sync.h" + +/* md storage manager functionality */ +extern void mdinit(void); +extern void mdopen(SMgrRelation reln); +extern void mdclose(SMgrRelation reln, ForkNumber forknum); +extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); +extern bool mdexists(SMgrRelation reln, ForkNumber forknum); +extern void mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo); +extern void mdextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, const void *buffer, bool skipFsync); +extern void mdzeroextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks, bool skipFsync); +extern bool mdprefetch(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks); +extern void mdreadv(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void mdwritev(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + const void **buffers, BlockNumber nblocks, bool skipFsync); +extern void mdwriteback(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, BlockNumber nblocks); +extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum); +extern void mdtruncate(SMgrRelation reln, ForkNumber forknum, + BlockNumber old_blocks, BlockNumber nblocks); +extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum); +extern void mdregistersync(SMgrRelation reln, ForkNumber forknum); + +extern void ForgetDatabaseSyncRequests(Oid dbid); +extern void DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo); + +/* md sync callbacks */ +extern int mdsyncfiletag(const FileTag *ftag, char *path); +extern int mdunlinkfiletag(const FileTag *ftag, char *path); +extern bool mdfiletagmatches(const FileTag *ftag, const FileTag *candidate); + +#endif /* MD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/off.h b/platform/dbops/binaries/postgres/include/server/storage/off.h new file mode 100644 index 0000000000000000000000000000000000000000..575cca83dd19cb180561b7b94953bb8ad2f593ef --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/off.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * off.h + * POSTGRES disk "offset" definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/off.h + * + *------------------------------------------------------------------------- + */ +#ifndef OFF_H +#define OFF_H + +#include "storage/itemid.h" +/* + * OffsetNumber: + * + * this is a 1-based index into the linp (ItemIdData) array in the + * header of each disk page. + */ +typedef uint16 OffsetNumber; + +#define InvalidOffsetNumber ((OffsetNumber) 0) +#define FirstOffsetNumber ((OffsetNumber) 1) +#define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData))) + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * OffsetNumberIsValid + * True iff the offset number is valid. + */ +#define OffsetNumberIsValid(offsetNumber) \ + ((bool) ((offsetNumber != InvalidOffsetNumber) && \ + (offsetNumber <= MaxOffsetNumber))) + +/* + * OffsetNumberNext + * OffsetNumberPrev + * Increments/decrements the argument. These macros look pointless + * but they help us disambiguate the different manipulations on + * OffsetNumbers (e.g., sometimes we subtract one from an + * OffsetNumber to move back, and sometimes we do so to form a + * real C array index). + */ +#define OffsetNumberNext(offsetNumber) \ + ((OffsetNumber) (1 + (offsetNumber))) +#define OffsetNumberPrev(offsetNumber) \ + ((OffsetNumber) (-1 + (offsetNumber))) + +#endif /* OFF_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/pg_sema.h b/platform/dbops/binaries/postgres/include/server/storage/pg_sema.h new file mode 100644 index 0000000000000000000000000000000000000000..dfef79ac963846eacb7943a2b3f01c8875af44fd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/pg_sema.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * pg_sema.h + * Platform-independent API for semaphores. + * + * PostgreSQL requires counting semaphores (the kind that keep track of + * multiple unlock operations, and will allow an equal number of subsequent + * lock operations before blocking). The underlying implementation is + * not the same on every platform. This file defines the API that must + * be provided by each port. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pg_sema.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SEMA_H +#define PG_SEMA_H + +/* + * struct PGSemaphoreData and pointer type PGSemaphore are the data structure + * representing an individual semaphore. The contents of PGSemaphoreData vary + * across implementations and must never be touched by platform-independent + * code; hence, PGSemaphoreData is declared as an opaque struct here. + * + * However, Windows is sufficiently unlike our other ports that it doesn't + * seem worth insisting on ABI compatibility for Windows too. Hence, on + * that platform just define PGSemaphore as HANDLE. + */ +#ifndef USE_WIN32_SEMAPHORES +typedef struct PGSemaphoreData *PGSemaphore; +#else +typedef HANDLE PGSemaphore; +#endif + + +/* Report amount of shared memory needed */ +extern Size PGSemaphoreShmemSize(int maxSemas); + +/* Module initialization (called during postmaster start or shmem reinit) */ +extern void PGReserveSemaphores(int maxSemas); + +/* Allocate a PGSemaphore structure with initial count 1 */ +extern PGSemaphore PGSemaphoreCreate(void); + +/* Reset a previously-initialized PGSemaphore to have count 0 */ +extern void PGSemaphoreReset(PGSemaphore sema); + +/* Lock a semaphore (decrement count), blocking if count would be < 0 */ +extern void PGSemaphoreLock(PGSemaphore sema); + +/* Unlock a semaphore (increment count) */ +extern void PGSemaphoreUnlock(PGSemaphore sema); + +/* Lock a semaphore only if able to do so without blocking */ +extern bool PGSemaphoreTryLock(PGSemaphore sema); + +#endif /* PG_SEMA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/pg_shmem.h b/platform/dbops/binaries/postgres/include/server/storage/pg_shmem.h new file mode 100644 index 0000000000000000000000000000000000000000..3065ff5be71c1637d8fc35d405e54e0d0bebcb5b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/pg_shmem.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * pg_shmem.h + * Platform-independent API for shared memory support. + * + * Every port is expected to support shared memory with approximately + * SysV-ish semantics; in particular, a memory block is not anonymous + * but has an ID, and we must be able to tell whether there are any + * remaining processes attached to a block of a specified ID. + * + * To simplify life for the SysV implementation, the ID is assumed to + * consist of two unsigned long values (these are key and ID in SysV + * terms). Other platforms may ignore the second value if they need + * only one ID number. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pg_shmem.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SHMEM_H +#define PG_SHMEM_H + +#include "storage/dsm_impl.h" + +typedef struct PGShmemHeader /* standard header for all Postgres shmem */ +{ + int32 magic; /* magic # to identify Postgres segments */ +#define PGShmemMagic 679834894 + pid_t creatorPID; /* PID of creating process (set but unread) */ + Size totalsize; /* total size of segment */ + Size freeoffset; /* offset to first free space */ + dsm_handle dsm_control; /* ID of dynamic shared memory control seg */ + void *index; /* pointer to ShmemIndex table */ +#ifndef WIN32 /* Windows doesn't have useful inode#s */ + dev_t device; /* device data directory is on */ + ino_t inode; /* inode number of data directory */ +#endif +} PGShmemHeader; + +/* GUC variables */ +extern PGDLLIMPORT int shared_memory_type; +extern PGDLLIMPORT int huge_pages; +extern PGDLLIMPORT int huge_page_size; + +/* Possible values for huge_pages and huge_pages_status */ +typedef enum +{ + HUGE_PAGES_OFF, + HUGE_PAGES_ON, + HUGE_PAGES_TRY, /* only for huge_pages */ + HUGE_PAGES_UNKNOWN, /* only for huge_pages_status */ +} HugePagesType; + +/* Possible values for shared_memory_type */ +typedef enum +{ + SHMEM_TYPE_WINDOWS, + SHMEM_TYPE_SYSV, + SHMEM_TYPE_MMAP, +} PGShmemType; + +#ifndef WIN32 +extern PGDLLIMPORT unsigned long UsedShmemSegID; +#else +extern PGDLLIMPORT HANDLE UsedShmemSegID; +extern PGDLLIMPORT void *ShmemProtectiveRegion; +#endif +extern PGDLLIMPORT void *UsedShmemSegAddr; + +#if !defined(WIN32) && !defined(EXEC_BACKEND) +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP +#elif !defined(WIN32) +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV +#else +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_WINDOWS +#endif + +#ifdef EXEC_BACKEND +extern void PGSharedMemoryReAttach(void); +extern void PGSharedMemoryNoReAttach(void); +#endif + +extern PGShmemHeader *PGSharedMemoryCreate(Size size, + PGShmemHeader **shim); +extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2); +extern void PGSharedMemoryDetach(void); +extern void GetHugePageSize(Size *hugepagesize, int *mmap_flags); + +#endif /* PG_SHMEM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/pmsignal.h b/platform/dbops/binaries/postgres/include/server/storage/pmsignal.h new file mode 100644 index 0000000000000000000000000000000000000000..029b7201093b37120044916cf79d712601840d56 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/pmsignal.h @@ -0,0 +1,105 @@ +/*------------------------------------------------------------------------- + * + * pmsignal.h + * routines for signaling between the postmaster and its child processes + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/pmsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PMSIGNAL_H +#define PMSIGNAL_H + +#include + +#ifdef HAVE_SYS_PRCTL_H +#include "sys/prctl.h" +#endif + +#ifdef HAVE_SYS_PROCCTL_H +#include "sys/procctl.h" +#endif + +/* + * Reasons for signaling the postmaster. We can cope with simultaneous + * signals for different reasons. If the same reason is signaled multiple + * times in quick succession, however, the postmaster is likely to observe + * only one notification of it. This is okay for the present uses. + */ +typedef enum +{ + PMSIGNAL_RECOVERY_STARTED, /* recovery has started */ + PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */ + PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ + PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */ + PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */ + PMSIGNAL_BACKGROUND_WORKER_CHANGE, /* background worker state change */ + PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */ + PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */ + + NUM_PMSIGNALS /* Must be last value of enum! */ +} PMSignalReason; + +/* + * Reasons why the postmaster would send SIGQUIT to its children. + */ +typedef enum +{ + PMQUIT_NOT_SENT = 0, /* postmaster hasn't sent SIGQUIT */ + PMQUIT_FOR_CRASH, /* some other backend bought the farm */ + PMQUIT_FOR_STOP, /* immediate stop was commanded */ +} QuitSignalReason; + +/* PMSignalData is an opaque struct, details known only within pmsignal.c */ +typedef struct PMSignalData PMSignalData; + +/* + * prototypes for functions in pmsignal.c + */ +extern Size PMSignalShmemSize(void); +extern void PMSignalShmemInit(void); +extern void SendPostmasterSignal(PMSignalReason reason); +extern bool CheckPostmasterSignal(PMSignalReason reason); +extern void SetQuitSignalReason(QuitSignalReason reason); +extern QuitSignalReason GetQuitSignalReason(void); +extern int AssignPostmasterChildSlot(void); +extern bool ReleasePostmasterChildSlot(int slot); +extern bool IsPostmasterChildWalSender(int slot); +extern void MarkPostmasterChildActive(void); +extern void MarkPostmasterChildInactive(void); +extern void MarkPostmasterChildWalSender(void); +extern bool PostmasterIsAliveInternal(void); +extern void PostmasterDeathSignalInit(void); + + +/* + * Do we have a way to ask for a signal on parent death? + * + * If we do, pmsignal.c will set up a signal handler, that sets a flag when + * the parent dies. Checking the flag first makes PostmasterIsAlive() a lot + * cheaper in usual case that the postmaster is alive. + */ +#if (defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_PDEATHSIG)) || \ + (defined(HAVE_SYS_PROCCTL_H) && defined(PROC_PDEATHSIG_CTL)) +#define USE_POSTMASTER_DEATH_SIGNAL +#endif + +#ifdef USE_POSTMASTER_DEATH_SIGNAL +extern PGDLLIMPORT volatile sig_atomic_t postmaster_possibly_dead; + +static inline bool +PostmasterIsAlive(void) +{ + if (likely(!postmaster_possibly_dead)) + return true; + return PostmasterIsAliveInternal(); +} +#else +#define PostmasterIsAlive() PostmasterIsAliveInternal() +#endif + +#endif /* PMSIGNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/predicate.h b/platform/dbops/binaries/postgres/include/server/storage/predicate.h new file mode 100644 index 0000000000000000000000000000000000000000..14ee9b94a2ff64834b2d3169058da43e86687205 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/predicate.h @@ -0,0 +1,83 @@ +/*------------------------------------------------------------------------- + * + * predicate.h + * POSTGRES public predicate locking definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/predicate.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREDICATE_H +#define PREDICATE_H + +#include "storage/lock.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + + +/* + * GUC variables + */ +extern PGDLLIMPORT int max_predicate_locks_per_xact; +extern PGDLLIMPORT int max_predicate_locks_per_relation; +extern PGDLLIMPORT int max_predicate_locks_per_page; + +/* + * A handle used for sharing SERIALIZABLEXACT objects between the participants + * in a parallel query. + */ +typedef void *SerializableXactHandle; + +/* + * function prototypes + */ + +/* housekeeping for shared memory predicate lock structures */ +extern void InitPredicateLocks(void); +extern Size PredicateLockShmemSize(void); + +extern void CheckPointPredicate(void); + +/* predicate lock reporting */ +extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno); + +/* predicate lock maintenance */ +extern Snapshot GetSerializableTransactionSnapshot(Snapshot snapshot); +extern void SetSerializableTransactionSnapshot(Snapshot snapshot, + VirtualTransactionId *sourcevxid, + int sourcepid); +extern void RegisterPredicateLockingXid(TransactionId xid); +extern void PredicateLockRelation(Relation relation, Snapshot snapshot); +extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot); +extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, + TransactionId tuple_xid); +extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); +extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); +extern void TransferPredicateLocksToHeapRelation(Relation relation); +extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe); + +/* conflict detection (may also trigger rollback) */ +extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot); +extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot); +extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno); +extern void CheckTableForSerializableConflictIn(Relation relation); + +/* final rollback checking */ +extern void PreCommit_CheckForSerializationFailure(void); + +/* two-phase commit support */ +extern void AtPrepare_PredicateLocks(void); +extern void PostPrepare_PredicateLocks(TransactionId xid); +extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit); +extern void predicatelock_twophase_recover(TransactionId xid, uint16 info, + void *recdata, uint32 len); + +/* parallel query support */ +extern SerializableXactHandle ShareSerializableXact(void); +extern void AttachSerializableXact(SerializableXactHandle handle); + +#endif /* PREDICATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/predicate_internals.h b/platform/dbops/binaries/postgres/include/server/storage/predicate_internals.h new file mode 100644 index 0000000000000000000000000000000000000000..cb0ec9bc98e33050e7db62e77013afc03ebdc9e9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/predicate_internals.h @@ -0,0 +1,478 @@ +/*------------------------------------------------------------------------- + * + * predicate_internals.h + * POSTGRES internal predicate locking definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/predicate_internals.h + * + *------------------------------------------------------------------------- + */ +#ifndef PREDICATE_INTERNALS_H +#define PREDICATE_INTERNALS_H + +#include "lib/ilist.h" +#include "storage/lock.h" +#include "storage/lwlock.h" + +/* + * Commit number. + */ +typedef uint64 SerCommitSeqNo; + +/* + * Reserved commit sequence numbers: + * - 0 is reserved to indicate a non-existent SLRU entry; it cannot be + * used as a SerCommitSeqNo, even an invalid one + * - InvalidSerCommitSeqNo is used to indicate a transaction that + * hasn't committed yet, so use a number greater than all valid + * ones to make comparison do the expected thing + * - RecoverySerCommitSeqNo is used to refer to transactions that + * happened before a crash/recovery, since we restart the sequence + * at that point. It's earlier than all normal sequence numbers, + * and is only used by recovered prepared transactions + */ +#define InvalidSerCommitSeqNo ((SerCommitSeqNo) PG_UINT64_MAX) +#define RecoverySerCommitSeqNo ((SerCommitSeqNo) 1) +#define FirstNormalSerCommitSeqNo ((SerCommitSeqNo) 2) + +/* + * The SERIALIZABLEXACT struct contains information needed for each + * serializable database transaction to support SSI techniques. + * + * A home-grown list is maintained in shared memory to manage these. + * An entry is used when the serializable transaction acquires a snapshot. + * Unless the transaction is rolled back, this entry must generally remain + * until all concurrent transactions have completed. (There are special + * optimizations for READ ONLY transactions which often allow them to be + * cleaned up earlier.) A transaction which is rolled back is cleaned up + * as soon as possible. + * + * Eligibility for cleanup of committed transactions is generally determined + * by comparing the transaction's finishedBefore field to + * SxactGlobalXmin. + */ +typedef struct SERIALIZABLEXACT +{ + VirtualTransactionId vxid; /* The executing process always has one of + * these. */ + + /* + * We use two numbers to track the order that transactions commit. Before + * commit, a transaction is marked as prepared, and prepareSeqNo is set. + * Shortly after commit, it's marked as committed, and commitSeqNo is set. + * This doesn't give a strict commit order, but these two values together + * are good enough for us, as we can always err on the safe side and + * assume that there's a conflict, if we can't be sure of the exact + * ordering of two commits. + * + * Note that a transaction is marked as prepared for a short period during + * commit processing, even if two-phase commit is not used. But with + * two-phase commit, a transaction can stay in prepared state for some + * time. + */ + SerCommitSeqNo prepareSeqNo; + SerCommitSeqNo commitSeqNo; + + /* these values are not both interesting at the same time */ + union + { + SerCommitSeqNo earliestOutConflictCommit; /* when committed with + * conflict out */ + SerCommitSeqNo lastCommitBeforeSnapshot; /* when not committed or + * no conflict out */ + } SeqNo; + dlist_head outConflicts; /* list of write transactions whose data we + * couldn't read. */ + dlist_head inConflicts; /* list of read transactions which couldn't + * see our write. */ + dlist_head predicateLocks; /* list of associated PREDICATELOCK objects */ + dlist_node finishedLink; /* list link in + * FinishedSerializableTransactions */ + dlist_node xactLink; /* PredXact->activeList/availableList */ + + /* + * perXactPredicateListLock is only used in parallel queries: it protects + * this SERIALIZABLEXACT's predicate lock list against other workers of + * the same session. + */ + LWLock perXactPredicateListLock; + + /* + * for r/o transactions: list of concurrent r/w transactions that we could + * potentially have conflicts with, and vice versa for r/w transactions + */ + dlist_head possibleUnsafeConflicts; + + TransactionId topXid; /* top level xid for the transaction, if one + * exists; else invalid */ + TransactionId finishedBefore; /* invalid means still running; else the + * struct expires when no serializable + * xids are before this. */ + TransactionId xmin; /* the transaction's snapshot xmin */ + uint32 flags; /* OR'd combination of values defined below */ + int pid; /* pid of associated process */ + int pgprocno; /* pgprocno of associated process */ +} SERIALIZABLEXACT; + +#define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ +#define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ +#define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ +#define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ +/* + * The following flag actually means that the flagged transaction has a + * conflict out *to a transaction which committed ahead of it*. It's hard + * to get that into a name of a reasonable length. + */ +#define SXACT_FLAG_CONFLICT_OUT 0x00000010 +#define SXACT_FLAG_READ_ONLY 0x00000020 +#define SXACT_FLAG_DEFERRABLE_WAITING 0x00000040 +#define SXACT_FLAG_RO_SAFE 0x00000080 +#define SXACT_FLAG_RO_UNSAFE 0x00000100 +#define SXACT_FLAG_SUMMARY_CONFLICT_IN 0x00000200 +#define SXACT_FLAG_SUMMARY_CONFLICT_OUT 0x00000400 +/* + * The following flag means the transaction has been partially released + * already, but is being preserved because parallel workers might have a + * reference to it. It'll be recycled by the leader at end-of-transaction. + */ +#define SXACT_FLAG_PARTIALLY_RELEASED 0x00000800 + +typedef struct PredXactListData +{ + dlist_head availableList; + dlist_head activeList; + + /* + * These global variables are maintained when registering and cleaning up + * serializable transactions. They must be global across all backends, + * but are not needed outside the predicate.c source file. Protected by + * SerializableXactHashLock. + */ + TransactionId SxactGlobalXmin; /* global xmin for active serializable + * transactions */ + int SxactGlobalXminCount; /* how many active serializable + * transactions have this xmin */ + int WritableSxactCount; /* how many non-read-only serializable + * transactions are active */ + SerCommitSeqNo LastSxactCommitSeqNo; /* a strictly monotonically + * increasing number for commits + * of serializable transactions */ + /* Protected by SerializableXactHashLock. */ + SerCommitSeqNo CanPartialClearThrough; /* can clear predicate locks and + * inConflicts for committed + * transactions through this seq + * no */ + /* Protected by SerializableFinishedListLock. */ + SerCommitSeqNo HavePartialClearedThrough; /* have cleared through this + * seq no */ + SERIALIZABLEXACT *OldCommittedSxact; /* shared copy of dummy sxact */ + + SERIALIZABLEXACT *element; +} PredXactListData; + +typedef struct PredXactListData *PredXactList; + +#define PredXactListDataSize \ + ((Size)MAXALIGN(sizeof(PredXactListData))) + + +/* + * The following types are used to provide lists of rw-conflicts between + * pairs of transactions. Since exactly the same information is needed, + * they are also used to record possible unsafe transaction relationships + * for purposes of identifying safe snapshots for read-only transactions. + * + * When a RWConflictData is not in use to record either type of relationship + * between a pair of transactions, it is kept on an "available" list. The + * outLink field is used for maintaining that list. + */ +typedef struct RWConflictData +{ + dlist_node outLink; /* link for list of conflicts out from a sxact */ + dlist_node inLink; /* link for list of conflicts in to a sxact */ + SERIALIZABLEXACT *sxactOut; + SERIALIZABLEXACT *sxactIn; +} RWConflictData; + +typedef struct RWConflictData *RWConflict; + +#define RWConflictDataSize \ + ((Size)MAXALIGN(sizeof(RWConflictData))) + +typedef struct RWConflictPoolHeaderData +{ + dlist_head availableList; + RWConflict element; +} RWConflictPoolHeaderData; + +typedef struct RWConflictPoolHeaderData *RWConflictPoolHeader; + +#define RWConflictPoolHeaderDataSize \ + ((Size)MAXALIGN(sizeof(RWConflictPoolHeaderData))) + + +/* + * The SERIALIZABLEXIDTAG struct identifies an xid assigned to a serializable + * transaction or any of its subtransactions. + */ +typedef struct SERIALIZABLEXIDTAG +{ + TransactionId xid; +} SERIALIZABLEXIDTAG; + +/* + * The SERIALIZABLEXID struct provides a link from a TransactionId for a + * serializable transaction to the related SERIALIZABLEXACT record, even if + * the transaction has completed and its connection has been closed. + * + * These are created as new top level transaction IDs are first assigned to + * transactions which are participating in predicate locking. This may + * never happen for a particular transaction if it doesn't write anything. + * They are removed with their related serializable transaction objects. + * + * The SubTransGetTopmostTransaction method is used where necessary to get + * from an XID which might be from a subtransaction to the top level XID. + */ +typedef struct SERIALIZABLEXID +{ + /* hash key */ + SERIALIZABLEXIDTAG tag; + + /* data */ + SERIALIZABLEXACT *myXact; /* pointer to the top level transaction data */ +} SERIALIZABLEXID; + + +/* + * The PREDICATELOCKTARGETTAG struct identifies a database object which can + * be the target of predicate locks. + * + * Note that the hash function being used doesn't properly respect tag + * length -- if the length of the structure isn't a multiple of four bytes it + * will go to a four byte boundary past the end of the tag. If you change + * this struct, make sure any slack space is initialized, so that any random + * bytes in the middle or at the end are not included in the hash. + * + * TODO SSI: If we always use the same fields for the same type of value, we + * should rename these. Holding off until it's clear there are no exceptions. + * Since indexes are relations with blocks and tuples, it's looking likely that + * the rename will be possible. If not, we may need to divide the last field + * and use part of it for a target type, so that we know how to interpret the + * data.. + */ +typedef struct PREDICATELOCKTARGETTAG +{ + uint32 locktag_field1; /* a 32-bit ID field */ + uint32 locktag_field2; /* a 32-bit ID field */ + uint32 locktag_field3; /* a 32-bit ID field */ + uint32 locktag_field4; /* a 32-bit ID field */ +} PREDICATELOCKTARGETTAG; + +/* + * The PREDICATELOCKTARGET struct represents a database object on which there + * are predicate locks. + * + * A hash list of these objects is maintained in shared memory. An entry is + * added when a predicate lock is requested on an object which doesn't + * already have one. An entry is removed when the last lock is removed from + * its list. + */ +typedef struct PREDICATELOCKTARGET +{ + /* hash key */ + PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ + + /* data */ + dlist_head predicateLocks; /* list of PREDICATELOCK objects assoc. with + * predicate lock target */ +} PREDICATELOCKTARGET; + + +/* + * The PREDICATELOCKTAG struct identifies an individual predicate lock. + * + * It is the combination of predicate lock target (which is a lockable + * object) and a serializable transaction which has acquired a lock on that + * target. + */ +typedef struct PREDICATELOCKTAG +{ + PREDICATELOCKTARGET *myTarget; + SERIALIZABLEXACT *myXact; +} PREDICATELOCKTAG; + +/* + * The PREDICATELOCK struct represents an individual lock. + * + * An entry can be created here when the related database object is read, or + * by promotion of multiple finer-grained targets. All entries related to a + * serializable transaction are removed when that serializable transaction is + * cleaned up. Entries can also be removed when they are combined into a + * single coarser-grained lock entry. + */ +typedef struct PREDICATELOCK +{ + /* hash key */ + PREDICATELOCKTAG tag; /* unique identifier of lock */ + + /* data */ + dlist_node targetLink; /* list link in PREDICATELOCKTARGET's list of + * predicate locks */ + dlist_node xactLink; /* list link in SERIALIZABLEXACT's list of + * predicate locks */ + SerCommitSeqNo commitSeqNo; /* only used for summarized predicate locks */ +} PREDICATELOCK; + + +/* + * The LOCALPREDICATELOCK struct represents a local copy of data which is + * also present in the PREDICATELOCK table, organized for fast access without + * needing to acquire a LWLock. It is strictly for optimization. + * + * Each serializable transaction creates its own local hash table to hold a + * collection of these. This information is used to determine when a number + * of fine-grained locks should be promoted to a single coarser-grained lock. + * The information is maintained more-or-less in parallel to the + * PREDICATELOCK data, but because this data is not protected by locks and is + * only used in an optimization heuristic, it is allowed to drift in a few + * corner cases where maintaining exact data would be expensive. + * + * The hash table is created when the serializable transaction acquires its + * snapshot, and its memory is released upon completion of the transaction. + */ +typedef struct LOCALPREDICATELOCK +{ + /* hash key */ + PREDICATELOCKTARGETTAG tag; /* unique identifier of lockable object */ + + /* data */ + bool held; /* is lock held, or just its children? */ + int childLocks; /* number of child locks currently held */ +} LOCALPREDICATELOCK; + + +/* + * The types of predicate locks which can be acquired. + */ +typedef enum PredicateLockTargetType +{ + PREDLOCKTAG_RELATION, + PREDLOCKTAG_PAGE, + PREDLOCKTAG_TUPLE, + /* TODO SSI: Other types may be needed for index locking */ +} PredicateLockTargetType; + + +/* + * This structure is used to quickly capture a copy of all predicate + * locks. This is currently used only by the pg_lock_status function, + * which in turn is used by the pg_locks view. + */ +typedef struct PredicateLockData +{ + int nelements; + PREDICATELOCKTARGETTAG *locktags; + SERIALIZABLEXACT *xacts; +} PredicateLockData; + + +/* + * These macros define how we map logical IDs of lockable objects into the + * physical fields of PREDICATELOCKTARGETTAG. Use these to set up values, + * rather than accessing the fields directly. Note multiple eval of target! + */ +#define SET_PREDICATELOCKTARGETTAG_RELATION(locktag,dboid,reloid) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = InvalidBlockNumber, \ + (locktag).locktag_field4 = InvalidOffsetNumber) + +#define SET_PREDICATELOCKTARGETTAG_PAGE(locktag,dboid,reloid,blocknum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = InvalidOffsetNumber) + +#define SET_PREDICATELOCKTARGETTAG_TUPLE(locktag,dboid,reloid,blocknum,offnum) \ + ((locktag).locktag_field1 = (dboid), \ + (locktag).locktag_field2 = (reloid), \ + (locktag).locktag_field3 = (blocknum), \ + (locktag).locktag_field4 = (offnum)) + +#define GET_PREDICATELOCKTARGETTAG_DB(locktag) \ + ((Oid) (locktag).locktag_field1) +#define GET_PREDICATELOCKTARGETTAG_RELATION(locktag) \ + ((Oid) (locktag).locktag_field2) +#define GET_PREDICATELOCKTARGETTAG_PAGE(locktag) \ + ((BlockNumber) (locktag).locktag_field3) +#define GET_PREDICATELOCKTARGETTAG_OFFSET(locktag) \ + ((OffsetNumber) (locktag).locktag_field4) +#define GET_PREDICATELOCKTARGETTAG_TYPE(locktag) \ + (((locktag).locktag_field4 != InvalidOffsetNumber) ? PREDLOCKTAG_TUPLE : \ + (((locktag).locktag_field3 != InvalidBlockNumber) ? PREDLOCKTAG_PAGE : \ + PREDLOCKTAG_RELATION)) + +/* + * Two-phase commit statefile records. There are two types: for each + * transaction, we generate one per-transaction record and a variable + * number of per-predicate-lock records. + */ +typedef enum TwoPhasePredicateRecordType +{ + TWOPHASEPREDICATERECORD_XACT, + TWOPHASEPREDICATERECORD_LOCK, +} TwoPhasePredicateRecordType; + +/* + * Per-transaction information to reconstruct a SERIALIZABLEXACT. Not + * much is needed because most of it not meaningful for a recovered + * prepared transaction. + * + * In particular, we do not record the in and out conflict lists for a + * prepared transaction because the associated SERIALIZABLEXACTs will + * not be available after recovery. Instead, we simply record the + * existence of each type of conflict by setting the transaction's + * summary conflict in/out flag. + */ +typedef struct TwoPhasePredicateXactRecord +{ + TransactionId xmin; + uint32 flags; +} TwoPhasePredicateXactRecord; + +/* Per-lock state */ +typedef struct TwoPhasePredicateLockRecord +{ + PREDICATELOCKTARGETTAG target; + uint32 filler; /* to avoid length change in back-patched fix */ +} TwoPhasePredicateLockRecord; + +typedef struct TwoPhasePredicateRecord +{ + TwoPhasePredicateRecordType type; + union + { + TwoPhasePredicateXactRecord xactRecord; + TwoPhasePredicateLockRecord lockRecord; + } data; +} TwoPhasePredicateRecord; + +/* + * Define a macro to use for an "empty" SERIALIZABLEXACT reference. + */ +#define InvalidSerializableXact ((SERIALIZABLEXACT *) NULL) + + +/* + * Function definitions for functions needing awareness of predicate + * locking internals. + */ +extern PredicateLockData *GetPredicateLockStatusData(void); +extern int GetSafeSnapshotBlockingPids(int blocked_pid, + int *output, int output_size); + +#endif /* PREDICATE_INTERNALS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/proc.h b/platform/dbops/binaries/postgres/include/server/storage/proc.h new file mode 100644 index 0000000000000000000000000000000000000000..bf0a714d60e3761c7072037c429a157876b6c2b2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/proc.h @@ -0,0 +1,488 @@ +/*------------------------------------------------------------------------- + * + * proc.h + * per-process shared memory data structures + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/proc.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PROC_H_ +#define _PROC_H_ + +#include "access/clog.h" +#include "access/xlogdefs.h" +#include "lib/ilist.h" +#include "storage/latch.h" +#include "storage/lock.h" +#include "storage/pg_sema.h" +#include "storage/proclist_types.h" +#include "storage/procnumber.h" + +/* + * Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds + * for non-aborted subtransactions of its current top transaction. These + * have to be treated as running XIDs by other backends. + * + * We also keep track of whether the cache overflowed (ie, the transaction has + * generated at least one subtransaction that didn't fit in the cache). + * If none of the caches have overflowed, we can assume that an XID that's not + * listed anywhere in the PGPROC array is not a running transaction. Else we + * have to look at pg_subtrans. + * + * See src/test/isolation/specs/subxid-overflow.spec if you change this. + */ +#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */ + +typedef struct XidCacheStatus +{ + /* number of cached subxids, never more than PGPROC_MAX_CACHED_SUBXIDS */ + uint8 count; + /* has PGPROC->subxids overflowed */ + bool overflowed; +} XidCacheStatus; + +struct XidCache +{ + TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS]; +}; + +/* + * Flags for PGPROC->statusFlags and PROC_HDR->statusFlags[] + */ +#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */ +#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */ +#define PROC_IN_SAFE_IC 0x04 /* currently running CREATE INDEX + * CONCURRENTLY or REINDEX + * CONCURRENTLY on non-expressional, + * non-partial index */ +#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */ +#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical + * decoding outside xact */ +#define PROC_AFFECTS_ALL_HORIZONS 0x20 /* this proc's xmin must be + * included in vacuum horizons + * in all databases */ + +/* flags reset at EOXact */ +#define PROC_VACUUM_STATE_MASK \ + (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) + +/* + * Xmin-related flags. Make sure any flags that affect how the process' Xmin + * value is interpreted by VACUUM are included here. + */ +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) + +/* + * We allow a small number of "weak" relation locks (AccessShareLock, + * RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure + * rather than the main lock table. This eases contention on the lock + * manager LWLocks. See storage/lmgr/README for additional details. + */ +#define FP_LOCK_SLOTS_PER_BACKEND 16 + +/* + * Flags for PGPROC.delayChkptFlags + * + * These flags can be used to delay the start or completion of a checkpoint + * for short periods. A flag is in effect if the corresponding bit is set in + * the PGPROC of any backend. + * + * For our purposes here, a checkpoint has three phases: (1) determine the + * location to which the redo pointer will be moved, (2) write all the + * data durably to disk, and (3) WAL-log the checkpoint. + * + * Setting DELAY_CHKPT_START prevents the system from moving from phase 1 + * to phase 2. This is useful when we are performing a WAL-logged modification + * of data that will be flushed to disk in phase 2. By setting this flag + * before writing WAL and clearing it after we've both written WAL and + * performed the corresponding modification, we ensure that if the WAL record + * is inserted prior to the new redo point, the corresponding data changes will + * also be flushed to disk before the checkpoint can complete. (In the + * extremely common case where the data being modified is in shared buffers + * and we acquire an exclusive content lock on the relevant buffers before + * writing WAL, this mechanism is not needed, because phase 2 will block + * until we release the content lock and then flush the modified data to + * disk.) + * + * Setting DELAY_CHKPT_COMPLETE prevents the system from moving from phase 2 + * to phase 3. This is useful if we are performing a WAL-logged operation that + * might invalidate buffers, such as relation truncation. In this case, we need + * to ensure that any buffers which were invalidated and thus not flushed by + * the checkpoint are actually destroyed on disk. Replay can cope with a file + * or block that doesn't exist, but not with a block that has the wrong + * contents. + */ +#define DELAY_CHKPT_START (1<<0) +#define DELAY_CHKPT_COMPLETE (1<<1) + +typedef enum +{ + PROC_WAIT_STATUS_OK, + PROC_WAIT_STATUS_WAITING, + PROC_WAIT_STATUS_ERROR, +} ProcWaitStatus; + +/* + * Each backend has a PGPROC struct in shared memory. There is also a list of + * currently-unused PGPROC structs that will be reallocated to new backends. + * + * links: list link for any list the PGPROC is in. When waiting for a lock, + * the PGPROC is linked into that lock's waitProcs queue. A recycled PGPROC + * is linked into ProcGlobal's freeProcs list. + * + * Note: twophase.c also sets up a dummy PGPROC struct for each currently + * prepared transaction. These PGPROCs appear in the ProcArray data structure + * so that the prepared transactions appear to be still running and are + * correctly shown as holding locks. A prepared transaction PGPROC can be + * distinguished from a real one at need by the fact that it has pid == 0. + * The semaphore and lock-activity fields in a prepared-xact PGPROC are unused, + * but its myProcLocks[] lists are valid. + * + * We allow many fields of this struct to be accessed without locks, such as + * delayChkptFlags and isBackgroundWorker. However, keep in mind that writing + * mirrored ones (see below) requires holding ProcArrayLock or XidGenLock in + * at least shared mode, so that pgxactoff does not change concurrently. + * + * Mirrored fields: + * + * Some fields in PGPROC (see "mirrored in ..." comment) are mirrored into an + * element of more densely packed ProcGlobal arrays. These arrays are indexed + * by PGPROC->pgxactoff. Both copies need to be maintained coherently. + * + * NB: The pgxactoff indexed value can *never* be accessed without holding + * locks. + * + * See PROC_HDR for details. + */ +struct PGPROC +{ + /* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */ + dlist_node links; /* list link if process is in a list */ + dlist_head *procgloballist; /* procglobal list that owns this PGPROC */ + + PGSemaphore sem; /* ONE semaphore to sleep on */ + ProcWaitStatus waitStatus; + + Latch procLatch; /* generic latch for process */ + + + TransactionId xid; /* id of top-level transaction currently being + * executed by this proc, if running and XID + * is assigned; else InvalidTransactionId. + * mirrored in ProcGlobal->xids[pgxactoff] */ + + TransactionId xmin; /* minimal running XID as it was when we were + * starting our xact, excluding LAZY VACUUM: + * vacuum must not remove tuples deleted by + * xid >= xmin ! */ + + int pid; /* Backend's process ID; 0 if prepared xact */ + + int pgxactoff; /* offset into various ProcGlobal->arrays with + * data mirrored from this PGPROC */ + + /* + * Currently running top-level transaction's virtual xid. Together these + * form a VirtualTransactionId, but we don't use that struct because this + * is not atomically assignable as whole, and we want to enforce code to + * consider both parts separately. See comments at VirtualTransactionId. + */ + struct + { + ProcNumber procNumber; /* For regular backends, equal to + * GetNumberFromPGProc(proc). For prepared + * xacts, ID of the original backend that + * processed the transaction. For unused + * PGPROC entries, INVALID_PROC_NUMBER. */ + LocalTransactionId lxid; /* local id of top-level transaction + * currently * being executed by this + * proc, if running; else + * InvalidLocalTransactionId */ + } vxid; + + /* These fields are zero while a backend is still starting up: */ + Oid databaseId; /* OID of database this backend is using */ + Oid roleId; /* OID of role using this backend */ + + Oid tempNamespaceId; /* OID of temp schema this backend is + * using */ + + bool isBackgroundWorker; /* true if not a regular backend. */ + + /* + * While in hot standby mode, shows that a conflict signal has been sent + * for the current transaction. Set/cleared while holding ProcArrayLock, + * though not required. Accessed without lock, if needed. + */ + bool recoveryConflictPending; + + /* Info about LWLock the process is currently waiting for, if any. */ + uint8 lwWaiting; /* see LWLockWaitState */ + uint8 lwWaitMode; /* lwlock mode being waited for */ + proclist_node lwWaitLink; /* position in LW lock wait list */ + + /* Support for condition variables. */ + proclist_node cvWaitLink; /* position in CV wait list */ + + /* Info about lock the process is currently waiting for, if any. */ + /* waitLock and waitProcLock are NULL if not currently waiting. */ + LOCK *waitLock; /* Lock object we're sleeping on ... */ + PROCLOCK *waitProcLock; /* Per-holder info for awaited lock */ + LOCKMODE waitLockMode; /* type of lock we're waiting for */ + LOCKMASK heldLocks; /* bitmask for lock types already held on this + * lock object by this backend */ + pg_atomic_uint64 waitStart; /* time at which wait for lock acquisition + * started */ + + int delayChkptFlags; /* for DELAY_CHKPT_* flags */ + + uint8 statusFlags; /* this backend's status flags, see PROC_* + * above. mirrored in + * ProcGlobal->statusFlags[pgxactoff] */ + + /* + * Info to allow us to wait for synchronous replication, if needed. + * waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend. + * syncRepState must not be touched except by owning process or WALSender. + * syncRepLinks used only while holding SyncRepLock. + */ + XLogRecPtr waitLSN; /* waiting for this LSN or higher */ + int syncRepState; /* wait state for sync rep */ + dlist_node syncRepLinks; /* list link if process is in syncrep queue */ + + /* + * All PROCLOCK objects for locks held or awaited by this backend are + * linked into one of these lists, according to the partition number of + * their lock. + */ + dlist_head myProcLocks[NUM_LOCK_PARTITIONS]; + + XidCacheStatus subxidStatus; /* mirrored with + * ProcGlobal->subxidStates[i] */ + struct XidCache subxids; /* cache for subtransaction XIDs */ + + /* Support for group XID clearing. */ + /* true, if member of ProcArray group waiting for XID clear */ + bool procArrayGroupMember; + /* next ProcArray group member waiting for XID clear */ + pg_atomic_uint32 procArrayGroupNext; + + /* + * latest transaction id among the transaction's main XID and + * subtransactions + */ + TransactionId procArrayGroupMemberXid; + + uint32 wait_event_info; /* proc's wait information */ + + /* Support for group transaction status update. */ + bool clogGroupMember; /* true, if member of clog group */ + pg_atomic_uint32 clogGroupNext; /* next clog group member */ + TransactionId clogGroupMemberXid; /* transaction id of clog group member */ + XidStatus clogGroupMemberXidStatus; /* transaction status of clog + * group member */ + int64 clogGroupMemberPage; /* clog page corresponding to + * transaction id of clog group member */ + XLogRecPtr clogGroupMemberLsn; /* WAL location of commit record for clog + * group member */ + + /* Lock manager data, recording fast-path locks taken by this backend. */ + LWLock fpInfoLock; /* protects per-backend fast-path state */ + uint64 fpLockBits; /* lock modes held for each fast-path slot */ + Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */ + bool fpVXIDLock; /* are we holding a fast-path VXID lock? */ + LocalTransactionId fpLocalTransactionId; /* lxid for fast-path VXID + * lock */ + + /* + * Support for lock groups. Use LockHashPartitionLockByProc on the group + * leader to get the LWLock protecting these fields. + */ + PGPROC *lockGroupLeader; /* lock group leader, if I'm a member */ + dlist_head lockGroupMembers; /* list of members, if I'm a leader */ + dlist_node lockGroupLink; /* my member link, if I'm a member */ +}; + +/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */ + + +extern PGDLLIMPORT PGPROC *MyProc; + +/* + * There is one ProcGlobal struct for the whole database cluster. + * + * Adding/Removing an entry into the procarray requires holding *both* + * ProcArrayLock and XidGenLock in exclusive mode (in that order). Both are + * needed because the dense arrays (see below) are accessed from + * GetNewTransactionId() and GetSnapshotData(), and we don't want to add + * further contention by both using the same lock. Adding/Removing a procarray + * entry is much less frequent. + * + * Some fields in PGPROC are mirrored into more densely packed arrays (e.g. + * xids), with one entry for each backend. These arrays only contain entries + * for PGPROCs that have been added to the shared array with ProcArrayAdd() + * (in contrast to PGPROC array which has unused PGPROCs interspersed). + * + * The dense arrays are indexed by PGPROC->pgxactoff. Any concurrent + * ProcArrayAdd() / ProcArrayRemove() can lead to pgxactoff of a procarray + * member to change. Therefore it is only safe to use PGPROC->pgxactoff to + * access the dense array while holding either ProcArrayLock or XidGenLock. + * + * As long as a PGPROC is in the procarray, the mirrored values need to be + * maintained in both places in a coherent manner. + * + * The denser separate arrays are beneficial for three main reasons: First, to + * allow for as tight loops accessing the data as possible. Second, to prevent + * updates of frequently changing data (e.g. xmin) from invalidating + * cachelines also containing less frequently changing data (e.g. xid, + * statusFlags). Third to condense frequently accessed data into as few + * cachelines as possible. + * + * There are two main reasons to have the data mirrored between these dense + * arrays and PGPROC. First, as explained above, a PGPROC's array entries can + * only be accessed with either ProcArrayLock or XidGenLock held, whereas the + * PGPROC entries do not require that (obviously there may still be locking + * requirements around the individual field, separate from the concerns + * here). That is particularly important for a backend to efficiently checks + * it own values, which it often can safely do without locking. Second, the + * PGPROC fields allow to avoid unnecessary accesses and modification to the + * dense arrays. A backend's own PGPROC is more likely to be in a local cache, + * whereas the cachelines for the dense array will be modified by other + * backends (often removing it from the cache for other cores/sockets). At + * commit/abort time a check of the PGPROC value can avoid accessing/dirtying + * the corresponding array value. + * + * Basically it makes sense to access the PGPROC variable when checking a + * single backend's data, especially when already looking at the PGPROC for + * other reasons already. It makes sense to look at the "dense" arrays if we + * need to look at many / most entries, because we then benefit from the + * reduced indirection and better cross-process cache-ability. + * + * When entering a PGPROC for 2PC transactions with ProcArrayAdd(), the data + * in the dense arrays is initialized from the PGPROC while it already holds + * ProcArrayLock. + */ +typedef struct PROC_HDR +{ + /* Array of PGPROC structures (not including dummies for prepared txns) */ + PGPROC *allProcs; + + /* Array mirroring PGPROC.xid for each PGPROC currently in the procarray */ + TransactionId *xids; + + /* + * Array mirroring PGPROC.subxidStatus for each PGPROC currently in the + * procarray. + */ + XidCacheStatus *subxidStates; + + /* + * Array mirroring PGPROC.statusFlags for each PGPROC currently in the + * procarray. + */ + uint8 *statusFlags; + + /* Length of allProcs array */ + uint32 allProcCount; + /* Head of list of free PGPROC structures */ + dlist_head freeProcs; + /* Head of list of autovacuum & special worker free PGPROC structures */ + dlist_head autovacFreeProcs; + /* Head of list of bgworker free PGPROC structures */ + dlist_head bgworkerFreeProcs; + /* Head of list of walsender free PGPROC structures */ + dlist_head walsenderFreeProcs; + /* First pgproc waiting for group XID clear */ + pg_atomic_uint32 procArrayGroupFirst; + /* First pgproc waiting for group transaction status update */ + pg_atomic_uint32 clogGroupFirst; + /* WALWriter process's latch */ + Latch *walwriterLatch; + /* Checkpointer process's latch */ + Latch *checkpointerLatch; + /* Current shared estimate of appropriate spins_per_delay value */ + int spins_per_delay; + /* Buffer id of the buffer that Startup process waits for pin on, or -1 */ + int startupBufferPinWaitBufId; +} PROC_HDR; + +extern PGDLLIMPORT PROC_HDR *ProcGlobal; + +extern PGDLLIMPORT PGPROC *PreparedXactProcs; + +/* + * Accessors for getting PGPROC given a ProcNumber and vice versa. + */ +#define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)]) +#define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0]) + +/* + * We set aside some extra PGPROC structures for "special worker" processes, + * which are full-fledged backends (they can run transactions) + * but are unique animals that there's never more than one of. + * Currently there are two such processes: the autovacuum launcher + * and the slotsync worker. + */ +#define NUM_SPECIAL_WORKER_PROCS 2 + +/* + * We set aside some extra PGPROC structures for auxiliary processes, + * ie things that aren't full-fledged backends (they cannot run transactions + * or take heavyweight locks) but need shmem access. + * + * Background writer, checkpointer, WAL writer, WAL summarizer, and archiver + * run during normal operation. Startup process and WAL receiver also consume + * 2 slots, but WAL writer is launched only after startup has exited, so we + * only need 6 slots. + */ +#define NUM_AUXILIARY_PROCS 6 + +/* configurable options */ +extern PGDLLIMPORT int DeadlockTimeout; +extern PGDLLIMPORT int StatementTimeout; +extern PGDLLIMPORT int LockTimeout; +extern PGDLLIMPORT int IdleInTransactionSessionTimeout; +extern PGDLLIMPORT int TransactionTimeout; +extern PGDLLIMPORT int IdleSessionTimeout; +extern PGDLLIMPORT bool log_lock_waits; + + +/* + * Function Prototypes + */ +extern int ProcGlobalSemas(void); +extern Size ProcGlobalShmemSize(void); +extern void InitProcGlobal(void); +extern void InitProcess(void); +extern void InitProcessPhase2(void); +extern void InitAuxiliaryProcess(void); + +extern void SetStartupBufferPinWaitBufId(int bufid); +extern int GetStartupBufferPinWaitBufId(void); + +extern bool HaveNFreeProcs(int n, int *nfree); +extern void ProcReleaseLocks(bool isCommit); + +extern ProcWaitStatus ProcSleep(LOCALLOCK *locallock, + LockMethod lockMethodTable, + bool dontWait); +extern void ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus); +extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock); +extern void CheckDeadLockAlert(void); +extern bool IsWaitingForLock(void); +extern void LockErrorCleanup(void); + +extern void ProcWaitForSignal(uint32 wait_event_info); +extern void ProcSendSignal(ProcNumber procNumber); + +extern PGPROC *AuxiliaryPidGetProc(int pid); + +extern void BecomeLockGroupLeader(void); +extern bool BecomeLockGroupMember(PGPROC *leader, int pid); + +#endif /* _PROC_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/procarray.h b/platform/dbops/binaries/postgres/include/server/storage/procarray.h new file mode 100644 index 0000000000000000000000000000000000000000..8ca6050462252d5936258fb2d664e11d868c1760 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/procarray.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * procarray.h + * POSTGRES process array definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procarray.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCARRAY_H +#define PROCARRAY_H + +#include "storage/lock.h" +#include "storage/standby.h" +#include "utils/relcache.h" +#include "utils/snapshot.h" + + +extern Size ProcArrayShmemSize(void); +extern void CreateSharedProcArray(void); +extern void ProcArrayAdd(PGPROC *proc); +extern void ProcArrayRemove(PGPROC *proc, TransactionId latestXid); + +extern void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid); +extern void ProcArrayClearTransaction(PGPROC *proc); + +extern void ProcArrayInitRecovery(TransactionId initializedUptoXID); +extern void ProcArrayApplyRecoveryInfo(RunningTransactions running); +extern void ProcArrayApplyXidAssignment(TransactionId topxid, + int nsubxids, TransactionId *subxids); + +extern void RecordKnownAssignedTransactionIds(TransactionId xid); +extern void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, + int nsubxids, TransactionId *subxids, + TransactionId max_xid); +extern void ExpireAllKnownAssignedTransactionIds(void); +extern void ExpireOldKnownAssignedTransactionIds(TransactionId xid); +extern void KnownAssignedTransactionIdsIdleMaintenance(void); + +extern int GetMaxSnapshotXidCount(void); +extern int GetMaxSnapshotSubxidCount(void); + +extern Snapshot GetSnapshotData(Snapshot snapshot); + +extern bool ProcArrayInstallImportedXmin(TransactionId xmin, + VirtualTransactionId *sourcevxid); +extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc); + +extern RunningTransactions GetRunningTransactionData(void); + +extern bool TransactionIdIsInProgress(TransactionId xid); +extern bool TransactionIdIsActive(TransactionId xid); +extern TransactionId GetOldestNonRemovableTransactionId(Relation rel); +extern TransactionId GetOldestTransactionIdConsideredRunning(void); +extern TransactionId GetOldestActiveTransactionId(void); +extern TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly); +extern void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin); + +extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int *nvxids, int type); +extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, + int nvxids, int type); + +extern PGPROC *ProcNumberGetProc(int procNumber); +extern void ProcNumberGetTransactionIds(int procNumber, TransactionId *xid, + TransactionId *xmin, int *nsubxid, + bool *overflowed); +extern PGPROC *BackendPidGetProc(int pid); +extern PGPROC *BackendPidGetProcWithLock(int pid); +extern int BackendXidGetPid(TransactionId xid); +extern bool IsBackendPid(int pid); + +extern VirtualTransactionId *GetCurrentVirtualXIDs(TransactionId limitXmin, + bool excludeXmin0, bool allDbs, int excludeVacuum, + int *nvxids); +extern VirtualTransactionId *GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid); +extern pid_t CancelVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode); +extern pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReason sigmode, + bool conflictPending); + +extern bool MinimumActiveBackends(int min); +extern int CountDBBackends(Oid databaseid); +extern int CountDBConnections(Oid databaseid); +extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending); +extern int CountUserBackends(Oid roleid); +extern bool CountOtherDBBackends(Oid databaseId, + int *nbackends, int *nprepared); +extern void TerminateOtherDBBackends(Oid databaseId); + +extern void XidCacheRemoveRunningXids(TransactionId xid, + int nxids, const TransactionId *xids, + TransactionId latestXid); + +extern void ProcArraySetReplicationSlotXmin(TransactionId xmin, + TransactionId catalog_xmin, bool already_locked); + +extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, + TransactionId *catalog_xmin); + +#endif /* PROCARRAY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/proclist.h b/platform/dbops/binaries/postgres/include/server/storage/proclist.h new file mode 100644 index 0000000000000000000000000000000000000000..34a1b7dcab56ef3d6d07ac3dc8fa8c24528ccfa4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/proclist.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------- + * + * proclist.h + * operations on doubly-linked lists of pgprocnos + * + * The interface is similar to dlist from ilist.h, but uses pgprocno instead + * of pointers. This allows proclist_head to be mapped at different addresses + * in different backends. + * + * See proclist_types.h for the structs that these functions operate on. They + * are separated to break a header dependency cycle with proc.h. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/storage/proclist.h + *------------------------------------------------------------------------- + */ +#ifndef PROCLIST_H +#define PROCLIST_H + +#include "storage/proc.h" +#include "storage/proclist_types.h" + +/* + * Initialize a proclist. + */ +static inline void +proclist_init(proclist_head *list) +{ + list->head = list->tail = INVALID_PROC_NUMBER; +} + +/* + * Is the list empty? + */ +static inline bool +proclist_is_empty(const proclist_head *list) +{ + return list->head == INVALID_PROC_NUMBER; +} + +/* + * Get a pointer to a proclist_node inside a given PGPROC, given a procno and + * the proclist_node field's offset within struct PGPROC. + */ +static inline proclist_node * +proclist_node_get(int procno, size_t node_offset) +{ + char *entry = (char *) GetPGProcByNumber(procno); + + return (proclist_node *) (entry + node_offset); +} + +/* + * Insert a process at the beginning of a list. + */ +static inline void +proclist_push_head_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next == 0 && node->prev == 0); + + if (list->head == INVALID_PROC_NUMBER) + { + Assert(list->tail == INVALID_PROC_NUMBER); + node->next = node->prev = INVALID_PROC_NUMBER; + list->head = list->tail = procno; + } + else + { + Assert(list->tail != INVALID_PROC_NUMBER); + Assert(list->head != procno); + Assert(list->tail != procno); + node->next = list->head; + proclist_node_get(node->next, node_offset)->prev = procno; + node->prev = INVALID_PROC_NUMBER; + list->head = procno; + } +} + +/* + * Insert a process at the end of a list. + */ +static inline void +proclist_push_tail_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next == 0 && node->prev == 0); + + if (list->tail == INVALID_PROC_NUMBER) + { + Assert(list->head == INVALID_PROC_NUMBER); + node->next = node->prev = INVALID_PROC_NUMBER; + list->head = list->tail = procno; + } + else + { + Assert(list->head != INVALID_PROC_NUMBER); + Assert(list->head != procno); + Assert(list->tail != procno); + node->prev = list->tail; + proclist_node_get(node->prev, node_offset)->next = procno; + node->next = INVALID_PROC_NUMBER; + list->tail = procno; + } +} + +/* + * Delete a process from a list --- it must be in the list! + */ +static inline void +proclist_delete_offset(proclist_head *list, int procno, size_t node_offset) +{ + proclist_node *node = proclist_node_get(procno, node_offset); + + Assert(node->next != 0 || node->prev != 0); + + if (node->prev == INVALID_PROC_NUMBER) + { + Assert(list->head == procno); + list->head = node->next; + } + else + proclist_node_get(node->prev, node_offset)->next = node->next; + + if (node->next == INVALID_PROC_NUMBER) + { + Assert(list->tail == procno); + list->tail = node->prev; + } + else + proclist_node_get(node->next, node_offset)->prev = node->prev; + + node->next = node->prev = 0; +} + +/* + * Check if a process is currently in a list. It must be known that the + * process is not in any _other_ proclist that uses the same proclist_node, + * so that the only possibilities are that it is in this list or none. + */ +static inline bool +proclist_contains_offset(const proclist_head *list, int procno, + size_t node_offset) +{ + const proclist_node *node = proclist_node_get(procno, node_offset); + + /* If it's not in any list, it's definitely not in this one. */ + if (node->prev == 0 && node->next == 0) + return false; + + /* + * It must, in fact, be in this list. Ideally, in assert-enabled builds, + * we'd verify that. But since this function is typically used while + * holding a spinlock, crawling the whole list is unacceptable. However, + * we can verify matters in O(1) time when the node is a list head or + * tail, and that seems worth doing, since in practice that should often + * be enough to catch mistakes. + */ + Assert(node->prev != INVALID_PROC_NUMBER || list->head == procno); + Assert(node->next != INVALID_PROC_NUMBER || list->tail == procno); + + return true; +} + +/* + * Remove and return the first process from a list (there must be one). + */ +static inline PGPROC * +proclist_pop_head_node_offset(proclist_head *list, size_t node_offset) +{ + PGPROC *proc; + + Assert(!proclist_is_empty(list)); + proc = GetPGProcByNumber(list->head); + proclist_delete_offset(list, list->head, node_offset); + return proc; +} + +/* + * Helper macros to avoid repetition of offsetof(PGPROC, ). + * 'link_member' is the name of a proclist_node member in PGPROC. + */ +#define proclist_delete(list, procno, link_member) \ + proclist_delete_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_push_head(list, procno, link_member) \ + proclist_push_head_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_push_tail(list, procno, link_member) \ + proclist_push_tail_offset((list), (procno), offsetof(PGPROC, link_member)) +#define proclist_pop_head_node(list, link_member) \ + proclist_pop_head_node_offset((list), offsetof(PGPROC, link_member)) +#define proclist_contains(list, procno, link_member) \ + proclist_contains_offset((list), (procno), offsetof(PGPROC, link_member)) + +/* + * Iterate through the list pointed at by 'lhead', storing the current + * position in 'iter'. 'link_member' is the name of a proclist_node member in + * PGPROC. Access the current position with iter.cur. + * + * The only list modification allowed while iterating is deleting the current + * node with proclist_delete(list, iter.cur, node_offset). + */ +#define proclist_foreach_modify(iter, lhead, link_member) \ + for (AssertVariableIsOfTypeMacro(iter, proclist_mutable_iter), \ + AssertVariableIsOfTypeMacro(lhead, proclist_head *), \ + (iter).cur = (lhead)->head, \ + (iter).next = (iter).cur == INVALID_PROC_NUMBER ? INVALID_PROC_NUMBER : \ + proclist_node_get((iter).cur, \ + offsetof(PGPROC, link_member))->next; \ + (iter).cur != INVALID_PROC_NUMBER; \ + (iter).cur = (iter).next, \ + (iter).next = (iter).cur == INVALID_PROC_NUMBER ? INVALID_PROC_NUMBER : \ + proclist_node_get((iter).cur, \ + offsetof(PGPROC, link_member))->next) + +#endif /* PROCLIST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/proclist_types.h b/platform/dbops/binaries/postgres/include/server/storage/proclist_types.h new file mode 100644 index 0000000000000000000000000000000000000000..a4fb88c1d0de37e1b5c9315ffedda42f07ac1f10 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/proclist_types.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * proclist_types.h + * doubly-linked lists of pgprocnos + * + * See proclist.h for functions that operate on these types. + * + * Portions Copyright (c) 2016-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/storage/proclist_types.h + *------------------------------------------------------------------------- + */ + +#ifndef PROCLIST_TYPES_H +#define PROCLIST_TYPES_H + +#include "storage/procnumber.h" + +/* + * A node in a doubly-linked list of processes. The link fields contain + * the 0-based PGPROC indexes of the next and previous process, or + * INVALID_PROC_NUMBER in the next-link of the last node and the prev-link + * of the first node. A node that is currently not in any list + * should have next == prev == 0; this is not a possible state for a node + * that is in a list, because we disallow circularity. + */ +typedef struct proclist_node +{ + ProcNumber next; /* pgprocno of the next PGPROC */ + ProcNumber prev; /* pgprocno of the prev PGPROC */ +} proclist_node; + +/* + * Header of a doubly-linked list of PGPROCs, identified by pgprocno. + * An empty list is represented by head == tail == INVALID_PROC_NUMBER. + */ +typedef struct proclist_head +{ + ProcNumber head; /* pgprocno of the head PGPROC */ + ProcNumber tail; /* pgprocno of the tail PGPROC */ +} proclist_head; + +/* + * List iterator allowing some modifications while iterating. + */ +typedef struct proclist_mutable_iter +{ + ProcNumber cur; /* pgprocno of the current PGPROC */ + ProcNumber next; /* pgprocno of the next PGPROC */ +} proclist_mutable_iter; + +#endif /* PROCLIST_TYPES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/procnumber.h b/platform/dbops/binaries/postgres/include/server/storage/procnumber.h new file mode 100644 index 0000000000000000000000000000000000000000..49eb0e215ccad092456b42f1ca5c5f6e85a439d0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/procnumber.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * procnumber.h + * definition of process number + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procnumber.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCNUMBER_H +#define PROCNUMBER_H + +/* + * ProcNumber uniquely identifies an active backend or auxiliary process. + * It's assigned at backend startup after authentication, when the process + * adds itself to the proc array. It is an index into the proc array, + * starting from 0. Note that a ProcNumber can be reused for a different + * backend immediately after a backend exits. + */ +typedef int ProcNumber; + +#define INVALID_PROC_NUMBER (-1) + +/* + * Proc number of this backend (same as GetNumberFromPGProc(MyProc)) + */ +extern PGDLLIMPORT ProcNumber MyProcNumber; + +/* proc number of our parallel session leader, or INVALID_PROC_NUMBER if none */ +extern PGDLLIMPORT ProcNumber ParallelLeaderProcNumber; + +/* + * The ProcNumber to use for our session's temp relations is normally our own, + * but parallel workers should use their leader's proc number. + */ +#define ProcNumberForTempRelations() \ + (ParallelLeaderProcNumber == INVALID_PROC_NUMBER ? MyProcNumber : ParallelLeaderProcNumber) + +#endif /* PROCNUMBER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/procsignal.h b/platform/dbops/binaries/postgres/include/server/storage/procsignal.h new file mode 100644 index 0000000000000000000000000000000000000000..7d290ea7d05ccf1725b686a7cf46b1dfcbe435bb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/procsignal.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * procsignal.h + * Routines for interprocess signaling + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/procsignal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PROCSIGNAL_H +#define PROCSIGNAL_H + +#include "storage/procnumber.h" + + +/* + * Reasons for signaling a Postgres child process (a backend or an auxiliary + * process, like checkpointer). We can cope with concurrent signals for different + * reasons. However, if the same reason is signaled multiple times in quick + * succession, the process is likely to observe only one notification of it. + * This is okay for the present uses. + * + * Also, because of race conditions, it's important that all the signals be + * defined so that no harm is done if a process mistakenly receives one. + */ +typedef enum +{ + PROCSIG_CATCHUP_INTERRUPT, /* sinval catchup interrupt */ + PROCSIG_NOTIFY_INTERRUPT, /* listen/notify interrupt */ + PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */ + PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */ + PROCSIG_BARRIER, /* global barrier interrupt */ + PROCSIG_LOG_MEMORY_CONTEXT, /* ask backend to log the memory contexts */ + PROCSIG_PARALLEL_APPLY_MESSAGE, /* Message from parallel apply workers */ + + /* Recovery conflict reasons */ + PROCSIG_RECOVERY_CONFLICT_FIRST, + PROCSIG_RECOVERY_CONFLICT_DATABASE = PROCSIG_RECOVERY_CONFLICT_FIRST, + PROCSIG_RECOVERY_CONFLICT_TABLESPACE, + PROCSIG_RECOVERY_CONFLICT_LOCK, + PROCSIG_RECOVERY_CONFLICT_SNAPSHOT, + PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT, + PROCSIG_RECOVERY_CONFLICT_BUFFERPIN, + PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, + PROCSIG_RECOVERY_CONFLICT_LAST = PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, + + NUM_PROCSIGNALS /* Must be last! */ +} ProcSignalReason; + +typedef enum +{ + PROCSIGNAL_BARRIER_SMGRRELEASE, /* ask smgr to close files */ +} ProcSignalBarrierType; + +/* + * prototypes for functions in procsignal.c + */ +extern Size ProcSignalShmemSize(void); +extern void ProcSignalShmemInit(void); + +extern void ProcSignalInit(void); +extern int SendProcSignal(pid_t pid, ProcSignalReason reason, + ProcNumber procNumber); + +extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type); +extern void WaitForProcSignalBarrier(uint64 generation); +extern void ProcessProcSignalBarrier(void); + +extern void procsignal_sigusr1_handler(SIGNAL_ARGS); + +#endif /* PROCSIGNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/read_stream.h b/platform/dbops/binaries/postgres/include/server/storage/read_stream.h new file mode 100644 index 0000000000000000000000000000000000000000..7b9005e87bc46467cebf6ae67167789ad3bea9f2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/read_stream.h @@ -0,0 +1,65 @@ +/*------------------------------------------------------------------------- + * + * read_stream.h + * Mechanism for accessing buffered relation data with look-ahead + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/read_stream.h + * + *------------------------------------------------------------------------- + */ +#ifndef READ_STREAM_H +#define READ_STREAM_H + +#include "storage/bufmgr.h" + +/* Default tuning, reasonable for many users. */ +#define READ_STREAM_DEFAULT 0x00 + +/* + * I/O streams that are performing maintenance work on behalf of potentially + * many users, and thus should be governed by maintenance_io_concurrency + * instead of effective_io_concurrency. For example, VACUUM or CREATE INDEX. + */ +#define READ_STREAM_MAINTENANCE 0x01 + +/* + * We usually avoid issuing prefetch advice automatically when sequential + * access is detected, but this flag explicitly disables it, for cases that + * might not be correctly detected. Explicit advice is known to perform worse + * than letting the kernel (at least Linux) detect sequential access. + */ +#define READ_STREAM_SEQUENTIAL 0x02 + +/* + * We usually ramp up from smaller reads to larger ones, to support users who + * don't know if it's worth reading lots of buffers yet. This flag disables + * that, declaring ahead of time that we'll be reading all available buffers. + */ +#define READ_STREAM_FULL 0x04 + +struct ReadStream; +typedef struct ReadStream ReadStream; + +/* Callback that returns the next block number to read. */ +typedef BlockNumber (*ReadStreamBlockNumberCB) (ReadStream *stream, + void *callback_private_data, + void *per_buffer_data); + +extern ReadStream *read_stream_begin_relation(int flags, + BufferAccessStrategy strategy, + Relation rel, + ForkNumber forknum, + ReadStreamBlockNumberCB callback, + void *callback_private_data, + size_t per_buffer_data_size); +extern Buffer read_stream_next_buffer(ReadStream *stream, void **per_buffer_data); +extern BlockNumber read_stream_next_block(ReadStream *stream, + BufferAccessStrategy *strategy); +extern void read_stream_reset(ReadStream *stream); +extern void read_stream_end(ReadStream *stream); + +#endif /* READ_STREAM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/reinit.h b/platform/dbops/binaries/postgres/include/server/storage/reinit.h new file mode 100644 index 0000000000000000000000000000000000000000..1373d509df23620de686dc00ef2076a1a9e498b4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/reinit.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * reinit.h + * Reinitialization of unlogged relations + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/reinit.h + * + *------------------------------------------------------------------------- + */ + +#ifndef REINIT_H +#define REINIT_H + +#include "common/relpath.h" + + +extern void ResetUnloggedRelations(int op); +extern bool parse_filename_for_nontemp_relation(const char *name, + RelFileNumber *relnumber, + ForkNumber *fork, + unsigned *segno); + +#define UNLOGGED_RELATION_CLEANUP 0x0001 +#define UNLOGGED_RELATION_INIT 0x0002 + +#endif /* REINIT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/relfilelocator.h b/platform/dbops/binaries/postgres/include/server/storage/relfilelocator.h new file mode 100644 index 0000000000000000000000000000000000000000..2f970a25c36c75ec1fe6dd0167415c702631557b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/relfilelocator.h @@ -0,0 +1,100 @@ +/*------------------------------------------------------------------------- + * + * relfilelocator.h + * Physical access information for relations. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/relfilelocator.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELFILELOCATOR_H +#define RELFILELOCATOR_H + +#include "common/relpath.h" +#include "storage/procnumber.h" + +/* + * RelFileLocator must provide all that we need to know to physically access + * a relation, with the exception of the backend's proc number, which can be + * provided separately. Note, however, that a "physical" relation is + * comprised of multiple files on the filesystem, as each fork is stored as + * a separate file, and each fork can be divided into multiple segments. See + * md.c. + * + * spcOid identifies the tablespace of the relation. It corresponds to + * pg_tablespace.oid. + * + * dbOid identifies the database of the relation. It is zero for + * "shared" relations (those common to all databases of a cluster). + * Nonzero dbOid values correspond to pg_database.oid. + * + * relNumber identifies the specific relation. relNumber corresponds to + * pg_class.relfilenode (NOT pg_class.oid, because we need to be able + * to assign new physical files to relations in some situations). + * Notice that relNumber is only unique within a database in a particular + * tablespace. + * + * Note: spcOid must be GLOBALTABLESPACE_OID if and only if dbOid is + * zero. We support shared relations only in the "global" tablespace. + * + * Note: in pg_class we allow reltablespace == 0 to denote that the + * relation is stored in its database's "default" tablespace (as + * identified by pg_database.dattablespace). However this shorthand + * is NOT allowed in RelFileLocator structs --- the real tablespace ID + * must be supplied when setting spcOid. + * + * Note: in pg_class, relfilenode can be zero to denote that the relation + * is a "mapped" relation, whose current true filenode number is available + * from relmapper.c. Again, this case is NOT allowed in RelFileLocators. + * + * Note: various places use RelFileLocator in hashtable keys. Therefore, + * there *must not* be any unused padding bytes in this struct. That + * should be safe as long as all the fields are of type Oid. + */ +typedef struct RelFileLocator +{ + Oid spcOid; /* tablespace */ + Oid dbOid; /* database */ + RelFileNumber relNumber; /* relation */ +} RelFileLocator; + +/* + * Augmenting a relfilelocator with the backend's proc number provides all the + * information we need to locate the physical storage. 'backend' is + * INVALID_PROC_NUMBER for regular relations (those accessible to more than + * one backend), or the owning backend's proc number for backend-local + * relations. Backend-local relations are always transient and removed in + * case of a database crash; they are never WAL-logged or fsync'd. + */ +typedef struct RelFileLocatorBackend +{ + RelFileLocator locator; + ProcNumber backend; +} RelFileLocatorBackend; + +#define RelFileLocatorBackendIsTemp(rlocator) \ + ((rlocator).backend != INVALID_PROC_NUMBER) + +/* + * Note: RelFileLocatorEquals and RelFileLocatorBackendEquals compare relNumber + * first since that is most likely to be different in two unequal + * RelFileLocators. It is probably redundant to compare spcOid if the other + * fields are found equal, but do it anyway to be sure. Likewise for checking + * the backend number in RelFileLocatorBackendEquals. + */ +#define RelFileLocatorEquals(locator1, locator2) \ + ((locator1).relNumber == (locator2).relNumber && \ + (locator1).dbOid == (locator2).dbOid && \ + (locator1).spcOid == (locator2).spcOid) + +#define RelFileLocatorBackendEquals(locator1, locator2) \ + ((locator1).locator.relNumber == (locator2).locator.relNumber && \ + (locator1).locator.dbOid == (locator2).locator.dbOid && \ + (locator1).backend == (locator2).backend && \ + (locator1).locator.spcOid == (locator2).locator.spcOid) + +#endif /* RELFILELOCATOR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/s_lock.h b/platform/dbops/binaries/postgres/include/server/storage/s_lock.h new file mode 100644 index 0000000000000000000000000000000000000000..29ac6cdcd928baa3b04e47fc3b9c990d43d83175 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/s_lock.h @@ -0,0 +1,847 @@ +/*------------------------------------------------------------------------- + * + * s_lock.h + * Hardware-dependent implementation of spinlocks. + * + * NOTE: none of the macros in this file are intended to be called directly. + * Call them through the hardware-independent macros in spin.h. + * + * The following hardware-dependent macros must be provided for each + * supported platform: + * + * void S_INIT_LOCK(slock_t *lock) + * Initialize a spinlock (to the unlocked state). + * + * int S_LOCK(slock_t *lock) + * Acquire a spinlock, waiting if necessary. + * Time out and abort() if unable to acquire the lock in a + * "reasonable" amount of time --- typically ~ 1 minute. + * Should return number of "delays"; see s_lock.c + * + * void S_UNLOCK(slock_t *lock) + * Unlock a previously acquired lock. + * + * bool S_LOCK_FREE(slock_t *lock) + * Tests if the lock is free. Returns true if free, false if locked. + * This does *not* change the state of the lock. + * + * void SPIN_DELAY(void) + * Delay operation to occur inside spinlock wait loop. + * + * Note to implementors: there are default implementations for all these + * macros at the bottom of the file. Check if your platform can use + * these or needs to override them. + * + * Usually, S_LOCK() is implemented in terms of even lower-level macros + * TAS() and TAS_SPIN(): + * + * int TAS(slock_t *lock) + * Atomic test-and-set instruction. Attempt to acquire the lock, + * but do *not* wait. Returns 0 if successful, nonzero if unable + * to acquire the lock. + * + * int TAS_SPIN(slock_t *lock) + * Like TAS(), but this version is used when waiting for a lock + * previously found to be contended. By default, this is the + * same as TAS(), but on some architectures it's better to poll a + * contended lock using an unlocked instruction and retry the + * atomic test-and-set only when it appears free. + * + * TAS() and TAS_SPIN() are NOT part of the API, and should never be called + * directly. + * + * CAUTION: on some platforms TAS() and/or TAS_SPIN() may sometimes report + * failure to acquire a lock even when the lock is not locked. For example, + * on Alpha TAS() will "fail" if interrupted. Therefore a retry loop must + * always be used, even if you are certain the lock is free. + * + * It is the responsibility of these macros to make sure that the compiler + * does not re-order accesses to shared memory to precede the actual lock + * acquisition, or follow the lock release. Prior to PostgreSQL 9.5, this + * was the caller's responsibility, which meant that callers had to use + * volatile-qualified pointers to refer to both the spinlock itself and the + * shared data being accessed within the spinlocked critical section. This + * was notationally awkward, easy to forget (and thus error-prone), and + * prevented some useful compiler optimizations. For these reasons, we + * now require that the macros themselves prevent compiler re-ordering, + * so that the caller doesn't need to take special precautions. + * + * On platforms with weak memory ordering, the TAS(), TAS_SPIN(), and + * S_UNLOCK() macros must further include hardware-level memory fence + * instructions to prevent similar re-ordering at the hardware level. + * TAS() and TAS_SPIN() must guarantee that loads and stores issued after + * the macro are not executed until the lock has been obtained. Conversely, + * S_UNLOCK() must guarantee that loads and stores issued before the macro + * have been executed before the lock is released. + * + * On most supported platforms, TAS() uses a tas() function written + * in assembly language to execute a hardware atomic-test-and-set + * instruction. Equivalent OS-supplied mutex routines could be used too. + * + * If no system-specific TAS() is available (ie, HAVE_SPINLOCKS is not + * defined), then we fall back on an emulation that uses SysV semaphores + * (see spin.c). This emulation will be MUCH MUCH slower than a proper TAS() + * implementation, because of the cost of a kernel call per lock or unlock. + * An old report is that Postgres spends around 40% of its time in semop(2) + * when using the SysV semaphore code. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/s_lock.h + * + *------------------------------------------------------------------------- + */ +#ifndef S_LOCK_H +#define S_LOCK_H + +#ifdef FRONTEND +#error "s_lock.h may not be included from frontend code" +#endif + +#ifdef HAVE_SPINLOCKS /* skip spinlocks if requested */ + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +/************************************************************************* + * All the gcc inlines + * Gcc consistently defines the CPU as __cpu__. + * Other compilers use __cpu or __cpu__ so we test for both in those cases. + */ + +/*---------- + * Standard gcc asm format (assuming "volatile slock_t *lock"): + + __asm__ __volatile__( + " instruction \n" + " instruction \n" + " instruction \n" +: "=r"(_res), "+m"(*lock) // return register, in/out lock value +: "r"(lock) // lock pointer, in input register +: "memory", "cc"); // show clobbered registers here + + * The output-operands list (after first colon) should always include + * "+m"(*lock), whether or not the asm code actually refers to this + * operand directly. This ensures that gcc believes the value in the + * lock variable is used and set by the asm code. Also, the clobbers + * list (after third colon) should always include "memory"; this prevents + * gcc from thinking it can cache the values of shared-memory fields + * across the asm code. Add "cc" if your asm code changes the condition + * code register, and also list any temp registers the code uses. + *---------- + */ + + +#ifdef __i386__ /* 32-bit i386 */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res = 1; + + /* + * Use a non-locking test before asserting the bus lock. Note that the + * extra test appears to be a small loss on some x86 platforms and a small + * win on others; it's by no means clear that we should keep it. + * + * When this was last tested, we didn't have separate TAS() and TAS_SPIN() + * macros. Nowadays it probably would be better to do a non-locking test + * in TAS_SPIN() but not in TAS(), like on x86_64, but no-one's done the + * testing to verify that. Without some empirical evidence, better to + * leave it alone. + */ + __asm__ __volatile__( + " cmpb $0,%1 \n" + " jne 1f \n" + " lock \n" + " xchgb %0,%1 \n" + "1: \n" +: "+q"(_res), "+m"(*lock) +: /* no inputs */ +: "memory", "cc"); + return (int) _res; +} + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + /* + * This sequence is equivalent to the PAUSE instruction ("rep" is + * ignored by old IA32 processors if the following instruction is + * not a string operation); the IA-32 Architecture Software + * Developer's Manual, Vol. 3, Section 7.7.2 describes why using + * PAUSE in the inner loop of a spin lock is necessary for good + * performance: + * + * The PAUSE instruction improves the performance of IA-32 + * processors supporting Hyper-Threading Technology when + * executing spin-wait loops and other routines where one + * thread is accessing a shared lock or semaphore in a tight + * polling loop. When executing a spin-wait loop, the + * processor can suffer a severe performance penalty when + * exiting the loop because it detects a possible memory order + * violation and flushes the core processor's pipeline. The + * PAUSE instruction provides a hint to the processor that the + * code sequence is a spin-wait loop. The processor uses this + * hint to avoid the memory order violation and prevent the + * pipeline flush. In addition, the PAUSE instruction + * de-pipelines the spin-wait loop to prevent it from + * consuming execution resources excessively. + */ + __asm__ __volatile__( + " rep; nop \n"); +} + +#endif /* __i386__ */ + + +#ifdef __x86_64__ /* AMD Opteron, Intel EM64T */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +/* + * On Intel EM64T, it's a win to use a non-locking test before the xchg proper, + * but only when spinning. + * + * See also Implementing Scalable Atomic Locks for Multi-Core Intel(tm) EM64T + * and IA32, by Michael Chynoweth and Mary R. Lee. As of this writing, it is + * available at: + * http://software.intel.com/en-us/articles/implementing-scalable-atomic-locks-for-multi-core-intel-em64t-and-ia32-architectures + */ +#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res = 1; + + __asm__ __volatile__( + " lock \n" + " xchgb %0,%1 \n" +: "+q"(_res), "+m"(*lock) +: /* no inputs */ +: "memory", "cc"); + return (int) _res; +} + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + /* + * Adding a PAUSE in the spin delay loop is demonstrably a no-op on + * Opteron, but it may be of some use on EM64T, so we keep it. + */ + __asm__ __volatile__( + " rep; nop \n"); +} + +#endif /* __x86_64__ */ + + +/* + * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. + * + * We use the int-width variant of the builtin because it works on more chips + * than other widths. + */ +#if defined(__arm__) || defined(__arm) || defined(__aarch64__) +#ifdef HAVE_GCC__SYNC_INT32_TAS +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +/* + * Using an ISB instruction to delay in spinlock loops appears beneficial on + * high-core-count ARM64 processors. It seems mostly a wash for smaller gear, + * and ISB doesn't exist at all on pre-v7 ARM chips. + */ +#if defined(__aarch64__) + +#define SPIN_DELAY() spin_delay() + +static __inline__ void +spin_delay(void) +{ + __asm__ __volatile__( + " isb; \n"); +} + +#endif /* __aarch64__ */ +#endif /* HAVE_GCC__SYNC_INT32_TAS */ +#endif /* __arm__ || __arm || __aarch64__ */ + + +/* S/390 and S/390x Linux (32- and 64-bit zSeries) */ +#if defined(__s390__) || defined(__s390x__) +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + int _res = 0; + + __asm__ __volatile__( + " cs %0,%3,0(%2) \n" +: "+d"(_res), "+m"(*lock) +: "a"(lock), "d"(1) +: "memory", "cc"); + return _res; +} + +#endif /* __s390__ || __s390x__ */ + + +#if defined(__sparc__) /* Sparc */ +/* + * Solaris has always run sparc processors in TSO (total store) mode, but + * linux didn't use to and the *BSDs still don't. So, be careful about + * acquire/release semantics. The CPU will treat superfluous members as + * NOPs, so it's just code space. + */ +#define HAS_TEST_AND_SET + +typedef unsigned char slock_t; + +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _res; + + /* + * See comment in src/backend/port/tas/sunstudio_sparc.s for why this + * uses "ldstub", and that file uses "cas". gcc currently generates + * sparcv7-targeted binaries, so "cas" use isn't possible. + */ + __asm__ __volatile__( + " ldstub [%2], %0 \n" +: "=r"(_res), "+m"(*lock) +: "r"(lock) +: "memory"); +#if defined(__sparcv7) || defined(__sparc_v7__) + /* + * No stbar or membar available, luckily no actually produced hardware + * requires a barrier. + */ +#elif defined(__sparcv8) || defined(__sparc_v8__) + /* stbar is available (and required for both PSO, RMO), membar isn't */ + __asm__ __volatile__ ("stbar \n":::"memory"); +#else + /* + * #LoadStore (RMO) | #LoadLoad (RMO) together are the appropriate acquire + * barrier for sparcv8+ upwards. + */ + __asm__ __volatile__ ("membar #LoadStore | #LoadLoad \n":::"memory"); +#endif + return (int) _res; +} + +#if defined(__sparcv7) || defined(__sparc_v7__) +/* + * No stbar or membar available, luckily no actually produced hardware + * requires a barrier. We fall through to the default gcc definition of + * S_UNLOCK in this case. + */ +#elif defined(__sparcv8) || defined(__sparc_v8__) +/* stbar is available (and required for both PSO, RMO), membar isn't */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ ("stbar \n":::"memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) +#else +/* + * #LoadStore (RMO) | #StoreStore (RMO, PSO) together are the appropriate + * release barrier for sparcv8+ upwards. + */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ ("membar #LoadStore | #StoreStore \n":::"memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) +#endif + +#endif /* __sparc__ */ + + +/* PowerPC */ +#if defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +/* On PPC, it's a win to use a non-locking test before the lwarx */ +#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock)) + +/* + * The second operand of addi can hold a constant zero or a register number, + * hence constraint "=&b" to avoid allocating r0. "b" stands for "address + * base register"; most operands having this register-or-zero property are + * address bases, e.g. the second operand of lwax. + * + * NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002, + * an isync is a sufficient synchronization barrier after a lwarx/stwcx loop. + * But if the spinlock is in ordinary memory, we can use lwsync instead for + * better performance. + */ +static __inline__ int +tas(volatile slock_t *lock) +{ + slock_t _t; + int _res; + + __asm__ __volatile__( +" lwarx %0,0,%3,1 \n" +" cmpwi %0,0 \n" +" bne 1f \n" +" addi %0,%0,1 \n" +" stwcx. %0,0,%3 \n" +" beq 2f \n" +"1: \n" +" li %1,1 \n" +" b 3f \n" +"2: \n" +" lwsync \n" +" li %1,0 \n" +"3: \n" +: "=&b"(_t), "=r"(_res), "+m"(*lock) +: "r"(lock) +: "memory", "cc"); + return _res; +} + +/* + * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction. + * But we can use lwsync instead for better performance. + */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__ (" lwsync \n" ::: "memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) + +#endif /* powerpc */ + + +#if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */ +#define HAS_TEST_AND_SET + +typedef unsigned int slock_t; + +#define TAS(lock) tas(lock) + +/* + * Original MIPS-I processors lacked the LL/SC instructions, but if we are + * so unfortunate as to be running on one of those, we expect that the kernel + * will handle the illegal-instruction traps and emulate them for us. On + * anything newer (and really, MIPS-I is extinct) LL/SC is the only sane + * choice because any other synchronization method must involve a kernel + * call. Unfortunately, many toolchains still default to MIPS-I as the + * codegen target; if the symbol __mips shows that that's the case, we + * have to force the assembler to accept LL/SC. + * + * R10000 and up processors require a separate SYNC, which has the same + * issues as LL/SC. + */ +#if __mips < 2 +#define MIPS_SET_MIPS2 " .set mips2 \n" +#else +#define MIPS_SET_MIPS2 +#endif + +static __inline__ int +tas(volatile slock_t *lock) +{ + volatile slock_t *_l = lock; + int _res; + int _tmp; + + __asm__ __volatile__( + " .set push \n" + MIPS_SET_MIPS2 + " .set noreorder \n" + " .set nomacro \n" + " ll %0, %2 \n" + " or %1, %0, 1 \n" + " sc %1, %2 \n" + " xori %1, 1 \n" + " or %0, %0, %1 \n" + " sync \n" + " .set pop " +: "=&r" (_res), "=&r" (_tmp), "+R" (*_l) +: /* no inputs */ +: "memory"); + return _res; +} + +/* MIPS S_UNLOCK is almost standard but requires a "sync" instruction */ +#define S_UNLOCK(lock) \ +do \ +{ \ + __asm__ __volatile__( \ + " .set push \n" \ + MIPS_SET_MIPS2 \ + " .set noreorder \n" \ + " .set nomacro \n" \ + " sync \n" \ + " .set pop " \ +: /* no outputs */ \ +: /* no inputs */ \ +: "memory"); \ + *((volatile slock_t *) (lock)) = 0; \ +} while (0) + +#endif /* __mips__ && !__sgi */ + + +#if defined(__hppa) || defined(__hppa__) /* HP PA-RISC */ +/* + * HP's PA-RISC + * + * Because LDCWX requires a 16-byte-aligned address, we declare slock_t as a + * 16-byte struct. The active word in the struct is whichever has the aligned + * address; the other three words just sit at -1. + */ +#define HAS_TEST_AND_SET + +typedef struct +{ + int sema[4]; +} slock_t; + +#define TAS_ACTIVE_WORD(lock) ((volatile int *) (((uintptr_t) (lock) + 15) & ~15)) + +static __inline__ int +tas(volatile slock_t *lock) +{ + volatile int *lockword = TAS_ACTIVE_WORD(lock); + int lockval; + + /* + * The LDCWX instruction atomically clears the target word and + * returns the previous value. Hence, if the instruction returns + * 0, someone else has already acquired the lock before we tested + * it (i.e., we have failed). + * + * Notice that this means that we actually clear the word to set + * the lock and set the word to clear the lock. This is the + * opposite behavior from the SPARC LDSTUB instruction. For some + * reason everything that H-P does is rather baroque... + * + * For details about the LDCWX instruction, see the "Precision + * Architecture and Instruction Reference Manual" (09740-90014 of June + * 1987), p. 5-38. + */ + __asm__ __volatile__( + " ldcwx 0(0,%2),%0 \n" +: "=r"(lockval), "+m"(*lockword) +: "r"(lockword) +: "memory"); + return (lockval == 0); +} + +#define S_UNLOCK(lock) \ + do { \ + __asm__ __volatile__("" : : : "memory"); \ + *TAS_ACTIVE_WORD(lock) = -1; \ + } while (0) + +#define S_INIT_LOCK(lock) \ + do { \ + volatile slock_t *lock_ = (lock); \ + lock_->sema[0] = -1; \ + lock_->sema[1] = -1; \ + lock_->sema[2] = -1; \ + lock_->sema[3] = -1; \ + } while (0) + +#define S_LOCK_FREE(lock) (*TAS_ACTIVE_WORD(lock) != 0) + +#endif /* __hppa || __hppa__ */ + + +/* + * If we have no platform-specific knowledge, but we found that the compiler + * provides __sync_lock_test_and_set(), use that. Prefer the int-width + * version over the char-width version if we have both, on the rather dubious + * grounds that that's known to be more likely to work in the ARM ecosystem. + * (But we dealt with ARM above.) + */ +#if !defined(HAS_TEST_AND_SET) + +#if defined(HAVE_GCC__SYNC_INT32_TAS) +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#elif defined(HAVE_GCC__SYNC_CHAR_TAS) +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef char slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#endif /* HAVE_GCC__SYNC_INT32_TAS */ + +#endif /* !defined(HAS_TEST_AND_SET) */ + + +/* + * Default implementation of S_UNLOCK() for gcc/icc. + * + * Note that this implementation is unsafe for any platform that can reorder + * a memory access (either load or store) after a following store. That + * happens not to be possible on x86 and most legacy architectures (some are + * single-processor!), but many modern systems have weaker memory ordering. + * Those that do must define their own version of S_UNLOCK() rather than + * relying on this one. + */ +#if !defined(S_UNLOCK) +#define S_UNLOCK(lock) \ + do { __asm__ __volatile__("" : : : "memory"); *(lock) = 0; } while (0) +#endif + +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ + + +/* + * --------------------------------------------------------------------- + * Platforms that use non-gcc inline assembly: + * --------------------------------------------------------------------- + */ + +#if !defined(HAS_TEST_AND_SET) /* We didn't trigger above, let's try here */ + +/* These are in sunstudio_(sparc|x86).s */ + +#if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc)) +#define HAS_TEST_AND_SET + +#if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus) +typedef unsigned int slock_t; +#else +typedef unsigned char slock_t; +#endif + +extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with, + slock_t cmp); + +#define TAS(a) (pg_atomic_cas((a), 1, 0) != 0) +#endif + + +#ifdef _MSC_VER +typedef LONG slock_t; + +#define HAS_TEST_AND_SET +#define TAS(lock) (InterlockedCompareExchange(lock, 1, 0)) + +#define SPIN_DELAY() spin_delay() + +/* If using Visual C++ on Win64, inline assembly is unavailable. + * Use a _mm_pause intrinsic instead of rep nop. + */ +#if defined(_WIN64) +static __forceinline void +spin_delay(void) +{ + _mm_pause(); +} +#else +static __forceinline void +spin_delay(void) +{ + /* See comment for gcc code. Same code, MASM syntax */ + __asm rep nop; +} +#endif + +#include +#pragma intrinsic(_ReadWriteBarrier) + +#define S_UNLOCK(lock) \ + do { _ReadWriteBarrier(); (*(lock)) = 0; } while (0) + +#endif + + +#endif /* !defined(HAS_TEST_AND_SET) */ + + +/* Blow up if we didn't have any way to do spinlocks */ +#ifndef HAS_TEST_AND_SET +#error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs@lists.postgresql.org. +#endif + + +#else /* !HAVE_SPINLOCKS */ + + +/* + * Fake spinlock implementation using semaphores --- slow and prone + * to fall foul of kernel limits on number of semaphores, so don't use this + * unless you must! The subroutines appear in spin.c. + */ +typedef int slock_t; + +extern bool s_lock_free_sema(volatile slock_t *lock); +extern void s_unlock_sema(volatile slock_t *lock); +extern void s_init_lock_sema(volatile slock_t *lock, bool nested); +extern int tas_sema(volatile slock_t *lock); + +#define S_LOCK_FREE(lock) s_lock_free_sema(lock) +#define S_UNLOCK(lock) s_unlock_sema(lock) +#define S_INIT_LOCK(lock) s_init_lock_sema(lock, false) +#define TAS(lock) tas_sema(lock) + + +#endif /* HAVE_SPINLOCKS */ + + +/* + * Default Definitions - override these above as needed. + */ + +#if !defined(S_LOCK) +#define S_LOCK(lock) \ + (TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0) +#endif /* S_LOCK */ + +#if !defined(S_LOCK_FREE) +#define S_LOCK_FREE(lock) (*(lock) == 0) +#endif /* S_LOCK_FREE */ + +#if !defined(S_UNLOCK) +/* + * Our default implementation of S_UNLOCK is essentially *(lock) = 0. This + * is unsafe if the platform can reorder a memory access (either load or + * store) after a following store; platforms where this is possible must + * define their own S_UNLOCK. But CPU reordering is not the only concern: + * if we simply defined S_UNLOCK() as an inline macro, the compiler might + * reorder instructions from inside the critical section to occur after the + * lock release. Since the compiler probably can't know what the external + * function s_unlock is doing, putting the same logic there should be adequate. + * A sufficiently-smart globally optimizing compiler could break that + * assumption, though, and the cost of a function call for every spinlock + * release may hurt performance significantly, so we use this implementation + * only for platforms where we don't know of a suitable intrinsic. For the + * most part, those are relatively obscure platform/compiler combinations to + * which the PostgreSQL project does not have access. + */ +#define USE_DEFAULT_S_UNLOCK +extern void s_unlock(volatile slock_t *lock); +#define S_UNLOCK(lock) s_unlock(lock) +#endif /* S_UNLOCK */ + +#if !defined(S_INIT_LOCK) +#define S_INIT_LOCK(lock) S_UNLOCK(lock) +#endif /* S_INIT_LOCK */ + +#if !defined(SPIN_DELAY) +#define SPIN_DELAY() ((void) 0) +#endif /* SPIN_DELAY */ + +#if !defined(TAS) +extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or + * s_lock.c */ + +#define TAS(lock) tas(lock) +#endif /* TAS */ + +#if !defined(TAS_SPIN) +#define TAS_SPIN(lock) TAS(lock) +#endif /* TAS_SPIN */ + + +/* + * Platform-independent out-of-line support routines + */ +extern int s_lock(volatile slock_t *lock, const char *file, int line, const char *func); + +/* Support for dynamic adjustment of spins_per_delay */ +#define DEFAULT_SPINS_PER_DELAY 100 + +extern void set_spins_per_delay(int shared_spins_per_delay); +extern int update_spins_per_delay(int shared_spins_per_delay); + +/* + * Support for spin delay which is useful in various places where + * spinlock-like procedures take place. + */ +typedef struct +{ + int spins; + int delays; + int cur_delay; + const char *file; + int line; + const char *func; +} SpinDelayStatus; + +static inline void +init_spin_delay(SpinDelayStatus *status, + const char *file, int line, const char *func) +{ + status->spins = 0; + status->delays = 0; + status->cur_delay = 0; + status->file = file; + status->line = line; + status->func = func; +} + +#define init_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__, __func__) +extern void perform_spin_delay(SpinDelayStatus *status); +extern void finish_spin_delay(SpinDelayStatus *status); + +#endif /* S_LOCK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/sharedfileset.h b/platform/dbops/binaries/postgres/include/server/storage/sharedfileset.h new file mode 100644 index 0000000000000000000000000000000000000000..7186aba2698c160a62fd81e8236bd327ea137c01 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/sharedfileset.h @@ -0,0 +1,37 @@ +/*------------------------------------------------------------------------- + * + * sharedfileset.h + * Shared temporary file management. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sharedfileset.h + * + *------------------------------------------------------------------------- + */ + +#ifndef SHAREDFILESET_H +#define SHAREDFILESET_H + +#include "storage/dsm.h" +#include "storage/fd.h" +#include "storage/fileset.h" +#include "storage/spin.h" + +/* + * A set of temporary files that can be shared by multiple backends. + */ +typedef struct SharedFileSet +{ + FileSet fs; + slock_t mutex; /* mutex protecting the reference count */ + int refcnt; /* number of attached backends */ +} SharedFileSet; + +extern void SharedFileSetInit(SharedFileSet *fileset, dsm_segment *seg); +extern void SharedFileSetAttach(SharedFileSet *fileset, dsm_segment *seg); +extern void SharedFileSetDeleteAll(SharedFileSet *fileset); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/storage/shm_mq.h b/platform/dbops/binaries/postgres/include/server/storage/shm_mq.h new file mode 100644 index 0000000000000000000000000000000000000000..80f63f4fba5e4fc973eb5e23a06dda702a8e224a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/shm_mq.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * + * shm_mq.h + * single-reader, single-writer shared memory message queue + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shm_mq.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHM_MQ_H +#define SHM_MQ_H + +#include "postmaster/bgworker.h" +#include "storage/dsm.h" +#include "storage/proc.h" + +/* The queue itself, in shared memory. */ +struct shm_mq; +typedef struct shm_mq shm_mq; + +/* Backend-private state. */ +struct shm_mq_handle; +typedef struct shm_mq_handle shm_mq_handle; + +/* Descriptors for a single write spanning multiple locations. */ +typedef struct +{ + const char *data; + Size len; +} shm_mq_iovec; + +/* Possible results of a send or receive operation. */ +typedef enum +{ + SHM_MQ_SUCCESS, /* Sent or received a message. */ + SHM_MQ_WOULD_BLOCK, /* Not completed; retry later. */ + SHM_MQ_DETACHED, /* Other process has detached queue. */ +} shm_mq_result; + +/* + * Primitives to create a queue and set the sender and receiver. + * + * Both the sender and the receiver must be set before any messages are read + * or written, but they need not be set by the same process. Each must be + * set exactly once. + */ +extern shm_mq *shm_mq_create(void *address, Size size); +extern void shm_mq_set_receiver(shm_mq *mq, PGPROC *); +extern void shm_mq_set_sender(shm_mq *mq, PGPROC *); + +/* Accessor methods for sender and receiver. */ +extern PGPROC *shm_mq_get_receiver(shm_mq *); +extern PGPROC *shm_mq_get_sender(shm_mq *); + +/* Set up backend-local queue state. */ +extern shm_mq_handle *shm_mq_attach(shm_mq *mq, dsm_segment *seg, + BackgroundWorkerHandle *handle); + +/* Associate worker handle with shm_mq. */ +extern void shm_mq_set_handle(shm_mq_handle *, BackgroundWorkerHandle *); + +/* Break connection, release handle resources. */ +extern void shm_mq_detach(shm_mq_handle *mqh); + +/* Get the shm_mq from handle. */ +extern shm_mq *shm_mq_get_queue(shm_mq_handle *mqh); + +/* Send or receive messages. */ +extern shm_mq_result shm_mq_send(shm_mq_handle *mqh, + Size nbytes, const void *data, bool nowait, + bool force_flush); +extern shm_mq_result shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, + int iovcnt, bool nowait, bool force_flush); +extern shm_mq_result shm_mq_receive(shm_mq_handle *mqh, + Size *nbytesp, void **datap, bool nowait); + +/* Wait for our counterparty to attach to the queue. */ +extern shm_mq_result shm_mq_wait_for_attach(shm_mq_handle *mqh); + +/* Smallest possible queue. */ +extern PGDLLIMPORT const Size shm_mq_minimum_size; + +#endif /* SHM_MQ_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/shm_toc.h b/platform/dbops/binaries/postgres/include/server/storage/shm_toc.h new file mode 100644 index 0000000000000000000000000000000000000000..a46470d68b8a02d26b0401ec498058a88dd7ea20 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/shm_toc.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * shm_toc.h + * shared memory segment table of contents + * + * This is intended to provide a simple way to divide a chunk of shared + * memory (probably dynamic shared memory allocated via dsm_create) into + * a number of regions and keep track of the addresses of those regions or + * key data structures within those regions. This is not intended to + * scale to a large number of keys and will perform poorly if used that + * way; if you need a large number of pointers, store them within some + * other data structure within the segment and only put the pointer to + * the data structure itself in the table of contents. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shm_toc.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHM_TOC_H +#define SHM_TOC_H + +#include "storage/shmem.h" /* for add_size() */ + +/* shm_toc is an opaque type known only within shm_toc.c */ +typedef struct shm_toc shm_toc; + +extern shm_toc *shm_toc_create(uint64 magic, void *address, Size nbytes); +extern shm_toc *shm_toc_attach(uint64 magic, void *address); +extern void *shm_toc_allocate(shm_toc *toc, Size nbytes); +extern Size shm_toc_freespace(shm_toc *toc); +extern void shm_toc_insert(shm_toc *toc, uint64 key, void *address); +extern void *shm_toc_lookup(shm_toc *toc, uint64 key, bool noError); + +/* + * Tools for estimating how large a chunk of shared memory will be needed + * to store a TOC and its dependent objects. Note: we don't really support + * large numbers of keys, but it's convenient to declare number_of_keys + * as a Size anyway. + */ +typedef struct +{ + Size space_for_chunks; + Size number_of_keys; +} shm_toc_estimator; + +#define shm_toc_initialize_estimator(e) \ + ((e)->space_for_chunks = 0, (e)->number_of_keys = 0) +#define shm_toc_estimate_chunk(e, sz) \ + ((e)->space_for_chunks = add_size((e)->space_for_chunks, BUFFERALIGN(sz))) +#define shm_toc_estimate_keys(e, cnt) \ + ((e)->number_of_keys = add_size((e)->number_of_keys, cnt)) + +extern Size shm_toc_estimate(shm_toc_estimator *e); + +#endif /* SHM_TOC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/shmem.h b/platform/dbops/binaries/postgres/include/server/storage/shmem.h new file mode 100644 index 0000000000000000000000000000000000000000..3b0cc9d380033c22b9a79e26e16f3b4735cee7ec --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/shmem.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * shmem.h + * shared memory management structures + * + * Historical note: + * A long time ago, Postgres' shared memory region was allowed to be mapped + * at a different address in each process, and shared memory "pointers" were + * passed around as offsets relative to the start of the shared memory region. + * That is no longer the case: each process must map the shared memory region + * at the same address. This means shared memory pointers can be passed + * around directly between different processes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/shmem.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHMEM_H +#define SHMEM_H + +#include "utils/hsearch.h" + + +/* shmem.c */ +extern void InitShmemAccess(void *seghdr); +extern void InitShmemAllocation(void); +extern void *ShmemAlloc(Size size); +extern void *ShmemAllocNoError(Size size); +extern void *ShmemAllocUnlocked(Size size); +extern bool ShmemAddrIsValid(const void *addr); +extern void InitShmemIndex(void); +extern HTAB *ShmemInitHash(const char *name, long init_size, long max_size, + HASHCTL *infoP, int hash_flags); +extern void *ShmemInitStruct(const char *name, Size size, bool *foundPtr); +extern Size add_size(Size s1, Size s2); +extern Size mul_size(Size s1, Size s2); + +/* ipci.c */ +extern void RequestAddinShmemSpace(Size size); + +/* size constants for the shmem index table */ + /* max size of data structure string name */ +#define SHMEM_INDEX_KEYSIZE (48) + /* estimated size of the shmem index table (not a hard limit) */ +#define SHMEM_INDEX_SIZE (64) + +/* this is a hash bucket in the shmem index table */ +typedef struct +{ + char key[SHMEM_INDEX_KEYSIZE]; /* string name */ + void *location; /* location in shared mem */ + Size size; /* # bytes requested for the structure */ + Size allocated_size; /* # bytes actually allocated */ +} ShmemIndexEnt; + +#endif /* SHMEM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/sinval.h b/platform/dbops/binaries/postgres/include/server/storage/sinval.h new file mode 100644 index 0000000000000000000000000000000000000000..8f5744b21bc9a8aab2ad5b3b82d2da5b0641d060 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/sinval.h @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------- + * + * sinval.h + * POSTGRES shared cache invalidation communication definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sinval.h + * + *------------------------------------------------------------------------- + */ +#ifndef SINVAL_H +#define SINVAL_H + +#include + +#include "storage/relfilelocator.h" + +/* + * We support several types of shared-invalidation messages: + * * invalidate a specific tuple in a specific catcache + * * invalidate all catcache entries from a given system catalog + * * invalidate a relcache entry for a specific logical relation + * * invalidate all relcache entries + * * invalidate an smgr cache entry for a specific physical relation + * * invalidate the mapped-relation mapping for a given database + * * invalidate any saved snapshot that might be used to scan a given relation + * More types could be added if needed. The message type is identified by + * the first "int8" field of the message struct. Zero or positive means a + * specific-catcache inval message (and also serves as the catcache ID field). + * Negative values identify the other message types, as per codes below. + * + * Catcache inval events are initially driven by detecting tuple inserts, + * updates and deletions in system catalogs (see CacheInvalidateHeapTuple). + * An update can generate two inval events, one for the old tuple and one for + * the new, but this is reduced to one event if the tuple's hash key doesn't + * change. Note that the inval events themselves don't actually say whether + * the tuple is being inserted or deleted. Also, since we transmit only a + * hash key, there is a small risk of unnecessary invalidations due to chance + * matches of hash keys. + * + * Note that some system catalogs have multiple caches on them (with different + * indexes). On detecting a tuple invalidation in such a catalog, separate + * catcache inval messages must be generated for each of its caches, since + * the hash keys will generally be different. + * + * Catcache, relcache, and snapshot invalidations are transactional, and so + * are sent to other backends upon commit. Internally to the generating + * backend, they are also processed at CommandCounterIncrement so that later + * commands in the same transaction see the new state. The generating backend + * also has to process them at abort, to flush out any cache state it's loaded + * from no-longer-valid entries. + * + * smgr and relation mapping invalidations are non-transactional: they are + * sent immediately when the underlying file change is made. + */ + +typedef struct +{ + int8 id; /* cache ID --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + uint32 hashValue; /* hash value of key for this catcache */ +} SharedInvalCatcacheMsg; + +#define SHAREDINVALCATALOG_ID (-1) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared catalog */ + Oid catId; /* ID of catalog whose contents are invalid */ +} SharedInvalCatalogMsg; + +#define SHAREDINVALRELCACHE_ID (-2) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + Oid relId; /* relation ID, or 0 if whole relcache */ +} SharedInvalRelcacheMsg; + +#define SHAREDINVALSMGR_ID (-3) + +typedef struct +{ + /* note: field layout chosen to pack into 16 bytes */ + int8 id; /* type field --- must be first */ + int8 backend_hi; /* high bits of backend procno, if temprel */ + uint16 backend_lo; /* low bits of backend procno, if temprel */ + RelFileLocator rlocator; /* spcOid, dbOid, relNumber */ +} SharedInvalSmgrMsg; + +#define SHAREDINVALRELMAP_ID (-4) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 for shared catalogs */ +} SharedInvalRelmapMsg; + +#define SHAREDINVALSNAPSHOT_ID (-5) + +typedef struct +{ + int8 id; /* type field --- must be first */ + Oid dbId; /* database ID, or 0 if a shared relation */ + Oid relId; /* relation ID */ +} SharedInvalSnapshotMsg; + +typedef union +{ + int8 id; /* type field --- must be first */ + SharedInvalCatcacheMsg cc; + SharedInvalCatalogMsg cat; + SharedInvalRelcacheMsg rc; + SharedInvalSmgrMsg sm; + SharedInvalRelmapMsg rm; + SharedInvalSnapshotMsg sn; +} SharedInvalidationMessage; + + +/* Counter of messages processed; don't worry about overflow. */ +extern PGDLLIMPORT uint64 SharedInvalidMessageCounter; + +extern PGDLLIMPORT volatile sig_atomic_t catchupInterruptPending; + +extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, + int n); +extern void ReceiveSharedInvalidMessages(void (*invalFunction) (SharedInvalidationMessage *msg), + void (*resetFunction) (void)); + +/* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */ +extern void HandleCatchupInterrupt(void); + +/* + * enable/disable processing of catchup events directly from signal handler. + * The enable routine first performs processing of any catchup events that + * have occurred since the last disable. + */ +extern void ProcessCatchupInterrupt(void); + +extern int xactGetCommittedInvalidationMessages(SharedInvalidationMessage **msgs, + bool *RelcacheInitFileInval); +extern void ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs, + int nmsgs, bool RelcacheInitFileInval, + Oid dbid, Oid tsid); + +extern void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg); + +#endif /* SINVAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/sinvaladt.h b/platform/dbops/binaries/postgres/include/server/storage/sinvaladt.h new file mode 100644 index 0000000000000000000000000000000000000000..7c8f450db7c3095fea109bc950522eaefd88fc38 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/sinvaladt.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * sinvaladt.h + * POSTGRES shared cache invalidation data manager. + * + * The shared cache invalidation manager is responsible for transmitting + * invalidation messages between backends. Any message sent by any backend + * must be delivered to all already-running backends before it can be + * forgotten. (If we run out of space, we instead deliver a "RESET" + * message to backends that have fallen too far behind.) + * + * The struct type SharedInvalidationMessage, defining the contents of + * a single message, is defined in sinval.h. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sinvaladt.h + * + *------------------------------------------------------------------------- + */ +#ifndef SINVALADT_H +#define SINVALADT_H + +#include "storage/lock.h" +#include "storage/sinval.h" + +/* + * prototypes for functions in sinvaladt.c + */ +extern Size SInvalShmemSize(void); +extern void CreateSharedInvalidationState(void); +extern void SharedInvalBackendInit(bool sendOnly); + +extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n); +extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize); +extern void SICleanupQueue(bool callerHasWriteLock, int minFree); +extern void SIResetAll(void); + +extern LocalTransactionId GetNextLocalTransactionId(void); + +#endif /* SINVALADT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/smgr.h b/platform/dbops/binaries/postgres/include/server/storage/smgr.h new file mode 100644 index 0000000000000000000000000000000000000000..3856d1d4f8b6c969253af94322c01728bc8ef7c6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/smgr.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * smgr.h + * storage manager switch public interface declarations. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/smgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SMGR_H +#define SMGR_H + +#include "lib/ilist.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" + +/* + * smgr.c maintains a table of SMgrRelation objects, which are essentially + * cached file handles. An SMgrRelation is created (if not already present) + * by smgropen(), and destroyed by smgrdestroy(). Note that neither of these + * operations imply I/O, they just create or destroy a hashtable entry. (But + * smgrdestroy() may release associated resources, such as OS-level file + * descriptors.) + * + * An SMgrRelation may be "pinned", to prevent it from being destroyed while + * it's in use. We use this to prevent pointers relcache to smgr from being + * invalidated. SMgrRelations that are not pinned are deleted at end of + * transaction. + */ +typedef struct SMgrRelationData +{ + /* rlocator is the hashtable lookup key, so it must be first! */ + RelFileLocatorBackend smgr_rlocator; /* relation physical identifier */ + + /* + * The following fields are reset to InvalidBlockNumber upon a cache flush + * event, and hold the last known size for each fork. This information is + * currently only reliable during recovery, since there is no cache + * invalidation for fork extension. + */ + BlockNumber smgr_targblock; /* current insertion target block */ + BlockNumber smgr_cached_nblocks[MAX_FORKNUM + 1]; /* last known size */ + + /* additional public fields may someday exist here */ + + /* + * Fields below here are intended to be private to smgr.c and its + * submodules. Do not touch them from elsewhere. + */ + int smgr_which; /* storage manager selector */ + + /* + * for md.c; per-fork arrays of the number of open segments + * (md_num_open_segs) and the segments themselves (md_seg_fds). + */ + int md_num_open_segs[MAX_FORKNUM + 1]; + struct _MdfdVec *md_seg_fds[MAX_FORKNUM + 1]; + + /* + * Pinning support. If unpinned (ie. pincount == 0), 'node' is a list + * link in list of all unpinned SMgrRelations. + */ + int pincount; + dlist_node node; +} SMgrRelationData; + +typedef SMgrRelationData *SMgrRelation; + +#define SmgrIsTemp(smgr) \ + RelFileLocatorBackendIsTemp((smgr)->smgr_rlocator) + +extern void smgrinit(void); +extern SMgrRelation smgropen(RelFileLocator rlocator, ProcNumber backend); +extern bool smgrexists(SMgrRelation reln, ForkNumber forknum); +extern void smgrpin(SMgrRelation reln); +extern void smgrunpin(SMgrRelation reln); +extern void smgrclose(SMgrRelation reln); +extern void smgrdestroyall(void); +extern void smgrrelease(SMgrRelation reln); +extern void smgrreleaseall(void); +extern void smgrreleaserellocator(RelFileLocatorBackend rlocator); +extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); +extern void smgrdosyncall(SMgrRelation *rels, int nrels); +extern void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo); +extern void smgrextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, const void *buffer, bool skipFsync); +extern void smgrzeroextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks, bool skipFsync); +extern bool smgrprefetch(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, int nblocks); +extern void smgrreadv(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + void **buffers, BlockNumber nblocks); +extern void smgrwritev(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, + const void **buffers, BlockNumber nblocks, + bool skipFsync); +extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, BlockNumber nblocks); +extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum); +extern BlockNumber smgrnblocks_cached(SMgrRelation reln, ForkNumber forknum); +extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, + BlockNumber *nblocks); +extern void smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int nforks, + BlockNumber *old_nblocks, + BlockNumber *nblocks); +extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum); +extern void smgrregistersync(SMgrRelation reln, ForkNumber forknum); +extern void AtEOXact_SMgr(void); +extern bool ProcessBarrierSmgrRelease(void); + +static inline void +smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + void *buffer) +{ + smgrreadv(reln, forknum, blocknum, &buffer, 1); +} + +static inline void +smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, + const void *buffer, bool skipFsync) +{ + smgrwritev(reln, forknum, blocknum, &buffer, 1, skipFsync); +} + +#endif /* SMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/spin.h b/platform/dbops/binaries/postgres/include/server/storage/spin.h new file mode 100644 index 0000000000000000000000000000000000000000..c0679c599921f9c2af13792f12dbf4e7028b701a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/spin.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * spin.h + * Hardware-independent implementation of spinlocks. + * + * + * The hardware-independent interface to spinlocks is defined by the + * typedef "slock_t" and these macros: + * + * void SpinLockInit(volatile slock_t *lock) + * Initialize a spinlock (to the unlocked state). + * + * void SpinLockAcquire(volatile slock_t *lock) + * Acquire a spinlock, waiting if necessary. + * Time out and abort() if unable to acquire the lock in a + * "reasonable" amount of time --- typically ~ 1 minute. + * + * void SpinLockRelease(volatile slock_t *lock) + * Unlock a previously acquired lock. + * + * bool SpinLockFree(slock_t *lock) + * Tests if the lock is free. Returns true if free, false if locked. + * This does *not* change the state of the lock. + * + * Callers must beware that the macro argument may be evaluated multiple + * times! + * + * Load and store operations in calling code are guaranteed not to be + * reordered with respect to these operations, because they include a + * compiler barrier. (Before PostgreSQL 9.5, callers needed to use a + * volatile qualifier to access data protected by spinlocks.) + * + * Keep in mind the coding rule that spinlocks must not be held for more + * than a few instructions. In particular, we assume it is not possible + * for a CHECK_FOR_INTERRUPTS() to occur while holding a spinlock, and so + * it is not necessary to do HOLD/RESUME_INTERRUPTS() in these macros. + * + * These macros are implemented in terms of hardware-dependent macros + * supplied by s_lock.h. There is not currently any extra functionality + * added by this header, but there has been in the past and may someday + * be again. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/spin.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPIN_H +#define SPIN_H + +#include "storage/s_lock.h" +#ifndef HAVE_SPINLOCKS +#include "storage/pg_sema.h" +#endif + + +#define SpinLockInit(lock) S_INIT_LOCK(lock) + +#define SpinLockAcquire(lock) S_LOCK(lock) + +#define SpinLockRelease(lock) S_UNLOCK(lock) + +#define SpinLockFree(lock) S_LOCK_FREE(lock) + + +extern int SpinlockSemas(void); +extern Size SpinlockSemaSize(void); + +#ifndef HAVE_SPINLOCKS +extern void SpinlockSemaInit(void); +extern PGDLLIMPORT PGSemaphore *SpinlockSemaArray; +#endif + +#endif /* SPIN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/standby.h b/platform/dbops/binaries/postgres/include/server/storage/standby.h new file mode 100644 index 0000000000000000000000000000000000000000..cce0bc521e7582e8fb9042a8d917c32f33caaaf4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/standby.h @@ -0,0 +1,109 @@ +/*------------------------------------------------------------------------- + * + * standby.h + * Definitions for hot standby mode. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/standby.h + * + *------------------------------------------------------------------------- + */ +#ifndef STANDBY_H +#define STANDBY_H + +#include "datatype/timestamp.h" +#include "storage/lock.h" +#include "storage/procsignal.h" +#include "storage/relfilelocator.h" +#include "storage/standbydefs.h" + +/* User-settable GUC parameters */ +extern PGDLLIMPORT int max_standby_archive_delay; +extern PGDLLIMPORT int max_standby_streaming_delay; +extern PGDLLIMPORT bool log_recovery_conflict_waits; + +extern void InitRecoveryTransactionEnvironment(void); +extern void ShutdownRecoveryTransactionEnvironment(void); + +extern void ResolveRecoveryConflictWithSnapshot(TransactionId snapshotConflictHorizon, + bool isCatalogRel, + RelFileLocator locator); +extern void ResolveRecoveryConflictWithSnapshotFullXid(FullTransactionId snapshotConflictHorizon, + bool isCatalogRel, + RelFileLocator locator); +extern void ResolveRecoveryConflictWithTablespace(Oid tsid); +extern void ResolveRecoveryConflictWithDatabase(Oid dbid); + +extern void ResolveRecoveryConflictWithLock(LOCKTAG locktag, bool logging_conflict); +extern void ResolveRecoveryConflictWithBufferPin(void); +extern void CheckRecoveryConflictDeadlock(void); +extern void StandbyDeadLockHandler(void); +extern void StandbyTimeoutHandler(void); +extern void StandbyLockTimeoutHandler(void); +extern void LogRecoveryConflict(ProcSignalReason reason, TimestampTz wait_start, + TimestampTz now, VirtualTransactionId *wait_list, + bool still_waiting); + +/* + * Standby Rmgr (RM_STANDBY_ID) + * + * Standby recovery manager exists to perform actions that are required + * to make hot standby work. That includes logging AccessExclusiveLocks taken + * by transactions and running-xacts snapshots. + */ +extern void StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid); +extern void StandbyReleaseLockTree(TransactionId xid, + int nsubxids, TransactionId *subxids); +extern void StandbyReleaseAllLocks(void); +extern void StandbyReleaseOldLocks(TransactionId oldxid); + +#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) + + +/* + * Declarations for GetRunningTransactionData(). Similar to Snapshots, but + * not quite. This has nothing at all to do with visibility on this server, + * so this is completely separate from snapmgr.c and snapmgr.h. + * This data is important for creating the initial snapshot state on a + * standby server. We need lots more information than a normal snapshot, + * hence we use a specific data structure for our needs. This data + * is written to WAL as a separate record immediately after each + * checkpoint. That means that wherever we start a standby from we will + * almost immediately see the data we need to begin executing queries. + */ + +typedef enum +{ + SUBXIDS_IN_ARRAY, /* xids array includes all running subxids */ + SUBXIDS_MISSING, /* snapshot overflowed, subxids are missing */ + SUBXIDS_IN_SUBTRANS, /* subxids are not included in 'xids', but + * pg_subtrans is fully up-to-date */ +} subxids_array_status; + +typedef struct RunningTransactionsData +{ + int xcnt; /* # of xact ids in xids[] */ + int subxcnt; /* # of subxact ids in xids[] */ + subxids_array_status subxid_status; + TransactionId nextXid; /* xid from TransamVariables->nextXid */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId oldestDatabaseRunningXid; /* same as above, but within the + * current database */ + TransactionId latestCompletedXid; /* so we can set xmax */ + + TransactionId *xids; /* array of (sub)xids still running */ +} RunningTransactionsData; + +typedef RunningTransactionsData *RunningTransactions; + +extern void LogAccessExclusiveLock(Oid dbOid, Oid relOid); +extern void LogAccessExclusiveLockPrepare(void); + +extern XLogRecPtr LogStandbySnapshot(void); +extern void LogStandbyInvalidations(int nmsgs, SharedInvalidationMessage *msgs, + bool relcacheInitFileInval); + +#endif /* STANDBY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/standbydefs.h b/platform/dbops/binaries/postgres/include/server/storage/standbydefs.h new file mode 100644 index 0000000000000000000000000000000000000000..fe12f463a86289fd8b77db0e4c9ce24945631be5 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/standbydefs.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * standbydefs.h + * Frontend exposed definitions for hot standby mode. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/standbydefs.h + * + *------------------------------------------------------------------------- + */ +#ifndef STANDBYDEFS_H +#define STANDBYDEFS_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" +#include "storage/lockdefs.h" +#include "storage/sinval.h" + +/* Recovery handlers for the Standby Rmgr (RM_STANDBY_ID) */ +extern void standby_redo(XLogReaderState *record); +extern void standby_desc(StringInfo buf, XLogReaderState *record); +extern const char *standby_identify(uint8 info); +extern void standby_desc_invalidations(StringInfo buf, + int nmsgs, SharedInvalidationMessage *msgs, + Oid dbId, Oid tsId, + bool relcacheInitFileInval); + +/* + * XLOG message types + */ +#define XLOG_STANDBY_LOCK 0x00 +#define XLOG_RUNNING_XACTS 0x10 +#define XLOG_INVALIDATIONS 0x20 + +typedef struct xl_standby_locks +{ + int nlocks; /* number of entries in locks array */ + xl_standby_lock locks[FLEXIBLE_ARRAY_MEMBER]; +} xl_standby_locks; + +/* + * When we write running xact data to WAL, we use this structure. + */ +typedef struct xl_running_xacts +{ + int xcnt; /* # of xact ids in xids[] */ + int subxcnt; /* # of subxact ids in xids[] */ + bool subxid_overflow; /* snapshot overflowed, subxids missing */ + TransactionId nextXid; /* xid from TransamVariables->nextXid */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId latestCompletedXid; /* so we can set xmax */ + + TransactionId xids[FLEXIBLE_ARRAY_MEMBER]; +} xl_running_xacts; + +/* + * Invalidations for standby, currently only when transactions without an + * assigned xid commit. + */ +typedef struct xl_invalidations +{ + Oid dbId; /* MyDatabaseId */ + Oid tsId; /* MyDatabaseTableSpace */ + bool relcacheInitFileInval; /* invalidate relcache init files */ + int nmsgs; /* number of shared inval msgs */ + SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; +} xl_invalidations; + +#define MinSizeOfInvalidations offsetof(xl_invalidations, msgs) + +#endif /* STANDBYDEFS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/storage/sync.h b/platform/dbops/binaries/postgres/include/server/storage/sync.h new file mode 100644 index 0000000000000000000000000000000000000000..9dee8fa6e5bb341bfd41f6c0a90219142be28366 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/storage/sync.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------- + * + * sync.h + * File synchronization management code. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/storage/sync.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYNC_H +#define SYNC_H + +#include "storage/relfilelocator.h" + +/* + * Type of sync request. These are used to manage the set of pending + * requests to call a sync handler's sync or unlink functions at the next + * checkpoint. + */ +typedef enum SyncRequestType +{ + SYNC_REQUEST, /* schedule a call of sync function */ + SYNC_UNLINK_REQUEST, /* schedule a call of unlink function */ + SYNC_FORGET_REQUEST, /* forget all calls for a tag */ + SYNC_FILTER_REQUEST, /* forget all calls satisfying match fn */ +} SyncRequestType; + +/* + * Which set of functions to use to handle a given request. The values of + * the enumerators must match the indexes of the function table in sync.c. + */ +typedef enum SyncRequestHandler +{ + SYNC_HANDLER_MD = 0, + SYNC_HANDLER_CLOG, + SYNC_HANDLER_COMMIT_TS, + SYNC_HANDLER_MULTIXACT_OFFSET, + SYNC_HANDLER_MULTIXACT_MEMBER, + SYNC_HANDLER_NONE, +} SyncRequestHandler; + +/* + * A tag identifying a file. Currently it has the members required for md.c's + * usage, but sync.c has no knowledge of the internal structure, and it is + * liable to change as required by future handlers. + */ +typedef struct FileTag +{ + int16 handler; /* SyncRequestHandler value, saving space */ + int16 forknum; /* ForkNumber, saving space */ + RelFileLocator rlocator; + uint64 segno; +} FileTag; + +extern void InitSync(void); +extern void SyncPreCheckpoint(void); +extern void SyncPostCheckpoint(void); +extern void ProcessSyncRequests(void); +extern void RememberSyncRequest(const FileTag *ftag, SyncRequestType type); +extern bool RegisterSyncRequest(const FileTag *ftag, SyncRequestType type, + bool retryOnError); + +#endif /* SYNC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/backend_startup.h b/platform/dbops/binaries/postgres/include/server/tcop/backend_startup.h new file mode 100644 index 0000000000000000000000000000000000000000..16a68c7758456c3dafee73f3572578b0c84a2d6f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/backend_startup.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * backend_startup.h + * prototypes for backend_startup.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/backend_startup.h + * + *------------------------------------------------------------------------- + */ +#ifndef BACKEND_STARTUP_H +#define BACKEND_STARTUP_H + +/* + * CAC_state is passed from postmaster to the backend process, to indicate + * whether the connection should be accepted, or if the process should just + * send an error to the client and close the connection. Note that the + * connection can fail for various reasons even if postmaster passed CAC_OK. + */ +typedef enum CAC_state +{ + CAC_OK, + CAC_STARTUP, + CAC_SHUTDOWN, + CAC_RECOVERY, + CAC_NOTCONSISTENT, + CAC_TOOMANY, +} CAC_state; + +/* Information passed from postmaster to backend process in 'startup_data' */ +typedef struct BackendStartupData +{ + CAC_state canAcceptConnections; +} BackendStartupData; + +extern void BackendMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn(); + +#endif /* BACKEND_STARTUP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/cmdtag.h b/platform/dbops/binaries/postgres/include/server/tcop/cmdtag.h new file mode 100644 index 0000000000000000000000000000000000000000..23c99d7eca654aa810b776a3d69e7271b201fab6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/cmdtag.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * cmdtag.h + * Declarations for commandtag names and enumeration. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/cmdtag.h + * + *------------------------------------------------------------------------- + */ +#ifndef CMDTAG_H +#define CMDTAG_H + +/* buffer size required for command completion tags */ +#define COMPLETION_TAG_BUFSIZE 64 + +#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \ + tag, + +typedef enum CommandTag +{ +#include "tcop/cmdtaglist.h" +} CommandTag; + +#undef PG_CMDTAG + +typedef struct QueryCompletion +{ + CommandTag commandTag; + uint64 nprocessed; +} QueryCompletion; + + +static inline void +SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag, + uint64 nprocessed) +{ + qc->commandTag = commandTag; + qc->nprocessed = nprocessed; +} + +static inline void +CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src) +{ + dst->commandTag = src->commandTag; + dst->nprocessed = src->nprocessed; +} + + +extern void InitializeQueryCompletion(QueryCompletion *qc); +extern const char *GetCommandTagName(CommandTag commandTag); +extern const char *GetCommandTagNameAndLen(CommandTag commandTag, Size *len); +extern bool command_tag_display_rowcount(CommandTag commandTag); +extern bool command_tag_event_trigger_ok(CommandTag commandTag); +extern bool command_tag_table_rewrite_ok(CommandTag commandTag); +extern CommandTag GetCommandTagEnum(const char *commandname); +extern Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc, + bool nameonly); + +#endif /* CMDTAG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/cmdtaglist.h b/platform/dbops/binaries/postgres/include/server/tcop/cmdtaglist.h new file mode 100644 index 0000000000000000000000000000000000000000..7fdcec6dd93d9acfe68d40818958af4711fc36e6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/cmdtaglist.h @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------- + * + * cmdtaglist.h + * Command tags + * + * The command tag list is kept in its own source file for possible use + * by automatic tools. The exact representation of a command tag is + * determined by the PG_CMDTAG macro, which is not defined in this file; + * it can be defined by the caller for special purposes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/cmdtaglist.h + * + *---------------------------------------------------------------------- + */ + +/* there is deliberately not an #ifndef CMDTAGLIST_H here */ + +/* + * List of command tags. The entries must be sorted alphabetically on their + * textual name, so that we can bsearch on it; see GetCommandTagEnum(). + */ + +/* symbol name, textual name, event_trigger_ok, table_rewrite_ok, rowcount */ +PG_CMDTAG(CMDTAG_UNKNOWN, "???", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_ACCESS_METHOD, "ALTER ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_AGGREGATE, "ALTER AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CAST, "ALTER CAST", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_COLLATION, "ALTER COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CONSTRAINT, "ALTER CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_CONVERSION, "ALTER CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_DATABASE, "ALTER DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_DEFAULT_PRIVILEGES, "ALTER DEFAULT PRIVILEGES", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_DOMAIN, "ALTER DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_EVENT_TRIGGER, "ALTER EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_EXTENSION, "ALTER EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FOREIGN_DATA_WRAPPER, "ALTER FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FOREIGN_TABLE, "ALTER FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_FUNCTION, "ALTER FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_INDEX, "ALTER INDEX", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_LANGUAGE, "ALTER LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_LARGE_OBJECT, "ALTER LARGE OBJECT", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_MATERIALIZED_VIEW, "ALTER MATERIALIZED VIEW", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR, "ALTER OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR_CLASS, "ALTER OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_OPERATOR_FAMILY, "ALTER OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_POLICY, "ALTER POLICY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_PROCEDURE, "ALTER PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_PUBLICATION, "ALTER PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_ROLE, "ALTER ROLE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_ROUTINE, "ALTER ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_RULE, "ALTER RULE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SCHEMA, "ALTER SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SEQUENCE, "ALTER SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SERVER, "ALTER SERVER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_STATISTICS, "ALTER STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SUBSCRIPTION, "ALTER SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_SYSTEM, "ALTER SYSTEM", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_TABLE, "ALTER TABLE", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_TABLESPACE, "ALTER TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_CONFIGURATION, "ALTER TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_DICTIONARY, "ALTER TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_PARSER, "ALTER TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TEXT_SEARCH_TEMPLATE, "ALTER TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TRANSFORM, "ALTER TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TRIGGER, "ALTER TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_TYPE, "ALTER TYPE", true, true, false) +PG_CMDTAG(CMDTAG_ALTER_USER_MAPPING, "ALTER USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_ALTER_VIEW, "ALTER VIEW", true, false, false) +PG_CMDTAG(CMDTAG_ANALYZE, "ANALYZE", false, false, false) +PG_CMDTAG(CMDTAG_BEGIN, "BEGIN", false, false, false) +PG_CMDTAG(CMDTAG_CALL, "CALL", false, false, false) +PG_CMDTAG(CMDTAG_CHECKPOINT, "CHECKPOINT", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE, "CLOSE", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE_CURSOR, "CLOSE CURSOR", false, false, false) +PG_CMDTAG(CMDTAG_CLOSE_CURSOR_ALL, "CLOSE CURSOR ALL", false, false, false) +PG_CMDTAG(CMDTAG_CLUSTER, "CLUSTER", false, false, false) +PG_CMDTAG(CMDTAG_COMMENT, "COMMENT", true, false, false) +PG_CMDTAG(CMDTAG_COMMIT, "COMMIT", false, false, false) +PG_CMDTAG(CMDTAG_COMMIT_PREPARED, "COMMIT PREPARED", false, false, false) +PG_CMDTAG(CMDTAG_COPY, "COPY", false, false, true) +PG_CMDTAG(CMDTAG_COPY_FROM, "COPY FROM", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_ACCESS_METHOD, "CREATE ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_AGGREGATE, "CREATE AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CAST, "CREATE CAST", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_COLLATION, "CREATE COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CONSTRAINT, "CREATE CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_CONVERSION, "CREATE CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_DATABASE, "CREATE DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_DOMAIN, "CREATE DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_EVENT_TRIGGER, "CREATE EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_EXTENSION, "CREATE EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FOREIGN_DATA_WRAPPER, "CREATE FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FOREIGN_TABLE, "CREATE FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_FUNCTION, "CREATE FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_INDEX, "CREATE INDEX", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_LANGUAGE, "CREATE LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_MATERIALIZED_VIEW, "CREATE MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR, "CREATE OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR_CLASS, "CREATE OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_OPERATOR_FAMILY, "CREATE OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_POLICY, "CREATE POLICY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_PROCEDURE, "CREATE PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_PUBLICATION, "CREATE PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_ROLE, "CREATE ROLE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_ROUTINE, "CREATE ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_RULE, "CREATE RULE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SCHEMA, "CREATE SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SEQUENCE, "CREATE SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SERVER, "CREATE SERVER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_STATISTICS, "CREATE STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_SUBSCRIPTION, "CREATE SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLE, "CREATE TABLE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLE_AS, "CREATE TABLE AS", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TABLESPACE, "CREATE TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_CONFIGURATION, "CREATE TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_DICTIONARY, "CREATE TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_PARSER, "CREATE TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TEXT_SEARCH_TEMPLATE, "CREATE TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TRANSFORM, "CREATE TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TRIGGER, "CREATE TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_TYPE, "CREATE TYPE", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_USER_MAPPING, "CREATE USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_CREATE_VIEW, "CREATE VIEW", true, false, false) +PG_CMDTAG(CMDTAG_DEALLOCATE, "DEALLOCATE", false, false, false) +PG_CMDTAG(CMDTAG_DEALLOCATE_ALL, "DEALLOCATE ALL", false, false, false) +PG_CMDTAG(CMDTAG_DECLARE_CURSOR, "DECLARE CURSOR", false, false, false) +PG_CMDTAG(CMDTAG_DELETE, "DELETE", false, false, true) +PG_CMDTAG(CMDTAG_DISCARD, "DISCARD", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_ALL, "DISCARD ALL", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_PLANS, "DISCARD PLANS", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_SEQUENCES, "DISCARD SEQUENCES", false, false, false) +PG_CMDTAG(CMDTAG_DISCARD_TEMP, "DISCARD TEMP", false, false, false) +PG_CMDTAG(CMDTAG_DO, "DO", false, false, false) +PG_CMDTAG(CMDTAG_DROP_ACCESS_METHOD, "DROP ACCESS METHOD", true, false, false) +PG_CMDTAG(CMDTAG_DROP_AGGREGATE, "DROP AGGREGATE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CAST, "DROP CAST", true, false, false) +PG_CMDTAG(CMDTAG_DROP_COLLATION, "DROP COLLATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CONSTRAINT, "DROP CONSTRAINT", true, false, false) +PG_CMDTAG(CMDTAG_DROP_CONVERSION, "DROP CONVERSION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_DATABASE, "DROP DATABASE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_DOMAIN, "DROP DOMAIN", true, false, false) +PG_CMDTAG(CMDTAG_DROP_EVENT_TRIGGER, "DROP EVENT TRIGGER", false, false, false) +PG_CMDTAG(CMDTAG_DROP_EXTENSION, "DROP EXTENSION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FOREIGN_DATA_WRAPPER, "DROP FOREIGN DATA WRAPPER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FOREIGN_TABLE, "DROP FOREIGN TABLE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_FUNCTION, "DROP FUNCTION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_INDEX, "DROP INDEX", true, false, false) +PG_CMDTAG(CMDTAG_DROP_LANGUAGE, "DROP LANGUAGE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_MATERIALIZED_VIEW, "DROP MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR, "DROP OPERATOR", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR_CLASS, "DROP OPERATOR CLASS", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OPERATOR_FAMILY, "DROP OPERATOR FAMILY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_OWNED, "DROP OWNED", true, false, false) +PG_CMDTAG(CMDTAG_DROP_POLICY, "DROP POLICY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_PROCEDURE, "DROP PROCEDURE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_PUBLICATION, "DROP PUBLICATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_ROLE, "DROP ROLE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_ROUTINE, "DROP ROUTINE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_RULE, "DROP RULE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SCHEMA, "DROP SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SEQUENCE, "DROP SEQUENCE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SERVER, "DROP SERVER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_STATISTICS, "DROP STATISTICS", true, false, false) +PG_CMDTAG(CMDTAG_DROP_SUBSCRIPTION, "DROP SUBSCRIPTION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TABLE, "DROP TABLE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TABLESPACE, "DROP TABLESPACE", false, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_CONFIGURATION, "DROP TEXT SEARCH CONFIGURATION", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_DICTIONARY, "DROP TEXT SEARCH DICTIONARY", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_PARSER, "DROP TEXT SEARCH PARSER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TEXT_SEARCH_TEMPLATE, "DROP TEXT SEARCH TEMPLATE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TRANSFORM, "DROP TRANSFORM", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TRIGGER, "DROP TRIGGER", true, false, false) +PG_CMDTAG(CMDTAG_DROP_TYPE, "DROP TYPE", true, false, false) +PG_CMDTAG(CMDTAG_DROP_USER_MAPPING, "DROP USER MAPPING", true, false, false) +PG_CMDTAG(CMDTAG_DROP_VIEW, "DROP VIEW", true, false, false) +PG_CMDTAG(CMDTAG_EXECUTE, "EXECUTE", false, false, false) +PG_CMDTAG(CMDTAG_EXPLAIN, "EXPLAIN", false, false, false) +PG_CMDTAG(CMDTAG_FETCH, "FETCH", false, false, true) +PG_CMDTAG(CMDTAG_GRANT, "GRANT", true, false, false) +PG_CMDTAG(CMDTAG_GRANT_ROLE, "GRANT ROLE", false, false, false) +PG_CMDTAG(CMDTAG_IMPORT_FOREIGN_SCHEMA, "IMPORT FOREIGN SCHEMA", true, false, false) +PG_CMDTAG(CMDTAG_INSERT, "INSERT", false, false, true) +PG_CMDTAG(CMDTAG_LISTEN, "LISTEN", false, false, false) +PG_CMDTAG(CMDTAG_LOAD, "LOAD", false, false, false) +PG_CMDTAG(CMDTAG_LOCK_TABLE, "LOCK TABLE", false, false, false) +PG_CMDTAG(CMDTAG_LOGIN, "LOGIN", true, false, false) +PG_CMDTAG(CMDTAG_MERGE, "MERGE", false, false, true) +PG_CMDTAG(CMDTAG_MOVE, "MOVE", false, false, true) +PG_CMDTAG(CMDTAG_NOTIFY, "NOTIFY", false, false, false) +PG_CMDTAG(CMDTAG_PREPARE, "PREPARE", false, false, false) +PG_CMDTAG(CMDTAG_PREPARE_TRANSACTION, "PREPARE TRANSACTION", false, false, false) +PG_CMDTAG(CMDTAG_REASSIGN_OWNED, "REASSIGN OWNED", false, false, false) +PG_CMDTAG(CMDTAG_REFRESH_MATERIALIZED_VIEW, "REFRESH MATERIALIZED VIEW", true, false, false) +PG_CMDTAG(CMDTAG_REINDEX, "REINDEX", true, false, false) +PG_CMDTAG(CMDTAG_RELEASE, "RELEASE", false, false, false) +PG_CMDTAG(CMDTAG_RESET, "RESET", false, false, false) +PG_CMDTAG(CMDTAG_REVOKE, "REVOKE", true, false, false) +PG_CMDTAG(CMDTAG_REVOKE_ROLE, "REVOKE ROLE", false, false, false) +PG_CMDTAG(CMDTAG_ROLLBACK, "ROLLBACK", false, false, false) +PG_CMDTAG(CMDTAG_ROLLBACK_PREPARED, "ROLLBACK PREPARED", false, false, false) +PG_CMDTAG(CMDTAG_SAVEPOINT, "SAVEPOINT", false, false, false) +PG_CMDTAG(CMDTAG_SECURITY_LABEL, "SECURITY LABEL", true, false, false) +PG_CMDTAG(CMDTAG_SELECT, "SELECT", false, false, true) +PG_CMDTAG(CMDTAG_SELECT_FOR_KEY_SHARE, "SELECT FOR KEY SHARE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_NO_KEY_UPDATE, "SELECT FOR NO KEY UPDATE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_SHARE, "SELECT FOR SHARE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_FOR_UPDATE, "SELECT FOR UPDATE", false, false, false) +PG_CMDTAG(CMDTAG_SELECT_INTO, "SELECT INTO", true, false, false) +PG_CMDTAG(CMDTAG_SET, "SET", false, false, false) +PG_CMDTAG(CMDTAG_SET_CONSTRAINTS, "SET CONSTRAINTS", false, false, false) +PG_CMDTAG(CMDTAG_SHOW, "SHOW", false, false, false) +PG_CMDTAG(CMDTAG_START_TRANSACTION, "START TRANSACTION", false, false, false) +PG_CMDTAG(CMDTAG_TRUNCATE_TABLE, "TRUNCATE TABLE", false, false, false) +PG_CMDTAG(CMDTAG_UNLISTEN, "UNLISTEN", false, false, false) +PG_CMDTAG(CMDTAG_UPDATE, "UPDATE", false, false, true) +PG_CMDTAG(CMDTAG_VACUUM, "VACUUM", false, false, false) diff --git a/platform/dbops/binaries/postgres/include/server/tcop/deparse_utility.h b/platform/dbops/binaries/postgres/include/server/tcop/deparse_utility.h new file mode 100644 index 0000000000000000000000000000000000000000..bb94342119e6e9833b67f0d452efc2b39121205f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/deparse_utility.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * + * deparse_utility.h + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/deparse_utility.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEPARSE_UTILITY_H +#define DEPARSE_UTILITY_H + +#include "access/attnum.h" +#include "catalog/objectaddress.h" +#include "nodes/nodes.h" +#include "utils/aclchk_internal.h" + + +/* + * Support for keeping track of collected commands. + */ +typedef enum CollectedCommandType +{ + SCT_Simple, + SCT_AlterTable, + SCT_Grant, + SCT_AlterOpFamily, + SCT_AlterDefaultPrivileges, + SCT_CreateOpClass, + SCT_AlterTSConfig, +} CollectedCommandType; + +/* + * For ALTER TABLE commands, we keep a list of the subcommands therein. + */ +typedef struct CollectedATSubcmd +{ + ObjectAddress address; /* affected column, constraint, index, ... */ + Node *parsetree; +} CollectedATSubcmd; + +typedef struct CollectedCommand +{ + CollectedCommandType type; + + bool in_extension; + Node *parsetree; + + union + { + /* most commands */ + struct + { + ObjectAddress address; + ObjectAddress secondaryObject; + } simple; + + /* ALTER TABLE, and internal uses thereof */ + struct + { + Oid objectId; + Oid classId; + List *subcmds; + } alterTable; + + /* GRANT / REVOKE */ + struct + { + InternalGrant *istmt; + } grant; + + /* ALTER OPERATOR FAMILY */ + struct + { + ObjectAddress address; + List *operators; + List *procedures; + } opfam; + + /* CREATE OPERATOR CLASS */ + struct + { + ObjectAddress address; + List *operators; + List *procedures; + } createopc; + + /* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER/DROP MAPPING */ + struct + { + ObjectAddress address; + Oid *dictIds; + int ndicts; + } atscfg; + + /* ALTER DEFAULT PRIVILEGES */ + struct + { + ObjectType objtype; + } defprivs; + } d; + + struct CollectedCommand *parent; /* when nested */ +} CollectedCommand; + +#endif /* DEPARSE_UTILITY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/dest.h b/platform/dbops/binaries/postgres/include/server/tcop/dest.h new file mode 100644 index 0000000000000000000000000000000000000000..a3d521b6f97f8ede4fd569a31342857dacf9a55a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/dest.h @@ -0,0 +1,148 @@ +/*------------------------------------------------------------------------- + * + * dest.h + * support for communication destinations + * + * Whenever the backend executes a query that returns tuples, the results + * have to go someplace. For example: + * + * - stdout is the destination only when we are running a + * standalone backend (no postmaster) and are returning results + * back to an interactive user. + * + * - a remote process is the destination when we are + * running a backend with a frontend and the frontend executes + * PQexec() or PQfn(). In this case, the results are sent + * to the frontend via the functions in backend/libpq. + * + * - DestNone is the destination when the system executes + * a query internally. The results are discarded. + * + * dest.c defines three functions that implement destination management: + * + * BeginCommand: initialize the destination at start of command. + * CreateDestReceiver: return a pointer to a struct of destination-specific + * receiver functions. + * EndCommand: clean up the destination at end of command. + * + * BeginCommand/EndCommand are executed once per received SQL query. + * + * CreateDestReceiver returns a receiver object appropriate to the specified + * destination. The executor, as well as utility statements that can return + * tuples, are passed the resulting DestReceiver* pointer. Each executor run + * or utility execution calls the receiver's rStartup method, then the + * receiveSlot method (zero or more times), then the rShutdown method. + * The same receiver object may be re-used multiple times; eventually it is + * destroyed by calling its rDestroy method. + * + * In some cases, receiver objects require additional parameters that must + * be passed to them after calling CreateDestReceiver. Since the set of + * parameters varies for different receiver types, this is not handled by + * this module, but by direct calls from the calling code to receiver type + * specific functions. + * + * The DestReceiver object returned by CreateDestReceiver may be a statically + * allocated object (for destination types that require no local state), + * in which case rDestroy is a no-op. Alternatively it can be a palloc'd + * object that has DestReceiver as its first field and contains additional + * fields (see printtup.c for an example). These additional fields are then + * accessible to the DestReceiver functions by casting the DestReceiver* + * pointer passed to them. The palloc'd object is pfree'd by the rDestroy + * method. Note that the caller of CreateDestReceiver should take care to + * do so in a memory context that is long-lived enough for the receiver + * object not to disappear while still needed. + * + * Special provision: None_Receiver is a permanently available receiver + * object for the DestNone destination. This avoids useless creation/destroy + * calls in portal and cursor manipulations. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/dest.h + * + *------------------------------------------------------------------------- + */ +#ifndef DEST_H +#define DEST_H + +#include "executor/tuptable.h" +#include "tcop/cmdtag.h" + + + + +/* ---------------- + * CommandDest is a simplistic means of identifying the desired + * destination. Someday this will probably need to be improved. + * + * Note: only the values DestNone, DestDebug, DestRemote are legal for the + * global variable whereToSendOutput. The other values may be used + * as the destination for individual commands. + * ---------------- + */ +typedef enum +{ + DestNone, /* results are discarded */ + DestDebug, /* results go to debugging output */ + DestRemote, /* results sent to frontend process */ + DestRemoteExecute, /* sent to frontend, in Execute command */ + DestRemoteSimple, /* sent to frontend, w/no catalog access */ + DestSPI, /* results sent to SPI manager */ + DestTuplestore, /* results sent to Tuplestore */ + DestIntoRel, /* results sent to relation (SELECT INTO) */ + DestCopyOut, /* results sent to COPY TO code */ + DestSQLFunction, /* results sent to SQL-language func mgr */ + DestTransientRel, /* results sent to transient relation */ + DestTupleQueue, /* results sent to tuple queue */ + DestExplainSerialize, /* results are serialized and discarded */ +} CommandDest; + +/* ---------------- + * DestReceiver is a base type for destination-specific local state. + * In the simplest cases, there is no state info, just the function + * pointers that the executor must call. + * + * Note: the receiveSlot routine must be passed a slot containing a TupleDesc + * identical to the one given to the rStartup routine. It returns bool where + * a "true" value means "continue processing" and a "false" value means + * "stop early, just as if we'd reached the end of the scan". + * ---------------- + */ +typedef struct _DestReceiver DestReceiver; + +struct _DestReceiver +{ + /* Called for each tuple to be output: */ + bool (*receiveSlot) (TupleTableSlot *slot, + DestReceiver *self); + /* Per-executor-run initialization and shutdown: */ + void (*rStartup) (DestReceiver *self, + int operation, + TupleDesc typeinfo); + void (*rShutdown) (DestReceiver *self); + /* Destroy the receiver object itself (if dynamically allocated) */ + void (*rDestroy) (DestReceiver *self); + /* CommandDest code for this receiver */ + CommandDest mydest; + /* Private fields might appear beyond this point... */ +}; + +extern PGDLLIMPORT DestReceiver *None_Receiver; /* permanent receiver for + * DestNone */ + +/* The primary destination management functions */ + +extern void BeginCommand(CommandTag commandTag, CommandDest dest); +extern DestReceiver *CreateDestReceiver(CommandDest dest); +extern void EndCommand(const QueryCompletion *qc, CommandDest dest, + bool force_undecorated_output); +extern void EndReplicationCommand(const char *commandTag); + +/* Additional functions that go with destination management, more or less. */ + +extern void NullCommand(CommandDest dest); +extern void ReadyForQuery(CommandDest dest); + +#endif /* DEST_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/fastpath.h b/platform/dbops/binaries/postgres/include/server/tcop/fastpath.h new file mode 100644 index 0000000000000000000000000000000000000000..da0bd715f517e5bac7ed3945ff9ebe4a40430fbb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/fastpath.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * fastpath.h + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/fastpath.h + * + *------------------------------------------------------------------------- + */ +#ifndef FASTPATH_H +#define FASTPATH_H + +#include "lib/stringinfo.h" + +extern void HandleFunctionRequest(StringInfo msgBuf); + +#endif /* FASTPATH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/pquery.h b/platform/dbops/binaries/postgres/include/server/tcop/pquery.h new file mode 100644 index 0000000000000000000000000000000000000000..073fb323bc1283dfcd99fb0651096960aa6c59d1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/pquery.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------- + * + * pquery.h + * prototypes for pquery.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/pquery.h + * + *------------------------------------------------------------------------- + */ +#ifndef PQUERY_H +#define PQUERY_H + +#include "nodes/parsenodes.h" +#include "utils/portal.h" + +struct PlannedStmt; /* avoid including plannodes.h here */ + + +extern PGDLLIMPORT Portal ActivePortal; + + +extern PortalStrategy ChoosePortalStrategy(List *stmts); + +extern List *FetchPortalTargetList(Portal portal); + +extern List *FetchStatementTargetList(Node *stmt); + +extern void PortalStart(Portal portal, ParamListInfo params, + int eflags, Snapshot snapshot); + +extern void PortalSetResultFormat(Portal portal, int nFormats, + int16 *formats); + +extern bool PortalRun(Portal portal, long count, bool isTopLevel, + bool run_once, DestReceiver *dest, DestReceiver *altdest, + QueryCompletion *qc); + +extern uint64 PortalRunFetch(Portal portal, + FetchDirection fdirection, + long count, + DestReceiver *dest); + +extern bool PlannedStmtRequiresSnapshot(struct PlannedStmt *pstmt); + +extern void EnsurePortalSnapshotExists(void); + +#endif /* PQUERY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/tcopprot.h b/platform/dbops/binaries/postgres/include/server/tcop/tcopprot.h new file mode 100644 index 0000000000000000000000000000000000000000..180d5a2d2275f370dd10fc4c2e223f8802eda3fb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/tcopprot.h @@ -0,0 +1,98 @@ +/*------------------------------------------------------------------------- + * + * tcopprot.h + * prototypes for postgres.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/tcopprot.h + * + *------------------------------------------------------------------------- + */ +#ifndef TCOPPROT_H +#define TCOPPROT_H + +#include "nodes/params.h" +#include "nodes/plannodes.h" +#include "storage/procsignal.h" +#include "utils/guc.h" +#include "utils/queryenvironment.h" + + +/* Required daylight between max_stack_depth and the kernel limit, in bytes */ +#define STACK_DEPTH_SLOP (512 * 1024L) + +extern PGDLLIMPORT CommandDest whereToSendOutput; +extern PGDLLIMPORT const char *debug_query_string; +extern PGDLLIMPORT int max_stack_depth; +extern PGDLLIMPORT int PostAuthDelay; +extern PGDLLIMPORT int client_connection_check_interval; + +/* GUC-configurable parameters */ + +typedef enum +{ + LOGSTMT_NONE, /* log no statements */ + LOGSTMT_DDL, /* log data definition statements */ + LOGSTMT_MOD, /* log modification statements, plus DDL */ + LOGSTMT_ALL, /* log all statements */ +} LogStmtLevel; + +extern PGDLLIMPORT int log_statement; + +/* Flags for restrict_nonsystem_relation_kind value */ +#define RESTRICT_RELKIND_VIEW 0x01 +#define RESTRICT_RELKIND_FOREIGN_TABLE 0x02 + +extern PGDLLIMPORT int restrict_nonsystem_relation_kind; + +extern List *pg_parse_query(const char *query_string); +extern List *pg_rewrite_query(Query *query); +extern List *pg_analyze_and_rewrite_fixedparams(RawStmt *parsetree, + const char *query_string, + const Oid *paramTypes, int numParams, + QueryEnvironment *queryEnv); +extern List *pg_analyze_and_rewrite_varparams(RawStmt *parsetree, + const char *query_string, + Oid **paramTypes, + int *numParams, + QueryEnvironment *queryEnv); +extern List *pg_analyze_and_rewrite_withcb(RawStmt *parsetree, + const char *query_string, + ParserSetupHook parserSetup, + void *parserSetupArg, + QueryEnvironment *queryEnv); +extern PlannedStmt *pg_plan_query(Query *querytree, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); +extern List *pg_plan_queries(List *querytrees, const char *query_string, + int cursorOptions, + ParamListInfo boundParams); + +extern void die(SIGNAL_ARGS); +extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn(); +extern void StatementCancelHandler(SIGNAL_ARGS); +extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn(); +extern void HandleRecoveryConflictInterrupt(ProcSignalReason reason); +extern void ProcessClientReadInterrupt(bool blocked); +extern void ProcessClientWriteInterrupt(bool blocked); + +extern void process_postgres_switches(int argc, char *argv[], + GucContext ctx, const char **dbname); +extern void PostgresSingleUserMain(int argc, char *argv[], + const char *username) pg_attribute_noreturn(); +extern void PostgresMain(const char *dbname, + const char *username) pg_attribute_noreturn(); +extern long get_stack_depth_rlimit(void); +extern void ResetUsage(void); +extern void ShowUsage(const char *title); +extern int check_log_duration(char *msec_str, bool was_logged); +extern void set_debug_options(int debug_flag, + GucContext context, GucSource source); +extern bool set_plan_disabling_options(const char *arg, + GucContext context, GucSource source); +extern const char *get_stats_option_name(const char *arg); + +#endif /* TCOPPROT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tcop/utility.h b/platform/dbops/binaries/postgres/include/server/tcop/utility.h new file mode 100644 index 0000000000000000000000000000000000000000..9aa1de387900058dcaa044eaaef845aecd6669e4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tcop/utility.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------------------- + * + * utility.h + * prototypes for utility.c. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tcop/utility.h + * + *------------------------------------------------------------------------- + */ +#ifndef UTILITY_H +#define UTILITY_H + +#include "tcop/cmdtag.h" +#include "tcop/tcopprot.h" + +typedef enum +{ + PROCESS_UTILITY_TOPLEVEL, /* toplevel interactive command */ + PROCESS_UTILITY_QUERY, /* a complete query, but not toplevel */ + PROCESS_UTILITY_QUERY_NONATOMIC, /* a complete query, nonatomic + * execution context */ + PROCESS_UTILITY_SUBCOMMAND, /* a portion of a query */ +} ProcessUtilityContext; + +/* Info needed when recursing from ALTER TABLE */ +typedef struct AlterTableUtilityContext +{ + PlannedStmt *pstmt; /* PlannedStmt for outer ALTER TABLE command */ + const char *queryString; /* its query string */ + Oid relid; /* OID of ALTER's target table */ + ParamListInfo params; /* any parameters available to ALTER TABLE */ + QueryEnvironment *queryEnv; /* execution environment for ALTER TABLE */ +} AlterTableUtilityContext; + +/* + * These constants are used to describe the extent to which a particular + * command is read-only. + * + * COMMAND_OK_IN_READ_ONLY_TXN means that the command is permissible even when + * XactReadOnly is set. This bit should be set for commands that don't change + * the state of the database (data or schema) in a way that would affect the + * output of pg_dump. + * + * COMMAND_OK_IN_PARALLEL_MODE means that the command is permissible even + * when in parallel mode. Writing tuples is forbidden, as is anything that + * might confuse cooperating processes. + * + * COMMAND_OK_IN_RECOVERY means that the command is permissible even when in + * recovery. It can't write WAL, nor can it do things that would imperil + * replay of future WAL received from the primary. + */ +#define COMMAND_OK_IN_READ_ONLY_TXN 0x0001 +#define COMMAND_OK_IN_PARALLEL_MODE 0x0002 +#define COMMAND_OK_IN_RECOVERY 0x0004 + +/* + * We say that a command is strictly read-only if it is sufficiently read-only + * for all purposes. For clarity, we also have a constant for commands that are + * in no way read-only. + */ +#define COMMAND_IS_STRICTLY_READ_ONLY \ + (COMMAND_OK_IN_READ_ONLY_TXN | COMMAND_OK_IN_RECOVERY | \ + COMMAND_OK_IN_PARALLEL_MODE) +#define COMMAND_IS_NOT_READ_ONLY 0 + +/* Hook for plugins to get control in ProcessUtility() */ +typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, + const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, + ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); +extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; + +extern void ProcessUtility(PlannedStmt *pstmt, const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); +extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString, + bool readOnlyTree, + ProcessUtilityContext context, ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, QueryCompletion *qc); + +extern void ProcessUtilityForAlterTable(Node *stmt, + AlterTableUtilityContext *context); + +extern bool UtilityReturnsTuples(Node *parsetree); + +extern TupleDesc UtilityTupleDescriptor(Node *parsetree); + +extern Query *UtilityContainsQuery(Node *parsetree); + +extern CommandTag CreateCommandTag(Node *parsetree); + +static inline const char * +CreateCommandName(Node *parsetree) +{ + return GetCommandTagName(CreateCommandTag(parsetree)); +} + +extern LogStmtLevel GetCommandLogLevel(Node *parsetree); + +extern bool CommandIsReadOnly(PlannedStmt *pstmt); + +#endif /* UTILITY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/dicts/regis.h b/platform/dbops/binaries/postgres/include/server/tsearch/dicts/regis.h new file mode 100644 index 0000000000000000000000000000000000000000..d3d9b6ec22da33bb9b4b29048decb0828ed0f53e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/dicts/regis.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * regis.h + * + * Declarations for fast regex subset, used by ISpell + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/dicts/regis.h + * + *------------------------------------------------------------------------- + */ + +#ifndef __REGIS_H__ +#define __REGIS_H__ + +typedef struct RegisNode +{ + uint32 + type:2, + len:16, + unused:14; + struct RegisNode *next; + unsigned char data[FLEXIBLE_ARRAY_MEMBER]; +} RegisNode; + +#define RNHDRSZ (offsetof(RegisNode,data)) + +#define RSF_ONEOF 1 +#define RSF_NONEOF 2 + +typedef struct Regis +{ + RegisNode *node; + uint32 + issuffix:1, + nchar:16, + unused:15; +} Regis; + +extern bool RS_isRegis(const char *str); + +extern void RS_compile(Regis *r, bool issuffix, const char *str); +extern void RS_free(Regis *r); + +/*returns true if matches */ +extern bool RS_execute(Regis *r, char *str); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/dicts/spell.h b/platform/dbops/binaries/postgres/include/server/tsearch/dicts/spell.h new file mode 100644 index 0000000000000000000000000000000000000000..10c05769ac7347738dad3b0880c2e3330e3326cd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/dicts/spell.h @@ -0,0 +1,241 @@ +/*------------------------------------------------------------------------- + * + * spell.h + * + * Declarations for ISpell dictionary + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/dicts/spell.h + * + *------------------------------------------------------------------------- + */ + +#ifndef __SPELL_H__ +#define __SPELL_H__ + +#include "regex/regex.h" +#include "tsearch/dicts/regis.h" +#include "tsearch/ts_public.h" + +/* + * SPNode and SPNodeData are used to represent prefix tree (Trie) to store + * a words list. + */ +struct SPNode; + +typedef struct +{ + uint32 val:8, + isword:1, + /* Stores compound flags listed below */ + compoundflag:4, + /* Reference to an entry of the AffixData field */ + affix:19; + struct SPNode *node; +} SPNodeData; + +/* + * Names of FF_ are correlated with Hunspell options in affix file + * https://hunspell.github.io/ + */ +#define FF_COMPOUNDONLY 0x01 +#define FF_COMPOUNDBEGIN 0x02 +#define FF_COMPOUNDMIDDLE 0x04 +#define FF_COMPOUNDLAST 0x08 +#define FF_COMPOUNDFLAG ( FF_COMPOUNDBEGIN | FF_COMPOUNDMIDDLE | \ + FF_COMPOUNDLAST ) +#define FF_COMPOUNDFLAGMASK 0x0f + +typedef struct SPNode +{ + uint32 length; + SPNodeData data[FLEXIBLE_ARRAY_MEMBER]; +} SPNode; + +#define SPNHDRSZ (offsetof(SPNode,data)) + +/* + * Represents an entry in a words list. + */ +typedef struct spell_struct +{ + union + { + /* + * flag is filled in by NIImportDictionary(). After + * NISortDictionary(), d is used instead of flag. + */ + char *flag; + /* d is used in mkSPNode() */ + struct + { + /* Reference to an entry of the AffixData field */ + int affix; + /* Length of the word */ + int len; + } d; + } p; + char word[FLEXIBLE_ARRAY_MEMBER]; +} SPELL; + +#define SPELLHDRSZ (offsetof(SPELL, word)) + +/* + * Represents an entry in an affix list. + */ +typedef struct aff_struct +{ + char *flag; + /* FF_SUFFIX or FF_PREFIX */ + uint32 type:1, + flagflags:7, + issimple:1, + isregis:1, + replen:14; + char *find; + char *repl; + union + { + /* + * Arrays of AFFIX are moved and sorted. We'll use a pointer to + * regex_t to keep this struct small, and avoid assuming that regex_t + * is movable. + */ + regex_t *pregex; + Regis regis; + } reg; +} AFFIX; + +/* + * affixes use dictionary flags too + */ +#define FF_COMPOUNDPERMITFLAG 0x10 +#define FF_COMPOUNDFORBIDFLAG 0x20 +#define FF_CROSSPRODUCT 0x40 + +/* + * Don't change the order of these. Initialization sorts by these, + * and expects prefixes to come first after sorting. + */ +#define FF_SUFFIX 1 +#define FF_PREFIX 0 + +/* + * AffixNode and AffixNodeData are used to represent prefix tree (Trie) to store + * an affix list. + */ +struct AffixNode; + +typedef struct +{ + uint32 val:8, + naff:24; + AFFIX **aff; + struct AffixNode *node; +} AffixNodeData; + +typedef struct AffixNode +{ + uint32 isvoid:1, + length:31; + AffixNodeData data[FLEXIBLE_ARRAY_MEMBER]; +} AffixNode; + +#define ANHRDSZ (offsetof(AffixNode, data)) + +typedef struct +{ + char *affix; + int len; + bool issuffix; +} CMPDAffix; + +/* + * Type of encoding affix flags in Hunspell dictionaries + */ +typedef enum +{ + FM_CHAR, /* one character (like ispell) */ + FM_LONG, /* two characters */ + FM_NUM, /* number, >= 0 and < 65536 */ +} FlagMode; + +/* + * Structure to store Hunspell options. Flag representation depends on flag + * type. These flags are about support of compound words. + */ +typedef struct CompoundAffixFlag +{ + union + { + /* Flag name if flagMode is FM_CHAR or FM_LONG */ + char *s; + /* Flag name if flagMode is FM_NUM */ + uint32 i; + } flag; + /* we don't have a bsearch_arg version, so, copy FlagMode */ + FlagMode flagMode; + uint32 value; +} CompoundAffixFlag; + +#define FLAGNUM_MAXSIZE (1 << 16) + +typedef struct +{ + int maffixes; + int naffixes; + AFFIX *Affix; + + AffixNode *Suffix; + AffixNode *Prefix; + + SPNode *Dictionary; + /* Array of sets of affixes */ + char **AffixData; + int lenAffixData; + int nAffixData; + bool useFlagAliases; + + CMPDAffix *CompoundAffix; + + bool usecompound; + FlagMode flagMode; + + /* + * All follow fields are actually needed only for initialization + */ + + /* Array of Hunspell options in affix file */ + CompoundAffixFlag *CompoundAffixFlags; + /* number of entries in CompoundAffixFlags array */ + int nCompoundAffixFlag; + /* allocated length of CompoundAffixFlags array */ + int mCompoundAffixFlag; + + /* + * Remaining fields are only used during dictionary construction; they are + * set up by NIStartBuild and cleared by NIFinishBuild. + */ + MemoryContext buildCxt; /* temp context for construction */ + + /* Temporary array of all words in the dict file */ + SPELL **Spell; + int nspell; /* number of valid entries in Spell array */ + int mspell; /* allocated length of Spell array */ + + /* These are used to allocate "compact" data without palloc overhead */ + char *firstfree; /* first free address (always maxaligned) */ + size_t avail; /* free space remaining at firstfree */ +} IspellDict; + +extern TSLexeme *NINormalizeWord(IspellDict *Conf, char *word); + +extern void NIStartBuild(IspellDict *Conf); +extern void NIImportAffixes(IspellDict *Conf, const char *filename); +extern void NIImportDictionary(IspellDict *Conf, const char *filename); +extern void NISortDictionary(IspellDict *Conf); +extern void NISortAffixes(IspellDict *Conf); +extern void NIFinishBuild(IspellDict *Conf); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/ts_cache.h b/platform/dbops/binaries/postgres/include/server/tsearch/ts_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..2f8fcd4e9c9f673eaa4c8286c64d97b6615700aa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/ts_cache.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * ts_cache.h + * Tsearch related object caches. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/tsearch/ts_cache.h + * + *------------------------------------------------------------------------- + */ +#ifndef TS_CACHE_H +#define TS_CACHE_H + +#include "fmgr.h" + + +/* + * All TS*CacheEntry structs must share this common header + * (see InvalidateTSCacheCallBack) + */ +typedef struct TSAnyCacheEntry +{ + Oid objId; + bool isvalid; +} TSAnyCacheEntry; + + +typedef struct TSParserCacheEntry +{ + /* prsId is the hash lookup key and MUST BE FIRST */ + Oid prsId; /* OID of the parser */ + bool isvalid; + + Oid startOid; + Oid tokenOid; + Oid endOid; + Oid headlineOid; + Oid lextypeOid; + + /* + * Pre-set-up fmgr call of most needed parser's methods + */ + FmgrInfo prsstart; + FmgrInfo prstoken; + FmgrInfo prsend; + FmgrInfo prsheadline; +} TSParserCacheEntry; + +typedef struct TSDictionaryCacheEntry +{ + /* dictId is the hash lookup key and MUST BE FIRST */ + Oid dictId; + bool isvalid; + + /* most frequent fmgr call */ + Oid lexizeOid; + FmgrInfo lexize; + + MemoryContext dictCtx; /* memory context to store private data */ + void *dictData; +} TSDictionaryCacheEntry; + +typedef struct +{ + int len; + Oid *dictIds; +} ListDictionary; + +typedef struct +{ + /* cfgId is the hash lookup key and MUST BE FIRST */ + Oid cfgId; + bool isvalid; + + Oid prsId; + + int lenmap; + ListDictionary *map; +} TSConfigCacheEntry; + + +/* + * GUC variable for current configuration + */ +extern PGDLLIMPORT char *TSCurrentConfig; + + +extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId); +extern TSDictionaryCacheEntry *lookup_ts_dictionary_cache(Oid dictId); +extern TSConfigCacheEntry *lookup_ts_config_cache(Oid cfgId); + +extern Oid getTSCurrentConfig(bool emitError); + +#endif /* TS_CACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/ts_locale.h b/platform/dbops/binaries/postgres/include/server/tsearch/ts_locale.h new file mode 100644 index 0000000000000000000000000000000000000000..abc21a7ebeae607a0439149cbb83f4bfec01f323 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/ts_locale.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * ts_locale.h + * locale compatibility layer for tsearch + * + * Copyright (c) 1998-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_locale.h + * + *------------------------------------------------------------------------- + */ +#ifndef __TSLOCALE_H__ +#define __TSLOCALE_H__ + +#include +#include +#include + +#include "lib/stringinfo.h" +#include "mb/pg_wchar.h" +#include "utils/pg_locale.h" + +/* working state for tsearch_readline (should be a local var in caller) */ +typedef struct +{ + FILE *fp; + const char *filename; + int lineno; + StringInfoData buf; /* current input line, in UTF-8 */ + char *curline; /* current input line, in DB's encoding */ + /* curline may be NULL, or equal to buf.data, or a palloc'd string */ + ErrorContextCallback cb; +} tsearch_readline_state; + +#define TOUCHAR(x) (*((const unsigned char *) (x))) + +/* The second argument of t_iseq() must be a plain ASCII character */ +#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) + +#define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s)) + +extern int t_isdigit(const char *ptr); +extern int t_isspace(const char *ptr); +extern int t_isalpha(const char *ptr); +extern int t_isalnum(const char *ptr); +extern int t_isprint(const char *ptr); + +extern char *lowerstr(const char *str); +extern char *lowerstr_with_len(const char *str, int len); + +extern bool tsearch_readline_begin(tsearch_readline_state *stp, + const char *filename); +extern char *tsearch_readline(tsearch_readline_state *stp); +extern void tsearch_readline_end(tsearch_readline_state *stp); + +#endif /* __TSLOCALE_H__ */ diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/ts_public.h b/platform/dbops/binaries/postgres/include/server/tsearch/ts_public.h new file mode 100644 index 0000000000000000000000000000000000000000..e1549863a12c83ceb32f74e3857a5d677b18c38b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/ts_public.h @@ -0,0 +1,159 @@ +/*------------------------------------------------------------------------- + * + * ts_public.h + * Public interface to various tsearch modules, such as + * parsers and dictionaries. + * + * Copyright (c) 1998-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_public.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TS_PUBLIC_H_ +#define _PG_TS_PUBLIC_H_ + +#include "tsearch/ts_type.h" + +/* + * Parser's framework + */ + +/* + * returning type for prslextype method of parser + */ +typedef struct +{ + int lexid; + char *alias; + char *descr; +} LexDescr; + +/* + * Interface to headline generator (tsparser's prsheadline function) + * + * HeadlineParsedText describes the text that is to be highlighted. + * Some fields are passed from the core code to the prsheadline function, + * while others are output from the prsheadline function. + * + * The principal data is words[], an array of HeadlineWordEntry, + * one entry per token, of length curwords. + * The fields of HeadlineWordEntry are: + * + * in, selected, replace, skip: these flags are initially zero + * and may be set by the prsheadline function. A consecutive group + * of tokens marked "in" form a "fragment" to be output. + * Such tokens may additionally be marked selected, replace, or skip + * to modify how they are shown. (If you set more than one of those + * bits, you get an unspecified one of those behaviors.) + * + * type, len, pos, word: filled by core code to describe the token. + * + * item: if the token matches any operand of the tsquery of interest, + * a pointer to such an operand. (If there are multiple matching + * operands, we generate extra copies of the HeadlineWordEntry to hold + * all the pointers. The extras are marked with repeated = 1 and should + * be ignored except for checking the item pointer.) + */ +typedef struct +{ + uint32 selected:1, /* token is to be highlighted */ + in:1, /* token is part of headline */ + replace:1, /* token is to be replaced with a space */ + repeated:1, /* duplicate entry to hold item pointer */ + skip:1, /* token is to be skipped (not output) */ + unused:3, /* available bits */ + type:8, /* parser's token category */ + len:16; /* length of token */ + WordEntryPos pos; /* position of token */ + char *word; /* text of token (not null-terminated) */ + QueryOperand *item; /* a matching query operand, or NULL if none */ +} HeadlineWordEntry; + +typedef struct +{ + /* Fields filled by core code before calling prsheadline function: */ + HeadlineWordEntry *words; + int32 lenwords; /* allocated length of words[] */ + int32 curwords; /* current number of valid entries */ + int32 vectorpos; /* used by ts_parse.c in filling pos fields */ + + /* The prsheadline function must fill these fields: */ + /* Strings for marking selected tokens and separating fragments: */ + char *startsel; /* palloc'd strings */ + char *stopsel; + char *fragdelim; + int16 startsellen; /* lengths of strings */ + int16 stopsellen; + int16 fragdelimlen; +} HeadlineParsedText; + +/* + * Common useful things for tsearch subsystem + */ +extern char *get_tsearch_config_filename(const char *basename, + const char *extension); + +/* + * Often useful stopword list management + */ +typedef struct +{ + int len; + char **stop; +} StopList; + +extern void readstoplist(const char *fname, StopList *s, + char *(*wordop) (const char *)); +extern bool searchstoplist(StopList *s, char *key); + +/* + * Interface with dictionaries + */ + +/* return struct for any lexize function */ +typedef struct +{ + /*---------- + * Number of current variant of split word. For example the Norwegian + * word 'fotballklubber' has two variants to split: ( fotball, klubb ) + * and ( fot, ball, klubb ). So, dictionary should return: + * + * nvariant lexeme + * 1 fotball + * 1 klubb + * 2 fot + * 2 ball + * 2 klubb + * + * In general, a TSLexeme will be considered to belong to the same split + * variant as the previous one if they have the same nvariant value. + * The exact values don't matter, only changes from one lexeme to next. + *---------- + */ + uint16 nvariant; + + uint16 flags; /* See flag bits below */ + + char *lexeme; /* C string */ +} TSLexeme; + +/* Flag bits that can appear in TSLexeme.flags */ +#define TSL_ADDPOS 0x01 +#define TSL_PREFIX 0x02 +#define TSL_FILTER 0x04 + +/* + * Struct for supporting complex dictionaries like thesaurus. + * 4th argument for dictlexize method is a pointer to this + */ +typedef struct +{ + bool isend; /* in: marks for lexize_info about text end is + * reached */ + bool getnext; /* out: dict wants next lexeme */ + void *private_state; /* internal dict state between calls with + * getnext == true */ +} DictSubState; + +#endif /* _PG_TS_PUBLIC_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/ts_type.h b/platform/dbops/binaries/postgres/include/server/tsearch/ts_type.h new file mode 100644 index 0000000000000000000000000000000000000000..060d539096e8a05adc62fca0ea420e2eac6d8952 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/ts_type.h @@ -0,0 +1,272 @@ +/*------------------------------------------------------------------------- + * + * ts_type.h + * Definitions for the tsvector and tsquery types + * + * Copyright (c) 1998-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_type.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TSTYPE_H_ +#define _PG_TSTYPE_H_ + +#include "fmgr.h" +#include "utils/memutils.h" + + +/* + * TSVector type. + * + * Structure of tsvector datatype: + * 1) standard varlena header + * 2) int32 size - number of lexemes (WordEntry array entries) + * 3) Array of WordEntry - one per lexeme; must be sorted according to + * tsCompareString() (ie, memcmp of lexeme strings). + * WordEntry->pos gives the number of bytes from end of WordEntry + * array to start of lexeme's string, which is of length len. + * 4) Per-lexeme data storage: + * lexeme string (not null-terminated) + * if haspos is true: + * padding byte if necessary to make the position data 2-byte aligned + * uint16 number of positions that follow + * WordEntryPos[] positions + * + * The positions for each lexeme must be sorted. + * + * Note, tsvectorsend/recv believe that sizeof(WordEntry) == 4 + */ + +typedef struct +{ + uint32 + haspos:1, + len:11, /* MAX 2Kb */ + pos:20; /* MAX 1Mb */ +} WordEntry; + +#define MAXSTRLEN ( (1<<11) - 1) +#define MAXSTRPOS ( (1<<20) - 1) + +extern int compareWordEntryPos(const void *a, const void *b); + +/* + * Equivalent to + * typedef struct { + * uint16 + * weight:2, + * pos:14; + * } + */ + +typedef uint16 WordEntryPos; + +typedef struct +{ + uint16 npos; + WordEntryPos pos[FLEXIBLE_ARRAY_MEMBER]; +} WordEntryPosVector; + +/* WordEntryPosVector with exactly 1 entry */ +typedef struct +{ + uint16 npos; + WordEntryPos pos[1]; +} WordEntryPosVector1; + + +#define WEP_GETWEIGHT(x) ( (x) >> 14 ) +#define WEP_GETPOS(x) ( (x) & 0x3fff ) + +#define WEP_SETWEIGHT(x,v) ( (x) = ( (v) << 14 ) | ( (x) & 0x3fff ) ) +#define WEP_SETPOS(x,v) ( (x) = ( (x) & 0xc000 ) | ( (v) & 0x3fff ) ) + +#define MAXENTRYPOS (1<<14) +#define MAXNUMPOS (256) +#define LIMITPOS(x) ( ( (x) >= MAXENTRYPOS ) ? (MAXENTRYPOS-1) : (x) ) + +/* This struct represents a complete tsvector datum */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; + WordEntry entries[FLEXIBLE_ARRAY_MEMBER]; + /* lexemes follow the entries[] array */ +} TSVectorData; + +typedef TSVectorData *TSVector; + +#define DATAHDRSIZE (offsetof(TSVectorData, entries)) +#define CALCDATASIZE(nentries, lenstr) (DATAHDRSIZE + (nentries) * sizeof(WordEntry) + (lenstr) ) + +/* pointer to start of a tsvector's WordEntry array */ +#define ARRPTR(x) ( (x)->entries ) + +/* pointer to start of a tsvector's lexeme storage */ +#define STRPTR(x) ( (char *) &(x)->entries[(x)->size] ) + +#define _POSVECPTR(x, e) ((WordEntryPosVector *)(STRPTR(x) + SHORTALIGN((e)->pos + (e)->len))) +#define POSDATALEN(x,e) ( ( (e)->haspos ) ? (_POSVECPTR(x,e)->npos) : 0 ) +#define POSDATAPTR(x,e) (_POSVECPTR(x,e)->pos) + +/* + * fmgr interface functions + */ + +static inline TSVector +DatumGetTSVector(Datum X) +{ + return (TSVector) PG_DETOAST_DATUM(X); +} + +static inline TSVector +DatumGetTSVectorCopy(Datum X) +{ + return (TSVector) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +TSVectorGetDatum(const TSVectorData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TSVECTOR(n) DatumGetTSVector(PG_GETARG_DATUM(n)) +#define PG_GETARG_TSVECTOR_COPY(n) DatumGetTSVectorCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_TSVECTOR(x) return TSVectorGetDatum(x) + + +/* + * TSQuery + * + * + */ + +typedef int8 QueryItemType; + +/* Valid values for QueryItemType: */ +#define QI_VAL 1 +#define QI_OPR 2 +#define QI_VALSTOP 3 /* This is only used in an intermediate stack + * representation in parse_tsquery. It's not a + * legal type elsewhere. */ + +/* + * QueryItem is one node in tsquery - operator or operand. + */ +typedef struct +{ + QueryItemType type; /* operand or kind of operator (ts_tokentype) */ + uint8 weight; /* weights of operand to search. It's a + * bitmask of allowed weights. if it =0 then + * any weight are allowed. Weights and bit + * map: A: 1<<3 B: 1<<2 C: 1<<1 D: 1<<0 */ + bool prefix; /* true if it's a prefix search */ + int32 valcrc; /* XXX: pg_crc32 would be a more appropriate + * data type, but we use comparisons to signed + * integers in the code. They would need to be + * changed as well. */ + + /* pointer to text value of operand, must correlate with WordEntry */ + uint32 + length:12, + distance:20; +} QueryOperand; + + +/* + * Legal values for QueryOperator.operator. + */ +#define OP_NOT 1 +#define OP_AND 2 +#define OP_OR 3 +#define OP_PHRASE 4 /* highest code, tsquery_cleanup.c */ +#define OP_COUNT 4 + +extern PGDLLIMPORT const int tsearch_op_priority[OP_COUNT]; + +/* get operation priority by its code */ +#define OP_PRIORITY(x) ( tsearch_op_priority[(x) - 1] ) +/* get QueryOperator priority */ +#define QO_PRIORITY(x) OP_PRIORITY(((QueryOperator *) (x))->oper) + +typedef struct +{ + QueryItemType type; + int8 oper; /* see above */ + int16 distance; /* distance between agrs for OP_PHRASE */ + uint32 left; /* pointer to left operand. Right operand is + * item + 1, left operand is placed + * item+item->left */ +} QueryOperator; + +/* + * Note: TSQuery is 4-bytes aligned, so make sure there's no fields + * inside QueryItem requiring 8-byte alignment, like int64. + */ +typedef union +{ + QueryItemType type; + QueryOperator qoperator; + QueryOperand qoperand; +} QueryItem; + +/* + * Storage: + * (len)(size)(array of QueryItem)(operands as '\0'-terminated c-strings) + */ + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; /* number of QueryItems */ + char data[FLEXIBLE_ARRAY_MEMBER]; /* data starts here */ +} TSQueryData; + +typedef TSQueryData *TSQuery; + +#define HDRSIZETQ ( VARHDRSZ + sizeof(int32) ) + +/* Computes the size of header and all QueryItems. size is the number of + * QueryItems, and lenofoperand is the total length of all operands + */ +#define COMPUTESIZE(size, lenofoperand) ( HDRSIZETQ + (size) * sizeof(QueryItem) + (lenofoperand) ) +#define TSQUERY_TOO_BIG(size, lenofoperand) \ + ((size) > (MaxAllocSize - HDRSIZETQ - (lenofoperand)) / sizeof(QueryItem)) + +/* Returns a pointer to the first QueryItem in a TSQuery */ +#define GETQUERY(x) ((QueryItem*)( (char*)(x)+HDRSIZETQ )) + +/* Returns a pointer to the beginning of operands in a TSQuery */ +#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((TSQuery)(x))->size * sizeof(QueryItem) ) + +/* + * fmgr interface functions + * Note, TSQuery type marked as plain storage, so it can't be toasted + * but PG_DETOAST_DATUM_COPY is used for simplicity + */ + +static inline TSQuery +DatumGetTSQuery(Datum X) +{ + return (TSQuery) DatumGetPointer(X); +} + +static inline TSQuery +DatumGetTSQueryCopy(Datum X) +{ + return (TSQuery) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +TSQueryGetDatum(const TSQueryData *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TSQUERY(n) DatumGetTSQuery(PG_GETARG_DATUM(n)) +#define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x) + +#endif /* _PG_TSTYPE_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/tsearch/ts_utils.h b/platform/dbops/binaries/postgres/include/server/tsearch/ts_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..6dc739086494a09b2edba5e017bce0ae810cba71 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/tsearch/ts_utils.h @@ -0,0 +1,283 @@ +/*------------------------------------------------------------------------- + * + * ts_utils.h + * helper utilities for tsearch + * + * Copyright (c) 1998-2024, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_utils.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_TS_UTILS_H_ +#define _PG_TS_UTILS_H_ + +#include "nodes/pg_list.h" +#include "tsearch/ts_public.h" +#include "tsearch/ts_type.h" + +/* + * Common parse definitions for tsvector and tsquery + */ + +/* tsvector parser support. */ + +struct TSVectorParseStateData; /* opaque struct in tsvector_parser.c */ +typedef struct TSVectorParseStateData *TSVectorParseState; + +/* flag bits that can be passed to init_tsvector_parser: */ +#define P_TSV_OPR_IS_DELIM (1 << 0) +#define P_TSV_IS_TSQUERY (1 << 1) +#define P_TSV_IS_WEB (1 << 2) + +extern TSVectorParseState init_tsvector_parser(char *input, int flags, + Node *escontext); +extern void reset_tsvector_parser(TSVectorParseState state, char *input); +extern bool gettoken_tsvector(TSVectorParseState state, + char **strval, int *lenval, + WordEntryPos **pos_ptr, int *poslen, + char **endptr); +extern void close_tsvector_parser(TSVectorParseState state); + +/* phrase operator begins with '<' */ +#define ISOPERATOR(x) \ + ( pg_mblen(x) == 1 && ( *(x) == '!' || \ + *(x) == '&' || \ + *(x) == '|' || \ + *(x) == '(' || \ + *(x) == ')' || \ + *(x) == '<' \ + ) ) + +/* parse_tsquery */ + +struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */ +typedef struct TSQueryParserStateData *TSQueryParserState; + +typedef void (*PushFunction) (Datum opaque, TSQueryParserState state, + char *token, int tokenlen, + int16 tokenweights, /* bitmap as described in + * QueryOperand struct */ + bool prefix); + +/* flag bits that can be passed to parse_tsquery: */ +#define P_TSQ_PLAIN (1 << 0) +#define P_TSQ_WEB (1 << 1) + +extern TSQuery parse_tsquery(char *buf, + PushFunction pushval, + Datum opaque, + int flags, + Node *escontext); + +/* Functions for use by PushFunction implementations */ +extern void pushValue(TSQueryParserState state, + char *strval, int lenval, int16 weight, bool prefix); +extern void pushStop(TSQueryParserState state); +extern void pushOperator(TSQueryParserState state, int8 oper, int16 distance); + +/* + * parse plain text and lexize words + */ +typedef struct +{ + uint16 flags; /* currently, only TSL_PREFIX */ + uint16 len; + uint16 nvariant; + uint16 alen; + union + { + uint16 pos; + + /* + * When apos array is used, apos[0] is the number of elements in the + * array (excluding apos[0]), and alen is the allocated size of the + * array. We do not allow more than MAXNUMPOS array elements. + */ + uint16 *apos; + } pos; + char *word; +} ParsedWord; + +typedef struct +{ + ParsedWord *words; + int32 lenwords; + int32 curwords; + int32 pos; +} ParsedText; + +extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int32 buflen); + +/* + * headline framework, flow in common to generate: + * 1 parse text with hlparsetext + * 2 parser-specific function to find part + * 3 generateHeadline to generate result text + */ + +extern void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, + char *buf, int32 buflen); +extern text *generateHeadline(HeadlineParsedText *prs); + +/* + * TSQuery execution support + * + * TS_execute() executes a tsquery against data that can be represented in + * various forms. The TSExecuteCallback callback function is called to check + * whether a given primitive tsquery value is matched in the data. + */ + +/* TS_execute requires ternary logic to handle NOT with phrase matches */ +typedef enum +{ + TS_NO, /* definitely no match */ + TS_YES, /* definitely does match */ + TS_MAYBE, /* can't verify match for lack of pos data */ +} TSTernaryValue; + +/* + * struct ExecPhraseData is passed to a TSExecuteCallback function if we need + * lexeme position data (because of a phrase-match operator in the tsquery). + * The callback should fill in position data when it returns TS_YES (success). + * If it cannot return position data, it should leave "data" unchanged and + * return TS_MAYBE. The caller of TS_execute() must then arrange for a later + * recheck with position data available. + * + * The reported lexeme positions must be sorted and unique. Callers must only + * consult the position bits of the pos array, ie, WEP_GETPOS(data->pos[i]). + * This allows the returned "pos" to point directly to the WordEntryPos + * portion of a tsvector value. If "allocated" is true then the pos array + * is palloc'd workspace and caller may free it when done. + * + * "negate" means that the pos array contains positions where the query does + * not match, rather than positions where it does. "width" is positive when + * the match is wider than one lexeme. Neither of these fields normally need + * to be touched by TSExecuteCallback functions; they are used for + * phrase-search processing within TS_execute. + * + * All fields of the ExecPhraseData struct are initially zeroed by caller. + */ +typedef struct ExecPhraseData +{ + int npos; /* number of positions reported */ + bool allocated; /* pos points to palloc'd data? */ + bool negate; /* positions are where query is NOT matched */ + WordEntryPos *pos; /* ordered, non-duplicate lexeme positions */ + int width; /* width of match in lexemes, less 1 */ +} ExecPhraseData; + +/* + * Signature for TSQuery lexeme check functions + * + * arg: opaque value passed through from caller of TS_execute + * val: lexeme to test for presence of + * data: to be filled with lexeme positions; NULL if position data not needed + * + * Return TS_YES if lexeme is present in data, TS_MAYBE if it might be + * present, TS_NO if it definitely is not present. If data is not NULL, + * it must be filled with lexeme positions if available. If position data + * is not available, leave *data as zeroes and return TS_MAYBE, never TS_YES. + */ +typedef TSTernaryValue (*TSExecuteCallback) (void *arg, QueryOperand *val, + ExecPhraseData *data); + +/* + * Flag bits for TS_execute + */ +#define TS_EXEC_EMPTY (0x00) +/* + * If TS_EXEC_SKIP_NOT is set, then NOT sub-expressions are automatically + * evaluated to be true. This was formerly the default behavior. It's now + * deprecated because it tends to give silly answers, but some applications + * might still have a use for it. + */ +#define TS_EXEC_SKIP_NOT (0x01) +/* + * If TS_EXEC_PHRASE_NO_POS is set, allow OP_PHRASE to be executed lossily + * in the absence of position information: a true result indicates that the + * phrase might be present. Without this flag, OP_PHRASE always returns + * false if lexeme position information is not available. + */ +#define TS_EXEC_PHRASE_NO_POS (0x02) + +extern bool TS_execute(QueryItem *curitem, void *arg, uint32 flags, + TSExecuteCallback chkcond); +extern TSTernaryValue TS_execute_ternary(QueryItem *curitem, void *arg, + uint32 flags, + TSExecuteCallback chkcond); +extern List *TS_execute_locations(QueryItem *curitem, void *arg, + uint32 flags, + TSExecuteCallback chkcond); +extern bool tsquery_requires_match(QueryItem *curitem); + +/* + * to_ts* - text transformation to tsvector, tsquery + */ +extern TSVector make_tsvector(ParsedText *prs); +extern int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix); + +/* + * Possible strategy numbers for indexes + * TSearchStrategyNumber - (tsvector|text) @@ tsquery + * TSearchWithClassStrategyNumber - tsvector @@@ tsquery + */ +#define TSearchStrategyNumber 1 +#define TSearchWithClassStrategyNumber 2 + +/* + * TSQuery Utilities + */ +extern QueryItem *clean_NOT(QueryItem *ptr, int32 *len); +extern TSQuery cleanup_tsquery_stopwords(TSQuery in, bool noisy); + +typedef struct QTNode +{ + QueryItem *valnode; + uint32 flags; + int32 nchild; + char *word; + uint32 sign; + struct QTNode **child; +} QTNode; + +/* bits in QTNode.flags */ +#define QTN_NEEDFREE 0x01 +#define QTN_NOCHANGE 0x02 +#define QTN_WORDFREE 0x04 + +typedef uint64 TSQuerySign; + +#define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) + +static inline Datum +TSQuerySignGetDatum(TSQuerySign X) +{ + return Int64GetDatum((int64) X); +} + +static inline TSQuerySign +DatumGetTSQuerySign(Datum X) +{ + return (TSQuerySign) DatumGetInt64(X); +} + +#define PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X) +#define PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n)) + + +extern QTNode *QT2QTN(QueryItem *in, char *operand); +extern TSQuery QTN2QT(QTNode *in); +extern void QTNFree(QTNode *in); +extern void QTNSort(QTNode *in); +extern void QTNTernary(QTNode *in); +extern void QTNBinary(QTNode *in); +extern int QTNodeCompare(QTNode *an, QTNode *bn); +extern QTNode *QTNCopy(QTNode *in); +extern void QTNClearFlags(QTNode *in, uint32 flags); +extern bool QTNEq(QTNode *a, QTNode *b); +extern TSQuerySign makeTSQuerySign(TSQuery a); +extern QTNode *findsubquery(QTNode *root, QTNode *ex, QTNode *subs, + bool *isfind); + +#endif /* _PG_TS_UTILS_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/acl.h b/platform/dbops/binaries/postgres/include/server/utils/acl.h new file mode 100644 index 0000000000000000000000000000000000000000..731d84b2a939c3b79226576258c436c991d77b0a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/acl.h @@ -0,0 +1,290 @@ +/*------------------------------------------------------------------------- + * + * acl.h + * Definition of (and support for) access control list data structures. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/acl.h + * + * NOTES + * An ACL array is simply an array of AclItems, representing the union + * of the privileges represented by the individual items. A zero-length + * array represents "no privileges". + * + * The order of items in the array is important as client utilities (in + * particular, pg_dump, though possibly other clients) expect to be able + * to issue GRANTs in the ordering of the items in the array. The reason + * this matters is that GRANTs WITH GRANT OPTION must be before any GRANTs + * which depend on it. This happens naturally in the backend during + * operations as we update ACLs in-place, new items are appended, and + * existing entries are only removed if there's no dependency on them (no + * GRANT can been based on it, or, if there was, those GRANTs are also + * removed). + * + * For backward-compatibility purposes we have to allow null ACL entries + * in system catalogs. A null ACL will be treated as meaning "default + * protection" (i.e., whatever acldefault() returns). + *------------------------------------------------------------------------- + */ +#ifndef ACL_H +#define ACL_H + +#include "access/htup.h" +#include "nodes/parsenodes.h" +#include "parser/parse_node.h" +#include "utils/snapshot.h" + + +/* + * typedef AclMode is declared in parsenodes.h, also the individual privilege + * bit meanings are defined there + */ + +#define ACL_ID_PUBLIC 0 /* placeholder for id in a PUBLIC acl item */ + +/* + * AclItem + * + * Note: must be same size on all platforms, because the size is hardcoded + * in the pg_type.h entry for aclitem. + */ +typedef struct AclItem +{ + Oid ai_grantee; /* ID that this item grants privs to */ + Oid ai_grantor; /* grantor of privs */ + AclMode ai_privs; /* privilege bits */ +} AclItem; + +/* + * The upper 32 bits of the ai_privs field of an AclItem are the grant option + * bits, and the lower 32 bits are the actual privileges. We use "rights" + * to mean the combined grant option and privilege bits fields. + */ +#define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFFFFFF) +#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 32) & 0xFFFFFFFF) +#define ACLITEM_GET_RIGHTS(item) ((item).ai_privs) + +#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFFFFFF) << 32) +#define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 32) & 0xFFFFFFFF) + +#define ACLITEM_SET_PRIVS(item,privs) \ + ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFFFFFF)) | \ + ((AclMode) (privs) & 0xFFFFFFFF)) +#define ACLITEM_SET_GOPTIONS(item,goptions) \ + ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFFFFFF) << 32)) | \ + (((AclMode) (goptions) & 0xFFFFFFFF) << 32)) +#define ACLITEM_SET_RIGHTS(item,rights) \ + ((item).ai_privs = (AclMode) (rights)) + +#define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \ + ((item).ai_privs = ((AclMode) (privs) & 0xFFFFFFFF) | \ + (((AclMode) (goptions) & 0xFFFFFFFF) << 32)) + + +#define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFFFFFF) +#define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFFFFFF << 32) + +/* + * Definitions for convenient access to Acl (array of AclItem). + * These are standard PostgreSQL arrays, but are restricted to have one + * dimension and no nulls. We also ignore the lower bound when reading, + * and set it to one when writing. + * + * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all + * other array types). Therefore, be careful to detoast them with the + * macros provided, unless you know for certain that a particular array + * can't have been toasted. + */ + + +/* + * Acl a one-dimensional array of AclItem + */ +typedef struct ArrayType Acl; + +#define ACL_NUM(ACL) (ARR_DIMS(ACL)[0]) +#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL)) +#define ACL_N_SIZE(N) (ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem))) +#define ACL_SIZE(ACL) ARR_SIZE(ACL) + +/* + * fmgr macros for these types + */ +#define DatumGetAclItemP(X) ((AclItem *) DatumGetPointer(X)) +#define PG_GETARG_ACLITEM_P(n) DatumGetAclItemP(PG_GETARG_DATUM(n)) +#define PG_RETURN_ACLITEM_P(x) PG_RETURN_POINTER(x) + +#define DatumGetAclP(X) ((Acl *) PG_DETOAST_DATUM(X)) +#define DatumGetAclPCopy(X) ((Acl *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_ACL_P(n) DatumGetAclP(PG_GETARG_DATUM(n)) +#define PG_GETARG_ACL_P_COPY(n) DatumGetAclPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_ACL_P(x) PG_RETURN_POINTER(x) + +/* + * ACL modification opcodes for aclupdate + */ +#define ACL_MODECHG_ADD 1 +#define ACL_MODECHG_DEL 2 +#define ACL_MODECHG_EQL 3 + +/* + * External representations of the privilege bits --- aclitemin/aclitemout + * represent each possible privilege bit with a distinct 1-character code + */ +#define ACL_INSERT_CHR 'a' /* formerly known as "append" */ +#define ACL_SELECT_CHR 'r' /* formerly known as "read" */ +#define ACL_UPDATE_CHR 'w' /* formerly known as "write" */ +#define ACL_DELETE_CHR 'd' +#define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */ +#define ACL_REFERENCES_CHR 'x' +#define ACL_TRIGGER_CHR 't' +#define ACL_EXECUTE_CHR 'X' +#define ACL_USAGE_CHR 'U' +#define ACL_CREATE_CHR 'C' +#define ACL_CREATE_TEMP_CHR 'T' +#define ACL_CONNECT_CHR 'c' +#define ACL_SET_CHR 's' +#define ACL_ALTER_SYSTEM_CHR 'A' +#define ACL_MAINTAIN_CHR 'm' + +/* string holding all privilege code chars, in order by bitmask position */ +#define ACL_ALL_RIGHTS_STR "arwdDxtXUCTcsAm" + +/* + * Bitmasks defining "all rights" for each supported object type + */ +#define ACL_ALL_RIGHTS_COLUMN (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES) +#define ACL_ALL_RIGHTS_RELATION (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER|ACL_MAINTAIN) +#define ACL_ALL_RIGHTS_SEQUENCE (ACL_USAGE|ACL_SELECT|ACL_UPDATE) +#define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT) +#define ACL_ALL_RIGHTS_FDW (ACL_USAGE) +#define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE) +#define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE) +#define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE) +#define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE) +#define ACL_ALL_RIGHTS_PARAMETER_ACL (ACL_SET|ACL_ALTER_SYSTEM) +#define ACL_ALL_RIGHTS_SCHEMA (ACL_USAGE|ACL_CREATE) +#define ACL_ALL_RIGHTS_TABLESPACE (ACL_CREATE) +#define ACL_ALL_RIGHTS_TYPE (ACL_USAGE) + +/* operation codes for pg_*_aclmask */ +typedef enum +{ + ACLMASK_ALL, /* normal case: compute all bits */ + ACLMASK_ANY, /* return when result is known nonzero */ +} AclMaskHow; + +/* result codes for pg_*_aclcheck */ +typedef enum +{ + ACLCHECK_OK = 0, + ACLCHECK_NO_PRIV, + ACLCHECK_NOT_OWNER, +} AclResult; + + +/* + * routines used internally + */ +extern Acl *acldefault(ObjectType objtype, Oid ownerId); +extern Acl *get_user_default_acl(ObjectType objtype, Oid ownerId, + Oid nsp_oid); +extern void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, + Oid ownerId, Acl *acl); + +extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip, + int modechg, Oid ownerId, DropBehavior behavior); +extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId); +extern Acl *make_empty_acl(void); +extern Acl *aclcopy(const Acl *orig_acl); +extern Acl *aclconcat(const Acl *left_acl, const Acl *right_acl); +extern Acl *aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId); +extern void aclitemsort(Acl *acl); +extern bool aclequal(const Acl *left_acl, const Acl *right_acl); + +extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, + AclMode mask, AclMaskHow how); +extern int aclmembers(const Acl *acl, Oid **roleids); + +extern bool has_privs_of_role(Oid member, Oid role); +extern bool member_can_set_role(Oid member, Oid role); +extern void check_can_set_role(Oid member, Oid role); +extern bool is_member_of_role(Oid member, Oid role); +extern bool is_member_of_role_nosuper(Oid member, Oid role); +extern bool is_admin_of_role(Oid member, Oid role); +extern Oid select_best_admin(Oid member, Oid role); +extern Oid get_role_oid(const char *rolname, bool missing_ok); +extern Oid get_role_oid_or_public(const char *rolname); +extern Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok); +extern void check_rolespec_name(const RoleSpec *role, const char *detail_msg); +extern HeapTuple get_rolespec_tuple(const RoleSpec *role); +extern char *get_rolespec_name(const RoleSpec *role); + +extern void select_best_grantor(Oid roleId, AclMode privileges, + const Acl *acl, Oid ownerId, + Oid *grantorId, AclMode *grantOptions); + +extern void initialize_acl(void); + +/* + * prototypes for functions in aclchk.c + */ +extern void ExecuteGrantStmt(GrantStmt *stmt); +extern void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt); + +extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid); + +extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid, + AclMode mask, AclMaskHow how); + +/* generic functions */ +extern AclResult object_aclcheck(Oid classid, Oid objectid, + Oid roleid, AclMode mode); +extern AclResult object_aclcheck_ext(Oid classid, Oid objectid, + Oid roleid, AclMode mode, + bool *is_missing); + +/* special cases */ +extern AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, + Oid roleid, AclMode mode); +extern AclResult pg_attribute_aclcheck_ext(Oid table_oid, AttrNumber attnum, + Oid roleid, AclMode mode, + bool *is_missing); +extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, + AclMode mode, AclMaskHow how); +extern AclResult pg_attribute_aclcheck_all_ext(Oid table_oid, Oid roleid, + AclMode mode, AclMaskHow how, + bool *is_missing); +extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode); +extern AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid, + AclMode mode, bool *is_missing); +extern AclResult pg_parameter_aclcheck(const char *name, Oid roleid, + AclMode mode); +extern AclResult pg_largeobject_aclcheck_snapshot(Oid lobj_oid, Oid roleid, + AclMode mode, Snapshot snapshot); + +extern void aclcheck_error(AclResult aclerr, ObjectType objtype, + const char *objectname); + +extern void aclcheck_error_col(AclResult aclerr, ObjectType objtype, + const char *objectname, const char *colname); + +extern void aclcheck_error_type(AclResult aclerr, Oid typeOid); + +extern void recordExtObjInitPriv(Oid objoid, Oid classoid); +extern void removeExtObjInitPriv(Oid objoid, Oid classoid); +extern void ReplaceRoleInInitPriv(Oid oldroleid, Oid newroleid, + Oid classid, Oid objid, int32 objsubid); +extern void RemoveRoleFromInitPriv(Oid roleid, + Oid classid, Oid objid, int32 objsubid); + + +/* ownercheck routines just return true (owner) or false (not) */ +extern bool object_ownercheck(Oid classid, Oid objectid, Oid roleid); +extern bool has_createrole_privilege(Oid roleid); +extern bool has_bypassrls_privilege(Oid roleid); + +#endif /* ACL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/aclchk_internal.h b/platform/dbops/binaries/postgres/include/server/utils/aclchk_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..11cd87dda7dfe356cd36ec80e37fbed393be17c3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/aclchk_internal.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * aclchk_internal.h + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/aclchk_internal.h + * + *------------------------------------------------------------------------- + */ +#ifndef ACLCHK_INTERNAL_H +#define ACLCHK_INTERNAL_H + +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" + +/* + * The information about one Grant/Revoke statement, in internal format: object + * and grantees names have been turned into Oids, the privilege list is an + * AclMode bitmask. If 'privileges' is ACL_NO_RIGHTS (the 0 value) and + * all_privs is true, 'privileges' will be internally set to the right kind of + * ACL_ALL_RIGHTS_*, depending on the object type (NB - this will modify the + * InternalGrant struct!) + * + * Note: 'all_privs' and 'privileges' represent object-level privileges only. + * There might also be column-level privilege specifications, which are + * represented in col_privs (this is a list of untransformed AccessPriv nodes). + * Column privileges are only valid for objtype OBJECT_TABLE. + */ +typedef struct +{ + bool is_grant; + ObjectType objtype; + List *objects; + bool all_privs; + AclMode privileges; + List *col_privs; + List *grantees; + bool grant_option; + DropBehavior behavior; +} InternalGrant; + + +#endif /* ACLCHK_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/array.h b/platform/dbops/binaries/postgres/include/server/utils/array.h new file mode 100644 index 0000000000000000000000000000000000000000..157cc0e4c6e777e6c5249b9353b9b5d284c8af99 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/array.h @@ -0,0 +1,481 @@ +/*------------------------------------------------------------------------- + * + * array.h + * Declarations for Postgres arrays. + * + * A standard varlena array has the following internal structure: + * - standard varlena header word + * - number of dimensions of the array + * - offset to stored data, or 0 if no nulls bitmap + * - element type OID + * - length of each array axis (C array of int) + * - lower boundary of each dimension (C array of int) + * - bitmap showing locations of nulls (OPTIONAL) + * - whatever is the stored data + * + * The and arrays each have ndim elements. + * + * The may be omitted if the array contains no NULL elements. + * If it is absent, the field is zero and the offset to the + * stored data must be computed on-the-fly. If the bitmap is present, + * is nonzero and is equal to the offset from the array start + * to the first data element (including any alignment padding). The bitmap + * follows the same conventions as tuple null bitmaps, ie, a 1 indicates + * a non-null entry and the LSB of each bitmap byte is used first. + * + * The actual data starts on a MAXALIGN boundary. Individual items in the + * array are aligned as specified by the array element type. They are + * stored in row-major order (last subscript varies most rapidly). + * + * NOTE: it is important that array elements of toastable datatypes NOT be + * toasted, since the tupletoaster won't know they are there. (We could + * support compressed toasted items; only out-of-line items are dangerous. + * However, it seems preferable to store such items uncompressed and allow + * the toaster to compress the whole array as one input.) + * + * + * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with + * generic arrays, but they support only one-dimensional arrays with no + * nulls (and no null bitmap). They don't support being toasted, either. + * + * There are also some "fixed-length array" datatypes, such as NAME and + * POINT. These are simply a sequence of a fixed number of items each + * of a fixed-length datatype, with no overhead; the item size must be + * a multiple of its alignment requirement, because we do no padding. + * We support subscripting on these types, but array_in() and array_out() + * only work with varlena arrays. + * + * In addition, arrays are a major user of the "expanded object" TOAST + * infrastructure. This allows a varlena array to be converted to a + * separate representation that may include "deconstructed" Datum/isnull + * arrays holding the elements. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/array.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARRAY_H +#define ARRAY_H + +#include "fmgr.h" +#include "utils/expandeddatum.h" + +/* avoid including execnodes.h here */ +struct ExprState; +struct ExprContext; + + +/* + * Maximum number of array subscripts (arbitrary limit) + */ +#define MAXDIM 6 + +/* + * Maximum number of elements in an array. We limit this to at most about a + * quarter billion elements, so that it's not necessary to check for overflow + * in quite so many places --- for instance when palloc'ing Datum arrays. + */ +#define MaxArraySize ((Size) (MaxAllocSize / sizeof(Datum))) + +/* + * Arrays are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + * + * CAUTION: if you change the header for ordinary arrays you will also + * need to change the headers for oidvector and int2vector! + */ +typedef struct ArrayType +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int ndim; /* # of dimensions */ + int32 dataoffset; /* offset to data, or 0 if no bitmap */ + Oid elemtype; /* element type OID */ +} ArrayType; + +/* + * An expanded array is contained within a private memory context (as + * all expanded objects must be) and has a control structure as below. + * + * The expanded array might contain a regular "flat" array if that was the + * original input and we've not modified it significantly. Otherwise, the + * contents are represented by Datum/isnull arrays plus dimensionality and + * type information. We could also have both forms, if we've deconstructed + * the original array for access purposes but not yet changed it. For pass- + * by-reference element types, the Datums would point into the flat array in + * this situation. Once we start modifying array elements, new pass-by-ref + * elements are separately palloc'd within the memory context. + */ +#define EA_MAGIC 689375833 /* ID for debugging crosschecks */ + +typedef struct ExpandedArrayHeader +{ + /* Standard header for expanded objects */ + ExpandedObjectHeader hdr; + + /* Magic value identifying an expanded array (for debugging only) */ + int ea_magic; + + /* Dimensionality info (always valid) */ + int ndims; /* # of dimensions */ + int *dims; /* array dimensions */ + int *lbound; /* index lower bounds for each dimension */ + + /* Element type info (always valid) */ + Oid element_type; /* element type OID */ + int16 typlen; /* needed info about element datatype */ + bool typbyval; + char typalign; + + /* + * If we have a Datum-array representation of the array, it's kept here; + * else dvalues/dnulls are NULL. The dvalues and dnulls arrays are always + * palloc'd within the object private context, but may change size from + * time to time. For pass-by-ref element types, dvalues entries might + * point either into the fstartptr..fendptr area, or to separately + * palloc'd chunks. Elements should always be fully detoasted, as they + * are in the standard flat representation. + * + * Even when dvalues is valid, dnulls can be NULL if there are no null + * elements. + */ + Datum *dvalues; /* array of Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int dvalueslen; /* allocated length of above arrays */ + int nelems; /* number of valid entries in above arrays */ + + /* + * flat_size is the current space requirement for the flat equivalent of + * the expanded array, if known; otherwise it's 0. We store this to make + * consecutive calls of get_flat_size cheap. + */ + Size flat_size; + + /* + * fvalue points to the flat representation if it is valid, else it is + * NULL. If we have or ever had a flat representation then + * fstartptr/fendptr point to the start and end+1 of its data area; this + * is so that we can tell which Datum pointers point into the flat + * representation rather than being pointers to separately palloc'd data. + */ + ArrayType *fvalue; /* must be a fully detoasted array */ + char *fstartptr; /* start of its data area */ + char *fendptr; /* end+1 of its data area */ +} ExpandedArrayHeader; + +/* + * Functions that can handle either a "flat" varlena array or an expanded + * array use this union to work with their input. Don't refer to "flt"; + * instead, cast to ArrayType. This struct nominally requires 8-byte + * alignment on 64-bit, but it's often used for an ArrayType having 4-byte + * alignment. UBSan complains about referencing "flt" in such cases. + */ +typedef union AnyArrayType +{ + ArrayType flt; + ExpandedArrayHeader xpn; +} AnyArrayType; + +/* + * working state for accumArrayResult() and friends + * note that the input must be scalars (legal array elements) + */ +typedef struct ArrayBuildState +{ + MemoryContext mcontext; /* where all the temp stuff is kept */ + Datum *dvalues; /* array of accumulated Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int alen; /* allocated length of above arrays */ + int nelems; /* number of valid entries in above arrays */ + Oid element_type; /* data type of the Datums */ + int16 typlen; /* needed info about datatype */ + bool typbyval; + char typalign; + bool private_cxt; /* use private memory context */ +} ArrayBuildState; + +/* + * working state for accumArrayResultArr() and friends + * note that the input must be arrays, and the same array type is returned + */ +typedef struct ArrayBuildStateArr +{ + MemoryContext mcontext; /* where all the temp stuff is kept */ + char *data; /* accumulated data */ + bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */ + int abytes; /* allocated length of "data" */ + int nbytes; /* number of bytes used so far */ + int aitems; /* allocated length of bitmap (in elements) */ + int nitems; /* total number of elements in result */ + int ndims; /* current dimensions of result */ + int dims[MAXDIM]; + int lbs[MAXDIM]; + Oid array_type; /* data type of the arrays */ + Oid element_type; /* data type of the array elements */ + bool private_cxt; /* use private memory context */ +} ArrayBuildStateArr; + +/* + * working state for accumArrayResultAny() and friends + * these functions handle both cases + */ +typedef struct ArrayBuildStateAny +{ + /* Exactly one of these is not NULL: */ + ArrayBuildState *scalarstate; + ArrayBuildStateArr *arraystate; +} ArrayBuildStateAny; + +/* + * structure to cache type metadata needed for array manipulation + */ +typedef struct ArrayMetaState +{ + Oid element_type; + int16 typlen; + bool typbyval; + char typalign; + char typdelim; + Oid typioparam; + Oid typiofunc; + FmgrInfo proc; +} ArrayMetaState; + +/* + * private state needed by array_map (here because caller must provide it) + */ +typedef struct ArrayMapState +{ + ArrayMetaState inp_extra; + ArrayMetaState ret_extra; +} ArrayMapState; + +/* ArrayIteratorData is private in arrayfuncs.c */ +typedef struct ArrayIteratorData *ArrayIterator; + +/* fmgr macros for regular varlena array objects */ +#define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X)) +#define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x) + +/* fmgr macros for expanded array objects */ +#define PG_GETARG_EXPANDED_ARRAY(n) DatumGetExpandedArray(PG_GETARG_DATUM(n)) +#define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \ + DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache) +#define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr)) + +/* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */ +#define PG_GETARG_ANY_ARRAY_P(n) DatumGetAnyArrayP(PG_GETARG_DATUM(n)) + +/* + * Access macros for varlena array header fields. + * + * ARR_DIMS returns a pointer to an array of array dimensions (number of + * elements along the various array axes). + * + * ARR_LBOUND returns a pointer to an array of array lower bounds. + * + * That is: if the third axis of an array has elements 5 through 8, then + * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5. + * + * Unlike C, the default lower bound is 1. + */ +#define ARR_SIZE(a) VARSIZE(a) +#define ARR_NDIM(a) ((a)->ndim) +#define ARR_HASNULL(a) ((a)->dataoffset != 0) +#define ARR_ELEMTYPE(a) ((a)->elemtype) + +#define ARR_DIMS(a) \ + ((int *) (((char *) (a)) + sizeof(ArrayType))) +#define ARR_LBOUND(a) \ + ((int *) (((char *) (a)) + sizeof(ArrayType) + \ + sizeof(int) * ARR_NDIM(a))) + +#define ARR_NULLBITMAP(a) \ + (ARR_HASNULL(a) ? \ + (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \ + 2 * sizeof(int) * ARR_NDIM(a)) \ + : (bits8 *) NULL) + +/* + * The total array header size (in bytes) for an array with the specified + * number of dimensions and total number of items. + */ +#define ARR_OVERHEAD_NONULLS(ndims) \ + MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims)) +#define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \ + MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \ + ((nitems) + 7) / 8) + +#define ARR_DATA_OFFSET(a) \ + (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a))) + +/* + * Returns a pointer to the actual array data. + */ +#define ARR_DATA_PTR(a) \ + (((char *) (a)) + ARR_DATA_OFFSET(a)) + +/* + * Macros for working with AnyArrayType inputs. Beware multiple references! + */ +#define AARR_NDIM(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.ndims : ARR_NDIM((ArrayType *) (a))) +#define AARR_HASNULL(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \ + ARR_HASNULL((ArrayType *) (a))) +#define AARR_ELEMTYPE(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.element_type : ARR_ELEMTYPE((ArrayType *) (a))) +#define AARR_DIMS(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.dims : ARR_DIMS((ArrayType *) (a))) +#define AARR_LBOUND(a) \ + (VARATT_IS_EXPANDED_HEADER(a) ? \ + (a)->xpn.lbound : ARR_LBOUND((ArrayType *) (a))) + + +/* + * GUC parameter + */ +extern PGDLLIMPORT bool Array_nulls; + +/* + * prototypes for functions defined in arrayfuncs.c + */ +extern void CopyArrayEls(ArrayType *array, + Datum *values, + bool *nulls, + int nitems, + int typlen, + bool typbyval, + char typalign, + bool freedata); + +extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, + int arraytyplen, int elmlen, bool elmbyval, char elmalign, + bool *isNull); +extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, + Datum dataValue, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); +extern Datum array_get_slice(Datum arraydatum, int nSubscripts, + int *upperIndx, int *lowerIndx, + bool *upperProvided, bool *lowerProvided, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); +extern Datum array_set_slice(Datum arraydatum, int nSubscripts, + int *upperIndx, int *lowerIndx, + bool *upperProvided, bool *lowerProvided, + Datum srcArrayDatum, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); + +extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx, + int arraytyplen, int elmlen, bool elmbyval, char elmalign, + bool *isNull); +extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx, + Datum dataValue, bool isNull, + int arraytyplen, int elmlen, bool elmbyval, char elmalign); + +extern Datum array_map(Datum arrayd, + struct ExprState *exprstate, struct ExprContext *econtext, + Oid retType, ArrayMapState *amstate); + +extern void array_bitmap_copy(bits8 *destbitmap, int destoffset, + const bits8 *srcbitmap, int srcoffset, + int nitems); + +extern ArrayType *construct_array(Datum *elems, int nelems, + Oid elmtype, + int elmlen, bool elmbyval, char elmalign); +extern ArrayType *construct_array_builtin(Datum *elems, int nelems, Oid elmtype); +extern ArrayType *construct_md_array(Datum *elems, + bool *nulls, + int ndims, + int *dims, + int *lbs, + Oid elmtype, int elmlen, bool elmbyval, char elmalign); +extern ArrayType *construct_empty_array(Oid elmtype); +extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type, + MemoryContext parentcontext, + ArrayMetaState *metacache); +extern void deconstruct_array(ArrayType *array, + Oid elmtype, + int elmlen, bool elmbyval, char elmalign, + Datum **elemsp, bool **nullsp, int *nelemsp); +extern void deconstruct_array_builtin(ArrayType *array, + Oid elmtype, + Datum **elemsp, bool **nullsp, int *nelemsp); +extern bool array_contains_nulls(ArrayType *array); + +extern ArrayBuildState *initArrayResult(Oid element_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildState *initArrayResultWithSize(Oid element_type, + MemoryContext rcontext, + bool subcontext, int initsize); +extern ArrayBuildState *accumArrayResult(ArrayBuildState *astate, + Datum dvalue, bool disnull, + Oid element_type, + MemoryContext rcontext); +extern Datum makeArrayResult(ArrayBuildState *astate, + MemoryContext rcontext); +extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, + int *dims, int *lbs, MemoryContext rcontext, bool release); + +extern ArrayBuildStateArr *initArrayResultArr(Oid array_type, Oid element_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildStateArr *accumArrayResultArr(ArrayBuildStateArr *astate, + Datum dvalue, bool disnull, + Oid array_type, + MemoryContext rcontext); +extern Datum makeArrayResultArr(ArrayBuildStateArr *astate, + MemoryContext rcontext, bool release); + +extern ArrayBuildStateAny *initArrayResultAny(Oid input_type, + MemoryContext rcontext, bool subcontext); +extern ArrayBuildStateAny *accumArrayResultAny(ArrayBuildStateAny *astate, + Datum dvalue, bool disnull, + Oid input_type, + MemoryContext rcontext); +extern Datum makeArrayResultAny(ArrayBuildStateAny *astate, + MemoryContext rcontext, bool release); + +extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate); +extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull); +extern void array_free_iterator(ArrayIterator iterator); + +/* + * prototypes for functions defined in arrayutils.c + */ + +extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx); +extern int ArrayGetNItems(int ndim, const int *dims); +extern int ArrayGetNItemsSafe(int ndim, const int *dims, + struct Node *escontext); +extern void ArrayCheckBounds(int ndim, const int *dims, const int *lb); +extern bool ArrayCheckBoundsSafe(int ndim, const int *dims, const int *lb, + struct Node *escontext); +extern void mda_get_range(int n, int *span, const int *st, const int *endp); +extern void mda_get_prod(int n, const int *range, int *prod); +extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span); +extern int mda_next_tuple(int n, int *curr, const int *span); +extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n); + +/* + * prototypes for functions defined in array_expanded.c + */ +extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext, + ArrayMetaState *metacache); +extern ExpandedArrayHeader *DatumGetExpandedArray(Datum d); +extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d, + ArrayMetaState *metacache); +extern AnyArrayType *DatumGetAnyArrayP(Datum d); +extern void deconstruct_expanded_array(ExpandedArrayHeader *eah); + +#endif /* ARRAY_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/arrayaccess.h b/platform/dbops/binaries/postgres/include/server/utils/arrayaccess.h new file mode 100644 index 0000000000000000000000000000000000000000..fff31e298461124d582555ffccd4fe90d1af0080 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/arrayaccess.h @@ -0,0 +1,118 @@ +/*------------------------------------------------------------------------- + * + * arrayaccess.h + * Declarations for element-by-element access to Postgres arrays. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/arrayaccess.h + * + *------------------------------------------------------------------------- + */ +#ifndef ARRAYACCESS_H +#define ARRAYACCESS_H + +#include "access/tupmacs.h" +#include "utils/array.h" + + +/* + * Functions for iterating through elements of a flat or expanded array. + * These require a state struct "array_iter iter". + * + * Use "array_iter_setup(&iter, arrayptr);" to prepare to iterate, and + * "datumvar = array_iter_next(&iter, &isnullvar, index, ...);" to fetch + * the next element into datumvar/isnullvar. + * "index" must be the zero-origin element number; we make caller provide + * this since caller is generally counting the elements anyway. Despite + * that, these functions can only fetch elements sequentially. + */ + +typedef struct array_iter +{ + /* datumptr being NULL or not tells if we have flat or expanded array */ + + /* Fields used when we have an expanded array */ + Datum *datumptr; /* Pointer to Datum array */ + bool *isnullptr; /* Pointer to isnull array */ + + /* Fields used when we have a flat array */ + char *dataptr; /* Current spot in the data area */ + bits8 *bitmapptr; /* Current byte of the nulls bitmap, or NULL */ + int bitmask; /* mask for current bit in nulls bitmap */ +} array_iter; + + +static inline void +array_iter_setup(array_iter *it, AnyArrayType *a) +{ + if (VARATT_IS_EXPANDED_HEADER(a)) + { + if (a->xpn.dvalues) + { + it->datumptr = a->xpn.dvalues; + it->isnullptr = a->xpn.dnulls; + /* we must fill all fields to prevent compiler warnings */ + it->dataptr = NULL; + it->bitmapptr = NULL; + } + else + { + /* Work with flat array embedded in the expanded datum */ + it->datumptr = NULL; + it->isnullptr = NULL; + it->dataptr = ARR_DATA_PTR(a->xpn.fvalue); + it->bitmapptr = ARR_NULLBITMAP(a->xpn.fvalue); + } + } + else + { + it->datumptr = NULL; + it->isnullptr = NULL; + it->dataptr = ARR_DATA_PTR((ArrayType *) a); + it->bitmapptr = ARR_NULLBITMAP((ArrayType *) a); + } + it->bitmask = 1; +} + +static inline Datum +array_iter_next(array_iter *it, bool *isnull, int i, + int elmlen, bool elmbyval, char elmalign) +{ + Datum ret; + + if (it->datumptr) + { + ret = it->datumptr[i]; + *isnull = it->isnullptr ? it->isnullptr[i] : false; + } + else + { + if (it->bitmapptr && (*(it->bitmapptr) & it->bitmask) == 0) + { + *isnull = true; + ret = (Datum) 0; + } + else + { + *isnull = false; + ret = fetch_att(it->dataptr, elmbyval, elmlen); + it->dataptr = att_addlength_pointer(it->dataptr, elmlen, + it->dataptr); + it->dataptr = (char *) att_align_nominal(it->dataptr, elmalign); + } + it->bitmask <<= 1; + if (it->bitmask == 0x100) + { + if (it->bitmapptr) + it->bitmapptr++; + it->bitmask = 1; + } + } + + return ret; +} + +#endif /* ARRAYACCESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/ascii.h b/platform/dbops/binaries/postgres/include/server/utils/ascii.h new file mode 100644 index 0000000000000000000000000000000000000000..863f0f7e0e8d1ccffd378b2da7c60d6fc2388d35 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/ascii.h @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------- + * ascii.h + * + * Portions Copyright (c) 1999-2024, PostgreSQL Global Development Group + * + * src/include/utils/ascii.h + * + *----------------------------------------------------------------------- + */ + +#ifndef _ASCII_H_ +#define _ASCII_H_ + +#include "port/simd.h" + +extern void ascii_safe_strlcpy(char *dest, const char *src, size_t destsiz); + +/* + * Verify a chunk of bytes for valid ASCII. + * + * Returns false if the input contains any zero bytes or bytes with the + * high-bit set. Input len must be a multiple of the chunk size (8 or 16). + */ +static inline bool +is_valid_ascii(const unsigned char *s, int len) +{ + const unsigned char *const s_end = s + len; + Vector8 chunk; + Vector8 highbit_cum = vector8_broadcast(0); +#ifdef USE_NO_SIMD + Vector8 zero_cum = vector8_broadcast(0x80); +#endif + + Assert(len % sizeof(chunk) == 0); + + while (s < s_end) + { + vector8_load(&chunk, s); + + /* Capture any zero bytes in this chunk. */ +#ifdef USE_NO_SIMD + + /* + * First, add 0x7f to each byte. This sets the high bit in each byte, + * unless it was a zero. If any resulting high bits are zero, the + * corresponding high bits in the zero accumulator will be cleared. + * + * If none of the bytes in the chunk had the high bit set, the max + * value each byte can have after the addition is 0x7f + 0x7f = 0xfe, + * and we don't need to worry about carrying over to the next byte. If + * any input bytes did have the high bit set, it doesn't matter + * because we check for those separately. + */ + zero_cum &= (chunk + vector8_broadcast(0x7F)); +#else + + /* + * Set all bits in each lane of the highbit accumulator where input + * bytes are zero. + */ + highbit_cum = vector8_or(highbit_cum, + vector8_eq(chunk, vector8_broadcast(0))); +#endif + + /* Capture all set bits in this chunk. */ + highbit_cum = vector8_or(highbit_cum, chunk); + + s += sizeof(chunk); + } + + /* Check if any high bits in the high bit accumulator got set. */ + if (vector8_is_highbit_set(highbit_cum)) + return false; + +#ifdef USE_NO_SIMD + /* Check if any high bits in the zero accumulator got cleared. */ + if (zero_cum != vector8_broadcast(0x80)) + return false; +#endif + + return true; +} + +#endif /* _ASCII_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/attoptcache.h b/platform/dbops/binaries/postgres/include/server/utils/attoptcache.h new file mode 100644 index 0000000000000000000000000000000000000000..a1a9bfc0fb9069e4e481d1f0164efd158fec89c7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/attoptcache.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * attoptcache.h + * Attribute options cache. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/attoptcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef ATTOPTCACHE_H +#define ATTOPTCACHE_H + +/* + * Attribute options. + */ +typedef struct AttributeOpts +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + float8 n_distinct; + float8 n_distinct_inherited; +} AttributeOpts; + +extern AttributeOpts *get_attribute_options(Oid attrelid, int attnum); + +#endif /* ATTOPTCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/backend_progress.h b/platform/dbops/binaries/postgres/include/server/utils/backend_progress.h new file mode 100644 index 0000000000000000000000000000000000000000..7b63d38f9756f92a951e3764973be4941fb0107d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/backend_progress.h @@ -0,0 +1,46 @@ +/* ---------- + * backend_progress.h + * Command progress reporting definition. + * + * Note that this file provides the infrastructure for storing a single + * backend's command progress counters, without ascribing meaning to the + * individual fields. See commands/progress.h and system_views.sql for that. + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/utils/backend_progress.h + * ---------- + */ +#ifndef BACKEND_PROGRESS_H +#define BACKEND_PROGRESS_H + + +/* ---------- + * Command type for progress reporting purposes + * ---------- + */ +typedef enum ProgressCommandType +{ + PROGRESS_COMMAND_INVALID, + PROGRESS_COMMAND_VACUUM, + PROGRESS_COMMAND_ANALYZE, + PROGRESS_COMMAND_CLUSTER, + PROGRESS_COMMAND_CREATE_INDEX, + PROGRESS_COMMAND_BASEBACKUP, + PROGRESS_COMMAND_COPY, +} ProgressCommandType; + +#define PGSTAT_NUM_PROGRESS_PARAM 20 + + +extern void pgstat_progress_start_command(ProgressCommandType cmdtype, + Oid relid); +extern void pgstat_progress_update_param(int index, int64 val); +extern void pgstat_progress_incr_param(int index, int64 incr); +extern void pgstat_progress_parallel_incr_param(int index, int64 incr); +extern void pgstat_progress_update_multi_param(int nparam, const int *index, + const int64 *val); +extern void pgstat_progress_end_command(void); + + +#endif /* BACKEND_PROGRESS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/backend_status.h b/platform/dbops/binaries/postgres/include/server/utils/backend_status.h new file mode 100644 index 0000000000000000000000000000000000000000..7b7f6f59d07a815e65777e3ab386d82caa500f52 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/backend_status.h @@ -0,0 +1,340 @@ +/* ---------- + * backend_status.h + * Definitions related to backend status reporting + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/utils/backend_status.h + * ---------- + */ +#ifndef BACKEND_STATUS_H +#define BACKEND_STATUS_H + +#include "datatype/timestamp.h" +#include "libpq/pqcomm.h" +#include "miscadmin.h" /* for BackendType */ +#include "storage/procnumber.h" +#include "utils/backend_progress.h" + + +/* ---------- + * Backend states + * ---------- + */ +typedef enum BackendState +{ + STATE_UNDEFINED, + STATE_IDLE, + STATE_RUNNING, + STATE_IDLEINTRANSACTION, + STATE_FASTPATH, + STATE_IDLEINTRANSACTION_ABORTED, + STATE_DISABLED, +} BackendState; + + +/* ---------- + * Shared-memory data structures + * ---------- + */ + +/* + * PgBackendSSLStatus + * + * For each backend, we keep the SSL status in a separate struct, that + * is only filled in if SSL is enabled. + * + * All char arrays must be null-terminated. + */ +typedef struct PgBackendSSLStatus +{ + /* Information about SSL connection */ + int ssl_bits; + char ssl_version[NAMEDATALEN]; + char ssl_cipher[NAMEDATALEN]; + char ssl_client_dn[NAMEDATALEN]; + + /* + * serial number is max "20 octets" per RFC 5280, so this size should be + * fine + */ + char ssl_client_serial[NAMEDATALEN]; + + char ssl_issuer_dn[NAMEDATALEN]; +} PgBackendSSLStatus; + +/* + * PgBackendGSSStatus + * + * For each backend, we keep the GSS status in a separate struct, that + * is only filled in if GSS is enabled. + * + * All char arrays must be null-terminated. + */ +typedef struct PgBackendGSSStatus +{ + /* Information about GSSAPI connection */ + char gss_princ[NAMEDATALEN]; /* GSSAPI Principal used to auth */ + bool gss_auth; /* If GSSAPI authentication was used */ + bool gss_enc; /* If encryption is being used */ + bool gss_delegation; /* If credentials delegated */ + +} PgBackendGSSStatus; + + +/* ---------- + * PgBackendStatus + * + * Each live backend maintains a PgBackendStatus struct in shared memory + * showing its current activity. (The structs are allocated according to + * ProcNumber, but that is not critical.) Note that this is unrelated to the + * cumulative stats system (i.e. pgstat.c et al). + * + * Each auxiliary process also maintains a PgBackendStatus struct in shared + * memory. + * ---------- + */ +typedef struct PgBackendStatus +{ + /* + * To avoid locking overhead, we use the following protocol: a backend + * increments st_changecount before modifying its entry, and again after + * finishing a modification. A would-be reader should note the value of + * st_changecount, copy the entry into private memory, then check + * st_changecount again. If the value hasn't changed, and if it's even, + * the copy is valid; otherwise start over. This makes updates cheap + * while reads are potentially expensive, but that's the tradeoff we want. + * + * The above protocol needs memory barriers to ensure that the apparent + * order of execution is as it desires. Otherwise, for example, the CPU + * might rearrange the code so that st_changecount is incremented twice + * before the modification on a machine with weak memory ordering. Hence, + * use the macros defined below for manipulating st_changecount, rather + * than touching it directly. + */ + int st_changecount; + + /* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */ + int st_procpid; + + /* Type of backends */ + BackendType st_backendType; + + /* Times when current backend, transaction, and activity started */ + TimestampTz st_proc_start_timestamp; + TimestampTz st_xact_start_timestamp; + TimestampTz st_activity_start_timestamp; + TimestampTz st_state_start_timestamp; + + /* Database OID, owning user's OID, connection client address */ + Oid st_databaseid; + Oid st_userid; + SockAddr st_clientaddr; + char *st_clienthostname; /* MUST be null-terminated */ + + /* Information about SSL connection */ + bool st_ssl; + PgBackendSSLStatus *st_sslstatus; + + /* Information about GSSAPI connection */ + bool st_gss; + PgBackendGSSStatus *st_gssstatus; + + /* current state */ + BackendState st_state; + + /* application name; MUST be null-terminated */ + char *st_appname; + + /* + * Current command string; MUST be null-terminated. Note that this string + * possibly is truncated in the middle of a multi-byte character. As + * activity strings are stored more frequently than read, that allows to + * move the cost of correct truncation to the display side. Use + * pgstat_clip_activity() to truncate correctly. + */ + char *st_activity_raw; + + /* + * Command progress reporting. Any command which wishes can advertise + * that it is running by setting st_progress_command, + * st_progress_command_target, and st_progress_param[]. + * st_progress_command_target should be the OID of the relation which the + * command targets (we assume there's just one, as this is meant for + * utility commands), but the meaning of each element in the + * st_progress_param array is command-specific. + */ + ProgressCommandType st_progress_command; + Oid st_progress_command_target; + int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]; + + /* query identifier, optionally computed using post_parse_analyze_hook */ + uint64 st_query_id; +} PgBackendStatus; + + +/* + * Macros to load and store st_changecount with appropriate memory barriers. + * + * Use PGSTAT_BEGIN_WRITE_ACTIVITY() before, and PGSTAT_END_WRITE_ACTIVITY() + * after, modifying the current process's PgBackendStatus data. Note that, + * since there is no mechanism for cleaning up st_changecount after an error, + * THESE MACROS FORM A CRITICAL SECTION. Any error between them will be + * promoted to PANIC, causing a database restart to clean up shared memory! + * Hence, keep the critical section as short and straight-line as possible. + * Aside from being safer, that minimizes the window in which readers will + * have to loop. + * + * Reader logic should follow this sketch: + * + * for (;;) + * { + * int before_ct, after_ct; + * + * pgstat_begin_read_activity(beentry, before_ct); + * ... copy beentry data to local memory ... + * pgstat_end_read_activity(beentry, after_ct); + * if (pgstat_read_activity_complete(before_ct, after_ct)) + * break; + * CHECK_FOR_INTERRUPTS(); + * } + * + * For extra safety, we generally use volatile beentry pointers, although + * the memory barriers should theoretically be sufficient. + */ +#define PGSTAT_BEGIN_WRITE_ACTIVITY(beentry) \ + do { \ + START_CRIT_SECTION(); \ + (beentry)->st_changecount++; \ + pg_write_barrier(); \ + } while (0) + +#define PGSTAT_END_WRITE_ACTIVITY(beentry) \ + do { \ + pg_write_barrier(); \ + (beentry)->st_changecount++; \ + Assert(((beentry)->st_changecount & 1) == 0); \ + END_CRIT_SECTION(); \ + } while (0) + +#define pgstat_begin_read_activity(beentry, before_changecount) \ + do { \ + (before_changecount) = (beentry)->st_changecount; \ + pg_read_barrier(); \ + } while (0) + +#define pgstat_end_read_activity(beentry, after_changecount) \ + do { \ + pg_read_barrier(); \ + (after_changecount) = (beentry)->st_changecount; \ + } while (0) + +#define pgstat_read_activity_complete(before_changecount, after_changecount) \ + ((before_changecount) == (after_changecount) && \ + ((before_changecount) & 1) == 0) + + +/* ---------- + * LocalPgBackendStatus + * + * When we build the backend status array, we use LocalPgBackendStatus to be + * able to add new values to the struct when needed without adding new fields + * to the shared memory. It contains the backend status as a first member. + * ---------- + */ +typedef struct LocalPgBackendStatus +{ + /* + * Local version of the backend status entry. + */ + PgBackendStatus backendStatus; + + /* + * The proc number. + */ + ProcNumber proc_number; + + /* + * The xid of the current transaction if available, InvalidTransactionId + * if not. + */ + TransactionId backend_xid; + + /* + * The xmin of the current session if available, InvalidTransactionId if + * not. + */ + TransactionId backend_xmin; + + /* + * Number of cached subtransactions in the current session. + */ + int backend_subxact_count; + + /* + * The number of subtransactions in the current session which exceeded the + * cached subtransaction limit. + */ + bool backend_subxact_overflowed; +} LocalPgBackendStatus; + + +/* ---------- + * GUC parameters + * ---------- + */ +extern PGDLLIMPORT bool pgstat_track_activities; +extern PGDLLIMPORT int pgstat_track_activity_query_size; + + +/* ---------- + * Other global variables + * ---------- + */ +extern PGDLLIMPORT PgBackendStatus *MyBEEntry; + + +/* ---------- + * Functions called from postmaster + * ---------- + */ +extern Size BackendStatusShmemSize(void); +extern void CreateSharedBackendStatus(void); + + +/* ---------- + * Functions called from backends + * ---------- + */ + +/* Initialization functions */ +extern void pgstat_beinit(void); +extern void pgstat_bestart(void); + +extern void pgstat_clear_backend_activity_snapshot(void); + +/* Activity reporting functions */ +extern void pgstat_report_activity(BackendState state, const char *cmd_str); +extern void pgstat_report_query_id(uint64 query_id, bool force); +extern void pgstat_report_tempfile(size_t filesize); +extern void pgstat_report_appname(const char *appname); +extern void pgstat_report_xact_timestamp(TimestampTz tstamp); +extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); +extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer, + int buflen); +extern uint64 pgstat_get_my_query_id(void); + + +/* ---------- + * Support functions for the SQL-callable functions to + * generate the pgstat* views. + * ---------- + */ +extern int pgstat_fetch_stat_numbackends(void); +extern PgBackendStatus *pgstat_get_beentry_by_proc_number(ProcNumber procNumber); +extern LocalPgBackendStatus *pgstat_get_local_beentry_by_proc_number(ProcNumber procNumber); +extern LocalPgBackendStatus *pgstat_get_local_beentry_by_index(int idx); +extern char *pgstat_clip_activity(const char *raw_activity); + + +#endif /* BACKEND_STATUS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/builtins.h b/platform/dbops/binaries/postgres/include/server/utils/builtins.h new file mode 100644 index 0000000000000000000000000000000000000000..359c570f23e20e36cfcc461f2fa88b26f21b656d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/builtins.h @@ -0,0 +1,139 @@ +/*------------------------------------------------------------------------- + * + * builtins.h + * Declarations for operations on built-in types. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/builtins.h + * + *------------------------------------------------------------------------- + */ +#ifndef BUILTINS_H +#define BUILTINS_H + +#include "fmgr.h" +#include "nodes/nodes.h" +#include "utils/fmgrprotos.h" + +/* Sign + the most decimal digits an 8-byte number could have */ +#define MAXINT8LEN 20 + +/* bool.c */ +extern bool parse_bool(const char *value, bool *result); +extern bool parse_bool_with_len(const char *value, size_t len, bool *result); + +/* domains.c */ +extern void domain_check(Datum value, bool isnull, Oid domainType, + void **extra, MemoryContext mcxt); +extern bool domain_check_safe(Datum value, bool isnull, Oid domainType, + void **extra, MemoryContext mcxt, + Node *escontext); +extern int errdatatype(Oid datatypeOid); +extern int errdomainconstraint(Oid datatypeOid, const char *conname); + +/* encode.c */ +extern uint64 hex_encode(const char *src, size_t len, char *dst); +extern uint64 hex_decode(const char *src, size_t len, char *dst); +extern uint64 hex_decode_safe(const char *src, size_t len, char *dst, + Node *escontext); + +/* int.c */ +extern int2vector *buildint2vector(const int16 *int2s, int n); + +/* name.c */ +extern void namestrcpy(Name name, const char *str); +extern int namestrcmp(Name name, const char *str); + +/* numutils.c */ +extern int16 pg_strtoint16(const char *s); +extern int16 pg_strtoint16_safe(const char *s, Node *escontext); +extern int32 pg_strtoint32(const char *s); +extern int32 pg_strtoint32_safe(const char *s, Node *escontext); +extern int64 pg_strtoint64(const char *s); +extern int64 pg_strtoint64_safe(const char *s, Node *escontext); +extern uint32 uint32in_subr(const char *s, char **endloc, + const char *typname, Node *escontext); +extern uint64 uint64in_subr(const char *s, char **endloc, + const char *typname, Node *escontext); +extern int pg_itoa(int16 i, char *a); +extern int pg_ultoa_n(uint32 value, char *a); +extern int pg_ulltoa_n(uint64 value, char *a); +extern int pg_ltoa(int32 value, char *a); +extern int pg_lltoa(int64 value, char *a); +extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth); +extern char *pg_ultostr(char *str, uint32 value); + +/* oid.c */ +extern oidvector *buildoidvector(const Oid *oids, int n); +extern Oid oidparse(Node *node); +extern int oid_cmp(const void *p1, const void *p2); + +/* regexp.c */ +extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive, + Oid collation, bool *exact); + +/* ruleutils.c */ +extern PGDLLIMPORT bool quote_all_identifiers; +extern const char *quote_identifier(const char *ident); +extern char *quote_qualified_identifier(const char *qualifier, + const char *ident); +extern void generate_operator_clause(fmStringInfo buf, + const char *leftop, Oid leftoptype, + Oid opoid, + const char *rightop, Oid rightoptype); + +/* varchar.c */ +extern int bpchartruelen(char *s, int len); + +/* popular functions from varlena.c */ +extern text *cstring_to_text(const char *s); +extern text *cstring_to_text_with_len(const char *s, int len); +extern char *text_to_cstring(const text *t); +extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len); + +#define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s)) +#define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d)) + +/* xid.c */ +extern int xidComparator(const void *arg1, const void *arg2); +extern int xidLogicalComparator(const void *arg1, const void *arg2); + +/* inet_cidr_ntop.c */ +extern char *pg_inet_cidr_ntop(int af, const void *src, int bits, + char *dst, size_t size); + +/* inet_net_pton.c */ +extern int pg_inet_net_pton(int af, const char *src, + void *dst, size_t size); + +/* network.c */ +extern double convert_network_to_scalar(Datum value, Oid typid, bool *failure); +extern Datum network_scan_first(Datum in); +extern Datum network_scan_last(Datum in); +extern void clean_ipv6_addr(int addr_family, char *addr); + +/* numeric.c */ +extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS); + +/* format_type.c */ + +/* Control flags for format_type_extended */ +#define FORMAT_TYPE_TYPEMOD_GIVEN 0x01 /* typemod defined by caller */ +#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */ +#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */ +#define FORMAT_TYPE_INVALID_AS_NULL 0x08 /* NULL if undefined */ +extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags); + +extern char *format_type_be(Oid type_oid); +extern char *format_type_be_qualified(Oid type_oid); +extern char *format_type_with_typemod(Oid type_oid, int32 typemod); + +extern int32 type_maximum_size(Oid type_oid, int32 typemod); + +/* quote.c */ +extern char *quote_literal_cstr(const char *rawstr); + +#endif /* BUILTINS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/bytea.h b/platform/dbops/binaries/postgres/include/server/utils/bytea.h new file mode 100644 index 0000000000000000000000000000000000000000..dcc55d879b920559e36c92d770fd6296ecd2f714 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/bytea.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * bytea.h + * Declarations for BYTEA data type support. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/bytea.h + * + *------------------------------------------------------------------------- + */ +#ifndef BYTEA_H +#define BYTEA_H + + + +typedef enum +{ + BYTEA_OUTPUT_ESCAPE, + BYTEA_OUTPUT_HEX, +} ByteaOutputType; + +extern PGDLLIMPORT int bytea_output; /* ByteaOutputType, but int for GUC + * enum */ + +#endif /* BYTEA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/cash.h b/platform/dbops/binaries/postgres/include/server/utils/cash.h new file mode 100644 index 0000000000000000000000000000000000000000..55d45fadd4815415f8bb5289d82776026df901b4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/cash.h @@ -0,0 +1,35 @@ +/* + * src/include/utils/cash.h + * + * + * cash.h + * Written by D'Arcy J.M. Cain + * + * Functions to allow input and output of money normally but store + * and handle it as 64 bit integer. + */ + +#ifndef CASH_H +#define CASH_H + +#include "fmgr.h" + +typedef int64 Cash; + +/* Cash is pass-by-reference if and only if int64 is */ +static inline Cash +DatumGetCash(Datum X) +{ + return DatumGetInt64(X); +} + +static inline Datum +CashGetDatum(Cash X) +{ + return Int64GetDatum(X); +} + +#define PG_GETARG_CASH(n) DatumGetCash(PG_GETARG_DATUM(n)) +#define PG_RETURN_CASH(x) return CashGetDatum(x) + +#endif /* CASH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/catcache.h b/platform/dbops/binaries/postgres/include/server/utils/catcache.h new file mode 100644 index 0000000000000000000000000000000000000000..99169a93d91459e06d6f40a39def312adcfecabf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/catcache.h @@ -0,0 +1,231 @@ +/*------------------------------------------------------------------------- + * + * catcache.h + * Low-level catalog cache definitions. + * + * NOTE: every catalog cache must have a corresponding unique index on + * the system table that it caches --- ie, the index must match the keys + * used to do lookups in this cache. All cache fetches are done with + * indexscans (under normal conditions). The index should be unique to + * guarantee that there can only be one matching row for a key combination. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/catcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef CATCACHE_H +#define CATCACHE_H + +#include "access/htup.h" +#include "access/skey.h" +#include "lib/ilist.h" +#include "utils/relcache.h" + +/* + * struct catctup: individual tuple in the cache. + * struct catclist: list of tuples matching a partial key. + * struct catcache: information for managing a cache. + * struct catcacheheader: information for managing all the caches. + */ + +#define CATCACHE_MAXKEYS 4 + + +/* function computing a datum's hash */ +typedef uint32 (*CCHashFN) (Datum datum); + +/* function computing equality of two datums */ +typedef bool (*CCFastEqualFN) (Datum a, Datum b); + +typedef struct catcache +{ + int id; /* cache identifier --- see syscache.h */ + int cc_nbuckets; /* # of hash buckets in this cache */ + TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */ + dlist_head *cc_bucket; /* hash buckets */ + CCHashFN cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */ + CCFastEqualFN cc_fastequal[CATCACHE_MAXKEYS]; /* fast equal function for + * each key */ + int cc_keyno[CATCACHE_MAXKEYS]; /* AttrNumber of each key */ + int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */ + int cc_ntup; /* # of tuples currently in this cache */ + int cc_nlist; /* # of CatCLists currently in this cache */ + int cc_nlbuckets; /* # of CatCList hash buckets in this cache */ + dlist_head *cc_lbucket; /* hash buckets for CatCLists */ + const char *cc_relname; /* name of relation the tuples come from */ + Oid cc_reloid; /* OID of relation the tuples come from */ + Oid cc_indexoid; /* OID of index matching cache keys */ + bool cc_relisshared; /* is relation shared across databases? */ + slist_node cc_next; /* list link */ + ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap + * scans */ + + /* + * Keep these at the end, so that compiling catcache.c with CATCACHE_STATS + * doesn't break ABI for other modules + */ +#ifdef CATCACHE_STATS + long cc_searches; /* total # searches against this cache */ + long cc_hits; /* # of matches against existing entry */ + long cc_neg_hits; /* # of matches against negative entry */ + long cc_newloads; /* # of successful loads of new entry */ + + /* + * cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of failed + * searches, each of which will result in loading a negative entry + */ + long cc_invals; /* # of entries invalidated from cache */ + long cc_lsearches; /* total # list-searches */ + long cc_lhits; /* # of matches against existing lists */ +#endif +} CatCache; + + +typedef struct catctup +{ + int ct_magic; /* for identifying CatCTup entries */ +#define CT_MAGIC 0x57261502 + + uint32 hash_value; /* hash value for this tuple's keys */ + + /* + * Lookup keys for the entry. By-reference datums point into the tuple for + * positive cache entries, and are separately allocated for negative ones. + */ + Datum keys[CATCACHE_MAXKEYS]; + + /* + * Each tuple in a cache is a member of a dlist that stores the elements + * of its hash bucket. We keep each dlist in LRU order to speed repeated + * lookups. + */ + dlist_node cache_elem; /* list member of per-bucket list */ + + /* + * A tuple marked "dead" must not be returned by subsequent searches. + * However, it won't be physically deleted from the cache until its + * refcount goes to zero. (If it's a member of a CatCList, the list's + * refcount must go to zero, too; also, remember to mark the list dead at + * the same time the tuple is marked.) + * + * A negative cache entry is an assertion that there is no tuple matching + * a particular key. This is just as useful as a normal entry so far as + * avoiding catalog searches is concerned. Management of positive and + * negative entries is identical. + */ + int refcount; /* number of active references */ + bool dead; /* dead but not yet removed? */ + bool negative; /* negative cache entry? */ + HeapTupleData tuple; /* tuple management header */ + + /* + * The tuple may also be a member of at most one CatCList. (If a single + * catcache is list-searched with varying numbers of keys, we may have to + * make multiple entries for the same tuple because of this restriction. + * Currently, that's not expected to be common, so we accept the potential + * inefficiency.) + */ + struct catclist *c_list; /* containing CatCList, or NULL if none */ + + CatCache *my_cache; /* link to owning catcache */ + /* properly aligned tuple data follows, unless a negative entry */ +} CatCTup; + + +/* + * A CatCList describes the result of a partial search, ie, a search using + * only the first K key columns of an N-key cache. We store the keys used + * into the keys attribute to represent the stored key set. The CatCList + * object contains links to cache entries for all the table rows satisfying + * the partial key. (Note: none of these will be negative cache entries.) + * + * A CatCList is only a member of a per-cache list; we do not currently + * divide them into hash buckets. + * + * A list marked "dead" must not be returned by subsequent searches. + * However, it won't be physically deleted from the cache until its + * refcount goes to zero. (A list should be marked dead if any of its + * member entries are dead.) + * + * If "ordered" is true then the member tuples appear in the order of the + * cache's underlying index. This will be true in normal operation, but + * might not be true during bootstrap or recovery operations. (namespace.c + * is able to save some cycles when it is true.) + */ +typedef struct catclist +{ + int cl_magic; /* for identifying CatCList entries */ +#define CL_MAGIC 0x52765103 + + uint32 hash_value; /* hash value for lookup keys */ + + dlist_node cache_elem; /* list member of per-catcache list */ + + /* + * Lookup keys for the entry, with the first nkeys elements being valid. + * All by-reference are separately allocated. + */ + Datum keys[CATCACHE_MAXKEYS]; + + int refcount; /* number of active references */ + bool dead; /* dead but not yet removed? */ + bool ordered; /* members listed in index order? */ + short nkeys; /* number of lookup keys specified */ + int n_members; /* number of member tuples */ + CatCache *my_cache; /* link to owning catcache */ + CatCTup *members[FLEXIBLE_ARRAY_MEMBER]; /* members */ +} CatCList; + + +typedef struct catcacheheader +{ + slist_head ch_caches; /* head of list of CatCache structs */ + int ch_ntup; /* # of tuples in all caches */ +} CatCacheHeader; + + +/* this extern duplicates utils/memutils.h... */ +extern PGDLLIMPORT MemoryContext CacheMemoryContext; + +extern void CreateCacheMemoryContext(void); + +extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid, + int nkeys, const int *key, + int nbuckets); +extern void InitCatCachePhase2(CatCache *cache, bool touch_index); + +extern HeapTuple SearchCatCache(CatCache *cache, + Datum v1, Datum v2, Datum v3, Datum v4); +extern HeapTuple SearchCatCache1(CatCache *cache, + Datum v1); +extern HeapTuple SearchCatCache2(CatCache *cache, + Datum v1, Datum v2); +extern HeapTuple SearchCatCache3(CatCache *cache, + Datum v1, Datum v2, Datum v3); +extern HeapTuple SearchCatCache4(CatCache *cache, + Datum v1, Datum v2, Datum v3, Datum v4); +extern void ReleaseCatCache(HeapTuple tuple); + +extern uint32 GetCatCacheHashValue(CatCache *cache, + Datum v1, Datum v2, + Datum v3, Datum v4); + +extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys, + Datum v1, Datum v2, + Datum v3); +extern void ReleaseCatCacheList(CatCList *list); + +extern void ResetCatalogCaches(void); +extern void ResetCatalogCachesExt(bool debug_discard); +extern void CatalogCacheFlushCatalog(Oid catId); +extern void CatCacheInvalidate(CatCache *cache, uint32 hashValue); +extern void PrepareToInvalidateCacheTuple(Relation relation, + HeapTuple tuple, + HeapTuple newtuple, + void (*function) (int, uint32, Oid)); + +#endif /* CATCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/combocid.h b/platform/dbops/binaries/postgres/include/server/utils/combocid.h new file mode 100644 index 0000000000000000000000000000000000000000..00a9b561ec98fe9271aa797f265ebfbb3b278785 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/combocid.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * combocid.h + * Combo command ID support routines + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/combocid.h + * + *------------------------------------------------------------------------- + */ +#ifndef COMBOCID_H +#define COMBOCID_H + +/* + * HeapTupleHeaderGetCmin and HeapTupleHeaderGetCmax function prototypes + * are in access/htup.h, because that's where the macro definitions that + * those functions replaced used to be. + */ + +extern void AtEOXact_ComboCid(void); +extern void RestoreComboCIDState(char *comboCIDstate); +extern void SerializeComboCIDState(Size maxsize, char *start_address); +extern Size EstimateComboCIDStateSpace(void); + +#endif /* COMBOCID_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/conffiles.h b/platform/dbops/binaries/postgres/include/server/utils/conffiles.h new file mode 100644 index 0000000000000000000000000000000000000000..82ca89bbccf5a91adf6f06ae8c201336614317b2 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/conffiles.h @@ -0,0 +1,27 @@ +/*-------------------------------------------------------------------- + * conffiles.h + * + * Utilities related to configuration files. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/conffiles.h + * + *-------------------------------------------------------------------- + */ +#ifndef CONFFILES_H +#define CONFFILES_H + +/* recursion nesting depth for configuration files */ +#define CONF_FILE_START_DEPTH 0 +#define CONF_FILE_MAX_DEPTH 10 + +extern char *AbsoluteConfigLocation(const char *location, + const char *calling_file); +extern char **GetConfFilesInDir(const char *includedir, + const char *calling_file, + int elevel, int *num_filenames, + char **err_msg); + +#endif /* CONFFILES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/date.h b/platform/dbops/binaries/postgres/include/server/utils/date.h new file mode 100644 index 0000000000000000000000000000000000000000..aaed6471a633a05d2e8377450009350c01e5e350 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/date.h @@ -0,0 +1,118 @@ +/*------------------------------------------------------------------------- + * + * date.h + * Definitions for the SQL "date" and "time" types. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/date.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATE_H +#define DATE_H + +#include + +#include "datatype/timestamp.h" +#include "fmgr.h" +#include "pgtime.h" + +typedef int32 DateADT; + +typedef int64 TimeADT; + +typedef struct +{ + TimeADT time; /* all time units other than months and years */ + int32 zone; /* numeric time zone, in seconds */ +} TimeTzADT; + +/* + * Infinity and minus infinity must be the max and min values of DateADT. + */ +#define DATEVAL_NOBEGIN ((DateADT) PG_INT32_MIN) +#define DATEVAL_NOEND ((DateADT) PG_INT32_MAX) + +#define DATE_NOBEGIN(j) ((j) = DATEVAL_NOBEGIN) +#define DATE_IS_NOBEGIN(j) ((j) == DATEVAL_NOBEGIN) +#define DATE_NOEND(j) ((j) = DATEVAL_NOEND) +#define DATE_IS_NOEND(j) ((j) == DATEVAL_NOEND) +#define DATE_NOT_FINITE(j) (DATE_IS_NOBEGIN(j) || DATE_IS_NOEND(j)) + +#define MAX_TIME_PRECISION 6 + +/* + * Functions for fmgr-callable functions. + * + * For TimeADT, we make use of the same support routines as for int64. + * Therefore TimeADT is pass-by-reference if and only if int64 is! + */ +static inline DateADT +DatumGetDateADT(Datum X) +{ + return (DateADT) DatumGetInt32(X); +} + +static inline TimeADT +DatumGetTimeADT(Datum X) +{ + return (TimeADT) DatumGetInt64(X); +} + +static inline TimeTzADT * +DatumGetTimeTzADTP(Datum X) +{ + return (TimeTzADT *) DatumGetPointer(X); +} + +static inline Datum +DateADTGetDatum(DateADT X) +{ + return Int32GetDatum(X); +} + +static inline Datum +TimeADTGetDatum(TimeADT X) +{ + return Int64GetDatum(X); +} + +static inline Datum +TimeTzADTPGetDatum(const TimeTzADT *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMEADT(n) DatumGetTimeADT(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMETZADT_P(n) DatumGetTimeTzADTP(PG_GETARG_DATUM(n)) + +#define PG_RETURN_DATEADT(x) return DateADTGetDatum(x) +#define PG_RETURN_TIMEADT(x) return TimeADTGetDatum(x) +#define PG_RETURN_TIMETZADT_P(x) return TimeTzADTPGetDatum(x) + + +/* date.c */ +extern int32 anytime_typmod_check(bool istz, int32 typmod); +extern double date2timestamp_no_overflow(DateADT dateVal); +extern Timestamp date2timestamp_opt_overflow(DateADT dateVal, int *overflow); +extern TimestampTz date2timestamptz_opt_overflow(DateADT dateVal, int *overflow); +extern int32 date_cmp_timestamp_internal(DateADT dateVal, Timestamp dt2); +extern int32 date_cmp_timestamptz_internal(DateADT dateVal, TimestampTz dt2); + +extern void EncodeSpecialDate(DateADT dt, char *str); +extern DateADT GetSQLCurrentDate(void); +extern TimeTzADT *GetSQLCurrentTime(int32 typmod); +extern TimeADT GetSQLLocalTime(int32 typmod); +extern int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec); +extern int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp); +extern int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result); +extern int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result); +extern bool time_overflows(int hour, int min, int sec, fsec_t fsec); +extern bool float_time_overflows(int hour, int min, double sec); +extern void AdjustTimeForTypmod(TimeADT *time, int32 typmod); + +#endif /* DATE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/datetime.h b/platform/dbops/binaries/postgres/include/server/utils/datetime.h new file mode 100644 index 0000000000000000000000000000000000000000..e4ac2b8e7f6c9b5551e7779470cde77c6da3e665 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/datetime.h @@ -0,0 +1,367 @@ +/*------------------------------------------------------------------------- + * + * datetime.h + * Definitions for date/time support code. + * The support code is shared with other date data types, + * including date, and time. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/datetime.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATETIME_H +#define DATETIME_H + +#include "utils/timestamp.h" + +/* this struct is declared in utils/tzparser.h: */ +struct tzEntry; + + +/* ---------------------------------------------------------------- + * time types + support macros + * + * String definitions for standard time quantities. + * + * These strings are the defaults used to form output time strings. + * Other alternative forms are hardcoded into token tables in datetime.c. + * ---------------------------------------------------------------- + */ + +#define DAGO "ago" +#define DCURRENT "current" +#define EPOCH "epoch" +#define INVALID "invalid" +#define EARLY "-infinity" +#define LATE "infinity" +#define NOW "now" +#define TODAY "today" +#define TOMORROW "tomorrow" +#define YESTERDAY "yesterday" +#define ZULU "zulu" + +#define DMICROSEC "usecond" +#define DMILLISEC "msecond" +#define DSECOND "second" +#define DMINUTE "minute" +#define DHOUR "hour" +#define DDAY "day" +#define DWEEK "week" +#define DMONTH "month" +#define DQUARTER "quarter" +#define DYEAR "year" +#define DDECADE "decade" +#define DCENTURY "century" +#define DMILLENNIUM "millennium" +#define DA_D "ad" +#define DB_C "bc" +#define DTIMEZONE "timezone" + +/* + * Fundamental time field definitions for parsing. + * + * Meridian: am, pm, or 24-hour style. + * Millennium: ad, bc + */ + +#define AM 0 +#define PM 1 +#define HR24 2 + +#define AD 0 +#define BC 1 + +/* + * Field types for time decoding. + * + * Can't have more of these than there are bits in an unsigned int + * since these are turned into bit masks during parsing and decoding. + * + * Furthermore, the values for YEAR, MONTH, DAY, HOUR, MINUTE, SECOND + * must be in the range 0..14 so that the associated bitmasks can fit + * into the left half of an INTERVAL's typmod value. Since those bits + * are stored in typmods, you can't change them without initdb! + */ + +#define RESERV 0 +#define MONTH 1 +#define YEAR 2 +#define DAY 3 +#define JULIAN 4 +#define TZ 5 /* fixed-offset timezone abbreviation */ +#define DTZ 6 /* fixed-offset timezone abbrev, DST */ +#define DYNTZ 7 /* dynamic timezone abbreviation */ +#define IGNORE_DTF 8 +#define AMPM 9 +#define HOUR 10 +#define MINUTE 11 +#define SECOND 12 +#define MILLISECOND 13 +#define MICROSECOND 14 +#define DOY 15 +#define DOW 16 +#define UNITS 17 +#define ADBC 18 +/* these are only for relative dates */ +#define AGO 19 +#define ABS_BEFORE 20 +#define ABS_AFTER 21 +/* generic fields to help with parsing */ +#define ISODATE 22 +#define ISOTIME 23 +/* these are only for parsing intervals */ +#define WEEK 24 +#define DECADE 25 +#define CENTURY 26 +#define MILLENNIUM 27 +/* hack for parsing two-word timezone specs "MET DST" etc */ +#define DTZMOD 28 /* "DST" as a separate word */ +/* reserved for unrecognized string values */ +#define UNKNOWN_FIELD 31 + +/* + * Token field definitions for time parsing and decoding. + * + * Some field type codes (see above) use these as the "value" in datetktbl[]. + * These are also used for bit masks in DecodeDateTime and friends + * so actually restrict them to within [0,31] for now. + * - thomas 97/06/19 + * Not all of these fields are used for masks in DecodeDateTime + * so allow some larger than 31. - thomas 1997-11-17 + * + * Caution: there are undocumented assumptions in the code that most of these + * values are not equal to IGNORE_DTF nor RESERV. Be very careful when + * renumbering values in either of these apparently-independent lists :-( + */ + +#define DTK_NUMBER 0 +#define DTK_STRING 1 + +#define DTK_DATE 2 +#define DTK_TIME 3 +#define DTK_TZ 4 +#define DTK_AGO 5 + +#define DTK_SPECIAL 6 +#define DTK_EARLY 9 +#define DTK_LATE 10 +#define DTK_EPOCH 11 +#define DTK_NOW 12 +#define DTK_YESTERDAY 13 +#define DTK_TODAY 14 +#define DTK_TOMORROW 15 +#define DTK_ZULU 16 + +#define DTK_DELTA 17 +#define DTK_SECOND 18 +#define DTK_MINUTE 19 +#define DTK_HOUR 20 +#define DTK_DAY 21 +#define DTK_WEEK 22 +#define DTK_MONTH 23 +#define DTK_QUARTER 24 +#define DTK_YEAR 25 +#define DTK_DECADE 26 +#define DTK_CENTURY 27 +#define DTK_MILLENNIUM 28 +#define DTK_MILLISEC 29 +#define DTK_MICROSEC 30 +#define DTK_JULIAN 31 + +#define DTK_DOW 32 +#define DTK_DOY 33 +#define DTK_TZ_HOUR 34 +#define DTK_TZ_MINUTE 35 +#define DTK_ISOYEAR 36 +#define DTK_ISODOW 37 + + +/* + * Bit mask definitions for time parsing. + */ + +#define DTK_M(t) (0x01 << (t)) + +/* Convenience: a second, plus any fractional component */ +#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) +#define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) +#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) + +/* + * Working buffer size for input and output of interval, timestamp, etc. + * Inputs that need more working space will be rejected early. Longer outputs + * will overrun buffers, so this must suffice for all possible output. As of + * this writing, interval_out() needs the most space at ~90 bytes. + */ +#define MAXDATELEN 128 +/* maximum possible number of fields in a date string */ +#define MAXDATEFIELDS 25 +/* only this many chars are stored in datetktbl */ +#define TOKMAXLEN 10 + +/* keep this struct small; it gets used a lot */ +typedef struct +{ + char token[TOKMAXLEN + 1]; /* always NUL-terminated */ + char type; /* see field type codes above */ + int32 value; /* meaning depends on type */ +} datetkn; + +/* one of its uses is in tables of time zone abbreviations */ +typedef struct TimeZoneAbbrevTable +{ + Size tblsize; /* size in bytes of TimeZoneAbbrevTable */ + int numabbrevs; /* number of entries in abbrevs[] array */ + datetkn abbrevs[FLEXIBLE_ARRAY_MEMBER]; + /* DynamicZoneAbbrev(s) may follow the abbrevs[] array */ +} TimeZoneAbbrevTable; + +/* auxiliary data for a dynamic time zone abbreviation (non-fixed-offset) */ +typedef struct DynamicZoneAbbrev +{ + pg_tz *tz; /* NULL if not yet looked up */ + char zone[FLEXIBLE_ARRAY_MEMBER]; /* NUL-terminated zone name */ +} DynamicZoneAbbrev; + + +/* FMODULO() + * Macro to replace modf(), which is broken on some platforms. + * t = input and remainder + * q = integer part + * u = divisor + */ +#define FMODULO(t,q,u) \ +do { \ + (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \ + if ((q) != 0) (t) -= rint((q) * (u)); \ +} while(0) + +/* TMODULO() + * Like FMODULO(), but work on the timestamp datatype (now always int64). + * We assume that int64 follows the C99 semantics for division (negative + * quotients truncate towards zero). + */ +#define TMODULO(t,q,u) \ +do { \ + (q) = ((t) / (u)); \ + if ((q) != 0) (t) -= ((q) * (u)); \ +} while(0) + +/* + * Date/time validation + * Include check for leap year. + */ + +extern PGDLLIMPORT const char *const months[]; /* months (3-char + * abbreviations) */ +extern PGDLLIMPORT const char *const days[]; /* days (full names) */ +extern PGDLLIMPORT const int day_tab[2][13]; + +/* + * These are the rules for the Gregorian calendar, which was adopted in 1582. + * However, we use this calculation for all prior years as well because the + * SQL standard specifies use of the Gregorian calendar. This prevents the + * date 1500-02-29 from being stored, even though it is valid in the Julian + * calendar. + */ +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + + +/* + * Datetime input parsing routines (ParseDateTime, DecodeDateTime, etc) + * return zero or a positive value on success. On failure, they return + * one of these negative code values. DateTimeParseError may be used to + * produce a suitable error report. For some of these codes, + * DateTimeParseError requires additional information, which is carried + * in struct DateTimeErrorExtra. + */ +#define DTERR_BAD_FORMAT (-1) +#define DTERR_FIELD_OVERFLOW (-2) +#define DTERR_MD_FIELD_OVERFLOW (-3) /* triggers hint about DateStyle */ +#define DTERR_INTERVAL_OVERFLOW (-4) +#define DTERR_TZDISP_OVERFLOW (-5) +#define DTERR_BAD_TIMEZONE (-6) +#define DTERR_BAD_ZONE_ABBREV (-7) + +typedef struct DateTimeErrorExtra +{ + /* Needed for DTERR_BAD_TIMEZONE and DTERR_BAD_ZONE_ABBREV: */ + const char *dtee_timezone; /* incorrect time zone name */ + /* Needed for DTERR_BAD_ZONE_ABBREV: */ + const char *dtee_abbrev; /* relevant time zone abbreviation */ +} DateTimeErrorExtra; + +/* Result codes for DecodeTimezoneName() */ +#define TZNAME_FIXED_OFFSET 0 +#define TZNAME_DYNTZ 1 +#define TZNAME_ZONE 2 + + +extern void GetCurrentDateTime(struct pg_tm *tm); +extern void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp); +extern void j2date(int jd, int *year, int *month, int *day); +extern int date2j(int year, int month, int day); + +extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, + char **field, int *ftype, + int maxfields, int *numfields); +extern int DecodeDateTime(char **field, int *ftype, int nf, + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, + DateTimeErrorExtra *extra); +extern int DecodeTimezone(const char *str, int *tzp); +extern int DecodeTimeOnly(char **field, int *ftype, int nf, + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, + DateTimeErrorExtra *extra); +extern int DecodeInterval(char **field, int *ftype, int nf, int range, + int *dtype, struct pg_itm_in *itm_in); +extern int DecodeISO8601Interval(char *str, + int *dtype, struct pg_itm_in *itm_in); + +extern void DateTimeParseError(int dterr, DateTimeErrorExtra *extra, + const char *str, const char *datatype, + struct Node *escontext); + +extern int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp); +extern int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp); +extern int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, + pg_tz *tzp, int *isdst); + +extern void EncodeDateOnly(struct pg_tm *tm, int style, char *str); +extern void EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); +extern void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); +extern void EncodeInterval(struct pg_itm *itm, int style, char *str); +extern void EncodeSpecialTimestamp(Timestamp dt, char *str); + +extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, + struct pg_tm *tm); + +extern int DecodeTimezoneAbbrev(int field, const char *lowtoken, + int *ftype, int *offset, pg_tz **tz, + DateTimeErrorExtra *extra); +extern int DecodeSpecial(int field, const char *lowtoken, int *val); +extern int DecodeUnits(int field, const char *lowtoken, int *val); + +extern int DecodeTimezoneName(const char *tzname, int *offset, pg_tz **tz); +extern pg_tz *DecodeTimezoneNameToTz(const char *tzname); + +extern int DecodeTimezoneAbbrevPrefix(const char *str, + int *offset, pg_tz **tz); + +extern int j2day(int date); + +extern struct Node *TemporalSimplify(int32 max_precis, struct Node *node); + +extern bool CheckDateTokenTables(void); + +extern TimeZoneAbbrevTable *ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, + int n); +extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl); + +extern bool AdjustTimestampForTypmod(Timestamp *time, int32 typmod, + struct Node *escontext); + +#endif /* DATETIME_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/datum.h b/platform/dbops/binaries/postgres/include/server/utils/datum.h new file mode 100644 index 0000000000000000000000000000000000000000..8e3728f1b551f79b33a3775283cec49902d4a43e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/datum.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------------------- + * + * datum.h + * POSTGRES Datum (abstract data type) manipulation routines. + * + * These routines are driven by the 'typbyval' and 'typlen' information, + * which must previously have been obtained by the caller for the datatype + * of the Datum. (We do it this way because in most situations the caller + * can look up the info just once and use it for many per-datum operations.) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/datum.h + * + *------------------------------------------------------------------------- + */ +#ifndef DATUM_H +#define DATUM_H + +/* + * datumGetSize - find the "real" length of a datum + */ +extern Size datumGetSize(Datum value, bool typByVal, int typLen); + +/* + * datumCopy - make a copy of a non-NULL datum. + * + * If the datatype is pass-by-reference, memory is obtained with palloc(). + */ +extern Datum datumCopy(Datum value, bool typByVal, int typLen); + +/* + * datumTransfer - transfer a non-NULL datum into the current memory context. + * + * Differs from datumCopy() in its handling of read-write expanded objects. + */ +extern Datum datumTransfer(Datum value, bool typByVal, int typLen); + +/* + * datumIsEqual + * return true if two datums of the same type are equal, false otherwise. + * + * XXX : See comments in the code for restrictions! + */ +extern bool datumIsEqual(Datum value1, Datum value2, + bool typByVal, int typLen); + +/* + * datum_image_eq + * + * Compares two datums for identical contents, based on byte images. Return + * true if the two datums are equal, false otherwise. + */ +extern bool datum_image_eq(Datum value1, Datum value2, + bool typByVal, int typLen); + +/* + * datum_image_hash + * + * Generates hash value for 'value' based on its bits rather than logical + * value. + */ +extern uint32 datum_image_hash(Datum value, bool typByVal, int typLen); + +/* + * Serialize and restore datums so that we can transfer them to parallel + * workers. + */ +extern Size datumEstimateSpace(Datum value, bool isnull, bool typByVal, + int typLen); +extern void datumSerialize(Datum value, bool isnull, bool typByVal, + int typLen, char **start_address); +extern Datum datumRestore(char **start_address, bool *isnull); + +#endif /* DATUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/dsa.h b/platform/dbops/binaries/postgres/include/server/utils/dsa.h new file mode 100644 index 0000000000000000000000000000000000000000..8dff964bf3334c908e566fe455f0015ae7d0e8b0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/dsa.h @@ -0,0 +1,166 @@ +/*------------------------------------------------------------------------- + * + * dsa.h + * Dynamic shared memory areas. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/dsa.h + * + *------------------------------------------------------------------------- + */ +#ifndef DSA_H +#define DSA_H + +#include "port/atomics.h" +#include "storage/dsm.h" + +/* The opaque type used for an area. */ +struct dsa_area; +typedef struct dsa_area dsa_area; + +/* + * If this system only uses a 32-bit value for size_t, then use the 32-bit + * implementation of DSA. This limits the amount of DSA that can be created + * to something significantly less than the entire 4GB address space because + * the DSA pointer must encode both a segment identifier and an offset, but + * that shouldn't be a significant limitation in practice. + * + * If this system doesn't support atomic operations on 64-bit values, then + * we fall back to 32-bit dsa_pointer for lack of other options. + * + * For testing purposes, USE_SMALL_DSA_POINTER can be defined to force the use + * of 32-bit dsa_pointer even on systems capable of supporting a 64-bit + * dsa_pointer. + */ +#if SIZEOF_SIZE_T == 4 || !defined(PG_HAVE_ATOMIC_U64_SUPPORT) || \ + defined(USE_SMALL_DSA_POINTER) +#define SIZEOF_DSA_POINTER 4 +#else +#define SIZEOF_DSA_POINTER 8 +#endif + +/* + * The type of 'relative pointers' to memory allocated by a dynamic shared + * area. dsa_pointer values can be shared with other processes, but must be + * converted to backend-local pointers before they can be dereferenced. See + * dsa_get_address. Also, an atomic version and appropriately sized atomic + * operations. + */ +#if SIZEOF_DSA_POINTER == 4 +typedef uint32 dsa_pointer; +typedef pg_atomic_uint32 dsa_pointer_atomic; +#define dsa_pointer_atomic_init pg_atomic_init_u32 +#define dsa_pointer_atomic_read pg_atomic_read_u32 +#define dsa_pointer_atomic_write pg_atomic_write_u32 +#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u32 +#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u32 +#define DSA_POINTER_FORMAT "%08x" +#else +typedef uint64 dsa_pointer; +typedef pg_atomic_uint64 dsa_pointer_atomic; +#define dsa_pointer_atomic_init pg_atomic_init_u64 +#define dsa_pointer_atomic_read pg_atomic_read_u64 +#define dsa_pointer_atomic_write pg_atomic_write_u64 +#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u64 +#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u64 +#define DSA_POINTER_FORMAT "%016" INT64_MODIFIER "x" +#endif + +/* Flags for dsa_allocate_extended. */ +#define DSA_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ +#define DSA_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define DSA_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* A sentinel value for dsa_pointer used to indicate failure to allocate. */ +#define InvalidDsaPointer ((dsa_pointer) 0) + +/* + * The number of bits used to represent the offset part of a dsa_pointer. + * This controls the maximum size of a segment, the maximum possible + * allocation size and also the maximum number of segments per area. + */ +#if SIZEOF_DSA_POINTER == 4 +#define DSA_OFFSET_WIDTH 27 /* 32 segments of size up to 128MB */ +#else +#define DSA_OFFSET_WIDTH 40 /* 1024 segments of size up to 1TB */ +#endif + +/* + * The default size of the initial DSM segment that backs a dsa_area created + * by dsa_create. After creating some number of segments of the initial size + * we'll double this size, and so on. Larger segments may be created if + * necessary to satisfy large requests. + */ +#define DSA_DEFAULT_INIT_SEGMENT_SIZE ((size_t) (1 * 1024 * 1024)) + +/* The minimum size of a DSM segment. */ +#define DSA_MIN_SEGMENT_SIZE ((size_t) (256 * 1024L)) + +/* The maximum size of a DSM segment. */ +#define DSA_MAX_SEGMENT_SIZE ((size_t) 1 << DSA_OFFSET_WIDTH) + +/* Check if a dsa_pointer value is valid. */ +#define DsaPointerIsValid(x) ((x) != InvalidDsaPointer) + +/* Allocate uninitialized memory with error on out-of-memory. */ +#define dsa_allocate(area, size) \ + dsa_allocate_extended(area, size, 0) + +/* Allocate zero-initialized memory with error on out-of-memory. */ +#define dsa_allocate0(area, size) \ + dsa_allocate_extended(area, size, DSA_ALLOC_ZERO) + +/* Create dsa_area with default segment sizes */ +#define dsa_create(tranch_id) \ + dsa_create_ext(tranch_id, DSA_DEFAULT_INIT_SEGMENT_SIZE, \ + DSA_MAX_SEGMENT_SIZE) + +/* Create dsa_area with default segment sizes in an existing share memory space */ +#define dsa_create_in_place(place, size, tranch_id, segment) \ + dsa_create_in_place_ext(place, size, tranch_id, segment, \ + DSA_DEFAULT_INIT_SEGMENT_SIZE, \ + DSA_MAX_SEGMENT_SIZE) + +/* + * The type used for dsa_area handles. dsa_handle values can be shared with + * other processes, so that they can attach to them. This provides a way to + * share allocated storage with other processes. + * + * The handle for a dsa_area is currently implemented as the dsm_handle + * for the first DSM segment backing this dynamic storage area, but client + * code shouldn't assume that is true. + */ +typedef dsm_handle dsa_handle; + +/* Sentinel value to use for invalid dsa_handles. */ +#define DSA_HANDLE_INVALID ((dsa_handle) DSM_HANDLE_INVALID) + +extern dsa_area *dsa_create_ext(int tranche_id, size_t init_segment_size, + size_t max_segment_size); +extern dsa_area *dsa_create_in_place_ext(void *place, size_t size, + int tranche_id, dsm_segment *segment, + size_t init_segment_size, + size_t max_segment_size); +extern dsa_area *dsa_attach(dsa_handle handle); +extern dsa_area *dsa_attach_in_place(void *place, dsm_segment *segment); +extern void dsa_release_in_place(void *place); +extern void dsa_on_dsm_detach_release_in_place(dsm_segment *, Datum); +extern void dsa_on_shmem_exit_release_in_place(int, Datum); +extern void dsa_pin_mapping(dsa_area *area); +extern void dsa_detach(dsa_area *area); +extern void dsa_pin(dsa_area *area); +extern void dsa_unpin(dsa_area *area); +extern void dsa_set_size_limit(dsa_area *area, size_t limit); +extern size_t dsa_minimum_size(void); +extern dsa_handle dsa_get_handle(dsa_area *area); +extern dsa_pointer dsa_allocate_extended(dsa_area *area, size_t size, int flags); +extern void dsa_free(dsa_area *area, dsa_pointer dp); +extern void *dsa_get_address(dsa_area *area, dsa_pointer dp); +extern size_t dsa_get_total_size(dsa_area *area); +extern void dsa_trim(dsa_area *area); +extern void dsa_dump(dsa_area *area); + +#endif /* DSA_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/dynahash.h b/platform/dbops/binaries/postgres/include/server/utils/dynahash.h new file mode 100644 index 0000000000000000000000000000000000000000..418166f01ec9384ab3d798e5e35324923db3bb11 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/dynahash.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * dynahash.h + * POSTGRES dynahash.h file definitions + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/dynahash.h + * + *------------------------------------------------------------------------- + */ +#ifndef DYNAHASH_H +#define DYNAHASH_H + +extern int my_log2(long num); + +#endif /* DYNAHASH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/elog.h b/platform/dbops/binaries/postgres/include/server/utils/elog.h new file mode 100644 index 0000000000000000000000000000000000000000..e54eca5b4891e072f3b9135d92d75c59bed584cc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/elog.h @@ -0,0 +1,540 @@ +/*------------------------------------------------------------------------- + * + * elog.h + * POSTGRES error reporting/logging definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/elog.h + * + *------------------------------------------------------------------------- + */ +#ifndef ELOG_H +#define ELOG_H + +#include + +#include "lib/stringinfo.h" + +/* We cannot include nodes.h yet, so forward-declare struct Node */ +struct Node; + + +/* Error level codes */ +#define DEBUG5 10 /* Debugging messages, in categories of + * decreasing detail. */ +#define DEBUG4 11 +#define DEBUG3 12 +#define DEBUG2 13 +#define DEBUG1 14 /* used by GUC debug_* variables */ +#define LOG 15 /* Server operational messages; sent only to + * server log by default. */ +#define LOG_SERVER_ONLY 16 /* Same as LOG for server reporting, but never + * sent to client. */ +#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same as + * LOG for server reporting, but never + * sent to client. */ +#define INFO 17 /* Messages specifically requested by user (eg + * VACUUM VERBOSE output); always sent to + * client regardless of client_min_messages, + * but by default not sent to server log. */ +#define NOTICE 18 /* Helpful messages to users about query + * operation; sent to client and not to server + * log by default. */ +#define WARNING 19 /* Warnings. NOTICE is for expected messages + * like implicit sequence creation by SERIAL. + * WARNING is for unexpected messages. */ +#define PGWARNING 19 /* Must equal WARNING; see NOTE below. */ +#define WARNING_CLIENT_ONLY 20 /* Warnings to be sent to client as usual, but + * never to the server log. */ +#define ERROR 21 /* user error - abort transaction; return to + * known state */ +#define PGERROR 21 /* Must equal ERROR; see NOTE below. */ +#define FATAL 22 /* fatal error - abort process */ +#define PANIC 23 /* take down the other backends with me */ + +/* + * NOTE: the alternate names PGWARNING and PGERROR are useful for dealing + * with third-party headers that make other definitions of WARNING and/or + * ERROR. One can, for example, re-define ERROR as PGERROR after including + * such a header. + */ + + +/* macros for representing SQLSTATE strings compactly */ +#define PGSIXBIT(ch) (((ch) - '0') & 0x3F) +#define PGUNSIXBIT(val) (((val) & 0x3F) + '0') + +#define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \ + (PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \ + (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24)) + +/* These macros depend on the fact that '0' becomes a zero in PGSIXBIT */ +#define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1)) +#define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0) + +/* SQLSTATE codes for errors are defined in a separate file */ +#include "utils/errcodes.h" + +/* + * Provide a way to prevent "errno" from being accidentally used inside an + * elog() or ereport() invocation. Since we know that some operating systems + * define errno as something involving a function call, we'll put a local + * variable of the same name as that function in the local scope to force a + * compile error. On platforms that don't define errno in that way, nothing + * happens, so we get no warning ... but we can live with that as long as it + * happens on some popular platforms. + */ +#if defined(errno) && defined(__linux__) +#define pg_prevent_errno_in_scope() int __errno_location pg_attribute_unused() +#elif defined(errno) && (defined(__darwin__) || defined(__FreeBSD__)) +#define pg_prevent_errno_in_scope() int __error pg_attribute_unused() +#else +#define pg_prevent_errno_in_scope() +#endif + + +/*---------- + * New-style error reporting API: to be used in this way: + * ereport(ERROR, + * errcode(ERRCODE_UNDEFINED_CURSOR), + * errmsg("portal \"%s\" not found", stmt->portalname), + * ... other errxxx() fields as needed ...); + * + * The error level is required, and so is a primary error message (errmsg + * or errmsg_internal). All else is optional. errcode() defaults to + * ERRCODE_INTERNAL_ERROR if elevel is ERROR or more, ERRCODE_WARNING + * if elevel is WARNING, or ERRCODE_SUCCESSFUL_COMPLETION if elevel is + * NOTICE or below. + * + * Before Postgres v12, extra parentheses were required around the + * list of auxiliary function calls; that's now optional. + * + * ereport_domain() allows a message domain to be specified, for modules that + * wish to use a different message catalog from the backend's. To avoid having + * one copy of the default text domain per .o file, we define it as NULL here + * and have errstart insert the default text domain. Modules can either use + * ereport_domain() directly, or preferably they can override the TEXTDOMAIN + * macro. + * + * When __builtin_constant_p is available and elevel >= ERROR we make a call + * to errstart_cold() instead of errstart(). This version of the function is + * marked with pg_attribute_cold which will coax supporting compilers into + * generating code which is more optimized towards non-ERROR cases. Because + * we use __builtin_constant_p() in the condition, when elevel is not a + * compile-time constant, or if it is, but it's < ERROR, the compiler has no + * need to generate any code for this branch. It can simply call errstart() + * unconditionally. + * + * If elevel >= ERROR, the call will not return; we try to inform the compiler + * of that via pg_unreachable(). However, no useful optimization effect is + * obtained unless the compiler sees elevel as a compile-time constant, else + * we're just adding code bloat. So, if __builtin_constant_p is available, + * use that to cause the second if() to vanish completely for non-constant + * cases. We avoid using a local variable because it's not necessary and + * prevents gcc from making the unreachability deduction at optlevel -O0. + *---------- + */ +#ifdef HAVE__BUILTIN_CONSTANT_P +#define ereport_domain(elevel, domain, ...) \ + do { \ + pg_prevent_errno_in_scope(); \ + if (__builtin_constant_p(elevel) && (elevel) >= ERROR ? \ + errstart_cold(elevel, domain) : \ + errstart(elevel, domain)) \ + __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \ + if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \ + pg_unreachable(); \ + } while(0) +#else /* !HAVE__BUILTIN_CONSTANT_P */ +#define ereport_domain(elevel, domain, ...) \ + do { \ + const int elevel_ = (elevel); \ + pg_prevent_errno_in_scope(); \ + if (errstart(elevel_, domain)) \ + __VA_ARGS__, errfinish(__FILE__, __LINE__, __func__); \ + if (elevel_ >= ERROR) \ + pg_unreachable(); \ + } while(0) +#endif /* HAVE__BUILTIN_CONSTANT_P */ + +#define ereport(elevel, ...) \ + ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__) + +#define TEXTDOMAIN NULL + +extern bool message_level_is_interesting(int elevel); + +extern bool errstart(int elevel, const char *domain); +extern pg_attribute_cold bool errstart_cold(int elevel, const char *domain); +extern void errfinish(const char *filename, int lineno, const char *funcname); + +extern int errcode(int sqlerrcode); + +extern int errcode_for_file_access(void); +extern int errcode_for_socket_access(void); + +extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errdetail_log_plural(const char *fmt_singular, + const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errhint_plural(const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + +/* + * errcontext() is typically called in error context callback functions, not + * within an ereport() invocation. The callback function can be in a different + * module than the ereport() call, so the message domain passed in errstart() + * is not usually the correct domain for translating the context message. + * set_errcontext_domain() first sets the domain to be used, and + * errcontext_msg() passes the actual message. + */ +#define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg + +extern int set_errcontext_domain(const char *domain); + +extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2); + +extern int errhidestmt(bool hide_stmt); +extern int errhidecontext(bool hide_ctx); + +extern int errbacktrace(void); + +extern int errposition(int cursorpos); + +extern int internalerrposition(int cursorpos); +extern int internalerrquery(const char *query); + +extern int err_generic_string(int field, const char *str); + +extern int geterrcode(void); +extern int geterrlevel(void); +extern int geterrposition(void); +extern int getinternalerrposition(void); + + +/*---------- + * Old-style error reporting API: to be used in this way: + * elog(ERROR, "portal \"%s\" not found", stmt->portalname); + *---------- + */ +#define elog(elevel, ...) \ + ereport(elevel, errmsg_internal(__VA_ARGS__)) + + +/*---------- + * Support for reporting "soft" errors that don't require a full transaction + * abort to clean up. This is to be used in this way: + * errsave(context, + * errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + * errmsg("invalid input syntax for type %s: \"%s\"", + * "boolean", in_str), + * ... other errxxx() fields as needed ...); + * + * "context" is a node pointer or NULL, and the remaining auxiliary calls + * provide the same error details as in ereport(). If context is not a + * pointer to an ErrorSaveContext node, then errsave(context, ...) + * behaves identically to ereport(ERROR, ...). If context is a pointer + * to an ErrorSaveContext node, then the information provided by the + * auxiliary calls is stored in the context node and control returns + * normally. The caller of errsave() must then do any required cleanup + * and return control back to its caller. That caller must check the + * ErrorSaveContext node to see whether an error occurred before + * it can trust the function's result to be meaningful. + * + * errsave_domain() allows a message domain to be specified; it is + * precisely analogous to ereport_domain(). + *---------- + */ +#define errsave_domain(context, domain, ...) \ + do { \ + struct Node *context_ = (context); \ + pg_prevent_errno_in_scope(); \ + if (errsave_start(context_, domain)) \ + __VA_ARGS__, errsave_finish(context_, __FILE__, __LINE__, __func__); \ + } while(0) + +#define errsave(context, ...) \ + errsave_domain(context, TEXTDOMAIN, __VA_ARGS__) + +/* + * "ereturn(context, dummy_value, ...);" is exactly the same as + * "errsave(context, ...); return dummy_value;". This saves a bit + * of typing in the common case where a function has no cleanup + * actions to take after reporting a soft error. "dummy_value" + * can be empty if the function returns void. + */ +#define ereturn_domain(context, dummy_value, domain, ...) \ + do { \ + errsave_domain(context, domain, __VA_ARGS__); \ + return dummy_value; \ + } while(0) + +#define ereturn(context, dummy_value, ...) \ + ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__) + +extern bool errsave_start(struct Node *context, const char *domain); +extern void errsave_finish(struct Node *context, + const char *filename, int lineno, + const char *funcname); + + +/* Support for constructing error strings separately from ereport() calls */ + +extern void pre_format_elog_string(int errnumber, const char *domain); +extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2); + + +/* Support for attaching context information to error reports */ + +typedef struct ErrorContextCallback +{ + struct ErrorContextCallback *previous; + void (*callback) (void *arg); + void *arg; +} ErrorContextCallback; + +extern PGDLLIMPORT ErrorContextCallback *error_context_stack; + + +/*---------- + * API for catching ereport(ERROR) exits. Use these macros like so: + * + * PG_TRY(); + * { + * ... code that might throw ereport(ERROR) ... + * } + * PG_CATCH(); + * { + * ... error recovery code ... + * } + * PG_END_TRY(); + * + * (The braces are not actually necessary, but are recommended so that + * pgindent will indent the construct nicely.) The error recovery code + * can either do PG_RE_THROW to propagate the error outwards, or do a + * (sub)transaction abort. Failure to do so may leave the system in an + * inconsistent state for further processing. + * + * For the common case that the error recovery code and the cleanup in the + * normal code path are identical, the following can be used instead: + * + * PG_TRY(); + * { + * ... code that might throw ereport(ERROR) ... + * } + * PG_FINALLY(); + * { + * ... cleanup code ... + * } + * PG_END_TRY(); + * + * The cleanup code will be run in either case, and any error will be rethrown + * afterwards. + * + * You cannot use both PG_CATCH() and PG_FINALLY() in the same + * PG_TRY()/PG_END_TRY() block. + * + * Note: while the system will correctly propagate any new ereport(ERROR) + * occurring in the recovery section, there is a small limit on the number + * of levels this will work for. It's best to keep the error recovery + * section simple enough that it can't generate any new errors, at least + * not before popping the error stack. + * + * Note: an ereport(FATAL) will not be caught by this construct; control will + * exit straight through proc_exit(). Therefore, do NOT put any cleanup + * of non-process-local resources into the error recovery section, at least + * not without taking thought for what will happen during ereport(FATAL). + * The PG_ENSURE_ERROR_CLEANUP macros provided by storage/ipc.h may be + * helpful in such cases. + * + * Note: if a local variable of the function containing PG_TRY is modified + * in the PG_TRY section and used in the PG_CATCH section, that variable + * must be declared "volatile" for POSIX compliance. This is not mere + * pedantry; we have seen bugs from compilers improperly optimizing code + * away when such a variable was not marked. Beware that gcc's -Wclobbered + * warnings are just about entirely useless for catching such oversights. + * + * Each of these macros accepts an optional argument which can be specified + * to apply a suffix to the variables declared within the macros. This suffix + * can be used to avoid the compiler emitting warnings about shadowed + * variables when compiling with -Wshadow in situations where nested PG_TRY() + * statements are required. The optional suffix may contain any character + * that's allowed in a variable name. The suffix, if specified, must be the + * same within each component macro of the given PG_TRY() statement. + *---------- + */ +#define PG_TRY(...) \ + do { \ + sigjmp_buf *_save_exception_stack##__VA_ARGS__ = PG_exception_stack; \ + ErrorContextCallback *_save_context_stack##__VA_ARGS__ = error_context_stack; \ + sigjmp_buf _local_sigjmp_buf##__VA_ARGS__; \ + bool _do_rethrow##__VA_ARGS__ = false; \ + if (sigsetjmp(_local_sigjmp_buf##__VA_ARGS__, 0) == 0) \ + { \ + PG_exception_stack = &_local_sigjmp_buf##__VA_ARGS__ + +#define PG_CATCH(...) \ + } \ + else \ + { \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__ + +#define PG_FINALLY(...) \ + } \ + else \ + _do_rethrow##__VA_ARGS__ = true; \ + { \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__ + +#define PG_END_TRY(...) \ + } \ + if (_do_rethrow##__VA_ARGS__) \ + PG_RE_THROW(); \ + PG_exception_stack = _save_exception_stack##__VA_ARGS__; \ + error_context_stack = _save_context_stack##__VA_ARGS__; \ + } while (0) + +/* + * Some compilers understand pg_attribute_noreturn(); for other compilers, + * insert pg_unreachable() so that the compiler gets the point. + */ +#ifdef HAVE_PG_ATTRIBUTE_NORETURN +#define PG_RE_THROW() \ + pg_re_throw() +#else +#define PG_RE_THROW() \ + (pg_re_throw(), pg_unreachable()) +#endif + +extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; + + +/* Stuff that error handlers might want to use */ + +/* + * ErrorData holds the data accumulated during any one ereport() cycle. + * Any non-NULL pointers must point to palloc'd data. + * (The const pointers are an exception; we assume they point at non-freeable + * constant strings.) + */ +typedef struct ErrorData +{ + int elevel; /* error level */ + bool output_to_server; /* will report to server log? */ + bool output_to_client; /* will report to client? */ + bool hide_stmt; /* true to prevent STATEMENT: inclusion */ + bool hide_ctx; /* true to prevent CONTEXT: inclusion */ + const char *filename; /* __FILE__ of ereport() call */ + int lineno; /* __LINE__ of ereport() call */ + const char *funcname; /* __func__ of ereport() call */ + const char *domain; /* message domain */ + const char *context_domain; /* message domain for context message */ + int sqlerrcode; /* encoded ERRSTATE */ + char *message; /* primary error message (translated) */ + char *detail; /* detail error message */ + char *detail_log; /* detail error message for server log only */ + char *hint; /* hint message */ + char *context; /* context message */ + char *backtrace; /* backtrace */ + const char *message_id; /* primary message's id (original string) */ + char *schema_name; /* name of schema */ + char *table_name; /* name of table */ + char *column_name; /* name of column */ + char *datatype_name; /* name of datatype */ + char *constraint_name; /* name of constraint */ + int cursorpos; /* cursor index into query string */ + int internalpos; /* cursor index into internalquery */ + char *internalquery; /* text of internally-generated query */ + int saved_errno; /* errno at entry */ + + /* context containing associated non-constant strings */ + struct MemoryContextData *assoc_context; +} ErrorData; + +extern void EmitErrorReport(void); +extern ErrorData *CopyErrorData(void); +extern void FreeErrorData(ErrorData *edata); +extern void FlushErrorState(void); +extern void ReThrowError(ErrorData *edata) pg_attribute_noreturn(); +extern void ThrowErrorData(ErrorData *edata); +extern void pg_re_throw(void) pg_attribute_noreturn(); + +extern char *GetErrorContextStack(void); + +/* Hook for intercepting messages before they are sent to the server log */ +typedef void (*emit_log_hook_type) (ErrorData *edata); +extern PGDLLIMPORT emit_log_hook_type emit_log_hook; + + +/* GUC-configurable parameters */ + +typedef enum +{ + PGERROR_TERSE, /* single-line error messages */ + PGERROR_DEFAULT, /* recommended style */ + PGERROR_VERBOSE, /* all the facts, ma'am */ +} PGErrorVerbosity; + +extern PGDLLIMPORT int Log_error_verbosity; +extern PGDLLIMPORT char *Log_line_prefix; +extern PGDLLIMPORT int Log_destination; +extern PGDLLIMPORT char *Log_destination_string; +extern PGDLLIMPORT bool syslog_sequence_numbers; +extern PGDLLIMPORT bool syslog_split_messages; + +/* Log destination bitmap */ +#define LOG_DESTINATION_STDERR 1 +#define LOG_DESTINATION_SYSLOG 2 +#define LOG_DESTINATION_EVENTLOG 4 +#define LOG_DESTINATION_CSVLOG 8 +#define LOG_DESTINATION_JSONLOG 16 + +/* Other exported functions */ +extern void log_status_format(StringInfo buf, const char *format, + ErrorData *edata); +extern void DebugFileOpen(void); +extern char *unpack_sql_state(int sql_state); +extern bool in_error_recursion_trouble(void); + +/* Common functions shared across destinations */ +extern void reset_formatted_start_time(void); +extern char *get_formatted_start_time(void); +extern char *get_formatted_log_time(void); +extern const char *get_backend_type_for_log(void); +extern bool check_log_of_query(ErrorData *edata); +extern const char *error_severity(int elevel); +extern void write_pipe_chunks(char *data, int len, int dest); + +/* Destination-specific functions */ +extern void write_csvlog(ErrorData *edata); +extern void write_jsonlog(ErrorData *edata); + +/* + * Write errors to stderr (or by equal means when stderr is + * not available). Used before ereport/elog can be used + * safely (memory context, GUC load etc) + */ +extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2); + +#endif /* ELOG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/errcodes.h b/platform/dbops/binaries/postgres/include/server/utils/errcodes.h new file mode 100644 index 0000000000000000000000000000000000000000..8f86feb4bc4cbeb2e147c832f370da2e16e161e7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/errcodes.h @@ -0,0 +1,352 @@ +/* autogenerated from src/backend/utils/errcodes.txt, do not edit */ +/* there is deliberately not an #ifndef ERRCODES_H here */ + +/* Class 00 - Successful Completion */ +#define ERRCODE_SUCCESSFUL_COMPLETION MAKE_SQLSTATE('0','0','0','0','0') + +/* Class 01 - Warning */ +#define ERRCODE_WARNING MAKE_SQLSTATE('0','1','0','0','0') +#define ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','1','0','0','C') +#define ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING MAKE_SQLSTATE('0','1','0','0','8') +#define ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION MAKE_SQLSTATE('0','1','0','0','3') +#define ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED MAKE_SQLSTATE('0','1','0','0','7') +#define ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED MAKE_SQLSTATE('0','1','0','0','6') +#define ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('0','1','0','0','4') +#define ERRCODE_WARNING_DEPRECATED_FEATURE MAKE_SQLSTATE('0','1','P','0','1') + +/* Class 02 - No Data (this is also a warning class per the SQL standard) */ +#define ERRCODE_NO_DATA MAKE_SQLSTATE('0','2','0','0','0') +#define ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED MAKE_SQLSTATE('0','2','0','0','1') + +/* Class 03 - SQL Statement Not Yet Complete */ +#define ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE MAKE_SQLSTATE('0','3','0','0','0') + +/* Class 08 - Connection Exception */ +#define ERRCODE_CONNECTION_EXCEPTION MAKE_SQLSTATE('0','8','0','0','0') +#define ERRCODE_CONNECTION_DOES_NOT_EXIST MAKE_SQLSTATE('0','8','0','0','3') +#define ERRCODE_CONNECTION_FAILURE MAKE_SQLSTATE('0','8','0','0','6') +#define ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','1') +#define ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION MAKE_SQLSTATE('0','8','0','0','4') +#define ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN MAKE_SQLSTATE('0','8','0','0','7') +#define ERRCODE_PROTOCOL_VIOLATION MAKE_SQLSTATE('0','8','P','0','1') + +/* Class 09 - Triggered Action Exception */ +#define ERRCODE_TRIGGERED_ACTION_EXCEPTION MAKE_SQLSTATE('0','9','0','0','0') + +/* Class 0A - Feature Not Supported */ +#define ERRCODE_FEATURE_NOT_SUPPORTED MAKE_SQLSTATE('0','A','0','0','0') + +/* Class 0B - Invalid Transaction Initiation */ +#define ERRCODE_INVALID_TRANSACTION_INITIATION MAKE_SQLSTATE('0','B','0','0','0') + +/* Class 0F - Locator Exception */ +#define ERRCODE_LOCATOR_EXCEPTION MAKE_SQLSTATE('0','F','0','0','0') +#define ERRCODE_L_E_INVALID_SPECIFICATION MAKE_SQLSTATE('0','F','0','0','1') + +/* Class 0L - Invalid Grantor */ +#define ERRCODE_INVALID_GRANTOR MAKE_SQLSTATE('0','L','0','0','0') +#define ERRCODE_INVALID_GRANT_OPERATION MAKE_SQLSTATE('0','L','P','0','1') + +/* Class 0P - Invalid Role Specification */ +#define ERRCODE_INVALID_ROLE_SPECIFICATION MAKE_SQLSTATE('0','P','0','0','0') + +/* Class 0Z - Diagnostics Exception */ +#define ERRCODE_DIAGNOSTICS_EXCEPTION MAKE_SQLSTATE('0','Z','0','0','0') +#define ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER MAKE_SQLSTATE('0','Z','0','0','2') + +/* Class 20 - Case Not Found */ +#define ERRCODE_CASE_NOT_FOUND MAKE_SQLSTATE('2','0','0','0','0') + +/* Class 21 - Cardinality Violation */ +#define ERRCODE_CARDINALITY_VIOLATION MAKE_SQLSTATE('2','1','0','0','0') + +/* Class 22 - Data Exception */ +#define ERRCODE_DATA_EXCEPTION MAKE_SQLSTATE('2','2','0','0','0') +#define ERRCODE_ARRAY_ELEMENT_ERROR MAKE_SQLSTATE('2','2','0','2','E') +#define ERRCODE_ARRAY_SUBSCRIPT_ERROR MAKE_SQLSTATE('2','2','0','2','E') +#define ERRCODE_CHARACTER_NOT_IN_REPERTOIRE MAKE_SQLSTATE('2','2','0','2','1') +#define ERRCODE_DATETIME_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','0','8') +#define ERRCODE_DATETIME_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','8') +#define ERRCODE_DIVISION_BY_ZERO MAKE_SQLSTATE('2','2','0','1','2') +#define ERRCODE_ERROR_IN_ASSIGNMENT MAKE_SQLSTATE('2','2','0','0','5') +#define ERRCODE_ESCAPE_CHARACTER_CONFLICT MAKE_SQLSTATE('2','2','0','0','B') +#define ERRCODE_INDICATOR_OVERFLOW MAKE_SQLSTATE('2','2','0','2','2') +#define ERRCODE_INTERVAL_FIELD_OVERFLOW MAKE_SQLSTATE('2','2','0','1','5') +#define ERRCODE_INVALID_ARGUMENT_FOR_LOG MAKE_SQLSTATE('2','2','0','1','E') +#define ERRCODE_INVALID_ARGUMENT_FOR_NTILE MAKE_SQLSTATE('2','2','0','1','4') +#define ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE MAKE_SQLSTATE('2','2','0','1','6') +#define ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION MAKE_SQLSTATE('2','2','0','1','F') +#define ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION MAKE_SQLSTATE('2','2','0','1','G') +#define ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST MAKE_SQLSTATE('2','2','0','1','8') +#define ERRCODE_INVALID_DATETIME_FORMAT MAKE_SQLSTATE('2','2','0','0','7') +#define ERRCODE_INVALID_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','1','9') +#define ERRCODE_INVALID_ESCAPE_OCTET MAKE_SQLSTATE('2','2','0','0','D') +#define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2','0','2','5') +#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','P','0','6') +#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','1','0') +#define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2','0','2','3') +#define ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE MAKE_SQLSTATE('2','2','0','1','3') +#define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2','0','1','B') +#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2','2','0','1','W') +#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2','2','0','1','X') +#define ERRCODE_INVALID_TABLESAMPLE_ARGUMENT MAKE_SQLSTATE('2','2','0','2','H') +#define ERRCODE_INVALID_TABLESAMPLE_REPEAT MAKE_SQLSTATE('2','2','0','2','G') +#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2','0','0','9') +#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2','0','0','C') +#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2','0','0','G') +#define ERRCODE_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('2','2','0','0','4') +#define ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER MAKE_SQLSTATE('2','2','0','0','2') +#define ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE MAKE_SQLSTATE('2','2','0','0','3') +#define ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED MAKE_SQLSTATE('2','2','0','0','H') +#define ERRCODE_STRING_DATA_LENGTH_MISMATCH MAKE_SQLSTATE('2','2','0','2','6') +#define ERRCODE_STRING_DATA_RIGHT_TRUNCATION MAKE_SQLSTATE('2','2','0','0','1') +#define ERRCODE_SUBSTRING_ERROR MAKE_SQLSTATE('2','2','0','1','1') +#define ERRCODE_TRIM_ERROR MAKE_SQLSTATE('2','2','0','2','7') +#define ERRCODE_UNTERMINATED_C_STRING MAKE_SQLSTATE('2','2','0','2','4') +#define ERRCODE_ZERO_LENGTH_CHARACTER_STRING MAKE_SQLSTATE('2','2','0','0','F') +#define ERRCODE_FLOATING_POINT_EXCEPTION MAKE_SQLSTATE('2','2','P','0','1') +#define ERRCODE_INVALID_TEXT_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','2') +#define ERRCODE_INVALID_BINARY_REPRESENTATION MAKE_SQLSTATE('2','2','P','0','3') +#define ERRCODE_BAD_COPY_FILE_FORMAT MAKE_SQLSTATE('2','2','P','0','4') +#define ERRCODE_UNTRANSLATABLE_CHARACTER MAKE_SQLSTATE('2','2','P','0','5') +#define ERRCODE_NOT_AN_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','L') +#define ERRCODE_INVALID_XML_DOCUMENT MAKE_SQLSTATE('2','2','0','0','M') +#define ERRCODE_INVALID_XML_CONTENT MAKE_SQLSTATE('2','2','0','0','N') +#define ERRCODE_INVALID_XML_COMMENT MAKE_SQLSTATE('2','2','0','0','S') +#define ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION MAKE_SQLSTATE('2','2','0','0','T') +#define ERRCODE_DUPLICATE_JSON_OBJECT_KEY_VALUE MAKE_SQLSTATE('2','2','0','3','0') +#define ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION MAKE_SQLSTATE('2','2','0','3','1') +#define ERRCODE_INVALID_JSON_TEXT MAKE_SQLSTATE('2','2','0','3','2') +#define ERRCODE_INVALID_SQL_JSON_SUBSCRIPT MAKE_SQLSTATE('2','2','0','3','3') +#define ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','4') +#define ERRCODE_NO_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','5') +#define ERRCODE_NON_NUMERIC_SQL_JSON_ITEM MAKE_SQLSTATE('2','2','0','3','6') +#define ERRCODE_NON_UNIQUE_KEYS_IN_A_JSON_OBJECT MAKE_SQLSTATE('2','2','0','3','7') +#define ERRCODE_SINGLETON_SQL_JSON_ITEM_REQUIRED MAKE_SQLSTATE('2','2','0','3','8') +#define ERRCODE_SQL_JSON_ARRAY_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','9') +#define ERRCODE_SQL_JSON_MEMBER_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','A') +#define ERRCODE_SQL_JSON_NUMBER_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','B') +#define ERRCODE_SQL_JSON_OBJECT_NOT_FOUND MAKE_SQLSTATE('2','2','0','3','C') +#define ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS MAKE_SQLSTATE('2','2','0','3','D') +#define ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS MAKE_SQLSTATE('2','2','0','3','E') +#define ERRCODE_SQL_JSON_SCALAR_REQUIRED MAKE_SQLSTATE('2','2','0','3','F') +#define ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE MAKE_SQLSTATE('2','2','0','3','G') + +/* Class 23 - Integrity Constraint Violation */ +#define ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('2','3','0','0','0') +#define ERRCODE_RESTRICT_VIOLATION MAKE_SQLSTATE('2','3','0','0','1') +#define ERRCODE_NOT_NULL_VIOLATION MAKE_SQLSTATE('2','3','5','0','2') +#define ERRCODE_FOREIGN_KEY_VIOLATION MAKE_SQLSTATE('2','3','5','0','3') +#define ERRCODE_UNIQUE_VIOLATION MAKE_SQLSTATE('2','3','5','0','5') +#define ERRCODE_CHECK_VIOLATION MAKE_SQLSTATE('2','3','5','1','4') +#define ERRCODE_EXCLUSION_VIOLATION MAKE_SQLSTATE('2','3','P','0','1') + +/* Class 24 - Invalid Cursor State */ +#define ERRCODE_INVALID_CURSOR_STATE MAKE_SQLSTATE('2','4','0','0','0') + +/* Class 25 - Invalid Transaction State */ +#define ERRCODE_INVALID_TRANSACTION_STATE MAKE_SQLSTATE('2','5','0','0','0') +#define ERRCODE_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','1') +#define ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE MAKE_SQLSTATE('2','5','0','0','2') +#define ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL MAKE_SQLSTATE('2','5','0','0','8') +#define ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','3') +#define ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','4') +#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION MAKE_SQLSTATE('2','5','0','0','5') +#define ERRCODE_READ_ONLY_SQL_TRANSACTION MAKE_SQLSTATE('2','5','0','0','6') +#define ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED MAKE_SQLSTATE('2','5','0','0','7') +#define ERRCODE_NO_ACTIVE_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','1') +#define ERRCODE_IN_FAILED_SQL_TRANSACTION MAKE_SQLSTATE('2','5','P','0','2') +#define ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','3') +#define ERRCODE_TRANSACTION_TIMEOUT MAKE_SQLSTATE('2','5','P','0','4') + +/* Class 26 - Invalid SQL Statement Name */ +#define ERRCODE_INVALID_SQL_STATEMENT_NAME MAKE_SQLSTATE('2','6','0','0','0') + +/* Class 27 - Triggered Data Change Violation */ +#define ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION MAKE_SQLSTATE('2','7','0','0','0') + +/* Class 28 - Invalid Authorization Specification */ +#define ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION MAKE_SQLSTATE('2','8','0','0','0') +#define ERRCODE_INVALID_PASSWORD MAKE_SQLSTATE('2','8','P','0','1') + +/* Class 2B - Dependent Privilege Descriptors Still Exist */ +#define ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST MAKE_SQLSTATE('2','B','0','0','0') +#define ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST MAKE_SQLSTATE('2','B','P','0','1') + +/* Class 2D - Invalid Transaction Termination */ +#define ERRCODE_INVALID_TRANSACTION_TERMINATION MAKE_SQLSTATE('2','D','0','0','0') + +/* Class 2F - SQL Routine Exception */ +#define ERRCODE_SQL_ROUTINE_EXCEPTION MAKE_SQLSTATE('2','F','0','0','0') +#define ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT MAKE_SQLSTATE('2','F','0','0','5') +#define ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','2') +#define ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('2','F','0','0','3') +#define ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('2','F','0','0','4') + +/* Class 34 - Invalid Cursor Name */ +#define ERRCODE_INVALID_CURSOR_NAME MAKE_SQLSTATE('3','4','0','0','0') + +/* Class 38 - External Routine Exception */ +#define ERRCODE_EXTERNAL_ROUTINE_EXCEPTION MAKE_SQLSTATE('3','8','0','0','0') +#define ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','1') +#define ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','2') +#define ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED MAKE_SQLSTATE('3','8','0','0','3') +#define ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED MAKE_SQLSTATE('3','8','0','0','4') + +/* Class 39 - External Routine Invocation Exception */ +#define ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION MAKE_SQLSTATE('3','9','0','0','0') +#define ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED MAKE_SQLSTATE('3','9','0','0','1') +#define ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED MAKE_SQLSTATE('3','9','0','0','4') +#define ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','1') +#define ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','2') +#define ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED MAKE_SQLSTATE('3','9','P','0','3') + +/* Class 3B - Savepoint Exception */ +#define ERRCODE_SAVEPOINT_EXCEPTION MAKE_SQLSTATE('3','B','0','0','0') +#define ERRCODE_S_E_INVALID_SPECIFICATION MAKE_SQLSTATE('3','B','0','0','1') + +/* Class 3D - Invalid Catalog Name */ +#define ERRCODE_INVALID_CATALOG_NAME MAKE_SQLSTATE('3','D','0','0','0') + +/* Class 3F - Invalid Schema Name */ +#define ERRCODE_INVALID_SCHEMA_NAME MAKE_SQLSTATE('3','F','0','0','0') + +/* Class 40 - Transaction Rollback */ +#define ERRCODE_TRANSACTION_ROLLBACK MAKE_SQLSTATE('4','0','0','0','0') +#define ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION MAKE_SQLSTATE('4','0','0','0','2') +#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0','0','0','1') +#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0','0','0','3') +#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0','P','0','1') + +/* Class 42 - Syntax Error or Access Rule Violation */ +#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2','0','0','0') +#define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2','6','0','1') +#define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2','5','0','1') +#define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2','8','4','6') +#define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2','8','0','3') +#define ERRCODE_WINDOWING_ERROR MAKE_SQLSTATE('4','2','P','2','0') +#define ERRCODE_INVALID_RECURSION MAKE_SQLSTATE('4','2','P','1','9') +#define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2','8','3','0') +#define ERRCODE_INVALID_NAME MAKE_SQLSTATE('4','2','6','0','2') +#define ERRCODE_NAME_TOO_LONG MAKE_SQLSTATE('4','2','6','2','2') +#define ERRCODE_RESERVED_NAME MAKE_SQLSTATE('4','2','9','3','9') +#define ERRCODE_DATATYPE_MISMATCH MAKE_SQLSTATE('4','2','8','0','4') +#define ERRCODE_INDETERMINATE_DATATYPE MAKE_SQLSTATE('4','2','P','1','8') +#define ERRCODE_COLLATION_MISMATCH MAKE_SQLSTATE('4','2','P','2','1') +#define ERRCODE_INDETERMINATE_COLLATION MAKE_SQLSTATE('4','2','P','2','2') +#define ERRCODE_WRONG_OBJECT_TYPE MAKE_SQLSTATE('4','2','8','0','9') +#define ERRCODE_GENERATED_ALWAYS MAKE_SQLSTATE('4','2','8','C','9') +#define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2','7','0','3') +#define ERRCODE_UNDEFINED_CURSOR MAKE_SQLSTATE('3','4','0','0','0') +#define ERRCODE_UNDEFINED_DATABASE MAKE_SQLSTATE('3','D','0','0','0') +#define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2','8','8','3') +#define ERRCODE_UNDEFINED_PSTATEMENT MAKE_SQLSTATE('2','6','0','0','0') +#define ERRCODE_UNDEFINED_SCHEMA MAKE_SQLSTATE('3','F','0','0','0') +#define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2','P','0','1') +#define ERRCODE_UNDEFINED_PARAMETER MAKE_SQLSTATE('4','2','P','0','2') +#define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2','7','0','4') +#define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2','7','0','1') +#define ERRCODE_DUPLICATE_CURSOR MAKE_SQLSTATE('4','2','P','0','3') +#define ERRCODE_DUPLICATE_DATABASE MAKE_SQLSTATE('4','2','P','0','4') +#define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2','7','2','3') +#define ERRCODE_DUPLICATE_PSTATEMENT MAKE_SQLSTATE('4','2','P','0','5') +#define ERRCODE_DUPLICATE_SCHEMA MAKE_SQLSTATE('4','2','P','0','6') +#define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2','P','0','7') +#define ERRCODE_DUPLICATE_ALIAS MAKE_SQLSTATE('4','2','7','1','2') +#define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2','7','1','0') +#define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2','7','0','2') +#define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2','7','2','5') +#define ERRCODE_AMBIGUOUS_PARAMETER MAKE_SQLSTATE('4','2','P','0','8') +#define ERRCODE_AMBIGUOUS_ALIAS MAKE_SQLSTATE('4','2','P','0','9') +#define ERRCODE_INVALID_COLUMN_REFERENCE MAKE_SQLSTATE('4','2','P','1','0') +#define ERRCODE_INVALID_COLUMN_DEFINITION MAKE_SQLSTATE('4','2','6','1','1') +#define ERRCODE_INVALID_CURSOR_DEFINITION MAKE_SQLSTATE('4','2','P','1','1') +#define ERRCODE_INVALID_DATABASE_DEFINITION MAKE_SQLSTATE('4','2','P','1','2') +#define ERRCODE_INVALID_FUNCTION_DEFINITION MAKE_SQLSTATE('4','2','P','1','3') +#define ERRCODE_INVALID_PSTATEMENT_DEFINITION MAKE_SQLSTATE('4','2','P','1','4') +#define ERRCODE_INVALID_SCHEMA_DEFINITION MAKE_SQLSTATE('4','2','P','1','5') +#define ERRCODE_INVALID_TABLE_DEFINITION MAKE_SQLSTATE('4','2','P','1','6') +#define ERRCODE_INVALID_OBJECT_DEFINITION MAKE_SQLSTATE('4','2','P','1','7') + +/* Class 44 - WITH CHECK OPTION Violation */ +#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4','0','0','0') + +/* Class 53 - Insufficient Resources */ +#define ERRCODE_INSUFFICIENT_RESOURCES MAKE_SQLSTATE('5','3','0','0','0') +#define ERRCODE_DISK_FULL MAKE_SQLSTATE('5','3','1','0','0') +#define ERRCODE_OUT_OF_MEMORY MAKE_SQLSTATE('5','3','2','0','0') +#define ERRCODE_TOO_MANY_CONNECTIONS MAKE_SQLSTATE('5','3','3','0','0') +#define ERRCODE_CONFIGURATION_LIMIT_EXCEEDED MAKE_SQLSTATE('5','3','4','0','0') + +/* Class 54 - Program Limit Exceeded */ +#define ERRCODE_PROGRAM_LIMIT_EXCEEDED MAKE_SQLSTATE('5','4','0','0','0') +#define ERRCODE_STATEMENT_TOO_COMPLEX MAKE_SQLSTATE('5','4','0','0','1') +#define ERRCODE_TOO_MANY_COLUMNS MAKE_SQLSTATE('5','4','0','1','1') +#define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('5','4','0','2','3') + +/* Class 55 - Object Not In Prerequisite State */ +#define ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE MAKE_SQLSTATE('5','5','0','0','0') +#define ERRCODE_OBJECT_IN_USE MAKE_SQLSTATE('5','5','0','0','6') +#define ERRCODE_CANT_CHANGE_RUNTIME_PARAM MAKE_SQLSTATE('5','5','P','0','2') +#define ERRCODE_LOCK_NOT_AVAILABLE MAKE_SQLSTATE('5','5','P','0','3') +#define ERRCODE_UNSAFE_NEW_ENUM_VALUE_USAGE MAKE_SQLSTATE('5','5','P','0','4') + +/* Class 57 - Operator Intervention */ +#define ERRCODE_OPERATOR_INTERVENTION MAKE_SQLSTATE('5','7','0','0','0') +#define ERRCODE_QUERY_CANCELED MAKE_SQLSTATE('5','7','0','1','4') +#define ERRCODE_ADMIN_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','1') +#define ERRCODE_CRASH_SHUTDOWN MAKE_SQLSTATE('5','7','P','0','2') +#define ERRCODE_CANNOT_CONNECT_NOW MAKE_SQLSTATE('5','7','P','0','3') +#define ERRCODE_DATABASE_DROPPED MAKE_SQLSTATE('5','7','P','0','4') +#define ERRCODE_IDLE_SESSION_TIMEOUT MAKE_SQLSTATE('5','7','P','0','5') + +/* Class 58 - System Error (errors external to PostgreSQL itself) */ +#define ERRCODE_SYSTEM_ERROR MAKE_SQLSTATE('5','8','0','0','0') +#define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8','0','3','0') +#define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8','P','0','1') +#define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8','P','0','2') + +/* Class F0 - Configuration File Error */ +#define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0','0','0','0') +#define ERRCODE_LOCK_FILE_EXISTS MAKE_SQLSTATE('F','0','0','0','1') + +/* Class HV - Foreign Data Wrapper Error (SQL/MED) */ +#define ERRCODE_FDW_ERROR MAKE_SQLSTATE('H','V','0','0','0') +#define ERRCODE_FDW_COLUMN_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','5') +#define ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED MAKE_SQLSTATE('H','V','0','0','2') +#define ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR MAKE_SQLSTATE('H','V','0','1','0') +#define ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION MAKE_SQLSTATE('H','V','0','2','1') +#define ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE MAKE_SQLSTATE('H','V','0','2','4') +#define ERRCODE_FDW_INVALID_COLUMN_NAME MAKE_SQLSTATE('H','V','0','0','7') +#define ERRCODE_FDW_INVALID_COLUMN_NUMBER MAKE_SQLSTATE('H','V','0','0','8') +#define ERRCODE_FDW_INVALID_DATA_TYPE MAKE_SQLSTATE('H','V','0','0','4') +#define ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS MAKE_SQLSTATE('H','V','0','0','6') +#define ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER MAKE_SQLSTATE('H','V','0','9','1') +#define ERRCODE_FDW_INVALID_HANDLE MAKE_SQLSTATE('H','V','0','0','B') +#define ERRCODE_FDW_INVALID_OPTION_INDEX MAKE_SQLSTATE('H','V','0','0','C') +#define ERRCODE_FDW_INVALID_OPTION_NAME MAKE_SQLSTATE('H','V','0','0','D') +#define ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH MAKE_SQLSTATE('H','V','0','9','0') +#define ERRCODE_FDW_INVALID_STRING_FORMAT MAKE_SQLSTATE('H','V','0','0','A') +#define ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER MAKE_SQLSTATE('H','V','0','0','9') +#define ERRCODE_FDW_TOO_MANY_HANDLES MAKE_SQLSTATE('H','V','0','1','4') +#define ERRCODE_FDW_OUT_OF_MEMORY MAKE_SQLSTATE('H','V','0','0','1') +#define ERRCODE_FDW_NO_SCHEMAS MAKE_SQLSTATE('H','V','0','0','P') +#define ERRCODE_FDW_OPTION_NAME_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','J') +#define ERRCODE_FDW_REPLY_HANDLE MAKE_SQLSTATE('H','V','0','0','K') +#define ERRCODE_FDW_SCHEMA_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','Q') +#define ERRCODE_FDW_TABLE_NOT_FOUND MAKE_SQLSTATE('H','V','0','0','R') +#define ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION MAKE_SQLSTATE('H','V','0','0','L') +#define ERRCODE_FDW_UNABLE_TO_CREATE_REPLY MAKE_SQLSTATE('H','V','0','0','M') +#define ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION MAKE_SQLSTATE('H','V','0','0','N') + +/* Class P0 - PL/pgSQL Error */ +#define ERRCODE_PLPGSQL_ERROR MAKE_SQLSTATE('P','0','0','0','0') +#define ERRCODE_RAISE_EXCEPTION MAKE_SQLSTATE('P','0','0','0','1') +#define ERRCODE_NO_DATA_FOUND MAKE_SQLSTATE('P','0','0','0','2') +#define ERRCODE_TOO_MANY_ROWS MAKE_SQLSTATE('P','0','0','0','3') +#define ERRCODE_ASSERT_FAILURE MAKE_SQLSTATE('P','0','0','0','4') + +/* Class XX - Internal Error */ +#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X','0','0','0') +#define ERRCODE_DATA_CORRUPTED MAKE_SQLSTATE('X','X','0','0','1') +#define ERRCODE_INDEX_CORRUPTED MAKE_SQLSTATE('X','X','0','0','2') diff --git a/platform/dbops/binaries/postgres/include/server/utils/evtcache.h b/platform/dbops/binaries/postgres/include/server/utils/evtcache.h new file mode 100644 index 0000000000000000000000000000000000000000..573e1de4066c9e395bf6b4fc8beaa6ed76036c37 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/evtcache.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * evtcache.h + * Special-purpose cache for event trigger data. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * src/include/utils/evtcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef EVTCACHE_H +#define EVTCACHE_H + +#include "nodes/bitmapset.h" +#include "nodes/pg_list.h" + +typedef enum +{ + EVT_DDLCommandStart, + EVT_DDLCommandEnd, + EVT_SQLDrop, + EVT_TableRewrite, + EVT_Login, +} EventTriggerEvent; + +typedef struct +{ + Oid fnoid; /* function to be called */ + char enabled; /* as SESSION_REPLICATION_ROLE_* */ + Bitmapset *tagset; /* command tags, or NULL if empty */ +} EventTriggerCacheItem; + +extern List *EventCacheLookup(EventTriggerEvent event); + +#endif /* EVTCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/expandeddatum.h b/platform/dbops/binaries/postgres/include/server/utils/expandeddatum.h new file mode 100644 index 0000000000000000000000000000000000000000..4a6637dae3478701f26a35cc3a4042927ba297d1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/expandeddatum.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * expandeddatum.h + * Declarations for access to "expanded" value representations. + * + * Complex data types, particularly container types such as arrays and + * records, usually have on-disk representations that are compact but not + * especially convenient to modify. What's more, when we do modify them, + * having to recopy all the rest of the value can be extremely inefficient. + * Therefore, we provide a notion of an "expanded" representation that is used + * only in memory and is optimized more for computation than storage. + * The format appearing on disk is called the data type's "flattened" + * representation, since it is required to be a contiguous blob of bytes -- + * but the type can have an expanded representation that is not. Data types + * must provide means to translate an expanded representation back to + * flattened form. + * + * An expanded object is meant to survive across multiple operations, but + * not to be enormously long-lived; for example it might be a local variable + * in a PL/pgSQL procedure. So its extra bulk compared to the on-disk format + * is a worthwhile trade-off. + * + * References to expanded objects are a type of TOAST pointer. + * Because of longstanding conventions in Postgres, this means that the + * flattened form of such an object must always be a varlena object. + * Fortunately that's no restriction in practice. + * + * There are actually two kinds of TOAST pointers for expanded objects: + * read-only and read-write pointers. Possession of one of the latter + * authorizes a function to modify the value in-place rather than copying it + * as would normally be required. Functions should always return a read-write + * pointer to any new expanded object they create. Functions that modify an + * argument value in-place must take care that they do not corrupt the old + * value if they fail partway through. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/expandeddatum.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPANDEDDATUM_H +#define EXPANDEDDATUM_H + +#include "varatt.h" + +/* Size of an EXTERNAL datum that contains a pointer to an expanded object */ +#define EXPANDED_POINTER_SIZE (VARHDRSZ_EXTERNAL + sizeof(varatt_expanded)) + +/* + * "Methods" that must be provided for any expanded object. + * + * get_flat_size: compute space needed for flattened representation (total, + * including header). + * + * flatten_into: construct flattened representation in the caller-allocated + * space at *result, of size allocated_size (which will always be the result + * of a preceding get_flat_size call; it's passed for cross-checking). + * + * The flattened representation must be a valid in-line, non-compressed, + * 4-byte-header varlena object. + * + * Note: construction of a heap tuple from an expanded datum calls + * get_flat_size twice, so it's worthwhile to make sure that that doesn't + * incur too much overhead. + */ +typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr); +typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr, + void *result, Size allocated_size); + +/* Struct of function pointers for an expanded object's methods */ +typedef struct ExpandedObjectMethods +{ + EOM_get_flat_size_method get_flat_size; + EOM_flatten_into_method flatten_into; +} ExpandedObjectMethods; + +/* + * Every expanded object must contain this header; typically the header + * is embedded in some larger struct that adds type-specific fields. + * + * It is presumed that the header object and all subsidiary data are stored + * in eoh_context, so that the object can be freed by deleting that context, + * or its storage lifespan can be altered by reparenting the context. + * (In principle the object could own additional resources, such as malloc'd + * storage, and use a memory context reset callback to free them upon reset or + * deletion of eoh_context.) + * + * We set up two TOAST pointers within the standard header, one read-write + * and one read-only. This allows functions to return either kind of pointer + * without making an additional allocation, and in particular without worrying + * whether a separately palloc'd object would have sufficient lifespan. + * But note that these pointers are just a convenience; a pointer object + * appearing somewhere else would still be legal. + * + * The typedef declaration for this appears in postgres.h. + */ +struct ExpandedObjectHeader +{ + /* Phony varlena header */ + int32 vl_len_; /* always EOH_HEADER_MAGIC, see below */ + + /* Pointer to methods required for object type */ + const ExpandedObjectMethods *eoh_methods; + + /* Memory context containing this header and subsidiary data */ + MemoryContext eoh_context; + + /* Standard R/W TOAST pointer for this object is kept here */ + char eoh_rw_ptr[EXPANDED_POINTER_SIZE]; + + /* Standard R/O TOAST pointer for this object is kept here */ + char eoh_ro_ptr[EXPANDED_POINTER_SIZE]; +}; + +/* + * Particularly for read-only functions, it is handy to be able to work with + * either regular "flat" varlena inputs or expanded inputs of the same data + * type. To allow determining which case an argument-fetching function has + * returned, the first int32 of an ExpandedObjectHeader always contains -1 + * (EOH_HEADER_MAGIC to the code). This works since no 4-byte-header varlena + * could have that as its first 4 bytes. Caution: we could not reliably tell + * the difference between an ExpandedObjectHeader and a short-header object + * with this trick. However, it works fine if the argument fetching code + * always returns either a 4-byte-header flat object or an expanded object. + */ +#define EOH_HEADER_MAGIC (-1) +#define VARATT_IS_EXPANDED_HEADER(PTR) \ + (((varattrib_4b *) (PTR))->va_4byte.va_header == (uint32) EOH_HEADER_MAGIC) + +/* + * Generic support functions for expanded objects. + * (More of these might be worth inlining later.) + */ + +static inline Datum +EOHPGetRWDatum(const struct ExpandedObjectHeader *eohptr) +{ + return PointerGetDatum(eohptr->eoh_rw_ptr); +} + +static inline Datum +EOHPGetRODatum(const struct ExpandedObjectHeader *eohptr) +{ + return PointerGetDatum(eohptr->eoh_ro_ptr); +} + +/* Does the Datum represent a writable expanded object? */ +#define DatumIsReadWriteExpandedObject(d, isnull, typlen) \ + (((isnull) || (typlen) != -1) ? false : \ + VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d))) + +#define MakeExpandedObjectReadOnly(d, isnull, typlen) \ + (((isnull) || (typlen) != -1) ? (d) : \ + MakeExpandedObjectReadOnlyInternal(d)) + +extern ExpandedObjectHeader *DatumGetEOHP(Datum d); +extern void EOH_init_header(ExpandedObjectHeader *eohptr, + const ExpandedObjectMethods *methods, + MemoryContext obj_context); +extern Size EOH_get_flat_size(ExpandedObjectHeader *eohptr); +extern void EOH_flatten_into(ExpandedObjectHeader *eohptr, + void *result, Size allocated_size); +extern Datum MakeExpandedObjectReadOnlyInternal(Datum d); +extern Datum TransferExpandedObject(Datum d, MemoryContext new_parent); +extern void DeleteExpandedObject(Datum d); + +#endif /* EXPANDEDDATUM_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/expandedrecord.h b/platform/dbops/binaries/postgres/include/server/utils/expandedrecord.h new file mode 100644 index 0000000000000000000000000000000000000000..936aaf19a1f59abb77f4d680aa81aeb6ff27d99c --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/expandedrecord.h @@ -0,0 +1,241 @@ +/*------------------------------------------------------------------------- + * + * expandedrecord.h + * Declarations for composite expanded objects. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/expandedrecord.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPANDEDRECORD_H +#define EXPANDEDRECORD_H + +#include "access/htup.h" +#include "access/tupdesc.h" +#include "fmgr.h" +#include "utils/expandeddatum.h" + + +/* + * An expanded record is contained within a private memory context (as + * all expanded objects must be) and has a control structure as below. + * + * The expanded record might contain a regular "flat" tuple if that was the + * original input and we've not modified it. Otherwise, the contents are + * represented by Datum/isnull arrays plus type information. We could also + * have both forms, if we've deconstructed the original tuple for access + * purposes but not yet changed it. For pass-by-reference field types, the + * Datums would point into the flat tuple in this situation. Once we start + * modifying tuple fields, new pass-by-ref fields are separately palloc'd + * within the memory context. + * + * It's possible to build an expanded record that references a "flat" tuple + * stored externally, if the caller can guarantee that that tuple will not + * change for the lifetime of the expanded record. (This frammish is mainly + * meant to avoid unnecessary data copying in trigger functions.) + */ +#define ER_MAGIC 1384727874 /* ID for debugging crosschecks */ + +typedef struct ExpandedRecordHeader +{ + /* Standard header for expanded objects */ + ExpandedObjectHeader hdr; + + /* Magic value identifying an expanded record (for debugging only) */ + int er_magic; + + /* Assorted flag bits */ + int flags; +#define ER_FLAG_FVALUE_VALID 0x0001 /* fvalue is up to date? */ +#define ER_FLAG_FVALUE_ALLOCED 0x0002 /* fvalue is local storage? */ +#define ER_FLAG_DVALUES_VALID 0x0004 /* dvalues/dnulls are up to date? */ +#define ER_FLAG_DVALUES_ALLOCED 0x0008 /* any field values local storage? */ +#define ER_FLAG_HAVE_EXTERNAL 0x0010 /* any field values are external? */ +#define ER_FLAG_TUPDESC_ALLOCED 0x0020 /* tupdesc is local storage? */ +#define ER_FLAG_IS_DOMAIN 0x0040 /* er_decltypeid is domain? */ +#define ER_FLAG_IS_DUMMY 0x0080 /* this header is dummy (see below) */ +/* flag bits that are not to be cleared when replacing tuple data: */ +#define ER_FLAGS_NON_DATA \ + (ER_FLAG_TUPDESC_ALLOCED | ER_FLAG_IS_DOMAIN | ER_FLAG_IS_DUMMY) + + /* Declared type of the record variable (could be a domain type) */ + Oid er_decltypeid; + + /* + * Actual composite type/typmod; never a domain (if ER_FLAG_IS_DOMAIN, + * these identify the composite base type). These will match + * er_tupdesc->tdtypeid/tdtypmod, as well as the header fields of + * composite datums made from or stored in this expanded record. + */ + Oid er_typeid; /* type OID of the composite type */ + int32 er_typmod; /* typmod of the composite type */ + + /* + * Tuple descriptor, if we have one, else NULL. This may point to a + * reference-counted tupdesc originally belonging to the typcache, in + * which case we use a memory context reset callback to release the + * refcount. It can also be locally allocated in this object's private + * context (in which case ER_FLAG_TUPDESC_ALLOCED is set). + */ + TupleDesc er_tupdesc; + + /* + * Unique-within-process identifier for the tupdesc (see typcache.h). This + * field will never be equal to INVALID_TUPLEDESC_IDENTIFIER. + */ + uint64 er_tupdesc_id; + + /* + * If we have a Datum-array representation of the record, it's kept here; + * else ER_FLAG_DVALUES_VALID is not set, and dvalues/dnulls may be NULL + * if they've not yet been allocated. If allocated, the dvalues and + * dnulls arrays are palloc'd within the object private context, and are + * of length matching er_tupdesc->natts. For pass-by-ref field types, + * dvalues entries might point either into the fstartptr..fendptr area, or + * to separately palloc'd chunks. + */ + Datum *dvalues; /* array of Datums */ + bool *dnulls; /* array of is-null flags for Datums */ + int nfields; /* length of above arrays */ + + /* + * flat_size is the current space requirement for the flat equivalent of + * the expanded record, if known; otherwise it's 0. We store this to make + * consecutive calls of get_flat_size cheap. If flat_size is not 0, the + * component values data_len, hoff, and hasnull must be valid too. + */ + Size flat_size; + + Size data_len; /* data len within flat_size */ + int hoff; /* header offset */ + bool hasnull; /* null bitmap needed? */ + + /* + * fvalue points to the flat representation if we have one, else it is + * NULL. If the flat representation is valid (up to date) then + * ER_FLAG_FVALUE_VALID is set. Even if we've outdated the flat + * representation due to changes of user fields, it can still be used to + * fetch system column values. If we have a flat representation then + * fstartptr/fendptr point to the start and end+1 of its data area; this + * is so that we can tell which Datum pointers point into the flat + * representation rather than being pointers to separately palloc'd data. + */ + HeapTuple fvalue; /* might or might not be private storage */ + char *fstartptr; /* start of its data area */ + char *fendptr; /* end+1 of its data area */ + + /* Some operations on the expanded record need a short-lived context */ + MemoryContext er_short_term_cxt; /* short-term memory context */ + + /* Working state for domain checking, used if ER_FLAG_IS_DOMAIN is set */ + struct ExpandedRecordHeader *er_dummy_header; /* dummy record header */ + void *er_domaininfo; /* cache space for domain_check() */ + + /* Callback info (it's active if er_mcb.arg is not NULL) */ + MemoryContextCallback er_mcb; +} ExpandedRecordHeader; + +/* fmgr functions and macros for expanded record objects */ +static inline Datum +ExpandedRecordGetDatum(const ExpandedRecordHeader *erh) +{ + return EOHPGetRWDatum(&erh->hdr); +} + +static inline Datum +ExpandedRecordGetRODatum(const ExpandedRecordHeader *erh) +{ + return EOHPGetRODatum(&erh->hdr); +} + +#define PG_GETARG_EXPANDED_RECORD(n) DatumGetExpandedRecord(PG_GETARG_DATUM(n)) +#define PG_RETURN_EXPANDED_RECORD(x) PG_RETURN_DATUM(ExpandedRecordGetDatum(x)) + +/* assorted other macros */ +#define ExpandedRecordIsEmpty(erh) \ + (((erh)->flags & (ER_FLAG_DVALUES_VALID | ER_FLAG_FVALUE_VALID)) == 0) +#define ExpandedRecordIsDomain(erh) \ + (((erh)->flags & ER_FLAG_IS_DOMAIN) != 0) + +/* this can substitute for TransferExpandedObject() when we already have erh */ +#define TransferExpandedRecord(erh, cxt) \ + MemoryContextSetParent((erh)->hdr.eoh_context, cxt) + +/* information returned by expanded_record_lookup_field() */ +typedef struct ExpandedRecordFieldInfo +{ + int fnumber; /* field's attr number in record */ + Oid ftypeid; /* field's type/typmod info */ + int32 ftypmod; + Oid fcollation; /* field's collation if any */ +} ExpandedRecordFieldInfo; + +/* + * prototypes for functions defined in expandedrecord.c + */ +extern ExpandedRecordHeader *make_expanded_record_from_typeid(Oid type_id, int32 typmod, + MemoryContext parentcontext); +extern ExpandedRecordHeader *make_expanded_record_from_tupdesc(TupleDesc tupdesc, + MemoryContext parentcontext); +extern ExpandedRecordHeader *make_expanded_record_from_exprecord(ExpandedRecordHeader *olderh, + MemoryContext parentcontext); +extern void expanded_record_set_tuple(ExpandedRecordHeader *erh, + HeapTuple tuple, bool copy, bool expand_external); +extern Datum make_expanded_record_from_datum(Datum recorddatum, + MemoryContext parentcontext); +extern TupleDesc expanded_record_fetch_tupdesc(ExpandedRecordHeader *erh); +extern HeapTuple expanded_record_get_tuple(ExpandedRecordHeader *erh); +extern ExpandedRecordHeader *DatumGetExpandedRecord(Datum d); +extern void deconstruct_expanded_record(ExpandedRecordHeader *erh); +extern bool expanded_record_lookup_field(ExpandedRecordHeader *erh, + const char *fieldname, + ExpandedRecordFieldInfo *finfo); +extern Datum expanded_record_fetch_field(ExpandedRecordHeader *erh, int fnumber, + bool *isnull); +extern void expanded_record_set_field_internal(ExpandedRecordHeader *erh, + int fnumber, + Datum newValue, bool isnull, + bool expand_external, + bool check_constraints); +extern void expanded_record_set_fields(ExpandedRecordHeader *erh, + const Datum *newValues, const bool *isnulls, + bool expand_external); + +/* outside code should never call expanded_record_set_field_internal as such */ +#define expanded_record_set_field(erh, fnumber, newValue, isnull, expand_external) \ + expanded_record_set_field_internal(erh, fnumber, newValue, isnull, expand_external, true) + +/* + * Inline-able fast cases. The expanded_record_fetch_xxx functions above + * handle the general cases. + */ + +/* Get the tupdesc for the expanded record's actual type */ +static inline TupleDesc +expanded_record_get_tupdesc(ExpandedRecordHeader *erh) +{ + if (likely(erh->er_tupdesc != NULL)) + return erh->er_tupdesc; + else + return expanded_record_fetch_tupdesc(erh); +} + +/* Get value of record field */ +static inline Datum +expanded_record_get_field(ExpandedRecordHeader *erh, int fnumber, + bool *isnull) +{ + if ((erh->flags & ER_FLAG_DVALUES_VALID) && + likely(fnumber > 0 && fnumber <= erh->nfields)) + { + *isnull = erh->dnulls[fnumber - 1]; + return erh->dvalues[fnumber - 1]; + } + else + return expanded_record_fetch_field(erh, fnumber, isnull); +} + +#endif /* EXPANDEDRECORD_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/float.h b/platform/dbops/binaries/postgres/include/server/utils/float.h new file mode 100644 index 0000000000000000000000000000000000000000..7d1badd292ad1a1d46e90e7c30e189c014981e8a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/float.h @@ -0,0 +1,357 @@ +/*------------------------------------------------------------------------- + * + * float.h + * Definitions for the built-in floating-point types + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * src/include/utils/float.h + * + *------------------------------------------------------------------------- + */ +#ifndef FLOAT_H +#define FLOAT_H + +#include + +/* X/Open (XSI) requires to provide M_PI, but core POSIX does not */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* Radians per degree, a.k.a. PI / 180 */ +#define RADIANS_PER_DEGREE 0.0174532925199432957692 + +/* Visual C++ etc lacks NAN, and won't accept 0.0/0.0. */ +#if defined(WIN32) && !defined(NAN) +static const uint32 nan[2] = {0xffffffff, 0x7fffffff}; + +#define NAN (*(const float8 *) nan) +#endif + +extern PGDLLIMPORT int extra_float_digits; + +/* + * Utility functions in float.c + */ +extern void float_overflow_error(void) pg_attribute_noreturn(); +extern void float_underflow_error(void) pg_attribute_noreturn(); +extern void float_zero_divide_error(void) pg_attribute_noreturn(); +extern int is_infinite(float8 val); +extern float8 float8in_internal(char *num, char **endptr_p, + const char *type_name, const char *orig_string, + struct Node *escontext); +extern float4 float4in_internal(char *num, char **endptr_p, + const char *type_name, const char *orig_string, + struct Node *escontext); +extern char *float8out_internal(float8 num); +extern int float4_cmp_internal(float4 a, float4 b); +extern int float8_cmp_internal(float8 a, float8 b); + +/* + * Routines to provide reasonably platform-independent handling of + * infinity and NaN + * + * We assume that isinf() and isnan() are available and work per spec. + * (On some platforms, we have to supply our own; see src/port.) However, + * generating an Infinity or NaN in the first place is less well standardized; + * pre-C99 systems tend not to have C99's INFINITY and NaN macros. We + * centralize our workarounds for this here. + */ + +/* + * The funny placements of the two #pragmas is necessary because of a + * long lived bug in the Microsoft compilers. + * See http://support.microsoft.com/kb/120968/en-us for details + */ +#ifdef _MSC_VER +#pragma warning(disable:4756) +#endif +static inline float4 +get_float4_infinity(void) +{ +#ifdef INFINITY + /* C99 standard way */ + return (float4) INFINITY; +#else +#ifdef _MSC_VER +#pragma warning(default:4756) +#endif + + /* + * On some platforms, HUGE_VAL is an infinity, elsewhere it's just the + * largest normal float8. We assume forcing an overflow will get us a + * true infinity. + */ + return (float4) (HUGE_VAL * HUGE_VAL); +#endif +} + +static inline float8 +get_float8_infinity(void) +{ +#ifdef INFINITY + /* C99 standard way */ + return (float8) INFINITY; +#else + + /* + * On some platforms, HUGE_VAL is an infinity, elsewhere it's just the + * largest normal float8. We assume forcing an overflow will get us a + * true infinity. + */ + return (float8) (HUGE_VAL * HUGE_VAL); +#endif +} + +static inline float4 +get_float4_nan(void) +{ +#ifdef NAN + /* C99 standard way */ + return (float4) NAN; +#else + /* Assume we can get a NAN via zero divide */ + return (float4) (0.0 / 0.0); +#endif +} + +static inline float8 +get_float8_nan(void) +{ + /* (float8) NAN doesn't work on some NetBSD/MIPS releases */ +#if defined(NAN) && !(defined(__NetBSD__) && defined(__mips__)) + /* C99 standard way */ + return (float8) NAN; +#else + /* Assume we can get a NaN via zero divide */ + return (float8) (0.0 / 0.0); +#endif +} + +/* + * Floating-point arithmetic with overflow/underflow reported as errors + * + * There isn't any way to check for underflow of addition/subtraction + * because numbers near the underflow value have already been rounded to + * the point where we can't detect that the two values were originally + * different, e.g. on x86, '1e-45'::float4 == '2e-45'::float4 == + * 1.4013e-45. + */ + +static inline float4 +float4_pl(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 + val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float8 +float8_pl(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 + val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float4 +float4_mi(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 - val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float8 +float8_mi(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 - val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + + return result; +} + +static inline float4 +float4_mul(const float4 val1, const float4 val2) +{ + float4 result; + + result = val1 * val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + if (unlikely(result == 0.0f) && val1 != 0.0f && val2 != 0.0f) + float_underflow_error(); + + return result; +} + +static inline float8 +float8_mul(const float8 val1, const float8 val2) +{ + float8 result; + + result = val1 * val2; + if (unlikely(isinf(result)) && !isinf(val1) && !isinf(val2)) + float_overflow_error(); + if (unlikely(result == 0.0) && val1 != 0.0 && val2 != 0.0) + float_underflow_error(); + + return result; +} + +static inline float4 +float4_div(const float4 val1, const float4 val2) +{ + float4 result; + + if (unlikely(val2 == 0.0f) && !isnan(val1)) + float_zero_divide_error(); + result = val1 / val2; + if (unlikely(isinf(result)) && !isinf(val1)) + float_overflow_error(); + if (unlikely(result == 0.0f) && val1 != 0.0f && !isinf(val2)) + float_underflow_error(); + + return result; +} + +static inline float8 +float8_div(const float8 val1, const float8 val2) +{ + float8 result; + + if (unlikely(val2 == 0.0) && !isnan(val1)) + float_zero_divide_error(); + result = val1 / val2; + if (unlikely(isinf(result)) && !isinf(val1)) + float_overflow_error(); + if (unlikely(result == 0.0) && val1 != 0.0 && !isinf(val2)) + float_underflow_error(); + + return result; +} + +/* + * Routines for NaN-aware comparisons + * + * We consider all NaNs to be equal and larger than any non-NaN. This is + * somewhat arbitrary; the important thing is to have a consistent sort + * order. + */ + +static inline bool +float4_eq(const float4 val1, const float4 val2) +{ + return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2; +} + +static inline bool +float8_eq(const float8 val1, const float8 val2) +{ + return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2; +} + +static inline bool +float4_ne(const float4 val1, const float4 val2) +{ + return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2; +} + +static inline bool +float8_ne(const float8 val1, const float8 val2) +{ + return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2; +} + +static inline bool +float4_lt(const float4 val1, const float4 val2) +{ + return !isnan(val1) && (isnan(val2) || val1 < val2); +} + +static inline bool +float8_lt(const float8 val1, const float8 val2) +{ + return !isnan(val1) && (isnan(val2) || val1 < val2); +} + +static inline bool +float4_le(const float4 val1, const float4 val2) +{ + return isnan(val2) || (!isnan(val1) && val1 <= val2); +} + +static inline bool +float8_le(const float8 val1, const float8 val2) +{ + return isnan(val2) || (!isnan(val1) && val1 <= val2); +} + +static inline bool +float4_gt(const float4 val1, const float4 val2) +{ + return !isnan(val2) && (isnan(val1) || val1 > val2); +} + +static inline bool +float8_gt(const float8 val1, const float8 val2) +{ + return !isnan(val2) && (isnan(val1) || val1 > val2); +} + +static inline bool +float4_ge(const float4 val1, const float4 val2) +{ + return isnan(val1) || (!isnan(val2) && val1 >= val2); +} + +static inline bool +float8_ge(const float8 val1, const float8 val2) +{ + return isnan(val1) || (!isnan(val2) && val1 >= val2); +} + +static inline float4 +float4_min(const float4 val1, const float4 val2) +{ + return float4_lt(val1, val2) ? val1 : val2; +} + +static inline float8 +float8_min(const float8 val1, const float8 val2) +{ + return float8_lt(val1, val2) ? val1 : val2; +} + +static inline float4 +float4_max(const float4 val1, const float4 val2) +{ + return float4_gt(val1, val2) ? val1 : val2; +} + +static inline float8 +float8_max(const float8 val1, const float8 val2) +{ + return float8_gt(val1, val2) ? val1 : val2; +} + +#endif /* FLOAT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/fmgroids.h b/platform/dbops/binaries/postgres/include/server/utils/fmgroids.h new file mode 100644 index 0000000000000000000000000000000000000000..bb0a91f074cfb576fb65526ed03b63520b28b44b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/fmgroids.h @@ -0,0 +1,3347 @@ +/*------------------------------------------------------------------------- + * + * fmgroids.h + * Macros that define the OIDs of built-in functions. + * + * These macros can be used to avoid a catalog lookup when a specific + * fmgr-callable function needs to be referenced. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/Gen_fmgrtab.pl + * + *------------------------------------------------------------------------- + */ +#ifndef FMGROIDS_H +#define FMGROIDS_H + +/* + * Constant macros for the OIDs of entries in pg_proc. + * + * F_XXX macros are named after the proname field; if that is not unique, + * we append the proargtypes field, replacing spaces with underscores. + * For example, we have F_OIDEQ because that proname is unique, but + * F_POW_FLOAT8_FLOAT8 (among others) because that proname is not. + */ +#define F_HEAP_TABLEAM_HANDLER 3 +#define F_BYTEAOUT 31 +#define F_CHAROUT 33 +#define F_NAMEIN 34 +#define F_NAMEOUT 35 +#define F_INT2IN 38 +#define F_INT2OUT 39 +#define F_INT2VECTORIN 40 +#define F_INT2VECTOROUT 41 +#define F_INT4IN 42 +#define F_INT4OUT 43 +#define F_REGPROCIN 44 +#define F_REGPROCOUT 45 +#define F_TEXTIN 46 +#define F_TEXTOUT 47 +#define F_TIDIN 48 +#define F_TIDOUT 49 +#define F_XIDIN 50 +#define F_XIDOUT 51 +#define F_CIDIN 52 +#define F_CIDOUT 53 +#define F_OIDVECTORIN 54 +#define F_OIDVECTOROUT 55 +#define F_BOOLLT 56 +#define F_BOOLGT 57 +#define F_BOOLEQ 60 +#define F_CHAREQ 61 +#define F_NAMEEQ 62 +#define F_INT2EQ 63 +#define F_INT2LT 64 +#define F_INT4EQ 65 +#define F_INT4LT 66 +#define F_TEXTEQ 67 +#define F_XIDEQ 68 +#define F_CIDEQ 69 +#define F_CHARNE 70 +#define F_CHARLE 72 +#define F_CHARGT 73 +#define F_CHARGE 74 +#define F_INT4_CHAR 77 +#define F_CHAR_INT4 78 +#define F_NAMEREGEXEQ 79 +#define F_BOOLNE 84 +#define F_PG_DDL_COMMAND_IN 86 +#define F_PG_DDL_COMMAND_OUT 87 +#define F_PG_DDL_COMMAND_RECV 88 +#define F_VERSION 89 +#define F_PG_DDL_COMMAND_SEND 90 +#define F_EQSEL 101 +#define F_NEQSEL 102 +#define F_SCALARLTSEL 103 +#define F_SCALARGTSEL 104 +#define F_EQJOINSEL 105 +#define F_NEQJOINSEL 106 +#define F_SCALARLTJOINSEL 107 +#define F_SCALARGTJOINSEL 108 +#define F_UNKNOWNIN 109 +#define F_UNKNOWNOUT 110 +#define F_BOX_ABOVE_EQ 115 +#define F_BOX_BELOW_EQ 116 +#define F_POINT_IN 117 +#define F_POINT_OUT 118 +#define F_LSEG_IN 119 +#define F_LSEG_OUT 120 +#define F_PATH_IN 121 +#define F_PATH_OUT 122 +#define F_BOX_IN 123 +#define F_BOX_OUT 124 +#define F_BOX_OVERLAP 125 +#define F_BOX_GE 126 +#define F_BOX_GT 127 +#define F_BOX_EQ 128 +#define F_BOX_LT 129 +#define F_BOX_LE 130 +#define F_POINT_ABOVE 131 +#define F_POINT_LEFT 132 +#define F_POINT_RIGHT 133 +#define F_POINT_BELOW 134 +#define F_POINT_EQ 135 +#define F_ON_PB 136 +#define F_ON_PPATH 137 +#define F_BOX_CENTER 138 +#define F_AREASEL 139 +#define F_AREAJOINSEL 140 +#define F_INT4MUL 141 +#define F_INT4NE 144 +#define F_INT2NE 145 +#define F_INT2GT 146 +#define F_INT4GT 147 +#define F_INT2LE 148 +#define F_INT4LE 149 +#define F_INT4GE 150 +#define F_INT2GE 151 +#define F_INT2MUL 152 +#define F_INT2DIV 153 +#define F_INT4DIV 154 +#define F_INT2MOD 155 +#define F_INT4MOD 156 +#define F_TEXTNE 157 +#define F_INT24EQ 158 +#define F_INT42EQ 159 +#define F_INT24LT 160 +#define F_INT42LT 161 +#define F_INT24GT 162 +#define F_INT42GT 163 +#define F_INT24NE 164 +#define F_INT42NE 165 +#define F_INT24LE 166 +#define F_INT42LE 167 +#define F_INT24GE 168 +#define F_INT42GE 169 +#define F_INT24MUL 170 +#define F_INT42MUL 171 +#define F_INT24DIV 172 +#define F_INT42DIV 173 +#define F_INT2PL 176 +#define F_INT4PL 177 +#define F_INT24PL 178 +#define F_INT42PL 179 +#define F_INT2MI 180 +#define F_INT4MI 181 +#define F_INT24MI 182 +#define F_INT42MI 183 +#define F_OIDEQ 184 +#define F_OIDNE 185 +#define F_BOX_SAME 186 +#define F_BOX_CONTAIN 187 +#define F_BOX_LEFT 188 +#define F_BOX_OVERLEFT 189 +#define F_BOX_OVERRIGHT 190 +#define F_BOX_RIGHT 191 +#define F_BOX_CONTAINED 192 +#define F_BOX_CONTAIN_PT 193 +#define F_PG_NODE_TREE_IN 195 +#define F_PG_NODE_TREE_OUT 196 +#define F_PG_NODE_TREE_RECV 197 +#define F_PG_NODE_TREE_SEND 198 +#define F_FLOAT4IN 200 +#define F_FLOAT4OUT 201 +#define F_FLOAT4MUL 202 +#define F_FLOAT4DIV 203 +#define F_FLOAT4PL 204 +#define F_FLOAT4MI 205 +#define F_FLOAT4UM 206 +#define F_FLOAT4ABS 207 +#define F_FLOAT4_ACCUM 208 +#define F_FLOAT4LARGER 209 +#define F_FLOAT4SMALLER 211 +#define F_INT4UM 212 +#define F_INT2UM 213 +#define F_FLOAT8IN 214 +#define F_FLOAT8OUT 215 +#define F_FLOAT8MUL 216 +#define F_FLOAT8DIV 217 +#define F_FLOAT8PL 218 +#define F_FLOAT8MI 219 +#define F_FLOAT8UM 220 +#define F_FLOAT8ABS 221 +#define F_FLOAT8_ACCUM 222 +#define F_FLOAT8LARGER 223 +#define F_FLOAT8SMALLER 224 +#define F_LSEG_CENTER 225 +#define F_POLY_CENTER 227 +#define F_DROUND 228 +#define F_DTRUNC 229 +#define F_DSQRT 230 +#define F_DCBRT 231 +#define F_DPOW 232 +#define F_DEXP 233 +#define F_DLOG1 234 +#define F_FLOAT8_INT2 235 +#define F_FLOAT4_INT2 236 +#define F_INT2_FLOAT8 237 +#define F_INT2_FLOAT4 238 +#define F_LINE_DISTANCE 239 +#define F_NAMEEQTEXT 240 +#define F_NAMELTTEXT 241 +#define F_NAMELETEXT 242 +#define F_NAMEGETEXT 243 +#define F_NAMEGTTEXT 244 +#define F_NAMENETEXT 245 +#define F_BTNAMETEXTCMP 246 +#define F_TEXTEQNAME 247 +#define F_TEXTLTNAME 248 +#define F_TEXTLENAME 249 +#define F_TEXTGENAME 250 +#define F_TEXTGTNAME 251 +#define F_TEXTNENAME 252 +#define F_BTTEXTNAMECMP 253 +#define F_NAMECONCATOID 266 +#define F_TABLE_AM_HANDLER_IN 267 +#define F_TABLE_AM_HANDLER_OUT 268 +#define F_TIMEOFDAY 274 +#define F_PG_NEXTOID 275 +#define F_FLOAT8_COMBINE 276 +#define F_INTER_SL 277 +#define F_INTER_LB 278 +#define F_FLOAT48MUL 279 +#define F_FLOAT48DIV 280 +#define F_FLOAT48PL 281 +#define F_FLOAT48MI 282 +#define F_FLOAT84MUL 283 +#define F_FLOAT84DIV 284 +#define F_FLOAT84PL 285 +#define F_FLOAT84MI 286 +#define F_FLOAT4EQ 287 +#define F_FLOAT4NE 288 +#define F_FLOAT4LT 289 +#define F_FLOAT4LE 290 +#define F_FLOAT4GT 291 +#define F_FLOAT4GE 292 +#define F_FLOAT8EQ 293 +#define F_FLOAT8NE 294 +#define F_FLOAT8LT 295 +#define F_FLOAT8LE 296 +#define F_FLOAT8GT 297 +#define F_FLOAT8GE 298 +#define F_FLOAT48EQ 299 +#define F_FLOAT48NE 300 +#define F_FLOAT48LT 301 +#define F_FLOAT48LE 302 +#define F_FLOAT48GT 303 +#define F_FLOAT48GE 304 +#define F_FLOAT84EQ 305 +#define F_FLOAT84NE 306 +#define F_FLOAT84LT 307 +#define F_FLOAT84LE 308 +#define F_FLOAT84GT 309 +#define F_FLOAT84GE 310 +#define F_FLOAT8_FLOAT4 311 +#define F_FLOAT4_FLOAT8 312 +#define F_INT4_INT2 313 +#define F_INT2_INT4 314 +#define F_PG_JIT_AVAILABLE 315 +#define F_FLOAT8_INT4 316 +#define F_INT4_FLOAT8 317 +#define F_FLOAT4_INT4 318 +#define F_INT4_FLOAT4 319 +#define F_WIDTH_BUCKET_FLOAT8_FLOAT8_FLOAT8_INT4 320 +#define F_JSON_IN 321 +#define F_JSON_OUT 322 +#define F_JSON_RECV 323 +#define F_JSON_SEND 324 +#define F_INDEX_AM_HANDLER_IN 326 +#define F_INDEX_AM_HANDLER_OUT 327 +#define F_HASHMACADDR8 328 +#define F_HASH_ACLITEM 329 +#define F_BTHANDLER 330 +#define F_HASHHANDLER 331 +#define F_GISTHANDLER 332 +#define F_GINHANDLER 333 +#define F_SPGHANDLER 334 +#define F_BRINHANDLER 335 +#define F_SCALARLESEL 336 +#define F_SCALARGESEL 337 +#define F_AMVALIDATE 338 +#define F_POLY_SAME 339 +#define F_POLY_CONTAIN 340 +#define F_POLY_LEFT 341 +#define F_POLY_OVERLEFT 342 +#define F_POLY_OVERRIGHT 343 +#define F_POLY_RIGHT 344 +#define F_POLY_CONTAINED 345 +#define F_POLY_OVERLAP 346 +#define F_POLY_IN 347 +#define F_POLY_OUT 348 +#define F_BTINT2CMP 350 +#define F_BTINT4CMP 351 +#define F_BTFLOAT4CMP 354 +#define F_BTFLOAT8CMP 355 +#define F_BTOIDCMP 356 +#define F_DIST_BP 357 +#define F_BTCHARCMP 358 +#define F_BTNAMECMP 359 +#define F_BTTEXTCMP 360 +#define F_LSEG_DISTANCE 361 +#define F_LSEG_INTERPT 362 +#define F_DIST_PS 363 +#define F_DIST_PB 364 +#define F_DIST_SB 365 +#define F_CLOSE_PS 366 +#define F_CLOSE_PB 367 +#define F_CLOSE_SB 368 +#define F_ON_PS 369 +#define F_PATH_DISTANCE 370 +#define F_DIST_PPATH 371 +#define F_ON_SB 372 +#define F_INTER_SB 373 +#define F_STRING_TO_ARRAY_TEXT_TEXT_TEXT 376 +#define F_CASH_CMP 377 +#define F_ARRAY_APPEND 378 +#define F_ARRAY_PREPEND 379 +#define F_DIST_SP 380 +#define F_DIST_BS 381 +#define F_BTARRAYCMP 382 +#define F_ARRAY_CAT 383 +#define F_ARRAY_TO_STRING_ANYARRAY_TEXT_TEXT 384 +#define F_SCALARLEJOINSEL 386 +#define F_ARRAY_NE 390 +#define F_ARRAY_LT 391 +#define F_ARRAY_GT 392 +#define F_ARRAY_LE 393 +#define F_STRING_TO_ARRAY_TEXT_TEXT 394 +#define F_ARRAY_TO_STRING_ANYARRAY_TEXT 395 +#define F_ARRAY_GE 396 +#define F_SCALARGEJOINSEL 398 +#define F_HASHMACADDR 399 +#define F_HASHTEXT 400 +#define F_TEXT_BPCHAR 401 +#define F_BTOIDVECTORCMP 404 +#define F_TEXT_NAME 406 +#define F_NAME_TEXT 407 +#define F_BPCHAR_NAME 408 +#define F_NAME_BPCHAR 409 +#define F_DIST_PATHP 421 +#define F_HASHINET 422 +#define F_HASHINT4EXTENDED 425 +#define F_HASH_NUMERIC 432 +#define F_MACADDR_IN 436 +#define F_MACADDR_OUT 437 +#define F_NUM_NULLS 438 +#define F_NUM_NONNULLS 440 +#define F_HASHINT2EXTENDED 441 +#define F_HASHINT8EXTENDED 442 +#define F_HASHFLOAT4EXTENDED 443 +#define F_HASHFLOAT8EXTENDED 444 +#define F_HASHOIDEXTENDED 445 +#define F_HASHCHAREXTENDED 446 +#define F_HASHNAMEEXTENDED 447 +#define F_HASHTEXTEXTENDED 448 +#define F_HASHINT2 449 +#define F_HASHINT4 450 +#define F_HASHFLOAT4 451 +#define F_HASHFLOAT8 452 +#define F_HASHOID 453 +#define F_HASHCHAR 454 +#define F_HASHNAME 455 +#define F_HASHVARLENA 456 +#define F_HASHOIDVECTOR 457 +#define F_TEXT_LARGER 458 +#define F_TEXT_SMALLER 459 +#define F_INT8IN 460 +#define F_INT8OUT 461 +#define F_INT8UM 462 +#define F_INT8PL 463 +#define F_INT8MI 464 +#define F_INT8MUL 465 +#define F_INT8DIV 466 +#define F_INT8EQ 467 +#define F_INT8NE 468 +#define F_INT8LT 469 +#define F_INT8GT 470 +#define F_INT8LE 471 +#define F_INT8GE 472 +#define F_INT84EQ 474 +#define F_INT84NE 475 +#define F_INT84LT 476 +#define F_INT84GT 477 +#define F_INT84LE 478 +#define F_INT84GE 479 +#define F_INT4_INT8 480 +#define F_INT8_INT4 481 +#define F_FLOAT8_INT8 482 +#define F_INT8_FLOAT8 483 +#define F_ARRAY_LARGER 515 +#define F_ARRAY_SMALLER 516 +#define F_ABBREV_INET 598 +#define F_ABBREV_CIDR 599 +#define F_SET_MASKLEN_INET_INT4 605 +#define F_OIDVECTORNE 619 +#define F_HASH_ARRAY 626 +#define F_SET_MASKLEN_CIDR_INT4 635 +#define F_PG_INDEXAM_HAS_PROPERTY 636 +#define F_PG_INDEX_HAS_PROPERTY 637 +#define F_PG_INDEX_COLUMN_HAS_PROPERTY 638 +#define F_FLOAT4_INT8 652 +#define F_INT8_FLOAT4 653 +#define F_NAMELT 655 +#define F_NAMELE 656 +#define F_NAMEGT 657 +#define F_NAMEGE 658 +#define F_NAMENE 659 +#define F_BPCHAR_BPCHAR_INT4_BOOL 668 +#define F_VARCHAR_VARCHAR_INT4_BOOL 669 +#define F_PG_INDEXAM_PROGRESS_PHASENAME 676 +#define F_OIDVECTORLT 677 +#define F_OIDVECTORLE 678 +#define F_OIDVECTOREQ 679 +#define F_OIDVECTORGE 680 +#define F_OIDVECTORGT 681 +#define F_NETWORK 683 +#define F_NETMASK 696 +#define F_MASKLEN 697 +#define F_BROADCAST 698 +#define F_HOST 699 +#define F_DIST_LP 702 +#define F_DIST_LS 704 +#define F_GETPGUSERNAME 710 +#define F_FAMILY 711 +#define F_INT2_INT8 714 +#define F_LO_CREATE 715 +#define F_OIDLT 716 +#define F_OIDLE 717 +#define F_OCTET_LENGTH_BYTEA 720 +#define F_GET_BYTE 721 +#define F_SET_BYTE 722 +#define F_GET_BIT_BYTEA_INT8 723 +#define F_SET_BIT_BYTEA_INT8_INT4 724 +#define F_DIST_PL 725 +#define F_DIST_SL 727 +#define F_DIST_CPOLY 728 +#define F_POLY_DISTANCE 729 +#define F_TEXT_INET 730 +#define F_TEXT_LT 740 +#define F_TEXT_LE 741 +#define F_TEXT_GT 742 +#define F_TEXT_GE 743 +#define F_ARRAY_EQ 744 +#define F_CURRENT_USER 745 +#define F_SESSION_USER 746 +#define F_ARRAY_DIMS 747 +#define F_ARRAY_NDIMS 748 +#define F_OVERLAY_BYTEA_BYTEA_INT4_INT4 749 +#define F_ARRAY_IN 750 +#define F_ARRAY_OUT 751 +#define F_OVERLAY_BYTEA_BYTEA_INT4 752 +#define F_TRUNC_MACADDR 753 +#define F_INT8_INT2 754 +#define F_LO_IMPORT_TEXT 764 +#define F_LO_EXPORT 765 +#define F_INT4INC 766 +#define F_LO_IMPORT_TEXT_OID 767 +#define F_INT4LARGER 768 +#define F_INT4SMALLER 769 +#define F_INT2LARGER 770 +#define F_INT2SMALLER 771 +#define F_HASHVARLENAEXTENDED 772 +#define F_HASHOIDVECTOREXTENDED 776 +#define F_HASH_ACLITEM_EXTENDED 777 +#define F_HASHMACADDREXTENDED 778 +#define F_HASHINETEXTENDED 779 +#define F_HASH_NUMERIC_EXTENDED 780 +#define F_HASHMACADDR8EXTENDED 781 +#define F_HASH_ARRAY_EXTENDED 782 +#define F_DIST_POLYC 785 +#define F_PG_CLIENT_ENCODING 810 +#define F_CURRENT_QUERY 817 +#define F_MACADDR_EQ 830 +#define F_MACADDR_LT 831 +#define F_MACADDR_LE 832 +#define F_MACADDR_GT 833 +#define F_MACADDR_GE 834 +#define F_MACADDR_NE 835 +#define F_MACADDR_CMP 836 +#define F_INT82PL 837 +#define F_INT82MI 838 +#define F_INT82MUL 839 +#define F_INT82DIV 840 +#define F_INT28PL 841 +#define F_BTINT8CMP 842 +#define F_CASH_MUL_FLT4 846 +#define F_CASH_DIV_FLT4 847 +#define F_FLT4_MUL_CASH 848 +#define F_POSITION_TEXT_TEXT 849 +#define F_TEXTLIKE 850 +#define F_TEXTNLIKE 851 +#define F_INT48EQ 852 +#define F_INT48NE 853 +#define F_INT48LT 854 +#define F_INT48GT 855 +#define F_INT48LE 856 +#define F_INT48GE 857 +#define F_NAMELIKE 858 +#define F_NAMENLIKE 859 +#define F_BPCHAR_CHAR 860 +#define F_CURRENT_DATABASE 861 +#define F_INT4_MUL_CASH 862 +#define F_INT2_MUL_CASH 863 +#define F_CASH_MUL_INT4 864 +#define F_CASH_DIV_INT4 865 +#define F_CASH_MUL_INT2 866 +#define F_CASH_DIV_INT2 867 +#define F_STRPOS 868 +#define F_LOWER_TEXT 870 +#define F_UPPER_TEXT 871 +#define F_INITCAP 872 +#define F_LPAD_TEXT_INT4_TEXT 873 +#define F_RPAD_TEXT_INT4_TEXT 874 +#define F_LTRIM_TEXT_TEXT 875 +#define F_RTRIM_TEXT_TEXT 876 +#define F_SUBSTR_TEXT_INT4_INT4 877 +#define F_TRANSLATE 878 +#define F_LPAD_TEXT_INT4 879 +#define F_RPAD_TEXT_INT4 880 +#define F_LTRIM_TEXT 881 +#define F_RTRIM_TEXT 882 +#define F_SUBSTR_TEXT_INT4 883 +#define F_BTRIM_TEXT_TEXT 884 +#define F_BTRIM_TEXT 885 +#define F_CASH_IN 886 +#define F_CASH_OUT 887 +#define F_CASH_EQ 888 +#define F_CASH_NE 889 +#define F_CASH_LT 890 +#define F_CASH_LE 891 +#define F_CASH_GT 892 +#define F_CASH_GE 893 +#define F_CASH_PL 894 +#define F_CASH_MI 895 +#define F_CASH_MUL_FLT8 896 +#define F_CASH_DIV_FLT8 897 +#define F_CASHLARGER 898 +#define F_CASHSMALLER 899 +#define F_INET_IN 910 +#define F_INET_OUT 911 +#define F_FLT8_MUL_CASH 919 +#define F_NETWORK_EQ 920 +#define F_NETWORK_LT 921 +#define F_NETWORK_LE 922 +#define F_NETWORK_GT 923 +#define F_NETWORK_GE 924 +#define F_NETWORK_NE 925 +#define F_NETWORK_CMP 926 +#define F_NETWORK_SUB 927 +#define F_NETWORK_SUBEQ 928 +#define F_NETWORK_SUP 929 +#define F_NETWORK_SUPEQ 930 +#define F_CASH_WORDS 935 +#define F_SUBSTRING_TEXT_INT4_INT4 936 +#define F_SUBSTRING_TEXT_INT4 937 +#define F_GENERATE_SERIES_TIMESTAMP_TIMESTAMP_INTERVAL 938 +#define F_GENERATE_SERIES_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL 939 +#define F_MOD_INT2_INT2 940 +#define F_MOD_INT4_INT4 941 +#define F_INT28MI 942 +#define F_INT28MUL 943 +#define F_CHAR_TEXT 944 +#define F_INT8MOD 945 +#define F_TEXT_CHAR 946 +#define F_MOD_INT8_INT8 947 +#define F_INT28DIV 948 +#define F_HASHINT8 949 +#define F_LO_OPEN 952 +#define F_LO_CLOSE 953 +#define F_LOREAD 954 +#define F_LOWRITE 955 +#define F_LO_LSEEK 956 +#define F_LO_CREAT 957 +#define F_LO_TELL 958 +#define F_ON_PL 959 +#define F_ON_SL 960 +#define F_CLOSE_PL 961 +#define F_LO_UNLINK 964 +#define F_HASHBPCHAREXTENDED 972 +#define F_PATH_INTER 973 +#define F_AREA_BOX 975 +#define F_WIDTH 976 +#define F_HEIGHT 977 +#define F_BOX_DISTANCE 978 +#define F_AREA_PATH 979 +#define F_BOX_INTERSECT 980 +#define F_DIAGONAL 981 +#define F_PATH_N_LT 982 +#define F_PATH_N_GT 983 +#define F_PATH_N_EQ 984 +#define F_PATH_N_LE 985 +#define F_PATH_N_GE 986 +#define F_PATH_LENGTH 987 +#define F_POINT_NE 988 +#define F_POINT_VERT 989 +#define F_POINT_HORIZ 990 +#define F_POINT_DISTANCE 991 +#define F_SLOPE 992 +#define F_LSEG_POINT_POINT 993 +#define F_LSEG_INTERSECT 994 +#define F_LSEG_PARALLEL 995 +#define F_LSEG_PERP 996 +#define F_LSEG_VERTICAL 997 +#define F_LSEG_HORIZONTAL 998 +#define F_LSEG_EQ 999 +#define F_LO_TRUNCATE 1004 +#define F_TEXTLIKE_SUPPORT 1023 +#define F_TEXTICREGEXEQ_SUPPORT 1024 +#define F_TEXTICLIKE_SUPPORT 1025 +#define F_TIMEZONE_INTERVAL_TIMESTAMPTZ 1026 +#define F_GIST_POINT_COMPRESS 1030 +#define F_ACLITEMIN 1031 +#define F_ACLITEMOUT 1032 +#define F_ACLINSERT 1035 +#define F_ACLREMOVE 1036 +#define F_ACLCONTAINS 1037 +#define F_GETDATABASEENCODING 1039 +#define F_BPCHARIN 1044 +#define F_BPCHAROUT 1045 +#define F_VARCHARIN 1046 +#define F_VARCHAROUT 1047 +#define F_BPCHAREQ 1048 +#define F_BPCHARLT 1049 +#define F_BPCHARLE 1050 +#define F_BPCHARGT 1051 +#define F_BPCHARGE 1052 +#define F_BPCHARNE 1053 +#define F_ACLITEMEQ 1062 +#define F_BPCHAR_LARGER 1063 +#define F_BPCHAR_SMALLER 1064 +#define F_PG_PREPARED_XACT 1065 +#define F_GENERATE_SERIES_INT4_INT4_INT4 1066 +#define F_GENERATE_SERIES_INT4_INT4 1067 +#define F_GENERATE_SERIES_INT8_INT8_INT8 1068 +#define F_GENERATE_SERIES_INT8_INT8 1069 +#define F_BPCHARCMP 1078 +#define F_REGCLASS 1079 +#define F_HASHBPCHAR 1080 +#define F_FORMAT_TYPE 1081 +#define F_DATE_IN 1084 +#define F_DATE_OUT 1085 +#define F_DATE_EQ 1086 +#define F_DATE_LT 1087 +#define F_DATE_LE 1088 +#define F_DATE_GT 1089 +#define F_DATE_GE 1090 +#define F_DATE_NE 1091 +#define F_DATE_CMP 1092 +#define F_TIME_LT 1102 +#define F_TIME_LE 1103 +#define F_TIME_GT 1104 +#define F_TIME_GE 1105 +#define F_TIME_NE 1106 +#define F_TIME_CMP 1107 +#define F_PG_STAT_GET_WAL 1136 +#define F_PG_GET_WAL_REPLAY_PAUSE_STATE 1137 +#define F_DATE_LARGER 1138 +#define F_DATE_SMALLER 1139 +#define F_DATE_MI 1140 +#define F_DATE_PLI 1141 +#define F_DATE_MII 1142 +#define F_TIME_IN 1143 +#define F_TIME_OUT 1144 +#define F_TIME_EQ 1145 +#define F_CIRCLE_ADD_PT 1146 +#define F_CIRCLE_SUB_PT 1147 +#define F_CIRCLE_MUL_PT 1148 +#define F_CIRCLE_DIV_PT 1149 +#define F_TIMESTAMPTZ_IN 1150 +#define F_TIMESTAMPTZ_OUT 1151 +#define F_TIMESTAMPTZ_EQ 1152 +#define F_TIMESTAMPTZ_NE 1153 +#define F_TIMESTAMPTZ_LT 1154 +#define F_TIMESTAMPTZ_LE 1155 +#define F_TIMESTAMPTZ_GE 1156 +#define F_TIMESTAMPTZ_GT 1157 +#define F_TO_TIMESTAMP_FLOAT8 1158 +#define F_TIMEZONE_TEXT_TIMESTAMPTZ 1159 +#define F_INTERVAL_IN 1160 +#define F_INTERVAL_OUT 1161 +#define F_INTERVAL_EQ 1162 +#define F_INTERVAL_NE 1163 +#define F_INTERVAL_LT 1164 +#define F_INTERVAL_LE 1165 +#define F_INTERVAL_GE 1166 +#define F_INTERVAL_GT 1167 +#define F_INTERVAL_UM 1168 +#define F_INTERVAL_PL 1169 +#define F_INTERVAL_MI 1170 +#define F_DATE_PART_TEXT_TIMESTAMPTZ 1171 +#define F_DATE_PART_TEXT_INTERVAL 1172 +#define F_NETWORK_SUBSET_SUPPORT 1173 +#define F_TIMESTAMPTZ_DATE 1174 +#define F_JUSTIFY_HOURS 1175 +#define F_TIMESTAMPTZ_DATE_TIME 1176 +#define F_JSONB_PATH_EXISTS_TZ 1177 +#define F_DATE_TIMESTAMPTZ 1178 +#define F_JSONB_PATH_QUERY_TZ 1179 +#define F_JSONB_PATH_QUERY_ARRAY_TZ 1180 +#define F_AGE_XID 1181 +#define F_TIMESTAMPTZ_MI 1188 +#define F_TIMESTAMPTZ_PL_INTERVAL 1189 +#define F_TIMESTAMPTZ_MI_INTERVAL 1190 +#define F_GENERATE_SUBSCRIPTS_ANYARRAY_INT4_BOOL 1191 +#define F_GENERATE_SUBSCRIPTS_ANYARRAY_INT4 1192 +#define F_ARRAY_FILL_ANYELEMENT__INT4 1193 +#define F_LOG10_FLOAT8 1194 +#define F_TIMESTAMPTZ_SMALLER 1195 +#define F_TIMESTAMPTZ_LARGER 1196 +#define F_INTERVAL_SMALLER 1197 +#define F_INTERVAL_LARGER 1198 +#define F_AGE_TIMESTAMPTZ_TIMESTAMPTZ 1199 +#define F_INTERVAL_INTERVAL_INT4 1200 +#define F_OBJ_DESCRIPTION_OID_NAME 1215 +#define F_COL_DESCRIPTION 1216 +#define F_DATE_TRUNC_TEXT_TIMESTAMPTZ 1217 +#define F_DATE_TRUNC_TEXT_INTERVAL 1218 +#define F_INT8INC 1219 +#define F_INT8ABS 1230 +#define F_INT8LARGER 1236 +#define F_INT8SMALLER 1237 +#define F_TEXTICREGEXEQ 1238 +#define F_TEXTICREGEXNE 1239 +#define F_NAMEICREGEXEQ 1240 +#define F_NAMEICREGEXNE 1241 +#define F_BOOLIN 1242 +#define F_BOOLOUT 1243 +#define F_BYTEAIN 1244 +#define F_CHARIN 1245 +#define F_CHARLT 1246 +#define F_UNIQUE_KEY_RECHECK 1250 +#define F_INT4ABS 1251 +#define F_NAMEREGEXNE 1252 +#define F_INT2ABS 1253 +#define F_TEXTREGEXEQ 1254 +#define F_TEXTREGEXNE 1256 +#define F_TEXTLEN 1257 +#define F_TEXTCAT 1258 +#define F_PG_CHAR_TO_ENCODING 1264 +#define F_TIDNE 1265 +#define F_CIDR_IN 1267 +#define F_PARSE_IDENT 1268 +#define F_PG_COLUMN_SIZE 1269 +#define F_OVERLAPS_TIMETZ_TIMETZ_TIMETZ_TIMETZ 1271 +#define F_DATETIME_PL 1272 +#define F_DATE_PART_TEXT_TIMETZ 1273 +#define F_INT84PL 1274 +#define F_INT84MI 1275 +#define F_INT84MUL 1276 +#define F_INT84DIV 1277 +#define F_INT48PL 1278 +#define F_INT48MI 1279 +#define F_INT48MUL 1280 +#define F_INT48DIV 1281 +#define F_QUOTE_IDENT 1282 +#define F_QUOTE_LITERAL_TEXT 1283 +#define F_DATE_TRUNC_TEXT_TIMESTAMPTZ_TEXT 1284 +#define F_QUOTE_LITERAL_ANYELEMENT 1285 +#define F_ARRAY_FILL_ANYELEMENT__INT4__INT4 1286 +#define F_OID 1287 +#define F_INT8_OID 1288 +#define F_QUOTE_NULLABLE_TEXT 1289 +#define F_QUOTE_NULLABLE_ANYELEMENT 1290 +#define F_SUPPRESS_REDUNDANT_UPDATES_TRIGGER 1291 +#define F_TIDEQ 1292 +#define F_UNNEST_ANYMULTIRANGE 1293 +#define F_CURRTID2 1294 +#define F_JUSTIFY_DAYS 1295 +#define F_TIMEDATE_PL 1296 +#define F_DATETIMETZ_PL 1297 +#define F_TIMETZDATE_PL 1298 +#define F_NOW 1299 +#define F_POSITIONSEL 1300 +#define F_POSITIONJOINSEL 1301 +#define F_CONTSEL 1302 +#define F_CONTJOINSEL 1303 +#define F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ 1304 +#define F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_INTERVAL 1305 +#define F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL 1306 +#define F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ 1307 +#define F_OVERLAPS_TIME_TIME_TIME_TIME 1308 +#define F_OVERLAPS_TIME_INTERVAL_TIME_INTERVAL 1309 +#define F_OVERLAPS_TIME_TIME_TIME_INTERVAL 1310 +#define F_OVERLAPS_TIME_INTERVAL_TIME_TIME 1311 +#define F_TIMESTAMP_IN 1312 +#define F_TIMESTAMP_OUT 1313 +#define F_TIMESTAMPTZ_CMP 1314 +#define F_INTERVAL_CMP 1315 +#define F_TIME_TIMESTAMP 1316 +#define F_LENGTH_TEXT 1317 +#define F_LENGTH_BPCHAR 1318 +#define F_XIDEQINT4 1319 +#define F_INTERVAL_DIV 1326 +#define F_DLOG10 1339 +#define F_LOG_FLOAT8 1340 +#define F_LN_FLOAT8 1341 +#define F_ROUND_FLOAT8 1342 +#define F_TRUNC_FLOAT8 1343 +#define F_SQRT_FLOAT8 1344 +#define F_CBRT 1345 +#define F_POW_FLOAT8_FLOAT8 1346 +#define F_EXP_FLOAT8 1347 +#define F_OBJ_DESCRIPTION_OID 1348 +#define F_OIDVECTORTYPES 1349 +#define F_TIMETZ_IN 1350 +#define F_TIMETZ_OUT 1351 +#define F_TIMETZ_EQ 1352 +#define F_TIMETZ_NE 1353 +#define F_TIMETZ_LT 1354 +#define F_TIMETZ_LE 1355 +#define F_TIMETZ_GE 1356 +#define F_TIMETZ_GT 1357 +#define F_TIMETZ_CMP 1358 +#define F_TIMESTAMPTZ_DATE_TIMETZ 1359 +#define F_HOSTMASK 1362 +#define F_TEXTREGEXEQ_SUPPORT 1364 +#define F_MAKEACLITEM 1365 +#define F_CHARACTER_LENGTH_BPCHAR 1367 +#define F_POWER_FLOAT8_FLOAT8 1368 +#define F_CHARACTER_LENGTH_TEXT 1369 +#define F_INTERVAL_TIME 1370 +#define F_PG_LOCK_STATUS 1371 +#define F_CHAR_LENGTH_BPCHAR 1372 +#define F_ISFINITE_DATE 1373 +#define F_OCTET_LENGTH_TEXT 1374 +#define F_OCTET_LENGTH_BPCHAR 1375 +#define F_FACTORIAL 1376 +#define F_TIME_LARGER 1377 +#define F_TIME_SMALLER 1378 +#define F_TIMETZ_LARGER 1379 +#define F_TIMETZ_SMALLER 1380 +#define F_CHAR_LENGTH_TEXT 1381 +#define F_DATE_PART_TEXT_DATE 1384 +#define F_DATE_PART_TEXT_TIME 1385 +#define F_AGE_TIMESTAMPTZ 1386 +#define F_PG_GET_CONSTRAINTDEF_OID 1387 +#define F_TIMETZ_TIMESTAMPTZ 1388 +#define F_ISFINITE_TIMESTAMPTZ 1389 +#define F_ISFINITE_INTERVAL 1390 +#define F_PG_STAT_GET_BACKEND_START 1391 +#define F_PG_STAT_GET_BACKEND_CLIENT_ADDR 1392 +#define F_PG_STAT_GET_BACKEND_CLIENT_PORT 1393 +#define F_ABS_FLOAT4 1394 +#define F_ABS_FLOAT8 1395 +#define F_ABS_INT8 1396 +#define F_ABS_INT4 1397 +#define F_ABS_INT2 1398 +#define F_NAME_VARCHAR 1400 +#define F_VARCHAR_NAME 1401 +#define F_CURRENT_SCHEMA 1402 +#define F_CURRENT_SCHEMAS 1403 +#define F_OVERLAY_TEXT_TEXT_INT4_INT4 1404 +#define F_OVERLAY_TEXT_TEXT_INT4 1405 +#define F_ISVERTICAL_POINT_POINT 1406 +#define F_ISHORIZONTAL_POINT_POINT 1407 +#define F_ISPARALLEL_LSEG_LSEG 1408 +#define F_ISPERP_LSEG_LSEG 1409 +#define F_ISVERTICAL_LSEG 1410 +#define F_ISHORIZONTAL_LSEG 1411 +#define F_ISPARALLEL_LINE_LINE 1412 +#define F_ISPERP_LINE_LINE 1413 +#define F_ISVERTICAL_LINE 1414 +#define F_ISHORIZONTAL_LINE 1415 +#define F_POINT_CIRCLE 1416 +#define F_TIME_INTERVAL 1419 +#define F_BOX_POINT_POINT 1421 +#define F_BOX_ADD 1422 +#define F_BOX_SUB 1423 +#define F_BOX_MUL 1424 +#define F_BOX_DIV 1425 +#define F_PATH_CONTAIN_PT 1426 +#define F_CIDR_OUT 1427 +#define F_POLY_CONTAIN_PT 1428 +#define F_PT_CONTAINED_POLY 1429 +#define F_ISCLOSED 1430 +#define F_ISOPEN 1431 +#define F_PATH_NPOINTS 1432 +#define F_PCLOSE 1433 +#define F_POPEN 1434 +#define F_PATH_ADD 1435 +#define F_PATH_ADD_PT 1436 +#define F_PATH_SUB_PT 1437 +#define F_PATH_MUL_PT 1438 +#define F_PATH_DIV_PT 1439 +#define F_POINT_FLOAT8_FLOAT8 1440 +#define F_POINT_ADD 1441 +#define F_POINT_SUB 1442 +#define F_POINT_MUL 1443 +#define F_POINT_DIV 1444 +#define F_POLY_NPOINTS 1445 +#define F_BOX_POLYGON 1446 +#define F_PATH 1447 +#define F_POLYGON_BOX 1448 +#define F_POLYGON_PATH 1449 +#define F_CIRCLE_IN 1450 +#define F_CIRCLE_OUT 1451 +#define F_CIRCLE_SAME 1452 +#define F_CIRCLE_CONTAIN 1453 +#define F_CIRCLE_LEFT 1454 +#define F_CIRCLE_OVERLEFT 1455 +#define F_CIRCLE_OVERRIGHT 1456 +#define F_CIRCLE_RIGHT 1457 +#define F_CIRCLE_CONTAINED 1458 +#define F_CIRCLE_OVERLAP 1459 +#define F_CIRCLE_BELOW 1460 +#define F_CIRCLE_ABOVE 1461 +#define F_CIRCLE_EQ 1462 +#define F_CIRCLE_NE 1463 +#define F_CIRCLE_LT 1464 +#define F_CIRCLE_GT 1465 +#define F_CIRCLE_LE 1466 +#define F_CIRCLE_GE 1467 +#define F_AREA_CIRCLE 1468 +#define F_DIAMETER 1469 +#define F_RADIUS 1470 +#define F_CIRCLE_DISTANCE 1471 +#define F_CIRCLE_CENTER 1472 +#define F_CIRCLE_POINT_FLOAT8 1473 +#define F_CIRCLE_POLYGON 1474 +#define F_POLYGON_INT4_CIRCLE 1475 +#define F_DIST_PC 1476 +#define F_CIRCLE_CONTAIN_PT 1477 +#define F_PT_CONTAINED_CIRCLE 1478 +#define F_CIRCLE_BOX 1479 +#define F_BOX_CIRCLE 1480 +#define F_LOG10_NUMERIC 1481 +#define F_LSEG_NE 1482 +#define F_LSEG_LT 1483 +#define F_LSEG_LE 1484 +#define F_LSEG_GT 1485 +#define F_LSEG_GE 1486 +#define F_LSEG_LENGTH 1487 +#define F_CLOSE_LS 1488 +#define F_CLOSE_LSEG 1489 +#define F_LINE_IN 1490 +#define F_LINE_OUT 1491 +#define F_LINE_EQ 1492 +#define F_LINE 1493 +#define F_LINE_INTERPT 1494 +#define F_LINE_INTERSECT 1495 +#define F_LINE_PARALLEL 1496 +#define F_LINE_PERP 1497 +#define F_LINE_VERTICAL 1498 +#define F_LINE_HORIZONTAL 1499 +#define F_LENGTH_LSEG 1530 +#define F_LENGTH_PATH 1531 +#define F_POINT_LSEG 1532 +#define F_POINT_BOX 1534 +#define F_POINT_POLYGON 1540 +#define F_LSEG_BOX 1541 +#define F_CENTER_BOX 1542 +#define F_CENTER_CIRCLE 1543 +#define F_POLYGON_CIRCLE 1544 +#define F_NPOINTS_PATH 1545 +#define F_NPOINTS_POLYGON 1556 +#define F_BIT_IN 1564 +#define F_BIT_OUT 1565 +#define F_LIKE_TEXT_TEXT 1569 +#define F_NOTLIKE_TEXT_TEXT 1570 +#define F_LIKE_NAME_TEXT 1571 +#define F_NOTLIKE_NAME_TEXT 1572 +#define F_PG_GET_RULEDEF_OID 1573 +#define F_NEXTVAL 1574 +#define F_CURRVAL 1575 +#define F_SETVAL_REGCLASS_INT8 1576 +#define F_VARBIT_IN 1579 +#define F_VARBIT_OUT 1580 +#define F_BITEQ 1581 +#define F_BITNE 1582 +#define F_BITGE 1592 +#define F_BITGT 1593 +#define F_BITLE 1594 +#define F_BITLT 1595 +#define F_BITCMP 1596 +#define F_PG_ENCODING_TO_CHAR 1597 +#define F_RANDOM_ 1598 +#define F_SETSEED 1599 +#define F_ASIN 1600 +#define F_ACOS 1601 +#define F_ATAN 1602 +#define F_ATAN2 1603 +#define F_SIN 1604 +#define F_COS 1605 +#define F_TAN 1606 +#define F_COT 1607 +#define F_DEGREES 1608 +#define F_RADIANS 1609 +#define F_PI 1610 +#define F_INTERVAL_MUL 1618 +#define F_PG_TYPEOF 1619 +#define F_ASCII 1620 +#define F_CHR 1621 +#define F_REPEAT 1622 +#define F_SIMILAR_ESCAPE 1623 +#define F_MUL_D_INTERVAL 1624 +#define F_BPCHARLIKE 1631 +#define F_BPCHARNLIKE 1632 +#define F_TEXTICLIKE 1633 +#define F_TEXTICNLIKE 1634 +#define F_NAMEICLIKE 1635 +#define F_NAMEICNLIKE 1636 +#define F_LIKE_ESCAPE_TEXT_TEXT 1637 +#define F_OIDGT 1638 +#define F_OIDGE 1639 +#define F_PG_GET_VIEWDEF_TEXT 1640 +#define F_PG_GET_VIEWDEF_OID 1641 +#define F_PG_GET_USERBYID 1642 +#define F_PG_GET_INDEXDEF_OID 1643 +#define F_RI_FKEY_CHECK_INS 1644 +#define F_RI_FKEY_CHECK_UPD 1645 +#define F_RI_FKEY_CASCADE_DEL 1646 +#define F_RI_FKEY_CASCADE_UPD 1647 +#define F_RI_FKEY_RESTRICT_DEL 1648 +#define F_RI_FKEY_RESTRICT_UPD 1649 +#define F_RI_FKEY_SETNULL_DEL 1650 +#define F_RI_FKEY_SETNULL_UPD 1651 +#define F_RI_FKEY_SETDEFAULT_DEL 1652 +#define F_RI_FKEY_SETDEFAULT_UPD 1653 +#define F_RI_FKEY_NOACTION_DEL 1654 +#define F_RI_FKEY_NOACTION_UPD 1655 +#define F_BPCHARICREGEXEQ 1656 +#define F_BPCHARICREGEXNE 1657 +#define F_BPCHARREGEXEQ 1658 +#define F_BPCHARREGEXNE 1659 +#define F_BPCHARICLIKE 1660 +#define F_BPCHARICNLIKE 1661 +#define F_PG_GET_TRIGGERDEF_OID 1662 +#define F_PG_GET_SERIAL_SEQUENCE 1665 +#define F_VARBITEQ 1666 +#define F_VARBITNE 1667 +#define F_VARBITGE 1668 +#define F_VARBITGT 1669 +#define F_VARBITLE 1670 +#define F_VARBITLT 1671 +#define F_VARBITCMP 1672 +#define F_BITAND 1673 +#define F_BITOR 1674 +#define F_BITXOR 1675 +#define F_BITNOT 1676 +#define F_BITSHIFTLEFT 1677 +#define F_BITSHIFTRIGHT 1678 +#define F_BITCAT 1679 +#define F_SUBSTRING_BIT_INT4_INT4 1680 +#define F_LENGTH_BIT 1681 +#define F_OCTET_LENGTH_BIT 1682 +#define F_BIT_INT4_INT4 1683 +#define F_INT4_BIT 1684 +#define F_BIT_BIT_INT4_BOOL 1685 +#define F_PG_GET_KEYWORDS 1686 +#define F_VARBIT 1687 +#define F_TIME_HASH 1688 +#define F_ACLEXPLODE 1689 +#define F_TIME_MI_TIME 1690 +#define F_BOOLLE 1691 +#define F_BOOLGE 1692 +#define F_BTBOOLCMP 1693 +#define F_TIMETZ_HASH 1696 +#define F_INTERVAL_HASH 1697 +#define F_POSITION_BIT_BIT 1698 +#define F_SUBSTRING_BIT_INT4 1699 +#define F_NUMERIC_IN 1701 +#define F_NUMERIC_OUT 1702 +#define F_NUMERIC_NUMERIC_INT4 1703 +#define F_NUMERIC_ABS 1704 +#define F_ABS_NUMERIC 1705 +#define F_SIGN_NUMERIC 1706 +#define F_ROUND_NUMERIC_INT4 1707 +#define F_ROUND_NUMERIC 1708 +#define F_TRUNC_NUMERIC_INT4 1709 +#define F_TRUNC_NUMERIC 1710 +#define F_CEIL_NUMERIC 1711 +#define F_FLOOR_NUMERIC 1712 +#define F_LENGTH_BYTEA_NAME 1713 +#define F_CONVERT_FROM 1714 +#define F_CIDR 1715 +#define F_PG_GET_EXPR_PG_NODE_TREE_OID 1716 +#define F_CONVERT_TO 1717 +#define F_NUMERIC_EQ 1718 +#define F_NUMERIC_NE 1719 +#define F_NUMERIC_GT 1720 +#define F_NUMERIC_GE 1721 +#define F_NUMERIC_LT 1722 +#define F_NUMERIC_LE 1723 +#define F_NUMERIC_ADD 1724 +#define F_NUMERIC_SUB 1725 +#define F_NUMERIC_MUL 1726 +#define F_NUMERIC_DIV 1727 +#define F_MOD_NUMERIC_NUMERIC 1728 +#define F_NUMERIC_MOD 1729 +#define F_SQRT_NUMERIC 1730 +#define F_NUMERIC_SQRT 1731 +#define F_EXP_NUMERIC 1732 +#define F_NUMERIC_EXP 1733 +#define F_LN_NUMERIC 1734 +#define F_NUMERIC_LN 1735 +#define F_LOG_NUMERIC_NUMERIC 1736 +#define F_NUMERIC_LOG 1737 +#define F_POW_NUMERIC_NUMERIC 1738 +#define F_NUMERIC_POWER 1739 +#define F_NUMERIC_INT4 1740 +#define F_LOG_NUMERIC 1741 +#define F_NUMERIC_FLOAT4 1742 +#define F_NUMERIC_FLOAT8 1743 +#define F_INT4_NUMERIC 1744 +#define F_FLOAT4_NUMERIC 1745 +#define F_FLOAT8_NUMERIC 1746 +#define F_TIME_PL_INTERVAL 1747 +#define F_TIME_MI_INTERVAL 1748 +#define F_TIMETZ_PL_INTERVAL 1749 +#define F_TIMETZ_MI_INTERVAL 1750 +#define F_NUMERIC_INC 1764 +#define F_SETVAL_REGCLASS_INT8_BOOL 1765 +#define F_NUMERIC_SMALLER 1766 +#define F_NUMERIC_LARGER 1767 +#define F_TO_CHAR_INTERVAL_TEXT 1768 +#define F_NUMERIC_CMP 1769 +#define F_TO_CHAR_TIMESTAMPTZ_TEXT 1770 +#define F_NUMERIC_UMINUS 1771 +#define F_TO_CHAR_NUMERIC_TEXT 1772 +#define F_TO_CHAR_INT4_TEXT 1773 +#define F_TO_CHAR_INT8_TEXT 1774 +#define F_TO_CHAR_FLOAT4_TEXT 1775 +#define F_TO_CHAR_FLOAT8_TEXT 1776 +#define F_TO_NUMBER 1777 +#define F_TO_TIMESTAMP_TEXT_TEXT 1778 +#define F_INT8_NUMERIC 1779 +#define F_TO_DATE 1780 +#define F_NUMERIC_INT8 1781 +#define F_NUMERIC_INT2 1782 +#define F_INT2_NUMERIC 1783 +#define F_OIDIN 1798 +#define F_OIDOUT 1799 +#define F_BIT_LENGTH_BYTEA 1810 +#define F_BIT_LENGTH_TEXT 1811 +#define F_BIT_LENGTH_BIT 1812 +#define F_CONVERT 1813 +#define F_ICLIKESEL 1814 +#define F_ICNLIKESEL 1815 +#define F_ICLIKEJOINSEL 1816 +#define F_ICNLIKEJOINSEL 1817 +#define F_REGEXEQSEL 1818 +#define F_LIKESEL 1819 +#define F_ICREGEXEQSEL 1820 +#define F_REGEXNESEL 1821 +#define F_NLIKESEL 1822 +#define F_ICREGEXNESEL 1823 +#define F_REGEXEQJOINSEL 1824 +#define F_LIKEJOINSEL 1825 +#define F_ICREGEXEQJOINSEL 1826 +#define F_REGEXNEJOINSEL 1827 +#define F_NLIKEJOINSEL 1828 +#define F_ICREGEXNEJOINSEL 1829 +#define F_FLOAT8_AVG 1830 +#define F_FLOAT8_VAR_SAMP 1831 +#define F_FLOAT8_STDDEV_SAMP 1832 +#define F_NUMERIC_ACCUM 1833 +#define F_INT2_ACCUM 1834 +#define F_INT4_ACCUM 1835 +#define F_INT8_ACCUM 1836 +#define F_NUMERIC_AVG 1837 +#define F_NUMERIC_VAR_SAMP 1838 +#define F_NUMERIC_STDDEV_SAMP 1839 +#define F_INT2_SUM 1840 +#define F_INT4_SUM 1841 +#define F_INT8_SUM 1842 +#define F_INTERVAL_AVG_ACCUM 1843 +#define F_INTERVAL_AVG 1844 +#define F_TO_ASCII_TEXT 1845 +#define F_TO_ASCII_TEXT_INT4 1846 +#define F_TO_ASCII_TEXT_NAME 1847 +#define F_INTERVAL_PL_TIME 1848 +#define F_INT28EQ 1850 +#define F_INT28NE 1851 +#define F_INT28LT 1852 +#define F_INT28GT 1853 +#define F_INT28LE 1854 +#define F_INT28GE 1855 +#define F_INT82EQ 1856 +#define F_INT82NE 1857 +#define F_INT82LT 1858 +#define F_INT82GT 1859 +#define F_INT82LE 1860 +#define F_INT82GE 1861 +#define F_INT2AND 1892 +#define F_INT2OR 1893 +#define F_INT2XOR 1894 +#define F_INT2NOT 1895 +#define F_INT2SHL 1896 +#define F_INT2SHR 1897 +#define F_INT4AND 1898 +#define F_INT4OR 1899 +#define F_INT4XOR 1900 +#define F_INT4NOT 1901 +#define F_INT4SHL 1902 +#define F_INT4SHR 1903 +#define F_INT8AND 1904 +#define F_INT8OR 1905 +#define F_INT8XOR 1906 +#define F_INT8NOT 1907 +#define F_INT8SHL 1908 +#define F_INT8SHR 1909 +#define F_INT8UP 1910 +#define F_INT2UP 1911 +#define F_INT4UP 1912 +#define F_FLOAT4UP 1913 +#define F_FLOAT8UP 1914 +#define F_NUMERIC_UPLUS 1915 +#define F_HAS_TABLE_PRIVILEGE_NAME_TEXT_TEXT 1922 +#define F_HAS_TABLE_PRIVILEGE_NAME_OID_TEXT 1923 +#define F_HAS_TABLE_PRIVILEGE_OID_TEXT_TEXT 1924 +#define F_HAS_TABLE_PRIVILEGE_OID_OID_TEXT 1925 +#define F_HAS_TABLE_PRIVILEGE_TEXT_TEXT 1926 +#define F_HAS_TABLE_PRIVILEGE_OID_TEXT 1927 +#define F_PG_STAT_GET_NUMSCANS 1928 +#define F_PG_STAT_GET_TUPLES_RETURNED 1929 +#define F_PG_STAT_GET_TUPLES_FETCHED 1930 +#define F_PG_STAT_GET_TUPLES_INSERTED 1931 +#define F_PG_STAT_GET_TUPLES_UPDATED 1932 +#define F_PG_STAT_GET_TUPLES_DELETED 1933 +#define F_PG_STAT_GET_BLOCKS_FETCHED 1934 +#define F_PG_STAT_GET_BLOCKS_HIT 1935 +#define F_PG_STAT_GET_BACKEND_IDSET 1936 +#define F_PG_STAT_GET_BACKEND_PID 1937 +#define F_PG_STAT_GET_BACKEND_DBID 1938 +#define F_PG_STAT_GET_BACKEND_USERID 1939 +#define F_PG_STAT_GET_BACKEND_ACTIVITY 1940 +#define F_PG_STAT_GET_DB_NUMBACKENDS 1941 +#define F_PG_STAT_GET_DB_XACT_COMMIT 1942 +#define F_PG_STAT_GET_DB_XACT_ROLLBACK 1943 +#define F_PG_STAT_GET_DB_BLOCKS_FETCHED 1944 +#define F_PG_STAT_GET_DB_BLOCKS_HIT 1945 +#define F_ENCODE 1946 +#define F_DECODE 1947 +#define F_BYTEAEQ 1948 +#define F_BYTEALT 1949 +#define F_BYTEALE 1950 +#define F_BYTEAGT 1951 +#define F_BYTEAGE 1952 +#define F_BYTEANE 1953 +#define F_BYTEACMP 1954 +#define F_TIMESTAMP_TIMESTAMP_INT4 1961 +#define F_INT2_AVG_ACCUM 1962 +#define F_INT4_AVG_ACCUM 1963 +#define F_INT8_AVG 1964 +#define F_OIDLARGER 1965 +#define F_OIDSMALLER 1966 +#define F_TIMESTAMPTZ_TIMESTAMPTZ_INT4 1967 +#define F_TIME_TIME_INT4 1968 +#define F_TIMETZ_TIMETZ_INT4 1969 +#define F_PG_STAT_GET_TUPLES_HOT_UPDATED 1972 +#define F_DIV 1973 +#define F_NUMERIC_DIV_TRUNC 1980 +#define F_SIMILAR_TO_ESCAPE_TEXT_TEXT 1986 +#define F_SIMILAR_TO_ESCAPE_TEXT 1987 +#define F_SHOBJ_DESCRIPTION 1993 +#define F_TEXTANYCAT 2003 +#define F_ANYTEXTCAT 2004 +#define F_BYTEALIKE 2005 +#define F_BYTEANLIKE 2006 +#define F_LIKE_BYTEA_BYTEA 2007 +#define F_NOTLIKE_BYTEA_BYTEA 2008 +#define F_LIKE_ESCAPE_BYTEA_BYTEA 2009 +#define F_LENGTH_BYTEA 2010 +#define F_BYTEACAT 2011 +#define F_SUBSTRING_BYTEA_INT4_INT4 2012 +#define F_SUBSTRING_BYTEA_INT4 2013 +#define F_POSITION_BYTEA_BYTEA 2014 +#define F_BTRIM_BYTEA_BYTEA 2015 +#define F_TIME_TIMESTAMPTZ 2019 +#define F_DATE_TRUNC_TEXT_TIMESTAMP 2020 +#define F_DATE_PART_TEXT_TIMESTAMP 2021 +#define F_PG_STAT_GET_ACTIVITY 2022 +#define F_JSONB_PATH_QUERY_FIRST_TZ 2023 +#define F_TIMESTAMP_DATE 2024 +#define F_TIMESTAMP_DATE_TIME 2025 +#define F_PG_BACKEND_PID 2026 +#define F_TIMESTAMP_TIMESTAMPTZ 2027 +#define F_TIMESTAMPTZ_TIMESTAMP 2028 +#define F_DATE_TIMESTAMP 2029 +#define F_JSONB_PATH_MATCH_TZ 2030 +#define F_TIMESTAMP_MI 2031 +#define F_TIMESTAMP_PL_INTERVAL 2032 +#define F_TIMESTAMP_MI_INTERVAL 2033 +#define F_PG_CONF_LOAD_TIME 2034 +#define F_TIMESTAMP_SMALLER 2035 +#define F_TIMESTAMP_LARGER 2036 +#define F_TIMEZONE_TEXT_TIMETZ 2037 +#define F_TIMEZONE_INTERVAL_TIMETZ 2038 +#define F_TIMESTAMP_HASH 2039 +#define F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_TIMESTAMP 2041 +#define F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_INTERVAL 2042 +#define F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_INTERVAL 2043 +#define F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_TIMESTAMP 2044 +#define F_TIMESTAMP_CMP 2045 +#define F_TIME_TIMETZ 2046 +#define F_TIMETZ_TIME 2047 +#define F_ISFINITE_TIMESTAMP 2048 +#define F_TO_CHAR_TIMESTAMP_TEXT 2049 +#define F_MAX_ANYARRAY 2050 +#define F_MIN_ANYARRAY 2051 +#define F_TIMESTAMP_EQ 2052 +#define F_TIMESTAMP_NE 2053 +#define F_TIMESTAMP_LT 2054 +#define F_TIMESTAMP_LE 2055 +#define F_TIMESTAMP_GE 2056 +#define F_TIMESTAMP_GT 2057 +#define F_AGE_TIMESTAMP_TIMESTAMP 2058 +#define F_AGE_TIMESTAMP 2059 +#define F_TIMEZONE_TEXT_TIMESTAMP 2069 +#define F_TIMEZONE_INTERVAL_TIMESTAMP 2070 +#define F_DATE_PL_INTERVAL 2071 +#define F_DATE_MI_INTERVAL 2072 +#define F_SUBSTRING_TEXT_TEXT 2073 +#define F_SUBSTRING_TEXT_TEXT_TEXT 2074 +#define F_BIT_INT8_INT4 2075 +#define F_INT8_BIT 2076 +#define F_CURRENT_SETTING_TEXT 2077 +#define F_SET_CONFIG 2078 +#define F_PG_TABLE_IS_VISIBLE 2079 +#define F_PG_TYPE_IS_VISIBLE 2080 +#define F_PG_FUNCTION_IS_VISIBLE 2081 +#define F_PG_OPERATOR_IS_VISIBLE 2082 +#define F_PG_OPCLASS_IS_VISIBLE 2083 +#define F_PG_SHOW_ALL_SETTINGS 2084 +#define F_SUBSTR_BYTEA_INT4_INT4 2085 +#define F_SUBSTR_BYTEA_INT4 2086 +#define F_REPLACE 2087 +#define F_SPLIT_PART 2088 +#define F_TO_HEX_INT4 2089 +#define F_TO_HEX_INT8 2090 +#define F_ARRAY_LOWER 2091 +#define F_ARRAY_UPPER 2092 +#define F_PG_CONVERSION_IS_VISIBLE 2093 +#define F_PG_STAT_GET_BACKEND_ACTIVITY_START 2094 +#define F_PG_TERMINATE_BACKEND 2096 +#define F_PG_GET_FUNCTIONDEF 2098 +#define F_AVG_INT8 2100 +#define F_AVG_INT4 2101 +#define F_AVG_INT2 2102 +#define F_AVG_NUMERIC 2103 +#define F_AVG_FLOAT4 2104 +#define F_AVG_FLOAT8 2105 +#define F_AVG_INTERVAL 2106 +#define F_SUM_INT8 2107 +#define F_SUM_INT4 2108 +#define F_SUM_INT2 2109 +#define F_SUM_FLOAT4 2110 +#define F_SUM_FLOAT8 2111 +#define F_SUM_MONEY 2112 +#define F_SUM_INTERVAL 2113 +#define F_SUM_NUMERIC 2114 +#define F_MAX_INT8 2115 +#define F_MAX_INT4 2116 +#define F_MAX_INT2 2117 +#define F_MAX_OID 2118 +#define F_MAX_FLOAT4 2119 +#define F_MAX_FLOAT8 2120 +#define F_PG_COLUMN_COMPRESSION 2121 +#define F_MAX_DATE 2122 +#define F_MAX_TIME 2123 +#define F_MAX_TIMETZ 2124 +#define F_MAX_MONEY 2125 +#define F_MAX_TIMESTAMP 2126 +#define F_MAX_TIMESTAMPTZ 2127 +#define F_MAX_INTERVAL 2128 +#define F_MAX_TEXT 2129 +#define F_MAX_NUMERIC 2130 +#define F_MIN_INT8 2131 +#define F_MIN_INT4 2132 +#define F_MIN_INT2 2133 +#define F_MIN_OID 2134 +#define F_MIN_FLOAT4 2135 +#define F_MIN_FLOAT8 2136 +#define F_PG_STAT_FORCE_NEXT_FLUSH 2137 +#define F_MIN_DATE 2138 +#define F_MIN_TIME 2139 +#define F_MIN_TIMETZ 2140 +#define F_MIN_MONEY 2141 +#define F_MIN_TIMESTAMP 2142 +#define F_MIN_TIMESTAMPTZ 2143 +#define F_MIN_INTERVAL 2144 +#define F_MIN_TEXT 2145 +#define F_MIN_NUMERIC 2146 +#define F_COUNT_ANY 2147 +#define F_VARIANCE_INT8 2148 +#define F_VARIANCE_INT4 2149 +#define F_VARIANCE_INT2 2150 +#define F_VARIANCE_FLOAT4 2151 +#define F_VARIANCE_FLOAT8 2152 +#define F_VARIANCE_NUMERIC 2153 +#define F_STDDEV_INT8 2154 +#define F_STDDEV_INT4 2155 +#define F_STDDEV_INT2 2156 +#define F_STDDEV_FLOAT4 2157 +#define F_STDDEV_FLOAT8 2158 +#define F_STDDEV_NUMERIC 2159 +#define F_TEXT_PATTERN_LT 2160 +#define F_TEXT_PATTERN_LE 2161 +#define F_PG_GET_FUNCTION_ARGUMENTS 2162 +#define F_TEXT_PATTERN_GE 2163 +#define F_TEXT_PATTERN_GT 2164 +#define F_PG_GET_FUNCTION_RESULT 2165 +#define F_BTTEXT_PATTERN_CMP 2166 +#define F_CEILING_NUMERIC 2167 +#define F_PG_DATABASE_SIZE_NAME 2168 +#define F_POWER_NUMERIC_NUMERIC 2169 +#define F_WIDTH_BUCKET_NUMERIC_NUMERIC_NUMERIC_INT4 2170 +#define F_PG_CANCEL_BACKEND 2171 +#define F_PG_BACKUP_START 2172 +#define F_BPCHAR_PATTERN_LT 2174 +#define F_BPCHAR_PATTERN_LE 2175 +#define F_ARRAY_LENGTH 2176 +#define F_BPCHAR_PATTERN_GE 2177 +#define F_BPCHAR_PATTERN_GT 2178 +#define F_GIST_POINT_CONSISTENT 2179 +#define F_BTBPCHAR_PATTERN_CMP 2180 +#define F_HAS_SEQUENCE_PRIVILEGE_NAME_TEXT_TEXT 2181 +#define F_HAS_SEQUENCE_PRIVILEGE_NAME_OID_TEXT 2182 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_TEXT_TEXT 2183 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_OID_TEXT 2184 +#define F_HAS_SEQUENCE_PRIVILEGE_TEXT_TEXT 2185 +#define F_HAS_SEQUENCE_PRIVILEGE_OID_TEXT 2186 +#define F_BTINT48CMP 2188 +#define F_BTINT84CMP 2189 +#define F_BTINT24CMP 2190 +#define F_BTINT42CMP 2191 +#define F_BTINT28CMP 2192 +#define F_BTINT82CMP 2193 +#define F_BTFLOAT48CMP 2194 +#define F_BTFLOAT84CMP 2195 +#define F_INET_CLIENT_ADDR 2196 +#define F_INET_CLIENT_PORT 2197 +#define F_INET_SERVER_ADDR 2198 +#define F_INET_SERVER_PORT 2199 +#define F_REGPROCEDUREIN 2212 +#define F_REGPROCEDUREOUT 2213 +#define F_REGOPERIN 2214 +#define F_REGOPEROUT 2215 +#define F_REGOPERATORIN 2216 +#define F_REGOPERATOROUT 2217 +#define F_REGCLASSIN 2218 +#define F_REGCLASSOUT 2219 +#define F_REGTYPEIN 2220 +#define F_REGTYPEOUT 2221 +#define F_PG_STAT_CLEAR_SNAPSHOT 2230 +#define F_PG_GET_FUNCTION_IDENTITY_ARGUMENTS 2232 +#define F_HASHTID 2233 +#define F_HASHTIDEXTENDED 2234 +#define F_BIT_AND_INT2 2236 +#define F_BIT_OR_INT2 2237 +#define F_BIT_AND_INT4 2238 +#define F_BIT_OR_INT4 2239 +#define F_BIT_AND_INT8 2240 +#define F_BIT_OR_INT8 2241 +#define F_BIT_AND_BIT 2242 +#define F_BIT_OR_BIT 2243 +#define F_MAX_BPCHAR 2244 +#define F_MIN_BPCHAR 2245 +#define F_FMGR_INTERNAL_VALIDATOR 2246 +#define F_FMGR_C_VALIDATOR 2247 +#define F_FMGR_SQL_VALIDATOR 2248 +#define F_HAS_DATABASE_PRIVILEGE_NAME_TEXT_TEXT 2250 +#define F_HAS_DATABASE_PRIVILEGE_NAME_OID_TEXT 2251 +#define F_HAS_DATABASE_PRIVILEGE_OID_TEXT_TEXT 2252 +#define F_HAS_DATABASE_PRIVILEGE_OID_OID_TEXT 2253 +#define F_HAS_DATABASE_PRIVILEGE_TEXT_TEXT 2254 +#define F_HAS_DATABASE_PRIVILEGE_OID_TEXT 2255 +#define F_HAS_FUNCTION_PRIVILEGE_NAME_TEXT_TEXT 2256 +#define F_HAS_FUNCTION_PRIVILEGE_NAME_OID_TEXT 2257 +#define F_HAS_FUNCTION_PRIVILEGE_OID_TEXT_TEXT 2258 +#define F_HAS_FUNCTION_PRIVILEGE_OID_OID_TEXT 2259 +#define F_HAS_FUNCTION_PRIVILEGE_TEXT_TEXT 2260 +#define F_HAS_FUNCTION_PRIVILEGE_OID_TEXT 2261 +#define F_HAS_LANGUAGE_PRIVILEGE_NAME_TEXT_TEXT 2262 +#define F_HAS_LANGUAGE_PRIVILEGE_NAME_OID_TEXT 2263 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_TEXT_TEXT 2264 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_OID_TEXT 2265 +#define F_HAS_LANGUAGE_PRIVILEGE_TEXT_TEXT 2266 +#define F_HAS_LANGUAGE_PRIVILEGE_OID_TEXT 2267 +#define F_HAS_SCHEMA_PRIVILEGE_NAME_TEXT_TEXT 2268 +#define F_HAS_SCHEMA_PRIVILEGE_NAME_OID_TEXT 2269 +#define F_HAS_SCHEMA_PRIVILEGE_OID_TEXT_TEXT 2270 +#define F_HAS_SCHEMA_PRIVILEGE_OID_OID_TEXT 2271 +#define F_HAS_SCHEMA_PRIVILEGE_TEXT_TEXT 2272 +#define F_HAS_SCHEMA_PRIVILEGE_OID_TEXT 2273 +#define F_PG_STAT_RESET 2274 +#define F_PG_GET_BACKEND_MEMORY_CONTEXTS 2282 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT 2284 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_TEXT 2285 +#define F_PG_TOTAL_RELATION_SIZE 2286 +#define F_PG_SIZE_PRETTY_INT8 2288 +#define F_PG_OPTIONS_TO_TABLE 2289 +#define F_RECORD_IN 2290 +#define F_RECORD_OUT 2291 +#define F_CSTRING_IN 2292 +#define F_CSTRING_OUT 2293 +#define F_ANY_IN 2294 +#define F_ANY_OUT 2295 +#define F_ANYARRAY_IN 2296 +#define F_ANYARRAY_OUT 2297 +#define F_VOID_IN 2298 +#define F_VOID_OUT 2299 +#define F_TRIGGER_IN 2300 +#define F_TRIGGER_OUT 2301 +#define F_LANGUAGE_HANDLER_IN 2302 +#define F_LANGUAGE_HANDLER_OUT 2303 +#define F_INTERNAL_IN 2304 +#define F_INTERNAL_OUT 2305 +#define F_PG_STAT_GET_SLRU 2306 +#define F_PG_STAT_RESET_SLRU 2307 +#define F_CEIL_FLOAT8 2308 +#define F_FLOOR_FLOAT8 2309 +#define F_SIGN_FLOAT8 2310 +#define F_MD5_TEXT 2311 +#define F_ANYELEMENT_IN 2312 +#define F_ANYELEMENT_OUT 2313 +#define F_POSTGRESQL_FDW_VALIDATOR 2316 +#define F_PG_ENCODING_MAX_LENGTH 2319 +#define F_CEILING_FLOAT8 2320 +#define F_MD5_BYTEA 2321 +#define F_PG_TABLESPACE_SIZE_OID 2322 +#define F_PG_TABLESPACE_SIZE_NAME 2323 +#define F_PG_DATABASE_SIZE_OID 2324 +#define F_PG_RELATION_SIZE_REGCLASS 2325 +#define F_UNNEST_ANYARRAY 2331 +#define F_PG_RELATION_SIZE_REGCLASS_TEXT 2332 +#define F_ARRAY_AGG_TRANSFN 2333 +#define F_ARRAY_AGG_FINALFN 2334 +#define F_ARRAY_AGG_ANYNONARRAY 2335 +#define F_DATE_LT_TIMESTAMP 2338 +#define F_DATE_LE_TIMESTAMP 2339 +#define F_DATE_EQ_TIMESTAMP 2340 +#define F_DATE_GT_TIMESTAMP 2341 +#define F_DATE_GE_TIMESTAMP 2342 +#define F_DATE_NE_TIMESTAMP 2343 +#define F_DATE_CMP_TIMESTAMP 2344 +#define F_DATE_LT_TIMESTAMPTZ 2351 +#define F_DATE_LE_TIMESTAMPTZ 2352 +#define F_DATE_EQ_TIMESTAMPTZ 2353 +#define F_DATE_GT_TIMESTAMPTZ 2354 +#define F_DATE_GE_TIMESTAMPTZ 2355 +#define F_DATE_NE_TIMESTAMPTZ 2356 +#define F_DATE_CMP_TIMESTAMPTZ 2357 +#define F_TIMESTAMP_LT_DATE 2364 +#define F_TIMESTAMP_LE_DATE 2365 +#define F_TIMESTAMP_EQ_DATE 2366 +#define F_TIMESTAMP_GT_DATE 2367 +#define F_TIMESTAMP_GE_DATE 2368 +#define F_TIMESTAMP_NE_DATE 2369 +#define F_TIMESTAMP_CMP_DATE 2370 +#define F_TIMESTAMPTZ_LT_DATE 2377 +#define F_TIMESTAMPTZ_LE_DATE 2378 +#define F_TIMESTAMPTZ_EQ_DATE 2379 +#define F_TIMESTAMPTZ_GT_DATE 2380 +#define F_TIMESTAMPTZ_GE_DATE 2381 +#define F_TIMESTAMPTZ_NE_DATE 2382 +#define F_TIMESTAMPTZ_CMP_DATE 2383 +#define F_HAS_TABLESPACE_PRIVILEGE_NAME_TEXT_TEXT 2390 +#define F_HAS_TABLESPACE_PRIVILEGE_NAME_OID_TEXT 2391 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_TEXT_TEXT 2392 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_OID_TEXT 2393 +#define F_HAS_TABLESPACE_PRIVILEGE_TEXT_TEXT 2394 +#define F_HAS_TABLESPACE_PRIVILEGE_OID_TEXT 2395 +#define F_SHELL_IN 2398 +#define F_SHELL_OUT 2399 +#define F_ARRAY_RECV 2400 +#define F_ARRAY_SEND 2401 +#define F_RECORD_RECV 2402 +#define F_RECORD_SEND 2403 +#define F_INT2RECV 2404 +#define F_INT2SEND 2405 +#define F_INT4RECV 2406 +#define F_INT4SEND 2407 +#define F_INT8RECV 2408 +#define F_INT8SEND 2409 +#define F_INT2VECTORRECV 2410 +#define F_INT2VECTORSEND 2411 +#define F_BYTEARECV 2412 +#define F_BYTEASEND 2413 +#define F_TEXTRECV 2414 +#define F_TEXTSEND 2415 +#define F_UNKNOWNRECV 2416 +#define F_UNKNOWNSEND 2417 +#define F_OIDRECV 2418 +#define F_OIDSEND 2419 +#define F_OIDVECTORRECV 2420 +#define F_OIDVECTORSEND 2421 +#define F_NAMERECV 2422 +#define F_NAMESEND 2423 +#define F_FLOAT4RECV 2424 +#define F_FLOAT4SEND 2425 +#define F_FLOAT8RECV 2426 +#define F_FLOAT8SEND 2427 +#define F_POINT_RECV 2428 +#define F_POINT_SEND 2429 +#define F_BPCHARRECV 2430 +#define F_BPCHARSEND 2431 +#define F_VARCHARRECV 2432 +#define F_VARCHARSEND 2433 +#define F_CHARRECV 2434 +#define F_CHARSEND 2435 +#define F_BOOLRECV 2436 +#define F_BOOLSEND 2437 +#define F_TIDRECV 2438 +#define F_TIDSEND 2439 +#define F_XIDRECV 2440 +#define F_XIDSEND 2441 +#define F_CIDRECV 2442 +#define F_CIDSEND 2443 +#define F_REGPROCRECV 2444 +#define F_REGPROCSEND 2445 +#define F_REGPROCEDURERECV 2446 +#define F_REGPROCEDURESEND 2447 +#define F_REGOPERRECV 2448 +#define F_REGOPERSEND 2449 +#define F_REGOPERATORRECV 2450 +#define F_REGOPERATORSEND 2451 +#define F_REGCLASSRECV 2452 +#define F_REGCLASSSEND 2453 +#define F_REGTYPERECV 2454 +#define F_REGTYPESEND 2455 +#define F_BIT_RECV 2456 +#define F_BIT_SEND 2457 +#define F_VARBIT_RECV 2458 +#define F_VARBIT_SEND 2459 +#define F_NUMERIC_RECV 2460 +#define F_NUMERIC_SEND 2461 +#define F_SINH 2462 +#define F_COSH 2463 +#define F_TANH 2464 +#define F_ASINH 2465 +#define F_ACOSH 2466 +#define F_ATANH 2467 +#define F_DATE_RECV 2468 +#define F_DATE_SEND 2469 +#define F_TIME_RECV 2470 +#define F_TIME_SEND 2471 +#define F_TIMETZ_RECV 2472 +#define F_TIMETZ_SEND 2473 +#define F_TIMESTAMP_RECV 2474 +#define F_TIMESTAMP_SEND 2475 +#define F_TIMESTAMPTZ_RECV 2476 +#define F_TIMESTAMPTZ_SEND 2477 +#define F_INTERVAL_RECV 2478 +#define F_INTERVAL_SEND 2479 +#define F_LSEG_RECV 2480 +#define F_LSEG_SEND 2481 +#define F_PATH_RECV 2482 +#define F_PATH_SEND 2483 +#define F_BOX_RECV 2484 +#define F_BOX_SEND 2485 +#define F_POLY_RECV 2486 +#define F_POLY_SEND 2487 +#define F_LINE_RECV 2488 +#define F_LINE_SEND 2489 +#define F_CIRCLE_RECV 2490 +#define F_CIRCLE_SEND 2491 +#define F_CASH_RECV 2492 +#define F_CASH_SEND 2493 +#define F_MACADDR_RECV 2494 +#define F_MACADDR_SEND 2495 +#define F_INET_RECV 2496 +#define F_INET_SEND 2497 +#define F_CIDR_RECV 2498 +#define F_CIDR_SEND 2499 +#define F_CSTRING_RECV 2500 +#define F_CSTRING_SEND 2501 +#define F_ANYARRAY_RECV 2502 +#define F_ANYARRAY_SEND 2503 +#define F_PG_GET_RULEDEF_OID_BOOL 2504 +#define F_PG_GET_VIEWDEF_TEXT_BOOL 2505 +#define F_PG_GET_VIEWDEF_OID_BOOL 2506 +#define F_PG_GET_INDEXDEF_OID_INT4_BOOL 2507 +#define F_PG_GET_CONSTRAINTDEF_OID_BOOL 2508 +#define F_PG_GET_EXPR_PG_NODE_TREE_OID_BOOL 2509 +#define F_PG_PREPARED_STATEMENT 2510 +#define F_PG_CURSOR 2511 +#define F_FLOAT8_VAR_POP 2512 +#define F_FLOAT8_STDDEV_POP 2513 +#define F_NUMERIC_VAR_POP 2514 +#define F_BOOLAND_STATEFUNC 2515 +#define F_BOOLOR_STATEFUNC 2516 +#define F_BOOL_AND 2517 +#define F_BOOL_OR 2518 +#define F_EVERY 2519 +#define F_TIMESTAMP_LT_TIMESTAMPTZ 2520 +#define F_TIMESTAMP_LE_TIMESTAMPTZ 2521 +#define F_TIMESTAMP_EQ_TIMESTAMPTZ 2522 +#define F_TIMESTAMP_GT_TIMESTAMPTZ 2523 +#define F_TIMESTAMP_GE_TIMESTAMPTZ 2524 +#define F_TIMESTAMP_NE_TIMESTAMPTZ 2525 +#define F_TIMESTAMP_CMP_TIMESTAMPTZ 2526 +#define F_TIMESTAMPTZ_LT_TIMESTAMP 2527 +#define F_TIMESTAMPTZ_LE_TIMESTAMP 2528 +#define F_TIMESTAMPTZ_EQ_TIMESTAMP 2529 +#define F_TIMESTAMPTZ_GT_TIMESTAMP 2530 +#define F_TIMESTAMPTZ_GE_TIMESTAMP 2531 +#define F_TIMESTAMPTZ_NE_TIMESTAMP 2532 +#define F_TIMESTAMPTZ_CMP_TIMESTAMP 2533 +#define F_INTERVAL_PL_DATE 2546 +#define F_INTERVAL_PL_TIMETZ 2547 +#define F_INTERVAL_PL_TIMESTAMP 2548 +#define F_INTERVAL_PL_TIMESTAMPTZ 2549 +#define F_INTEGER_PL_DATE 2550 +#define F_PG_TABLESPACE_DATABASES 2556 +#define F_BOOL_INT4 2557 +#define F_INT4_BOOL 2558 +#define F_LASTVAL 2559 +#define F_PG_POSTMASTER_START_TIME 2560 +#define F_PG_BLOCKING_PIDS 2561 +#define F_BOX_BELOW 2562 +#define F_BOX_OVERBELOW 2563 +#define F_BOX_OVERABOVE 2564 +#define F_BOX_ABOVE 2565 +#define F_POLY_BELOW 2566 +#define F_POLY_OVERBELOW 2567 +#define F_POLY_OVERABOVE 2568 +#define F_POLY_ABOVE 2569 +#define F_GIST_BOX_CONSISTENT 2578 +#define F_FLOAT8_JSONB 2580 +#define F_GIST_BOX_PENALTY 2581 +#define F_GIST_BOX_PICKSPLIT 2582 +#define F_GIST_BOX_UNION 2583 +#define F_GIST_BOX_SAME 2584 +#define F_GIST_POLY_CONSISTENT 2585 +#define F_GIST_POLY_COMPRESS 2586 +#define F_CIRCLE_OVERBELOW 2587 +#define F_CIRCLE_OVERABOVE 2588 +#define F_GIST_CIRCLE_CONSISTENT 2591 +#define F_GIST_CIRCLE_COMPRESS 2592 +#define F_NUMERIC_STDDEV_POP 2596 +#define F_DOMAIN_IN 2597 +#define F_DOMAIN_RECV 2598 +#define F_PG_TIMEZONE_ABBREVS 2599 +#define F_XMLEXISTS 2614 +#define F_PG_RELOAD_CONF 2621 +#define F_PG_ROTATE_LOGFILE 2622 +#define F_PG_STAT_FILE_TEXT 2623 +#define F_PG_READ_FILE_TEXT_INT8_INT8 2624 +#define F_PG_LS_DIR_TEXT 2625 +#define F_PG_SLEEP 2626 +#define F_INETNOT 2627 +#define F_INETAND 2628 +#define F_INETOR 2629 +#define F_INETPL 2630 +#define F_INT8PL_INET 2631 +#define F_INETMI_INT8 2632 +#define F_INETMI 2633 +#define F_VAR_SAMP_INT8 2641 +#define F_VAR_SAMP_INT4 2642 +#define F_VAR_SAMP_INT2 2643 +#define F_VAR_SAMP_FLOAT4 2644 +#define F_VAR_SAMP_FLOAT8 2645 +#define F_VAR_SAMP_NUMERIC 2646 +#define F_TRANSACTION_TIMESTAMP 2647 +#define F_STATEMENT_TIMESTAMP 2648 +#define F_CLOCK_TIMESTAMP 2649 +#define F_GIN_CMP_PREFIX 2700 +#define F_PG_HAS_ROLE_NAME_NAME_TEXT 2705 +#define F_PG_HAS_ROLE_NAME_OID_TEXT 2706 +#define F_PG_HAS_ROLE_OID_NAME_TEXT 2707 +#define F_PG_HAS_ROLE_OID_OID_TEXT 2708 +#define F_PG_HAS_ROLE_NAME_TEXT 2709 +#define F_PG_HAS_ROLE_OID_TEXT 2710 +#define F_JUSTIFY_INTERVAL 2711 +#define F_STDDEV_SAMP_INT8 2712 +#define F_STDDEV_SAMP_INT4 2713 +#define F_STDDEV_SAMP_INT2 2714 +#define F_STDDEV_SAMP_FLOAT4 2715 +#define F_STDDEV_SAMP_FLOAT8 2716 +#define F_STDDEV_SAMP_NUMERIC 2717 +#define F_VAR_POP_INT8 2718 +#define F_VAR_POP_INT4 2719 +#define F_VAR_POP_INT2 2720 +#define F_VAR_POP_FLOAT4 2721 +#define F_VAR_POP_FLOAT8 2722 +#define F_VAR_POP_NUMERIC 2723 +#define F_STDDEV_POP_INT8 2724 +#define F_STDDEV_POP_INT4 2725 +#define F_STDDEV_POP_INT2 2726 +#define F_STDDEV_POP_FLOAT4 2727 +#define F_STDDEV_POP_FLOAT8 2728 +#define F_STDDEV_POP_NUMERIC 2729 +#define F_PG_GET_TRIGGERDEF_OID_BOOL 2730 +#define F_ASIND 2731 +#define F_ACOSD 2732 +#define F_ATAND 2733 +#define F_ATAN2D 2734 +#define F_SIND 2735 +#define F_COSD 2736 +#define F_TAND 2737 +#define F_COTD 2738 +#define F_PG_BACKUP_STOP 2739 +#define F_NUMERIC_AVG_SERIALIZE 2740 +#define F_NUMERIC_AVG_DESERIALIZE 2741 +#define F_GINARRAYEXTRACT_ANYARRAY_INTERNAL_INTERNAL 2743 +#define F_GINARRAYCONSISTENT 2744 +#define F_INT8_AVG_ACCUM 2746 +#define F_ARRAYOVERLAP 2747 +#define F_ARRAYCONTAINS 2748 +#define F_ARRAYCONTAINED 2749 +#define F_PG_STAT_GET_DB_TUPLES_RETURNED 2758 +#define F_PG_STAT_GET_DB_TUPLES_FETCHED 2759 +#define F_PG_STAT_GET_DB_TUPLES_INSERTED 2760 +#define F_PG_STAT_GET_DB_TUPLES_UPDATED 2761 +#define F_PG_STAT_GET_DB_TUPLES_DELETED 2762 +#define F_REGEXP_MATCHES_TEXT_TEXT 2763 +#define F_REGEXP_MATCHES_TEXT_TEXT_TEXT 2764 +#define F_REGEXP_SPLIT_TO_TABLE_TEXT_TEXT 2765 +#define F_REGEXP_SPLIT_TO_TABLE_TEXT_TEXT_TEXT 2766 +#define F_REGEXP_SPLIT_TO_ARRAY_TEXT_TEXT 2767 +#define F_REGEXP_SPLIT_TO_ARRAY_TEXT_TEXT_TEXT 2768 +#define F_PG_STAT_GET_CHECKPOINTER_NUM_TIMED 2769 +#define F_PG_STAT_GET_CHECKPOINTER_NUM_REQUESTED 2770 +#define F_PG_STAT_GET_CHECKPOINTER_BUFFERS_WRITTEN 2771 +#define F_PG_STAT_GET_BGWRITER_BUF_WRITTEN_CLEAN 2772 +#define F_PG_STAT_GET_BGWRITER_MAXWRITTEN_CLEAN 2773 +#define F_GINQUERYARRAYEXTRACT 2774 +#define F_ANYNONARRAY_IN 2777 +#define F_ANYNONARRAY_OUT 2778 +#define F_PG_STAT_GET_LAST_VACUUM_TIME 2781 +#define F_PG_STAT_GET_LAST_AUTOVACUUM_TIME 2782 +#define F_PG_STAT_GET_LAST_ANALYZE_TIME 2783 +#define F_PG_STAT_GET_LAST_AUTOANALYZE_TIME 2784 +#define F_INT8_AVG_COMBINE 2785 +#define F_INT8_AVG_SERIALIZE 2786 +#define F_INT8_AVG_DESERIALIZE 2787 +#define F_PG_STAT_GET_BACKEND_WAIT_EVENT_TYPE 2788 +#define F_TIDGT 2790 +#define F_TIDLT 2791 +#define F_TIDGE 2792 +#define F_TIDLE 2793 +#define F_BTTIDCMP 2794 +#define F_TIDLARGER 2795 +#define F_TIDSMALLER 2796 +#define F_MAX_TID 2797 +#define F_MIN_TID 2798 +#define F_COUNT_ 2803 +#define F_INT8INC_ANY 2804 +#define F_INT8INC_FLOAT8_FLOAT8 2805 +#define F_FLOAT8_REGR_ACCUM 2806 +#define F_FLOAT8_REGR_SXX 2807 +#define F_FLOAT8_REGR_SYY 2808 +#define F_FLOAT8_REGR_SXY 2809 +#define F_FLOAT8_REGR_AVGX 2810 +#define F_FLOAT8_REGR_AVGY 2811 +#define F_FLOAT8_REGR_R2 2812 +#define F_FLOAT8_REGR_SLOPE 2813 +#define F_FLOAT8_REGR_INTERCEPT 2814 +#define F_FLOAT8_COVAR_POP 2815 +#define F_FLOAT8_COVAR_SAMP 2816 +#define F_FLOAT8_CORR 2817 +#define F_REGR_COUNT 2818 +#define F_REGR_SXX 2819 +#define F_REGR_SYY 2820 +#define F_REGR_SXY 2821 +#define F_REGR_AVGX 2822 +#define F_REGR_AVGY 2823 +#define F_REGR_R2 2824 +#define F_REGR_SLOPE 2825 +#define F_REGR_INTERCEPT 2826 +#define F_COVAR_POP 2827 +#define F_COVAR_SAMP 2828 +#define F_CORR 2829 +#define F_PG_STAT_GET_DB_BLK_READ_TIME 2844 +#define F_PG_STAT_GET_DB_BLK_WRITE_TIME 2845 +#define F_PG_SWITCH_WAL 2848 +#define F_PG_CURRENT_WAL_LSN 2849 +#define F_PG_WALFILE_NAME_OFFSET 2850 +#define F_PG_WALFILE_NAME 2851 +#define F_PG_CURRENT_WAL_INSERT_LSN 2852 +#define F_PG_STAT_GET_BACKEND_WAIT_EVENT 2853 +#define F_PG_MY_TEMP_SCHEMA 2854 +#define F_PG_IS_OTHER_TEMP_SCHEMA 2855 +#define F_PG_TIMEZONE_NAMES 2856 +#define F_PG_STAT_GET_BACKEND_XACT_START 2857 +#define F_NUMERIC_AVG_ACCUM 2858 +#define F_PG_STAT_GET_BUF_ALLOC 2859 +#define F_PG_STAT_GET_LIVE_TUPLES 2878 +#define F_PG_STAT_GET_DEAD_TUPLES 2879 +#define F_PG_ADVISORY_LOCK_INT8 2880 +#define F_PG_ADVISORY_LOCK_SHARED_INT8 2881 +#define F_PG_TRY_ADVISORY_LOCK_INT8 2882 +#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT8 2883 +#define F_PG_ADVISORY_UNLOCK_INT8 2884 +#define F_PG_ADVISORY_UNLOCK_SHARED_INT8 2885 +#define F_PG_ADVISORY_LOCK_INT4_INT4 2886 +#define F_PG_ADVISORY_LOCK_SHARED_INT4_INT4 2887 +#define F_PG_TRY_ADVISORY_LOCK_INT4_INT4 2888 +#define F_PG_TRY_ADVISORY_LOCK_SHARED_INT4_INT4 2889 +#define F_PG_ADVISORY_UNLOCK_INT4_INT4 2890 +#define F_PG_ADVISORY_UNLOCK_SHARED_INT4_INT4 2891 +#define F_PG_ADVISORY_UNLOCK_ALL 2892 +#define F_XML_IN 2893 +#define F_XML_OUT 2894 +#define F_XMLCOMMENT 2895 +#define F_XML 2896 +#define F_XMLVALIDATE 2897 +#define F_XML_RECV 2898 +#define F_XML_SEND 2899 +#define F_XMLCONCAT2 2900 +#define F_XMLAGG 2901 +#define F_VARBITTYPMODIN 2902 +#define F_INTERVALTYPMODIN 2903 +#define F_INTERVALTYPMODOUT 2904 +#define F_TIMESTAMPTYPMODIN 2905 +#define F_TIMESTAMPTYPMODOUT 2906 +#define F_TIMESTAMPTZTYPMODIN 2907 +#define F_TIMESTAMPTZTYPMODOUT 2908 +#define F_TIMETYPMODIN 2909 +#define F_TIMETYPMODOUT 2910 +#define F_TIMETZTYPMODIN 2911 +#define F_TIMETZTYPMODOUT 2912 +#define F_BPCHARTYPMODIN 2913 +#define F_BPCHARTYPMODOUT 2914 +#define F_VARCHARTYPMODIN 2915 +#define F_VARCHARTYPMODOUT 2916 +#define F_NUMERICTYPMODIN 2917 +#define F_NUMERICTYPMODOUT 2918 +#define F_BITTYPMODIN 2919 +#define F_BITTYPMODOUT 2920 +#define F_VARBITTYPMODOUT 2921 +#define F_TEXT_XML 2922 +#define F_TABLE_TO_XML 2923 +#define F_QUERY_TO_XML 2924 +#define F_CURSOR_TO_XML 2925 +#define F_TABLE_TO_XMLSCHEMA 2926 +#define F_QUERY_TO_XMLSCHEMA 2927 +#define F_CURSOR_TO_XMLSCHEMA 2928 +#define F_TABLE_TO_XML_AND_XMLSCHEMA 2929 +#define F_QUERY_TO_XML_AND_XMLSCHEMA 2930 +#define F_XPATH_TEXT_XML__TEXT 2931 +#define F_XPATH_TEXT_XML 2932 +#define F_SCHEMA_TO_XML 2933 +#define F_SCHEMA_TO_XMLSCHEMA 2934 +#define F_SCHEMA_TO_XML_AND_XMLSCHEMA 2935 +#define F_DATABASE_TO_XML 2936 +#define F_DATABASE_TO_XMLSCHEMA 2937 +#define F_DATABASE_TO_XML_AND_XMLSCHEMA 2938 +#define F_TXID_SNAPSHOT_IN 2939 +#define F_TXID_SNAPSHOT_OUT 2940 +#define F_TXID_SNAPSHOT_RECV 2941 +#define F_TXID_SNAPSHOT_SEND 2942 +#define F_TXID_CURRENT 2943 +#define F_TXID_CURRENT_SNAPSHOT 2944 +#define F_TXID_SNAPSHOT_XMIN 2945 +#define F_TXID_SNAPSHOT_XMAX 2946 +#define F_TXID_SNAPSHOT_XIP 2947 +#define F_TXID_VISIBLE_IN_SNAPSHOT 2948 +#define F_UUID_IN 2952 +#define F_UUID_OUT 2953 +#define F_UUID_LT 2954 +#define F_UUID_LE 2955 +#define F_UUID_EQ 2956 +#define F_UUID_GE 2957 +#define F_UUID_GT 2958 +#define F_UUID_NE 2959 +#define F_UUID_CMP 2960 +#define F_UUID_RECV 2961 +#define F_UUID_SEND 2962 +#define F_UUID_HASH 2963 +#define F_TEXT_BOOL 2971 +#define F_PG_STAT_GET_FUNCTION_CALLS 2978 +#define F_PG_STAT_GET_FUNCTION_TOTAL_TIME 2979 +#define F_PG_STAT_GET_FUNCTION_SELF_TIME 2980 +#define F_RECORD_EQ 2981 +#define F_RECORD_NE 2982 +#define F_RECORD_LT 2983 +#define F_RECORD_GT 2984 +#define F_RECORD_LE 2985 +#define F_RECORD_GE 2986 +#define F_BTRECORDCMP 2987 +#define F_PG_TABLE_SIZE 2997 +#define F_PG_INDEXES_SIZE 2998 +#define F_PG_RELATION_FILENODE 2999 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_TEXT_TEXT 3000 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_NAME_OID_TEXT 3001 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_TEXT_TEXT 3002 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_OID_TEXT 3003 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_TEXT_TEXT 3004 +#define F_HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE_OID_TEXT 3005 +#define F_HAS_SERVER_PRIVILEGE_NAME_TEXT_TEXT 3006 +#define F_HAS_SERVER_PRIVILEGE_NAME_OID_TEXT 3007 +#define F_HAS_SERVER_PRIVILEGE_OID_TEXT_TEXT 3008 +#define F_HAS_SERVER_PRIVILEGE_OID_OID_TEXT 3009 +#define F_HAS_SERVER_PRIVILEGE_TEXT_TEXT 3010 +#define F_HAS_SERVER_PRIVILEGE_OID_TEXT 3011 +#define F_HAS_COLUMN_PRIVILEGE_NAME_TEXT_TEXT_TEXT 3012 +#define F_HAS_COLUMN_PRIVILEGE_NAME_TEXT_INT2_TEXT 3013 +#define F_HAS_COLUMN_PRIVILEGE_NAME_OID_TEXT_TEXT 3014 +#define F_HAS_COLUMN_PRIVILEGE_NAME_OID_INT2_TEXT 3015 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_TEXT_TEXT 3016 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_INT2_TEXT 3017 +#define F_HAS_COLUMN_PRIVILEGE_OID_OID_TEXT_TEXT 3018 +#define F_HAS_COLUMN_PRIVILEGE_OID_OID_INT2_TEXT 3019 +#define F_HAS_COLUMN_PRIVILEGE_TEXT_TEXT_TEXT 3020 +#define F_HAS_COLUMN_PRIVILEGE_TEXT_INT2_TEXT 3021 +#define F_HAS_COLUMN_PRIVILEGE_OID_TEXT_TEXT 3022 +#define F_HAS_COLUMN_PRIVILEGE_OID_INT2_TEXT 3023 +#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_TEXT_TEXT 3024 +#define F_HAS_ANY_COLUMN_PRIVILEGE_NAME_OID_TEXT 3025 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_TEXT_TEXT 3026 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_OID_TEXT 3027 +#define F_HAS_ANY_COLUMN_PRIVILEGE_TEXT_TEXT 3028 +#define F_HAS_ANY_COLUMN_PRIVILEGE_OID_TEXT 3029 +#define F_OVERLAY_BIT_BIT_INT4_INT4 3030 +#define F_OVERLAY_BIT_BIT_INT4 3031 +#define F_GET_BIT_BIT_INT4 3032 +#define F_SET_BIT_BIT_INT4_INT4 3033 +#define F_PG_RELATION_FILEPATH 3034 +#define F_PG_LISTENING_CHANNELS 3035 +#define F_PG_NOTIFY 3036 +#define F_PG_STAT_GET_XACT_NUMSCANS 3037 +#define F_PG_STAT_GET_XACT_TUPLES_RETURNED 3038 +#define F_PG_STAT_GET_XACT_TUPLES_FETCHED 3039 +#define F_PG_STAT_GET_XACT_TUPLES_INSERTED 3040 +#define F_PG_STAT_GET_XACT_TUPLES_UPDATED 3041 +#define F_PG_STAT_GET_XACT_TUPLES_DELETED 3042 +#define F_PG_STAT_GET_XACT_TUPLES_HOT_UPDATED 3043 +#define F_PG_STAT_GET_XACT_BLOCKS_FETCHED 3044 +#define F_PG_STAT_GET_XACT_BLOCKS_HIT 3045 +#define F_PG_STAT_GET_XACT_FUNCTION_CALLS 3046 +#define F_PG_STAT_GET_XACT_FUNCTION_TOTAL_TIME 3047 +#define F_PG_STAT_GET_XACT_FUNCTION_SELF_TIME 3048 +#define F_XPATH_EXISTS_TEXT_XML__TEXT 3049 +#define F_XPATH_EXISTS_TEXT_XML 3050 +#define F_XML_IS_WELL_FORMED 3051 +#define F_XML_IS_WELL_FORMED_DOCUMENT 3052 +#define F_XML_IS_WELL_FORMED_CONTENT 3053 +#define F_PG_STAT_GET_VACUUM_COUNT 3054 +#define F_PG_STAT_GET_AUTOVACUUM_COUNT 3055 +#define F_PG_STAT_GET_ANALYZE_COUNT 3056 +#define F_PG_STAT_GET_AUTOANALYZE_COUNT 3057 +#define F_CONCAT 3058 +#define F_CONCAT_WS 3059 +#define F_LEFT 3060 +#define F_RIGHT 3061 +#define F_REVERSE 3062 +#define F_GIST_POINT_DISTANCE 3064 +#define F_PG_STAT_GET_DB_CONFLICT_TABLESPACE 3065 +#define F_PG_STAT_GET_DB_CONFLICT_LOCK 3066 +#define F_PG_STAT_GET_DB_CONFLICT_SNAPSHOT 3067 +#define F_PG_STAT_GET_DB_CONFLICT_BUFFERPIN 3068 +#define F_PG_STAT_GET_DB_CONFLICT_STARTUP_DEADLOCK 3069 +#define F_PG_STAT_GET_DB_CONFLICT_ALL 3070 +#define F_PG_WAL_REPLAY_PAUSE 3071 +#define F_PG_WAL_REPLAY_RESUME 3072 +#define F_PG_IS_WAL_REPLAY_PAUSED 3073 +#define F_PG_STAT_GET_DB_STAT_RESET_TIME 3074 +#define F_PG_STAT_GET_BGWRITER_STAT_RESET_TIME 3075 +#define F_GINARRAYEXTRACT_ANYARRAY_INTERNAL 3076 +#define F_GIN_EXTRACT_TSVECTOR_TSVECTOR_INTERNAL 3077 +#define F_PG_SEQUENCE_PARAMETERS 3078 +#define F_PG_AVAILABLE_EXTENSIONS 3082 +#define F_PG_AVAILABLE_EXTENSION_VERSIONS 3083 +#define F_PG_EXTENSION_UPDATE_PATHS 3084 +#define F_PG_EXTENSION_CONFIG_DUMP 3086 +#define F_GIN_EXTRACT_TSQUERY_TSQUERY_INTERNAL_INT2_INTERNAL_INTERNAL 3087 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSQUERY_INT4_INTERNAL_INTERNAL 3088 +#define F_PG_ADVISORY_XACT_LOCK_INT8 3089 +#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT8 3090 +#define F_PG_TRY_ADVISORY_XACT_LOCK_INT8 3091 +#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT8 3092 +#define F_PG_ADVISORY_XACT_LOCK_INT4_INT4 3093 +#define F_PG_ADVISORY_XACT_LOCK_SHARED_INT4_INT4 3094 +#define F_PG_TRY_ADVISORY_XACT_LOCK_INT4_INT4 3095 +#define F_PG_TRY_ADVISORY_XACT_LOCK_SHARED_INT4_INT4 3096 +#define F_VARCHAR_SUPPORT 3097 +#define F_PG_CREATE_RESTORE_POINT 3098 +#define F_PG_STAT_GET_WAL_SENDERS 3099 +#define F_ROW_NUMBER 3100 +#define F_RANK_ 3101 +#define F_DENSE_RANK_ 3102 +#define F_PERCENT_RANK_ 3103 +#define F_CUME_DIST_ 3104 +#define F_NTILE 3105 +#define F_LAG_ANYELEMENT 3106 +#define F_LAG_ANYELEMENT_INT4 3107 +#define F_LAG_ANYCOMPATIBLE_INT4_ANYCOMPATIBLE 3108 +#define F_LEAD_ANYELEMENT 3109 +#define F_LEAD_ANYELEMENT_INT4 3110 +#define F_LEAD_ANYCOMPATIBLE_INT4_ANYCOMPATIBLE 3111 +#define F_FIRST_VALUE 3112 +#define F_LAST_VALUE 3113 +#define F_NTH_VALUE 3114 +#define F_FDW_HANDLER_IN 3116 +#define F_FDW_HANDLER_OUT 3117 +#define F_VOID_RECV 3120 +#define F_VOID_SEND 3121 +#define F_BTINT2SORTSUPPORT 3129 +#define F_BTINT4SORTSUPPORT 3130 +#define F_BTINT8SORTSUPPORT 3131 +#define F_BTFLOAT4SORTSUPPORT 3132 +#define F_BTFLOAT8SORTSUPPORT 3133 +#define F_BTOIDSORTSUPPORT 3134 +#define F_BTNAMESORTSUPPORT 3135 +#define F_DATE_SORTSUPPORT 3136 +#define F_TIMESTAMP_SORTSUPPORT 3137 +#define F_HAS_TYPE_PRIVILEGE_NAME_TEXT_TEXT 3138 +#define F_HAS_TYPE_PRIVILEGE_NAME_OID_TEXT 3139 +#define F_HAS_TYPE_PRIVILEGE_OID_TEXT_TEXT 3140 +#define F_HAS_TYPE_PRIVILEGE_OID_OID_TEXT 3141 +#define F_HAS_TYPE_PRIVILEGE_TEXT_TEXT 3142 +#define F_HAS_TYPE_PRIVILEGE_OID_TEXT 3143 +#define F_MACADDR_NOT 3144 +#define F_MACADDR_AND 3145 +#define F_MACADDR_OR 3146 +#define F_PG_STAT_GET_DB_TEMP_FILES 3150 +#define F_PG_STAT_GET_DB_TEMP_BYTES 3151 +#define F_PG_STAT_GET_DB_DEADLOCKS 3152 +#define F_ARRAY_TO_JSON_ANYARRAY 3153 +#define F_ARRAY_TO_JSON_ANYARRAY_BOOL 3154 +#define F_ROW_TO_JSON_RECORD 3155 +#define F_ROW_TO_JSON_RECORD_BOOL 3156 +#define F_NUMERIC_SUPPORT 3157 +#define F_VARBIT_SUPPORT 3158 +#define F_PG_GET_VIEWDEF_OID_INT4 3159 +#define F_PG_STAT_GET_CHECKPOINTER_WRITE_TIME 3160 +#define F_PG_STAT_GET_CHECKPOINTER_SYNC_TIME 3161 +#define F_PG_COLLATION_FOR 3162 +#define F_PG_TRIGGER_DEPTH 3163 +#define F_PG_WAL_LSN_DIFF 3165 +#define F_PG_SIZE_PRETTY_NUMERIC 3166 +#define F_ARRAY_REMOVE 3167 +#define F_ARRAY_REPLACE 3168 +#define F_RANGESEL 3169 +#define F_LO_LSEEK64 3170 +#define F_LO_TELL64 3171 +#define F_LO_TRUNCATE64 3172 +#define F_JSON_AGG_TRANSFN 3173 +#define F_JSON_AGG_FINALFN 3174 +#define F_JSON_AGG 3175 +#define F_TO_JSON 3176 +#define F_PG_STAT_GET_MOD_SINCE_ANALYZE 3177 +#define F_NUMERIC_SUM 3178 +#define F_CARDINALITY 3179 +#define F_JSON_OBJECT_AGG_TRANSFN 3180 +#define F_RECORD_IMAGE_EQ 3181 +#define F_RECORD_IMAGE_NE 3182 +#define F_RECORD_IMAGE_LT 3183 +#define F_RECORD_IMAGE_GT 3184 +#define F_RECORD_IMAGE_LE 3185 +#define F_RECORD_IMAGE_GE 3186 +#define F_BTRECORDIMAGECMP 3187 +#define F_PG_STAT_GET_ARCHIVER 3195 +#define F_JSON_OBJECT_AGG_FINALFN 3196 +#define F_JSON_OBJECT_AGG 3197 +#define F_JSON_BUILD_ARRAY_ANY 3198 +#define F_JSON_BUILD_ARRAY_ 3199 +#define F_JSON_BUILD_OBJECT_ANY 3200 +#define F_JSON_BUILD_OBJECT_ 3201 +#define F_JSON_OBJECT__TEXT 3202 +#define F_JSON_OBJECT__TEXT__TEXT 3203 +#define F_JSON_TO_RECORD 3204 +#define F_JSON_TO_RECORDSET 3205 +#define F_JSONB_ARRAY_LENGTH 3207 +#define F_JSONB_EACH 3208 +#define F_JSONB_POPULATE_RECORD 3209 +#define F_JSONB_TYPEOF 3210 +#define F_JSONB_OBJECT_FIELD_TEXT 3214 +#define F_JSONB_ARRAY_ELEMENT 3215 +#define F_JSONB_ARRAY_ELEMENT_TEXT 3216 +#define F_JSONB_EXTRACT_PATH 3217 +#define F_WIDTH_BUCKET_ANYCOMPATIBLE_ANYCOMPATIBLEARRAY 3218 +#define F_JSONB_ARRAY_ELEMENTS 3219 +#define F_PG_LSN_IN 3229 +#define F_PG_LSN_OUT 3230 +#define F_PG_LSN_LT 3231 +#define F_PG_LSN_LE 3232 +#define F_PG_LSN_EQ 3233 +#define F_PG_LSN_GE 3234 +#define F_PG_LSN_GT 3235 +#define F_PG_LSN_NE 3236 +#define F_PG_LSN_MI 3237 +#define F_PG_LSN_RECV 3238 +#define F_PG_LSN_SEND 3239 +#define F_PG_LSN_CMP 3251 +#define F_PG_LSN_HASH 3252 +#define F_BTTEXTSORTSUPPORT 3255 +#define F_GENERATE_SERIES_NUMERIC_NUMERIC_NUMERIC 3259 +#define F_GENERATE_SERIES_NUMERIC_NUMERIC 3260 +#define F_JSON_STRIP_NULLS 3261 +#define F_JSONB_STRIP_NULLS 3262 +#define F_JSONB_OBJECT__TEXT 3263 +#define F_JSONB_OBJECT__TEXT__TEXT 3264 +#define F_JSONB_AGG_TRANSFN 3265 +#define F_JSONB_AGG_FINALFN 3266 +#define F_JSONB_AGG 3267 +#define F_JSONB_OBJECT_AGG_TRANSFN 3268 +#define F_JSONB_OBJECT_AGG_FINALFN 3269 +#define F_JSONB_OBJECT_AGG 3270 +#define F_JSONB_BUILD_ARRAY_ANY 3271 +#define F_JSONB_BUILD_ARRAY_ 3272 +#define F_JSONB_BUILD_OBJECT_ANY 3273 +#define F_JSONB_BUILD_OBJECT_ 3274 +#define F_DIST_PPOLY 3275 +#define F_ARRAY_POSITION_ANYCOMPATIBLEARRAY_ANYCOMPATIBLE 3277 +#define F_ARRAY_POSITION_ANYCOMPATIBLEARRAY_ANYCOMPATIBLE_INT4 3278 +#define F_ARRAY_POSITIONS 3279 +#define F_GIST_CIRCLE_DISTANCE 3280 +#define F_SCALE 3281 +#define F_GIST_POINT_FETCH 3282 +#define F_NUMERIC_SORTSUPPORT 3283 +#define F_GIST_POLY_DISTANCE 3288 +#define F_DIST_CPOINT 3290 +#define F_DIST_POLYP 3292 +#define F_PG_READ_FILE_TEXT_INT8_INT8_BOOL 3293 +#define F_CURRENT_SETTING_TEXT_BOOL 3294 +#define F_PG_READ_BINARY_FILE_TEXT_INT8_INT8_BOOL 3295 +#define F_PG_NOTIFICATION_QUEUE_USAGE 3296 +#define F_PG_LS_DIR_TEXT_BOOL_BOOL 3297 +#define F_ROW_SECURITY_ACTIVE_OID 3298 +#define F_ROW_SECURITY_ACTIVE_TEXT 3299 +#define F_UUID_SORTSUPPORT 3300 +#define F_JSONB_CONCAT 3301 +#define F_JSONB_DELETE_JSONB_TEXT 3302 +#define F_JSONB_DELETE_JSONB_INT4 3303 +#define F_JSONB_DELETE_PATH 3304 +#define F_JSONB_SET 3305 +#define F_JSONB_PRETTY 3306 +#define F_PG_STAT_FILE_TEXT_BOOL 3307 +#define F_XIDNEQ 3308 +#define F_XIDNEQINT4 3309 +#define F_TSM_HANDLER_IN 3311 +#define F_TSM_HANDLER_OUT 3312 +#define F_BERNOULLI 3313 +#define F_SYSTEM 3314 +#define F_PG_STAT_GET_WAL_RECEIVER 3317 +#define F_PG_STAT_GET_PROGRESS_INFO 3318 +#define F_TS_FILTER 3319 +#define F_SETWEIGHT_TSVECTOR_CHAR__TEXT 3320 +#define F_TS_DELETE_TSVECTOR_TEXT 3321 +#define F_UNNEST_TSVECTOR 3322 +#define F_TS_DELETE_TSVECTOR__TEXT 3323 +#define F_INT4_AVG_COMBINE 3324 +#define F_INTERVAL_AVG_COMBINE 3325 +#define F_TSVECTOR_TO_ARRAY 3326 +#define F_ARRAY_TO_TSVECTOR 3327 +#define F_BPCHAR_SORTSUPPORT 3328 +#define F_PG_SHOW_ALL_FILE_SETTINGS 3329 +#define F_PG_CURRENT_WAL_FLUSH_LSN 3330 +#define F_BYTEA_SORTSUPPORT 3331 +#define F_BTTEXT_PATTERN_SORTSUPPORT 3332 +#define F_BTBPCHAR_PATTERN_SORTSUPPORT 3333 +#define F_PG_SIZE_BYTES 3334 +#define F_NUMERIC_SERIALIZE 3335 +#define F_NUMERIC_DESERIALIZE 3336 +#define F_NUMERIC_AVG_COMBINE 3337 +#define F_NUMERIC_POLY_COMBINE 3338 +#define F_NUMERIC_POLY_SERIALIZE 3339 +#define F_NUMERIC_POLY_DESERIALIZE 3340 +#define F_NUMERIC_COMBINE 3341 +#define F_FLOAT8_REGR_COMBINE 3342 +#define F_JSONB_DELETE_JSONB__TEXT 3343 +#define F_CASH_MUL_INT8 3344 +#define F_CASH_DIV_INT8 3345 +#define F_TXID_CURRENT_IF_ASSIGNED 3348 +#define F_PG_GET_PARTKEYDEF 3352 +#define F_PG_LS_LOGDIR 3353 +#define F_PG_LS_WALDIR 3354 +#define F_PG_NDISTINCT_IN 3355 +#define F_PG_NDISTINCT_OUT 3356 +#define F_PG_NDISTINCT_RECV 3357 +#define F_PG_NDISTINCT_SEND 3358 +#define F_MACADDR_SORTSUPPORT 3359 +#define F_TXID_STATUS 3360 +#define F_PG_SAFE_SNAPSHOT_BLOCKING_PIDS 3376 +#define F_PG_ISOLATION_TEST_SESSION_IS_BLOCKED 3378 +#define F_PG_IDENTIFY_OBJECT_AS_ADDRESS 3382 +#define F_BRIN_MINMAX_OPCINFO 3383 +#define F_BRIN_MINMAX_ADD_VALUE 3384 +#define F_BRIN_MINMAX_CONSISTENT 3385 +#define F_BRIN_MINMAX_UNION 3386 +#define F_INT8_AVG_ACCUM_INV 3387 +#define F_NUMERIC_POLY_SUM 3388 +#define F_NUMERIC_POLY_AVG 3389 +#define F_NUMERIC_POLY_VAR_POP 3390 +#define F_NUMERIC_POLY_VAR_SAMP 3391 +#define F_NUMERIC_POLY_STDDEV_POP 3392 +#define F_NUMERIC_POLY_STDDEV_SAMP 3393 +#define F_REGEXP_MATCH_TEXT_TEXT 3396 +#define F_REGEXP_MATCH_TEXT_TEXT_TEXT 3397 +#define F_INT8_MUL_CASH 3399 +#define F_PG_CONFIG 3400 +#define F_PG_HBA_FILE_RULES 3401 +#define F_PG_STATISTICS_OBJ_IS_VISIBLE 3403 +#define F_PG_DEPENDENCIES_IN 3404 +#define F_PG_DEPENDENCIES_OUT 3405 +#define F_PG_DEPENDENCIES_RECV 3406 +#define F_PG_DEPENDENCIES_SEND 3407 +#define F_PG_GET_PARTITION_CONSTRAINTDEF 3408 +#define F_TIME_HASH_EXTENDED 3409 +#define F_TIMETZ_HASH_EXTENDED 3410 +#define F_TIMESTAMP_HASH_EXTENDED 3411 +#define F_UUID_HASH_EXTENDED 3412 +#define F_PG_LSN_HASH_EXTENDED 3413 +#define F_HASHENUMEXTENDED 3414 +#define F_PG_GET_STATISTICSOBJDEF 3415 +#define F_JSONB_HASH_EXTENDED 3416 +#define F_HASH_RANGE_EXTENDED 3417 +#define F_INTERVAL_HASH_EXTENDED 3418 +#define F_SHA224 3419 +#define F_SHA256 3420 +#define F_SHA384 3421 +#define F_SHA512 3422 +#define F_PG_PARTITION_TREE 3423 +#define F_PG_PARTITION_ROOT 3424 +#define F_PG_PARTITION_ANCESTORS 3425 +#define F_PG_STAT_GET_DB_CHECKSUM_FAILURES 3426 +#define F_PG_MCV_LIST_ITEMS 3427 +#define F_PG_STAT_GET_DB_CHECKSUM_LAST_FAILURE 3428 +#define F_GEN_RANDOM_UUID 3432 +#define F_GTSVECTOR_OPTIONS 3434 +#define F_GIST_POINT_SORTSUPPORT 3435 +#define F_PG_PROMOTE 3436 +#define F_PREFIXSEL 3437 +#define F_PREFIXJOINSEL 3438 +#define F_PG_CONTROL_SYSTEM 3441 +#define F_PG_CONTROL_CHECKPOINT 3442 +#define F_PG_CONTROL_RECOVERY 3443 +#define F_PG_CONTROL_INIT 3444 +#define F_PG_IMPORT_SYSTEM_COLLATIONS 3445 +#define F_MACADDR8_RECV 3446 +#define F_MACADDR8_SEND 3447 +#define F_PG_COLLATION_ACTUAL_VERSION 3448 +#define F_NUMERIC_JSONB 3449 +#define F_INT2_JSONB 3450 +#define F_INT4_JSONB 3451 +#define F_INT8_JSONB 3452 +#define F_FLOAT4_JSONB 3453 +#define F_PG_FILENODE_RELATION 3454 +#define F_LO_FROM_BYTEA 3457 +#define F_LO_GET_OID 3458 +#define F_LO_GET_OID_INT8_INT4 3459 +#define F_LO_PUT 3460 +#define F_MAKE_TIMESTAMP 3461 +#define F_MAKE_TIMESTAMPTZ_INT4_INT4_INT4_INT4_INT4_FLOAT8 3462 +#define F_MAKE_TIMESTAMPTZ_INT4_INT4_INT4_INT4_INT4_FLOAT8_TEXT 3463 +#define F_MAKE_INTERVAL 3464 +#define F_JSONB_ARRAY_ELEMENTS_TEXT 3465 +#define F_SPG_RANGE_QUAD_CONFIG 3469 +#define F_SPG_RANGE_QUAD_CHOOSE 3470 +#define F_SPG_RANGE_QUAD_PICKSPLIT 3471 +#define F_SPG_RANGE_QUAD_INNER_CONSISTENT 3472 +#define F_SPG_RANGE_QUAD_LEAF_CONSISTENT 3473 +#define F_JSONB_POPULATE_RECORDSET 3475 +#define F_TO_REGOPERATOR 3476 +#define F_JSONB_OBJECT_FIELD 3478 +#define F_TO_REGPROCEDURE 3479 +#define F_GIN_COMPARE_JSONB 3480 +#define F_GIN_EXTRACT_JSONB 3482 +#define F_GIN_EXTRACT_JSONB_QUERY 3483 +#define F_GIN_CONSISTENT_JSONB 3484 +#define F_GIN_EXTRACT_JSONB_PATH 3485 +#define F_GIN_EXTRACT_JSONB_QUERY_PATH 3486 +#define F_GIN_CONSISTENT_JSONB_PATH 3487 +#define F_GIN_TRICONSISTENT_JSONB 3488 +#define F_GIN_TRICONSISTENT_JSONB_PATH 3489 +#define F_JSONB_TO_RECORD 3490 +#define F_JSONB_TO_RECORDSET 3491 +#define F_TO_REGOPER 3492 +#define F_TO_REGTYPE 3493 +#define F_TO_REGPROC 3494 +#define F_TO_REGCLASS 3495 +#define F_BOOL_ACCUM 3496 +#define F_BOOL_ACCUM_INV 3497 +#define F_BOOL_ALLTRUE 3498 +#define F_BOOL_ANYTRUE 3499 +#define F_ANYENUM_IN 3504 +#define F_ANYENUM_OUT 3505 +#define F_ENUM_IN 3506 +#define F_ENUM_OUT 3507 +#define F_ENUM_EQ 3508 +#define F_ENUM_NE 3509 +#define F_ENUM_LT 3510 +#define F_ENUM_GT 3511 +#define F_ENUM_LE 3512 +#define F_ENUM_GE 3513 +#define F_ENUM_CMP 3514 +#define F_HASHENUM 3515 +#define F_ENUM_SMALLER 3524 +#define F_ENUM_LARGER 3525 +#define F_MAX_ANYENUM 3526 +#define F_MIN_ANYENUM 3527 +#define F_ENUM_FIRST 3528 +#define F_ENUM_LAST 3529 +#define F_ENUM_RANGE_ANYENUM_ANYENUM 3530 +#define F_ENUM_RANGE_ANYENUM 3531 +#define F_ENUM_RECV 3532 +#define F_ENUM_SEND 3533 +#define F_STRING_AGG_TRANSFN 3535 +#define F_STRING_AGG_FINALFN 3536 +#define F_PG_DESCRIBE_OBJECT 3537 +#define F_STRING_AGG_TEXT_TEXT 3538 +#define F_FORMAT_TEXT_ANY 3539 +#define F_FORMAT_TEXT 3540 +#define F_BYTEA_STRING_AGG_TRANSFN 3543 +#define F_BYTEA_STRING_AGG_FINALFN 3544 +#define F_STRING_AGG_BYTEA_BYTEA 3545 +#define F_INT8DEC 3546 +#define F_INT8DEC_ANY 3547 +#define F_NUMERIC_ACCUM_INV 3548 +#define F_INTERVAL_AVG_ACCUM_INV 3549 +#define F_NETWORK_OVERLAP 3551 +#define F_INET_GIST_CONSISTENT 3553 +#define F_INET_GIST_UNION 3554 +#define F_INET_GIST_COMPRESS 3555 +#define F_BOOL_JSONB 3556 +#define F_INET_GIST_PENALTY 3557 +#define F_INET_GIST_PICKSPLIT 3558 +#define F_INET_GIST_SAME 3559 +#define F_NETWORKSEL 3560 +#define F_NETWORKJOINSEL 3561 +#define F_NETWORK_LARGER 3562 +#define F_NETWORK_SMALLER 3563 +#define F_MAX_INET 3564 +#define F_MIN_INET 3565 +#define F_PG_EVENT_TRIGGER_DROPPED_OBJECTS 3566 +#define F_INT2_ACCUM_INV 3567 +#define F_INT4_ACCUM_INV 3568 +#define F_INT8_ACCUM_INV 3569 +#define F_INT2_AVG_ACCUM_INV 3570 +#define F_INT4_AVG_ACCUM_INV 3571 +#define F_INT2INT4_SUM 3572 +#define F_INET_GIST_FETCH 3573 +#define F_PG_LOGICAL_EMIT_MESSAGE_BOOL_TEXT_TEXT_BOOL 3577 +#define F_PG_LOGICAL_EMIT_MESSAGE_BOOL_TEXT_BYTEA_BOOL 3578 +#define F_JSONB_INSERT 3579 +#define F_PG_XACT_COMMIT_TIMESTAMP 3581 +#define F_BINARY_UPGRADE_SET_NEXT_PG_TYPE_OID 3582 +#define F_PG_LAST_COMMITTED_XACT 3583 +#define F_BINARY_UPGRADE_SET_NEXT_ARRAY_PG_TYPE_OID 3584 +#define F_BINARY_UPGRADE_SET_NEXT_HEAP_PG_CLASS_OID 3586 +#define F_BINARY_UPGRADE_SET_NEXT_INDEX_PG_CLASS_OID 3587 +#define F_BINARY_UPGRADE_SET_NEXT_TOAST_PG_CLASS_OID 3588 +#define F_BINARY_UPGRADE_SET_NEXT_PG_ENUM_OID 3589 +#define F_BINARY_UPGRADE_SET_NEXT_PG_AUTHID_OID 3590 +#define F_BINARY_UPGRADE_CREATE_EMPTY_EXTENSION 3591 +#define F_EVENT_TRIGGER_IN 3594 +#define F_EVENT_TRIGGER_OUT 3595 +#define F_TSVECTORIN 3610 +#define F_TSVECTOROUT 3611 +#define F_TSQUERYIN 3612 +#define F_TSQUERYOUT 3613 +#define F_TSVECTOR_LT 3616 +#define F_TSVECTOR_LE 3617 +#define F_TSVECTOR_EQ 3618 +#define F_TSVECTOR_NE 3619 +#define F_TSVECTOR_GE 3620 +#define F_TSVECTOR_GT 3621 +#define F_TSVECTOR_CMP 3622 +#define F_STRIP 3623 +#define F_SETWEIGHT_TSVECTOR_CHAR 3624 +#define F_TSVECTOR_CONCAT 3625 +#define F_TS_MATCH_VQ 3634 +#define F_TS_MATCH_QV 3635 +#define F_TSVECTORSEND 3638 +#define F_TSVECTORRECV 3639 +#define F_TSQUERYSEND 3640 +#define F_TSQUERYRECV 3641 +#define F_GTSVECTORIN 3646 +#define F_GTSVECTOROUT 3647 +#define F_GTSVECTOR_COMPRESS 3648 +#define F_GTSVECTOR_DECOMPRESS 3649 +#define F_GTSVECTOR_PICKSPLIT 3650 +#define F_GTSVECTOR_UNION 3651 +#define F_GTSVECTOR_SAME 3652 +#define F_GTSVECTOR_PENALTY 3653 +#define F_GTSVECTOR_CONSISTENT_INTERNAL_TSVECTOR_INT2_OID_INTERNAL 3654 +#define F_GIN_EXTRACT_TSVECTOR_TSVECTOR_INTERNAL_INTERNAL 3656 +#define F_GIN_EXTRACT_TSQUERY_TSVECTOR_INTERNAL_INT2_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3657 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSVECTOR_INT4_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3658 +#define F_TSQUERY_LT 3662 +#define F_TSQUERY_LE 3663 +#define F_TSQUERY_EQ 3664 +#define F_TSQUERY_NE 3665 +#define F_TSQUERY_GE 3666 +#define F_TSQUERY_GT 3667 +#define F_TSQUERY_CMP 3668 +#define F_TSQUERY_AND 3669 +#define F_TSQUERY_OR 3670 +#define F_TSQUERY_NOT 3671 +#define F_NUMNODE 3672 +#define F_QUERYTREE 3673 +#define F_TS_REWRITE_TSQUERY_TSQUERY_TSQUERY 3684 +#define F_TS_REWRITE_TSQUERY_TEXT 3685 +#define F_TSMATCHSEL 3686 +#define F_TSMATCHJOINSEL 3687 +#define F_TS_TYPANALYZE 3688 +#define F_TS_STAT_TEXT 3689 +#define F_TS_STAT_TEXT_TEXT 3690 +#define F_TSQ_MCONTAINS 3691 +#define F_TSQ_MCONTAINED 3692 +#define F_GTSQUERY_COMPRESS 3695 +#define F_STARTS_WITH 3696 +#define F_GTSQUERY_PICKSPLIT 3697 +#define F_GTSQUERY_UNION 3698 +#define F_GTSQUERY_SAME 3699 +#define F_GTSQUERY_PENALTY 3700 +#define F_GTSQUERY_CONSISTENT_INTERNAL_TSQUERY_INT2_OID_INTERNAL 3701 +#define F_TS_RANK__FLOAT4_TSVECTOR_TSQUERY_INT4 3703 +#define F_TS_RANK__FLOAT4_TSVECTOR_TSQUERY 3704 +#define F_TS_RANK_TSVECTOR_TSQUERY_INT4 3705 +#define F_TS_RANK_TSVECTOR_TSQUERY 3706 +#define F_TS_RANK_CD__FLOAT4_TSVECTOR_TSQUERY_INT4 3707 +#define F_TS_RANK_CD__FLOAT4_TSVECTOR_TSQUERY 3708 +#define F_TS_RANK_CD_TSVECTOR_TSQUERY_INT4 3709 +#define F_TS_RANK_CD_TSVECTOR_TSQUERY 3710 +#define F_LENGTH_TSVECTOR 3711 +#define F_TS_TOKEN_TYPE_OID 3713 +#define F_TS_TOKEN_TYPE_TEXT 3714 +#define F_TS_PARSE_OID_TEXT 3715 +#define F_TS_PARSE_TEXT_TEXT 3716 +#define F_PRSD_START 3717 +#define F_PRSD_NEXTTOKEN 3718 +#define F_PRSD_END 3719 +#define F_PRSD_HEADLINE 3720 +#define F_PRSD_LEXTYPE 3721 +#define F_TS_LEXIZE 3723 +#define F_GIN_CMP_TSLEXEME 3724 +#define F_DSIMPLE_INIT 3725 +#define F_DSIMPLE_LEXIZE 3726 +#define F_DSYNONYM_INIT 3728 +#define F_DSYNONYM_LEXIZE 3729 +#define F_DISPELL_INIT 3731 +#define F_DISPELL_LEXIZE 3732 +#define F_REGCONFIGIN 3736 +#define F_REGCONFIGOUT 3737 +#define F_REGCONFIGRECV 3738 +#define F_REGCONFIGSEND 3739 +#define F_THESAURUS_INIT 3740 +#define F_THESAURUS_LEXIZE 3741 +#define F_TS_HEADLINE_REGCONFIG_TEXT_TSQUERY_TEXT 3743 +#define F_TS_HEADLINE_REGCONFIG_TEXT_TSQUERY 3744 +#define F_TO_TSVECTOR_REGCONFIG_TEXT 3745 +#define F_TO_TSQUERY_REGCONFIG_TEXT 3746 +#define F_PLAINTO_TSQUERY_REGCONFIG_TEXT 3747 +#define F_TO_TSVECTOR_TEXT 3749 +#define F_TO_TSQUERY_TEXT 3750 +#define F_PLAINTO_TSQUERY_TEXT 3751 +#define F_TSVECTOR_UPDATE_TRIGGER 3752 +#define F_TSVECTOR_UPDATE_TRIGGER_COLUMN 3753 +#define F_TS_HEADLINE_TEXT_TSQUERY_TEXT 3754 +#define F_TS_HEADLINE_TEXT_TSQUERY 3755 +#define F_PG_TS_PARSER_IS_VISIBLE 3756 +#define F_PG_TS_DICT_IS_VISIBLE 3757 +#define F_PG_TS_CONFIG_IS_VISIBLE 3758 +#define F_GET_CURRENT_TS_CONFIG 3759 +#define F_TS_MATCH_TT 3760 +#define F_TS_MATCH_TQ 3761 +#define F_PG_TS_TEMPLATE_IS_VISIBLE 3768 +#define F_REGDICTIONARYIN 3771 +#define F_REGDICTIONARYOUT 3772 +#define F_REGDICTIONARYRECV 3773 +#define F_REGDICTIONARYSEND 3774 +#define F_PG_STAT_RESET_SHARED 3775 +#define F_PG_STAT_RESET_SINGLE_TABLE_COUNTERS 3776 +#define F_PG_STAT_RESET_SINGLE_FUNCTION_COUNTERS 3777 +#define F_PG_TABLESPACE_LOCATION 3778 +#define F_PG_CREATE_PHYSICAL_REPLICATION_SLOT 3779 +#define F_PG_DROP_REPLICATION_SLOT 3780 +#define F_PG_GET_REPLICATION_SLOTS 3781 +#define F_PG_LOGICAL_SLOT_GET_CHANGES 3782 +#define F_PG_LOGICAL_SLOT_GET_BINARY_CHANGES 3783 +#define F_PG_LOGICAL_SLOT_PEEK_CHANGES 3784 +#define F_PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES 3785 +#define F_PG_CREATE_LOGICAL_REPLICATION_SLOT 3786 +#define F_TO_JSONB 3787 +#define F_PG_STAT_GET_SNAPSHOT_TIMESTAMP 3788 +#define F_GIN_CLEAN_PENDING_LIST 3789 +#define F_GTSVECTOR_CONSISTENT_INTERNAL_GTSVECTOR_INT4_OID_INTERNAL 3790 +#define F_GIN_EXTRACT_TSQUERY_TSQUERY_INTERNAL_INT2_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3791 +#define F_GIN_TSQUERY_CONSISTENT_INTERNAL_INT2_TSQUERY_INT4_INTERNAL_INTERNAL_INTERNAL_INTERNAL 3792 +#define F_GTSQUERY_CONSISTENT_INTERNAL_INTERNAL_INT4_OID_INTERNAL 3793 +#define F_INET_SPG_CONFIG 3795 +#define F_INET_SPG_CHOOSE 3796 +#define F_INET_SPG_PICKSPLIT 3797 +#define F_INET_SPG_INNER_CONSISTENT 3798 +#define F_INET_SPG_LEAF_CONSISTENT 3799 +#define F_PG_CURRENT_LOGFILE_ 3800 +#define F_PG_CURRENT_LOGFILE_TEXT 3801 +#define F_JSONB_SEND 3803 +#define F_JSONB_OUT 3804 +#define F_JSONB_RECV 3805 +#define F_JSONB_IN 3806 +#define F_PG_GET_FUNCTION_ARG_DEFAULT 3808 +#define F_PG_EXPORT_SNAPSHOT 3809 +#define F_PG_IS_IN_RECOVERY 3810 +#define F_MONEY_INT4 3811 +#define F_MONEY_INT8 3812 +#define F_XMLTEXT 3813 +#define F_PG_COLLATION_IS_VISIBLE 3815 +#define F_ARRAY_TYPANALYZE 3816 +#define F_ARRAYCONTSEL 3817 +#define F_ARRAYCONTJOINSEL 3818 +#define F_PG_GET_MULTIXACT_MEMBERS 3819 +#define F_PG_LAST_WAL_RECEIVE_LSN 3820 +#define F_PG_LAST_WAL_REPLAY_LSN 3821 +#define F_CASH_DIV_CASH 3822 +#define F_NUMERIC_MONEY 3823 +#define F_MONEY_NUMERIC 3824 +#define F_PG_READ_FILE_TEXT 3826 +#define F_PG_READ_BINARY_FILE_TEXT_INT8_INT8 3827 +#define F_PG_READ_BINARY_FILE_TEXT 3828 +#define F_PG_OPFAMILY_IS_VISIBLE 3829 +#define F_PG_LAST_XACT_REPLAY_TIMESTAMP 3830 +#define F_ANYRANGE_IN 3832 +#define F_ANYRANGE_OUT 3833 +#define F_RANGE_IN 3834 +#define F_RANGE_OUT 3835 +#define F_RANGE_RECV 3836 +#define F_RANGE_SEND 3837 +#define F_PG_IDENTIFY_OBJECT 3839 +#define F_INT4RANGE_INT4_INT4 3840 +#define F_INT4RANGE_INT4_INT4_TEXT 3841 +#define F_PG_RELATION_IS_UPDATABLE 3842 +#define F_PG_COLUMN_IS_UPDATABLE 3843 +#define F_NUMRANGE_NUMERIC_NUMERIC 3844 +#define F_NUMRANGE_NUMERIC_NUMERIC_TEXT 3845 +#define F_MAKE_DATE 3846 +#define F_MAKE_TIME 3847 +#define F_LOWER_ANYRANGE 3848 +#define F_UPPER_ANYRANGE 3849 +#define F_ISEMPTY_ANYRANGE 3850 +#define F_LOWER_INC_ANYRANGE 3851 +#define F_UPPER_INC_ANYRANGE 3852 +#define F_LOWER_INF_ANYRANGE 3853 +#define F_UPPER_INF_ANYRANGE 3854 +#define F_RANGE_EQ 3855 +#define F_RANGE_NE 3856 +#define F_RANGE_OVERLAPS 3857 +#define F_RANGE_CONTAINS_ELEM 3858 +#define F_RANGE_CONTAINS 3859 +#define F_ELEM_CONTAINED_BY_RANGE 3860 +#define F_RANGE_CONTAINED_BY 3861 +#define F_RANGE_ADJACENT 3862 +#define F_RANGE_BEFORE 3863 +#define F_RANGE_AFTER 3864 +#define F_RANGE_OVERLEFT 3865 +#define F_RANGE_OVERRIGHT 3866 +#define F_RANGE_UNION 3867 +#define F_RANGE_INTERSECT 3868 +#define F_RANGE_MINUS 3869 +#define F_RANGE_CMP 3870 +#define F_RANGE_LT 3871 +#define F_RANGE_LE 3872 +#define F_RANGE_GE 3873 +#define F_RANGE_GT 3874 +#define F_RANGE_GIST_CONSISTENT 3875 +#define F_RANGE_GIST_UNION 3876 +#define F_PG_REPLICATION_SLOT_ADVANCE 3878 +#define F_RANGE_GIST_PENALTY 3879 +#define F_RANGE_GIST_PICKSPLIT 3880 +#define F_RANGE_GIST_SAME 3881 +#define F_HASH_RANGE 3902 +#define F_INT4RANGE_CANONICAL 3914 +#define F_DATERANGE_CANONICAL 3915 +#define F_RANGE_TYPANALYZE 3916 +#define F_TIMESTAMP_SUPPORT 3917 +#define F_INTERVAL_SUPPORT 3918 +#define F_GINARRAYTRICONSISTENT 3920 +#define F_GIN_TSQUERY_TRICONSISTENT 3921 +#define F_INT4RANGE_SUBDIFF 3922 +#define F_INT8RANGE_SUBDIFF 3923 +#define F_NUMRANGE_SUBDIFF 3924 +#define F_DATERANGE_SUBDIFF 3925 +#define F_INT8RANGE_CANONICAL 3928 +#define F_TSRANGE_SUBDIFF 3929 +#define F_TSTZRANGE_SUBDIFF 3930 +#define F_JSONB_OBJECT_KEYS 3931 +#define F_JSONB_EACH_TEXT 3932 +#define F_TSRANGE_TIMESTAMP_TIMESTAMP 3933 +#define F_TSRANGE_TIMESTAMP_TIMESTAMP_TEXT 3934 +#define F_PG_SLEEP_FOR 3935 +#define F_PG_SLEEP_UNTIL 3936 +#define F_TSTZRANGE_TIMESTAMPTZ_TIMESTAMPTZ 3937 +#define F_TSTZRANGE_TIMESTAMPTZ_TIMESTAMPTZ_TEXT 3938 +#define F_MXID_AGE 3939 +#define F_JSONB_EXTRACT_PATH_TEXT 3940 +#define F_DATERANGE_DATE_DATE 3941 +#define F_DATERANGE_DATE_DATE_TEXT 3942 +#define F_ACLDEFAULT 3943 +#define F_TIME_SUPPORT 3944 +#define F_INT8RANGE_INT8_INT8 3945 +#define F_INT8RANGE_INT8_INT8_TEXT 3946 +#define F_JSON_OBJECT_FIELD 3947 +#define F_JSON_OBJECT_FIELD_TEXT 3948 +#define F_JSON_ARRAY_ELEMENT 3949 +#define F_JSON_ARRAY_ELEMENT_TEXT 3950 +#define F_JSON_EXTRACT_PATH 3951 +#define F_BRIN_SUMMARIZE_NEW_VALUES 3952 +#define F_JSON_EXTRACT_PATH_TEXT 3953 +#define F_PG_GET_OBJECT_ADDRESS 3954 +#define F_JSON_ARRAY_ELEMENTS 3955 +#define F_JSON_ARRAY_LENGTH 3956 +#define F_JSON_OBJECT_KEYS 3957 +#define F_JSON_EACH 3958 +#define F_JSON_EACH_TEXT 3959 +#define F_JSON_POPULATE_RECORD 3960 +#define F_JSON_POPULATE_RECORDSET 3961 +#define F_JSON_TYPEOF 3968 +#define F_JSON_ARRAY_ELEMENTS_TEXT 3969 +#define F_ORDERED_SET_TRANSITION 3970 +#define F_ORDERED_SET_TRANSITION_MULTI 3971 +#define F_PERCENTILE_DISC_FLOAT8_ANYELEMENT 3972 +#define F_PERCENTILE_DISC_FINAL 3973 +#define F_PERCENTILE_CONT_FLOAT8_FLOAT8 3974 +#define F_PERCENTILE_CONT_FLOAT8_FINAL 3975 +#define F_PERCENTILE_CONT_FLOAT8_INTERVAL 3976 +#define F_PERCENTILE_CONT_INTERVAL_FINAL 3977 +#define F_PERCENTILE_DISC__FLOAT8_ANYELEMENT 3978 +#define F_PERCENTILE_DISC_MULTI_FINAL 3979 +#define F_PERCENTILE_CONT__FLOAT8_FLOAT8 3980 +#define F_PERCENTILE_CONT_FLOAT8_MULTI_FINAL 3981 +#define F_PERCENTILE_CONT__FLOAT8_INTERVAL 3982 +#define F_PERCENTILE_CONT_INTERVAL_MULTI_FINAL 3983 +#define F_MODE 3984 +#define F_MODE_FINAL 3985 +#define F_RANK_ANY 3986 +#define F_RANK_FINAL 3987 +#define F_PERCENT_RANK_ANY 3988 +#define F_PERCENT_RANK_FINAL 3989 +#define F_CUME_DIST_ANY 3990 +#define F_CUME_DIST_FINAL 3991 +#define F_DENSE_RANK_ANY 3992 +#define F_DENSE_RANK_FINAL 3993 +#define F_GENERATE_SERIES_INT4_SUPPORT 3994 +#define F_GENERATE_SERIES_INT8_SUPPORT 3995 +#define F_ARRAY_UNNEST_SUPPORT 3996 +#define F_GIST_BOX_DISTANCE 3998 +#define F_BRIN_SUMMARIZE_RANGE 3999 +#define F_JSONPATH_IN 4001 +#define F_JSONPATH_RECV 4002 +#define F_JSONPATH_OUT 4003 +#define F_JSONPATH_SEND 4004 +#define F_JSONB_PATH_EXISTS 4005 +#define F_JSONB_PATH_QUERY 4006 +#define F_JSONB_PATH_QUERY_ARRAY 4007 +#define F_JSONB_PATH_QUERY_FIRST 4008 +#define F_JSONB_PATH_MATCH 4009 +#define F_JSONB_PATH_EXISTS_OPR 4010 +#define F_JSONB_PATH_MATCH_OPR 4011 +#define F_BRIN_DESUMMARIZE_RANGE 4014 +#define F_SPG_QUAD_CONFIG 4018 +#define F_SPG_QUAD_CHOOSE 4019 +#define F_SPG_QUAD_PICKSPLIT 4020 +#define F_SPG_QUAD_INNER_CONSISTENT 4021 +#define F_SPG_QUAD_LEAF_CONSISTENT 4022 +#define F_SPG_KD_CONFIG 4023 +#define F_SPG_KD_CHOOSE 4024 +#define F_SPG_KD_PICKSPLIT 4025 +#define F_SPG_KD_INNER_CONSISTENT 4026 +#define F_SPG_TEXT_CONFIG 4027 +#define F_SPG_TEXT_CHOOSE 4028 +#define F_SPG_TEXT_PICKSPLIT 4029 +#define F_SPG_TEXT_INNER_CONSISTENT 4030 +#define F_SPG_TEXT_LEAF_CONSISTENT 4031 +#define F_PG_SEQUENCE_LAST_VALUE 4032 +#define F_JSONB_NE 4038 +#define F_JSONB_LT 4039 +#define F_JSONB_GT 4040 +#define F_JSONB_LE 4041 +#define F_JSONB_GE 4042 +#define F_JSONB_EQ 4043 +#define F_JSONB_CMP 4044 +#define F_JSONB_HASH 4045 +#define F_JSONB_CONTAINS 4046 +#define F_JSONB_EXISTS 4047 +#define F_JSONB_EXISTS_ANY 4048 +#define F_JSONB_EXISTS_ALL 4049 +#define F_JSONB_CONTAINED 4050 +#define F_ARRAY_AGG_ARRAY_TRANSFN 4051 +#define F_ARRAY_AGG_ARRAY_FINALFN 4052 +#define F_ARRAY_AGG_ANYARRAY 4053 +#define F_RANGE_MERGE_ANYRANGE_ANYRANGE 4057 +#define F_INET_MERGE 4063 +#define F_BOUND_BOX 4067 +#define F_INET_SAME_FAMILY 4071 +#define F_BINARY_UPGRADE_SET_RECORD_INIT_PRIVS 4083 +#define F_REGNAMESPACEIN 4084 +#define F_REGNAMESPACEOUT 4085 +#define F_TO_REGNAMESPACE 4086 +#define F_REGNAMESPACERECV 4087 +#define F_REGNAMESPACESEND 4088 +#define F_BOX_POINT 4091 +#define F_REGROLEOUT 4092 +#define F_TO_REGROLE 4093 +#define F_REGROLERECV 4094 +#define F_REGROLESEND 4095 +#define F_REGROLEIN 4098 +#define F_BINARY_UPGRADE_SET_MISSING_VALUE 4101 +#define F_BRIN_INCLUSION_OPCINFO 4105 +#define F_BRIN_INCLUSION_ADD_VALUE 4106 +#define F_BRIN_INCLUSION_CONSISTENT 4107 +#define F_BRIN_INCLUSION_UNION 4108 +#define F_MACADDR8_IN 4110 +#define F_MACADDR8_OUT 4111 +#define F_TRUNC_MACADDR8 4112 +#define F_MACADDR8_EQ 4113 +#define F_MACADDR8_LT 4114 +#define F_MACADDR8_LE 4115 +#define F_MACADDR8_GT 4116 +#define F_MACADDR8_GE 4117 +#define F_MACADDR8_NE 4118 +#define F_MACADDR8_CMP 4119 +#define F_MACADDR8_NOT 4120 +#define F_MACADDR8_AND 4121 +#define F_MACADDR8_OR 4122 +#define F_MACADDR8 4123 +#define F_MACADDR 4124 +#define F_MACADDR8_SET7BIT 4125 +#define F_IN_RANGE_INT8_INT8_INT8_BOOL_BOOL 4126 +#define F_IN_RANGE_INT4_INT4_INT8_BOOL_BOOL 4127 +#define F_IN_RANGE_INT4_INT4_INT4_BOOL_BOOL 4128 +#define F_IN_RANGE_INT4_INT4_INT2_BOOL_BOOL 4129 +#define F_IN_RANGE_INT2_INT2_INT8_BOOL_BOOL 4130 +#define F_IN_RANGE_INT2_INT2_INT4_BOOL_BOOL 4131 +#define F_IN_RANGE_INT2_INT2_INT2_BOOL_BOOL 4132 +#define F_IN_RANGE_DATE_DATE_INTERVAL_BOOL_BOOL 4133 +#define F_IN_RANGE_TIMESTAMP_TIMESTAMP_INTERVAL_BOOL_BOOL 4134 +#define F_IN_RANGE_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL_BOOL_BOOL 4135 +#define F_IN_RANGE_INTERVAL_INTERVAL_INTERVAL_BOOL_BOOL 4136 +#define F_IN_RANGE_TIME_TIME_INTERVAL_BOOL_BOOL 4137 +#define F_IN_RANGE_TIMETZ_TIMETZ_INTERVAL_BOOL_BOOL 4138 +#define F_IN_RANGE_FLOAT8_FLOAT8_FLOAT8_BOOL_BOOL 4139 +#define F_IN_RANGE_FLOAT4_FLOAT4_FLOAT8_BOOL_BOOL 4140 +#define F_IN_RANGE_NUMERIC_NUMERIC_NUMERIC_BOOL_BOOL 4141 +#define F_PG_LSN_LARGER 4187 +#define F_PG_LSN_SMALLER 4188 +#define F_MAX_PG_LSN 4189 +#define F_MIN_PG_LSN 4190 +#define F_REGCOLLATIONIN 4193 +#define F_REGCOLLATIONOUT 4194 +#define F_TO_REGCOLLATION 4195 +#define F_REGCOLLATIONRECV 4196 +#define F_REGCOLLATIONSEND 4197 +#define F_TS_HEADLINE_REGCONFIG_JSONB_TSQUERY_TEXT 4201 +#define F_TS_HEADLINE_REGCONFIG_JSONB_TSQUERY 4202 +#define F_TS_HEADLINE_JSONB_TSQUERY_TEXT 4203 +#define F_TS_HEADLINE_JSONB_TSQUERY 4204 +#define F_TS_HEADLINE_REGCONFIG_JSON_TSQUERY_TEXT 4205 +#define F_TS_HEADLINE_REGCONFIG_JSON_TSQUERY 4206 +#define F_TS_HEADLINE_JSON_TSQUERY_TEXT 4207 +#define F_TS_HEADLINE_JSON_TSQUERY 4208 +#define F_TO_TSVECTOR_JSONB 4209 +#define F_TO_TSVECTOR_JSON 4210 +#define F_TO_TSVECTOR_REGCONFIG_JSONB 4211 +#define F_TO_TSVECTOR_REGCONFIG_JSON 4212 +#define F_JSONB_TO_TSVECTOR_JSONB_JSONB 4213 +#define F_JSONB_TO_TSVECTOR_REGCONFIG_JSONB_JSONB 4214 +#define F_JSON_TO_TSVECTOR_JSON_JSONB 4215 +#define F_JSON_TO_TSVECTOR_REGCONFIG_JSON_JSONB 4216 +#define F_PG_COPY_PHYSICAL_REPLICATION_SLOT_NAME_NAME_BOOL 4220 +#define F_PG_COPY_PHYSICAL_REPLICATION_SLOT_NAME_NAME 4221 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME_BOOL_NAME 4222 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME_BOOL 4223 +#define F_PG_COPY_LOGICAL_REPLICATION_SLOT_NAME_NAME 4224 +#define F_ANYCOMPATIBLEMULTIRANGE_IN 4226 +#define F_ANYCOMPATIBLEMULTIRANGE_OUT 4227 +#define F_RANGE_MERGE_ANYMULTIRANGE 4228 +#define F_ANYMULTIRANGE_IN 4229 +#define F_ANYMULTIRANGE_OUT 4230 +#define F_MULTIRANGE_IN 4231 +#define F_MULTIRANGE_OUT 4232 +#define F_MULTIRANGE_RECV 4233 +#define F_MULTIRANGE_SEND 4234 +#define F_LOWER_ANYMULTIRANGE 4235 +#define F_UPPER_ANYMULTIRANGE 4236 +#define F_ISEMPTY_ANYMULTIRANGE 4237 +#define F_LOWER_INC_ANYMULTIRANGE 4238 +#define F_UPPER_INC_ANYMULTIRANGE 4239 +#define F_LOWER_INF_ANYMULTIRANGE 4240 +#define F_UPPER_INF_ANYMULTIRANGE 4241 +#define F_MULTIRANGE_TYPANALYZE 4242 +#define F_MULTIRANGESEL 4243 +#define F_MULTIRANGE_EQ 4244 +#define F_MULTIRANGE_NE 4245 +#define F_RANGE_OVERLAPS_MULTIRANGE 4246 +#define F_MULTIRANGE_OVERLAPS_RANGE 4247 +#define F_MULTIRANGE_OVERLAPS_MULTIRANGE 4248 +#define F_MULTIRANGE_CONTAINS_ELEM 4249 +#define F_MULTIRANGE_CONTAINS_RANGE 4250 +#define F_MULTIRANGE_CONTAINS_MULTIRANGE 4251 +#define F_ELEM_CONTAINED_BY_MULTIRANGE 4252 +#define F_RANGE_CONTAINED_BY_MULTIRANGE 4253 +#define F_MULTIRANGE_CONTAINED_BY_MULTIRANGE 4254 +#define F_RANGE_ADJACENT_MULTIRANGE 4255 +#define F_MULTIRANGE_ADJACENT_MULTIRANGE 4256 +#define F_MULTIRANGE_ADJACENT_RANGE 4257 +#define F_RANGE_BEFORE_MULTIRANGE 4258 +#define F_MULTIRANGE_BEFORE_RANGE 4259 +#define F_MULTIRANGE_BEFORE_MULTIRANGE 4260 +#define F_RANGE_AFTER_MULTIRANGE 4261 +#define F_MULTIRANGE_AFTER_RANGE 4262 +#define F_MULTIRANGE_AFTER_MULTIRANGE 4263 +#define F_RANGE_OVERLEFT_MULTIRANGE 4264 +#define F_MULTIRANGE_OVERLEFT_RANGE 4265 +#define F_MULTIRANGE_OVERLEFT_MULTIRANGE 4266 +#define F_RANGE_OVERRIGHT_MULTIRANGE 4267 +#define F_MULTIRANGE_OVERRIGHT_RANGE 4268 +#define F_MULTIRANGE_OVERRIGHT_MULTIRANGE 4269 +#define F_MULTIRANGE_UNION 4270 +#define F_MULTIRANGE_MINUS 4271 +#define F_MULTIRANGE_INTERSECT 4272 +#define F_MULTIRANGE_CMP 4273 +#define F_MULTIRANGE_LT 4274 +#define F_MULTIRANGE_LE 4275 +#define F_MULTIRANGE_GE 4276 +#define F_MULTIRANGE_GT 4277 +#define F_HASH_MULTIRANGE 4278 +#define F_HASH_MULTIRANGE_EXTENDED 4279 +#define F_INT4MULTIRANGE_ 4280 +#define F_INT4MULTIRANGE_INT4RANGE 4281 +#define F_INT4MULTIRANGE__INT4RANGE 4282 +#define F_NUMMULTIRANGE_ 4283 +#define F_NUMMULTIRANGE_NUMRANGE 4284 +#define F_NUMMULTIRANGE__NUMRANGE 4285 +#define F_TSMULTIRANGE_ 4286 +#define F_TSMULTIRANGE_TSRANGE 4287 +#define F_TSMULTIRANGE__TSRANGE 4288 +#define F_TSTZMULTIRANGE_ 4289 +#define F_TSTZMULTIRANGE_TSTZRANGE 4290 +#define F_TSTZMULTIRANGE__TSTZRANGE 4291 +#define F_DATEMULTIRANGE_ 4292 +#define F_DATEMULTIRANGE_DATERANGE 4293 +#define F_DATEMULTIRANGE__DATERANGE 4294 +#define F_INT8MULTIRANGE_ 4295 +#define F_INT8MULTIRANGE_INT8RANGE 4296 +#define F_INT8MULTIRANGE__INT8RANGE 4297 +#define F_MULTIRANGE 4298 +#define F_RANGE_AGG_TRANSFN 4299 +#define F_RANGE_AGG_FINALFN 4300 +#define F_RANGE_AGG_ANYRANGE 4301 +#define F_KOI8R_TO_MIC 4302 +#define F_MIC_TO_KOI8R 4303 +#define F_ISO_TO_MIC 4304 +#define F_MIC_TO_ISO 4305 +#define F_WIN1251_TO_MIC 4306 +#define F_MIC_TO_WIN1251 4307 +#define F_WIN866_TO_MIC 4308 +#define F_MIC_TO_WIN866 4309 +#define F_KOI8R_TO_WIN1251 4310 +#define F_WIN1251_TO_KOI8R 4311 +#define F_KOI8R_TO_WIN866 4312 +#define F_WIN866_TO_KOI8R 4313 +#define F_WIN866_TO_WIN1251 4314 +#define F_WIN1251_TO_WIN866 4315 +#define F_ISO_TO_KOI8R 4316 +#define F_KOI8R_TO_ISO 4317 +#define F_ISO_TO_WIN1251 4318 +#define F_WIN1251_TO_ISO 4319 +#define F_ISO_TO_WIN866 4320 +#define F_WIN866_TO_ISO 4321 +#define F_EUC_CN_TO_MIC 4322 +#define F_MIC_TO_EUC_CN 4323 +#define F_EUC_JP_TO_SJIS 4324 +#define F_SJIS_TO_EUC_JP 4325 +#define F_EUC_JP_TO_MIC 4326 +#define F_SJIS_TO_MIC 4327 +#define F_MIC_TO_EUC_JP 4328 +#define F_MIC_TO_SJIS 4329 +#define F_EUC_KR_TO_MIC 4330 +#define F_MIC_TO_EUC_KR 4331 +#define F_EUC_TW_TO_BIG5 4332 +#define F_BIG5_TO_EUC_TW 4333 +#define F_EUC_TW_TO_MIC 4334 +#define F_BIG5_TO_MIC 4335 +#define F_MIC_TO_EUC_TW 4336 +#define F_MIC_TO_BIG5 4337 +#define F_LATIN2_TO_MIC 4338 +#define F_MIC_TO_LATIN2 4339 +#define F_WIN1250_TO_MIC 4340 +#define F_MIC_TO_WIN1250 4341 +#define F_LATIN2_TO_WIN1250 4342 +#define F_WIN1250_TO_LATIN2 4343 +#define F_LATIN1_TO_MIC 4344 +#define F_MIC_TO_LATIN1 4345 +#define F_LATIN3_TO_MIC 4346 +#define F_MIC_TO_LATIN3 4347 +#define F_LATIN4_TO_MIC 4348 +#define F_MIC_TO_LATIN4 4349 +#define F_NORMALIZE 4350 +#define F_IS_NORMALIZED 4351 +#define F_BIG5_TO_UTF8 4352 +#define F_UTF8_TO_BIG5 4353 +#define F_UTF8_TO_KOI8R 4354 +#define F_KOI8R_TO_UTF8 4355 +#define F_UTF8_TO_KOI8U 4356 +#define F_KOI8U_TO_UTF8 4357 +#define F_UTF8_TO_WIN 4358 +#define F_WIN_TO_UTF8 4359 +#define F_EUC_CN_TO_UTF8 4360 +#define F_UTF8_TO_EUC_CN 4361 +#define F_EUC_JP_TO_UTF8 4362 +#define F_UTF8_TO_EUC_JP 4363 +#define F_EUC_KR_TO_UTF8 4364 +#define F_UTF8_TO_EUC_KR 4365 +#define F_EUC_TW_TO_UTF8 4366 +#define F_UTF8_TO_EUC_TW 4367 +#define F_GB18030_TO_UTF8 4368 +#define F_UTF8_TO_GB18030 4369 +#define F_GBK_TO_UTF8 4370 +#define F_UTF8_TO_GBK 4371 +#define F_UTF8_TO_ISO8859 4372 +#define F_ISO8859_TO_UTF8 4373 +#define F_ISO8859_1_TO_UTF8 4374 +#define F_UTF8_TO_ISO8859_1 4375 +#define F_JOHAB_TO_UTF8 4376 +#define F_UTF8_TO_JOHAB 4377 +#define F_SJIS_TO_UTF8 4378 +#define F_UTF8_TO_SJIS 4379 +#define F_UHC_TO_UTF8 4380 +#define F_UTF8_TO_UHC 4381 +#define F_EUC_JIS_2004_TO_UTF8 4382 +#define F_UTF8_TO_EUC_JIS_2004 4383 +#define F_SHIFT_JIS_2004_TO_UTF8 4384 +#define F_UTF8_TO_SHIFT_JIS_2004 4385 +#define F_EUC_JIS_2004_TO_SHIFT_JIS_2004 4386 +#define F_SHIFT_JIS_2004_TO_EUC_JIS_2004 4387 +#define F_MULTIRANGE_INTERSECT_AGG_TRANSFN 4388 +#define F_RANGE_INTERSECT_AGG_ANYMULTIRANGE 4389 +#define F_BINARY_UPGRADE_SET_NEXT_MULTIRANGE_PG_TYPE_OID 4390 +#define F_BINARY_UPGRADE_SET_NEXT_MULTIRANGE_ARRAY_PG_TYPE_OID 4391 +#define F_RANGE_INTERSECT_AGG_TRANSFN 4401 +#define F_RANGE_INTERSECT_AGG_ANYRANGE 4450 +#define F_RANGE_CONTAINS_MULTIRANGE 4541 +#define F_MULTIRANGE_CONTAINED_BY_RANGE 4542 +#define F_PG_LOG_BACKEND_MEMORY_CONTEXTS 4543 +#define F_BINARY_UPGRADE_SET_NEXT_HEAP_RELFILENODE 4545 +#define F_BINARY_UPGRADE_SET_NEXT_INDEX_RELFILENODE 4546 +#define F_BINARY_UPGRADE_SET_NEXT_TOAST_RELFILENODE 4547 +#define F_BINARY_UPGRADE_SET_NEXT_PG_TABLESPACE_OID 4548 +#define F_UNICODE_VERSION 4549 +#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_OID 4566 +#define F_PG_EVENT_TRIGGER_TABLE_REWRITE_REASON 4567 +#define F_PG_EVENT_TRIGGER_DDL_COMMANDS 4568 +#define F_BRIN_BLOOM_OPCINFO 4591 +#define F_BRIN_BLOOM_ADD_VALUE 4592 +#define F_BRIN_BLOOM_CONSISTENT 4593 +#define F_BRIN_BLOOM_UNION 4594 +#define F_BRIN_BLOOM_OPTIONS 4595 +#define F_BRIN_BLOOM_SUMMARY_IN 4596 +#define F_BRIN_BLOOM_SUMMARY_OUT 4597 +#define F_BRIN_BLOOM_SUMMARY_RECV 4598 +#define F_BRIN_BLOOM_SUMMARY_SEND 4599 +#define F_BRIN_MINMAX_MULTI_OPCINFO 4616 +#define F_BRIN_MINMAX_MULTI_ADD_VALUE 4617 +#define F_BRIN_MINMAX_MULTI_CONSISTENT 4618 +#define F_BRIN_MINMAX_MULTI_UNION 4619 +#define F_BRIN_MINMAX_MULTI_OPTIONS 4620 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT2 4621 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT4 4622 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INT8 4623 +#define F_BRIN_MINMAX_MULTI_DISTANCE_FLOAT4 4624 +#define F_BRIN_MINMAX_MULTI_DISTANCE_FLOAT8 4625 +#define F_BRIN_MINMAX_MULTI_DISTANCE_NUMERIC 4626 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TID 4627 +#define F_BRIN_MINMAX_MULTI_DISTANCE_UUID 4628 +#define F_BRIN_MINMAX_MULTI_DISTANCE_DATE 4629 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIME 4630 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INTERVAL 4631 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIMETZ 4632 +#define F_BRIN_MINMAX_MULTI_DISTANCE_PG_LSN 4633 +#define F_BRIN_MINMAX_MULTI_DISTANCE_MACADDR 4634 +#define F_BRIN_MINMAX_MULTI_DISTANCE_MACADDR8 4635 +#define F_BRIN_MINMAX_MULTI_DISTANCE_INET 4636 +#define F_BRIN_MINMAX_MULTI_DISTANCE_TIMESTAMP 4637 +#define F_BRIN_MINMAX_MULTI_SUMMARY_IN 4638 +#define F_BRIN_MINMAX_MULTI_SUMMARY_OUT 4639 +#define F_BRIN_MINMAX_MULTI_SUMMARY_RECV 4640 +#define F_BRIN_MINMAX_MULTI_SUMMARY_SEND 4641 +#define F_PHRASETO_TSQUERY_TEXT 5001 +#define F_TSQUERY_PHRASE_TSQUERY_TSQUERY 5003 +#define F_TSQUERY_PHRASE_TSQUERY_TSQUERY_INT4 5004 +#define F_PHRASETO_TSQUERY_REGCONFIG_TEXT 5006 +#define F_WEBSEARCH_TO_TSQUERY_REGCONFIG_TEXT 5007 +#define F_WEBSEARCH_TO_TSQUERY_TEXT 5009 +#define F_SPG_BBOX_QUAD_CONFIG 5010 +#define F_SPG_POLY_QUAD_COMPRESS 5011 +#define F_SPG_BOX_QUAD_CONFIG 5012 +#define F_SPG_BOX_QUAD_CHOOSE 5013 +#define F_SPG_BOX_QUAD_PICKSPLIT 5014 +#define F_SPG_BOX_QUAD_INNER_CONSISTENT 5015 +#define F_SPG_BOX_QUAD_LEAF_CONSISTENT 5016 +#define F_PG_MCV_LIST_IN 5018 +#define F_PG_MCV_LIST_OUT 5019 +#define F_PG_MCV_LIST_RECV 5020 +#define F_PG_MCV_LIST_SEND 5021 +#define F_PG_LSN_PLI 5022 +#define F_NUMERIC_PL_PG_LSN 5023 +#define F_PG_LSN_MII 5024 +#define F_SATISFIES_HASH_PARTITION 5028 +#define F_PG_LS_TMPDIR_ 5029 +#define F_PG_LS_TMPDIR_OID 5030 +#define F_PG_LS_ARCHIVE_STATUSDIR 5031 +#define F_NETWORK_SORTSUPPORT 5033 +#define F_XID8LT 5034 +#define F_XID8GT 5035 +#define F_XID8LE 5036 +#define F_XID8GE 5037 +#define F_MATCHINGSEL 5040 +#define F_MATCHINGJOINSEL 5041 +#define F_MIN_SCALE 5042 +#define F_TRIM_SCALE 5043 +#define F_GCD_INT4_INT4 5044 +#define F_GCD_INT8_INT8 5045 +#define F_LCM_INT4_INT4 5046 +#define F_LCM_INT8_INT8 5047 +#define F_GCD_NUMERIC_NUMERIC 5048 +#define F_LCM_NUMERIC_NUMERIC 5049 +#define F_BTVARSTREQUALIMAGE 5050 +#define F_BTEQUALIMAGE 5051 +#define F_PG_GET_SHMEM_ALLOCATIONS 5052 +#define F_PG_STAT_GET_INS_SINCE_VACUUM 5053 +#define F_JSONB_SET_LAX 5054 +#define F_PG_SNAPSHOT_IN 5055 +#define F_PG_SNAPSHOT_OUT 5056 +#define F_PG_SNAPSHOT_RECV 5057 +#define F_PG_SNAPSHOT_SEND 5058 +#define F_PG_CURRENT_XACT_ID 5059 +#define F_PG_CURRENT_XACT_ID_IF_ASSIGNED 5060 +#define F_PG_CURRENT_SNAPSHOT 5061 +#define F_PG_SNAPSHOT_XMIN 5062 +#define F_PG_SNAPSHOT_XMAX 5063 +#define F_PG_SNAPSHOT_XIP 5064 +#define F_PG_VISIBLE_IN_SNAPSHOT 5065 +#define F_PG_XACT_STATUS 5066 +#define F_XID8IN 5070 +#define F_XID 5071 +#define F_XID8OUT 5081 +#define F_XID8RECV 5082 +#define F_XID8SEND 5083 +#define F_XID8EQ 5084 +#define F_XID8NE 5085 +#define F_ANYCOMPATIBLE_IN 5086 +#define F_ANYCOMPATIBLE_OUT 5087 +#define F_ANYCOMPATIBLEARRAY_IN 5088 +#define F_ANYCOMPATIBLEARRAY_OUT 5089 +#define F_ANYCOMPATIBLEARRAY_RECV 5090 +#define F_ANYCOMPATIBLEARRAY_SEND 5091 +#define F_ANYCOMPATIBLENONARRAY_IN 5092 +#define F_ANYCOMPATIBLENONARRAY_OUT 5093 +#define F_ANYCOMPATIBLERANGE_IN 5094 +#define F_ANYCOMPATIBLERANGE_OUT 5095 +#define F_XID8CMP 5096 +#define F_XID8_LARGER 5097 +#define F_XID8_SMALLER 5098 +#define F_MAX_XID8 5099 +#define F_MIN_XID8 5100 +#define F_PG_REPLICATION_ORIGIN_CREATE 6003 +#define F_PG_REPLICATION_ORIGIN_DROP 6004 +#define F_PG_REPLICATION_ORIGIN_OID 6005 +#define F_PG_REPLICATION_ORIGIN_SESSION_SETUP 6006 +#define F_PG_REPLICATION_ORIGIN_SESSION_RESET 6007 +#define F_PG_REPLICATION_ORIGIN_SESSION_IS_SETUP 6008 +#define F_PG_REPLICATION_ORIGIN_SESSION_PROGRESS 6009 +#define F_PG_REPLICATION_ORIGIN_XACT_SETUP 6010 +#define F_PG_REPLICATION_ORIGIN_XACT_RESET 6011 +#define F_PG_REPLICATION_ORIGIN_ADVANCE 6012 +#define F_PG_REPLICATION_ORIGIN_PROGRESS 6013 +#define F_PG_SHOW_REPLICATION_ORIGIN_STATUS 6014 +#define F_JSONB_SUBSCRIPT_HANDLER 6098 +#define F_ICU_UNICODE_VERSION 6099 +#define F_PG_LSN 6103 +#define F_UNICODE_ASSIGNED 6105 +#define F_PG_STAT_GET_BACKEND_SUBXACT 6107 +#define F_PG_STAT_GET_SUBSCRIPTION 6118 +#define F_PG_GET_PUBLICATION_TABLES 6119 +#define F_PG_GET_REPLICA_IDENTITY_INDEX 6120 +#define F_PG_RELATION_IS_PUBLISHABLE 6121 +#define F_MULTIRANGE_GIST_CONSISTENT 6154 +#define F_MULTIRANGE_GIST_COMPRESS 6156 +#define F_PG_GET_CATALOG_FOREIGN_KEYS 6159 +#define F_STRING_TO_TABLE_TEXT_TEXT 6160 +#define F_STRING_TO_TABLE_TEXT_TEXT_TEXT 6161 +#define F_BIT_COUNT_BIT 6162 +#define F_BIT_COUNT_BYTEA 6163 +#define F_BIT_XOR_INT2 6164 +#define F_BIT_XOR_INT4 6165 +#define F_BIT_XOR_INT8 6166 +#define F_BIT_XOR_BIT 6167 +#define F_PG_XACT_COMMIT_TIMESTAMP_ORIGIN 6168 +#define F_PG_STAT_GET_REPLICATION_SLOT 6169 +#define F_PG_STAT_RESET_REPLICATION_SLOT 6170 +#define F_TRIM_ARRAY 6172 +#define F_PG_GET_STATISTICSOBJDEF_EXPRESSIONS 6173 +#define F_PG_GET_STATISTICSOBJDEF_COLUMNS 6174 +#define F_DATE_BIN_INTERVAL_TIMESTAMP_TIMESTAMP 6177 +#define F_DATE_BIN_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ 6178 +#define F_ARRAY_SUBSCRIPT_HANDLER 6179 +#define F_RAW_ARRAY_SUBSCRIPT_HANDLER 6180 +#define F_TS_DEBUG_REGCONFIG_TEXT 6183 +#define F_TS_DEBUG_TEXT 6184 +#define F_PG_STAT_GET_DB_SESSION_TIME 6185 +#define F_PG_STAT_GET_DB_ACTIVE_TIME 6186 +#define F_PG_STAT_GET_DB_IDLE_IN_TRANSACTION_TIME 6187 +#define F_PG_STAT_GET_DB_SESSIONS 6188 +#define F_PG_STAT_GET_DB_SESSIONS_ABANDONED 6189 +#define F_PG_STAT_GET_DB_SESSIONS_FATAL 6190 +#define F_PG_STAT_GET_DB_SESSIONS_KILLED 6191 +#define F_HASH_RECORD 6192 +#define F_HASH_RECORD_EXTENDED 6193 +#define F_LTRIM_BYTEA_BYTEA 6195 +#define F_RTRIM_BYTEA_BYTEA 6196 +#define F_PG_GET_FUNCTION_SQLBODY 6197 +#define F_UNISTR 6198 +#define F_EXTRACT_TEXT_DATE 6199 +#define F_EXTRACT_TEXT_TIME 6200 +#define F_EXTRACT_TEXT_TIMETZ 6201 +#define F_EXTRACT_TEXT_TIMESTAMP 6202 +#define F_EXTRACT_TEXT_TIMESTAMPTZ 6203 +#define F_EXTRACT_TEXT_INTERVAL 6204 +#define F_HAS_PARAMETER_PRIVILEGE_NAME_TEXT_TEXT 6205 +#define F_HAS_PARAMETER_PRIVILEGE_OID_TEXT_TEXT 6206 +#define F_HAS_PARAMETER_PRIVILEGE_TEXT_TEXT 6207 +#define F_PG_READ_FILE_TEXT_BOOL 6208 +#define F_PG_READ_BINARY_FILE_TEXT_BOOL 6209 +#define F_PG_INPUT_IS_VALID 6210 +#define F_PG_INPUT_ERROR_INFO 6211 +#define F_RANDOM_NORMAL 6212 +#define F_PG_SPLIT_WALFILE_NAME 6213 +#define F_PG_STAT_GET_IO 6214 +#define F_ARRAY_SHUFFLE 6215 +#define F_ARRAY_SAMPLE 6216 +#define F_PG_STAT_GET_TUPLES_NEWPAGE_UPDATED 6217 +#define F_PG_STAT_GET_XACT_TUPLES_NEWPAGE_UPDATED 6218 +#define F_ERF 6219 +#define F_ERFC 6220 +#define F_DATE_ADD_TIMESTAMPTZ_INTERVAL 6221 +#define F_DATE_ADD_TIMESTAMPTZ_INTERVAL_TEXT 6222 +#define F_DATE_SUBTRACT_TIMESTAMPTZ_INTERVAL 6223 +#define F_PG_GET_WAL_RESOURCE_MANAGERS 6224 +#define F_MULTIRANGE_AGG_TRANSFN 6225 +#define F_MULTIRANGE_AGG_FINALFN 6226 +#define F_RANGE_AGG_ANYMULTIRANGE 6227 +#define F_PG_STAT_HAVE_STATS 6230 +#define F_PG_STAT_GET_SUBSCRIPTION_STATS 6231 +#define F_PG_STAT_RESET_SUBSCRIPTION_STATS 6232 +#define F_WINDOW_ROW_NUMBER_SUPPORT 6233 +#define F_WINDOW_RANK_SUPPORT 6234 +#define F_WINDOW_DENSE_RANK_SUPPORT 6235 +#define F_INT8INC_SUPPORT 6236 +#define F_PG_SETTINGS_GET_FLAGS 6240 +#define F_PG_STOP_MAKING_PINNED_OBJECTS 6241 +#define F_TEXT_STARTS_WITH_SUPPORT 6242 +#define F_PG_STAT_GET_RECOVERY_PREFETCH 6248 +#define F_PG_DATABASE_COLLATION_ACTUAL_VERSION 6249 +#define F_PG_IDENT_FILE_MAPPINGS 6250 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4_INT4_TEXT 6251 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4_INT4 6252 +#define F_REGEXP_REPLACE_TEXT_TEXT_TEXT_INT4 6253 +#define F_REGEXP_COUNT_TEXT_TEXT 6254 +#define F_REGEXP_COUNT_TEXT_TEXT_INT4 6255 +#define F_REGEXP_COUNT_TEXT_TEXT_INT4_TEXT 6256 +#define F_REGEXP_INSTR_TEXT_TEXT 6257 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4 6258 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4 6259 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4 6260 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4_TEXT 6261 +#define F_REGEXP_INSTR_TEXT_TEXT_INT4_INT4_INT4_TEXT_INT4 6262 +#define F_REGEXP_LIKE_TEXT_TEXT 6263 +#define F_REGEXP_LIKE_TEXT_TEXT_TEXT 6264 +#define F_REGEXP_SUBSTR_TEXT_TEXT 6265 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4 6266 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4 6267 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4_TEXT 6268 +#define F_REGEXP_SUBSTR_TEXT_TEXT_INT4_INT4_TEXT_INT4 6269 +#define F_PG_LS_LOGICALSNAPDIR 6270 +#define F_PG_LS_LOGICALMAPDIR 6271 +#define F_PG_LS_REPLSLOTDIR 6272 +#define F_DATE_SUBTRACT_TIMESTAMPTZ_INTERVAL_TEXT 6273 +#define F_GENERATE_SERIES_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL_TEXT 6274 +#define F_JSON_AGG_STRICT_TRANSFN 6275 +#define F_JSON_AGG_STRICT 6276 +#define F_JSON_OBJECT_AGG_STRICT_TRANSFN 6277 +#define F_JSON_OBJECT_AGG_UNIQUE_TRANSFN 6278 +#define F_JSON_OBJECT_AGG_UNIQUE_STRICT_TRANSFN 6279 +#define F_JSON_OBJECT_AGG_STRICT 6280 +#define F_JSON_OBJECT_AGG_UNIQUE 6281 +#define F_JSON_OBJECT_AGG_UNIQUE_STRICT 6282 +#define F_JSONB_AGG_STRICT_TRANSFN 6283 +#define F_JSONB_AGG_STRICT 6284 +#define F_JSONB_OBJECT_AGG_STRICT_TRANSFN 6285 +#define F_JSONB_OBJECT_AGG_UNIQUE_TRANSFN 6286 +#define F_JSONB_OBJECT_AGG_UNIQUE_STRICT_TRANSFN 6287 +#define F_JSONB_OBJECT_AGG_STRICT 6288 +#define F_JSONB_OBJECT_AGG_UNIQUE 6289 +#define F_JSONB_OBJECT_AGG_UNIQUE_STRICT 6290 +#define F_ANY_VALUE 6291 +#define F_ANY_VALUE_TRANSFN 6292 +#define F_ARRAY_AGG_COMBINE 6293 +#define F_ARRAY_AGG_SERIALIZE 6294 +#define F_ARRAY_AGG_DESERIALIZE 6295 +#define F_ARRAY_AGG_ARRAY_COMBINE 6296 +#define F_ARRAY_AGG_ARRAY_SERIALIZE 6297 +#define F_ARRAY_AGG_ARRAY_DESERIALIZE 6298 +#define F_STRING_AGG_COMBINE 6299 +#define F_STRING_AGG_SERIALIZE 6300 +#define F_STRING_AGG_DESERIALIZE 6301 +#define F_PG_LOG_STANDBY_SNAPSHOT 6305 +#define F_WINDOW_PERCENT_RANK_SUPPORT 6306 +#define F_WINDOW_CUME_DIST_SUPPORT 6307 +#define F_WINDOW_NTILE_SUPPORT 6308 +#define F_PG_STAT_GET_DB_CONFLICT_LOGICALSLOT 6309 +#define F_PG_STAT_GET_LASTSCAN 6310 +#define F_SYSTEM_USER 6311 +#define F_BINARY_UPGRADE_LOGICAL_SLOT_HAS_CAUGHT_UP 6312 +#define F_PG_STAT_GET_CHECKPOINTER_STAT_RESET_TIME 6314 +#define F_PG_BASETYPE 6315 +#define F_PG_COLUMN_TOAST_CHUNK_ID 6316 +#define F_TO_REGTYPEMOD 6317 +#define F_PG_GET_WAIT_EVENTS 6318 +#define F_BINARY_UPGRADE_ADD_SUB_REL_STATE 6319 +#define F_BINARY_UPGRADE_REPLORIGIN_ADVANCE 6320 +#define F_PG_AVAILABLE_WAL_SUMMARIES 6321 +#define F_PG_WAL_SUMMARY_CONTENTS 6322 +#define F_PG_GET_WAL_SUMMARIZER_STATE 6323 +#define F_INTERVAL_AVG_SERIALIZE 6324 +#define F_INTERVAL_AVG_DESERIALIZE 6325 +#define F_INTERVAL_SUM 6326 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_TIMED 6327 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_REQUESTED 6328 +#define F_PG_STAT_GET_CHECKPOINTER_RESTARTPOINTS_PERFORMED 6329 +#define F_TO_BIN_INT4 6330 +#define F_TO_BIN_INT8 6331 +#define F_TO_OCT_INT4 6332 +#define F_TO_OCT_INT8 6333 +#define F_TIMEZONE_TIMESTAMPTZ 6334 +#define F_TIMEZONE_TIMESTAMP 6335 +#define F_TIMEZONE_TIMETZ 6336 +#define F_JSONB_POPULATE_RECORD_VALID 6338 +#define F_RANDOM_INT4_INT4 6339 +#define F_RANDOM_INT8_INT8 6340 +#define F_RANDOM_NUMERIC_NUMERIC 6341 +#define F_UUID_EXTRACT_TIMESTAMP 6342 +#define F_UUID_EXTRACT_VERSION 6343 +#define F_PG_SYNC_REPLICATION_SLOTS 6344 +#define F_RANGE_CONTAINS_ELEM_SUPPORT 6345 +#define F_ELEM_CONTAINED_BY_RANGE_SUPPORT 6346 + +#endif /* FMGROIDS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/fmgrprotos.h b/platform/dbops/binaries/postgres/include/server/utils/fmgrprotos.h new file mode 100644 index 0000000000000000000000000000000000000000..bccdc4224a4f8dc9e95f5cc5f5884d041579f8ff --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/fmgrprotos.h @@ -0,0 +1,2904 @@ +/*------------------------------------------------------------------------- + * + * fmgrprotos.h + * Prototypes for built-in functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/Gen_fmgrtab.pl + * + *------------------------------------------------------------------------- + */ + +#ifndef FMGRPROTOS_H +#define FMGRPROTOS_H + +#include "fmgr.h" + +extern Datum heap_tableam_handler(PG_FUNCTION_ARGS); +extern Datum byteaout(PG_FUNCTION_ARGS); +extern Datum charout(PG_FUNCTION_ARGS); +extern Datum namein(PG_FUNCTION_ARGS); +extern Datum nameout(PG_FUNCTION_ARGS); +extern Datum int2in(PG_FUNCTION_ARGS); +extern Datum int2out(PG_FUNCTION_ARGS); +extern Datum int2vectorin(PG_FUNCTION_ARGS); +extern Datum int2vectorout(PG_FUNCTION_ARGS); +extern Datum int4in(PG_FUNCTION_ARGS); +extern Datum int4out(PG_FUNCTION_ARGS); +extern Datum regprocin(PG_FUNCTION_ARGS); +extern Datum regprocout(PG_FUNCTION_ARGS); +extern Datum textin(PG_FUNCTION_ARGS); +extern Datum textout(PG_FUNCTION_ARGS); +extern Datum tidin(PG_FUNCTION_ARGS); +extern Datum tidout(PG_FUNCTION_ARGS); +extern Datum xidin(PG_FUNCTION_ARGS); +extern Datum xidout(PG_FUNCTION_ARGS); +extern Datum cidin(PG_FUNCTION_ARGS); +extern Datum cidout(PG_FUNCTION_ARGS); +extern Datum oidvectorin(PG_FUNCTION_ARGS); +extern Datum oidvectorout(PG_FUNCTION_ARGS); +extern Datum boollt(PG_FUNCTION_ARGS); +extern Datum boolgt(PG_FUNCTION_ARGS); +extern Datum booleq(PG_FUNCTION_ARGS); +extern Datum chareq(PG_FUNCTION_ARGS); +extern Datum nameeq(PG_FUNCTION_ARGS); +extern Datum int2eq(PG_FUNCTION_ARGS); +extern Datum int2lt(PG_FUNCTION_ARGS); +extern Datum int4eq(PG_FUNCTION_ARGS); +extern Datum int4lt(PG_FUNCTION_ARGS); +extern Datum texteq(PG_FUNCTION_ARGS); +extern Datum xideq(PG_FUNCTION_ARGS); +extern Datum cideq(PG_FUNCTION_ARGS); +extern Datum charne(PG_FUNCTION_ARGS); +extern Datum charle(PG_FUNCTION_ARGS); +extern Datum chargt(PG_FUNCTION_ARGS); +extern Datum charge(PG_FUNCTION_ARGS); +extern Datum chartoi4(PG_FUNCTION_ARGS); +extern Datum i4tochar(PG_FUNCTION_ARGS); +extern Datum nameregexeq(PG_FUNCTION_ARGS); +extern Datum boolne(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_in(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_out(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_recv(PG_FUNCTION_ARGS); +extern Datum pgsql_version(PG_FUNCTION_ARGS); +extern Datum pg_ddl_command_send(PG_FUNCTION_ARGS); +extern Datum eqsel(PG_FUNCTION_ARGS); +extern Datum neqsel(PG_FUNCTION_ARGS); +extern Datum scalarltsel(PG_FUNCTION_ARGS); +extern Datum scalargtsel(PG_FUNCTION_ARGS); +extern Datum eqjoinsel(PG_FUNCTION_ARGS); +extern Datum neqjoinsel(PG_FUNCTION_ARGS); +extern Datum scalarltjoinsel(PG_FUNCTION_ARGS); +extern Datum scalargtjoinsel(PG_FUNCTION_ARGS); +extern Datum unknownin(PG_FUNCTION_ARGS); +extern Datum unknownout(PG_FUNCTION_ARGS); +extern Datum box_above_eq(PG_FUNCTION_ARGS); +extern Datum box_below_eq(PG_FUNCTION_ARGS); +extern Datum point_in(PG_FUNCTION_ARGS); +extern Datum point_out(PG_FUNCTION_ARGS); +extern Datum lseg_in(PG_FUNCTION_ARGS); +extern Datum lseg_out(PG_FUNCTION_ARGS); +extern Datum path_in(PG_FUNCTION_ARGS); +extern Datum path_out(PG_FUNCTION_ARGS); +extern Datum box_in(PG_FUNCTION_ARGS); +extern Datum box_out(PG_FUNCTION_ARGS); +extern Datum box_overlap(PG_FUNCTION_ARGS); +extern Datum box_ge(PG_FUNCTION_ARGS); +extern Datum box_gt(PG_FUNCTION_ARGS); +extern Datum box_eq(PG_FUNCTION_ARGS); +extern Datum box_lt(PG_FUNCTION_ARGS); +extern Datum box_le(PG_FUNCTION_ARGS); +extern Datum point_above(PG_FUNCTION_ARGS); +extern Datum point_left(PG_FUNCTION_ARGS); +extern Datum point_right(PG_FUNCTION_ARGS); +extern Datum point_below(PG_FUNCTION_ARGS); +extern Datum point_eq(PG_FUNCTION_ARGS); +extern Datum on_pb(PG_FUNCTION_ARGS); +extern Datum on_ppath(PG_FUNCTION_ARGS); +extern Datum box_center(PG_FUNCTION_ARGS); +extern Datum areasel(PG_FUNCTION_ARGS); +extern Datum areajoinsel(PG_FUNCTION_ARGS); +extern Datum int4mul(PG_FUNCTION_ARGS); +extern Datum int4ne(PG_FUNCTION_ARGS); +extern Datum int2ne(PG_FUNCTION_ARGS); +extern Datum int2gt(PG_FUNCTION_ARGS); +extern Datum int4gt(PG_FUNCTION_ARGS); +extern Datum int2le(PG_FUNCTION_ARGS); +extern Datum int4le(PG_FUNCTION_ARGS); +extern Datum int4ge(PG_FUNCTION_ARGS); +extern Datum int2ge(PG_FUNCTION_ARGS); +extern Datum int2mul(PG_FUNCTION_ARGS); +extern Datum int2div(PG_FUNCTION_ARGS); +extern Datum int4div(PG_FUNCTION_ARGS); +extern Datum int2mod(PG_FUNCTION_ARGS); +extern Datum int4mod(PG_FUNCTION_ARGS); +extern Datum textne(PG_FUNCTION_ARGS); +extern Datum int24eq(PG_FUNCTION_ARGS); +extern Datum int42eq(PG_FUNCTION_ARGS); +extern Datum int24lt(PG_FUNCTION_ARGS); +extern Datum int42lt(PG_FUNCTION_ARGS); +extern Datum int24gt(PG_FUNCTION_ARGS); +extern Datum int42gt(PG_FUNCTION_ARGS); +extern Datum int24ne(PG_FUNCTION_ARGS); +extern Datum int42ne(PG_FUNCTION_ARGS); +extern Datum int24le(PG_FUNCTION_ARGS); +extern Datum int42le(PG_FUNCTION_ARGS); +extern Datum int24ge(PG_FUNCTION_ARGS); +extern Datum int42ge(PG_FUNCTION_ARGS); +extern Datum int24mul(PG_FUNCTION_ARGS); +extern Datum int42mul(PG_FUNCTION_ARGS); +extern Datum int24div(PG_FUNCTION_ARGS); +extern Datum int42div(PG_FUNCTION_ARGS); +extern Datum int2pl(PG_FUNCTION_ARGS); +extern Datum int4pl(PG_FUNCTION_ARGS); +extern Datum int24pl(PG_FUNCTION_ARGS); +extern Datum int42pl(PG_FUNCTION_ARGS); +extern Datum int2mi(PG_FUNCTION_ARGS); +extern Datum int4mi(PG_FUNCTION_ARGS); +extern Datum int24mi(PG_FUNCTION_ARGS); +extern Datum int42mi(PG_FUNCTION_ARGS); +extern Datum oideq(PG_FUNCTION_ARGS); +extern Datum oidne(PG_FUNCTION_ARGS); +extern Datum box_same(PG_FUNCTION_ARGS); +extern Datum box_contain(PG_FUNCTION_ARGS); +extern Datum box_left(PG_FUNCTION_ARGS); +extern Datum box_overleft(PG_FUNCTION_ARGS); +extern Datum box_overright(PG_FUNCTION_ARGS); +extern Datum box_right(PG_FUNCTION_ARGS); +extern Datum box_contained(PG_FUNCTION_ARGS); +extern Datum box_contain_pt(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_in(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_out(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_recv(PG_FUNCTION_ARGS); +extern Datum pg_node_tree_send(PG_FUNCTION_ARGS); +extern Datum float4in(PG_FUNCTION_ARGS); +extern Datum float4out(PG_FUNCTION_ARGS); +extern Datum float4mul(PG_FUNCTION_ARGS); +extern Datum float4div(PG_FUNCTION_ARGS); +extern Datum float4pl(PG_FUNCTION_ARGS); +extern Datum float4mi(PG_FUNCTION_ARGS); +extern Datum float4um(PG_FUNCTION_ARGS); +extern Datum float4abs(PG_FUNCTION_ARGS); +extern Datum float4_accum(PG_FUNCTION_ARGS); +extern Datum float4larger(PG_FUNCTION_ARGS); +extern Datum float4smaller(PG_FUNCTION_ARGS); +extern Datum int4um(PG_FUNCTION_ARGS); +extern Datum int2um(PG_FUNCTION_ARGS); +extern Datum float8in(PG_FUNCTION_ARGS); +extern Datum float8out(PG_FUNCTION_ARGS); +extern Datum float8mul(PG_FUNCTION_ARGS); +extern Datum float8div(PG_FUNCTION_ARGS); +extern Datum float8pl(PG_FUNCTION_ARGS); +extern Datum float8mi(PG_FUNCTION_ARGS); +extern Datum float8um(PG_FUNCTION_ARGS); +extern Datum float8abs(PG_FUNCTION_ARGS); +extern Datum float8_accum(PG_FUNCTION_ARGS); +extern Datum float8larger(PG_FUNCTION_ARGS); +extern Datum float8smaller(PG_FUNCTION_ARGS); +extern Datum lseg_center(PG_FUNCTION_ARGS); +extern Datum poly_center(PG_FUNCTION_ARGS); +extern Datum dround(PG_FUNCTION_ARGS); +extern Datum dtrunc(PG_FUNCTION_ARGS); +extern Datum dsqrt(PG_FUNCTION_ARGS); +extern Datum dcbrt(PG_FUNCTION_ARGS); +extern Datum dpow(PG_FUNCTION_ARGS); +extern Datum dexp(PG_FUNCTION_ARGS); +extern Datum dlog1(PG_FUNCTION_ARGS); +extern Datum i2tod(PG_FUNCTION_ARGS); +extern Datum i2tof(PG_FUNCTION_ARGS); +extern Datum dtoi2(PG_FUNCTION_ARGS); +extern Datum ftoi2(PG_FUNCTION_ARGS); +extern Datum line_distance(PG_FUNCTION_ARGS); +extern Datum nameeqtext(PG_FUNCTION_ARGS); +extern Datum namelttext(PG_FUNCTION_ARGS); +extern Datum nameletext(PG_FUNCTION_ARGS); +extern Datum namegetext(PG_FUNCTION_ARGS); +extern Datum namegttext(PG_FUNCTION_ARGS); +extern Datum namenetext(PG_FUNCTION_ARGS); +extern Datum btnametextcmp(PG_FUNCTION_ARGS); +extern Datum texteqname(PG_FUNCTION_ARGS); +extern Datum textltname(PG_FUNCTION_ARGS); +extern Datum textlename(PG_FUNCTION_ARGS); +extern Datum textgename(PG_FUNCTION_ARGS); +extern Datum textgtname(PG_FUNCTION_ARGS); +extern Datum textnename(PG_FUNCTION_ARGS); +extern Datum bttextnamecmp(PG_FUNCTION_ARGS); +extern Datum nameconcatoid(PG_FUNCTION_ARGS); +extern Datum table_am_handler_in(PG_FUNCTION_ARGS); +extern Datum table_am_handler_out(PG_FUNCTION_ARGS); +extern Datum timeofday(PG_FUNCTION_ARGS); +extern Datum pg_nextoid(PG_FUNCTION_ARGS); +extern Datum float8_combine(PG_FUNCTION_ARGS); +extern Datum inter_sl(PG_FUNCTION_ARGS); +extern Datum inter_lb(PG_FUNCTION_ARGS); +extern Datum float48mul(PG_FUNCTION_ARGS); +extern Datum float48div(PG_FUNCTION_ARGS); +extern Datum float48pl(PG_FUNCTION_ARGS); +extern Datum float48mi(PG_FUNCTION_ARGS); +extern Datum float84mul(PG_FUNCTION_ARGS); +extern Datum float84div(PG_FUNCTION_ARGS); +extern Datum float84pl(PG_FUNCTION_ARGS); +extern Datum float84mi(PG_FUNCTION_ARGS); +extern Datum float4eq(PG_FUNCTION_ARGS); +extern Datum float4ne(PG_FUNCTION_ARGS); +extern Datum float4lt(PG_FUNCTION_ARGS); +extern Datum float4le(PG_FUNCTION_ARGS); +extern Datum float4gt(PG_FUNCTION_ARGS); +extern Datum float4ge(PG_FUNCTION_ARGS); +extern Datum float8eq(PG_FUNCTION_ARGS); +extern Datum float8ne(PG_FUNCTION_ARGS); +extern Datum float8lt(PG_FUNCTION_ARGS); +extern Datum float8le(PG_FUNCTION_ARGS); +extern Datum float8gt(PG_FUNCTION_ARGS); +extern Datum float8ge(PG_FUNCTION_ARGS); +extern Datum float48eq(PG_FUNCTION_ARGS); +extern Datum float48ne(PG_FUNCTION_ARGS); +extern Datum float48lt(PG_FUNCTION_ARGS); +extern Datum float48le(PG_FUNCTION_ARGS); +extern Datum float48gt(PG_FUNCTION_ARGS); +extern Datum float48ge(PG_FUNCTION_ARGS); +extern Datum float84eq(PG_FUNCTION_ARGS); +extern Datum float84ne(PG_FUNCTION_ARGS); +extern Datum float84lt(PG_FUNCTION_ARGS); +extern Datum float84le(PG_FUNCTION_ARGS); +extern Datum float84gt(PG_FUNCTION_ARGS); +extern Datum float84ge(PG_FUNCTION_ARGS); +extern Datum ftod(PG_FUNCTION_ARGS); +extern Datum dtof(PG_FUNCTION_ARGS); +extern Datum i2toi4(PG_FUNCTION_ARGS); +extern Datum i4toi2(PG_FUNCTION_ARGS); +extern Datum pg_jit_available(PG_FUNCTION_ARGS); +extern Datum i4tod(PG_FUNCTION_ARGS); +extern Datum dtoi4(PG_FUNCTION_ARGS); +extern Datum i4tof(PG_FUNCTION_ARGS); +extern Datum ftoi4(PG_FUNCTION_ARGS); +extern Datum width_bucket_float8(PG_FUNCTION_ARGS); +extern Datum json_in(PG_FUNCTION_ARGS); +extern Datum json_out(PG_FUNCTION_ARGS); +extern Datum json_recv(PG_FUNCTION_ARGS); +extern Datum json_send(PG_FUNCTION_ARGS); +extern Datum index_am_handler_in(PG_FUNCTION_ARGS); +extern Datum index_am_handler_out(PG_FUNCTION_ARGS); +extern Datum hashmacaddr8(PG_FUNCTION_ARGS); +extern Datum hash_aclitem(PG_FUNCTION_ARGS); +extern Datum bthandler(PG_FUNCTION_ARGS); +extern Datum hashhandler(PG_FUNCTION_ARGS); +extern Datum gisthandler(PG_FUNCTION_ARGS); +extern Datum ginhandler(PG_FUNCTION_ARGS); +extern Datum spghandler(PG_FUNCTION_ARGS); +extern Datum brinhandler(PG_FUNCTION_ARGS); +extern Datum scalarlesel(PG_FUNCTION_ARGS); +extern Datum scalargesel(PG_FUNCTION_ARGS); +extern Datum amvalidate(PG_FUNCTION_ARGS); +extern Datum poly_same(PG_FUNCTION_ARGS); +extern Datum poly_contain(PG_FUNCTION_ARGS); +extern Datum poly_left(PG_FUNCTION_ARGS); +extern Datum poly_overleft(PG_FUNCTION_ARGS); +extern Datum poly_overright(PG_FUNCTION_ARGS); +extern Datum poly_right(PG_FUNCTION_ARGS); +extern Datum poly_contained(PG_FUNCTION_ARGS); +extern Datum poly_overlap(PG_FUNCTION_ARGS); +extern Datum poly_in(PG_FUNCTION_ARGS); +extern Datum poly_out(PG_FUNCTION_ARGS); +extern Datum btint2cmp(PG_FUNCTION_ARGS); +extern Datum btint4cmp(PG_FUNCTION_ARGS); +extern Datum btfloat4cmp(PG_FUNCTION_ARGS); +extern Datum btfloat8cmp(PG_FUNCTION_ARGS); +extern Datum btoidcmp(PG_FUNCTION_ARGS); +extern Datum dist_bp(PG_FUNCTION_ARGS); +extern Datum btcharcmp(PG_FUNCTION_ARGS); +extern Datum btnamecmp(PG_FUNCTION_ARGS); +extern Datum bttextcmp(PG_FUNCTION_ARGS); +extern Datum lseg_distance(PG_FUNCTION_ARGS); +extern Datum lseg_interpt(PG_FUNCTION_ARGS); +extern Datum dist_ps(PG_FUNCTION_ARGS); +extern Datum dist_pb(PG_FUNCTION_ARGS); +extern Datum dist_sb(PG_FUNCTION_ARGS); +extern Datum close_ps(PG_FUNCTION_ARGS); +extern Datum close_pb(PG_FUNCTION_ARGS); +extern Datum close_sb(PG_FUNCTION_ARGS); +extern Datum on_ps(PG_FUNCTION_ARGS); +extern Datum path_distance(PG_FUNCTION_ARGS); +extern Datum dist_ppath(PG_FUNCTION_ARGS); +extern Datum on_sb(PG_FUNCTION_ARGS); +extern Datum inter_sb(PG_FUNCTION_ARGS); +extern Datum text_to_array_null(PG_FUNCTION_ARGS); +extern Datum cash_cmp(PG_FUNCTION_ARGS); +extern Datum array_append(PG_FUNCTION_ARGS); +extern Datum array_prepend(PG_FUNCTION_ARGS); +extern Datum dist_sp(PG_FUNCTION_ARGS); +extern Datum dist_bs(PG_FUNCTION_ARGS); +extern Datum btarraycmp(PG_FUNCTION_ARGS); +extern Datum array_cat(PG_FUNCTION_ARGS); +extern Datum array_to_text_null(PG_FUNCTION_ARGS); +extern Datum scalarlejoinsel(PG_FUNCTION_ARGS); +extern Datum array_ne(PG_FUNCTION_ARGS); +extern Datum array_lt(PG_FUNCTION_ARGS); +extern Datum array_gt(PG_FUNCTION_ARGS); +extern Datum array_le(PG_FUNCTION_ARGS); +extern Datum text_to_array(PG_FUNCTION_ARGS); +extern Datum array_to_text(PG_FUNCTION_ARGS); +extern Datum array_ge(PG_FUNCTION_ARGS); +extern Datum scalargejoinsel(PG_FUNCTION_ARGS); +extern Datum hashmacaddr(PG_FUNCTION_ARGS); +extern Datum hashtext(PG_FUNCTION_ARGS); +extern Datum rtrim1(PG_FUNCTION_ARGS); +extern Datum btoidvectorcmp(PG_FUNCTION_ARGS); +extern Datum name_text(PG_FUNCTION_ARGS); +extern Datum text_name(PG_FUNCTION_ARGS); +extern Datum name_bpchar(PG_FUNCTION_ARGS); +extern Datum bpchar_name(PG_FUNCTION_ARGS); +extern Datum dist_pathp(PG_FUNCTION_ARGS); +extern Datum hashinet(PG_FUNCTION_ARGS); +extern Datum hashint4extended(PG_FUNCTION_ARGS); +extern Datum hash_numeric(PG_FUNCTION_ARGS); +extern Datum macaddr_in(PG_FUNCTION_ARGS); +extern Datum macaddr_out(PG_FUNCTION_ARGS); +extern Datum pg_num_nulls(PG_FUNCTION_ARGS); +extern Datum pg_num_nonnulls(PG_FUNCTION_ARGS); +extern Datum hashint2extended(PG_FUNCTION_ARGS); +extern Datum hashint8extended(PG_FUNCTION_ARGS); +extern Datum hashfloat4extended(PG_FUNCTION_ARGS); +extern Datum hashfloat8extended(PG_FUNCTION_ARGS); +extern Datum hashoidextended(PG_FUNCTION_ARGS); +extern Datum hashcharextended(PG_FUNCTION_ARGS); +extern Datum hashnameextended(PG_FUNCTION_ARGS); +extern Datum hashtextextended(PG_FUNCTION_ARGS); +extern Datum hashint2(PG_FUNCTION_ARGS); +extern Datum hashint4(PG_FUNCTION_ARGS); +extern Datum hashfloat4(PG_FUNCTION_ARGS); +extern Datum hashfloat8(PG_FUNCTION_ARGS); +extern Datum hashoid(PG_FUNCTION_ARGS); +extern Datum hashchar(PG_FUNCTION_ARGS); +extern Datum hashname(PG_FUNCTION_ARGS); +extern Datum hashvarlena(PG_FUNCTION_ARGS); +extern Datum hashoidvector(PG_FUNCTION_ARGS); +extern Datum text_larger(PG_FUNCTION_ARGS); +extern Datum text_smaller(PG_FUNCTION_ARGS); +extern Datum int8in(PG_FUNCTION_ARGS); +extern Datum int8out(PG_FUNCTION_ARGS); +extern Datum int8um(PG_FUNCTION_ARGS); +extern Datum int8pl(PG_FUNCTION_ARGS); +extern Datum int8mi(PG_FUNCTION_ARGS); +extern Datum int8mul(PG_FUNCTION_ARGS); +extern Datum int8div(PG_FUNCTION_ARGS); +extern Datum int8eq(PG_FUNCTION_ARGS); +extern Datum int8ne(PG_FUNCTION_ARGS); +extern Datum int8lt(PG_FUNCTION_ARGS); +extern Datum int8gt(PG_FUNCTION_ARGS); +extern Datum int8le(PG_FUNCTION_ARGS); +extern Datum int8ge(PG_FUNCTION_ARGS); +extern Datum int84eq(PG_FUNCTION_ARGS); +extern Datum int84ne(PG_FUNCTION_ARGS); +extern Datum int84lt(PG_FUNCTION_ARGS); +extern Datum int84gt(PG_FUNCTION_ARGS); +extern Datum int84le(PG_FUNCTION_ARGS); +extern Datum int84ge(PG_FUNCTION_ARGS); +extern Datum int84(PG_FUNCTION_ARGS); +extern Datum int48(PG_FUNCTION_ARGS); +extern Datum i8tod(PG_FUNCTION_ARGS); +extern Datum dtoi8(PG_FUNCTION_ARGS); +extern Datum array_larger(PG_FUNCTION_ARGS); +extern Datum array_smaller(PG_FUNCTION_ARGS); +extern Datum inet_abbrev(PG_FUNCTION_ARGS); +extern Datum cidr_abbrev(PG_FUNCTION_ARGS); +extern Datum inet_set_masklen(PG_FUNCTION_ARGS); +extern Datum oidvectorne(PG_FUNCTION_ARGS); +extern Datum hash_array(PG_FUNCTION_ARGS); +extern Datum cidr_set_masklen(PG_FUNCTION_ARGS); +extern Datum pg_indexam_has_property(PG_FUNCTION_ARGS); +extern Datum pg_index_has_property(PG_FUNCTION_ARGS); +extern Datum pg_index_column_has_property(PG_FUNCTION_ARGS); +extern Datum i8tof(PG_FUNCTION_ARGS); +extern Datum ftoi8(PG_FUNCTION_ARGS); +extern Datum namelt(PG_FUNCTION_ARGS); +extern Datum namele(PG_FUNCTION_ARGS); +extern Datum namegt(PG_FUNCTION_ARGS); +extern Datum namege(PG_FUNCTION_ARGS); +extern Datum namene(PG_FUNCTION_ARGS); +extern Datum bpchar(PG_FUNCTION_ARGS); +extern Datum varchar(PG_FUNCTION_ARGS); +extern Datum pg_indexam_progress_phasename(PG_FUNCTION_ARGS); +extern Datum oidvectorlt(PG_FUNCTION_ARGS); +extern Datum oidvectorle(PG_FUNCTION_ARGS); +extern Datum oidvectoreq(PG_FUNCTION_ARGS); +extern Datum oidvectorge(PG_FUNCTION_ARGS); +extern Datum oidvectorgt(PG_FUNCTION_ARGS); +extern Datum network_network(PG_FUNCTION_ARGS); +extern Datum network_netmask(PG_FUNCTION_ARGS); +extern Datum network_masklen(PG_FUNCTION_ARGS); +extern Datum network_broadcast(PG_FUNCTION_ARGS); +extern Datum network_host(PG_FUNCTION_ARGS); +extern Datum dist_lp(PG_FUNCTION_ARGS); +extern Datum dist_ls(PG_FUNCTION_ARGS); +extern Datum current_user(PG_FUNCTION_ARGS); +extern Datum network_family(PG_FUNCTION_ARGS); +extern Datum int82(PG_FUNCTION_ARGS); +extern Datum be_lo_create(PG_FUNCTION_ARGS); +extern Datum oidlt(PG_FUNCTION_ARGS); +extern Datum oidle(PG_FUNCTION_ARGS); +extern Datum byteaoctetlen(PG_FUNCTION_ARGS); +extern Datum byteaGetByte(PG_FUNCTION_ARGS); +extern Datum byteaSetByte(PG_FUNCTION_ARGS); +extern Datum byteaGetBit(PG_FUNCTION_ARGS); +extern Datum byteaSetBit(PG_FUNCTION_ARGS); +extern Datum dist_pl(PG_FUNCTION_ARGS); +extern Datum dist_sl(PG_FUNCTION_ARGS); +extern Datum dist_cpoly(PG_FUNCTION_ARGS); +extern Datum poly_distance(PG_FUNCTION_ARGS); +extern Datum network_show(PG_FUNCTION_ARGS); +extern Datum text_lt(PG_FUNCTION_ARGS); +extern Datum text_le(PG_FUNCTION_ARGS); +extern Datum text_gt(PG_FUNCTION_ARGS); +extern Datum text_ge(PG_FUNCTION_ARGS); +extern Datum array_eq(PG_FUNCTION_ARGS); +extern Datum session_user(PG_FUNCTION_ARGS); +extern Datum array_dims(PG_FUNCTION_ARGS); +extern Datum array_ndims(PG_FUNCTION_ARGS); +extern Datum byteaoverlay(PG_FUNCTION_ARGS); +extern Datum array_in(PG_FUNCTION_ARGS); +extern Datum array_out(PG_FUNCTION_ARGS); +extern Datum byteaoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum macaddr_trunc(PG_FUNCTION_ARGS); +extern Datum int28(PG_FUNCTION_ARGS); +extern Datum be_lo_import(PG_FUNCTION_ARGS); +extern Datum be_lo_export(PG_FUNCTION_ARGS); +extern Datum int4inc(PG_FUNCTION_ARGS); +extern Datum be_lo_import_with_oid(PG_FUNCTION_ARGS); +extern Datum int4larger(PG_FUNCTION_ARGS); +extern Datum int4smaller(PG_FUNCTION_ARGS); +extern Datum int2larger(PG_FUNCTION_ARGS); +extern Datum int2smaller(PG_FUNCTION_ARGS); +extern Datum hashvarlenaextended(PG_FUNCTION_ARGS); +extern Datum hashoidvectorextended(PG_FUNCTION_ARGS); +extern Datum hash_aclitem_extended(PG_FUNCTION_ARGS); +extern Datum hashmacaddrextended(PG_FUNCTION_ARGS); +extern Datum hashinetextended(PG_FUNCTION_ARGS); +extern Datum hash_numeric_extended(PG_FUNCTION_ARGS); +extern Datum hashmacaddr8extended(PG_FUNCTION_ARGS); +extern Datum hash_array_extended(PG_FUNCTION_ARGS); +extern Datum dist_polyc(PG_FUNCTION_ARGS); +extern Datum pg_client_encoding(PG_FUNCTION_ARGS); +extern Datum current_query(PG_FUNCTION_ARGS); +extern Datum macaddr_eq(PG_FUNCTION_ARGS); +extern Datum macaddr_lt(PG_FUNCTION_ARGS); +extern Datum macaddr_le(PG_FUNCTION_ARGS); +extern Datum macaddr_gt(PG_FUNCTION_ARGS); +extern Datum macaddr_ge(PG_FUNCTION_ARGS); +extern Datum macaddr_ne(PG_FUNCTION_ARGS); +extern Datum macaddr_cmp(PG_FUNCTION_ARGS); +extern Datum int82pl(PG_FUNCTION_ARGS); +extern Datum int82mi(PG_FUNCTION_ARGS); +extern Datum int82mul(PG_FUNCTION_ARGS); +extern Datum int82div(PG_FUNCTION_ARGS); +extern Datum int28pl(PG_FUNCTION_ARGS); +extern Datum btint8cmp(PG_FUNCTION_ARGS); +extern Datum cash_mul_flt4(PG_FUNCTION_ARGS); +extern Datum cash_div_flt4(PG_FUNCTION_ARGS); +extern Datum flt4_mul_cash(PG_FUNCTION_ARGS); +extern Datum textpos(PG_FUNCTION_ARGS); +extern Datum textlike(PG_FUNCTION_ARGS); +extern Datum textnlike(PG_FUNCTION_ARGS); +extern Datum int48eq(PG_FUNCTION_ARGS); +extern Datum int48ne(PG_FUNCTION_ARGS); +extern Datum int48lt(PG_FUNCTION_ARGS); +extern Datum int48gt(PG_FUNCTION_ARGS); +extern Datum int48le(PG_FUNCTION_ARGS); +extern Datum int48ge(PG_FUNCTION_ARGS); +extern Datum namelike(PG_FUNCTION_ARGS); +extern Datum namenlike(PG_FUNCTION_ARGS); +extern Datum char_bpchar(PG_FUNCTION_ARGS); +extern Datum current_database(PG_FUNCTION_ARGS); +extern Datum int4_mul_cash(PG_FUNCTION_ARGS); +extern Datum int2_mul_cash(PG_FUNCTION_ARGS); +extern Datum cash_mul_int4(PG_FUNCTION_ARGS); +extern Datum cash_div_int4(PG_FUNCTION_ARGS); +extern Datum cash_mul_int2(PG_FUNCTION_ARGS); +extern Datum cash_div_int2(PG_FUNCTION_ARGS); +extern Datum lower(PG_FUNCTION_ARGS); +extern Datum upper(PG_FUNCTION_ARGS); +extern Datum initcap(PG_FUNCTION_ARGS); +extern Datum lpad(PG_FUNCTION_ARGS); +extern Datum rpad(PG_FUNCTION_ARGS); +extern Datum ltrim(PG_FUNCTION_ARGS); +extern Datum rtrim(PG_FUNCTION_ARGS); +extern Datum text_substr(PG_FUNCTION_ARGS); +extern Datum translate(PG_FUNCTION_ARGS); +extern Datum ltrim1(PG_FUNCTION_ARGS); +extern Datum text_substr_no_len(PG_FUNCTION_ARGS); +extern Datum btrim(PG_FUNCTION_ARGS); +extern Datum btrim1(PG_FUNCTION_ARGS); +extern Datum cash_in(PG_FUNCTION_ARGS); +extern Datum cash_out(PG_FUNCTION_ARGS); +extern Datum cash_eq(PG_FUNCTION_ARGS); +extern Datum cash_ne(PG_FUNCTION_ARGS); +extern Datum cash_lt(PG_FUNCTION_ARGS); +extern Datum cash_le(PG_FUNCTION_ARGS); +extern Datum cash_gt(PG_FUNCTION_ARGS); +extern Datum cash_ge(PG_FUNCTION_ARGS); +extern Datum cash_pl(PG_FUNCTION_ARGS); +extern Datum cash_mi(PG_FUNCTION_ARGS); +extern Datum cash_mul_flt8(PG_FUNCTION_ARGS); +extern Datum cash_div_flt8(PG_FUNCTION_ARGS); +extern Datum cashlarger(PG_FUNCTION_ARGS); +extern Datum cashsmaller(PG_FUNCTION_ARGS); +extern Datum inet_in(PG_FUNCTION_ARGS); +extern Datum inet_out(PG_FUNCTION_ARGS); +extern Datum flt8_mul_cash(PG_FUNCTION_ARGS); +extern Datum network_eq(PG_FUNCTION_ARGS); +extern Datum network_lt(PG_FUNCTION_ARGS); +extern Datum network_le(PG_FUNCTION_ARGS); +extern Datum network_gt(PG_FUNCTION_ARGS); +extern Datum network_ge(PG_FUNCTION_ARGS); +extern Datum network_ne(PG_FUNCTION_ARGS); +extern Datum network_cmp(PG_FUNCTION_ARGS); +extern Datum network_sub(PG_FUNCTION_ARGS); +extern Datum network_subeq(PG_FUNCTION_ARGS); +extern Datum network_sup(PG_FUNCTION_ARGS); +extern Datum network_supeq(PG_FUNCTION_ARGS); +extern Datum cash_words(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamp(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamptz(PG_FUNCTION_ARGS); +extern Datum int28mi(PG_FUNCTION_ARGS); +extern Datum int28mul(PG_FUNCTION_ARGS); +extern Datum text_char(PG_FUNCTION_ARGS); +extern Datum int8mod(PG_FUNCTION_ARGS); +extern Datum char_text(PG_FUNCTION_ARGS); +extern Datum int28div(PG_FUNCTION_ARGS); +extern Datum hashint8(PG_FUNCTION_ARGS); +extern Datum be_lo_open(PG_FUNCTION_ARGS); +extern Datum be_lo_close(PG_FUNCTION_ARGS); +extern Datum be_loread(PG_FUNCTION_ARGS); +extern Datum be_lowrite(PG_FUNCTION_ARGS); +extern Datum be_lo_lseek(PG_FUNCTION_ARGS); +extern Datum be_lo_creat(PG_FUNCTION_ARGS); +extern Datum be_lo_tell(PG_FUNCTION_ARGS); +extern Datum on_pl(PG_FUNCTION_ARGS); +extern Datum on_sl(PG_FUNCTION_ARGS); +extern Datum close_pl(PG_FUNCTION_ARGS); +extern Datum be_lo_unlink(PG_FUNCTION_ARGS); +extern Datum hashbpcharextended(PG_FUNCTION_ARGS); +extern Datum path_inter(PG_FUNCTION_ARGS); +extern Datum box_area(PG_FUNCTION_ARGS); +extern Datum box_width(PG_FUNCTION_ARGS); +extern Datum box_height(PG_FUNCTION_ARGS); +extern Datum box_distance(PG_FUNCTION_ARGS); +extern Datum path_area(PG_FUNCTION_ARGS); +extern Datum box_intersect(PG_FUNCTION_ARGS); +extern Datum box_diagonal(PG_FUNCTION_ARGS); +extern Datum path_n_lt(PG_FUNCTION_ARGS); +extern Datum path_n_gt(PG_FUNCTION_ARGS); +extern Datum path_n_eq(PG_FUNCTION_ARGS); +extern Datum path_n_le(PG_FUNCTION_ARGS); +extern Datum path_n_ge(PG_FUNCTION_ARGS); +extern Datum path_length(PG_FUNCTION_ARGS); +extern Datum point_ne(PG_FUNCTION_ARGS); +extern Datum point_vert(PG_FUNCTION_ARGS); +extern Datum point_horiz(PG_FUNCTION_ARGS); +extern Datum point_distance(PG_FUNCTION_ARGS); +extern Datum point_slope(PG_FUNCTION_ARGS); +extern Datum lseg_construct(PG_FUNCTION_ARGS); +extern Datum lseg_intersect(PG_FUNCTION_ARGS); +extern Datum lseg_parallel(PG_FUNCTION_ARGS); +extern Datum lseg_perp(PG_FUNCTION_ARGS); +extern Datum lseg_vertical(PG_FUNCTION_ARGS); +extern Datum lseg_horizontal(PG_FUNCTION_ARGS); +extern Datum lseg_eq(PG_FUNCTION_ARGS); +extern Datum be_lo_truncate(PG_FUNCTION_ARGS); +extern Datum textlike_support(PG_FUNCTION_ARGS); +extern Datum texticregexeq_support(PG_FUNCTION_ARGS); +extern Datum texticlike_support(PG_FUNCTION_ARGS); +extern Datum timestamptz_izone(PG_FUNCTION_ARGS); +extern Datum gist_point_compress(PG_FUNCTION_ARGS); +extern Datum aclitemin(PG_FUNCTION_ARGS); +extern Datum aclitemout(PG_FUNCTION_ARGS); +extern Datum aclinsert(PG_FUNCTION_ARGS); +extern Datum aclremove(PG_FUNCTION_ARGS); +extern Datum aclcontains(PG_FUNCTION_ARGS); +extern Datum getdatabaseencoding(PG_FUNCTION_ARGS); +extern Datum bpcharin(PG_FUNCTION_ARGS); +extern Datum bpcharout(PG_FUNCTION_ARGS); +extern Datum varcharin(PG_FUNCTION_ARGS); +extern Datum varcharout(PG_FUNCTION_ARGS); +extern Datum bpchareq(PG_FUNCTION_ARGS); +extern Datum bpcharlt(PG_FUNCTION_ARGS); +extern Datum bpcharle(PG_FUNCTION_ARGS); +extern Datum bpchargt(PG_FUNCTION_ARGS); +extern Datum bpcharge(PG_FUNCTION_ARGS); +extern Datum bpcharne(PG_FUNCTION_ARGS); +extern Datum aclitem_eq(PG_FUNCTION_ARGS); +extern Datum bpchar_larger(PG_FUNCTION_ARGS); +extern Datum bpchar_smaller(PG_FUNCTION_ARGS); +extern Datum pg_prepared_xact(PG_FUNCTION_ARGS); +extern Datum generate_series_step_int4(PG_FUNCTION_ARGS); +extern Datum generate_series_int4(PG_FUNCTION_ARGS); +extern Datum generate_series_step_int8(PG_FUNCTION_ARGS); +extern Datum generate_series_int8(PG_FUNCTION_ARGS); +extern Datum bpcharcmp(PG_FUNCTION_ARGS); +extern Datum text_regclass(PG_FUNCTION_ARGS); +extern Datum hashbpchar(PG_FUNCTION_ARGS); +extern Datum format_type(PG_FUNCTION_ARGS); +extern Datum date_in(PG_FUNCTION_ARGS); +extern Datum date_out(PG_FUNCTION_ARGS); +extern Datum date_eq(PG_FUNCTION_ARGS); +extern Datum date_lt(PG_FUNCTION_ARGS); +extern Datum date_le(PG_FUNCTION_ARGS); +extern Datum date_gt(PG_FUNCTION_ARGS); +extern Datum date_ge(PG_FUNCTION_ARGS); +extern Datum date_ne(PG_FUNCTION_ARGS); +extern Datum date_cmp(PG_FUNCTION_ARGS); +extern Datum time_lt(PG_FUNCTION_ARGS); +extern Datum time_le(PG_FUNCTION_ARGS); +extern Datum time_gt(PG_FUNCTION_ARGS); +extern Datum time_ge(PG_FUNCTION_ARGS); +extern Datum time_ne(PG_FUNCTION_ARGS); +extern Datum time_cmp(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_replay_pause_state(PG_FUNCTION_ARGS); +extern Datum date_larger(PG_FUNCTION_ARGS); +extern Datum date_smaller(PG_FUNCTION_ARGS); +extern Datum date_mi(PG_FUNCTION_ARGS); +extern Datum date_pli(PG_FUNCTION_ARGS); +extern Datum date_mii(PG_FUNCTION_ARGS); +extern Datum time_in(PG_FUNCTION_ARGS); +extern Datum time_out(PG_FUNCTION_ARGS); +extern Datum time_eq(PG_FUNCTION_ARGS); +extern Datum circle_add_pt(PG_FUNCTION_ARGS); +extern Datum circle_sub_pt(PG_FUNCTION_ARGS); +extern Datum circle_mul_pt(PG_FUNCTION_ARGS); +extern Datum circle_div_pt(PG_FUNCTION_ARGS); +extern Datum timestamptz_in(PG_FUNCTION_ARGS); +extern Datum timestamptz_out(PG_FUNCTION_ARGS); +extern Datum timestamp_eq(PG_FUNCTION_ARGS); +extern Datum timestamp_ne(PG_FUNCTION_ARGS); +extern Datum timestamp_lt(PG_FUNCTION_ARGS); +extern Datum timestamp_le(PG_FUNCTION_ARGS); +extern Datum timestamp_ge(PG_FUNCTION_ARGS); +extern Datum timestamp_gt(PG_FUNCTION_ARGS); +extern Datum float8_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamptz_zone(PG_FUNCTION_ARGS); +extern Datum interval_in(PG_FUNCTION_ARGS); +extern Datum interval_out(PG_FUNCTION_ARGS); +extern Datum interval_eq(PG_FUNCTION_ARGS); +extern Datum interval_ne(PG_FUNCTION_ARGS); +extern Datum interval_lt(PG_FUNCTION_ARGS); +extern Datum interval_le(PG_FUNCTION_ARGS); +extern Datum interval_ge(PG_FUNCTION_ARGS); +extern Datum interval_gt(PG_FUNCTION_ARGS); +extern Datum interval_um(PG_FUNCTION_ARGS); +extern Datum interval_pl(PG_FUNCTION_ARGS); +extern Datum interval_mi(PG_FUNCTION_ARGS); +extern Datum timestamptz_part(PG_FUNCTION_ARGS); +extern Datum interval_part(PG_FUNCTION_ARGS); +extern Datum network_subset_support(PG_FUNCTION_ARGS); +extern Datum date_timestamptz(PG_FUNCTION_ARGS); +extern Datum interval_justify_hours(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists_tz(PG_FUNCTION_ARGS); +extern Datum timestamptz_date(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_tz(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_array_tz(PG_FUNCTION_ARGS); +extern Datum xid_age(PG_FUNCTION_ARGS); +extern Datum timestamp_mi(PG_FUNCTION_ARGS); +extern Datum timestamptz_pl_interval(PG_FUNCTION_ARGS); +extern Datum timestamptz_mi_interval(PG_FUNCTION_ARGS); +extern Datum generate_subscripts(PG_FUNCTION_ARGS); +extern Datum generate_subscripts_nodir(PG_FUNCTION_ARGS); +extern Datum array_fill(PG_FUNCTION_ARGS); +extern Datum dlog10(PG_FUNCTION_ARGS); +extern Datum timestamp_smaller(PG_FUNCTION_ARGS); +extern Datum timestamp_larger(PG_FUNCTION_ARGS); +extern Datum interval_smaller(PG_FUNCTION_ARGS); +extern Datum interval_larger(PG_FUNCTION_ARGS); +extern Datum timestamptz_age(PG_FUNCTION_ARGS); +extern Datum interval_scale(PG_FUNCTION_ARGS); +extern Datum timestamptz_trunc(PG_FUNCTION_ARGS); +extern Datum interval_trunc(PG_FUNCTION_ARGS); +extern Datum int8inc(PG_FUNCTION_ARGS); +extern Datum int8abs(PG_FUNCTION_ARGS); +extern Datum int8larger(PG_FUNCTION_ARGS); +extern Datum int8smaller(PG_FUNCTION_ARGS); +extern Datum texticregexeq(PG_FUNCTION_ARGS); +extern Datum texticregexne(PG_FUNCTION_ARGS); +extern Datum nameicregexeq(PG_FUNCTION_ARGS); +extern Datum nameicregexne(PG_FUNCTION_ARGS); +extern Datum boolin(PG_FUNCTION_ARGS); +extern Datum boolout(PG_FUNCTION_ARGS); +extern Datum byteain(PG_FUNCTION_ARGS); +extern Datum charin(PG_FUNCTION_ARGS); +extern Datum charlt(PG_FUNCTION_ARGS); +extern Datum unique_key_recheck(PG_FUNCTION_ARGS); +extern Datum int4abs(PG_FUNCTION_ARGS); +extern Datum nameregexne(PG_FUNCTION_ARGS); +extern Datum int2abs(PG_FUNCTION_ARGS); +extern Datum textregexeq(PG_FUNCTION_ARGS); +extern Datum textregexne(PG_FUNCTION_ARGS); +extern Datum textlen(PG_FUNCTION_ARGS); +extern Datum textcat(PG_FUNCTION_ARGS); +extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS); +extern Datum tidne(PG_FUNCTION_ARGS); +extern Datum cidr_in(PG_FUNCTION_ARGS); +extern Datum parse_ident(PG_FUNCTION_ARGS); +extern Datum pg_column_size(PG_FUNCTION_ARGS); +extern Datum overlaps_timetz(PG_FUNCTION_ARGS); +extern Datum datetime_timestamp(PG_FUNCTION_ARGS); +extern Datum timetz_part(PG_FUNCTION_ARGS); +extern Datum int84pl(PG_FUNCTION_ARGS); +extern Datum int84mi(PG_FUNCTION_ARGS); +extern Datum int84mul(PG_FUNCTION_ARGS); +extern Datum int84div(PG_FUNCTION_ARGS); +extern Datum int48pl(PG_FUNCTION_ARGS); +extern Datum int48mi(PG_FUNCTION_ARGS); +extern Datum int48mul(PG_FUNCTION_ARGS); +extern Datum int48div(PG_FUNCTION_ARGS); +extern Datum quote_ident(PG_FUNCTION_ARGS); +extern Datum quote_literal(PG_FUNCTION_ARGS); +extern Datum timestamptz_trunc_zone(PG_FUNCTION_ARGS); +extern Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS); +extern Datum i8tooid(PG_FUNCTION_ARGS); +extern Datum oidtoi8(PG_FUNCTION_ARGS); +extern Datum quote_nullable(PG_FUNCTION_ARGS); +extern Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS); +extern Datum tideq(PG_FUNCTION_ARGS); +extern Datum multirange_unnest(PG_FUNCTION_ARGS); +extern Datum currtid_byrelname(PG_FUNCTION_ARGS); +extern Datum interval_justify_days(PG_FUNCTION_ARGS); +extern Datum datetimetz_timestamptz(PG_FUNCTION_ARGS); +extern Datum now(PG_FUNCTION_ARGS); +extern Datum positionsel(PG_FUNCTION_ARGS); +extern Datum positionjoinsel(PG_FUNCTION_ARGS); +extern Datum contsel(PG_FUNCTION_ARGS); +extern Datum contjoinsel(PG_FUNCTION_ARGS); +extern Datum overlaps_timestamp(PG_FUNCTION_ARGS); +extern Datum overlaps_time(PG_FUNCTION_ARGS); +extern Datum timestamp_in(PG_FUNCTION_ARGS); +extern Datum timestamp_out(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp(PG_FUNCTION_ARGS); +extern Datum interval_cmp(PG_FUNCTION_ARGS); +extern Datum timestamp_time(PG_FUNCTION_ARGS); +extern Datum bpcharlen(PG_FUNCTION_ARGS); +extern Datum interval_div(PG_FUNCTION_ARGS); +extern Datum oidvectortypes(PG_FUNCTION_ARGS); +extern Datum timetz_in(PG_FUNCTION_ARGS); +extern Datum timetz_out(PG_FUNCTION_ARGS); +extern Datum timetz_eq(PG_FUNCTION_ARGS); +extern Datum timetz_ne(PG_FUNCTION_ARGS); +extern Datum timetz_lt(PG_FUNCTION_ARGS); +extern Datum timetz_le(PG_FUNCTION_ARGS); +extern Datum timetz_ge(PG_FUNCTION_ARGS); +extern Datum timetz_gt(PG_FUNCTION_ARGS); +extern Datum timetz_cmp(PG_FUNCTION_ARGS); +extern Datum network_hostmask(PG_FUNCTION_ARGS); +extern Datum textregexeq_support(PG_FUNCTION_ARGS); +extern Datum makeaclitem(PG_FUNCTION_ARGS); +extern Datum time_interval(PG_FUNCTION_ARGS); +extern Datum pg_lock_status(PG_FUNCTION_ARGS); +extern Datum date_finite(PG_FUNCTION_ARGS); +extern Datum textoctetlen(PG_FUNCTION_ARGS); +extern Datum bpcharoctetlen(PG_FUNCTION_ARGS); +extern Datum numeric_fac(PG_FUNCTION_ARGS); +extern Datum time_larger(PG_FUNCTION_ARGS); +extern Datum time_smaller(PG_FUNCTION_ARGS); +extern Datum timetz_larger(PG_FUNCTION_ARGS); +extern Datum timetz_smaller(PG_FUNCTION_ARGS); +extern Datum time_part(PG_FUNCTION_ARGS); +extern Datum pg_get_constraintdef(PG_FUNCTION_ARGS); +extern Datum timestamptz_timetz(PG_FUNCTION_ARGS); +extern Datum timestamp_finite(PG_FUNCTION_ARGS); +extern Datum interval_finite(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_start(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_client_port(PG_FUNCTION_ARGS); +extern Datum current_schema(PG_FUNCTION_ARGS); +extern Datum current_schemas(PG_FUNCTION_ARGS); +extern Datum textoverlay(PG_FUNCTION_ARGS); +extern Datum textoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum line_parallel(PG_FUNCTION_ARGS); +extern Datum line_perp(PG_FUNCTION_ARGS); +extern Datum line_vertical(PG_FUNCTION_ARGS); +extern Datum line_horizontal(PG_FUNCTION_ARGS); +extern Datum circle_center(PG_FUNCTION_ARGS); +extern Datum interval_time(PG_FUNCTION_ARGS); +extern Datum points_box(PG_FUNCTION_ARGS); +extern Datum box_add(PG_FUNCTION_ARGS); +extern Datum box_sub(PG_FUNCTION_ARGS); +extern Datum box_mul(PG_FUNCTION_ARGS); +extern Datum box_div(PG_FUNCTION_ARGS); +extern Datum cidr_out(PG_FUNCTION_ARGS); +extern Datum poly_contain_pt(PG_FUNCTION_ARGS); +extern Datum pt_contained_poly(PG_FUNCTION_ARGS); +extern Datum path_isclosed(PG_FUNCTION_ARGS); +extern Datum path_isopen(PG_FUNCTION_ARGS); +extern Datum path_npoints(PG_FUNCTION_ARGS); +extern Datum path_close(PG_FUNCTION_ARGS); +extern Datum path_open(PG_FUNCTION_ARGS); +extern Datum path_add(PG_FUNCTION_ARGS); +extern Datum path_add_pt(PG_FUNCTION_ARGS); +extern Datum path_sub_pt(PG_FUNCTION_ARGS); +extern Datum path_mul_pt(PG_FUNCTION_ARGS); +extern Datum path_div_pt(PG_FUNCTION_ARGS); +extern Datum construct_point(PG_FUNCTION_ARGS); +extern Datum point_add(PG_FUNCTION_ARGS); +extern Datum point_sub(PG_FUNCTION_ARGS); +extern Datum point_mul(PG_FUNCTION_ARGS); +extern Datum point_div(PG_FUNCTION_ARGS); +extern Datum poly_npoints(PG_FUNCTION_ARGS); +extern Datum poly_box(PG_FUNCTION_ARGS); +extern Datum poly_path(PG_FUNCTION_ARGS); +extern Datum box_poly(PG_FUNCTION_ARGS); +extern Datum path_poly(PG_FUNCTION_ARGS); +extern Datum circle_in(PG_FUNCTION_ARGS); +extern Datum circle_out(PG_FUNCTION_ARGS); +extern Datum circle_same(PG_FUNCTION_ARGS); +extern Datum circle_contain(PG_FUNCTION_ARGS); +extern Datum circle_left(PG_FUNCTION_ARGS); +extern Datum circle_overleft(PG_FUNCTION_ARGS); +extern Datum circle_overright(PG_FUNCTION_ARGS); +extern Datum circle_right(PG_FUNCTION_ARGS); +extern Datum circle_contained(PG_FUNCTION_ARGS); +extern Datum circle_overlap(PG_FUNCTION_ARGS); +extern Datum circle_below(PG_FUNCTION_ARGS); +extern Datum circle_above(PG_FUNCTION_ARGS); +extern Datum circle_eq(PG_FUNCTION_ARGS); +extern Datum circle_ne(PG_FUNCTION_ARGS); +extern Datum circle_lt(PG_FUNCTION_ARGS); +extern Datum circle_gt(PG_FUNCTION_ARGS); +extern Datum circle_le(PG_FUNCTION_ARGS); +extern Datum circle_ge(PG_FUNCTION_ARGS); +extern Datum circle_area(PG_FUNCTION_ARGS); +extern Datum circle_diameter(PG_FUNCTION_ARGS); +extern Datum circle_radius(PG_FUNCTION_ARGS); +extern Datum circle_distance(PG_FUNCTION_ARGS); +extern Datum cr_circle(PG_FUNCTION_ARGS); +extern Datum poly_circle(PG_FUNCTION_ARGS); +extern Datum circle_poly(PG_FUNCTION_ARGS); +extern Datum dist_pc(PG_FUNCTION_ARGS); +extern Datum circle_contain_pt(PG_FUNCTION_ARGS); +extern Datum pt_contained_circle(PG_FUNCTION_ARGS); +extern Datum box_circle(PG_FUNCTION_ARGS); +extern Datum circle_box(PG_FUNCTION_ARGS); +extern Datum lseg_ne(PG_FUNCTION_ARGS); +extern Datum lseg_lt(PG_FUNCTION_ARGS); +extern Datum lseg_le(PG_FUNCTION_ARGS); +extern Datum lseg_gt(PG_FUNCTION_ARGS); +extern Datum lseg_ge(PG_FUNCTION_ARGS); +extern Datum lseg_length(PG_FUNCTION_ARGS); +extern Datum close_ls(PG_FUNCTION_ARGS); +extern Datum close_lseg(PG_FUNCTION_ARGS); +extern Datum line_in(PG_FUNCTION_ARGS); +extern Datum line_out(PG_FUNCTION_ARGS); +extern Datum line_eq(PG_FUNCTION_ARGS); +extern Datum line_construct_pp(PG_FUNCTION_ARGS); +extern Datum line_interpt(PG_FUNCTION_ARGS); +extern Datum line_intersect(PG_FUNCTION_ARGS); +extern Datum bit_in(PG_FUNCTION_ARGS); +extern Datum bit_out(PG_FUNCTION_ARGS); +extern Datum pg_get_ruledef(PG_FUNCTION_ARGS); +extern Datum nextval_oid(PG_FUNCTION_ARGS); +extern Datum currval_oid(PG_FUNCTION_ARGS); +extern Datum setval_oid(PG_FUNCTION_ARGS); +extern Datum varbit_in(PG_FUNCTION_ARGS); +extern Datum varbit_out(PG_FUNCTION_ARGS); +extern Datum biteq(PG_FUNCTION_ARGS); +extern Datum bitne(PG_FUNCTION_ARGS); +extern Datum bitge(PG_FUNCTION_ARGS); +extern Datum bitgt(PG_FUNCTION_ARGS); +extern Datum bitle(PG_FUNCTION_ARGS); +extern Datum bitlt(PG_FUNCTION_ARGS); +extern Datum bitcmp(PG_FUNCTION_ARGS); +extern Datum PG_encoding_to_char(PG_FUNCTION_ARGS); +extern Datum drandom(PG_FUNCTION_ARGS); +extern Datum setseed(PG_FUNCTION_ARGS); +extern Datum dasin(PG_FUNCTION_ARGS); +extern Datum dacos(PG_FUNCTION_ARGS); +extern Datum datan(PG_FUNCTION_ARGS); +extern Datum datan2(PG_FUNCTION_ARGS); +extern Datum dsin(PG_FUNCTION_ARGS); +extern Datum dcos(PG_FUNCTION_ARGS); +extern Datum dtan(PG_FUNCTION_ARGS); +extern Datum dcot(PG_FUNCTION_ARGS); +extern Datum degrees(PG_FUNCTION_ARGS); +extern Datum radians(PG_FUNCTION_ARGS); +extern Datum dpi(PG_FUNCTION_ARGS); +extern Datum interval_mul(PG_FUNCTION_ARGS); +extern Datum pg_typeof(PG_FUNCTION_ARGS); +extern Datum ascii(PG_FUNCTION_ARGS); +extern Datum chr(PG_FUNCTION_ARGS); +extern Datum repeat(PG_FUNCTION_ARGS); +extern Datum similar_escape(PG_FUNCTION_ARGS); +extern Datum mul_d_interval(PG_FUNCTION_ARGS); +extern Datum texticlike(PG_FUNCTION_ARGS); +extern Datum texticnlike(PG_FUNCTION_ARGS); +extern Datum nameiclike(PG_FUNCTION_ARGS); +extern Datum nameicnlike(PG_FUNCTION_ARGS); +extern Datum like_escape(PG_FUNCTION_ARGS); +extern Datum oidgt(PG_FUNCTION_ARGS); +extern Datum oidge(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_name(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef(PG_FUNCTION_ARGS); +extern Datum pg_get_userbyid(PG_FUNCTION_ARGS); +extern Datum pg_get_indexdef(PG_FUNCTION_ARGS); +extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS); +extern Datum RI_FKey_check_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_cascade_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_cascade_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_restrict_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_restrict_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setnull_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS); +extern Datum RI_FKey_noaction_del(PG_FUNCTION_ARGS); +extern Datum RI_FKey_noaction_upd(PG_FUNCTION_ARGS); +extern Datum pg_get_triggerdef(PG_FUNCTION_ARGS); +extern Datum pg_get_serial_sequence(PG_FUNCTION_ARGS); +extern Datum bit_and(PG_FUNCTION_ARGS); +extern Datum bit_or(PG_FUNCTION_ARGS); +extern Datum bitxor(PG_FUNCTION_ARGS); +extern Datum bitnot(PG_FUNCTION_ARGS); +extern Datum bitshiftleft(PG_FUNCTION_ARGS); +extern Datum bitshiftright(PG_FUNCTION_ARGS); +extern Datum bitcat(PG_FUNCTION_ARGS); +extern Datum bitsubstr(PG_FUNCTION_ARGS); +extern Datum bitlength(PG_FUNCTION_ARGS); +extern Datum bitoctetlength(PG_FUNCTION_ARGS); +extern Datum bitfromint4(PG_FUNCTION_ARGS); +extern Datum bittoint4(PG_FUNCTION_ARGS); +extern Datum bit(PG_FUNCTION_ARGS); +extern Datum pg_get_keywords(PG_FUNCTION_ARGS); +extern Datum varbit(PG_FUNCTION_ARGS); +extern Datum time_hash(PG_FUNCTION_ARGS); +extern Datum aclexplode(PG_FUNCTION_ARGS); +extern Datum time_mi_time(PG_FUNCTION_ARGS); +extern Datum boolle(PG_FUNCTION_ARGS); +extern Datum boolge(PG_FUNCTION_ARGS); +extern Datum btboolcmp(PG_FUNCTION_ARGS); +extern Datum timetz_hash(PG_FUNCTION_ARGS); +extern Datum interval_hash(PG_FUNCTION_ARGS); +extern Datum bitposition(PG_FUNCTION_ARGS); +extern Datum bitsubstr_no_len(PG_FUNCTION_ARGS); +extern Datum numeric_in(PG_FUNCTION_ARGS); +extern Datum numeric_out(PG_FUNCTION_ARGS); +extern Datum numeric(PG_FUNCTION_ARGS); +extern Datum numeric_abs(PG_FUNCTION_ARGS); +extern Datum numeric_sign(PG_FUNCTION_ARGS); +extern Datum numeric_round(PG_FUNCTION_ARGS); +extern Datum numeric_trunc(PG_FUNCTION_ARGS); +extern Datum numeric_ceil(PG_FUNCTION_ARGS); +extern Datum numeric_floor(PG_FUNCTION_ARGS); +extern Datum length_in_encoding(PG_FUNCTION_ARGS); +extern Datum pg_convert_from(PG_FUNCTION_ARGS); +extern Datum inet_to_cidr(PG_FUNCTION_ARGS); +extern Datum pg_get_expr(PG_FUNCTION_ARGS); +extern Datum pg_convert_to(PG_FUNCTION_ARGS); +extern Datum numeric_eq(PG_FUNCTION_ARGS); +extern Datum numeric_ne(PG_FUNCTION_ARGS); +extern Datum numeric_gt(PG_FUNCTION_ARGS); +extern Datum numeric_ge(PG_FUNCTION_ARGS); +extern Datum numeric_lt(PG_FUNCTION_ARGS); +extern Datum numeric_le(PG_FUNCTION_ARGS); +extern Datum numeric_add(PG_FUNCTION_ARGS); +extern Datum numeric_sub(PG_FUNCTION_ARGS); +extern Datum numeric_mul(PG_FUNCTION_ARGS); +extern Datum numeric_div(PG_FUNCTION_ARGS); +extern Datum numeric_mod(PG_FUNCTION_ARGS); +extern Datum numeric_sqrt(PG_FUNCTION_ARGS); +extern Datum numeric_exp(PG_FUNCTION_ARGS); +extern Datum numeric_ln(PG_FUNCTION_ARGS); +extern Datum numeric_log(PG_FUNCTION_ARGS); +extern Datum numeric_power(PG_FUNCTION_ARGS); +extern Datum int4_numeric(PG_FUNCTION_ARGS); +extern Datum float4_numeric(PG_FUNCTION_ARGS); +extern Datum float8_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_int4(PG_FUNCTION_ARGS); +extern Datum numeric_float4(PG_FUNCTION_ARGS); +extern Datum numeric_float8(PG_FUNCTION_ARGS); +extern Datum time_pl_interval(PG_FUNCTION_ARGS); +extern Datum time_mi_interval(PG_FUNCTION_ARGS); +extern Datum timetz_pl_interval(PG_FUNCTION_ARGS); +extern Datum timetz_mi_interval(PG_FUNCTION_ARGS); +extern Datum numeric_inc(PG_FUNCTION_ARGS); +extern Datum setval3_oid(PG_FUNCTION_ARGS); +extern Datum numeric_smaller(PG_FUNCTION_ARGS); +extern Datum numeric_larger(PG_FUNCTION_ARGS); +extern Datum interval_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_cmp(PG_FUNCTION_ARGS); +extern Datum timestamptz_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_uminus(PG_FUNCTION_ARGS); +extern Datum numeric_to_char(PG_FUNCTION_ARGS); +extern Datum int4_to_char(PG_FUNCTION_ARGS); +extern Datum int8_to_char(PG_FUNCTION_ARGS); +extern Datum float4_to_char(PG_FUNCTION_ARGS); +extern Datum float8_to_char(PG_FUNCTION_ARGS); +extern Datum numeric_to_number(PG_FUNCTION_ARGS); +extern Datum to_timestamp(PG_FUNCTION_ARGS); +extern Datum numeric_int8(PG_FUNCTION_ARGS); +extern Datum to_date(PG_FUNCTION_ARGS); +extern Datum int8_numeric(PG_FUNCTION_ARGS); +extern Datum int2_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_int2(PG_FUNCTION_ARGS); +extern Datum oidin(PG_FUNCTION_ARGS); +extern Datum oidout(PG_FUNCTION_ARGS); +extern Datum pg_convert(PG_FUNCTION_ARGS); +extern Datum iclikesel(PG_FUNCTION_ARGS); +extern Datum icnlikesel(PG_FUNCTION_ARGS); +extern Datum iclikejoinsel(PG_FUNCTION_ARGS); +extern Datum icnlikejoinsel(PG_FUNCTION_ARGS); +extern Datum regexeqsel(PG_FUNCTION_ARGS); +extern Datum likesel(PG_FUNCTION_ARGS); +extern Datum icregexeqsel(PG_FUNCTION_ARGS); +extern Datum regexnesel(PG_FUNCTION_ARGS); +extern Datum nlikesel(PG_FUNCTION_ARGS); +extern Datum icregexnesel(PG_FUNCTION_ARGS); +extern Datum regexeqjoinsel(PG_FUNCTION_ARGS); +extern Datum likejoinsel(PG_FUNCTION_ARGS); +extern Datum icregexeqjoinsel(PG_FUNCTION_ARGS); +extern Datum regexnejoinsel(PG_FUNCTION_ARGS); +extern Datum nlikejoinsel(PG_FUNCTION_ARGS); +extern Datum icregexnejoinsel(PG_FUNCTION_ARGS); +extern Datum float8_avg(PG_FUNCTION_ARGS); +extern Datum float8_var_samp(PG_FUNCTION_ARGS); +extern Datum float8_stddev_samp(PG_FUNCTION_ARGS); +extern Datum numeric_accum(PG_FUNCTION_ARGS); +extern Datum int2_accum(PG_FUNCTION_ARGS); +extern Datum int4_accum(PG_FUNCTION_ARGS); +extern Datum int8_accum(PG_FUNCTION_ARGS); +extern Datum numeric_avg(PG_FUNCTION_ARGS); +extern Datum numeric_var_samp(PG_FUNCTION_ARGS); +extern Datum numeric_stddev_samp(PG_FUNCTION_ARGS); +extern Datum int2_sum(PG_FUNCTION_ARGS); +extern Datum int4_sum(PG_FUNCTION_ARGS); +extern Datum int8_sum(PG_FUNCTION_ARGS); +extern Datum interval_avg_accum(PG_FUNCTION_ARGS); +extern Datum interval_avg(PG_FUNCTION_ARGS); +extern Datum to_ascii_default(PG_FUNCTION_ARGS); +extern Datum to_ascii_enc(PG_FUNCTION_ARGS); +extern Datum to_ascii_encname(PG_FUNCTION_ARGS); +extern Datum int28eq(PG_FUNCTION_ARGS); +extern Datum int28ne(PG_FUNCTION_ARGS); +extern Datum int28lt(PG_FUNCTION_ARGS); +extern Datum int28gt(PG_FUNCTION_ARGS); +extern Datum int28le(PG_FUNCTION_ARGS); +extern Datum int28ge(PG_FUNCTION_ARGS); +extern Datum int82eq(PG_FUNCTION_ARGS); +extern Datum int82ne(PG_FUNCTION_ARGS); +extern Datum int82lt(PG_FUNCTION_ARGS); +extern Datum int82gt(PG_FUNCTION_ARGS); +extern Datum int82le(PG_FUNCTION_ARGS); +extern Datum int82ge(PG_FUNCTION_ARGS); +extern Datum int2and(PG_FUNCTION_ARGS); +extern Datum int2or(PG_FUNCTION_ARGS); +extern Datum int2xor(PG_FUNCTION_ARGS); +extern Datum int2not(PG_FUNCTION_ARGS); +extern Datum int2shl(PG_FUNCTION_ARGS); +extern Datum int2shr(PG_FUNCTION_ARGS); +extern Datum int4and(PG_FUNCTION_ARGS); +extern Datum int4or(PG_FUNCTION_ARGS); +extern Datum int4xor(PG_FUNCTION_ARGS); +extern Datum int4not(PG_FUNCTION_ARGS); +extern Datum int4shl(PG_FUNCTION_ARGS); +extern Datum int4shr(PG_FUNCTION_ARGS); +extern Datum int8and(PG_FUNCTION_ARGS); +extern Datum int8or(PG_FUNCTION_ARGS); +extern Datum int8xor(PG_FUNCTION_ARGS); +extern Datum int8not(PG_FUNCTION_ARGS); +extern Datum int8shl(PG_FUNCTION_ARGS); +extern Datum int8shr(PG_FUNCTION_ARGS); +extern Datum int8up(PG_FUNCTION_ARGS); +extern Datum int2up(PG_FUNCTION_ARGS); +extern Datum int4up(PG_FUNCTION_ARGS); +extern Datum float4up(PG_FUNCTION_ARGS); +extern Datum float8up(PG_FUNCTION_ARGS); +extern Datum numeric_uplus(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_table_privilege_id(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_numscans(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_blocks_hit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_idset(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_pid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_dbid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_userid(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_activity(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_numbackends(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_xact_commit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_xact_rollback(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blocks_hit(PG_FUNCTION_ARGS); +extern Datum binary_encode(PG_FUNCTION_ARGS); +extern Datum binary_decode(PG_FUNCTION_ARGS); +extern Datum byteaeq(PG_FUNCTION_ARGS); +extern Datum bytealt(PG_FUNCTION_ARGS); +extern Datum byteale(PG_FUNCTION_ARGS); +extern Datum byteagt(PG_FUNCTION_ARGS); +extern Datum byteage(PG_FUNCTION_ARGS); +extern Datum byteane(PG_FUNCTION_ARGS); +extern Datum byteacmp(PG_FUNCTION_ARGS); +extern Datum timestamp_scale(PG_FUNCTION_ARGS); +extern Datum int2_avg_accum(PG_FUNCTION_ARGS); +extern Datum int4_avg_accum(PG_FUNCTION_ARGS); +extern Datum int8_avg(PG_FUNCTION_ARGS); +extern Datum oidlarger(PG_FUNCTION_ARGS); +extern Datum oidsmaller(PG_FUNCTION_ARGS); +extern Datum timestamptz_scale(PG_FUNCTION_ARGS); +extern Datum time_scale(PG_FUNCTION_ARGS); +extern Datum timetz_scale(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_hot_updated(PG_FUNCTION_ARGS); +extern Datum numeric_div_trunc(PG_FUNCTION_ARGS); +extern Datum similar_to_escape_2(PG_FUNCTION_ARGS); +extern Datum similar_to_escape_1(PG_FUNCTION_ARGS); +extern Datum bytealike(PG_FUNCTION_ARGS); +extern Datum byteanlike(PG_FUNCTION_ARGS); +extern Datum like_escape_bytea(PG_FUNCTION_ARGS); +extern Datum byteacat(PG_FUNCTION_ARGS); +extern Datum bytea_substr(PG_FUNCTION_ARGS); +extern Datum bytea_substr_no_len(PG_FUNCTION_ARGS); +extern Datum byteapos(PG_FUNCTION_ARGS); +extern Datum byteatrim(PG_FUNCTION_ARGS); +extern Datum timestamptz_time(PG_FUNCTION_ARGS); +extern Datum timestamp_trunc(PG_FUNCTION_ARGS); +extern Datum timestamp_part(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_activity(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_first_tz(PG_FUNCTION_ARGS); +extern Datum date_timestamp(PG_FUNCTION_ARGS); +extern Datum pg_backend_pid(PG_FUNCTION_ARGS); +extern Datum timestamptz_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_date(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match_tz(PG_FUNCTION_ARGS); +extern Datum timestamp_pl_interval(PG_FUNCTION_ARGS); +extern Datum timestamp_mi_interval(PG_FUNCTION_ARGS); +extern Datum pg_conf_load_time(PG_FUNCTION_ARGS); +extern Datum timetz_zone(PG_FUNCTION_ARGS); +extern Datum timetz_izone(PG_FUNCTION_ARGS); +extern Datum timestamp_hash(PG_FUNCTION_ARGS); +extern Datum timetz_time(PG_FUNCTION_ARGS); +extern Datum time_timetz(PG_FUNCTION_ARGS); +extern Datum timestamp_to_char(PG_FUNCTION_ARGS); +extern Datum timestamp_age(PG_FUNCTION_ARGS); +extern Datum timestamp_zone(PG_FUNCTION_ARGS); +extern Datum timestamp_izone(PG_FUNCTION_ARGS); +extern Datum date_pl_interval(PG_FUNCTION_ARGS); +extern Datum date_mi_interval(PG_FUNCTION_ARGS); +extern Datum textregexsubstr(PG_FUNCTION_ARGS); +extern Datum bitfromint8(PG_FUNCTION_ARGS); +extern Datum bittoint8(PG_FUNCTION_ARGS); +extern Datum show_config_by_name(PG_FUNCTION_ARGS); +extern Datum set_config_by_name(PG_FUNCTION_ARGS); +extern Datum pg_table_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_type_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_function_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_operator_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_opclass_is_visible(PG_FUNCTION_ARGS); +extern Datum show_all_settings(PG_FUNCTION_ARGS); +extern Datum replace_text(PG_FUNCTION_ARGS); +extern Datum split_part(PG_FUNCTION_ARGS); +extern Datum to_hex32(PG_FUNCTION_ARGS); +extern Datum to_hex64(PG_FUNCTION_ARGS); +extern Datum array_lower(PG_FUNCTION_ARGS); +extern Datum array_upper(PG_FUNCTION_ARGS); +extern Datum pg_conversion_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS); +extern Datum pg_terminate_backend(PG_FUNCTION_ARGS); +extern Datum pg_get_functiondef(PG_FUNCTION_ARGS); +extern Datum pg_column_compression(PG_FUNCTION_ARGS); +extern Datum pg_stat_force_next_flush(PG_FUNCTION_ARGS); +extern Datum text_pattern_lt(PG_FUNCTION_ARGS); +extern Datum text_pattern_le(PG_FUNCTION_ARGS); +extern Datum pg_get_function_arguments(PG_FUNCTION_ARGS); +extern Datum text_pattern_ge(PG_FUNCTION_ARGS); +extern Datum text_pattern_gt(PG_FUNCTION_ARGS); +extern Datum pg_get_function_result(PG_FUNCTION_ARGS); +extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS); +extern Datum pg_database_size_name(PG_FUNCTION_ARGS); +extern Datum width_bucket_numeric(PG_FUNCTION_ARGS); +extern Datum pg_cancel_backend(PG_FUNCTION_ARGS); +extern Datum pg_backup_start(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS); +extern Datum array_length(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS); +extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS); +extern Datum gist_point_consistent(PG_FUNCTION_ARGS); +extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_sequence_privilege_id(PG_FUNCTION_ARGS); +extern Datum btint48cmp(PG_FUNCTION_ARGS); +extern Datum btint84cmp(PG_FUNCTION_ARGS); +extern Datum btint24cmp(PG_FUNCTION_ARGS); +extern Datum btint42cmp(PG_FUNCTION_ARGS); +extern Datum btint28cmp(PG_FUNCTION_ARGS); +extern Datum btint82cmp(PG_FUNCTION_ARGS); +extern Datum btfloat48cmp(PG_FUNCTION_ARGS); +extern Datum btfloat84cmp(PG_FUNCTION_ARGS); +extern Datum inet_client_addr(PG_FUNCTION_ARGS); +extern Datum inet_client_port(PG_FUNCTION_ARGS); +extern Datum inet_server_addr(PG_FUNCTION_ARGS); +extern Datum inet_server_port(PG_FUNCTION_ARGS); +extern Datum regprocedurein(PG_FUNCTION_ARGS); +extern Datum regprocedureout(PG_FUNCTION_ARGS); +extern Datum regoperin(PG_FUNCTION_ARGS); +extern Datum regoperout(PG_FUNCTION_ARGS); +extern Datum regoperatorin(PG_FUNCTION_ARGS); +extern Datum regoperatorout(PG_FUNCTION_ARGS); +extern Datum regclassin(PG_FUNCTION_ARGS); +extern Datum regclassout(PG_FUNCTION_ARGS); +extern Datum regtypein(PG_FUNCTION_ARGS); +extern Datum regtypeout(PG_FUNCTION_ARGS); +extern Datum pg_stat_clear_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS); +extern Datum hashtid(PG_FUNCTION_ARGS); +extern Datum hashtidextended(PG_FUNCTION_ARGS); +extern Datum fmgr_internal_validator(PG_FUNCTION_ARGS); +extern Datum fmgr_c_validator(PG_FUNCTION_ARGS); +extern Datum fmgr_sql_validator(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_database_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_function_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_language_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_schema_privilege_id(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset(PG_FUNCTION_ARGS); +extern Datum pg_get_backend_memory_contexts(PG_FUNCTION_ARGS); +extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS); +extern Datum textregexreplace(PG_FUNCTION_ARGS); +extern Datum pg_total_relation_size(PG_FUNCTION_ARGS); +extern Datum pg_size_pretty(PG_FUNCTION_ARGS); +extern Datum pg_options_to_table(PG_FUNCTION_ARGS); +extern Datum record_in(PG_FUNCTION_ARGS); +extern Datum record_out(PG_FUNCTION_ARGS); +extern Datum cstring_in(PG_FUNCTION_ARGS); +extern Datum cstring_out(PG_FUNCTION_ARGS); +extern Datum any_in(PG_FUNCTION_ARGS); +extern Datum any_out(PG_FUNCTION_ARGS); +extern Datum anyarray_in(PG_FUNCTION_ARGS); +extern Datum anyarray_out(PG_FUNCTION_ARGS); +extern Datum void_in(PG_FUNCTION_ARGS); +extern Datum void_out(PG_FUNCTION_ARGS); +extern Datum trigger_in(PG_FUNCTION_ARGS); +extern Datum trigger_out(PG_FUNCTION_ARGS); +extern Datum language_handler_in(PG_FUNCTION_ARGS); +extern Datum language_handler_out(PG_FUNCTION_ARGS); +extern Datum internal_in(PG_FUNCTION_ARGS); +extern Datum internal_out(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_slru(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_slru(PG_FUNCTION_ARGS); +extern Datum dceil(PG_FUNCTION_ARGS); +extern Datum dfloor(PG_FUNCTION_ARGS); +extern Datum dsign(PG_FUNCTION_ARGS); +extern Datum md5_text(PG_FUNCTION_ARGS); +extern Datum anyelement_in(PG_FUNCTION_ARGS); +extern Datum anyelement_out(PG_FUNCTION_ARGS); +extern Datum postgresql_fdw_validator(PG_FUNCTION_ARGS); +extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS); +extern Datum md5_bytea(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_size_oid(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_size_name(PG_FUNCTION_ARGS); +extern Datum pg_database_size_oid(PG_FUNCTION_ARGS); +extern Datum array_unnest(PG_FUNCTION_ARGS); +extern Datum pg_relation_size(PG_FUNCTION_ARGS); +extern Datum array_agg_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum date_lt_timestamp(PG_FUNCTION_ARGS); +extern Datum date_le_timestamp(PG_FUNCTION_ARGS); +extern Datum date_eq_timestamp(PG_FUNCTION_ARGS); +extern Datum date_gt_timestamp(PG_FUNCTION_ARGS); +extern Datum date_ge_timestamp(PG_FUNCTION_ARGS); +extern Datum date_ne_timestamp(PG_FUNCTION_ARGS); +extern Datum date_cmp_timestamp(PG_FUNCTION_ARGS); +extern Datum date_lt_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_le_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_eq_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_gt_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_ge_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_ne_timestamptz(PG_FUNCTION_ARGS); +extern Datum date_cmp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_lt_date(PG_FUNCTION_ARGS); +extern Datum timestamp_le_date(PG_FUNCTION_ARGS); +extern Datum timestamp_eq_date(PG_FUNCTION_ARGS); +extern Datum timestamp_gt_date(PG_FUNCTION_ARGS); +extern Datum timestamp_ge_date(PG_FUNCTION_ARGS); +extern Datum timestamp_ne_date(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_lt_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_le_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_eq_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_gt_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_ge_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_ne_date(PG_FUNCTION_ARGS); +extern Datum timestamptz_cmp_date(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS); +extern Datum shell_in(PG_FUNCTION_ARGS); +extern Datum shell_out(PG_FUNCTION_ARGS); +extern Datum array_recv(PG_FUNCTION_ARGS); +extern Datum array_send(PG_FUNCTION_ARGS); +extern Datum record_recv(PG_FUNCTION_ARGS); +extern Datum record_send(PG_FUNCTION_ARGS); +extern Datum int2recv(PG_FUNCTION_ARGS); +extern Datum int2send(PG_FUNCTION_ARGS); +extern Datum int4recv(PG_FUNCTION_ARGS); +extern Datum int4send(PG_FUNCTION_ARGS); +extern Datum int8recv(PG_FUNCTION_ARGS); +extern Datum int8send(PG_FUNCTION_ARGS); +extern Datum int2vectorrecv(PG_FUNCTION_ARGS); +extern Datum int2vectorsend(PG_FUNCTION_ARGS); +extern Datum bytearecv(PG_FUNCTION_ARGS); +extern Datum byteasend(PG_FUNCTION_ARGS); +extern Datum textrecv(PG_FUNCTION_ARGS); +extern Datum textsend(PG_FUNCTION_ARGS); +extern Datum unknownrecv(PG_FUNCTION_ARGS); +extern Datum unknownsend(PG_FUNCTION_ARGS); +extern Datum oidrecv(PG_FUNCTION_ARGS); +extern Datum oidsend(PG_FUNCTION_ARGS); +extern Datum oidvectorrecv(PG_FUNCTION_ARGS); +extern Datum oidvectorsend(PG_FUNCTION_ARGS); +extern Datum namerecv(PG_FUNCTION_ARGS); +extern Datum namesend(PG_FUNCTION_ARGS); +extern Datum float4recv(PG_FUNCTION_ARGS); +extern Datum float4send(PG_FUNCTION_ARGS); +extern Datum float8recv(PG_FUNCTION_ARGS); +extern Datum float8send(PG_FUNCTION_ARGS); +extern Datum point_recv(PG_FUNCTION_ARGS); +extern Datum point_send(PG_FUNCTION_ARGS); +extern Datum bpcharrecv(PG_FUNCTION_ARGS); +extern Datum bpcharsend(PG_FUNCTION_ARGS); +extern Datum varcharrecv(PG_FUNCTION_ARGS); +extern Datum varcharsend(PG_FUNCTION_ARGS); +extern Datum charrecv(PG_FUNCTION_ARGS); +extern Datum charsend(PG_FUNCTION_ARGS); +extern Datum boolrecv(PG_FUNCTION_ARGS); +extern Datum boolsend(PG_FUNCTION_ARGS); +extern Datum tidrecv(PG_FUNCTION_ARGS); +extern Datum tidsend(PG_FUNCTION_ARGS); +extern Datum xidrecv(PG_FUNCTION_ARGS); +extern Datum xidsend(PG_FUNCTION_ARGS); +extern Datum cidrecv(PG_FUNCTION_ARGS); +extern Datum cidsend(PG_FUNCTION_ARGS); +extern Datum regprocrecv(PG_FUNCTION_ARGS); +extern Datum regprocsend(PG_FUNCTION_ARGS); +extern Datum regprocedurerecv(PG_FUNCTION_ARGS); +extern Datum regproceduresend(PG_FUNCTION_ARGS); +extern Datum regoperrecv(PG_FUNCTION_ARGS); +extern Datum regopersend(PG_FUNCTION_ARGS); +extern Datum regoperatorrecv(PG_FUNCTION_ARGS); +extern Datum regoperatorsend(PG_FUNCTION_ARGS); +extern Datum regclassrecv(PG_FUNCTION_ARGS); +extern Datum regclasssend(PG_FUNCTION_ARGS); +extern Datum regtyperecv(PG_FUNCTION_ARGS); +extern Datum regtypesend(PG_FUNCTION_ARGS); +extern Datum bit_recv(PG_FUNCTION_ARGS); +extern Datum bit_send(PG_FUNCTION_ARGS); +extern Datum varbit_recv(PG_FUNCTION_ARGS); +extern Datum varbit_send(PG_FUNCTION_ARGS); +extern Datum numeric_recv(PG_FUNCTION_ARGS); +extern Datum numeric_send(PG_FUNCTION_ARGS); +extern Datum dsinh(PG_FUNCTION_ARGS); +extern Datum dcosh(PG_FUNCTION_ARGS); +extern Datum dtanh(PG_FUNCTION_ARGS); +extern Datum dasinh(PG_FUNCTION_ARGS); +extern Datum dacosh(PG_FUNCTION_ARGS); +extern Datum datanh(PG_FUNCTION_ARGS); +extern Datum date_recv(PG_FUNCTION_ARGS); +extern Datum date_send(PG_FUNCTION_ARGS); +extern Datum time_recv(PG_FUNCTION_ARGS); +extern Datum time_send(PG_FUNCTION_ARGS); +extern Datum timetz_recv(PG_FUNCTION_ARGS); +extern Datum timetz_send(PG_FUNCTION_ARGS); +extern Datum timestamp_recv(PG_FUNCTION_ARGS); +extern Datum timestamp_send(PG_FUNCTION_ARGS); +extern Datum timestamptz_recv(PG_FUNCTION_ARGS); +extern Datum timestamptz_send(PG_FUNCTION_ARGS); +extern Datum interval_recv(PG_FUNCTION_ARGS); +extern Datum interval_send(PG_FUNCTION_ARGS); +extern Datum lseg_recv(PG_FUNCTION_ARGS); +extern Datum lseg_send(PG_FUNCTION_ARGS); +extern Datum path_recv(PG_FUNCTION_ARGS); +extern Datum path_send(PG_FUNCTION_ARGS); +extern Datum box_recv(PG_FUNCTION_ARGS); +extern Datum box_send(PG_FUNCTION_ARGS); +extern Datum poly_recv(PG_FUNCTION_ARGS); +extern Datum poly_send(PG_FUNCTION_ARGS); +extern Datum line_recv(PG_FUNCTION_ARGS); +extern Datum line_send(PG_FUNCTION_ARGS); +extern Datum circle_recv(PG_FUNCTION_ARGS); +extern Datum circle_send(PG_FUNCTION_ARGS); +extern Datum cash_recv(PG_FUNCTION_ARGS); +extern Datum cash_send(PG_FUNCTION_ARGS); +extern Datum macaddr_recv(PG_FUNCTION_ARGS); +extern Datum macaddr_send(PG_FUNCTION_ARGS); +extern Datum inet_recv(PG_FUNCTION_ARGS); +extern Datum inet_send(PG_FUNCTION_ARGS); +extern Datum cidr_recv(PG_FUNCTION_ARGS); +extern Datum cidr_send(PG_FUNCTION_ARGS); +extern Datum cstring_recv(PG_FUNCTION_ARGS); +extern Datum cstring_send(PG_FUNCTION_ARGS); +extern Datum anyarray_recv(PG_FUNCTION_ARGS); +extern Datum anyarray_send(PG_FUNCTION_ARGS); +extern Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS); +extern Datum pg_get_expr_ext(PG_FUNCTION_ARGS); +extern Datum pg_prepared_statement(PG_FUNCTION_ARGS); +extern Datum pg_cursor(PG_FUNCTION_ARGS); +extern Datum float8_var_pop(PG_FUNCTION_ARGS); +extern Datum float8_stddev_pop(PG_FUNCTION_ARGS); +extern Datum numeric_var_pop(PG_FUNCTION_ARGS); +extern Datum booland_statefunc(PG_FUNCTION_ARGS); +extern Datum boolor_statefunc(PG_FUNCTION_ARGS); +extern Datum timestamp_lt_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_le_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_eq_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_gt_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_ge_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_ne_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamp_cmp_timestamptz(PG_FUNCTION_ARGS); +extern Datum timestamptz_lt_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_le_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_eq_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_gt_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_ge_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_ne_timestamp(PG_FUNCTION_ARGS); +extern Datum timestamptz_cmp_timestamp(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_databases(PG_FUNCTION_ARGS); +extern Datum int4_bool(PG_FUNCTION_ARGS); +extern Datum bool_int4(PG_FUNCTION_ARGS); +extern Datum lastval(PG_FUNCTION_ARGS); +extern Datum pg_postmaster_start_time(PG_FUNCTION_ARGS); +extern Datum pg_blocking_pids(PG_FUNCTION_ARGS); +extern Datum box_below(PG_FUNCTION_ARGS); +extern Datum box_overbelow(PG_FUNCTION_ARGS); +extern Datum box_overabove(PG_FUNCTION_ARGS); +extern Datum box_above(PG_FUNCTION_ARGS); +extern Datum poly_below(PG_FUNCTION_ARGS); +extern Datum poly_overbelow(PG_FUNCTION_ARGS); +extern Datum poly_overabove(PG_FUNCTION_ARGS); +extern Datum poly_above(PG_FUNCTION_ARGS); +extern Datum gist_box_consistent(PG_FUNCTION_ARGS); +extern Datum jsonb_float8(PG_FUNCTION_ARGS); +extern Datum gist_box_penalty(PG_FUNCTION_ARGS); +extern Datum gist_box_picksplit(PG_FUNCTION_ARGS); +extern Datum gist_box_union(PG_FUNCTION_ARGS); +extern Datum gist_box_same(PG_FUNCTION_ARGS); +extern Datum gist_poly_consistent(PG_FUNCTION_ARGS); +extern Datum gist_poly_compress(PG_FUNCTION_ARGS); +extern Datum circle_overbelow(PG_FUNCTION_ARGS); +extern Datum circle_overabove(PG_FUNCTION_ARGS); +extern Datum gist_circle_consistent(PG_FUNCTION_ARGS); +extern Datum gist_circle_compress(PG_FUNCTION_ARGS); +extern Datum numeric_stddev_pop(PG_FUNCTION_ARGS); +extern Datum domain_in(PG_FUNCTION_ARGS); +extern Datum domain_recv(PG_FUNCTION_ARGS); +extern Datum pg_timezone_abbrevs(PG_FUNCTION_ARGS); +extern Datum xmlexists(PG_FUNCTION_ARGS); +extern Datum pg_reload_conf(PG_FUNCTION_ARGS); +extern Datum pg_rotate_logfile(PG_FUNCTION_ARGS); +extern Datum pg_stat_file_1arg(PG_FUNCTION_ARGS); +extern Datum pg_read_file_off_len(PG_FUNCTION_ARGS); +extern Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS); +extern Datum pg_sleep(PG_FUNCTION_ARGS); +extern Datum inetnot(PG_FUNCTION_ARGS); +extern Datum inetand(PG_FUNCTION_ARGS); +extern Datum inetor(PG_FUNCTION_ARGS); +extern Datum inetpl(PG_FUNCTION_ARGS); +extern Datum inetmi_int8(PG_FUNCTION_ARGS); +extern Datum inetmi(PG_FUNCTION_ARGS); +extern Datum statement_timestamp(PG_FUNCTION_ARGS); +extern Datum clock_timestamp(PG_FUNCTION_ARGS); +extern Datum gin_cmp_prefix(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name_id(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id_id(PG_FUNCTION_ARGS); +extern Datum pg_has_role_name(PG_FUNCTION_ARGS); +extern Datum pg_has_role_id(PG_FUNCTION_ARGS); +extern Datum interval_justify_interval(PG_FUNCTION_ARGS); +extern Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS); +extern Datum dasind(PG_FUNCTION_ARGS); +extern Datum dacosd(PG_FUNCTION_ARGS); +extern Datum datand(PG_FUNCTION_ARGS); +extern Datum datan2d(PG_FUNCTION_ARGS); +extern Datum dsind(PG_FUNCTION_ARGS); +extern Datum dcosd(PG_FUNCTION_ARGS); +extern Datum dtand(PG_FUNCTION_ARGS); +extern Datum dcotd(PG_FUNCTION_ARGS); +extern Datum pg_backup_stop(PG_FUNCTION_ARGS); +extern Datum numeric_avg_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum ginarrayextract(PG_FUNCTION_ARGS); +extern Datum ginarrayconsistent(PG_FUNCTION_ARGS); +extern Datum int8_avg_accum(PG_FUNCTION_ARGS); +extern Datum arrayoverlap(PG_FUNCTION_ARGS); +extern Datum arraycontains(PG_FUNCTION_ARGS); +extern Datum arraycontained(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_matches(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_table_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_table(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_array_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_split_to_array(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_num_timed(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_num_requested(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_buffers_written(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_buf_written_clean(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_maxwritten_clean(PG_FUNCTION_ARGS); +extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS); +extern Datum anynonarray_in(PG_FUNCTION_ARGS); +extern Datum anynonarray_out(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_vacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_autovacuum_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_analyze_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_last_autoanalyze_time(PG_FUNCTION_ARGS); +extern Datum int8_avg_combine(PG_FUNCTION_ARGS); +extern Datum int8_avg_serialize(PG_FUNCTION_ARGS); +extern Datum int8_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_wait_event_type(PG_FUNCTION_ARGS); +extern Datum tidgt(PG_FUNCTION_ARGS); +extern Datum tidlt(PG_FUNCTION_ARGS); +extern Datum tidge(PG_FUNCTION_ARGS); +extern Datum tidle(PG_FUNCTION_ARGS); +extern Datum bttidcmp(PG_FUNCTION_ARGS); +extern Datum tidlarger(PG_FUNCTION_ARGS); +extern Datum tidsmaller(PG_FUNCTION_ARGS); +extern Datum int8inc_any(PG_FUNCTION_ARGS); +extern Datum int8inc_float8_float8(PG_FUNCTION_ARGS); +extern Datum float8_regr_accum(PG_FUNCTION_ARGS); +extern Datum float8_regr_sxx(PG_FUNCTION_ARGS); +extern Datum float8_regr_syy(PG_FUNCTION_ARGS); +extern Datum float8_regr_sxy(PG_FUNCTION_ARGS); +extern Datum float8_regr_avgx(PG_FUNCTION_ARGS); +extern Datum float8_regr_avgy(PG_FUNCTION_ARGS); +extern Datum float8_regr_r2(PG_FUNCTION_ARGS); +extern Datum float8_regr_slope(PG_FUNCTION_ARGS); +extern Datum float8_regr_intercept(PG_FUNCTION_ARGS); +extern Datum float8_covar_pop(PG_FUNCTION_ARGS); +extern Datum float8_covar_samp(PG_FUNCTION_ARGS); +extern Datum float8_corr(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blk_read_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_blk_write_time(PG_FUNCTION_ARGS); +extern Datum pg_switch_wal(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_lsn(PG_FUNCTION_ARGS); +extern Datum pg_walfile_name_offset(PG_FUNCTION_ARGS); +extern Datum pg_walfile_name(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_insert_lsn(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_wait_event(PG_FUNCTION_ARGS); +extern Datum pg_my_temp_schema(PG_FUNCTION_ARGS); +extern Datum pg_is_other_temp_schema(PG_FUNCTION_ARGS); +extern Datum pg_timezone_names(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_xact_start(PG_FUNCTION_ARGS); +extern Datum numeric_avg_accum(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_buf_alloc(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_live_tuples(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_dead_tuples(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_unlock_all(PG_FUNCTION_ARGS); +extern Datum xml_in(PG_FUNCTION_ARGS); +extern Datum xml_out(PG_FUNCTION_ARGS); +extern Datum xmlcomment(PG_FUNCTION_ARGS); +extern Datum texttoxml(PG_FUNCTION_ARGS); +extern Datum xmlvalidate(PG_FUNCTION_ARGS); +extern Datum xml_recv(PG_FUNCTION_ARGS); +extern Datum xml_send(PG_FUNCTION_ARGS); +extern Datum xmlconcat2(PG_FUNCTION_ARGS); +extern Datum varbittypmodin(PG_FUNCTION_ARGS); +extern Datum intervaltypmodin(PG_FUNCTION_ARGS); +extern Datum intervaltypmodout(PG_FUNCTION_ARGS); +extern Datum timestamptypmodin(PG_FUNCTION_ARGS); +extern Datum timestamptypmodout(PG_FUNCTION_ARGS); +extern Datum timestamptztypmodin(PG_FUNCTION_ARGS); +extern Datum timestamptztypmodout(PG_FUNCTION_ARGS); +extern Datum timetypmodin(PG_FUNCTION_ARGS); +extern Datum timetypmodout(PG_FUNCTION_ARGS); +extern Datum timetztypmodin(PG_FUNCTION_ARGS); +extern Datum timetztypmodout(PG_FUNCTION_ARGS); +extern Datum bpchartypmodin(PG_FUNCTION_ARGS); +extern Datum bpchartypmodout(PG_FUNCTION_ARGS); +extern Datum varchartypmodin(PG_FUNCTION_ARGS); +extern Datum varchartypmodout(PG_FUNCTION_ARGS); +extern Datum numerictypmodin(PG_FUNCTION_ARGS); +extern Datum numerictypmodout(PG_FUNCTION_ARGS); +extern Datum bittypmodin(PG_FUNCTION_ARGS); +extern Datum bittypmodout(PG_FUNCTION_ARGS); +extern Datum varbittypmodout(PG_FUNCTION_ARGS); +extern Datum xmltotext(PG_FUNCTION_ARGS); +extern Datum table_to_xml(PG_FUNCTION_ARGS); +extern Datum query_to_xml(PG_FUNCTION_ARGS); +extern Datum cursor_to_xml(PG_FUNCTION_ARGS); +extern Datum table_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum query_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum cursor_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum table_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum query_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum xpath(PG_FUNCTION_ARGS); +extern Datum schema_to_xml(PG_FUNCTION_ARGS); +extern Datum schema_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum database_to_xml(PG_FUNCTION_ARGS); +extern Datum database_to_xmlschema(PG_FUNCTION_ARGS); +extern Datum database_to_xml_and_xmlschema(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_in(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_out(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_recv(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_send(PG_FUNCTION_ARGS); +extern Datum pg_current_xact_id(PG_FUNCTION_ARGS); +extern Datum pg_current_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xmin(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xmax(PG_FUNCTION_ARGS); +extern Datum pg_snapshot_xip(PG_FUNCTION_ARGS); +extern Datum pg_visible_in_snapshot(PG_FUNCTION_ARGS); +extern Datum uuid_in(PG_FUNCTION_ARGS); +extern Datum uuid_out(PG_FUNCTION_ARGS); +extern Datum uuid_lt(PG_FUNCTION_ARGS); +extern Datum uuid_le(PG_FUNCTION_ARGS); +extern Datum uuid_eq(PG_FUNCTION_ARGS); +extern Datum uuid_ge(PG_FUNCTION_ARGS); +extern Datum uuid_gt(PG_FUNCTION_ARGS); +extern Datum uuid_ne(PG_FUNCTION_ARGS); +extern Datum uuid_cmp(PG_FUNCTION_ARGS); +extern Datum uuid_recv(PG_FUNCTION_ARGS); +extern Datum uuid_send(PG_FUNCTION_ARGS); +extern Datum uuid_hash(PG_FUNCTION_ARGS); +extern Datum booltext(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_calls(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_total_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_function_self_time(PG_FUNCTION_ARGS); +extern Datum record_eq(PG_FUNCTION_ARGS); +extern Datum record_ne(PG_FUNCTION_ARGS); +extern Datum record_lt(PG_FUNCTION_ARGS); +extern Datum record_gt(PG_FUNCTION_ARGS); +extern Datum record_le(PG_FUNCTION_ARGS); +extern Datum record_ge(PG_FUNCTION_ARGS); +extern Datum btrecordcmp(PG_FUNCTION_ARGS); +extern Datum pg_table_size(PG_FUNCTION_ARGS); +extern Datum pg_indexes_size(PG_FUNCTION_ARGS); +extern Datum pg_relation_filenode(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_server_privilege_id(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_any_column_privilege_id(PG_FUNCTION_ARGS); +extern Datum bitoverlay(PG_FUNCTION_ARGS); +extern Datum bitoverlay_no_len(PG_FUNCTION_ARGS); +extern Datum bitgetbit(PG_FUNCTION_ARGS); +extern Datum bitsetbit(PG_FUNCTION_ARGS); +extern Datum pg_relation_filepath(PG_FUNCTION_ARGS); +extern Datum pg_listening_channels(PG_FUNCTION_ARGS); +extern Datum pg_notify(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_numscans(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_returned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_inserted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_deleted(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_hot_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_blocks_fetched(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_blocks_hit(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_calls(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_total_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_function_self_time(PG_FUNCTION_ARGS); +extern Datum xpath_exists(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed_document(PG_FUNCTION_ARGS); +extern Datum xml_is_well_formed_content(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_vacuum_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_autovacuum_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_analyze_count(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_autoanalyze_count(PG_FUNCTION_ARGS); +extern Datum text_concat(PG_FUNCTION_ARGS); +extern Datum text_concat_ws(PG_FUNCTION_ARGS); +extern Datum text_left(PG_FUNCTION_ARGS); +extern Datum text_right(PG_FUNCTION_ARGS); +extern Datum text_reverse(PG_FUNCTION_ARGS); +extern Datum gist_point_distance(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_tablespace(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_lock(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_bufferpin(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_startup_deadlock(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_all(PG_FUNCTION_ARGS); +extern Datum pg_wal_replay_pause(PG_FUNCTION_ARGS); +extern Datum pg_wal_replay_resume(PG_FUNCTION_ARGS); +extern Datum pg_is_wal_replay_paused(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_bgwriter_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsvector_2args(PG_FUNCTION_ARGS); +extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS); +extern Datum pg_available_extensions(PG_FUNCTION_ARGS); +extern Datum pg_available_extension_versions(PG_FUNCTION_ARGS); +extern Datum pg_extension_update_paths(PG_FUNCTION_ARGS); +extern Datum pg_extension_config_dump(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery_5args(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_int8(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_shared_int8(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_int4(PG_FUNCTION_ARGS); +extern Datum pg_try_advisory_xact_lock_shared_int4(PG_FUNCTION_ARGS); +extern Datum varchar_support(PG_FUNCTION_ARGS); +extern Datum pg_create_restore_point(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS); +extern Datum window_row_number(PG_FUNCTION_ARGS); +extern Datum window_rank(PG_FUNCTION_ARGS); +extern Datum window_dense_rank(PG_FUNCTION_ARGS); +extern Datum window_percent_rank(PG_FUNCTION_ARGS); +extern Datum window_cume_dist(PG_FUNCTION_ARGS); +extern Datum window_ntile(PG_FUNCTION_ARGS); +extern Datum window_lag(PG_FUNCTION_ARGS); +extern Datum window_lag_with_offset(PG_FUNCTION_ARGS); +extern Datum window_lag_with_offset_and_default(PG_FUNCTION_ARGS); +extern Datum window_lead(PG_FUNCTION_ARGS); +extern Datum window_lead_with_offset(PG_FUNCTION_ARGS); +extern Datum window_lead_with_offset_and_default(PG_FUNCTION_ARGS); +extern Datum window_first_value(PG_FUNCTION_ARGS); +extern Datum window_last_value(PG_FUNCTION_ARGS); +extern Datum window_nth_value(PG_FUNCTION_ARGS); +extern Datum fdw_handler_in(PG_FUNCTION_ARGS); +extern Datum fdw_handler_out(PG_FUNCTION_ARGS); +extern Datum void_recv(PG_FUNCTION_ARGS); +extern Datum void_send(PG_FUNCTION_ARGS); +extern Datum btint2sortsupport(PG_FUNCTION_ARGS); +extern Datum btint4sortsupport(PG_FUNCTION_ARGS); +extern Datum btint8sortsupport(PG_FUNCTION_ARGS); +extern Datum btfloat4sortsupport(PG_FUNCTION_ARGS); +extern Datum btfloat8sortsupport(PG_FUNCTION_ARGS); +extern Datum btoidsortsupport(PG_FUNCTION_ARGS); +extern Datum btnamesortsupport(PG_FUNCTION_ARGS); +extern Datum date_sortsupport(PG_FUNCTION_ARGS); +extern Datum timestamp_sortsupport(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name_id(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id_id(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_name(PG_FUNCTION_ARGS); +extern Datum has_type_privilege_id(PG_FUNCTION_ARGS); +extern Datum macaddr_not(PG_FUNCTION_ARGS); +extern Datum macaddr_and(PG_FUNCTION_ARGS); +extern Datum macaddr_or(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_temp_files(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_temp_bytes(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_deadlocks(PG_FUNCTION_ARGS); +extern Datum array_to_json(PG_FUNCTION_ARGS); +extern Datum array_to_json_pretty(PG_FUNCTION_ARGS); +extern Datum row_to_json(PG_FUNCTION_ARGS); +extern Datum row_to_json_pretty(PG_FUNCTION_ARGS); +extern Datum numeric_support(PG_FUNCTION_ARGS); +extern Datum varbit_support(PG_FUNCTION_ARGS); +extern Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_write_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_sync_time(PG_FUNCTION_ARGS); +extern Datum pg_collation_for(PG_FUNCTION_ARGS); +extern Datum pg_trigger_depth(PG_FUNCTION_ARGS); +extern Datum pg_wal_lsn_diff(PG_FUNCTION_ARGS); +extern Datum pg_size_pretty_numeric(PG_FUNCTION_ARGS); +extern Datum array_remove(PG_FUNCTION_ARGS); +extern Datum array_replace(PG_FUNCTION_ARGS); +extern Datum rangesel(PG_FUNCTION_ARGS); +extern Datum be_lo_lseek64(PG_FUNCTION_ARGS); +extern Datum be_lo_tell64(PG_FUNCTION_ARGS); +extern Datum be_lo_truncate64(PG_FUNCTION_ARGS); +extern Datum json_agg_transfn(PG_FUNCTION_ARGS); +extern Datum json_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum to_json(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_mod_since_analyze(PG_FUNCTION_ARGS); +extern Datum numeric_sum(PG_FUNCTION_ARGS); +extern Datum array_cardinality(PG_FUNCTION_ARGS); +extern Datum json_object_agg_transfn(PG_FUNCTION_ARGS); +extern Datum record_image_eq(PG_FUNCTION_ARGS); +extern Datum record_image_ne(PG_FUNCTION_ARGS); +extern Datum record_image_lt(PG_FUNCTION_ARGS); +extern Datum record_image_gt(PG_FUNCTION_ARGS); +extern Datum record_image_le(PG_FUNCTION_ARGS); +extern Datum record_image_ge(PG_FUNCTION_ARGS); +extern Datum btrecordimagecmp(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_archiver(PG_FUNCTION_ARGS); +extern Datum json_object_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum json_build_array(PG_FUNCTION_ARGS); +extern Datum json_build_array_noargs(PG_FUNCTION_ARGS); +extern Datum json_build_object(PG_FUNCTION_ARGS); +extern Datum json_build_object_noargs(PG_FUNCTION_ARGS); +extern Datum json_object(PG_FUNCTION_ARGS); +extern Datum json_object_two_arg(PG_FUNCTION_ARGS); +extern Datum json_to_record(PG_FUNCTION_ARGS); +extern Datum json_to_recordset(PG_FUNCTION_ARGS); +extern Datum jsonb_array_length(PG_FUNCTION_ARGS); +extern Datum jsonb_each(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_record(PG_FUNCTION_ARGS); +extern Datum jsonb_typeof(PG_FUNCTION_ARGS); +extern Datum jsonb_object_field_text(PG_FUNCTION_ARGS); +extern Datum jsonb_array_element(PG_FUNCTION_ARGS); +extern Datum jsonb_array_element_text(PG_FUNCTION_ARGS); +extern Datum jsonb_extract_path(PG_FUNCTION_ARGS); +extern Datum width_bucket_array(PG_FUNCTION_ARGS); +extern Datum jsonb_array_elements(PG_FUNCTION_ARGS); +extern Datum pg_lsn_in(PG_FUNCTION_ARGS); +extern Datum pg_lsn_out(PG_FUNCTION_ARGS); +extern Datum pg_lsn_lt(PG_FUNCTION_ARGS); +extern Datum pg_lsn_le(PG_FUNCTION_ARGS); +extern Datum pg_lsn_eq(PG_FUNCTION_ARGS); +extern Datum pg_lsn_ge(PG_FUNCTION_ARGS); +extern Datum pg_lsn_gt(PG_FUNCTION_ARGS); +extern Datum pg_lsn_ne(PG_FUNCTION_ARGS); +extern Datum pg_lsn_mi(PG_FUNCTION_ARGS); +extern Datum pg_lsn_recv(PG_FUNCTION_ARGS); +extern Datum pg_lsn_send(PG_FUNCTION_ARGS); +extern Datum pg_lsn_cmp(PG_FUNCTION_ARGS); +extern Datum pg_lsn_hash(PG_FUNCTION_ARGS); +extern Datum bttextsortsupport(PG_FUNCTION_ARGS); +extern Datum generate_series_step_numeric(PG_FUNCTION_ARGS); +extern Datum generate_series_numeric(PG_FUNCTION_ARGS); +extern Datum json_strip_nulls(PG_FUNCTION_ARGS); +extern Datum jsonb_strip_nulls(PG_FUNCTION_ARGS); +extern Datum jsonb_object(PG_FUNCTION_ARGS); +extern Datum jsonb_object_two_arg(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum jsonb_build_array(PG_FUNCTION_ARGS); +extern Datum jsonb_build_array_noargs(PG_FUNCTION_ARGS); +extern Datum jsonb_build_object(PG_FUNCTION_ARGS); +extern Datum jsonb_build_object_noargs(PG_FUNCTION_ARGS); +extern Datum dist_ppoly(PG_FUNCTION_ARGS); +extern Datum array_position(PG_FUNCTION_ARGS); +extern Datum array_position_start(PG_FUNCTION_ARGS); +extern Datum array_positions(PG_FUNCTION_ARGS); +extern Datum gist_circle_distance(PG_FUNCTION_ARGS); +extern Datum numeric_scale(PG_FUNCTION_ARGS); +extern Datum gist_point_fetch(PG_FUNCTION_ARGS); +extern Datum numeric_sortsupport(PG_FUNCTION_ARGS); +extern Datum gist_poly_distance(PG_FUNCTION_ARGS); +extern Datum dist_cpoint(PG_FUNCTION_ARGS); +extern Datum dist_polyp(PG_FUNCTION_ARGS); +extern Datum pg_read_file_off_len_missing(PG_FUNCTION_ARGS); +extern Datum show_config_by_name_missing_ok(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_off_len_missing(PG_FUNCTION_ARGS); +extern Datum pg_notification_queue_usage(PG_FUNCTION_ARGS); +extern Datum pg_ls_dir(PG_FUNCTION_ARGS); +extern Datum row_security_active(PG_FUNCTION_ARGS); +extern Datum row_security_active_name(PG_FUNCTION_ARGS); +extern Datum uuid_sortsupport(PG_FUNCTION_ARGS); +extern Datum jsonb_concat(PG_FUNCTION_ARGS); +extern Datum jsonb_delete(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_idx(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_path(PG_FUNCTION_ARGS); +extern Datum jsonb_set(PG_FUNCTION_ARGS); +extern Datum jsonb_pretty(PG_FUNCTION_ARGS); +extern Datum pg_stat_file(PG_FUNCTION_ARGS); +extern Datum xidneq(PG_FUNCTION_ARGS); +extern Datum tsm_handler_in(PG_FUNCTION_ARGS); +extern Datum tsm_handler_out(PG_FUNCTION_ARGS); +extern Datum tsm_bernoulli_handler(PG_FUNCTION_ARGS); +extern Datum tsm_system_handler(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_wal_receiver(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_progress_info(PG_FUNCTION_ARGS); +extern Datum tsvector_filter(PG_FUNCTION_ARGS); +extern Datum tsvector_setweight_by_filter(PG_FUNCTION_ARGS); +extern Datum tsvector_delete_str(PG_FUNCTION_ARGS); +extern Datum tsvector_unnest(PG_FUNCTION_ARGS); +extern Datum tsvector_delete_arr(PG_FUNCTION_ARGS); +extern Datum int4_avg_combine(PG_FUNCTION_ARGS); +extern Datum interval_avg_combine(PG_FUNCTION_ARGS); +extern Datum tsvector_to_array(PG_FUNCTION_ARGS); +extern Datum array_to_tsvector(PG_FUNCTION_ARGS); +extern Datum bpchar_sortsupport(PG_FUNCTION_ARGS); +extern Datum show_all_file_settings(PG_FUNCTION_ARGS); +extern Datum pg_current_wal_flush_lsn(PG_FUNCTION_ARGS); +extern Datum bytea_sortsupport(PG_FUNCTION_ARGS); +extern Datum bttext_pattern_sortsupport(PG_FUNCTION_ARGS); +extern Datum btbpchar_pattern_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_size_bytes(PG_FUNCTION_ARGS); +extern Datum numeric_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_deserialize(PG_FUNCTION_ARGS); +extern Datum numeric_avg_combine(PG_FUNCTION_ARGS); +extern Datum numeric_poly_combine(PG_FUNCTION_ARGS); +extern Datum numeric_poly_serialize(PG_FUNCTION_ARGS); +extern Datum numeric_poly_deserialize(PG_FUNCTION_ARGS); +extern Datum numeric_combine(PG_FUNCTION_ARGS); +extern Datum float8_regr_combine(PG_FUNCTION_ARGS); +extern Datum jsonb_delete_array(PG_FUNCTION_ARGS); +extern Datum cash_mul_int8(PG_FUNCTION_ARGS); +extern Datum cash_div_int8(PG_FUNCTION_ARGS); +extern Datum pg_current_xact_id_if_assigned(PG_FUNCTION_ARGS); +extern Datum pg_get_partkeydef(PG_FUNCTION_ARGS); +extern Datum pg_ls_logdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_waldir(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_in(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_out(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_recv(PG_FUNCTION_ARGS); +extern Datum pg_ndistinct_send(PG_FUNCTION_ARGS); +extern Datum macaddr_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_xact_status(PG_FUNCTION_ARGS); +extern Datum pg_safe_snapshot_blocking_pids(PG_FUNCTION_ARGS); +extern Datum pg_isolation_test_session_is_blocked(PG_FUNCTION_ARGS); +extern Datum pg_identify_object_as_address(PG_FUNCTION_ARGS); +extern Datum brin_minmax_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_minmax_add_value(PG_FUNCTION_ARGS); +extern Datum brin_minmax_consistent(PG_FUNCTION_ARGS); +extern Datum brin_minmax_union(PG_FUNCTION_ARGS); +extern Datum int8_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum numeric_poly_sum(PG_FUNCTION_ARGS); +extern Datum numeric_poly_avg(PG_FUNCTION_ARGS); +extern Datum numeric_poly_var_pop(PG_FUNCTION_ARGS); +extern Datum numeric_poly_var_samp(PG_FUNCTION_ARGS); +extern Datum numeric_poly_stddev_pop(PG_FUNCTION_ARGS); +extern Datum numeric_poly_stddev_samp(PG_FUNCTION_ARGS); +extern Datum regexp_match_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_match(PG_FUNCTION_ARGS); +extern Datum int8_mul_cash(PG_FUNCTION_ARGS); +extern Datum pg_config(PG_FUNCTION_ARGS); +extern Datum pg_hba_file_rules(PG_FUNCTION_ARGS); +extern Datum pg_statistics_obj_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_in(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_out(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_recv(PG_FUNCTION_ARGS); +extern Datum pg_dependencies_send(PG_FUNCTION_ARGS); +extern Datum pg_get_partition_constraintdef(PG_FUNCTION_ARGS); +extern Datum time_hash_extended(PG_FUNCTION_ARGS); +extern Datum timetz_hash_extended(PG_FUNCTION_ARGS); +extern Datum timestamp_hash_extended(PG_FUNCTION_ARGS); +extern Datum uuid_hash_extended(PG_FUNCTION_ARGS); +extern Datum pg_lsn_hash_extended(PG_FUNCTION_ARGS); +extern Datum hashenumextended(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef(PG_FUNCTION_ARGS); +extern Datum jsonb_hash_extended(PG_FUNCTION_ARGS); +extern Datum hash_range_extended(PG_FUNCTION_ARGS); +extern Datum interval_hash_extended(PG_FUNCTION_ARGS); +extern Datum sha224_bytea(PG_FUNCTION_ARGS); +extern Datum sha256_bytea(PG_FUNCTION_ARGS); +extern Datum sha384_bytea(PG_FUNCTION_ARGS); +extern Datum sha512_bytea(PG_FUNCTION_ARGS); +extern Datum pg_partition_tree(PG_FUNCTION_ARGS); +extern Datum pg_partition_root(PG_FUNCTION_ARGS); +extern Datum pg_partition_ancestors(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_checksum_failures(PG_FUNCTION_ARGS); +extern Datum pg_stats_ext_mcvlist_items(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_checksum_last_failure(PG_FUNCTION_ARGS); +extern Datum gen_random_uuid(PG_FUNCTION_ARGS); +extern Datum gtsvector_options(PG_FUNCTION_ARGS); +extern Datum gist_point_sortsupport(PG_FUNCTION_ARGS); +extern Datum pg_promote(PG_FUNCTION_ARGS); +extern Datum prefixsel(PG_FUNCTION_ARGS); +extern Datum prefixjoinsel(PG_FUNCTION_ARGS); +extern Datum pg_control_system(PG_FUNCTION_ARGS); +extern Datum pg_control_checkpoint(PG_FUNCTION_ARGS); +extern Datum pg_control_recovery(PG_FUNCTION_ARGS); +extern Datum pg_control_init(PG_FUNCTION_ARGS); +extern Datum pg_import_system_collations(PG_FUNCTION_ARGS); +extern Datum macaddr8_recv(PG_FUNCTION_ARGS); +extern Datum macaddr8_send(PG_FUNCTION_ARGS); +extern Datum pg_collation_actual_version(PG_FUNCTION_ARGS); +extern Datum jsonb_numeric(PG_FUNCTION_ARGS); +extern Datum jsonb_int2(PG_FUNCTION_ARGS); +extern Datum jsonb_int4(PG_FUNCTION_ARGS); +extern Datum jsonb_int8(PG_FUNCTION_ARGS); +extern Datum jsonb_float4(PG_FUNCTION_ARGS); +extern Datum pg_filenode_relation(PG_FUNCTION_ARGS); +extern Datum be_lo_from_bytea(PG_FUNCTION_ARGS); +extern Datum be_lo_get(PG_FUNCTION_ARGS); +extern Datum be_lo_get_fragment(PG_FUNCTION_ARGS); +extern Datum be_lo_put(PG_FUNCTION_ARGS); +extern Datum make_timestamp(PG_FUNCTION_ARGS); +extern Datum make_timestamptz(PG_FUNCTION_ARGS); +extern Datum make_timestamptz_at_timezone(PG_FUNCTION_ARGS); +extern Datum make_interval(PG_FUNCTION_ARGS); +extern Datum jsonb_array_elements_text(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_range_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_recordset(PG_FUNCTION_ARGS); +extern Datum to_regoperator(PG_FUNCTION_ARGS); +extern Datum jsonb_object_field(PG_FUNCTION_ARGS); +extern Datum to_regprocedure(PG_FUNCTION_ARGS); +extern Datum gin_compare_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_query(PG_FUNCTION_ARGS); +extern Datum gin_consistent_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_path(PG_FUNCTION_ARGS); +extern Datum gin_extract_jsonb_query_path(PG_FUNCTION_ARGS); +extern Datum gin_consistent_jsonb_path(PG_FUNCTION_ARGS); +extern Datum gin_triconsistent_jsonb(PG_FUNCTION_ARGS); +extern Datum gin_triconsistent_jsonb_path(PG_FUNCTION_ARGS); +extern Datum jsonb_to_record(PG_FUNCTION_ARGS); +extern Datum jsonb_to_recordset(PG_FUNCTION_ARGS); +extern Datum to_regoper(PG_FUNCTION_ARGS); +extern Datum to_regtype(PG_FUNCTION_ARGS); +extern Datum to_regproc(PG_FUNCTION_ARGS); +extern Datum to_regclass(PG_FUNCTION_ARGS); +extern Datum bool_accum(PG_FUNCTION_ARGS); +extern Datum bool_accum_inv(PG_FUNCTION_ARGS); +extern Datum bool_alltrue(PG_FUNCTION_ARGS); +extern Datum bool_anytrue(PG_FUNCTION_ARGS); +extern Datum anyenum_in(PG_FUNCTION_ARGS); +extern Datum anyenum_out(PG_FUNCTION_ARGS); +extern Datum enum_in(PG_FUNCTION_ARGS); +extern Datum enum_out(PG_FUNCTION_ARGS); +extern Datum enum_eq(PG_FUNCTION_ARGS); +extern Datum enum_ne(PG_FUNCTION_ARGS); +extern Datum enum_lt(PG_FUNCTION_ARGS); +extern Datum enum_gt(PG_FUNCTION_ARGS); +extern Datum enum_le(PG_FUNCTION_ARGS); +extern Datum enum_ge(PG_FUNCTION_ARGS); +extern Datum enum_cmp(PG_FUNCTION_ARGS); +extern Datum hashenum(PG_FUNCTION_ARGS); +extern Datum enum_smaller(PG_FUNCTION_ARGS); +extern Datum enum_larger(PG_FUNCTION_ARGS); +extern Datum enum_first(PG_FUNCTION_ARGS); +extern Datum enum_last(PG_FUNCTION_ARGS); +extern Datum enum_range_bounds(PG_FUNCTION_ARGS); +extern Datum enum_range_all(PG_FUNCTION_ARGS); +extern Datum enum_recv(PG_FUNCTION_ARGS); +extern Datum enum_send(PG_FUNCTION_ARGS); +extern Datum string_agg_transfn(PG_FUNCTION_ARGS); +extern Datum string_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum pg_describe_object(PG_FUNCTION_ARGS); +extern Datum text_format(PG_FUNCTION_ARGS); +extern Datum text_format_nv(PG_FUNCTION_ARGS); +extern Datum bytea_string_agg_transfn(PG_FUNCTION_ARGS); +extern Datum bytea_string_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum int8dec(PG_FUNCTION_ARGS); +extern Datum int8dec_any(PG_FUNCTION_ARGS); +extern Datum numeric_accum_inv(PG_FUNCTION_ARGS); +extern Datum interval_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum network_overlap(PG_FUNCTION_ARGS); +extern Datum inet_gist_consistent(PG_FUNCTION_ARGS); +extern Datum inet_gist_union(PG_FUNCTION_ARGS); +extern Datum inet_gist_compress(PG_FUNCTION_ARGS); +extern Datum jsonb_bool(PG_FUNCTION_ARGS); +extern Datum inet_gist_penalty(PG_FUNCTION_ARGS); +extern Datum inet_gist_picksplit(PG_FUNCTION_ARGS); +extern Datum inet_gist_same(PG_FUNCTION_ARGS); +extern Datum networksel(PG_FUNCTION_ARGS); +extern Datum networkjoinsel(PG_FUNCTION_ARGS); +extern Datum network_larger(PG_FUNCTION_ARGS); +extern Datum network_smaller(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS); +extern Datum int2_accum_inv(PG_FUNCTION_ARGS); +extern Datum int4_accum_inv(PG_FUNCTION_ARGS); +extern Datum int8_accum_inv(PG_FUNCTION_ARGS); +extern Datum int2_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum int4_avg_accum_inv(PG_FUNCTION_ARGS); +extern Datum int2int4_sum(PG_FUNCTION_ARGS); +extern Datum inet_gist_fetch(PG_FUNCTION_ARGS); +extern Datum pg_logical_emit_message_text(PG_FUNCTION_ARGS); +extern Datum pg_logical_emit_message_bytea(PG_FUNCTION_ARGS); +extern Datum jsonb_insert(PG_FUNCTION_ARGS); +extern Datum pg_xact_commit_timestamp(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum pg_last_committed_xact(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_array_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_heap_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_index_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_toast_pg_class_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_enum_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_authid_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_create_empty_extension(PG_FUNCTION_ARGS); +extern Datum event_trigger_in(PG_FUNCTION_ARGS); +extern Datum event_trigger_out(PG_FUNCTION_ARGS); +extern Datum tsvectorin(PG_FUNCTION_ARGS); +extern Datum tsvectorout(PG_FUNCTION_ARGS); +extern Datum tsqueryin(PG_FUNCTION_ARGS); +extern Datum tsqueryout(PG_FUNCTION_ARGS); +extern Datum tsvector_lt(PG_FUNCTION_ARGS); +extern Datum tsvector_le(PG_FUNCTION_ARGS); +extern Datum tsvector_eq(PG_FUNCTION_ARGS); +extern Datum tsvector_ne(PG_FUNCTION_ARGS); +extern Datum tsvector_ge(PG_FUNCTION_ARGS); +extern Datum tsvector_gt(PG_FUNCTION_ARGS); +extern Datum tsvector_cmp(PG_FUNCTION_ARGS); +extern Datum tsvector_strip(PG_FUNCTION_ARGS); +extern Datum tsvector_setweight(PG_FUNCTION_ARGS); +extern Datum tsvector_concat(PG_FUNCTION_ARGS); +extern Datum ts_match_vq(PG_FUNCTION_ARGS); +extern Datum ts_match_qv(PG_FUNCTION_ARGS); +extern Datum tsvectorsend(PG_FUNCTION_ARGS); +extern Datum tsvectorrecv(PG_FUNCTION_ARGS); +extern Datum tsquerysend(PG_FUNCTION_ARGS); +extern Datum tsqueryrecv(PG_FUNCTION_ARGS); +extern Datum gtsvectorin(PG_FUNCTION_ARGS); +extern Datum gtsvectorout(PG_FUNCTION_ARGS); +extern Datum gtsvector_compress(PG_FUNCTION_ARGS); +extern Datum gtsvector_decompress(PG_FUNCTION_ARGS); +extern Datum gtsvector_picksplit(PG_FUNCTION_ARGS); +extern Datum gtsvector_union(PG_FUNCTION_ARGS); +extern Datum gtsvector_same(PG_FUNCTION_ARGS); +extern Datum gtsvector_penalty(PG_FUNCTION_ARGS); +extern Datum gtsvector_consistent(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsvector(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent(PG_FUNCTION_ARGS); +extern Datum tsquery_lt(PG_FUNCTION_ARGS); +extern Datum tsquery_le(PG_FUNCTION_ARGS); +extern Datum tsquery_eq(PG_FUNCTION_ARGS); +extern Datum tsquery_ne(PG_FUNCTION_ARGS); +extern Datum tsquery_ge(PG_FUNCTION_ARGS); +extern Datum tsquery_gt(PG_FUNCTION_ARGS); +extern Datum tsquery_cmp(PG_FUNCTION_ARGS); +extern Datum tsquery_and(PG_FUNCTION_ARGS); +extern Datum tsquery_or(PG_FUNCTION_ARGS); +extern Datum tsquery_not(PG_FUNCTION_ARGS); +extern Datum tsquery_numnode(PG_FUNCTION_ARGS); +extern Datum tsquerytree(PG_FUNCTION_ARGS); +extern Datum tsquery_rewrite(PG_FUNCTION_ARGS); +extern Datum tsquery_rewrite_query(PG_FUNCTION_ARGS); +extern Datum tsmatchsel(PG_FUNCTION_ARGS); +extern Datum tsmatchjoinsel(PG_FUNCTION_ARGS); +extern Datum ts_typanalyze(PG_FUNCTION_ARGS); +extern Datum ts_stat1(PG_FUNCTION_ARGS); +extern Datum ts_stat2(PG_FUNCTION_ARGS); +extern Datum tsq_mcontains(PG_FUNCTION_ARGS); +extern Datum tsq_mcontained(PG_FUNCTION_ARGS); +extern Datum gtsquery_compress(PG_FUNCTION_ARGS); +extern Datum text_starts_with(PG_FUNCTION_ARGS); +extern Datum gtsquery_picksplit(PG_FUNCTION_ARGS); +extern Datum gtsquery_union(PG_FUNCTION_ARGS); +extern Datum gtsquery_same(PG_FUNCTION_ARGS); +extern Datum gtsquery_penalty(PG_FUNCTION_ARGS); +extern Datum gtsquery_consistent(PG_FUNCTION_ARGS); +extern Datum ts_rank_wttf(PG_FUNCTION_ARGS); +extern Datum ts_rank_wtt(PG_FUNCTION_ARGS); +extern Datum ts_rank_ttf(PG_FUNCTION_ARGS); +extern Datum ts_rank_tt(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_wttf(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_wtt(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_ttf(PG_FUNCTION_ARGS); +extern Datum ts_rankcd_tt(PG_FUNCTION_ARGS); +extern Datum tsvector_length(PG_FUNCTION_ARGS); +extern Datum ts_token_type_byid(PG_FUNCTION_ARGS); +extern Datum ts_token_type_byname(PG_FUNCTION_ARGS); +extern Datum ts_parse_byid(PG_FUNCTION_ARGS); +extern Datum ts_parse_byname(PG_FUNCTION_ARGS); +extern Datum prsd_start(PG_FUNCTION_ARGS); +extern Datum prsd_nexttoken(PG_FUNCTION_ARGS); +extern Datum prsd_end(PG_FUNCTION_ARGS); +extern Datum prsd_headline(PG_FUNCTION_ARGS); +extern Datum prsd_lextype(PG_FUNCTION_ARGS); +extern Datum ts_lexize(PG_FUNCTION_ARGS); +extern Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS); +extern Datum dsimple_init(PG_FUNCTION_ARGS); +extern Datum dsimple_lexize(PG_FUNCTION_ARGS); +extern Datum dsynonym_init(PG_FUNCTION_ARGS); +extern Datum dsynonym_lexize(PG_FUNCTION_ARGS); +extern Datum dispell_init(PG_FUNCTION_ARGS); +extern Datum dispell_lexize(PG_FUNCTION_ARGS); +extern Datum regconfigin(PG_FUNCTION_ARGS); +extern Datum regconfigout(PG_FUNCTION_ARGS); +extern Datum regconfigrecv(PG_FUNCTION_ARGS); +extern Datum regconfigsend(PG_FUNCTION_ARGS); +extern Datum thesaurus_init(PG_FUNCTION_ARGS); +extern Datum thesaurus_lexize(PG_FUNCTION_ARGS); +extern Datum ts_headline_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_byid(PG_FUNCTION_ARGS); +extern Datum to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum to_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum plainto_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum to_tsvector(PG_FUNCTION_ARGS); +extern Datum to_tsquery(PG_FUNCTION_ARGS); +extern Datum plainto_tsquery(PG_FUNCTION_ARGS); +extern Datum tsvector_update_trigger_byid(PG_FUNCTION_ARGS); +extern Datum tsvector_update_trigger_bycolumn(PG_FUNCTION_ARGS); +extern Datum ts_headline_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline(PG_FUNCTION_ARGS); +extern Datum pg_ts_parser_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_ts_dict_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_ts_config_is_visible(PG_FUNCTION_ARGS); +extern Datum get_current_ts_config(PG_FUNCTION_ARGS); +extern Datum ts_match_tt(PG_FUNCTION_ARGS); +extern Datum ts_match_tq(PG_FUNCTION_ARGS); +extern Datum pg_ts_template_is_visible(PG_FUNCTION_ARGS); +extern Datum regdictionaryin(PG_FUNCTION_ARGS); +extern Datum regdictionaryout(PG_FUNCTION_ARGS); +extern Datum regdictionaryrecv(PG_FUNCTION_ARGS); +extern Datum regdictionarysend(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_shared(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_single_table_counters(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_single_function_counters(PG_FUNCTION_ARGS); +extern Datum pg_tablespace_location(PG_FUNCTION_ARGS); +extern Datum pg_create_physical_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_drop_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_get_replication_slots(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_get_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_get_binary_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_peek_changes(PG_FUNCTION_ARGS); +extern Datum pg_logical_slot_peek_binary_changes(PG_FUNCTION_ARGS); +extern Datum pg_create_logical_replication_slot(PG_FUNCTION_ARGS); +extern Datum to_jsonb(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_snapshot_timestamp(PG_FUNCTION_ARGS); +extern Datum gin_clean_pending_list(PG_FUNCTION_ARGS); +extern Datum gtsvector_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum gin_extract_tsquery_oldsig(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum gtsquery_consistent_oldsig(PG_FUNCTION_ARGS); +extern Datum inet_spg_config(PG_FUNCTION_ARGS); +extern Datum inet_spg_choose(PG_FUNCTION_ARGS); +extern Datum inet_spg_picksplit(PG_FUNCTION_ARGS); +extern Datum inet_spg_inner_consistent(PG_FUNCTION_ARGS); +extern Datum inet_spg_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_current_logfile(PG_FUNCTION_ARGS); +extern Datum pg_current_logfile_1arg(PG_FUNCTION_ARGS); +extern Datum jsonb_send(PG_FUNCTION_ARGS); +extern Datum jsonb_out(PG_FUNCTION_ARGS); +extern Datum jsonb_recv(PG_FUNCTION_ARGS); +extern Datum jsonb_in(PG_FUNCTION_ARGS); +extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS); +extern Datum pg_export_snapshot(PG_FUNCTION_ARGS); +extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS); +extern Datum int4_cash(PG_FUNCTION_ARGS); +extern Datum int8_cash(PG_FUNCTION_ARGS); +extern Datum xmltext(PG_FUNCTION_ARGS); +extern Datum pg_collation_is_visible(PG_FUNCTION_ARGS); +extern Datum array_typanalyze(PG_FUNCTION_ARGS); +extern Datum arraycontsel(PG_FUNCTION_ARGS); +extern Datum arraycontjoinsel(PG_FUNCTION_ARGS); +extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS); +extern Datum pg_last_wal_receive_lsn(PG_FUNCTION_ARGS); +extern Datum pg_last_wal_replay_lsn(PG_FUNCTION_ARGS); +extern Datum cash_div_cash(PG_FUNCTION_ARGS); +extern Datum cash_numeric(PG_FUNCTION_ARGS); +extern Datum numeric_cash(PG_FUNCTION_ARGS); +extern Datum pg_read_file_all(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS); +extern Datum pg_opfamily_is_visible(PG_FUNCTION_ARGS); +extern Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS); +extern Datum anyrange_in(PG_FUNCTION_ARGS); +extern Datum anyrange_out(PG_FUNCTION_ARGS); +extern Datum range_in(PG_FUNCTION_ARGS); +extern Datum range_out(PG_FUNCTION_ARGS); +extern Datum range_recv(PG_FUNCTION_ARGS); +extern Datum range_send(PG_FUNCTION_ARGS); +extern Datum pg_identify_object(PG_FUNCTION_ARGS); +extern Datum range_constructor2(PG_FUNCTION_ARGS); +extern Datum range_constructor3(PG_FUNCTION_ARGS); +extern Datum pg_relation_is_updatable(PG_FUNCTION_ARGS); +extern Datum pg_column_is_updatable(PG_FUNCTION_ARGS); +extern Datum make_date(PG_FUNCTION_ARGS); +extern Datum make_time(PG_FUNCTION_ARGS); +extern Datum range_lower(PG_FUNCTION_ARGS); +extern Datum range_upper(PG_FUNCTION_ARGS); +extern Datum range_empty(PG_FUNCTION_ARGS); +extern Datum range_lower_inc(PG_FUNCTION_ARGS); +extern Datum range_upper_inc(PG_FUNCTION_ARGS); +extern Datum range_lower_inf(PG_FUNCTION_ARGS); +extern Datum range_upper_inf(PG_FUNCTION_ARGS); +extern Datum range_eq(PG_FUNCTION_ARGS); +extern Datum range_ne(PG_FUNCTION_ARGS); +extern Datum range_overlaps(PG_FUNCTION_ARGS); +extern Datum range_contains_elem(PG_FUNCTION_ARGS); +extern Datum range_contains(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_range(PG_FUNCTION_ARGS); +extern Datum range_contained_by(PG_FUNCTION_ARGS); +extern Datum range_adjacent(PG_FUNCTION_ARGS); +extern Datum range_before(PG_FUNCTION_ARGS); +extern Datum range_after(PG_FUNCTION_ARGS); +extern Datum range_overleft(PG_FUNCTION_ARGS); +extern Datum range_overright(PG_FUNCTION_ARGS); +extern Datum range_union(PG_FUNCTION_ARGS); +extern Datum range_intersect(PG_FUNCTION_ARGS); +extern Datum range_minus(PG_FUNCTION_ARGS); +extern Datum range_cmp(PG_FUNCTION_ARGS); +extern Datum range_lt(PG_FUNCTION_ARGS); +extern Datum range_le(PG_FUNCTION_ARGS); +extern Datum range_ge(PG_FUNCTION_ARGS); +extern Datum range_gt(PG_FUNCTION_ARGS); +extern Datum range_gist_consistent(PG_FUNCTION_ARGS); +extern Datum range_gist_union(PG_FUNCTION_ARGS); +extern Datum pg_replication_slot_advance(PG_FUNCTION_ARGS); +extern Datum range_gist_penalty(PG_FUNCTION_ARGS); +extern Datum range_gist_picksplit(PG_FUNCTION_ARGS); +extern Datum range_gist_same(PG_FUNCTION_ARGS); +extern Datum hash_range(PG_FUNCTION_ARGS); +extern Datum int4range_canonical(PG_FUNCTION_ARGS); +extern Datum daterange_canonical(PG_FUNCTION_ARGS); +extern Datum range_typanalyze(PG_FUNCTION_ARGS); +extern Datum timestamp_support(PG_FUNCTION_ARGS); +extern Datum interval_support(PG_FUNCTION_ARGS); +extern Datum ginarraytriconsistent(PG_FUNCTION_ARGS); +extern Datum gin_tsquery_triconsistent(PG_FUNCTION_ARGS); +extern Datum int4range_subdiff(PG_FUNCTION_ARGS); +extern Datum int8range_subdiff(PG_FUNCTION_ARGS); +extern Datum numrange_subdiff(PG_FUNCTION_ARGS); +extern Datum daterange_subdiff(PG_FUNCTION_ARGS); +extern Datum int8range_canonical(PG_FUNCTION_ARGS); +extern Datum tsrange_subdiff(PG_FUNCTION_ARGS); +extern Datum tstzrange_subdiff(PG_FUNCTION_ARGS); +extern Datum jsonb_object_keys(PG_FUNCTION_ARGS); +extern Datum jsonb_each_text(PG_FUNCTION_ARGS); +extern Datum mxid_age(PG_FUNCTION_ARGS); +extern Datum jsonb_extract_path_text(PG_FUNCTION_ARGS); +extern Datum acldefault_sql(PG_FUNCTION_ARGS); +extern Datum time_support(PG_FUNCTION_ARGS); +extern Datum json_object_field(PG_FUNCTION_ARGS); +extern Datum json_object_field_text(PG_FUNCTION_ARGS); +extern Datum json_array_element(PG_FUNCTION_ARGS); +extern Datum json_array_element_text(PG_FUNCTION_ARGS); +extern Datum json_extract_path(PG_FUNCTION_ARGS); +extern Datum brin_summarize_new_values(PG_FUNCTION_ARGS); +extern Datum json_extract_path_text(PG_FUNCTION_ARGS); +extern Datum pg_get_object_address(PG_FUNCTION_ARGS); +extern Datum json_array_elements(PG_FUNCTION_ARGS); +extern Datum json_array_length(PG_FUNCTION_ARGS); +extern Datum json_object_keys(PG_FUNCTION_ARGS); +extern Datum json_each(PG_FUNCTION_ARGS); +extern Datum json_each_text(PG_FUNCTION_ARGS); +extern Datum json_populate_record(PG_FUNCTION_ARGS); +extern Datum json_populate_recordset(PG_FUNCTION_ARGS); +extern Datum json_typeof(PG_FUNCTION_ARGS); +extern Datum json_array_elements_text(PG_FUNCTION_ARGS); +extern Datum ordered_set_transition(PG_FUNCTION_ARGS); +extern Datum ordered_set_transition_multi(PG_FUNCTION_ARGS); +extern Datum percentile_disc_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_float8_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_interval_final(PG_FUNCTION_ARGS); +extern Datum percentile_disc_multi_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_float8_multi_final(PG_FUNCTION_ARGS); +extern Datum percentile_cont_interval_multi_final(PG_FUNCTION_ARGS); +extern Datum mode_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_rank_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_percent_rank_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_cume_dist_final(PG_FUNCTION_ARGS); +extern Datum hypothetical_dense_rank_final(PG_FUNCTION_ARGS); +extern Datum generate_series_int4_support(PG_FUNCTION_ARGS); +extern Datum generate_series_int8_support(PG_FUNCTION_ARGS); +extern Datum array_unnest_support(PG_FUNCTION_ARGS); +extern Datum gist_box_distance(PG_FUNCTION_ARGS); +extern Datum brin_summarize_range(PG_FUNCTION_ARGS); +extern Datum jsonpath_in(PG_FUNCTION_ARGS); +extern Datum jsonpath_recv(PG_FUNCTION_ARGS); +extern Datum jsonpath_out(PG_FUNCTION_ARGS); +extern Datum jsonpath_send(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_array(PG_FUNCTION_ARGS); +extern Datum jsonb_path_query_first(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match(PG_FUNCTION_ARGS); +extern Datum jsonb_path_exists_opr(PG_FUNCTION_ARGS); +extern Datum jsonb_path_match_opr(PG_FUNCTION_ARGS); +extern Datum brin_desummarize_range(PG_FUNCTION_ARGS); +extern Datum spg_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum spg_kd_config(PG_FUNCTION_ARGS); +extern Datum spg_kd_choose(PG_FUNCTION_ARGS); +extern Datum spg_kd_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_kd_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_text_config(PG_FUNCTION_ARGS); +extern Datum spg_text_choose(PG_FUNCTION_ARGS); +extern Datum spg_text_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_text_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_text_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_sequence_last_value(PG_FUNCTION_ARGS); +extern Datum jsonb_ne(PG_FUNCTION_ARGS); +extern Datum jsonb_lt(PG_FUNCTION_ARGS); +extern Datum jsonb_gt(PG_FUNCTION_ARGS); +extern Datum jsonb_le(PG_FUNCTION_ARGS); +extern Datum jsonb_ge(PG_FUNCTION_ARGS); +extern Datum jsonb_eq(PG_FUNCTION_ARGS); +extern Datum jsonb_cmp(PG_FUNCTION_ARGS); +extern Datum jsonb_hash(PG_FUNCTION_ARGS); +extern Datum jsonb_contains(PG_FUNCTION_ARGS); +extern Datum jsonb_exists(PG_FUNCTION_ARGS); +extern Datum jsonb_exists_any(PG_FUNCTION_ARGS); +extern Datum jsonb_exists_all(PG_FUNCTION_ARGS); +extern Datum jsonb_contained(PG_FUNCTION_ARGS); +extern Datum array_agg_array_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_array_finalfn(PG_FUNCTION_ARGS); +extern Datum range_merge(PG_FUNCTION_ARGS); +extern Datum inet_merge(PG_FUNCTION_ARGS); +extern Datum boxes_bound_box(PG_FUNCTION_ARGS); +extern Datum inet_same_family(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_record_init_privs(PG_FUNCTION_ARGS); +extern Datum regnamespacein(PG_FUNCTION_ARGS); +extern Datum regnamespaceout(PG_FUNCTION_ARGS); +extern Datum to_regnamespace(PG_FUNCTION_ARGS); +extern Datum regnamespacerecv(PG_FUNCTION_ARGS); +extern Datum regnamespacesend(PG_FUNCTION_ARGS); +extern Datum point_box(PG_FUNCTION_ARGS); +extern Datum regroleout(PG_FUNCTION_ARGS); +extern Datum to_regrole(PG_FUNCTION_ARGS); +extern Datum regrolerecv(PG_FUNCTION_ARGS); +extern Datum regrolesend(PG_FUNCTION_ARGS); +extern Datum regrolein(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_missing_value(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_add_value(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_consistent(PG_FUNCTION_ARGS); +extern Datum brin_inclusion_union(PG_FUNCTION_ARGS); +extern Datum macaddr8_in(PG_FUNCTION_ARGS); +extern Datum macaddr8_out(PG_FUNCTION_ARGS); +extern Datum macaddr8_trunc(PG_FUNCTION_ARGS); +extern Datum macaddr8_eq(PG_FUNCTION_ARGS); +extern Datum macaddr8_lt(PG_FUNCTION_ARGS); +extern Datum macaddr8_le(PG_FUNCTION_ARGS); +extern Datum macaddr8_gt(PG_FUNCTION_ARGS); +extern Datum macaddr8_ge(PG_FUNCTION_ARGS); +extern Datum macaddr8_ne(PG_FUNCTION_ARGS); +extern Datum macaddr8_cmp(PG_FUNCTION_ARGS); +extern Datum macaddr8_not(PG_FUNCTION_ARGS); +extern Datum macaddr8_and(PG_FUNCTION_ARGS); +extern Datum macaddr8_or(PG_FUNCTION_ARGS); +extern Datum macaddrtomacaddr8(PG_FUNCTION_ARGS); +extern Datum macaddr8tomacaddr(PG_FUNCTION_ARGS); +extern Datum macaddr8_set7bit(PG_FUNCTION_ARGS); +extern Datum in_range_int8_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int4(PG_FUNCTION_ARGS); +extern Datum in_range_int4_int2(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int8(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int4(PG_FUNCTION_ARGS); +extern Datum in_range_int2_int2(PG_FUNCTION_ARGS); +extern Datum in_range_date_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timestamp_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timestamptz_interval(PG_FUNCTION_ARGS); +extern Datum in_range_interval_interval(PG_FUNCTION_ARGS); +extern Datum in_range_time_interval(PG_FUNCTION_ARGS); +extern Datum in_range_timetz_interval(PG_FUNCTION_ARGS); +extern Datum in_range_float8_float8(PG_FUNCTION_ARGS); +extern Datum in_range_float4_float8(PG_FUNCTION_ARGS); +extern Datum in_range_numeric_numeric(PG_FUNCTION_ARGS); +extern Datum pg_lsn_larger(PG_FUNCTION_ARGS); +extern Datum pg_lsn_smaller(PG_FUNCTION_ARGS); +extern Datum regcollationin(PG_FUNCTION_ARGS); +extern Datum regcollationout(PG_FUNCTION_ARGS); +extern Datum to_regcollation(PG_FUNCTION_ARGS); +extern Datum regcollationrecv(PG_FUNCTION_ARGS); +extern Datum regcollationsend(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_byid(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_jsonb(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_byid_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_byid(PG_FUNCTION_ARGS); +extern Datum ts_headline_json_opt(PG_FUNCTION_ARGS); +extern Datum ts_headline_json(PG_FUNCTION_ARGS); +extern Datum jsonb_string_to_tsvector(PG_FUNCTION_ARGS); +extern Datum json_string_to_tsvector(PG_FUNCTION_ARGS); +extern Datum jsonb_string_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum json_string_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum jsonb_to_tsvector(PG_FUNCTION_ARGS); +extern Datum jsonb_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum json_to_tsvector(PG_FUNCTION_ARGS); +extern Datum json_to_tsvector_byid(PG_FUNCTION_ARGS); +extern Datum pg_copy_physical_replication_slot_a(PG_FUNCTION_ARGS); +extern Datum pg_copy_physical_replication_slot_b(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_a(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_b(PG_FUNCTION_ARGS); +extern Datum pg_copy_logical_replication_slot_c(PG_FUNCTION_ARGS); +extern Datum anycompatiblemultirange_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblemultirange_out(PG_FUNCTION_ARGS); +extern Datum range_merge_from_multirange(PG_FUNCTION_ARGS); +extern Datum anymultirange_in(PG_FUNCTION_ARGS); +extern Datum anymultirange_out(PG_FUNCTION_ARGS); +extern Datum multirange_in(PG_FUNCTION_ARGS); +extern Datum multirange_out(PG_FUNCTION_ARGS); +extern Datum multirange_recv(PG_FUNCTION_ARGS); +extern Datum multirange_send(PG_FUNCTION_ARGS); +extern Datum multirange_lower(PG_FUNCTION_ARGS); +extern Datum multirange_upper(PG_FUNCTION_ARGS); +extern Datum multirange_empty(PG_FUNCTION_ARGS); +extern Datum multirange_lower_inc(PG_FUNCTION_ARGS); +extern Datum multirange_upper_inc(PG_FUNCTION_ARGS); +extern Datum multirange_lower_inf(PG_FUNCTION_ARGS); +extern Datum multirange_upper_inf(PG_FUNCTION_ARGS); +extern Datum multirange_typanalyze(PG_FUNCTION_ARGS); +extern Datum multirangesel(PG_FUNCTION_ARGS); +extern Datum multirange_eq(PG_FUNCTION_ARGS); +extern Datum multirange_ne(PG_FUNCTION_ARGS); +extern Datum range_overlaps_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overlaps_range(PG_FUNCTION_ARGS); +extern Datum multirange_overlaps_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contains_elem(PG_FUNCTION_ARGS); +extern Datum multirange_contains_range(PG_FUNCTION_ARGS); +extern Datum multirange_contains_multirange(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum range_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contained_by_multirange(PG_FUNCTION_ARGS); +extern Datum range_adjacent_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_adjacent_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_adjacent_range(PG_FUNCTION_ARGS); +extern Datum range_before_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_before_range(PG_FUNCTION_ARGS); +extern Datum multirange_before_multirange(PG_FUNCTION_ARGS); +extern Datum range_after_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_after_range(PG_FUNCTION_ARGS); +extern Datum multirange_after_multirange(PG_FUNCTION_ARGS); +extern Datum range_overleft_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overleft_range(PG_FUNCTION_ARGS); +extern Datum multirange_overleft_multirange(PG_FUNCTION_ARGS); +extern Datum range_overright_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_overright_range(PG_FUNCTION_ARGS); +extern Datum multirange_overright_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_union(PG_FUNCTION_ARGS); +extern Datum multirange_minus(PG_FUNCTION_ARGS); +extern Datum multirange_intersect(PG_FUNCTION_ARGS); +extern Datum multirange_cmp(PG_FUNCTION_ARGS); +extern Datum multirange_lt(PG_FUNCTION_ARGS); +extern Datum multirange_le(PG_FUNCTION_ARGS); +extern Datum multirange_ge(PG_FUNCTION_ARGS); +extern Datum multirange_gt(PG_FUNCTION_ARGS); +extern Datum hash_multirange(PG_FUNCTION_ARGS); +extern Datum hash_multirange_extended(PG_FUNCTION_ARGS); +extern Datum multirange_constructor0(PG_FUNCTION_ARGS); +extern Datum multirange_constructor1(PG_FUNCTION_ARGS); +extern Datum multirange_constructor2(PG_FUNCTION_ARGS); +extern Datum range_agg_transfn(PG_FUNCTION_ARGS); +extern Datum range_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum unicode_normalize_func(PG_FUNCTION_ARGS); +extern Datum unicode_is_normalized(PG_FUNCTION_ARGS); +extern Datum multirange_intersect_agg_transfn(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_multirange_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_multirange_array_pg_type_oid(PG_FUNCTION_ARGS); +extern Datum range_intersect_agg_transfn(PG_FUNCTION_ARGS); +extern Datum range_contains_multirange(PG_FUNCTION_ARGS); +extern Datum multirange_contained_by_range(PG_FUNCTION_ARGS); +extern Datum pg_log_backend_memory_contexts(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_heap_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_index_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_toast_relfilenode(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_set_next_pg_tablespace_oid(PG_FUNCTION_ARGS); +extern Datum unicode_version(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_table_rewrite_oid(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_table_rewrite_reason(PG_FUNCTION_ARGS); +extern Datum pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS); +extern Datum brin_bloom_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_bloom_add_value(PG_FUNCTION_ARGS); +extern Datum brin_bloom_consistent(PG_FUNCTION_ARGS); +extern Datum brin_bloom_union(PG_FUNCTION_ARGS); +extern Datum brin_bloom_options(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_in(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_out(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_recv(PG_FUNCTION_ARGS); +extern Datum brin_bloom_summary_send(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_opcinfo(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_add_value(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_consistent(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_union(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_options(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int2(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int4(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_int8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_float4(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_float8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_numeric(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_tid(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_uuid(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_date(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_time(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_interval(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_timetz(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_pg_lsn(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_macaddr(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_macaddr8(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_inet(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_distance_timestamp(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_in(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_out(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_recv(PG_FUNCTION_ARGS); +extern Datum brin_minmax_multi_summary_send(PG_FUNCTION_ARGS); +extern Datum phraseto_tsquery(PG_FUNCTION_ARGS); +extern Datum tsquery_phrase(PG_FUNCTION_ARGS); +extern Datum tsquery_phrase_distance(PG_FUNCTION_ARGS); +extern Datum phraseto_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum websearch_to_tsquery_byid(PG_FUNCTION_ARGS); +extern Datum websearch_to_tsquery(PG_FUNCTION_ARGS); +extern Datum spg_bbox_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_poly_quad_compress(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_config(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_choose(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_picksplit(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_inner_consistent(PG_FUNCTION_ARGS); +extern Datum spg_box_quad_leaf_consistent(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_in(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_out(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_recv(PG_FUNCTION_ARGS); +extern Datum pg_mcv_list_send(PG_FUNCTION_ARGS); +extern Datum pg_lsn_pli(PG_FUNCTION_ARGS); +extern Datum pg_lsn_mii(PG_FUNCTION_ARGS); +extern Datum satisfies_hash_partition(PG_FUNCTION_ARGS); +extern Datum pg_ls_tmpdir_noargs(PG_FUNCTION_ARGS); +extern Datum pg_ls_tmpdir_1arg(PG_FUNCTION_ARGS); +extern Datum pg_ls_archive_statusdir(PG_FUNCTION_ARGS); +extern Datum network_sortsupport(PG_FUNCTION_ARGS); +extern Datum xid8lt(PG_FUNCTION_ARGS); +extern Datum xid8gt(PG_FUNCTION_ARGS); +extern Datum xid8le(PG_FUNCTION_ARGS); +extern Datum xid8ge(PG_FUNCTION_ARGS); +extern Datum matchingsel(PG_FUNCTION_ARGS); +extern Datum matchingjoinsel(PG_FUNCTION_ARGS); +extern Datum numeric_min_scale(PG_FUNCTION_ARGS); +extern Datum numeric_trim_scale(PG_FUNCTION_ARGS); +extern Datum int4gcd(PG_FUNCTION_ARGS); +extern Datum int8gcd(PG_FUNCTION_ARGS); +extern Datum int4lcm(PG_FUNCTION_ARGS); +extern Datum int8lcm(PG_FUNCTION_ARGS); +extern Datum numeric_gcd(PG_FUNCTION_ARGS); +extern Datum numeric_lcm(PG_FUNCTION_ARGS); +extern Datum btvarstrequalimage(PG_FUNCTION_ARGS); +extern Datum btequalimage(PG_FUNCTION_ARGS); +extern Datum pg_get_shmem_allocations(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_ins_since_vacuum(PG_FUNCTION_ARGS); +extern Datum jsonb_set_lax(PG_FUNCTION_ARGS); +extern Datum xid8in(PG_FUNCTION_ARGS); +extern Datum xid8toxid(PG_FUNCTION_ARGS); +extern Datum xid8out(PG_FUNCTION_ARGS); +extern Datum xid8recv(PG_FUNCTION_ARGS); +extern Datum xid8send(PG_FUNCTION_ARGS); +extern Datum xid8eq(PG_FUNCTION_ARGS); +extern Datum xid8ne(PG_FUNCTION_ARGS); +extern Datum anycompatible_in(PG_FUNCTION_ARGS); +extern Datum anycompatible_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_recv(PG_FUNCTION_ARGS); +extern Datum anycompatiblearray_send(PG_FUNCTION_ARGS); +extern Datum anycompatiblenonarray_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblenonarray_out(PG_FUNCTION_ARGS); +extern Datum anycompatiblerange_in(PG_FUNCTION_ARGS); +extern Datum anycompatiblerange_out(PG_FUNCTION_ARGS); +extern Datum xid8cmp(PG_FUNCTION_ARGS); +extern Datum xid8_larger(PG_FUNCTION_ARGS); +extern Datum xid8_smaller(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_create(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_drop(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_oid(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_reset(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_is_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_session_progress(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_xact_setup(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_xact_reset(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_advance(PG_FUNCTION_ARGS); +extern Datum pg_replication_origin_progress(PG_FUNCTION_ARGS); +extern Datum pg_show_replication_origin_status(PG_FUNCTION_ARGS); +extern Datum jsonb_subscript_handler(PG_FUNCTION_ARGS); +extern Datum icu_unicode_version(PG_FUNCTION_ARGS); +extern Datum numeric_pg_lsn(PG_FUNCTION_ARGS); +extern Datum unicode_assigned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_backend_subxact(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_subscription(PG_FUNCTION_ARGS); +extern Datum pg_get_publication_tables(PG_FUNCTION_ARGS); +extern Datum pg_get_replica_identity_index(PG_FUNCTION_ARGS); +extern Datum pg_relation_is_publishable(PG_FUNCTION_ARGS); +extern Datum multirange_gist_consistent(PG_FUNCTION_ARGS); +extern Datum multirange_gist_compress(PG_FUNCTION_ARGS); +extern Datum pg_get_catalog_foreign_keys(PG_FUNCTION_ARGS); +extern Datum text_to_table(PG_FUNCTION_ARGS); +extern Datum text_to_table_null(PG_FUNCTION_ARGS); +extern Datum bit_bit_count(PG_FUNCTION_ARGS); +extern Datum bytea_bit_count(PG_FUNCTION_ARGS); +extern Datum pg_xact_commit_timestamp_origin(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_replication_slot(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_replication_slot(PG_FUNCTION_ARGS); +extern Datum trim_array(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS); +extern Datum pg_get_statisticsobjdef_columns(PG_FUNCTION_ARGS); +extern Datum timestamp_bin(PG_FUNCTION_ARGS); +extern Datum timestamptz_bin(PG_FUNCTION_ARGS); +extern Datum array_subscript_handler(PG_FUNCTION_ARGS); +extern Datum raw_array_subscript_handler(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_session_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_active_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_idle_in_transaction_time(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_abandoned(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_fatal(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_sessions_killed(PG_FUNCTION_ARGS); +extern Datum hash_record(PG_FUNCTION_ARGS); +extern Datum hash_record_extended(PG_FUNCTION_ARGS); +extern Datum bytealtrim(PG_FUNCTION_ARGS); +extern Datum byteartrim(PG_FUNCTION_ARGS); +extern Datum pg_get_function_sqlbody(PG_FUNCTION_ARGS); +extern Datum unistr(PG_FUNCTION_ARGS); +extern Datum extract_date(PG_FUNCTION_ARGS); +extern Datum extract_time(PG_FUNCTION_ARGS); +extern Datum extract_timetz(PG_FUNCTION_ARGS); +extern Datum extract_timestamp(PG_FUNCTION_ARGS); +extern Datum extract_timestamptz(PG_FUNCTION_ARGS); +extern Datum extract_interval(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_name_name(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_id_name(PG_FUNCTION_ARGS); +extern Datum has_parameter_privilege_name(PG_FUNCTION_ARGS); +extern Datum pg_read_file_all_missing(PG_FUNCTION_ARGS); +extern Datum pg_read_binary_file_all_missing(PG_FUNCTION_ARGS); +extern Datum pg_input_is_valid(PG_FUNCTION_ARGS); +extern Datum pg_input_error_info(PG_FUNCTION_ARGS); +extern Datum drandom_normal(PG_FUNCTION_ARGS); +extern Datum pg_split_walfile_name(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_io(PG_FUNCTION_ARGS); +extern Datum array_shuffle(PG_FUNCTION_ARGS); +extern Datum array_sample(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_tuples_newpage_updated(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_xact_tuples_newpage_updated(PG_FUNCTION_ARGS); +extern Datum derf(PG_FUNCTION_ARGS); +extern Datum derfc(PG_FUNCTION_ARGS); +extern Datum timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_resource_managers(PG_FUNCTION_ARGS); +extern Datum multirange_agg_transfn(PG_FUNCTION_ARGS); +extern Datum pg_stat_have_stats(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_subscription_stats(PG_FUNCTION_ARGS); +extern Datum pg_stat_reset_subscription_stats(PG_FUNCTION_ARGS); +extern Datum window_row_number_support(PG_FUNCTION_ARGS); +extern Datum window_rank_support(PG_FUNCTION_ARGS); +extern Datum window_dense_rank_support(PG_FUNCTION_ARGS); +extern Datum int8inc_support(PG_FUNCTION_ARGS); +extern Datum pg_settings_get_flags(PG_FUNCTION_ARGS); +extern Datum pg_stop_making_pinned_objects(PG_FUNCTION_ARGS); +extern Datum text_starts_with_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_recovery_prefetch(PG_FUNCTION_ARGS); +extern Datum pg_database_collation_actual_version(PG_FUNCTION_ARGS); +extern Datum pg_ident_file_mappings(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended_no_flags(PG_FUNCTION_ARGS); +extern Datum textregexreplace_extended_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_count_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_count_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_count(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_endoption(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_instr_no_subexpr(PG_FUNCTION_ARGS); +extern Datum regexp_instr(PG_FUNCTION_ARGS); +extern Datum regexp_like_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_like(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_start(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_n(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_flags(PG_FUNCTION_ARGS); +extern Datum regexp_substr_no_subexpr(PG_FUNCTION_ARGS); +extern Datum regexp_substr(PG_FUNCTION_ARGS); +extern Datum pg_ls_logicalsnapdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_logicalmapdir(PG_FUNCTION_ARGS); +extern Datum pg_ls_replslotdir(PG_FUNCTION_ARGS); +extern Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS); +extern Datum generate_series_timestamptz_at_zone(PG_FUNCTION_ARGS); +extern Datum json_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_unique_transfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_unique_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_strict_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_unique_transfn(PG_FUNCTION_ARGS); +extern Datum jsonb_object_agg_unique_strict_transfn(PG_FUNCTION_ARGS); +extern Datum any_value_transfn(PG_FUNCTION_ARGS); +extern Datum array_agg_combine(PG_FUNCTION_ARGS); +extern Datum array_agg_serialize(PG_FUNCTION_ARGS); +extern Datum array_agg_deserialize(PG_FUNCTION_ARGS); +extern Datum array_agg_array_combine(PG_FUNCTION_ARGS); +extern Datum array_agg_array_serialize(PG_FUNCTION_ARGS); +extern Datum array_agg_array_deserialize(PG_FUNCTION_ARGS); +extern Datum string_agg_combine(PG_FUNCTION_ARGS); +extern Datum string_agg_serialize(PG_FUNCTION_ARGS); +extern Datum string_agg_deserialize(PG_FUNCTION_ARGS); +extern Datum pg_log_standby_snapshot(PG_FUNCTION_ARGS); +extern Datum window_percent_rank_support(PG_FUNCTION_ARGS); +extern Datum window_cume_dist_support(PG_FUNCTION_ARGS); +extern Datum window_ntile_support(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_db_conflict_logicalslot(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_lastscan(PG_FUNCTION_ARGS); +extern Datum system_user(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_logical_slot_has_caught_up(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_stat_reset_time(PG_FUNCTION_ARGS); +extern Datum pg_basetype(PG_FUNCTION_ARGS); +extern Datum pg_column_toast_chunk_id(PG_FUNCTION_ARGS); +extern Datum to_regtypemod(PG_FUNCTION_ARGS); +extern Datum pg_get_wait_events(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_add_sub_rel_state(PG_FUNCTION_ARGS); +extern Datum binary_upgrade_replorigin_advance(PG_FUNCTION_ARGS); +extern Datum pg_available_wal_summaries(PG_FUNCTION_ARGS); +extern Datum pg_wal_summary_contents(PG_FUNCTION_ARGS); +extern Datum pg_get_wal_summarizer_state(PG_FUNCTION_ARGS); +extern Datum interval_avg_serialize(PG_FUNCTION_ARGS); +extern Datum interval_avg_deserialize(PG_FUNCTION_ARGS); +extern Datum interval_sum(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_timed(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_requested(PG_FUNCTION_ARGS); +extern Datum pg_stat_get_checkpointer_restartpoints_performed(PG_FUNCTION_ARGS); +extern Datum to_bin32(PG_FUNCTION_ARGS); +extern Datum to_bin64(PG_FUNCTION_ARGS); +extern Datum to_oct32(PG_FUNCTION_ARGS); +extern Datum to_oct64(PG_FUNCTION_ARGS); +extern Datum timestamptz_at_local(PG_FUNCTION_ARGS); +extern Datum timestamp_at_local(PG_FUNCTION_ARGS); +extern Datum timetz_at_local(PG_FUNCTION_ARGS); +extern Datum jsonb_populate_record_valid(PG_FUNCTION_ARGS); +extern Datum int4random(PG_FUNCTION_ARGS); +extern Datum int8random(PG_FUNCTION_ARGS); +extern Datum numeric_random(PG_FUNCTION_ARGS); +extern Datum uuid_extract_timestamp(PG_FUNCTION_ARGS); +extern Datum uuid_extract_version(PG_FUNCTION_ARGS); +extern Datum pg_sync_replication_slots(PG_FUNCTION_ARGS); +extern Datum range_contains_elem_support(PG_FUNCTION_ARGS); +extern Datum elem_contained_by_range_support(PG_FUNCTION_ARGS); + +#endif /* FMGRPROTOS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/fmgrtab.h b/platform/dbops/binaries/postgres/include/server/utils/fmgrtab.h new file mode 100644 index 0000000000000000000000000000000000000000..151dd74055d0b108cf7131654274c8ca7ae7cbfe --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/fmgrtab.h @@ -0,0 +1,49 @@ +/*------------------------------------------------------------------------- + * + * fmgrtab.h + * The function manager's table of internal functions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/fmgrtab.h + * + *------------------------------------------------------------------------- + */ +#ifndef FMGRTAB_H +#define FMGRTAB_H + +#include "access/transam.h" +#include "fmgr.h" + + +/* + * This table stores info about all the built-in functions (ie, functions + * that are compiled into the Postgres executable). + */ + +typedef struct +{ + Oid foid; /* OID of the function */ + short nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable count */ + bool strict; /* T if function is "strict" */ + bool retset; /* T if function returns a set */ + const char *funcName; /* C name of the function */ + PGFunction func; /* pointer to compiled function */ +} FmgrBuiltin; + +extern PGDLLIMPORT const FmgrBuiltin fmgr_builtins[]; + +extern PGDLLIMPORT const int fmgr_nbuiltins; /* number of entries in table */ + +extern PGDLLIMPORT const Oid fmgr_last_builtin_oid; /* highest function OID in + * table */ + +/* + * Mapping from a builtin function's OID to its index in the fmgr_builtins + * array. This is indexed from 0 through fmgr_last_builtin_oid. + */ +#define InvalidOidBuiltinMapping PG_UINT16_MAX +extern PGDLLIMPORT const uint16 fmgr_builtin_oid_index[]; + +#endif /* FMGRTAB_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/formatting.h b/platform/dbops/binaries/postgres/include/server/utils/formatting.h new file mode 100644 index 0000000000000000000000000000000000000000..cde030414ee443e8fe2f270adc10f7428b1612ae --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/formatting.h @@ -0,0 +1,34 @@ +/* ----------------------------------------------------------------------- + * formatting.h + * + * src/include/utils/formatting.h + * + * + * Portions Copyright (c) 1999-2024, PostgreSQL Global Development Group + * + * The PostgreSQL routines for a DateTime/int/float/numeric formatting, + * inspired by the Oracle TO_CHAR() / TO_DATE() / TO_NUMBER() routines. + * + * Karel Zak + * + * ----------------------------------------------------------------------- + */ + +#ifndef _FORMATTING_H_ +#define _FORMATTING_H_ + + +extern char *str_tolower(const char *buff, size_t nbytes, Oid collid); +extern char *str_toupper(const char *buff, size_t nbytes, Oid collid); +extern char *str_initcap(const char *buff, size_t nbytes, Oid collid); + +extern char *asc_tolower(const char *buff, size_t nbytes); +extern char *asc_toupper(const char *buff, size_t nbytes); +extern char *asc_initcap(const char *buff, size_t nbytes); + +extern Datum parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict, + Oid *typid, int32 *typmod, int *tz, + struct Node *escontext); +extern bool datetime_format_has_tz(const char *fmt_str); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/freepage.h b/platform/dbops/binaries/postgres/include/server/utils/freepage.h new file mode 100644 index 0000000000000000000000000000000000000000..c7c004657f0153e362303a766e150d62873b3561 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/freepage.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * + * freepage.h + * Management of page-organized free memory. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/freepage.h + * + *------------------------------------------------------------------------- + */ + +#ifndef FREEPAGE_H +#define FREEPAGE_H + +#include "storage/lwlock.h" +#include "utils/relptr.h" + +/* Forward declarations. */ +typedef struct FreePageSpanLeader FreePageSpanLeader; +typedef struct FreePageBtree FreePageBtree; +typedef struct FreePageManager FreePageManager; + +/* + * PostgreSQL normally uses 8kB pages for most things, but many common + * architecture/operating system pairings use a 4kB page size for memory + * allocation, so we do that here also. + */ +#define FPM_PAGE_SIZE 4096 + +/* + * Each freelist except for the last contains only spans of one particular + * size. Everything larger goes on the last one. In some sense this seems + * like a waste since most allocations are in a few common sizes, but it + * means that small allocations can simply pop the head of the relevant list + * without needing to worry about whether the object we find there is of + * precisely the correct size (because we know it must be). + */ +#define FPM_NUM_FREELISTS 129 + +/* Define relative pointer types. */ +relptr_declare(FreePageBtree, RelptrFreePageBtree); +relptr_declare(FreePageManager, RelptrFreePageManager); +relptr_declare(FreePageSpanLeader, RelptrFreePageSpanLeader); + +/* Everything we need in order to manage free pages (see freepage.c) */ +struct FreePageManager +{ + RelptrFreePageManager self; + RelptrFreePageBtree btree_root; + RelptrFreePageSpanLeader btree_recycle; + unsigned btree_depth; + unsigned btree_recycle_count; + Size singleton_first_page; + Size singleton_npages; + Size contiguous_pages; + bool contiguous_pages_dirty; + RelptrFreePageSpanLeader freelist[FPM_NUM_FREELISTS]; +#ifdef FPM_EXTRA_ASSERTS + /* For debugging only, pages put minus pages gotten. */ + Size free_pages; +#endif +}; + +/* Macros to convert between page numbers (expressed as Size) and pointers. */ +#define fpm_page_to_pointer(base, page) \ + (AssertVariableIsOfTypeMacro(page, Size), \ + (base) + FPM_PAGE_SIZE * (page)) +#define fpm_pointer_to_page(base, ptr) \ + (((Size) (((char *) (ptr)) - (base))) / FPM_PAGE_SIZE) + +/* Macro to convert an allocation size to a number of pages. */ +#define fpm_size_to_pages(sz) \ + (((sz) + FPM_PAGE_SIZE - 1) / FPM_PAGE_SIZE) + +/* Macros to check alignment of absolute and relative pointers. */ +#define fpm_pointer_is_page_aligned(base, ptr) \ + (((Size) (((char *) (ptr)) - (base))) % FPM_PAGE_SIZE == 0) +#define fpm_relptr_is_page_aligned(base, relptr) \ + (relptr_offset(relptr) % FPM_PAGE_SIZE == 0) + +/* Macro to find base address of the segment containing a FreePageManager. */ +#define fpm_segment_base(fpm) \ + (((char *) fpm) - relptr_offset(fpm->self)) + +/* Macro to access a FreePageManager's largest consecutive run of pages. */ +#define fpm_largest(fpm) \ + (fpm->contiguous_pages) + +/* Functions to manipulate the free page map. */ +extern void FreePageManagerInitialize(FreePageManager *fpm, char *base); +extern bool FreePageManagerGet(FreePageManager *fpm, Size npages, + Size *first_page); +extern void FreePageManagerPut(FreePageManager *fpm, Size first_page, + Size npages); +extern char *FreePageManagerDump(FreePageManager *fpm); + +#endif /* FREEPAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/geo_decls.h b/platform/dbops/binaries/postgres/include/server/utils/geo_decls.h new file mode 100644 index 0000000000000000000000000000000000000000..02e2062e8f0dfb696243c1cf8b4c26737ef2a459 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/geo_decls.h @@ -0,0 +1,285 @@ +/*------------------------------------------------------------------------- + * + * geo_decls.h - Declarations for various 2D constructs. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/geo_decls.h + * + * XXX These routines were not written by a numerical analyst. + * + * XXX I have made some attempt to flesh out the operators + * and data types. There are still some more to do. - tgl 97/04/19 + * + *------------------------------------------------------------------------- + */ +#ifndef GEO_DECLS_H +#define GEO_DECLS_H + +#include + +#include "fmgr.h" + +/*-------------------------------------------------------------------- + * Useful floating point utilities and constants. + *-------------------------------------------------------------------- + * + * "Fuzzy" floating-point comparisons: values within EPSILON of each other + * are considered equal. Beware of normal reasoning about the behavior of + * these comparisons, since for example FPeq does not behave transitively. + * + * Note that these functions are not NaN-aware and will give FALSE for + * any case involving NaN inputs. + * + * Also note that these will give sane answers for infinite inputs, + * where it's important to avoid computing Inf minus Inf; we do so + * by eliminating equality cases before subtracting. + */ + +#define EPSILON 1.0E-06 + +#ifdef EPSILON +#define FPzero(A) (fabs(A) <= EPSILON) + +static inline bool +FPeq(double A, double B) +{ + return A == B || fabs(A - B) <= EPSILON; +} + +static inline bool +FPne(double A, double B) +{ + return A != B && fabs(A - B) > EPSILON; +} + +static inline bool +FPlt(double A, double B) +{ + return A + EPSILON < B; +} + +static inline bool +FPle(double A, double B) +{ + return A <= B + EPSILON; +} + +static inline bool +FPgt(double A, double B) +{ + return A > B + EPSILON; +} + +static inline bool +FPge(double A, double B) +{ + return A + EPSILON >= B; +} +#else +#define FPzero(A) ((A) == 0) +#define FPeq(A,B) ((A) == (B)) +#define FPne(A,B) ((A) != (B)) +#define FPlt(A,B) ((A) < (B)) +#define FPle(A,B) ((A) <= (B)) +#define FPgt(A,B) ((A) > (B)) +#define FPge(A,B) ((A) >= (B)) +#endif + +#define HYPOT(A, B) pg_hypot(A, B) + +/*--------------------------------------------------------------------- + * Point - (x,y) + *-------------------------------------------------------------------*/ +typedef struct +{ + float8 x, + y; +} Point; + + +/*--------------------------------------------------------------------- + * LSEG - A straight line, specified by endpoints. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point p[2]; +} LSEG; + + +/*--------------------------------------------------------------------- + * PATH - Specified by vertex points. + *-------------------------------------------------------------------*/ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 npts; + int32 closed; /* is this a closed polygon? */ + int32 dummy; /* padding to make it double align */ + Point p[FLEXIBLE_ARRAY_MEMBER]; +} PATH; + + +/*--------------------------------------------------------------------- + * LINE - Specified by its general equation (Ax+By+C=0). + *-------------------------------------------------------------------*/ +typedef struct +{ + float8 A, + B, + C; +} LINE; + + +/*--------------------------------------------------------------------- + * BOX - Specified by two corner points, which are + * sorted to save calculation time later. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point high, + low; /* corner POINTs */ +} BOX; + +/*--------------------------------------------------------------------- + * POLYGON - Specified by an array of doubles defining the points, + * keeping the number of points and the bounding box for + * speed purposes. + *-------------------------------------------------------------------*/ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 npts; + BOX boundbox; + Point p[FLEXIBLE_ARRAY_MEMBER]; +} POLYGON; + +/*--------------------------------------------------------------------- + * CIRCLE - Specified by a center point and radius. + *-------------------------------------------------------------------*/ +typedef struct +{ + Point center; + float8 radius; +} CIRCLE; + +/* + * fmgr interface functions + * + * Path and Polygon are toastable varlena types, the others are just + * fixed-size pass-by-reference types. + */ + +static inline Point * +DatumGetPointP(Datum X) +{ + return (Point *) DatumGetPointer(X); +} +static inline Datum +PointPGetDatum(const Point *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_POINT_P(n) DatumGetPointP(PG_GETARG_DATUM(n)) +#define PG_RETURN_POINT_P(x) return PointPGetDatum(x) + +static inline LSEG * +DatumGetLsegP(Datum X) +{ + return (LSEG *) DatumGetPointer(X); +} +static inline Datum +LsegPGetDatum(const LSEG *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_LSEG_P(n) DatumGetLsegP(PG_GETARG_DATUM(n)) +#define PG_RETURN_LSEG_P(x) return LsegPGetDatum(x) + +static inline PATH * +DatumGetPathP(Datum X) +{ + return (PATH *) PG_DETOAST_DATUM(X); +} +static inline PATH * +DatumGetPathPCopy(Datum X) +{ + return (PATH *) PG_DETOAST_DATUM_COPY(X); +} +static inline Datum +PathPGetDatum(const PATH *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_PATH_P(n) DatumGetPathP(PG_GETARG_DATUM(n)) +#define PG_GETARG_PATH_P_COPY(n) DatumGetPathPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_PATH_P(x) return PathPGetDatum(x) + +static inline LINE * +DatumGetLineP(Datum X) +{ + return (LINE *) DatumGetPointer(X); +} +static inline Datum +LinePGetDatum(const LINE *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_LINE_P(n) DatumGetLineP(PG_GETARG_DATUM(n)) +#define PG_RETURN_LINE_P(x) return LinePGetDatum(x) + +static inline BOX * +DatumGetBoxP(Datum X) +{ + return (BOX *) DatumGetPointer(X); +} +static inline Datum +BoxPGetDatum(const BOX *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_BOX_P(n) DatumGetBoxP(PG_GETARG_DATUM(n)) +#define PG_RETURN_BOX_P(x) return BoxPGetDatum(x) + +static inline POLYGON * +DatumGetPolygonP(Datum X) +{ + return (POLYGON *) PG_DETOAST_DATUM(X); +} +static inline POLYGON * +DatumGetPolygonPCopy(Datum X) +{ + return (POLYGON *) PG_DETOAST_DATUM_COPY(X); +} +static inline Datum +PolygonPGetDatum(const POLYGON *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_POLYGON_P(n) DatumGetPolygonP(PG_GETARG_DATUM(n)) +#define PG_GETARG_POLYGON_P_COPY(n) DatumGetPolygonPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_POLYGON_P(x) return PolygonPGetDatum(x) + +static inline CIRCLE * +DatumGetCircleP(Datum X) +{ + return (CIRCLE *) DatumGetPointer(X); +} +static inline Datum +CirclePGetDatum(const CIRCLE *X) +{ + return PointerGetDatum(X); +} +#define PG_GETARG_CIRCLE_P(n) DatumGetCircleP(PG_GETARG_DATUM(n)) +#define PG_RETURN_CIRCLE_P(x) return CirclePGetDatum(x) + + +/* + * in geo_ops.c + */ + +extern float8 pg_hypot(float8 x, float8 y); + +#endif /* GEO_DECLS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/guc.h b/platform/dbops/binaries/postgres/include/server/utils/guc.h new file mode 100644 index 0000000000000000000000000000000000000000..2207a77b369773ab06441e008a40a9a76ceb34e7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/guc.h @@ -0,0 +1,456 @@ +/*-------------------------------------------------------------------- + * guc.h + * + * External declarations pertaining to Grand Unified Configuration. + * + * Copyright (c) 2000-2024, PostgreSQL Global Development Group + * Written by Peter Eisentraut . + * + * src/include/utils/guc.h + *-------------------------------------------------------------------- + */ +#ifndef GUC_H +#define GUC_H + +#include "nodes/parsenodes.h" +#include "tcop/dest.h" +#include "utils/array.h" + + +/* upper limit for GUC variables measured in kilobytes of memory */ +/* note that various places assume the byte size fits in a "long" variable */ +#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4 +#define MAX_KILOBYTES INT_MAX +#else +#define MAX_KILOBYTES (INT_MAX / 1024) +#endif + +/* + * Automatic configuration file name for ALTER SYSTEM. + * This file will be used to store values of configuration parameters + * set by ALTER SYSTEM command. + */ +#define PG_AUTOCONF_FILENAME "postgresql.auto.conf" + +/* + * Certain options can only be set at certain times. The rules are + * like this: + * + * INTERNAL options cannot be set by the user at all, but only through + * internal processes ("server_version" is an example). These are GUC + * variables only so they can be shown by SHOW, etc. + * + * POSTMASTER options can only be set when the postmaster starts, + * either from the configuration file or the command line. + * + * SIGHUP options can only be set at postmaster startup or by changing + * the configuration file and sending the HUP signal to the postmaster + * or a backend process. (Notice that the signal receipt will not be + * evaluated immediately. The postmaster and the backend check it at a + * certain point in their main loop. It's safer to wait than to read a + * file asynchronously.) + * + * BACKEND and SU_BACKEND options can only be set at postmaster startup, + * from the configuration file, or by client request in the connection + * startup packet (e.g., from libpq's PGOPTIONS variable). SU_BACKEND + * options can be set from the startup packet only when the user is a + * superuser. Furthermore, an already-started backend will ignore changes + * to such an option in the configuration file. The idea is that these + * options are fixed for a given backend once it's started, but they can + * vary across backends. + * + * SUSET options can be set at postmaster startup, with the SIGHUP + * mechanism, or from the startup packet or SQL if you're a superuser. + * + * USERSET options can be set by anyone any time. + */ +typedef enum +{ + PGC_INTERNAL, + PGC_POSTMASTER, + PGC_SIGHUP, + PGC_SU_BACKEND, + PGC_BACKEND, + PGC_SUSET, + PGC_USERSET, +} GucContext; + +/* + * The following type records the source of the current setting. A + * new setting can only take effect if the previous setting had the + * same or lower level. (E.g, changing the config file doesn't + * override the postmaster command line.) Tracking the source allows us + * to process sources in any convenient order without affecting results. + * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well + * as the current value. + * + * PGC_S_INTERACTIVE isn't actually a source value, but is the + * dividing line between "interactive" and "non-interactive" sources for + * error reporting purposes. + * + * PGC_S_TEST is used when testing values to be used later. For example, + * ALTER DATABASE/ROLE tests proposed per-database or per-user defaults this + * way, and CREATE FUNCTION tests proposed function SET clauses this way. + * This is an interactive case, but it needs its own source value because + * some assign hooks need to make different validity checks in this case. + * In particular, references to nonexistent database objects generally + * shouldn't throw hard errors in this case, at most NOTICEs, since the + * objects might exist by the time the setting is used for real. + * + * When setting the value of a non-compile-time-constant PGC_INTERNAL option, + * source == PGC_S_DYNAMIC_DEFAULT should typically be used so that the value + * will show as "default" in pg_settings. If there is a specific reason not + * to want that, use source == PGC_S_OVERRIDE. + * + * NB: see GucSource_Names in guc.c if you change this. + */ +typedef enum +{ + PGC_S_DEFAULT, /* hard-wired default ("boot_val") */ + PGC_S_DYNAMIC_DEFAULT, /* default computed during initialization */ + PGC_S_ENV_VAR, /* postmaster environment variable */ + PGC_S_FILE, /* postgresql.conf */ + PGC_S_ARGV, /* postmaster command line */ + PGC_S_GLOBAL, /* global in-database setting */ + PGC_S_DATABASE, /* per-database setting */ + PGC_S_USER, /* per-user setting */ + PGC_S_DATABASE_USER, /* per-user-and-database setting */ + PGC_S_CLIENT, /* from client connection request */ + PGC_S_OVERRIDE, /* special case to forcibly set default */ + PGC_S_INTERACTIVE, /* dividing line for error reporting */ + PGC_S_TEST, /* test per-database or per-user setting */ + PGC_S_SESSION, /* SET command */ +} GucSource; + +/* + * Parsing the configuration file(s) will return a list of name-value pairs + * with source location info. We also abuse this data structure to carry + * error reports about the config files. An entry reporting an error will + * have errmsg != NULL, and might have NULLs for name, value, and/or filename. + * + * If "ignore" is true, don't attempt to apply the item (it might be an error + * report, or an item we determined to be duplicate). "applied" is set true + * if we successfully applied, or could have applied, the setting. + */ +typedef struct ConfigVariable +{ + char *name; + char *value; + char *errmsg; + char *filename; + int sourceline; + bool ignore; + bool applied; + struct ConfigVariable *next; +} ConfigVariable; + +typedef struct config_generic config_handle; + +extern bool ParseConfigFile(const char *config_file, bool strict, + const char *calling_file, int calling_lineno, + int depth, int elevel, + ConfigVariable **head_p, ConfigVariable **tail_p); +extern bool ParseConfigFp(FILE *fp, const char *config_file, + int depth, int elevel, + ConfigVariable **head_p, ConfigVariable **tail_p); +extern bool ParseConfigDirectory(const char *includedir, + const char *calling_file, int calling_lineno, + int depth, int elevel, + ConfigVariable **head_p, + ConfigVariable **tail_p); +extern void FreeConfigVariables(ConfigVariable *list); +extern char *DeescapeQuotedString(const char *s); + +/* + * The possible values of an enum variable are specified by an array of + * name-value pairs. The "hidden" flag means the value is accepted but + * won't be displayed when guc.c is asked for a list of acceptable values. + */ +struct config_enum_entry +{ + const char *name; + int val; + bool hidden; +}; + +/* + * Signatures for per-variable check/assign/show hook functions + */ +typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source); +typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source); +typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source); +typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source); +typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source); + +typedef void (*GucBoolAssignHook) (bool newval, void *extra); +typedef void (*GucIntAssignHook) (int newval, void *extra); +typedef void (*GucRealAssignHook) (double newval, void *extra); +typedef void (*GucStringAssignHook) (const char *newval, void *extra); +typedef void (*GucEnumAssignHook) (int newval, void *extra); + +typedef const char *(*GucShowHook) (void); + +/* + * Miscellaneous + */ +typedef enum +{ + /* Types of set_config_option actions */ + GUC_ACTION_SET, /* regular SET command */ + GUC_ACTION_LOCAL, /* SET LOCAL command */ + GUC_ACTION_SAVE, /* function SET option, or temp assignment */ +} GucAction; + +#define GUC_QUALIFIER_SEPARATOR '.' + +/* + * Bit values in "flags" of a GUC variable. Note that these don't appear + * on disk, so we can reassign their values freely. + */ +#define GUC_LIST_INPUT 0x000001 /* input can be list format */ +#define GUC_LIST_QUOTE 0x000002 /* double-quote list elements */ +#define GUC_NO_SHOW_ALL 0x000004 /* exclude from SHOW ALL */ +#define GUC_NO_RESET 0x000008 /* disallow RESET and SAVE */ +#define GUC_NO_RESET_ALL 0x000010 /* exclude from RESET ALL */ +#define GUC_EXPLAIN 0x000020 /* include in EXPLAIN */ +#define GUC_REPORT 0x000040 /* auto-report changes to client */ +#define GUC_NOT_IN_SAMPLE 0x000080 /* not in postgresql.conf.sample */ +#define GUC_DISALLOW_IN_FILE 0x000100 /* can't set in postgresql.conf */ +#define GUC_CUSTOM_PLACEHOLDER 0x000200 /* placeholder for custom variable */ +#define GUC_SUPERUSER_ONLY 0x000400 /* show only to superusers */ +#define GUC_IS_NAME 0x000800 /* limit string to NAMEDATALEN-1 */ +#define GUC_NOT_WHILE_SEC_REST 0x001000 /* can't set if security restricted */ +#define GUC_DISALLOW_IN_AUTO_FILE \ + 0x002000 /* can't set in PG_AUTOCONF_FILENAME */ +#define GUC_RUNTIME_COMPUTED 0x004000 /* delay processing in 'postgres -C' */ +#define GUC_ALLOW_IN_PARALLEL 0x008000 /* allow setting in parallel mode */ + +#define GUC_UNIT_KB 0x01000000 /* value is in kilobytes */ +#define GUC_UNIT_BLOCKS 0x02000000 /* value is in blocks */ +#define GUC_UNIT_XBLOCKS 0x03000000 /* value is in xlog blocks */ +#define GUC_UNIT_MB 0x04000000 /* value is in megabytes */ +#define GUC_UNIT_BYTE 0x05000000 /* value is in bytes */ +#define GUC_UNIT_MEMORY 0x0F000000 /* mask for size-related units */ + +#define GUC_UNIT_MS 0x10000000 /* value is in milliseconds */ +#define GUC_UNIT_S 0x20000000 /* value is in seconds */ +#define GUC_UNIT_MIN 0x30000000 /* value is in minutes */ +#define GUC_UNIT_TIME 0x70000000 /* mask for time-related units */ + +#define GUC_UNIT (GUC_UNIT_MEMORY | GUC_UNIT_TIME) + + +/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */ +extern PGDLLIMPORT bool Debug_print_plan; +extern PGDLLIMPORT bool Debug_print_parse; +extern PGDLLIMPORT bool Debug_print_rewritten; +extern PGDLLIMPORT bool Debug_pretty_print; + +extern PGDLLIMPORT bool log_parser_stats; +extern PGDLLIMPORT bool log_planner_stats; +extern PGDLLIMPORT bool log_executor_stats; +extern PGDLLIMPORT bool log_statement_stats; +extern PGDLLIMPORT bool log_btree_build_stats; + +extern PGDLLIMPORT bool check_function_bodies; +extern PGDLLIMPORT bool current_role_is_superuser; + +extern PGDLLIMPORT bool AllowAlterSystem; +extern PGDLLIMPORT bool log_duration; +extern PGDLLIMPORT int log_parameter_max_length; +extern PGDLLIMPORT int log_parameter_max_length_on_error; +extern PGDLLIMPORT int log_min_error_statement; +extern PGDLLIMPORT int log_min_messages; +extern PGDLLIMPORT int client_min_messages; +extern PGDLLIMPORT int log_min_duration_sample; +extern PGDLLIMPORT int log_min_duration_statement; +extern PGDLLIMPORT int log_temp_files; +extern PGDLLIMPORT double log_statement_sample_rate; +extern PGDLLIMPORT double log_xact_sample_rate; +extern PGDLLIMPORT char *backtrace_functions; + +extern PGDLLIMPORT int temp_file_limit; + +extern PGDLLIMPORT int num_temp_buffers; + +extern PGDLLIMPORT char *cluster_name; +extern PGDLLIMPORT char *ConfigFileName; +extern PGDLLIMPORT char *HbaFileName; +extern PGDLLIMPORT char *IdentFileName; +extern PGDLLIMPORT char *external_pid_file; + +extern PGDLLIMPORT char *application_name; + +extern PGDLLIMPORT int tcp_keepalives_idle; +extern PGDLLIMPORT int tcp_keepalives_interval; +extern PGDLLIMPORT int tcp_keepalives_count; +extern PGDLLIMPORT int tcp_user_timeout; + +#ifdef TRACE_SORT +extern PGDLLIMPORT bool trace_sort; +#endif + +/* + * Functions exported by guc.c + */ +extern void SetConfigOption(const char *name, const char *value, + GucContext context, GucSource source); + +extern void DefineCustomBoolVariable(const char *name, + const char *short_desc, + const char *long_desc, + bool *valueAddr, + bool bootValue, + GucContext context, + int flags, + GucBoolCheckHook check_hook, + GucBoolAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomIntVariable(const char *name, + const char *short_desc, + const char *long_desc, + int *valueAddr, + int bootValue, + int minValue, + int maxValue, + GucContext context, + int flags, + GucIntCheckHook check_hook, + GucIntAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomRealVariable(const char *name, + const char *short_desc, + const char *long_desc, + double *valueAddr, + double bootValue, + double minValue, + double maxValue, + GucContext context, + int flags, + GucRealCheckHook check_hook, + GucRealAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomStringVariable(const char *name, + const char *short_desc, + const char *long_desc, + char **valueAddr, + const char *bootValue, + GucContext context, + int flags, + GucStringCheckHook check_hook, + GucStringAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void DefineCustomEnumVariable(const char *name, + const char *short_desc, + const char *long_desc, + int *valueAddr, + int bootValue, + const struct config_enum_entry *options, + GucContext context, + int flags, + GucEnumCheckHook check_hook, + GucEnumAssignHook assign_hook, + GucShowHook show_hook) pg_attribute_nonnull(1, 4); + +extern void MarkGUCPrefixReserved(const char *className); + +/* old name for MarkGUCPrefixReserved, for backwards compatibility: */ +#define EmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className) + +extern const char *GetConfigOption(const char *name, bool missing_ok, + bool restrict_privileged); +extern const char *GetConfigOptionResetString(const char *name); +extern int GetConfigOptionFlags(const char *name, bool missing_ok); +extern void ProcessConfigFile(GucContext context); +extern char *convert_GUC_name_for_parameter_acl(const char *name); +extern void check_GUC_name_for_parameter_acl(const char *name); +extern void InitializeGUCOptions(void); +extern bool SelectConfigFiles(const char *userDoption, const char *progname); +extern void ResetAllOptions(void); +extern void AtStart_GUC(void); +extern int NewGUCNestLevel(void); +extern void RestrictSearchPath(void); +extern void AtEOXact_GUC(bool isCommit, int nestLevel); +extern void BeginReportingGUCOptions(void); +extern void ReportChangedGUCOptions(void); +extern void ParseLongOption(const char *string, char **name, char **value); +extern const char *get_config_unit_name(int flags); +extern bool parse_int(const char *value, int *result, int flags, + const char **hintmsg); +extern bool parse_real(const char *value, double *result, int flags, + const char **hintmsg); +extern int set_config_option(const char *name, const char *value, + GucContext context, GucSource source, + GucAction action, bool changeVal, int elevel, + bool is_reload); +extern int set_config_option_ext(const char *name, const char *value, + GucContext context, GucSource source, + Oid srole, + GucAction action, bool changeVal, int elevel, + bool is_reload); +extern int set_config_with_handle(const char *name, config_handle *handle, + const char *value, + GucContext context, GucSource source, + Oid srole, + GucAction action, bool changeVal, + int elevel, bool is_reload); +extern config_handle *get_config_handle(const char *name); +extern void AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt); +extern char *GetConfigOptionByName(const char *name, const char **varname, + bool missing_ok); + +extern void TransformGUCArray(ArrayType *array, List **names, + List **values); +extern void ProcessGUCArray(ArrayType *array, + GucContext context, GucSource source, GucAction action); +extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value); +extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name); +extern ArrayType *GUCArrayReset(ArrayType *array); + +extern void *guc_malloc(int elevel, size_t size); +extern pg_nodiscard void *guc_realloc(int elevel, void *old, size_t size); +extern char *guc_strdup(int elevel, const char *src); +extern void guc_free(void *ptr); + +#ifdef EXEC_BACKEND +extern void write_nondefault_variables(GucContext context); +extern void read_nondefault_variables(void); +#endif + +/* GUC serialization */ +extern Size EstimateGUCStateSpace(void); +extern void SerializeGUCState(Size maxsize, char *start_address); +extern void RestoreGUCState(void *gucstate); + +/* Functions exported by guc_funcs.c */ +extern void ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel); +extern char *ExtractSetVariableArgs(VariableSetStmt *stmt); +extern void SetPGVariable(const char *name, List *args, bool is_local); +extern void GetPGVariable(const char *name, DestReceiver *dest); +extern TupleDesc GetPGVariableResultDesc(const char *name); + +/* Support for messages reported from GUC check hooks */ + +extern PGDLLIMPORT char *GUC_check_errmsg_string; +extern PGDLLIMPORT char *GUC_check_errdetail_string; +extern PGDLLIMPORT char *GUC_check_errhint_string; + +extern void GUC_check_errcode(int sqlerrcode); + +#define GUC_check_errmsg \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errmsg_string = format_elog_string + +#define GUC_check_errdetail \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errdetail_string = format_elog_string + +#define GUC_check_errhint \ + pre_format_elog_string(errno, TEXTDOMAIN), \ + GUC_check_errhint_string = format_elog_string + +#endif /* GUC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/guc_hooks.h b/platform/dbops/binaries/postgres/include/server/utils/guc_hooks.h new file mode 100644 index 0000000000000000000000000000000000000000..8fd91af3887f762305681b04cabcf5dbf07825e8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/guc_hooks.h @@ -0,0 +1,184 @@ +/*------------------------------------------------------------------------- + * + * guc_hooks.h + * Declarations of per-variable callback functions used by GUC. + * + * These functions are scattered throughout the system, but we + * declare them all here to avoid having to propagate guc.h into + * a lot of unrelated header files. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/utils/guc_hooks.h + * + *------------------------------------------------------------------------- + */ +#ifndef GUC_HOOKS_H +#define GUC_HOOKS_H 1 + +#include "utils/guc.h" + +/* + * See guc.h for the typedefs that these hook functions should match + * (GucBoolCheckHook and so on). + * + * Please keep the declarations in order by GUC variable name. + */ + +extern bool check_application_name(char **newval, void **extra, + GucSource source); +extern void assign_application_name(const char *newval, void *extra); +extern const char *show_archive_command(void); +extern bool check_autovacuum_max_workers(int *newval, void **extra, + GucSource source); +extern bool check_autovacuum_work_mem(int *newval, void **extra, + GucSource source); +extern bool check_vacuum_buffer_usage_limit(int *newval, void **extra, + GucSource source); +extern bool check_backtrace_functions(char **newval, void **extra, + GucSource source); +extern void assign_backtrace_functions(const char *newval, void *extra); +extern bool check_bonjour(bool *newval, void **extra, GucSource source); +extern bool check_canonical_path(char **newval, void **extra, GucSource source); +extern void assign_checkpoint_completion_target(double newval, void *extra); +extern bool check_client_connection_check_interval(int *newval, void **extra, + GucSource source); +extern bool check_client_encoding(char **newval, void **extra, GucSource source); +extern void assign_client_encoding(const char *newval, void *extra); +extern bool check_cluster_name(char **newval, void **extra, GucSource source); +extern bool check_commit_ts_buffers(int *newval, void **extra, + GucSource source); +extern const char *show_data_directory_mode(void); +extern bool check_datestyle(char **newval, void **extra, GucSource source); +extern void assign_datestyle(const char *newval, void *extra); +extern bool check_debug_io_direct(char **newval, void **extra, GucSource source); +extern void assign_debug_io_direct(const char *newval, void *extra); +extern bool check_default_table_access_method(char **newval, void **extra, + GucSource source); +extern bool check_default_tablespace(char **newval, void **extra, + GucSource source); +extern bool check_default_text_search_config(char **newval, void **extra, GucSource source); +extern void assign_default_text_search_config(const char *newval, void *extra); +extern bool check_default_with_oids(bool *newval, void **extra, + GucSource source); +extern bool check_effective_io_concurrency(int *newval, void **extra, + GucSource source); +extern bool check_huge_page_size(int *newval, void **extra, GucSource source); +extern const char *show_in_hot_standby(void); +extern bool check_locale_messages(char **newval, void **extra, GucSource source); +extern void assign_locale_messages(const char *newval, void *extra); +extern bool check_locale_monetary(char **newval, void **extra, GucSource source); +extern void assign_locale_monetary(const char *newval, void *extra); +extern bool check_locale_numeric(char **newval, void **extra, GucSource source); +extern void assign_locale_numeric(const char *newval, void *extra); +extern bool check_locale_time(char **newval, void **extra, GucSource source); +extern void assign_locale_time(const char *newval, void *extra); +extern bool check_log_destination(char **newval, void **extra, + GucSource source); +extern void assign_log_destination(const char *newval, void *extra); +extern const char *show_log_file_mode(void); +extern bool check_log_stats(bool *newval, void **extra, GucSource source); +extern bool check_log_timezone(char **newval, void **extra, GucSource source); +extern void assign_log_timezone(const char *newval, void *extra); +extern const char *show_log_timezone(void); +extern bool check_maintenance_io_concurrency(int *newval, void **extra, + GucSource source); +extern void assign_maintenance_io_concurrency(int newval, void *extra); +extern bool check_max_connections(int *newval, void **extra, GucSource source); +extern bool check_max_wal_senders(int *newval, void **extra, GucSource source); +extern bool check_max_slot_wal_keep_size(int *newval, void **extra, + GucSource source); +extern void assign_max_wal_size(int newval, void *extra); +extern bool check_max_worker_processes(int *newval, void **extra, + GucSource source); +extern bool check_max_stack_depth(int *newval, void **extra, GucSource source); +extern void assign_max_stack_depth(int newval, void *extra); +extern bool check_multixact_member_buffers(int *newval, void **extra, + GucSource source); +extern bool check_multixact_offset_buffers(int *newval, void **extra, + GucSource source); +extern bool check_notify_buffers(int *newval, void **extra, GucSource source); +extern bool check_primary_slot_name(char **newval, void **extra, + GucSource source); +extern bool check_random_seed(double *newval, void **extra, GucSource source); +extern void assign_random_seed(double newval, void *extra); +extern const char *show_random_seed(void); +extern bool check_recovery_prefetch(int *new_value, void **extra, + GucSource source); +extern void assign_recovery_prefetch(int new_value, void *extra); +extern bool check_recovery_target(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target(const char *newval, void *extra); +extern bool check_recovery_target_lsn(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_lsn(const char *newval, void *extra); +extern bool check_recovery_target_name(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_name(const char *newval, void *extra); +extern bool check_recovery_target_time(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_time(const char *newval, void *extra); +extern bool check_recovery_target_timeline(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_timeline(const char *newval, void *extra); +extern bool check_recovery_target_xid(char **newval, void **extra, + GucSource source); +extern void assign_recovery_target_xid(const char *newval, void *extra); +extern bool check_role(char **newval, void **extra, GucSource source); +extern void assign_role(const char *newval, void *extra); +extern const char *show_role(void); +extern bool check_restrict_nonsystem_relation_kind(char **newval, void **extra, + GucSource source); +extern void assign_restrict_nonsystem_relation_kind(const char *newval, void *extra); +extern bool check_search_path(char **newval, void **extra, GucSource source); +extern void assign_search_path(const char *newval, void *extra); +extern bool check_serial_buffers(int *newval, void **extra, GucSource source); +extern bool check_session_authorization(char **newval, void **extra, GucSource source); +extern void assign_session_authorization(const char *newval, void *extra); +extern void assign_session_replication_role(int newval, void *extra); +extern void assign_stats_fetch_consistency(int newval, void *extra); +extern bool check_ssl(bool *newval, void **extra, GucSource source); +extern bool check_stage_log_stats(bool *newval, void **extra, GucSource source); +extern bool check_subtrans_buffers(int *newval, void **extra, + GucSource source); +extern bool check_synchronous_standby_names(char **newval, void **extra, + GucSource source); +extern void assign_synchronous_standby_names(const char *newval, void *extra); +extern void assign_synchronous_commit(int newval, void *extra); +extern void assign_syslog_facility(int newval, void *extra); +extern void assign_syslog_ident(const char *newval, void *extra); +extern void assign_tcp_keepalives_count(int newval, void *extra); +extern const char *show_tcp_keepalives_count(void); +extern void assign_tcp_keepalives_idle(int newval, void *extra); +extern const char *show_tcp_keepalives_idle(void); +extern void assign_tcp_keepalives_interval(int newval, void *extra); +extern const char *show_tcp_keepalives_interval(void); +extern void assign_tcp_user_timeout(int newval, void *extra); +extern const char *show_tcp_user_timeout(void); +extern bool check_temp_buffers(int *newval, void **extra, GucSource source); +extern bool check_temp_tablespaces(char **newval, void **extra, + GucSource source); +extern void assign_temp_tablespaces(const char *newval, void *extra); +extern bool check_timezone(char **newval, void **extra, GucSource source); +extern void assign_timezone(const char *newval, void *extra); +extern const char *show_timezone(void); +extern bool check_timezone_abbreviations(char **newval, void **extra, + GucSource source); +extern void assign_timezone_abbreviations(const char *newval, void *extra); +extern bool check_transaction_buffers(int *newval, void **extra, GucSource source); +extern bool check_transaction_deferrable(bool *newval, void **extra, GucSource source); +extern bool check_transaction_isolation(int *newval, void **extra, GucSource source); +extern bool check_transaction_read_only(bool *newval, void **extra, GucSource source); +extern void assign_transaction_timeout(int newval, void *extra); +extern const char *show_unix_socket_permissions(void); +extern bool check_wal_buffers(int *newval, void **extra, GucSource source); +extern bool check_wal_consistency_checking(char **newval, void **extra, + GucSource source); +extern void assign_wal_consistency_checking(const char *newval, void *extra); +extern bool check_wal_segment_size(int *newval, void **extra, GucSource source); +extern void assign_wal_sync_method(int new_wal_sync_method, void *extra); +extern bool check_synchronized_standby_slots(char **newval, void **extra, + GucSource source); +extern void assign_synchronized_standby_slots(const char *newval, void *extra); + +#endif /* GUC_HOOKS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/guc_tables.h b/platform/dbops/binaries/postgres/include/server/utils/guc_tables.h new file mode 100644 index 0000000000000000000000000000000000000000..0c0277c4230269110002fa53f6e887b811408cbd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/guc_tables.h @@ -0,0 +1,323 @@ +/*------------------------------------------------------------------------- + * + * guc_tables.h + * Declarations of tables used by GUC. + * + * See src/backend/utils/misc/README for design notes. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/utils/guc_tables.h + * + *------------------------------------------------------------------------- + */ +#ifndef GUC_TABLES_H +#define GUC_TABLES_H 1 + +#include "lib/ilist.h" +#include "utils/guc.h" + +/* + * GUC supports these types of variables: + */ +enum config_type +{ + PGC_BOOL, + PGC_INT, + PGC_REAL, + PGC_STRING, + PGC_ENUM, +}; + +union config_var_val +{ + bool boolval; + int intval; + double realval; + char *stringval; + int enumval; +}; + +/* + * The actual value of a GUC variable can include a malloc'd opaque struct + * "extra", which is created by its check_hook and used by its assign_hook. + */ +typedef struct config_var_value +{ + union config_var_val val; + void *extra; +} config_var_value; + +/* + * Groupings to help organize all the run-time options for display. + * Be sure this agrees with the way the options are categorized in config.sgml! + */ +enum config_group +{ + UNGROUPED, /* use for options not shown in pg_settings */ + FILE_LOCATIONS, + CONN_AUTH_SETTINGS, + CONN_AUTH_TCP, + CONN_AUTH_AUTH, + CONN_AUTH_SSL, + RESOURCES_MEM, + RESOURCES_DISK, + RESOURCES_KERNEL, + RESOURCES_VACUUM_DELAY, + RESOURCES_BGWRITER, + RESOURCES_ASYNCHRONOUS, + WAL_SETTINGS, + WAL_CHECKPOINTS, + WAL_ARCHIVING, + WAL_RECOVERY, + WAL_ARCHIVE_RECOVERY, + WAL_RECOVERY_TARGET, + WAL_SUMMARIZATION, + REPLICATION_SENDING, + REPLICATION_PRIMARY, + REPLICATION_STANDBY, + REPLICATION_SUBSCRIBERS, + QUERY_TUNING_METHOD, + QUERY_TUNING_COST, + QUERY_TUNING_GEQO, + QUERY_TUNING_OTHER, + LOGGING_WHERE, + LOGGING_WHEN, + LOGGING_WHAT, + PROCESS_TITLE, + STATS_MONITORING, + STATS_CUMULATIVE, + AUTOVACUUM, + CLIENT_CONN_STATEMENT, + CLIENT_CONN_LOCALE, + CLIENT_CONN_PRELOAD, + CLIENT_CONN_OTHER, + LOCK_MANAGEMENT, + COMPAT_OPTIONS_PREVIOUS, + COMPAT_OPTIONS_OTHER, + ERROR_HANDLING_OPTIONS, + PRESET_OPTIONS, + CUSTOM_OPTIONS, + DEVELOPER_OPTIONS, +}; + +/* + * Stack entry for saving the state a variable had prior to an uncommitted + * transactional change + */ +typedef enum +{ + /* This is almost GucAction, but we need a fourth state for SET+LOCAL */ + GUC_SAVE, /* entry caused by function SET option */ + GUC_SET, /* entry caused by plain SET command */ + GUC_LOCAL, /* entry caused by SET LOCAL command */ + GUC_SET_LOCAL, /* entry caused by SET then SET LOCAL */ +} GucStackState; + +typedef struct guc_stack +{ + struct guc_stack *prev; /* previous stack item, if any */ + int nest_level; /* nesting depth at which we made entry */ + GucStackState state; /* see enum above */ + GucSource source; /* source of the prior value */ + /* masked value's source must be PGC_S_SESSION, so no need to store it */ + GucContext scontext; /* context that set the prior value */ + GucContext masked_scontext; /* context that set the masked value */ + Oid srole; /* role that set the prior value */ + Oid masked_srole; /* role that set the masked value */ + config_var_value prior; /* previous value of variable */ + config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */ +} GucStack; + +/* + * Generic fields applicable to all types of variables + * + * The short description should be less than 80 chars in length. Some + * applications may use the long description as well, and will append + * it to the short description. (separated by a newline or '. ') + * + * srole is the role that set the current value, or BOOTSTRAP_SUPERUSERID + * if the value came from an internal source or the config file. Similarly + * for reset_srole (which is usually BOOTSTRAP_SUPERUSERID, but not always). + * + * Variables that are currently of active interest for maintenance + * operations are linked into various lists using the xxx_link fields. + * The link fields are unused/garbage in variables not currently having + * the specified properties. + * + * Note that sourcefile/sourceline are kept here, and not pushed into stacked + * values, although in principle they belong with some stacked value if the + * active value is session- or transaction-local. This is to avoid bloating + * stack entries. We know they are only relevant when source == PGC_S_FILE. + */ +struct config_generic +{ + /* constant fields, must be set correctly in initial value: */ + const char *name; /* name of variable - MUST BE FIRST */ + GucContext context; /* context required to set the variable */ + enum config_group group; /* to help organize variables by function */ + const char *short_desc; /* short desc. of this variable's purpose */ + const char *long_desc; /* long desc. of this variable's purpose */ + int flags; /* flag bits, see guc.h */ + /* variable fields, initialized at runtime: */ + enum config_type vartype; /* type of variable (set only at startup) */ + int status; /* status bits, see below */ + GucSource source; /* source of the current actual value */ + GucSource reset_source; /* source of the reset_value */ + GucContext scontext; /* context that set the current value */ + GucContext reset_scontext; /* context that set the reset value */ + Oid srole; /* role that set the current value */ + Oid reset_srole; /* role that set the reset value */ + GucStack *stack; /* stacked prior values */ + void *extra; /* "extra" pointer for current actual value */ + dlist_node nondef_link; /* list link for variables that have source + * different from PGC_S_DEFAULT */ + slist_node stack_link; /* list link for variables that have non-NULL + * stack */ + slist_node report_link; /* list link for variables that have the + * GUC_NEEDS_REPORT bit set in status */ + char *last_reported; /* if variable is GUC_REPORT, value last sent + * to client (NULL if not yet sent) */ + char *sourcefile; /* file current setting is from (NULL if not + * set in config file) */ + int sourceline; /* line in source file */ +}; + +/* bit values in status field */ +#define GUC_IS_IN_FILE 0x0001 /* found it in config file */ +/* + * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile. + * Do not assume that its value represents useful information elsewhere. + */ +#define GUC_PENDING_RESTART 0x0002 /* changed value cannot be applied yet */ +#define GUC_NEEDS_REPORT 0x0004 /* new value must be reported to client */ + + +/* GUC records for specific variable types */ + +struct config_bool +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + bool *variable; + bool boot_val; + GucBoolCheckHook check_hook; + GucBoolAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + bool reset_val; + void *reset_extra; +}; + +struct config_int +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + int min; + int max; + GucIntCheckHook check_hook; + GucIntAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; + void *reset_extra; +}; + +struct config_real +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + double *variable; + double boot_val; + double min; + double max; + GucRealCheckHook check_hook; + GucRealAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + double reset_val; + void *reset_extra; +}; + +/* + * A note about string GUCs: the boot_val is allowed to be NULL, which leads + * to the reset_val and the actual variable value (*variable) also being NULL. + * However, there is no way to set a NULL value subsequently using + * set_config_option or any other GUC API. Also, GUC APIs such as SHOW will + * display a NULL value as an empty string. Callers that choose to use a NULL + * boot_val should overwrite the setting later in startup, or else be careful + * that NULL doesn't have semantics that are visibly different from an empty + * string. + */ +struct config_string +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + char **variable; + const char *boot_val; + GucStringCheckHook check_hook; + GucStringAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + char *reset_val; + void *reset_extra; +}; + +struct config_enum +{ + struct config_generic gen; + /* constant fields, must be set correctly in initial value: */ + int *variable; + int boot_val; + const struct config_enum_entry *options; + GucEnumCheckHook check_hook; + GucEnumAssignHook assign_hook; + GucShowHook show_hook; + /* variable fields, initialized at runtime: */ + int reset_val; + void *reset_extra; +}; + +/* constant tables corresponding to enums above and in guc.h */ +extern PGDLLIMPORT const char *const config_group_names[]; +extern PGDLLIMPORT const char *const config_type_names[]; +extern PGDLLIMPORT const char *const GucContext_Names[]; +extern PGDLLIMPORT const char *const GucSource_Names[]; + +/* data arrays defining all the built-in GUC variables */ +extern PGDLLIMPORT struct config_bool ConfigureNamesBool[]; +extern PGDLLIMPORT struct config_int ConfigureNamesInt[]; +extern PGDLLIMPORT struct config_real ConfigureNamesReal[]; +extern PGDLLIMPORT struct config_string ConfigureNamesString[]; +extern PGDLLIMPORT struct config_enum ConfigureNamesEnum[]; + +/* lookup GUC variables, returning config_generic pointers */ +extern struct config_generic *find_option(const char *name, + bool create_placeholders, + bool skip_errors, + int elevel); +extern struct config_generic **get_explain_guc_options(int *num); + +/* get string value of variable */ +extern char *ShowGUCOption(struct config_generic *record, bool use_units); + +/* get whether or not the GUC variable is visible to current user */ +extern bool ConfigOptionIsVisible(struct config_generic *conf); + +/* get the current set of variables */ +extern struct config_generic **get_guc_variables(int *num_vars); + +extern void build_guc_variables(void); + +/* search in enum options */ +extern const char *config_enum_lookup_by_value(struct config_enum *record, int val); +extern bool config_enum_lookup_by_name(struct config_enum *record, + const char *value, int *retval); +extern char *config_enum_get_options(struct config_enum *record, + const char *prefix, + const char *suffix, + const char *separator); + +#endif /* GUC_TABLES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/help_config.h b/platform/dbops/binaries/postgres/include/server/utils/help_config.h new file mode 100644 index 0000000000000000000000000000000000000000..c27a54f1b913c9d43e3b0f779d04bbc11122d4a4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/help_config.h @@ -0,0 +1,17 @@ +/*------------------------------------------------------------------------- + * + * help_config.h + * Interface to the --help-config option of main.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/utils/help_config.h + * + *------------------------------------------------------------------------- + */ +#ifndef HELP_CONFIG_H +#define HELP_CONFIG_H 1 + +extern void GucInfoMain(void) pg_attribute_noreturn(); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/hsearch.h b/platform/dbops/binaries/postgres/include/server/utils/hsearch.h new file mode 100644 index 0000000000000000000000000000000000000000..da26941f6db5ffda5bd3b960235c724000a319ad --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/hsearch.h @@ -0,0 +1,153 @@ +/*------------------------------------------------------------------------- + * + * hsearch.h + * exported definitions for utils/hash/dynahash.c; see notes therein + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/hsearch.h + * + *------------------------------------------------------------------------- + */ +#ifndef HSEARCH_H +#define HSEARCH_H + + +/* + * Hash functions must have this signature. + */ +typedef uint32 (*HashValueFunc) (const void *key, Size keysize); + +/* + * Key comparison functions must have this signature. Comparison functions + * return zero for match, nonzero for no match. (The comparison function + * definition is designed to allow memcmp() and strncmp() to be used directly + * as key comparison functions.) + */ +typedef int (*HashCompareFunc) (const void *key1, const void *key2, + Size keysize); + +/* + * Key copying functions must have this signature. The return value is not + * used. (The definition is set up to allow memcpy() and strlcpy() to be + * used directly.) + */ +typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize); + +/* + * Space allocation function for a hashtable --- designed to match malloc(). + * Note: there is no free function API; can't destroy a hashtable unless you + * use the default allocator. + */ +typedef void *(*HashAllocFunc) (Size request); + +/* + * HASHELEMENT is the private part of a hashtable entry. The caller's data + * follows the HASHELEMENT structure (on a MAXALIGN'd boundary). The hash key + * is expected to be at the start of the caller's hash entry data structure. + */ +typedef struct HASHELEMENT +{ + struct HASHELEMENT *link; /* link to next entry in same bucket */ + uint32 hashvalue; /* hash function result for this entry */ +} HASHELEMENT; + +/* Hash table header struct is an opaque type known only within dynahash.c */ +typedef struct HASHHDR HASHHDR; + +/* Hash table control struct is an opaque type known only within dynahash.c */ +typedef struct HTAB HTAB; + +/* Parameter data structure for hash_create */ +/* Only those fields indicated by hash_flags need be set */ +typedef struct HASHCTL +{ + /* Used if HASH_PARTITION flag is set: */ + long num_partitions; /* # partitions (must be power of 2) */ + /* Used if HASH_SEGMENT flag is set: */ + long ssize; /* segment size */ + /* Used if HASH_DIRSIZE flag is set: */ + long dsize; /* (initial) directory size */ + long max_dsize; /* limit to dsize if dir size is limited */ + /* Used if HASH_ELEM flag is set (which is now required): */ + Size keysize; /* hash key length in bytes */ + Size entrysize; /* total user element size in bytes */ + /* Used if HASH_FUNCTION flag is set: */ + HashValueFunc hash; /* hash function */ + /* Used if HASH_COMPARE flag is set: */ + HashCompareFunc match; /* key comparison function */ + /* Used if HASH_KEYCOPY flag is set: */ + HashCopyFunc keycopy; /* key copying function */ + /* Used if HASH_ALLOC flag is set: */ + HashAllocFunc alloc; /* memory allocator */ + /* Used if HASH_CONTEXT flag is set: */ + MemoryContext hcxt; /* memory context to use for allocations */ + /* Used if HASH_SHARED_MEM flag is set: */ + HASHHDR *hctl; /* location of header in shared mem */ +} HASHCTL; + +/* Flag bits for hash_create; most indicate which parameters are supplied */ +#define HASH_PARTITION 0x0001 /* Hashtable is used w/partitioned locking */ +#define HASH_SEGMENT 0x0002 /* Set segment size */ +#define HASH_DIRSIZE 0x0004 /* Set directory size (initial and max) */ +#define HASH_ELEM 0x0008 /* Set keysize and entrysize (now required!) */ +#define HASH_STRINGS 0x0010 /* Select support functions for string keys */ +#define HASH_BLOBS 0x0020 /* Select support functions for binary keys */ +#define HASH_FUNCTION 0x0040 /* Set user defined hash function */ +#define HASH_COMPARE 0x0080 /* Set user defined comparison function */ +#define HASH_KEYCOPY 0x0100 /* Set user defined key-copying function */ +#define HASH_ALLOC 0x0200 /* Set memory allocator */ +#define HASH_CONTEXT 0x0400 /* Set memory allocation context */ +#define HASH_SHARED_MEM 0x0800 /* Hashtable is in shared memory */ +#define HASH_ATTACH 0x1000 /* Do not initialize hctl */ +#define HASH_FIXED_SIZE 0x2000 /* Initial size is a hard limit */ + +/* max_dsize value to indicate expansible directory */ +#define NO_MAX_DSIZE (-1) + +/* hash_search operations */ +typedef enum +{ + HASH_FIND, + HASH_ENTER, + HASH_REMOVE, + HASH_ENTER_NULL, +} HASHACTION; + +/* hash_seq status (should be considered an opaque type by callers) */ +typedef struct +{ + HTAB *hashp; + uint32 curBucket; /* index of current bucket */ + HASHELEMENT *curEntry; /* current entry in bucket */ +} HASH_SEQ_STATUS; + +/* + * prototypes for functions in dynahash.c + */ +extern HTAB *hash_create(const char *tabname, long nelem, + const HASHCTL *info, int flags); +extern void hash_destroy(HTAB *hashp); +extern void hash_stats(const char *where, HTAB *hashp); +extern void *hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, + bool *foundPtr); +extern uint32 get_hash_value(HTAB *hashp, const void *keyPtr); +extern void *hash_search_with_hash_value(HTAB *hashp, const void *keyPtr, + uint32 hashvalue, HASHACTION action, + bool *foundPtr); +extern bool hash_update_hash_key(HTAB *hashp, void *existingEntry, + const void *newKeyPtr); +extern long hash_get_num_entries(HTAB *hashp); +extern void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp); +extern void *hash_seq_search(HASH_SEQ_STATUS *status); +extern void hash_seq_term(HASH_SEQ_STATUS *status); +extern void hash_freeze(HTAB *hashp); +extern Size hash_estimate_size(long num_entries, Size entrysize); +extern long hash_select_dirsize(long num_entries); +extern Size hash_get_shared_size(HASHCTL *info, int flags); +extern void AtEOXact_HashTables(bool isCommit); +extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth); + +#endif /* HSEARCH_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/index_selfuncs.h b/platform/dbops/binaries/postgres/include/server/utils/index_selfuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..a41cd2b7fd979d3f10d061256c0ff7c5c6af7f9d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/index_selfuncs.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * index_selfuncs.h + * Index cost estimation functions for standard index access methods. + * + * + * Note: this is split out of selfuncs.h mainly to avoid importing all of the + * planner's data structures into the non-planner parts of the index AMs. + * If you make it depend on anything besides access/amapi.h, that's likely + * a mistake. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/index_selfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef INDEX_SELFUNCS_H +#define INDEX_SELFUNCS_H + +#include "access/amapi.h" + +/* Functions in selfuncs.c */ +extern void brincostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void btcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void hashcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void gistcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void spgcostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); +extern void gincostestimate(struct PlannerInfo *root, + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); + +#endif /* INDEX_SELFUNCS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/inet.h b/platform/dbops/binaries/postgres/include/server/utils/inet.h new file mode 100644 index 0000000000000000000000000000000000000000..882617c704a04973da6298fda8cbcc079e38aa17 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/inet.h @@ -0,0 +1,184 @@ +/*------------------------------------------------------------------------- + * + * inet.h + * Declarations for operations on INET datatypes. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/inet.h + * + *------------------------------------------------------------------------- + */ +#ifndef INET_H +#define INET_H + +#include "fmgr.h" + +/* + * This is the internal storage format for IP addresses + * (both INET and CIDR datatypes): + */ +typedef struct +{ + unsigned char family; /* PGSQL_AF_INET or PGSQL_AF_INET6 */ + unsigned char bits; /* number of bits in netmask */ + unsigned char ipaddr[16]; /* up to 128 bits of address */ +} inet_struct; + +/* + * We use these values for the "family" field. + * + * Referencing all of the non-AF_INET types to AF_INET lets us work on + * machines which did not have the appropriate address family (like + * inet6 addresses when AF_INET6 wasn't present) but didn't cause a + * dump/reload requirement. Pre-7.4 databases used AF_INET for the family + * type on disk. + */ +#define PGSQL_AF_INET (AF_INET + 0) +#define PGSQL_AF_INET6 (AF_INET + 1) + +/* + * Both INET and CIDR addresses are represented within Postgres as varlena + * objects, ie, there is a varlena header in front of the struct type + * depicted above. This struct depicts what we actually have in memory + * in "uncompressed" cases. Note that since the maximum data size is only + * 18 bytes, INET/CIDR will invariably be stored into tuples using the + * 1-byte-header varlena format. However, we have to be prepared to cope + * with the 4-byte-header format too, because various code may helpfully + * try to "decompress" 1-byte-header datums. + */ +typedef struct +{ + char vl_len_[4]; /* Do not touch this field directly! */ + inet_struct inet_data; +} inet; + +/* + * Access macros. We use VARDATA_ANY so that we can process short-header + * varlena values without detoasting them. This requires a trick: + * VARDATA_ANY assumes the varlena header is already filled in, which is + * not the case when constructing a new value (until SET_INET_VARSIZE is + * called, which we typically can't do till the end). Therefore, we + * always initialize the newly-allocated value to zeroes (using palloc0). + * A zero length word will look like the not-1-byte case to VARDATA_ANY, + * and so we correctly construct an uncompressed value. + * + * Note that ip_addrsize(), ip_maxbits(), and SET_INET_VARSIZE() require + * the family field to be set correctly. + */ +#define ip_family(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->family) + +#define ip_bits(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->bits) + +#define ip_addr(inetptr) \ + (((inet_struct *) VARDATA_ANY(inetptr))->ipaddr) + +#define ip_addrsize(inetptr) \ + (ip_family(inetptr) == PGSQL_AF_INET ? 4 : 16) + +#define ip_maxbits(inetptr) \ + (ip_family(inetptr) == PGSQL_AF_INET ? 32 : 128) + +#define SET_INET_VARSIZE(dst) \ + SET_VARSIZE(dst, VARHDRSZ + offsetof(inet_struct, ipaddr) + \ + ip_addrsize(dst)) + + +/* + * This is the internal storage format for MAC addresses: + */ +typedef struct macaddr +{ + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; +} macaddr; + +/* + * This is the internal storage format for MAC8 addresses: + */ +typedef struct macaddr8 +{ + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; + unsigned char g; + unsigned char h; +} macaddr8; + +/* + * fmgr interface macros + */ +static inline inet * +DatumGetInetPP(Datum X) +{ + return (inet *) PG_DETOAST_DATUM_PACKED(X); +} + +static inline Datum +InetPGetDatum(const inet *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n)) +#define PG_RETURN_INET_P(x) return InetPGetDatum(x) + +/* obsolescent variants */ +static inline inet * +DatumGetInetP(Datum X) +{ + return (inet *) PG_DETOAST_DATUM(X); +} +#define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n)) + +/* macaddr is a fixed-length pass-by-reference datatype */ +static inline macaddr * +DatumGetMacaddrP(Datum X) +{ + return (macaddr *) DatumGetPointer(X); +} + +static inline Datum +MacaddrPGetDatum(const macaddr *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MACADDR_P(n) DatumGetMacaddrP(PG_GETARG_DATUM(n)) +#define PG_RETURN_MACADDR_P(x) return MacaddrPGetDatum(x) + +/* macaddr8 is a fixed-length pass-by-reference datatype */ +static inline macaddr8 * +DatumGetMacaddr8P(Datum X) +{ + return (macaddr8 *) DatumGetPointer(X); +} + +static inline Datum +Macaddr8PGetDatum(const macaddr8 *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MACADDR8_P(n) DatumGetMacaddr8P(PG_GETARG_DATUM(n)) +#define PG_RETURN_MACADDR8_P(x) return Macaddr8PGetDatum(x) + +/* + * Support functions in network.c + */ +extern inet *cidr_set_masklen_internal(const inet *src, int bits); +extern int bitncmp(const unsigned char *l, const unsigned char *r, int n); +extern int bitncommon(const unsigned char *l, const unsigned char *r, int n); + +#endif /* INET_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/injection_point.h b/platform/dbops/binaries/postgres/include/server/utils/injection_point.h new file mode 100644 index 0000000000000000000000000000000000000000..6e417cedc60b34592bc75551833a64ef79edfbfd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/injection_point.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * injection_point.h + * Definitions related to injection points. + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/utils/injection_point.h + *------------------------------------------------------------------------- + */ + +#ifndef INJECTION_POINT_H +#define INJECTION_POINT_H + +/* + * Injections points require --enable-injection-points. + */ +#ifdef USE_INJECTION_POINTS +#define INJECTION_POINT(name) InjectionPointRun(name) +#else +#define INJECTION_POINT(name) ((void) name) +#endif + +/* + * Typedef for callback function launched by an injection point. + */ +typedef void (*InjectionPointCallback) (const char *name, + const void *private_data); + +extern Size InjectionPointShmemSize(void); +extern void InjectionPointShmemInit(void); + +extern void InjectionPointAttach(const char *name, + const char *library, + const char *function, + const void *private_data, + int private_data_size); +extern void InjectionPointRun(const char *name); +extern bool InjectionPointDetach(const char *name); + +#ifdef EXEC_BACKEND +extern PGDLLIMPORT struct InjectionPointsCtl *ActiveInjectionPoints; +#endif + +#endif /* INJECTION_POINT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/inval.h b/platform/dbops/binaries/postgres/include/server/utils/inval.h new file mode 100644 index 0000000000000000000000000000000000000000..24695facf22183a01b25c1f18808761cac07f2ad --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/inval.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------------------- + * + * inval.h + * POSTGRES cache invalidation dispatcher definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/inval.h + * + *------------------------------------------------------------------------- + */ +#ifndef INVAL_H +#define INVAL_H + +#include "access/htup.h" +#include "storage/relfilelocator.h" +#include "utils/relcache.h" + +extern PGDLLIMPORT int debug_discard_caches; + +typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue); +typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid); + + +extern void AcceptInvalidationMessages(void); + +extern void AtEOXact_Inval(bool isCommit); + +extern void AtEOSubXact_Inval(bool isCommit); + +extern void PostPrepare_Inval(void); + +extern void CommandEndInvalidationMessages(void); + +extern void CacheInvalidateHeapTuple(Relation relation, + HeapTuple tuple, + HeapTuple newtuple); + +extern void CacheInvalidateCatalog(Oid catalogId); + +extern void CacheInvalidateRelcache(Relation relation); + +extern void CacheInvalidateRelcacheAll(void); + +extern void CacheInvalidateRelcacheByTuple(HeapTuple classTuple); + +extern void CacheInvalidateRelcacheByRelid(Oid relid); + +extern void CacheInvalidateSmgr(RelFileLocatorBackend rlocator); + +extern void CacheInvalidateRelmap(Oid databaseId); + +extern void CacheRegisterSyscacheCallback(int cacheid, + SyscacheCallbackFunction func, + Datum arg); + +extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, + Datum arg); + +extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue); + +extern void InvalidateSystemCaches(void); +extern void InvalidateSystemCachesExtended(bool debug_discard); + +extern void LogLogicalInvalidations(void); +#endif /* INVAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/json.h b/platform/dbops/binaries/postgres/include/server/utils/json.h new file mode 100644 index 0000000000000000000000000000000000000000..6d7f1b387d1edadf00e5616da80810a19ca4affd --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/json.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * json.h + * Declarations for JSON data type support. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/json.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSON_H +#define JSON_H + +#include "lib/stringinfo.h" + +/* functions in json.c */ +extern void escape_json(StringInfo buf, const char *str); +extern char *JsonEncodeDateTime(char *buf, Datum value, Oid typid, + const int *tzp); +extern bool to_json_is_immutable(Oid typoid); +extern Datum json_build_object_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null, + bool unique_keys); +extern Datum json_build_array_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null); +extern bool json_validate(text *json, bool check_unique_keys, bool throw_error); + +#endif /* JSON_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/jsonb.h b/platform/dbops/binaries/postgres/include/server/utils/jsonb.h new file mode 100644 index 0000000000000000000000000000000000000000..d589ace5a21e200f0bb0685f3f1b9dc6ca5c9a44 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/jsonb.h @@ -0,0 +1,440 @@ +/*------------------------------------------------------------------------- + * + * jsonb.h + * Declarations for jsonb data type support. + * + * Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/utils/jsonb.h + * + *------------------------------------------------------------------------- + */ +#ifndef __JSONB_H__ +#define __JSONB_H__ + +#include "lib/stringinfo.h" +#include "utils/array.h" +#include "utils/numeric.h" + +/* Tokens used when sequentially processing a jsonb value */ +typedef enum +{ + WJB_DONE, + WJB_KEY, + WJB_VALUE, + WJB_ELEM, + WJB_BEGIN_ARRAY, + WJB_END_ARRAY, + WJB_BEGIN_OBJECT, + WJB_END_OBJECT, +} JsonbIteratorToken; + +/* Strategy numbers for GIN index opclasses */ +#define JsonbContainsStrategyNumber 7 +#define JsonbExistsStrategyNumber 9 +#define JsonbExistsAnyStrategyNumber 10 +#define JsonbExistsAllStrategyNumber 11 +#define JsonbJsonpathExistsStrategyNumber 15 +#define JsonbJsonpathPredicateStrategyNumber 16 + + +/* + * In the standard jsonb_ops GIN opclass for jsonb, we choose to index both + * keys and values. The storage format is text. The first byte of the text + * string distinguishes whether this is a key (always a string), null value, + * boolean value, numeric value, or string value. However, array elements + * that are strings are marked as though they were keys; this imprecision + * supports the definition of the "exists" operator, which treats array + * elements like keys. The remainder of the text string is empty for a null + * value, "t" or "f" for a boolean value, a normalized print representation of + * a numeric value, or the text of a string value. However, if the length of + * this text representation would exceed JGIN_MAXLENGTH bytes, we instead hash + * the text representation and store an 8-hex-digit representation of the + * uint32 hash value, marking the prefix byte with an additional bit to + * distinguish that this has happened. Hashing long strings saves space and + * ensures that we won't overrun the maximum entry length for a GIN index. + * (But JGIN_MAXLENGTH is quite a bit shorter than GIN's limit. It's chosen + * to ensure that the on-disk text datum will have a short varlena header.) + * Note that when any hashed item appears in a query, we must recheck index + * matches against the heap tuple; currently, this costs nothing because we + * must always recheck for other reasons. + */ +#define JGINFLAG_KEY 0x01 /* key (or string array element) */ +#define JGINFLAG_NULL 0x02 /* null value */ +#define JGINFLAG_BOOL 0x03 /* boolean value */ +#define JGINFLAG_NUM 0x04 /* numeric value */ +#define JGINFLAG_STR 0x05 /* string value (if not an array element) */ +#define JGINFLAG_HASHED 0x10 /* OR'd into flag if value was hashed */ +#define JGIN_MAXLENGTH 125 /* max length of text part before hashing */ + +typedef struct JsonbPair JsonbPair; +typedef struct JsonbValue JsonbValue; + +/* + * Jsonbs are varlena objects, so must meet the varlena convention that the + * first int32 of the object contains the total object size in bytes. Be sure + * to use VARSIZE() and SET_VARSIZE() to access it, though! + * + * Jsonb is the on-disk representation, in contrast to the in-memory JsonbValue + * representation. Often, JsonbValues are just shims through which a Jsonb + * buffer is accessed, but they can also be deep copied and passed around. + * + * Jsonb is a tree structure. Each node in the tree consists of a JEntry + * header and a variable-length content (possibly of zero size). The JEntry + * header indicates what kind of a node it is, e.g. a string or an array, + * and provides the length of its variable-length portion. + * + * The JEntry and the content of a node are not stored physically together. + * Instead, the container array or object has an array that holds the JEntrys + * of all the child nodes, followed by their variable-length portions. + * + * The root node is an exception; it has no parent array or object that could + * hold its JEntry. Hence, no JEntry header is stored for the root node. It + * is implicitly known that the root node must be an array or an object, + * so we can get away without the type indicator as long as we can distinguish + * the two. For that purpose, both an array and an object begin with a uint32 + * header field, which contains an JB_FOBJECT or JB_FARRAY flag. When a naked + * scalar value needs to be stored as a Jsonb value, what we actually store is + * an array with one element, with the flags in the array's header field set + * to JB_FSCALAR | JB_FARRAY. + * + * Overall, the Jsonb struct requires 4-bytes alignment. Within the struct, + * the variable-length portion of some node types is aligned to a 4-byte + * boundary, while others are not. When alignment is needed, the padding is + * in the beginning of the node that requires it. For example, if a numeric + * node is stored after a string node, so that the numeric node begins at + * offset 3, the variable-length portion of the numeric node will begin with + * one padding byte so that the actual numeric data is 4-byte aligned. + */ + +/* + * JEntry format. + * + * The least significant 28 bits store either the data length of the entry, + * or its end+1 offset from the start of the variable-length portion of the + * containing object. The next three bits store the type of the entry, and + * the high-order bit tells whether the least significant bits store a length + * or an offset. + * + * The reason for the offset-or-length complication is to compromise between + * access speed and data compressibility. In the initial design each JEntry + * always stored an offset, but this resulted in JEntry arrays with horrible + * compressibility properties, so that TOAST compression of a JSONB did not + * work well. Storing only lengths would greatly improve compressibility, + * but it makes random access into large arrays expensive (O(N) not O(1)). + * So what we do is store an offset in every JB_OFFSET_STRIDE'th JEntry and + * a length in the rest. This results in reasonably compressible data (as + * long as the stride isn't too small). We may have to examine as many as + * JB_OFFSET_STRIDE JEntrys in order to find out the offset or length of any + * given item, but that's still O(1) no matter how large the container is. + * + * We could avoid eating a flag bit for this purpose if we were to store + * the stride in the container header, or if we were willing to treat the + * stride as an unchangeable constant. Neither of those options is very + * attractive though. + */ +typedef uint32 JEntry; + +#define JENTRY_OFFLENMASK 0x0FFFFFFF +#define JENTRY_TYPEMASK 0x70000000 +#define JENTRY_HAS_OFF 0x80000000 + +/* values stored in the type bits */ +#define JENTRY_ISSTRING 0x00000000 +#define JENTRY_ISNUMERIC 0x10000000 +#define JENTRY_ISBOOL_FALSE 0x20000000 +#define JENTRY_ISBOOL_TRUE 0x30000000 +#define JENTRY_ISNULL 0x40000000 +#define JENTRY_ISCONTAINER 0x50000000 /* array or object */ + +/* Access macros. Note possible multiple evaluations */ +#define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK) +#define JBE_HAS_OFF(je_) (((je_) & JENTRY_HAS_OFF) != 0) +#define JBE_ISSTRING(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISSTRING) +#define JBE_ISNUMERIC(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNUMERIC) +#define JBE_ISCONTAINER(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISCONTAINER) +#define JBE_ISNULL(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNULL) +#define JBE_ISBOOL_TRUE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_TRUE) +#define JBE_ISBOOL_FALSE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_FALSE) +#define JBE_ISBOOL(je_) (JBE_ISBOOL_TRUE(je_) || JBE_ISBOOL_FALSE(je_)) + +/* Macro for advancing an offset variable to the next JEntry */ +#define JBE_ADVANCE_OFFSET(offset, je) \ + do { \ + JEntry je_ = (je); \ + if (JBE_HAS_OFF(je_)) \ + (offset) = JBE_OFFLENFLD(je_); \ + else \ + (offset) += JBE_OFFLENFLD(je_); \ + } while(0) + +/* + * We store an offset, not a length, every JB_OFFSET_STRIDE children. + * Caution: this macro should only be referenced when creating a JSONB + * value. When examining an existing value, pay attention to the HAS_OFF + * bits instead. This allows changes in the offset-placement heuristic + * without breaking on-disk compatibility. + */ +#define JB_OFFSET_STRIDE 32 + +/* + * A jsonb array or object node, within a Jsonb Datum. + * + * An array has one child for each element, stored in array order. + * + * An object has two children for each key/value pair. The keys all appear + * first, in key sort order; then the values appear, in an order matching the + * key order. This arrangement keeps the keys compact in memory, making a + * search for a particular key more cache-friendly. + */ +typedef struct JsonbContainer +{ + uint32 header; /* number of elements or key/value pairs, and + * flags */ + JEntry children[FLEXIBLE_ARRAY_MEMBER]; + + /* the data for each child node follows. */ +} JsonbContainer; + +/* flags for the header-field in JsonbContainer */ +#define JB_CMASK 0x0FFFFFFF /* mask for count field */ +#define JB_FSCALAR 0x10000000 /* flag bits */ +#define JB_FOBJECT 0x20000000 +#define JB_FARRAY 0x40000000 + +/* convenience macros for accessing a JsonbContainer struct */ +#define JsonContainerSize(jc) ((jc)->header & JB_CMASK) +#define JsonContainerIsScalar(jc) (((jc)->header & JB_FSCALAR) != 0) +#define JsonContainerIsObject(jc) (((jc)->header & JB_FOBJECT) != 0) +#define JsonContainerIsArray(jc) (((jc)->header & JB_FARRAY) != 0) + +/* The top-level on-disk format for a jsonb datum. */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + JsonbContainer root; +} Jsonb; + +/* convenience macros for accessing the root container in a Jsonb datum */ +#define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK) +#define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0) +#define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0) +#define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0) + + +enum jbvType +{ + /* Scalar types */ + jbvNull = 0x0, + jbvString, + jbvNumeric, + jbvBool, + /* Composite types */ + jbvArray = 0x10, + jbvObject, + /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */ + jbvBinary, + + /* + * Virtual types. + * + * These types are used only for in-memory JSON processing and serialized + * into JSON strings when outputted to json/jsonb. + */ + jbvDatetime = 0x20, +}; + +/* + * JsonbValue: In-memory representation of Jsonb. This is a convenient + * deserialized representation, that can easily support using the "val" + * union across underlying types during manipulation. The Jsonb on-disk + * representation has various alignment considerations. + */ +struct JsonbValue +{ + enum jbvType type; /* Influences sort order */ + + union + { + Numeric numeric; + bool boolean; + struct + { + int len; + char *val; /* Not necessarily null-terminated */ + } string; /* String primitive type */ + + struct + { + int nElems; + JsonbValue *elems; + bool rawScalar; /* Top-level "raw scalar" array? */ + } array; /* Array container type */ + + struct + { + int nPairs; /* 1 pair, 2 elements */ + JsonbPair *pairs; + } object; /* Associative container type */ + + struct + { + int len; + JsonbContainer *data; + } binary; /* Array or object, in on-disk format */ + + struct + { + Datum value; + Oid typid; + int32 typmod; + int tz; /* Numeric time zone, in seconds, for + * TimestampTz data type */ + } datetime; + } val; +}; + +#define IsAJsonbScalar(jsonbval) (((jsonbval)->type >= jbvNull && \ + (jsonbval)->type <= jbvBool) || \ + (jsonbval)->type == jbvDatetime) + +/* + * Key/value pair within an Object. + * + * This struct type is only used briefly while constructing a Jsonb; it is + * *not* the on-disk representation. + * + * Pairs with duplicate keys are de-duplicated. We store the originally + * observed pair ordering for the purpose of removing duplicates in a + * well-defined way (which is "last observed wins"). + */ +struct JsonbPair +{ + JsonbValue key; /* Must be a jbvString */ + JsonbValue value; /* May be of any type */ + uint32 order; /* Pair's index in original sequence */ +}; + +/* Conversion state used when parsing Jsonb from text, or for type coercion */ +typedef struct JsonbParseState +{ + JsonbValue contVal; + Size size; + struct JsonbParseState *next; + bool unique_keys; /* Check object key uniqueness */ + bool skip_nulls; /* Skip null object fields */ +} JsonbParseState; + +/* + * JsonbIterator holds details of the type for each iteration. It also stores a + * Jsonb varlena buffer, which can be directly accessed in some contexts. + */ +typedef enum +{ + JBI_ARRAY_START, + JBI_ARRAY_ELEM, + JBI_OBJECT_START, + JBI_OBJECT_KEY, + JBI_OBJECT_VALUE, +} JsonbIterState; + +typedef struct JsonbIterator +{ + /* Container being iterated */ + JsonbContainer *container; + uint32 nElems; /* Number of elements in children array (will + * be nPairs for objects) */ + bool isScalar; /* Pseudo-array scalar value? */ + JEntry *children; /* JEntrys for child nodes */ + /* Data proper. This points to the beginning of the variable-length data */ + char *dataProper; + + /* Current item in buffer (up to nElems) */ + int curIndex; + + /* Data offset corresponding to current item */ + uint32 curDataOffset; + + /* + * If the container is an object, we want to return keys and values + * alternately; so curDataOffset points to the current key, and + * curValueOffset points to the current value. + */ + uint32 curValueOffset; + + /* Private state */ + JsonbIterState state; + + struct JsonbIterator *parent; +} JsonbIterator; + + +/* Convenience macros */ +static inline Jsonb * +DatumGetJsonbP(Datum d) +{ + return (Jsonb *) PG_DETOAST_DATUM(d); +} + +static inline Jsonb * +DatumGetJsonbPCopy(Datum d) +{ + return (Jsonb *) PG_DETOAST_DATUM_COPY(d); +} + +static inline Datum +JsonbPGetDatum(const Jsonb *p) +{ + return PointerGetDatum(p); +} + +#define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x)) +#define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x)) +#define PG_RETURN_JSONB_P(x) PG_RETURN_POINTER(x) + +/* Support functions */ +extern uint32 getJsonbOffset(const JsonbContainer *jc, int index); +extern uint32 getJsonbLength(const JsonbContainer *jc, int index); +extern int compareJsonbContainers(JsonbContainer *a, JsonbContainer *b); +extern JsonbValue *findJsonbValueFromContainer(JsonbContainer *container, + uint32 flags, + JsonbValue *key); +extern JsonbValue *getKeyJsonValueFromContainer(JsonbContainer *container, + const char *keyVal, int keyLen, + JsonbValue *res); +extern JsonbValue *getIthJsonbValueFromContainer(JsonbContainer *container, + uint32 i); +extern JsonbValue *pushJsonbValue(JsonbParseState **pstate, + JsonbIteratorToken seq, JsonbValue *jbval); +extern JsonbIterator *JsonbIteratorInit(JsonbContainer *container); +extern JsonbIteratorToken JsonbIteratorNext(JsonbIterator **it, JsonbValue *val, + bool skipNested); +extern void JsonbToJsonbValue(Jsonb *jsonb, JsonbValue *val); +extern Jsonb *JsonbValueToJsonb(JsonbValue *val); +extern bool JsonbDeepContains(JsonbIterator **val, + JsonbIterator **mContained); +extern void JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash); +extern void JsonbHashScalarValueExtended(const JsonbValue *scalarVal, + uint64 *hash, uint64 seed); + +/* jsonb.c support functions */ +extern char *JsonbToCString(StringInfo out, JsonbContainer *in, + int estimated_len); +extern char *JsonbToCStringIndent(StringInfo out, JsonbContainer *in, + int estimated_len); +extern char *JsonbUnquote(Jsonb *jb); +extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res); +extern const char *JsonbTypeName(JsonbValue *val); + +extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, + JsonbValue *newval); +extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, + bool *isnull, bool as_text); +extern bool to_jsonb_is_immutable(Oid typoid); +extern Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null, + bool unique_keys); +extern Datum jsonb_build_array_worker(int nargs, const Datum *args, const bool *nulls, + const Oid *types, bool absent_on_null); + +#endif /* __JSONB_H__ */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/jsonfuncs.h b/platform/dbops/binaries/postgres/include/server/utils/jsonfuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..93384d900a098507d13595906a9d1dea838b9e1f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/jsonfuncs.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * + * jsonfuncs.h + * Functions to process JSON data types. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/jsonfuncs.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONFUNCS_H +#define JSONFUNCS_H + +#include "common/jsonapi.h" +#include "nodes/nodes.h" +#include "utils/jsonb.h" + +/* + * Flag types for iterate_json(b)_values to specify what elements from a + * json(b) document we want to iterate. + */ +typedef enum JsonToIndex +{ + jtiKey = 0x01, + jtiString = 0x02, + jtiNumeric = 0x04, + jtiBool = 0x08, + jtiAll = jtiKey | jtiString | jtiNumeric | jtiBool +} JsonToIndex; + +/* an action that will be applied to each value in iterate_json(b)_values functions */ +typedef void (*JsonIterateStringValuesAction) (void *state, char *elem_value, int elem_len); + +/* an action that will be applied to each value in transform_json(b)_values functions */ +typedef text *(*JsonTransformStringValuesAction) (void *state, char *elem_value, int elem_len); + +/* build a JsonLexContext from a text datum; see also freeJsonLexContext */ +extern JsonLexContext *makeJsonLexContext(JsonLexContext *lex, text *json, bool need_escapes); + +/* try to parse json, and errsave(escontext) on failure */ +extern bool pg_parse_json_or_errsave(JsonLexContext *lex, JsonSemAction *sem, + struct Node *escontext); + +#define pg_parse_json_or_ereport(lex, sem) \ + (void) pg_parse_json_or_errsave(lex, sem, NULL) + +/* save an error during json lexing or parsing */ +extern void json_errsave_error(JsonParseErrorType error, JsonLexContext *lex, + struct Node *escontext); + +/* get first JSON token */ +extern JsonTokenType json_get_first_token(text *json, bool throw_error); + +extern uint32 parse_jsonb_index_flags(Jsonb *jb); +extern void iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, + JsonIterateStringValuesAction action); +extern void iterate_json_values(text *json, uint32 flags, void *action_state, + JsonIterateStringValuesAction action); +extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state, + JsonTransformStringValuesAction transform_action); +extern text *transform_json_string_values(text *json, void *action_state, + JsonTransformStringValuesAction transform_action); + +/* Type categories returned by json_categorize_type */ +typedef enum +{ + JSONTYPE_NULL, /* null, so we didn't bother to identify */ + JSONTYPE_BOOL, /* boolean (built-in types only) */ + JSONTYPE_NUMERIC, /* numeric (ditto) */ + JSONTYPE_DATE, /* we use special formatting for datetimes */ + JSONTYPE_TIMESTAMP, + JSONTYPE_TIMESTAMPTZ, + JSONTYPE_JSON, /* JSON (and JSONB, if not is_jsonb) */ + JSONTYPE_JSONB, /* JSONB (if is_jsonb) */ + JSONTYPE_ARRAY, /* array */ + JSONTYPE_COMPOSITE, /* composite */ + JSONTYPE_CAST, /* something with an explicit cast to JSON */ + JSONTYPE_OTHER, /* all else */ +} JsonTypeCategory; + +extern void json_categorize_type(Oid typoid, bool is_jsonb, + JsonTypeCategory *tcategory, Oid *outfuncoid); +extern Datum datum_to_json(Datum val, JsonTypeCategory tcategory, + Oid outfuncoid); +extern Datum datum_to_jsonb(Datum val, JsonTypeCategory tcategory, + Oid outfuncoid); +extern Datum jsonb_from_text(text *js, bool unique_keys); + +extern Datum json_populate_type(Datum json_val, Oid json_type, + Oid typid, int32 typmod, + void **cache, MemoryContext mcxt, + bool *isnull, + bool omit_quotes, + Node *escontext); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/jsonpath.h b/platform/dbops/binaries/postgres/include/server/utils/jsonpath.h new file mode 100644 index 0000000000000000000000000000000000000000..ee35698d083effb8dd2a2e480da35cfc730f40bb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/jsonpath.h @@ -0,0 +1,310 @@ +/*------------------------------------------------------------------------- + * + * jsonpath.h + * Definitions for jsonpath datatype + * + * Copyright (c) 2019-2024, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/include/utils/jsonpath.h + * + *------------------------------------------------------------------------- + */ + +#ifndef JSONPATH_H +#define JSONPATH_H + +#include "executor/tablefunc.h" +#include "fmgr.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "utils/jsonb.h" + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 header; /* version and flags (see below) */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} JsonPath; + +#define JSONPATH_VERSION (0x01) +#define JSONPATH_LAX (0x80000000) +#define JSONPATH_HDRSZ (offsetof(JsonPath, data)) + +static inline JsonPath * +DatumGetJsonPathP(Datum d) +{ + return (JsonPath *) PG_DETOAST_DATUM(d); +} + +static inline JsonPath * +DatumGetJsonPathPCopy(Datum d) +{ + return (JsonPath *) PG_DETOAST_DATUM_COPY(d); +} + +#define PG_GETARG_JSONPATH_P(x) DatumGetJsonPathP(PG_GETARG_DATUM(x)) +#define PG_GETARG_JSONPATH_P_COPY(x) DatumGetJsonPathPCopy(PG_GETARG_DATUM(x)) +#define PG_RETURN_JSONPATH_P(p) PG_RETURN_POINTER(p) + +#define jspIsScalar(type) ((type) >= jpiNull && (type) <= jpiBool) + +/* + * All node's type of jsonpath expression + * + * These become part of the on-disk representation of the jsonpath type. + * Therefore, to preserve pg_upgradability, the order must not be changed, and + * new values must be added at the end. + * + * It is recommended that switch cases etc. in other parts of the code also + * use this order, to maintain some consistency. + */ +typedef enum JsonPathItemType +{ + jpiNull = jbvNull, /* NULL literal */ + jpiString = jbvString, /* string literal */ + jpiNumeric = jbvNumeric, /* numeric literal */ + jpiBool = jbvBool, /* boolean literal: TRUE or FALSE */ + jpiAnd, /* predicate && predicate */ + jpiOr, /* predicate || predicate */ + jpiNot, /* ! predicate */ + jpiIsUnknown, /* (predicate) IS UNKNOWN */ + jpiEqual, /* expr == expr */ + jpiNotEqual, /* expr != expr */ + jpiLess, /* expr < expr */ + jpiGreater, /* expr > expr */ + jpiLessOrEqual, /* expr <= expr */ + jpiGreaterOrEqual, /* expr >= expr */ + jpiAdd, /* expr + expr */ + jpiSub, /* expr - expr */ + jpiMul, /* expr * expr */ + jpiDiv, /* expr / expr */ + jpiMod, /* expr % expr */ + jpiPlus, /* + expr */ + jpiMinus, /* - expr */ + jpiAnyArray, /* [*] */ + jpiAnyKey, /* .* */ + jpiIndexArray, /* [subscript, ...] */ + jpiAny, /* .** */ + jpiKey, /* .key */ + jpiCurrent, /* @ */ + jpiRoot, /* $ */ + jpiVariable, /* $variable */ + jpiFilter, /* ? (predicate) */ + jpiExists, /* EXISTS (expr) predicate */ + jpiType, /* .type() item method */ + jpiSize, /* .size() item method */ + jpiAbs, /* .abs() item method */ + jpiFloor, /* .floor() item method */ + jpiCeiling, /* .ceiling() item method */ + jpiDouble, /* .double() item method */ + jpiDatetime, /* .datetime() item method */ + jpiKeyValue, /* .keyvalue() item method */ + jpiSubscript, /* array subscript: 'expr' or 'expr TO expr' */ + jpiLast, /* LAST array subscript */ + jpiStartsWith, /* STARTS WITH predicate */ + jpiLikeRegex, /* LIKE_REGEX predicate */ + jpiBigint, /* .bigint() item method */ + jpiBoolean, /* .boolean() item method */ + jpiDate, /* .date() item method */ + jpiDecimal, /* .decimal() item method */ + jpiInteger, /* .integer() item method */ + jpiNumber, /* .number() item method */ + jpiStringFunc, /* .string() item method */ + jpiTime, /* .time() item method */ + jpiTimeTz, /* .time_tz() item method */ + jpiTimestamp, /* .timestamp() item method */ + jpiTimestampTz, /* .timestamp_tz() item method */ +} JsonPathItemType; + +/* XQuery regex mode flags for LIKE_REGEX predicate */ +#define JSP_REGEX_ICASE 0x01 /* i flag, case insensitive */ +#define JSP_REGEX_DOTALL 0x02 /* s flag, dot matches newline */ +#define JSP_REGEX_MLINE 0x04 /* m flag, ^/$ match at newlines */ +#define JSP_REGEX_WSPACE 0x08 /* x flag, ignore whitespace in pattern */ +#define JSP_REGEX_QUOTE 0x10 /* q flag, no special characters */ + +/* + * Support functions to parse/construct binary value. + * Unlike many other representation of expression the first/main + * node is not an operation but left operand of expression. That + * allows to implement cheap follow-path descending in jsonb + * structure and then execute operator with right operand + */ + +typedef struct JsonPathItem +{ + JsonPathItemType type; + + /* position form base to next node */ + int32 nextPos; + + /* + * pointer into JsonPath value to current node, all positions of current + * are relative to this base + */ + char *base; + + union + { + /* classic operator with two operands: and, or etc */ + struct + { + int32 left; + int32 right; + } args; + + /* any unary operation */ + int32 arg; + + /* storage for jpiIndexArray: indexes of array */ + struct + { + int32 nelems; + struct + { + int32 from; + int32 to; + } *elems; + } array; + + /* jpiAny: levels */ + struct + { + uint32 first; + uint32 last; + } anybounds; + + struct + { + char *data; /* for bool, numeric and string/key */ + int32 datalen; /* filled only for string/key */ + } value; + + struct + { + int32 expr; + char *pattern; + int32 patternlen; + uint32 flags; + } like_regex; + } content; +} JsonPathItem; + +#define jspHasNext(jsp) ((jsp)->nextPos > 0) + +extern void jspInit(JsonPathItem *v, JsonPath *js); +extern void jspInitByBuffer(JsonPathItem *v, char *base, int32 pos); +extern bool jspGetNext(JsonPathItem *v, JsonPathItem *a); +extern void jspGetArg(JsonPathItem *v, JsonPathItem *a); +extern void jspGetLeftArg(JsonPathItem *v, JsonPathItem *a); +extern void jspGetRightArg(JsonPathItem *v, JsonPathItem *a); +extern Numeric jspGetNumeric(JsonPathItem *v); +extern bool jspGetBool(JsonPathItem *v); +extern char *jspGetString(JsonPathItem *v, int32 *len); +extern bool jspGetArraySubscript(JsonPathItem *v, JsonPathItem *from, + JsonPathItem *to, int i); +extern bool jspIsMutable(JsonPath *path, List *varnames, List *varexprs); + +extern const char *jspOperationName(JsonPathItemType type); + +/* + * Parsing support data structures. + */ + +typedef struct JsonPathParseItem JsonPathParseItem; + +struct JsonPathParseItem +{ + JsonPathItemType type; + JsonPathParseItem *next; /* next in path */ + + union + { + + /* classic operator with two operands: and, or etc */ + struct + { + JsonPathParseItem *left; + JsonPathParseItem *right; + } args; + + /* any unary operation */ + JsonPathParseItem *arg; + + /* storage for jpiIndexArray: indexes of array */ + struct + { + int nelems; + struct + { + JsonPathParseItem *from; + JsonPathParseItem *to; + } *elems; + } array; + + /* jpiAny: levels */ + struct + { + uint32 first; + uint32 last; + } anybounds; + + struct + { + JsonPathParseItem *expr; + char *pattern; /* could not be not null-terminated */ + uint32 patternlen; + uint32 flags; + } like_regex; + + /* scalars */ + Numeric numeric; + bool boolean; + struct + { + uint32 len; + char *val; /* could not be not null-terminated */ + } string; + } value; +}; + +typedef struct JsonPathParseResult +{ + JsonPathParseItem *expr; + bool lax; +} JsonPathParseResult; + +extern JsonPathParseResult *parsejsonpath(const char *str, int len, + struct Node *escontext); + +extern bool jspConvertRegexFlags(uint32 xflags, int *result, + struct Node *escontext); + +/* + * Struct for details about external variables passed into jsonpath executor + */ +typedef struct JsonPathVariable +{ + char *name; + int namelen; /* strlen(name) as cache for GetJsonPathVar() */ + Oid typid; + int32 typmod; + Datum value; + bool isnull; +} JsonPathVariable; + + +/* SQL/JSON query functions */ +extern bool JsonPathExists(Datum jb, JsonPath *jp, bool *error, List *vars); +extern Datum JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, + bool *empty, bool *error, List *vars, + const char *column_name); +extern JsonbValue *JsonPathValue(Datum jb, JsonPath *jp, bool *empty, + bool *error, List *vars, + const char *column_name); + +/* For JSON_TABLE() */ +extern PGDLLIMPORT const TableFuncRoutine JsonbTableRoutine; + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/logtape.h b/platform/dbops/binaries/postgres/include/server/utils/logtape.h new file mode 100644 index 0000000000000000000000000000000000000000..d310b974f92dfe05bdead6f3a0c7c558519811f6 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/logtape.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * + * logtape.h + * Management of "logical tapes" within temporary files. + * + * See logtape.c for explanations. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/logtape.h + * + *------------------------------------------------------------------------- + */ + +#ifndef LOGTAPE_H +#define LOGTAPE_H + +#include "storage/sharedfileset.h" + +/* + * LogicalTapeSet and LogicalTape are opaque types whose details are not + * known outside logtape.c. + */ +typedef struct LogicalTapeSet LogicalTapeSet; +typedef struct LogicalTape LogicalTape; + + +/* + * The approach tuplesort.c takes to parallel external sorts is that workers, + * whose state is almost the same as independent serial sorts, are made to + * produce a final materialized tape of sorted output in all cases. This is + * frozen, just like any case requiring a final materialized tape. However, + * there is one difference, which is that freezing will also export an + * underlying shared fileset BufFile for sharing. Freezing produces TapeShare + * metadata for the worker when this happens, which is passed along through + * shared memory to leader. + * + * The leader process can then pass an array of TapeShare metadata (one per + * worker participant) to LogicalTapeSetCreate(), alongside a handle to a + * shared fileset, which is sufficient to construct a new logical tapeset that + * consists of each of the tapes materialized by workers. + * + * Note that while logtape.c does create an empty leader tape at the end of the + * tapeset in the leader case, it can never be written to due to a restriction + * in the shared buffile infrastructure. + */ +typedef struct TapeShare +{ + /* + * Currently, all the leader process needs is the location of the + * materialized tape's first block. + */ + int64 firstblocknumber; +} TapeShare; + +/* + * prototypes for functions in logtape.c + */ + +extern LogicalTapeSet *LogicalTapeSetCreate(bool preallocate, + SharedFileSet *fileset, int worker); +extern void LogicalTapeClose(LogicalTape *lt); +extern void LogicalTapeSetClose(LogicalTapeSet *lts); +extern LogicalTape *LogicalTapeCreate(LogicalTapeSet *lts); +extern LogicalTape *LogicalTapeImport(LogicalTapeSet *lts, int worker, TapeShare *shared); +extern void LogicalTapeSetForgetFreeSpace(LogicalTapeSet *lts); +extern size_t LogicalTapeRead(LogicalTape *lt, void *ptr, size_t size); +extern void LogicalTapeWrite(LogicalTape *lt, const void *ptr, size_t size); +extern void LogicalTapeRewindForRead(LogicalTape *lt, size_t buffer_size); +extern void LogicalTapeFreeze(LogicalTape *lt, TapeShare *share); +extern size_t LogicalTapeBackspace(LogicalTape *lt, size_t size); +extern void LogicalTapeSeek(LogicalTape *lt, int64 blocknum, int offset); +extern void LogicalTapeTell(LogicalTape *lt, int64 *blocknum, int *offset); +extern int64 LogicalTapeSetBlocks(LogicalTapeSet *lts); + +#endif /* LOGTAPE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/lsyscache.h b/platform/dbops/binaries/postgres/include/server/utils/lsyscache.h new file mode 100644 index 0000000000000000000000000000000000000000..20446f6f8368d58e836e41b46a118b4b534b3ae8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/lsyscache.h @@ -0,0 +1,215 @@ +/*------------------------------------------------------------------------- + * + * lsyscache.h + * Convenience routines for common queries in the system catalog cache. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/lsyscache.h + * + *------------------------------------------------------------------------- + */ +#ifndef LSYSCACHE_H +#define LSYSCACHE_H + +#include "access/attnum.h" +#include "access/htup.h" +#include "nodes/pg_list.h" + +/* avoid including subscripting.h here */ +struct SubscriptRoutines; + +/* Result list element for get_op_btree_interpretation */ +typedef struct OpBtreeInterpretation +{ + Oid opfamily_id; /* btree opfamily containing operator */ + int strategy; /* its strategy number */ + Oid oplefttype; /* declared left input datatype */ + Oid oprighttype; /* declared right input datatype */ +} OpBtreeInterpretation; + +/* I/O function selector for get_type_io_data */ +typedef enum IOFuncSelector +{ + IOFunc_input, + IOFunc_output, + IOFunc_receive, + IOFunc_send, +} IOFuncSelector; + +/* Flag bits for get_attstatsslot */ +#define ATTSTATSSLOT_VALUES 0x01 +#define ATTSTATSSLOT_NUMBERS 0x02 + +/* Result struct for get_attstatsslot */ +typedef struct AttStatsSlot +{ + /* Always filled: */ + Oid staop; /* Actual staop for the found slot */ + Oid stacoll; /* Actual collation for the found slot */ + /* Filled if ATTSTATSSLOT_VALUES is specified: */ + Oid valuetype; /* Actual datatype of the values */ + Datum *values; /* slot's "values" array, or NULL if none */ + int nvalues; /* length of values[], or 0 */ + /* Filled if ATTSTATSSLOT_NUMBERS is specified: */ + float4 *numbers; /* slot's "numbers" array, or NULL if none */ + int nnumbers; /* length of numbers[], or 0 */ + + /* Remaining fields are private to get_attstatsslot/free_attstatsslot */ + void *values_arr; /* palloc'd values array, if any */ + void *numbers_arr; /* palloc'd numbers array, if any */ +} AttStatsSlot; + +/* Hook for plugins to get control in get_attavgwidth() */ +typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum); +extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook; + +extern bool op_in_opfamily(Oid opno, Oid opfamily); +extern int get_op_opfamily_strategy(Oid opno, Oid opfamily); +extern Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily); +extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op, + int *strategy, + Oid *lefttype, + Oid *righttype); +extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, + int16 strategy); +extern bool get_ordering_op_properties(Oid opno, + Oid *opfamily, Oid *opcintype, int16 *strategy); +extern Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse); +extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type); +extern List *get_mergejoin_opfamilies(Oid opno); +extern bool get_compatible_hash_operators(Oid opno, + Oid *lhs_opno, Oid *rhs_opno); +extern bool get_op_hash_functions(Oid opno, + RegProcedure *lhs_procno, RegProcedure *rhs_procno); +extern List *get_op_btree_interpretation(Oid opno); +extern bool equality_ops_are_compatible(Oid opno1, Oid opno2); +extern bool comparison_ops_are_compatible(Oid opno1, Oid opno2); +extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, + int16 procnum); +extern char *get_attname(Oid relid, AttrNumber attnum, bool missing_ok); +extern AttrNumber get_attnum(Oid relid, const char *attname); +extern char get_attgenerated(Oid relid, AttrNumber attnum); +extern Oid get_atttype(Oid relid, AttrNumber attnum); +extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, + Oid *typid, int32 *typmod, Oid *collid); +extern Datum get_attoptions(Oid relid, int16 attnum); +extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); +extern char *get_collation_name(Oid colloid); +extern bool get_collation_isdeterministic(Oid colloid); +extern char *get_constraint_name(Oid conoid); +extern Oid get_constraint_index(Oid conoid); +extern char get_constraint_type(Oid conoid); + +extern char *get_language_name(Oid langoid, bool missing_ok); +extern Oid get_opclass_family(Oid opclass); +extern Oid get_opclass_input_type(Oid opclass); +extern bool get_opclass_opfamily_and_input_type(Oid opclass, + Oid *opfamily, Oid *opcintype); +extern Oid get_opclass_method(Oid opclass); +extern RegProcedure get_opcode(Oid opno); +extern char *get_opname(Oid opno); +extern Oid get_op_rettype(Oid opno); +extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype); +extern bool op_mergejoinable(Oid opno, Oid inputtype); +extern bool op_hashjoinable(Oid opno, Oid inputtype); +extern bool op_strict(Oid opno); +extern char op_volatile(Oid opno); +extern Oid get_commutator(Oid opno); +extern Oid get_negator(Oid opno); +extern RegProcedure get_oprrest(Oid opno); +extern RegProcedure get_oprjoin(Oid opno); +extern char *get_func_name(Oid funcid); +extern Oid get_func_namespace(Oid funcid); +extern Oid get_func_rettype(Oid funcid); +extern int get_func_nargs(Oid funcid); +extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs); +extern Oid get_func_variadictype(Oid funcid); +extern bool get_func_retset(Oid funcid); +extern bool func_strict(Oid funcid); +extern char func_volatile(Oid funcid); +extern char func_parallel(Oid funcid); +extern char get_func_prokind(Oid funcid); +extern bool get_func_leakproof(Oid funcid); +extern RegProcedure get_func_support(Oid funcid); +extern Oid get_relname_relid(const char *relname, Oid relnamespace); +extern char *get_rel_name(Oid relid); +extern Oid get_rel_namespace(Oid relid); +extern Oid get_rel_type_id(Oid relid); +extern char get_rel_relkind(Oid relid); +extern bool get_rel_relispartition(Oid relid); +extern Oid get_rel_tablespace(Oid relid); +extern char get_rel_persistence(Oid relid); +extern Oid get_rel_relam(Oid relid); +extern Oid get_transform_fromsql(Oid typid, Oid langid, List *trftypes); +extern Oid get_transform_tosql(Oid typid, Oid langid, List *trftypes); +extern bool get_typisdefined(Oid typid); +extern int16 get_typlen(Oid typid); +extern bool get_typbyval(Oid typid); +extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval); +extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, + char *typalign); +extern Oid getTypeIOParam(HeapTuple typeTuple); +extern void get_type_io_data(Oid typid, + IOFuncSelector which_func, + int16 *typlen, + bool *typbyval, + char *typalign, + char *typdelim, + Oid *typioparam, + Oid *func); +extern char get_typstorage(Oid typid); +extern Node *get_typdefault(Oid typid); +extern char get_typtype(Oid typid); +extern bool type_is_rowtype(Oid typid); +extern bool type_is_enum(Oid typid); +extern bool type_is_range(Oid typid); +extern bool type_is_multirange(Oid typid); +extern void get_type_category_preferred(Oid typid, + char *typcategory, + bool *typispreferred); +extern Oid get_typ_typrelid(Oid typid); +extern Oid get_element_type(Oid typid); +extern Oid get_array_type(Oid typid); +extern Oid get_promoted_array_type(Oid typid); +extern Oid get_base_element_type(Oid typid); +extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam); +extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena); +extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam); +extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena); +extern Oid get_typmodin(Oid typid); +extern Oid get_typcollation(Oid typid); +extern bool type_is_collatable(Oid typid); +extern RegProcedure get_typsubscript(Oid typid, Oid *typelemp); +extern const struct SubscriptRoutines *getSubscriptingRoutines(Oid typid, + Oid *typelemp); +extern Oid getBaseType(Oid typid); +extern Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod); +extern int32 get_typavgwidth(Oid typid, int32 typmod); +extern int32 get_attavgwidth(Oid relid, AttrNumber attnum); +extern bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple, + int reqkind, Oid reqop, int flags); +extern void free_attstatsslot(AttStatsSlot *sslot); +extern char *get_namespace_name(Oid nspid); +extern char *get_namespace_name_or_temp(Oid nspid); +extern Oid get_range_subtype(Oid rangeOid); +extern Oid get_range_collation(Oid rangeOid); +extern Oid get_range_multirange(Oid rangeOid); +extern Oid get_multirange_range(Oid multirangeOid); +extern Oid get_index_column_opclass(Oid index_oid, int attno); +extern bool get_index_isreplident(Oid index_oid); +extern bool get_index_isvalid(Oid index_oid); +extern bool get_index_isclustered(Oid index_oid); +extern Oid get_publication_oid(const char *pubname, bool missing_ok); +extern char *get_publication_name(Oid pubid, bool missing_ok); +extern Oid get_subscription_oid(const char *subname, bool missing_ok); +extern char *get_subscription_name(Oid subid, bool missing_ok); + +#define type_is_array(typid) (get_element_type(typid) != InvalidOid) +/* type_is_array_domain accepts both plain arrays and domains over arrays */ +#define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid) + +#define TypeIsToastable(typid) (get_typstorage(typid) != TYPSTORAGE_PLAIN) + +#endif /* LSYSCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/memdebug.h b/platform/dbops/binaries/postgres/include/server/utils/memdebug.h new file mode 100644 index 0000000000000000000000000000000000000000..f62b10cbbd16197826a6b21bb0200266ff88bd11 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/memdebug.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------------------- + * + * memdebug.h + * Memory debugging support. + * + * Currently, this file either wraps or substitutes + * empty definitions for Valgrind client request macros we use. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memdebug.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMDEBUG_H +#define MEMDEBUG_H + +#ifdef USE_VALGRIND +#include +#else +#define VALGRIND_CHECK_MEM_IS_DEFINED(addr, size) do {} while (0) +#define VALGRIND_CREATE_MEMPOOL(context, redzones, zeroed) do {} while (0) +#define VALGRIND_DESTROY_MEMPOOL(context) do {} while (0) +#define VALGRIND_MAKE_MEM_DEFINED(addr, size) do {} while (0) +#define VALGRIND_MAKE_MEM_NOACCESS(addr, size) do {} while (0) +#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) do {} while (0) +#define VALGRIND_MEMPOOL_ALLOC(context, addr, size) do {} while (0) +#define VALGRIND_MEMPOOL_FREE(context, addr) do {} while (0) +#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size) do {} while (0) +#endif + + +#ifdef CLOBBER_FREED_MEMORY + +/* Wipe freed memory for debugging purposes */ +static inline void +wipe_mem(void *ptr, size_t size) +{ + VALGRIND_MAKE_MEM_UNDEFINED(ptr, size); + memset(ptr, 0x7F, size); + VALGRIND_MAKE_MEM_NOACCESS(ptr, size); +} + +#endif /* CLOBBER_FREED_MEMORY */ + +#ifdef MEMORY_CONTEXT_CHECKING + +static inline void +set_sentinel(void *base, Size offset) +{ + char *ptr = (char *) base + offset; + + VALGRIND_MAKE_MEM_UNDEFINED(ptr, 1); + *ptr = 0x7E; + VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); +} + +static inline bool +sentinel_ok(const void *base, Size offset) +{ + const char *ptr = (const char *) base + offset; + bool ret; + + VALGRIND_MAKE_MEM_DEFINED(ptr, 1); + ret = *ptr == 0x7E; + VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); + + return ret; +} + +#endif /* MEMORY_CONTEXT_CHECKING */ + +#ifdef RANDOMIZE_ALLOCATED_MEMORY + +void randomize_mem(char *ptr, size_t size); + +#endif /* RANDOMIZE_ALLOCATED_MEMORY */ + + +#endif /* MEMDEBUG_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/memutils.h b/platform/dbops/binaries/postgres/include/server/utils/memutils.h new file mode 100644 index 0000000000000000000000000000000000000000..cd9596ff21930dce7c4eab7ede5ff77f0f78472e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/memutils.h @@ -0,0 +1,192 @@ +/*------------------------------------------------------------------------- + * + * memutils.h + * This file contains declarations for memory allocation utility + * functions. These are functions that are not quite widely used + * enough to justify going in utils/palloc.h, but are still part + * of the API of the memory management subsystem. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef MEMUTILS_H +#define MEMUTILS_H + +#include "nodes/memnodes.h" + + +/* + * MaxAllocSize, MaxAllocHugeSize + * Quasi-arbitrary limits on size of allocations. + * + * Note: + * There is no guarantee that smaller allocations will succeed, but + * larger requests will be summarily denied. + * + * palloc() enforces MaxAllocSize, chosen to correspond to the limiting size + * of varlena objects under TOAST. See VARSIZE_4B() and related macros in + * postgres.h. Many datatypes assume that any allocatable size can be + * represented in a varlena header. This limit also permits a caller to use + * an "int" variable for an index into or length of an allocation. Callers + * careful to avoid these hazards can access the higher limit with + * MemoryContextAllocHuge(). Both limits permit code to assume that it may + * compute twice an allocation's size without overflow. + */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ + +#define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) + +/* Must be less than SIZE_MAX */ +#define MaxAllocHugeSize (SIZE_MAX / 2) + +#define InvalidAllocSize SIZE_MAX + +#define AllocHugeSizeIsValid(size) ((Size) (size) <= MaxAllocHugeSize) + + +/* + * Standard top-level memory contexts. + * + * Only TopMemoryContext and ErrorContext are initialized by + * MemoryContextInit() itself. + */ +extern PGDLLIMPORT MemoryContext TopMemoryContext; +extern PGDLLIMPORT MemoryContext ErrorContext; +extern PGDLLIMPORT MemoryContext PostmasterContext; +extern PGDLLIMPORT MemoryContext CacheMemoryContext; +extern PGDLLIMPORT MemoryContext MessageContext; +extern PGDLLIMPORT MemoryContext TopTransactionContext; +extern PGDLLIMPORT MemoryContext CurTransactionContext; + +/* This is a transient link to the active portal's memory context: */ +extern PGDLLIMPORT MemoryContext PortalContext; + + +/* + * Memory-context-type-independent functions in mcxt.c + */ +extern void MemoryContextInit(void); +extern void MemoryContextReset(MemoryContext context); +extern void MemoryContextDelete(MemoryContext context); +extern void MemoryContextResetOnly(MemoryContext context); +extern void MemoryContextResetChildren(MemoryContext context); +extern void MemoryContextDeleteChildren(MemoryContext context); +extern void MemoryContextSetIdentifier(MemoryContext context, const char *id); +extern void MemoryContextSetParent(MemoryContext context, + MemoryContext new_parent); +extern MemoryContext GetMemoryChunkContext(void *pointer); +extern Size GetMemoryChunkSpace(void *pointer); +extern MemoryContext MemoryContextGetParent(MemoryContext context); +extern bool MemoryContextIsEmpty(MemoryContext context); +extern Size MemoryContextMemAllocated(MemoryContext context, bool recurse); +extern void MemoryContextMemConsumed(MemoryContext context, + MemoryContextCounters *consumed); +extern void MemoryContextStats(MemoryContext context); +extern void MemoryContextStatsDetail(MemoryContext context, + int max_level, int max_children, + bool print_to_stderr); +extern void MemoryContextAllowInCriticalSection(MemoryContext context, + bool allow); + +#ifdef MEMORY_CONTEXT_CHECKING +extern void MemoryContextCheck(MemoryContext context); +#endif + +/* Handy macro for copying and assigning context ID ... but note double eval */ +#define MemoryContextCopyAndSetIdentifier(cxt, id) \ + MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id)) + +extern void HandleLogMemoryContextInterrupt(void); +extern void ProcessLogMemoryContextInterrupt(void); + +/* + * Memory-context-type-specific functions + */ + +/* aset.c */ +extern MemoryContext AllocSetContextCreateInternal(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* + * This wrapper macro exists to check for non-constant strings used as context + * names; that's no longer supported. (Use MemoryContextSetIdentifier if you + * want to provide a variable identifier.) + */ +#ifdef HAVE__BUILTIN_CONSTANT_P +#define AllocSetContextCreate(parent, name, ...) \ + (StaticAssertExpr(__builtin_constant_p(name), \ + "memory context names must be constant strings"), \ + AllocSetContextCreateInternal(parent, name, __VA_ARGS__)) +#else +#define AllocSetContextCreate \ + AllocSetContextCreateInternal +#endif + +/* slab.c */ +extern MemoryContext SlabContextCreate(MemoryContext parent, + const char *name, + Size blockSize, + Size chunkSize); + +/* generation.c */ +extern MemoryContext GenerationContextCreate(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* bump.c */ +extern MemoryContext BumpContextCreate(MemoryContext parent, + const char *name, + Size minContextSize, + Size initBlockSize, + Size maxBlockSize); + +/* + * Recommended default alloc parameters, suitable for "ordinary" contexts + * that might hold quite a lot of data. + */ +#define ALLOCSET_DEFAULT_MINSIZE 0 +#define ALLOCSET_DEFAULT_INITSIZE (8 * 1024) +#define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024) +#define ALLOCSET_DEFAULT_SIZES \ + ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE + +/* + * Recommended alloc parameters for "small" contexts that are never expected + * to contain much data (for example, a context to contain a query plan). + */ +#define ALLOCSET_SMALL_MINSIZE 0 +#define ALLOCSET_SMALL_INITSIZE (1 * 1024) +#define ALLOCSET_SMALL_MAXSIZE (8 * 1024) +#define ALLOCSET_SMALL_SIZES \ + ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE + +/* + * Recommended alloc parameters for contexts that should start out small, + * but might sometimes grow big. + */ +#define ALLOCSET_START_SMALL_SIZES \ + ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE + + +/* + * Threshold above which a request in an AllocSet context is certain to be + * allocated separately (and thereby have constant allocation overhead). + * Few callers should be interested in this, but tuplesort/tuplestore need + * to know it. + */ +#define ALLOCSET_SEPARATE_THRESHOLD 8192 + +#define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024) +#define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024) + +#endif /* MEMUTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/memutils_internal.h b/platform/dbops/binaries/postgres/include/server/utils/memutils_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..5ce2d9b5877a521e25f8386b7932e51e7cefc024 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/memutils_internal.h @@ -0,0 +1,176 @@ +/*------------------------------------------------------------------------- + * + * memutils_internal.h + * This file contains declarations for memory allocation utility + * functions for internal use. + * + * + * Portions Copyright (c) 2022-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils_internal.h + * + *------------------------------------------------------------------------- + */ + +#ifndef MEMUTILS_INTERNAL_H +#define MEMUTILS_INTERNAL_H + +#include "utils/memutils.h" + +/* These functions implement the MemoryContext API for AllocSet context. */ +extern void *AllocSetAlloc(MemoryContext context, Size size, int flags); +extern void AllocSetFree(void *pointer); +extern void *AllocSetRealloc(void *pointer, Size size, int flags); +extern void AllocSetReset(MemoryContext context); +extern void AllocSetDelete(MemoryContext context); +extern MemoryContext AllocSetGetChunkContext(void *pointer); +extern Size AllocSetGetChunkSpace(void *pointer); +extern bool AllocSetIsEmpty(MemoryContext context); +extern void AllocSetStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void AllocSetCheck(MemoryContext context); +#endif + +/* These functions implement the MemoryContext API for Generation context. */ +extern void *GenerationAlloc(MemoryContext context, Size size, int flags); +extern void GenerationFree(void *pointer); +extern void *GenerationRealloc(void *pointer, Size size, int flags); +extern void GenerationReset(MemoryContext context); +extern void GenerationDelete(MemoryContext context); +extern MemoryContext GenerationGetChunkContext(void *pointer); +extern Size GenerationGetChunkSpace(void *pointer); +extern bool GenerationIsEmpty(MemoryContext context); +extern void GenerationStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void GenerationCheck(MemoryContext context); +#endif + + +/* These functions implement the MemoryContext API for Slab context. */ +extern void *SlabAlloc(MemoryContext context, Size size, int flags); +extern void SlabFree(void *pointer); +extern void *SlabRealloc(void *pointer, Size size, int flags); +extern void SlabReset(MemoryContext context); +extern void SlabDelete(MemoryContext context); +extern MemoryContext SlabGetChunkContext(void *pointer); +extern Size SlabGetChunkSpace(void *pointer); +extern bool SlabIsEmpty(MemoryContext context); +extern void SlabStats(MemoryContext context, + MemoryStatsPrintFunc printfunc, void *passthru, + MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void SlabCheck(MemoryContext context); +#endif + +/* + * These functions support the implementation of palloc_aligned() and are not + * part of a fully-fledged MemoryContext type. + */ +extern void AlignedAllocFree(void *pointer); +extern void *AlignedAllocRealloc(void *pointer, Size size, int flags); +extern MemoryContext AlignedAllocGetChunkContext(void *pointer); +extern Size AlignedAllocGetChunkSpace(void *pointer); + + /* These functions implement the MemoryContext API for the Bump context. */ +extern void *BumpAlloc(MemoryContext context, Size size, int flags); +extern void BumpFree(void *pointer); +extern void *BumpRealloc(void *pointer, Size size, int flags); +extern void BumpReset(MemoryContext context); +extern void BumpDelete(MemoryContext context); +extern MemoryContext BumpGetChunkContext(void *pointer); +extern Size BumpGetChunkSpace(void *pointer); +extern bool BumpIsEmpty(MemoryContext context); +extern void BumpStats(MemoryContext context, MemoryStatsPrintFunc printfunc, + void *passthru, MemoryContextCounters *totals, + bool print_to_stderr); +#ifdef MEMORY_CONTEXT_CHECKING +extern void BumpCheck(MemoryContext context); +#endif + +/* + * How many extra bytes do we need to request in order to ensure that we can + * align a pointer to 'alignto'. Since palloc'd pointers are already aligned + * to MAXIMUM_ALIGNOF we can subtract that amount. We also need to make sure + * there is enough space for the redirection MemoryChunk. + */ +#define PallocAlignedExtraBytes(alignto) \ + ((alignto) + (sizeof(MemoryChunk) - MAXIMUM_ALIGNOF)) + +/* + * MemoryContextMethodID + * A unique identifier for each MemoryContext implementation which + * indicates the index into the mcxt_methods[] array. See mcxt.c. + * + * For robust error detection, ensure that MemoryContextMethodID has a value + * for each possible bit-pattern of MEMORY_CONTEXT_METHODID_MASK, and make + * dummy entries for unused IDs in the mcxt_methods[] array. We also try + * to avoid using bit-patterns as valid IDs if they are likely to occur in + * garbage data, or if they could falsely match on chunks that are really from + * malloc not palloc. (We can't tell that for most malloc implementations, + * but it happens that glibc stores flag bits in the same place where we put + * the MemoryContextMethodID, so the possible values are predictable for it.) + */ +typedef enum MemoryContextMethodID +{ + MCTX_0_RESERVED_UNUSEDMEM_ID, /* 0000 occurs in never-used memory */ + MCTX_1_RESERVED_GLIBC_ID, /* glibc malloc'd chunks usually match 0001 */ + MCTX_2_RESERVED_GLIBC_ID, /* glibc malloc'd chunks > 128kB match 0010 */ + MCTX_ASET_ID, + MCTX_GENERATION_ID, + MCTX_SLAB_ID, + MCTX_ALIGNED_REDIRECT_ID, + MCTX_BUMP_ID, + MCTX_8_UNUSED_ID, + MCTX_9_UNUSED_ID, + MCTX_10_UNUSED_ID, + MCTX_11_UNUSED_ID, + MCTX_12_UNUSED_ID, + MCTX_13_UNUSED_ID, + MCTX_14_UNUSED_ID, + MCTX_15_RESERVED_WIPEDMEM_ID /* 1111 occurs in wipe_mem'd memory */ +} MemoryContextMethodID; + +/* + * The number of bits that 8-byte memory chunk headers can use to encode the + * MemoryContextMethodID. + */ +#define MEMORY_CONTEXT_METHODID_BITS 4 +#define MEMORY_CONTEXT_METHODID_MASK \ + ((((uint64) 1) << MEMORY_CONTEXT_METHODID_BITS) - 1) + +/* + * This routine handles the context-type-independent part of memory + * context creation. It's intended to be called from context-type- + * specific creation routines, and noplace else. + */ +extern void MemoryContextCreate(MemoryContext node, + NodeTag tag, + MemoryContextMethodID method_id, + MemoryContext parent, + const char *name); + +extern void *MemoryContextAllocationFailure(MemoryContext context, Size size, + int flags); + +extern void MemoryContextSizeFailure(MemoryContext context, Size size, + int flags) pg_attribute_noreturn(); + +static inline void +MemoryContextCheckSize(MemoryContext context, Size size, int flags) +{ + if (unlikely(!AllocSizeIsValid(size))) + { + if (!(flags & MCXT_ALLOC_HUGE) || !AllocHugeSizeIsValid(size)) + MemoryContextSizeFailure(context, size, flags); + } +} + +#endif /* MEMUTILS_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/memutils_memorychunk.h b/platform/dbops/binaries/postgres/include/server/utils/memutils_memorychunk.h new file mode 100644 index 0000000000000000000000000000000000000000..56c49d604c395c788471d5e6b6a487edec1f2927 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/memutils_memorychunk.h @@ -0,0 +1,253 @@ +/*------------------------------------------------------------------------- + * + * memutils_memorychunk.h + * Here we define a struct named MemoryChunk which implementations of + * MemoryContexts may use as a header for chunks of memory they allocate. + * + * MemoryChunk provides a lightweight header that a MemoryContext can use to + * store a reference back to the block which the given chunk is allocated on + * and also an additional 30-bits to store another value such as the size of + * the allocated chunk. + * + * Although MemoryChunks are used by each of our MemoryContexts, future + * implementations may choose to implement their own method for storing chunk + * headers. The only requirement is that the header ends with an 8-byte value + * which the least significant 4-bits of are set to the MemoryContextMethodID + * of the given context. + * + * By default, a MemoryChunk is 8 bytes in size, however, when + * MEMORY_CONTEXT_CHECKING is defined the header becomes 16 bytes in size due + * to the additional requested_size field. The MemoryContext may use this + * field for whatever they wish, but it is intended to be used for additional + * checks which are only done in MEMORY_CONTEXT_CHECKING builds. + * + * The MemoryChunk contains a uint64 field named 'hdrmask'. This field is + * used to encode 4 separate pieces of information. Starting with the least + * significant bits of 'hdrmask', the bit space is reserved as follows: + * + * 1. 4-bits to indicate the MemoryContextMethodID as defined by + * MEMORY_CONTEXT_METHODID_MASK + * 2. 1-bit to denote an "external" chunk (see below) + * 3. 30-bits reserved for the MemoryContext to use for anything it + * requires. Most MemoryContexts likely want to store the size of the + * chunk here. + * 4. 30-bits for the number of bytes that must be subtracted from the chunk + * to obtain the address of the block that the chunk is stored on. + * + * If you're paying close attention, you'll notice this adds up to 65 bits + * rather than 64 bits. This is because the highest-order bit of #3 is the + * same bit as the lowest-order bit of #4. We can do this as we insist that + * the chunk and block pointers are both MAXALIGNed, therefore the relative + * offset between those will always be a MAXALIGNed value which means the + * lowest order bit is always 0. When fetching the chunk to block offset we + * mask out the lowest-order bit to ensure it's still zero. + * + * In some cases, for example when memory allocations become large, it's + * possible fields 3 and 4 above are not large enough to store the values + * required for the chunk. In this case, the MemoryContext can choose to mark + * the chunk as "external" by calling the MemoryChunkSetHdrMaskExternal() + * function. When this is done, fields 3 and 4 are unavailable for use by the + * MemoryContext and it's up to the MemoryContext itself to devise its own + * method for getting the reference to the block. + * + * Interface: + * + * MemoryChunkSetHdrMask: + * Used to set up a non-external MemoryChunk. + * + * MemoryChunkSetHdrMaskExternal: + * Used to set up an externally managed MemoryChunk. + * + * MemoryChunkIsExternal: + * Determine if the given MemoryChunk is externally managed, i.e. + * MemoryChunkSetHdrMaskExternal() was called on the chunk. + * + * MemoryChunkGetValue: + * For non-external chunks, return the stored 30-bit value as it was set + * in the call to MemoryChunkSetHdrMask(). + * + * MemoryChunkGetBlock: + * For non-external chunks, return a pointer to the block as it was set + * in the call to MemoryChunkSetHdrMask(). + * + * Also exports: + * MEMORYCHUNK_MAX_VALUE + * MEMORYCHUNK_MAX_BLOCKOFFSET + * PointerGetMemoryChunk + * MemoryChunkGetPointer + * + * Portions Copyright (c) 2022-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/memutils_memorychunk.h + * + *------------------------------------------------------------------------- + */ + +#ifndef MEMUTILS_MEMORYCHUNK_H +#define MEMUTILS_MEMORYCHUNK_H + +#include "utils/memutils_internal.h" + + /* + * The maximum allowed value that MemoryContexts can store in the value + * field. Must be 1 less than a power of 2. + */ +#define MEMORYCHUNK_MAX_VALUE UINT64CONST(0x3FFFFFFF) + +/* + * The maximum distance in bytes that a MemoryChunk can be offset from the + * block that is storing the chunk. Must be 1 less than a power of 2. + */ +#define MEMORYCHUNK_MAX_BLOCKOFFSET UINT64CONST(0x3FFFFFFF) + +/* + * As above, but mask out the lowest-order (always zero) bit as this is shared + * with the MemoryChunkGetValue field. + */ +#define MEMORYCHUNK_BLOCKOFFSET_MASK UINT64CONST(0x3FFFFFFE) + +/* define the least significant base-0 bit of each portion of the hdrmask */ +#define MEMORYCHUNK_EXTERNAL_BASEBIT MEMORY_CONTEXT_METHODID_BITS +#define MEMORYCHUNK_VALUE_BASEBIT (MEMORYCHUNK_EXTERNAL_BASEBIT + 1) +#define MEMORYCHUNK_BLOCKOFFSET_BASEBIT (MEMORYCHUNK_VALUE_BASEBIT + 29) + +/* + * A magic number for storing in the free bits of an external chunk. This + * must mask out the bits used for storing the MemoryContextMethodID and the + * external bit. + */ +#define MEMORYCHUNK_MAGIC (UINT64CONST(0xB1A8DB858EB6EFBA) >> \ + MEMORYCHUNK_VALUE_BASEBIT << \ + MEMORYCHUNK_VALUE_BASEBIT) + +typedef struct MemoryChunk +{ +#ifdef MEMORY_CONTEXT_CHECKING + Size requested_size; +#endif + + /* bitfield for storing details about the chunk */ + uint64 hdrmask; /* must be last */ +} MemoryChunk; + +/* Get the MemoryChunk from the pointer */ +#define PointerGetMemoryChunk(p) \ + ((MemoryChunk *) ((char *) (p) - sizeof(MemoryChunk))) +/* Get the pointer from the MemoryChunk */ +#define MemoryChunkGetPointer(c) \ + ((void *) ((char *) (c) + sizeof(MemoryChunk))) + +/* private macros for making the inline functions below more simple */ +#define HdrMaskIsExternal(hdrmask) \ + ((hdrmask) & (((uint64) 1) << MEMORYCHUNK_EXTERNAL_BASEBIT)) +#define HdrMaskGetValue(hdrmask) \ + (((hdrmask) >> MEMORYCHUNK_VALUE_BASEBIT) & MEMORYCHUNK_MAX_VALUE) + +/* + * Shift the block offset down to the 0th bit position and mask off the single + * bit that's shared with the MemoryChunkGetValue field. + */ +#define HdrMaskBlockOffset(hdrmask) \ + (((hdrmask) >> MEMORYCHUNK_BLOCKOFFSET_BASEBIT) & MEMORYCHUNK_BLOCKOFFSET_MASK) + +/* For external chunks only, check the magic number matches */ +#define HdrMaskCheckMagic(hdrmask) \ + (MEMORYCHUNK_MAGIC == \ + ((hdrmask) >> MEMORYCHUNK_VALUE_BASEBIT << MEMORYCHUNK_VALUE_BASEBIT)) +/* + * MemoryChunkSetHdrMask + * Store the given 'block', 'chunk_size' and 'methodid' in the given + * MemoryChunk. + * + * The number of bytes between 'block' and 'chunk' must be <= + * MEMORYCHUNK_MAX_BLOCKOFFSET. + * 'value' must be <= MEMORYCHUNK_MAX_VALUE. + * Both 'chunk' and 'block' must be MAXALIGNed pointers. + */ +static inline void +MemoryChunkSetHdrMask(MemoryChunk *chunk, void *block, + Size value, MemoryContextMethodID methodid) +{ + Size blockoffset = (char *) chunk - (char *) block; + + Assert((char *) chunk >= (char *) block); + Assert((blockoffset & MEMORYCHUNK_BLOCKOFFSET_MASK) == blockoffset); + Assert(value <= MEMORYCHUNK_MAX_VALUE); + Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK); + + chunk->hdrmask = (((uint64) blockoffset) << MEMORYCHUNK_BLOCKOFFSET_BASEBIT) | + (((uint64) value) << MEMORYCHUNK_VALUE_BASEBIT) | + methodid; +} + +/* + * MemoryChunkSetHdrMaskExternal + * Set 'chunk' as an externally managed chunk. Here we only record the + * MemoryContextMethodID and set the external chunk bit. + */ +static inline void +MemoryChunkSetHdrMaskExternal(MemoryChunk *chunk, + MemoryContextMethodID methodid) +{ + Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK); + + chunk->hdrmask = MEMORYCHUNK_MAGIC | (((uint64) 1) << MEMORYCHUNK_EXTERNAL_BASEBIT) | + methodid; +} + +/* + * MemoryChunkIsExternal + * Return true if 'chunk' is marked as external. + */ +static inline bool +MemoryChunkIsExternal(MemoryChunk *chunk) +{ + /* + * External chunks should always store MEMORYCHUNK_MAGIC in the upper + * portion of the hdrmask, check that nothing has stomped on that. + */ + Assert(!HdrMaskIsExternal(chunk->hdrmask) || + HdrMaskCheckMagic(chunk->hdrmask)); + + return HdrMaskIsExternal(chunk->hdrmask); +} + +/* + * MemoryChunkGetValue + * For non-external chunks, returns the value field as it was set in + * MemoryChunkSetHdrMask. + */ +static inline Size +MemoryChunkGetValue(MemoryChunk *chunk) +{ + Assert(!HdrMaskIsExternal(chunk->hdrmask)); + + return HdrMaskGetValue(chunk->hdrmask); +} + +/* + * MemoryChunkGetBlock + * For non-external chunks, returns the pointer to the block as was set + * in MemoryChunkSetHdrMask. + */ +static inline void * +MemoryChunkGetBlock(MemoryChunk *chunk) +{ + Assert(!HdrMaskIsExternal(chunk->hdrmask)); + + return (void *) ((char *) chunk - HdrMaskBlockOffset(chunk->hdrmask)); +} + +/* cleanup all internal definitions */ +#undef MEMORYCHUNK_BLOCKOFFSET_MASK +#undef MEMORYCHUNK_EXTERNAL_BASEBIT +#undef MEMORYCHUNK_VALUE_BASEBIT +#undef MEMORYCHUNK_BLOCKOFFSET_BASEBIT +#undef MEMORYCHUNK_MAGIC +#undef HdrMaskIsExternal +#undef HdrMaskGetValue +#undef HdrMaskBlockOffset +#undef HdrMaskCheckMagic + +#endif /* MEMUTILS_MEMORYCHUNK_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/multirangetypes.h b/platform/dbops/binaries/postgres/include/server/utils/multirangetypes.h new file mode 100644 index 0000000000000000000000000000000000000000..845254395b671dfac63122862322928fd46bf457 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/multirangetypes.h @@ -0,0 +1,150 @@ +/*------------------------------------------------------------------------- + * + * multirangetypes.h + * Declarations for Postgres multirange types. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/multirangetypes.h + * + *------------------------------------------------------------------------- + */ +#ifndef MULTIRANGETYPES_H +#define MULTIRANGETYPES_H + +#include "utils/rangetypes.h" +#include "utils/typcache.h" + + +/* + * Multiranges are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + Oid multirangetypid; /* multirange type's own OID */ + uint32 rangeCount; /* the number of ranges */ + + /* + * Following the count are the range objects themselves, as ShortRangeType + * structs. Note that ranges are varlena too, depending on whether they + * have lower/upper bounds and because even their base types can be + * varlena. So we can't really index into this list. + */ +} MultirangeType; + +/* Use these macros in preference to accessing these fields directly */ +#define MultirangeTypeGetOid(mr) ((mr)->multirangetypid) +#define MultirangeIsEmpty(mr) ((mr)->rangeCount == 0) + +/* + * fmgr functions for multirange type objects + */ +static inline MultirangeType * +DatumGetMultirangeTypeP(Datum X) +{ + return (MultirangeType *) PG_DETOAST_DATUM(X); +} + +static inline MultirangeType * +DatumGetMultirangeTypePCopy(Datum X) +{ + return (MultirangeType *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +MultirangeTypePGetDatum(const MultirangeType *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_MULTIRANGE_P(n) DatumGetMultirangeTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_MULTIRANGE_P_COPY(n) DatumGetMultirangeTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_MULTIRANGE_P(x) return MultirangeTypePGetDatum(x) + +/* + * prototypes for functions defined in multirangetypes.c + */ + +/* internal versions of the above */ +extern bool multirange_eq_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool multirange_ne_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool multirange_contains_elem_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr, + Datum val); +extern bool multirange_contains_range_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr, + const RangeType *r); +extern bool range_contains_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_contains_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool range_overlaps_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_overlaps_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern bool range_overleft_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_overright_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_before_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_after_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool range_adjacent_multirange_internal(TypeCacheEntry *rangetyp, + const RangeType *r, + const MultirangeType *mr); +extern bool multirange_before_multirange_internal(TypeCacheEntry *rangetyp, + const MultirangeType *mr1, + const MultirangeType *mr2); +extern MultirangeType *multirange_minus_internal(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count1, + RangeType **ranges1, + int32 range_count2, + RangeType **ranges2); +extern MultirangeType *multirange_intersect_internal(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count1, + RangeType **ranges1, + int32 range_count2, + RangeType **ranges2); + +/* assorted support functions */ +extern TypeCacheEntry *multirange_get_typcache(FunctionCallInfo fcinfo, + Oid mltrngtypid); +extern void multirange_deserialize(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, + int32 *range_count, + RangeType ***ranges); +extern MultirangeType *make_multirange(Oid mltrngtypoid, + TypeCacheEntry *rangetyp, + int32 range_count, RangeType **ranges); +extern MultirangeType *make_empty_multirange(Oid mltrngtypoid, + TypeCacheEntry *rangetyp); +extern void multirange_get_bounds(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, + uint32 i, + RangeBound *lower, RangeBound *upper); +extern RangeType *multirange_get_range(TypeCacheEntry *rangetyp, + const MultirangeType *multirange, int i); +extern RangeType *multirange_get_union_range(TypeCacheEntry *rangetyp, + const MultirangeType *mr); + +#endif /* MULTIRANGETYPES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/numeric.h b/platform/dbops/binaries/postgres/include/server/utils/numeric.h new file mode 100644 index 0000000000000000000000000000000000000000..43c75c436fe6b8873ba9aa9cb4dbb800bc1eafc9 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/numeric.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------- + * + * numeric.h + * Definitions for the exact numeric data type of Postgres + * + * Original coding 1998, Jan Wieck. Heavily revised 2003, Tom Lane. + * + * Copyright (c) 1998-2024, PostgreSQL Global Development Group + * + * src/include/utils/numeric.h + * + *------------------------------------------------------------------------- + */ +#ifndef _PG_NUMERIC_H_ +#define _PG_NUMERIC_H_ + +#include "common/pg_prng.h" +#include "fmgr.h" + +/* + * Limits on the precision and scale specifiable in a NUMERIC typmod. The + * precision is strictly positive, but the scale may be positive or negative. + * A negative scale implies rounding before the decimal point. + * + * Note that the minimum display scale defined below is zero --- we always + * display all digits before the decimal point, even when the scale is + * negative. + * + * Note that the implementation limits on the precision and display scale of a + * numeric value are much larger --- beware of what you use these for! + */ +#define NUMERIC_MAX_PRECISION 1000 + +#define NUMERIC_MIN_SCALE (-1000) +#define NUMERIC_MAX_SCALE 1000 + +/* + * Internal limits on the scales chosen for calculation results + */ +#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION +#define NUMERIC_MIN_DISPLAY_SCALE 0 + +#define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2) + +/* + * For inherently inexact calculations such as division and square root, + * we try to get at least this many significant digits; the idea is to + * deliver a result no worse than float8 would. + */ +#define NUMERIC_MIN_SIG_DIGITS 16 + +/* The actual contents of Numeric are private to numeric.c */ +struct NumericData; +typedef struct NumericData *Numeric; + +/* + * fmgr interface macros + */ + +static inline Numeric +DatumGetNumeric(Datum X) +{ + return (Numeric) PG_DETOAST_DATUM(X); +} + +static inline Numeric +DatumGetNumericCopy(Datum X) +{ + return (Numeric) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +NumericGetDatum(Numeric X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_NUMERIC(n) DatumGetNumeric(PG_GETARG_DATUM(n)) +#define PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_NUMERIC(x) return NumericGetDatum(x) + +/* + * Utility functions in numeric.c + */ +extern bool numeric_is_nan(Numeric num); +extern bool numeric_is_inf(Numeric num); +extern int32 numeric_maximum_size(int32 typmod); +extern char *numeric_out_sci(Numeric num, int scale); +extern char *numeric_normalize(Numeric num); + +extern Numeric int64_to_numeric(int64 val); +extern Numeric int64_div_fast_to_numeric(int64 val1, int log10val2); + +extern Numeric numeric_add_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_sub_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_mul_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_div_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern Numeric numeric_mod_opt_error(Numeric num1, Numeric num2, + bool *have_error); +extern int32 numeric_int4_opt_error(Numeric num, bool *have_error); +extern int64 numeric_int8_opt_error(Numeric num, bool *have_error); + +extern Numeric random_numeric(pg_prng_state *state, + Numeric rmin, Numeric rmax); + +#endif /* _PG_NUMERIC_H_ */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/palloc.h b/platform/dbops/binaries/postgres/include/server/utils/palloc.h new file mode 100644 index 0000000000000000000000000000000000000000..773a5d2c34738560c38dfb05680d2880f137e32b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/palloc.h @@ -0,0 +1,151 @@ +/*------------------------------------------------------------------------- + * + * palloc.h + * POSTGRES memory allocator definitions. + * + * This file contains the basic memory allocation interface that is + * needed by almost every backend module. It is included directly by + * postgres.h, so the definitions here are automatically available + * everywhere. Keep it lean! + * + * Memory allocation occurs within "contexts". Every chunk obtained from + * palloc()/MemoryContextAlloc() is allocated within a specific context. + * The entire contents of a context can be freed easily and quickly by + * resetting or deleting the context --- this is both faster and less + * prone to memory-leakage bugs than releasing chunks individually. + * We organize contexts into context trees to allow fine-grain control + * over chunk lifetime while preserving the certainty that we will free + * everything that should be freed. See utils/mmgr/README for more info. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/palloc.h + * + *------------------------------------------------------------------------- + */ +#ifndef PALLOC_H +#define PALLOC_H + +/* + * Type MemoryContextData is declared in nodes/memnodes.h. Most users + * of memory allocation should just treat it as an abstract type, so we + * do not provide the struct contents here. + */ +typedef struct MemoryContextData *MemoryContext; + +/* + * A memory context can have callback functions registered on it. Any such + * function will be called once just before the context is next reset or + * deleted. The MemoryContextCallback struct describing such a callback + * typically would be allocated within the context itself, thereby avoiding + * any need to manage it explicitly (the reset/delete action will free it). + */ +typedef void (*MemoryContextCallbackFunction) (void *arg); + +typedef struct MemoryContextCallback +{ + MemoryContextCallbackFunction func; /* function to call */ + void *arg; /* argument to pass it */ + struct MemoryContextCallback *next; /* next in list of callbacks */ +} MemoryContextCallback; + +/* + * CurrentMemoryContext is the default allocation context for palloc(). + * Avoid accessing it directly! Instead, use MemoryContextSwitchTo() + * to change the setting. + */ +extern PGDLLIMPORT MemoryContext CurrentMemoryContext; + +/* + * Flags for MemoryContextAllocExtended. + */ +#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ +#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ + +/* + * Fundamental memory-allocation operations (more are in utils/memutils.h) + */ +extern void *MemoryContextAlloc(MemoryContext context, Size size); +extern void *MemoryContextAllocZero(MemoryContext context, Size size); +extern void *MemoryContextAllocExtended(MemoryContext context, + Size size, int flags); +extern void *MemoryContextAllocAligned(MemoryContext context, + Size size, Size alignto, int flags); + +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *palloc_extended(Size size, int flags); +extern void *palloc_aligned(Size size, Size alignto, int flags); +extern pg_nodiscard void *repalloc(void *pointer, Size size); +extern pg_nodiscard void *repalloc_extended(void *pointer, + Size size, int flags); +extern pg_nodiscard void *repalloc0(void *pointer, Size oldsize, Size size); +extern void pfree(void *pointer); + +/* + * Variants with easier notation and more type safety + */ + +/* + * Allocate space for one object of type "type" + */ +#define palloc_object(type) ((type *) palloc(sizeof(type))) +#define palloc0_object(type) ((type *) palloc0(sizeof(type))) + +/* + * Allocate space for "count" objects of type "type" + */ +#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count))) +#define palloc0_array(type, count) ((type *) palloc0(sizeof(type) * (count))) + +/* + * Change size of allocation pointed to by "pointer" to have space for "count" + * objects of type "type" + */ +#define repalloc_array(pointer, type, count) ((type *) repalloc(pointer, sizeof(type) * (count))) +#define repalloc0_array(pointer, type, oldcount, count) ((type *) repalloc0(pointer, sizeof(type) * (oldcount), sizeof(type) * (count))) + +/* Higher-limit allocators. */ +extern void *MemoryContextAllocHuge(MemoryContext context, Size size); +extern pg_nodiscard void *repalloc_huge(void *pointer, Size size); + +/* + * Although this header file is nominally backend-only, certain frontend + * programs like pg_controldata include it via postgres.h. For some compilers + * it's necessary to hide the inline definition of MemoryContextSwitchTo in + * this scenario; hence the #ifndef FRONTEND. + */ + +#ifndef FRONTEND +static inline MemoryContext +MemoryContextSwitchTo(MemoryContext context) +{ + MemoryContext old = CurrentMemoryContext; + + CurrentMemoryContext = context; + return old; +} +#endif /* FRONTEND */ + +/* Registration of memory context reset/delete callbacks */ +extern void MemoryContextRegisterResetCallback(MemoryContext context, + MemoryContextCallback *cb); + +/* + * These are like standard strdup() except the copied string is + * allocated in a context, not with malloc(). + */ +extern char *MemoryContextStrdup(MemoryContext context, const char *string); +extern char *pstrdup(const char *in); +extern char *pnstrdup(const char *in, Size len); + +extern char *pchomp(const char *in); + +/* sprintf into a palloc'd buffer --- these are in psprintf.c */ +extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); +extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); + +#endif /* PALLOC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/partcache.h b/platform/dbops/binaries/postgres/include/server/utils/partcache.h new file mode 100644 index 0000000000000000000000000000000000000000..a4ffa03622469bfa73bf9e6500ac789d953bf7c1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/partcache.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * partcache.h + * + * Copyright (c) 1996-2024, PostgreSQL Global Development Group + * + * src/include/utils/partcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef PARTCACHE_H +#define PARTCACHE_H + +#include "access/attnum.h" +#include "fmgr.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "partitioning/partdefs.h" +#include "utils/relcache.h" + +/* + * Information about the partition key of a relation + */ +typedef struct PartitionKeyData +{ + PartitionStrategy strategy; /* partitioning strategy */ + int16 partnatts; /* number of columns in the partition key */ + AttrNumber *partattrs; /* attribute numbers of columns in the + * partition key or 0 if it's an expr */ + List *partexprs; /* list of expressions in the partitioning + * key, one for each zero-valued partattrs */ + + Oid *partopfamily; /* OIDs of operator families */ + Oid *partopcintype; /* OIDs of opclass declared input data types */ + FmgrInfo *partsupfunc; /* lookup info for support funcs */ + + /* Partitioning collation per attribute */ + Oid *partcollation; + + /* Type information per attribute */ + Oid *parttypid; + int32 *parttypmod; + int16 *parttyplen; + bool *parttypbyval; + char *parttypalign; + Oid *parttypcoll; +} PartitionKeyData; + + +extern PartitionKey RelationGetPartitionKey(Relation rel); +extern List *RelationGetPartitionQual(Relation rel); +extern Expr *get_partition_qual_relid(Oid relid); + +/* + * PartitionKey inquiry functions + */ +static inline int +get_partition_strategy(PartitionKey key) +{ + return key->strategy; +} + +static inline int +get_partition_natts(PartitionKey key) +{ + return key->partnatts; +} + +static inline List * +get_partition_exprs(PartitionKey key) +{ + return key->partexprs; +} + +/* + * PartitionKey inquiry functions - one column + */ +static inline int16 +get_partition_col_attnum(PartitionKey key, int col) +{ + return key->partattrs[col]; +} + +static inline Oid +get_partition_col_typid(PartitionKey key, int col) +{ + return key->parttypid[col]; +} + +static inline int32 +get_partition_col_typmod(PartitionKey key, int col) +{ + return key->parttypmod[col]; +} + +static inline Oid +get_partition_col_collation(PartitionKey key, int col) +{ + return key->partcollation[col]; +} + +#endif /* PARTCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pg_crc.h b/platform/dbops/binaries/postgres/include/server/utils/pg_crc.h new file mode 100644 index 0000000000000000000000000000000000000000..6d76ce977192c270f8a20a6111f2520e28176f62 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pg_crc.h @@ -0,0 +1,107 @@ +/* + * pg_crc.h + * + * PostgreSQL CRC support + * + * See Ross Williams' excellent introduction + * A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from + * http://ross.net/crc/ or several other net sites. + * + * We have three slightly different variants of a 32-bit CRC calculation: + * CRC-32C (Castagnoli polynomial), CRC-32 (Ethernet polynomial), and a legacy + * CRC-32 version that uses the lookup table in a funny way. They all consist + * of four macros: + * + * INIT_(crc) + * Initialize a CRC accumulator + * + * COMP_(crc, data, len) + * Accumulate some (more) bytes into a CRC + * + * FIN_(crc) + * Finish a CRC calculation + * + * EQ_(c1, c2) + * Check for equality of two CRCs. + * + * The CRC-32C variant is in port/pg_crc32c.h. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_crc.h + */ +#ifndef PG_CRC_H +#define PG_CRC_H + +typedef uint32 pg_crc32; + +/* + * CRC-32, the same used e.g. in Ethernet. + * + * This is currently only used in ltree and hstore contrib modules. It uses + * the same lookup table as the legacy algorithm below. New code should + * use the Castagnoli version instead. + */ +#define INIT_TRADITIONAL_CRC32(crc) ((crc) = 0xFFFFFFFF) +#define FIN_TRADITIONAL_CRC32(crc) ((crc) ^= 0xFFFFFFFF) +#define COMP_TRADITIONAL_CRC32(crc, data, len) \ + COMP_CRC32_NORMAL_TABLE(crc, data, len, pg_crc32_table) +#define EQ_TRADITIONAL_CRC32(c1, c2) ((c1) == (c2)) + +/* Sarwate's algorithm, for use with a "normal" lookup table */ +#define COMP_CRC32_NORMAL_TABLE(crc, data, len, table) \ +do { \ + const unsigned char *__data = (const unsigned char *) (data); \ + uint32 __len = (len); \ +\ + while (__len-- > 0) \ + { \ + int __tab_index = ((int) (crc) ^ *__data++) & 0xFF; \ + (crc) = table[__tab_index] ^ ((crc) >> 8); \ + } \ +} while (0) + +/* + * The CRC algorithm used for WAL et al in pre-9.5 versions. + * + * This closely resembles the normal CRC-32 algorithm, but is subtly + * different. Using Williams' terms, we use the "normal" table, but with + * "reflected" code. That's bogus, but it was like that for years before + * anyone noticed. It does not correspond to any polynomial in a normal CRC + * algorithm, so it's not clear what the error-detection properties of this + * algorithm actually are. + * + * We still need to carry this around because it is used in a few on-disk + * structures that need to be pg_upgradeable. It should not be used in new + * code. + */ +#define INIT_LEGACY_CRC32(crc) ((crc) = 0xFFFFFFFF) +#define FIN_LEGACY_CRC32(crc) ((crc) ^= 0xFFFFFFFF) +#define COMP_LEGACY_CRC32(crc, data, len) \ + COMP_CRC32_REFLECTED_TABLE(crc, data, len, pg_crc32_table) +#define EQ_LEGACY_CRC32(c1, c2) ((c1) == (c2)) + +/* + * Sarwate's algorithm, for use with a "reflected" lookup table (but in the + * legacy algorithm, we actually use it on a "normal" table, see above) + */ +#define COMP_CRC32_REFLECTED_TABLE(crc, data, len, table) \ +do { \ + const unsigned char *__data = (const unsigned char *) (data); \ + uint32 __len = (len); \ +\ + while (__len-- > 0) \ + { \ + int __tab_index = ((int) ((crc) >> 24) ^ *__data++) & 0xFF; \ + (crc) = table[__tab_index] ^ ((crc) << 8); \ + } \ +} while (0) + +/* + * Constant table for the CRC-32 polynomials. The same table is used by both + * the normal and traditional variants. + */ +extern PGDLLIMPORT const uint32 pg_crc32_table[256]; + +#endif /* PG_CRC_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pg_locale.h b/platform/dbops/binaries/postgres/include/server/utils/pg_locale.h new file mode 100644 index 0000000000000000000000000000000000000000..040968d6ff295766449b94ab8ccb74ebb7ce591d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pg_locale.h @@ -0,0 +1,136 @@ +/*----------------------------------------------------------------------- + * + * PostgreSQL locale utilities + * + * src/include/utils/pg_locale.h + * + * Copyright (c) 2002-2024, PostgreSQL Global Development Group + * + *----------------------------------------------------------------------- + */ + +#ifndef _PG_LOCALE_ +#define _PG_LOCALE_ + +#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE) +#include +#endif +#ifdef USE_ICU +#include +#endif + +#ifdef USE_ICU +/* + * ucol_strcollUTF8() was introduced in ICU 50, but it is buggy before ICU 53. + * (see + * ) + */ +#if U_ICU_VERSION_MAJOR_NUM >= 53 +#define HAVE_UCOL_STRCOLLUTF8 1 +#else +#undef HAVE_UCOL_STRCOLLUTF8 +#endif +#endif + +/* use for libc locale names */ +#define LOCALE_NAME_BUFLEN 128 + +/* GUC settings */ +extern PGDLLIMPORT char *locale_messages; +extern PGDLLIMPORT char *locale_monetary; +extern PGDLLIMPORT char *locale_numeric; +extern PGDLLIMPORT char *locale_time; +extern PGDLLIMPORT int icu_validation_level; + +/* lc_time localization cache */ +extern PGDLLIMPORT char *localized_abbrev_days[]; +extern PGDLLIMPORT char *localized_full_days[]; +extern PGDLLIMPORT char *localized_abbrev_months[]; +extern PGDLLIMPORT char *localized_full_months[]; + +/* is the databases's LC_CTYPE the C locale? */ +extern PGDLLIMPORT bool database_ctype_is_c; + +extern bool check_locale(int category, const char *locale, char **canonname); +extern char *pg_perm_setlocale(int category, const char *locale); + +extern bool lc_collate_is_c(Oid collation); +extern bool lc_ctype_is_c(Oid collation); + +/* + * Return the POSIX lconv struct (contains number/money formatting + * information) with locale information for all categories. + */ +extern struct lconv *PGLC_localeconv(void); + +extern void cache_locale_time(void); + + +/* + * We use a discriminated union to hold either a locale_t or an ICU collator. + * pg_locale_t is occasionally checked for truth, so make it a pointer. + */ +struct pg_locale_struct +{ + char provider; + bool deterministic; + union + { + struct + { + const char *locale; + } builtin; + locale_t lt; +#ifdef USE_ICU + struct + { + const char *locale; + UCollator *ucol; + } icu; +#endif + } info; +}; + +typedef struct pg_locale_struct *pg_locale_t; + +extern PGDLLIMPORT struct pg_locale_struct default_locale; + +extern void make_icu_collator(const char *iculocstr, + const char *icurules, + struct pg_locale_struct *resultp); + +extern bool pg_locale_deterministic(pg_locale_t locale); +extern pg_locale_t pg_newlocale_from_collation(Oid collid); + +extern char *get_collation_actual_version(char collprovider, const char *collcollate); +extern int pg_strcoll(const char *arg1, const char *arg2, pg_locale_t locale); +extern int pg_strncoll(const char *arg1, size_t len1, + const char *arg2, size_t len2, pg_locale_t locale); +extern bool pg_strxfrm_enabled(pg_locale_t locale); +extern size_t pg_strxfrm(char *dest, const char *src, size_t destsize, + pg_locale_t locale); +extern size_t pg_strnxfrm(char *dest, size_t destsize, const char *src, + size_t srclen, pg_locale_t locale); +extern bool pg_strxfrm_prefix_enabled(pg_locale_t locale); +extern size_t pg_strxfrm_prefix(char *dest, const char *src, size_t destsize, + pg_locale_t locale); +extern size_t pg_strnxfrm_prefix(char *dest, size_t destsize, const char *src, + size_t srclen, pg_locale_t locale); + +extern int builtin_locale_encoding(const char *locale); +extern const char *builtin_validate_locale(int encoding, const char *locale); +extern void icu_validate_locale(const char *loc_str); +extern char *icu_language_tag(const char *loc_str, int elevel); + +#ifdef USE_ICU +extern int32_t icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes); +extern int32_t icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar); +#endif + +/* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */ +extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen, + pg_locale_t locale); +extern size_t char2wchar(wchar_t *to, size_t tolen, + const char *from, size_t fromlen, pg_locale_t locale); + +#endif /* _PG_LOCALE_ */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pg_lsn.h b/platform/dbops/binaries/postgres/include/server/utils/pg_lsn.h new file mode 100644 index 0000000000000000000000000000000000000000..e885ecdb1e13273268b4029a5c9128af8562885d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pg_lsn.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * pg_lsn.h + * Declarations for operations on log sequence numbers (LSNs) of + * PostgreSQL. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_lsn.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LSN_H +#define PG_LSN_H + +#include "access/xlogdefs.h" +#include "fmgr.h" + +static inline XLogRecPtr +DatumGetLSN(Datum X) +{ + return (XLogRecPtr) DatumGetInt64(X); +} + +static inline Datum +LSNGetDatum(XLogRecPtr X) +{ + return Int64GetDatum((int64) X); +} + +#define PG_GETARG_LSN(n) DatumGetLSN(PG_GETARG_DATUM(n)) +#define PG_RETURN_LSN(x) return LSNGetDatum(x) + +extern XLogRecPtr pg_lsn_in_internal(const char *str, bool *have_error); + +#endif /* PG_LSN_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pg_rusage.h b/platform/dbops/binaries/postgres/include/server/utils/pg_rusage.h new file mode 100644 index 0000000000000000000000000000000000000000..a299c19fb8b89244c598ae3bfc396c4c5256a6aa --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pg_rusage.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * pg_rusage.h + * header file for resource usage measurement support routines + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pg_rusage.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RUSAGE_H +#define PG_RUSAGE_H + +#include +#include + + +/* State structure for pg_rusage_init/pg_rusage_show */ +typedef struct PGRUsage +{ + struct timeval tv; + struct rusage ru; +} PGRUsage; + + +extern void pg_rusage_init(PGRUsage *ru0); +extern const char *pg_rusage_show(const PGRUsage *ru0); + +#endif /* PG_RUSAGE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pgstat_internal.h b/platform/dbops/binaries/postgres/include/server/utils/pgstat_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..22106778396228f4c2c5e06e20a1f97644e0970a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pgstat_internal.h @@ -0,0 +1,827 @@ +/* ---------- + * pgstat_internal.h + * + * Definitions for the PostgreSQL cumulative statistics system that should + * only be needed by files implementing statistics support (rather than ones + * reporting / querying stats). + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/utils/pgstat_internal.h + * ---------- + */ +#ifndef PGSTAT_INTERNAL_H +#define PGSTAT_INTERNAL_H + + +#include "common/hashfn_unstable.h" +#include "lib/dshash.h" +#include "lib/ilist.h" +#include "pgstat.h" +#include "storage/lwlock.h" +#include "utils/dsa.h" + + +/* + * Types related to shared memory storage of statistics. + * + * Per-object statistics are stored in the "shared stats" hashtable. That + * table's entries (PgStatShared_HashEntry) contain a pointer to the actual stats + * data for the object (the size of the stats data varies depending on the + * kind of stats). The table is keyed by PgStat_HashKey. + * + * Once a backend has a reference to a shared stats entry, it increments the + * entry's refcount. Even after stats data is dropped (e.g., due to a DROP + * TABLE), the entry itself can only be deleted once all references have been + * released. + * + * These refcounts, in combination with a backend local hashtable + * (pgStatEntryRefHash, with entries pointing to PgStat_EntryRef) in front of + * the shared hash table, mean that most stats work can happen without + * touching the shared hash table, reducing contention. + * + * Once there are pending stats updates for a table PgStat_EntryRef->pending + * is allocated to contain a working space for as-of-yet-unapplied stats + * updates. Once the stats are flushed, PgStat_EntryRef->pending is freed. + * + * Each stat kind in the shared hash table has a fixed member + * PgStatShared_Common as the first element. + */ + +/* struct for shared statistics hash entry key. */ +typedef struct PgStat_HashKey +{ + PgStat_Kind kind; /* statistics entry kind */ + Oid dboid; /* database ID. InvalidOid for shared objects. */ + Oid objoid; /* object ID, either table or function. */ +} PgStat_HashKey; + +/* + * Shared statistics hash entry. Doesn't itself contain any stats, but points + * to them (with ->body). That allows the stats entries themselves to be of + * variable size. + */ +typedef struct PgStatShared_HashEntry +{ + PgStat_HashKey key; /* hash key */ + + /* + * If dropped is set, backends need to release their references so that + * the memory for the entry can be freed. No new references may be made + * once marked as dropped. + */ + bool dropped; + + /* + * Refcount managing lifetime of the entry itself (as opposed to the + * dshash entry pointing to it). The stats lifetime has to be separate + * from the hash table entry lifetime because we allow backends to point + * to a stats entry without holding a hash table lock (and some other + * reasons). + * + * As long as the entry is not dropped, 1 is added to the refcount + * representing that the entry should not be dropped. In addition each + * backend that has a reference to the entry needs to increment the + * refcount as long as it does. + * + * May only be incremented / decremented while holding at least a shared + * lock on the dshash partition containing the entry. It needs to be an + * atomic variable because multiple backends can increment the refcount + * with just a shared lock. + * + * When the refcount reaches 0 the entry needs to be freed. + */ + pg_atomic_uint32 refcount; + + /* + * Counter tracking the number of times the entry has been reused. + * + * Set to 0 when the entry is created, and incremented by one each time + * the shared entry is reinitialized with pgstat_reinit_entry(). + * + * May only be incremented / decremented while holding at least a shared + * lock on the dshash partition containing the entry. Like refcount, it + * needs to be an atomic variable because multiple backends can increment + * the generation with just a shared lock. + */ + pg_atomic_uint32 generation; + + /* + * Pointer to shared stats. The stats entry always starts with + * PgStatShared_Common, embedded in a larger struct containing the + * PgStat_Kind specific stats fields. + */ + dsa_pointer body; +} PgStatShared_HashEntry; + +/* + * Common header struct for PgStatShared_*. + */ +typedef struct PgStatShared_Common +{ + uint32 magic; /* just a validity cross-check */ + /* lock protecting stats contents (i.e. data following the header) */ + LWLock lock; +} PgStatShared_Common; + +/* + * A backend local reference to a shared stats entry. As long as at least one + * such reference exists, the shared stats entry will not be released. + * + * If there are pending stats update to the shared stats, these are stored in + * ->pending. + */ +typedef struct PgStat_EntryRef +{ + /* + * Pointer to the PgStatShared_HashEntry entry in the shared stats + * hashtable. + */ + PgStatShared_HashEntry *shared_entry; + + /* + * Pointer to the stats data (i.e. PgStatShared_HashEntry->body), resolved + * as a local pointer, to avoid repeated dsa_get_address() calls. + */ + PgStatShared_Common *shared_stats; + + /* + * Copy of PgStatShared_HashEntry->generation, keeping locally track of + * the shared stats entry "generation" retrieved (number of times reused). + */ + uint32 generation; + + /* + * Pending statistics data that will need to be flushed to shared memory + * stats eventually. Each stats kind utilizing pending data defines what + * format its pending data has and needs to provide a + * PgStat_KindInfo->flush_pending_cb callback to merge pending into shared + * stats. + */ + void *pending; + dlist_node pending_node; /* membership in pgStatPending list */ +} PgStat_EntryRef; + + +/* + * Some stats changes are transactional. To maintain those, a stack of + * PgStat_SubXactStatus entries is maintained, which contain data pertaining + * to the current transaction and its active subtransactions. + */ +typedef struct PgStat_SubXactStatus +{ + int nest_level; /* subtransaction nest level */ + + struct PgStat_SubXactStatus *prev; /* higher-level subxact if any */ + + /* + * Statistics for transactionally dropped objects need to be + * transactionally dropped as well. Collect the stats dropped in the + * current (sub-)transaction and only execute the stats drop when we know + * if the transaction commits/aborts. To handle replicas and crashes, + * stats drops are included in commit / abort records. + */ + dclist_head pending_drops; + + /* + * Tuple insertion/deletion counts for an open transaction can't be + * propagated into PgStat_TableStatus counters until we know if it is + * going to commit or abort. Hence, we keep these counts in per-subxact + * structs that live in TopTransactionContext. This data structure is + * designed on the assumption that subxacts won't usually modify very many + * tables. + */ + PgStat_TableXactStatus *first; /* head of list for this subxact */ +} PgStat_SubXactStatus; + + +/* + * Metadata for a specific kind of statistics. + */ +typedef struct PgStat_KindInfo +{ + /* + * Do a fixed number of stats objects exist for this kind of stats (e.g. + * bgwriter stats) or not (e.g. tables). + */ + bool fixed_amount:1; + + /* + * Can stats of this kind be accessed from another database? Determines + * whether a stats object gets included in stats snapshots. + */ + bool accessed_across_databases:1; + + /* + * For variable-numbered stats: Identified on-disk using a name, rather + * than PgStat_HashKey. Probably only needed for replication slot stats. + */ + bool named_on_disk:1; + + /* + * The size of an entry in the shared stats hash table (pointed to by + * PgStatShared_HashEntry->body). + */ + uint32 shared_size; + + /* + * The offset/size of statistics inside the shared stats entry. Used when + * [de-]serializing statistics to / from disk respectively. Separate from + * shared_size because [de-]serialization may not include in-memory state + * like lwlocks. + */ + uint32 shared_data_off; + uint32 shared_data_len; + + /* + * The size of the pending data for this kind. E.g. how large + * PgStat_EntryRef->pending is. Used for allocations. + * + * 0 signals that an entry of this kind should never have a pending entry. + */ + uint32 pending_size; + + /* + * For variable-numbered stats: flush pending stats. Required if pending + * data is used. + */ + bool (*flush_pending_cb) (PgStat_EntryRef *sr, bool nowait); + + /* + * For variable-numbered stats: delete pending stats. Optional. + */ + void (*delete_pending_cb) (PgStat_EntryRef *sr); + + /* + * For variable-numbered stats: reset the reset timestamp. Optional. + */ + void (*reset_timestamp_cb) (PgStatShared_Common *header, TimestampTz ts); + + /* + * For variable-numbered stats with named_on_disk. Optional. + */ + void (*to_serialized_name) (const PgStat_HashKey *key, + const PgStatShared_Common *header, NameData *name); + bool (*from_serialized_name) (const NameData *name, PgStat_HashKey *key); + + /* + * For fixed-numbered statistics: Reset All. + */ + void (*reset_all_cb) (TimestampTz ts); + + /* + * For fixed-numbered statistics: Build snapshot for entry + */ + void (*snapshot_cb) (void); + + /* name of the kind of stats */ + const char *const name; +} PgStat_KindInfo; + + +/* + * List of SLRU names that we keep stats for. There is no central registry of + * SLRUs, so we use this fixed list instead. The "other" entry is used for + * all SLRUs without an explicit entry (e.g. SLRUs in extensions). + * + * This is only defined here so that SLRU_NUM_ELEMENTS is known for later type + * definitions. + */ +static const char *const slru_names[] = { + "commit_timestamp", + "multixact_member", + "multixact_offset", + "notify", + "serializable", + "subtransaction", + "transaction", + "other" /* has to be last */ +}; + +#define SLRU_NUM_ELEMENTS lengthof(slru_names) + + +/* ---------- + * Types and definitions for different kinds of fixed-amount stats. + * + * Single-writer stats use the changecount mechanism to achieve low-overhead + * writes - they're obviously more performance critical than reads. Check the + * definition of struct PgBackendStatus for some explanation of the + * changecount mechanism. + * + * Because the obvious implementation of resetting single-writer stats isn't + * compatible with that (another backend needs to write), we don't scribble on + * shared stats while resetting. Instead, just record the current counter + * values in a copy of the stats data, which is protected by ->lock. See + * pgstat_fetch_stat_(archiver|bgwriter|checkpointer) for the reader side. + * + * The only exception to that is the stat_reset_timestamp in these structs, + * which is protected by ->lock, because it has to be written by another + * backend while resetting. + * ---------- + */ + +typedef struct PgStatShared_Archiver +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_ArchiverStats stats; + PgStat_ArchiverStats reset_offset; +} PgStatShared_Archiver; + +typedef struct PgStatShared_BgWriter +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_BgWriterStats stats; + PgStat_BgWriterStats reset_offset; +} PgStatShared_BgWriter; + +typedef struct PgStatShared_Checkpointer +{ + /* lock protects ->reset_offset as well as stats->stat_reset_timestamp */ + LWLock lock; + uint32 changecount; + PgStat_CheckpointerStats stats; + PgStat_CheckpointerStats reset_offset; +} PgStatShared_Checkpointer; + +/* Shared-memory ready PgStat_IO */ +typedef struct PgStatShared_IO +{ + /* + * locks[i] protects stats.stats[i]. locks[0] also protects + * stats.stat_reset_timestamp. + */ + LWLock locks[BACKEND_NUM_TYPES]; + PgStat_IO stats; +} PgStatShared_IO; + +typedef struct PgStatShared_SLRU +{ + /* lock protects ->stats */ + LWLock lock; + PgStat_SLRUStats stats[SLRU_NUM_ELEMENTS]; +} PgStatShared_SLRU; + +typedef struct PgStatShared_Wal +{ + /* lock protects ->stats */ + LWLock lock; + PgStat_WalStats stats; +} PgStatShared_Wal; + + + +/* ---------- + * Types and definitions for different kinds of variable-amount stats. + * + * Each struct has to start with PgStatShared_Common, containing information + * common across the different types of stats. Kind-specific data follows. + * ---------- + */ + +typedef struct PgStatShared_Database +{ + PgStatShared_Common header; + PgStat_StatDBEntry stats; +} PgStatShared_Database; + +typedef struct PgStatShared_Relation +{ + PgStatShared_Common header; + PgStat_StatTabEntry stats; +} PgStatShared_Relation; + +typedef struct PgStatShared_Function +{ + PgStatShared_Common header; + PgStat_StatFuncEntry stats; +} PgStatShared_Function; + +typedef struct PgStatShared_Subscription +{ + PgStatShared_Common header; + PgStat_StatSubEntry stats; +} PgStatShared_Subscription; + +typedef struct PgStatShared_ReplSlot +{ + PgStatShared_Common header; + PgStat_StatReplSlotEntry stats; +} PgStatShared_ReplSlot; + + +/* + * Central shared memory entry for the cumulative stats system. + * + * Fixed amount stats, the dynamic shared memory hash table for + * non-fixed-amount stats, as well as remaining bits and pieces are all + * reached from here. + */ +typedef struct PgStat_ShmemControl +{ + void *raw_dsa_area; + + /* + * Stats for variable-numbered objects are kept in this shared hash table. + * See comment above PgStat_Kind for details. + */ + dshash_table_handle hash_handle; /* shared dbstat hash */ + + /* Has the stats system already been shut down? Just a debugging check. */ + bool is_shutdown; + + /* + * Whenever statistics for dropped objects could not be freed - because + * backends still have references - the dropping backend calls + * pgstat_request_entry_refs_gc() incrementing this counter. Eventually + * that causes backends to run pgstat_gc_entry_refs(), allowing memory to + * be reclaimed. + */ + pg_atomic_uint64 gc_request_count; + + /* + * Stats data for fixed-numbered objects. + */ + PgStatShared_Archiver archiver; + PgStatShared_BgWriter bgwriter; + PgStatShared_Checkpointer checkpointer; + PgStatShared_IO io; + PgStatShared_SLRU slru; + PgStatShared_Wal wal; +} PgStat_ShmemControl; + + +/* + * Cached statistics snapshot + */ +typedef struct PgStat_Snapshot +{ + PgStat_FetchConsistency mode; + + /* time at which snapshot was taken */ + TimestampTz snapshot_timestamp; + + bool fixed_valid[PGSTAT_NUM_KINDS]; + + PgStat_ArchiverStats archiver; + + PgStat_BgWriterStats bgwriter; + + PgStat_CheckpointerStats checkpointer; + + PgStat_IO io; + + PgStat_SLRUStats slru[SLRU_NUM_ELEMENTS]; + + PgStat_WalStats wal; + + /* to free snapshot in bulk */ + MemoryContext context; + struct pgstat_snapshot_hash *stats; +} PgStat_Snapshot; + + +/* + * Collection of backend-local stats state. + */ +typedef struct PgStat_LocalState +{ + PgStat_ShmemControl *shmem; + dsa_area *dsa; + dshash_table *shared_hash; + + /* the current statistics snapshot */ + PgStat_Snapshot snapshot; +} PgStat_LocalState; + + +/* + * Inline functions defined further below. + */ + +static inline void pgstat_begin_changecount_write(uint32 *cc); +static inline void pgstat_end_changecount_write(uint32 *cc); +static inline uint32 pgstat_begin_changecount_read(uint32 *cc); +static inline bool pgstat_end_changecount_read(uint32 *cc, uint32 cc_before); + +static inline void pgstat_copy_changecounted_stats(void *dst, void *src, size_t len, + uint32 *cc); + +static inline int pgstat_cmp_hash_key(const void *a, const void *b, size_t size, void *arg); +static inline uint32 pgstat_hash_hash_key(const void *d, size_t size, void *arg); +static inline size_t pgstat_get_entry_len(PgStat_Kind kind); +static inline void *pgstat_get_entry_data(PgStat_Kind kind, PgStatShared_Common *entry); + + +/* + * Functions in pgstat.c + */ + +extern const PgStat_KindInfo *pgstat_get_kind_info(PgStat_Kind kind); + +#ifdef USE_ASSERT_CHECKING +extern void pgstat_assert_is_up(void); +#else +#define pgstat_assert_is_up() ((void)true) +#endif + +extern void pgstat_delete_pending_entry(PgStat_EntryRef *entry_ref); +extern PgStat_EntryRef *pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, Oid objoid, bool *created_entry); +extern PgStat_EntryRef *pgstat_fetch_pending_entry(PgStat_Kind kind, Oid dboid, Oid objoid); + +extern void *pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, Oid objoid); +extern void pgstat_snapshot_fixed(PgStat_Kind kind); + + +/* + * Functions in pgstat_archiver.c + */ + +extern void pgstat_archiver_reset_all_cb(TimestampTz ts); +extern void pgstat_archiver_snapshot_cb(void); + + +/* + * Functions in pgstat_bgwriter.c + */ + +extern void pgstat_bgwriter_reset_all_cb(TimestampTz ts); +extern void pgstat_bgwriter_snapshot_cb(void); + + +/* + * Functions in pgstat_checkpointer.c + */ + +extern void pgstat_checkpointer_reset_all_cb(TimestampTz ts); +extern void pgstat_checkpointer_snapshot_cb(void); + + +/* + * Functions in pgstat_database.c + */ + +extern void pgstat_report_disconnect(Oid dboid); +extern void pgstat_update_dbstats(TimestampTz ts); +extern void AtEOXact_PgStat_Database(bool isCommit, bool parallel); + +extern PgStat_StatDBEntry *pgstat_prep_database_pending(Oid dboid); +extern void pgstat_reset_database_timestamp(Oid dboid, TimestampTz ts); +extern bool pgstat_database_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_database_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); + + +/* + * Functions in pgstat_function.c + */ + +extern bool pgstat_function_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); + + +/* + * Functions in pgstat_io.c + */ + +extern bool pgstat_flush_io(bool nowait); +extern void pgstat_io_reset_all_cb(TimestampTz ts); +extern void pgstat_io_snapshot_cb(void); + + +/* + * Functions in pgstat_relation.c + */ + +extern void AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit); +extern void AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, int nestDepth); +extern void AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state); +extern void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state); + +extern bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_relation_delete_pending_cb(PgStat_EntryRef *entry_ref); + + +/* + * Functions in pgstat_replslot.c + */ + +extern void pgstat_replslot_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); +extern void pgstat_replslot_to_serialized_name_cb(const PgStat_HashKey *key, const PgStatShared_Common *header, NameData *name); +extern bool pgstat_replslot_from_serialized_name_cb(const NameData *name, PgStat_HashKey *key); + + +/* + * Functions in pgstat_shmem.c + */ + +extern void pgstat_attach_shmem(void); +extern void pgstat_detach_shmem(void); + +extern PgStat_EntryRef *pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, Oid objoid, + bool create, bool *created_entry); +extern bool pgstat_lock_entry(PgStat_EntryRef *entry_ref, bool nowait); +extern bool pgstat_lock_entry_shared(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_unlock_entry(PgStat_EntryRef *entry_ref); +extern bool pgstat_drop_entry(PgStat_Kind kind, Oid dboid, Oid objoid); +extern void pgstat_drop_all_entries(void); +extern PgStat_EntryRef *pgstat_get_entry_ref_locked(PgStat_Kind kind, Oid dboid, Oid objoid, + bool nowait); +extern void pgstat_reset_entry(PgStat_Kind kind, Oid dboid, Oid objoid, TimestampTz ts); +extern void pgstat_reset_entries_of_kind(PgStat_Kind kind, TimestampTz ts); +extern void pgstat_reset_matching_entries(bool (*do_reset) (PgStatShared_HashEntry *, Datum), + Datum match_data, + TimestampTz ts); + +extern void pgstat_request_entry_refs_gc(void); +extern PgStatShared_Common *pgstat_init_entry(PgStat_Kind kind, + PgStatShared_HashEntry *shhashent); + + +/* + * Functions in pgstat_slru.c + */ + +extern bool pgstat_slru_flush(bool nowait); +extern void pgstat_slru_reset_all_cb(TimestampTz ts); +extern void pgstat_slru_snapshot_cb(void); + + +/* + * Functions in pgstat_wal.c + */ + +extern bool pgstat_flush_wal(bool nowait); +extern void pgstat_init_wal(void); +extern bool pgstat_have_pending_wal(void); + +extern void pgstat_wal_reset_all_cb(TimestampTz ts); +extern void pgstat_wal_snapshot_cb(void); + + +/* + * Functions in pgstat_subscription.c + */ + +extern bool pgstat_subscription_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_subscription_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); + + +/* + * Functions in pgstat_xact.c + */ + +extern PgStat_SubXactStatus *pgstat_get_xact_stack_level(int nest_level); +extern void pgstat_drop_transactional(PgStat_Kind kind, Oid dboid, Oid objoid); +extern void pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid); + + +/* + * Variables in pgstat.c + */ + +extern PGDLLIMPORT PgStat_LocalState pgStatLocal; + + +/* + * Variables in pgstat_io.c + */ + +extern PGDLLIMPORT bool have_iostats; + + +/* + * Variables in pgstat_slru.c + */ + +extern PGDLLIMPORT bool have_slrustats; + + +/* + * Implementation of inline functions declared above. + */ + +/* + * Helpers for changecount manipulation. See comments around struct + * PgBackendStatus for details. + */ + +static inline void +pgstat_begin_changecount_write(uint32 *cc) +{ + Assert((*cc & 1) == 0); + + START_CRIT_SECTION(); + (*cc)++; + pg_write_barrier(); +} + +static inline void +pgstat_end_changecount_write(uint32 *cc) +{ + Assert((*cc & 1) == 1); + + pg_write_barrier(); + + (*cc)++; + + END_CRIT_SECTION(); +} + +static inline uint32 +pgstat_begin_changecount_read(uint32 *cc) +{ + uint32 before_cc = *cc; + + CHECK_FOR_INTERRUPTS(); + + pg_read_barrier(); + + return before_cc; +} + +/* + * Returns true if the read succeeded, false if it needs to be repeated. + */ +static inline bool +pgstat_end_changecount_read(uint32 *cc, uint32 before_cc) +{ + uint32 after_cc; + + pg_read_barrier(); + + after_cc = *cc; + + /* was a write in progress when we started? */ + if (before_cc & 1) + return false; + + /* did writes start and complete while we read? */ + return before_cc == after_cc; +} + + +/* + * helper function for PgStat_KindInfo->snapshot_cb + * PgStat_KindInfo->reset_all_cb callbacks. + * + * Copies out the specified memory area following change-count protocol. + */ +static inline void +pgstat_copy_changecounted_stats(void *dst, void *src, size_t len, + uint32 *cc) +{ + uint32 cc_before; + + do + { + cc_before = pgstat_begin_changecount_read(cc); + + memcpy(dst, src, len); + } + while (!pgstat_end_changecount_read(cc, cc_before)); +} + +/* helpers for dshash / simplehash hashtables */ +static inline int +pgstat_cmp_hash_key(const void *a, const void *b, size_t size, void *arg) +{ + Assert(size == sizeof(PgStat_HashKey) && arg == NULL); + return memcmp(a, b, sizeof(PgStat_HashKey)); +} + +static inline uint32 +pgstat_hash_hash_key(const void *d, size_t size, void *arg) +{ + const char *key = (const char *) d; + + Assert(size == sizeof(PgStat_HashKey) && arg == NULL); + return fasthash32(key, size, 0); +} + +/* + * The length of the data portion of a shared memory stats entry (i.e. without + * transient data such as refcounts, lwlocks, ...). + */ +static inline size_t +pgstat_get_entry_len(PgStat_Kind kind) +{ + return pgstat_get_kind_info(kind)->shared_data_len; +} + +/* + * Returns a pointer to the data portion of a shared memory stats entry. + */ +static inline void * +pgstat_get_entry_data(PgStat_Kind kind, PgStatShared_Common *entry) +{ + size_t off = pgstat_get_kind_info(kind)->shared_data_off; + + Assert(off != 0 && off < PG_UINT32_MAX); + + return ((char *) (entry)) + off; +} + +#endif /* PGSTAT_INTERNAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/pidfile.h b/platform/dbops/binaries/postgres/include/server/utils/pidfile.h new file mode 100644 index 0000000000000000000000000000000000000000..f0d00d398fd47099c5e50b9a264e66706c398f80 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/pidfile.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pidfile.h + * Declarations describing the data directory lock file (postmaster.pid) + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/pidfile.h + * + *------------------------------------------------------------------------- + */ +#ifndef UTILS_PIDFILE_H +#define UTILS_PIDFILE_H + +/* + * As of Postgres 10, the contents of the data-directory lock file are: + * + * line # + * 1 postmaster PID (or negative of a standalone backend's PID) + * 2 data directory path + * 3 postmaster start timestamp (time_t representation) + * 4 port number + * 5 first Unix socket directory path (empty if none) + * 6 first listen_address (IP address or "*"; empty if no TCP port) + * 7 shared memory key (empty on Windows) + * 8 postmaster status (see values below) + * + * Lines 6 and up are added via AddToDataDirLockFile() after initial file + * creation; also, line 5 is initially empty and is changed after the first + * Unix socket is opened. Onlookers should not assume that lines 4 and up + * are filled in any particular order. + * + * Socket lock file(s), if used, have the same contents as lines 1-5, with + * line 5 being their own directory. + */ +#define LOCK_FILE_LINE_PID 1 +#define LOCK_FILE_LINE_DATA_DIR 2 +#define LOCK_FILE_LINE_START_TIME 3 +#define LOCK_FILE_LINE_PORT 4 +#define LOCK_FILE_LINE_SOCKET_DIR 5 +#define LOCK_FILE_LINE_LISTEN_ADDR 6 +#define LOCK_FILE_LINE_SHMEM_KEY 7 +#define LOCK_FILE_LINE_PM_STATUS 8 + +/* + * The PM_STATUS line may contain one of these values. All these strings + * must be the same length, per comments for AddToDataDirLockFile(). + * We pad with spaces as needed to make that true. + */ +#define PM_STATUS_STARTING "starting" /* still starting up */ +#define PM_STATUS_STOPPING "stopping" /* in shutdown sequence */ +#define PM_STATUS_READY "ready " /* ready for connections */ +#define PM_STATUS_STANDBY "standby " /* up, won't accept connections */ + +#endif /* UTILS_PIDFILE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/plancache.h b/platform/dbops/binaries/postgres/include/server/utils/plancache.h new file mode 100644 index 0000000000000000000000000000000000000000..a90dfdf9067a45a66fe8e27dd89c29d71a00b651 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/plancache.h @@ -0,0 +1,238 @@ +/*------------------------------------------------------------------------- + * + * plancache.h + * Plan cache definitions. + * + * See plancache.c for comments. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/plancache.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLANCACHE_H +#define PLANCACHE_H + +#include "access/tupdesc.h" +#include "lib/ilist.h" +#include "nodes/params.h" +#include "tcop/cmdtag.h" +#include "utils/queryenvironment.h" +#include "utils/resowner.h" + + +/* Forward declaration, to avoid including parsenodes.h here */ +struct RawStmt; + +/* possible values for plan_cache_mode */ +typedef enum +{ + PLAN_CACHE_MODE_AUTO, + PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, + PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, +} PlanCacheMode; + +/* GUC parameter */ +extern PGDLLIMPORT int plan_cache_mode; + +#define CACHEDPLANSOURCE_MAGIC 195726186 +#define CACHEDPLAN_MAGIC 953717834 +#define CACHEDEXPR_MAGIC 838275847 + +/* + * CachedPlanSource (which might better have been called CachedQuery) + * represents a SQL query that we expect to use multiple times. It stores + * the query source text, the raw parse tree, and the analyzed-and-rewritten + * query tree, as well as adjunct data. Cache invalidation can happen as a + * result of DDL affecting objects used by the query. In that case we discard + * the analyzed-and-rewritten query tree, and rebuild it when next needed. + * + * An actual execution plan, represented by CachedPlan, is derived from the + * CachedPlanSource when we need to execute the query. The plan could be + * either generic (usable with any set of plan parameters) or custom (for a + * specific set of parameters). plancache.c contains the logic that decides + * which way to do it for any particular execution. If we are using a generic + * cached plan then it is meant to be re-used across multiple executions, so + * callers must always treat CachedPlans as read-only. + * + * Once successfully built and "saved", CachedPlanSources typically live + * for the life of the backend, although they can be dropped explicitly. + * CachedPlans are reference-counted and go away automatically when the last + * reference is dropped. A CachedPlan can outlive the CachedPlanSource it + * was created from. + * + * An "unsaved" CachedPlanSource can be used for generating plans, but it + * lives in transient storage and will not be updated in response to sinval + * events. + * + * CachedPlans made from saved CachedPlanSources are likewise in permanent + * storage, so to avoid memory leaks, the reference-counted references to them + * must be held in permanent data structures or ResourceOwners. CachedPlans + * made from unsaved CachedPlanSources are in children of the caller's + * memory context, so references to them should not be longer-lived than + * that context. (Reference counting is somewhat pro forma in that case, + * though it may be useful if the CachedPlan can be discarded early.) + * + * A CachedPlanSource has two associated memory contexts: one that holds the + * struct itself, the query source text and the raw parse tree, and another + * context that holds the rewritten query tree and associated data. This + * allows the query tree to be discarded easily when it is invalidated. + * + * Some callers wish to use the CachedPlan API even with one-shot queries + * that have no reason to be saved at all. We therefore support a "oneshot" + * variant that does no data copying or invalidation checking. In this case + * there are no separate memory contexts: the CachedPlanSource struct and + * all subsidiary data live in the caller's CurrentMemoryContext, and there + * is no way to free memory short of clearing that entire context. A oneshot + * plan is always treated as unsaved. + * + * Note: the string referenced by commandTag is not subsidiary storage; + * it is assumed to be a compile-time-constant string. As with portals, + * commandTag shall be NULL if and only if the original query string (before + * rewriting) was an empty string. + */ +typedef struct CachedPlanSource +{ + int magic; /* should equal CACHEDPLANSOURCE_MAGIC */ + struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */ + const char *query_string; /* source text of query */ + CommandTag commandTag; /* 'nuff said */ + Oid *param_types; /* array of parameter type OIDs, or NULL */ + int num_params; /* length of param_types array */ + ParserSetupHook parserSetup; /* alternative parameter spec method */ + void *parserSetupArg; + int cursor_options; /* cursor options used for planning */ + bool fixed_result; /* disallow change in result tupdesc? */ + TupleDesc resultDesc; /* result type; NULL = doesn't return tuples */ + MemoryContext context; /* memory context holding all above */ + /* These fields describe the current analyzed-and-rewritten query tree: */ + List *query_list; /* list of Query nodes, or NIL if not valid */ + List *relationOids; /* OIDs of relations the queries depend on */ + List *invalItems; /* other dependencies, as PlanInvalItems */ + struct SearchPathMatcher *search_path; /* search_path used for parsing + * and planning */ + MemoryContext query_context; /* context holding the above, or NULL */ + Oid rewriteRoleId; /* Role ID we did rewriting for */ + bool rewriteRowSecurity; /* row_security used during rewrite */ + bool dependsOnRLS; /* is rewritten query specific to the above? */ + /* If we have a generic plan, this is a reference-counted link to it: */ + struct CachedPlan *gplan; /* generic plan, or NULL if not valid */ + /* Some state flags: */ + bool is_oneshot; /* is it a "oneshot" plan? */ + bool is_complete; /* has CompleteCachedPlan been done? */ + bool is_saved; /* has CachedPlanSource been "saved"? */ + bool is_valid; /* is the query_list currently valid? */ + int generation; /* increments each time we create a plan */ + /* If CachedPlanSource has been saved, it is a member of a global list */ + dlist_node node; /* list link, if is_saved */ + /* State kept to help decide whether to use custom or generic plans: */ + double generic_cost; /* cost of generic plan, or -1 if not known */ + double total_custom_cost; /* total cost of custom plans so far */ + int64 num_custom_plans; /* # of custom plans included in total */ + int64 num_generic_plans; /* # of generic plans */ +} CachedPlanSource; + +/* + * CachedPlan represents an execution plan derived from a CachedPlanSource. + * The reference count includes both the link from the parent CachedPlanSource + * (if any), and any active plan executions, so the plan can be discarded + * exactly when refcount goes to zero. Both the struct itself and the + * subsidiary data live in the context denoted by the context field. + * This makes it easy to free a no-longer-needed cached plan. (However, + * if is_oneshot is true, the context does not belong solely to the CachedPlan + * so no freeing is possible.) + */ +typedef struct CachedPlan +{ + int magic; /* should equal CACHEDPLAN_MAGIC */ + List *stmt_list; /* list of PlannedStmts */ + bool is_oneshot; /* is it a "oneshot" plan? */ + bool is_saved; /* is CachedPlan in a long-lived context? */ + bool is_valid; /* is the stmt_list currently valid? */ + Oid planRoleId; /* Role ID the plan was created for */ + bool dependsOnRole; /* is plan specific to that role? */ + TransactionId saved_xmin; /* if valid, replan when TransactionXmin + * changes from this value */ + int generation; /* parent's generation number for this plan */ + int refcount; /* count of live references to this struct */ + MemoryContext context; /* context containing this CachedPlan */ +} CachedPlan; + +/* + * CachedExpression is a low-overhead mechanism for caching the planned form + * of standalone scalar expressions. While such expressions are not usually + * subject to cache invalidation events, that can happen, for example because + * of replacement of a SQL function that was inlined into the expression. + * The plancache takes care of storing the expression tree and marking it + * invalid if a cache invalidation occurs, but the caller must notice the + * !is_valid status and discard the obsolete expression without reusing it. + * We do not store the original parse tree, only the planned expression; + * this is an optimization based on the assumption that we usually will not + * need to replan for the life of the session. + */ +typedef struct CachedExpression +{ + int magic; /* should equal CACHEDEXPR_MAGIC */ + Node *expr; /* planned form of expression */ + bool is_valid; /* is the expression still valid? */ + /* remaining fields should be treated as private to plancache.c: */ + List *relationOids; /* OIDs of relations the expr depends on */ + List *invalItems; /* other dependencies, as PlanInvalItems */ + MemoryContext context; /* context containing this CachedExpression */ + dlist_node node; /* link in global list of CachedExpressions */ +} CachedExpression; + + +extern void InitPlanCache(void); +extern void ResetPlanCache(void); + +extern void ReleaseAllPlanCacheRefsInOwner(ResourceOwner owner); + +extern CachedPlanSource *CreateCachedPlan(struct RawStmt *raw_parse_tree, + const char *query_string, + CommandTag commandTag); +extern CachedPlanSource *CreateOneShotCachedPlan(struct RawStmt *raw_parse_tree, + const char *query_string, + CommandTag commandTag); +extern void CompleteCachedPlan(CachedPlanSource *plansource, + List *querytree_list, + MemoryContext querytree_context, + Oid *param_types, + int num_params, + ParserSetupHook parserSetup, + void *parserSetupArg, + int cursor_options, + bool fixed_result); + +extern void SaveCachedPlan(CachedPlanSource *plansource); +extern void DropCachedPlan(CachedPlanSource *plansource); + +extern void CachedPlanSetParentContext(CachedPlanSource *plansource, + MemoryContext newcontext); + +extern CachedPlanSource *CopyCachedPlan(CachedPlanSource *plansource); + +extern bool CachedPlanIsValid(CachedPlanSource *plansource); + +extern List *CachedPlanGetTargetList(CachedPlanSource *plansource, + QueryEnvironment *queryEnv); + +extern CachedPlan *GetCachedPlan(CachedPlanSource *plansource, + ParamListInfo boundParams, + ResourceOwner owner, + QueryEnvironment *queryEnv); +extern void ReleaseCachedPlan(CachedPlan *plan, ResourceOwner owner); + +extern bool CachedPlanAllowsSimpleValidityCheck(CachedPlanSource *plansource, + CachedPlan *plan, + ResourceOwner owner); +extern bool CachedPlanIsSimplyValid(CachedPlanSource *plansource, + CachedPlan *plan, + ResourceOwner owner); + +extern CachedExpression *GetCachedExpression(Node *expr); +extern void FreeCachedExpression(CachedExpression *cexpr); + +#endif /* PLANCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/portal.h b/platform/dbops/binaries/postgres/include/server/utils/portal.h new file mode 100644 index 0000000000000000000000000000000000000000..6c635150742eb01c8e4e979cbc82b75328c47c74 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/portal.h @@ -0,0 +1,252 @@ +/*------------------------------------------------------------------------- + * + * portal.h + * POSTGRES portal definitions. + * + * A portal is an abstraction which represents the execution state of + * a running or runnable query. Portals support both SQL-level CURSORs + * and protocol-level portals. + * + * Scrolling (nonsequential access) and suspension of execution are allowed + * only for portals that contain a single SELECT-type query. We do not want + * to let the client suspend an update-type query partway through! Because + * the query rewriter does not allow arbitrary ON SELECT rewrite rules, + * only queries that were originally update-type could produce multiple + * plan trees; so the restriction to a single query is not a problem + * in practice. + * + * For SQL cursors, we support three kinds of scroll behavior: + * + * (1) Neither NO SCROLL nor SCROLL was specified: to remain backward + * compatible, we allow backward fetches here, unless it would + * impose additional runtime overhead to do so. + * + * (2) NO SCROLL was specified: don't allow any backward fetches. + * + * (3) SCROLL was specified: allow all kinds of backward fetches, even + * if we need to take a performance hit to do so. (The planner sticks + * a Materialize node atop the query plan if needed.) + * + * Case #1 is converted to #2 or #3 by looking at the query itself and + * determining if scrollability can be supported without additional + * overhead. + * + * Protocol-level portals have no nonsequential-fetch API and so the + * distinction doesn't matter for them. They are always initialized + * to look like NO SCROLL cursors. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/portal.h + * + *------------------------------------------------------------------------- + */ +#ifndef PORTAL_H +#define PORTAL_H + +#include "datatype/timestamp.h" +#include "executor/execdesc.h" +#include "tcop/cmdtag.h" +#include "utils/plancache.h" +#include "utils/resowner.h" + +/* + * We have several execution strategies for Portals, depending on what + * query or queries are to be executed. (Note: in all cases, a Portal + * executes just a single source-SQL query, and thus produces just a + * single result from the user's viewpoint. However, the rule rewriter + * may expand the single source query to zero or many actual queries.) + * + * PORTAL_ONE_SELECT: the portal contains one single SELECT query. We run + * the Executor incrementally as results are demanded. This strategy also + * supports holdable cursors (the Executor results can be dumped into a + * tuplestore for access after transaction completion). + * + * PORTAL_ONE_RETURNING: the portal contains a single INSERT/UPDATE/DELETE/ + * MERGE query with a RETURNING clause (plus possibly auxiliary queries added + * by rule rewriting). On first execution, we run the portal to completion + * and dump the primary query's results into the portal tuplestore; the + * results are then returned to the client as demanded. (We can't support + * suspension of the query partway through, because the AFTER TRIGGER code + * can't cope, and also because we don't want to risk failing to execute + * all the auxiliary queries.) + * + * PORTAL_ONE_MOD_WITH: the portal contains one single SELECT query, but + * it has data-modifying CTEs. This is currently treated the same as the + * PORTAL_ONE_RETURNING case because of the possibility of needing to fire + * triggers. It may act more like PORTAL_ONE_SELECT in future. + * + * PORTAL_UTIL_SELECT: the portal contains a utility statement that returns + * a SELECT-like result (for example, EXPLAIN or SHOW). On first execution, + * we run the statement and dump its results into the portal tuplestore; + * the results are then returned to the client as demanded. + * + * PORTAL_MULTI_QUERY: all other cases. Here, we do not support partial + * execution: the portal's queries will be run to completion on first call. + */ +typedef enum PortalStrategy +{ + PORTAL_ONE_SELECT, + PORTAL_ONE_RETURNING, + PORTAL_ONE_MOD_WITH, + PORTAL_UTIL_SELECT, + PORTAL_MULTI_QUERY, +} PortalStrategy; + +/* + * A portal is always in one of these states. It is possible to transit + * from ACTIVE back to READY if the query is not run to completion; + * otherwise we never back up in status. + */ +typedef enum PortalStatus +{ + PORTAL_NEW, /* freshly created */ + PORTAL_DEFINED, /* PortalDefineQuery done */ + PORTAL_READY, /* PortalStart complete, can run it */ + PORTAL_ACTIVE, /* portal is running (can't delete it) */ + PORTAL_DONE, /* portal is finished (don't re-run it) */ + PORTAL_FAILED, /* portal got error (can't re-run it) */ +} PortalStatus; + +typedef struct PortalData *Portal; + +typedef struct PortalData +{ + /* Bookkeeping data */ + const char *name; /* portal's name */ + const char *prepStmtName; /* source prepared statement (NULL if none) */ + MemoryContext portalContext; /* subsidiary memory for portal */ + ResourceOwner resowner; /* resources owned by portal */ + void (*cleanup) (Portal portal); /* cleanup hook */ + + /* + * State data for remembering which subtransaction(s) the portal was + * created or used in. If the portal is held over from a previous + * transaction, both subxids are InvalidSubTransactionId. Otherwise, + * createSubid is the creating subxact and activeSubid is the last subxact + * in which we ran the portal. + */ + SubTransactionId createSubid; /* the creating subxact */ + SubTransactionId activeSubid; /* the last subxact with activity */ + int createLevel; /* creating subxact's nesting level */ + + /* The query or queries the portal will execute */ + const char *sourceText; /* text of query (as of 8.4, never NULL) */ + CommandTag commandTag; /* command tag for original query */ + QueryCompletion qc; /* command completion data for executed query */ + List *stmts; /* list of PlannedStmts */ + CachedPlan *cplan; /* CachedPlan, if stmts are from one */ + + ParamListInfo portalParams; /* params to pass to query */ + QueryEnvironment *queryEnv; /* environment for query */ + + /* Features/options */ + PortalStrategy strategy; /* see above */ + int cursorOptions; /* DECLARE CURSOR option bits */ + bool run_once; /* unused */ + + /* Status data */ + PortalStatus status; /* see above */ + bool portalPinned; /* a pinned portal can't be dropped */ + bool autoHeld; /* was automatically converted from pinned to + * held (see HoldPinnedPortals()) */ + + /* If not NULL, Executor is active; call ExecutorEnd eventually: */ + QueryDesc *queryDesc; /* info needed for executor invocation */ + + /* If portal returns tuples, this is their tupdesc: */ + TupleDesc tupDesc; /* descriptor for result tuples */ + /* and these are the format codes to use for the columns: */ + int16 *formats; /* a format code for each column */ + + /* + * Outermost ActiveSnapshot for execution of the portal's queries. For + * all but a few utility commands, we require such a snapshot to exist. + * This ensures that TOAST references in query results can be detoasted, + * and helps to reduce thrashing of the process's exposed xmin. + */ + Snapshot portalSnapshot; /* active snapshot, or NULL if none */ + + /* + * Where we store tuples for a held cursor or a PORTAL_ONE_RETURNING, + * PORTAL_ONE_MOD_WITH, or PORTAL_UTIL_SELECT query. (A cursor held past + * the end of its transaction no longer has any active executor state.) + */ + Tuplestorestate *holdStore; /* store for holdable cursors */ + MemoryContext holdContext; /* memory containing holdStore */ + + /* + * Snapshot under which tuples in the holdStore were read. We must keep a + * reference to this snapshot if there is any possibility that the tuples + * contain TOAST references, because releasing the snapshot could allow + * recently-dead rows to be vacuumed away, along with any toast data + * belonging to them. In the case of a held cursor, we avoid needing to + * keep such a snapshot by forcibly detoasting the data. + */ + Snapshot holdSnapshot; /* registered snapshot, or NULL if none */ + + /* + * atStart, atEnd and portalPos indicate the current cursor position. + * portalPos is zero before the first row, N after fetching N'th row of + * query. After we run off the end, portalPos = # of rows in query, and + * atEnd is true. Note that atStart implies portalPos == 0, but not the + * reverse: we might have backed up only as far as the first row, not to + * the start. Also note that various code inspects atStart and atEnd, but + * only the portal movement routines should touch portalPos. + */ + bool atStart; + bool atEnd; + uint64 portalPos; + + /* Presentation data, primarily used by the pg_cursors system view */ + TimestampTz creation_time; /* time at which this portal was defined */ + bool visible; /* include this portal in pg_cursors? */ +} PortalData; + +/* + * PortalIsValid + * True iff portal is valid. + */ +#define PortalIsValid(p) PointerIsValid(p) + + +/* Prototypes for functions in utils/mmgr/portalmem.c */ +extern void EnablePortalManager(void); +extern bool PreCommit_Portals(bool isPrepare); +extern void AtAbort_Portals(void); +extern void AtCleanup_Portals(void); +extern void PortalErrorCleanup(void); +extern void AtSubCommit_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + int parentLevel, + ResourceOwner parentXactOwner); +extern void AtSubAbort_Portals(SubTransactionId mySubid, + SubTransactionId parentSubid, + ResourceOwner myXactOwner, + ResourceOwner parentXactOwner); +extern void AtSubCleanup_Portals(SubTransactionId mySubid); +extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent); +extern Portal CreateNewPortal(void); +extern void PinPortal(Portal portal); +extern void UnpinPortal(Portal portal); +extern void MarkPortalActive(Portal portal); +extern void MarkPortalDone(Portal portal); +extern void MarkPortalFailed(Portal portal); +extern void PortalDrop(Portal portal, bool isTopCommit); +extern Portal GetPortalByName(const char *name); +extern void PortalDefineQuery(Portal portal, + const char *prepStmtName, + const char *sourceText, + CommandTag commandTag, + List *stmts, + CachedPlan *cplan); +extern PlannedStmt *PortalGetPrimaryStmt(Portal portal); +extern void PortalCreateHoldStore(Portal portal); +extern void PortalHashTableDeleteAll(void); +extern bool ThereAreNoReadyPortals(void); +extern void HoldPinnedPortals(void); +extern void ForgetPortalSnapshots(void); + +#endif /* PORTAL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/probes.h b/platform/dbops/binaries/postgres/include/server/utils/probes.h new file mode 100644 index 0000000000000000000000000000000000000000..f600a965d20a409d296041e30ce679d99bbd6998 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/probes.h @@ -0,0 +1,114 @@ +#define TRACE_POSTGRESQL_TRANSACTION_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_START_ENABLED() (0) +#define TRACE_POSTGRESQL_TRANSACTION_COMMIT(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_COMMIT_ENABLED() (0) +#define TRACE_POSTGRESQL_TRANSACTION_ABORT(INT1) do {} while (0) +#define TRACE_POSTGRESQL_TRANSACTION_ABORT_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_RELEASE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_RELEASE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_START(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_WAIT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_ENABLED() (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL_ENABLED() (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_DONE(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_LOCK_WAIT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PARSE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_REWRITE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_START() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_DONE() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_PLAN_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_START() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE() do {} while (0) +#define TRACE_POSTGRESQL_QUERY_EXECUTE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_START_ENABLED() (0) +#define TRACE_POSTGRESQL_QUERY_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_QUERY_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_STATEMENT_STATUS(INT1) do {} while (0) +#define TRACE_POSTGRESQL_STATEMENT_STATUS_ENABLED() (0) +#define TRACE_POSTGRESQL_SORT_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SORT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SORT_DONE(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_SORT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_READ_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_READ_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_READ_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_START(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_FLUSH_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_EXTEND_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START() do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE() do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_START(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_START_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(INT1) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE(INT1, INT2, INT3) do {} while (0) +#define TRACE_POSTGRESQL_BUFFER_SYNC_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_DEADLOCK_FOUND() do {} while (0) +#define TRACE_POSTGRESQL_DEADLOCK_FOUND_ENABLED() (0) +#define TRACE_POSTGRESQL_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_CHECKPOINT_DONE(INT1, INT2, INT3, INT4, INT5) do {} while (0) +#define TRACE_POSTGRESQL_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START(INT1) do {} while (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE(INT1) do {} while (0) +#define TRACE_POSTGRESQL_MULTIXACT_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START() do {} while (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_START_ENABLED() (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE() do {} while (0) +#define TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_READ_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START(INT1, INT2, INT3, INT4, INT5, INT6) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_START_ENABLED() (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8) do {} while (0) +#define TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_INSERT(INT1, INT2) do {} while (0) +#define TRACE_POSTGRESQL_WAL_INSERT_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_SWITCH() do {} while (0) +#define TRACE_POSTGRESQL_WAL_SWITCH_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START() do {} while (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START_ENABLED() (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE() do {} while (0) +#define TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_DONE_ENABLED() (0) diff --git a/platform/dbops/binaries/postgres/include/server/utils/ps_status.h b/platform/dbops/binaries/postgres/include/server/utils/ps_status.h new file mode 100644 index 0000000000000000000000000000000000000000..ff5a2b2b8a2274c562c3b2ef62d0011d3591a0b4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/ps_status.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * ps_status.h + * + * Declarations for backend/utils/misc/ps_status.c + * + * src/include/utils/ps_status.h + * + *------------------------------------------------------------------------- + */ + +#ifndef PS_STATUS_H +#define PS_STATUS_H + +/* disabled on Windows as the performance overhead can be significant */ +#ifdef WIN32 +#define DEFAULT_UPDATE_PROCESS_TITLE false +#else +#define DEFAULT_UPDATE_PROCESS_TITLE true +#endif + +extern PGDLLIMPORT bool update_process_title; + +extern char **save_ps_display_args(int argc, char **argv); + +extern void init_ps_display(const char *fixed_part); + +extern void set_ps_display_suffix(const char *suffix); + +extern void set_ps_display_remove_suffix(void); + +extern void set_ps_display_with_len(const char *activity, size_t len); + +/* + * set_ps_display + * inlined to allow strlen to be evaluated during compilation when + * passing string constants. + */ +static inline void +set_ps_display(const char *activity) +{ + set_ps_display_with_len(activity, strlen(activity)); +} + +extern const char *get_ps_display(int *displen); + +#endif /* PS_STATUS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/queryenvironment.h b/platform/dbops/binaries/postgres/include/server/utils/queryenvironment.h new file mode 100644 index 0000000000000000000000000000000000000000..10a9b6d553017d3cc56a58d8964ae5151db42985 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/queryenvironment.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------------------------- + * + * queryenvironment.h + * Access to functions to mutate the query environment and retrieve the + * actual data related to entries (if any). + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/queryenvironment.h + * + *------------------------------------------------------------------------- + */ +#ifndef QUERYENVIRONMENT_H +#define QUERYENVIRONMENT_H + +#include "access/tupdesc.h" + + +typedef enum EphemeralNameRelationType +{ + ENR_NAMED_TUPLESTORE, /* named tuplestore relation; e.g., deltas */ +} EphemeralNameRelationType; + +/* + * Some ephemeral named relations must match some relation (e.g., trigger + * transition tables), so to properly handle cached plans and DDL, we should + * carry the OID of that relation. In other cases an ENR might be independent + * of any relation which is stored in the system catalogs, so we need to be + * able to directly store the TupleDesc. We never need both. + */ +typedef struct EphemeralNamedRelationMetadataData +{ + char *name; /* name used to identify the relation */ + + /* only one of the next two fields should be used */ + Oid reliddesc; /* oid of relation to get tupdesc */ + TupleDesc tupdesc; /* description of result rows */ + + EphemeralNameRelationType enrtype; /* to identify type of relation */ + double enrtuples; /* estimated number of tuples */ +} EphemeralNamedRelationMetadataData; + +typedef EphemeralNamedRelationMetadataData *EphemeralNamedRelationMetadata; + +/* + * Ephemeral Named Relation data; used for parsing named relations not in the + * catalog, like transition tables in AFTER triggers. + */ +typedef struct EphemeralNamedRelationData +{ + EphemeralNamedRelationMetadataData md; + void *reldata; /* structure for execution-time access to data */ +} EphemeralNamedRelationData; + +typedef EphemeralNamedRelationData *EphemeralNamedRelation; + +/* + * This is an opaque structure outside of queryenvironment.c itself. The + * intention is to be able to change the implementation or add new context + * features without needing to change existing code for use of existing + * features. + */ +typedef struct QueryEnvironment QueryEnvironment; + + +extern QueryEnvironment *create_queryEnv(void); +extern EphemeralNamedRelationMetadata get_visible_ENR_metadata(QueryEnvironment *queryEnv, const char *refname); +extern void register_ENR(QueryEnvironment *queryEnv, EphemeralNamedRelation enr); +extern void unregister_ENR(QueryEnvironment *queryEnv, const char *name); +extern EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name); +extern TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd); + +#endif /* QUERYENVIRONMENT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/rangetypes.h b/platform/dbops/binaries/postgres/include/server/utils/rangetypes.h new file mode 100644 index 0000000000000000000000000000000000000000..2b574873cefdeadfacd13dcdac2027c91264df8b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/rangetypes.h @@ -0,0 +1,168 @@ +/*------------------------------------------------------------------------- + * + * rangetypes.h + * Declarations for Postgres range types. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/rangetypes.h + * + *------------------------------------------------------------------------- + */ +#ifndef RANGETYPES_H +#define RANGETYPES_H + +#include "utils/typcache.h" + + +/* + * Ranges are varlena objects, so must meet the varlena convention that + * the first int32 of the object contains the total object size in bytes. + * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + Oid rangetypid; /* range type's own OID */ + /* Following the OID are zero to two bound values, then a flags byte */ +} RangeType; + +#define RANGE_EMPTY_LITERAL "empty" + +/* Use this macro in preference to fetching rangetypid field directly */ +#define RangeTypeGetOid(r) ((r)->rangetypid) + +/* A range's flags byte contains these bits: */ +#define RANGE_EMPTY 0x01 /* range is empty */ +#define RANGE_LB_INC 0x02 /* lower bound is inclusive */ +#define RANGE_UB_INC 0x04 /* upper bound is inclusive */ +#define RANGE_LB_INF 0x08 /* lower bound is -infinity */ +#define RANGE_UB_INF 0x10 /* upper bound is +infinity */ +#define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */ +#define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */ +#define RANGE_CONTAIN_EMPTY 0x80 /* marks a GiST internal-page entry whose + * subtree contains some empty ranges */ + +#define RANGE_HAS_LBOUND(flags) (!((flags) & (RANGE_EMPTY | \ + RANGE_LB_NULL | \ + RANGE_LB_INF))) + +#define RANGE_HAS_UBOUND(flags) (!((flags) & (RANGE_EMPTY | \ + RANGE_UB_NULL | \ + RANGE_UB_INF))) + +#define RangeIsEmpty(r) ((range_get_flags(r) & RANGE_EMPTY) != 0) +#define RangeIsOrContainsEmpty(r) \ + ((range_get_flags(r) & (RANGE_EMPTY | RANGE_CONTAIN_EMPTY)) != 0) + + +/* Internal representation of either bound of a range (not what's on disk) */ +typedef struct +{ + Datum val; /* the bound value, if any */ + bool infinite; /* bound is +/- infinity */ + bool inclusive; /* bound is inclusive (vs exclusive) */ + bool lower; /* this is the lower (vs upper) bound */ +} RangeBound; + +/* + * fmgr functions for range type objects + */ +static inline RangeType * +DatumGetRangeTypeP(Datum X) +{ + return (RangeType *) PG_DETOAST_DATUM(X); +} + +static inline RangeType * +DatumGetRangeTypePCopy(Datum X) +{ + return (RangeType *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +RangeTypePGetDatum(const RangeType *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_RANGE_P(n) DatumGetRangeTypeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_RANGE_P_COPY(n) DatumGetRangeTypePCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_RANGE_P(x) return RangeTypePGetDatum(x) + +/* Operator strategy numbers used in the GiST and SP-GiST range opclasses */ +/* Numbers are chosen to match up operator names with existing usages */ +#define RANGESTRAT_BEFORE RTLeftStrategyNumber +#define RANGESTRAT_OVERLEFT RTOverLeftStrategyNumber +#define RANGESTRAT_OVERLAPS RTOverlapStrategyNumber +#define RANGESTRAT_OVERRIGHT RTOverRightStrategyNumber +#define RANGESTRAT_AFTER RTRightStrategyNumber +#define RANGESTRAT_ADJACENT RTSameStrategyNumber +#define RANGESTRAT_CONTAINS RTContainsStrategyNumber +#define RANGESTRAT_CONTAINED_BY RTContainedByStrategyNumber +#define RANGESTRAT_CONTAINS_ELEM RTContainsElemStrategyNumber +#define RANGESTRAT_EQ RTEqualStrategyNumber + +/* + * prototypes for functions defined in rangetypes.c + */ + +extern bool range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val); + +/* internal versions of the above */ +extern bool range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_ne_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_before_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_after_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern bool range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); +extern RangeType *range_union_internal(TypeCacheEntry *typcache, RangeType *r1, + RangeType *r2, bool strict); +extern RangeType *range_minus_internal(TypeCacheEntry *typcache, RangeType *r1, + RangeType *r2); +extern RangeType *range_intersect_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2); + +/* assorted support functions */ +extern TypeCacheEntry *range_get_typcache(FunctionCallInfo fcinfo, + Oid rngtypid); +extern RangeType *range_serialize(TypeCacheEntry *typcache, RangeBound *lower, + RangeBound *upper, bool empty, + struct Node *escontext); +extern void range_deserialize(TypeCacheEntry *typcache, const RangeType *range, + RangeBound *lower, RangeBound *upper, + bool *empty); +extern char range_get_flags(const RangeType *range); +extern void range_set_contain_empty(RangeType *range); +extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower, + RangeBound *upper, bool empty, + struct Node *escontext); +extern int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, + const RangeBound *b2); +extern int range_cmp_bound_values(TypeCacheEntry *typcache, const RangeBound *b1, + const RangeBound *b2); +extern int range_compare(const void *key1, const void *key2, void *arg); +extern bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, + RangeBound boundB); +extern RangeType *make_empty_range(TypeCacheEntry *typcache); +extern bool range_split_internal(TypeCacheEntry *typcache, const RangeType *r1, + const RangeType *r2, RangeType **output1, + RangeType **output2); + +#endif /* RANGETYPES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/regproc.h b/platform/dbops/binaries/postgres/include/server/utils/regproc.h new file mode 100644 index 0000000000000000000000000000000000000000..53e0298fb307a9b9b6f51c84e892fade60b1daa0 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/regproc.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * regproc.h + * Functions for the built-in types regproc, regclass, regtype, etc. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/regproc.h + * + *------------------------------------------------------------------------- + */ +#ifndef REGPROC_H +#define REGPROC_H + +#include "nodes/pg_list.h" + +/* Control flags for format_procedure_extended */ +#define FORMAT_PROC_INVALID_AS_NULL 0x01 /* NULL if undefined */ +#define FORMAT_PROC_FORCE_QUALIFY 0x02 /* force qualification */ +extern char *format_procedure_extended(Oid procedure_oid, bits16 flags); + +/* Control flags for format_operator_extended */ +#define FORMAT_OPERATOR_INVALID_AS_NULL 0x01 /* NULL if undefined */ +#define FORMAT_OPERATOR_FORCE_QUALIFY 0x02 /* force qualification */ +extern char *format_operator_extended(Oid operator_oid, bits16 flags); + +extern List *stringToQualifiedNameList(const char *string, Node *escontext); +extern char *format_procedure(Oid procedure_oid); +extern char *format_procedure_qualified(Oid procedure_oid); +extern void format_procedure_parts(Oid procedure_oid, List **objnames, + List **objargs, bool missing_ok); + +extern char *format_operator(Oid operator_oid); +extern char *format_operator_qualified(Oid operator_oid); +extern void format_operator_parts(Oid operator_oid, List **objnames, + List **objargs, bool missing_ok); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/rel.h b/platform/dbops/binaries/postgres/include/server/utils/rel.h new file mode 100644 index 0000000000000000000000000000000000000000..87002049538a8990aa64a9814a4e3a88dd350eea --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/rel.h @@ -0,0 +1,711 @@ +/*------------------------------------------------------------------------- + * + * rel.h + * POSTGRES relation descriptor (a/k/a relcache entry) definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/rel.h + * + *------------------------------------------------------------------------- + */ +#ifndef REL_H +#define REL_H + +#include "access/tupdesc.h" +#include "access/xlog.h" +#include "catalog/catalog.h" +#include "catalog/pg_class.h" +#include "catalog/pg_index.h" +#include "catalog/pg_publication.h" +#include "nodes/bitmapset.h" +#include "partitioning/partdefs.h" +#include "rewrite/prs2lock.h" +#include "storage/block.h" +#include "storage/relfilelocator.h" +#include "storage/smgr.h" +#include "utils/relcache.h" +#include "utils/reltrigger.h" + + +/* + * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient + * to declare them here so we can have a LockInfoData field in a Relation. + */ + +typedef struct LockRelId +{ + Oid relId; /* a relation identifier */ + Oid dbId; /* a database identifier */ +} LockRelId; + +typedef struct LockInfoData +{ + LockRelId lockRelId; +} LockInfoData; + +typedef LockInfoData *LockInfo; + +/* + * Here are the contents of a relation cache entry. + */ + +typedef struct RelationData +{ + RelFileLocator rd_locator; /* relation physical identifier */ + SMgrRelation rd_smgr; /* cached file handle, or NULL */ + int rd_refcnt; /* reference count */ + ProcNumber rd_backend; /* owning backend's proc number, if temp rel */ + bool rd_islocaltemp; /* rel is a temp rel of this session */ + bool rd_isnailed; /* rel is nailed in cache */ + bool rd_isvalid; /* relcache entry is valid */ + bool rd_indexvalid; /* is rd_indexlist valid? (also rd_pkindex and + * rd_replidindex) */ + bool rd_statvalid; /* is rd_statlist valid? */ + + /*---------- + * rd_createSubid is the ID of the highest subtransaction the rel has + * survived into or zero if the rel or its storage was created before the + * current top transaction. (IndexStmt.oldNumber leads to the case of a new + * rel with an old rd_locator.) rd_firstRelfilelocatorSubid is the ID of the + * highest subtransaction an rd_locator change has survived into or zero if + * rd_locator matches the value it had at the start of the current top + * transaction. (Rolling back the subtransaction that + * rd_firstRelfilelocatorSubid denotes would restore rd_locator to the value it + * had at the start of the current top transaction. Rolling back any + * lower subtransaction would not.) Their accuracy is critical to + * RelationNeedsWAL(). + * + * rd_newRelfilelocatorSubid is the ID of the highest subtransaction the + * most-recent relfilenumber change has survived into or zero if not changed + * in the current transaction (or we have forgotten changing it). This + * field is accurate when non-zero, but it can be zero when a relation has + * multiple new relfilenumbers within a single transaction, with one of them + * occurring in a subsequently aborted subtransaction, e.g. + * BEGIN; + * TRUNCATE t; + * SAVEPOINT save; + * TRUNCATE t; + * ROLLBACK TO save; + * -- rd_newRelfilelocatorSubid is now forgotten + * + * If every rd_*Subid field is zero, they are read-only outside + * relcache.c. Files that trigger rd_locator changes by updating + * pg_class.reltablespace and/or pg_class.relfilenode call + * RelationAssumeNewRelfilelocator() to update rd_*Subid. + * + * rd_droppedSubid is the ID of the highest subtransaction that a drop of + * the rel has survived into. In entries visible outside relcache.c, this + * is always zero. + */ + SubTransactionId rd_createSubid; /* rel was created in current xact */ + SubTransactionId rd_newRelfilelocatorSubid; /* highest subxact changing + * rd_locator to current value */ + SubTransactionId rd_firstRelfilelocatorSubid; /* highest subxact + * changing rd_locator to + * any value */ + SubTransactionId rd_droppedSubid; /* dropped with another Subid set */ + + Form_pg_class rd_rel; /* RELATION tuple */ + TupleDesc rd_att; /* tuple descriptor */ + Oid rd_id; /* relation's object id */ + LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */ + RuleLock *rd_rules; /* rewrite rules */ + MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */ + TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */ + /* use "struct" here to avoid needing to include rowsecurity.h: */ + struct RowSecurityDesc *rd_rsdesc; /* row security policies, or NULL */ + + /* data managed by RelationGetFKeyList: */ + List *rd_fkeylist; /* list of ForeignKeyCacheInfo (see below) */ + bool rd_fkeyvalid; /* true if list has been computed */ + + /* data managed by RelationGetPartitionKey: */ + PartitionKey rd_partkey; /* partition key, or NULL */ + MemoryContext rd_partkeycxt; /* private context for rd_partkey, if any */ + + /* data managed by RelationGetPartitionDesc: */ + PartitionDesc rd_partdesc; /* partition descriptor, or NULL */ + MemoryContext rd_pdcxt; /* private context for rd_partdesc, if any */ + + /* Same as above, for partdescs that omit detached partitions */ + PartitionDesc rd_partdesc_nodetached; /* partdesc w/o detached parts */ + MemoryContext rd_pddcxt; /* for rd_partdesc_nodetached, if any */ + + /* + * pg_inherits.xmin of the partition that was excluded in + * rd_partdesc_nodetached. This informs a future user of that partdesc: + * if this value is not in progress for the active snapshot, then the + * partdesc can be used, otherwise they have to build a new one. (This + * matches what find_inheritance_children_extended would do). + */ + TransactionId rd_partdesc_nodetached_xmin; + + /* data managed by RelationGetPartitionQual: */ + List *rd_partcheck; /* partition CHECK quals */ + bool rd_partcheckvalid; /* true if list has been computed */ + MemoryContext rd_partcheckcxt; /* private cxt for rd_partcheck, if any */ + + /* data managed by RelationGetIndexList: */ + List *rd_indexlist; /* list of OIDs of indexes on relation */ + Oid rd_pkindex; /* OID of (deferrable?) primary key, if any */ + bool rd_ispkdeferrable; /* is rd_pkindex a deferrable PK? */ + Oid rd_replidindex; /* OID of replica identity index, if any */ + + /* data managed by RelationGetStatExtList: */ + List *rd_statlist; /* list of OIDs of extended stats */ + + /* data managed by RelationGetIndexAttrBitmap: */ + bool rd_attrsvalid; /* are bitmaps of attrs valid? */ + Bitmapset *rd_keyattr; /* cols that can be ref'd by foreign keys */ + Bitmapset *rd_pkattr; /* cols included in primary key */ + Bitmapset *rd_idattr; /* included in replica identity index */ + Bitmapset *rd_hotblockingattr; /* cols blocking HOT update */ + Bitmapset *rd_summarizedattr; /* cols indexed by summarizing indexes */ + + PublicationDesc *rd_pubdesc; /* publication descriptor, or NULL */ + + /* + * rd_options is set whenever rd_rel is loaded into the relcache entry. + * Note that you can NOT look into rd_rel for this data. NULL means "use + * defaults". + */ + bytea *rd_options; /* parsed pg_class.reloptions */ + + /* + * Oid of the handler for this relation. For an index this is a function + * returning IndexAmRoutine, for table like relations a function returning + * TableAmRoutine. This is stored separately from rd_indam, rd_tableam as + * its lookup requires syscache access, but during relcache bootstrap we + * need to be able to initialize rd_tableam without syscache lookups. + */ + Oid rd_amhandler; /* OID of index AM's handler function */ + + /* + * Table access method. + */ + const struct TableAmRoutine *rd_tableam; + + /* These are non-NULL only for an index relation: */ + Form_pg_index rd_index; /* pg_index tuple describing this index */ + /* use "struct" here to avoid needing to include htup.h: */ + struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */ + + /* + * index access support info (used only for an index relation) + * + * Note: only default support procs for each opclass are cached, namely + * those with lefttype and righttype equal to the opclass's opcintype. The + * arrays are indexed by support function number, which is a sufficient + * identifier given that restriction. + */ + MemoryContext rd_indexcxt; /* private memory cxt for this stuff */ + /* use "struct" here to avoid needing to include amapi.h: */ + struct IndexAmRoutine *rd_indam; /* index AM's API struct */ + Oid *rd_opfamily; /* OIDs of op families for each index col */ + Oid *rd_opcintype; /* OIDs of opclass declared input data types */ + RegProcedure *rd_support; /* OIDs of support procedures */ + struct FmgrInfo *rd_supportinfo; /* lookup info for support procedures */ + int16 *rd_indoption; /* per-column AM-specific flags */ + List *rd_indexprs; /* index expression trees, if any */ + List *rd_indpred; /* index predicate tree, if any */ + Oid *rd_exclops; /* OIDs of exclusion operators, if any */ + Oid *rd_exclprocs; /* OIDs of exclusion ops' procs, if any */ + uint16 *rd_exclstrats; /* exclusion ops' strategy numbers, if any */ + Oid *rd_indcollation; /* OIDs of index collations */ + bytea **rd_opcoptions; /* parsed opclass-specific options */ + + /* + * rd_amcache is available for index and table AMs to cache private data + * about the relation. This must be just a cache since it may get reset + * at any time (in particular, it will get reset by a relcache inval + * message for the relation). If used, it must point to a single memory + * chunk palloc'd in CacheMemoryContext, or in rd_indexcxt for an index + * relation. A relcache reset will include freeing that chunk and setting + * rd_amcache = NULL. + */ + void *rd_amcache; /* available for use by index/table AM */ + + /* + * foreign-table support + * + * rd_fdwroutine must point to a single memory chunk palloc'd in + * CacheMemoryContext. It will be freed and reset to NULL on a relcache + * reset. + */ + + /* use "struct" here to avoid needing to include fdwapi.h: */ + struct FdwRoutine *rd_fdwroutine; /* cached function pointers, or NULL */ + + /* + * Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new + * version of a table, we need to make any toast pointers inserted into it + * have the existing toast table's OID, not the OID of the transient toast + * table. If rd_toastoid isn't InvalidOid, it is the OID to place in + * toast pointers inserted into this rel. (Note it's set on the new + * version of the main heap, not the toast table itself.) This also + * causes toast_save_datum() to try to preserve toast value OIDs. + */ + Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */ + + bool pgstat_enabled; /* should relation stats be counted */ + /* use "struct" here to avoid needing to include pgstat.h: */ + struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ +} RelationData; + + +/* + * ForeignKeyCacheInfo + * Information the relcache can cache about foreign key constraints + * + * This is basically just an image of relevant columns from pg_constraint. + * We make it a subclass of Node so that copyObject() can be used on a list + * of these, but we also ensure it is a "flat" object without substructure, + * so that list_free_deep() is sufficient to free such a list. + * The per-FK-column arrays can be fixed-size because we allow at most + * INDEX_MAX_KEYS columns in a foreign key constraint. + * + * Currently, we mostly cache fields of interest to the planner, but the set + * of fields has already grown the constraint OID for other uses. + */ +typedef struct ForeignKeyCacheInfo +{ + pg_node_attr(no_equal, no_read, no_query_jumble) + + NodeTag type; + /* oid of the constraint itself */ + Oid conoid; + /* relation constrained by the foreign key */ + Oid conrelid; + /* relation referenced by the foreign key */ + Oid confrelid; + /* number of columns in the foreign key */ + int nkeys; + + /* + * these arrays each have nkeys valid entries: + */ + /* cols in referencing table */ + AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* cols in referenced table */ + AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); + /* PK = FK operator OIDs */ + Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys)); +} ForeignKeyCacheInfo; + + +/* + * StdRdOptions + * Standard contents of rd_options for heaps. + * + * RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only + * be applied to relations that use this format or a superset for + * private options data. + */ + /* autovacuum-related reloptions. */ +typedef struct AutoVacOpts +{ + bool enabled; + int vacuum_threshold; + int vacuum_ins_threshold; + int analyze_threshold; + int vacuum_cost_limit; + int freeze_min_age; + int freeze_max_age; + int freeze_table_age; + int multixact_freeze_min_age; + int multixact_freeze_max_age; + int multixact_freeze_table_age; + int log_min_duration; + float8 vacuum_cost_delay; + float8 vacuum_scale_factor; + float8 vacuum_ins_scale_factor; + float8 analyze_scale_factor; +} AutoVacOpts; + +/* StdRdOptions->vacuum_index_cleanup values */ +typedef enum StdRdOptIndexCleanup +{ + STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0, + STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF, + STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON, +} StdRdOptIndexCleanup; + +typedef struct StdRdOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int fillfactor; /* page fill factor in percent (0..100) */ + int toast_tuple_target; /* target for tuple toasting */ + AutoVacOpts autovacuum; /* autovacuum-related options */ + bool user_catalog_table; /* use as an additional catalog relation */ + int parallel_workers; /* max number of parallel workers */ + StdRdOptIndexCleanup vacuum_index_cleanup; /* controls index vacuuming */ + bool vacuum_truncate; /* enables vacuum to truncate a relation */ +} StdRdOptions; + +#define HEAP_MIN_FILLFACTOR 10 +#define HEAP_DEFAULT_FILLFACTOR 100 + +/* + * RelationGetToastTupleTarget + * Returns the relation's toast_tuple_target. Note multiple eval of argument! + */ +#define RelationGetToastTupleTarget(relation, defaulttarg) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg)) + +/* + * RelationGetFillFactor + * Returns the relation's fillfactor. Note multiple eval of argument! + */ +#define RelationGetFillFactor(relation, defaultff) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff)) + +/* + * RelationGetTargetPageUsage + * Returns the relation's desired space usage per page in bytes. + */ +#define RelationGetTargetPageUsage(relation, defaultff) \ + (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100) + +/* + * RelationGetTargetPageFreeSpace + * Returns the relation's desired freespace per page in bytes. + */ +#define RelationGetTargetPageFreeSpace(relation, defaultff) \ + (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100) + +/* + * RelationIsUsedAsCatalogTable + * Returns whether the relation should be treated as a catalog table + * from the pov of logical decoding. Note multiple eval of argument! + */ +#define RelationIsUsedAsCatalogTable(relation) \ + ((relation)->rd_options && \ + ((relation)->rd_rel->relkind == RELKIND_RELATION || \ + (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \ + ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false) + +/* + * RelationGetParallelWorkers + * Returns the relation's parallel_workers reloption setting. + * Note multiple eval of argument! + */ +#define RelationGetParallelWorkers(relation, defaultpw) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw)) + +/* ViewOptions->check_option values */ +typedef enum ViewOptCheckOption +{ + VIEW_OPTION_CHECK_OPTION_NOT_SET, + VIEW_OPTION_CHECK_OPTION_LOCAL, + VIEW_OPTION_CHECK_OPTION_CASCADED, +} ViewOptCheckOption; + +/* + * ViewOptions + * Contents of rd_options for views + */ +typedef struct ViewOptions +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + bool security_barrier; + bool security_invoker; + ViewOptCheckOption check_option; +} ViewOptions; + +/* + * RelationIsSecurityView + * Returns whether the relation is security view, or not. Note multiple + * eval of argument! + */ +#define RelationIsSecurityView(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options ? \ + ((ViewOptions *) (relation)->rd_options)->security_barrier : false) + +/* + * RelationHasSecurityInvoker + * Returns true if the relation has the security_invoker property set. + * Note multiple eval of argument! + */ +#define RelationHasSecurityInvoker(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options ? \ + ((ViewOptions *) (relation)->rd_options)->security_invoker : false) + +/* + * RelationHasCheckOption + * Returns true if the relation is a view defined with either the local + * or the cascaded check option. Note multiple eval of argument! + */ +#define RelationHasCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option != \ + VIEW_OPTION_CHECK_OPTION_NOT_SET) + +/* + * RelationHasLocalCheckOption + * Returns true if the relation is a view defined with the local check + * option. Note multiple eval of argument! + */ +#define RelationHasLocalCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option == \ + VIEW_OPTION_CHECK_OPTION_LOCAL) + +/* + * RelationHasCascadedCheckOption + * Returns true if the relation is a view defined with the cascaded check + * option. Note multiple eval of argument! + */ +#define RelationHasCascadedCheckOption(relation) \ + (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \ + (relation)->rd_options && \ + ((ViewOptions *) (relation)->rd_options)->check_option == \ + VIEW_OPTION_CHECK_OPTION_CASCADED) + +/* + * RelationIsValid + * True iff relation descriptor is valid. + */ +#define RelationIsValid(relation) PointerIsValid(relation) + +#define InvalidRelation ((Relation) NULL) + +/* + * RelationHasReferenceCountZero + * True iff relation reference count is zero. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationHasReferenceCountZero(relation) \ + ((bool)((relation)->rd_refcnt == 0)) + +/* + * RelationGetForm + * Returns pg_class tuple for a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetForm(relation) ((relation)->rd_rel) + +/* + * RelationGetRelid + * Returns the OID of the relation + */ +#define RelationGetRelid(relation) ((relation)->rd_id) + +/* + * RelationGetNumberOfAttributes + * Returns the total number of attributes in a relation. + */ +#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) + +/* + * IndexRelationGetNumberOfAttributes + * Returns the number of attributes in an index. + */ +#define IndexRelationGetNumberOfAttributes(relation) \ + ((relation)->rd_index->indnatts) + +/* + * IndexRelationGetNumberOfKeyAttributes + * Returns the number of key attributes in an index. + */ +#define IndexRelationGetNumberOfKeyAttributes(relation) \ + ((relation)->rd_index->indnkeyatts) + +/* + * RelationGetDescr + * Returns tuple descriptor for a relation. + */ +#define RelationGetDescr(relation) ((relation)->rd_att) + +/* + * RelationGetRelationName + * Returns the rel's name. + * + * Note that the name is only unique within the containing namespace. + */ +#define RelationGetRelationName(relation) \ + (NameStr((relation)->rd_rel->relname)) + +/* + * RelationGetNamespace + * Returns the rel's namespace OID. + */ +#define RelationGetNamespace(relation) \ + ((relation)->rd_rel->relnamespace) + +/* + * RelationIsMapped + * True if the relation uses the relfilenumber map. Note multiple eval + * of argument! + */ +#define RelationIsMapped(relation) \ + (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \ + ((relation)->rd_rel->relfilenode == InvalidRelFileNumber)) + +#ifndef FRONTEND +/* + * RelationGetSmgr + * Returns smgr file handle for a relation, opening it if needed. + * + * Very little code is authorized to touch rel->rd_smgr directly. Instead + * use this function to fetch its value. + */ +static inline SMgrRelation +RelationGetSmgr(Relation rel) +{ + if (unlikely(rel->rd_smgr == NULL)) + { + rel->rd_smgr = smgropen(rel->rd_locator, rel->rd_backend); + smgrpin(rel->rd_smgr); + } + return rel->rd_smgr; +} + +/* + * RelationCloseSmgr + * Close the relation at the smgr level, if not already done. + */ +static inline void +RelationCloseSmgr(Relation relation) +{ + if (relation->rd_smgr != NULL) + { + smgrunpin(relation->rd_smgr); + smgrclose(relation->rd_smgr); + relation->rd_smgr = NULL; + } +} +#endif /* !FRONTEND */ + +/* + * RelationGetTargetBlock + * Fetch relation's current insertion target block. + * + * Returns InvalidBlockNumber if there is no current target block. Note + * that the target block status is discarded on any smgr-level invalidation, + * so there's no need to re-open the smgr handle if it's not currently open. + */ +#define RelationGetTargetBlock(relation) \ + ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber ) + +/* + * RelationSetTargetBlock + * Set relation's current insertion target block. + */ +#define RelationSetTargetBlock(relation, targblock) \ + do { \ + RelationGetSmgr(relation)->smgr_targblock = (targblock); \ + } while (0) + +/* + * RelationIsPermanent + * True if relation is permanent. + */ +#define RelationIsPermanent(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT) + +/* + * RelationNeedsWAL + * True if relation needs WAL. + * + * Returns false if wal_level = minimal and this relation is created or + * truncated in the current transaction. See "Skipping WAL for New + * RelFileLocator" in src/backend/access/transam/README. + */ +#define RelationNeedsWAL(relation) \ + (RelationIsPermanent(relation) && (XLogIsNeeded() || \ + (relation->rd_createSubid == InvalidSubTransactionId && \ + relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId))) + +/* + * RelationUsesLocalBuffers + * True if relation's pages are stored in local buffers. + */ +#define RelationUsesLocalBuffers(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP) + +/* + * RELATION_IS_LOCAL + * If a rel is either temp or newly created in the current transaction, + * it can be assumed to be accessible only to the current backend. + * This is typically used to decide that we can skip acquiring locks. + * + * Beware of multiple eval of argument + */ +#define RELATION_IS_LOCAL(relation) \ + ((relation)->rd_islocaltemp || \ + (relation)->rd_createSubid != InvalidSubTransactionId) + +/* + * RELATION_IS_OTHER_TEMP + * Test for a temporary relation that belongs to some other session. + * + * Beware of multiple eval of argument + */ +#define RELATION_IS_OTHER_TEMP(relation) \ + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \ + !(relation)->rd_islocaltemp) + + +/* + * RelationIsScannable + * Currently can only be false for a materialized view which has not been + * populated by its query. This is likely to get more complicated later, + * so use a macro which looks like a function. + */ +#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated) + +/* + * RelationIsPopulated + * Currently, we don't physically distinguish the "populated" and + * "scannable" properties of matviews, but that may change later. + * Hence, use the appropriate one of these macros in code tests. + */ +#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated) + +/* + * RelationIsAccessibleInLogicalDecoding + * True if we need to log enough information to have access via + * decoding snapshot. + */ +#define RelationIsAccessibleInLogicalDecoding(relation) \ + (XLogLogicalInfoActive() && \ + RelationNeedsWAL(relation) && \ + (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation))) + +/* + * RelationIsLogicallyLogged + * True if we need to log enough information to extract the data from the + * WAL stream. + * + * We don't log information for unlogged tables (since they don't WAL log + * anyway), for foreign tables (since they don't WAL log, either), + * and for system tables (their content is hard to make sense of, and + * it would complicate decoding slightly for little gain). Note that we *do* + * log information for user defined catalog tables since they presumably are + * interesting to the user... + */ +#define RelationIsLogicallyLogged(relation) \ + (XLogLogicalInfoActive() && \ + RelationNeedsWAL(relation) && \ + (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \ + !IsCatalogRelation(relation)) + +/* routines in utils/cache/relcache.c */ +extern void RelationIncrementReferenceCount(Relation rel); +extern void RelationDecrementReferenceCount(Relation rel); + +#endif /* REL_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/relcache.h b/platform/dbops/binaries/postgres/include/server/utils/relcache.h new file mode 100644 index 0000000000000000000000000000000000000000..18c32ea7008d404c3935bb8652ee0f0459264bfe --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/relcache.h @@ -0,0 +1,155 @@ +/*------------------------------------------------------------------------- + * + * relcache.h + * Relation descriptor cache definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELCACHE_H +#define RELCACHE_H + +#include "access/tupdesc.h" +#include "common/relpath.h" +#include "nodes/bitmapset.h" + + +/* + * Name of relcache init file(s), used to speed up backend startup + */ +#define RELCACHE_INIT_FILENAME "pg_internal.init" + +typedef struct RelationData *Relation; + +/* ---------------- + * RelationPtr is used in the executor to support index scans + * where we have to keep track of several index relations in an + * array. -cim 9/10/89 + * ---------------- + */ +typedef Relation *RelationPtr; + +/* + * Routines to open (lookup) and close a relcache entry + */ +extern Relation RelationIdGetRelation(Oid relationId); +extern void RelationClose(Relation relation); + +/* + * Routines to compute/retrieve additional cached information + */ +extern List *RelationGetFKeyList(Relation relation); +extern List *RelationGetIndexList(Relation relation); +extern List *RelationGetStatExtList(Relation relation); +extern Oid RelationGetPrimaryKeyIndex(Relation relation); +extern Oid RelationGetReplicaIndex(Relation relation); +extern List *RelationGetIndexExpressions(Relation relation); +extern List *RelationGetDummyIndexExpressions(Relation relation); +extern List *RelationGetIndexPredicate(Relation relation); +extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy); + +/* + * Which set of columns to return by RelationGetIndexAttrBitmap. + */ +typedef enum IndexAttrBitmapKind +{ + INDEX_ATTR_BITMAP_KEY, + INDEX_ATTR_BITMAP_PRIMARY_KEY, + INDEX_ATTR_BITMAP_IDENTITY_KEY, + INDEX_ATTR_BITMAP_HOT_BLOCKING, + INDEX_ATTR_BITMAP_SUMMARIZED, +} IndexAttrBitmapKind; + +extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation, + IndexAttrBitmapKind attrKind); + +extern Bitmapset *RelationGetIdentityKeyBitmap(Relation relation); + +extern void RelationGetExclusionInfo(Relation indexRelation, + Oid **operators, + Oid **procs, + uint16 **strategies); + +extern void RelationInitIndexAccessInfo(Relation relation); + +/* caller must include pg_publication.h */ +struct PublicationDesc; +extern void RelationBuildPublicationDesc(Relation relation, + struct PublicationDesc *pubdesc); + +extern void RelationInitTableAccessMethod(Relation relation); + +/* + * Routines to support ereport() reports of relation-related errors + */ +extern int errtable(Relation rel); +extern int errtablecol(Relation rel, int attnum); +extern int errtablecolname(Relation rel, const char *colname); +extern int errtableconstraint(Relation rel, const char *conname); + +/* + * Routines for backend startup + */ +extern void RelationCacheInitialize(void); +extern void RelationCacheInitializePhase2(void); +extern void RelationCacheInitializePhase3(void); + +/* + * Routine to create a relcache entry for an about-to-be-created relation + */ +extern Relation RelationBuildLocalRelation(const char *relname, + Oid relnamespace, + TupleDesc tupDesc, + Oid relid, + Oid accessmtd, + RelFileNumber relfilenumber, + Oid reltablespace, + bool shared_relation, + bool mapped_relation, + char relpersistence, + char relkind); + +/* + * Routines to manage assignment of new relfilenumber to a relation + */ +extern void RelationSetNewRelfilenumber(Relation relation, char persistence); +extern void RelationAssumeNewRelfilelocator(Relation relation); + +/* + * Routines for flushing/rebuilding relcache entries in various scenarios + */ +extern void RelationForgetRelation(Oid rid); + +extern void RelationCacheInvalidateEntry(Oid relationId); + +extern void RelationCacheInvalidate(bool debug_discard); + +#ifdef USE_ASSERT_CHECKING +extern void AssertPendingSyncs_RelationCache(void); +#else +#define AssertPendingSyncs_RelationCache() do {} while (0) +#endif +extern void AtEOXact_RelationCache(bool isCommit); +extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, + SubTransactionId parentSubid); + +/* + * Routines to help manage rebuilding of relcache init files + */ +extern bool RelationIdIsInInitFile(Oid relationId); +extern void RelationCacheInitFilePreInvalidate(void); +extern void RelationCacheInitFilePostInvalidate(void); +extern void RelationCacheInitFileRemove(void); + +/* should be used only by relcache.c and catcache.c */ +extern PGDLLIMPORT bool criticalRelcachesBuilt; + +/* should be used only by relcache.c and postinit.c */ +extern PGDLLIMPORT bool criticalSharedRelcachesBuilt; + +#endif /* RELCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/relfilenumbermap.h b/platform/dbops/binaries/postgres/include/server/utils/relfilenumbermap.h new file mode 100644 index 0000000000000000000000000000000000000000..0ca89e452adb9f5a4a9a9518dd089f34b44860db --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/relfilenumbermap.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * relfilenumbermap.h + * relfilenumber to oid mapping cache. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relfilenumbermap.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELFILENUMBERMAP_H +#define RELFILENUMBERMAP_H + +#include "common/relpath.h" + +extern Oid RelidByRelfilenumber(Oid reltablespace, + RelFileNumber relfilenumber); + +#endif /* RELFILENUMBERMAP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/relmapper.h b/platform/dbops/binaries/postgres/include/server/utils/relmapper.h new file mode 100644 index 0000000000000000000000000000000000000000..4c1a74743d87e6386dc36369208c8d683e571ff4 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/relmapper.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------------------- + * + * relmapper.h + * Catalog-to-filenumber mapping + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relmapper.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELMAPPER_H +#define RELMAPPER_H + +#include "access/xlogreader.h" +#include "lib/stringinfo.h" + +/* ---------------- + * relmap-related XLOG entries + * ---------------- + */ + +#define XLOG_RELMAP_UPDATE 0x00 + +typedef struct xl_relmap_update +{ + Oid dbid; /* database ID, or 0 for shared map */ + Oid tsid; /* database's tablespace, or pg_global */ + int32 nbytes; /* size of relmap data */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} xl_relmap_update; + +#define MinSizeOfRelmapUpdate offsetof(xl_relmap_update, data) + + +extern RelFileNumber RelationMapOidToFilenumber(Oid relationId, bool shared); + +extern Oid RelationMapFilenumberToOid(RelFileNumber filenumber, bool shared); +extern RelFileNumber RelationMapOidToFilenumberForDatabase(char *dbpath, + Oid relationId); +extern void RelationMapCopy(Oid dbid, Oid tsid, char *srcdbpath, + char *dstdbpath); +extern void RelationMapUpdateMap(Oid relationId, RelFileNumber fileNumber, + bool shared, bool immediate); + +extern void RelationMapRemoveMapping(Oid relationId); + +extern void RelationMapInvalidate(bool shared); +extern void RelationMapInvalidateAll(void); + +extern void AtCCI_RelationMap(void); +extern void AtEOXact_RelationMap(bool isCommit, bool isParallelWorker); +extern void AtPrepare_RelationMap(void); + +extern void CheckPointRelationMap(void); + +extern void RelationMapFinishBootstrap(void); + +extern void RelationMapInitialize(void); +extern void RelationMapInitializePhase2(void); +extern void RelationMapInitializePhase3(void); + +extern Size EstimateRelationMapSpace(void); +extern void SerializeRelationMap(Size maxSize, char *startAddress); +extern void RestoreRelationMap(char *startAddress); + +extern void relmap_redo(XLogReaderState *record); +extern void relmap_desc(StringInfo buf, XLogReaderState *record); +extern const char *relmap_identify(uint8 info); + +#endif /* RELMAPPER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/relptr.h b/platform/dbops/binaries/postgres/include/server/utils/relptr.h new file mode 100644 index 0000000000000000000000000000000000000000..622039e87e8855b8b505161b4940ccb2a58a9532 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/relptr.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * relptr.h + * This file contains basic declarations for relative pointers. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/relptr.h + * + *------------------------------------------------------------------------- + */ + +#ifndef RELPTR_H +#define RELPTR_H + +/* + * Relative pointers are intended to be used when storing an address that may + * be relative either to the base of the process's address space or some + * dynamic shared memory segment mapped therein. + * + * The idea here is that you declare a relative pointer as relptr(type) + * and then use relptr_access to dereference it and relptr_store to change + * it. The use of a union here is a hack, because what's stored in the + * relptr is always a Size, never an actual pointer. But including a pointer + * in the union allows us to use stupid macro tricks to provide some measure + * of type-safety. + */ +#define relptr(type) union { type *relptr_type; Size relptr_off; } + +/* + * pgindent gets confused by declarations that use "relptr(type)" directly, + * so preferred style is to write + * typedef struct ... SomeStruct; + * relptr_declare(SomeStruct, RelptrSomeStruct); + * and then declare pointer variables as "RelptrSomeStruct someptr". + */ +#define relptr_declare(type, relptrtype) \ + typedef relptr(type) relptrtype + +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define relptr_access(base, rp) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (__typeof__((rp).relptr_type)) ((rp).relptr_off == 0 ? NULL : \ + (base) + (rp).relptr_off - 1)) +#else +/* + * If we don't have __builtin_types_compatible_p, assume we might not have + * __typeof__ either. + */ +#define relptr_access(base, rp) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (void *) ((rp).relptr_off == 0 ? NULL : (base) + (rp).relptr_off - 1)) +#endif + +#define relptr_is_null(rp) \ + ((rp).relptr_off == 0) + +#define relptr_offset(rp) \ + ((rp).relptr_off - 1) + +/* We use this inline to avoid double eval of "val" in relptr_store */ +static inline Size +relptr_store_eval(char *base, char *val) +{ + if (val == NULL) + return 0; + else + { + Assert(val >= base); + return val - base + 1; + } +} + +#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P +#define relptr_store(base, rp, val) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + AssertVariableIsOfTypeMacro(val, __typeof__((rp).relptr_type)), \ + (rp).relptr_off = relptr_store_eval((base), (char *) (val))) +#else +/* + * If we don't have __builtin_types_compatible_p, assume we might not have + * __typeof__ either. + */ +#define relptr_store(base, rp, val) \ + (AssertVariableIsOfTypeMacro(base, char *), \ + (rp).relptr_off = relptr_store_eval((base), (char *) (val))) +#endif + +#define relptr_copy(rp1, rp2) \ + ((rp1).relptr_off = (rp2).relptr_off) + +#endif /* RELPTR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/reltrigger.h b/platform/dbops/binaries/postgres/include/server/utils/reltrigger.h new file mode 100644 index 0000000000000000000000000000000000000000..dfef4c055a48e3a5615c4d1e08370541cf8a3bc7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/reltrigger.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------------------- + * + * reltrigger.h + * POSTGRES relation trigger definitions. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/reltrigger.h + * + *------------------------------------------------------------------------- + */ +#ifndef RELTRIGGER_H +#define RELTRIGGER_H + + +/* + * These struct really belongs to trigger.h, but we put it separately so that + * it can be cleanly included in rel.h and other places. + */ + +typedef struct Trigger +{ + Oid tgoid; /* OID of trigger (pg_trigger row) */ + /* Remaining fields are copied from pg_trigger, see pg_trigger.h */ + char *tgname; + Oid tgfoid; + int16 tgtype; + char tgenabled; + bool tgisinternal; + bool tgisclone; + Oid tgconstrrelid; + Oid tgconstrindid; + Oid tgconstraint; + bool tgdeferrable; + bool tginitdeferred; + int16 tgnargs; + int16 tgnattr; + int16 *tgattr; + char **tgargs; + char *tgqual; + char *tgoldtable; + char *tgnewtable; +} Trigger; + +typedef struct TriggerDesc +{ + Trigger *triggers; /* array of Trigger structs */ + int numtriggers; /* number of array entries */ + + /* + * These flags indicate whether the array contains at least one of each + * type of trigger. We use these to skip searching the array if not. + */ + bool trig_insert_before_row; + bool trig_insert_after_row; + bool trig_insert_instead_row; + bool trig_insert_before_statement; + bool trig_insert_after_statement; + bool trig_update_before_row; + bool trig_update_after_row; + bool trig_update_instead_row; + bool trig_update_before_statement; + bool trig_update_after_statement; + bool trig_delete_before_row; + bool trig_delete_after_row; + bool trig_delete_instead_row; + bool trig_delete_before_statement; + bool trig_delete_after_statement; + /* there are no row-level truncate triggers */ + bool trig_truncate_before_statement; + bool trig_truncate_after_statement; + /* Is there at least one trigger specifying each transition relation? */ + bool trig_insert_new_table; + bool trig_update_old_table; + bool trig_update_new_table; + bool trig_delete_old_table; +} TriggerDesc; + +#endif /* RELTRIGGER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/resowner.h b/platform/dbops/binaries/postgres/include/server/utils/resowner.h new file mode 100644 index 0000000000000000000000000000000000000000..4e534bc3e709c917f1bf54e70e49de857e047a0a --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/resowner.h @@ -0,0 +1,167 @@ +/*------------------------------------------------------------------------- + * + * resowner.h + * POSTGRES resource owner definitions. + * + * Query-lifespan resources are tracked by associating them with + * ResourceOwner objects. This provides a simple mechanism for ensuring + * that such resources are freed at the right time. + * See utils/resowner/README for more info. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/resowner.h + * + *------------------------------------------------------------------------- + */ +#ifndef RESOWNER_H +#define RESOWNER_H + + +/* + * ResourceOwner objects are an opaque data structure known only within + * resowner.c. + */ +typedef struct ResourceOwnerData *ResourceOwner; + + +/* + * Globally known ResourceOwners + */ +extern PGDLLIMPORT ResourceOwner CurrentResourceOwner; +extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner; +extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner; +extern PGDLLIMPORT ResourceOwner AuxProcessResourceOwner; + +/* + * Resource releasing is done in three phases: pre-locks, locks, and + * post-locks. The pre-lock phase must release any resources that are visible + * to other backends (such as pinned buffers); this ensures that when we + * release a lock that another backend may be waiting on, it will see us as + * being fully out of our transaction. The post-lock phase should be used for + * backend-internal cleanup. + * + * Within each phase, resources are released in priority order. Priority is + * just an integer specified in ResourceOwnerDesc. The priorities of built-in + * resource types are given below, extensions may use any priority relative to + * those or RELEASE_PRIO_FIRST/LAST. RELEASE_PRIO_FIRST is a fine choice if + * your resource doesn't depend on any other resources. + */ +typedef enum +{ + RESOURCE_RELEASE_BEFORE_LOCKS = 1, + RESOURCE_RELEASE_LOCKS, + RESOURCE_RELEASE_AFTER_LOCKS, +} ResourceReleasePhase; + +typedef uint32 ResourceReleasePriority; + +/* priorities of built-in BEFORE_LOCKS resources */ +#define RELEASE_PRIO_BUFFER_IOS 100 +#define RELEASE_PRIO_BUFFER_PINS 200 +#define RELEASE_PRIO_RELCACHE_REFS 300 +#define RELEASE_PRIO_DSMS 400 +#define RELEASE_PRIO_JIT_CONTEXTS 500 +#define RELEASE_PRIO_CRYPTOHASH_CONTEXTS 600 +#define RELEASE_PRIO_HMAC_CONTEXTS 700 + +/* priorities of built-in AFTER_LOCKS resources */ +#define RELEASE_PRIO_CATCACHE_REFS 100 +#define RELEASE_PRIO_CATCACHE_LIST_REFS 200 +#define RELEASE_PRIO_PLANCACHE_REFS 300 +#define RELEASE_PRIO_TUPDESC_REFS 400 +#define RELEASE_PRIO_SNAPSHOT_REFS 500 +#define RELEASE_PRIO_FILES 600 +#define RELEASE_PRIO_WAITEVENTSETS 700 + +/* 0 is considered invalid */ +#define RELEASE_PRIO_FIRST 1 +#define RELEASE_PRIO_LAST UINT32_MAX + +/* + * In order to track an object, resowner.c needs a few callbacks for it. + * The callbacks for resources of a specific kind are encapsulated in + * ResourceOwnerDesc. + * + * Note that the callbacks occur post-commit or post-abort, so the callback + * functions can only do noncritical cleanup and must not fail. + */ +typedef struct ResourceOwnerDesc +{ + const char *name; /* name for the object kind, for debugging */ + + /* when are these objects released? */ + ResourceReleasePhase release_phase; + ResourceReleasePriority release_priority; + + /* + * Release resource. + * + * This is called for each resource in the resource owner, in the order + * specified by 'release_phase' and 'release_priority' when the whole + * resource owner is been released or when ResourceOwnerReleaseAllOfKind() + * is called. The resource is implicitly removed from the owner, the + * callback function doesn't need to call ResourceOwnerForget. + */ + void (*ReleaseResource) (Datum res); + + /* + * Format a string describing the resource, for debugging purposes. If a + * resource has not been properly released before commit, this is used to + * print a WARNING. + * + * This can be left to NULL, in which case a generic "[resource name]: %p" + * format is used. + */ + char *(*DebugPrint) (Datum res); + +} ResourceOwnerDesc; + +/* + * Dynamically loaded modules can get control during ResourceOwnerRelease + * by providing a callback of this form. + */ +typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase, + bool isCommit, + bool isTopLevel, + void *arg); + + +/* + * Functions in resowner.c + */ + +/* generic routines */ +extern ResourceOwner ResourceOwnerCreate(ResourceOwner parent, + const char *name); +extern void ResourceOwnerRelease(ResourceOwner owner, + ResourceReleasePhase phase, + bool isCommit, + bool isTopLevel); +extern void ResourceOwnerDelete(ResourceOwner owner); +extern ResourceOwner ResourceOwnerGetParent(ResourceOwner owner); +extern void ResourceOwnerNewParent(ResourceOwner owner, + ResourceOwner newparent); + +extern void ResourceOwnerEnlarge(ResourceOwner owner); +extern void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind); +extern void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind); + +extern void ResourceOwnerReleaseAllOfKind(ResourceOwner owner, const ResourceOwnerDesc *kind); + +extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback, + void *arg); +extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback, + void *arg); + +extern void CreateAuxProcessResourceOwner(void); +extern void ReleaseAuxProcessResources(bool isCommit); + +/* special support for local lock management */ +struct LOCALLOCK; +extern void ResourceOwnerRememberLock(ResourceOwner owner, struct LOCALLOCK *locallock); +extern void ResourceOwnerForgetLock(ResourceOwner owner, struct LOCALLOCK *locallock); + +#endif /* RESOWNER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/rls.h b/platform/dbops/binaries/postgres/include/server/utils/rls.h new file mode 100644 index 0000000000000000000000000000000000000000..fafc4ee89caaba662b606f5d2c8da246eeab98cb --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/rls.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------- + * + * rls.h + * Header file for Row Level Security (RLS) utility commands to be used + * with the rowsecurity feature. + * + * Copyright (c) 2007-2024, PostgreSQL Global Development Group + * + * src/include/utils/rls.h + * + *------------------------------------------------------------------------- + */ +#ifndef RLS_H +#define RLS_H + +/* GUC variable */ +extern PGDLLIMPORT bool row_security; + +/* + * Used by callers of check_enable_rls. + * + * RLS could be completely disabled on the tables involved in the query, + * which is the simple case, or it may depend on the current environment + * (the role which is running the query or the value of the row_security + * GUC), or it might be simply enabled as usual. + * + * If RLS isn't on the table involved then RLS_NONE is returned to indicate + * that we don't need to worry about invalidating the query plan for RLS + * reasons. If RLS is on the table, but we are bypassing it for now, then + * we return RLS_NONE_ENV to indicate that, if the environment changes, + * we need to invalidate and replan. Finally, if RLS should be turned on + * for the query, then we return RLS_ENABLED, which means we also need to + * invalidate if the environment changes. + * + * Note that RLS_ENABLED will also be returned if noError is true + * (indicating that the caller simply want to know if RLS should be applied + * for this user but doesn't want an error thrown if it is; this is used + * by other error cases where we're just trying to decide if data from the + * table should be passed back to the user or not). + */ +enum CheckEnableRlsResult +{ + RLS_NONE, + RLS_NONE_ENV, + RLS_ENABLED, +}; + +extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError); + +#endif /* RLS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/ruleutils.h b/platform/dbops/binaries/postgres/include/server/utils/ruleutils.h new file mode 100644 index 0000000000000000000000000000000000000000..161fb5ef02c6e5b3f8391983206a0fe78a63b060 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/ruleutils.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * ruleutils.h + * Declarations for ruleutils.c + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/ruleutils.h + * + *------------------------------------------------------------------------- + */ +#ifndef RULEUTILS_H +#define RULEUTILS_H + +#include "nodes/nodes.h" +#include "nodes/parsenodes.h" +#include "nodes/pg_list.h" + +struct Plan; /* avoid including plannodes.h here */ +struct PlannedStmt; + +/* Flags for pg_get_indexdef_columns_extended() */ +#define RULE_INDEXDEF_PRETTY 0x01 +#define RULE_INDEXDEF_KEYS_ONLY 0x02 /* ignore included attributes */ + +extern char *pg_get_indexdef_string(Oid indexrelid); +extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty); +extern char *pg_get_indexdef_columns_extended(Oid indexrelid, + bits16 flags); +extern char *pg_get_querydef(Query *query, bool pretty); + +extern char *pg_get_partkeydef_columns(Oid relid, bool pretty); +extern char *pg_get_partconstrdef_string(Oid partitionId, char *aliasname); + +extern char *pg_get_constraintdef_command(Oid constraintId); +extern char *deparse_expression(Node *expr, List *dpcontext, + bool forceprefix, bool showimplicit); +extern List *deparse_context_for(const char *aliasname, Oid relid); +extern List *deparse_context_for_plan_tree(struct PlannedStmt *pstmt, + List *rtable_names); +extern List *set_deparse_context_plan(List *dpcontext, + struct Plan *plan, List *ancestors); +extern List *select_rtable_names_for_explain(List *rtable, + Bitmapset *rels_used); +extern char *generate_collation_name(Oid collid); +extern char *generate_opclass_name(Oid opclass); +extern char *get_range_partbound_string(List *bound_datums); + +extern char *pg_get_statisticsobjdef_string(Oid statextid); + +#endif /* RULEUTILS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/sampling.h b/platform/dbops/binaries/postgres/include/server/utils/sampling.h new file mode 100644 index 0000000000000000000000000000000000000000..be48ee52bac4bdb20bec35a65b2e66aeb4530244 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/sampling.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * sampling.h + * definitions for sampling functions + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sampling.h + * + *------------------------------------------------------------------------- + */ +#ifndef SAMPLING_H +#define SAMPLING_H + +#include "common/pg_prng.h" +#include "storage/block.h" /* for typedef BlockNumber */ + + +/* Random generator for sampling code */ +extern void sampler_random_init_state(uint32 seed, + pg_prng_state *randstate); +extern double sampler_random_fract(pg_prng_state *randstate); + +/* Block sampling methods */ + +/* Data structure for Algorithm S from Knuth 3.4.2 */ +typedef struct +{ + BlockNumber N; /* number of blocks, known in advance */ + int n; /* desired sample size */ + BlockNumber t; /* current block number */ + int m; /* blocks selected so far */ + pg_prng_state randstate; /* random generator state */ +} BlockSamplerData; + +typedef BlockSamplerData *BlockSampler; + +extern BlockNumber BlockSampler_Init(BlockSampler bs, BlockNumber nblocks, + int samplesize, uint32 randseed); +extern bool BlockSampler_HasMore(BlockSampler bs); +extern BlockNumber BlockSampler_Next(BlockSampler bs); + +/* Reservoir sampling methods */ + +typedef struct +{ + double W; + pg_prng_state randstate; /* random generator state */ +} ReservoirStateData; + +typedef ReservoirStateData *ReservoirState; + +extern void reservoir_init_selection_state(ReservoirState rs, int n); +extern double reservoir_get_next_S(ReservoirState rs, double t, int n); + +/* Old API, still in use by assorted FDWs */ +/* For backwards compatibility, these declarations are duplicated in vacuum.h */ + +extern double anl_random_fract(void); +extern double anl_init_selection_state(int n); +extern double anl_get_next_S(double t, int n, double *stateptr); + +#endif /* SAMPLING_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/selfuncs.h b/platform/dbops/binaries/postgres/include/server/utils/selfuncs.h new file mode 100644 index 0000000000000000000000000000000000000000..f2563ad1cb3a8e23c826a0222d1d944c67ab294f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/selfuncs.h @@ -0,0 +1,244 @@ +/*------------------------------------------------------------------------- + * + * selfuncs.h + * Selectivity functions for standard operators, and assorted + * infrastructure for selectivity and cost estimation. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/selfuncs.h + * + *------------------------------------------------------------------------- + */ +#ifndef SELFUNCS_H +#define SELFUNCS_H + +#include "access/htup.h" +#include "fmgr.h" +#include "nodes/pathnodes.h" + + +/* + * Note: the default selectivity estimates are not chosen entirely at random. + * We want them to be small enough to ensure that indexscans will be used if + * available, for typical table densities of ~100 tuples/page. Thus, for + * example, 0.01 is not quite small enough, since that makes it appear that + * nearly all pages will be hit anyway. Also, since we sometimes estimate + * eqsel as 1/num_distinct, we probably want DEFAULT_NUM_DISTINCT to equal + * 1/DEFAULT_EQ_SEL. + */ + +/* default selectivity estimate for equalities such as "A = b" */ +#define DEFAULT_EQ_SEL 0.005 + +/* default selectivity estimate for inequalities such as "A < b" */ +#define DEFAULT_INEQ_SEL 0.3333333333333333 + +/* default selectivity estimate for range inequalities "A > b AND A < c" */ +#define DEFAULT_RANGE_INEQ_SEL 0.005 + +/* default selectivity estimate for multirange inequalities "A > b AND A < c" */ +#define DEFAULT_MULTIRANGE_INEQ_SEL 0.005 + +/* default selectivity estimate for pattern-match operators such as LIKE */ +#define DEFAULT_MATCH_SEL 0.005 + +/* default selectivity estimate for other matching operators */ +#define DEFAULT_MATCHING_SEL 0.010 + +/* default number of distinct values in a table */ +#define DEFAULT_NUM_DISTINCT 200 + +/* default selectivity estimate for boolean and null test nodes */ +#define DEFAULT_UNK_SEL 0.005 +#define DEFAULT_NOT_UNK_SEL (1.0 - DEFAULT_UNK_SEL) + + +/* + * Clamp a computed probability estimate (which may suffer from roundoff or + * estimation errors) to valid range. Argument must be a float variable. + */ +#define CLAMP_PROBABILITY(p) \ + do { \ + if (p < 0.0) \ + p = 0.0; \ + else if (p > 1.0) \ + p = 1.0; \ + } while (0) + +/* + * A set of flags which some selectivity estimation functions can pass back to + * callers to provide further details about some assumptions which were made + * during the estimation. + */ +#define SELFLAG_USED_DEFAULT (1 << 0) /* Estimation fell back on one + * of the DEFAULTs as defined + * above. */ + +typedef struct EstimationInfo +{ + uint32 flags; /* Flags, as defined above to mark special + * properties of the estimation. */ +} EstimationInfo; + +/* Return data from examine_variable and friends */ +typedef struct VariableStatData +{ + Node *var; /* the Var or expression tree */ + RelOptInfo *rel; /* Relation, or NULL if not identifiable */ + HeapTuple statsTuple; /* pg_statistic tuple, or NULL if none */ + /* NB: if statsTuple!=NULL, it must be freed when caller is done */ + void (*freefunc) (HeapTuple tuple); /* how to free statsTuple */ + Oid vartype; /* exposed type of expression */ + Oid atttype; /* actual type (after stripping relabel) */ + int32 atttypmod; /* actual typmod (after stripping relabel) */ + bool isunique; /* matches unique index or DISTINCT clause */ + bool acl_ok; /* result of ACL check on table or column */ +} VariableStatData; + +#define ReleaseVariableStats(vardata) \ + do { \ + if (HeapTupleIsValid((vardata).statsTuple)) \ + (vardata).freefunc((vardata).statsTuple); \ + } while(0) + + +/* + * genericcostestimate is a general-purpose estimator that can be used for + * most index types. In some cases we use genericcostestimate as the base + * code and then incorporate additional index-type-specific knowledge in + * the type-specific calling function. To avoid code duplication, we make + * genericcostestimate return a number of intermediate values as well as + * its preliminary estimates of the output cost values. The GenericCosts + * struct includes all these values. + * + * Callers should initialize all fields of GenericCosts to zero. In addition, + * they can set numIndexTuples to some positive value if they have a better + * than default way of estimating the number of leaf index tuples visited. + * Similarly, they can set num_sa_scans to some value >= 1 for an index AM + * that doesn't necessarily perform exactly one primitive index scan per + * distinct combination of ScalarArrayOp array elements. + */ +typedef struct +{ + /* These are the values the cost estimator must return to the planner */ + Cost indexStartupCost; /* index-related startup cost */ + Cost indexTotalCost; /* total index-related scan cost */ + Selectivity indexSelectivity; /* selectivity of index */ + double indexCorrelation; /* order correlation of index */ + + /* Intermediate values we obtain along the way */ + double numIndexPages; /* number of leaf pages visited */ + double numIndexTuples; /* number of leaf tuples visited */ + double spc_random_page_cost; /* relevant random_page_cost value */ + double num_sa_scans; /* # indexscans from ScalarArrayOpExprs */ +} GenericCosts; + +/* Hooks for plugins to get control when we ask for stats */ +typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, + RangeTblEntry *rte, + AttrNumber attnum, + VariableStatData *vardata); +extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; +typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, + Oid indexOid, + AttrNumber indexattnum, + VariableStatData *vardata); +extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; + +/* Functions in selfuncs.c */ + +extern void examine_variable(PlannerInfo *root, Node *node, int varRelid, + VariableStatData *vardata); +extern bool statistic_proc_security_check(VariableStatData *vardata, Oid func_oid); +extern bool get_restriction_variable(PlannerInfo *root, List *args, + int varRelid, + VariableStatData *vardata, Node **other, + bool *varonleft); +extern void get_join_variables(PlannerInfo *root, List *args, + SpecialJoinInfo *sjinfo, + VariableStatData *vardata1, + VariableStatData *vardata2, + bool *join_is_reversed); +extern double get_variable_numdistinct(VariableStatData *vardata, + bool *isdefault); +extern double mcv_selectivity(VariableStatData *vardata, + FmgrInfo *opproc, Oid collation, + Datum constval, bool varonleft, + double *sumcommonp); +extern double histogram_selectivity(VariableStatData *vardata, + FmgrInfo *opproc, Oid collation, + Datum constval, bool varonleft, + int min_hist_size, int n_skip, + int *hist_size); +extern double generic_restriction_selectivity(PlannerInfo *root, + Oid oproid, Oid collation, + List *args, int varRelid, + double default_selectivity); +extern double ineq_histogram_selectivity(PlannerInfo *root, + VariableStatData *vardata, + Oid opoid, FmgrInfo *opproc, + bool isgt, bool iseq, + Oid collation, + Datum constval, Oid consttype); +extern double var_eq_const(VariableStatData *vardata, + Oid oproid, Oid collation, + Datum constval, bool constisnull, + bool varonleft, bool negate); +extern double var_eq_non_const(VariableStatData *vardata, + Oid oproid, Oid collation, + Node *other, + bool varonleft, bool negate); + +extern Selectivity boolvarsel(PlannerInfo *root, Node *arg, int varRelid); +extern Selectivity booltestsel(PlannerInfo *root, BoolTestType booltesttype, + Node *arg, int varRelid, + JoinType jointype, SpecialJoinInfo *sjinfo); +extern Selectivity nulltestsel(PlannerInfo *root, NullTestType nulltesttype, + Node *arg, int varRelid, + JoinType jointype, SpecialJoinInfo *sjinfo); +extern Selectivity scalararraysel(PlannerInfo *root, + ScalarArrayOpExpr *clause, + bool is_join_clause, + int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); +extern double estimate_array_length(PlannerInfo *root, Node *arrayexpr); +extern Selectivity rowcomparesel(PlannerInfo *root, + RowCompareExpr *clause, + int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo); + +extern void mergejoinscansel(PlannerInfo *root, Node *clause, + Oid opfamily, int strategy, bool nulls_first, + Selectivity *leftstart, Selectivity *leftend, + Selectivity *rightstart, Selectivity *rightend); + +extern double estimate_num_groups(PlannerInfo *root, List *groupExprs, + double input_rows, List **pgset, + EstimationInfo *estinfo); + +extern void estimate_hash_bucket_stats(PlannerInfo *root, + Node *hashkey, double nbuckets, + Selectivity *mcv_freq, + Selectivity *bucketsize_frac); +extern double estimate_hashagg_tablesize(PlannerInfo *root, Path *path, + const AggClauseCosts *agg_costs, + double dNumGroups); + +extern List *get_quals_from_indexclauses(List *indexclauses); +extern Cost index_other_operands_eval_cost(PlannerInfo *root, + List *indexquals); +extern List *add_predicate_to_index_quals(IndexOptInfo *index, + List *indexQuals); +extern void genericcostestimate(PlannerInfo *root, IndexPath *path, + double loop_count, + GenericCosts *costs); + +/* Functions in array_selfuncs.c */ + +extern Selectivity scalararraysel_containment(PlannerInfo *root, + Node *leftop, Node *rightop, + Oid elemtype, bool isEquality, bool useOr, + int varRelid); + +#endif /* SELFUNCS_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/sharedtuplestore.h b/platform/dbops/binaries/postgres/include/server/utils/sharedtuplestore.h new file mode 100644 index 0000000000000000000000000000000000000000..dcf676ff5fbb9bd7ff2d2fae118be5a0ac180085 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/sharedtuplestore.h @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------- + * + * sharedtuplestore.h + * Simple mechanism for sharing tuples between backends. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sharedtuplestore.h + * + *------------------------------------------------------------------------- + */ +#ifndef SHAREDTUPLESTORE_H +#define SHAREDTUPLESTORE_H + +#include "access/htup.h" +#include "storage/fd.h" +#include "storage/sharedfileset.h" + +struct SharedTuplestore; +typedef struct SharedTuplestore SharedTuplestore; + +struct SharedTuplestoreAccessor; +typedef struct SharedTuplestoreAccessor SharedTuplestoreAccessor; + +/* + * A flag indicating that the tuplestore will only be scanned once, so backing + * files can be unlinked early. + */ +#define SHARED_TUPLESTORE_SINGLE_PASS 0x01 + +extern size_t sts_estimate(int participants); + +extern SharedTuplestoreAccessor *sts_initialize(SharedTuplestore *sts, + int participants, + int my_participant_number, + size_t meta_data_size, + int flags, + SharedFileSet *fileset, + const char *name); + +extern SharedTuplestoreAccessor *sts_attach(SharedTuplestore *sts, + int my_participant_number, + SharedFileSet *fileset); + +extern void sts_end_write(SharedTuplestoreAccessor *accessor); + +extern void sts_reinitialize(SharedTuplestoreAccessor *accessor); + +extern void sts_begin_parallel_scan(SharedTuplestoreAccessor *accessor); + +extern void sts_end_parallel_scan(SharedTuplestoreAccessor *accessor); + +extern void sts_puttuple(SharedTuplestoreAccessor *accessor, + void *meta_data, + MinimalTuple tuple); + +extern MinimalTuple sts_parallel_scan_next(SharedTuplestoreAccessor *accessor, + void *meta_data); + +#endif /* SHAREDTUPLESTORE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/snapmgr.h b/platform/dbops/binaries/postgres/include/server/utils/snapmgr.h new file mode 100644 index 0000000000000000000000000000000000000000..9398a84051c5e864db1ea0032c83a6491f9801ab --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/snapmgr.h @@ -0,0 +1,130 @@ +/*------------------------------------------------------------------------- + * + * snapmgr.h + * POSTGRES snapshot manager + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/snapmgr.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPMGR_H +#define SNAPMGR_H + +#include "access/transam.h" +#include "utils/relcache.h" +#include "utils/resowner.h" +#include "utils/snapshot.h" + + +extern PGDLLIMPORT bool FirstSnapshotSet; + +extern PGDLLIMPORT TransactionId TransactionXmin; +extern PGDLLIMPORT TransactionId RecentXmin; + +/* Variables representing various special snapshot semantics */ +extern PGDLLIMPORT SnapshotData SnapshotSelfData; +extern PGDLLIMPORT SnapshotData SnapshotAnyData; +extern PGDLLIMPORT SnapshotData CatalogSnapshotData; + +#define SnapshotSelf (&SnapshotSelfData) +#define SnapshotAny (&SnapshotAnyData) + +/* + * We don't provide a static SnapshotDirty variable because it would be + * non-reentrant. Instead, users of that snapshot type should declare a + * local variable of type SnapshotData, and initialize it with this macro. + */ +#define InitDirtySnapshot(snapshotdata) \ + ((snapshotdata).snapshot_type = SNAPSHOT_DIRTY) + +/* + * Similarly, some initialization is required for a NonVacuumable snapshot. + * The caller must supply the visibility cutoff state to use (c.f. + * GlobalVisTestFor()). + */ +#define InitNonVacuumableSnapshot(snapshotdata, vistestp) \ + ((snapshotdata).snapshot_type = SNAPSHOT_NON_VACUUMABLE, \ + (snapshotdata).vistest = (vistestp)) + +/* + * Similarly, some initialization is required for SnapshotToast. We need + * to set lsn and whenTaken correctly to support snapshot_too_old. + */ +#define InitToastSnapshot(snapshotdata, l, w) \ + ((snapshotdata).snapshot_type = SNAPSHOT_TOAST, \ + (snapshotdata).lsn = (l), \ + (snapshotdata).whenTaken = (w)) + +/* This macro encodes the knowledge of which snapshots are MVCC-safe */ +#define IsMVCCSnapshot(snapshot) \ + ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \ + (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC) + +extern Snapshot GetTransactionSnapshot(void); +extern Snapshot GetLatestSnapshot(void); +extern void SnapshotSetCommandId(CommandId curcid); +extern Snapshot GetOldestSnapshot(void); + +extern Snapshot GetCatalogSnapshot(Oid relid); +extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid); +extern void InvalidateCatalogSnapshot(void); +extern void InvalidateCatalogSnapshotConditionally(void); + +extern void PushActiveSnapshot(Snapshot snapshot); +extern void PushActiveSnapshotWithLevel(Snapshot snapshot, int snap_level); +extern void PushCopiedSnapshot(Snapshot snapshot); +extern void UpdateActiveSnapshotCommandId(void); +extern void PopActiveSnapshot(void); +extern Snapshot GetActiveSnapshot(void); +extern bool ActiveSnapshotSet(void); + +extern Snapshot RegisterSnapshot(Snapshot snapshot); +extern void UnregisterSnapshot(Snapshot snapshot); +extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner); +extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner); + +extern void AtSubCommit_Snapshot(int level); +extern void AtSubAbort_Snapshot(int level); +extern void AtEOXact_Snapshot(bool isCommit, bool resetXmin); + +extern void ImportSnapshot(const char *idstr); +extern bool XactHasExportedSnapshots(void); +extern void DeleteAllExportedSnapshotFiles(void); +extern void WaitForOlderSnapshots(TransactionId limitXmin, bool progress); +extern bool ThereAreNoPriorRegisteredSnapshots(void); +extern bool HaveRegisteredOrActiveSnapshot(void); + +extern char *ExportSnapshot(Snapshot snapshot); + +/* + * These live in procarray.c because they're intimately linked to the + * procarray contents, but thematically they better fit into snapmgr.h. + */ +typedef struct GlobalVisState GlobalVisState; +extern GlobalVisState *GlobalVisTestFor(Relation rel); +extern bool GlobalVisTestIsRemovableXid(GlobalVisState *state, TransactionId xid); +extern bool GlobalVisTestIsRemovableFullXid(GlobalVisState *state, FullTransactionId fxid); +extern bool GlobalVisCheckRemovableXid(Relation rel, TransactionId xid); +extern bool GlobalVisCheckRemovableFullXid(Relation rel, FullTransactionId fxid); + +/* + * Utility functions for implementing visibility routines in table AMs. + */ +extern bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot); + +/* Support for catalog timetravel for logical decoding */ +struct HTAB; +extern struct HTAB *HistoricSnapshotGetTupleCids(void); +extern void SetupHistoricSnapshot(Snapshot historic_snapshot, struct HTAB *tuplecids); +extern void TeardownHistoricSnapshot(bool is_error); +extern bool HistoricSnapshotActive(void); + +extern Size EstimateSnapshotSpace(Snapshot snapshot); +extern void SerializeSnapshot(Snapshot snapshot, char *start_address); +extern Snapshot RestoreSnapshot(char *start_address); +extern void RestoreTransactionSnapshot(Snapshot snapshot, void *source_pgproc); + +#endif /* SNAPMGR_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/snapshot.h b/platform/dbops/binaries/postgres/include/server/utils/snapshot.h new file mode 100644 index 0000000000000000000000000000000000000000..8d1e31e888eea4d7a815d63e45f3d9c5be9174e3 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/snapshot.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------- + * + * snapshot.h + * POSTGRES snapshot definition + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/snapshot.h + * + *------------------------------------------------------------------------- + */ +#ifndef SNAPSHOT_H +#define SNAPSHOT_H + +#include "access/htup.h" +#include "access/xlogdefs.h" +#include "datatype/timestamp.h" +#include "lib/pairingheap.h" +#include "storage/buf.h" + + +/* + * The different snapshot types. We use SnapshotData structures to represent + * both "regular" (MVCC) snapshots and "special" snapshots that have non-MVCC + * semantics. The specific semantics of a snapshot are encoded by its type. + * + * The behaviour of each type of snapshot should be documented alongside its + * enum value, best in terms that are not specific to an individual table AM. + * + * The reason the snapshot type rather than a callback as it used to be is + * that that allows to use the same snapshot for different table AMs without + * having one callback per AM. + */ +typedef enum SnapshotType +{ + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid for the given MVCC snapshot. + * + * Here, we consider the effects of: + * - all transactions committed as of the time of the given snapshot + * - previous commands of this transaction + * + * Does _not_ include: + * - transactions shown as in-progress by the snapshot + * - transactions started after the snapshot was taken + * - changes made by the current command + * ------------------------------------------------------------------------- + */ + SNAPSHOT_MVCC = 0, + + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid "for itself". + * + * Here, we consider the effects of: + * - all committed transactions (as of the current instant) + * - previous commands of this transaction + * - changes made by the current command + * + * Does _not_ include: + * - in-progress transactions (as of the current instant) + * ------------------------------------------------------------------------- + */ + SNAPSHOT_SELF, + + /* + * Any tuple is visible. + */ + SNAPSHOT_ANY, + + /* + * A tuple is visible iff the tuple is valid as a TOAST row. + */ + SNAPSHOT_TOAST, + + /*------------------------------------------------------------------------- + * A tuple is visible iff the tuple is valid including effects of open + * transactions. + * + * Here, we consider the effects of: + * - all committed and in-progress transactions (as of the current instant) + * - previous commands of this transaction + * - changes made by the current command + * + * This is essentially like SNAPSHOT_SELF as far as effects of the current + * transaction and committed/aborted xacts are concerned. However, it + * also includes the effects of other xacts still in progress. + * + * A special hack is that when a snapshot of this type is used to + * determine tuple visibility, the passed-in snapshot struct is used as an + * output argument to return the xids of concurrent xacts that affected + * the tuple. snapshot->xmin is set to the tuple's xmin if that is + * another transaction that's still in progress; or to + * InvalidTransactionId if the tuple's xmin is committed good, committed + * dead, or my own xact. Similarly for snapshot->xmax and the tuple's + * xmax. If the tuple was inserted speculatively, meaning that the + * inserter might still back down on the insertion without aborting the + * whole transaction, the associated token is also returned in + * snapshot->speculativeToken. See also InitDirtySnapshot(). + * ------------------------------------------------------------------------- + */ + SNAPSHOT_DIRTY, + + /* + * A tuple is visible iff it follows the rules of SNAPSHOT_MVCC, but + * supports being called in timetravel context (for decoding catalog + * contents in the context of logical decoding). + */ + SNAPSHOT_HISTORIC_MVCC, + + /* + * A tuple is visible iff the tuple might be visible to some transaction; + * false if it's surely dead to everyone, i.e., vacuumable. + * + * For visibility checks snapshot->min must have been set up with the xmin + * horizon to use. + */ + SNAPSHOT_NON_VACUUMABLE, +} SnapshotType; + +typedef struct SnapshotData *Snapshot; + +#define InvalidSnapshot ((Snapshot) NULL) + +/* + * Struct representing all kind of possible snapshots. + * + * There are several different kinds of snapshots: + * * Normal MVCC snapshots + * * MVCC snapshots taken during recovery (in Hot-Standby mode) + * * Historic MVCC snapshots used during logical decoding + * * snapshots passed to HeapTupleSatisfiesDirty() + * * snapshots passed to HeapTupleSatisfiesNonVacuumable() + * * snapshots used for SatisfiesAny, Toast, Self where no members are + * accessed. + * + * TODO: It's probably a good idea to split this struct using a NodeTag + * similar to how parser and executor nodes are handled, with one type for + * each different kind of snapshot to avoid overloading the meaning of + * individual fields. + */ +typedef struct SnapshotData +{ + SnapshotType snapshot_type; /* type of snapshot */ + + /* + * The remaining fields are used only for MVCC snapshots, and are normally + * just zeroes in special snapshots. (But xmin and xmax are used + * specially by HeapTupleSatisfiesDirty, and xmin is used specially by + * HeapTupleSatisfiesNonVacuumable.) + * + * An MVCC snapshot can never see the effects of XIDs >= xmax. It can see + * the effects of all older XIDs except those listed in the snapshot. xmin + * is stored as an optimization to avoid needing to search the XID arrays + * for most tuples. + */ + TransactionId xmin; /* all XID < xmin are visible to me */ + TransactionId xmax; /* all XID >= xmax are invisible to me */ + + /* + * For normal MVCC snapshot this contains the all xact IDs that are in + * progress, unless the snapshot was taken during recovery in which case + * it's empty. For historic MVCC snapshots, the meaning is inverted, i.e. + * it contains *committed* transactions between xmin and xmax. + * + * note: all ids in xip[] satisfy xmin <= xip[i] < xmax + */ + TransactionId *xip; + uint32 xcnt; /* # of xact ids in xip[] */ + + /* + * For non-historic MVCC snapshots, this contains subxact IDs that are in + * progress (and other transactions that are in progress if taken during + * recovery). For historic snapshot it contains *all* xids assigned to the + * replayed transaction, including the toplevel xid. + * + * note: all ids in subxip[] are >= xmin, but we don't bother filtering + * out any that are >= xmax + */ + TransactionId *subxip; + int32 subxcnt; /* # of xact ids in subxip[] */ + bool suboverflowed; /* has the subxip array overflowed? */ + + bool takenDuringRecovery; /* recovery-shaped snapshot? */ + bool copied; /* false if it's a static snapshot */ + + CommandId curcid; /* in my xact, CID < curcid are visible */ + + /* + * An extra return value for HeapTupleSatisfiesDirty, not used in MVCC + * snapshots. + */ + uint32 speculativeToken; + + /* + * For SNAPSHOT_NON_VACUUMABLE (and hopefully more in the future) this is + * used to determine whether row could be vacuumed. + */ + struct GlobalVisState *vistest; + + /* + * Book-keeping information, used by the snapshot manager + */ + uint32 active_count; /* refcount on ActiveSnapshot stack */ + uint32 regd_count; /* refcount on RegisteredSnapshots */ + pairingheap_node ph_node; /* link in the RegisteredSnapshots heap */ + + TimestampTz whenTaken; /* timestamp when snapshot was taken */ + XLogRecPtr lsn; /* position in the WAL stream when taken */ + + /* + * The transaction completion count at the time GetSnapshotData() built + * this snapshot. Allows to avoid re-computing static snapshots when no + * transactions completed since the last GetSnapshotData(). + */ + uint64 snapXactCompletionCount; +} SnapshotData; + +#endif /* SNAPSHOT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/sortsupport.h b/platform/dbops/binaries/postgres/include/server/utils/sortsupport.h new file mode 100644 index 0000000000000000000000000000000000000000..4bf99584f88818fabc917e11f7e577e0e7ab951b --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/sortsupport.h @@ -0,0 +1,391 @@ +/*------------------------------------------------------------------------- + * + * sortsupport.h + * Framework for accelerated sorting. + * + * Traditionally, PostgreSQL has implemented sorting by repeatedly invoking + * an SQL-callable comparison function "cmp(x, y) returns int" on pairs of + * values to be compared, where the comparison function is the BTORDER_PROC + * pg_amproc support function of the appropriate btree index opclass. + * + * This file defines alternative APIs that allow sorting to be performed with + * reduced overhead. To support lower-overhead sorting, a btree opclass may + * provide a BTSORTSUPPORT_PROC pg_amproc entry, which must take a single + * argument of type internal and return void. The argument is actually a + * pointer to a SortSupportData struct, which is defined below. + * + * If provided, the BTSORTSUPPORT function will be called during sort setup, + * and it must initialize the provided struct with pointers to function(s) + * that can be called to perform sorting. This API is defined to allow + * multiple acceleration mechanisms to be supported, but no opclass is + * required to provide all of them. The BTSORTSUPPORT function should + * simply not set any function pointers for mechanisms it doesn't support. + * Opclasses that provide BTSORTSUPPORT and don't provide a comparator + * function will have a shim set up by sort support automatically. However, + * opclasses that support the optional additional abbreviated key capability + * must always provide an authoritative comparator used to tie-break + * inconclusive abbreviated comparisons and also used when aborting + * abbreviation. Furthermore, a converter and abort/costing function must be + * provided. + * + * All sort support functions will be passed the address of the + * SortSupportData struct when called, so they can use it to store + * additional private data as needed. In particular, for collation-aware + * datatypes, the ssup_collation field is set before calling BTSORTSUPPORT + * and is available to all support functions. Additional opclass-dependent + * data can be stored using the ssup_extra field. Any such data + * should be allocated in the ssup_cxt memory context. + * + * Note: since pg_amproc functions are indexed by (lefttype, righttype) + * it is possible to associate a BTSORTSUPPORT function with a cross-type + * comparison. This could sensibly be used to provide a fast comparator + * function for such cases, but probably not any other acceleration method. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/sortsupport.h + * + *------------------------------------------------------------------------- + */ +#ifndef SORTSUPPORT_H +#define SORTSUPPORT_H + +#include "access/attnum.h" +#include "utils/relcache.h" + +typedef struct SortSupportData *SortSupport; + +typedef struct SortSupportData +{ + /* + * These fields are initialized before calling the BTSORTSUPPORT function + * and should not be changed later. + */ + MemoryContext ssup_cxt; /* Context containing sort info */ + Oid ssup_collation; /* Collation to use, or InvalidOid */ + + /* + * Additional sorting parameters; but unlike ssup_collation, these can be + * changed after BTSORTSUPPORT is called, so don't use them in selecting + * sort support functions. + */ + bool ssup_reverse; /* descending-order sort? */ + bool ssup_nulls_first; /* sort nulls first? */ + + /* + * These fields are workspace for callers, and should not be touched by + * opclass-specific functions. + */ + AttrNumber ssup_attno; /* column number to sort */ + + /* + * ssup_extra is zeroed before calling the BTSORTSUPPORT function, and is + * not touched subsequently by callers. + */ + void *ssup_extra; /* Workspace for opclass functions */ + + /* + * Function pointers are zeroed before calling the BTSORTSUPPORT function, + * and must be set by it for any acceleration methods it wants to supply. + * The comparator pointer must be set, others are optional. + */ + + /* + * Comparator function has the same API as the traditional btree + * comparison function, ie, return <0, 0, or >0 according as x is less + * than, equal to, or greater than y. Note that x and y are guaranteed + * not null, and there is no way to return null either. + * + * This may be either the authoritative comparator, or the abbreviated + * comparator. Core code may switch this over the initial preference of + * an opclass support function despite originally indicating abbreviation + * was applicable, by assigning the authoritative comparator back. + */ + int (*comparator) (Datum x, Datum y, SortSupport ssup); + + /* + * "Abbreviated key" infrastructure follows. + * + * All callbacks must be set by sortsupport opclasses that make use of + * this optional additional infrastructure (unless for whatever reasons + * the opclass doesn't proceed with abbreviation, in which case + * abbrev_converter must not be set). + * + * This allows opclass authors to supply a conversion routine, used to + * create an alternative representation of the underlying type (an + * "abbreviated key"). This representation must be pass-by-value and + * typically will use some ad-hoc format that only the opclass has + * knowledge of. An alternative comparator, used only with this + * alternative representation must also be provided (which is assigned to + * "comparator"). This representation is a simple approximation of the + * original Datum. It must be possible to compare datums of this + * representation with each other using the supplied alternative + * comparator, and have any non-zero return value be a reliable proxy for + * what a proper comparison would indicate. Returning zero from the + * alternative comparator does not indicate equality, as with a + * conventional support routine 1, though -- it indicates that it wasn't + * possible to determine how the two abbreviated values compared. A + * proper comparison, using "abbrev_full_comparator"/ + * ApplySortAbbrevFullComparator() is therefore required. In many cases + * this results in most or all comparisons only using the cheap + * alternative comparison func, which is typically implemented as code + * that compiles to just a few CPU instructions. CPU cache miss penalties + * are expensive; to get good overall performance, sort infrastructure + * must heavily weigh cache performance. + * + * Opclass authors must consider the final cardinality of abbreviated keys + * when devising an encoding scheme. It's possible for a strategy to work + * better than an alternative strategy with one usage pattern, while the + * reverse might be true for another usage pattern. All of these factors + * must be considered. + */ + + /* + * "abbreviate" concerns whether or not the abbreviated key optimization + * is applicable in principle (that is, the sortsupport routine needs to + * know if its dealing with a key where an abbreviated representation can + * usefully be packed together. Conventionally, this is the leading + * attribute key). Note, however, that in order to determine that + * abbreviation is not in play, the core code always checks whether or not + * the opclass has set abbrev_converter. This is a one way, one time + * message to the opclass. + */ + bool abbreviate; + + /* + * Converter to abbreviated format, from original representation. Core + * code uses this callback to convert from a pass-by-reference "original" + * Datum to a pass-by-value abbreviated key Datum. Note that original is + * guaranteed NOT NULL, because it doesn't make sense to factor NULLness + * into ad-hoc cost model. + * + * abbrev_converter is tested to see if abbreviation is in play. Core + * code may set it to NULL to indicate abbreviation should not be used + * (which is something sortsupport routines need not concern themselves + * with). However, sortsupport routines must not set it when it is + * immediately established that abbreviation should not proceed (e.g., for + * !abbreviate calls, or due to platform-specific impediments to using + * abbreviation). + */ + Datum (*abbrev_converter) (Datum original, SortSupport ssup); + + /* + * abbrev_abort callback allows clients to verify that the current + * strategy is working out, using a sortsupport routine defined ad-hoc + * cost model. If there is a lot of duplicate abbreviated keys in + * practice, it's useful to be able to abandon the strategy before paying + * too high a cost in conversion (perhaps certain opclass-specific + * adaptations are useful too). + */ + bool (*abbrev_abort) (int memtupcount, SortSupport ssup); + + /* + * Full, authoritative comparator for key that an abbreviated + * representation was generated for, used when an abbreviated comparison + * was inconclusive (by calling ApplySortAbbrevFullComparator()), or used + * to replace "comparator" when core system ultimately decides against + * abbreviation. + */ + int (*abbrev_full_comparator) (Datum x, Datum y, SortSupport ssup); +} SortSupportData; + + +/* + * Apply a sort comparator function and return a 3-way comparison result. + * This takes care of handling reverse-sort and NULLs-ordering properly. + */ +static inline int +ApplySortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = ssup->comparator(datum1, datum2, ssup); + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +static inline int +ApplyUnsignedSortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = datum1 < datum2 ? -1 : datum1 > datum2 ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +#if SIZEOF_DATUM >= 8 +static inline int +ApplySignedSortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = DatumGetInt64(datum1) < DatumGetInt64(datum2) ? -1 : + DatumGetInt64(datum1) > DatumGetInt64(datum2) ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} +#endif + +static inline int +ApplyInt32SortComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = DatumGetInt32(datum1) < DatumGetInt32(datum2) ? -1 : + DatumGetInt32(datum1) > DatumGetInt32(datum2) ? 1 : 0; + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +/* + * Apply a sort comparator function and return a 3-way comparison using full, + * authoritative comparator. This takes care of handling reverse-sort and + * NULLs-ordering properly. + */ +static inline int +ApplySortAbbrevFullComparator(Datum datum1, bool isNull1, + Datum datum2, bool isNull2, + SortSupport ssup) +{ + int compare; + + if (isNull1) + { + if (isNull2) + compare = 0; /* NULL "=" NULL */ + else if (ssup->ssup_nulls_first) + compare = -1; /* NULL "<" NOT_NULL */ + else + compare = 1; /* NULL ">" NOT_NULL */ + } + else if (isNull2) + { + if (ssup->ssup_nulls_first) + compare = 1; /* NOT_NULL ">" NULL */ + else + compare = -1; /* NOT_NULL "<" NULL */ + } + else + { + compare = ssup->abbrev_full_comparator(datum1, datum2, ssup); + if (ssup->ssup_reverse) + INVERT_COMPARE_RESULT(compare); + } + + return compare; +} + +/* + * Datum comparison functions that we have specialized sort routines for. + * Datatypes that install these as their comparator or abbreviated comparator + * are eligible for faster sorting. + */ +extern int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup); +#if SIZEOF_DATUM >= 8 +extern int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup); +#endif +extern int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup); + +/* Other functions in utils/sort/sortsupport.c */ +extern void PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup); +extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup); +extern void PrepareSortSupportFromIndexRel(Relation indexRel, int16 strategy, + SortSupport ssup); +extern void PrepareSortSupportFromGistIndexRel(Relation indexRel, SortSupport ssup); + +#endif /* SORTSUPPORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/spccache.h b/platform/dbops/binaries/postgres/include/server/utils/spccache.h new file mode 100644 index 0000000000000000000000000000000000000000..11cfa719955eda23171008c471be6298c2b7a5df --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/spccache.h @@ -0,0 +1,21 @@ +/*------------------------------------------------------------------------- + * + * spccache.h + * Tablespace cache. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/spccache.h + * + *------------------------------------------------------------------------- + */ +#ifndef SPCCACHE_H +#define SPCCACHE_H + +extern void get_tablespace_page_costs(Oid spcid, float8 *spc_random_page_cost, + float8 *spc_seq_page_cost); +extern int get_tablespace_io_concurrency(Oid spcid); +extern int get_tablespace_maintenance_io_concurrency(Oid spcid); + +#endif /* SPCCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/syscache.h b/platform/dbops/binaries/postgres/include/server/utils/syscache.h new file mode 100644 index 0000000000000000000000000000000000000000..b541911c8fc27c10cc6bdf7d24645ab554a30881 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/syscache.h @@ -0,0 +1,136 @@ +/*------------------------------------------------------------------------- + * + * syscache.h + * System catalog cache definitions. + * + * See also lsyscache.h, which provides convenience routines for + * common cache-lookup operations. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/syscache.h + * + *------------------------------------------------------------------------- + */ +#ifndef SYSCACHE_H +#define SYSCACHE_H + +#include "access/attnum.h" +#include "access/htup.h" +/* we intentionally do not include utils/catcache.h here */ + +#include "catalog/syscache_ids.h" + +extern void InitCatalogCache(void); +extern void InitCatalogCachePhase2(void); + +extern HeapTuple SearchSysCache(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +/* + * The use of argument specific numbers is encouraged. They're faster, and + * insulates the caller from changes in the maximum number of keys. + */ +extern HeapTuple SearchSysCache1(int cacheId, + Datum key1); +extern HeapTuple SearchSysCache2(int cacheId, + Datum key1, Datum key2); +extern HeapTuple SearchSysCache3(int cacheId, + Datum key1, Datum key2, Datum key3); +extern HeapTuple SearchSysCache4(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +extern void ReleaseSysCache(HeapTuple tuple); + +extern HeapTuple SearchSysCacheLocked1(int cacheId, + Datum key1); + +/* convenience routines */ +extern HeapTuple SearchSysCacheCopy(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); +extern HeapTuple SearchSysCacheLockedCopy1(int cacheId, + Datum key1); +extern bool SearchSysCacheExists(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); +extern Oid GetSysCacheOid(int cacheId, AttrNumber oidcol, + Datum key1, Datum key2, Datum key3, Datum key4); + +extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname); +extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname); +extern bool SearchSysCacheExistsAttName(Oid relid, const char *attname); + +extern HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum); +extern HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum); + +extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup, + AttrNumber attributeNumber, bool *isNull); + +extern Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, + AttrNumber attributeNumber); + +extern uint32 GetSysCacheHashValue(int cacheId, + Datum key1, Datum key2, Datum key3, Datum key4); + +/* list-search interface. Users of this must import catcache.h too */ +struct catclist; +extern struct catclist *SearchSysCacheList(int cacheId, int nkeys, + Datum key1, Datum key2, Datum key3); + +extern void SysCacheInvalidate(int cacheId, uint32 hashValue); + +extern bool RelationInvalidatesSnapshotsOnly(Oid relid); +extern bool RelationHasSysCache(Oid relid); +extern bool RelationSupportsSysCache(Oid relid); + +/* + * The use of the macros below rather than direct calls to the corresponding + * functions is encouraged, as it insulates the caller from changes in the + * maximum number of keys. + */ +#define SearchSysCacheCopy1(cacheId, key1) \ + SearchSysCacheCopy(cacheId, key1, 0, 0, 0) +#define SearchSysCacheCopy2(cacheId, key1, key2) \ + SearchSysCacheCopy(cacheId, key1, key2, 0, 0) +#define SearchSysCacheCopy3(cacheId, key1, key2, key3) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, 0) +#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheCopy(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheExists1(cacheId, key1) \ + SearchSysCacheExists(cacheId, key1, 0, 0, 0) +#define SearchSysCacheExists2(cacheId, key1, key2) \ + SearchSysCacheExists(cacheId, key1, key2, 0, 0) +#define SearchSysCacheExists3(cacheId, key1, key2, key3) \ + SearchSysCacheExists(cacheId, key1, key2, key3, 0) +#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \ + SearchSysCacheExists(cacheId, key1, key2, key3, key4) + +#define GetSysCacheOid1(cacheId, oidcol, key1) \ + GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0) +#define GetSysCacheOid2(cacheId, oidcol, key1, key2) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0) +#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0) +#define GetSysCacheOid4(cacheId, oidcol, key1, key2, key3, key4) \ + GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4) + +#define GetSysCacheHashValue1(cacheId, key1) \ + GetSysCacheHashValue(cacheId, key1, 0, 0, 0) +#define GetSysCacheHashValue2(cacheId, key1, key2) \ + GetSysCacheHashValue(cacheId, key1, key2, 0, 0) +#define GetSysCacheHashValue3(cacheId, key1, key2, key3) \ + GetSysCacheHashValue(cacheId, key1, key2, key3, 0) +#define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \ + GetSysCacheHashValue(cacheId, key1, key2, key3, key4) + +#define SearchSysCacheList1(cacheId, key1) \ + SearchSysCacheList(cacheId, 1, key1, 0, 0) +#define SearchSysCacheList2(cacheId, key1, key2) \ + SearchSysCacheList(cacheId, 2, key1, key2, 0) +#define SearchSysCacheList3(cacheId, key1, key2, key3) \ + SearchSysCacheList(cacheId, 3, key1, key2, key3) + +#define ReleaseSysCacheList(x) ReleaseCatCacheList(x) + +#endif /* SYSCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/timeout.h b/platform/dbops/binaries/postgres/include/server/utils/timeout.h new file mode 100644 index 0000000000000000000000000000000000000000..a5d8f078246fcf4497b5bbf79978d398000f69dc --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/timeout.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * timeout.h + * Routines to multiplex SIGALRM interrupts for multiple timeout reasons. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/timeout.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIMEOUT_H +#define TIMEOUT_H + +#include "datatype/timestamp.h" + +/* + * Identifiers for timeout reasons. Note that in case multiple timeouts + * trigger at the same time, they are serviced in the order of this enum. + */ +typedef enum TimeoutId +{ + /* Predefined timeout reasons */ + STARTUP_PACKET_TIMEOUT, + DEADLOCK_TIMEOUT, + LOCK_TIMEOUT, + STATEMENT_TIMEOUT, + STANDBY_DEADLOCK_TIMEOUT, + STANDBY_TIMEOUT, + STANDBY_LOCK_TIMEOUT, + IDLE_IN_TRANSACTION_SESSION_TIMEOUT, + TRANSACTION_TIMEOUT, + IDLE_SESSION_TIMEOUT, + IDLE_STATS_UPDATE_TIMEOUT, + CLIENT_CONNECTION_CHECK_TIMEOUT, + STARTUP_PROGRESS_TIMEOUT, + /* First user-definable timeout reason */ + USER_TIMEOUT, + /* Maximum number of timeout reasons */ + MAX_TIMEOUTS = USER_TIMEOUT + 10 +} TimeoutId; + +/* callback function signature */ +typedef void (*timeout_handler_proc) (void); + +/* + * Parameter structure for setting multiple timeouts at once + */ +typedef enum TimeoutType +{ + TMPARAM_AFTER, + TMPARAM_AT, + TMPARAM_EVERY, +} TimeoutType; + +typedef struct +{ + TimeoutId id; /* timeout to set */ + TimeoutType type; /* TMPARAM_AFTER or TMPARAM_AT */ + int delay_ms; /* only used for TMPARAM_AFTER/EVERY */ + TimestampTz fin_time; /* only used for TMPARAM_AT */ +} EnableTimeoutParams; + +/* + * Parameter structure for clearing multiple timeouts at once + */ +typedef struct +{ + TimeoutId id; /* timeout to clear */ + bool keep_indicator; /* keep the indicator flag? */ +} DisableTimeoutParams; + +/* timeout setup */ +extern void InitializeTimeouts(void); +extern TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler); +extern void reschedule_timeouts(void); + +/* timeout operation */ +extern void enable_timeout_after(TimeoutId id, int delay_ms); +extern void enable_timeout_every(TimeoutId id, TimestampTz fin_time, + int delay_ms); +extern void enable_timeout_at(TimeoutId id, TimestampTz fin_time); +extern void enable_timeouts(const EnableTimeoutParams *timeouts, int count); +extern void disable_timeout(TimeoutId id, bool keep_indicator); +extern void disable_timeouts(const DisableTimeoutParams *timeouts, int count); +extern void disable_all_timeouts(bool keep_indicators); + +/* accessors */ +extern bool get_timeout_active(TimeoutId id); +extern bool get_timeout_indicator(TimeoutId id, bool reset_indicator); +extern TimestampTz get_timeout_start_time(TimeoutId id); +extern TimestampTz get_timeout_finish_time(TimeoutId id); + +#endif /* TIMEOUT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/timestamp.h b/platform/dbops/binaries/postgres/include/server/utils/timestamp.h new file mode 100644 index 0000000000000000000000000000000000000000..a6ce03ed46045fb748daf02f0f6e06492ad5a181 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/timestamp.h @@ -0,0 +1,147 @@ +/*------------------------------------------------------------------------- + * + * timestamp.h + * Definitions for the SQL "timestamp" and "interval" types. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/timestamp.h + * + *------------------------------------------------------------------------- + */ +#ifndef TIMESTAMP_H +#define TIMESTAMP_H + +#include "datatype/timestamp.h" +#include "fmgr.h" +#include "pgtime.h" + + +/* + * Functions for fmgr-callable functions. + * + * For Timestamp, we make use of the same support routines as for int64. + * Therefore Timestamp is pass-by-reference if and only if int64 is! + */ +static inline Timestamp +DatumGetTimestamp(Datum X) +{ + return (Timestamp) DatumGetInt64(X); +} + +static inline TimestampTz +DatumGetTimestampTz(Datum X) +{ + return (TimestampTz) DatumGetInt64(X); +} + +static inline Interval * +DatumGetIntervalP(Datum X) +{ + return (Interval *) DatumGetPointer(X); +} + +static inline Datum +TimestampGetDatum(Timestamp X) +{ + return Int64GetDatum(X); +} + +static inline Datum +TimestampTzGetDatum(TimestampTz X) +{ + return Int64GetDatum(X); +} + +static inline Datum +IntervalPGetDatum(const Interval *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_TIMESTAMP(n) DatumGetTimestamp(PG_GETARG_DATUM(n)) +#define PG_GETARG_TIMESTAMPTZ(n) DatumGetTimestampTz(PG_GETARG_DATUM(n)) +#define PG_GETARG_INTERVAL_P(n) DatumGetIntervalP(PG_GETARG_DATUM(n)) + +#define PG_RETURN_TIMESTAMP(x) return TimestampGetDatum(x) +#define PG_RETURN_TIMESTAMPTZ(x) return TimestampTzGetDatum(x) +#define PG_RETURN_INTERVAL_P(x) return IntervalPGetDatum(x) + + +#define TIMESTAMP_MASK(b) (1 << (b)) +#define INTERVAL_MASK(b) (1 << (b)) + +/* Macros to handle packing and unpacking the typmod field for intervals */ +#define INTERVAL_FULL_RANGE (0x7FFF) +#define INTERVAL_RANGE_MASK (0x7FFF) +#define INTERVAL_FULL_PRECISION (0xFFFF) +#define INTERVAL_PRECISION_MASK (0xFFFF) +#define INTERVAL_TYPMOD(p,r) ((((r) & INTERVAL_RANGE_MASK) << 16) | ((p) & INTERVAL_PRECISION_MASK)) +#define INTERVAL_PRECISION(t) ((t) & INTERVAL_PRECISION_MASK) +#define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) + +/* Macros for doing timestamp arithmetic without assuming timestamp's units */ +#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000)) +#define TimestampTzPlusSeconds(tz,s) ((tz) + ((s) * (int64) 1000000)) + + +/* Set at postmaster start */ +extern PGDLLIMPORT TimestampTz PgStartTime; + +/* Set at configuration reload */ +extern PGDLLIMPORT TimestampTz PgReloadTime; + + +/* Internal routines (not fmgr-callable) */ + +extern int32 anytimestamp_typmod_check(bool istz, int32 typmod); + +extern TimestampTz GetCurrentTimestamp(void); +extern TimestampTz GetSQLCurrentTimestamp(int32 typmod); +extern Timestamp GetSQLLocalTimestamp(int32 typmod); +extern void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, + long *secs, int *microsecs); +extern long TimestampDifferenceMilliseconds(TimestampTz start_time, + TimestampTz stop_time); +extern bool TimestampDifferenceExceeds(TimestampTz start_time, + TimestampTz stop_time, + int msec); + +extern TimestampTz time_t_to_timestamptz(pg_time_t tm); +extern pg_time_t timestamptz_to_time_t(TimestampTz t); + +extern const char *timestamptz_to_str(TimestampTz t); + +extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result); +extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, + fsec_t *fsec, const char **tzn, pg_tz *attimezone); +extern void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec); + +extern void interval2itm(Interval span, struct pg_itm *itm); +extern int itm2interval(struct pg_itm *itm, Interval *span); +extern int itmin2interval(struct pg_itm_in *itm_in, Interval *span); + +extern Timestamp SetEpochTimestamp(void); +extern void GetEpochTime(struct pg_tm *tm); + +extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2); + +/* timestamp comparison works for timestamptz also */ +#define timestamptz_cmp_internal(dt1,dt2) timestamp_cmp_internal(dt1, dt2) + +extern TimestampTz timestamp2timestamptz_opt_overflow(Timestamp timestamp, + int *overflow); +extern int32 timestamp_cmp_timestamptz_internal(Timestamp timestampVal, + TimestampTz dt2); + +extern int isoweek2j(int year, int week); +extern void isoweek2date(int woy, int *year, int *mon, int *mday); +extern void isoweekdate2date(int isoweek, int wday, int *year, int *mon, int *mday); +extern int date2isoweek(int year, int mon, int mday); +extern int date2isoyear(int year, int mon, int mday); +extern int date2isoyearday(int year, int mon, int mday); + +extern bool TimestampTimestampTzRequiresRewrite(void); + +#endif /* TIMESTAMP_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/tuplesort.h b/platform/dbops/binaries/postgres/include/server/utils/tuplesort.h new file mode 100644 index 0000000000000000000000000000000000000000..cde83f6201525ef63d32efd1f8bf49097c36e862 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/tuplesort.h @@ -0,0 +1,472 @@ +/*------------------------------------------------------------------------- + * + * tuplesort.h + * Generalized tuple sorting routines. + * + * This module handles sorting of heap tuples, index tuples, or single + * Datums (and could easily support other kinds of sortable objects, + * if necessary). It works efficiently for both small and large amounts + * of data. Small amounts are sorted in-memory using qsort(). Large + * amounts are sorted using temporary files and a standard external sort + * algorithm. Parallel sorts use a variant of this external sort + * algorithm, and are typically only used for large amounts of data. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tuplesort.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPLESORT_H +#define TUPLESORT_H + +#include "access/brin_tuple.h" +#include "access/itup.h" +#include "executor/tuptable.h" +#include "storage/dsm.h" +#include "utils/logtape.h" +#include "utils/relcache.h" +#include "utils/sortsupport.h" + + +/* + * Tuplesortstate and Sharedsort are opaque types whose details are not + * known outside tuplesort.c. + */ +typedef struct Tuplesortstate Tuplesortstate; +typedef struct Sharedsort Sharedsort; + +/* + * Tuplesort parallel coordination state, allocated by each participant in + * local memory. Participant caller initializes everything. See usage notes + * below. + */ +typedef struct SortCoordinateData +{ + /* Worker process? If not, must be leader. */ + bool isWorker; + + /* + * Leader-process-passed number of participants known launched (workers + * set this to -1). Includes state within leader needed for it to + * participate as a worker, if any. + */ + int nParticipants; + + /* Private opaque state (points to shared memory) */ + Sharedsort *sharedsort; +} SortCoordinateData; + +typedef struct SortCoordinateData *SortCoordinate; + +/* + * Data structures for reporting sort statistics. Note that + * TuplesortInstrumentation can't contain any pointers because we + * sometimes put it in shared memory. + * + * The parallel-sort infrastructure relies on having a zero TuplesortMethod + * to indicate that a worker never did anything, so we assign zero to + * SORT_TYPE_STILL_IN_PROGRESS. The other values of this enum can be + * OR'ed together to represent a situation where different workers used + * different methods, so we need a separate bit for each one. Keep the + * NUM_TUPLESORTMETHODS constant in sync with the number of bits! + */ +typedef enum +{ + SORT_TYPE_STILL_IN_PROGRESS = 0, + SORT_TYPE_TOP_N_HEAPSORT = 1 << 0, + SORT_TYPE_QUICKSORT = 1 << 1, + SORT_TYPE_EXTERNAL_SORT = 1 << 2, + SORT_TYPE_EXTERNAL_MERGE = 1 << 3, +} TuplesortMethod; + +#define NUM_TUPLESORTMETHODS 4 + +typedef enum +{ + SORT_SPACE_TYPE_DISK, + SORT_SPACE_TYPE_MEMORY, +} TuplesortSpaceType; + +/* Bitwise option flags for tuple sorts */ +#define TUPLESORT_NONE 0 + +/* specifies whether non-sequential access to the sort result is required */ +#define TUPLESORT_RANDOMACCESS (1 << 0) + +/* specifies if the tuplesort is able to support bounded sorts */ +#define TUPLESORT_ALLOWBOUNDED (1 << 1) + +/* + * For bounded sort, tuples get pfree'd when they fall outside of the bound. + * When bounded sorts are not required, we can use a bump context for tuple + * allocation as there's no risk that pfree will ever be called for a tuple. + * Define a macro to make it easier for code to figure out if we're using a + * bump allocator. + */ +#define TupleSortUseBumpTupleCxt(opt) (((opt) & TUPLESORT_ALLOWBOUNDED) == 0) + +typedef struct TuplesortInstrumentation +{ + TuplesortMethod sortMethod; /* sort algorithm used */ + TuplesortSpaceType spaceType; /* type of space spaceUsed represents */ + int64 spaceUsed; /* space consumption, in kB */ +} TuplesortInstrumentation; + +/* + * The objects we actually sort are SortTuple structs. These contain + * a pointer to the tuple proper (might be a MinimalTuple or IndexTuple), + * which is a separate palloc chunk --- we assume it is just one chunk and + * can be freed by a simple pfree() (except during merge, where we use a + * simple slab allocator, and during a non-bounded sort where we use a bump + * allocator). SortTuples also contain the tuple's first key column in + * Datum/nullflag format, and a source/input tape number that tracks which + * tape each heap element/slot belongs to during merging. + * + * Storing the first key column lets us save heap_getattr or index_getattr + * calls during tuple comparisons. We could extract and save all the key + * columns not just the first, but this would increase code complexity and + * overhead, and wouldn't actually save any comparison cycles in the common + * case where the first key determines the comparison result. Note that + * for a pass-by-reference datatype, datum1 points into the "tuple" storage. + * + * There is one special case: when the sort support infrastructure provides an + * "abbreviated key" representation, where the key is (typically) a pass by + * value proxy for a pass by reference type. In this case, the abbreviated key + * is stored in datum1 in place of the actual first key column. + * + * When sorting single Datums, the data value is represented directly by + * datum1/isnull1 for pass by value types (or null values). If the datatype is + * pass-by-reference and isnull1 is false, then "tuple" points to a separately + * palloc'd data value, otherwise "tuple" is NULL. The value of datum1 is then + * either the same pointer as "tuple", or is an abbreviated key value as + * described above. Accordingly, "tuple" is always used in preference to + * datum1 as the authoritative value for pass-by-reference cases. + */ +typedef struct +{ + void *tuple; /* the tuple itself */ + Datum datum1; /* value of first key column */ + bool isnull1; /* is first key column NULL? */ + int srctape; /* source tape number */ +} SortTuple; + +typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b, + Tuplesortstate *state); + +/* + * The public part of a Tuple sort operation state. This data structure + * contains the definition of sort-variant-specific interface methods and + * the part of Tuple sort operation state required by their implementations. + */ +typedef struct +{ + /* + * These function pointers decouple the routines that must know what kind + * of tuple we are sorting from the routines that don't need to know it. + * They are set up by the tuplesort_begin_xxx routines. + * + * Function to compare two tuples; result is per qsort() convention, ie: + * <0, 0, >0 according as ab. The API must match + * qsort_arg_comparator. + */ + SortTupleComparator comparetup; + + /* + * Fall back to the full tuple for comparison, but only compare the first + * sortkey if it was abbreviated. Otherwise, only compare second and later + * sortkeys. + */ + SortTupleComparator comparetup_tiebreak; + + /* + * Alter datum1 representation in the SortTuple's array back from the + * abbreviated key to the first column value. + */ + void (*removeabbrev) (Tuplesortstate *state, SortTuple *stups, + int count); + + /* + * Function to write a stored tuple onto tape. The representation of the + * tuple on tape need not be the same as it is in memory. + */ + void (*writetup) (Tuplesortstate *state, LogicalTape *tape, + SortTuple *stup); + + /* + * Function to read a stored tuple from tape back into memory. 'len' is + * the already-read length of the stored tuple. The tuple is allocated + * from the slab memory arena, or is palloc'd, see + * tuplesort_readtup_alloc(). + */ + void (*readtup) (Tuplesortstate *state, SortTuple *stup, + LogicalTape *tape, unsigned int len); + + /* + * Function to do some specific release of resources for the sort variant. + * In particular, this function should free everything stored in the "arg" + * field, which wouldn't be cleared on reset of the Tuple sort memory + * contexts. This can be NULL if nothing specific needs to be done. + */ + void (*freestate) (Tuplesortstate *state); + + /* + * The subsequent fields are used in the implementations of the functions + * above. + */ + MemoryContext maincontext; /* memory context for tuple sort metadata that + * persists across multiple batches */ + MemoryContext sortcontext; /* memory context holding most sort data */ + MemoryContext tuplecontext; /* sub-context of sortcontext for tuple data */ + + /* + * Whether SortTuple's datum1 and isnull1 members are maintained by the + * above routines. If not, some sort specializations are disabled. + */ + bool haveDatum1; + + /* + * The sortKeys variable is used by every case other than the hash index + * case; it is set by tuplesort_begin_xxx. tupDesc is only used by the + * MinimalTuple and CLUSTER routines, though. + */ + int nKeys; /* number of columns in sort key */ + SortSupport sortKeys; /* array of length nKeys */ + + /* + * This variable is shared by the single-key MinimalTuple case and the + * Datum case (which both use qsort_ssup()). Otherwise, it's NULL. The + * presence of a value in this field is also checked by various sort + * specialization functions as an optimization when comparing the leading + * key in a tiebreak situation to determine if there are any subsequent + * keys to sort on. + */ + SortSupport onlyKey; + + int sortopt; /* Bitmask of flags used to setup sort */ + + bool tuples; /* Can SortTuple.tuple ever be set? */ + + void *arg; /* Specific information for the sort variant */ +} TuplesortPublic; + +/* Sort parallel code from state for sort__start probes */ +#define PARALLEL_SORT(coordinate) (coordinate == NULL || \ + (coordinate)->sharedsort == NULL ? 0 : \ + (coordinate)->isWorker ? 1 : 2) + +#define TuplesortstateGetPublic(state) ((TuplesortPublic *) state) + +/* When using this macro, beware of double evaluation of len */ +#define LogicalTapeReadExact(tape, ptr, len) \ + do { \ + if (LogicalTapeRead(tape, ptr, len) != (size_t) (len)) \ + elog(ERROR, "unexpected end of data"); \ + } while(0) + +/* + * We provide multiple interfaces to what is essentially the same code, + * since different callers have different data to be sorted and want to + * specify the sort key information differently. There are two APIs for + * sorting HeapTuples and two more for sorting IndexTuples. Yet another + * API supports sorting bare Datums. + * + * Serial sort callers should pass NULL for their coordinate argument. + * + * The "heap" API actually stores/sorts MinimalTuples, which means it doesn't + * preserve the system columns (tuple identity and transaction visibility + * info). The sort keys are specified by column numbers within the tuples + * and sort operator OIDs. We save some cycles by passing and returning the + * tuples in TupleTableSlots, rather than forming actual HeapTuples (which'd + * have to be converted to MinimalTuples). This API works well for sorts + * executed as parts of plan trees. + * + * The "cluster" API stores/sorts full HeapTuples including all visibility + * info. The sort keys are specified by reference to a btree index that is + * defined on the relation to be sorted. Note that putheaptuple/getheaptuple + * go with this API, not the "begin_heap" one! + * + * The "index_btree" API stores/sorts IndexTuples (preserving all their + * header fields). The sort keys are specified by a btree index definition. + * + * The "index_hash" API is similar to index_btree, but the tuples are + * actually sorted by their hash codes not the raw data. + * + * The "index_brin" API is similar to index_btree, but the tuples are + * BrinTuple and are sorted by their block number not the raw data. + * + * Parallel sort callers are required to coordinate multiple tuplesort states + * in a leader process and one or more worker processes. The leader process + * must launch workers, and have each perform an independent "partial" + * tuplesort, typically fed by the parallel heap interface. The leader later + * produces the final output (internally, it merges runs output by workers). + * + * Callers must do the following to perform a sort in parallel using multiple + * worker processes: + * + * 1. Request tuplesort-private shared memory for n workers. Use + * tuplesort_estimate_shared() to get the required size. + * 2. Have leader process initialize allocated shared memory using + * tuplesort_initialize_shared(). Launch workers. + * 3. Initialize a coordinate argument within both the leader process, and + * for each worker process. This has a pointer to the shared + * tuplesort-private structure, as well as some caller-initialized fields. + * Leader's coordinate argument reliably indicates number of workers + * launched (this is unused by workers). + * 4. Begin a tuplesort using some appropriate tuplesort_begin* routine, + * (passing the coordinate argument) within each worker. The workMem + * arguments need not be identical. All other arguments should match + * exactly, though. + * 5. tuplesort_attach_shared() should be called by all workers. Feed tuples + * to each worker, and call tuplesort_performsort() within each when input + * is exhausted. + * 6. Call tuplesort_end() in each worker process. Worker processes can shut + * down once tuplesort_end() returns. + * 7. Begin a tuplesort in the leader using the same tuplesort_begin* + * routine, passing a leader-appropriate coordinate argument (this can + * happen as early as during step 3, actually, since we only need to know + * the number of workers successfully launched). The leader must now wait + * for workers to finish. Caller must use own mechanism for ensuring that + * next step isn't reached until all workers have called and returned from + * tuplesort_performsort(). (Note that it's okay if workers have already + * also called tuplesort_end() by then.) + * 8. Call tuplesort_performsort() in leader. Consume output using the + * appropriate tuplesort_get* routine. Leader can skip this step if + * tuplesort turns out to be unnecessary. + * 9. Call tuplesort_end() in leader. + * + * This division of labor assumes nothing about how input tuples are produced, + * but does require that caller combine the state of multiple tuplesorts for + * any purpose other than producing the final output. For example, callers + * must consider that tuplesort_get_stats() reports on only one worker's role + * in a sort (or the leader's role), and not statistics for the sort as a + * whole. + * + * Note that callers may use the leader process to sort runs as if it was an + * independent worker process (prior to the process performing a leader sort + * to produce the final sorted output). Doing so only requires a second + * "partial" tuplesort within the leader process, initialized like that of a + * worker process. The steps above don't touch on this directly. The only + * difference is that the tuplesort_attach_shared() call is never needed within + * leader process, because the backend as a whole holds the shared fileset + * reference. A worker Tuplesortstate in leader is expected to do exactly the + * same amount of total initial processing work as a worker process + * Tuplesortstate, since the leader process has nothing else to do before + * workers finish. + * + * Note that only a very small amount of memory will be allocated prior to + * the leader state first consuming input, and that workers will free the + * vast majority of their memory upon returning from tuplesort_performsort(). + * Callers can rely on this to arrange for memory to be used in a way that + * respects a workMem-style budget across an entire parallel sort operation. + * + * Callers are responsible for parallel safety in general. However, they + * can at least rely on there being no parallel safety hazards within + * tuplesort, because tuplesort thinks of the sort as several independent + * sorts whose results are combined. Since, in general, the behavior of + * sort operators is immutable, caller need only worry about the parallel + * safety of whatever the process is through which input tuples are + * generated (typically, caller uses a parallel heap scan). + */ + + +extern Tuplesortstate *tuplesort_begin_common(int workMem, + SortCoordinate coordinate, + int sortopt); +extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound); +extern bool tuplesort_used_bound(Tuplesortstate *state); +extern void tuplesort_puttuple_common(Tuplesortstate *state, + SortTuple *tuple, bool useAbbrev, + Size tuplen); +extern void tuplesort_performsort(Tuplesortstate *state); +extern bool tuplesort_gettuple_common(Tuplesortstate *state, bool forward, + SortTuple *stup); +extern bool tuplesort_skiptuples(Tuplesortstate *state, int64 ntuples, + bool forward); +extern void tuplesort_end(Tuplesortstate *state); +extern void tuplesort_reset(Tuplesortstate *state); + +extern void tuplesort_get_stats(Tuplesortstate *state, + TuplesortInstrumentation *stats); +extern const char *tuplesort_method_name(TuplesortMethod m); +extern const char *tuplesort_space_type_name(TuplesortSpaceType t); + +extern int tuplesort_merge_order(int64 allowedMem); + +extern Size tuplesort_estimate_shared(int nWorkers); +extern void tuplesort_initialize_shared(Sharedsort *shared, int nWorkers, + dsm_segment *seg); +extern void tuplesort_attach_shared(Sharedsort *shared, dsm_segment *seg); + +/* + * These routines may only be called if TUPLESORT_RANDOMACCESS was specified + * during tuplesort_begin_*. Additionally backwards scan in gettuple/getdatum + * also require TUPLESORT_RANDOMACCESS. Note that parallel sorts do not + * support random access. + */ +extern void tuplesort_rescan(Tuplesortstate *state); +extern void tuplesort_markpos(Tuplesortstate *state); +extern void tuplesort_restorepos(Tuplesortstate *state); + +extern void *tuplesort_readtup_alloc(Tuplesortstate *state, Size tuplen); + + +/* tuplesortvariants.c */ + +extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc, + int nkeys, AttrNumber *attNums, + Oid *sortOperators, Oid *sortCollations, + bool *nullsFirstFlags, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc, + Relation indexRel, int workMem, + SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_btree(Relation heapRel, + Relation indexRel, + bool enforceUnique, + bool uniqueNullsNotDistinct, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_hash(Relation heapRel, + Relation indexRel, + uint32 high_mask, + uint32 low_mask, + uint32 max_buckets, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_gist(Relation heapRel, + Relation indexRel, + int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_index_brin(int workMem, SortCoordinate coordinate, + int sortopt); +extern Tuplesortstate *tuplesort_begin_datum(Oid datumType, + Oid sortOperator, Oid sortCollation, + bool nullsFirstFlag, + int workMem, SortCoordinate coordinate, + int sortopt); + +extern void tuplesort_puttupleslot(Tuplesortstate *state, + TupleTableSlot *slot); +extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup); +extern void tuplesort_putindextuplevalues(Tuplesortstate *state, + Relation rel, ItemPointer self, + const Datum *values, const bool *isnull); +extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size); +extern void tuplesort_putdatum(Tuplesortstate *state, Datum val, + bool isNull); + +extern bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward, + bool copy, TupleTableSlot *slot, Datum *abbrev); +extern HeapTuple tuplesort_getheaptuple(Tuplesortstate *state, bool forward); +extern IndexTuple tuplesort_getindextuple(Tuplesortstate *state, bool forward); +extern BrinTuple *tuplesort_getbrintuple(Tuplesortstate *state, Size *len, + bool forward); +extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward, bool copy, + Datum *val, bool *isNull, Datum *abbrev); + + +#endif /* TUPLESORT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/tuplestore.h b/platform/dbops/binaries/postgres/include/server/utils/tuplestore.h new file mode 100644 index 0000000000000000000000000000000000000000..419613c17bab13f11cb5a5249548759ef8f69930 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/tuplestore.h @@ -0,0 +1,88 @@ +/*------------------------------------------------------------------------- + * + * tuplestore.h + * Generalized routines for temporary tuple storage. + * + * This module handles temporary storage of tuples for purposes such + * as Materialize nodes, hashjoin batch files, etc. It is essentially + * a dumbed-down version of tuplesort.c; it does no sorting of tuples + * but can only store and regurgitate a sequence of tuples. However, + * because no sort is required, it is allowed to start reading the sequence + * before it has all been written. This is particularly useful for cursors, + * because it allows random access within the already-scanned portion of + * a query without having to process the underlying scan to completion. + * Also, it is possible to support multiple independent read pointers. + * + * A temporary file is used to handle the data if it exceeds the + * space limit specified by the caller. + * + * Beginning in Postgres 8.2, what is stored is just MinimalTuples; + * callers cannot expect valid system columns in regurgitated tuples. + * Also, we have changed the API to return tuples in TupleTableSlots, + * so that there is a check to prevent attempted access to system columns. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tuplestore.h + * + *------------------------------------------------------------------------- + */ +#ifndef TUPLESTORE_H +#define TUPLESTORE_H + +#include "executor/tuptable.h" + + +/* Tuplestorestate is an opaque type whose details are not known outside + * tuplestore.c. + */ +typedef struct Tuplestorestate Tuplestorestate; + +/* + * Currently we only need to store MinimalTuples, but it would be easy + * to support the same behavior for IndexTuples and/or bare Datums. + */ + +extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess, + bool interXact, + int maxKBytes); + +extern void tuplestore_set_eflags(Tuplestorestate *state, int eflags); + +extern void tuplestore_puttupleslot(Tuplestorestate *state, + TupleTableSlot *slot); +extern void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple); +extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, + const Datum *values, const bool *isnull); + +extern int tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags); + +extern void tuplestore_select_read_pointer(Tuplestorestate *state, int ptr); + +extern void tuplestore_copy_read_pointer(Tuplestorestate *state, + int srcptr, int destptr); + +extern void tuplestore_trim(Tuplestorestate *state); + +extern bool tuplestore_in_memory(Tuplestorestate *state); + +extern bool tuplestore_gettupleslot(Tuplestorestate *state, bool forward, + bool copy, TupleTableSlot *slot); + +extern bool tuplestore_advance(Tuplestorestate *state, bool forward); + +extern bool tuplestore_skiptuples(Tuplestorestate *state, + int64 ntuples, bool forward); + +extern int64 tuplestore_tuple_count(Tuplestorestate *state); + +extern bool tuplestore_ateof(Tuplestorestate *state); + +extern void tuplestore_rescan(Tuplestorestate *state); + +extern void tuplestore_clear(Tuplestorestate *state); + +extern void tuplestore_end(Tuplestorestate *state); + +#endif /* TUPLESTORE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/typcache.h b/platform/dbops/binaries/postgres/include/server/utils/typcache.h new file mode 100644 index 0000000000000000000000000000000000000000..f506cc4aa35d47698c8c3340c5225d060eaf72d8 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/typcache.h @@ -0,0 +1,210 @@ +/*------------------------------------------------------------------------- + * + * typcache.h + * Type cache definitions. + * + * The type cache exists to speed lookup of certain information about data + * types that is not directly available from a type's pg_type row. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/typcache.h + * + *------------------------------------------------------------------------- + */ +#ifndef TYPCACHE_H +#define TYPCACHE_H + +#include "access/tupdesc.h" +#include "fmgr.h" +#include "storage/dsm.h" +#include "utils/dsa.h" + + +/* DomainConstraintCache is an opaque struct known only within typcache.c */ +typedef struct DomainConstraintCache DomainConstraintCache; + +/* TypeCacheEnumData is an opaque struct known only within typcache.c */ +struct TypeCacheEnumData; + +typedef struct TypeCacheEntry +{ + /* typeId is the hash lookup key and MUST BE FIRST */ + Oid type_id; /* OID of the data type */ + + uint32 type_id_hash; /* hashed value of the OID */ + + /* some subsidiary information copied from the pg_type row */ + int16 typlen; + bool typbyval; + char typalign; + char typstorage; + char typtype; + Oid typrelid; + Oid typsubscript; + Oid typelem; + Oid typcollation; + + /* + * Information obtained from opfamily entries + * + * These will be InvalidOid if no match could be found, or if the + * information hasn't yet been requested. Also note that for array and + * composite types, typcache.c checks that the contained types are + * comparable or hashable before allowing eq_opr etc to become set. + */ + Oid btree_opf; /* the default btree opclass' family */ + Oid btree_opintype; /* the default btree opclass' opcintype */ + Oid hash_opf; /* the default hash opclass' family */ + Oid hash_opintype; /* the default hash opclass' opcintype */ + Oid eq_opr; /* the equality operator */ + Oid lt_opr; /* the less-than operator */ + Oid gt_opr; /* the greater-than operator */ + Oid cmp_proc; /* the btree comparison function */ + Oid hash_proc; /* the hash calculation function */ + Oid hash_extended_proc; /* the extended hash calculation function */ + + /* + * Pre-set-up fmgr call info for the equality operator, the btree + * comparison function, and the hash calculation function. These are kept + * in the type cache to avoid problems with memory leaks in repeated calls + * to functions such as array_eq, array_cmp, hash_array. There is not + * currently a need to maintain call info for the lt_opr or gt_opr. + */ + FmgrInfo eq_opr_finfo; + FmgrInfo cmp_proc_finfo; + FmgrInfo hash_proc_finfo; + FmgrInfo hash_extended_proc_finfo; + + /* + * Tuple descriptor if it's a composite type (row type). NULL if not + * composite or information hasn't yet been requested. (NOTE: this is a + * reference-counted tupledesc.) + * + * To simplify caching dependent info, tupDesc_identifier is an identifier + * for this tupledesc that is unique for the life of the process, and + * changes anytime the tupledesc does. Zero if not yet determined. + */ + TupleDesc tupDesc; + uint64 tupDesc_identifier; + + /* + * Fields computed when TYPECACHE_RANGE_INFO is requested. Zeroes if not + * a range type or information hasn't yet been requested. Note that + * rng_cmp_proc_finfo could be different from the element type's default + * btree comparison function. + */ + struct TypeCacheEntry *rngelemtype; /* range's element type */ + Oid rng_opfamily; /* opfamily to use for range comparisons */ + Oid rng_collation; /* collation for comparisons, if any */ + FmgrInfo rng_cmp_proc_finfo; /* comparison function */ + FmgrInfo rng_canonical_finfo; /* canonicalization function, if any */ + FmgrInfo rng_subdiff_finfo; /* difference function, if any */ + + /* + * Fields computed when TYPECACHE_MULTIRANGE_INFO is required. + */ + struct TypeCacheEntry *rngtype; /* multirange's range underlying type */ + + /* + * Domain's base type and typmod if it's a domain type. Zeroes if not + * domain, or if information hasn't been requested. + */ + Oid domainBaseType; + int32 domainBaseTypmod; + + /* + * Domain constraint data if it's a domain type. NULL if not domain, or + * if domain has no constraints, or if information hasn't been requested. + */ + DomainConstraintCache *domainData; + + /* Private data, for internal use of typcache.c only */ + int flags; /* flags about what we've computed */ + + /* + * Private information about an enum type. NULL if not enum or + * information hasn't been requested. + */ + struct TypeCacheEnumData *enumData; + + /* We also maintain a list of all known domain-type cache entries */ + struct TypeCacheEntry *nextDomain; +} TypeCacheEntry; + +/* Bit flags to indicate which fields a given caller needs to have set */ +#define TYPECACHE_EQ_OPR 0x00001 +#define TYPECACHE_LT_OPR 0x00002 +#define TYPECACHE_GT_OPR 0x00004 +#define TYPECACHE_CMP_PROC 0x00008 +#define TYPECACHE_HASH_PROC 0x00010 +#define TYPECACHE_EQ_OPR_FINFO 0x00020 +#define TYPECACHE_CMP_PROC_FINFO 0x00040 +#define TYPECACHE_HASH_PROC_FINFO 0x00080 +#define TYPECACHE_TUPDESC 0x00100 +#define TYPECACHE_BTREE_OPFAMILY 0x00200 +#define TYPECACHE_HASH_OPFAMILY 0x00400 +#define TYPECACHE_RANGE_INFO 0x00800 +#define TYPECACHE_DOMAIN_BASE_INFO 0x01000 +#define TYPECACHE_DOMAIN_CONSTR_INFO 0x02000 +#define TYPECACHE_HASH_EXTENDED_PROC 0x04000 +#define TYPECACHE_HASH_EXTENDED_PROC_FINFO 0x08000 +#define TYPECACHE_MULTIRANGE_INFO 0x10000 + +/* This value will not equal any valid tupledesc identifier, nor 0 */ +#define INVALID_TUPLEDESC_IDENTIFIER ((uint64) 1) + +/* + * Callers wishing to maintain a long-lived reference to a domain's constraint + * set must store it in one of these. Use InitDomainConstraintRef() and + * UpdateDomainConstraintRef() to manage it. Note: DomainConstraintState is + * considered an executable expression type, so it's defined in execnodes.h. + */ +typedef struct DomainConstraintRef +{ + List *constraints; /* list of DomainConstraintState nodes */ + MemoryContext refctx; /* context holding DomainConstraintRef */ + TypeCacheEntry *tcache; /* typcache entry for domain type */ + bool need_exprstate; /* does caller need check_exprstate? */ + + /* Management data --- treat these fields as private to typcache.c */ + DomainConstraintCache *dcc; /* current constraints, or NULL if none */ + MemoryContextCallback callback; /* used to release refcount when done */ +} DomainConstraintRef; + +typedef struct SharedRecordTypmodRegistry SharedRecordTypmodRegistry; + +extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags); + +extern void InitDomainConstraintRef(Oid type_id, DomainConstraintRef *ref, + MemoryContext refctx, bool need_exprstate); + +extern void UpdateDomainConstraintRef(DomainConstraintRef *ref); + +extern bool DomainHasConstraints(Oid type_id); + +extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod); + +extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod, + bool noError); + +extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod); + +extern TupleDesc lookup_rowtype_tupdesc_domain(Oid type_id, int32 typmod, + bool noError); + +extern void assign_record_type_typmod(TupleDesc tupDesc); + +extern uint64 assign_record_type_identifier(Oid type_id, int32 typmod); + +extern int compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2); + +extern size_t SharedRecordTypmodRegistryEstimate(void); + +extern void SharedRecordTypmodRegistryInit(SharedRecordTypmodRegistry *, + dsm_segment *segment, dsa_area *area); + +extern void SharedRecordTypmodRegistryAttach(SharedRecordTypmodRegistry *); + +#endif /* TYPCACHE_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/tzparser.h b/platform/dbops/binaries/postgres/include/server/utils/tzparser.h new file mode 100644 index 0000000000000000000000000000000000000000..5d5edfff2baa687c1d8939146fb3dd3f28adbed7 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/tzparser.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * tzparser.h + * Timezone offset file parsing definitions. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/tzparser.h + * + *------------------------------------------------------------------------- + */ +#ifndef TZPARSER_H +#define TZPARSER_H + +#include "utils/datetime.h" + +/* + * The result of parsing a timezone configuration file is an array of + * these structs, in order by abbrev. We export this because datetime.c + * needs it. + */ +typedef struct tzEntry +{ + /* the actual data */ + char *abbrev; /* TZ abbreviation (downcased) */ + char *zone; /* zone name if dynamic abbrev, else NULL */ + /* for a dynamic abbreviation, offset/is_dst are not used */ + int offset; /* offset in seconds from UTC */ + bool is_dst; /* true if a DST abbreviation */ + /* source information (for error messages) */ + int lineno; + const char *filename; +} tzEntry; + + +extern TimeZoneAbbrevTable *load_tzoffsets(const char *filename); + +#endif /* TZPARSER_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/usercontext.h b/platform/dbops/binaries/postgres/include/server/utils/usercontext.h new file mode 100644 index 0000000000000000000000000000000000000000..a8195c194de6bfac706b0850560e7e86ae424805 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/usercontext.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * usercontext.h + * Convenience functions for running code as a different database user. + * + *------------------------------------------------------------------------- + */ +#ifndef USERCONTEXT_H +#define USERCONTEXT_H + +/* + * When temporarily changing to run as a different user, this structure + * holds the details needed to restore the original state. + */ +typedef struct UserContext +{ + Oid save_userid; + int save_sec_context; + int save_nestlevel; +} UserContext; + +/* Function prototypes. */ +extern void SwitchToUntrustedUser(Oid userid, UserContext *context); +extern void RestoreUserContext(UserContext *context); + +#endif /* USERCONTEXT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/uuid.h b/platform/dbops/binaries/postgres/include/server/utils/uuid.h new file mode 100644 index 0000000000000000000000000000000000000000..ae631e75d557d8ba062141a6c65aa989906a03a1 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/uuid.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * uuid.h + * Header file for the "uuid" ADT. In C, we use the name pg_uuid_t, + * to avoid conflicts with any uuid_t type that might be defined by + * the system headers. + * + * Copyright (c) 2007-2024, PostgreSQL Global Development Group + * + * src/include/utils/uuid.h + * + *------------------------------------------------------------------------- + */ +#ifndef UUID_H +#define UUID_H + +/* uuid size in bytes */ +#define UUID_LEN 16 + +typedef struct pg_uuid_t +{ + unsigned char data[UUID_LEN]; +} pg_uuid_t; + +/* fmgr interface macros */ +static inline Datum +UUIDPGetDatum(const pg_uuid_t *X) +{ + return PointerGetDatum(X); +} + +#define PG_RETURN_UUID_P(X) return UUIDPGetDatum(X) + +static inline pg_uuid_t * +DatumGetUUIDP(Datum X) +{ + return (pg_uuid_t *) DatumGetPointer(X); +} + +#define PG_GETARG_UUID_P(X) DatumGetUUIDP(PG_GETARG_DATUM(X)) + +#endif /* UUID_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/varbit.h b/platform/dbops/binaries/postgres/include/server/utils/varbit.h new file mode 100644 index 0000000000000000000000000000000000000000..312062cac64568f040554e43c13079d44ed62dcf --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/varbit.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------------------- + * + * varbit.h + * Functions for the SQL datatypes BIT() and BIT VARYING(). + * + * Code originally contributed by Adriaan Joubert. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/varbit.h + * + *------------------------------------------------------------------------- + */ +#ifndef VARBIT_H +#define VARBIT_H + +#include + +#include "fmgr.h" + +/* + * Modeled on struct varlena from postgres.h, but data type is bits8. + * + * Caution: if bit_len is not a multiple of BITS_PER_BYTE, the low-order + * bits of the last byte of bit_dat[] are unused and MUST be zeroes. + * (This allows bit_cmp() to not bother masking the last byte.) + * Also, there should not be any excess bytes counted in the header length. + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 bit_len; /* number of valid bits */ + bits8 bit_dat[FLEXIBLE_ARRAY_MEMBER]; /* bit string, most sig. byte + * first */ +} VarBit; + +/* + * fmgr interface macros + * + * BIT and BIT VARYING are toastable varlena types. They are the same + * as far as representation goes, so we just have one set of macros. + */ +static inline VarBit * +DatumGetVarBitP(Datum X) +{ + return (VarBit *) PG_DETOAST_DATUM(X); +} + +static inline VarBit * +DatumGetVarBitPCopy(Datum X) +{ + return (VarBit *) PG_DETOAST_DATUM_COPY(X); +} + +static inline Datum +VarBitPGetDatum(const VarBit *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_VARBIT_P(n) DatumGetVarBitP(PG_GETARG_DATUM(n)) +#define PG_GETARG_VARBIT_P_COPY(n) DatumGetVarBitPCopy(PG_GETARG_DATUM(n)) +#define PG_RETURN_VARBIT_P(x) return VarBitPGetDatum(x) + +/* Header overhead *in addition to* VARHDRSZ */ +#define VARBITHDRSZ sizeof(int32) +/* Number of bits in this bit string */ +#define VARBITLEN(PTR) (((VarBit *) (PTR))->bit_len) +/* Pointer to the first byte containing bit string data */ +#define VARBITS(PTR) (((VarBit *) (PTR))->bit_dat) +/* Number of bytes in the data section of a bit string */ +#define VARBITBYTES(PTR) (VARSIZE(PTR) - VARHDRSZ - VARBITHDRSZ) +/* Padding of the bit string at the end (in bits) */ +#define VARBITPAD(PTR) (VARBITBYTES(PTR)*BITS_PER_BYTE - VARBITLEN(PTR)) +/* Number of bytes needed to store a bit string of a given length */ +#define VARBITTOTALLEN(BITLEN) (((BITLEN) + BITS_PER_BYTE-1)/BITS_PER_BYTE + \ + VARHDRSZ + VARBITHDRSZ) +/* + * Maximum number of bits. Several code sites assume no overflow from + * computing bitlen + X; VARBITTOTALLEN() has the largest such X. + */ +#define VARBITMAXLEN (INT_MAX - BITS_PER_BYTE + 1) +/* pointer beyond the end of the bit string (like end() in STL containers) */ +#define VARBITEND(PTR) (((bits8 *) (PTR)) + VARSIZE(PTR)) +/* Mask that will cover exactly one byte, i.e. BITS_PER_BYTE bits */ +#define BITMASK 0xFF + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/varlena.h b/platform/dbops/binaries/postgres/include/server/utils/varlena.h new file mode 100644 index 0000000000000000000000000000000000000000..e6d90b94be81a324ad168e647f915818490c0f30 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/varlena.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * varlena.h + * Functions for the variable-length built-in types. + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/varlena.h + * + *------------------------------------------------------------------------- + */ +#ifndef VARLENA_H +#define VARLENA_H + +#include "nodes/pg_list.h" +#include "utils/sortsupport.h" + +extern int varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid); +extern void varstr_sortsupport(SortSupport ssup, Oid typid, Oid collid); +extern int varstr_levenshtein(const char *source, int slen, + const char *target, int tlen, + int ins_c, int del_c, int sub_c, + bool trusted); +extern int varstr_levenshtein_less_equal(const char *source, int slen, + const char *target, int tlen, + int ins_c, int del_c, int sub_c, + int max_d, bool trusted); +extern List *textToQualifiedNameList(text *textval); +extern bool SplitIdentifierString(char *rawstring, char separator, + List **namelist); +extern bool SplitDirectoriesString(char *rawstring, char separator, + List **namelist); +extern bool SplitGUCList(char *rawstring, char separator, + List **namelist); +extern text *replace_text_regexp(text *src_text, text *pattern_text, + text *replace_text, + int cflags, Oid collation, + int search_start, int n); + +typedef struct ClosestMatchState +{ + const char *source; + int min_d; + int max_d; + const char *match; +} ClosestMatchState; + +extern void initClosestMatch(ClosestMatchState *state, const char *source, int max_d); +extern void updateClosestMatch(ClosestMatchState *state, const char *candidate); +extern const char *getClosestMatch(ClosestMatchState *state); + +#endif diff --git a/platform/dbops/binaries/postgres/include/server/utils/wait_event.h b/platform/dbops/binaries/postgres/include/server/utils/wait_event.h new file mode 100644 index 0000000000000000000000000000000000000000..9f18a753d47efef586be8844e5bf9ab408a7bb55 --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/wait_event.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * wait_event.h + * Definitions related to wait event reporting + * + * Copyright (c) 2001-2024, PostgreSQL Global Development Group + * + * src/include/utils/wait_event.h + * ---------- + */ +#ifndef WAIT_EVENT_H +#define WAIT_EVENT_H + + +/* ---------- + * Wait Classes + * ---------- + */ +#define PG_WAIT_LWLOCK 0x01000000U +#define PG_WAIT_LOCK 0x03000000U +#define PG_WAIT_BUFFERPIN 0x04000000U +#define PG_WAIT_ACTIVITY 0x05000000U +#define PG_WAIT_CLIENT 0x06000000U +#define PG_WAIT_EXTENSION 0x07000000U +#define PG_WAIT_IPC 0x08000000U +#define PG_WAIT_TIMEOUT 0x09000000U +#define PG_WAIT_IO 0x0A000000U +#define PG_WAIT_INJECTIONPOINT 0x0B000000U + +/* enums for wait events */ +#include "utils/wait_event_types.h" + +extern const char *pgstat_get_wait_event(uint32 wait_event_info); +extern const char *pgstat_get_wait_event_type(uint32 wait_event_info); +static inline void pgstat_report_wait_start(uint32 wait_event_info); +static inline void pgstat_report_wait_end(void); +extern void pgstat_set_wait_event_storage(uint32 *wait_event_info); +extern void pgstat_reset_wait_event_storage(void); + +extern PGDLLIMPORT uint32 *my_wait_event_info; + + +/* + * Wait Events - Extension, InjectionPoint + * + * Use InjectionPoint when the server process is waiting in an injection + * point. Use Extension for other cases of the server process waiting for + * some condition defined by an extension module. + * + * Extensions can define their own wait events in these categories. They + * should call one of these functions with a wait event string. If the wait + * event associated to a string is already allocated, it returns the wait + * event information to use. If not, it gets one wait event ID allocated from + * a shared counter, associates the string to the ID in the shared dynamic + * hash and returns the wait event information. + * + * The ID retrieved can be used with pgstat_report_wait_start() or equivalent. + */ +extern uint32 WaitEventExtensionNew(const char *wait_event_name); +extern uint32 WaitEventInjectionPointNew(const char *wait_event_name); + +extern void WaitEventCustomShmemInit(void); +extern Size WaitEventCustomShmemSize(void); +extern char **GetWaitEventCustomNames(uint32 classId, int *nwaitevents); + +/* ---------- + * pgstat_report_wait_start() - + * + * Called from places where server process needs to wait. This is called + * to report wait event information. The wait information is stored + * as 4-bytes where first byte represents the wait event class (type of + * wait, for different types of wait, refer WaitClass) and the next + * 3-bytes represent the actual wait event. Currently 2-bytes are used + * for wait event which is sufficient for current usage, 1-byte is + * reserved for future usage. + * + * Historically we used to make this reporting conditional on + * pgstat_track_activities, but the check for that seems to add more cost + * than it saves. + * + * my_wait_event_info initially points to local memory, making it safe to + * call this before MyProc has been initialized. + * ---------- + */ +static inline void +pgstat_report_wait_start(uint32 wait_event_info) +{ + /* + * Since this is a four-byte field which is always read and written as + * four-bytes, updates are atomic. + */ + *(volatile uint32 *) my_wait_event_info = wait_event_info; +} + +/* ---------- + * pgstat_report_wait_end() - + * + * Called to report end of a wait. + * ---------- + */ +static inline void +pgstat_report_wait_end(void) +{ + /* see pgstat_report_wait_start() */ + *(volatile uint32 *) my_wait_event_info = 0; +} + + +#endif /* WAIT_EVENT_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/wait_event_types.h b/platform/dbops/binaries/postgres/include/server/utils/wait_event_types.h new file mode 100644 index 0000000000000000000000000000000000000000..fdd1e2ea26b0e42dbba28fbe933f5b276f13709f --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/wait_event_types.h @@ -0,0 +1,218 @@ +/*------------------------------------------------------------------------- + * + * wait_event_types.h + * Generated wait events infrastructure code + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * NOTES + * ****************************** + * *** DO NOT EDIT THIS FILE! *** + * ****************************** + * + * It has been GENERATED by src/backend/utils/activity/generate-wait_event_types.pl + * + *------------------------------------------------------------------------- + */ + +#ifndef WAIT_EVENT_TYPES_H +#define WAIT_EVENT_TYPES_H + +#include "utils/wait_event.h" + +typedef enum +{ + WAIT_EVENT_ARCHIVER_MAIN = PG_WAIT_ACTIVITY, + WAIT_EVENT_AUTOVACUUM_MAIN, + WAIT_EVENT_BGWRITER_HIBERNATE, + WAIT_EVENT_BGWRITER_MAIN, + WAIT_EVENT_CHECKPOINTER_MAIN, + WAIT_EVENT_LOGICAL_APPLY_MAIN, + WAIT_EVENT_LOGICAL_LAUNCHER_MAIN, + WAIT_EVENT_LOGICAL_PARALLEL_APPLY_MAIN, + WAIT_EVENT_RECOVERY_WAL_STREAM, + WAIT_EVENT_REPLICATION_SLOTSYNC_MAIN, + WAIT_EVENT_REPLICATION_SLOTSYNC_SHUTDOWN, + WAIT_EVENT_SYSLOGGER_MAIN, + WAIT_EVENT_WAL_RECEIVER_MAIN, + WAIT_EVENT_WAL_SENDER_MAIN, + WAIT_EVENT_WAL_SUMMARIZER_WAL, + WAIT_EVENT_WAL_WRITER_MAIN +} WaitEventActivity; + +typedef enum +{ + WAIT_EVENT_BUFFER_PIN = PG_WAIT_BUFFERPIN +} WaitEventBufferPin; + +typedef enum +{ + WAIT_EVENT_CLIENT_READ = PG_WAIT_CLIENT, + WAIT_EVENT_CLIENT_WRITE, + WAIT_EVENT_GSS_OPEN_SERVER, + WAIT_EVENT_LIBPQWALRECEIVER_CONNECT, + WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE, + WAIT_EVENT_SSL_OPEN_SERVER, + WAIT_EVENT_WAIT_FOR_STANDBY_CONFIRMATION, + WAIT_EVENT_WAL_SENDER_WAIT_FOR_WAL, + WAIT_EVENT_WAL_SENDER_WRITE_DATA +} WaitEventClient; + +typedef enum +{ + WAIT_EVENT_BASEBACKUP_READ = PG_WAIT_IO, + WAIT_EVENT_BASEBACKUP_SYNC, + WAIT_EVENT_BASEBACKUP_WRITE, + WAIT_EVENT_BUFFILE_READ, + WAIT_EVENT_BUFFILE_TRUNCATE, + WAIT_EVENT_BUFFILE_WRITE, + WAIT_EVENT_CONTROL_FILE_READ, + WAIT_EVENT_CONTROL_FILE_SYNC, + WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE, + WAIT_EVENT_CONTROL_FILE_WRITE, + WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE, + WAIT_EVENT_COPY_FILE_READ, + WAIT_EVENT_COPY_FILE_WRITE, + WAIT_EVENT_DATA_FILE_EXTEND, + WAIT_EVENT_DATA_FILE_FLUSH, + WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC, + WAIT_EVENT_DATA_FILE_PREFETCH, + WAIT_EVENT_DATA_FILE_READ, + WAIT_EVENT_DATA_FILE_SYNC, + WAIT_EVENT_DATA_FILE_TRUNCATE, + WAIT_EVENT_DATA_FILE_WRITE, + WAIT_EVENT_DSM_ALLOCATE, + WAIT_EVENT_DSM_FILL_ZERO_WRITE, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC, + WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE, + WAIT_EVENT_LOCK_FILE_CREATE_READ, + WAIT_EVENT_LOCK_FILE_CREATE_SYNC, + WAIT_EVENT_LOCK_FILE_CREATE_WRITE, + WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ, + WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE, + WAIT_EVENT_LOGICAL_REWRITE_SYNC, + WAIT_EVENT_LOGICAL_REWRITE_TRUNCATE, + WAIT_EVENT_LOGICAL_REWRITE_WRITE, + WAIT_EVENT_RELATION_MAP_READ, + WAIT_EVENT_RELATION_MAP_REPLACE, + WAIT_EVENT_RELATION_MAP_WRITE, + WAIT_EVENT_REORDER_BUFFER_READ, + WAIT_EVENT_REORDER_BUFFER_WRITE, + WAIT_EVENT_REORDER_LOGICAL_MAPPING_READ, + WAIT_EVENT_REPLICATION_SLOT_READ, + WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC, + WAIT_EVENT_REPLICATION_SLOT_SYNC, + WAIT_EVENT_REPLICATION_SLOT_WRITE, + WAIT_EVENT_SLRU_FLUSH_SYNC, + WAIT_EVENT_SLRU_READ, + WAIT_EVENT_SLRU_SYNC, + WAIT_EVENT_SLRU_WRITE, + WAIT_EVENT_SNAPBUILD_READ, + WAIT_EVENT_SNAPBUILD_SYNC, + WAIT_EVENT_SNAPBUILD_WRITE, + WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC, + WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE, + WAIT_EVENT_TIMELINE_HISTORY_READ, + WAIT_EVENT_TIMELINE_HISTORY_SYNC, + WAIT_EVENT_TIMELINE_HISTORY_WRITE, + WAIT_EVENT_TWOPHASE_FILE_READ, + WAIT_EVENT_TWOPHASE_FILE_SYNC, + WAIT_EVENT_TWOPHASE_FILE_WRITE, + WAIT_EVENT_VERSION_FILE_SYNC, + WAIT_EVENT_VERSION_FILE_WRITE, + WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ, + WAIT_EVENT_WAL_BOOTSTRAP_SYNC, + WAIT_EVENT_WAL_BOOTSTRAP_WRITE, + WAIT_EVENT_WAL_COPY_READ, + WAIT_EVENT_WAL_COPY_SYNC, + WAIT_EVENT_WAL_COPY_WRITE, + WAIT_EVENT_WAL_INIT_SYNC, + WAIT_EVENT_WAL_INIT_WRITE, + WAIT_EVENT_WAL_READ, + WAIT_EVENT_WAL_SUMMARY_READ, + WAIT_EVENT_WAL_SUMMARY_WRITE, + WAIT_EVENT_WAL_SYNC, + WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN, + WAIT_EVENT_WAL_WRITE +} WaitEventIO; + +typedef enum +{ + WAIT_EVENT_APPEND_READY = PG_WAIT_IPC, + WAIT_EVENT_ARCHIVE_CLEANUP_COMMAND, + WAIT_EVENT_ARCHIVE_COMMAND, + WAIT_EVENT_BACKEND_TERMINATION, + WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE, + WAIT_EVENT_BGWORKER_SHUTDOWN, + WAIT_EVENT_BGWORKER_STARTUP, + WAIT_EVENT_BTREE_PAGE, + WAIT_EVENT_BUFFER_IO, + WAIT_EVENT_CHECKPOINT_DELAY_COMPLETE, + WAIT_EVENT_CHECKPOINT_DELAY_START, + WAIT_EVENT_CHECKPOINT_DONE, + WAIT_EVENT_CHECKPOINT_START, + WAIT_EVENT_EXECUTE_GATHER, + WAIT_EVENT_HASH_BATCH_ALLOCATE, + WAIT_EVENT_HASH_BATCH_ELECT, + WAIT_EVENT_HASH_BATCH_LOAD, + WAIT_EVENT_HASH_BUILD_ALLOCATE, + WAIT_EVENT_HASH_BUILD_ELECT, + WAIT_EVENT_HASH_BUILD_HASH_INNER, + WAIT_EVENT_HASH_BUILD_HASH_OUTER, + WAIT_EVENT_HASH_GROW_BATCHES_DECIDE, + WAIT_EVENT_HASH_GROW_BATCHES_ELECT, + WAIT_EVENT_HASH_GROW_BATCHES_FINISH, + WAIT_EVENT_HASH_GROW_BATCHES_REALLOCATE, + WAIT_EVENT_HASH_GROW_BATCHES_REPARTITION, + WAIT_EVENT_HASH_GROW_BUCKETS_ELECT, + WAIT_EVENT_HASH_GROW_BUCKETS_REALLOCATE, + WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT, + WAIT_EVENT_LOGICAL_APPLY_SEND_DATA, + WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE, + WAIT_EVENT_LOGICAL_SYNC_DATA, + WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE, + WAIT_EVENT_MESSAGE_QUEUE_INTERNAL, + WAIT_EVENT_MESSAGE_QUEUE_PUT_MESSAGE, + WAIT_EVENT_MESSAGE_QUEUE_RECEIVE, + WAIT_EVENT_MESSAGE_QUEUE_SEND, + WAIT_EVENT_MULTIXACT_CREATION, + WAIT_EVENT_PARALLEL_BITMAP_SCAN, + WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN, + WAIT_EVENT_PARALLEL_FINISH, + WAIT_EVENT_PROCARRAY_GROUP_UPDATE, + WAIT_EVENT_PROC_SIGNAL_BARRIER, + WAIT_EVENT_PROMOTE, + WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT, + WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE, + WAIT_EVENT_RECOVERY_END_COMMAND, + WAIT_EVENT_RECOVERY_PAUSE, + WAIT_EVENT_REPLICATION_ORIGIN_DROP, + WAIT_EVENT_REPLICATION_SLOT_DROP, + WAIT_EVENT_RESTORE_COMMAND, + WAIT_EVENT_SAFE_SNAPSHOT, + WAIT_EVENT_SYNC_REP, + WAIT_EVENT_WAL_RECEIVER_EXIT, + WAIT_EVENT_WAL_RECEIVER_WAIT_START, + WAIT_EVENT_WAL_SUMMARY_READY, + WAIT_EVENT_XACT_GROUP_UPDATE +} WaitEventIPC; + +typedef enum +{ + WAIT_EVENT_BASE_BACKUP_THROTTLE = PG_WAIT_TIMEOUT, + WAIT_EVENT_CHECKPOINT_WRITE_DELAY, + WAIT_EVENT_PG_SLEEP, + WAIT_EVENT_RECOVERY_APPLY_DELAY, + WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL, + WAIT_EVENT_REGISTER_SYNC_REQUEST, + WAIT_EVENT_SPIN_DELAY, + WAIT_EVENT_VACUUM_DELAY, + WAIT_EVENT_VACUUM_TRUNCATE, + WAIT_EVENT_WAL_SUMMARIZER_ERROR +} WaitEventTimeout; + +#endif /* WAIT_EVENT_TYPES_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/xid8.h b/platform/dbops/binaries/postgres/include/server/utils/xid8.h new file mode 100644 index 0000000000000000000000000000000000000000..e8f887c633331511bbf762012f57fa21b419648d --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/xid8.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * xid8.h + * Header file for the "xid8" ADT. + * + * Copyright (c) 2020-2024, PostgreSQL Global Development Group + * + * src/include/utils/xid8.h + * + *------------------------------------------------------------------------- + */ +#ifndef XID8_H +#define XID8_H + +#include "access/transam.h" + +static inline FullTransactionId +DatumGetFullTransactionId(Datum X) +{ + return FullTransactionIdFromU64(DatumGetUInt64(X)); +} + +static inline Datum +FullTransactionIdGetDatum(FullTransactionId X) +{ + return UInt64GetDatum(U64FromFullTransactionId(X)); +} + +#define PG_GETARG_FULLTRANSACTIONID(X) DatumGetFullTransactionId(PG_GETARG_DATUM(X)) +#define PG_RETURN_FULLTRANSACTIONID(X) return FullTransactionIdGetDatum(X) + +#endif /* XID8_H */ diff --git a/platform/dbops/binaries/postgres/include/server/utils/xml.h b/platform/dbops/binaries/postgres/include/server/utils/xml.h new file mode 100644 index 0000000000000000000000000000000000000000..ed20e213753ac66e734c5cd188d4dc44f680c83e --- /dev/null +++ b/platform/dbops/binaries/postgres/include/server/utils/xml.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * xml.h + * Declarations for XML data type support. + * + * + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/utils/xml.h + * + *------------------------------------------------------------------------- + */ + +#ifndef XML_H +#define XML_H + +#include "executor/tablefunc.h" +#include "fmgr.h" +#include "nodes/execnodes.h" +#include "nodes/primnodes.h" + +typedef struct varlena xmltype; + +typedef enum +{ + XML_STANDALONE_YES, + XML_STANDALONE_NO, + XML_STANDALONE_NO_VALUE, + XML_STANDALONE_OMITTED, +} XmlStandaloneType; + +typedef enum +{ + XMLBINARY_BASE64, + XMLBINARY_HEX, +} XmlBinaryType; + +typedef enum +{ + PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result + * indicates error condition */ + PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */ + PG_XML_STRICTNESS_ALL, /* report all notices/warnings/errors */ +} PgXmlStrictness; + +/* struct PgXmlErrorContext is private to xml.c */ +typedef struct PgXmlErrorContext PgXmlErrorContext; + +static inline xmltype * +DatumGetXmlP(Datum X) +{ + return (xmltype *) PG_DETOAST_DATUM(X); +} + +static inline Datum +XmlPGetDatum(const xmltype *X) +{ + return PointerGetDatum(X); +} + +#define PG_GETARG_XML_P(n) DatumGetXmlP(PG_GETARG_DATUM(n)) +#define PG_RETURN_XML_P(x) PG_RETURN_POINTER(x) + +extern void pg_xml_init_library(void); +extern PgXmlErrorContext *pg_xml_init(PgXmlStrictness strictness); +extern void pg_xml_done(PgXmlErrorContext *errcxt, bool isError); +extern bool pg_xml_error_occurred(PgXmlErrorContext *errcxt); +extern void xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, + const char *msg); + +extern xmltype *xmlconcat(List *args); +extern xmltype *xmlelement(XmlExpr *xexpr, + Datum *named_argvalue, bool *named_argnull, + Datum *argvalue, bool *argnull); +extern xmltype *xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace); +extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null); +extern xmltype *xmlroot(xmltype *data, text *version, int standalone); +extern bool xml_is_document(xmltype *arg); +extern text *xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg, + bool indent); +extern char *escape_xml(const char *str); + +extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escaped, bool escape_period); +extern char *map_xml_name_to_sql_identifier(const char *name); +extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings); + +extern PGDLLIMPORT int xmlbinary; /* XmlBinaryType, but int for guc enum */ + +extern PGDLLIMPORT int xmloption; /* XmlOptionType, but int for guc enum */ + +extern PGDLLIMPORT const TableFuncRoutine XmlTableRoutine; + +#endif /* XML_H */