| 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 2 | % |
|---|
| 3 | % Logtalk - Object oriented extension to Prolog |
|---|
| 4 | % Release 2.21.0 |
|---|
| 5 | % |
|---|
| 6 | % configuration file for ALS Prolog 3.1 |
|---|
| 7 | % |
|---|
| 8 | % last updated: July 17, 2004 |
|---|
| 9 | % |
|---|
| 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 16 | % |
|---|
| 17 | % ISO Prolog Standard predicates that we must define because they are |
|---|
| 18 | % not built-in |
|---|
| 19 | % |
|---|
| 20 | % add a clause for lgt_iso_predicate/1 declaring each ISO predicate that |
|---|
| 21 | % we must define; there must be at least one clause for this predicate |
|---|
| 22 | % whose call should fail if we don't define any ISO predicates |
|---|
| 23 | % |
|---|
| 24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | initialization(Goal) :- |
|---|
| 28 | call(Goal). |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | % '$lgt_iso_predicate'(?callable). |
|---|
| 32 | |
|---|
| 33 | '$lgt_iso_predicate'(abolish(_)). |
|---|
| 34 | '$lgt_iso_predicate'(current_predicate(_)). |
|---|
| 35 | '$lgt_iso_predicate'(once(_)). |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | abolish(Functor/Arity) :- |
|---|
| 39 | abolish(Functor, Arity). |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | current_predicate(Functor/Arity) :- |
|---|
| 43 | procedures(_, Functor, Arity, _). |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | once(Goal) :- |
|---|
| 47 | call(Goal), |
|---|
| 48 | !. |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 53 | % |
|---|
| 54 | % predicate properties |
|---|
| 55 | % |
|---|
| 56 | % this predicate must return at least static, dynamic, and built_in |
|---|
| 57 | % properties for an existing predicate |
|---|
| 58 | % |
|---|
| 59 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | % '$lgt_predicate_property'(+callable, ?predicate_property) |
|---|
| 63 | |
|---|
| 64 | '$lgt_predicate_property'(Pred, built_in) :- |
|---|
| 65 | functor(Pred, Functor, Arity), |
|---|
| 66 | all_procedures(Module, Functor, Arity, _), |
|---|
| 67 | once((Module = builtins; Module = sio)). |
|---|
| 68 | |
|---|
| 69 | '$lgt_predicate_property'(Pred, dynamic) :- |
|---|
| 70 | procedures(_, Functor, Arity, _). |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | '$lgt_predicate_property'(Pred, static) :- |
|---|
| 74 | '$lgt_predicate_property'(Pred, built_in). |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 79 | % |
|---|
| 80 | % metapredicates |
|---|
| 81 | % |
|---|
| 82 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | % forall(+callable, +callble) |
|---|
| 86 | |
|---|
| 87 | forall(Generate, Test) :- |
|---|
| 88 | \+ call((Generate, \+ call(Test))). |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | % retractall(+callable). |
|---|
| 92 | |
|---|
| 93 | retractall(Head) :- |
|---|
| 94 | retract((Head:-_)), |
|---|
| 95 | fail. |
|---|
| 96 | |
|---|
| 97 | retractall(Head) :- |
|---|
| 98 | retract(Head), |
|---|
| 99 | fail. |
|---|
| 100 | |
|---|
| 101 | retractall(_). |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | % lgt_call/2-8 |
|---|
| 105 | % |
|---|
| 106 | % use these definitions only if your compiler does |
|---|
| 107 | % not provide call/1-8 as built-in predicates |
|---|
| 108 | |
|---|
| 109 | '$lgt_call'(F, A) :- |
|---|
| 110 | Call =.. [F, A], |
|---|
| 111 | call(Call). |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | '$lgt_call'(F, A1, A2) :- |
|---|
| 115 | Call =.. [F, A1, A2], |
|---|
| 116 | call(Call). |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | '$lgt_call'(F, A1, A2, A3) :- |
|---|
| 120 | Call =.. [F, A1, A2, A3], |
|---|
| 121 | call(Call). |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | '$lgt_call'(F, A1, A2, A3, A4) :- |
|---|
| 125 | Call =.. [F, A1, A2, A3, A4], |
|---|
| 126 | call(Call). |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | '$lgt_call'(F, A1, A2, A3, A4, A5) :- |
|---|
| 130 | Call =.. [F, A1, A2, A3, A4, A5], |
|---|
| 131 | call(Call). |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | '$lgt_call'(F, A1, A2, A3, A4, A5, A6) :- |
|---|
| 135 | Call =.. [F, A1, A2, A3, A4, A5, A6], |
|---|
| 136 | call(Call). |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | '$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :- |
|---|
| 140 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7], |
|---|
| 141 | call(Call). |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | % lgt_once/2-8 |
|---|
| 145 | % |
|---|
| 146 | % if your compiler provides call/1-8 as built-in |
|---|
| 147 | % predicates rewrite these definitions using call(...), !. |
|---|
| 148 | |
|---|
| 149 | '$lgt_once'(F, A) :- |
|---|
| 150 | Call =.. [F, A], |
|---|
| 151 | once(Call). |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | '$lgt_once'(F, A1, A2) :- |
|---|
| 155 | Call =.. [F, A1, A2], |
|---|
| 156 | once(Call). |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | '$lgt_once'(F, A1, A2, A3) :- |
|---|
| 160 | Call =.. [F, A1, A2, A3], |
|---|
| 161 | once(Call). |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | '$lgt_once'(F, A1, A2, A3, A4) :- |
|---|
| 165 | Call =.. [F, A1, A2, A3, A4], |
|---|
| 166 | once(Call). |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | '$lgt_once'(F, A1, A2, A3, A4, A5) :- |
|---|
| 170 | Call =.. [F, A1, A2, A3, A4, A5], |
|---|
| 171 | once(Call). |
|---|
| 172 | |
|---|
| 173 | |
|---|
| 174 | '$lgt_once'(F, A1, A2, A3, A4, A5, A6) :- |
|---|
| 175 | Call =.. [F, A1, A2, A3, A4, A5, A6], |
|---|
| 176 | once(Call). |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | '$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :- |
|---|
| 180 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7], |
|---|
| 181 | once(Call). |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 186 | % |
|---|
| 187 | % Prolog built-in metapredicates |
|---|
| 188 | % |
|---|
| 189 | % (excluding ISO Prolog Standard metapredicates) |
|---|
| 190 | % |
|---|
| 191 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | % '$lgt_pl_metapredicate'(?callable). |
|---|
| 195 | |
|---|
| 196 | '$lgt_pl_metapredicate'(b_findall(*, ::, *, *)). |
|---|
| 197 | '$lgt_pl_metapredicate'(bagOf(*, ::, *)). |
|---|
| 198 | '$lgt_pl_metapredicate'(setOf(*, ::, *)). |
|---|
| 199 | '$lgt_pl_metapredicate'(not(::)). |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 204 | % |
|---|
| 205 | % file extension predicate |
|---|
| 206 | % |
|---|
| 207 | % these extensions are used by Logtalk load/compile predicates |
|---|
| 208 | % |
|---|
| 209 | % you may want to change the extension for Prolog files to match |
|---|
| 210 | % the one expected by your Prolog compiler |
|---|
| 211 | % |
|---|
| 212 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | % '$lgt_file_extension'(?atom, ?atom) |
|---|
| 216 | |
|---|
| 217 | '$lgt_file_extension'(metafile, '.mlgt'). |
|---|
| 218 | '$lgt_file_extension'(logtalk, '.lgt'). |
|---|
| 219 | '$lgt_file_extension'(prolog, '.pro'). |
|---|
| 220 | '$lgt_file_extension'(xml, '.xml'). |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 225 | % |
|---|
| 226 | % default flag values |
|---|
| 227 | % |
|---|
| 228 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | % '$lgt_default_flag'(?atom, ?atom) |
|---|
| 232 | % |
|---|
| 233 | % default values for all flags |
|---|
| 234 | |
|---|
| 235 | '$lgt_default_flag'(iso_initialization_dir, false). |
|---|
| 236 | |
|---|
| 237 | '$lgt_default_flag'(xml, on). |
|---|
| 238 | '$lgt_default_flag'(xsl, 'lgtxml.xsl'). |
|---|
| 239 | '$lgt_default_flag'(xmlspec, dtd). |
|---|
| 240 | '$lgt_default_flag'(doctype, local). |
|---|
| 241 | |
|---|
| 242 | '$lgt_default_flag'(unknown, warning). |
|---|
| 243 | '$lgt_default_flag'(misspelt, warning). |
|---|
| 244 | '$lgt_default_flag'(singletons, warning). |
|---|
| 245 | '$lgt_default_flag'(lgtredef, warning). |
|---|
| 246 | '$lgt_default_flag'(plredef, silent). |
|---|
| 247 | '$lgt_default_flag'(portability, silent). |
|---|
| 248 | |
|---|
| 249 | '$lgt_default_flag'(report, on). |
|---|
| 250 | |
|---|
| 251 | '$lgt_default_flag'(smart_compilation, off). |
|---|
| 252 | |
|---|
| 253 | '$lgt_default_flag'(startup_message, flags). |
|---|
| 254 | |
|---|
| 255 | '$lgt_default_flag'(underscore_vars, singletons). |
|---|
| 256 | |
|---|
| 257 | '$lgt_default_flag'(code_prefix, ''). |
|---|
| 258 | |
|---|
| 259 | '$lgt_default_flag'(debug, off). |
|---|
| 260 | '$lgt_default_flag'(supports_break_predicate, false). |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 265 | % |
|---|
| 266 | % list predicates |
|---|
| 267 | % |
|---|
| 268 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | '$lgt_append'([], List, List). |
|---|
| 272 | '$lgt_append'([Head| Tail], List, [Head| Tail2]) :- |
|---|
| 273 | '$lgt_append'(Tail, List, Tail2). |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | '$lgt_member'(Head, [Head| _]). |
|---|
| 277 | '$lgt_member'(Head, [_| Tail]) :- |
|---|
| 278 | '$lgt_member'(Head, Tail). |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | '$lgt_member_var'(V, [H| _]) :- |
|---|
| 282 | V == H. |
|---|
| 283 | '$lgt_member_var'(V, [_| T]) :- |
|---|
| 284 | '$lgt_member_var'(V, T). |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | '$lgt_proper_list'([]). |
|---|
| 288 | '$lgt_proper_list'([_| List]) :- |
|---|
| 289 | '$lgt_proper_list'(List). |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | '$lgt_reverse'(List, Reversed) :- |
|---|
| 293 | '$lgt_reverse'(List, [], Reversed, Reversed). |
|---|
| 294 | |
|---|
| 295 | '$lgt_reverse'([], Reversed, Reversed, []). |
|---|
| 296 | '$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :- |
|---|
| 297 | '$lgt_reverse'(Tail, [Head| List], Reversed, Bound). |
|---|
| 298 | |
|---|
| 299 | |
|---|
| 300 | |
|---|
| 301 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 302 | % |
|---|
| 303 | % file predicates |
|---|
| 304 | % |
|---|
| 305 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | % '$lgt_file_exists'(+atom) |
|---|
| 309 | % |
|---|
| 310 | % see if a file exist in the current directory |
|---|
| 311 | |
|---|
| 312 | '$lgt_file_exists'(File) :- |
|---|
| 313 | exists_file(File). |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | % '$lgt_load_prolog_code'(+atom) |
|---|
| 317 | % |
|---|
| 318 | % compile and load a Prolog file |
|---|
| 319 | |
|---|
| 320 | '$lgt_load_prolog_code'(File) :- |
|---|
| 321 | reconsult(File). |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | % '$lgt_compare_file_mtimes'(?atom, +atom, +atom) |
|---|
| 325 | % |
|---|
| 326 | % compare file modification times |
|---|
| 327 | |
|---|
| 328 | '$lgt_compare_file_mtimes'(Result, File1, File2) :- |
|---|
| 329 | file_status(File1, Status1), once('$lgt_member'(mod_time=Time1, Status1)), |
|---|
| 330 | file_status(File2, Status2), once('$lgt_member'(mod_time=Time2, Status2)), |
|---|
| 331 | compare(Result, Time1, Time2). |
|---|
| 332 | |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 336 | % |
|---|
| 337 | % sorting predicates |
|---|
| 338 | % |
|---|
| 339 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | % '$lgt_keysort'(+list, -list) |
|---|
| 343 | |
|---|
| 344 | '$lgt_keysort'(List, Sorted) :- |
|---|
| 345 | keysort(List, Sorted). |
|---|
| 346 | |
|---|
| 347 | |
|---|
| 348 | % '$lgt_sort'( +List, -Sorted ) |
|---|
| 349 | |
|---|
| 350 | '$lgt_sort'(List, Sorted) :- |
|---|
| 351 | sort(List, Sorted). |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | |
|---|
| 355 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 356 | % |
|---|
| 357 | % time and date predicates |
|---|
| 358 | % |
|---|
| 359 | % if your Prolog compiler does not provide access to the operating system |
|---|
| 360 | % time and date just write dummy definitions |
|---|
| 361 | % |
|---|
| 362 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | % '$lgt_current_date'(?Year, ?Month, ?Day) |
|---|
| 366 | |
|---|
| 367 | '$lgt_current_date'(Year, Month, Day) :- |
|---|
| 368 | date(Year/Month/Day). |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | % '$lgt_current_time'(?Hours, ?Mins, ?Secs) |
|---|
| 372 | |
|---|
| 373 | '$lgt_current_time'(Hours, Mins, Secs) :- |
|---|
| 374 | time(Hours:Mins:Secs). |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | |
|---|
| 378 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 379 | % |
|---|
| 380 | % timing predicate |
|---|
| 381 | % |
|---|
| 382 | % if your Prolog compiler does not provide access to a timing predicate |
|---|
| 383 | % just write dummy definition |
|---|
| 384 | % |
|---|
| 385 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 386 | |
|---|
| 387 | |
|---|
| 388 | % '$lgt_cpu_time'(-Seconds) |
|---|
| 389 | |
|---|
| 390 | '$lgt_cpu_time'(Seconds) :- |
|---|
| 391 | Seconds is cputime. |
|---|
| 392 | |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 396 | % |
|---|
| 397 | % comparison predicate |
|---|
| 398 | % |
|---|
| 399 | % the usual compare/3 definition |
|---|
| 400 | % |
|---|
| 401 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | % compare(?atom, @term, @term) -- built-in |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 409 | % |
|---|
| 410 | % callable predicate |
|---|
| 411 | % |
|---|
| 412 | % the usual callable/1 definition |
|---|
| 413 | % |
|---|
| 414 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | % callable(@term) |
|---|
| 418 | |
|---|
| 419 | callable(Term) :- |
|---|
| 420 | once((atom(Term); compound(Term))). |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 425 | % |
|---|
| 426 | % read character predicate |
|---|
| 427 | % |
|---|
| 428 | % read a single character echoing it and writing a newline after |
|---|
| 429 | % |
|---|
| 430 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | '$lgt_read_single_char'(Char) :- |
|---|
| 434 | get_char(Char). |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 439 | % |
|---|
| 440 | % pretty print a term by naming its free variables |
|---|
| 441 | % (avoid instantiating variables in term by using double negation if necessary) |
|---|
| 442 | % |
|---|
| 443 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 444 | |
|---|
| 445 | |
|---|
| 446 | '$lgt_pretty_print_vars'(Stream, Term) :- |
|---|
| 447 | \+ \+ ( |
|---|
| 448 | numbervars(Term, 0, _), |
|---|
| 449 | write_term(Stream, Term, [numbervars(true)])). |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | '$lgt_pretty_print_vars_quoted'(Stream, Term) :- |
|---|
| 453 | \+ \+ ( |
|---|
| 454 | numbervars(Term, 0, _), |
|---|
| 455 | write_term(Stream, Term, [numbervars(true), quoted(true)])). |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 460 | % |
|---|
| 461 | % end! |
|---|
| 462 | % |
|---|
| 463 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|