version 1.7, 2003/06/03 02:56:08 |
version 1.8, 2003/06/26 07:27:29 |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
|
#include "find.h" |
#include "find.h" |
|
#include "extern.h" |
|
|
/* |
/* |
* yanknode -- |
* yanknode -- |
* destructively removes the top from the plan |
* destructively removes the top from the plan |
*/ |
*/ |
static PLAN * |
static PLAN * |
yanknode(planp) |
yanknode(PLAN **planp) /* pointer to top of plan (modified) */ |
PLAN **planp; /* pointer to top of plan (modified) */ |
|
{ |
{ |
PLAN *node; /* top node removed from the plan */ |
PLAN *node; /* top node removed from the plan */ |
|
|
|
|
* simple node or a N_EXPR node containing a list of simple nodes. |
* simple node or a N_EXPR node containing a list of simple nodes. |
*/ |
*/ |
static PLAN * |
static PLAN * |
yankexpr(planp) |
yankexpr(PLAN **planp) /* pointer to top of plan (modified) */ |
PLAN **planp; /* pointer to top of plan (modified) */ |
|
{ |
{ |
PLAN *next; /* temp node holding subexpression results */ |
PLAN *next; /* temp node holding subexpression results */ |
PLAN *node; /* pointer to returned node or expression */ |
PLAN *node; /* pointer to returned node or expression */ |
PLAN *tail; /* pointer to tail of subplan */ |
PLAN *tail; /* pointer to tail of subplan */ |
PLAN *subplan; /* pointer to head of ( ) expression */ |
PLAN *subplan; /* pointer to head of ( ) expression */ |
int f_expr(); |
extern int f_expr(PLAN *, FTSENT *); |
|
|
/* first pull the top node from the plan */ |
/* first pull the top node from the plan */ |
if ((node = yanknode(planp)) == NULL) |
if ((node = yanknode(planp)) == NULL) |
|
|
* replaces "parentheisized" plans in our search plan with "expr" nodes. |
* replaces "parentheisized" plans in our search plan with "expr" nodes. |
*/ |
*/ |
PLAN * |
PLAN * |
paren_squish(plan) |
paren_squish(PLAN *plan) /* plan with ( ) nodes */ |
PLAN *plan; /* plan with ( ) nodes */ |
|
{ |
{ |
PLAN *expr; /* pointer to next expression */ |
PLAN *expr; /* pointer to next expression */ |
PLAN *tail; /* pointer to tail of result plan */ |
PLAN *tail; /* pointer to tail of result plan */ |
|
|
* compresses "!" expressions in our search plan. |
* compresses "!" expressions in our search plan. |
*/ |
*/ |
PLAN * |
PLAN * |
not_squish(plan) |
not_squish(PLAN *plan) /* plan to process */ |
PLAN *plan; /* plan to process */ |
|
{ |
{ |
PLAN *next; /* next node being processed */ |
PLAN *next; /* next node being processed */ |
PLAN *node; /* temporary node used in N_NOT processing */ |
PLAN *node; /* temporary node used in N_NOT processing */ |
|
|
* compresses -o expressions in our search plan. |
* compresses -o expressions in our search plan. |
*/ |
*/ |
PLAN * |
PLAN * |
or_squish(plan) |
or_squish(PLAN *plan) /* plan with ors to be squished */ |
PLAN *plan; /* plan with ors to be squished */ |
|
{ |
{ |
PLAN *next; /* next node being processed */ |
PLAN *next; /* next node being processed */ |
PLAN *tail; /* pointer to tail of result plan */ |
PLAN *tail; /* pointer to tail of result plan */ |