|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "catalog/pg_collation.h"#include "miscadmin.h"#include "tsearch/dicts/spell.h"#include "tsearch/ts_locale.h"#include "utils/formatting.h"#include "utils/memutils.h"
Go to the source code of this file.
Data Structures | |
| struct | SplitVar |
Macros | |
| #define | tmpalloc(sz) MemoryContextAlloc(Conf->buildCxt, (sz)) |
| #define | tmpalloc0(sz) MemoryContextAllocZero(Conf->buildCxt, (sz)) |
| #define | COMPACT_ALLOC_CHUNK 8192 /* amount to get from palloc at once */ |
| #define | COMPACT_MAX_REQ 1024 /* must be < COMPACT_ALLOC_CHUNK */ |
| #define | cpalloc(size) compact_palloc0(Conf, size) |
| #define | cpalloc0(size) compact_palloc0(Conf, size) |
| #define | MAX_NORM 1024 |
| #define | MAXNORMLEN 256 |
| #define | STRNCMP(s, p) strncmp( (s), (p), strlen(p) ) |
| #define | GETWCHAR(W, L, N, T) ( ((const uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] ) |
| #define | GETCHAR(A, N, T) GETWCHAR( (A)->repl, (A)->replen, N, T ) |
| #define | PAE_WAIT_MASK 0 |
| #define | PAE_INMASK 1 |
| #define | PAE_WAIT_FIND 2 |
| #define | PAE_INFIND 3 |
| #define | PAE_WAIT_REPL 4 |
| #define | PAE_INREPL 5 |
| #define | PAE_WAIT_TYPE 6 |
| #define | PAE_WAIT_FLAG 7 |
Typedefs | |
| typedef struct SplitVar | SplitVar |
Variables | |
| static const char * | VoidString = "" |
| #define COMPACT_MAX_REQ 1024 /* must be < COMPACT_ALLOC_CHUNK */ |
| #define cpalloc | ( | size | ) | compact_palloc0(Conf, size) |
| #define cpalloc0 | ( | size | ) | compact_palloc0(Conf, size) |
| #define tmpalloc | ( | sz | ) | MemoryContextAlloc(Conf->buildCxt, (sz)) |
| #define tmpalloc0 | ( | sz | ) | MemoryContextAllocZero(Conf->buildCxt, (sz)) |
|
static |
Definition at line 1069 of file spell.c.
References COPYCHAR, ereport, errcode(), errmsg(), ERROR, fb(), pg_mblen(), repalloc(), setCompoundAffixFlagValue(), tmpalloc, and val.
Referenced by NIImportAffixes(), and NIImportOOAffixes().
|
static |
Definition at line 2529 of file spell.c.
References fb(), MAX_NORM, palloc_array, and word().
Referenced by NINormalizeWord().
Definition at line 2366 of file spell.c.
References SplitVar::lenstem, SplitVar::nstem, repalloc(), SplitVar::stem, and word().
Referenced by SplitToVariants().
|
static |
Definition at line 2076 of file spell.c.
References data, fb(), FF_COMPOUNDBEGIN, FF_COMPOUNDFORBIDFLAG, FF_COMPOUNDLAST, FF_COMPOUNDMIDDLE, FF_COMPOUNDONLY, FF_PREFIX, FF_SUFFIX, aff_struct::find, aff_struct::flagflags, aff_struct::isregis, aff_struct::issimple, len, palloc_array, pfree(), pg_mb2wchar_with_len(), pg_regexec(), aff_struct::pregex, aff_struct::reg, REG_OKAY, aff_struct::regis, aff_struct::replen, RS_execute(), aff_struct::type, and word().
Referenced by NormalizeSubWord().
|
static |
Definition at line 2299 of file spell.c.
References fb(), len, and word().
Referenced by SplitToVariants().
Definition at line 211 of file spell.c.
References Assert, f1, f2, fb(), and FM_NUM.
Referenced by getCompoundAffixFlagValue(), and NIImportOOAffixes().
|
static |
Definition at line 131 of file spell.c.
References Assert, COMPACT_ALLOC_CHUNK, COMPACT_MAX_REQ, fb(), MAXALIGN, and palloc0().
Definition at line 2341 of file spell.c.
References fb(), i, SplitVar::lenstem, SplitVar::next, SplitVar::nstem, palloc_array, palloc_object, pstrdup(), and SplitVar::stem.
Referenced by SplitToVariants().
|
static |
Definition at line 163 of file spell.c.
References cpalloc, fb(), and str.
Referenced by NIAddAffix(), NIAddSpell(), NIImportOOAffixes(), NISortDictionary(), and setCompoundAffixFlagValue().
|
static |
Definition at line 2033 of file spell.c.
References AffixNode::data, fb(), GETWCHAR, AffixNode::isvoid, AffixNode::length, AffixNodeData::naff, AffixNodeData::node, type, and word().
Referenced by NormalizeSubWord().
Definition at line 230 of file spell.c.
References fb(), pg_mblen(), str, and t_iseq.
Referenced by NIImportDictionary().
|
static |
Definition at line 604 of file spell.c.
References SPNode::data, fb(), FF_COMPOUNDFLAGMASK, FF_COMPOUNDONLY, flag(), IsAffixFlagInUse(), SPNode::length, and word().
Referenced by NormalizeSubWord().
Definition at line 793 of file spell.c.
References COPYCHAR, fb(), next, PAE_INMASK, PAE_WAIT_MASK, pg_mblen(), str, and t_iseq.
Referenced by parse_ooaffentry().
|
static |
Definition at line 1162 of file spell.c.
References ereport, errcode(), errmsg(), ERROR, fb(), and VoidString.
Referenced by NIImportOOAffixes().
|
static |
Definition at line 1126 of file spell.c.
References cmpcmdflag(), fb(), flag(), getNextFlagFromString(), setCompoundAffixFlagValue(), and CompoundAffixFlag::value.
Referenced by makeCompoundFlags(), and NIImportOOAffixes().
|
static |
Definition at line 350 of file spell.c.
References COPYCHAR, elog, ereport, errcode(), errmsg(), ERROR, fb(), FLAGNUM_MAXSIZE, FM_CHAR, FM_LONG, FM_NUM, next, pg_mblen(), sprintf, and t_iseq.
Referenced by getCompoundAffixFlagValue(), and IsAffixFlagInUse().
Definition at line 456 of file spell.c.
References Assert, fb(), flag(), and getNextFlagFromString().
Referenced by FindWord(), and isAffixInUse().
|
static |
Definition at line 1966 of file spell.c.
References fb(), i, and IsAffixFlagInUse().
Referenced by NISortAffixes().
|
static |
Definition at line 176 of file spell.c.
References fb(), MemoryContextSwitchTo(), and str_tolower().
Referenced by NIImportDictionary(), and NIImportOOAffixes().
|
static |
Definition at line 1627 of file spell.c.
References Assert, fb(), FF_COMPOUNDFLAGMASK, and getCompoundAffixFlagValue().
Referenced by mkSPNode().
|
static |
Definition at line 1576 of file spell.c.
References a1, a2, Assert, cpalloc, fb(), FM_NUM, repalloc(), and sprintf.
Referenced by mkSPNode().
Definition at line 1835 of file spell.c.
References ANHRDSZ, cpalloc, cpalloc0, AffixNode::data, data, fb(), GETCHAR, i, AffixNode::length, mkANode(), AffixNodeData::node, pfree(), tmpalloc, and type.
Referenced by mkANode(), and NISortAffixes().
Definition at line 1644 of file spell.c.
References cpalloc0, SPNode::data, data, fb(), FF_COMPOUNDFLAG, FF_COMPOUNDONLY, i, SPNode::length, makeCompoundFlags(), MergeAffix(), mkSPNode(), SPNodeData::node, and SPNHDRSZ.
Referenced by mkSPNode(), and NISortDictionary().
|
static |
Definition at line 1912 of file spell.c.
References AffixNodeData::aff, ANHRDSZ, cpalloc, AffixNode::data, fb(), i, AffixNode::isvoid, AffixNode::length, AffixNodeData::naff, AffixNodeData::node, palloc0(), and start.
Referenced by NISortAffixes().
|
static |
Definition at line 679 of file spell.c.
References cpstrdup(), ereport, err(), errcode(), errmsg(), ERROR, fb(), FF_COMPOUNDFLAG, FF_COMPOUNDONLY, FF_COMPOUNDPERMITFLAG, FF_SUFFIX, find(), aff_struct::find, aff_struct::flag, flag(), aff_struct::flagflags, aff_struct::isregis, aff_struct::issimple, palloc_array, palloc_object, pg_mb2wchar_with_len(), pg_regcomp(), pg_regerror(), aff_struct::pregex, aff_struct::reg, REG_ADVANCED, REG_NOSUB, regex_t, aff_struct::regis, repalloc(), aff_struct::repl, aff_struct::replen, RS_compile(), RS_isRegis(), sprintf, tmpalloc, type, aff_struct::type, and VoidString.
Referenced by NIImportAffixes(), and NIImportOOAffixes().
Definition at line 488 of file spell.c.
References cpstrdup(), fb(), flag(), repalloc(), SPELLHDRSZ, tmpalloc, VoidString, and word().
Referenced by NIImportDictionary().
| void NIFinishBuild | ( | IspellDict * | Conf | ) |
Definition at line 104 of file spell.c.
References fb(), and MemoryContextDelete().
Referenced by dispell_init().
| void NIImportAffixes | ( | IspellDict * | Conf, |
| const char * | filename | ||
| ) |
Definition at line 1429 of file spell.c.
References addCompoundAffixFlagValue(), COPYCHAR, ereport, errcode(), errmsg(), ERROR, fb(), FF_COMPOUNDFLAG, FF_COMPOUNDONLY, FF_CROSSPRODUCT, FF_PREFIX, FF_SUFFIX, filename, find(), findchar2(), flag(), FM_CHAR, NIAddAffix(), NIImportOOAffixes(), parse_affentry(), pfree(), pg_mblen(), prefixes(), str_tolower(), STRNCMP, tsearch_readline(), tsearch_readline_begin(), and tsearch_readline_end().
Referenced by dispell_init().
| void NIImportDictionary | ( | IspellDict * | Conf, |
| const char * | filename | ||
| ) |
Definition at line 519 of file spell.c.
References ereport, errcode(), errmsg(), ERROR, fb(), filename, findchar(), flag(), lowerstr_ctx(), NIAddSpell(), pfree(), pg_mblen(), tsearch_readline(), tsearch_readline_begin(), and tsearch_readline_end().
Referenced by dispell_init().
|
static |
Definition at line 1200 of file spell.c.
References addCompoundAffixFlagValue(), cmpcmdflag(), cpstrdup(), ereport, errcode(), errmsg(), ERROR, fb(), FF_COMPOUNDBEGIN, FF_COMPOUNDFLAG, FF_COMPOUNDFORBIDFLAG, FF_COMPOUNDLAST, FF_COMPOUNDMIDDLE, FF_COMPOUNDONLY, FF_COMPOUNDPERMITFLAG, FF_CROSSPRODUCT, FF_PREFIX, FF_SUFFIX, filename, find(), FM_CHAR, FM_LONG, FM_NUM, getAffixFlagSet(), getCompoundAffixFlagValue(), lowerstr_ctx(), NIAddAffix(), palloc0_array, parse_ooaffentry(), pfree(), pg_mblen(), qsort, STRNCMP, t_iseq, tsearch_readline(), tsearch_readline_begin(), tsearch_readline_end(), type, and VoidString.
Referenced by NIImportAffixes().
| TSLexeme * NINormalizeWord | ( | IspellDict * | Conf, |
| const char * | word | ||
| ) |
Definition at line 2545 of file spell.c.
References addNorm(), fb(), FF_COMPOUNDLAST, i, MAX_NORM, SplitVar::next, NormalizeSubWord(), SplitVar::nstem, pfree(), pstrdup(), SplitToVariants(), SplitVar::stem, and word().
Referenced by dispell_lexize().
| void NISortAffixes | ( | IspellDict * | Conf | ) |
Definition at line 1981 of file spell.c.
References CMPDAffix::affix, cmpaffix(), fb(), FF_COMPOUNDFLAG, FF_PREFIX, FF_SUFFIX, aff_struct::flag, aff_struct::flagflags, i, isAffixInUse(), CMPDAffix::issuffix, CMPDAffix::len, mkANode(), mkVoidAffix(), palloc_array, qsort, repalloc(), aff_struct::repl, aff_struct::replen, strbncmp(), and aff_struct::type.
Referenced by dispell_init().
| void NISortDictionary | ( | IspellDict * | Conf | ) |
Definition at line 1726 of file spell.c.
References Assert, cmpspell(), cmpspellaffix(), cpstrdup(), ereport, errcode(), errmsg(), ERROR, fb(), i, mkSPNode(), palloc0_array, and qsort.
Referenced by dispell_init().
| void NIStartBuild | ( | IspellDict * | Conf | ) |
Definition at line 89 of file spell.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CurTransactionContext, and fb().
Referenced by dispell_init().
Definition at line 2181 of file spell.c.
References addToResult(), AffixNodeData::aff, CheckAffix(), cur, fb(), FF_CROSSPRODUCT, FF_PREFIX, FF_SUFFIX, FindAffixes(), FindWord(), aff_struct::flag, flag(), aff_struct::flagflags, i, j, MAX_NORM, MAXNORMLEN, AffixNodeData::naff, AffixNodeData::node, palloc_array, pfree(), pstrdup(), VoidString, and word().
Referenced by NINormalizeWord(), and SplitToVariants().
Definition at line 915 of file spell.c.
References COPYCHAR, elog, ereport, errcode(), errmsg(), ERROR, fb(), find(), PAE_INFIND, PAE_INMASK, PAE_INREPL, PAE_WAIT_FIND, PAE_WAIT_MASK, PAE_WAIT_REPL, pg_mblen(), str, t_isalpha(), and t_iseq.
Referenced by NIImportAffixes().
|
static |
Definition at line 859 of file spell.c.
References elog, ERROR, fb(), find(), flag(), get_nextfield(), PAE_WAIT_FIND, PAE_WAIT_FLAG, PAE_WAIT_MASK, PAE_WAIT_REPL, PAE_WAIT_TYPE, str, and type.
Referenced by NIImportOOAffixes().
|
static |
Definition at line 1033 of file spell.c.
References cpstrdup(), ereport, errcode(), errmsg(), ERROR, fb(), CompoundAffixFlag::flag, CompoundAffixFlag::flagMode, FLAGNUM_MAXSIZE, FM_NUM, i, CompoundAffixFlag::i, next, CompoundAffixFlag::s, val, and CompoundAffixFlag::value.
Referenced by addCompoundAffixFlagValue(), and getCompoundAffixFlagValue().
|
static |
Definition at line 2379 of file spell.c.
References AddStem(), buf, check_stack_depth(), CheckCompoundAffixes(), CopyVar(), SPNode::data, fb(), FF_COMPOUNDBEGIN, FF_COMPOUNDLAST, FF_COMPOUNDMIDDLE, SPNode::length, MAXNORMLEN, SplitVar::next, NormalizeSubWord(), palloc(), pfree(), pnstrdup(), SplitToVariants(), startpos, and word().
Referenced by NINormalizeWord(), and SplitToVariants().
Definition at line 258 of file spell.c.
Referenced by cmpaffix().
Definition at line 281 of file spell.c.
Referenced by NISortAffixes().
Definition at line 195 of file spell.c.
Referenced by getAffixFlagSet(), NIAddAffix(), NIAddSpell(), NIImportOOAffixes(), and NormalizeSubWord().