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,653 @@
|
|
|
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) 2010-2025, VU University Amsterdam
|
|
7
|
+
CWI, 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(ansi_term,
|
|
38
|
+
[ ansi_format/3, % +Attr, +Format, +Args
|
|
39
|
+
ansi_format/4, % +Stream, +Attr, +Format, +Args
|
|
40
|
+
ansi_get_color/2, % +Which, -rgb(R,G,B)
|
|
41
|
+
ansi_hyperlink/2, % +Stream,+Location
|
|
42
|
+
ansi_hyperlink/3 % +Stream,+URL,+Label
|
|
43
|
+
]).
|
|
44
|
+
:- autoload(library(error), [domain_error/2, must_be/2, instantiation_error/1]).
|
|
45
|
+
:- autoload(library(lists), [append/3]).
|
|
46
|
+
:- autoload(library(utf8), [utf8_codes/3]).
|
|
47
|
+
|
|
48
|
+
/** <module> Print decorated text to ANSI consoles
|
|
49
|
+
|
|
50
|
+
This library allows for exploiting the color and attribute facilities of
|
|
51
|
+
most modern terminals using ANSI escape sequences. This library provides
|
|
52
|
+
the following:
|
|
53
|
+
|
|
54
|
+
- ansi_format/3 allows writing messages to the terminal with ansi
|
|
55
|
+
attributes.
|
|
56
|
+
- It defines the hook prolog:message_line_element/2, which provides
|
|
57
|
+
ansi attributes and hyperlinks for print_message/2.
|
|
58
|
+
|
|
59
|
+
The behavior of this library is controlled by two Prolog flags:
|
|
60
|
+
|
|
61
|
+
- `color_term`
|
|
62
|
+
When `true`, activate the color output for this library. Otherwise
|
|
63
|
+
simply call format/3.
|
|
64
|
+
- `hyperlink_term`
|
|
65
|
+
Emit terminal hyperlinks for url(Location) and url(URL, Label)
|
|
66
|
+
elements of Prolog messages.
|
|
67
|
+
|
|
68
|
+
@see http://en.wikipedia.org/wiki/ANSI_escape_code
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
:- multifile
|
|
72
|
+
prolog:console_color/2, % +Term, -AnsiAttrs
|
|
73
|
+
supports_get_color/0,
|
|
74
|
+
hyperlink/2, % +Stream, +Spec
|
|
75
|
+
tty_url_hook/2. % +For, -URL
|
|
76
|
+
|
|
77
|
+
color_term_flag_default(true) :-
|
|
78
|
+
stream_property(user_input, tty(true)),
|
|
79
|
+
stream_property(user_error, tty(true)),
|
|
80
|
+
stream_property(user_output, tty(true)),
|
|
81
|
+
\+ getenv('TERM', dumb),
|
|
82
|
+
!.
|
|
83
|
+
color_term_flag_default(false).
|
|
84
|
+
|
|
85
|
+
init_color_term_flag :-
|
|
86
|
+
color_term_flag_default(Default),
|
|
87
|
+
create_prolog_flag(color_term, Default,
|
|
88
|
+
[ type(boolean),
|
|
89
|
+
keep(true)
|
|
90
|
+
]),
|
|
91
|
+
create_prolog_flag(hyperlink_term, false,
|
|
92
|
+
[ type(boolean),
|
|
93
|
+
keep(true)
|
|
94
|
+
]).
|
|
95
|
+
|
|
96
|
+
:- initialization
|
|
97
|
+
init_color_term_flag.
|
|
98
|
+
|
|
99
|
+
:- meta_predicate
|
|
100
|
+
keep_line_pos(+, 0).
|
|
101
|
+
|
|
102
|
+
:- multifile
|
|
103
|
+
user:message_property/2.
|
|
104
|
+
|
|
105
|
+
%! ansi_format(+ClassOrAttributes, +Format, +Args) is det.
|
|
106
|
+
%! ansi_format(+Stream, +ClassOrAttributes, +Format, +Args) is det.
|
|
107
|
+
%
|
|
108
|
+
% Format text with ANSI attributes. This predicate behaves as
|
|
109
|
+
% format/2 using Format and Args, but if the `current_output` is a
|
|
110
|
+
% terminal, it adds ANSI escape sequences according to Attributes.
|
|
111
|
+
% For example, to print a text in bold cyan, do
|
|
112
|
+
%
|
|
113
|
+
% ==
|
|
114
|
+
% ?- ansi_format([bold,fg(cyan)], 'Hello ~w', [world]).
|
|
115
|
+
% ==
|
|
116
|
+
%
|
|
117
|
+
% Attributes is either a single attribute, a list thereof or a term
|
|
118
|
+
% that is mapped to concrete attributes based on the current theme
|
|
119
|
+
% (see prolog:console_color/2). The attribute names are derived from
|
|
120
|
+
% the ANSI specification. See the source for sgr_code/2 for details.
|
|
121
|
+
% Some commonly used attributes are:
|
|
122
|
+
%
|
|
123
|
+
% - bold
|
|
124
|
+
% - underline
|
|
125
|
+
% - fg(Color), bg(Color), hfg(Color), hbg(Color)
|
|
126
|
+
% For fg(Color) and bg(Color), the colour name can be '#RGB' or
|
|
127
|
+
% '#RRGGBB'
|
|
128
|
+
% - fg8(Spec), bg8(Spec)
|
|
129
|
+
% 8-bit color specification. Spec is a colour name, h(Color)
|
|
130
|
+
% or an integer 0..255.
|
|
131
|
+
% - fg(R,G,B), bg(R,G,B)
|
|
132
|
+
% 24-bit (direct color) specification. The components are
|
|
133
|
+
% integers in the range 0..255.
|
|
134
|
+
%
|
|
135
|
+
% Defined color constants are below. `default` can be used to
|
|
136
|
+
% access the default color of the terminal.
|
|
137
|
+
%
|
|
138
|
+
% - black, red, green, yellow, blue, magenta, cyan, white
|
|
139
|
+
%
|
|
140
|
+
% ANSI sequences are sent if and only if
|
|
141
|
+
%
|
|
142
|
+
% - The `current_output` has the property tty(true) (see
|
|
143
|
+
% stream_property/2).
|
|
144
|
+
% - The Prolog flag `color_term` is `true`.
|
|
145
|
+
|
|
146
|
+
ansi_format(Attr, Format, Args) :-
|
|
147
|
+
ansi_format(current_output, Attr, Format, Args).
|
|
148
|
+
|
|
149
|
+
ansi_format(Stream, Class, Format, Args) :-
|
|
150
|
+
stream_property(Stream, tty(true)),
|
|
151
|
+
current_prolog_flag(color_term, true),
|
|
152
|
+
class_attrs(Class, Attr),
|
|
153
|
+
Attr \== [],
|
|
154
|
+
!,
|
|
155
|
+
phrase(sgr_codes_ex(Attr), Codes),
|
|
156
|
+
atomic_list_concat(Codes, ;, Code),
|
|
157
|
+
with_output_to(
|
|
158
|
+
Stream,
|
|
159
|
+
( keep_line_pos(current_output, format('\e[~wm', [Code])),
|
|
160
|
+
format(Format, Args),
|
|
161
|
+
keep_line_pos(current_output, format('\e[0m'))
|
|
162
|
+
)
|
|
163
|
+
),
|
|
164
|
+
flush_output.
|
|
165
|
+
ansi_format(Stream, _Attr, Format, Args) :-
|
|
166
|
+
format(Stream, Format, Args).
|
|
167
|
+
|
|
168
|
+
sgr_codes_ex(X) -->
|
|
169
|
+
{ var(X),
|
|
170
|
+
!,
|
|
171
|
+
instantiation_error(X)
|
|
172
|
+
}.
|
|
173
|
+
sgr_codes_ex([]) -->
|
|
174
|
+
!.
|
|
175
|
+
sgr_codes_ex([H|T]) -->
|
|
176
|
+
!,
|
|
177
|
+
sgr_codes_ex(H),
|
|
178
|
+
sgr_codes_ex(T).
|
|
179
|
+
sgr_codes_ex(Attr) -->
|
|
180
|
+
( { sgr_code(Attr, Code) }
|
|
181
|
+
-> ( { is_list(Code) }
|
|
182
|
+
-> list(Code)
|
|
183
|
+
; [Code]
|
|
184
|
+
)
|
|
185
|
+
; { domain_error(sgr_code, Attr) }
|
|
186
|
+
).
|
|
187
|
+
|
|
188
|
+
list([]) --> [].
|
|
189
|
+
list([H|T]) --> [H], list(T).
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
%! sgr_code(+Name, -Code)
|
|
193
|
+
%
|
|
194
|
+
% True when code is the Select Graphic Rendition code for Name.
|
|
195
|
+
% The defined names are given below. Note that most terminals only
|
|
196
|
+
% implement this partially.
|
|
197
|
+
%
|
|
198
|
+
% | reset | all attributes off |
|
|
199
|
+
% | bold | |
|
|
200
|
+
% | faint | |
|
|
201
|
+
% | italic | |
|
|
202
|
+
% | underline | |
|
|
203
|
+
% | blink(slow) | |
|
|
204
|
+
% | blink(rapid) | |
|
|
205
|
+
% | negative | |
|
|
206
|
+
% | conceal | |
|
|
207
|
+
% | crossed_out | |
|
|
208
|
+
% | font(primary) | |
|
|
209
|
+
% | font(N) | Alternate font (1..8) |
|
|
210
|
+
% | fraktur | |
|
|
211
|
+
% | underline(double) | |
|
|
212
|
+
% | intensity(normal) | |
|
|
213
|
+
% | fg(Name) | Color name |
|
|
214
|
+
% | bg(Name) | Color name |
|
|
215
|
+
% | framed | |
|
|
216
|
+
% | encircled | |
|
|
217
|
+
% | overlined | |
|
|
218
|
+
% | ideogram(underline) | |
|
|
219
|
+
% | right_side_line | |
|
|
220
|
+
% | ideogram(underline(double)) | |
|
|
221
|
+
% | right_side_line(double) | |
|
|
222
|
+
% | ideogram(overlined) | |
|
|
223
|
+
% | left_side_line | |
|
|
224
|
+
% | ideogram(stress_marking) | |
|
|
225
|
+
% | -Off | Switch attributes off |
|
|
226
|
+
% | hfg(Name) | Color name |
|
|
227
|
+
% | hbg(Name) | Color name |
|
|
228
|
+
%
|
|
229
|
+
% @see http://en.wikipedia.org/wiki/ANSI_escape_code
|
|
230
|
+
|
|
231
|
+
sgr_code(reset, 0).
|
|
232
|
+
sgr_code(bold, 1).
|
|
233
|
+
sgr_code(faint, 2).
|
|
234
|
+
sgr_code(italic, 3).
|
|
235
|
+
sgr_code(underline, 4).
|
|
236
|
+
sgr_code(blink(slow), 5).
|
|
237
|
+
sgr_code(blink(rapid), 6).
|
|
238
|
+
sgr_code(negative, 7).
|
|
239
|
+
sgr_code(conceal, 8).
|
|
240
|
+
sgr_code(crossed_out, 9).
|
|
241
|
+
sgr_code(font(primary), 10) :- !.
|
|
242
|
+
sgr_code(font(N), C) :-
|
|
243
|
+
C is 10+N.
|
|
244
|
+
sgr_code(fraktur, 20).
|
|
245
|
+
sgr_code(underline(double), 21).
|
|
246
|
+
sgr_code(intensity(normal), 22).
|
|
247
|
+
sgr_code(fg(Name), C) :-
|
|
248
|
+
( ansi_color(Name, N)
|
|
249
|
+
-> C is N+30
|
|
250
|
+
; rgb(Name, R, G, B)
|
|
251
|
+
-> sgr_code(fg(R,G,B), C)
|
|
252
|
+
).
|
|
253
|
+
sgr_code(bg(Name), C) :-
|
|
254
|
+
!,
|
|
255
|
+
( ansi_color(Name, N)
|
|
256
|
+
-> C is N+40
|
|
257
|
+
; rgb(Name, R, G, B)
|
|
258
|
+
-> sgr_code(bg(R,G,B), C)
|
|
259
|
+
).
|
|
260
|
+
sgr_code(framed, 51).
|
|
261
|
+
sgr_code(encircled, 52).
|
|
262
|
+
sgr_code(overlined, 53).
|
|
263
|
+
sgr_code(ideogram(underline), 60).
|
|
264
|
+
sgr_code(right_side_line, 60).
|
|
265
|
+
sgr_code(ideogram(underline(double)), 61).
|
|
266
|
+
sgr_code(right_side_line(double), 61).
|
|
267
|
+
sgr_code(ideogram(overlined), 62).
|
|
268
|
+
sgr_code(left_side_line, 62).
|
|
269
|
+
sgr_code(ideogram(stress_marking), 64).
|
|
270
|
+
sgr_code(-X, Code) :-
|
|
271
|
+
off_code(X, Code).
|
|
272
|
+
sgr_code(hfg(Name), C) :-
|
|
273
|
+
ansi_color(Name, N),
|
|
274
|
+
C is N+90.
|
|
275
|
+
sgr_code(hbg(Name), C) :-
|
|
276
|
+
!,
|
|
277
|
+
ansi_color(Name, N),
|
|
278
|
+
C is N+100.
|
|
279
|
+
sgr_code(fg8(Name), [38,5,N]) :-
|
|
280
|
+
ansi_color8(Name, N).
|
|
281
|
+
sgr_code(bg8(Name), [48,5,N]) :-
|
|
282
|
+
ansi_color8(Name, N).
|
|
283
|
+
sgr_code(fg(R,G,B), [38,2,R,G,B]) :-
|
|
284
|
+
between(0, 255, R),
|
|
285
|
+
between(0, 255, G),
|
|
286
|
+
between(0, 255, B).
|
|
287
|
+
sgr_code(bg(R,G,B), [48,2,R,G,B]) :-
|
|
288
|
+
between(0, 255, R),
|
|
289
|
+
between(0, 255, G),
|
|
290
|
+
between(0, 255, B).
|
|
291
|
+
|
|
292
|
+
off_code(italic_and_franktur, 23).
|
|
293
|
+
off_code(underline, 24).
|
|
294
|
+
off_code(blink, 25).
|
|
295
|
+
off_code(negative, 27).
|
|
296
|
+
off_code(conceal, 28).
|
|
297
|
+
off_code(crossed_out, 29).
|
|
298
|
+
off_code(framed, 54).
|
|
299
|
+
off_code(overlined, 55).
|
|
300
|
+
|
|
301
|
+
ansi_color8(h(Name), N) :-
|
|
302
|
+
!,
|
|
303
|
+
ansi_color(Name, N0),
|
|
304
|
+
N is N0+8.
|
|
305
|
+
ansi_color8(Name, N) :-
|
|
306
|
+
atom(Name),
|
|
307
|
+
!,
|
|
308
|
+
ansi_color(Name, N).
|
|
309
|
+
ansi_color8(N, N) :-
|
|
310
|
+
between(0, 255, N).
|
|
311
|
+
|
|
312
|
+
ansi_color(black, 0).
|
|
313
|
+
ansi_color(red, 1).
|
|
314
|
+
ansi_color(green, 2).
|
|
315
|
+
ansi_color(yellow, 3).
|
|
316
|
+
ansi_color(blue, 4).
|
|
317
|
+
ansi_color(magenta, 5).
|
|
318
|
+
ansi_color(cyan, 6).
|
|
319
|
+
ansi_color(white, 7).
|
|
320
|
+
ansi_color(default, 9).
|
|
321
|
+
|
|
322
|
+
rgb(Name, R, G, B) :-
|
|
323
|
+
atom_codes(Name, [0'#,R1,R2,G1,G2,B1,B2]),
|
|
324
|
+
hex_color(R1,R2,R),
|
|
325
|
+
hex_color(G1,G2,G),
|
|
326
|
+
hex_color(B1,B2,B).
|
|
327
|
+
rgb(Name, R, G, B) :-
|
|
328
|
+
atom_codes(Name, [0'#,R1,G1,B1]),
|
|
329
|
+
hex_color(R1,R),
|
|
330
|
+
hex_color(G1,G),
|
|
331
|
+
hex_color(B1,B).
|
|
332
|
+
|
|
333
|
+
hex_color(D1,D2,V) :-
|
|
334
|
+
code_type(D1, xdigit(V1)),
|
|
335
|
+
code_type(D2, xdigit(V2)),
|
|
336
|
+
V is 16*V1+V2.
|
|
337
|
+
|
|
338
|
+
hex_color(D1,V) :-
|
|
339
|
+
code_type(D1, xdigit(V1)),
|
|
340
|
+
V is 16*V1+V1.
|
|
341
|
+
|
|
342
|
+
%! prolog:console_color(+Term, -AnsiAttributes) is semidet.
|
|
343
|
+
%
|
|
344
|
+
% Hook that allows for mapping abstract terms to concrete ANSI
|
|
345
|
+
% attributes. This hook is used by _theme_ files to adjust the
|
|
346
|
+
% rendering based on user preferences and context. Defaults are
|
|
347
|
+
% defined in the file `boot/messages.pl`, default_theme/2.
|
|
348
|
+
%
|
|
349
|
+
% @see library(theme/dark) for an example implementation and the Term
|
|
350
|
+
% values used by the system messages.
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
/*******************************
|
|
354
|
+
* HOOK *
|
|
355
|
+
*******************************/
|
|
356
|
+
|
|
357
|
+
%! prolog:message_line_element(+Stream, +Term) is semidet.
|
|
358
|
+
%
|
|
359
|
+
% Hook implementation that deals with ansi(+Attr, +Fmt, +Args) in
|
|
360
|
+
% message specifications.
|
|
361
|
+
|
|
362
|
+
prolog:message_line_element(S, ansi(Class, Fmt, Args)) :-
|
|
363
|
+
class_attrs(Class, Attr),
|
|
364
|
+
ansi_format(S, Attr, Fmt, Args).
|
|
365
|
+
prolog:message_line_element(S, ansi(Class, Fmt, Args, Ctx)) :-
|
|
366
|
+
class_attrs(Class, Attr),
|
|
367
|
+
ansi_format(S, Attr, Fmt, Args),
|
|
368
|
+
( nonvar(Ctx),
|
|
369
|
+
Ctx = ansi(_, RI-RA)
|
|
370
|
+
-> keep_line_pos(S, format(S, RI, RA))
|
|
371
|
+
; true
|
|
372
|
+
).
|
|
373
|
+
prolog:message_line_element(S, url(Location)) :-
|
|
374
|
+
ansi_hyperlink(S, Location).
|
|
375
|
+
prolog:message_line_element(S, url(URL, Label)) :-
|
|
376
|
+
ansi_hyperlink(S, URL, Label).
|
|
377
|
+
prolog:message_line_element(S, begin(Level, Ctx)) :-
|
|
378
|
+
level_attrs(Level, Attr),
|
|
379
|
+
stream_property(S, tty(true)),
|
|
380
|
+
current_prolog_flag(color_term, true),
|
|
381
|
+
!,
|
|
382
|
+
( is_list(Attr)
|
|
383
|
+
-> sgr_codes(Attr, Codes),
|
|
384
|
+
atomic_list_concat(Codes, ;, Code)
|
|
385
|
+
; sgr_code(Attr, Code)
|
|
386
|
+
),
|
|
387
|
+
keep_line_pos(S, format(S, '\e[~wm', [Code])),
|
|
388
|
+
Ctx = ansi('\e[0m', '\e[0m\e[~wm'-[Code]).
|
|
389
|
+
prolog:message_line_element(S, end(Ctx)) :-
|
|
390
|
+
nonvar(Ctx),
|
|
391
|
+
Ctx = ansi(Reset, _),
|
|
392
|
+
keep_line_pos(S, write(S, Reset)).
|
|
393
|
+
|
|
394
|
+
sgr_codes([], []).
|
|
395
|
+
sgr_codes([H0|T0], [H|T]) :-
|
|
396
|
+
sgr_code(H0, H),
|
|
397
|
+
sgr_codes(T0, T).
|
|
398
|
+
|
|
399
|
+
level_attrs(Level, Attrs) :-
|
|
400
|
+
user:message_property(Level, color(Attrs)),
|
|
401
|
+
!.
|
|
402
|
+
level_attrs(Level, Attrs) :-
|
|
403
|
+
class_attrs(message(Level), Attrs).
|
|
404
|
+
|
|
405
|
+
class_attrs(Class, Attrs) :-
|
|
406
|
+
user:message_property(Class, color(Attrs)),
|
|
407
|
+
!.
|
|
408
|
+
class_attrs(Class, Attrs) :-
|
|
409
|
+
prolog:console_color(Class, Attrs),
|
|
410
|
+
!.
|
|
411
|
+
class_attrs(Class, Attrs) :-
|
|
412
|
+
'$messages':default_theme(Class, Attrs),
|
|
413
|
+
!.
|
|
414
|
+
class_attrs(Attrs, Attrs).
|
|
415
|
+
|
|
416
|
+
%! ansi_hyperlink(+Stream, +Location) is det.
|
|
417
|
+
%! ansi_hyperlink(+Stream, +URL, +Label) is det.
|
|
418
|
+
%
|
|
419
|
+
% Create a hyperlink for a terminal emulator. The file is fairly easy,
|
|
420
|
+
% but getting the line and column across is not as there seems to be
|
|
421
|
+
% no established standard. The current implementation emits, i.e.,
|
|
422
|
+
% inserting a capital ``L`` before the line.
|
|
423
|
+
%
|
|
424
|
+
% ``file://AbsFileName[#LLine[:Column]]``
|
|
425
|
+
%
|
|
426
|
+
% @see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
|
|
427
|
+
|
|
428
|
+
ansi_hyperlink(Stream, Location) :-
|
|
429
|
+
hyperlink(Stream, url(Location)),
|
|
430
|
+
!.
|
|
431
|
+
ansi_hyperlink(Stream, Location) :-
|
|
432
|
+
location_label(Location, Label),
|
|
433
|
+
ansi_hyperlink(Stream, Location, Label).
|
|
434
|
+
|
|
435
|
+
location_label(File:Line:Column, Label) =>
|
|
436
|
+
format(string(Label), '~w:~w:~w', [File,Line,Column]).
|
|
437
|
+
location_label(File:Line, Label) =>
|
|
438
|
+
format(string(Label), '~w:~w', [File,Line]).
|
|
439
|
+
location_label(File, Label) =>
|
|
440
|
+
format(string(Label), '~w', [File]).
|
|
441
|
+
|
|
442
|
+
ansi_hyperlink(Stream, Location, Label),
|
|
443
|
+
hyperlink(Stream, url(Location, Label)) =>
|
|
444
|
+
true.
|
|
445
|
+
ansi_hyperlink(Stream, Location, Label) =>
|
|
446
|
+
( location_url(Location, URL)
|
|
447
|
+
-> keep_line_pos(Stream,
|
|
448
|
+
format(Stream, '\e]8;;~w\e\\', [URL])),
|
|
449
|
+
format(Stream, '~w', [Label]),
|
|
450
|
+
keep_line_pos(Stream,
|
|
451
|
+
format(Stream, '\e]8;;\e\\', []))
|
|
452
|
+
; format(Stream, '~w', [Label])
|
|
453
|
+
).
|
|
454
|
+
|
|
455
|
+
is_url(URL) :-
|
|
456
|
+
( atom(URL)
|
|
457
|
+
-> true
|
|
458
|
+
; string(URL)
|
|
459
|
+
),
|
|
460
|
+
url_prefix(Prefix),
|
|
461
|
+
sub_string(URL, 0, _, _, Prefix).
|
|
462
|
+
|
|
463
|
+
url_prefix('http://').
|
|
464
|
+
url_prefix('https://').
|
|
465
|
+
url_prefix('file://').
|
|
466
|
+
|
|
467
|
+
%! location_url(+Location, -URL) is det.
|
|
468
|
+
%
|
|
469
|
+
% Translate Location into a (file) URL. This predicate is hooked by
|
|
470
|
+
% tty_url_hook/2 with the same signature to allow for actions,
|
|
471
|
+
% location specifiers or URL schemes.
|
|
472
|
+
|
|
473
|
+
location_url(Location, URL),
|
|
474
|
+
tty_url_hook(Location, URL0) =>
|
|
475
|
+
URL = URL0.
|
|
476
|
+
location_url(File:Line:Column, URL) =>
|
|
477
|
+
url_file_name(FileURL, File),
|
|
478
|
+
format(string(URL), '~w#~d:~d', [FileURL, Line, Column]).
|
|
479
|
+
location_url(File:Line, URL) =>
|
|
480
|
+
url_file_name(FileURL, File),
|
|
481
|
+
format(string(URL), '~w#~w', [FileURL, Line]).
|
|
482
|
+
location_url(File, URL) =>
|
|
483
|
+
url_file_name(URL, File).
|
|
484
|
+
|
|
485
|
+
%! tty_url_hook(+Location, -URL)
|
|
486
|
+
%
|
|
487
|
+
% Hook for location_url/2.
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
%! url_file_name(-URL, +File) is semidet.
|
|
491
|
+
%
|
|
492
|
+
% Same as uri_file_name/2 in mode (-,+), but as a core library we do
|
|
493
|
+
% not wish to depend on the `clib` package and its foreign support.
|
|
494
|
+
|
|
495
|
+
url_file_name(URL, File) :-
|
|
496
|
+
is_url(File), !,
|
|
497
|
+
current_prolog_flag(hyperlink_term, true),
|
|
498
|
+
URL = File.
|
|
499
|
+
url_file_name(URL, File) :-
|
|
500
|
+
current_prolog_flag(hyperlink_term, true),
|
|
501
|
+
absolute_file_name(File, AbsFile),
|
|
502
|
+
ensure_leading_slash(AbsFile, AbsFile1),
|
|
503
|
+
url_encode_path(AbsFile1, Encoded),
|
|
504
|
+
format(string(URL), 'file://~s', [Encoded]).
|
|
505
|
+
|
|
506
|
+
ensure_leading_slash(Path, SlashPath) :-
|
|
507
|
+
( sub_atom(Path, 0, _, _, /)
|
|
508
|
+
-> SlashPath = Path
|
|
509
|
+
; atom_concat(/, Path, SlashPath)
|
|
510
|
+
).
|
|
511
|
+
|
|
512
|
+
url_encode_path(Name, Encoded) :-
|
|
513
|
+
atom_codes(Name, Codes),
|
|
514
|
+
phrase(utf8_codes(Codes), UTF8),
|
|
515
|
+
phrase(encode(UTF8), Encoded).
|
|
516
|
+
|
|
517
|
+
encode([]) --> [].
|
|
518
|
+
encode([H|T]) --> encode1(H), encode(T).
|
|
519
|
+
|
|
520
|
+
encode1(C) -->
|
|
521
|
+
{ reserved(C),
|
|
522
|
+
!,
|
|
523
|
+
format(codes([C1,C2]), '~`0t~16r~2|', [C])
|
|
524
|
+
},
|
|
525
|
+
"%", [C1,C2].
|
|
526
|
+
encode1(C) -->
|
|
527
|
+
[C].
|
|
528
|
+
|
|
529
|
+
reserved(C) :- C =< 0'\s.
|
|
530
|
+
reserved(C) :- C >= 127.
|
|
531
|
+
reserved(0'#).
|
|
532
|
+
|
|
533
|
+
%! keep_line_pos(+Stream, :Goal)
|
|
534
|
+
%
|
|
535
|
+
% Run goal without changing the position information on Stream. This
|
|
536
|
+
% is used to avoid that the exchange of ANSI sequences modifies the
|
|
537
|
+
% notion of, notably, the `line_pos` notion.
|
|
538
|
+
|
|
539
|
+
keep_line_pos(S, G) :-
|
|
540
|
+
stream_property(S, position(Pos)),
|
|
541
|
+
!,
|
|
542
|
+
setup_call_cleanup(
|
|
543
|
+
stream_position_data(line_position, Pos, LPos),
|
|
544
|
+
G,
|
|
545
|
+
set_stream(S, line_position(LPos))).
|
|
546
|
+
keep_line_pos(_, G) :-
|
|
547
|
+
call(G).
|
|
548
|
+
|
|
549
|
+
%! ansi_get_color(+Which, -RGB) is semidet.
|
|
550
|
+
%
|
|
551
|
+
% Obtain the RGB color for an ANSI color parameter. Which is either a
|
|
552
|
+
% color alias or an integer ANSI color id. Defined aliases are
|
|
553
|
+
% `foreground` and `background`. This predicate sends a request to the
|
|
554
|
+
% console (`user_output`) and reads the reply. This assumes an `xterm`
|
|
555
|
+
% compatible terminal.
|
|
556
|
+
%
|
|
557
|
+
% @arg RGB is a term rgb(Red,Green,Blue). The color components are
|
|
558
|
+
% integers in the range 0..65535.
|
|
559
|
+
|
|
560
|
+
ansi_get_color(Which0, RGB) :-
|
|
561
|
+
\+ current_prolog_flag(console_menu, true),
|
|
562
|
+
stream_property(user_input, tty(true)),
|
|
563
|
+
stream_property(user_output, tty(true)),
|
|
564
|
+
stream_property(user_error, tty(true)),
|
|
565
|
+
supports_get_color,
|
|
566
|
+
( color_alias(Which0, Which)
|
|
567
|
+
-> true
|
|
568
|
+
; must_be(between(0,15),Which0)
|
|
569
|
+
-> Which = Which0
|
|
570
|
+
),
|
|
571
|
+
catch(keep_line_pos(user_output,
|
|
572
|
+
ansi_get_color_(Which, RGB)),
|
|
573
|
+
error(timeout_error(_,_), _),
|
|
574
|
+
no_xterm).
|
|
575
|
+
|
|
576
|
+
supports_get_color :-
|
|
577
|
+
\+ current_prolog_flag(windows, true),
|
|
578
|
+
getenv('TERM', Term),
|
|
579
|
+
sub_atom(Term, 0, _, _, xterm),
|
|
580
|
+
\+ getenv('TERM_PROGRAM', 'Apple_Terminal').
|
|
581
|
+
|
|
582
|
+
color_alias(foreground, 10).
|
|
583
|
+
color_alias(background, 11).
|
|
584
|
+
|
|
585
|
+
ansi_get_color_(Which, rgb(R,G,B)) :-
|
|
586
|
+
format(codes(Id), '~w', [Which]),
|
|
587
|
+
hex4(RH),
|
|
588
|
+
hex4(GH),
|
|
589
|
+
hex4(BH),
|
|
590
|
+
phrase(("\e]", Id, ";rgb:", RH, "/", GH, "/", BH, "\a"), Pattern),
|
|
591
|
+
stream_property(user_input, timeout(Old)),
|
|
592
|
+
setup_call_cleanup(
|
|
593
|
+
set_stream(user_input, timeout(0.05)),
|
|
594
|
+
with_tty_raw(exchange_pattern(Which, Pattern)),
|
|
595
|
+
set_stream(user_input, timeout(Old))),
|
|
596
|
+
!,
|
|
597
|
+
hex_val(RH, R),
|
|
598
|
+
hex_val(GH, G),
|
|
599
|
+
hex_val(BH, B).
|
|
600
|
+
|
|
601
|
+
no_xterm :-
|
|
602
|
+
print_message(warning, ansi(no_xterm_get_colour)),
|
|
603
|
+
fail.
|
|
604
|
+
|
|
605
|
+
hex4([_,_,_,_]).
|
|
606
|
+
|
|
607
|
+
hex_val([D1,D2,D3,D4], V) :-
|
|
608
|
+
code_type(D1, xdigit(V1)),
|
|
609
|
+
code_type(D2, xdigit(V2)),
|
|
610
|
+
code_type(D3, xdigit(V3)),
|
|
611
|
+
code_type(D4, xdigit(V4)),
|
|
612
|
+
V is (V1<<12)+(V2<<8)+(V3<<4)+V4.
|
|
613
|
+
|
|
614
|
+
exchange_pattern(Which, Pattern) :-
|
|
615
|
+
format(user_output, '\e]~w;?\a', [Which]),
|
|
616
|
+
flush_output(user_output),
|
|
617
|
+
read_pattern(user_input, Pattern, []).
|
|
618
|
+
|
|
619
|
+
read_pattern(From, Pattern, NotMatched0) :-
|
|
620
|
+
copy_term(Pattern, TryPattern),
|
|
621
|
+
append(Skip, Rest, NotMatched0),
|
|
622
|
+
append(Rest, RestPattern, TryPattern),
|
|
623
|
+
!,
|
|
624
|
+
echo(Skip),
|
|
625
|
+
try_read_pattern(From, RestPattern, NotMatched, Done),
|
|
626
|
+
( Done == true
|
|
627
|
+
-> Pattern = TryPattern
|
|
628
|
+
; read_pattern(From, Pattern, NotMatched)
|
|
629
|
+
).
|
|
630
|
+
|
|
631
|
+
%! try_read_pattern(+From, +Pattern, -NotMatched)
|
|
632
|
+
|
|
633
|
+
try_read_pattern(_, [], [], true) :-
|
|
634
|
+
!.
|
|
635
|
+
try_read_pattern(From, [H|T], [C|RT], Done) :-
|
|
636
|
+
get_code(C),
|
|
637
|
+
( C = H
|
|
638
|
+
-> try_read_pattern(From, T, RT, Done)
|
|
639
|
+
; RT = [],
|
|
640
|
+
Done = false
|
|
641
|
+
).
|
|
642
|
+
|
|
643
|
+
echo([]).
|
|
644
|
+
echo([H|T]) :-
|
|
645
|
+
put_code(user_output, H),
|
|
646
|
+
echo(T).
|
|
647
|
+
|
|
648
|
+
:- multifile prolog:message//1.
|
|
649
|
+
|
|
650
|
+
prolog:message(ansi(no_xterm_get_colour)) -->
|
|
651
|
+
[ 'Terminal claims to be xterm compatible,'-[], nl,
|
|
652
|
+
'but does not report colour info'-[]
|
|
653
|
+
].
|