| 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 2 | % |
|---|
| 3 | % Logtalk - Open source object-oriented logic programming language |
|---|
| 4 | % Release 2.31.1 |
|---|
| 5 | % |
|---|
| 6 | % configuration file for Amzi! Prolog 7.6.1 and later versions |
|---|
| 7 | % |
|---|
| 8 | % last updated: October 24, 2007 |
|---|
| 9 | % |
|---|
| 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | :- loadlsx('aosutils.lsx'). |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 18 | % |
|---|
| 19 | % ISO Prolog Standard predicates that we must define because they are |
|---|
| 20 | % not built-in |
|---|
| 21 | % |
|---|
| 22 | % add a clause for lgt_iso_predicate/1 declaring each ISO predicate that |
|---|
| 23 | % we must define; there must be at least one clause for this predicate |
|---|
| 24 | % whose call should fail if we don't define any ISO predicates |
|---|
| 25 | % |
|---|
| 26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | initialization(Goal) :- |
|---|
| 30 | call(Goal). |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | % '$lgt_iso_predicate'(?callable). |
|---|
| 34 | |
|---|
| 35 | '$lgt_iso_predicate'(read_term(_, _, _)). |
|---|
| 36 | '$lgt_iso_predicate'(write_canonical(_, _)). |
|---|
| 37 | '$lgt_iso_predicate'(write_term(_, _, _)). |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | read_term(Stream, Term, [singletons([])]) :- |
|---|
| 41 | !, |
|---|
| 42 | read(Stream, Term). |
|---|
| 43 | |
|---|
| 44 | read_term(Stream, Term, _) :- |
|---|
| 45 | read(Stream, Term). |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | write_canonical(Stream, Term) :- |
|---|
| 49 | writeq(Stream, Term). |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | write_term(Stream, Term, [quoted(true)]) :- |
|---|
| 53 | !, |
|---|
| 54 | writeq(Stream, Term). |
|---|
| 55 | |
|---|
| 56 | write_term(Stream, Term, _) :- |
|---|
| 57 | write(Stream, Term). |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 62 | % |
|---|
| 63 | % predicate properties |
|---|
| 64 | % |
|---|
| 65 | % this predicate must return at least static, dynamic, and built_in |
|---|
| 66 | % properties for an existing predicate |
|---|
| 67 | % |
|---|
| 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | % '$lgt_predicate_property'(+callable, ?predicate_property) |
|---|
| 72 | |
|---|
| 73 | '$lgt_predicate_property'(Predicate, Property) :- |
|---|
| 74 | functor(Predicate, Functor, Arity), |
|---|
| 75 | '$lgt_predicate_property_pi'(Functor/Arity, Property). |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | '$lgt_predicate_property_pi'(Predicate, built_in) :- |
|---|
| 79 | predicate_property(Predicate, imported_from(amzi_system)), |
|---|
| 80 | \+ predicate_property(Predicate, built_in). |
|---|
| 81 | |
|---|
| 82 | '$lgt_predicate_property_pi'(Predicate, Property) :- |
|---|
| 83 | predicate_property(Predicate, Property). |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 88 | % |
|---|
| 89 | % meta-predicates |
|---|
| 90 | % |
|---|
| 91 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | % call_cleanup(+callable, +callble) |
|---|
| 95 | |
|---|
| 96 | call_cleanup(_, _) :- |
|---|
| 97 | throw(not_supported(call_cleanup/2)). |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | % forall(+callable, +callble) -- built-in |
|---|
| 101 | |
|---|
| 102 | forall(Generate, Test) :- |
|---|
| 103 | \+ (call(Generate), \+ call(Test)). |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | % retractall(+callable) -- built-in |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | % call_with_args/2-9 |
|---|
| 110 | % |
|---|
| 111 | % use these definitions only if your compiler does |
|---|
| 112 | % not provide call_with_args/2-9 as built-in predicates |
|---|
| 113 | |
|---|
| 114 | call_with_args(F, A) :- |
|---|
| 115 | Call =.. [F, A], |
|---|
| 116 | call(Call). |
|---|
| 117 | |
|---|
| 118 | call_with_args(F, A1, A2) :- |
|---|
| 119 | Call =.. [F, A1, A2], |
|---|
| 120 | call(Call). |
|---|
| 121 | |
|---|
| 122 | call_with_args(F, A1, A2, A3) :- |
|---|
| 123 | Call =.. [F, A1, A2, A3], |
|---|
| 124 | call(Call). |
|---|
| 125 | |
|---|
| 126 | call_with_args(F, A1, A2, A3, A4) :- |
|---|
| 127 | Call =.. [F, A1, A2, A3, A4], |
|---|
| 128 | call(Call). |
|---|
| 129 | |
|---|
| 130 | call_with_args(F, A1, A2, A3, A4, A5) :- |
|---|
| 131 | Call =.. [F, A1, A2, A3, A4, A5], |
|---|
| 132 | call(Call). |
|---|
| 133 | |
|---|
| 134 | call_with_args(F, A1, A2, A3, A4, A5, A6) :- |
|---|
| 135 | Call =.. [F, A1, A2, A3, A4, A5, A6], |
|---|
| 136 | call(Call). |
|---|
| 137 | |
|---|
| 138 | call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :- |
|---|
| 139 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7], |
|---|
| 140 | call(Call). |
|---|
| 141 | |
|---|
| 142 | call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :- |
|---|
| 143 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8], |
|---|
| 144 | call(Call). |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 149 | % |
|---|
| 150 | % Prolog built-in Prolog built-in meta-predicatess |
|---|
| 151 | % |
|---|
| 152 | % (excluding ISO Prolog Standard meta-predicates) |
|---|
| 153 | % |
|---|
| 154 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | % '$lgt_pl_meta_predicate'(?callable). |
|---|
| 158 | |
|---|
| 159 | '$lgt_pl_meta_predicate'(not(::)). |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 164 | % |
|---|
| 165 | % file extension predicates |
|---|
| 166 | % |
|---|
| 167 | % these extensions are used by Logtalk load/compile predicates |
|---|
| 168 | % |
|---|
| 169 | % you may want to change the extension for Prolog files to match |
|---|
| 170 | % the one expected by your Prolog compiler |
|---|
| 171 | % |
|---|
| 172 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | % '$lgt_file_extension'(?atom, ?atom) |
|---|
| 176 | |
|---|
| 177 | '$lgt_file_extension'(logtalk, '.lgt'). |
|---|
| 178 | '$lgt_file_extension'(prolog, '.pro'). |
|---|
| 179 | '$lgt_file_extension'(xml, '.xml'). |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 184 | % |
|---|
| 185 | % default flag values |
|---|
| 186 | % |
|---|
| 187 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | % '$lgt_default_flag'(?atom, ?atom) |
|---|
| 191 | % |
|---|
| 192 | % default values for all flags |
|---|
| 193 | |
|---|
| 194 | '$lgt_default_flag'(xmldocs, on). |
|---|
| 195 | '$lgt_default_flag'(xslfile, 'lgtxml.xsl'). |
|---|
| 196 | '$lgt_default_flag'(xmlspec, dtd). |
|---|
| 197 | '$lgt_default_flag'(xmlsref, local). |
|---|
| 198 | |
|---|
| 199 | '$lgt_default_flag'(unknown, warning). |
|---|
| 200 | '$lgt_default_flag'(misspelt, warning). |
|---|
| 201 | '$lgt_default_flag'(singletons, warning). |
|---|
| 202 | '$lgt_default_flag'(lgtredef, warning). |
|---|
| 203 | '$lgt_default_flag'(plredef, silent). |
|---|
| 204 | '$lgt_default_flag'(portability, silent). |
|---|
| 205 | |
|---|
| 206 | '$lgt_default_flag'(report, on). |
|---|
| 207 | |
|---|
| 208 | '$lgt_default_flag'(smart_compilation, off). |
|---|
| 209 | '$lgt_default_flag'(reload, always). |
|---|
| 210 | |
|---|
| 211 | '$lgt_default_flag'(startup_message, flags(verbose)). |
|---|
| 212 | |
|---|
| 213 | '$lgt_default_flag'(underscore_variables, singletons). |
|---|
| 214 | |
|---|
| 215 | '$lgt_default_flag'(code_prefix, ''). |
|---|
| 216 | |
|---|
| 217 | '$lgt_default_flag'(debug, off). |
|---|
| 218 | '$lgt_default_flag'(break_predicate, false). |
|---|
| 219 | |
|---|
| 220 | '$lgt_default_flag'(events, off). |
|---|
| 221 | |
|---|
| 222 | '$lgt_default_flag'(altdirs, off). |
|---|
| 223 | '$lgt_default_flag'(tmpdir, 'lgt_tmp/'). |
|---|
| 224 | '$lgt_default_flag'(xmldir, 'xml_docs/'). |
|---|
| 225 | |
|---|
| 226 | '$lgt_default_flag'(encoding_directive, unsupported). |
|---|
| 227 | '$lgt_default_flag'(threads, unsupported). |
|---|
| 228 | |
|---|
| 229 | '$lgt_default_flag'(context_switching_calls, allow). |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 234 | % |
|---|
| 235 | % list predicates |
|---|
| 236 | % |
|---|
| 237 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | '$lgt_append'([], List, List). |
|---|
| 241 | '$lgt_append'([Head| Tail], List, [Head| Tail2]) :- |
|---|
| 242 | '$lgt_append'(Tail, List, Tail2). |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | '$lgt_member'(Head, [Head| _]). |
|---|
| 246 | '$lgt_member'(Head, [_| Tail]) :- |
|---|
| 247 | '$lgt_member'(Head, Tail). |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | '$lgt_member_var'(V, [H| _]) :- |
|---|
| 251 | V == H. |
|---|
| 252 | '$lgt_member_var'(V, [_| T]) :- |
|---|
| 253 | '$lgt_member_var'(V, T). |
|---|
| 254 | |
|---|
| 255 | |
|---|
| 256 | '$lgt_is_list'([]) :- |
|---|
| 257 | !. |
|---|
| 258 | '$lgt_is_list'([_| Tail]) :- |
|---|
| 259 | '$lgt_is_list'(Tail). |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | '$lgt_is_proper_list'(List) :- |
|---|
| 263 | List == [], !. |
|---|
| 264 | '$lgt_is_proper_list'([_| Tail]) :- |
|---|
| 265 | nonvar(Tail), |
|---|
| 266 | '$lgt_is_proper_list'(Tail). |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 271 | % |
|---|
| 272 | % file predicates |
|---|
| 273 | % |
|---|
| 274 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | % '$lgt_file_exists'(+atom) |
|---|
| 278 | % |
|---|
| 279 | % see if a file exist in the current directory |
|---|
| 280 | |
|---|
| 281 | '$lgt_file_exists'(File) :- |
|---|
| 282 | file_exists(File). |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | % '$lgt_directory_exists'(+atom) |
|---|
| 286 | % |
|---|
| 287 | % checks if a directory exists |
|---|
| 288 | |
|---|
| 289 | '$lgt_directory_exists'(Directory) :- |
|---|
| 290 | file_exists(Directory). |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | % '$lgt_current_directory'(-atom) |
|---|
| 294 | % |
|---|
| 295 | % gets current working directory |
|---|
| 296 | |
|---|
| 297 | '$lgt_current_directory'(Directory) :- |
|---|
| 298 | curdir(Directory). |
|---|
| 299 | |
|---|
| 300 | |
|---|
| 301 | % '$lgt_change_directory'(+atom) |
|---|
| 302 | % |
|---|
| 303 | % changes current working directory |
|---|
| 304 | |
|---|
| 305 | '$lgt_change_directory'(Directory) :- |
|---|
| 306 | chdir(Directory). |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | % '$lgt_make_directory'(+atom) |
|---|
| 310 | % |
|---|
| 311 | % makes a new directory; succeeds if the directory already exists |
|---|
| 312 | |
|---|
| 313 | '$lgt_make_directory'(Directory) :- |
|---|
| 314 | file_exists(Directory) -> |
|---|
| 315 | true |
|---|
| 316 | ; |
|---|
| 317 | mkdir(Directory). |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | % '$lgt_load_prolog_code'(+atom, +atom) |
|---|
| 321 | % |
|---|
| 322 | % compile and load a Prolog file |
|---|
| 323 | |
|---|
| 324 | '$lgt_load_prolog_code'(File, _) :- |
|---|
| 325 | reconsult(File). |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | % '$lgt_compare_file_mtimes'(?atom, +atom, +atom) |
|---|
| 329 | % |
|---|
| 330 | % compare file modification times |
|---|
| 331 | |
|---|
| 332 | '$lgt_compare_file_mtimes'(_, _, _) :- |
|---|
| 333 | fail. |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | |
|---|
| 337 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 338 | % |
|---|
| 339 | % sorting predicates |
|---|
| 340 | % |
|---|
| 341 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 342 | |
|---|
| 343 | |
|---|
| 344 | % '$lgt_keysort'(+list, -list) |
|---|
| 345 | |
|---|
| 346 | '$lgt_keysort'(List, Sorted) :- |
|---|
| 347 | keysort(List, Sorted). |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | % '$lgt_sort'(+list, -list) |
|---|
| 351 | |
|---|
| 352 | '$lgt_sort'(List, Sorted) :- |
|---|
| 353 | sort(List, Sorted). |
|---|
| 354 | |
|---|
| 355 | |
|---|
| 356 | |
|---|
| 357 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 358 | % |
|---|
| 359 | % time and date predicates |
|---|
| 360 | % |
|---|
| 361 | % if your Prolog compiler does not provide access to the operating system |
|---|
| 362 | % time and date just write dummy definitions |
|---|
| 363 | % |
|---|
| 364 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | % '$lgt_current_date'(?Year, ?Month, ?Day) |
|---|
| 368 | |
|---|
| 369 | '$lgt_current_date'(Year, Month, Day) :- |
|---|
| 370 | date(Month, Day, Year). |
|---|
| 371 | |
|---|
| 372 | |
|---|
| 373 | % '$lgt_current_time'(?Hours, ?Mins, ?Secs) |
|---|
| 374 | |
|---|
| 375 | '$lgt_current_time'(Hours, Mins, Secs) :- |
|---|
| 376 | time(Hours, Mins, Secs). |
|---|
| 377 | |
|---|
| 378 | |
|---|
| 379 | |
|---|
| 380 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 381 | % |
|---|
| 382 | % timing predicate |
|---|
| 383 | % |
|---|
| 384 | % if your Prolog compiler does not provide access to a timing predicate |
|---|
| 385 | % just write dummy definition |
|---|
| 386 | % |
|---|
| 387 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 388 | |
|---|
| 389 | |
|---|
| 390 | % '$lgt_cpu_time'(-Seconds) |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | '$lgt_cpu_time'(Seconds) :- |
|---|
| 394 | Seconds is cputime. |
|---|
| 395 | |
|---|
| 396 | |
|---|
| 397 | |
|---|
| 398 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 399 | % |
|---|
| 400 | % comparison predicate |
|---|
| 401 | % |
|---|
| 402 | % the usual compare/3 definition |
|---|
| 403 | % |
|---|
| 404 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | % compare(Order, Term1, Term2) -- built-in |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 412 | % |
|---|
| 413 | % callable predicate |
|---|
| 414 | % |
|---|
| 415 | % the usual callable/1 definition |
|---|
| 416 | % |
|---|
| 417 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 418 | |
|---|
| 419 | |
|---|
| 420 | % callable(@term) |
|---|
| 421 | |
|---|
| 422 | callable(Term) :- |
|---|
| 423 | nonvar(Term), |
|---|
| 424 | functor(Term, Functor, _), |
|---|
| 425 | atom(Functor). |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 430 | % |
|---|
| 431 | % read character predicate |
|---|
| 432 | % |
|---|
| 433 | % read a single character echoing it and writing a newline after |
|---|
| 434 | % |
|---|
| 435 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | '$lgt_read_single_char'(Char) :- |
|---|
| 439 | respkey(Code), nl, name(Char, [Code]). |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | |
|---|
| 443 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 444 | % |
|---|
| 445 | % pretty print a term by naming its free variables |
|---|
| 446 | % (avoid instantiating variables in term by using double negation if necessary) |
|---|
| 447 | % |
|---|
| 448 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | '$lgt_pretty_print_vars'(Stream, Term) :- |
|---|
| 452 | \+ \+ (numbervars(Term, 1, _), write(Stream, Term)). |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | '$lgt_pretty_print_vars_quoted'(Stream, Term) :- |
|---|
| 456 | \+ \+ (numbervars(Term, 1, _), writeq(Stream, Term)). |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 461 | % |
|---|
| 462 | % getting stream current line number |
|---|
| 463 | % (needed for improved compiler error messages) |
|---|
| 464 | % |
|---|
| 465 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 466 | |
|---|
| 467 | |
|---|
| 468 | % '$lgt_stream_current_line_number'(@stream, -integer) |
|---|
| 469 | |
|---|
| 470 | '$lgt_stream_current_line_number'(_, _) :- |
|---|
| 471 | fail. |
|---|
| 472 | |
|---|
| 473 | |
|---|
| 474 | |
|---|
| 475 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 476 | % |
|---|
| 477 | % handling of Prolog-proprietary directives on Logtalk source files |
|---|
| 478 | % |
|---|
| 479 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 480 | |
|---|
| 481 | |
|---|
| 482 | % '$lgt_ignore_pl_directive'(@callable) |
|---|
| 483 | |
|---|
| 484 | '$lgt_ignore_pl_directive'(_) :- |
|---|
| 485 | fail. |
|---|
| 486 | |
|---|
| 487 | |
|---|
| 488 | % '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable) |
|---|
| 489 | |
|---|
| 490 | '$lgt_rewrite_and_copy_pl_directive'(_, _) :- |
|---|
| 491 | fail. |
|---|
| 492 | |
|---|
| 493 | |
|---|
| 494 | % '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable) |
|---|
| 495 | |
|---|
| 496 | '$lgt_rewrite_and_recompile_pl_directive'(_, _) :- |
|---|
| 497 | fail. |
|---|
| 498 | |
|---|
| 499 | |
|---|
| 500 | |
|---|
| 501 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 502 | % |
|---|
| 503 | % Shortcut to the Logtalk built-in predicate logtalk_load/1 |
|---|
| 504 | % |
|---|
| 505 | % defined in the config files in order to be able to comment it out in case |
|---|
| 506 | % of conflict with some Prolog native feature; it implies conformance with |
|---|
| 507 | % the ISO Prolog standard regarding the definition of the {}/1 syntax |
|---|
| 508 | % |
|---|
| 509 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 510 | |
|---|
| 511 | {File, Files} :- |
|---|
| 512 | !, |
|---|
| 513 | logtalk_load(File), |
|---|
| 514 | {Files}. |
|---|
| 515 | {File} :- |
|---|
| 516 | logtalk_load(File). |
|---|
| 517 | |
|---|
| 518 | |
|---|
| 519 | |
|---|
| 520 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 521 | % |
|---|
| 522 | % end! |
|---|
| 523 | % |
|---|
| 524 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|