YAP 7.1.0
core_dbtries.h
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3% $Date: 2010-06-30 17:05:24 +0200 (Wed, 30 Jun 2010) $
4% $Revision: 1 $
5%
6% This file is part of YAP & ProbLog
7% http://www.dcc.fc.up.pt/~vsc/Yap/index.html
8% http://dtai.cs.kuleuven.be/problog
9%
10% ProbLog was developed at Katholieke Universiteit Leuven &
11% University of Porto
12%
13% Copyright 2010 Katholieke Universiteit Leuven & University of Porto
14%
15% Main authors of this file: Mantadelis Theofrastos, Ricardo Rocha
16%
17%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18%
19% Artistic License 2.0
20%
21% Copyright (c) 2000-2006, The Perl Foundation.
22%
23% Everyone is permitted to copy and distribute verbatim copies of this
24% license document, but changing it is not allowed. Preamble
25%
26% This license establishes the terms under which a given free software
27% Package may be copied, modified, distributed, and/or
28% redistributed. The intent is that the Copyright Holder maintains some
29% artistic control over the development of that Package while still
30% keeping the Package available as open source and free software.
31%
32% You are always permitted to make arrangements wholly outside of this
33% license directly with the Copyright Holder of a given Package. If the
34% terms of this license do not permit the full use that you propose to
35% make of the Package, you should contact the Copyright Holder and seek
36% a different licensing arrangement. Definitions
37%
38% "Copyright Holder" means the individual(s) or organization(s) named in
39% the copyright notice for the entire Package.
40%
41% "Contributor" means any party that has contributed code or other
42% material to the Package, in accordance with the Copyright Holder's
43% procedures.
44%
45% "You" and "your" means any person who would like to copy, distribute,
46% or modify the Package.
47%
48% "Package" means the collection of files distributed by the Copyright
49% Holder, and derivatives of that collection and/or of those files. A
50% given Package may consist of either the Standard Version, or a
51% Modified Version.
52%
53% "Distribute" means providing a copy of the Package or making it
54% accessible to anyone else, or in the case of a company or
55% organization, to others outside of your company or organization.
56%
57% "Distributor Fee" means any fee that you charge for Distributing this
58% Package or providing support for this Package to another party. It
59% does not mean licensing fees.
60%
61% "Standard Version" refers to the Package if it has not been modified,
62% or has been modified only in ways explicitly requested by the
63% Copyright Holder.
64%
65% "Modified Version" means the Package, if it has been changed, and such
66% changes were not explicitly requested by the Copyright Holder.
67%
68% "Original License" means this Artistic License as Distributed with the
69% Standard Version of the Package, in its current version or as it may
70% be modified by The Perl Foundation in the future.
71%
72% "Source" form means the source code, documentation source, and
73% configuration files for the Package.
74%
75% "Compiled" form means the compiled bytecode, object code, binary, or
76% any other form resulting from mechanical transformation or translation
77% of the Source form.
78%
79%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80%
81% Permission for Use and Modification Without Distribution
82%
83% (1) You are permitted to use the Standard Version and create and use
84% Modified Versions for any purpose without restriction, provided that
85% you do not Distribute the Modified Version.
86%
87% Permissions for Redistribution of the Standard Version
88%
89% (2) You may Distribute verbatim copies of the Source form of the
90% Standard Version of this Package in any medium without restriction,
91% either gratis or for a Distributor Fee, provided that you duplicate
92% all of the original copyright notices and associated disclaimers. At
93% your discretion, such verbatim copies may or may not include a
94% Compiled form of the Package.
95%
96% (3) You may apply any bug fixes, portability changes, and other
97% modifications made available from the Copyright Holder. The resulting
98% Package will still be considered the Standard Version, and as such
99% will be subject to the Original License.
100%
101% Distribution of Modified Versions of the Package as Source
102%
103% (4) You may Distribute your Modified Version as Source (either gratis
104% or for a Distributor Fee, and with or without a Compiled form of the
105% Modified Version) provided that you clearly document how it differs
106% from the Standard Version, including, but not limited to, documenting
107% any non-standard features, executables, or modules, and provided that
108% you do at least ONE of the following:
109%
110% (a) make the Modified Version available to the Copyright Holder of the
111% Standard Version, under the Original License, so that the Copyright
112% Holder may include your modifications in the Standard Version. (b)
113% ensure that installation of your Modified Version does not prevent the
114% user installing or running the Standard Version. In addition, the
115% modified Version must bear a name that is different from the name of
116% the Standard Version. (c) allow anyone who receives a copy of the
117% Modified Version to make the Source form of the Modified Version
118% available to others under (i) the Original License or (ii) a license
119% that permits the licensee to freely copy, modify and redistribute the
120% Modified Version using the same licensing terms that apply to the copy
121% that the licensee received, and requires that the Source form of the
122% Modified Version, and of any works derived from it, be made freely
123% available in that license fees are prohibited but Distributor Fees are
124% allowed.
125%
126% Distribution of Compiled Forms of the Standard Version or
127% Modified Versions without the Source
128%
129% (5) You may Distribute Compiled forms of the Standard Version without
130% the Source, provided that you include complete instructions on how to
131% get the Source of the Standard Version. Such instructions must be
132% valid at the time of your distribution. If these instructions, at any
133% time while you are carrying out such distribution, become invalid, you
134% must provide new instructions on demand or cease further
135% distribution. If you provide valid instructions or cease distribution
136% within thirty days after you become aware that the instructions are
137% invalid, then you do not forfeit any of your rights under this
138% license.
139%
140% (6) You may Distribute a Modified Version in Compiled form without the
141% Source, provided that you comply with Section 4 with respect to the
142% Source of the Modified Version.
143%
144% Aggregating or Linking the Package
145%
146% (7) You may aggregate the Package (either the Standard Version or
147% Modified Version) with other packages and Distribute the resulting
148% aggregation provided that you do not charge a licensing fee for the
149% Package. Distributor Fees are permitted, and licensing fees for other
150% components in the aggregation are permitted. The terms of this license
151% apply to the use and Distribution of the Standard or Modified Versions
152% as included in the aggregation.
153%
154% (8) You are permitted to link Modified and Standard Versions with
155% other works, to embed the Package in a larger work of your own, or to
156% build stand-alone binary or bytecode versions of applications that
157% include the Package, and Distribute the result without restriction,
158% provided the result does not expose a direct interface to the Package.
159%
160% Items That are Not Considered Part of a Modified Version
161%
162% (9) Works (including, but not limited to, modules and scripts) that
163% merely extend or make use of the Package, do not, by themselves, cause
164% the Package to be a Modified Version. In addition, such works are not
165% considered parts of the Package itself, and are not subject to the
166% terms of this license.
167%
168% General Provisions
169%
170% (10) Any use, modification, and distribution of the Standard or
171% Modified Versions is governed by this Artistic License. By using,
172% modifying or distributing the Package, you accept this license. Do not
173% use, modify, or distribute the Package, if you do not accept this
174% license.
175%
176% (11) If your Modified Version has been derived from a Modified Version
177% made by someone other than you, you are nevertheless required to
178% ensure that your Modified Version complies with the requirements of
179% this license.
180%
181% (12) This license does not grant you the right to use any trademark,
182% service mark, tradename, or logo of the Copyright Holder.
183%
184% (13) This license includes the non-exclusive, worldwide,
185% free-of-charge patent license to make, have made, use, offer to sell,
186% sell, import and otherwise transfer the Package with respect to any
187% patent claims licensable by the Copyright Holder that are necessarily
188% infringed by the Package. If you institute patent litigation
189% (including a cross-claim or counterclaim) against any party alleging
190% that the Package constitutes direct or contributory patent
191% infringement, then this Artistic License to you shall terminate on the
192% date that such litigation is filed.
193%
194% (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
195% HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED
196% WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
197% PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT
198% PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT
199% HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT,
200% INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
201% OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
202%
203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
204
205
206/* --------------------------- */
207/* Defines */
208/* --------------------------- */
209
210#define NESTED_TRIE_TERM "t"
211#define PairEndTag PairEndEmptyTag
212
213
214/* --------------------------- */
215/* API */
216/* --------------------------- */
217
218void core_set_label_counter(YAP_Int value);
219YAP_Int core_get_label_counter(void);
220void core_initialize_depth_breadth_trie(TrNode node, TrNode *depth_node, TrNode *breadth_node);
221void core_finalize_depth_breadth_trie(TrNode depth_node, TrNode breadth_node);
222TrNode core_simplification_reduction(TrEngine engine, TrNode node, void (*destruct_function)(TrNode));
223TrNode core_depth_reduction(TrEngine engine, TrNode node, TrNode depth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
224TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node, YAP_Int opt_level, void (*construct_function)(TrNode), void (*destruct_function)(TrNode), void (*copy_function)(TrNode, TrNode), void (*correct_order_function)(void));
225YAP_Term core_get_trie_db_return_term(void);
226void core_set_trie_db_return_term(YAP_Term return_value);
227YAP_Int core_db_trie_get_optimization_level_count(YAP_Int opt_level);
228void core_depth_breadth_trie_replace_nested_trie(TrNode node, YAP_Int nested_trie_id, YAP_Term new_term, void (*construct_function)(TrNode), void (*destruct_function)(TrNode));
229YAP_Int core_get_trie_db_opt_min_prefix(void);
230void core_set_trie_db_opt_min_prefix(YAP_Int min_prefix);