pike.git
/
src
/
modules
/
_WhiteFish
/
whitefish.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/_WhiteFish/whitefish.c:1:
#include <math.h> #include "global.h" #include "stralloc.h" #include "global.h"
-
RCSID("$Id: whitefish.c,v 1.
13
2001/05/25
12
:
48
:
04
per Exp $");
+
RCSID("$Id: whitefish.c,v 1.
14
2001/05/25
14
:
29
:
14
per Exp $");
#include "pike_macros.h" #include "interpret.h" #include "program.h" #include "program_id.h" #include "object.h" #include "operators.h" #include "array.h" #include "module_support.h" #include "config.h"
pike.git/src/modules/_WhiteFish/whitefish.c:35:
struct tofree *t= (struct tofree *)_t; int i; if( t->res ) free_object( t->res ); for( i = 0; i<t->nblobs; i++ ) wf_blob_free( t->blobs[i] ); free( t->tmp ); free( t ); } #define OFFSET(X) \
-
(X.type == HIT_BODY?X.u.body.pos:X.type==HIT_FIELD?(X.u.field.pos
<<(14-8
)
)
:(X.u.anchor.pos
<<10
))
+
(X.type == HIT_BODY?X.u.body.pos:X.type==HIT_FIELD?(X.u.field.pos):(X.u.anchor.pos))
#define DOFF(X) MINIMUM((int)sqrt(X),7)
-
#define MOFF(X) (X.type==HIT_BODY?
X.u.body.id
:X.type==HIT_FIELD?X.u.field.
type+3
:
67
)
+
#define MOFF(X) (X.type==HIT_BODY?
0
:X.type==HIT_FIELD?X.u.field.
type+2
:
1
)
static void handle_hit( Blob **blobs, int nblobs, struct object *res, int docid, double *field_c[68], double *prox_c[8] ) { int i, j, k, end = 0; Hit *hits = malloc( nblobs * sizeof(Hit) );
pike.git/src/modules/_WhiteFish/whitefish.c:67:
for( i = 0; i<nblobs; i++ ) nhits[i] = wf_blob_nhits( blobs[i] ); for( i = 0; i<nblobs; i++ ) { MEMSET( pos, 0, nblobs ); for( j = 0; j<nhits[i]; j++ ) { hits[i] = wf_blob_hit( blobs[i], j );
-
+
matrix[MOFF(hits[i])][0]++;
/* forward the other positions */ for( k = 0; k<nblobs; k++ ) if( k != j && pos[ k ] < nhits[ k ] ) {
-
while( (hits[k].
u.
raw < hits[i].
u.
raw) && (pos[ k ] < nhits[ k ]))
+
while( (hits[k].raw < hits[i].raw) && (pos[ k ] < nhits[ k ]))
hits[k] = wf_blob_hit( blobs[k], pos[k]++ ); if( (pos[ k ] < nhits[ k ]) && hits[k].type == hits[i].type )
-
matrix[MOFF(hits[i])][DOFF(OFFSET(hits[i])-OFFSET(hits[k]))]
++
;
+
matrix[MOFF(hits[i])][DOFF(OFFSET(hits[i])-OFFSET(hits[k]))]
+=2
;
} } } /* Now we have our nice matrix. Time to do some multiplication */ { double accum = 0.0, fc, pc; int accum_i;