]> Repositorios git - scryer-prolog.git/commitdiff
Allowing paths in use_module(library(..)) (#604)
authornotoria <[email protected]>
Wed, 1 Jul 2020 08:22:17 +0000 (10:22 +0200)
committernotoria <[email protected]>
Wed, 1 Jul 2020 08:22:17 +0000 (10:22 +0200)
In a module, the path is restricted in being an atom.

Cargo.lock
build.rs
src/lib/tabling.pl
src/lib/tabling/batched_worklist.pl
src/lib/tabling/table_data_structure.pl
src/lib/tabling/table_link_manager.pl
src/machine/compile.rs
src/machine/mod.rs
src/toplevel.pl

index 086a638e7f788e4dbdeeb2beeff70f17bcd82a56..41c90cbd81ad9735532ae8ca9c76a601a97084f8 100644 (file)
@@ -27,6 +27,12 @@ version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
 
+[[package]]
+name = "autocfg"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
+
 [[package]]
 name = "autocfg"
 version = "1.0.0"
@@ -45,6 +51,21 @@ version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
 
+[[package]]
+name = "bit-set"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
+dependencies = [
+ "bit-vec",
+]
+
+[[package]]
+name = "bit-vec"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3"
+
 [[package]]
 name = "bitflags"
 version = "1.2.1"
@@ -183,7 +204,7 @@ version = "0.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
  "cfg-if",
  "lazy_static",
 ]
@@ -281,6 +302,12 @@ version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
 
+[[package]]
+name = "fuchsia-cprng"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
+
 [[package]]
 name = "fuchsia-zircon"
 version = "0.3.3"
@@ -297,6 +324,16 @@ version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 
+[[package]]
+name = "futf"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b"
+dependencies = [
+ "mac",
+ "new_debug_unreachable",
+]
+
 [[package]]
 name = "generic-array"
 version = "0.12.3"
@@ -334,9 +371,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
 dependencies = [
  "proc-macro-hack",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "syn 1.0.18",
 ]
 
 [[package]]
@@ -360,13 +397,27 @@ dependencies = [
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "html5ever"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7"
+dependencies = [
+ "log",
+ "mac",
+ "markup5ever",
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "syn 0.15.44",
+]
+
 [[package]]
 name = "indexmap"
 version = "1.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
 ]
 
 [[package]]
@@ -378,6 +429,12 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "itoa"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
+
 [[package]]
 name = "js-sys"
 version = "0.3.39"
@@ -457,6 +514,29 @@ dependencies = [
  "cfg-if",
 ]
 
+[[package]]
+name = "mac"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
+
+[[package]]
+name = "markup5ever"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1af46a727284117e09780d05038b1ce6fc9c76cc6df183c3dae5a8955a25e21"
+dependencies = [
+ "log",
+ "phf",
+ "phf_codegen",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "string_cache",
+ "string_cache_codegen",
+ "tendril",
+]
+
 [[package]]
 name = "match_cfg"
 version = "0.1.0"
@@ -535,6 +615,12 @@ dependencies = [
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "new_debug_unreachable"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
+
 [[package]]
 name = "nix"
 version = "0.15.0"
@@ -573,7 +659,7 @@ version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
  "num-integer",
  "num-traits 0.2.11",
 ]
@@ -584,7 +670,7 @@ version = "0.1.42"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
  "num-traits 0.2.11",
 ]
 
@@ -594,7 +680,7 @@ version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
  "num-bigint",
  "num-integer",
  "num-traits 0.2.11",
@@ -628,7 +714,7 @@ version = "0.2.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
 ]
 
 [[package]]
@@ -678,7 +764,7 @@ version = "0.9.58"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de"
 dependencies = [
- "autocfg",
+ "autocfg 1.0.0",
  "cc",
  "libc",
  "openssl-src",
@@ -720,6 +806,44 @@ dependencies = [
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "phf"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
+dependencies = [
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_codegen"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e"
+dependencies = [
+ "phf_generator",
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_generator"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
+dependencies = [
+ "phf_shared",
+ "rand 0.6.5",
+]
+
+[[package]]
+name = "phf_shared"
+version = "0.7.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
+dependencies = [
+ "siphasher",
+]
+
 [[package]]
 name = "pkg-config"
 version = "0.3.17"
@@ -732,19 +856,34 @@ version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
 
+[[package]]
+name = "precomputed-hash"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
+
 [[package]]
 name = "proc-macro-hack"
 version = "0.5.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63"
 
+[[package]]
+name = "proc-macro2"
+version = "0.4.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
+dependencies = [
+ "unicode-xid 0.1.0",
+]
+
 [[package]]
 name = "proc-macro2"
 version = "1.0.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3"
 dependencies = [
- "unicode-xid",
+ "unicode-xid 0.2.0",
 ]
 
 [[package]]
@@ -760,13 +899,41 @@ dependencies = [
  "unicode_reader",
 ]
 
+[[package]]
+name = "quote"
+version = "0.6.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
+dependencies = [
+ "proc-macro2 0.4.30",
+]
+
 [[package]]
 name = "quote"
 version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
 dependencies = [
- "proc-macro2",
+ "proc-macro2 1.0.10",
+]
+
+[[package]]
+name = "rand"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
+dependencies = [
+ "autocfg 0.1.7",
+ "libc",
+ "rand_chacha 0.1.1",
+ "rand_core 0.4.2",
+ "rand_hc 0.1.0",
+ "rand_isaac",
+ "rand_jitter",
+ "rand_os",
+ "rand_pcg",
+ "rand_xorshift",
+ "winapi 0.3.8",
 ]
 
 [[package]]
@@ -777,9 +944,19 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
 dependencies = [
  "getrandom",
  "libc",
- "rand_chacha",
- "rand_core",
- "rand_hc",
+ "rand_chacha 0.2.2",
+ "rand_core 0.5.1",
+ "rand_hc 0.2.0",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
+dependencies = [
+ "autocfg 0.1.7",
+ "rand_core 0.3.1",
 ]
 
 [[package]]
@@ -789,9 +966,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
 dependencies = [
  "ppv-lite86",
- "rand_core",
+ "rand_core 0.5.1",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
+dependencies = [
+ "rand_core 0.4.2",
 ]
 
+[[package]]
+name = "rand_core"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
+
 [[package]]
 name = "rand_core"
 version = "0.5.1"
@@ -801,13 +993,84 @@ dependencies = [
  "getrandom",
 ]
 
+[[package]]
+name = "rand_hc"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
 [[package]]
 name = "rand_hc"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
 dependencies = [
- "rand_core",
+ "rand_core 0.5.1",
+]
+
+[[package]]
+name = "rand_isaac"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
+[[package]]
+name = "rand_jitter"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
+dependencies = [
+ "libc",
+ "rand_core 0.4.2",
+ "winapi 0.3.8",
+]
+
+[[package]]
+name = "rand_os"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
+dependencies = [
+ "cloudabi",
+ "fuchsia-cprng",
+ "libc",
+ "rand_core 0.4.2",
+ "rdrand",
+ "winapi 0.3.8",
+]
+
+[[package]]
+name = "rand_pcg"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
+dependencies = [
+ "autocfg 0.1.7",
+ "rand_core 0.4.2",
+]
+
+[[package]]
+name = "rand_xorshift"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
+dependencies = [
+ "rand_core 0.3.1",
+]
+
+[[package]]
+name = "rdrand"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
+dependencies = [
+ "rand_core 0.3.1",
 ]
 
 [[package]]
@@ -868,6 +1131,15 @@ dependencies = [
  "opaque-debug",
 ]
 
+[[package]]
+name = "roxmltree"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5001f134077069d87f77c8b9452b690df2445f7a43f1c7ca4a1af8dd505789d"
+dependencies = [
+ "xmlparser",
+]
+
 [[package]]
 name = "rug"
 version = "1.8.0"
@@ -966,8 +1238,10 @@ dependencies = [
  "ref_thread_local",
  "ring",
  "ripemd160",
+ "roxmltree",
  "rug",
  "rustyline",
+ "select",
  "sha3",
  "unicode_reader",
 ]
@@ -995,6 +1269,16 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "select"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac645958c62108d11f90f8d34e4dc2799c838fc995ed4c2075867a2a8d5be76b"
+dependencies = [
+ "bit-set",
+ "html5ever",
+]
+
 [[package]]
 name = "semver"
 version = "0.9.0"
@@ -1010,6 +1294,34 @@ version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
 
+[[package]]
+name = "serde"
+version = "1.0.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
+
+[[package]]
+name = "serde_derive"
+version = "1.0.113"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93c5eaa17d0954cb481cdcfffe9d84fcfa7a1a9f2349271e678677be4c26ae31"
+dependencies = [
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "syn 1.0.18",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.55"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
 [[package]]
 name = "sha3"
 version = "0.8.2"
@@ -1044,6 +1356,12 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "siphasher"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
+
 [[package]]
 name = "slab"
 version = "0.4.2"
@@ -1077,21 +1395,66 @@ version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3"
 
+[[package]]
+name = "string_cache"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89c058a82f9fd69b1becf8c274f412281038877c553182f1d02eb027045a2d67"
+dependencies = [
+ "lazy_static",
+ "new_debug_unreachable",
+ "phf_shared",
+ "precomputed-hash",
+ "serde",
+ "string_cache_codegen",
+ "string_cache_shared",
+]
+
+[[package]]
+name = "string_cache_codegen"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6"
+dependencies = [
+ "phf_generator",
+ "phf_shared",
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "string_cache_shared",
+]
+
+[[package]]
+name = "string_cache_shared"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
+
 [[package]]
 name = "subtle"
 version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
 
+[[package]]
+name = "syn"
+version = "0.15.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
+dependencies = [
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "unicode-xid 0.1.0",
+]
+
 [[package]]
 name = "syn"
 version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213"
 dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "unicode-xid 0.2.0",
 ]
 
 [[package]]
@@ -1102,12 +1465,23 @@ checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
 dependencies = [
  "cfg-if",
  "libc",
- "rand",
+ "rand 0.7.3",
  "redox_syscall",
  "remove_dir_all",
  "winapi 0.3.8",
 ]
 
+[[package]]
+name = "tendril"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "707feda9f2582d5d680d733e38755547a3e8fb471e7ba11452ecfd9ce93a5d3b"
+dependencies = [
+ "futf",
+ "mac",
+ "utf-8",
+]
+
 [[package]]
 name = "time"
 version = "0.1.43"
@@ -1136,6 +1510,12 @@ version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
 
+[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
+
 [[package]]
 name = "unicode-xid"
 version = "0.2.0"
@@ -1167,6 +1547,12 @@ version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 
+[[package]]
+name = "utf-8"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
+
 [[package]]
 name = "utf8parse"
 version = "0.2.0"
@@ -1210,9 +1596,9 @@ dependencies = [
  "bumpalo",
  "lazy_static",
  "log",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "syn 1.0.18",
  "wasm-bindgen-shared",
 ]
 
@@ -1222,7 +1608,7 @@ version = "0.2.62"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776"
 dependencies = [
- "quote",
+ "quote 1.0.3",
  "wasm-bindgen-macro-support",
 ]
 
@@ -1232,9 +1618,9 @@ version = "0.2.62"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a"
 dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.10",
+ "quote 1.0.3",
+ "syn 1.0.18",
  "wasm-bindgen-backend",
  "wasm-bindgen-shared",
 ]
@@ -1298,3 +1684,9 @@ dependencies = [
  "winapi 0.2.8",
  "winapi-build",
 ]
+
+[[package]]
+name = "xmlparser"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52613e655f6f11f63c0fe7d1c3b5ef69e44d96df9b65dab296b441ed0e1125f5"
index b8a5d2246dbe574b52f8a05fb033785546148fbb..a9ec444e45f0e0ab54109bd8462f9f6b2c44b6ac 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -1,60 +1,55 @@
 extern crate indexmap;
 
-use crate::indexmap::IndexSet;
-
 use std::env;
-use std::fs::{File, copy, read_dir};
+use std::fs;
+use std::fs::File;
 use std::io::Write;
 use std::path::Path;
 
-fn main()
-{
-    let out_dir = env::var("OUT_DIR").unwrap();
-    let dest_path = Path::new(&out_dir).join("libraries.rs");
-
-    let mut libraries = File::create(&dest_path).unwrap();
-    let mut library_index = IndexSet::new();
-
-    let paths = read_dir("./src/lib").unwrap();
-
-    for item in paths {
-        let item = item.unwrap().path();
-
-        if let Some(file_name) = item.file_name() {
-            if let Some(ext) = item.extension() {
-                if ext == "pl" {
-                    let file_stem = item.file_stem().unwrap();
-                    let file_str  = file_stem.to_string_lossy().to_uppercase();
-                    let dest = Path::new(&out_dir).join(file_name);
-
-                    match copy(&item, dest) {
-                        Ok(_) => {},
-                        Err(e) => panic!("die: {:?}", e)
-                    };
-
-                    let include_line = format!("static {}: &str = include_str!(\"{}.pl\");\n",
-                                               file_str, file_stem.to_string_lossy());
-
-                    libraries.write_all(include_line.as_bytes()).unwrap();
-                    library_index.insert(file_stem.to_string_lossy().to_string());
-                }
+fn find_prolog_files(libraries: &mut File, prefix: &str, current_dir: &Path) {
+    let entries = match current_dir.read_dir() {
+        Ok(entries) => entries,
+        Err(_) => return,
+    };
+    for entry in entries.filter_map(Result::ok).map(|e| e.path()) {
+        if entry.is_dir() {
+            if let Some(file_name) = entry.file_name() {
+                let new_prefix =
+                    prefix.to_owned() + file_name.to_str().unwrap() + "/";
+                find_prolog_files(libraries, &new_prefix, &entry);
+            }
+        } else if entry.is_file() {
+            let ext = std::ffi::OsStr::new("pl");
+            if entry.extension() == Some(ext) {
+                let contain =
+                    String::from_utf8(fs::read(&entry).unwrap()).unwrap();
+                let name = entry.file_stem().unwrap().to_str().unwrap();
+                let line = format!(
+                    "        m.insert(\"{}\",\n{:?});\n",
+                    prefix.to_owned() + name,
+                    contain
+                );
+
+                libraries.write_all(line.as_bytes()).unwrap();
             }
         }
     }
+}
 
-    libraries.write_all(b"\nref_thread_local! {
-    pub static managed LIBRARIES: IndexMap<&'static str, &'static str> = {
-        let mut m = IndexMap::new();\n").unwrap();
-
-    for item in library_index {
-        let line = format!("\n        m.insert(\"{}\", {});", item, item.to_uppercase());
-        libraries.write_all(line.as_bytes()).unwrap();
-    }
+fn main() {
+    let out_dir = env::var("OUT_DIR").unwrap();
+    let dest_path = Path::new(&out_dir).join("libraries.rs");
 
-    libraries.write_all(b"\n\n        m\n    };
-}\n").unwrap();
+    let mut libraries = File::create(&dest_path).unwrap();
+    let lib_path = Path::new("src/lib");
 
-    libraries.write_all(b"\npub static PROJECT_DIR: &'static str = \"").unwrap();
-    libraries.write_all(env::var("CARGO_MANIFEST_DIR").unwrap().as_bytes()).unwrap();
-    libraries.write_all(b"\";\n").unwrap();
+    libraries
+        .write_all(
+            b"ref_thread_local! {
+    pub static managed LIBRARIES: IndexMap<&'static str, &'static str> = {
+        let mut m = IndexMap::new();\n",
+        )
+        .unwrap();
+    find_prolog_files(&mut libraries, "", &lib_path);
+    libraries.write_all(b"\n        m\n    };\n}\n").unwrap();
 }
index 8f2b79d265719bfe1116b88d9c29e8803a65f7f1..dfe4c429113474fdf257cfd4fb95e8d5eafddb49 100644 (file)
@@ -8,12 +8,12 @@
            op(1150, fx, table)
          ]).
 
-:- use_module('tabling/double_linked_list').
-:- use_module('tabling/table_data_structure').
-:- use_module('tabling/batched_worklist').
-:- use_module('tabling/wrapper').
-:- use_module('tabling/global_worklist').
-:- use_module('tabling/table_link_manager').
+:- use_module(library('tabling/double_linked_list')).
+:- use_module(library('tabling/table_data_structure')).
+:- use_module(library('tabling/batched_worklist')).
+:- use_module(library('tabling/wrapper')).
+:- use_module(library('tabling/global_worklist')).
+:- use_module(library('tabling/table_link_manager')).
 
 :- use_module(library(cont)).
 :- use_module(library(lists)).
index 36a67c1626d86f692a263ab4e1ed1fff0e3b185e..7cef4f13d636de84ea148a48146bb90cf768732e 100644 (file)
@@ -45,8 +45,8 @@
            wkl_worklist_work_done/1                    % +WorkList
          ]).
 
-:- use_module(global_worklist).
-:- use_module(double_linked_list).
+:- use_module(library('tabling/global_worklist')).
+:- use_module(library('tabling/double_linked_list')).
 
 :- use_module(library(atts)).
 :- use_module(library(lists)).
index b4fc6121b2245279100748744fdbb73005eb9565..107a7a00b69cc4eeb42325fbe010f2df79d2ec22 100644 (file)
@@ -15,8 +15,8 @@
            get_nb_identifiers/3                % +Table, -NbWorklistID, -NbAnswerTreeID
          ]).
 
-:- use_module(table_link_manager).
-:- use_module(trie).
+:- use_module(library('tabling/table_link_manager')).
+:- use_module(library('tabling/trie')).
 
 /*  Part of SWI-Prolog
 
@@ -53,7 +53,7 @@
     POSSIBILITY OF SUCH DAMAGE.
 */
 
-:- use_module(batched_worklist).
+:- use_module(library('tabling/batched_worklist')).
 
 :- use_module(library(atts)).
 :- use_module(library(gensym)).
index c688d0cde409aa98d1ef96e7d046d9c7b3f23ef0..1195680c864efcae4081fca40e345de3ae18b76e 100644 (file)
@@ -47,7 +47,7 @@
 :- use_module(library(iso_ext)).
 :- use_module(library(terms)).
 
-:- use_module(trie).
+:- use_module(library('tabling/trie')).
 
 :- attribute trie_table_link/1.
 
index 517c4a9447d177068aee41b2972b903d97cebcf1..36544ebab9e605ef0c87e54a5ba8916001e41b6c 100644 (file)
@@ -602,12 +602,7 @@ fn load_library(
 ) -> Result<ClauseName, SessionError> {
     match LIBRARIES.borrow().get(name.as_str()) {
         Some(code) => {
-            let mut lib_path = current_dir();
-
-            lib_path.pop();
-            lib_path.push("lib");
-
-            let listing_src = ListingSource::from_file_and_path(name, lib_path);
+            let listing_src = ListingSource::User;
 
             load_module(
                 wam,
index cf44a693eef2e3969ec9cfb563cd29076c0a8b3e..365b201e50f47798795976719162a9508675822f 100644 (file)
@@ -212,17 +212,6 @@ impl SubModuleUser for IndexStore {
     }
 }
 
-#[inline]
-fn current_dir() -> std::path::PathBuf {
-    let mut path_buf = std::path::PathBuf::from(PROJECT_DIR);
-
-    // file!() always produces a path relative to PROJECT_DIR.
-    path_buf = path_buf.join(std::path::PathBuf::from(file!()));
-
-    path_buf.pop();
-    path_buf
-}
-
 include!(concat!(env!("OUT_DIR"), "/libraries.rs"));
 
 static TOPLEVEL: &str = include_str!("../toplevel.pl");
@@ -230,12 +219,7 @@ static TOPLEVEL: &str = include_str!("../toplevel.pl");
 impl Machine {
     fn compile_special_forms(&mut self)
     {
-        let current_dir = current_dir();
-
-        let verify_attrs_src = ListingSource::from_file_and_path(
-            clause_name!("attributed_variables.pl"),
-            current_dir.clone(),
-        );
+        let verify_attrs_src = ListingSource::User;
 
         match compile_special_form(
             self,
@@ -250,10 +234,7 @@ impl Machine {
                 panic!("Machine::compile_special_forms() failed at VERIFY_ATTRS"),
         }
 
-        let project_attrs_src = ListingSource::from_file_and_path(
-            clause_name!("project_attributes.pl"),
-            current_dir,
-        );
+        let project_attrs_src = ListingSource::User;
 
         match compile_special_form(
             self,
@@ -273,13 +254,7 @@ impl Machine {
     {
         self.toplevel_idx = self.code_repo.code.len();
 
-        let mut current_dir = current_dir();
-        current_dir.pop();
-
-        let top_lvl_src = ListingSource::from_file_and_path(
-            clause_name!("toplevel.pl"),
-            current_dir,
-        );
+        let top_lvl_src = ListingSource::User;
 
         compile_user_module(
             self,
@@ -371,6 +346,8 @@ impl Machine {
 
     pub fn new(current_input_stream: Stream, current_output_stream: Stream) -> Self
     {
+        use crate::ref_thread_local::RefThreadLocal;
+
         let mut wam = Machine {
             machine_st: MachineState::new(),
             inner_heap: Heap::new(),
@@ -383,78 +360,59 @@ impl Machine {
         };
 
         let atom_tbl = wam.indices.atom_tbl.clone();
-        let mut lib_path = current_dir();
-
-        lib_path.pop();
-        lib_path.push("lib");
 
         wam.indices.add_term_and_goal_expansion_indices();
 
         compile_listing(
             &mut wam,
-            Stream::from(BUILTINS),
+            Stream::from(LIBRARIES.borrow()["builtins"]),
             default_index_store!(atom_tbl.clone()),
             true,
-            ListingSource::from_file_and_path(
-                clause_name!("builtins.pl"),
-                lib_path.clone(),
-            ),
+            ListingSource::User,
         );
 
         wam.compile_special_forms();
 
-        compile_user_module(&mut wam,
-                            Stream::from(ERROR),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("error"),
-                                lib_path.clone(),
-                            )
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["error"]),
+            true,
+            ListingSource::User,
         );
 
-        compile_user_module(&mut wam,
-                            Stream::from(PAIRS),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("pairs"),
-                                lib_path.clone(),
-                            )
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["pairs"]),
+            true,
+            ListingSource::User,
         );
 
-        compile_user_module(&mut wam,
-                            Stream::from(LISTS),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("lists"),
-                                lib_path.clone(),
-                            ),
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["lists"]),
+            true,
+            ListingSource::User,
         );
 
-        compile_user_module(&mut wam,
-                            Stream::from(ISO_EXT),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("iso_ext"),
-                                lib_path.clone(),
-                            )
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["iso_ext"]),
+            true,
+            ListingSource::User,
         );
 
-        compile_user_module(&mut wam,
-                            Stream::from(SI),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("si"),
-                                lib_path.clone(),
-                            )
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["si"]),
+            true,
+            ListingSource::User,
         );
 
-        compile_user_module(&mut wam,
-                            Stream::from(CHARSIO),
-                            true,
-                            ListingSource::from_file_and_path(
-                                clause_name!("si"),
-                                lib_path.clone(),
-                            )
+        compile_user_module(
+            &mut wam,
+            Stream::from(LIBRARIES.borrow()["charsio"]),
+            true,
+            ListingSource::User,
         );
 
         if wam.compile_top_level().is_err() {
@@ -681,8 +639,15 @@ impl Machine {
                     name.clone(),
                 HeapCellValue::Addr(Addr::Char(c)) =>
                     clause_name!(c.to_string(), self.indices.atom_tbl),
-                   _ =>
-                    unreachable!(),
+                HeapCellValue::Addr(addr @ Addr::PStrLocation(..)) => {
+                    let mut heap_pstr_iter =
+                        self.machine_st.heap_pstr_iter(*addr);
+                    clause_name!(
+                        heap_pstr_iter.to_string(),
+                        self.indices.atom_tbl
+                    )
+                }
+                _ => unreachable!(),
             }
            };
 
index f07b30d48bcb33cd631cfaffaaf5e0fd8c91ae2f..23e7decd95b7a4b8a92c2e86a8ce97dd44cf0904 100644 (file)
@@ -387,8 +387,11 @@ consult(Item) :-
 
 use_module(Module) :-
     (  nonvar(Module) ->
-       (  Module = library(Filename) -> '$use_module'(Filename)
-       ;  atom(Module) -> '$use_module_from_file'(Module)
+       (  Module = library(Filename) ->
+          write_term_to_chars(Filename, [], FilenameString),
+          '$use_module'(FilenameString)
+       ;  atom(Module) ->
+          '$use_module_from_file'(Module)
        ;  throw(error(invalid_module_specifier, use_module/1))
        )
     ;  throw(error(instantiation_error, use_module/1))
@@ -399,7 +402,8 @@ use_module(Module, QualifiedExports) :-
        (  list_si(QualifiedExports) ->
              maplist('$module_export'(use_module/2), QualifiedExports) ->
                  (  Module = library(Filename) ->
-                    '$use_qualified_module'(Filename, QualifiedExports)
+                 write_term_to_chars(Filename, [], FilenameString),
+                    '$use_qualified_module'(FilenameString, QualifiedExports)
                  ;  atom(Module) ->
                     '$use_qualified_module_from_file'(Module, QualifiedExports)
                  ;  throw(error(invalid_module_specifier, use_module/2))