1 |
/************************************************************************************************* |
2 |
* IDL for bindings of scripting languages |
3 |
* Copyright (C) 2004-2005 Mikio Hirabayashi |
4 |
* This file is part of Hyper Estraier. |
5 |
* Hyper Estraier is free software; you can redistribute it and/or modify it under the terms of |
6 |
* the GNU Lesser General Public License as published by the Free Software Foundation; either |
7 |
* version 2.1 of the License or any later version. Hyper Estraier is distributed in the hope |
8 |
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
10 |
* License for more details. |
11 |
* You should have received a copy of the GNU Lesser General Public License along with Hyper |
12 |
* Estraier; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
13 |
* Boston, MA 02111-1307 USA. |
14 |
*************************************************************************************************/ |
15 |
|
16 |
|
17 |
|
18 |
/** |
19 |
* namespace of Hyper Estraier |
20 |
*/ |
21 |
module estraier { |
22 |
//---------------------------------------------------------------- |
23 |
// data structures for utility |
24 |
//---------------------------------------------------------------- |
25 |
/** |
26 |
* list of strings (to be substituted for by the native list mechanism) |
27 |
*/ |
28 |
interface List { |
29 |
string put(in string value); |
30 |
string get(in long index); |
31 |
}; |
32 |
/* |
33 |
* map of pairs of strings (to be substituted for by the native map mechanism) |
34 |
*/ |
35 |
interface Map { |
36 |
string put(in string key, in string value); |
37 |
string get(in string key); |
38 |
}; |
39 |
//---------------------------------------------------------------- |
40 |
// core API |
41 |
//---------------------------------------------------------------- |
42 |
/** |
43 |
* abstraction of document |
44 |
*/ |
45 |
interface Document { |
46 |
void add_attr(in string name, in string value); |
47 |
void add_text(in string text); |
48 |
void add_hidden_text(in string text); |
49 |
long id(); |
50 |
List attr_names(); |
51 |
string attr(in string name); |
52 |
List texts(); |
53 |
string cat_texts(); |
54 |
string dump_draft(); |
55 |
string make_snippet(in List words, in long wwidth, in long hwidth, in long awidth); |
56 |
boolean scan_words(in List words); |
57 |
}; |
58 |
/** |
59 |
* abstraction of search condition |
60 |
*/ |
61 |
interface Condition { |
62 |
const long CONDSURE = 1 << 0; |
63 |
const long CONDUSU = 1 << 1; |
64 |
const long CONDFAST = 1 << 2; |
65 |
const long CONDAGIT = 1 << 3; |
66 |
const long CONDNOIDF = 1 << 4; |
67 |
const long CONDSIMPLE = 1 << 10; |
68 |
void set_phrase(in string phrase); |
69 |
void add_attr(in string expr); |
70 |
void set_order(in string expr); |
71 |
void set_max(in long max); |
72 |
void set_options(in long options); |
73 |
}; |
74 |
/** |
75 |
* abstraction of result set from database |
76 |
*/ |
77 |
interface Database_result { |
78 |
long doc_num(); |
79 |
long get_doc_id(in long index); |
80 |
Map hints(); |
81 |
}; |
82 |
/** |
83 |
* abstraction of database |
84 |
*/ |
85 |
interface Database { |
86 |
const long ERRNOERR = 0; |
87 |
const long ERRINVAL = 1; |
88 |
const long ERRACCES = 2; |
89 |
const long ERRLOCK = 3; |
90 |
const long ERRDB = 4; |
91 |
const long ERRIO = 5; |
92 |
const long ERRNOITEM = 6; |
93 |
const long ERRMISC = 9999; |
94 |
const long DBREADER = 1 << 0; |
95 |
const long DBWRITER = 1 << 1; |
96 |
const long DBCREAT = 1 << 2; |
97 |
const long DBTRUNC = 1 << 3; |
98 |
const long DBNOLCK = 1 << 4; |
99 |
const long DBLCKNB = 1 << 5; |
100 |
const long DBPERFNG = 1 << 6; |
101 |
const long PDCLEAN = 1 << 0; |
102 |
const long ODCLEAN = 1 << 0; |
103 |
const long OPTNOPURGE = 1 << 0; |
104 |
const long OPTNODBOPT = 1 << 1; |
105 |
const long GDNOATTR = 1 << 0; |
106 |
const long GDNOTEXT = 1 << 1; |
107 |
string err_msg(in long ecode); |
108 |
boolean open(in string name, in long omode); |
109 |
boolean close(); |
110 |
long error(); |
111 |
boolean fatal(); |
112 |
boolean flush(in long max); |
113 |
boolean sync(); |
114 |
boolean optimize(in long options); |
115 |
boolean put_doc(in Document doc, in long options); |
116 |
boolean out_doc(in long id, in long options); |
117 |
Document get_doc(in long id, in long options); |
118 |
string get_doc_attr(in long id, in string name); |
119 |
long uri_to_id(in string uri); |
120 |
Map etch_doc(in Document doc, in long max); |
121 |
boolean iter_init(); |
122 |
long iter_next(); |
123 |
string name(); |
124 |
long doc_num(); |
125 |
long word_num(); |
126 |
double size(); |
127 |
Database_result search(in Condition cond); |
128 |
void set_cache_size(in double size, in long anum, in long tnum); |
129 |
void set_special_cache(in string name, in long num); |
130 |
}; |
131 |
//---------------------------------------------------------------- |
132 |
// node API |
133 |
//---------------------------------------------------------------- |
134 |
/** |
135 |
* abstraction of document in result |
136 |
*/ |
137 |
interface Result_document { |
138 |
string uri(); |
139 |
List attr_names(); |
140 |
string attr(in string name); |
141 |
string snippet(); |
142 |
}; |
143 |
/** |
144 |
* abstraction of result set from node |
145 |
*/ |
146 |
interface Node_result { |
147 |
long doc_num(); |
148 |
Result_document get_doc(in long index); |
149 |
Map hints(); |
150 |
}; |
151 |
/** |
152 |
* abstraction of node |
153 |
*/ |
154 |
interface Node { |
155 |
void set_url(in string url); |
156 |
void set_proxy(in string host, in long port); |
157 |
void set_timeout(in long msec); |
158 |
void set_auth(in string name, in string password); |
159 |
void add_header(in string name, in string value); |
160 |
boolean put_doc(in Document doc); |
161 |
boolean out_doc(in long id); |
162 |
Document get_doc(in long id); |
163 |
Document get_doc_by_uri(in string uri); |
164 |
string get_doc_attr(in long id, in string name); |
165 |
string get_doc_attr_by_uri(in string uri, in string name); |
166 |
long uri_to_id(in string uri); |
167 |
string name(); |
168 |
string label(); |
169 |
long doc_num(); |
170 |
long word_num(); |
171 |
double size(); |
172 |
Node_result search(in Condition cond, in long depth); |
173 |
boolean set_user(in string name, in long mode); |
174 |
boolean set_link(in string url, in string label, in long credit); |
175 |
}; |
176 |
}; |
177 |
|
178 |
|
179 |
|
180 |
/* END OF FILE */ |