blob: 78669ddbe7c968a9f4f2b9ce873a89401d7fcfd5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* fast find private interface
*/
#ifndef _FINDLIB_H
#define _FINDLIB_H
#include <ast.h>
#include <cdt.h>
#include <ctype.h>
#include <error.h>
#include <ls.h>
#include <regex.h>
#include <vmalloc.h>
#define FF_old 1 /* old format - 7 bit bigram */
#define FF_gnu 2 /* gnu 8 bit no bigram */
#define FF_dir 3 /* FF_gnu, dirs have trailing / */
#define FF_typ 4 /* FF_dir with types */
#define FF_gnu_magic "LOCATE02"
#define FF_dir_magic "FIND-DIR-02"
#define FF_typ_magic "FIND-DIR-TYPE-03"
#define FF_ESC 0036
#define FF_MAX 0200
#define FF_MIN 0040
#define FF_OFF 0016
#define FF_SET_TYPE(p,i) ((p)->decode.bigram1[((i)>>3)&((1<<CHAR_BIT)-1)]|=(1<<((i)&07)))
#define FF_OK_TYPE(p,i) (!(p)->types||((p)->decode.bigram1[((i)>>3)&((1<<CHAR_BIT)-1)]&(1<<((i)&07))))
typedef struct
{
char* end;
char* type;
char* restore;
int count;
int found;
int ignorecase;
int match;
int peek;
int swap;
regex_t re;
char bigram1[(1<<(CHAR_BIT-1))];
char bigram2[(1<<(CHAR_BIT-1))];
char path[PATH_MAX];
char temp[PATH_MAX];
char pattern[1];
} Decode_t;
typedef struct
{
Dtdisc_t namedisc;
Dtdisc_t indexdisc;
Dt_t* namedict;
Dt_t* indexdict;
int prefix;
unsigned char bigram[2*FF_MAX];
unsigned short code[FF_MAX][FF_MAX];
unsigned short hits[USHRT_MAX+1];
char path[PATH_MAX];
char mark[PATH_MAX];
char file[PATH_MAX];
char temp[PATH_MAX];
} Encode_t;
typedef union
{
Decode_t code_decode;
Encode_t code_encode;
} Code_t;
typedef struct
{
Dtlink_t byname;
Dtlink_t byindex;
unsigned long index;
char name[1];
} Type_t;
#define _FIND_PRIVATE_ \
Finddisc_t* disc; \
Vmalloc_t* vm; \
char** dirs; \
int* lens; \
Sfio_t* fp; \
Findverify_f verifyf; \
int generate; \
int method; \
int secure; \
int types; \
int verify; \
Code_t code;
#define decode code.code_decode
#define encode code.code_encode
#include <find.h>
#endif
|