/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* *18***********************************************************************/19#ifndef _VCWHDR_H20#define _VCWHDR_H 12122#include "vchdr.h"2324#define NG_BYTE 425#define H0 (1)26#define H1 ((Grint_t)0x101)27#define H2 (H1*H1)28#define H3 (H1*H2)29#define NGINIT(s,g) (g = H3*s[0] + H2*s[1] + H1*s[2] + H0*s[3] )30#define NGNEXT(s,g) (g = H1*(g - H3*s[-1]) + s[3])3132#define NG_FREQ (1<<13) /* this is the size of the alphabet */33/* used in counting frequencies. */34#define NGINDEX(g) (g & (NG_FREQ-1))3536#define NG_NSEG (1<<7) /* default # of segments per window */37#define NG_SIZE (1<<10) /* segment size to sum n-gram values */38#define NG_BITS (1<<20) /* # of bits used per n-gram value */39#define NGVALUE(g) (g & (NG_BITS-1))4041/* extra amount to add to windows to enhance matching */42#define VCWEXTRA(s) ((s)/4)4344typedef unsigned int Grint_t; /* n-gram integer value */4546typedef struct _vcwfile_s47{ Sfio_t* file; /* the file to be searched for windows */48Sfoff_t size; /* extent of file */49int done; /* 0: undone, -1: error, 1: ok */5051Grint_t* work; /* signatures of a window to be matched */52int nwork;5354Grint_t* sig; /* signatures of each file index */55Grint_t** ssig; /* sorted signatures */56int nsig; /* number of signatures */5758int nidx; /* indices of where to search */59int idx[8];60} Vcwfile_t;6162_BEGIN_EXTERNS_63extern int vcwngfreq _ARG_((size_t*, Vcchar_t*, size_t));64extern double vcwngmatch _ARG_((int*,size_t*,size_t,Vcchar_t*,size_t,size_t,double));65extern Grint_t vcwngsig _ARG_((Vcchar_t*, size_t));6667extern Vcwfile_t* vcwfopen _ARG_((Sfio_t*));68extern void vcwfclose _ARG_((Vcwfile_t*));69extern int vcwfsearch _ARG_((Vcwfile_t*, Vcchar_t*, size_t));7071extern Vcwmethod_t* Vcwdecode; /* special windowing method for decoding */72_END_EXTERNS_7374#endif /*_VCWHDR_H*/757677