kibi-swipl-linux-x64-gnu 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/bin/swipl +0 -0
- package/bin/swipl-win +0 -0
- package/build-manifest.json +70 -0
- package/lib/cmake/swipl/SWIPLConfig.cmake +21 -0
- package/lib/cmake/swipl/SWIPLConfigVersion.cmake +65 -0
- package/lib/cmake/swipl/SWIPLTargets-release.cmake +28 -0
- package/lib/cmake/swipl/SWIPLTargets.cmake +109 -0
- package/lib/swipl/ABI +1 -0
- package/lib/swipl/LICENSE +41 -0
- package/lib/swipl/README.md +116 -0
- package/lib/swipl/app/README.md +25 -0
- package/lib/swipl/app/app.pl +87 -0
- package/lib/swipl/app/pack.pl +350 -0
- package/lib/swipl/app/qlf.pl +521 -0
- package/lib/swipl/app/splfr.pl +177 -0
- package/lib/swipl/app/sys.pl +310 -0
- package/lib/swipl/bin/swipl.home +1 -0
- package/lib/swipl/boot/apply.pl +73 -0
- package/lib/swipl/boot/attvar.pl +344 -0
- package/lib/swipl/boot/autoload.pl +1226 -0
- package/lib/swipl/boot/bags.pl +283 -0
- package/lib/swipl/boot/dcg.pl +388 -0
- package/lib/swipl/boot/dicts.pl +193 -0
- package/lib/swipl/boot/dwim.pl +485 -0
- package/lib/swipl/boot/engines.pl +152 -0
- package/lib/swipl/boot/expand.pl +1628 -0
- package/lib/swipl/boot/gc.pl +65 -0
- package/lib/swipl/boot/history.pl +304 -0
- package/lib/swipl/boot/init.pl +4682 -0
- package/lib/swipl/boot/iri.pl +64 -0
- package/lib/swipl/boot/license.pl +390 -0
- package/lib/swipl/boot/load.pl +81 -0
- package/lib/swipl/boot/messages.pl +2521 -0
- package/lib/swipl/boot/packs.pl +306 -0
- package/lib/swipl/boot/predopts.pl +154 -0
- package/lib/swipl/boot/qlf.pl +141 -0
- package/lib/swipl/boot/rc.pl +263 -0
- package/lib/swipl/boot/syspred.pl +1634 -0
- package/lib/swipl/boot/tabling.pl +2321 -0
- package/lib/swipl/boot/threads.pl +42 -0
- package/lib/swipl/boot/toplevel.pl +2248 -0
- package/lib/swipl/boot/topvars.pl +261 -0
- package/lib/swipl/boot.prc +0 -0
- package/lib/swipl/cmake/swipl.cmake +131 -0
- package/lib/swipl/customize/README.md +23 -0
- package/lib/swipl/customize/edit +101 -0
- package/lib/swipl/customize/init.pl +164 -0
- package/lib/swipl/demo/README.md +33 -0
- package/lib/swipl/demo/likes.pl +44 -0
- package/lib/swipl/doc/packages/examples/chr/bool.chr +281 -0
- package/lib/swipl/doc/packages/examples/chr/chrdif.chr +87 -0
- package/lib/swipl/doc/packages/examples/chr/chrfreeze.chr +6 -0
- package/lib/swipl/doc/packages/examples/chr/family.chr +116 -0
- package/lib/swipl/doc/packages/examples/chr/fib.chr +24 -0
- package/lib/swipl/doc/packages/examples/chr/fibonacci.chr +31 -0
- package/lib/swipl/doc/packages/examples/chr/gcd.chr +28 -0
- package/lib/swipl/doc/packages/examples/chr/leq.chr +34 -0
- package/lib/swipl/doc/packages/examples/chr/listdom.chr +138 -0
- package/lib/swipl/doc/packages/examples/chr/primes.chr +29 -0
- package/lib/swipl/doc/packages/examples/http/README.md +98 -0
- package/lib/swipl/doc/packages/examples/http/calc.pl +92 -0
- package/lib/swipl/doc/packages/examples/http/demo_body.pl +232 -0
- package/lib/swipl/doc/packages/examples/http/demo_client.pl +165 -0
- package/lib/swipl/doc/packages/examples/http/demo_daemon.pl +38 -0
- package/lib/swipl/doc/packages/examples/http/demo_files.pl +50 -0
- package/lib/swipl/doc/packages/examples/http/demo_hello.pl +15 -0
- package/lib/swipl/doc/packages/examples/http/demo_login.pl +280 -0
- package/lib/swipl/doc/packages/examples/http/demo_openid.pl +177 -0
- package/lib/swipl/doc/packages/examples/http/demo_pwp.pl +20 -0
- package/lib/swipl/doc/packages/examples/http/demo_rest.pl +56 -0
- package/lib/swipl/doc/packages/examples/http/demo_threads.pl +52 -0
- package/lib/swipl/doc/packages/examples/http/linux-init-script +126 -0
- package/lib/swipl/doc/packages/examples/http/pwp/context.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/index.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp1.pwp +12 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp2.pwp +10 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp3.pwp +25 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp4.pwp +23 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp5.pwp +11 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp6.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp7.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwp8.pwp +3 -0
- package/lib/swipl/doc/packages/examples/http/pwp/pwpdb.pl +12 -0
- package/lib/swipl/doc/packages/examples/http/systemd-script.service +18 -0
- package/lib/swipl/doc/packages/examples/http/upstart-script.conf +20 -0
- package/lib/swipl/doc/packages/examples/plunit/read.pl +17 -0
- package/lib/swipl/doc/packages/examples/plunit/simple.pl +33 -0
- package/lib/swipl/doc/packages/examples/ssl/client.pl +83 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/README +52 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.p12 +0 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/client/client-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/cacert.pem +82 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/careq.pem +18 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/crlnumber +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt +3 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt.attr +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7C.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7D.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/private/cakey.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/serial +1 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-cert.pem +85 -0
- package/lib/swipl/doc/packages/examples/ssl/etc/server/server-key.pem +30 -0
- package/lib/swipl/doc/packages/examples/ssl/https.pl +267 -0
- package/lib/swipl/doc/packages/examples/ssl/server.pl +106 -0
- package/lib/swipl/include/SWI-Prolog.h +1544 -0
- package/lib/swipl/include/SWI-Stream.h +537 -0
- package/lib/swipl/include/Yap/YapInterface.h +283 -0
- package/lib/swipl/include/sicstus/sicstus.h +452 -0
- package/lib/swipl/lib/x86_64-linux/cgi.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypt.so +0 -0
- package/lib/swipl/lib/x86_64-linux/crypto4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/double_metaphone.so +0 -0
- package/lib/swipl/lib/x86_64-linux/files.so +0 -0
- package/lib/swipl/lib/x86_64-linux/hashstream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/http_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/isub.so +0 -0
- package/lib/swipl/lib/x86_64-linux/json.so +0 -0
- package/lib/swipl/lib/x86_64-linux/libswipl.so.10 +0 -0
- package/lib/swipl/lib/x86_64-linux/mallocinfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/md54pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/memfile.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ntriples.so +0 -0
- package/lib/swipl/lib/x86_64-linux/pcre4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/porter_stem.so +0 -0
- package/lib/swipl/lib/x86_64-linux/process.so +0 -0
- package/lib/swipl/lib/x86_64-linux/prolog_stream.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rdf_db.so +0 -0
- package/lib/swipl/lib/x86_64-linux/readutil.so +0 -0
- package/lib/swipl/lib/x86_64-linux/rlimit.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sched.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sgml2pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/sha4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/snowball.so +0 -0
- package/lib/swipl/lib/x86_64-linux/socket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/ssl4pl.so +0 -0
- package/lib/swipl/lib/x86_64-linux/streaminfo.so +0 -0
- package/lib/swipl/lib/x86_64-linux/syslog.so +0 -0
- package/lib/swipl/lib/x86_64-linux/time.so +0 -0
- package/lib/swipl/lib/x86_64-linux/turtle.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uid.so +0 -0
- package/lib/swipl/lib/x86_64-linux/unix.so +0 -0
- package/lib/swipl/lib/x86_64-linux/uri.so +0 -0
- package/lib/swipl/lib/x86_64-linux/websocket.so +0 -0
- package/lib/swipl/lib/x86_64-linux/zlib4pl.so +0 -0
- package/lib/swipl/library/INDEX.pl +1020 -0
- package/lib/swipl/library/aggregate.pl +755 -0
- package/lib/swipl/library/ansi_term.pl +653 -0
- package/lib/swipl/library/apply.pl +426 -0
- package/lib/swipl/library/apply_macros.pl +497 -0
- package/lib/swipl/library/arithmetic.pl +320 -0
- package/lib/swipl/library/assoc.pl +522 -0
- package/lib/swipl/library/atom.pl +169 -0
- package/lib/swipl/library/backcomp.pl +688 -0
- package/lib/swipl/library/base32.pl +291 -0
- package/lib/swipl/library/base64.pl +441 -0
- package/lib/swipl/library/broadcast.pl +161 -0
- package/lib/swipl/library/build/cmake.pl +137 -0
- package/lib/swipl/library/build/conan.pl +232 -0
- package/lib/swipl/library/build/make.pl +168 -0
- package/lib/swipl/library/build/tools.pl +825 -0
- package/lib/swipl/library/charsio.pl +195 -0
- package/lib/swipl/library/check.pl +1097 -0
- package/lib/swipl/library/check_installation.pl +912 -0
- package/lib/swipl/library/clp/INDEX.pl +157 -0
- package/lib/swipl/library/clp/bounds.pl +2036 -0
- package/lib/swipl/library/clp/clp_distinct.pl +263 -0
- package/lib/swipl/library/clp/clp_events.pl +92 -0
- package/lib/swipl/library/clp/clpb.pl +1896 -0
- package/lib/swipl/library/clp/clpfd.pl +7906 -0
- package/lib/swipl/library/clp/simplex.pl +1580 -0
- package/lib/swipl/library/codesio.pl +182 -0
- package/lib/swipl/library/coinduction.pl +183 -0
- package/lib/swipl/library/console_input.pl +289 -0
- package/lib/swipl/library/csv.pl +611 -0
- package/lib/swipl/library/ctypes.pl +161 -0
- package/lib/swipl/library/date.pl +370 -0
- package/lib/swipl/library/dcg/INDEX.pl +35 -0
- package/lib/swipl/library/dcg/basics.pl +514 -0
- package/lib/swipl/library/dcg/high_order.pl +227 -0
- package/lib/swipl/library/debug.pl +499 -0
- package/lib/swipl/library/dialect/bim.pl +186 -0
- package/lib/swipl/library/dialect/commons.pl +77 -0
- package/lib/swipl/library/dialect/eclipse/test_util_iso.pl +355 -0
- package/lib/swipl/library/dialect/hprolog/format.pl +44 -0
- package/lib/swipl/library/dialect/hprolog.pl +314 -0
- package/lib/swipl/library/dialect/ifprolog.pl +1317 -0
- package/lib/swipl/library/dialect/iso/iso_predicates.pl +277 -0
- package/lib/swipl/library/dialect/sicstus/README.TXT +1 -0
- package/lib/swipl/library/dialect/sicstus/arrays.pl +121 -0
- package/lib/swipl/library/dialect/sicstus/block.pl +278 -0
- package/lib/swipl/library/dialect/sicstus/lists.pl +167 -0
- package/lib/swipl/library/dialect/sicstus/ordsets.pl +52 -0
- package/lib/swipl/library/dialect/sicstus/sockets.pl +174 -0
- package/lib/swipl/library/dialect/sicstus/system.pl +262 -0
- package/lib/swipl/library/dialect/sicstus/terms.pl +57 -0
- package/lib/swipl/library/dialect/sicstus/timeout.pl +92 -0
- package/lib/swipl/library/dialect/sicstus.pl +582 -0
- package/lib/swipl/library/dialect/sicstus4/aggregate.pl +60 -0
- package/lib/swipl/library/dialect/sicstus4/between.pl +62 -0
- package/lib/swipl/library/dialect/sicstus4/clpfd.pl +75 -0
- package/lib/swipl/library/dialect/sicstus4/file_systems.pl +413 -0
- package/lib/swipl/library/dialect/sicstus4/lists.pl +274 -0
- package/lib/swipl/library/dialect/sicstus4/ordsets.pl +54 -0
- package/lib/swipl/library/dialect/sicstus4/samsort.pl +86 -0
- package/lib/swipl/library/dialect/sicstus4/sets.pl +124 -0
- package/lib/swipl/library/dialect/sicstus4/sockets.pl +164 -0
- package/lib/swipl/library/dialect/sicstus4/system.pl +80 -0
- package/lib/swipl/library/dialect/sicstus4/terms.pl +89 -0
- package/lib/swipl/library/dialect/sicstus4/timeout.pl +43 -0
- package/lib/swipl/library/dialect/sicstus4/types.pl +103 -0
- package/lib/swipl/library/dialect/sicstus4.pl +200 -0
- package/lib/swipl/library/dialect/swi/syspred_options.pl +250 -0
- package/lib/swipl/library/dialect/xsb/README.md +20 -0
- package/lib/swipl/library/dialect/xsb/basics.pl +318 -0
- package/lib/swipl/library/dialect/xsb/consult.pl +87 -0
- package/lib/swipl/library/dialect/xsb/curr_sym.pl +57 -0
- package/lib/swipl/library/dialect/xsb/error_handler.pl +111 -0
- package/lib/swipl/library/dialect/xsb/gensym.pl +53 -0
- package/lib/swipl/library/dialect/xsb/gpp.pl +138 -0
- package/lib/swipl/library/dialect/xsb/intern.pl +48 -0
- package/lib/swipl/library/dialect/xsb/lists.pl +47 -0
- package/lib/swipl/library/dialect/xsb/machine.pl +295 -0
- package/lib/swipl/library/dialect/xsb/ordsets.pl +53 -0
- package/lib/swipl/library/dialect/xsb/setof.pl +54 -0
- package/lib/swipl/library/dialect/xsb/source.pl +308 -0
- package/lib/swipl/library/dialect/xsb/standard.pl +169 -0
- package/lib/swipl/library/dialect/xsb/storage.pl +70 -0
- package/lib/swipl/library/dialect/xsb/string.pl +76 -0
- package/lib/swipl/library/dialect/xsb/thread.pl +62 -0
- package/lib/swipl/library/dialect/xsb/timed_call.pl +158 -0
- package/lib/swipl/library/dialect/xsb.pl +688 -0
- package/lib/swipl/library/dialect/yap/README.TXT +8 -0
- package/lib/swipl/library/dialect/yap.pl +283 -0
- package/lib/swipl/library/dialect.pl +123 -0
- package/lib/swipl/library/dicts.pl +399 -0
- package/lib/swipl/library/dif.pl +426 -0
- package/lib/swipl/library/edinburgh.pl +138 -0
- package/lib/swipl/library/edit.pl +783 -0
- package/lib/swipl/library/error.pl +495 -0
- package/lib/swipl/library/exceptions.pl +231 -0
- package/lib/swipl/library/explain.pl +543 -0
- package/lib/swipl/library/ext/RDF/INDEX.pl +25 -0
- package/lib/swipl/library/ext/RDF/rdf.pl +450 -0
- package/lib/swipl/library/ext/RDF/rdf_parser.pl +649 -0
- package/lib/swipl/library/ext/RDF/rdf_triple.pl +448 -0
- package/lib/swipl/library/ext/RDF/rdf_write.pl +701 -0
- package/lib/swipl/library/ext/RDF/rewrite_term.pl +177 -0
- package/lib/swipl/library/ext/chr/chr/a_star.pl +80 -0
- package/lib/swipl/library/ext/chr/chr/binomialheap.pl +142 -0
- package/lib/swipl/library/ext/chr/chr/builtins.pl +629 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_errors.pl +179 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_options.pl +382 -0
- package/lib/swipl/library/ext/chr/chr/chr_compiler_utility.pl +338 -0
- package/lib/swipl/library/ext/chr/chr/chr_debug.pl +59 -0
- package/lib/swipl/library/ext/chr/chr/chr_hashtable_store.pl +425 -0
- package/lib/swipl/library/ext/chr/chr/chr_integertable_store.pl +139 -0
- package/lib/swipl/library/ext/chr/chr/chr_messages.pl +176 -0
- package/lib/swipl/library/ext/chr/chr/chr_op.pl +53 -0
- package/lib/swipl/library/ext/chr/chr/chr_runtime.pl +1016 -0
- package/lib/swipl/library/ext/chr/chr/chr_translate.pl +25424 -0
- package/lib/swipl/library/ext/chr/chr/clean_code.pl +252 -0
- package/lib/swipl/library/ext/chr/chr/find.pl +78 -0
- package/lib/swipl/library/ext/chr/chr/guard_entailment.pl +19432 -0
- package/lib/swipl/library/ext/chr/chr/listmap.pl +108 -0
- package/lib/swipl/library/ext/chr/chr/pairlist.pl +78 -0
- package/lib/swipl/library/ext/chr/chr.pl +686 -0
- package/lib/swipl/library/ext/clib/INDEX.pl +158 -0
- package/lib/swipl/library/ext/clib/cgi.pl +86 -0
- package/lib/swipl/library/ext/clib/crypt.pl +44 -0
- package/lib/swipl/library/ext/clib/filesex.pl +644 -0
- package/lib/swipl/library/ext/clib/hash_stream.pl +119 -0
- package/lib/swipl/library/ext/clib/mallocinfo.pl +138 -0
- package/lib/swipl/library/ext/clib/md5.pl +68 -0
- package/lib/swipl/library/ext/clib/memfile.pl +61 -0
- package/lib/swipl/library/ext/clib/process.pl +573 -0
- package/lib/swipl/library/ext/clib/prolog_server.pl +157 -0
- package/lib/swipl/library/ext/clib/prolog_stream.pl +80 -0
- package/lib/swipl/library/ext/clib/rlimit.pl +54 -0
- package/lib/swipl/library/ext/clib/sched.pl +85 -0
- package/lib/swipl/library/ext/clib/sha.pl +162 -0
- package/lib/swipl/library/ext/clib/socket.pl +1102 -0
- package/lib/swipl/library/ext/clib/streaminfo.pl +103 -0
- package/lib/swipl/library/ext/clib/streampool.pl +136 -0
- package/lib/swipl/library/ext/clib/syslog.pl +180 -0
- package/lib/swipl/library/ext/clib/time.pl +194 -0
- package/lib/swipl/library/ext/clib/udp_broadcast.pl +975 -0
- package/lib/swipl/library/ext/clib/uid.pl +220 -0
- package/lib/swipl/library/ext/clib/unix.pl +317 -0
- package/lib/swipl/library/ext/clib/uri.pl +530 -0
- package/lib/swipl/library/ext/clib/uuid.pl +207 -0
- package/lib/swipl/library/ext/http/http/INDEX.pl +266 -0
- package/lib/swipl/library/ext/http/http/README.md +34 -0
- package/lib/swipl/library/ext/http/http/ax.pl +189 -0
- package/lib/swipl/library/ext/http/http/dcg_basics.pl +49 -0
- package/lib/swipl/library/ext/http/http/graphql.pl +1367 -0
- package/lib/swipl/library/ext/http/http/html_decl.pl +416 -0
- package/lib/swipl/library/ext/http/http/html_head.pl +654 -0
- package/lib/swipl/library/ext/http/http/html_quasiquotations.pl +120 -0
- package/lib/swipl/library/ext/http/http/html_write.pl +1425 -0
- package/lib/swipl/library/ext/http/http/htmx.pl +139 -0
- package/lib/swipl/library/ext/http/http/http_authenticate.pl +364 -0
- package/lib/swipl/library/ext/http/http/http_client.pl +412 -0
- package/lib/swipl/library/ext/http/http/http_cookie.pl +245 -0
- package/lib/swipl/library/ext/http/http/http_cors.pl +176 -0
- package/lib/swipl/library/ext/http/http/http_digest.pl +820 -0
- package/lib/swipl/library/ext/http/http/http_dirindex.pl +296 -0
- package/lib/swipl/library/ext/http/http/http_dispatch.pl +1552 -0
- package/lib/swipl/library/ext/http/http/http_dyn_workers.pl +214 -0
- package/lib/swipl/library/ext/http/http/http_error.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_exception.pl +225 -0
- package/lib/swipl/library/ext/http/http/http_files.pl +163 -0
- package/lib/swipl/library/ext/http/http/http_header.pl +2820 -0
- package/lib/swipl/library/ext/http/http/http_hook.pl +106 -0
- package/lib/swipl/library/ext/http/http/http_host.pl +204 -0
- package/lib/swipl/library/ext/http/http/http_load.pl +113 -0
- package/lib/swipl/library/ext/http/http/http_log.pl +738 -0
- package/lib/swipl/library/ext/http/http/http_multipart_plugin.pl +232 -0
- package/lib/swipl/library/ext/http/http/http_open.pl +1821 -0
- package/lib/swipl/library/ext/http/http/http_openid.pl +1561 -0
- package/lib/swipl/library/ext/http/http/http_parameters.pl +504 -0
- package/lib/swipl/library/ext/http/http/http_path.pl +380 -0
- package/lib/swipl/library/ext/http/http/http_proxy.pl +80 -0
- package/lib/swipl/library/ext/http/http/http_pwp.pl +351 -0
- package/lib/swipl/library/ext/http/http/http_redis_plugin.pl +332 -0
- package/lib/swipl/library/ext/http/http/http_server.pl +105 -0
- package/lib/swipl/library/ext/http/http/http_server_files.pl +126 -0
- package/lib/swipl/library/ext/http/http/http_server_health.pl +186 -0
- package/lib/swipl/library/ext/http/http/http_session.pl +1040 -0
- package/lib/swipl/library/ext/http/http/http_sgml_plugin.pl +137 -0
- package/lib/swipl/library/ext/http/http/http_stream.pl +376 -0
- package/lib/swipl/library/ext/http/http/http_unix_daemon.pl +989 -0
- package/lib/swipl/library/ext/http/http/http_wrapper.pl +559 -0
- package/lib/swipl/library/ext/http/http/hub.pl +600 -0
- package/lib/swipl/library/ext/http/http/js_write.pl +461 -0
- package/lib/swipl/library/ext/http/http/mimepack.pl +224 -0
- package/lib/swipl/library/ext/http/http/mimetype.pl +276 -0
- package/lib/swipl/library/ext/http/http/term_html.pl +797 -0
- package/lib/swipl/library/ext/http/http/thread_httpd.pl +1181 -0
- package/lib/swipl/library/ext/http/http/web/css/dirindex.css +24 -0
- package/lib/swipl/library/ext/http/http/web/css/openid.css +57 -0
- package/lib/swipl/library/ext/http/http/web/icons/back.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/c.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/compressed.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/folder.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/generic.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/layout.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-square.png +0 -0
- package/lib/swipl/library/ext/http/http/web/icons/openid-logo-tiny.png +0 -0
- package/lib/swipl/library/ext/http/http/websocket.pl +729 -0
- package/lib/swipl/library/ext/http/http/yadis.pl +205 -0
- package/lib/swipl/library/ext/json/INDEX.pl +36 -0
- package/lib/swipl/library/ext/json/http/INDEX.pl +16 -0
- package/lib/swipl/library/ext/json/http/http_json.pl +490 -0
- package/lib/swipl/library/ext/json/http/js_grammar.pl +53 -0
- package/lib/swipl/library/ext/json/http/json.pl +48 -0
- package/lib/swipl/library/ext/json/http/json_convert.pl +48 -0
- package/lib/swipl/library/ext/json/json.pl +1215 -0
- package/lib/swipl/library/ext/json/json_convert.pl +681 -0
- package/lib/swipl/library/ext/json/json_grammar.pl +349 -0
- package/lib/swipl/library/ext/json/json_rpc_client.pl +423 -0
- package/lib/swipl/library/ext/json/json_rpc_common.pl +104 -0
- package/lib/swipl/library/ext/json/json_rpc_server.pl +489 -0
- package/lib/swipl/library/ext/json/json_schema.pl +2111 -0
- package/lib/swipl/library/ext/nlp/INDEX.pl +15 -0
- package/lib/swipl/library/ext/nlp/double_metaphone.pl +86 -0
- package/lib/swipl/library/ext/nlp/isub.pl +162 -0
- package/lib/swipl/library/ext/nlp/porter_stem.pl +50 -0
- package/lib/swipl/library/ext/nlp/snowball.pl +97 -0
- package/lib/swipl/library/ext/pcre/INDEX.pl +17 -0
- package/lib/swipl/library/ext/pcre/pcre.pl +974 -0
- package/lib/swipl/library/ext/plunit/INDEX.pl +20 -0
- package/lib/swipl/library/ext/plunit/plunit.pl +2631 -0
- package/lib/swipl/library/ext/plunit/test_wizard.pl +249 -0
- package/lib/swipl/library/ext/semweb/semweb/INDEX.pl +288 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11.pl +2106 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf11_containers.pl +299 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_cache.pl +278 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_compare.pl +132 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_db.pl +3468 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_edit.pl +1145 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_http_plugin.pl +274 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_library.pl +1021 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_litindex.pl +1035 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_ntriples.pl +422 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_persistency.pl +1576 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_portray.pl +182 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_prefixes.pl +681 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_sandbox.pl +153 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle.pl +54 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_turtle_write.pl +1587 -0
- package/lib/swipl/library/ext/semweb/semweb/rdf_zlib_plugin.pl +52 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfa.pl +1510 -0
- package/lib/swipl/library/ext/semweb/semweb/rdfs.pl +475 -0
- package/lib/swipl/library/ext/semweb/semweb/sparql_client.pl +643 -0
- package/lib/swipl/library/ext/semweb/semweb/turtle.pl +455 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dcl +88 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.dtd +1092 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML4.soc +6 -0
- package/lib/swipl/library/ext/sgml/DTD/HTML5.dtd +906 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLlat1.ent +195 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLspec.ent +77 -0
- package/lib/swipl/library/ext/sgml/DTD/HTMLsym.ent +241 -0
- package/lib/swipl/library/ext/sgml/INDEX.pl +64 -0
- package/lib/swipl/library/ext/sgml/c14n2.pl +203 -0
- package/lib/swipl/library/ext/sgml/iso_639.pl +631 -0
- package/lib/swipl/library/ext/sgml/pwp.pl +705 -0
- package/lib/swipl/library/ext/sgml/sgml.pl +815 -0
- package/lib/swipl/library/ext/sgml/sgml_write.pl +1003 -0
- package/lib/swipl/library/ext/sgml/xpath.pl +620 -0
- package/lib/swipl/library/ext/sgml/xsdp_types.pl +232 -0
- package/lib/swipl/library/ext/ssl/INDEX.pl +60 -0
- package/lib/swipl/library/ext/ssl/crypto.pl +1015 -0
- package/lib/swipl/library/ext/ssl/http/INDEX.pl +5 -0
- package/lib/swipl/library/ext/ssl/http/http_ssl_plugin.pl +296 -0
- package/lib/swipl/library/ext/ssl/saml.pl +609 -0
- package/lib/swipl/library/ext/ssl/ssl.pl +647 -0
- package/lib/swipl/library/ext/ssl/xmldsig.pl +391 -0
- package/lib/swipl/library/ext/ssl/xmlenc.pl +354 -0
- package/lib/swipl/library/ext/zlib/INDEX.pl +8 -0
- package/lib/swipl/library/ext/zlib/zlib.pl +112 -0
- package/lib/swipl/library/fastrw.pl +105 -0
- package/lib/swipl/library/files.pl +80 -0
- package/lib/swipl/library/gensym.pl +111 -0
- package/lib/swipl/library/git.pl +1027 -0
- package/lib/swipl/library/hashtable.pl +365 -0
- package/lib/swipl/library/heaps.pl +252 -0
- package/lib/swipl/library/hotfix.pl +239 -0
- package/lib/swipl/library/http/jquery.pl +103 -0
- package/lib/swipl/library/http/web/js/jquery-3.6.0.min.js +2 -0
- package/lib/swipl/library/increval.pl +217 -0
- package/lib/swipl/library/intercept.pl +263 -0
- package/lib/swipl/library/iostream.pl +237 -0
- package/lib/swipl/library/iri_scheme/file.pl +70 -0
- package/lib/swipl/library/lazy_lists.pl +481 -0
- package/lib/swipl/library/listing.pl +1362 -0
- package/lib/swipl/library/lists.pl +860 -0
- package/lib/swipl/library/lynx/INDEX.pl +14 -0
- package/lib/swipl/library/lynx/format.pl +380 -0
- package/lib/swipl/library/lynx/html_style.pl +129 -0
- package/lib/swipl/library/lynx/html_text.pl +865 -0
- package/lib/swipl/library/lynx/pldoc_style.pl +87 -0
- package/lib/swipl/library/macros.pl +451 -0
- package/lib/swipl/library/main.pl +1200 -0
- package/lib/swipl/library/make.pl +197 -0
- package/lib/swipl/library/modules.pl +129 -0
- package/lib/swipl/library/nb_rbtrees.pl +267 -0
- package/lib/swipl/library/nb_set.pl +203 -0
- package/lib/swipl/library/obfuscate.pl +115 -0
- package/lib/swipl/library/occurs.pl +241 -0
- package/lib/swipl/library/operators.pl +182 -0
- package/lib/swipl/library/option.pl +388 -0
- package/lib/swipl/library/optparse.pl +966 -0
- package/lib/swipl/library/ordsets.pl +518 -0
- package/lib/swipl/library/oset.pl +160 -0
- package/lib/swipl/library/pairs.pl +187 -0
- package/lib/swipl/library/persistency.pl +713 -0
- package/lib/swipl/library/pio.pl +47 -0
- package/lib/swipl/library/portray_text.pl +277 -0
- package/lib/swipl/library/pprint.pl +940 -0
- package/lib/swipl/library/predicate_options.pl +975 -0
- package/lib/swipl/library/prolog_autoload.pl +233 -0
- package/lib/swipl/library/prolog_breakpoints.pl +396 -0
- package/lib/swipl/library/prolog_clause.pl +1104 -0
- package/lib/swipl/library/prolog_code.pl +416 -0
- package/lib/swipl/library/prolog_codewalk.pl +1248 -0
- package/lib/swipl/library/prolog_colour.pl +3301 -0
- package/lib/swipl/library/prolog_colour.qlf +0 -0
- package/lib/swipl/library/prolog_config.pl +154 -0
- package/lib/swipl/library/prolog_coverage.pl +1333 -0
- package/lib/swipl/library/prolog_debug.pl +404 -0
- package/lib/swipl/library/prolog_deps.pl +675 -0
- package/lib/swipl/library/prolog_evaluable.pl +234 -0
- package/lib/swipl/library/prolog_format.pl +219 -0
- package/lib/swipl/library/prolog_history.pl +161 -0
- package/lib/swipl/library/prolog_jiti.pl +333 -0
- package/lib/swipl/library/prolog_locale.pl +61 -0
- package/lib/swipl/library/prolog_metainference.pl +307 -0
- package/lib/swipl/library/prolog_pack.pl +3906 -0
- package/lib/swipl/library/prolog_profile.pl +346 -0
- package/lib/swipl/library/prolog_qlfmake.pl +533 -0
- package/lib/swipl/library/prolog_source.pl +1188 -0
- package/lib/swipl/library/prolog_stack.pl +794 -0
- package/lib/swipl/library/prolog_trace.pl +365 -0
- package/lib/swipl/library/prolog_versions.pl +347 -0
- package/lib/swipl/library/prolog_wrap.pl +164 -0
- package/lib/swipl/library/prolog_xref.pl +3090 -0
- package/lib/swipl/library/prolog_xref.qlf +0 -0
- package/lib/swipl/library/pure_input.pl +266 -0
- package/lib/swipl/library/qpforeign.pl +695 -0
- package/lib/swipl/library/qsave.pl +1516 -0
- package/lib/swipl/library/quasi_quotations.pl +300 -0
- package/lib/swipl/library/quintus.pl +437 -0
- package/lib/swipl/library/random.pl +459 -0
- package/lib/swipl/library/rbtrees.pl +1153 -0
- package/lib/swipl/library/readln.pl +256 -0
- package/lib/swipl/library/readutil.pl +304 -0
- package/lib/swipl/library/record.pl +544 -0
- package/lib/swipl/library/rwlocks.pl +172 -0
- package/lib/swipl/library/sandbox.pl +1384 -0
- package/lib/swipl/library/semweb/dc.rdfs +198 -0
- package/lib/swipl/library/semweb/eor.rdfs +95 -0
- package/lib/swipl/library/semweb/owl.owl +287 -0
- package/lib/swipl/library/semweb/rdf_library.ttl +90 -0
- package/lib/swipl/library/semweb/rdfs.rdfs +251 -0
- package/lib/swipl/library/settings.pl +755 -0
- package/lib/swipl/library/shell.pl +462 -0
- package/lib/swipl/library/shlib.pl +670 -0
- package/lib/swipl/library/solution_sequences.pl +439 -0
- package/lib/swipl/library/sort.pl +119 -0
- package/lib/swipl/library/statistics.pl +541 -0
- package/lib/swipl/library/streams.pl +118 -0
- package/lib/swipl/library/strings.pl +469 -0
- package/lib/swipl/library/system.pl +95 -0
- package/lib/swipl/library/tables.pl +381 -0
- package/lib/swipl/library/tableutil.pl +771 -0
- package/lib/swipl/library/tabling.pl +42 -0
- package/lib/swipl/library/terms.pl +457 -0
- package/lib/swipl/library/theme/auto.pl +61 -0
- package/lib/swipl/library/theme/dark.pl +455 -0
- package/lib/swipl/library/theme/light.pl +45 -0
- package/lib/swipl/library/thread.pl +810 -0
- package/lib/swipl/library/thread_pool.pl +508 -0
- package/lib/swipl/library/threadutil.pl +574 -0
- package/lib/swipl/library/tty.pl +316 -0
- package/lib/swipl/library/ugraphs.pl +644 -0
- package/lib/swipl/library/unicode/INDEX.pl +6 -0
- package/lib/swipl/library/unicode/blocks.pl +414 -0
- package/lib/swipl/library/url.pl +1129 -0
- package/lib/swipl/library/utf8.pl +145 -0
- package/lib/swipl/library/varnumbers.pl +221 -0
- package/lib/swipl/library/vm.pl +251 -0
- package/lib/swipl/library/wfs.pl +205 -0
- package/lib/swipl/library/when.pl +263 -0
- package/lib/swipl/library/writef.pl +278 -0
- package/lib/swipl/library/www_browser.pl +251 -0
- package/lib/swipl/library/yall.pl +574 -0
- package/lib/swipl/library/zip.pl +211 -0
- package/lib/swipl/swipl.home +1 -0
- package/lib/vendor/libcrypto.so.3 +0 -0
- package/lib/vendor/libpcre2-8.so.0 +0 -0
- package/lib/vendor/libssl.so.3 +0 -0
- package/lib/vendor/libz.so.1 +0 -0
- package/licenses/OpenSSL-LICENSE.txt +177 -0
- package/licenses/PCRE2-COPYING +5 -0
- package/licenses/README.md +12 -0
- package/licenses/SWI-Prolog-LICENSE +41 -0
- package/licenses/zlib-LICENSE +22 -0
- package/package.json +27 -0
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
/* Part of SWI-Prolog
|
|
2
|
+
|
|
3
|
+
Author: Jan Wielemaker
|
|
4
|
+
E-mail: J.Wielemaker@vu.nl
|
|
5
|
+
WWW: http://www.swi-prolog.org
|
|
6
|
+
Copyright (c) 1998-2025, University of Amsterdam
|
|
7
|
+
VU University Amsterdam
|
|
8
|
+
SWI-Prolog Solutions b.v.
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions
|
|
13
|
+
are met:
|
|
14
|
+
|
|
15
|
+
1. Redistributions of source code must retain the above copyright
|
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
|
17
|
+
|
|
18
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
19
|
+
notice, this list of conditions and the following disclaimer in
|
|
20
|
+
the documentation and/or other materials provided with the
|
|
21
|
+
distribution.
|
|
22
|
+
|
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
26
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
27
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
29
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
30
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
32
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
33
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
34
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
:- module(prolog_edit,
|
|
38
|
+
[ edit/1, % +Spec
|
|
39
|
+
edit/0
|
|
40
|
+
]).
|
|
41
|
+
:- autoload(library(lists), [member/2, append/3, select/3, append/2]).
|
|
42
|
+
:- autoload(library(make), [make/0]).
|
|
43
|
+
:- autoload(library(prolog_breakpoints), [breakpoint_property/2]).
|
|
44
|
+
:- autoload(library(apply), [foldl/5, maplist/3, maplist/2]).
|
|
45
|
+
:- use_module(library(dcg/high_order), [sequence/5]).
|
|
46
|
+
:- autoload(library(readutil), [read_line_to_string/2]).
|
|
47
|
+
:- autoload(library(dcg/basics), [string/3, integer/3, remainder/3]).
|
|
48
|
+
:- autoload(library(solution_sequences), [distinct/2]).
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
% :- set_prolog_flag(generate_debug_info, false).
|
|
52
|
+
|
|
53
|
+
/** <module> Editor interface
|
|
54
|
+
|
|
55
|
+
This module implements the generic editor interface. It consists of two
|
|
56
|
+
extensible parts with little in between. The first part deals with
|
|
57
|
+
translating the input into source-location, and the second with starting
|
|
58
|
+
an editor.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
:- multifile
|
|
62
|
+
locate/3, % +Partial, -FullSpec, -Location
|
|
63
|
+
locate/2, % +FullSpec, -Location
|
|
64
|
+
select_location/3, % +Pairs, +Spec, -Location
|
|
65
|
+
exists_location/1, % +Location
|
|
66
|
+
user_select/2, % +Max, -I
|
|
67
|
+
edit_source/1, % +Location
|
|
68
|
+
edit_command/2, % +Editor, -Command
|
|
69
|
+
load/0. % provides load-hooks
|
|
70
|
+
|
|
71
|
+
:- public
|
|
72
|
+
predicate_location/2. % :Pred, -Location
|
|
73
|
+
|
|
74
|
+
%! edit(+Spec)
|
|
75
|
+
%
|
|
76
|
+
% Edit indicated object.
|
|
77
|
+
|
|
78
|
+
edit(Spec) :-
|
|
79
|
+
notrace(edit_no_trace(Spec)).
|
|
80
|
+
|
|
81
|
+
edit_no_trace(Spec) :-
|
|
82
|
+
var(Spec),
|
|
83
|
+
!,
|
|
84
|
+
throw(error(instantiation_error, _)).
|
|
85
|
+
edit_no_trace(Spec) :-
|
|
86
|
+
load_extensions,
|
|
87
|
+
findall(Location-FullSpec,
|
|
88
|
+
locate(Spec, FullSpec, Location),
|
|
89
|
+
Pairs0),
|
|
90
|
+
sort(Pairs0, Pairs1),
|
|
91
|
+
merge_locations(Pairs1, Pairs),
|
|
92
|
+
do_select_location(Pairs, Spec, Location),
|
|
93
|
+
do_edit_source(Location).
|
|
94
|
+
|
|
95
|
+
%! edit
|
|
96
|
+
%
|
|
97
|
+
% Edit associated or script file. This is the Prolog file opened
|
|
98
|
+
% by double-clicking or the file loaded using
|
|
99
|
+
%
|
|
100
|
+
% ==
|
|
101
|
+
% % swipl [-s] file.pl
|
|
102
|
+
% ==
|
|
103
|
+
|
|
104
|
+
edit :-
|
|
105
|
+
current_prolog_flag(associated_file, File),
|
|
106
|
+
!,
|
|
107
|
+
edit(file(File)).
|
|
108
|
+
edit :-
|
|
109
|
+
'$cmd_option_val'(script_file, OsFiles),
|
|
110
|
+
OsFiles = [OsFile],
|
|
111
|
+
!,
|
|
112
|
+
prolog_to_os_filename(File, OsFile),
|
|
113
|
+
edit(file(File)).
|
|
114
|
+
edit :-
|
|
115
|
+
throw(error(context_error(edit, no_default_file), _)).
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/*******************************
|
|
119
|
+
* LOCATE *
|
|
120
|
+
*******************************/
|
|
121
|
+
|
|
122
|
+
%! locate(+Spec, -FullSpec, -Location:dict)
|
|
123
|
+
|
|
124
|
+
locate(FileSpec:Line, file(Path, line(Line)), #{file:Path, line:Line}) :-
|
|
125
|
+
integer(Line), Line >= 1,
|
|
126
|
+
ground(FileSpec), % so specific; do not try alts
|
|
127
|
+
!,
|
|
128
|
+
locate(FileSpec, _, #{file:Path}).
|
|
129
|
+
locate(FileSpec:Line:LinePos,
|
|
130
|
+
file(Path, line(Line), linepos(LinePos)),
|
|
131
|
+
#{file:Path, line:Line, linepos:LinePos}) :-
|
|
132
|
+
integer(Line), Line >= 1,
|
|
133
|
+
integer(LinePos), LinePos >= 1,
|
|
134
|
+
ground(FileSpec), % so specific; do not try alts
|
|
135
|
+
!,
|
|
136
|
+
locate(FileSpec, _, #{file:Path}).
|
|
137
|
+
locate(Path, file(Path), #{file:Path}) :-
|
|
138
|
+
atom(Path),
|
|
139
|
+
exists_file(Path).
|
|
140
|
+
locate(Pattern, file(Path), #{file:Path}) :-
|
|
141
|
+
atom(Pattern),
|
|
142
|
+
catch(expand_file_name(Pattern, Files), error(_,_), fail),
|
|
143
|
+
member(Path, Files),
|
|
144
|
+
exists_file(Path).
|
|
145
|
+
locate(FileBase, file(File), #{file:File}) :-
|
|
146
|
+
atom(FileBase),
|
|
147
|
+
find_source(FileBase, File).
|
|
148
|
+
locate(FileSpec, file(File), #{file:File}) :-
|
|
149
|
+
is_file_search_spec(FileSpec),
|
|
150
|
+
find_source(FileSpec, File).
|
|
151
|
+
locate(FileBase, source_file(Path), #{file:Path}) :-
|
|
152
|
+
atom(FileBase),
|
|
153
|
+
source_file(Path),
|
|
154
|
+
file_base_name(Path, File),
|
|
155
|
+
( File == FileBase
|
|
156
|
+
-> true
|
|
157
|
+
; file_name_extension(FileBase, _, File)
|
|
158
|
+
).
|
|
159
|
+
locate(FileBase, include_file(Path), #{file:Path}) :-
|
|
160
|
+
atom(FileBase),
|
|
161
|
+
setof(Path, include_file(Path), Paths),
|
|
162
|
+
member(Path, Paths),
|
|
163
|
+
file_base_name(Path, File),
|
|
164
|
+
( File == FileBase
|
|
165
|
+
-> true
|
|
166
|
+
; file_name_extension(FileBase, _, File)
|
|
167
|
+
).
|
|
168
|
+
locate(Name, FullSpec, Location) :-
|
|
169
|
+
atom(Name),
|
|
170
|
+
locate(Name/_, FullSpec, Location).
|
|
171
|
+
locate(Name/Arity, Module:Name/Arity, Location) :-
|
|
172
|
+
locate(Module:Name/Arity, Location).
|
|
173
|
+
locate(Name//DCGArity, FullSpec, Location) :-
|
|
174
|
+
( integer(DCGArity)
|
|
175
|
+
-> Arity is DCGArity+2,
|
|
176
|
+
locate(Name/Arity, FullSpec, Location)
|
|
177
|
+
; locate(Name/_, FullSpec, Location) % demand arity >= 2
|
|
178
|
+
).
|
|
179
|
+
locate(Name/Arity, library(File), #{file:PlPath}) :-
|
|
180
|
+
atom(Name),
|
|
181
|
+
'$in_library'(Name, Arity, Path),
|
|
182
|
+
( absolute_file_name(library(.), Dir,
|
|
183
|
+
[ file_type(directory),
|
|
184
|
+
solutions(all)
|
|
185
|
+
]),
|
|
186
|
+
atom_concat(Dir, File0, Path),
|
|
187
|
+
atom_concat(/, File, File0)
|
|
188
|
+
-> find_source(Path, PlPath)
|
|
189
|
+
; fail
|
|
190
|
+
).
|
|
191
|
+
locate(Module:Name, Module:Name/Arity, Location) :-
|
|
192
|
+
locate(Module:Name/Arity, Location).
|
|
193
|
+
locate(Module:Head, Module:Name/Arity, Location) :-
|
|
194
|
+
callable(Head),
|
|
195
|
+
\+ ( Head = (PName/_),
|
|
196
|
+
atom(PName)
|
|
197
|
+
),
|
|
198
|
+
functor(Head, Name, Arity),
|
|
199
|
+
locate(Module:Name/Arity, Location).
|
|
200
|
+
locate(Spec, module(Spec), Location) :-
|
|
201
|
+
locate(module(Spec), Location).
|
|
202
|
+
locate(Spec, Spec, Location) :-
|
|
203
|
+
locate(Spec, Location).
|
|
204
|
+
|
|
205
|
+
include_file(Path) :-
|
|
206
|
+
source_file_property(Path, included_in(_,_)).
|
|
207
|
+
|
|
208
|
+
%! is_file_search_spec(@Spec) is semidet.
|
|
209
|
+
%
|
|
210
|
+
% True if Spec is valid pattern for absolute_file_name/3.
|
|
211
|
+
|
|
212
|
+
is_file_search_spec(Spec) :-
|
|
213
|
+
compound(Spec),
|
|
214
|
+
compound_name_arguments(Spec, Alias, [Arg]),
|
|
215
|
+
is_file_spec(Arg),
|
|
216
|
+
user:file_search_path(Alias, _),
|
|
217
|
+
!.
|
|
218
|
+
|
|
219
|
+
is_file_spec(Name), atom(Name) => true.
|
|
220
|
+
is_file_spec(Name), string(Name) => true.
|
|
221
|
+
is_file_spec(Term), cyclic_term(Term) => fail.
|
|
222
|
+
is_file_spec(A/B) => is_file_spec(A), is_file_spec(B).
|
|
223
|
+
is_file_spec(_) => fail.
|
|
224
|
+
|
|
225
|
+
%! find_source(++FileSpec, =File) is semidet.
|
|
226
|
+
%
|
|
227
|
+
% Find a source file from FileSpec. If FileSpec resolves to a .qlf
|
|
228
|
+
% file, File is the embedded `.pl` file (which may not exist).
|
|
229
|
+
|
|
230
|
+
find_source(FileSpec, File) :-
|
|
231
|
+
catch(absolute_file_name(FileSpec, File0,
|
|
232
|
+
[ file_type(prolog),
|
|
233
|
+
access(read),
|
|
234
|
+
file_errors(fail)
|
|
235
|
+
]),
|
|
236
|
+
error(_,_), fail),
|
|
237
|
+
prolog_source(File0, File).
|
|
238
|
+
|
|
239
|
+
prolog_source(File0, File) :-
|
|
240
|
+
file_name_extension(_, Ext, File0),
|
|
241
|
+
user:prolog_file_type(Ext, qlf),
|
|
242
|
+
!,
|
|
243
|
+
'$qlf_module'(File0, Info),
|
|
244
|
+
File = Info.get(file).
|
|
245
|
+
prolog_source(File, File).
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
%! locate(+Spec, -Location)
|
|
249
|
+
%
|
|
250
|
+
% Locate object from the specified location.
|
|
251
|
+
|
|
252
|
+
locate(file(File, line(Line)), #{file:File, line:Line}).
|
|
253
|
+
locate(file(File), #{file:File}).
|
|
254
|
+
locate(Module:Name/Arity, Location) :-
|
|
255
|
+
( atom(Name), integer(Arity)
|
|
256
|
+
-> functor(Head, Name, Arity)
|
|
257
|
+
; Head = _ % leave unbound
|
|
258
|
+
),
|
|
259
|
+
( ( var(Module)
|
|
260
|
+
; var(Name)
|
|
261
|
+
)
|
|
262
|
+
-> NonImport = true
|
|
263
|
+
; NonImport = false
|
|
264
|
+
),
|
|
265
|
+
current_predicate(Name, Module:Head),
|
|
266
|
+
\+ ( NonImport == true,
|
|
267
|
+
Module \== system,
|
|
268
|
+
predicate_property(Module:Head, imported_from(_))
|
|
269
|
+
),
|
|
270
|
+
functor(Head, Name, Arity), % bind arity
|
|
271
|
+
predicate_location(Module:Head, Location).
|
|
272
|
+
locate(module(Module), Location) :-
|
|
273
|
+
atom(Module),
|
|
274
|
+
module_property(Module, file(Path)),
|
|
275
|
+
( module_property(Module, line_count(Line))
|
|
276
|
+
-> Location = #{file:Path, line:Line}
|
|
277
|
+
; Location = #{file:Path}
|
|
278
|
+
).
|
|
279
|
+
locate(breakpoint(Id), Location) :-
|
|
280
|
+
integer(Id),
|
|
281
|
+
breakpoint_property(Id, clause(Ref)),
|
|
282
|
+
( breakpoint_property(Id, file(File)),
|
|
283
|
+
breakpoint_property(Id, line_count(Line))
|
|
284
|
+
-> Location = #{file:File, line:Line}
|
|
285
|
+
; locate(clause(Ref), Location)
|
|
286
|
+
).
|
|
287
|
+
locate(clause(Ref), #{file:File, line:Line}) :-
|
|
288
|
+
clause_property(Ref, file(File)),
|
|
289
|
+
clause_property(Ref, line_count(Line)).
|
|
290
|
+
locate(clause(Ref, _PC), #{file:File, line:Line}) :- % TBD: use clause
|
|
291
|
+
clause_property(Ref, file(File)),
|
|
292
|
+
clause_property(Ref, line_count(Line)).
|
|
293
|
+
|
|
294
|
+
%! predicate_location(:Predicate, -Location) is nondet.
|
|
295
|
+
%
|
|
296
|
+
% Find the source location of a predicate.
|
|
297
|
+
%
|
|
298
|
+
% @arg Predicate is a qualified head. The module may be unbound at
|
|
299
|
+
% entry. It will be bound to the actual implementation module.
|
|
300
|
+
|
|
301
|
+
predicate_location(Pred, #{file:File, line:Line}) :-
|
|
302
|
+
copy_term(Pred, Pred2),
|
|
303
|
+
distinct(Primary, primary_predicate(Pred2, Primary)),
|
|
304
|
+
ignore(Pred = Primary),
|
|
305
|
+
( predicate_property(Primary, file(File)),
|
|
306
|
+
predicate_property(Primary, line_count(Line))
|
|
307
|
+
-> true
|
|
308
|
+
; '$foreign_predicate_source'(Primary, Source),
|
|
309
|
+
string_codes(Source, Codes),
|
|
310
|
+
phrase(addr2line_output(File, Line), Codes)
|
|
311
|
+
).
|
|
312
|
+
|
|
313
|
+
primary_predicate(Pred, Primary) :-
|
|
314
|
+
( predicate_property(Pred, imported_from(Source))
|
|
315
|
+
-> strip_module(Pred, _, Head),
|
|
316
|
+
Primary = Source:Head
|
|
317
|
+
; Primary = Pred
|
|
318
|
+
).
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
%! addr2line_output(-File, -Line)// is semidet.
|
|
322
|
+
%
|
|
323
|
+
% Process the output of the `addr2line` utility. This implementation
|
|
324
|
+
% works for Linux. Additional lines may be needed for other
|
|
325
|
+
% environments.
|
|
326
|
+
|
|
327
|
+
addr2line_output(File, Line) -->
|
|
328
|
+
string(_), " at ", string(FileCodes), ":", integer(Line),
|
|
329
|
+
!,
|
|
330
|
+
remainder(_),
|
|
331
|
+
{ atom_codes(File, FileCodes) }.
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
/*******************************
|
|
335
|
+
* EDIT *
|
|
336
|
+
*******************************/
|
|
337
|
+
|
|
338
|
+
%! do_edit_source(+Location)
|
|
339
|
+
%
|
|
340
|
+
% Actually call the editor to edit Location, a list of Name(Value)
|
|
341
|
+
% that contains file(File) and may contain line(Line). First the
|
|
342
|
+
% multifile hook edit_source/1 is called. If this fails the system
|
|
343
|
+
% checks for XPCE and the prolog-flag editor. If the latter is
|
|
344
|
+
% built_in or pce_emacs, it will start PceEmacs.
|
|
345
|
+
%
|
|
346
|
+
% Finally, it will get the editor to use from the prolog-flag
|
|
347
|
+
% editor and use edit_command/2 to determine how this editor
|
|
348
|
+
% should be called.
|
|
349
|
+
|
|
350
|
+
do_edit_source(Location) :- % hook
|
|
351
|
+
edit_source(Location),
|
|
352
|
+
!.
|
|
353
|
+
do_edit_source(Location) :- % PceEmacs
|
|
354
|
+
current_prolog_flag(editor, Editor),
|
|
355
|
+
is_pceemacs(Editor),
|
|
356
|
+
current_prolog_flag(gui, true),
|
|
357
|
+
!,
|
|
358
|
+
location_url(Location, URL), % File[:Line[:LinePos]]
|
|
359
|
+
run_pce_emacs(URL).
|
|
360
|
+
do_edit_source(Location) :- % External editor
|
|
361
|
+
external_edit_command(Location, Command),
|
|
362
|
+
print_message(informational, edit(waiting_for_editor)),
|
|
363
|
+
( catch(shell(Command), E,
|
|
364
|
+
(print_message(warning, E),
|
|
365
|
+
fail))
|
|
366
|
+
-> print_message(informational, edit(make)),
|
|
367
|
+
make
|
|
368
|
+
; print_message(informational, edit(canceled))
|
|
369
|
+
).
|
|
370
|
+
|
|
371
|
+
external_edit_command(Location, Command) :-
|
|
372
|
+
#{file:File, line:Line} :< Location,
|
|
373
|
+
editor(Editor),
|
|
374
|
+
file_base_name(Editor, EditorFile),
|
|
375
|
+
file_name_extension(Base, _, EditorFile),
|
|
376
|
+
edit_command(Base, Cmd),
|
|
377
|
+
prolog_to_os_filename(File, OsFile),
|
|
378
|
+
atom_codes(Cmd, S0),
|
|
379
|
+
substitute('%e', Editor, S0, S1),
|
|
380
|
+
substitute('%f', OsFile, S1, S2),
|
|
381
|
+
substitute('%d', Line, S2, S),
|
|
382
|
+
!,
|
|
383
|
+
atom_codes(Command, S).
|
|
384
|
+
external_edit_command(Location, Command) :-
|
|
385
|
+
#{file:File} :< Location,
|
|
386
|
+
editor(Editor),
|
|
387
|
+
file_base_name(Editor, EditorFile),
|
|
388
|
+
file_name_extension(Base, _, EditorFile),
|
|
389
|
+
edit_command(Base, Cmd),
|
|
390
|
+
prolog_to_os_filename(File, OsFile),
|
|
391
|
+
atom_codes(Cmd, S0),
|
|
392
|
+
substitute('%e', Editor, S0, S1),
|
|
393
|
+
substitute('%f', OsFile, S1, S),
|
|
394
|
+
\+ substitute('%d', 1, S, _),
|
|
395
|
+
!,
|
|
396
|
+
atom_codes(Command, S).
|
|
397
|
+
external_edit_command(Location, Command) :-
|
|
398
|
+
#{file:File} :< Location,
|
|
399
|
+
editor(Editor),
|
|
400
|
+
format(string(Command), '"~w" "~w"', [Editor, File]).
|
|
401
|
+
|
|
402
|
+
is_pceemacs(pce_emacs).
|
|
403
|
+
is_pceemacs(built_in).
|
|
404
|
+
|
|
405
|
+
%! run_pce_emacs(+URL) is semidet.
|
|
406
|
+
%
|
|
407
|
+
% Dynamically load and run emacs/1.
|
|
408
|
+
|
|
409
|
+
run_pce_emacs(URL) :-
|
|
410
|
+
autoload_call(in_pce_thread(autoload_call(emacs(URL)))).
|
|
411
|
+
|
|
412
|
+
%! editor(-Editor)
|
|
413
|
+
%
|
|
414
|
+
% Determine the external editor to run.
|
|
415
|
+
|
|
416
|
+
editor(Editor) :- % $EDITOR
|
|
417
|
+
current_prolog_flag(editor, Editor),
|
|
418
|
+
( sub_atom(Editor, 0, _, _, $)
|
|
419
|
+
-> sub_atom(Editor, 1, _, 0, Var),
|
|
420
|
+
catch(getenv(Var, Editor), _, fail), !
|
|
421
|
+
; Editor == default
|
|
422
|
+
-> catch(getenv('EDITOR', Editor), _, fail), !
|
|
423
|
+
; \+ is_pceemacs(Editor)
|
|
424
|
+
-> !
|
|
425
|
+
).
|
|
426
|
+
editor(Editor) :- % User defaults
|
|
427
|
+
getenv('EDITOR', Editor),
|
|
428
|
+
!.
|
|
429
|
+
editor(vi) :- % Platform defaults
|
|
430
|
+
current_prolog_flag(unix, true),
|
|
431
|
+
!.
|
|
432
|
+
editor(notepad) :-
|
|
433
|
+
current_prolog_flag(windows, true),
|
|
434
|
+
!.
|
|
435
|
+
editor(_) :- % No luck
|
|
436
|
+
throw(error(existence_error(editor), _)).
|
|
437
|
+
|
|
438
|
+
%! edit_command(+Editor, -Command)
|
|
439
|
+
%
|
|
440
|
+
% This predicate should specify the shell-command called to invoke
|
|
441
|
+
% the user's editor. The following substitutions will be made:
|
|
442
|
+
%
|
|
443
|
+
% | %e | Path name of the editor |
|
|
444
|
+
% | %f | Path name of the file to be edited |
|
|
445
|
+
% | %d | Line number of the target |
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
edit_command(vi, '%e +%d \'%f\'').
|
|
449
|
+
edit_command(vi, '%e \'%f\'').
|
|
450
|
+
edit_command(emacs, '%e +%d \'%f\'').
|
|
451
|
+
edit_command(emacs, '%e \'%f\'').
|
|
452
|
+
edit_command(notepad, '"%e" "%f"').
|
|
453
|
+
edit_command(wordpad, '"%e" "%f"').
|
|
454
|
+
edit_command(uedit32, '%e "%f/%d/0"'). % ultraedit (www.ultraedit.com)
|
|
455
|
+
edit_command(jedit, '%e -wait \'%f\' +line:%d').
|
|
456
|
+
edit_command(jedit, '%e -wait \'%f\'').
|
|
457
|
+
edit_command(edit, '%e %f:%d'). % PceEmacs client script
|
|
458
|
+
edit_command(edit, '%e %f').
|
|
459
|
+
|
|
460
|
+
edit_command(emacsclient, Command) :- edit_command(emacs, Command).
|
|
461
|
+
edit_command(vim, Command) :- edit_command(vi, Command).
|
|
462
|
+
edit_command(nvim, Command) :- edit_command(vi, Command).
|
|
463
|
+
|
|
464
|
+
substitute(FromAtom, ToAtom, Old, New) :-
|
|
465
|
+
atom_codes(FromAtom, From),
|
|
466
|
+
( atom(ToAtom)
|
|
467
|
+
-> atom_codes(ToAtom, To)
|
|
468
|
+
; number_codes(ToAtom, To)
|
|
469
|
+
),
|
|
470
|
+
append(Pre, S0, Old),
|
|
471
|
+
append(From, Post, S0) ->
|
|
472
|
+
append(Pre, To, S1),
|
|
473
|
+
append(S1, Post, New),
|
|
474
|
+
!.
|
|
475
|
+
substitute(_, _, Old, Old).
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
/*******************************
|
|
479
|
+
* SELECT *
|
|
480
|
+
*******************************/
|
|
481
|
+
|
|
482
|
+
merge_locations(Locations0, Locations) :-
|
|
483
|
+
append(Before, [L1|Rest], Locations0),
|
|
484
|
+
select(L2, Rest, Rest1),
|
|
485
|
+
merge_location(L1, L2, Loc),
|
|
486
|
+
!,
|
|
487
|
+
append([Before, [Loc], Rest1], Locations1),
|
|
488
|
+
merge_locations(Locations1, Locations).
|
|
489
|
+
merge_locations(Locations, Locations).
|
|
490
|
+
|
|
491
|
+
merge_location(Loc1-Spec1, Loc2-Spec2, Loc1-Spec1) :-
|
|
492
|
+
same_file_location(Loc1,Loc2),
|
|
493
|
+
better_spec(Spec1, Spec2).
|
|
494
|
+
merge_location(Loc1-Spec1, Loc2-Spec2, Loc-Spec) :-
|
|
495
|
+
same_location(Loc1, Loc2, Loc),
|
|
496
|
+
merge_specs(Spec1, Spec2, Spec).
|
|
497
|
+
|
|
498
|
+
same_file_location(L1, L2) :-
|
|
499
|
+
#{file:File} :< L1,
|
|
500
|
+
#{file:File} :< L2.
|
|
501
|
+
|
|
502
|
+
same_location(L, L, L).
|
|
503
|
+
same_location(#{file:F1}, #{file:F2}, #{file:F}) :-
|
|
504
|
+
best_same_file(F1, F2, F).
|
|
505
|
+
same_location(#{file:F1, line:Line}, #{file:F2}, #{file:F, line:Line}) :-
|
|
506
|
+
best_same_file(F1, F2, F).
|
|
507
|
+
same_location(#{file:F1}, #{file:F2, line:Line}, #{file:F, line:Line}) :-
|
|
508
|
+
best_same_file(F1, F2, F).
|
|
509
|
+
|
|
510
|
+
best_same_file(F1, F2, F) :-
|
|
511
|
+
catch(same_file(F1, F2), _, fail),
|
|
512
|
+
!,
|
|
513
|
+
atom_length(F1, L1),
|
|
514
|
+
atom_length(F2, L2),
|
|
515
|
+
( L1 < L2
|
|
516
|
+
-> F = F1
|
|
517
|
+
; F = F2
|
|
518
|
+
).
|
|
519
|
+
|
|
520
|
+
merge_specs(Spec, Spec, Spec) :-
|
|
521
|
+
!.
|
|
522
|
+
merge_specs(file(F1), file(F2), file(F)) :-
|
|
523
|
+
best_same_file(F1, F2, F),
|
|
524
|
+
!.
|
|
525
|
+
merge_specs(Spec1, Spec2, Spec) :-
|
|
526
|
+
merge_specs_(Spec1, Spec2, Spec),
|
|
527
|
+
!.
|
|
528
|
+
merge_specs(Spec1, Spec2, Spec) :-
|
|
529
|
+
merge_specs_(Spec2, Spec1, Spec),
|
|
530
|
+
!.
|
|
531
|
+
|
|
532
|
+
merge_specs_(FileSpec, Spec, Spec) :-
|
|
533
|
+
is_filespec(FileSpec).
|
|
534
|
+
|
|
535
|
+
is_filespec(file(_)) => true.
|
|
536
|
+
is_filespec(source_file(_)) => true.
|
|
537
|
+
is_filespec(Term),
|
|
538
|
+
compound(Term),
|
|
539
|
+
compound_name_arguments(Term, Alias, [_Arg]),
|
|
540
|
+
user:file_search_path(Alias, _) => true.
|
|
541
|
+
is_filespec(_) =>
|
|
542
|
+
fail.
|
|
543
|
+
|
|
544
|
+
better_spec(class(_), module(_)).
|
|
545
|
+
better_spec(_, FileSpec) :-
|
|
546
|
+
is_filespec(FileSpec).
|
|
547
|
+
|
|
548
|
+
%! select_location(+Pairs, +UserSpec, -Location) is semidet.
|
|
549
|
+
%
|
|
550
|
+
% @arg Pairs is a list of `Location-Spec` pairs
|
|
551
|
+
% @arg Location is a list of properties
|
|
552
|
+
|
|
553
|
+
do_select_location(Pairs, Spec, Location) :-
|
|
554
|
+
select_location(Pairs, Spec, Location), % HOOK
|
|
555
|
+
!,
|
|
556
|
+
Location \== [].
|
|
557
|
+
do_select_location([], Spec, _) :-
|
|
558
|
+
!,
|
|
559
|
+
print_message(warning, edit(not_found(Spec))),
|
|
560
|
+
fail.
|
|
561
|
+
do_select_location([#{file:File}-file(File)], _, Location) :-
|
|
562
|
+
!,
|
|
563
|
+
Location = #{file:File}.
|
|
564
|
+
do_select_location([Location-_Spec], _, Location) :-
|
|
565
|
+
existing_location(Location),
|
|
566
|
+
!.
|
|
567
|
+
do_select_location(Pairs, _, Location) :-
|
|
568
|
+
foldl(number_location, Pairs, NPairs, 1, End),
|
|
569
|
+
print_message(help, edit(select(NPairs))),
|
|
570
|
+
( End == 1
|
|
571
|
+
-> fail
|
|
572
|
+
; Max is End - 1,
|
|
573
|
+
user_selection(Max, I),
|
|
574
|
+
memberchk(I-(Location-_Spec), NPairs)
|
|
575
|
+
).
|
|
576
|
+
|
|
577
|
+
%! existing_location(+Location) is semidet.
|
|
578
|
+
%
|
|
579
|
+
% True when Location can be edited. By default that means that the
|
|
580
|
+
% file exists. This facility is hooked to allow for alternative ways
|
|
581
|
+
% to reach the source, e.g., by lazily downloading it.
|
|
582
|
+
|
|
583
|
+
existing_location(Location) :-
|
|
584
|
+
exists_location(Location),
|
|
585
|
+
!.
|
|
586
|
+
existing_location(Location) :-
|
|
587
|
+
#{file:File} :< Location,
|
|
588
|
+
access_file(File, read).
|
|
589
|
+
|
|
590
|
+
number_location(Pair, N-Pair, N, N1) :-
|
|
591
|
+
Pair = Location-_Spec,
|
|
592
|
+
existing_location(Location),
|
|
593
|
+
!,
|
|
594
|
+
N1 is N+1.
|
|
595
|
+
number_location(Pair, 0-Pair, N, N).
|
|
596
|
+
|
|
597
|
+
user_selection(Max, I) :-
|
|
598
|
+
user_select(Max, I),
|
|
599
|
+
!.
|
|
600
|
+
user_selection(Max, I) :-
|
|
601
|
+
print_message(help, edit(choose(Max))),
|
|
602
|
+
read_number(Max, I).
|
|
603
|
+
|
|
604
|
+
%! read_number(+Max, -X) is semidet.
|
|
605
|
+
%
|
|
606
|
+
% Read a number between 1 and Max. If Max < 10, use get_single_char/1.
|
|
607
|
+
|
|
608
|
+
read_number(Max, X) :-
|
|
609
|
+
Max < 10,
|
|
610
|
+
!,
|
|
611
|
+
get_single_char(C),
|
|
612
|
+
put_code(user_error, C),
|
|
613
|
+
between(0'0, 0'9, C),
|
|
614
|
+
X is C - 0'0.
|
|
615
|
+
read_number(_, X) :-
|
|
616
|
+
read_line_to_string(user_input, String),
|
|
617
|
+
number_string(X, String).
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
/*******************************
|
|
621
|
+
* MESSAGES *
|
|
622
|
+
*******************************/
|
|
623
|
+
|
|
624
|
+
:- multifile
|
|
625
|
+
prolog:message/3.
|
|
626
|
+
|
|
627
|
+
prolog:message(edit(Msg)) -->
|
|
628
|
+
message(Msg).
|
|
629
|
+
|
|
630
|
+
message(not_found(Spec)) -->
|
|
631
|
+
[ 'Cannot find anything to edit from "~p"'-[Spec] ],
|
|
632
|
+
( { atom(Spec) }
|
|
633
|
+
-> [ nl, ' Use edit(file(~q)) to create a new file'-[Spec] ]
|
|
634
|
+
; []
|
|
635
|
+
).
|
|
636
|
+
message(select(NPairs)) -->
|
|
637
|
+
{ \+ (member(N-_, NPairs), N > 0) },
|
|
638
|
+
!,
|
|
639
|
+
[ 'Found the following locations:', nl ],
|
|
640
|
+
sequence(target, [nl], NPairs).
|
|
641
|
+
message(select(NPairs)) -->
|
|
642
|
+
[ 'Please select item to edit:', nl ],
|
|
643
|
+
sequence(target, [nl], NPairs).
|
|
644
|
+
message(choose(_Max)) -->
|
|
645
|
+
[ nl, 'Your choice? ', flush ].
|
|
646
|
+
message(waiting_for_editor) -->
|
|
647
|
+
[ 'Waiting for editor ... ', flush ].
|
|
648
|
+
message(make) -->
|
|
649
|
+
[ 'Running make to reload modified files' ].
|
|
650
|
+
message(canceled) -->
|
|
651
|
+
[ 'Editor returned failure; skipped make/0 to reload files' ].
|
|
652
|
+
|
|
653
|
+
target(0-(Location-Spec)) ==>
|
|
654
|
+
[ ansi(warning, '~t*~3| ', [])],
|
|
655
|
+
edit_specifier(Spec),
|
|
656
|
+
[ '~t~32|' ],
|
|
657
|
+
edit_location(Location, false),
|
|
658
|
+
[ ansi(warning, ' (no source available)', [])].
|
|
659
|
+
target(N-(Location-Spec)) ==>
|
|
660
|
+
[ ansi(bold, '~t~d~3| ', [N])],
|
|
661
|
+
edit_specifier(Spec),
|
|
662
|
+
[ '~t~32|' ],
|
|
663
|
+
edit_location(Location, true).
|
|
664
|
+
|
|
665
|
+
edit_specifier(Module:Name/Arity) ==>
|
|
666
|
+
[ '~w:'-[Module],
|
|
667
|
+
ansi(code, '~w/~w', [Name, Arity]) ].
|
|
668
|
+
edit_specifier(file(_Path)) ==>
|
|
669
|
+
[ '<file>' ].
|
|
670
|
+
edit_specifier(source_file(_Path)) ==>
|
|
671
|
+
[ '<loaded file>' ].
|
|
672
|
+
edit_specifier(include_file(_Path)) ==>
|
|
673
|
+
[ '<included file>' ].
|
|
674
|
+
edit_specifier(Term) ==>
|
|
675
|
+
[ '~p'-[Term] ].
|
|
676
|
+
|
|
677
|
+
edit_location(Location, false) ==>
|
|
678
|
+
{ location_label(Location, Label) },
|
|
679
|
+
[ ansi(warning, '~s', [Label]) ].
|
|
680
|
+
edit_location(Location, true) ==>
|
|
681
|
+
{ location_label(Location, Label),
|
|
682
|
+
location_url(Location, URL)
|
|
683
|
+
},
|
|
684
|
+
[ url(URL, Label) ].
|
|
685
|
+
|
|
686
|
+
location_label(Location, Label) :-
|
|
687
|
+
#{file:File, line:Line} :< Location,
|
|
688
|
+
!,
|
|
689
|
+
short_filename(File, ShortFile),
|
|
690
|
+
format(string(Label), '~w:~d', [ShortFile, Line]).
|
|
691
|
+
location_label(Location, Label) :-
|
|
692
|
+
#{file:File} :< Location,
|
|
693
|
+
!,
|
|
694
|
+
short_filename(File, ShortFile),
|
|
695
|
+
format(string(Label), '~w', [ShortFile]).
|
|
696
|
+
|
|
697
|
+
location_url(Location, File:Line:LinePos) :-
|
|
698
|
+
#{file:File, line:Line, linepos:LinePos} :< Location,
|
|
699
|
+
!.
|
|
700
|
+
location_url(Location, File:Line) :-
|
|
701
|
+
#{file:File, line:Line} :< Location,
|
|
702
|
+
!.
|
|
703
|
+
location_url(Location, File) :-
|
|
704
|
+
#{file:File} :< Location.
|
|
705
|
+
|
|
706
|
+
%! short_filename(+Path, -Spec) is det.
|
|
707
|
+
%
|
|
708
|
+
% Spec is a way to refer to the file Path that is shorter. The path is
|
|
709
|
+
% shortened by either taking it relative to the current working
|
|
710
|
+
% directory or use one of the Prolog path aliases.
|
|
711
|
+
|
|
712
|
+
short_filename(Path, Spec) :-
|
|
713
|
+
working_directory(Here, Here),
|
|
714
|
+
atom_concat(Here, Local0, Path),
|
|
715
|
+
!,
|
|
716
|
+
remove_leading_slash(Local0, Spec).
|
|
717
|
+
short_filename(Path, Spec) :-
|
|
718
|
+
findall(LenAlias, aliased_path(Path, LenAlias), Keyed),
|
|
719
|
+
keysort(Keyed, [_-Spec|_]).
|
|
720
|
+
short_filename(Path, Path).
|
|
721
|
+
|
|
722
|
+
aliased_path(Path, Len-Spec) :-
|
|
723
|
+
setof(Alias, file_alias_path(Alias), Aliases),
|
|
724
|
+
member(Alias, Aliases),
|
|
725
|
+
Alias \== autoload, % confusing and covered by something else
|
|
726
|
+
Term =.. [Alias, '.'],
|
|
727
|
+
absolute_file_name(Term, Prefix,
|
|
728
|
+
[ file_type(directory),
|
|
729
|
+
file_errors(fail),
|
|
730
|
+
solutions(all)
|
|
731
|
+
]),
|
|
732
|
+
atom_concat(Prefix, Local0, Path),
|
|
733
|
+
remove_leading_slash(Local0, Local1),
|
|
734
|
+
remove_extension(Local1, Local2),
|
|
735
|
+
unquote_segments(Local2, Local),
|
|
736
|
+
atom_length(Local2, Len),
|
|
737
|
+
Spec =.. [Alias, Local].
|
|
738
|
+
|
|
739
|
+
file_alias_path(Alias) :-
|
|
740
|
+
user:file_search_path(Alias, _).
|
|
741
|
+
|
|
742
|
+
remove_leading_slash(Path, Local) :-
|
|
743
|
+
atom_concat(/, Local, Path),
|
|
744
|
+
!.
|
|
745
|
+
remove_leading_slash(Path, Path).
|
|
746
|
+
|
|
747
|
+
remove_extension(File0, File) :-
|
|
748
|
+
file_name_extension(File, Ext, File0),
|
|
749
|
+
user:prolog_file_type(Ext, source),
|
|
750
|
+
!.
|
|
751
|
+
remove_extension(File, File).
|
|
752
|
+
|
|
753
|
+
unquote_segments(File, Segments) :-
|
|
754
|
+
split_string(File, "/", "/", SegmentStrings),
|
|
755
|
+
maplist(atom_string, SegmentList, SegmentStrings),
|
|
756
|
+
maplist(no_quote_needed, SegmentList),
|
|
757
|
+
!,
|
|
758
|
+
segments(SegmentList, Segments).
|
|
759
|
+
unquote_segments(File, File).
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
no_quote_needed(A) :-
|
|
763
|
+
format(atom(Q), '~q', [A]),
|
|
764
|
+
Q == A.
|
|
765
|
+
|
|
766
|
+
segments([Segment], Segment) :-
|
|
767
|
+
!.
|
|
768
|
+
segments(List, A/Segment) :-
|
|
769
|
+
append(L1, [Segment], List),
|
|
770
|
+
!,
|
|
771
|
+
segments(L1, A).
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
/*******************************
|
|
775
|
+
* LOAD EXTENSIONS *
|
|
776
|
+
*******************************/
|
|
777
|
+
|
|
778
|
+
load_extensions :-
|
|
779
|
+
load,
|
|
780
|
+
fail.
|
|
781
|
+
load_extensions.
|
|
782
|
+
|
|
783
|
+
:- load_extensions.
|