-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
68 lines (44 loc) · 984 Bytes
/
main.h
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
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
//defining macros
#define FAILURE -1
#define SUCCESS 0
#define FNAME_SIZE 15
#define WORD_SIZE 10
#define FILE_EMPTY -2
#define FILE_NOTAVAILABLE -3
#define REPEATATION -4
//Structure for file list
typedef char data_t;
typedef struct node
{
char *s;
struct node *link;
}flist;
typedef struct subnode
{
int word_count;
char f_name[FNAME_SIZE];
struct subnode *link;
}sub_t;
typedef struct word
{
int file_count;
char word[WORD_SIZE];
struct word *link;
sub_t *tlink;
}wlist;
typedef struct indextable
{
int index;
wlist *tlink;
}table;
int insert_file(flist **head,char *str);
int creat_invertedindex(table *arr,int size);
int create_Database(table *arr,flist *head);
void disp_database(table *arr);
int search(table *arr,char *word);
int update_database(flist **head,char *fstr);
int save_database(flist *head,table *arr,char *newfile);