File: hash-private.h

package info (click to toggle)
libchewing 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,220 kB
  • ctags: 10,179
  • sloc: ansic: 103,539; sh: 11,563; makefile: 316; python: 98
file content (50 lines) | stat: -rw-r--r-- 1,533 bytes parent folder | download
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
/**
 * hash-private.h
 *
 * Copyright (c) 2008
 *	libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

/* *INDENT-OFF* */
#ifndef _CHEWING_HASH_PRIVATE_H
#define _CHEWING_HASH_PRIVATE_H
/* *INDENT-ON* */

#include "global.h"
#include "userphrase-private.h"

#ifdef __MacOSX__
#    define CHEWING_HASH_PATH "/Library/ChewingOSX"
#else
#    define CHEWING_HASH_PATH "/.chewing"
#endif

#define FIELD_SIZE (125)
#define BIN_HASH_SIG "CBiH"
#define HASH_FILE  "uhash.dat"

typedef struct HASH_ITEM {
    int item_index;
    UserPhraseData data;
    struct HASH_ITEM *next;
} HASH_ITEM;

HASH_ITEM *HashFindPhone(const uint16_t phoneSeq[]);
HASH_ITEM **HashFindHead(struct ChewingData *pgdata, const uint16_t phoneSeq[]);
HASH_ITEM *HashFindEntry(struct ChewingData *pgdata, const uint16_t phoneSeq[], const char wordSeq[]);
HASH_ITEM *HashInsert(struct ChewingData *pgdata, UserPhraseData *pData);
HASH_ITEM *HashFindPhonePhrase(struct ChewingData *pgdata, const uint16_t phoneSeq[], HASH_ITEM *pHashLast);
HASH_ITEM *FindNextHash(const struct ChewingData *pgdata, HASH_ITEM *curr);
void HashModify(struct ChewingData *pgdata, HASH_ITEM *pItem);
void FreeHashItem(HASH_ITEM *pItem);
int AlcUserPhraseSeq(UserPhraseData *pData, int phonelen, int wordlen);
int InitUserphrase(struct ChewingData *pgdata, const char *path);
void TerminateUserphrase(struct ChewingData *pgdata);
void FreeHashTable(void);

/* *INDENT-OFF* */
#endif
/* *INDENT-ON* */