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,103 @@
|
|
|
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) 2009-2020, University of Amsterdam
|
|
7
|
+
CWI, Amsterdam
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions
|
|
12
|
+
are met:
|
|
13
|
+
|
|
14
|
+
1. Redistributions of source code must retain the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
notice, this list of conditions and the following disclaimer in
|
|
19
|
+
the documentation and/or other materials provided with the
|
|
20
|
+
distribution.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
25
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
26
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
28
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
29
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
30
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
31
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
32
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
:- module(stream_info,
|
|
37
|
+
[ stream_info/1 % +Stream
|
|
38
|
+
]).
|
|
39
|
+
:- autoload(library(error),[existence_error/2]).
|
|
40
|
+
:- autoload(library(lists),[member/2]).
|
|
41
|
+
|
|
42
|
+
:- use_foreign_library(foreign(streaminfo)).
|
|
43
|
+
|
|
44
|
+
%! stream_info(+Stream) is det.
|
|
45
|
+
%
|
|
46
|
+
% Print detailed information about a stream or a file-number to
|
|
47
|
+
% the error output. The output of this command is meant for
|
|
48
|
+
% experts and requires knowledge about the implementation of
|
|
49
|
+
% streams. It has been added to diagnose leaking streams in
|
|
50
|
+
% web-servers. For example, on linux systems we can examine
|
|
51
|
+
% process file-descriptors using
|
|
52
|
+
%
|
|
53
|
+
% ==
|
|
54
|
+
% % ls -l /proc/<pid>/fd
|
|
55
|
+
% ==
|
|
56
|
+
%
|
|
57
|
+
% If now (say) descriptor 15 is open where it should not be, we
|
|
58
|
+
% can this command to find the associated Prolog streams and print
|
|
59
|
+
% as mush as possible information about the stream.
|
|
60
|
+
%
|
|
61
|
+
% ==
|
|
62
|
+
% ?- stream_info(15).
|
|
63
|
+
% ==
|
|
64
|
+
%
|
|
65
|
+
% @param Stream A stream-handle, alias name, (integer) system
|
|
66
|
+
% file handle or `'<stream>(address)'` atom.
|
|
67
|
+
|
|
68
|
+
stream_info(Stream) :-
|
|
69
|
+
is_stream(Stream),
|
|
70
|
+
!,
|
|
71
|
+
forall(stream_property(Stream, P),
|
|
72
|
+
print_property(P)),
|
|
73
|
+
nl,
|
|
74
|
+
catch('$stream_info'(current_output, Stream), E, true),
|
|
75
|
+
( nonvar(E)
|
|
76
|
+
-> format('~w:~t~25|~q~n', ['pending exception', E])
|
|
77
|
+
; true
|
|
78
|
+
).
|
|
79
|
+
stream_info(FileNo) :-
|
|
80
|
+
integer(FileNo),
|
|
81
|
+
!,
|
|
82
|
+
findall(S, stream_property(S, file_no(FileNo)), Streams),
|
|
83
|
+
length(Streams, Len),
|
|
84
|
+
format('File no ~w is connected to ~d streams~n', [FileNo, Len]),
|
|
85
|
+
forall(member(Stream, Streams),
|
|
86
|
+
( format('****************~nStream ~p:~n', [Stream]),
|
|
87
|
+
stream_info(Stream))).
|
|
88
|
+
stream_info(Atom) :-
|
|
89
|
+
atom(Atom),
|
|
90
|
+
( stream_property(Stream, type(_)),
|
|
91
|
+
format(atom(Atom), '~p', [Stream])
|
|
92
|
+
-> stream_info(Stream)
|
|
93
|
+
; existence_error(stream, Atom)
|
|
94
|
+
).
|
|
95
|
+
|
|
96
|
+
print_property(P) :-
|
|
97
|
+
P =.. [Name,Value],
|
|
98
|
+
!,
|
|
99
|
+
format('~w:~t~25|~q~n', [Name, Value]).
|
|
100
|
+
print_property(input) :- !.
|
|
101
|
+
print_property(output) :- !.
|
|
102
|
+
print_property(P) :-
|
|
103
|
+
format('~p~n', [P]).
|
|
@@ -0,0 +1,136 @@
|
|
|
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) 2002-2018, University of Amsterdam
|
|
7
|
+
CWI, Amsterdam
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions
|
|
12
|
+
are met:
|
|
13
|
+
|
|
14
|
+
1. Redistributions of source code must retain the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
notice, this list of conditions and the following disclaimer in
|
|
19
|
+
the documentation and/or other materials provided with the
|
|
20
|
+
distribution.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
25
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
26
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
28
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
29
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
30
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
31
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
32
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
:- module(stream_pool,
|
|
37
|
+
[ add_stream_to_pool/2, % +Stream, :Goal
|
|
38
|
+
delete_stream_from_pool/1, % +Stream
|
|
39
|
+
close_stream_pool/0,
|
|
40
|
+
dispatch_stream_pool/1, % +TimeOut
|
|
41
|
+
stream_pool_main_loop/0
|
|
42
|
+
]).
|
|
43
|
+
:- use_module(library(debug),[debug/3]).
|
|
44
|
+
|
|
45
|
+
:- meta_predicate
|
|
46
|
+
add_stream_to_pool(+, 0).
|
|
47
|
+
|
|
48
|
+
:- volatile
|
|
49
|
+
pool/2. % sockets don't survive a saved-state
|
|
50
|
+
:- dynamic
|
|
51
|
+
pool/2. % Stream, Action
|
|
52
|
+
|
|
53
|
+
/** <module> Input multiplexing
|
|
54
|
+
|
|
55
|
+
This libary allows a single thread to monitor multiple streams and call
|
|
56
|
+
a goal if input is available on a stream.
|
|
57
|
+
|
|
58
|
+
@bug Note that if the processing predicate blocks other input channals
|
|
59
|
+
are not processed. This may happen, for example, if a read/2 call blocks
|
|
60
|
+
due to incomplete input.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
%! add_stream_to_pool(+Stream :Goal)
|
|
64
|
+
%
|
|
65
|
+
% Call Goal whenever there is input on Stream.
|
|
66
|
+
|
|
67
|
+
add_stream_to_pool(Stream, Action) :-
|
|
68
|
+
strip_module(Action, Module, Plain),
|
|
69
|
+
register_stream(Stream, Module:Plain).
|
|
70
|
+
|
|
71
|
+
register_stream(Stream, Goal) :-
|
|
72
|
+
assert(pool(Stream, Goal)).
|
|
73
|
+
|
|
74
|
+
%! delete_stream_from_pool(+Stream)
|
|
75
|
+
%
|
|
76
|
+
% Retract stream from the pool
|
|
77
|
+
|
|
78
|
+
delete_stream_from_pool(Stream) :-
|
|
79
|
+
retractall(pool(Stream, _)).
|
|
80
|
+
|
|
81
|
+
%! close_stream_pool
|
|
82
|
+
%
|
|
83
|
+
% Close all streams in the pool. This causes stream_pool_main_loop/0
|
|
84
|
+
% to terminate.
|
|
85
|
+
|
|
86
|
+
close_stream_pool :-
|
|
87
|
+
forall(retract(pool(Stream, _)),
|
|
88
|
+
close(Stream, [force(true)])).
|
|
89
|
+
|
|
90
|
+
%! dispatch_stream_pool(+TimeOut)
|
|
91
|
+
%
|
|
92
|
+
% Wait for input on one or more streams and handle that. Wait for at
|
|
93
|
+
% most TimeOut seconds (0 means infinite).
|
|
94
|
+
|
|
95
|
+
dispatch_stream_pool(Timeout) :-
|
|
96
|
+
findall(S, pool(S, _), Pool),
|
|
97
|
+
debug(tcp, 'Select ~p ...', [Pool]),
|
|
98
|
+
catch(wait_for_input(Pool, Ready, Timeout), E, true),
|
|
99
|
+
debug(tcp, ' --> ~p (E=~p)', [Ready, E]),
|
|
100
|
+
( var(E)
|
|
101
|
+
-> actions(Ready)
|
|
102
|
+
; E = error(existence_error(stream, Stream), _)
|
|
103
|
+
-> delete_stream_from_pool(Stream)
|
|
104
|
+
).
|
|
105
|
+
|
|
106
|
+
actions([]).
|
|
107
|
+
actions([H|T]) :-
|
|
108
|
+
action(H),
|
|
109
|
+
actions(T).
|
|
110
|
+
|
|
111
|
+
action(Stream) :-
|
|
112
|
+
pool(Stream, Action),
|
|
113
|
+
( catch(Action, E, true)
|
|
114
|
+
-> ( var(E)
|
|
115
|
+
-> true
|
|
116
|
+
; print_message(error, E)
|
|
117
|
+
)
|
|
118
|
+
; print_message(warning,
|
|
119
|
+
goal_failed(Action, stream_pool))
|
|
120
|
+
).
|
|
121
|
+
|
|
122
|
+
%! stream_pool_main_loop
|
|
123
|
+
%
|
|
124
|
+
% Keep handling input from the streams in the pool until they have all
|
|
125
|
+
% died away.
|
|
126
|
+
|
|
127
|
+
stream_pool_main_loop :-
|
|
128
|
+
pool(_, _),
|
|
129
|
+
!,
|
|
130
|
+
( current_prolog_flag(windows, true)
|
|
131
|
+
-> dispatch_stream_pool(1) % so we can break out easily
|
|
132
|
+
; dispatch_stream_pool(0)
|
|
133
|
+
),
|
|
134
|
+
stream_pool_main_loop.
|
|
135
|
+
stream_pool_main_loop.
|
|
136
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
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) 2013-2020, VU University Amsterdam
|
|
7
|
+
CWI Amsterdam
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions
|
|
12
|
+
are met:
|
|
13
|
+
|
|
14
|
+
1. Redistributions of source code must retain the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
notice, this list of conditions and the following disclaimer in
|
|
19
|
+
the documentation and/or other materials provided with the
|
|
20
|
+
distribution.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
25
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
26
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
28
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
29
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
30
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
31
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
32
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
:- module(syslog,
|
|
37
|
+
[ openlog/3, % +Ident, +Options, +Facility
|
|
38
|
+
syslog/2, % +Priority, +Message
|
|
39
|
+
syslog/3, % +Priority, +Format, +Args
|
|
40
|
+
closelog/0
|
|
41
|
+
]).
|
|
42
|
+
:- autoload(library(lists),[member/2]).
|
|
43
|
+
|
|
44
|
+
/** <module> Unix syslog interface
|
|
45
|
+
|
|
46
|
+
This library provides an interface to the Unix syslog() facility. The
|
|
47
|
+
interface is an almost direct translation of the POSIX syslog API, with
|
|
48
|
+
two additions:
|
|
49
|
+
|
|
50
|
+
- syslog/3 exploits format/3 to format syslog messages
|
|
51
|
+
- The library integrates into library(debug) using
|
|
52
|
+
prolog:debug_print_hook/3, where debug _topics_ are mapped to
|
|
53
|
+
syslog _priorities_ and remaining debug _topics_ are mapped
|
|
54
|
+
to the syslog _priority_ =debug=.
|
|
55
|
+
|
|
56
|
+
Note that this interface makes no attempt to abstract over logging
|
|
57
|
+
facilities of operating systems. We expect that such abstractions will
|
|
58
|
+
be implemented at the Prolog level using multiple integrations into
|
|
59
|
+
library(debug).
|
|
60
|
+
|
|
61
|
+
@see detach_IO/1 to detach normal I/O of the process and remove it
|
|
62
|
+
from the process group.
|
|
63
|
+
@see fork/1 to create a daemon process.
|
|
64
|
+
@see library(uid) to manage user identifiers (e.g., drop root
|
|
65
|
+
privileges).
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
:- use_foreign_library(foreign(syslog)).
|
|
69
|
+
|
|
70
|
+
:- dynamic syslog/1.
|
|
71
|
+
|
|
72
|
+
%! openlog(+Ident:atom, +Options:list(atom), +Facility:atom) is det.
|
|
73
|
+
%
|
|
74
|
+
% Open system log. This predicate provides a direct interface into
|
|
75
|
+
% the openlog() library call. If the library call is successful,
|
|
76
|
+
% it runs at_halt(closelog) to ensure closing the system log on
|
|
77
|
+
% clean exit.
|
|
78
|
+
%
|
|
79
|
+
% @param Ident prepended to every message, and is typically set
|
|
80
|
+
% to the program name.
|
|
81
|
+
% @param Options is a list of options. Values are corresponding
|
|
82
|
+
% C options, after removing =LOG_= and translation to
|
|
83
|
+
% lower case: =cons=, =ndelay=, =nowait=, =odelay=,
|
|
84
|
+
% =perror=, =pid=.
|
|
85
|
+
% @param Facility is one of =auth=, =authpriv=, =cron=, =daemon=,
|
|
86
|
+
% =ftp=, =kern=, =local0= ... =local7=, =lpr=, =mail=,
|
|
87
|
+
% =news=, =syslog=, =user= or =uucp=.
|
|
88
|
+
|
|
89
|
+
openlog(Ident, Options, Facility) :-
|
|
90
|
+
'$openlog'(Ident, Options, Facility),
|
|
91
|
+
asserta(syslog(Ident)),
|
|
92
|
+
at_halt(closelog).
|
|
93
|
+
|
|
94
|
+
%! syslog(+Priority, +Message) is det.
|
|
95
|
+
%
|
|
96
|
+
% Send a message to the system log. Note that syslog/2 implicitly
|
|
97
|
+
% opens a connection to the system log if such a connection has
|
|
98
|
+
% not been opened explicitly using openlog/3.
|
|
99
|
+
%
|
|
100
|
+
% @param Priority is one of =emerg=, =alert=, =crit=, =err=,
|
|
101
|
+
% =warning=, =notice=, =info= or =debug=.
|
|
102
|
+
|
|
103
|
+
%! syslog(+Priority, +Format, +Args) is det.
|
|
104
|
+
%
|
|
105
|
+
% Send a formatted message to the system log if system logging is
|
|
106
|
+
% opened using openlog/3. This predicate combined format/3 with
|
|
107
|
+
% syslog/2. If there is no open syslog connection, syslog/3 calls
|
|
108
|
+
% print_message/2.
|
|
109
|
+
|
|
110
|
+
syslog(Priority, Format, Args) :-
|
|
111
|
+
syslog(_),
|
|
112
|
+
!,
|
|
113
|
+
format(string(Msg), Format, Args),
|
|
114
|
+
syslog(Priority, Msg).
|
|
115
|
+
syslog(Priority, Format, Args) :-
|
|
116
|
+
syslog_priority(Priority, Kind),
|
|
117
|
+
print_message(Kind, format(Format, Args)).
|
|
118
|
+
|
|
119
|
+
%! closelog is det.
|
|
120
|
+
%
|
|
121
|
+
% Close the system log.
|
|
122
|
+
|
|
123
|
+
closelog :-
|
|
124
|
+
retractall(syslog(_)),
|
|
125
|
+
'$closelog'.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/*******************************
|
|
129
|
+
* DEBUG INTEGRATION *
|
|
130
|
+
*******************************/
|
|
131
|
+
|
|
132
|
+
:- multifile
|
|
133
|
+
prolog:debug_print_hook/3.
|
|
134
|
+
|
|
135
|
+
%! prolog:debug_print_hook(+Topic, +Format, +Args) is semidet.
|
|
136
|
+
%
|
|
137
|
+
% Integration of debug/3 with the syslog facility. If syslog is
|
|
138
|
+
% enabled, debug/3 is re-routed to use the syslog facilities. If
|
|
139
|
+
% the _topic_ of the debug message matches one of the sylog
|
|
140
|
+
% _priority_ values (see syslog/2), the message is sent with the
|
|
141
|
+
% corresponding syslog priority. Otherwise it it sent with the
|
|
142
|
+
% =debug= priority.
|
|
143
|
+
|
|
144
|
+
prolog:debug_print_hook(Topic, Format, Args) :-
|
|
145
|
+
syslog(_),
|
|
146
|
+
debug_priority(Topic, Priority),
|
|
147
|
+
syslog(Priority, Format, Args).
|
|
148
|
+
|
|
149
|
+
debug_priority(Topic, Priority) :-
|
|
150
|
+
( syslog_priority(Topic, _Kind)
|
|
151
|
+
-> Priority = Topic
|
|
152
|
+
; Priority = debug
|
|
153
|
+
).
|
|
154
|
+
|
|
155
|
+
syslog_priority(emerg, error).
|
|
156
|
+
syslog_priority(alert, warning).
|
|
157
|
+
syslog_priority(crit, error).
|
|
158
|
+
syslog_priority(err, error).
|
|
159
|
+
syslog_priority(warning, warning).
|
|
160
|
+
syslog_priority(notice, informational).
|
|
161
|
+
syslog_priority(info, informational).
|
|
162
|
+
syslog_priority(debug, debug).
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
/*******************************
|
|
166
|
+
* MESSAGE INTEGRATION *
|
|
167
|
+
*******************************/
|
|
168
|
+
|
|
169
|
+
user:message_hook(Term, Kind, _) :-
|
|
170
|
+
syslog(_),
|
|
171
|
+
kind_syslog_priority(Kind, Level),
|
|
172
|
+
message_to_string(Term, Message),
|
|
173
|
+
atomic_list_concat(Lines, '\n', Message),
|
|
174
|
+
forall(member(Line, Lines),
|
|
175
|
+
syslog(Level, Line)),
|
|
176
|
+
fail.
|
|
177
|
+
|
|
178
|
+
kind_syslog_priority(error, err).
|
|
179
|
+
kind_syslog_priority(warning, warning).
|
|
180
|
+
kind_syslog_priority(informational, info).
|
|
@@ -0,0 +1,194 @@
|
|
|
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) 2002-2023, University of Amsterdam
|
|
7
|
+
VU University Amsterdam
|
|
8
|
+
CWI, Amsterdam
|
|
9
|
+
SWI-Prolog Solutions b.v.
|
|
10
|
+
All rights reserved.
|
|
11
|
+
|
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
|
13
|
+
modification, are permitted provided that the following conditions
|
|
14
|
+
are met:
|
|
15
|
+
|
|
16
|
+
1. Redistributions of source code must retain the above copyright
|
|
17
|
+
notice, this list of conditions and the following disclaimer.
|
|
18
|
+
|
|
19
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
20
|
+
notice, this list of conditions and the following disclaimer in
|
|
21
|
+
the documentation and/or other materials provided with the
|
|
22
|
+
distribution.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
25
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
26
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
27
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
28
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
29
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
30
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
31
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
32
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
33
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
34
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
35
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
:- module(time,
|
|
39
|
+
[ alarm/3, % +Time, :Callable, -Id
|
|
40
|
+
alarm/4, % +Time, :Callable, -Id, +Options
|
|
41
|
+
alarm_at/3, % +Time, :Callable, -Id
|
|
42
|
+
alarm_at/4, % +Time, :Callable, -Id, +Options
|
|
43
|
+
remove_alarm/1, % +Id
|
|
44
|
+
install_alarm/1, % +Id
|
|
45
|
+
install_alarm/2, % +Id, +Time
|
|
46
|
+
uninstall_alarm/1, % +Id
|
|
47
|
+
current_alarm/4, % ?At, ?:Goal, ?Id, ?Status
|
|
48
|
+
call_with_time_limit/2, % +Time, :Callable
|
|
49
|
+
call_with_time_limit/3 % +Time, :Callable, +Context
|
|
50
|
+
]).
|
|
51
|
+
:- autoload(library(lists),[member/2]).
|
|
52
|
+
|
|
53
|
+
:- set_prolog_flag(generate_debug_info, false).
|
|
54
|
+
|
|
55
|
+
:- meta_predicate
|
|
56
|
+
call_with_time_limit(+, 0),
|
|
57
|
+
call_with_time_limit(+, 0, +),
|
|
58
|
+
alarm(+, 0, -),
|
|
59
|
+
alarm(+, 0, -, +),
|
|
60
|
+
alarm_at(+, 0, -, +),
|
|
61
|
+
current_alarm(?, :, ?, ?).
|
|
62
|
+
|
|
63
|
+
:- predicate_options(alarm/4, 4,
|
|
64
|
+
[ remove(boolean),
|
|
65
|
+
install(boolean)
|
|
66
|
+
]).
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/** <module> Time and alarm library
|
|
70
|
+
|
|
71
|
+
The library(time) provides timing and alarm functions. Alarms are
|
|
72
|
+
thread-specific, i.e., creating an alarm causes the alarm goal to be
|
|
73
|
+
called in the thread that created it. The predicate current_alarm/4 only
|
|
74
|
+
reports alarms that are related to the calling thread. If a thread
|
|
75
|
+
terminates, all remaining alarms are silently removed. Most applications
|
|
76
|
+
use call_with_time_limit/2.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
%! alarm(+Time, :Callable, -Id) is det.
|
|
80
|
+
%! alarm(+Time, :Callable, -Id, +Options) is det.
|
|
81
|
+
%
|
|
82
|
+
% Set up an alarm to be signaled Time seconds from now. If the
|
|
83
|
+
% alarm expires, Callable is called asynchronously. Callable can
|
|
84
|
+
% be used to raise an exception using throw/1 to abort some
|
|
85
|
+
% execution.
|
|
86
|
+
%
|
|
87
|
+
% Options is a list of Name(Value) options. Currently defined
|
|
88
|
+
% options are:
|
|
89
|
+
%
|
|
90
|
+
% * remove(Bool)
|
|
91
|
+
% If =true= (default =false=), remove the alarm-event (as
|
|
92
|
+
% remove_alarm/1) after it has been fired.
|
|
93
|
+
% * install(Bool)
|
|
94
|
+
% If =false= (default =true=) do not install the alarm.
|
|
95
|
+
% It must be installed separately using install_alarm/1.
|
|
96
|
+
|
|
97
|
+
%! alarm_at(+Time, :Callable, -Id) is det.
|
|
98
|
+
%! alarm_at(+Time, :Callable, -Id, +Options) is det.
|
|
99
|
+
%
|
|
100
|
+
% As alarm/3 and alarm/4, but schedule the alarm at an absolute
|
|
101
|
+
% point in time.
|
|
102
|
+
%
|
|
103
|
+
% @see date_time_stamp/2.
|
|
104
|
+
|
|
105
|
+
%! install_alarm(+Id) is det.
|
|
106
|
+
%! install_alarm(+Id, +RelTime) is det.
|
|
107
|
+
%
|
|
108
|
+
% Install an alarm allocated using alarm/4 with the install(false)
|
|
109
|
+
% option or de-activated using uninstall_alarm/1. With a given
|
|
110
|
+
% RelTime, the alarm is scheduled at the RelTime from now.
|
|
111
|
+
% Otherwise it is scheduled on the same (absolute) time on which
|
|
112
|
+
% is was created.
|
|
113
|
+
|
|
114
|
+
%! uninstall_alarm(+Id) is det.
|
|
115
|
+
%
|
|
116
|
+
% De-activate an alarm. This does _not_ invalidate Id, but ensures
|
|
117
|
+
% that the alarm will not fire. The alarm can be rescheduled to
|
|
118
|
+
% the original time using install_alarm/1 or to a new time using
|
|
119
|
+
% install_alarm/2.
|
|
120
|
+
|
|
121
|
+
%! remove_alarm(+Id) is det.
|
|
122
|
+
%
|
|
123
|
+
% Remove an alarm. If it has not yet been fired, it never will.
|
|
124
|
+
|
|
125
|
+
%! current_alarm(?Time, :Goal, ?Id, ?Status) is nondet.
|
|
126
|
+
%
|
|
127
|
+
% Enumerate the alarms in the schedule. Time is the absolute time
|
|
128
|
+
% the event is scheduled for (see also get_time/1). Goal is the
|
|
129
|
+
% goal to execute, Id is the identifier and Status is the
|
|
130
|
+
% scheduling status. It takes the value =done= if the alarm has
|
|
131
|
+
% been fired, =next= if the event is the next to be executed and
|
|
132
|
+
% =scheduled= otherwise.
|
|
133
|
+
|
|
134
|
+
:- use_foreign_library(foreign(time)).
|
|
135
|
+
:- public time_debug/1. % set debugging
|
|
136
|
+
|
|
137
|
+
%! call_with_time_limit(+Time, :Goal) is det.
|
|
138
|
+
%! call_with_time_limit(+Time, :Goal, +Context) is det.
|
|
139
|
+
%
|
|
140
|
+
% Call Goal, while watching out for a (wall-time) limit. If this limit
|
|
141
|
+
% is exceeded, the exception `time_limit_exceeded` is raised.
|
|
142
|
+
% call_with_time_limit/3 throws time_limit_exceeded(Context). Goal is
|
|
143
|
+
% called as in once/1.
|
|
144
|
+
%
|
|
145
|
+
% @throws `time_limit_exceeded` (call_with_time_limit/2) or
|
|
146
|
+
% time_limit_exceeded(Context) (call_with_time_limit/3).
|
|
147
|
+
|
|
148
|
+
call_with_time_limit(Time, Goal) :-
|
|
149
|
+
call_with_time_limit(Time, Goal, '$no_ctx').
|
|
150
|
+
|
|
151
|
+
call_with_time_limit(Time, Goal, Ctx) :-
|
|
152
|
+
Time > 0,
|
|
153
|
+
!,
|
|
154
|
+
setup_call_cleanup(alarm(Time, time_limit_exceeded(Time, Ctx),
|
|
155
|
+
Id, [install(false)]),
|
|
156
|
+
run_alarm_goal(Id, Goal),
|
|
157
|
+
remove_alarm_notrace(Id)).
|
|
158
|
+
call_with_time_limit(_Time, _Goal, _Ctx) :-
|
|
159
|
+
throw(time_limit_exceeded).
|
|
160
|
+
|
|
161
|
+
run_alarm_goal(AlarmID, Goal) :-
|
|
162
|
+
install_alarm(AlarmID),
|
|
163
|
+
Goal,
|
|
164
|
+
!.
|
|
165
|
+
|
|
166
|
+
time_limit_exceeded(_Time, Ctx) :-
|
|
167
|
+
( Ctx == '$no_ctx'
|
|
168
|
+
-> throw(time_limit_exceeded)
|
|
169
|
+
; throw(time_limit_exceeded(Ctx))
|
|
170
|
+
).
|
|
171
|
+
|
|
172
|
+
current_alarm(Time, Goal, Id, Status) :-
|
|
173
|
+
current_alarms(Time, Goal, Id, Status, List),
|
|
174
|
+
member(alarm(Time, Goal, Id, Status), List).
|
|
175
|
+
|
|
176
|
+
/*******************************
|
|
177
|
+
* HANDLE MESSAGES *
|
|
178
|
+
*******************************/
|
|
179
|
+
|
|
180
|
+
:- multifile
|
|
181
|
+
prolog:message/3.
|
|
182
|
+
|
|
183
|
+
prolog:message(time_limit_exceeded) -->
|
|
184
|
+
[ 'Time limit exceeded' ].
|
|
185
|
+
prolog:message(time_limit_exceeded(Context)) -->
|
|
186
|
+
[ 'Time limit exceeded: ~p'-[Context] ].
|
|
187
|
+
|
|
188
|
+
/*******************************
|
|
189
|
+
* ALARM *
|
|
190
|
+
*******************************/
|
|
191
|
+
|
|
192
|
+
:- multifile sandbox:safe_meta_predicate/1.
|
|
193
|
+
|
|
194
|
+
sandbox:safe_meta_predicate(time:call_with_time_limit/2).
|