-
Notifications
You must be signed in to change notification settings - Fork 0
/
word-search.h
59 lines (51 loc) · 1.01 KB
/
word-search.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
#ifndef SEARCH_H
#define SEARCH_H
#include <locale.h>
#include <wchar.h>
#include <wctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#define INVALID -1
#define ALPHABET 1114112
#define DEFAULT_SIZE 100
typedef struct
{
wchar_t ch;
char color;
} bchar;
typedef struct
{
wchar_t ch;
int x;
int y;
} pos;
typedef struct trie
{
bool valid;
struct trie *path[ALPHABET];
} trie;
typedef enum {
PUZZLE_LIST_IMAGE,
WORD_LIST_IMAGE
} image_t;
FILE *read_image(char *file, image_t type);
wchar_t *get_word(FILE *inptr);
void index_node(trie *node);
void check(pos cor);
pos translate(pos cor, int dir);
void highlight(pos *cors, int length);
int row_size(void);
int col_size(void);
bchar **parse(FILE *inptr);
bchar *get_row(FILE *inptr);
bool load(FILE *list);
void insert(wchar_t *key);
trie *locate(pos *key, int length);
void unload_trie(void);
void unload_array(bchar **tmp);
int word_length(void);
bool is_image(FILE *inptr);
#endif