| 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 2 | % |
|---|
| 3 | % Logtalk - Object oriented extension to Prolog |
|---|
| 4 | % Release 2.9.0 |
|---|
| 5 | % |
|---|
| 6 | % configuration file for <your Prolog compiler name here> |
|---|
| 7 | % |
|---|
| 8 | % last updated: <date of latest update> |
|---|
| 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 | % lgt_iso_predicate(?callable). |
|---|
| 28 | |
|---|
| 29 | lgt_iso_predicate(_) :- % remove this clause if you need |
|---|
| 30 | fail. % to define any ISO predicate |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 35 | % |
|---|
| 36 | % predicate properties |
|---|
| 37 | % |
|---|
| 38 | % this predicate must return at least static, dynamic and built_in |
|---|
| 39 | % properties for an existing predicate |
|---|
| 40 | % |
|---|
| 41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | % lgt_predicate_property(+callable, ?predicate_property) |
|---|
| 45 | |
|---|
| 46 | lgt_predicate_property(Pred, Prop) :- |
|---|
| 47 | ????? |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 52 | % |
|---|
| 53 | % metapredicates |
|---|
| 54 | % |
|---|
| 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | % forall(+callable, +callble) |
|---|
| 59 | |
|---|
| 60 | forall(Generate, Test) :- |
|---|
| 61 | \+ call((Generate, \+ call(Test))). |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | % retractall(+callable) |
|---|
| 65 | |
|---|
| 66 | retractall(Head) :- |
|---|
| 67 | ????? |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | % lgt_call/2-8 |
|---|
| 71 | % |
|---|
| 72 | % if your compiler provides call/1-8 as built-in |
|---|
| 73 | % predicates rewrite these definitions using call(...). |
|---|
| 74 | |
|---|
| 75 | lgt_call(F, A) :- |
|---|
| 76 | Call =.. [F, A], |
|---|
| 77 | call(Call). |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | lgt_call(F, A1, A2) :- |
|---|
| 81 | Call =.. [F, A1, A2], |
|---|
| 82 | call(Call). |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | lgt_call(F, A1, A2, A3) :- |
|---|
| 86 | Call =.. [F, A1, A2, A3], |
|---|
| 87 | call(Call). |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | lgt_call(F, A1, A2, A3, A4) :- |
|---|
| 91 | Call =.. [F, A1, A2, A3, A4], |
|---|
| 92 | call(Call). |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | lgt_call(F, A1, A2, A3, A4, A5) :- |
|---|
| 96 | Call =.. [F, A1, A2, A3, A4, A5], |
|---|
| 97 | call(Call). |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | lgt_call(F, A1, A2, A3, A4, A5, A6) :- |
|---|
| 101 | Call =.. [F, A1, A2, A3, A4, A5, A6], |
|---|
| 102 | call(Call). |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :- |
|---|
| 106 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7], |
|---|
| 107 | call(Call). |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | % lgt_once/2-8 |
|---|
| 111 | % |
|---|
| 112 | % if your compiler provides call/1-8 as built-in |
|---|
| 113 | % predicates rewrite these definitions using call(...), !. |
|---|
| 114 | |
|---|
| 115 | lgt_once(F, A) :- |
|---|
| 116 | Call =.. [F, A], |
|---|
| 117 | once(Call). |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | lgt_once(F, A1, A2) :- |
|---|
| 121 | Call =.. [F, A1, A2], |
|---|
| 122 | once(Call). |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | lgt_once(F, A1, A2, A3) :- |
|---|
| 126 | Call =.. [F, A1, A2, A3], |
|---|
| 127 | once(Call). |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | lgt_once(F, A1, A2, A3, A4) :- |
|---|
| 131 | Call =.. [F, A1, A2, A3, A4], |
|---|
| 132 | once(Call). |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | lgt_once(F, A1, A2, A3, A4, A5) :- |
|---|
| 136 | Call =.. [F, A1, A2, A3, A4, A5], |
|---|
| 137 | once(Call). |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | lgt_once(F, A1, A2, A3, A4, A5, A6) :- |
|---|
| 141 | Call =.. [F, A1, A2, A3, A4, A5, A6], |
|---|
| 142 | once(Call). |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :- |
|---|
| 146 | Call =.. [F, A1, A2, A3, A4, A5, A6, A7], |
|---|
| 147 | once(Call). |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 152 | % |
|---|
| 153 | % file extension predicates |
|---|
| 154 | % |
|---|
| 155 | % these extensions are used by Logtalk load/compile predicates |
|---|
| 156 | % |
|---|
| 157 | % you may want to change the extension for Prolog files to match |
|---|
| 158 | % the one expected by your Prolog compiler |
|---|
| 159 | % |
|---|
| 160 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | % lgt_file_extension(?atom, ?atom) |
|---|
| 164 | |
|---|
| 165 | lgt_file_extension(logtalk, '.lgt'). |
|---|
| 166 | lgt_file_extension(prolog, '.pl'). |
|---|
| 167 | lgt_file_extension(xml, '.xml'). |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 172 | % |
|---|
| 173 | % default compiler options |
|---|
| 174 | % |
|---|
| 175 | % if your Prolog compiler supports the ISO definition of the |
|---|
| 176 | % initialization/1 then change the default value below to true |
|---|
| 177 | % |
|---|
| 178 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | % lgt_default_compiler_option(?atom, ?atom) |
|---|
| 182 | % |
|---|
| 183 | % default values for all compiler options |
|---|
| 184 | |
|---|
| 185 | lgt_default_compiler_option(iso_initialization_dir, false). |
|---|
| 186 | |
|---|
| 187 | lgt_default_compiler_option(xml, on). |
|---|
| 188 | lgt_default_compiler_option(xsl, 'lgtxml.xsl'). |
|---|
| 189 | |
|---|
| 190 | lgt_default_compiler_option(unknown, warning). |
|---|
| 191 | lgt_default_compiler_option(misspelt, warning). |
|---|
| 192 | lgt_default_compiler_option(singletons, warning). |
|---|
| 193 | lgt_default_compiler_option(lgtredef, warning). |
|---|
| 194 | lgt_default_compiler_option(plredef, silent). |
|---|
| 195 | |
|---|
| 196 | lgt_default_compiler_option(report, on). |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 201 | % |
|---|
| 202 | % list predicates |
|---|
| 203 | % |
|---|
| 204 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | lgt_append([], List, List). |
|---|
| 208 | lgt_append([Head| Tail], List, [Head| Tail2]) :- |
|---|
| 209 | lgt_append(Tail, List, Tail2). |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | lgt_member(Head, [Head| _]). |
|---|
| 213 | lgt_member(Head, [_| Tail]) :- |
|---|
| 214 | lgt_member(Head, Tail). |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | lgt_member_var(V, [H| _]) :- |
|---|
| 218 | V == H. |
|---|
| 219 | lgt_member_var(V, [_| T]) :- |
|---|
| 220 | lgt_member_var(V, T). |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | lgt_proper_list([]). |
|---|
| 224 | lgt_proper_list([_| List]) :- |
|---|
| 225 | lgt_proper_list(List). |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 230 | % |
|---|
| 231 | % file predicates |
|---|
| 232 | % |
|---|
| 233 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | % lgt_file_exists(+atom) |
|---|
| 237 | % |
|---|
| 238 | % see if a file exist in the current directory |
|---|
| 239 | |
|---|
| 240 | lgt_file_exists(File) :- |
|---|
| 241 | ????? |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | % lgt_load_prolog_code(+atom) |
|---|
| 245 | % |
|---|
| 246 | % compile and load a Prolog file |
|---|
| 247 | |
|---|
| 248 | lgt_load_prolog_code(File) :- |
|---|
| 249 | ????? |
|---|
| 250 | |
|---|
| 251 | |
|---|
| 252 | |
|---|
| 253 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 254 | % |
|---|
| 255 | % sorting predicates |
|---|
| 256 | % |
|---|
| 257 | % note that sort/2 and keysort/2 are buitl-in predicates in most Prolog |
|---|
| 258 | % compilers |
|---|
| 259 | % |
|---|
| 260 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | % lgt_keysort(+list, -list) |
|---|
| 264 | |
|---|
| 265 | lgt_keysort(List, Sorted) :- |
|---|
| 266 | ????? |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | % lgt_sort(+list, -list) |
|---|
| 270 | |
|---|
| 271 | lgt_sort(List, Sorted) :- |
|---|
| 272 | ????? |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 277 | % |
|---|
| 278 | % time and date predicates |
|---|
| 279 | % |
|---|
| 280 | % if your Prolog compiler does not provide access to the operating system |
|---|
| 281 | % time and date just write dummy definitions |
|---|
| 282 | % |
|---|
| 283 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | % lgt_current_date(?Year, ?Month, ?Day) |
|---|
| 287 | |
|---|
| 288 | lgt_current_date(Year, Month, Day) :- |
|---|
| 289 | ????? |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | % lgt_current_time(?Hours, ?Mins, ?Secs) |
|---|
| 293 | |
|---|
| 294 | lgt_current_time(Hours, Mins, Secs) :- |
|---|
| 295 | ????? |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 300 | % |
|---|
| 301 | % timing predicate |
|---|
| 302 | % |
|---|
| 303 | % if your Prolog compiler does not provide access to a timing predicate |
|---|
| 304 | % just write dummy definition |
|---|
| 305 | % |
|---|
| 306 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | % lgt_cpu_time(-Seconds) |
|---|
| 310 | |
|---|
| 311 | lgt_cpu_time(Seconds) :- |
|---|
| 312 | ????? |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 317 | % |
|---|
| 318 | % comparison predicate |
|---|
| 319 | % |
|---|
| 320 | % the usual compare/3 definition |
|---|
| 321 | % |
|---|
| 322 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | % compare(?atom, @term, @term) |
|---|
| 326 | |
|---|
| 327 | compare(Order, Term1, Term2) :- |
|---|
| 328 | ????? |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 333 | % |
|---|
| 334 | % end! |
|---|
| 335 | % |
|---|
| 336 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|