~ubuntu-branches/ubuntu/saucy/opencc/saucy-proposed

« back to all changes in this revision

Viewing changes to src/dictionary_set.c

  • Committer: Package Import Robot
  • Author(s): Asias He
  • Date: 2013-04-05 10:52:29 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130405105229-fiif4biajh42hkyg
Tags: 0.4.0-1
* New upstream release
* fix-new-test-cases.patch in upstream
* part of more_clear_man_c_option.patch is in upstream
  the rest is in install-data-file-to-meet-need-of-multi-arch.path

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
*/
18
18
 
19
19
#include "dictionary_set.h"
 
20
#include "dictionary_group.h"
20
21
 
21
22
#define DICTIONARY_GROUP_MAX_COUNT 128
22
23
 
23
24
struct _dictionary_set
24
25
{
 
26
        config_t config;
25
27
        size_t count;
26
28
        dictionary_group_t groups[DICTIONARY_GROUP_MAX_COUNT];
27
29
} ;
28
30
typedef struct _dictionary_set dictionary_set_desc;
29
31
 
30
 
dictionary_set_t dictionary_set_open(void)
 
32
dictionary_set_t dictionary_set_open(config_t config)
31
33
{
32
34
        dictionary_set_desc * dictionary_set =
33
35
                (dictionary_set_desc *) malloc(sizeof(dictionary_set_desc));
34
36
 
35
37
        dictionary_set->count = 0;
 
38
        dictionary_set->config = config;
36
39
 
37
40
        return dictionary_set;
38
41
}
57
60
                return (dictionary_group_t) -1;
58
61
        }
59
62
 
60
 
        dictionary_group_t group = dictionary_group_open();
 
63
        dictionary_group_t group = dictionary_group_open(t_dictionary);
61
64
        dictionary_set->groups[dictionary_set->count ++] = group;
62
65
 
63
66
        return group;
67
70
{
68
71
        dictionary_set_desc * dictionary_set = (dictionary_set_desc *) t_dictionary;
69
72
 
70
 
        if (index < 0 || index >= dictionary_set->count)
 
73
        if (index >= dictionary_set->count)
71
74
        {
72
75
                return (dictionary_group_t) -1;
73
76
        }
80
83
        dictionary_set_desc * dictionary_set = (dictionary_set_desc *) t_dictionary;
81
84
        return dictionary_set->count;
82
85
}
 
86
 
 
87
config_t dictionary_set_get_config(dictionary_set_t t_dictionary)
 
88
{
 
89
        dictionary_set_desc * dictionary_set = (dictionary_set_desc *) t_dictionary;
 
90
        return dictionary_set->config;
 
91
}