update fst search frame
This commit is contained in:
parent
a9a068410b
commit
f07045c1d8
|
@ -26,10 +26,24 @@ extern "C" {
|
|||
#include "index_fst_counting_writer.h"
|
||||
#include "index_fst_automation.h"
|
||||
|
||||
|
||||
typedef struct FstNode FstNode;
|
||||
#define OUTPUT_PREFIX(a, b) ((a) > (b) ? (b) : (a)
|
||||
|
||||
typedef struct Fst Fst;
|
||||
typedef struct FstNode FstNode;
|
||||
|
||||
typedef enum { Included, Excluded, Unbounded} FstBound;
|
||||
|
||||
typedef struct FstBoundWithData {
|
||||
FstSlice data;
|
||||
FstBound type;
|
||||
} FstBoundWithData;
|
||||
|
||||
typedef struct FstStreamBuilder {
|
||||
Fst *fst;
|
||||
AutomationCtx *aut;
|
||||
FstBoundWithData *min;
|
||||
FstBoundWithData *max;
|
||||
} FstStreamBuilder, FstStreamWithStateBuilder;
|
||||
|
||||
typedef struct FstRange {
|
||||
uint64_t start;
|
||||
|
@ -39,16 +53,9 @@ typedef struct FstRange {
|
|||
|
||||
typedef enum {GE, GT, LE, LT} RangeType;
|
||||
typedef enum { OneTransNext, OneTrans, AnyTrans, EmptyFinal} State;
|
||||
|
||||
typedef enum {Ordered, OutOfOrdered, DuplicateKey} OrderType;
|
||||
|
||||
|
||||
typedef enum { Included, Excluded, Unbounded} FstBound;
|
||||
typedef struct FstBoundWithData {
|
||||
FstSlice data;
|
||||
FstBound type;
|
||||
} FstBoundWithData;
|
||||
|
||||
FstBoundWithData* fstBoundStateCreate(FstBound type, FstSlice *data);
|
||||
bool fstBoundWithDataExceededBy(FstBoundWithData *bound, FstSlice *slice);
|
||||
bool fstBoundWithDataIsEmpty(FstBoundWithData *bound);
|
||||
|
@ -60,8 +67,6 @@ typedef struct FstOutput {
|
|||
Output out;
|
||||
} FstOutput;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* UnFinished node and helper function
|
||||
|
@ -275,6 +280,8 @@ FstNode* fstGetRoot(Fst *fst);
|
|||
FstType fstGetType(Fst *fst);
|
||||
CompiledAddr fstGetRootAddr(Fst *fst);
|
||||
Output fstEmptyFinalOutput(Fst *fst, bool *null);
|
||||
FstStreamBuilder *fstSearch(Fst *fst, AutomationCtx *ctx);
|
||||
FstStreamWithStateBuilder *fstSearchWithState(Fst *fst, AutomationCtx *ctx);
|
||||
|
||||
bool fstVerify(Fst *fst);
|
||||
|
||||
|
@ -314,14 +321,8 @@ typedef void* (*StreamCallback)(void *);
|
|||
StreamWithState *streamWithStateCreate(Fst *fst, AutomationCtx *automation, FstBoundWithData *min, FstBoundWithData *max) ;
|
||||
void streamWithStateDestroy(StreamWithState *sws);
|
||||
bool streamWithStateSeekMin(StreamWithState *sws, FstBoundWithData *min);
|
||||
StreamWithStateResult* streamWithStateNextWith(StreamWithState *sws, StreamCallback callback);
|
||||
|
||||
typedef struct FstStreamBuilder {
|
||||
Fst *fst;
|
||||
AutomationCtx *aut;
|
||||
FstBoundWithData *min;
|
||||
FstBoundWithData *max;
|
||||
} FstStreamBuilder;
|
||||
StreamWithStateResult* streamWithStateNextWith(StreamWithState *sws, StreamCallback callback);
|
||||
|
||||
FstStreamBuilder *fstStreamBuilderCreate(Fst *fst, AutomationCtx *aut);
|
||||
// set up bound range
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct AutomationFunc {
|
|||
} AutomationFunc;
|
||||
|
||||
AutomationCtx *automCtxCreate(void *data, AutomationType type);
|
||||
void autoCtxDestroy(AutomationCtx *ctx);
|
||||
void automCtxDestroy(AutomationCtx *ctx);
|
||||
|
||||
extern AutomationFunc automFuncs[];
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1090,6 +1090,12 @@ bool fstGet(Fst *fst, FstSlice *b, Output *out) {
|
|||
|
||||
return true;
|
||||
}
|
||||
FstStreamBuilder *fstSearch(Fst *fst, AutomationCtx *ctx) {
|
||||
return fstStreamBuilderCreate(fst, ctx);
|
||||
}
|
||||
FstStreamWithStateBuilder *fstSearchWithState(Fst *fst, AutomationCtx *ctx) {
|
||||
return fstStreamBuilderCreate(fst, ctx);
|
||||
}
|
||||
|
||||
FstNode *fstGetRoot(Fst *fst) {
|
||||
if (fst->root != NULL) {
|
||||
|
@ -1440,3 +1446,5 @@ FstStreamBuilder *fstStreamBuilderRange(FstStreamBuilder *b, FstSlice *val, Rang
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -92,6 +92,6 @@ AutomationCtx* automCtxCreate(void *data, AutomationType type) {
|
|||
}
|
||||
return ctx;
|
||||
}
|
||||
void autoCtxDestroy(AutomationCtx *ctx) {
|
||||
void automCtxDestroy(AutomationCtx *ctx) {
|
||||
free(ctx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue