Debian Codegraph @

tests/inputs/logtalk.lgt

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % https://raw.githubusercontent.com/LogtalkDotOrg/logtalk3/master/core/logtalk.lgt
3 %
4 % This file is part of Logtalk <http://logtalk.org/>
5 % Copyright 1998-2016 Paulo Moura <[email protected]>
6 %
7 % Licensed under the Apache License, Version 2.0 (the "License");
8 % you may not use this file except in compliance with the License.
9 % You may obtain a copy of the License at
10 %
11 % http://www.apache.org/licenses/LICENSE-2.0
12 %
13 % Unless required by applicable law or agreed to in writing, software
14 % distributed under the License is distributed on an "AS IS" BASIS,
15 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 % See the License for the specific language governing permissions and
17 % limitations under the License.
18 %
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21
22 % the compiler/runtime must be able to call some of the code generated
23 % by the compilation of the `logtalk` object directly, thus forcing us
24 % to fix the code prefix that is used in its compilation
25 :- set_logtalk_flag(code_prefix, '$').
26
27
28 :- if(current_logtalk_flag(prolog_dialect, lean)).
29 % avoid a warning when embedding Logtalk in Lean Prolog
30 :- dynamic('$lgt_parent_file_'/2).
31 :- endif.
32
33
34 :- object(logtalk).
35
36 :- info([
37 version is 1.2,
38 author is 'Paulo Moura',
39 date is 2015/08/26,
40 comment is 'Built-in object providing message printing, debugging, library, source file, and hacking methods.']).
41
42 :- built_in.
43
44 :- set_logtalk_flag(context_switching_calls, allow).
45 :- set_logtalk_flag(dynamic_declarations, deny).
46 :- set_logtalk_flag(complements, deny).
47 :- set_logtalk_flag(events, deny).
48 :- if(current_logtalk_flag(threads, supported)).
49 :- threaded.
50 :- endif.
51
52 % message printing predicates
53
54 :- public(print_message/3).
55 :- mode(print_message(+nonvar, +nonvar, +nonvar), one).
56 :- info(print_message/3, [
57 comment is 'Prints a message of the given kind for the specified component.',
58 argnames is ['Kind', 'Component', 'Message']
59 ]).
60
61 :- public(print_message_tokens/3).
62 :- mode(print_message_tokens(@stream_or_alias, +atom, @list(nonvar)), one).
63 :- info(print_message_tokens/3, [
64 comment is 'Print the messages tokens to the given stream, prefixing each line with the specified atom.',
65 argnames is ['Stream', 'Prefix', 'Tokens']
66 ]).
67
68 :- public(print_message_token/4).
69 :- multifile(print_message_token/4).
70 :- dynamic(print_message_token/4).
71 :- mode(print_message_token(@stream_or_alias, @atom, @nonvar, @list(nonvar)), zero_or_one).
72 :- info(print_message_token/4, [
73 comment is 'User-defined hook predicate for printing a message token (at_same_line, nl, flush, Format-Arguments, term(Term,Options), ansi(Attributes,Format,Arguments), begin(Kind,Variable), and end(Variable)).',
74 argnames is ['Stream', 'Prefix', 'Token', 'Tokens']
75 ]).
76
77 :- public(message_tokens//2).
78 :- multifile(message_tokens//2).
79 :- dynamic(message_tokens//2).
80 :- mode(message_tokens(+nonvar, +nonvar), zero_or_one).
81 :- info(message_tokens//2, [
82 comment is 'User-defined hook grammar rule for converting a message into a list of tokens (at_same_line, nl, flush, Format-Arguments, term(Term,Options), ansi(Attributes,Format,Arguments), begin(Kind,Variable), and end(Variable)).',
83 argnames is ['Message', 'Component']
84 ]).
85
86 :- public(message_prefix_stream/4).
87 :- multifile(message_prefix_stream/4).
88 :- dynamic(message_prefix_stream/4).
89 :- mode(message_prefix_stream(?nonvar, ?nonvar, ?atom, ?stream_or_alias), zero_or_more).
90 :- info(message_prefix_stream/4, [
91 comment is 'Message line prefix and output stream to be used when printing a message given its kind and component.',
92 argnames is ['Kind', 'Component', 'Prefix', 'Stream']
93 ]).
94
95 :- public(message_hook/4).
96 :- multifile(message_hook/4).
97 :- dynamic(message_hook/4).
98 :- mode(message_hook(+nonvar, +nonvar, +nonvar, +list(nonvar)), zero_or_one).
99 :- info(message_hook/4, [
100 comment is 'User-defined hook predicate for intercepting message printing calls.',
101 argnames is ['Message', 'Kind', 'Component', 'Tokens']
102 ]).
103
104 % question asking predicates
105
106 :- public(ask_question/5).
107 :- meta_predicate(ask_question(*, *, *, 1, *)).
108 :- mode(ask_question(+nonvar, +nonvar, +nonvar, +callable, -term), one).
109 :- info(ask_question/5, [
110 comment is 'Asks a question and reads the answer until the check predicate is true.',
111 argnames is ['Kind', 'Component', 'Question', 'Check', 'Answer']
112 ]).
113
114 :- public(question_hook/6).
115 :- multifile(question_hook/6).
116 :- dynamic(question_hook/6).
117 :- meta_predicate(question_hook(*, *, *, *, 1, *)).
118 :- mode(question_hook(+nonvar, +nonvar, +nonvar, +list(nonvar), +callable, -term), zero_or_one).
119 :- info(question_hook/6, [
120 comment is 'User-defined hook predicate for intercepting question asking calls.',
121 argnames is ['Question', 'Kind', 'Component', 'Tokens', 'Check', 'Answer']
122 ]).
123
124 :- public(question_prompt_stream/4).
125 :- multifile(question_prompt_stream/4).
126 :- dynamic(question_prompt_stream/4).
127 :- mode(question_prompt_stream(?nonvar, ?nonvar, ?atom, ?stream_or_alias), zero_or_more).
128 :- info(question_prompt_stream/4, [
129 comment is 'Prompt and input stream to be used when asking a question given its kind and component.',
130 argnames is ['Kind', 'Component', 'Prompt', 'Stream']
131 ]).
132
133 % debugging predicates
134
135 :- public(trace_event/2).
136 :- multifile(trace_event/2).
137 :- dynamic(trace_event/2).
138 :- mode(trace_event(@callable, @execution_context), zero).
139 :- info(trace_event/2, [
140 comment is 'Trace event handler. The runtime calls all trace event handlers using a failure-driven loop before calling the debug event handler.',
141 argnames is ['Event', 'ExecutionContext']
142 ]).
143
144 :- public(debug_handler_provider/1).
145 :- multifile(debug_handler_provider/1).
146 :- mode(debug_handler_provider(?object_identifier), zero_or_one).
147 :- info(debug_handler_provider/1, [
148 comment is 'Declares an object as the debug handler provider. There should be at most one debug handler provider loaded at any given moment.',
149 argnames is ['Provider']
150 ]).
151 % workaround the lack of support for static multifile predicates in Qu-Prolog and XSB
152 :- if((current_logtalk_flag(prolog_dialect, Dialect), (Dialect==xsb; Dialect==qp))).
153 :- dynamic(debug_handler_provider/1).
154 :- endif.
155
156 :- public(debug_handler/2).
157 :- multifile(debug_handler/2).
158 :- mode(debug_handler(?entity_identifier, ?atom), zero_or_more).
159 :- info(debug_handler/2, [
160 comment is 'Debug event handler. The defined events are unification events - fact(Entity,Fact,Clause,Line) and rule(Entity,Head,Clause,Line) - and goal events - top_goal(Goal,CompiledGoal) and goal(Goal,CompiledGoal).',
161 argnames is ['Event', 'ExecutionContext']
162 ]).
163 % workaround the lack of support for static multifile predicates in Qu-Prolog and XSB
164 :- if((current_logtalk_flag(prolog_dialect, Dialect), (Dialect==xsb; Dialect==qp))).
165 :- dynamic(debug_handler/2).
166 :- endif.
167
168 % file and library predicates
169
170 :- public(expand_library_path/2).
171 :- mode(expand_library_path(+atom, ?atom), zero_or_one).
172 :- info(expand_library_path/2, [
173 comment is 'Expands a library name into its full path. Uses a depth bound to prevent loops.',
174 argnames is ['Library', 'Path']
175 ]).
176
177 :- public(loaded_file/1).
178 :- mode(loaded_file(?atom), zero_or_more).
179 :- info(loaded_file/1, [
180 comment is 'Enumerates, by backtracking, all loaded files, returning their full paths.',
181 argnames is ['Path']
182 ]).
183
184 :- public(loaded_file_property/2).
185 :- mode(loaded_file_property(?atom, ?compound), zero_or_more).
186 :- info(loaded_file_property/2, [
187 comment is 'Enumerates, by backtracking, all loaded file properties. Valid properties are: basename/1, directory/1, mode/1, flags/1, text_properties/1 (encoding/1 and bom/1), target/1, modified/1, parent/1, library/1, object/1, protocol/1, and category/1.',
188 argnames is ['Path', 'Property']
189 ]).
190
191 % hacking predicates
192
193 :- public(compile_aux_clauses/1).
194 :- mode(compile_aux_clauses(@list(clause)), one).
195 :- info(compile_aux_clauses/1, [
196 comment is 'Compiles a list of auxiliary clauses.',
197 argnames is ['Clauses']
198 ]).
199
200 :- public(entity_prefix/2).
201 :- mode(entity_prefix(?entity_identifier, ?atom), zero_or_one).
202 :- info(entity_prefix/2, [
203 comment is 'Converts between an entity identifier and the entity prefix that is used for its compiled code. When none of the arguments is instantiated, it returns the identifier and the prefix of the entity under compilation, if any.',
204 argnames is ['Entity', 'Prefix']
205 ]).
206
207 :- public(compile_predicate_heads/4).
208 :- mode(compile_predicate_heads(@list(callable), ?entity_identifier, -list(callable), @execution_context), zero_or_one).
209 :- mode(compile_predicate_heads(@conjunction(callable), ?entity_identifier, -conjunction(callable), @execution_context), zero_or_one).
210 :- mode(compile_predicate_heads(@callable, ?entity_identifier, -callable, @execution_context), zero_or_one).
211 :- info(compile_predicate_heads/4, [
212 comment is 'Compiles clause heads. The heads are compiled in the context of the entity under compilation when the entity argument is not instantiated.',
213 argnames is ['Heads', 'Entity', 'CompiledHeads', 'ExecutionContext']
214 ]).
215
216 :- public(compile_predicate_indicators/3).
217 :- mode(compile_predicate_indicators(@list(predicate_indicator), ?entity_identifier, -list(predicate_indicator)), zero_or_one).
218 :- mode(compile_predicate_indicators(@conjunction(predicate_indicator), ?entity_identifier, -conjunction(predicate_indicator)), zero_or_one).
219 :- mode(compile_predicate_indicators(@predicate_indicator, ?entity_identifier, -predicate_indicator), zero_or_one).
220 :- info(compile_predicate_indicators/3, [
221 comment is 'Compiles predicate indicators. The predicate are compiled in the context of the entity under compilation when the entity argument is not instantiated.',
222 argnames is ['PredicateIndicators', 'Entity', 'CompiledPredicateIndicators']
223 ]).
224
225 :- public(decompile_predicate_heads/4).
226 :- mode(decompile_predicate_heads(@list(callable), -entity_identifier, -atom, -list(callable)), zero_or_one).
227 :- mode(decompile_predicate_heads(@conjunction(callable), -entity_identifier, -atom, -conjunction(callable)), zero_or_one).
228 :- mode(decompile_predicate_heads(@callable, -entity_identifier, -atom, -callable), zero_or_one).
229 :- info(decompile_predicate_heads/4, [
230 comment is 'Decompiles clause heads. All compiled clause heads must belong to the same entity, which must be loaded.',
231 argnames is ['CompiledHeads', 'Entity', 'Type', 'Heads']
232 ]).
233
234 :- public(decompile_predicate_indicators/4).
235 :- mode(decompile_predicate_indicators(@list(predicate_indicator), -entity_identifier, -atom, -list(predicate_indicator)), zero_or_one).
236 :- mode(decompile_predicate_indicators(@conjunction(predicate_indicator), -entity_identifier, -atom, -conjunction(predicate_indicator)), zero_or_one).
237 :- mode(decompile_predicate_indicators(@predicate_indicator, -entity_identifier, -atom, -predicate_indicator), zero_or_one).
238 :- info(decompile_predicate_indicators/4, [
239 comment is 'Decompiles predicate indicators. All compiled predicate indicators must belong to the same entity, which must be loaded.',
240 argnames is ['CompiledPredicateIndicators', 'Entity', 'Type', 'PredicateIndicators']
241 ]).
242
243 :- public(execution_context/7).
244 :- mode(execution_context(?nonvar, ?entity_identifier, ?object_identifier, ?object_identifier, ?object_identifier, @list(callable), @list(callable)), zero_or_one).
245 :- info(execution_context/7, [
246 comment is 'Execution context term data. Execution context terms should be considered opaque terms subject to change without notice.',
247 argnames is ['ExecutionContext', 'Entity', 'Sender', 'This', 'Self', 'MetaCallContext', 'Stack']
248 ]).
249
250 print_message(Kind, Component, Message) :-
251 message_term_to_tokens(Message, Kind, Component, Tokens),
252 ( nonvar(Message),
253 message_hook(Message, Kind, Component, Tokens) ->
254 % message intercepted; assume that the message is printed
255 true
256 ; default_print_message(Kind, Component, Tokens)
257 ).
258
259 % message_term_to_tokens(@term, @term, @term, -list)
260 %
261 % translates a message term to tokens
262 message_term_to_tokens(Message, Kind, Component, Tokens) :-
263 ( var(Message) ->
264 Tokens = ['Non-instantiated ~q message for component ~q!'-[Kind, Component], nl]
265 ; phrase(message_tokens(Message, Component), Tokens) ->
266 true
267 ; Tokens = ['Unknown ~q message for component ~q: ~q'-[Kind, Component, Message], nl]
268 ).
269
270 % default_print_message(+atom_or_compound, +atom, +compound, +list, +compound)
271 %
272 % print a message that was not intercepted by the user
273 default_print_message(silent, _, _) :-
274 !.
275 default_print_message(silent(_), _, _) :-
276 !.
277 default_print_message(banner, _, _) :-
278 \+ current_logtalk_flag(report, on),
279 !.
280 default_print_message(comment, _, _) :-
281 \+ current_logtalk_flag(report, on),
282 !.
283 default_print_message(comment(_), _, _) :-
284 \+ current_logtalk_flag(report, on),
285 !.
286 default_print_message(warning, _, _) :-
287 current_logtalk_flag(report, off),
288 !.
289 default_print_message(warning(_), _, _) :-
290 current_logtalk_flag(report, off),
291 !.
292 default_print_message(Kind, Component, Tokens) :-
293 ( message_prefix_stream(Kind, Component, Prefix, Stream) ->
294 true
295 ; % no user-defined prefix and stream; use default definition
296 default_message_prefix_stream(Kind, Prefix, Stream) ->
297 true
298 ; % no such kind of message; use "information" instead
299 default_message_prefix_stream(information, Prefix, Stream)
300 ),
301 % add begin/2 and end/1 tokens to, respectively, the start and the end of the list of tokens
302 % but pass them using discrete arguments instead of doing an expensive list append operation;
303 % these two tokens can be intercepted by the user for supporting e.g. message coloring
304 functor(Kind, Functor, _),
305 print_message_tokens_([begin(Functor,Ctx), Prefix-[]| Tokens], Stream, Prefix),
306 print_message_tokens_([end(Ctx)], Stream, Prefix).
307
308 % default_message_prefix_stream(?atom_or_compound, ?atom, ?stream_or_alias)
309 %
310 % default definitions for any component for the line prefix and output stream used
311 % when printing messages; the definitions used here are based on Quintus Prolog and
312 % are also used in other Prolog compilers
313 default_message_prefix_stream(banner, '', user_output).
314 default_message_prefix_stream(help, '', user_output).
315 default_message_prefix_stream(question, '', user_output).
316 default_message_prefix_stream(information, '% ', user_output).
317 default_message_prefix_stream(information(_), '% ', user_output).
318 default_message_prefix_stream(comment, '% ', user_output).
319 default_message_prefix_stream(comment(_), '% ', user_output).
320 default_message_prefix_stream(warning, '* ', user_error).
321 default_message_prefix_stream(warning(_), '* ', user_error).
322 default_message_prefix_stream(error, '! ', user_error).
323 default_message_prefix_stream(error(_), '! ', user_error).
324
325 print_message_tokens(Stream, Prefix, Tokens) :-
326 ( Tokens = [at_same_line| _] ->
327 % continuation message
328 print_message_tokens_(Tokens, Stream, Prefix)
329 ; Tokens = [begin(Kind, Context)| Rest] ->
330 % write the prefix after the begin/2 token
331 print_message_tokens_([begin(Kind, Context), Prefix-[]| Rest], Stream, Prefix)
332 ; % write first line prefix
333 write(Stream, Prefix),
334 print_message_tokens_(Tokens, Stream, Prefix)
335 ).
336
337 % if the list of tokens unifies with (-), assume it's a variable and ignore it
338 print_message_tokens_((-), _, _).
339 print_message_tokens_([], _, _).
340 print_message_tokens_([Token| Tokens], Stream, Prefix) :-
341 ( print_message_token(Stream, Prefix, Token, Tokens) ->
342 % token printing intercepted by user-defined code
343 true
344 ; % no user-defined token printing; use Logtalk default
345 default_print_message_token(Token, Tokens, Stream, Prefix) ->
346 true
347 ; % unsupported token
348 writeq(Stream, Token)
349 ),
350 print_message_tokens_(Tokens, Stream, Prefix).
351
352 % if a token unifies with (-), assume it's a variable and ignore it
353 default_print_message_token((-), _, _, _).
354 default_print_message_token(at_same_line, _, _, _).
355 default_print_message_token(nl, Tokens, Stream, Prefix) :-
356 ( Tokens == [] ->
357 nl(Stream)
358 ; Tokens = [end(_)] ->
359 nl(Stream)
360 ; nl(Stream),
361 write(Stream, Prefix)
362 ).
363 default_print_message_token(flush, _, Stream, _) :-
364 flush_output(Stream).
365 default_print_message_token(Format-Arguments, _, Stream, _) :-
366 {format(Stream, Format, Arguments)}.
367 default_print_message_token(term(Term, Options), _, Stream, _) :-
368 {write_term(Stream, Term, Options)}.
369 % the following tokens were first introduced by SWI-Prolog; we use default definitions
370 % for compatibility when running Logtalk with other back-end Prolog compilers
371 default_print_message_token(ansi(_, Format, Arguments), _, Stream, _) :-
372 {format(Stream, Format, Arguments)}.
373 default_print_message_token(begin(_, _), _, _, _).
374 default_print_message_token(end(_), _, _, _).
375
376 ask_question(Kind, Component, Question, Check, Answer) :-
377 message_term_to_tokens(Question, Kind, Component, Tokens),
378 ( question_hook(Question, Kind, Component, Tokens, Check, Answer) ->
379 % question asking intercepted; assume that the question was answered
380 true
381 ; % print the question text
382 default_print_message(Kind, Component, Tokens),
383 % find the output stream for printing the question prompt
384 ( message_prefix_stream(Kind, Component, _, OutputStream) ->
385 true
386 ; % no user-defined prefix and stream; use default definition
387 default_message_prefix_stream(Kind, _, OutputStream) ->
388 true
389 ; % no such kind of message; use "information" instead
390 default_message_prefix_stream(information, _, OutputStream)
391 ),
392 % find the prompt and the input stream
393 ( question_prompt_stream(Kind, Component, Prompt, InputStream) ->
394 true
395 ; default_question_prompt_stream(Kind, _, Prompt, InputStream) ->
396 true
397 ; % no such kind of question; use "question" instead
398 default_question_prompt_stream(question, _, Prompt, InputStream)
399 ),
400 repeat,
401 write(OutputStream, Prompt),
402 read(InputStream, Answer),
403 call(Check, Answer),
404 !
405 ).
406
407 default_question_prompt_stream(question, _, '> ', user_input).
408
409 expand_library_path(Library, Path) :-
410 {'$lgt_expand_library_path'(Library, Path)}.
411
412 loaded_file(Path) :-
413 {'$lgt_loaded_file_'(Basename, Directory, _, _, _, _, _)},
414 atom_concat(Directory, Basename, Path).
415
416 loaded_file_property(Path, Property) :-
417 ( var(Path) ->
418 {'$lgt_loaded_file_'(Basename, Directory, Mode, Flags, TextProperties, PrologFile, TimeStamp)},
419 atom_concat(Directory, Basename, Path)
420 ; {'$lgt_loaded_file_'(Basename, Directory, Mode, Flags, TextProperties, PrologFile, TimeStamp)},
421 atom_concat(Directory, Basename, Path),
422 !
423 ),
424 loaded_file_property(Property, Basename, Directory, Mode, Flags, TextProperties, PrologFile, TimeStamp).
425
426 loaded_file_property(basename(Basename), Basename, _, _, _, _, _, _).
427 loaded_file_property(directory(Directory), _, Directory, _, _, _, _, _).
428 loaded_file_property(mode(Mode), _, _, Mode, _, _, _, _).
429 loaded_file_property(flags(Flags), _, _, _, Flags, _, _, _).
430 loaded_file_property(text_properties(TextProperties), _, _, _, _, TextProperties, _, _).
431 loaded_file_property(target(PrologFile), _, _, _, _, _, PrologFile, _).
432 loaded_file_property(modified(TimeStamp), _, _, _, _, _, _, TimeStamp).
433 loaded_file_property(parent(Parent), Basename, Directory, _, _, _, _, _) :-
434 atom_concat(Directory, Basename, Path),
435 {'$lgt_parent_file_'(Path, Parent)}.
436 loaded_file_property(object(Object), Basename, Directory, _, _, _, _, _) :-
437 {'$lgt_current_object_'(Object, _, _, _, _, _, _, _, _, _, _),
438 '$lgt_entity_property_'(Object, file_lines(Basename, Directory, _, _))}.
439 loaded_file_property(protocol(Protocol), Basename, Directory, _, _, _, _, _) :-
440 {'$lgt_current_protocol_'(Protocol, _, _, _, _),
441 '$lgt_entity_property_'(Protocol, file_lines(Basename, Directory, _, _))}.
442 loaded_file_property(category(Category), Basename, Directory, _, _, _, _, _) :-
443 {'$lgt_current_category_'(Category, _, _, _, _, _),
444 '$lgt_entity_property_'(Category, file_lines(Basename, Directory, _, _))}.
445 loaded_file_property(library(Library), _, Directory, _, _, _, _, _) :-
446 logtalk_library_path(Library, _),
447 {'$lgt_expand_library_path'(Library, Directory)}, !.
448
449 compile_aux_clauses(Clauses) :-
450 {'$lgt_compile_aux_clauses'(Clauses)}.
451
452 entity_prefix(Entity, Prefix) :-
453 {'$lgt_entity_prefix'(Entity, Prefix)}.
454
455 compile_predicate_heads(Heads, Entity, CompiledHeads, ExecutionContext) :-
456 {'$lgt_compile_predicate_heads'(Heads, Entity, CompiledHeads, ExecutionContext)}.
457
458 compile_predicate_indicators(PredicateIndicators, Entity, CompiledPredicateIndicators) :-
459 {'$lgt_compile_predicate_indicators'(PredicateIndicators, Entity, CompiledPredicateIndicators)}.
460
461 decompile_predicate_indicators(CompiledPredicateIndicators, Entity, Type, PredicateIndicators) :-
462 {'$lgt_decompile_predicate_indicators'(CompiledPredicateIndicators, Entity, Type, PredicateIndicators)}.
463
464 decompile_predicate_heads(THeads, Entity, Type, Heads) :-
465 {'$lgt_decompile_predicate_heads'(THeads, Entity, Type, Heads)}.
466
467 execution_context(ExecutionContext, Entity, Sender, This, Self, MetaCallContext, Stack) :-
468 {'$lgt_execution_context'(ExecutionContext, Entity, Sender, This, Self, MetaCallContext, Stack)}.
469
470 :- end_object.
471
472
473 :- if(current_logtalk_flag(prolog_dialect, gnu)).
474 % workaround apparent gplc bug when dealing with multifile predicates
475 :- multifile(logtalk_library_path/2).
476 :- dynamic(logtalk_library_path/2).
477 :- multifile('$lgt_current_protocol_'/5).
478 :- dynamic('$lgt_current_protocol_'/5).
479 :- multifile('$lgt_current_category_'/6).
480 :- dynamic('$lgt_current_category_'/6).
481 :- elif(current_logtalk_flag(prolog_dialect, xsb)).
482 % workaround XSB atom-based module system
483 :- import(from(/(format,3), format)).
484 :- endif.