Tweak StrategyEvaluation data structure to eliminate hardwired limit on
number of strategies supported by an index AM. Add missing copyright notices and CVS $Header$ markers to GIST source files.
This commit is contained in:
parent
f504ad1b4d
commit
f1d5d0905c
|
@ -4,13 +4,14 @@
|
||||||
* interface routines for the postgres GiST index access method.
|
* interface routines for the postgres GiST index access method.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.76 2001/05/15 14:14:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.77 2001/05/30 19:53:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "access/genam.h"
|
#include "access/genam.h"
|
||||||
|
@ -22,9 +23,9 @@
|
||||||
#include "executor/executor.h"
|
#include "executor/executor.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "utils/syscache.h"
|
#include "utils/syscache.h"
|
||||||
|
|
||||||
#include "access/xlogutils.h"
|
#include "access/xlogutils.h"
|
||||||
|
|
||||||
|
|
||||||
/* result's status */
|
/* result's status */
|
||||||
#define INSERTED 0x01
|
#define INSERTED 0x01
|
||||||
#define SPLITED 0x02
|
#define SPLITED 0x02
|
||||||
|
@ -78,9 +79,9 @@ static void gistcentryinit(GISTSTATE *giststate,
|
||||||
OffsetNumber o, int b, bool l);
|
OffsetNumber o, int b, bool l);
|
||||||
|
|
||||||
#undef GISTDEBUG
|
#undef GISTDEBUG
|
||||||
|
|
||||||
#ifdef GISTDEBUG
|
#ifdef GISTDEBUG
|
||||||
static void gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber coff);
|
static void gist_dumptree(Relation r, int level, BlockNumber blk, OffsetNumber coff);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
* fetch tuples from a GiST scan.
|
* fetch tuples from a GiST scan.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* /usr/local/devel/pglite/cvs/src/backend/access/gisr/gistget.c,v 1.9.1 1996/11/21 01:00:00 vadim Exp
|
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.27 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "access/gist.h"
|
#include "access/gist.h"
|
||||||
#include "executor/execdebug.h"
|
#include "executor/execdebug.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static OffsetNumber gistfindnext(IndexScanDesc s, Page p, OffsetNumber n,
|
static OffsetNumber gistfindnext(IndexScanDesc s, Page p, OffsetNumber n,
|
||||||
ScanDirection dir);
|
ScanDirection dir);
|
||||||
static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir);
|
static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir);
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* gistscan.c
|
* gistscan.c
|
||||||
* routines to manage scans on index relations
|
* routines to manage scans on GiST index relations
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* /usr/local/devel/pglite/cvs/src/backend/access/gist/gistscan.c,v 1.7 1995/06/14 00:10:05 jolly Exp
|
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.34 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "access/genam.h"
|
#include "access/genam.h"
|
||||||
|
|
|
@ -3,21 +3,21 @@
|
||||||
* giststrat.c
|
* giststrat.c
|
||||||
* strategy map data for GiSTs.
|
* strategy map data for GiSTs.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* /usr/local/devel/pglite/cvs/src/backend/access/gist/giststrat.c,v 1.4 1995/06/14 00:10:05 jolly Exp
|
* $Header: /cvsroot/pgsql/src/backend/access/gist/Attic/giststrat.c,v 1.17 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "access/gist.h"
|
#include "access/gist.h"
|
||||||
#include "access/istrat.h"
|
#include "access/istrat.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: negate, commute, and negatecommute all assume that operators are
|
* Note: negate, commute, and negatecommute all assume that operators are
|
||||||
* ordered as follows in the strategy map:
|
* ordered as follows in the strategy map:
|
||||||
|
@ -71,6 +71,12 @@ static StrategyNumber GISTNegateCommute[GISTNStrategies] = {
|
||||||
* TermData) -- such logic must be encoded in the user's Consistent function.
|
* TermData) -- such logic must be encoded in the user's Consistent function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static StrategyExpression GISTEvaluationExpressions[GISTNStrategies] = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If you were sufficiently attentive to detail, you would go through
|
* If you were sufficiently attentive to detail, you would go through
|
||||||
* the ExpressionData pain above for every one of the strategies
|
* the ExpressionData pain above for every one of the strategies
|
||||||
|
@ -92,9 +98,10 @@ static StrategyEvaluationData GISTEvaluationData = {
|
||||||
(StrategyTransformMap) GISTNegate, /* how to do (not qual) */
|
(StrategyTransformMap) GISTNegate, /* how to do (not qual) */
|
||||||
(StrategyTransformMap) GISTCommute, /* how to swap operands */
|
(StrategyTransformMap) GISTCommute, /* how to swap operands */
|
||||||
(StrategyTransformMap) GISTNegateCommute, /* how to do both */
|
(StrategyTransformMap) GISTNegateCommute, /* how to do both */
|
||||||
{NULL}
|
GISTEvaluationExpressions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
StrategyNumber
|
StrategyNumber
|
||||||
RelationGetGISTStrategy(Relation r,
|
RelationGetGISTStrategy(Relation r,
|
||||||
AttrNumber attnum,
|
AttrNumber attnum,
|
||||||
|
|
|
@ -1,46 +1,50 @@
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* btstrat.c
|
* hashstrat.c
|
||||||
* Srategy map entries for the btree indexed access method
|
* Srategy map entries for the hash indexed access method
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.17 2001/01/24 19:42:47 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.18 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#include "access/hash.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* only one valid strategy for hash tables: equality.
|
* only one valid strategy for hash tables: equality.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef NOT_USED
|
#ifdef NOT_USED
|
||||||
static StrategyNumber HTNegate[1] = {
|
|
||||||
|
static StrategyNumber HTNegate[HTMaxStrategyNumber] = {
|
||||||
InvalidStrategy
|
InvalidStrategy
|
||||||
};
|
};
|
||||||
|
|
||||||
static StrategyNumber HTCommute[1] = {
|
static StrategyNumber HTCommute[HTMaxStrategyNumber] = {
|
||||||
HTEqualStrategyNumber
|
HTEqualStrategyNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
static StrategyNumber HTNegateCommute[1] = {
|
static StrategyNumber HTNegateCommute[HTMaxStrategyNumber] = {
|
||||||
InvalidStrategy
|
InvalidStrategy
|
||||||
};
|
};
|
||||||
|
|
||||||
static StrategyEvaluationData HTEvaluationData = {
|
static StrategyExpression HTEvaluationExpressions[HTMaxStrategyNumber] = {
|
||||||
/* XXX static for simplicity */
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static StrategyEvaluationData HTEvaluationData = {
|
||||||
HTMaxStrategyNumber,
|
HTMaxStrategyNumber,
|
||||||
(StrategyTransformMap) HTNegate,
|
(StrategyTransformMap) HTNegate,
|
||||||
(StrategyTransformMap) HTCommute,
|
(StrategyTransformMap) HTCommute,
|
||||||
(StrategyTransformMap) HTNegateCommute,
|
(StrategyTransformMap) HTNegateCommute,
|
||||||
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
HTEvaluationExpressions
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,11 +9,10 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.49 2001/03/22 03:59:13 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.50 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
|
@ -37,7 +36,6 @@ static bool StrategyOperatorIsValid(StrategyOperator operator,
|
||||||
StrategyNumber maxStrategy);
|
StrategyNumber maxStrategy);
|
||||||
static bool StrategyTermIsValid(StrategyTerm term,
|
static bool StrategyTermIsValid(StrategyTerm term,
|
||||||
StrategyNumber maxStrategy);
|
StrategyNumber maxStrategy);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,19 +186,13 @@ StrategyEvaluationIsValid(StrategyEvaluation evaluation)
|
||||||
!StrategyTransformMapIsValid(evaluation->negateTransform) ||
|
!StrategyTransformMapIsValid(evaluation->negateTransform) ||
|
||||||
!StrategyTransformMapIsValid(evaluation->commuteTransform) ||
|
!StrategyTransformMapIsValid(evaluation->commuteTransform) ||
|
||||||
!StrategyTransformMapIsValid(evaluation->negateCommuteTransform))
|
!StrategyTransformMapIsValid(evaluation->negateCommuteTransform))
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
for (index = 0; index < evaluation->maxStrategy; index += 1)
|
for (index = 0; index < evaluation->maxStrategy; index += 1)
|
||||||
{
|
{
|
||||||
if (!StrategyExpressionIsValid(evaluation->expression[index],
|
if (!StrategyExpressionIsValid(evaluation->expression[index],
|
||||||
evaluation->maxStrategy))
|
evaluation->maxStrategy))
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -268,6 +260,8 @@ StrategyTermEvaluate(StrategyTerm term,
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* RelationGetStrategy
|
* RelationGetStrategy
|
||||||
|
*
|
||||||
|
* Identify strategy number that describes given procedure, if there is one.
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
StrategyNumber
|
StrategyNumber
|
||||||
|
@ -286,8 +280,7 @@ RelationGetStrategy(Relation relation,
|
||||||
numattrs = RelationGetNumberOfAttributes(relation);
|
numattrs = RelationGetNumberOfAttributes(relation);
|
||||||
|
|
||||||
Assert(relation->rd_rel->relkind == RELKIND_INDEX); /* XXX use accessor */
|
Assert(relation->rd_rel->relkind == RELKIND_INDEX); /* XXX use accessor */
|
||||||
Assert(AttributeNumberIsValid(attributeNumber));
|
Assert((attributeNumber >= 1) && (attributeNumber <= numattrs));
|
||||||
Assert((attributeNumber >= 1) && (attributeNumber < 1 + numattrs));
|
|
||||||
|
|
||||||
Assert(StrategyEvaluationIsValid(evaluation));
|
Assert(StrategyEvaluationIsValid(evaluation));
|
||||||
Assert(RegProcedureIsValid(procedure));
|
Assert(RegProcedureIsValid(procedure));
|
||||||
|
@ -332,7 +325,6 @@ RelationGetStrategy(Relation relation,
|
||||||
elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
|
elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy))
|
if (!StrategyNumberIsInBounds(strategy, evaluation->maxStrategy))
|
||||||
{
|
{
|
||||||
if (!StrategyNumberIsValid(strategy))
|
if (!StrategyNumberIsValid(strategy))
|
||||||
|
@ -391,7 +383,6 @@ RelationInvokeStrategy(Relation relation,
|
||||||
newStrategy = evaluation->negateTransform->strategy[strategy - 1];
|
newStrategy = evaluation->negateTransform->strategy[strategy - 1];
|
||||||
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
||||||
{
|
{
|
||||||
|
|
||||||
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
||||||
|
|
||||||
if (RegProcedureIsValid(entry->sk_procedure))
|
if (RegProcedureIsValid(entry->sk_procedure))
|
||||||
|
@ -406,7 +397,6 @@ RelationInvokeStrategy(Relation relation,
|
||||||
newStrategy = evaluation->commuteTransform->strategy[strategy - 1];
|
newStrategy = evaluation->commuteTransform->strategy[strategy - 1];
|
||||||
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
||||||
{
|
{
|
||||||
|
|
||||||
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
||||||
|
|
||||||
if (RegProcedureIsValid(entry->sk_procedure))
|
if (RegProcedureIsValid(entry->sk_procedure))
|
||||||
|
@ -421,7 +411,6 @@ RelationInvokeStrategy(Relation relation,
|
||||||
newStrategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
|
newStrategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
|
||||||
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
if (newStrategy != strategy && StrategyNumberIsValid(newStrategy))
|
||||||
{
|
{
|
||||||
|
|
||||||
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
entry = StrategyMapGetScanKeyEntry(strategyMap, newStrategy);
|
||||||
|
|
||||||
if (RegProcedureIsValid(entry->sk_procedure))
|
if (RegProcedureIsValid(entry->sk_procedure))
|
||||||
|
@ -463,8 +452,6 @@ RelationInvokeStrategy(Relation relation,
|
||||||
|
|
||||||
/* not reached, just to make compiler happy */
|
/* not reached, just to make compiler happy */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -614,16 +601,16 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||||
ObjectIdGetDatum(accessMethodObjectId));
|
ObjectIdGetDatum(accessMethodObjectId));
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&entry[1], 0, Anum_pg_amproc_amopclaid,
|
ScanKeyEntryInitialize(&entry[1], 0, Anum_pg_amproc_amopclaid,
|
||||||
F_OIDEQ, 0);
|
F_OIDEQ,
|
||||||
|
InvalidOid); /* will set below */
|
||||||
|
|
||||||
relation = heap_openr(AccessMethodProcedureRelationName,
|
relation = heap_openr(AccessMethodProcedureRelationName,
|
||||||
AccessShareLock);
|
AccessShareLock);
|
||||||
|
|
||||||
for (attNumber = 1; attNumber <= maxAttributeNumber; attNumber++)
|
for (attNumber = 1; attNumber <= maxAttributeNumber; attNumber++)
|
||||||
{
|
{
|
||||||
int16 support;
|
|
||||||
Form_pg_amproc aform;
|
|
||||||
RegProcedure *loc;
|
RegProcedure *loc;
|
||||||
|
StrategyNumber support;
|
||||||
|
|
||||||
loc = &indexSupport[((attNumber - 1) * maxSupportNumber)];
|
loc = &indexSupport[((attNumber - 1) * maxSupportNumber)];
|
||||||
|
|
||||||
|
@ -637,8 +624,12 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||||
|
|
||||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
|
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
|
||||||
{
|
{
|
||||||
|
Form_pg_amproc aform;
|
||||||
|
|
||||||
aform = (Form_pg_amproc) GETSTRUCT(tuple);
|
aform = (Form_pg_amproc) GETSTRUCT(tuple);
|
||||||
loc[(aform->amprocnum - 1)] = aform->amproc;
|
support = aform->amprocnum;
|
||||||
|
Assert(support > 0 && support <= maxSupportNumber);
|
||||||
|
loc[support - 1] = aform->amproc;
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_endscan(scan);
|
heap_endscan(scan);
|
||||||
|
@ -708,7 +699,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
|
||||||
for (attributeNumber = 1; attributeNumber <= numberOfAttributes;
|
for (attributeNumber = 1; attributeNumber <= numberOfAttributes;
|
||||||
attributeNumber += 1)
|
attributeNumber += 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
strategyMap = IndexStrategyGetStrategyMap(indexStrategy,
|
strategyMap = IndexStrategyGetStrategyMap(indexStrategy,
|
||||||
numberOfStrategies,
|
numberOfStrategies,
|
||||||
attributeNumber);
|
attributeNumber);
|
||||||
|
@ -717,7 +707,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
|
||||||
strategyNumber <= AMStrategies(numberOfStrategies);
|
strategyNumber <= AMStrategies(numberOfStrategies);
|
||||||
strategyNumber += 1)
|
strategyNumber += 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf(":att %d\t:str %d\t:opr 0x%x(%d)\n",
|
printf(":att %d\t:str %d\t:opr 0x%x(%d)\n",
|
||||||
attributeNumber, strategyNumber,
|
attributeNumber, strategyNumber,
|
||||||
strategyMap->entry[strategyNumber - 1].sk_procedure,
|
strategyMap->entry[strategyNumber - 1].sk_procedure,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* btstrat.c
|
* nbtstrat.c
|
||||||
* Srategy map entries for the btree indexed access method
|
* Strategy map entries for the btree indexed access method
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.13 2001/01/24 19:42:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.14 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
* StrategyNegate, StrategyCommute, and StrategyNegateCommute
|
* StrategyNegate, StrategyCommute, and StrategyNegateCommute
|
||||||
* assume <, <=, ==, >=, > ordering.
|
* assume <, <=, ==, >=, > ordering.
|
||||||
*/
|
*/
|
||||||
static StrategyNumber BTNegate[5] = {
|
static StrategyNumber BTNegate[BTMaxStrategyNumber] = {
|
||||||
BTGreaterEqualStrategyNumber,
|
BTGreaterEqualStrategyNumber,
|
||||||
BTGreaterStrategyNumber,
|
BTGreaterStrategyNumber,
|
||||||
InvalidStrategy,
|
InvalidStrategy,
|
||||||
|
@ -31,7 +31,7 @@ static StrategyNumber BTNegate[5] = {
|
||||||
BTLessEqualStrategyNumber
|
BTLessEqualStrategyNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
static StrategyNumber BTCommute[5] = {
|
static StrategyNumber BTCommute[BTMaxStrategyNumber] = {
|
||||||
BTGreaterStrategyNumber,
|
BTGreaterStrategyNumber,
|
||||||
BTGreaterEqualStrategyNumber,
|
BTGreaterEqualStrategyNumber,
|
||||||
InvalidStrategy,
|
InvalidStrategy,
|
||||||
|
@ -39,7 +39,7 @@ static StrategyNumber BTCommute[5] = {
|
||||||
BTLessStrategyNumber
|
BTLessStrategyNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
static StrategyNumber BTNegateCommute[5] = {
|
static StrategyNumber BTNegateCommute[BTMaxStrategyNumber] = {
|
||||||
BTLessEqualStrategyNumber,
|
BTLessEqualStrategyNumber,
|
||||||
BTLessStrategyNumber,
|
BTLessStrategyNumber,
|
||||||
InvalidStrategy,
|
InvalidStrategy,
|
||||||
|
@ -87,16 +87,20 @@ static StrategyTerm BTEqualExpressionData[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static StrategyExpression BTEvaluationExpressions[BTMaxStrategyNumber] = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(StrategyExpression) BTEqualExpressionData,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static StrategyEvaluationData BTEvaluationData = {
|
static StrategyEvaluationData BTEvaluationData = {
|
||||||
/* XXX static for simplicity */
|
|
||||||
|
|
||||||
BTMaxStrategyNumber,
|
BTMaxStrategyNumber,
|
||||||
(StrategyTransformMap) BTNegate, /* XXX */
|
(StrategyTransformMap) BTNegate,
|
||||||
(StrategyTransformMap) BTCommute, /* XXX */
|
(StrategyTransformMap) BTCommute,
|
||||||
(StrategyTransformMap) BTNegateCommute, /* XXX */
|
(StrategyTransformMap) BTNegateCommute,
|
||||||
|
BTEvaluationExpressions
|
||||||
{NULL, NULL, (StrategyExpression) BTEqualExpressionData, NULL, NULL,
|
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.16 2001/01/24 19:42:50 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.17 2001/05/30 19:53:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +96,7 @@ static StrategyNumber RTNegateCommute[RTNStrategies] = {
|
||||||
* Early in the development of the POSTGRES access methods, it was believed
|
* Early in the development of the POSTGRES access methods, it was believed
|
||||||
* that writing functions was harder than writing arrays. This is wrong;
|
* that writing functions was harder than writing arrays. This is wrong;
|
||||||
* TermData is hard to understand and hard to get right. In general, when
|
* TermData is hard to understand and hard to get right. In general, when
|
||||||
* someone populates a new operator class, the populate it completely. If
|
* someone populates a new operator class, they populate it completely. If
|
||||||
* Mike Hirohama had forced Cimarron Taylor to populate the strategy map
|
* Mike Hirohama had forced Cimarron Taylor to populate the strategy map
|
||||||
* for btree int2_ops completely in 1988, you wouldn't have to deal with
|
* for btree int2_ops completely in 1988, you wouldn't have to deal with
|
||||||
* all this now. Too bad for you.
|
* all this now. Too bad for you.
|
||||||
|
@ -157,24 +157,23 @@ static StrategyTerm RTEqualExpressionData[] = {
|
||||||
* in the access methods just isn't worth the trouble, though.
|
* in the access methods just isn't worth the trouble, though.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static StrategyExpression RTEvaluationExpressions[RTNStrategies] = {
|
||||||
|
NULL, /* express left */
|
||||||
|
NULL, /* express overleft */
|
||||||
|
NULL, /* express overlap */
|
||||||
|
NULL, /* express overright */
|
||||||
|
NULL, /* express right */
|
||||||
|
(StrategyExpression) RTEqualExpressionData, /* express same */
|
||||||
|
NULL, /* express contains */
|
||||||
|
NULL /* express contained-by */
|
||||||
|
};
|
||||||
|
|
||||||
static StrategyEvaluationData RTEvaluationData = {
|
static StrategyEvaluationData RTEvaluationData = {
|
||||||
RTNStrategies, /* # of strategies */
|
RTNStrategies, /* # of strategies */
|
||||||
(StrategyTransformMap) RTNegate, /* how to do (not qual) */
|
(StrategyTransformMap) RTNegate, /* how to do (not qual) */
|
||||||
(StrategyTransformMap) RTCommute, /* how to swap operands */
|
(StrategyTransformMap) RTCommute, /* how to swap operands */
|
||||||
(StrategyTransformMap) RTNegateCommute, /* how to do both */
|
(StrategyTransformMap) RTNegateCommute, /* how to do both */
|
||||||
{
|
RTEvaluationExpressions
|
||||||
NULL, /* express left */
|
|
||||||
NULL, /* express overleft */
|
|
||||||
NULL, /* express over */
|
|
||||||
NULL, /* express overright */
|
|
||||||
NULL, /* express right */
|
|
||||||
(StrategyExpression) RTEqualExpressionData, /* express same */
|
|
||||||
NULL, /* express contains */
|
|
||||||
NULL, /* express contained-by */
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
* common declarations for the GiST access method code.
|
* common declarations for the GiST access method code.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
*
|
* $Id: gist.h,v 1.27 2001/05/30 19:53:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -18,22 +20,15 @@
|
||||||
#include "access/xlog.h"
|
#include "access/xlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** You can have as many strategies as you please in GiSTs, as
|
* You can have as many strategies as you please in GiSTs,
|
||||||
** long as your consistent method can handle them
|
* as long as your consistent method can handle them.
|
||||||
**
|
* The system doesn't really care what they are.
|
||||||
** But strat.h->StrategyEvaluationData->StrategyExpression expression[12]
|
*/
|
||||||
** - so 12 is real max # of strategies, or StrategyEvaluationIsValid
|
|
||||||
** crashes backend... - vadim 05/21/97
|
|
||||||
|
|
||||||
#define GISTNStrategies 100
|
#define GISTNStrategies 100
|
||||||
|
|
||||||
*/
|
|
||||||
#define GISTNStrategies 12
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Helper routines
|
* amproc indexes for GiST indexes.
|
||||||
*/
|
*/
|
||||||
#define GISTNProcs 8
|
|
||||||
#define GIST_CONSISTENT_PROC 1
|
#define GIST_CONSISTENT_PROC 1
|
||||||
#define GIST_UNION_PROC 2
|
#define GIST_UNION_PROC 2
|
||||||
#define GIST_COMPRESS_PROC 3
|
#define GIST_COMPRESS_PROC 3
|
||||||
|
@ -41,8 +36,12 @@
|
||||||
#define GIST_PENALTY_PROC 5
|
#define GIST_PENALTY_PROC 5
|
||||||
#define GIST_PICKSPLIT_PROC 6
|
#define GIST_PICKSPLIT_PROC 6
|
||||||
#define GIST_EQUAL_PROC 7
|
#define GIST_EQUAL_PROC 7
|
||||||
#define GIST_INFO_PROC 8
|
#define GISTNProcs 7
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Page opaque data in a GiST index page.
|
||||||
|
*/
|
||||||
#define F_LEAF (1 << 0)
|
#define F_LEAF (1 << 0)
|
||||||
|
|
||||||
typedef struct GISTPageOpaqueData
|
typedef struct GISTPageOpaqueData
|
||||||
|
@ -57,7 +56,6 @@ typedef GISTPageOpaqueData *GISTPageOpaque;
|
||||||
/*
|
/*
|
||||||
* When we descend a tree, we keep a stack of parent pointers.
|
* When we descend a tree, we keep a stack of parent pointers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct GISTSTACK
|
typedef struct GISTSTACK
|
||||||
{
|
{
|
||||||
struct GISTSTACK *gs_parent;
|
struct GISTSTACK *gs_parent;
|
||||||
|
@ -80,10 +78,9 @@ typedef struct GISTSTATE
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** When we're doing a scan, we need to keep track of the parent stack
|
* When we're doing a scan, we need to keep track of the parent stack
|
||||||
** for the marked and current items.
|
* for the marked and current items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct GISTScanOpaqueData
|
typedef struct GISTScanOpaqueData
|
||||||
{
|
{
|
||||||
struct GISTSTACK *s_stack;
|
struct GISTSTACK *s_stack;
|
||||||
|
@ -95,12 +92,11 @@ typedef struct GISTScanOpaqueData
|
||||||
typedef GISTScanOpaqueData *GISTScanOpaque;
|
typedef GISTScanOpaqueData *GISTScanOpaque;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** When we're doing a scan and updating a tree at the same time, the
|
* When we're doing a scan and updating a tree at the same time, the
|
||||||
** updates may affect the scan. We use the flags entry of the scan's
|
* updates may affect the scan. We use the flags entry of the scan's
|
||||||
** opaque space to record our actual position in response to updates
|
* opaque space to record our actual position in response to updates
|
||||||
** that we can't handle simply by adjusting pointers.
|
* that we can't handle simply by adjusting pointers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GS_CURBEFORE ((uint16) (1 << 0))
|
#define GS_CURBEFORE ((uint16) (1 << 0))
|
||||||
#define GS_MRKBEFORE ((uint16) (1 << 1))
|
#define GS_MRKBEFORE ((uint16) (1 << 1))
|
||||||
|
|
||||||
|
@ -108,20 +104,19 @@ typedef GISTScanOpaqueData *GISTScanOpaque;
|
||||||
#define GISTP_ROOT 0
|
#define GISTP_ROOT 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** When we update a relation on which we're doing a scan, we need to
|
* When we update a relation on which we're doing a scan, we need to
|
||||||
** check the scan and fix it if the update affected any of the pages it
|
* check the scan and fix it if the update affected any of the pages it
|
||||||
** touches. Otherwise, we can miss records that we should see. The only
|
* touches. Otherwise, we can miss records that we should see. The only
|
||||||
** times we need to do this are for deletions and splits. See the code in
|
* times we need to do this are for deletions and splits. See the code in
|
||||||
** gistscan.c for how the scan is fixed. These two constants tell us what sort
|
* gistscan.c for how the scan is fixed. These two constants tell us what sort
|
||||||
** of operation changed the index.
|
* of operation changed the index.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GISTOP_DEL 0
|
#define GISTOP_DEL 0
|
||||||
#define GISTOP_SPLIT 1
|
#define GISTOP_SPLIT 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This is the Split Vector to be returned by the PickSplit method.
|
* This is the Split Vector to be returned by the PickSplit method.
|
||||||
*/
|
*/
|
||||||
typedef struct GIST_SPLITVEC
|
typedef struct GIST_SPLITVEC
|
||||||
{
|
{
|
||||||
OffsetNumber *spl_left; /* array of entries that go left */
|
OffsetNumber *spl_left; /* array of entries that go left */
|
||||||
|
@ -133,11 +128,11 @@ typedef struct GIST_SPLITVEC
|
||||||
} GIST_SPLITVEC;
|
} GIST_SPLITVEC;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** An entry on a GiST node. Contains the key (pred), as well as
|
* An entry on a GiST node. Contains the key (pred), as well as
|
||||||
** its own location (rel,page,offset) which can supply the matching
|
* its own location (rel,page,offset) which can supply the matching
|
||||||
** pointer. The size of the pred is in bytes, and leafkey is a flag to
|
* pointer. The size of the pred is in bytes, and leafkey is a flag to
|
||||||
** tell us if the entry is in a leaf node.
|
* tell us if the entry is in a leaf node.
|
||||||
*/
|
*/
|
||||||
typedef struct GISTENTRY
|
typedef struct GISTENTRY
|
||||||
{
|
{
|
||||||
char *pred;
|
char *pred;
|
||||||
|
@ -149,10 +144,10 @@ typedef struct GISTENTRY
|
||||||
} GISTENTRY;
|
} GISTENTRY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** macro to initialize a GISTENTRY
|
* macro to initialize a GISTENTRY
|
||||||
*/
|
*/
|
||||||
#define gistentryinit(e, pr, r, pg, o, b, l)\
|
#define gistentryinit(e, pr, r, pg, o, b, l)\
|
||||||
do {(e).pred = pr; (e).rel = r; (e).page = pg; (e).offset = o; (e).bytes = b; (e).leafkey = l;} while (0)
|
do {(e).pred = (pr); (e).rel = (r); (e).page = (pg); (e).offset = (o); (e).bytes = (b); (e).leafkey = (l);} while (0)
|
||||||
|
|
||||||
/* defined in gist.c */
|
/* defined in gist.c */
|
||||||
#define TRLOWER(tr) (((tr)->bytes))
|
#define TRLOWER(tr) (((tr)->bytes))
|
||||||
|
@ -160,12 +155,11 @@ typedef struct GISTENTRY
|
||||||
|
|
||||||
typedef struct txtrange
|
typedef struct txtrange
|
||||||
{
|
{
|
||||||
|
int32 vl_len;
|
||||||
/*
|
/*
|
||||||
* flag: NINF means that lower is negative infinity; PINF means that *
|
* flag: NINF means that lower is negative infinity; PINF means that *
|
||||||
* upper is positive infinity. 0 means that both are numbers.
|
* upper is positive infinity. 0 means that both are numbers.
|
||||||
*/
|
*/
|
||||||
int32 vl_len;
|
|
||||||
int32 flag;
|
int32 flag;
|
||||||
char bytes[2];
|
char bytes[2];
|
||||||
} TXTRANGE;
|
} TXTRANGE;
|
||||||
|
@ -174,7 +168,6 @@ typedef struct intrange
|
||||||
{
|
{
|
||||||
int lower;
|
int lower;
|
||||||
int upper;
|
int upper;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* flag: NINF means that lower is negative infinity; PINF means that *
|
* flag: NINF means that lower is negative infinity; PINF means that *
|
||||||
* upper is positive infinity. 0 means that both are numbers.
|
* upper is positive infinity. 0 means that both are numbers.
|
||||||
|
@ -190,7 +183,8 @@ extern void gistfreestack(GISTSTACK *s);
|
||||||
extern void initGISTstate(GISTSTATE *giststate, Relation index);
|
extern void initGISTstate(GISTSTATE *giststate, Relation index);
|
||||||
extern void gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
|
extern void gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
|
||||||
Relation r, Page pg, OffsetNumber o, int b, bool l);
|
Relation r, Page pg, OffsetNumber o, int b, bool l);
|
||||||
extern StrategyNumber RelationGetGISTStrategy(Relation, AttrNumber, RegProcedure);
|
extern StrategyNumber RelationGetGISTStrategy(Relation, AttrNumber,
|
||||||
|
RegProcedure);
|
||||||
|
|
||||||
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
|
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||||
extern void gist_undo(XLogRecPtr lsn, XLogRecord *record);
|
extern void gist_undo(XLogRecPtr lsn, XLogRecord *record);
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* gistscan.h
|
* gistscan.h
|
||||||
* routines defined in access/gisr/gistscan.c
|
* routines defined in access/gist/gistscan.c
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* rtscan.h,v 1.2 1995/06/14 00:06:58 jolly Exp
|
* $Id: gistscan.h,v 1.15 2001/05/30 19:53:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: rtree.h,v 1.22 2001/03/22 04:00:30 momjian Exp $
|
* $Id: rtree.h,v 1.23 2001/05/30 19:53:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +107,7 @@ extern void freestack(RTSTACK *s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RTree code.
|
* RTree code.
|
||||||
* Defined in access/index-rtree/
|
* Defined in access/rtree/
|
||||||
*/
|
*/
|
||||||
extern Datum rtinsert(PG_FUNCTION_ARGS);
|
extern Datum rtinsert(PG_FUNCTION_ARGS);
|
||||||
extern Datum rtdelete(PG_FUNCTION_ARGS);
|
extern Datum rtdelete(PG_FUNCTION_ARGS);
|
||||||
|
@ -130,7 +130,7 @@ extern void rtree_desc(char *buf, uint8 xl_info, char *rec);
|
||||||
extern void rtadjscans(Relation r, int op, BlockNumber blkno,
|
extern void rtadjscans(Relation r, int op, BlockNumber blkno,
|
||||||
OffsetNumber offnum);
|
OffsetNumber offnum);
|
||||||
|
|
||||||
/* rtstrat.h */
|
/* rtstrat.c */
|
||||||
extern RegProcedure RTMapOperator(Relation r, AttrNumber attnum,
|
extern RegProcedure RTMapOperator(Relation r, AttrNumber attnum,
|
||||||
RegProcedure proc);
|
RegProcedure proc);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: strat.h,v 1.21 2001/03/22 06:16:20 momjian Exp $
|
* $Id: strat.h,v 1.22 2001/05/30 19:53:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "access/skey.h"
|
#include "access/skey.h"
|
||||||
|
|
||||||
|
|
||||||
typedef uint16 StrategyNumber;
|
typedef uint16 StrategyNumber;
|
||||||
|
|
||||||
#define InvalidStrategy 0
|
#define InvalidStrategy 0
|
||||||
|
@ -24,29 +25,14 @@ typedef uint16 StrategyNumber;
|
||||||
typedef struct StrategyTransformMapData
|
typedef struct StrategyTransformMapData
|
||||||
{
|
{
|
||||||
StrategyNumber strategy[1]; /* VARIABLE LENGTH ARRAY */
|
StrategyNumber strategy[1]; /* VARIABLE LENGTH ARRAY */
|
||||||
} StrategyTransformMapData; /* VARIABLE LENGTH
|
} StrategyTransformMapData; /* VARIABLE LENGTH STRUCTURE */
|
||||||
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* STRUCTURE */
|
|
||||||
|
|
||||||
typedef StrategyTransformMapData *StrategyTransformMap;
|
typedef StrategyTransformMapData *StrategyTransformMap;
|
||||||
|
|
||||||
typedef struct StrategyOperatorData
|
typedef struct StrategyOperatorData
|
||||||
{
|
{
|
||||||
StrategyNumber strategy;
|
StrategyNumber strategy;
|
||||||
bits16 flags; /* scan qualification flags h/skey.h */
|
bits16 flags; /* scan qualification flags, see skey.h */
|
||||||
} StrategyOperatorData;
|
} StrategyOperatorData;
|
||||||
|
|
||||||
typedef StrategyOperatorData *StrategyOperator;
|
typedef StrategyOperatorData *StrategyOperator;
|
||||||
|
@ -54,7 +40,7 @@ typedef StrategyOperatorData *StrategyOperator;
|
||||||
typedef struct StrategyTermData
|
typedef struct StrategyTermData
|
||||||
{ /* conjunctive term */
|
{ /* conjunctive term */
|
||||||
uint16 degree;
|
uint16 degree;
|
||||||
StrategyOperatorData operatorData[1]; /* VARIABLE LENGTH */
|
StrategyOperatorData operatorData[1]; /* VARIABLE LENGTH ARRAY */
|
||||||
} StrategyTermData; /* VARIABLE LENGTH STRUCTURE */
|
} StrategyTermData; /* VARIABLE LENGTH STRUCTURE */
|
||||||
|
|
||||||
typedef StrategyTermData *StrategyTerm;
|
typedef StrategyTermData *StrategyTerm;
|
||||||
|
@ -69,11 +55,12 @@ typedef StrategyExpressionData *StrategyExpression;
|
||||||
typedef struct StrategyEvaluationData
|
typedef struct StrategyEvaluationData
|
||||||
{
|
{
|
||||||
StrategyNumber maxStrategy;
|
StrategyNumber maxStrategy;
|
||||||
|
/* each of these must point to an array of maxStrategy elements: */
|
||||||
StrategyTransformMap negateTransform;
|
StrategyTransformMap negateTransform;
|
||||||
StrategyTransformMap commuteTransform;
|
StrategyTransformMap commuteTransform;
|
||||||
StrategyTransformMap negateCommuteTransform;
|
StrategyTransformMap negateCommuteTransform;
|
||||||
StrategyExpression expression[12]; /* XXX VARIABLE LENGTH */
|
StrategyExpression *expression;
|
||||||
} StrategyEvaluationData; /* VARIABLE LENGTH STRUCTURE */
|
} StrategyEvaluationData;
|
||||||
|
|
||||||
typedef StrategyEvaluationData *StrategyEvaluation;
|
typedef StrategyEvaluationData *StrategyEvaluation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue