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.
Files changed (550) hide show
  1. package/README.md +29 -0
  2. package/bin/swipl +0 -0
  3. package/bin/swipl-win +0 -0
  4. package/build-manifest.json +70 -0
  5. package/lib/cmake/swipl/SWIPLConfig.cmake +21 -0
  6. package/lib/cmake/swipl/SWIPLConfigVersion.cmake +65 -0
  7. package/lib/cmake/swipl/SWIPLTargets-release.cmake +28 -0
  8. package/lib/cmake/swipl/SWIPLTargets.cmake +109 -0
  9. package/lib/swipl/ABI +1 -0
  10. package/lib/swipl/LICENSE +41 -0
  11. package/lib/swipl/README.md +116 -0
  12. package/lib/swipl/app/README.md +25 -0
  13. package/lib/swipl/app/app.pl +87 -0
  14. package/lib/swipl/app/pack.pl +350 -0
  15. package/lib/swipl/app/qlf.pl +521 -0
  16. package/lib/swipl/app/splfr.pl +177 -0
  17. package/lib/swipl/app/sys.pl +310 -0
  18. package/lib/swipl/bin/swipl.home +1 -0
  19. package/lib/swipl/boot/apply.pl +73 -0
  20. package/lib/swipl/boot/attvar.pl +344 -0
  21. package/lib/swipl/boot/autoload.pl +1226 -0
  22. package/lib/swipl/boot/bags.pl +283 -0
  23. package/lib/swipl/boot/dcg.pl +388 -0
  24. package/lib/swipl/boot/dicts.pl +193 -0
  25. package/lib/swipl/boot/dwim.pl +485 -0
  26. package/lib/swipl/boot/engines.pl +152 -0
  27. package/lib/swipl/boot/expand.pl +1628 -0
  28. package/lib/swipl/boot/gc.pl +65 -0
  29. package/lib/swipl/boot/history.pl +304 -0
  30. package/lib/swipl/boot/init.pl +4682 -0
  31. package/lib/swipl/boot/iri.pl +64 -0
  32. package/lib/swipl/boot/license.pl +390 -0
  33. package/lib/swipl/boot/load.pl +81 -0
  34. package/lib/swipl/boot/messages.pl +2521 -0
  35. package/lib/swipl/boot/packs.pl +306 -0
  36. package/lib/swipl/boot/predopts.pl +154 -0
  37. package/lib/swipl/boot/qlf.pl +141 -0
  38. package/lib/swipl/boot/rc.pl +263 -0
  39. package/lib/swipl/boot/syspred.pl +1634 -0
  40. package/lib/swipl/boot/tabling.pl +2321 -0
  41. package/lib/swipl/boot/threads.pl +42 -0
  42. package/lib/swipl/boot/toplevel.pl +2248 -0
  43. package/lib/swipl/boot/topvars.pl +261 -0
  44. package/lib/swipl/boot.prc +0 -0
  45. package/lib/swipl/cmake/swipl.cmake +131 -0
  46. package/lib/swipl/customize/README.md +23 -0
  47. package/lib/swipl/customize/edit +101 -0
  48. package/lib/swipl/customize/init.pl +164 -0
  49. package/lib/swipl/demo/README.md +33 -0
  50. package/lib/swipl/demo/likes.pl +44 -0
  51. package/lib/swipl/doc/packages/examples/chr/bool.chr +281 -0
  52. package/lib/swipl/doc/packages/examples/chr/chrdif.chr +87 -0
  53. package/lib/swipl/doc/packages/examples/chr/chrfreeze.chr +6 -0
  54. package/lib/swipl/doc/packages/examples/chr/family.chr +116 -0
  55. package/lib/swipl/doc/packages/examples/chr/fib.chr +24 -0
  56. package/lib/swipl/doc/packages/examples/chr/fibonacci.chr +31 -0
  57. package/lib/swipl/doc/packages/examples/chr/gcd.chr +28 -0
  58. package/lib/swipl/doc/packages/examples/chr/leq.chr +34 -0
  59. package/lib/swipl/doc/packages/examples/chr/listdom.chr +138 -0
  60. package/lib/swipl/doc/packages/examples/chr/primes.chr +29 -0
  61. package/lib/swipl/doc/packages/examples/http/README.md +98 -0
  62. package/lib/swipl/doc/packages/examples/http/calc.pl +92 -0
  63. package/lib/swipl/doc/packages/examples/http/demo_body.pl +232 -0
  64. package/lib/swipl/doc/packages/examples/http/demo_client.pl +165 -0
  65. package/lib/swipl/doc/packages/examples/http/demo_daemon.pl +38 -0
  66. package/lib/swipl/doc/packages/examples/http/demo_files.pl +50 -0
  67. package/lib/swipl/doc/packages/examples/http/demo_hello.pl +15 -0
  68. package/lib/swipl/doc/packages/examples/http/demo_login.pl +280 -0
  69. package/lib/swipl/doc/packages/examples/http/demo_openid.pl +177 -0
  70. package/lib/swipl/doc/packages/examples/http/demo_pwp.pl +20 -0
  71. package/lib/swipl/doc/packages/examples/http/demo_rest.pl +56 -0
  72. package/lib/swipl/doc/packages/examples/http/demo_threads.pl +52 -0
  73. package/lib/swipl/doc/packages/examples/http/linux-init-script +126 -0
  74. package/lib/swipl/doc/packages/examples/http/pwp/context.pwp +23 -0
  75. package/lib/swipl/doc/packages/examples/http/pwp/index.pwp +25 -0
  76. package/lib/swipl/doc/packages/examples/http/pwp/pwp1.pwp +12 -0
  77. package/lib/swipl/doc/packages/examples/http/pwp/pwp2.pwp +10 -0
  78. package/lib/swipl/doc/packages/examples/http/pwp/pwp3.pwp +25 -0
  79. package/lib/swipl/doc/packages/examples/http/pwp/pwp4.pwp +23 -0
  80. package/lib/swipl/doc/packages/examples/http/pwp/pwp5.pwp +11 -0
  81. package/lib/swipl/doc/packages/examples/http/pwp/pwp6.pwp +3 -0
  82. package/lib/swipl/doc/packages/examples/http/pwp/pwp7.pwp +3 -0
  83. package/lib/swipl/doc/packages/examples/http/pwp/pwp8.pwp +3 -0
  84. package/lib/swipl/doc/packages/examples/http/pwp/pwpdb.pl +12 -0
  85. package/lib/swipl/doc/packages/examples/http/systemd-script.service +18 -0
  86. package/lib/swipl/doc/packages/examples/http/upstart-script.conf +20 -0
  87. package/lib/swipl/doc/packages/examples/plunit/read.pl +17 -0
  88. package/lib/swipl/doc/packages/examples/plunit/simple.pl +33 -0
  89. package/lib/swipl/doc/packages/examples/ssl/client.pl +83 -0
  90. package/lib/swipl/doc/packages/examples/ssl/etc/README +52 -0
  91. package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.p12 +0 -0
  92. package/lib/swipl/doc/packages/examples/ssl/etc/client/client-cert.pem +85 -0
  93. package/lib/swipl/doc/packages/examples/ssl/etc/client/client-key.pem +30 -0
  94. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/cacert.pem +82 -0
  95. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/careq.pem +18 -0
  96. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/crlnumber +1 -0
  97. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt +3 -0
  98. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/index.txt.attr +1 -0
  99. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7C.pem +85 -0
  100. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/newcerts/9DC08797A0F63F7D.pem +85 -0
  101. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/private/cakey.pem +30 -0
  102. package/lib/swipl/doc/packages/examples/ssl/etc/demoCA/serial +1 -0
  103. package/lib/swipl/doc/packages/examples/ssl/etc/server/server-cert.pem +85 -0
  104. package/lib/swipl/doc/packages/examples/ssl/etc/server/server-key.pem +30 -0
  105. package/lib/swipl/doc/packages/examples/ssl/https.pl +267 -0
  106. package/lib/swipl/doc/packages/examples/ssl/server.pl +106 -0
  107. package/lib/swipl/include/SWI-Prolog.h +1544 -0
  108. package/lib/swipl/include/SWI-Stream.h +537 -0
  109. package/lib/swipl/include/Yap/YapInterface.h +283 -0
  110. package/lib/swipl/include/sicstus/sicstus.h +452 -0
  111. package/lib/swipl/lib/x86_64-linux/cgi.so +0 -0
  112. package/lib/swipl/lib/x86_64-linux/crypt.so +0 -0
  113. package/lib/swipl/lib/x86_64-linux/crypto4pl.so +0 -0
  114. package/lib/swipl/lib/x86_64-linux/double_metaphone.so +0 -0
  115. package/lib/swipl/lib/x86_64-linux/files.so +0 -0
  116. package/lib/swipl/lib/x86_64-linux/hashstream.so +0 -0
  117. package/lib/swipl/lib/x86_64-linux/http_stream.so +0 -0
  118. package/lib/swipl/lib/x86_64-linux/isub.so +0 -0
  119. package/lib/swipl/lib/x86_64-linux/json.so +0 -0
  120. package/lib/swipl/lib/x86_64-linux/libswipl.so.10 +0 -0
  121. package/lib/swipl/lib/x86_64-linux/mallocinfo.so +0 -0
  122. package/lib/swipl/lib/x86_64-linux/md54pl.so +0 -0
  123. package/lib/swipl/lib/x86_64-linux/memfile.so +0 -0
  124. package/lib/swipl/lib/x86_64-linux/ntriples.so +0 -0
  125. package/lib/swipl/lib/x86_64-linux/pcre4pl.so +0 -0
  126. package/lib/swipl/lib/x86_64-linux/porter_stem.so +0 -0
  127. package/lib/swipl/lib/x86_64-linux/process.so +0 -0
  128. package/lib/swipl/lib/x86_64-linux/prolog_stream.so +0 -0
  129. package/lib/swipl/lib/x86_64-linux/rdf_db.so +0 -0
  130. package/lib/swipl/lib/x86_64-linux/readutil.so +0 -0
  131. package/lib/swipl/lib/x86_64-linux/rlimit.so +0 -0
  132. package/lib/swipl/lib/x86_64-linux/sched.so +0 -0
  133. package/lib/swipl/lib/x86_64-linux/sgml2pl.so +0 -0
  134. package/lib/swipl/lib/x86_64-linux/sha4pl.so +0 -0
  135. package/lib/swipl/lib/x86_64-linux/snowball.so +0 -0
  136. package/lib/swipl/lib/x86_64-linux/socket.so +0 -0
  137. package/lib/swipl/lib/x86_64-linux/ssl4pl.so +0 -0
  138. package/lib/swipl/lib/x86_64-linux/streaminfo.so +0 -0
  139. package/lib/swipl/lib/x86_64-linux/syslog.so +0 -0
  140. package/lib/swipl/lib/x86_64-linux/time.so +0 -0
  141. package/lib/swipl/lib/x86_64-linux/turtle.so +0 -0
  142. package/lib/swipl/lib/x86_64-linux/uid.so +0 -0
  143. package/lib/swipl/lib/x86_64-linux/unix.so +0 -0
  144. package/lib/swipl/lib/x86_64-linux/uri.so +0 -0
  145. package/lib/swipl/lib/x86_64-linux/websocket.so +0 -0
  146. package/lib/swipl/lib/x86_64-linux/zlib4pl.so +0 -0
  147. package/lib/swipl/library/INDEX.pl +1020 -0
  148. package/lib/swipl/library/aggregate.pl +755 -0
  149. package/lib/swipl/library/ansi_term.pl +653 -0
  150. package/lib/swipl/library/apply.pl +426 -0
  151. package/lib/swipl/library/apply_macros.pl +497 -0
  152. package/lib/swipl/library/arithmetic.pl +320 -0
  153. package/lib/swipl/library/assoc.pl +522 -0
  154. package/lib/swipl/library/atom.pl +169 -0
  155. package/lib/swipl/library/backcomp.pl +688 -0
  156. package/lib/swipl/library/base32.pl +291 -0
  157. package/lib/swipl/library/base64.pl +441 -0
  158. package/lib/swipl/library/broadcast.pl +161 -0
  159. package/lib/swipl/library/build/cmake.pl +137 -0
  160. package/lib/swipl/library/build/conan.pl +232 -0
  161. package/lib/swipl/library/build/make.pl +168 -0
  162. package/lib/swipl/library/build/tools.pl +825 -0
  163. package/lib/swipl/library/charsio.pl +195 -0
  164. package/lib/swipl/library/check.pl +1097 -0
  165. package/lib/swipl/library/check_installation.pl +912 -0
  166. package/lib/swipl/library/clp/INDEX.pl +157 -0
  167. package/lib/swipl/library/clp/bounds.pl +2036 -0
  168. package/lib/swipl/library/clp/clp_distinct.pl +263 -0
  169. package/lib/swipl/library/clp/clp_events.pl +92 -0
  170. package/lib/swipl/library/clp/clpb.pl +1896 -0
  171. package/lib/swipl/library/clp/clpfd.pl +7906 -0
  172. package/lib/swipl/library/clp/simplex.pl +1580 -0
  173. package/lib/swipl/library/codesio.pl +182 -0
  174. package/lib/swipl/library/coinduction.pl +183 -0
  175. package/lib/swipl/library/console_input.pl +289 -0
  176. package/lib/swipl/library/csv.pl +611 -0
  177. package/lib/swipl/library/ctypes.pl +161 -0
  178. package/lib/swipl/library/date.pl +370 -0
  179. package/lib/swipl/library/dcg/INDEX.pl +35 -0
  180. package/lib/swipl/library/dcg/basics.pl +514 -0
  181. package/lib/swipl/library/dcg/high_order.pl +227 -0
  182. package/lib/swipl/library/debug.pl +499 -0
  183. package/lib/swipl/library/dialect/bim.pl +186 -0
  184. package/lib/swipl/library/dialect/commons.pl +77 -0
  185. package/lib/swipl/library/dialect/eclipse/test_util_iso.pl +355 -0
  186. package/lib/swipl/library/dialect/hprolog/format.pl +44 -0
  187. package/lib/swipl/library/dialect/hprolog.pl +314 -0
  188. package/lib/swipl/library/dialect/ifprolog.pl +1317 -0
  189. package/lib/swipl/library/dialect/iso/iso_predicates.pl +277 -0
  190. package/lib/swipl/library/dialect/sicstus/README.TXT +1 -0
  191. package/lib/swipl/library/dialect/sicstus/arrays.pl +121 -0
  192. package/lib/swipl/library/dialect/sicstus/block.pl +278 -0
  193. package/lib/swipl/library/dialect/sicstus/lists.pl +167 -0
  194. package/lib/swipl/library/dialect/sicstus/ordsets.pl +52 -0
  195. package/lib/swipl/library/dialect/sicstus/sockets.pl +174 -0
  196. package/lib/swipl/library/dialect/sicstus/system.pl +262 -0
  197. package/lib/swipl/library/dialect/sicstus/terms.pl +57 -0
  198. package/lib/swipl/library/dialect/sicstus/timeout.pl +92 -0
  199. package/lib/swipl/library/dialect/sicstus.pl +582 -0
  200. package/lib/swipl/library/dialect/sicstus4/aggregate.pl +60 -0
  201. package/lib/swipl/library/dialect/sicstus4/between.pl +62 -0
  202. package/lib/swipl/library/dialect/sicstus4/clpfd.pl +75 -0
  203. package/lib/swipl/library/dialect/sicstus4/file_systems.pl +413 -0
  204. package/lib/swipl/library/dialect/sicstus4/lists.pl +274 -0
  205. package/lib/swipl/library/dialect/sicstus4/ordsets.pl +54 -0
  206. package/lib/swipl/library/dialect/sicstus4/samsort.pl +86 -0
  207. package/lib/swipl/library/dialect/sicstus4/sets.pl +124 -0
  208. package/lib/swipl/library/dialect/sicstus4/sockets.pl +164 -0
  209. package/lib/swipl/library/dialect/sicstus4/system.pl +80 -0
  210. package/lib/swipl/library/dialect/sicstus4/terms.pl +89 -0
  211. package/lib/swipl/library/dialect/sicstus4/timeout.pl +43 -0
  212. package/lib/swipl/library/dialect/sicstus4/types.pl +103 -0
  213. package/lib/swipl/library/dialect/sicstus4.pl +200 -0
  214. package/lib/swipl/library/dialect/swi/syspred_options.pl +250 -0
  215. package/lib/swipl/library/dialect/xsb/README.md +20 -0
  216. package/lib/swipl/library/dialect/xsb/basics.pl +318 -0
  217. package/lib/swipl/library/dialect/xsb/consult.pl +87 -0
  218. package/lib/swipl/library/dialect/xsb/curr_sym.pl +57 -0
  219. package/lib/swipl/library/dialect/xsb/error_handler.pl +111 -0
  220. package/lib/swipl/library/dialect/xsb/gensym.pl +53 -0
  221. package/lib/swipl/library/dialect/xsb/gpp.pl +138 -0
  222. package/lib/swipl/library/dialect/xsb/intern.pl +48 -0
  223. package/lib/swipl/library/dialect/xsb/lists.pl +47 -0
  224. package/lib/swipl/library/dialect/xsb/machine.pl +295 -0
  225. package/lib/swipl/library/dialect/xsb/ordsets.pl +53 -0
  226. package/lib/swipl/library/dialect/xsb/setof.pl +54 -0
  227. package/lib/swipl/library/dialect/xsb/source.pl +308 -0
  228. package/lib/swipl/library/dialect/xsb/standard.pl +169 -0
  229. package/lib/swipl/library/dialect/xsb/storage.pl +70 -0
  230. package/lib/swipl/library/dialect/xsb/string.pl +76 -0
  231. package/lib/swipl/library/dialect/xsb/thread.pl +62 -0
  232. package/lib/swipl/library/dialect/xsb/timed_call.pl +158 -0
  233. package/lib/swipl/library/dialect/xsb.pl +688 -0
  234. package/lib/swipl/library/dialect/yap/README.TXT +8 -0
  235. package/lib/swipl/library/dialect/yap.pl +283 -0
  236. package/lib/swipl/library/dialect.pl +123 -0
  237. package/lib/swipl/library/dicts.pl +399 -0
  238. package/lib/swipl/library/dif.pl +426 -0
  239. package/lib/swipl/library/edinburgh.pl +138 -0
  240. package/lib/swipl/library/edit.pl +783 -0
  241. package/lib/swipl/library/error.pl +495 -0
  242. package/lib/swipl/library/exceptions.pl +231 -0
  243. package/lib/swipl/library/explain.pl +543 -0
  244. package/lib/swipl/library/ext/RDF/INDEX.pl +25 -0
  245. package/lib/swipl/library/ext/RDF/rdf.pl +450 -0
  246. package/lib/swipl/library/ext/RDF/rdf_parser.pl +649 -0
  247. package/lib/swipl/library/ext/RDF/rdf_triple.pl +448 -0
  248. package/lib/swipl/library/ext/RDF/rdf_write.pl +701 -0
  249. package/lib/swipl/library/ext/RDF/rewrite_term.pl +177 -0
  250. package/lib/swipl/library/ext/chr/chr/a_star.pl +80 -0
  251. package/lib/swipl/library/ext/chr/chr/binomialheap.pl +142 -0
  252. package/lib/swipl/library/ext/chr/chr/builtins.pl +629 -0
  253. package/lib/swipl/library/ext/chr/chr/chr_compiler_errors.pl +179 -0
  254. package/lib/swipl/library/ext/chr/chr/chr_compiler_options.pl +382 -0
  255. package/lib/swipl/library/ext/chr/chr/chr_compiler_utility.pl +338 -0
  256. package/lib/swipl/library/ext/chr/chr/chr_debug.pl +59 -0
  257. package/lib/swipl/library/ext/chr/chr/chr_hashtable_store.pl +425 -0
  258. package/lib/swipl/library/ext/chr/chr/chr_integertable_store.pl +139 -0
  259. package/lib/swipl/library/ext/chr/chr/chr_messages.pl +176 -0
  260. package/lib/swipl/library/ext/chr/chr/chr_op.pl +53 -0
  261. package/lib/swipl/library/ext/chr/chr/chr_runtime.pl +1016 -0
  262. package/lib/swipl/library/ext/chr/chr/chr_translate.pl +25424 -0
  263. package/lib/swipl/library/ext/chr/chr/clean_code.pl +252 -0
  264. package/lib/swipl/library/ext/chr/chr/find.pl +78 -0
  265. package/lib/swipl/library/ext/chr/chr/guard_entailment.pl +19432 -0
  266. package/lib/swipl/library/ext/chr/chr/listmap.pl +108 -0
  267. package/lib/swipl/library/ext/chr/chr/pairlist.pl +78 -0
  268. package/lib/swipl/library/ext/chr/chr.pl +686 -0
  269. package/lib/swipl/library/ext/clib/INDEX.pl +158 -0
  270. package/lib/swipl/library/ext/clib/cgi.pl +86 -0
  271. package/lib/swipl/library/ext/clib/crypt.pl +44 -0
  272. package/lib/swipl/library/ext/clib/filesex.pl +644 -0
  273. package/lib/swipl/library/ext/clib/hash_stream.pl +119 -0
  274. package/lib/swipl/library/ext/clib/mallocinfo.pl +138 -0
  275. package/lib/swipl/library/ext/clib/md5.pl +68 -0
  276. package/lib/swipl/library/ext/clib/memfile.pl +61 -0
  277. package/lib/swipl/library/ext/clib/process.pl +573 -0
  278. package/lib/swipl/library/ext/clib/prolog_server.pl +157 -0
  279. package/lib/swipl/library/ext/clib/prolog_stream.pl +80 -0
  280. package/lib/swipl/library/ext/clib/rlimit.pl +54 -0
  281. package/lib/swipl/library/ext/clib/sched.pl +85 -0
  282. package/lib/swipl/library/ext/clib/sha.pl +162 -0
  283. package/lib/swipl/library/ext/clib/socket.pl +1102 -0
  284. package/lib/swipl/library/ext/clib/streaminfo.pl +103 -0
  285. package/lib/swipl/library/ext/clib/streampool.pl +136 -0
  286. package/lib/swipl/library/ext/clib/syslog.pl +180 -0
  287. package/lib/swipl/library/ext/clib/time.pl +194 -0
  288. package/lib/swipl/library/ext/clib/udp_broadcast.pl +975 -0
  289. package/lib/swipl/library/ext/clib/uid.pl +220 -0
  290. package/lib/swipl/library/ext/clib/unix.pl +317 -0
  291. package/lib/swipl/library/ext/clib/uri.pl +530 -0
  292. package/lib/swipl/library/ext/clib/uuid.pl +207 -0
  293. package/lib/swipl/library/ext/http/http/INDEX.pl +266 -0
  294. package/lib/swipl/library/ext/http/http/README.md +34 -0
  295. package/lib/swipl/library/ext/http/http/ax.pl +189 -0
  296. package/lib/swipl/library/ext/http/http/dcg_basics.pl +49 -0
  297. package/lib/swipl/library/ext/http/http/graphql.pl +1367 -0
  298. package/lib/swipl/library/ext/http/http/html_decl.pl +416 -0
  299. package/lib/swipl/library/ext/http/http/html_head.pl +654 -0
  300. package/lib/swipl/library/ext/http/http/html_quasiquotations.pl +120 -0
  301. package/lib/swipl/library/ext/http/http/html_write.pl +1425 -0
  302. package/lib/swipl/library/ext/http/http/htmx.pl +139 -0
  303. package/lib/swipl/library/ext/http/http/http_authenticate.pl +364 -0
  304. package/lib/swipl/library/ext/http/http/http_client.pl +412 -0
  305. package/lib/swipl/library/ext/http/http/http_cookie.pl +245 -0
  306. package/lib/swipl/library/ext/http/http/http_cors.pl +176 -0
  307. package/lib/swipl/library/ext/http/http/http_digest.pl +820 -0
  308. package/lib/swipl/library/ext/http/http/http_dirindex.pl +296 -0
  309. package/lib/swipl/library/ext/http/http/http_dispatch.pl +1552 -0
  310. package/lib/swipl/library/ext/http/http/http_dyn_workers.pl +214 -0
  311. package/lib/swipl/library/ext/http/http/http_error.pl +126 -0
  312. package/lib/swipl/library/ext/http/http/http_exception.pl +225 -0
  313. package/lib/swipl/library/ext/http/http/http_files.pl +163 -0
  314. package/lib/swipl/library/ext/http/http/http_header.pl +2820 -0
  315. package/lib/swipl/library/ext/http/http/http_hook.pl +106 -0
  316. package/lib/swipl/library/ext/http/http/http_host.pl +204 -0
  317. package/lib/swipl/library/ext/http/http/http_load.pl +113 -0
  318. package/lib/swipl/library/ext/http/http/http_log.pl +738 -0
  319. package/lib/swipl/library/ext/http/http/http_multipart_plugin.pl +232 -0
  320. package/lib/swipl/library/ext/http/http/http_open.pl +1821 -0
  321. package/lib/swipl/library/ext/http/http/http_openid.pl +1561 -0
  322. package/lib/swipl/library/ext/http/http/http_parameters.pl +504 -0
  323. package/lib/swipl/library/ext/http/http/http_path.pl +380 -0
  324. package/lib/swipl/library/ext/http/http/http_proxy.pl +80 -0
  325. package/lib/swipl/library/ext/http/http/http_pwp.pl +351 -0
  326. package/lib/swipl/library/ext/http/http/http_redis_plugin.pl +332 -0
  327. package/lib/swipl/library/ext/http/http/http_server.pl +105 -0
  328. package/lib/swipl/library/ext/http/http/http_server_files.pl +126 -0
  329. package/lib/swipl/library/ext/http/http/http_server_health.pl +186 -0
  330. package/lib/swipl/library/ext/http/http/http_session.pl +1040 -0
  331. package/lib/swipl/library/ext/http/http/http_sgml_plugin.pl +137 -0
  332. package/lib/swipl/library/ext/http/http/http_stream.pl +376 -0
  333. package/lib/swipl/library/ext/http/http/http_unix_daemon.pl +989 -0
  334. package/lib/swipl/library/ext/http/http/http_wrapper.pl +559 -0
  335. package/lib/swipl/library/ext/http/http/hub.pl +600 -0
  336. package/lib/swipl/library/ext/http/http/js_write.pl +461 -0
  337. package/lib/swipl/library/ext/http/http/mimepack.pl +224 -0
  338. package/lib/swipl/library/ext/http/http/mimetype.pl +276 -0
  339. package/lib/swipl/library/ext/http/http/term_html.pl +797 -0
  340. package/lib/swipl/library/ext/http/http/thread_httpd.pl +1181 -0
  341. package/lib/swipl/library/ext/http/http/web/css/dirindex.css +24 -0
  342. package/lib/swipl/library/ext/http/http/web/css/openid.css +57 -0
  343. package/lib/swipl/library/ext/http/http/web/icons/back.png +0 -0
  344. package/lib/swipl/library/ext/http/http/web/icons/c.png +0 -0
  345. package/lib/swipl/library/ext/http/http/web/icons/compressed.png +0 -0
  346. package/lib/swipl/library/ext/http/http/web/icons/folder.png +0 -0
  347. package/lib/swipl/library/ext/http/http/web/icons/generic.png +0 -0
  348. package/lib/swipl/library/ext/http/http/web/icons/layout.png +0 -0
  349. package/lib/swipl/library/ext/http/http/web/icons/openid-logo-square.png +0 -0
  350. package/lib/swipl/library/ext/http/http/web/icons/openid-logo-tiny.png +0 -0
  351. package/lib/swipl/library/ext/http/http/websocket.pl +729 -0
  352. package/lib/swipl/library/ext/http/http/yadis.pl +205 -0
  353. package/lib/swipl/library/ext/json/INDEX.pl +36 -0
  354. package/lib/swipl/library/ext/json/http/INDEX.pl +16 -0
  355. package/lib/swipl/library/ext/json/http/http_json.pl +490 -0
  356. package/lib/swipl/library/ext/json/http/js_grammar.pl +53 -0
  357. package/lib/swipl/library/ext/json/http/json.pl +48 -0
  358. package/lib/swipl/library/ext/json/http/json_convert.pl +48 -0
  359. package/lib/swipl/library/ext/json/json.pl +1215 -0
  360. package/lib/swipl/library/ext/json/json_convert.pl +681 -0
  361. package/lib/swipl/library/ext/json/json_grammar.pl +349 -0
  362. package/lib/swipl/library/ext/json/json_rpc_client.pl +423 -0
  363. package/lib/swipl/library/ext/json/json_rpc_common.pl +104 -0
  364. package/lib/swipl/library/ext/json/json_rpc_server.pl +489 -0
  365. package/lib/swipl/library/ext/json/json_schema.pl +2111 -0
  366. package/lib/swipl/library/ext/nlp/INDEX.pl +15 -0
  367. package/lib/swipl/library/ext/nlp/double_metaphone.pl +86 -0
  368. package/lib/swipl/library/ext/nlp/isub.pl +162 -0
  369. package/lib/swipl/library/ext/nlp/porter_stem.pl +50 -0
  370. package/lib/swipl/library/ext/nlp/snowball.pl +97 -0
  371. package/lib/swipl/library/ext/pcre/INDEX.pl +17 -0
  372. package/lib/swipl/library/ext/pcre/pcre.pl +974 -0
  373. package/lib/swipl/library/ext/plunit/INDEX.pl +20 -0
  374. package/lib/swipl/library/ext/plunit/plunit.pl +2631 -0
  375. package/lib/swipl/library/ext/plunit/test_wizard.pl +249 -0
  376. package/lib/swipl/library/ext/semweb/semweb/INDEX.pl +288 -0
  377. package/lib/swipl/library/ext/semweb/semweb/rdf11.pl +2106 -0
  378. package/lib/swipl/library/ext/semweb/semweb/rdf11_containers.pl +299 -0
  379. package/lib/swipl/library/ext/semweb/semweb/rdf_cache.pl +278 -0
  380. package/lib/swipl/library/ext/semweb/semweb/rdf_compare.pl +132 -0
  381. package/lib/swipl/library/ext/semweb/semweb/rdf_db.pl +3468 -0
  382. package/lib/swipl/library/ext/semweb/semweb/rdf_edit.pl +1145 -0
  383. package/lib/swipl/library/ext/semweb/semweb/rdf_http_plugin.pl +274 -0
  384. package/lib/swipl/library/ext/semweb/semweb/rdf_library.pl +1021 -0
  385. package/lib/swipl/library/ext/semweb/semweb/rdf_litindex.pl +1035 -0
  386. package/lib/swipl/library/ext/semweb/semweb/rdf_ntriples.pl +422 -0
  387. package/lib/swipl/library/ext/semweb/semweb/rdf_persistency.pl +1576 -0
  388. package/lib/swipl/library/ext/semweb/semweb/rdf_portray.pl +182 -0
  389. package/lib/swipl/library/ext/semweb/semweb/rdf_prefixes.pl +681 -0
  390. package/lib/swipl/library/ext/semweb/semweb/rdf_sandbox.pl +153 -0
  391. package/lib/swipl/library/ext/semweb/semweb/rdf_turtle.pl +54 -0
  392. package/lib/swipl/library/ext/semweb/semweb/rdf_turtle_write.pl +1587 -0
  393. package/lib/swipl/library/ext/semweb/semweb/rdf_zlib_plugin.pl +52 -0
  394. package/lib/swipl/library/ext/semweb/semweb/rdfa.pl +1510 -0
  395. package/lib/swipl/library/ext/semweb/semweb/rdfs.pl +475 -0
  396. package/lib/swipl/library/ext/semweb/semweb/sparql_client.pl +643 -0
  397. package/lib/swipl/library/ext/semweb/semweb/turtle.pl +455 -0
  398. package/lib/swipl/library/ext/sgml/DTD/HTML4.dcl +88 -0
  399. package/lib/swipl/library/ext/sgml/DTD/HTML4.dtd +1092 -0
  400. package/lib/swipl/library/ext/sgml/DTD/HTML4.soc +6 -0
  401. package/lib/swipl/library/ext/sgml/DTD/HTML5.dtd +906 -0
  402. package/lib/swipl/library/ext/sgml/DTD/HTMLlat1.ent +195 -0
  403. package/lib/swipl/library/ext/sgml/DTD/HTMLspec.ent +77 -0
  404. package/lib/swipl/library/ext/sgml/DTD/HTMLsym.ent +241 -0
  405. package/lib/swipl/library/ext/sgml/INDEX.pl +64 -0
  406. package/lib/swipl/library/ext/sgml/c14n2.pl +203 -0
  407. package/lib/swipl/library/ext/sgml/iso_639.pl +631 -0
  408. package/lib/swipl/library/ext/sgml/pwp.pl +705 -0
  409. package/lib/swipl/library/ext/sgml/sgml.pl +815 -0
  410. package/lib/swipl/library/ext/sgml/sgml_write.pl +1003 -0
  411. package/lib/swipl/library/ext/sgml/xpath.pl +620 -0
  412. package/lib/swipl/library/ext/sgml/xsdp_types.pl +232 -0
  413. package/lib/swipl/library/ext/ssl/INDEX.pl +60 -0
  414. package/lib/swipl/library/ext/ssl/crypto.pl +1015 -0
  415. package/lib/swipl/library/ext/ssl/http/INDEX.pl +5 -0
  416. package/lib/swipl/library/ext/ssl/http/http_ssl_plugin.pl +296 -0
  417. package/lib/swipl/library/ext/ssl/saml.pl +609 -0
  418. package/lib/swipl/library/ext/ssl/ssl.pl +647 -0
  419. package/lib/swipl/library/ext/ssl/xmldsig.pl +391 -0
  420. package/lib/swipl/library/ext/ssl/xmlenc.pl +354 -0
  421. package/lib/swipl/library/ext/zlib/INDEX.pl +8 -0
  422. package/lib/swipl/library/ext/zlib/zlib.pl +112 -0
  423. package/lib/swipl/library/fastrw.pl +105 -0
  424. package/lib/swipl/library/files.pl +80 -0
  425. package/lib/swipl/library/gensym.pl +111 -0
  426. package/lib/swipl/library/git.pl +1027 -0
  427. package/lib/swipl/library/hashtable.pl +365 -0
  428. package/lib/swipl/library/heaps.pl +252 -0
  429. package/lib/swipl/library/hotfix.pl +239 -0
  430. package/lib/swipl/library/http/jquery.pl +103 -0
  431. package/lib/swipl/library/http/web/js/jquery-3.6.0.min.js +2 -0
  432. package/lib/swipl/library/increval.pl +217 -0
  433. package/lib/swipl/library/intercept.pl +263 -0
  434. package/lib/swipl/library/iostream.pl +237 -0
  435. package/lib/swipl/library/iri_scheme/file.pl +70 -0
  436. package/lib/swipl/library/lazy_lists.pl +481 -0
  437. package/lib/swipl/library/listing.pl +1362 -0
  438. package/lib/swipl/library/lists.pl +860 -0
  439. package/lib/swipl/library/lynx/INDEX.pl +14 -0
  440. package/lib/swipl/library/lynx/format.pl +380 -0
  441. package/lib/swipl/library/lynx/html_style.pl +129 -0
  442. package/lib/swipl/library/lynx/html_text.pl +865 -0
  443. package/lib/swipl/library/lynx/pldoc_style.pl +87 -0
  444. package/lib/swipl/library/macros.pl +451 -0
  445. package/lib/swipl/library/main.pl +1200 -0
  446. package/lib/swipl/library/make.pl +197 -0
  447. package/lib/swipl/library/modules.pl +129 -0
  448. package/lib/swipl/library/nb_rbtrees.pl +267 -0
  449. package/lib/swipl/library/nb_set.pl +203 -0
  450. package/lib/swipl/library/obfuscate.pl +115 -0
  451. package/lib/swipl/library/occurs.pl +241 -0
  452. package/lib/swipl/library/operators.pl +182 -0
  453. package/lib/swipl/library/option.pl +388 -0
  454. package/lib/swipl/library/optparse.pl +966 -0
  455. package/lib/swipl/library/ordsets.pl +518 -0
  456. package/lib/swipl/library/oset.pl +160 -0
  457. package/lib/swipl/library/pairs.pl +187 -0
  458. package/lib/swipl/library/persistency.pl +713 -0
  459. package/lib/swipl/library/pio.pl +47 -0
  460. package/lib/swipl/library/portray_text.pl +277 -0
  461. package/lib/swipl/library/pprint.pl +940 -0
  462. package/lib/swipl/library/predicate_options.pl +975 -0
  463. package/lib/swipl/library/prolog_autoload.pl +233 -0
  464. package/lib/swipl/library/prolog_breakpoints.pl +396 -0
  465. package/lib/swipl/library/prolog_clause.pl +1104 -0
  466. package/lib/swipl/library/prolog_code.pl +416 -0
  467. package/lib/swipl/library/prolog_codewalk.pl +1248 -0
  468. package/lib/swipl/library/prolog_colour.pl +3301 -0
  469. package/lib/swipl/library/prolog_colour.qlf +0 -0
  470. package/lib/swipl/library/prolog_config.pl +154 -0
  471. package/lib/swipl/library/prolog_coverage.pl +1333 -0
  472. package/lib/swipl/library/prolog_debug.pl +404 -0
  473. package/lib/swipl/library/prolog_deps.pl +675 -0
  474. package/lib/swipl/library/prolog_evaluable.pl +234 -0
  475. package/lib/swipl/library/prolog_format.pl +219 -0
  476. package/lib/swipl/library/prolog_history.pl +161 -0
  477. package/lib/swipl/library/prolog_jiti.pl +333 -0
  478. package/lib/swipl/library/prolog_locale.pl +61 -0
  479. package/lib/swipl/library/prolog_metainference.pl +307 -0
  480. package/lib/swipl/library/prolog_pack.pl +3906 -0
  481. package/lib/swipl/library/prolog_profile.pl +346 -0
  482. package/lib/swipl/library/prolog_qlfmake.pl +533 -0
  483. package/lib/swipl/library/prolog_source.pl +1188 -0
  484. package/lib/swipl/library/prolog_stack.pl +794 -0
  485. package/lib/swipl/library/prolog_trace.pl +365 -0
  486. package/lib/swipl/library/prolog_versions.pl +347 -0
  487. package/lib/swipl/library/prolog_wrap.pl +164 -0
  488. package/lib/swipl/library/prolog_xref.pl +3090 -0
  489. package/lib/swipl/library/prolog_xref.qlf +0 -0
  490. package/lib/swipl/library/pure_input.pl +266 -0
  491. package/lib/swipl/library/qpforeign.pl +695 -0
  492. package/lib/swipl/library/qsave.pl +1516 -0
  493. package/lib/swipl/library/quasi_quotations.pl +300 -0
  494. package/lib/swipl/library/quintus.pl +437 -0
  495. package/lib/swipl/library/random.pl +459 -0
  496. package/lib/swipl/library/rbtrees.pl +1153 -0
  497. package/lib/swipl/library/readln.pl +256 -0
  498. package/lib/swipl/library/readutil.pl +304 -0
  499. package/lib/swipl/library/record.pl +544 -0
  500. package/lib/swipl/library/rwlocks.pl +172 -0
  501. package/lib/swipl/library/sandbox.pl +1384 -0
  502. package/lib/swipl/library/semweb/dc.rdfs +198 -0
  503. package/lib/swipl/library/semweb/eor.rdfs +95 -0
  504. package/lib/swipl/library/semweb/owl.owl +287 -0
  505. package/lib/swipl/library/semweb/rdf_library.ttl +90 -0
  506. package/lib/swipl/library/semweb/rdfs.rdfs +251 -0
  507. package/lib/swipl/library/settings.pl +755 -0
  508. package/lib/swipl/library/shell.pl +462 -0
  509. package/lib/swipl/library/shlib.pl +670 -0
  510. package/lib/swipl/library/solution_sequences.pl +439 -0
  511. package/lib/swipl/library/sort.pl +119 -0
  512. package/lib/swipl/library/statistics.pl +541 -0
  513. package/lib/swipl/library/streams.pl +118 -0
  514. package/lib/swipl/library/strings.pl +469 -0
  515. package/lib/swipl/library/system.pl +95 -0
  516. package/lib/swipl/library/tables.pl +381 -0
  517. package/lib/swipl/library/tableutil.pl +771 -0
  518. package/lib/swipl/library/tabling.pl +42 -0
  519. package/lib/swipl/library/terms.pl +457 -0
  520. package/lib/swipl/library/theme/auto.pl +61 -0
  521. package/lib/swipl/library/theme/dark.pl +455 -0
  522. package/lib/swipl/library/theme/light.pl +45 -0
  523. package/lib/swipl/library/thread.pl +810 -0
  524. package/lib/swipl/library/thread_pool.pl +508 -0
  525. package/lib/swipl/library/threadutil.pl +574 -0
  526. package/lib/swipl/library/tty.pl +316 -0
  527. package/lib/swipl/library/ugraphs.pl +644 -0
  528. package/lib/swipl/library/unicode/INDEX.pl +6 -0
  529. package/lib/swipl/library/unicode/blocks.pl +414 -0
  530. package/lib/swipl/library/url.pl +1129 -0
  531. package/lib/swipl/library/utf8.pl +145 -0
  532. package/lib/swipl/library/varnumbers.pl +221 -0
  533. package/lib/swipl/library/vm.pl +251 -0
  534. package/lib/swipl/library/wfs.pl +205 -0
  535. package/lib/swipl/library/when.pl +263 -0
  536. package/lib/swipl/library/writef.pl +278 -0
  537. package/lib/swipl/library/www_browser.pl +251 -0
  538. package/lib/swipl/library/yall.pl +574 -0
  539. package/lib/swipl/library/zip.pl +211 -0
  540. package/lib/swipl/swipl.home +1 -0
  541. package/lib/vendor/libcrypto.so.3 +0 -0
  542. package/lib/vendor/libpcre2-8.so.0 +0 -0
  543. package/lib/vendor/libssl.so.3 +0 -0
  544. package/lib/vendor/libz.so.1 +0 -0
  545. package/licenses/OpenSSL-LICENSE.txt +177 -0
  546. package/licenses/PCRE2-COPYING +5 -0
  547. package/licenses/README.md +12 -0
  548. package/licenses/SWI-Prolog-LICENSE +41 -0
  549. package/licenses/zlib-LICENSE +22 -0
  550. package/package.json +27 -0
@@ -0,0 +1,1544 @@
1
+ /* Part of SWI-Prolog
2
+
3
+ Author: Jan Wielemaker
4
+ E-mail: jan@swi-prolog.org
5
+ WWW: http://www.swi-prolog.org
6
+ Copyright (c) 2008-2026, University of Amsterdam
7
+ VU University Amsterdam
8
+ SWI-Prolog Solutions b.v.
9
+ All rights reserved.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions
13
+ are met:
14
+
15
+ 1. Redistributions of source code must retain the above copyright
16
+ notice, this list of conditions and the following disclaimer.
17
+
18
+ 2. Redistributions in binary form must reproduce the above copyright
19
+ notice, this list of conditions and the following disclaimer in
20
+ the documentation and/or other materials provided with the
21
+ distribution.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
+ POSSIBILITY OF SUCH DAMAGE.
35
+ */
36
+
37
+ #ifndef _SWI_PROLOG_H
38
+ #define _SWI_PROLOG_H
39
+
40
+ #ifndef __SWI_PROLOG__ /* use this to switch on Prolog dialect */
41
+ #define __SWI_PROLOG__ /* normally defined by the swipl-ld compiler driver */
42
+ #endif
43
+
44
+ #ifndef __WINDOWS__
45
+ #if defined(_MSC_VER) || defined(__MINGW32__)
46
+ #define __WINDOWS__ 1
47
+ #endif
48
+ #endif
49
+
50
+ #include <stdarg.h>
51
+ #include <stdlib.h> /* get size_t */
52
+ #include <stddef.h>
53
+ #include <stdbool.h>
54
+ #include <inttypes.h>
55
+
56
+ #ifdef __cplusplus
57
+ extern "C" {
58
+ #endif
59
+
60
+ /* PLVERSION: 10000 * <Major> + 100 * <Minor> + <Patch> */
61
+ /* PLVERSION_TAG: a string, normally "", but for example "rc1" */
62
+
63
+ #ifndef PLVERSION
64
+ #define PLVERSION 100002
65
+ #endif
66
+ #ifndef PLVERSION_TAG
67
+ #define PLVERSION_TAG ""
68
+ #endif
69
+
70
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71
+ This number is incremented when the SWI-Prolog PL_*() functions or one
72
+ of the data types is modified such that old binary extensions cannot run
73
+ reliably with the current version. This version is introduced in
74
+ SWI-Prolog 8.1.30. The most recent violation of compatibility was
75
+ between versions 8.1.21 and 8.1.22 with the introduction of rational
76
+ numbers are atomic type.
77
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
78
+
79
+ #define PL_FLI_VERSION 2 /* PL_*() functions */
80
+ #define PL_REC_VERSION 3 /* PL_record_external(), fastrw */
81
+ #define PL_QLF_LOADVERSION 68 /* load all versions later >= X */
82
+ #define PL_QLF_VERSION 71 /* save version number */
83
+
84
+
85
+ /*******************************
86
+ * EXPORT *
87
+ *******************************/
88
+
89
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
90
+ Traditional and ELF-based Unix systems don't need all this, but COFF
91
+ based systems need to import and export symbols explicitely from
92
+ executables and shared objects (DLL). On some systems (e.g. AIX) this is
93
+ achieved using import/export files, on Windows this is achieved using
94
+ special declarations on exported symbols. So, a symbol is local
95
+ (static), shared between the objects building an executable or DLL (no
96
+ special declaration) or exported from the executable or DLL.
97
+
98
+ Both using native Microsoft MSVC as well as recent Cygwin (tested 1.1)
99
+ compilers support __declspec(...) for exporting symbols.
100
+
101
+ As SWI-Stream.h can be included separately or together with this file we
102
+ duplicated this stuff.
103
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
104
+
105
+ #ifndef _PL_EXPORT_DONE
106
+ #define _PL_EXPORT_DONE
107
+
108
+ #if defined(_MSC_VER) || defined(__MINGW32__)
109
+ #define HAVE_DECLSPEC 1
110
+ #else
111
+ #if !defined(HAVE_VISIBILITY_ATTRIBUTE) && (__GNUC__ >= 4 || defined(__clang__))
112
+ #define HAVE_VISIBILITY_ATTRIBUTE 1
113
+ #endif
114
+ #endif
115
+
116
+ #ifdef HAVE_DECLSPEC
117
+ # ifdef PL_KERNEL
118
+ #define PL_EXPORT(type) __declspec(dllexport) extern type
119
+ #define PL_EXPORT_DATA(type) __declspec(dllexport) extern type
120
+ # else
121
+ # ifdef __BORLANDC__
122
+ #define PL_EXPORT(type) type _stdcall
123
+ #define PL_EXPORT_DATA(type) extern type
124
+ # else
125
+ # ifdef __MINGW32__
126
+ #define PL_EXPORT(type) extern type
127
+ #define PL_EXPORT_DATA(type) extern type
128
+ # else
129
+ #define PL_EXPORT(type) extern type
130
+ #define PL_EXPORT_DATA(type) __declspec(dllimport) type
131
+ # endif
132
+ # endif
133
+ #define install_t __declspec(dllexport) void
134
+ # endif
135
+ #else /*!HAVE_DECLSPEC*/
136
+ # ifdef PL_SO_EXPORT
137
+ #define PL_EXPORT(type) extern PL_SO_EXPORT type
138
+ #define PL_EXPORT_DATA(type) extern PL_SO_EXPORT type
139
+ # else
140
+ #define PL_EXPORT(type) extern type
141
+ #define PL_EXPORT_DATA(type) extern type
142
+ # endif
143
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE
144
+ #define install_t __attribute__((visibility("default"))) void
145
+ #else
146
+ #define install_t void
147
+ #endif
148
+ #endif /*HAVE_DECLSPEC*/
149
+ #endif /*_PL_EXPORT_DONE*/
150
+
151
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
152
+ The following two macros are used to define types that are internal to the
153
+ SWI-Prolog library but appear in public API signatures. None of these
154
+ types should be used by derived code; the mangling done by PL_OPAQUE is
155
+ intended solely to avoid clutter in global type namespaces and should not
156
+ be relied upon to remain unchanged across versions.
157
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
158
+ #ifndef PL_OPAQUE
159
+ #define PL_OPAQUE(type) __PL_ ## type
160
+ #define _DEFINED_PL_OPAQUE
161
+ #endif
162
+ #ifndef PL_STRUCT
163
+ #define PL_STRUCT(name) struct PL_OPAQUE(name)
164
+ #define _DEFINED_PL_STRUCT
165
+ #endif
166
+
167
+ /* Shorthand defines, for brevity in this file. They get undefined
168
+ * at the bottom, so don't use them in #define definitions (which
169
+ * use lazy evaluation) or in derived code.
170
+ */
171
+ #define _PLQ PL_OPAQUE
172
+ #define _PLS PL_STRUCT
173
+
174
+
175
+ /*******************************
176
+ * GCC ATTRIBUTES *
177
+ *******************************/
178
+
179
+ #if __GNUC__ >= 4
180
+ #define WUNUSED __attribute__((warn_unused_result))
181
+ #define WDEPRECATED __attribute__((deprecated))
182
+ #else
183
+ #define WUNUSED
184
+ #define WDEPRECATED
185
+ #endif
186
+
187
+
188
+ /*******************************
189
+ * TYPES *
190
+ *******************************/
191
+
192
+ typedef uint64_t _PLQ(word); /* Anonymous Prolog data cell */
193
+ #ifndef PL_HAVE_ATOM_T
194
+ #define PL_HAVE_ATOM_T
195
+ typedef uintptr_t atom_t; /* Prolog atom */
196
+ #endif
197
+ typedef uintptr_t functor_t; /* Name/arity pair */
198
+ typedef uintptr_t _PLQ(code); /* Prolog bytecode type */
199
+ typedef _PLS(module) * module_t; /* Prolog module */
200
+ typedef _PLS(procedure) *predicate_t; /* Prolog procedure */
201
+ typedef _PLS(record) * record_t; /* Prolog recorded term */
202
+ #ifndef PL_HAVE_TERM_T
203
+ #define PL_HAVE_TERM_T
204
+ typedef uintptr_t term_t; /* opaque term handle */
205
+ #endif
206
+ typedef _PLS(queryRef) *qid_t; /* opaque query handle */
207
+ typedef uintptr_t PL_fid_t; /* opaque foreign context handle */
208
+ typedef _PLS(foreign_context) *control_t; /* non-deterministic control arg */
209
+ typedef _PLS(PL_local_data) *PL_engine_t; /* opaque engine handle */
210
+ typedef _PLQ(word) PL_atomic_t; /* same a word */
211
+ typedef uintptr_t foreign_t; /* return type of foreign functions */
212
+ typedef wchar_t pl_wchar_t; /* Prolog wide character */
213
+ typedef void * pl_function_t; /* pass function as void* */
214
+ typedef uintptr_t buf_mark_t; /* buffer mark handle */
215
+
216
+ #define fid_t PL_fid_t /* avoid AIX name-clash */
217
+
218
+ typedef struct io_stream IOSTREAM; /* fully defined in SWI-Stream.h */
219
+
220
+ /* values for PL_get_term_value() */
221
+ typedef union
222
+ { int64_t i; /* PL_INTEGER */
223
+ double f; /* PL_FLOAT */
224
+ char * s; /* PL_STRING */
225
+ atom_t a; /* PL_ATOM */
226
+ struct /* PL_TERM */
227
+ { atom_t name;
228
+ size_t arity;
229
+ } t;
230
+ } term_value_t;
231
+
232
+
233
+ #ifndef TRUE
234
+ #define TRUE (true)
235
+ #define FALSE (false)
236
+ #endif
237
+
238
+ /*******************************
239
+ * TERM-TYPE CONSTANTS *
240
+ *******************************/
241
+ /* PL_unify_term() arguments */
242
+ #define PL_VARIABLE (1) /* nothing */
243
+ #define PL_ATOM (2) /* const char * */
244
+ #define PL_INTEGER (3) /* int */
245
+ #define PL_RATIONAL (4) /* rational number */
246
+ #define PL_FLOAT (5) /* double */
247
+ #define PL_STRING (6) /* const char * */
248
+ #define PL_TERM (7)
249
+
250
+ #define PL_NIL (8) /* The constant [] */
251
+ #define PL_BLOB (9) /* non-atom blob */
252
+ #define PL_LIST_PAIR (10) /* [_|_] term */
253
+
254
+ /* PL_unify_term() */
255
+ #define PL_FUNCTOR (11) /* functor_t, arg ... */
256
+ #define PL_LIST (12) /* length, arg ... */
257
+ #define PL_CHARS (13) /* const char * */
258
+ #define PL_POINTER (14) /* void * */
259
+ /* PlArg::PlArg(text, type) */
260
+ #define PL_CODE_LIST (15) /* [ascii...] */
261
+ #define PL_CHAR_LIST (16) /* [h,e,l,l,o] */
262
+ #define PL_BOOL (17) /* PL_set_prolog_flag() */
263
+ #define PL_FUNCTOR_CHARS (18) /* PL_unify_term() */
264
+ #define _PL_PREDICATE_INDICATOR (19) /* predicate_t (Procedure) */
265
+ #define PL_SHORT (20) /* short */
266
+ #define PL_INT (21) /* int */
267
+ #define PL_LONG (22) /* long */
268
+ #define PL_DOUBLE (23) /* double */
269
+ #define PL_NCHARS (24) /* size_t, const char * */
270
+ #define PL_UTF8_CHARS (25) /* const char * */
271
+ #define PL_UTF8_STRING (26) /* const char * */
272
+ #define PL_INT64 (27) /* int64_t */
273
+ #define PL_NUTF8_CHARS (28) /* size_t, const char * */
274
+ #define PL_NUTF8_CODES (29) /* size_t, const char * */
275
+ #define PL_NUTF8_STRING (30) /* size_t, const char * */
276
+ #define PL_NWCHARS (31) /* size_t, const wchar_t * */
277
+ #define PL_NWCODES (32) /* size_t, const wchar_t * */
278
+ #define PL_NWSTRING (33) /* size_t, const wchar_t * */
279
+ #define PL_MBCHARS (34) /* const char * */
280
+ #define PL_MBCODES (35) /* const char * */
281
+ #define PL_MBSTRING (36) /* const char * */
282
+ #define PL_INTPTR (37) /* intptr_t */
283
+ #define PL_CHAR (38) /* int */
284
+ #define PL_CODE (39) /* int */
285
+ #define PL_BYTE (40) /* int */
286
+ /* PL_skip_list() */
287
+ #define PL_PARTIAL_LIST (41) /* a partial list */
288
+ #define PL_CYCLIC_TERM (42) /* a cyclic list/term */
289
+ #define PL_NOT_A_LIST (43) /* Object is not a list */
290
+ /* dicts */
291
+ #define PL_DICT (44)
292
+ #define PL_SWORD (45) /* Signed word (internal) */
293
+
294
+ /* Or'ed flags for PL_set_prolog_flag() */
295
+ /* Keep consistent with more flags in `os/pl-prologflag.h` */
296
+ #define FF_READONLY 0x001000 /* Read-only prolog flag */
297
+ #define FF_KEEP 0x002000 /* keep prolog flag if already set */
298
+ #define FF_NOCREATE 0x004000 /* Fail if flag is non-existent */
299
+ #define FF_FORCE 0x008000 /* Force setting, overwrite READONLY */
300
+ #define FF_LOCAL 0x010000 /* Force creating only locally */
301
+ #define FF_GLOBAL 0x020000 /* Force setting globally */
302
+
303
+ /********************************
304
+ * DETERMINISTIC CALL/RETURN *
305
+ *********************************/
306
+
307
+ /* PL_succeed and PL_fail are deprecated */
308
+ #define PL_succeed return true /* succeed deterministically */
309
+ #define PL_fail return false /* fail */
310
+
311
+
312
+ /********************************
313
+ * NON-DETERMINISTIC CALL/RETURN *
314
+ *********************************/
315
+
316
+ /* Note 1: Non-deterministic foreign functions may also use the deterministic
317
+ return methods PL_succeed and PL_fail.
318
+
319
+ Note 2: The argument to PL_retry is a sizeof(ptr)-2 bits signed
320
+ integer (use type intptr_t).
321
+ */
322
+
323
+ #define PL_FIRST_CALL (0)
324
+ #define PL_CUTTED (1) /* deprecated */
325
+ #define PL_PRUNED (1)
326
+ #define PL_REDO (2)
327
+ #define PL_RESUME (3)
328
+
329
+ #define PL_retry(n) return _PL_retry(n)
330
+ #define PL_retry_address(a) return _PL_retry_address(a)
331
+ #define PL_yield_address(a) return _PL_yield_address(a)
332
+
333
+ PL_EXPORT(foreign_t) _PL_retry(intptr_t);
334
+ PL_EXPORT(foreign_t) _PL_retry_address(void *);
335
+ PL_EXPORT(foreign_t) _PL_yield_address(void *);
336
+ PL_EXPORT(int) PL_foreign_control(control_t);
337
+ PL_EXPORT(intptr_t) PL_foreign_context(control_t);
338
+ PL_EXPORT(void *) PL_foreign_context_address(control_t);
339
+ PL_EXPORT(predicate_t) PL_foreign_context_predicate(control_t);
340
+
341
+
342
+ /********************************
343
+ * REGISTERING FOREIGNS *
344
+ *********************************/
345
+
346
+ typedef struct PL_extension
347
+ { const char *predicate_name; /* Name of the predicate */
348
+ short arity; /* Arity of the predicate */
349
+ pl_function_t function; /* Implementing functions */
350
+ short flags; /* Or of PL_FA_... */
351
+ } PL_extension;
352
+
353
+ #define PL_FA_NOTRACE (0x01) /* foreign cannot be traced */
354
+ #define PL_FA_TRANSPARENT (0x02) /* foreign is module transparent (deprecated) */
355
+ #define PL_FA_NONDETERMINISTIC (0x04) /* foreign is non-deterministic */
356
+ #define PL_FA_VARARGS (0x08) /* call using t0, ac, ctx */
357
+ #define PL_FA_CREF (0x10) /* Internal: has clause-reference */
358
+ #define PL_FA_ISO (0x20) /* Internal: ISO core predicate */
359
+ #define PL_FA_META (0x40) /* Additional meta-argument spec */
360
+ #define PL_FA_SIG_ATOMIC (0x80) /* Internal: do not dispatch signals */
361
+
362
+ extern PL_extension PL_extensions[]; /* not Win32! */
363
+ PL_EXPORT(void) PL_register_extensions(const PL_extension *e);
364
+ PL_EXPORT(void) PL_register_extensions_in_module(const char *module, const PL_extension *e);
365
+ PL_EXPORT(bool) PL_register_foreign(const char *name, int arity,
366
+ pl_function_t func,
367
+ int flags, ...);
368
+ PL_EXPORT(bool) PL_register_foreign_in_module(const char *module,
369
+ const char *name, int arity,
370
+ pl_function_t func,
371
+ int flags, ...);
372
+ PL_EXPORT(void) PL_load_extensions(const PL_extension *e); /* WDEPRECATED */
373
+
374
+ /*******************************
375
+ * LICENSE *
376
+ *******************************/
377
+
378
+ PL_EXPORT(void) PL_license(const char *license, const char *module);
379
+
380
+ /********************************
381
+ * MODULES *
382
+ *********************************/
383
+
384
+ PL_EXPORT(module_t) PL_context(void);
385
+ PL_EXPORT(atom_t) PL_module_name(module_t module);
386
+ PL_EXPORT(module_t) PL_new_module(atom_t name);
387
+ PL_EXPORT(bool) PL_strip_module(term_t in, module_t *m, term_t out) WUNUSED;
388
+
389
+ /*******************************
390
+ * CONSTANTS *
391
+ *******************************/
392
+
393
+ PL_EXPORT(const atom_t) *_PL_atoms(void); /* base of reserved (meta-)atoms */
394
+ #ifndef PL_KERNEL
395
+ #define ATOM_nil (_PL_atoms()[0]) /* `[]` */
396
+ #define ATOM_dot (_PL_atoms()[1]) /* `.` */
397
+ #endif /*PL_KERNEL*/
398
+
399
+
400
+ /*******************************
401
+ * CALL-BACK *
402
+ *******************************/
403
+
404
+ #ifdef PL_KERNEL
405
+ #define PL_Q_DEBUG 0x0001 /* = true for backward compatibility */
406
+ #endif
407
+ #define PL_Q_NORMAL 0x0002 /* debug/print exceptions, pass bool */
408
+ #define PL_Q_NODEBUG 0x0004 /* Run in nodebug mode */
409
+ #define PL_Q_CATCH_EXCEPTION 0x0008 /* handle exceptions in C */
410
+ #define PL_Q_PASS_EXCEPTION 0x0010 /* pass to parent environment */
411
+ #define PL_Q_ALLOW_YIELD 0x0020 /* Support I_YIELD */
412
+ #define PL_Q_EXT_STATUS 0x0040 /* Return extended status */
413
+ #define PL_Q_EXCEPT_HALT 0x0080 /* Handles unwind(halt(Status)) */
414
+ #define PL_Q_TRACE_WITH_YIELD 0x0100 /* Yield for debug actions */
415
+ #ifdef PL_KERNEL
416
+ #define PL_Q_DETERMINISTIC 0x1000 /* call was deterministic */
417
+ #define PL_Q_EXCEPT_THREAD_EXIT 0x2000 /* Handles unwind(thread_exit(Term)) */
418
+ #endif
419
+
420
+ /* PL_Q_EXT_STATUS return codes */
421
+ #define PL_S_NOT_INNER -2 /* Query is not inner query */
422
+ #define PL_S_EXCEPTION -1 /* Query raised exception */
423
+ #define PL_S_FALSE 0 /* Query failed (=false) */
424
+ #define PL_S_TRUE 1 /* Query succeeded with choicepoint (=true)*/
425
+ #define PL_S_LAST 2 /* Query succeeded without CP */
426
+ #define PL_S_YIELD_DEBUG 254 /* Yield on behalf of the debugger */
427
+ #define PL_S_YIELD 255 /* Foreign yield */
428
+
429
+ #define PL_MAX_QUERY_DATA 2 /* Max offset for PL_query_data() */
430
+
431
+ /* Foreign context frames */
432
+ PL_EXPORT(fid_t) PL_open_foreign_frame(void);
433
+ PL_EXPORT(void) PL_rewind_foreign_frame(fid_t cid);
434
+ PL_EXPORT(void) PL_close_foreign_frame(fid_t cid);
435
+ PL_EXPORT(void) PL_discard_foreign_frame(fid_t cid);
436
+
437
+ /* Finding predicates */
438
+ PL_EXPORT(predicate_t) PL_pred(functor_t f, module_t m);
439
+ PL_EXPORT(predicate_t) PL_predicate(const char *name, int arity,
440
+ const char* module);
441
+ PL_EXPORT(bool) PL_predicate_info(predicate_t pred,
442
+ atom_t *name, size_t *arity,
443
+ module_t *module);
444
+
445
+ /* Call-back */
446
+ PL_EXPORT(qid_t) PL_open_query(module_t m, int flags,
447
+ predicate_t pred, term_t t0);
448
+ PL_EXPORT(int) PL_next_solution(qid_t qid) WUNUSED;
449
+ PL_EXPORT(int) PL_close_query(qid_t qid); /* true,false or PL_S_NOT_INNER */
450
+ PL_EXPORT(int) PL_cut_query(qid_t qid); /* true,false or PL_S_NOT_INNER */
451
+ PL_EXPORT(qid_t) PL_current_query(void);
452
+ PL_EXPORT(PL_engine_t) PL_query_engine(qid_t qid);
453
+ PL_EXPORT(term_t) PL_query_arguments(qid_t qid);
454
+ PL_EXPORT(bool) PL_can_yield(void);
455
+ PL_EXPORT(void*) PL_set_query_data(qid_t qid, unsigned int offset,
456
+ void *data);
457
+ PL_EXPORT(void*) PL_query_data(qid_t qid, unsigned int offset);
458
+
459
+ /* Simplified (but less flexible) call-back */
460
+ PL_EXPORT(bool) PL_call(term_t t, module_t m) WUNUSED;
461
+ PL_EXPORT(bool) PL_call_predicate(module_t m, int flags,
462
+ predicate_t pred, term_t t0); /* TODO: WUNUSED */
463
+ /* Handling exceptions */
464
+ PL_EXPORT(term_t) PL_exception(qid_t qid);
465
+ PL_EXPORT(bool) PL_raise_exception(term_t exception);
466
+ PL_EXPORT(bool) PL_throw(term_t exception); /* WDEPRECATED */
467
+ PL_EXPORT(void) PL_clear_exception(void);
468
+ /* Engine-based coroutining */
469
+ PL_EXPORT(term_t) PL_yielded(qid_t qid);
470
+
471
+ /*******************************
472
+ * COROUTINING BASED DEBUGGER *
473
+ *******************************/
474
+
475
+ PL_EXPORT(bool) PL_set_trace_action(term_t action);
476
+ PL_EXPORT(bool) PL_get_trace_context(term_t goal);
477
+
478
+
479
+ /*******************************
480
+ * ASSERT *
481
+ *******************************/
482
+
483
+ #define PL_ASSERTZ 0x0000
484
+ #define PL_ASSERTA 0x0001
485
+ #define PL_CREATE_THREAD_LOCAL 0x0010
486
+ #define PL_CREATE_INCREMENTAL 0x0020
487
+
488
+ PL_EXPORT(bool) PL_assert(term_t term, module_t m, int flags);
489
+
490
+
491
+
492
+
493
+ /*******************************
494
+ * TERM-REFERENCES *
495
+ *******************************/
496
+
497
+ /* Creating and destroying term-refs */
498
+ PL_EXPORT(term_t) PL_new_term_refs(size_t n);
499
+ PL_EXPORT(term_t) PL_new_term_ref(void);
500
+ PL_EXPORT(term_t) PL_copy_term_ref(term_t from);
501
+ PL_EXPORT(void) PL_free_term_ref(term_t t);
502
+ PL_EXPORT(void) PL_reset_term_refs(term_t r);
503
+
504
+ /* Constants */
505
+ PL_EXPORT(atom_t) PL_new_atom(const char *s);
506
+ PL_EXPORT(atom_t) PL_new_atom_nchars(size_t len, const char *s);
507
+ PL_EXPORT(atom_t) PL_new_atom_wchars(size_t len, const pl_wchar_t *s);
508
+ PL_EXPORT(atom_t) PL_new_atom_mbchars(int rep, size_t len, const char *s);
509
+ PL_EXPORT(const char *) PL_atom_chars(atom_t a); /* WDEPRECATED */
510
+ PL_EXPORT(const char *) PL_atom_nchars(atom_t a, size_t *len);
511
+ PL_EXPORT(bool) PL_atom_mbchars(atom_t a, size_t *len, char **s,
512
+ unsigned int flags);
513
+ PL_EXPORT(const wchar_t *) PL_atom_wchars(atom_t a, size_t *len);
514
+ PL_EXPORT(void) PL_register_atom(atom_t a);
515
+ PL_EXPORT(void) PL_unregister_atom(atom_t a);
516
+ PL_EXPORT(size_t) PL_atom_index(atom_t index);
517
+ PL_EXPORT(atom_t) PL_atom_from_index(size_t a);
518
+ #ifdef O_DEBUG_ATOMGC
519
+ #if defined(_MSC_VER) && !defined(__PRETTY_FUNCTION__)
520
+ #define __PRETTY_FUNCTION__ __FUNCSIG__
521
+ #endif
522
+ #define PL_register_atom(a) \
523
+ _PL_debug_register_atom(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
524
+ #define PL_unregister_atom(a) \
525
+ _PL_debug_unregister_atom(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
526
+ PL_EXPORT(void) _PL_debug_register_atom(atom_t a,
527
+ const char *file, int line,
528
+ const char *func);
529
+ PL_EXPORT(void) _PL_debug_unregister_atom(atom_t a,
530
+ const char *file, int line,
531
+ const char *func);
532
+ #endif
533
+ PL_EXPORT(functor_t) PL_new_functor_sz(atom_t f, size_t a);
534
+ PL_EXPORT(functor_t) PL_new_functor(atom_t f, int a);
535
+ PL_EXPORT(atom_t) PL_functor_name(functor_t f);
536
+ PL_EXPORT(int) PL_functor_arity(functor_t f);
537
+ PL_EXPORT(size_t) PL_functor_arity_sz(functor_t f);
538
+
539
+ /* Get C-values from Prolog terms */
540
+ PL_EXPORT(bool) PL_get_atom(term_t t, atom_t *a) WUNUSED;
541
+ PL_EXPORT(bool) PL_get_bool(term_t t, int *value) WUNUSED;
542
+ PL_EXPORT(bool) PL_get_atom_chars(term_t t, char **a) WUNUSED;
543
+ #define PL_get_string_chars(t, s, l) PL_get_string(t,s,l)
544
+ PL_EXPORT(bool) PL_get_string(term_t t, char **s, size_t *len) WUNUSED; /* WDEPRECATED */
545
+ PL_EXPORT(bool) PL_get_chars(term_t t, char **s, unsigned int flags) WUNUSED;
546
+ PL_EXPORT(bool) PL_get_list_chars(term_t l, char **s,
547
+ unsigned int flags) WUNUSED;
548
+ PL_EXPORT(bool) PL_get_atom_nchars(term_t t, size_t *len, char **a) WUNUSED;
549
+ PL_EXPORT(bool) PL_get_list_nchars(term_t l,
550
+ size_t *len, char **s,
551
+ unsigned int flags) WUNUSED;
552
+ PL_EXPORT(bool) PL_get_nchars(term_t t,
553
+ size_t *len, char **s,
554
+ unsigned int flags) WUNUSED;
555
+ PL_EXPORT(bool) PL_get_integer(term_t t, int *i) WUNUSED;
556
+ PL_EXPORT(bool) PL_get_long(term_t t, long *i) WUNUSED;
557
+ PL_EXPORT(bool) PL_get_intptr(term_t t, intptr_t *i) WUNUSED;
558
+ PL_EXPORT(bool) PL_get_pointer(term_t t, void **ptr) WUNUSED;
559
+ PL_EXPORT(bool) PL_get_float(term_t t, double *f) WUNUSED;
560
+ PL_EXPORT(bool) PL_get_functor(term_t t, functor_t *f) WUNUSED;
561
+ PL_EXPORT(bool) PL_get_name_arity_sz(term_t t, atom_t *name,
562
+ size_t *arity) WUNUSED;
563
+ PL_EXPORT(bool) PL_get_compound_name_arity_sz(term_t t, atom_t *name,
564
+ size_t *arity) WUNUSED;
565
+ PL_EXPORT(bool) PL_get_name_arity(term_t t, atom_t *name,
566
+ int *arity) WUNUSED;
567
+ PL_EXPORT(bool) PL_get_compound_name_arity(term_t t, atom_t *name,
568
+ int *arity) WUNUSED;
569
+ PL_EXPORT(bool) PL_get_module(term_t t, module_t *module) WUNUSED;
570
+ PL_EXPORT(bool) PL_get_arg_sz(size_t index, term_t t, term_t a) WUNUSED;
571
+ PL_EXPORT(bool) PL_get_arg(int index, term_t t, term_t a) WUNUSED;
572
+ PL_EXPORT(bool) PL_get_dict_key(atom_t key, term_t dict, term_t value) WUNUSED;
573
+ PL_EXPORT(bool) PL_get_list(term_t l, term_t h, term_t t) WUNUSED;
574
+ PL_EXPORT(bool) PL_get_head(term_t l, term_t h) WUNUSED;
575
+ PL_EXPORT(bool) PL_get_tail(term_t l, term_t t) WUNUSED;
576
+ PL_EXPORT(bool) PL_get_nil(term_t l) WUNUSED;
577
+ PL_EXPORT(int) PL_get_term_value(term_t t, term_value_t *v) WUNUSED; /* deprecated - doesn't handle big ints, rationals, etc */
578
+ PL_EXPORT(char *) PL_quote(int chr, const char *data);
579
+ #define PL_FOR_DICT_SORTED 0x1
580
+ PL_EXPORT(int) PL_for_dict(term_t dict,
581
+ int (*func)(term_t key, term_t value, void *closure),
582
+ void *closure,
583
+ int flags);
584
+
585
+ /* Verify types */
586
+ PL_EXPORT(int) PL_term_type(term_t t);
587
+ PL_EXPORT(bool) PL_is_variable(term_t t);
588
+ PL_EXPORT(bool) PL_is_ground(term_t t);
589
+ PL_EXPORT(bool) PL_is_atom(term_t t);
590
+ PL_EXPORT(bool) PL_is_integer(term_t t);
591
+ PL_EXPORT(bool) PL_is_string(term_t t);
592
+ PL_EXPORT(bool) PL_is_float(term_t t);
593
+ PL_EXPORT(bool) PL_is_rational(term_t t);
594
+ PL_EXPORT(bool) PL_is_compound(term_t t);
595
+ PL_EXPORT(bool) PL_is_callable(term_t t);
596
+ PL_EXPORT(bool) PL_is_functor(term_t t, functor_t f);
597
+ PL_EXPORT(bool) PL_is_list(term_t t);
598
+ PL_EXPORT(bool) PL_is_dict(term_t t);
599
+ PL_EXPORT(bool) PL_is_pair(term_t t);
600
+ PL_EXPORT(bool) PL_is_atomic(term_t t);
601
+ PL_EXPORT(bool) PL_is_number(term_t t);
602
+ PL_EXPORT(bool) PL_is_acyclic(term_t t);
603
+
604
+ /* Assign to term-references */
605
+ PL_EXPORT(bool) PL_put_variable(term_t t);
606
+ PL_EXPORT(bool) PL_put_atom(term_t t, atom_t a);
607
+ PL_EXPORT(bool) PL_put_bool(term_t t, int val);
608
+ PL_EXPORT(bool) PL_put_atom_chars(term_t t, const char *chars);
609
+ PL_EXPORT(bool) PL_put_string_chars(term_t t, const char *chars) WUNUSED;
610
+ PL_EXPORT(bool) PL_put_chars(term_t t, int flags,
611
+ size_t len, const char *chars) WUNUSED;
612
+ PL_EXPORT(bool) PL_put_list_chars(term_t t, const char *chars) WUNUSED;
613
+ PL_EXPORT(bool) PL_put_list_codes(term_t t, const char *chars) WUNUSED;
614
+ PL_EXPORT(bool) PL_put_atom_nchars(term_t t, size_t l, const char *chars);
615
+ PL_EXPORT(bool) PL_put_string_nchars(term_t t, size_t len, const char *chars) WUNUSED;
616
+ PL_EXPORT(bool) PL_put_list_nchars(term_t t, size_t l, const char *chars) WUNUSED;
617
+ PL_EXPORT(bool) PL_put_list_ncodes(term_t t, size_t l, const char *chars) WUNUSED;
618
+ PL_EXPORT(bool) PL_put_integer(term_t t, long i) WUNUSED;
619
+ PL_EXPORT(bool) PL_put_pointer(term_t t, void *ptr) WUNUSED;
620
+ PL_EXPORT(bool) PL_put_float(term_t t, double f) WUNUSED;
621
+ PL_EXPORT(bool) PL_put_functor(term_t t, functor_t functor) WUNUSED;
622
+ PL_EXPORT(bool) PL_put_list(term_t l) WUNUSED;
623
+ PL_EXPORT(bool) PL_put_nil(term_t l);
624
+ PL_EXPORT(bool) PL_put_term(term_t t1, term_t t2) WUNUSED;
625
+ PL_EXPORT(bool) PL_put_dict(term_t t, atom_t tag, size_t len,
626
+ const atom_t *keys, term_t values) WUNUSED;
627
+ PL_EXPORT(atom_t) _PL_cons_small_int(int64_t v);
628
+ PL_EXPORT(void) _PL_unregister_keys(size_t len, atom_t *keys);
629
+
630
+ /* construct a functor or list-cell */
631
+ PL_EXPORT(bool) PL_cons_functor(term_t h, functor_t f, ...) WUNUSED;
632
+ PL_EXPORT(bool) PL_cons_functor_v(term_t h, functor_t fd, term_t a0) WUNUSED;
633
+ PL_EXPORT(bool) PL_cons_list(term_t l, term_t h, term_t t) WUNUSED;
634
+
635
+ /* Unify term-references */
636
+ PL_EXPORT(bool) PL_unify(term_t t1, term_t t2) WUNUSED;
637
+ PL_EXPORT(bool) PL_unify_atom(term_t t, atom_t a) WUNUSED;
638
+ PL_EXPORT(bool) PL_unify_atom_chars(term_t t, const char *chars) WUNUSED;
639
+ PL_EXPORT(bool) PL_unify_list_chars(term_t t, const char *chars) WUNUSED;
640
+ PL_EXPORT(bool) PL_unify_list_codes(term_t t, const char *chars) WUNUSED;
641
+ PL_EXPORT(bool) PL_unify_string_chars(term_t t, const char *chars) WUNUSED;
642
+ PL_EXPORT(bool) PL_unify_atom_nchars(term_t t, size_t l, const char *s) WUNUSED;
643
+ PL_EXPORT(bool) PL_unify_list_ncodes(term_t t, size_t l, const char *s) WUNUSED;
644
+ PL_EXPORT(bool) PL_unify_list_nchars(term_t t, size_t l, const char *s) WUNUSED;
645
+ PL_EXPORT(bool) PL_unify_string_nchars(term_t t,
646
+ size_t len,
647
+ const char *chars) WUNUSED;
648
+ PL_EXPORT(bool) PL_unify_bool(term_t t, int n) WUNUSED;
649
+ PL_EXPORT(bool) PL_unify_integer(term_t t, intptr_t n) WUNUSED;
650
+ PL_EXPORT(bool) PL_unify_float(term_t t, double f) WUNUSED;
651
+ PL_EXPORT(bool) PL_unify_pointer(term_t t, void *ptr) WUNUSED;
652
+ PL_EXPORT(bool) PL_unify_functor(term_t t, functor_t f) WUNUSED;
653
+ PL_EXPORT(bool) PL_unify_compound(term_t t, functor_t f) WUNUSED;
654
+ PL_EXPORT(bool) PL_unify_list(term_t l, term_t h, term_t t) WUNUSED;
655
+ PL_EXPORT(bool) PL_unify_nil(term_t l) WUNUSED;
656
+ PL_EXPORT(bool) PL_unify_arg_sz(size_t index, term_t t, term_t a) WUNUSED;
657
+ PL_EXPORT(bool) PL_unify_arg(int index, term_t t, term_t a) WUNUSED;
658
+ PL_EXPORT(bool) PL_unify_term(term_t t, ...) WUNUSED;
659
+ PL_EXPORT(bool) PL_unify_chars(term_t t, int flags,
660
+ size_t len, const char *s) WUNUSED;
661
+
662
+ /*******************************
663
+ * LISTS *
664
+ *******************************/
665
+
666
+ PL_EXPORT(int) PL_skip_list(term_t list, term_t tail, size_t *len);
667
+
668
+
669
+ /*******************************
670
+ * WIDE CHARACTER VERSIONS *
671
+ *******************************/
672
+
673
+ PL_EXPORT(bool) PL_put_wchars(term_t t, int type,
674
+ size_t len, const pl_wchar_t *s) WUNUSED;
675
+ PL_EXPORT(bool) PL_unify_wchars(term_t t, int type,
676
+ size_t len, const pl_wchar_t *s) WUNUSED;
677
+ PL_EXPORT(bool) PL_unify_wchars_diff(term_t t, term_t tail, int type,
678
+ size_t len, const pl_wchar_t *s) WUNUSED;
679
+ PL_EXPORT(bool) PL_get_wchars(term_t l,
680
+ size_t *length, pl_wchar_t **s,
681
+ unsigned flags) WUNUSED;
682
+ PL_EXPORT(size_t) PL_utf8_strlen(const char *s, size_t len) WUNUSED;
683
+
684
+
685
+ /*******************************
686
+ * WIDE INTEGERS *
687
+ *******************************/
688
+
689
+
690
+ PL_EXPORT(bool) PL_get_int64(term_t t, int64_t *i) WUNUSED;
691
+ PL_EXPORT(bool) PL_get_uint64(term_t t, uint64_t *i) WUNUSED;
692
+ PL_EXPORT(bool) PL_unify_int64(term_t t, int64_t value) WUNUSED;
693
+ PL_EXPORT(bool) PL_unify_uint64(term_t t, uint64_t value) WUNUSED;
694
+ PL_EXPORT(bool) PL_put_int64(term_t t, int64_t i) WUNUSED;
695
+ PL_EXPORT(bool) PL_put_uint64(term_t t, uint64_t i) WUNUSED;
696
+
697
+
698
+ /*******************************
699
+ * ATTRIBUTED VARIABLES *
700
+ *******************************/
701
+
702
+ PL_EXPORT(bool) PL_is_attvar(term_t t);
703
+ PL_EXPORT(bool) PL_get_attr(term_t v, term_t a);
704
+
705
+
706
+ /*******************************
707
+ * TABLING *
708
+ *******************************/
709
+
710
+ PL_EXPORT(bool) PL_get_delay_list(term_t l);
711
+
712
+
713
+ /*******************************
714
+ * ERRORS *
715
+ *******************************/
716
+
717
+ PL_EXPORT(bool) PL_get_atom_ex(term_t t, atom_t *a);
718
+ PL_EXPORT(bool) PL_get_integer_ex(term_t t, int *i);
719
+ PL_EXPORT(bool) PL_get_long_ex(term_t t, long *i);
720
+ PL_EXPORT(bool) PL_get_int64_ex(term_t t, int64_t *i);
721
+ PL_EXPORT(bool) PL_get_uint64_ex(term_t t, uint64_t *i);
722
+ PL_EXPORT(bool) PL_get_intptr_ex(term_t t, intptr_t *i);
723
+ PL_EXPORT(bool) PL_get_size_ex(term_t t, size_t *i);
724
+ PL_EXPORT(bool) PL_get_bool_ex(term_t t, int *i);
725
+ PL_EXPORT(bool) PL_get_float_ex(term_t t, double *f);
726
+ PL_EXPORT(bool) PL_get_char_ex(term_t t, int *p, int eof);
727
+ PL_EXPORT(bool) PL_unify_bool_ex(term_t t, int val);
728
+ PL_EXPORT(bool) PL_get_pointer_ex(term_t t, void **addrp);
729
+ PL_EXPORT(bool) PL_unify_list_ex(term_t l, term_t h, term_t t);
730
+ PL_EXPORT(bool) PL_unify_nil_ex(term_t l);
731
+ PL_EXPORT(bool) PL_get_list_ex(term_t l, term_t h, term_t t);
732
+ PL_EXPORT(bool) PL_get_nil_ex(term_t l);
733
+
734
+ PL_EXPORT(bool) PL_instantiation_error(term_t culprit);
735
+ PL_EXPORT(bool) PL_uninstantiation_error(term_t culprit);
736
+ PL_EXPORT(bool) PL_representation_error(const char *resource);
737
+ PL_EXPORT(bool) PL_type_error(const char *expected, term_t culprit);
738
+ PL_EXPORT(bool) PL_domain_error(const char *expected, term_t culprit);
739
+ PL_EXPORT(bool) PL_existence_error(const char *type, term_t culprit);
740
+ PL_EXPORT(bool) PL_permission_error(const char *operation,
741
+ const char *type, term_t culprit);
742
+ PL_EXPORT(bool) PL_resource_error(const char *resource);
743
+ PL_EXPORT(bool) PL_syntax_error(const char *msg, IOSTREAM *in);
744
+
745
+ /*******************************
746
+ * BLOBS *
747
+ *******************************/
748
+
749
+ #define PL_BLOB_MAGIC_B 0x75293a00 /* Magic to validate a blob-type */
750
+ #define PL_BLOB_VERSION 1 /* Current version */
751
+ #define PL_BLOB_MAGIC (PL_BLOB_MAGIC_B|PL_BLOB_VERSION)
752
+
753
+ #define PL_BLOB_UNIQUE 0x01 /* Blob content is unique */
754
+ #define PL_BLOB_TEXT 0x02 /* blob contains text */
755
+ #define PL_BLOB_NOCOPY 0x04 /* do not copy the data */
756
+ #define PL_BLOB_WCHAR 0x08 /* wide character string */
757
+
758
+ typedef struct PL_blob_t
759
+ { uintptr_t magic; /* PL_BLOB_MAGIC */
760
+ uintptr_t flags; /* PL_BLOB_* */
761
+ const char * name; /* name of the type */
762
+ int (*release)(atom_t a);
763
+ int (*compare)(atom_t a, atom_t b);
764
+ int (*write)(IOSTREAM *s, atom_t a, int flags);
765
+ void (*acquire)(atom_t a);
766
+ int (*save)(atom_t a, IOSTREAM *s);
767
+ atom_t (*load)(IOSTREAM *s);
768
+ size_t padding; /* Required 0-padding */
769
+ /* private */
770
+ void * reserved[8]; /* for future extension */
771
+ int (*write_ex)(atom_t a, void *context);
772
+ bool registered; /* Already registered? */
773
+ int rank; /* Rank for ordering atoms */
774
+ struct PL_blob_t * next; /* next in registered type-chain */
775
+ atom_t atom_name; /* Name as atom */
776
+ } PL_blob_t;
777
+
778
+ PL_EXPORT(bool) PL_is_blob(term_t t, PL_blob_t **type);
779
+ PL_EXPORT(bool) PL_unify_blob(term_t t, void *blob, size_t len,
780
+ PL_blob_t *type);
781
+ PL_EXPORT(atom_t) PL_new_blob(void *blob, size_t len, PL_blob_t *type);
782
+ PL_EXPORT(bool) PL_put_blob(term_t t, void *blob, size_t len,
783
+ PL_blob_t *type);
784
+ PL_EXPORT(bool) PL_get_blob(term_t t, void **blob, size_t *len,
785
+ PL_blob_t **type);
786
+
787
+ PL_EXPORT(void*) PL_blob_data(atom_t a,
788
+ size_t *len,
789
+ struct PL_blob_t **type);
790
+ PL_EXPORT(bool) PL_free_blob(atom_t blob);
791
+
792
+ PL_EXPORT(void) PL_register_blob_type(PL_blob_t *type);
793
+ PL_EXPORT(PL_blob_t*) PL_find_blob_type(const char* name);
794
+ PL_EXPORT(bool) PL_unregister_blob_type(PL_blob_t *type);
795
+
796
+
797
+ #ifdef __GNU_MP__
798
+
799
+ /*******************************
800
+ * GMP *
801
+ *******************************/
802
+
803
+ PL_EXPORT(bool) PL_get_mpz(term_t t, mpz_t mpz) WUNUSED;
804
+ PL_EXPORT(bool) PL_get_mpq(term_t t, mpq_t mpq) WUNUSED;
805
+ PL_EXPORT(bool) PL_unify_mpz(term_t t, mpz_t mpz) WUNUSED;
806
+ PL_EXPORT(bool) PL_unify_mpq(term_t t, mpq_t mpq) WUNUSED;
807
+
808
+ #endif /*__GNU_MP__*/
809
+
810
+ /*******************************
811
+ * FILENAME SUPPORT *
812
+ *******************************/
813
+
814
+ #define PL_FILE_ABSOLUTE 0x01 /* return absolute path */
815
+ #define PL_FILE_OSPATH 0x02 /* return path in OS notation */
816
+ #define PL_FILE_SEARCH 0x04 /* use file_search_path */
817
+ #define PL_FILE_EXIST 0x08 /* demand file to exist */
818
+ #define PL_FILE_READ 0x10 /* demand read-access */
819
+ #define PL_FILE_WRITE 0x20 /* demand write-access */
820
+ #define PL_FILE_EXECUTE 0x40 /* demand execute-access */
821
+ #define PL_FILE_NOERRORS 0x80 /* do not raise exceptions */
822
+
823
+ PL_EXPORT(bool) PL_get_file_name(term_t n, char **name, int flags);
824
+ PL_EXPORT(bool) PL_get_file_nameW(term_t n, wchar_t **name, int flags);
825
+ PL_EXPORT(void) PL_changed_cwd(void); /* foreign code changed CWD */
826
+ PL_EXPORT(char *) PL_cwd(char *buf, size_t buflen);
827
+
828
+
829
+ /*******************************
830
+ * QUINTUS/SICSTUS WRAPPER *
831
+ *******************************/
832
+
833
+ PL_EXPORT(bool) PL_cvt_i_bool(term_t p, int *c); /* Note "int" because C has no "bool" */
834
+ PL_EXPORT(bool) PL_cvt_i_char(term_t p, char *c);
835
+ PL_EXPORT(bool) PL_cvt_i_schar(term_t p, signed char *c);
836
+ PL_EXPORT(bool) PL_cvt_i_uchar(term_t p, unsigned char *c);
837
+ PL_EXPORT(bool) PL_cvt_i_short(term_t p, short *s);
838
+ PL_EXPORT(bool) PL_cvt_i_ushort(term_t p, unsigned short *s);
839
+ PL_EXPORT(bool) PL_cvt_i_int(term_t p, int *c);
840
+ PL_EXPORT(bool) PL_cvt_i_uint(term_t p, unsigned int *c);
841
+ PL_EXPORT(bool) PL_cvt_i_long(term_t p, long *c);
842
+ PL_EXPORT(bool) PL_cvt_i_ulong(term_t p, unsigned long *c);
843
+ PL_EXPORT(bool) PL_cvt_i_llong(term_t p, long long *c);
844
+ PL_EXPORT(bool) PL_cvt_i_ullong(term_t p, unsigned long long *c);
845
+ PL_EXPORT(bool) PL_cvt_i_int32(term_t p, int32_t *c);
846
+ PL_EXPORT(bool) PL_cvt_i_uint32(term_t p, uint32_t *c);
847
+ PL_EXPORT(bool) PL_cvt_i_int64(term_t p, int64_t *c);
848
+ PL_EXPORT(bool) PL_cvt_i_uint64(term_t p, uint64_t *c);
849
+ PL_EXPORT(bool) PL_cvt_i_size_t(term_t p, size_t *c);
850
+ PL_EXPORT(bool) PL_cvt_i_float(term_t p, double *c);
851
+ PL_EXPORT(bool) PL_cvt_i_single(term_t p, float *c);
852
+ PL_EXPORT(bool) PL_cvt_i_string(term_t p, char **c);
853
+ PL_EXPORT(bool) PL_cvt_i_codes(term_t p, char **c);
854
+ PL_EXPORT(bool) PL_cvt_i_atom(term_t p, atom_t *c);
855
+ PL_EXPORT(bool) PL_cvt_i_address(term_t p, void *c);
856
+ PL_EXPORT(bool) PL_cvt_o_int64(int64_t c, term_t p);
857
+ PL_EXPORT(bool) PL_cvt_o_float(double c, term_t p);
858
+ PL_EXPORT(bool) PL_cvt_o_single(float c, term_t p);
859
+ PL_EXPORT(bool) PL_cvt_o_string(const char *c, term_t p);
860
+ PL_EXPORT(bool) PL_cvt_o_codes(const char *c, term_t p);
861
+ PL_EXPORT(bool) PL_cvt_o_atom(atom_t c, term_t p);
862
+ PL_EXPORT(bool) PL_cvt_o_address(void *address, term_t p);
863
+ PL_EXPORT(term_t) PL_new_nil_ref(void);
864
+
865
+ /* set/get encoding for PL_cvt_*_string() functions. The default
866
+ is UTF-8 (REP_UTF8)
867
+ */
868
+
869
+ PL_EXPORT(int) PL_cvt_encoding(void);
870
+ PL_EXPORT(bool) PL_cvt_set_encoding(int enc);
871
+ PL_EXPORT(void) SP_set_state(int state);
872
+ PL_EXPORT(int) SP_get_state(void);
873
+
874
+
875
+ /*******************************
876
+ * COMPARE *
877
+ *******************************/
878
+
879
+ PL_EXPORT(int) PL_compare(term_t t1, term_t t2);
880
+ PL_EXPORT(bool) PL_same_compound(term_t t1, term_t t2);
881
+
882
+ /*******************************
883
+ * MESSAGES *
884
+ *******************************/
885
+ #if !defined(WPRINTF12)
886
+ /* these macros are duplicated in SWI-Streams.h */
887
+ #if defined(CHECK_FORMAT)
888
+ #define WPRINTF12 __attribute__ ((format (printf, 1, 2)))
889
+ #define WPRINTF23 __attribute__ ((format (printf, 2, 3)))
890
+ #define WPRINTF34 __attribute__ ((format (printf, 3, 4)))
891
+ #else
892
+ #define WPRINTF12
893
+ #define WPRINTF23
894
+ #define WPRINTF34
895
+ #endif
896
+ #endif
897
+
898
+ PL_EXPORT(bool) PL_warning(const char *fmt, ...) WPRINTF12;
899
+ PL_EXPORT(bool) PL_warningX(const char *fmt, ...);
900
+ PL_EXPORT(void) PL_fatal_error(const char *fmt, ...) WPRINTF12;
901
+ PL_EXPORT(void) PL_api_error(const char *fmt, ...) WPRINTF12;
902
+ PL_EXPORT(void) PL_system_error(const char *fmt, ...) WPRINTF12;
903
+ PL_EXPORT(bool) PL_print_message(atom_t severity, ...) WUNUSED;
904
+
905
+ /*******************************
906
+ * RECORDED DATABASE *
907
+ *******************************/
908
+
909
+ PL_EXPORT(record_t) PL_record(term_t term);
910
+ PL_EXPORT(bool) PL_recorded(record_t record, term_t term);
911
+ PL_EXPORT(void) PL_erase(record_t record);
912
+ PL_EXPORT(record_t) PL_duplicate_record(record_t r);
913
+
914
+ PL_EXPORT(char *) PL_record_external(term_t t, size_t *size);
915
+ PL_EXPORT(bool) PL_recorded_external(const char *rec, term_t term);
916
+ PL_EXPORT(bool) PL_erase_external(char *rec);
917
+
918
+ /*******************************
919
+ * PROLOG FLAGS *
920
+ *******************************/
921
+
922
+ #define PL_set_feature PL_set_prolog_flag /* compatibility */
923
+ PL_EXPORT(bool) PL_set_prolog_flag(const char *name, int type, ...);
924
+
925
+
926
+ /*******************************
927
+ * INTERNAL FUNCTIONS *
928
+ *******************************/
929
+
930
+ PL_EXPORT(PL_atomic_t) _PL_get_atomic(term_t t);
931
+ PL_EXPORT(void) _PL_put_atomic(term_t t, PL_atomic_t a);
932
+ PL_EXPORT(bool) PL_unify_atomic(term_t t, PL_atomic_t a);
933
+ PL_EXPORT(bool) _PL_get_arg_sz(size_t index, term_t t, term_t a);
934
+ PL_EXPORT(bool) _PL_get_arg(int index, term_t t, term_t a);
935
+
936
+
937
+ /*******************************
938
+ * CHAR BUFFERS *
939
+ *******************************/
940
+
941
+ #define CVT_ATOM 0x00000001
942
+ #define CVT_STRING 0x00000002
943
+ #define CVT_LIST 0x00000004
944
+ #define CVT_INTEGER 0x00000008
945
+ #define CVT_RATIONAL 0x00000010
946
+ #define CVT_FLOAT 0x00000020
947
+ #define CVT_VARIABLE 0x00000040
948
+ #define CVT_NUMBER (CVT_RATIONAL|CVT_FLOAT)
949
+ #define CVT_ATOMIC (CVT_NUMBER|CVT_ATOM|CVT_STRING)
950
+ #define CVT_WRITE 0x00000080
951
+ #define CVT_WRITE_CANONICAL 0x00000100
952
+ #define CVT_WRITEQ 0x00000200
953
+ #define CVT_ALL (CVT_ATOMIC|CVT_LIST)
954
+ #define CVT_XINTEGER (0x00000400|CVT_INTEGER)
955
+ #define CVT_MASK 0x00000fff
956
+
957
+ #define CVT_EXCEPTION 0x00001000 /* throw exception on error */
958
+ #define CVT_VARNOFAIL 0x00002000 /* return 2 if argument is unbound */
959
+
960
+ #define BUF_DISCARDABLE 0x00000000 /* Store in single thread-local buffer */
961
+ #define BUF_STACK 0x00010000 /* Store in stack of buffers */
962
+ #define BUF_MALLOC 0x00020000 /* Store using PL_malloc() */
963
+ #define BUF_ALLOW_STACK 0x00040000 /* Allow pointer into (global) stack */
964
+
965
+ #define BUF_RING BUF_STACK /* legacy ring buffer */
966
+
967
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
968
+ Output representation for PL_get_chars() and friends. The
969
+ prepresentation type REP_FN is for PL_get_file_name() and friends. On
970
+ Windows we use UTF-8 which is translated by the `XOS' layer to Windows
971
+ UNICODE file functions.
972
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
973
+
974
+ #define REP_ISO_LATIN_1 0x00000000 /* output representation */
975
+ #define REP_UTF8 0x00100000
976
+ #define REP_MB 0x00200000
977
+ #ifdef __WINDOWS__
978
+ #define REP_FN REP_UTF8
979
+ #else
980
+ #define REP_FN REP_MB
981
+ #endif
982
+
983
+ #define PL_DIFF_LIST 0x01000000 /* PL_unify_chars() */
984
+
985
+
986
+ /*******************************
987
+ * STRING BUFFERS *
988
+ *******************************/
989
+
990
+ #define PL_STRINGS_MARK() \
991
+ { buf_mark_t __PL_mark; \
992
+ PL_mark_string_buffers(&__PL_mark);
993
+ #define PL_STRINGS_RELEASE() \
994
+ PL_release_string_buffers_from_mark(__PL_mark); \
995
+ }
996
+
997
+ PL_EXPORT(void) PL_mark_string_buffers(buf_mark_t *mark);
998
+ PL_EXPORT(void) PL_release_string_buffers_from_mark(buf_mark_t mark);
999
+
1000
+
1001
+ /*******************************
1002
+ * STREAM SUPPORT *
1003
+ *******************************/
1004
+
1005
+ /* Make IOSTREAM known to Prolog */
1006
+ #define PL_open_stream PL_unify_stream /* compatibility */
1007
+ PL_EXPORT(bool) PL_unify_stream(term_t t, IOSTREAM *s);
1008
+ PL_EXPORT(bool) PL_get_stream_handle(term_t t, IOSTREAM **s);
1009
+ PL_EXPORT(bool) PL_get_stream(term_t t, IOSTREAM **s, int flags);
1010
+ PL_EXPORT(bool) PL_get_stream_from_blob(atom_t a, IOSTREAM**s, int flags);
1011
+ PL_EXPORT(IOSTREAM*) PL_acquire_stream(IOSTREAM *s);
1012
+ PL_EXPORT(bool) PL_release_stream(IOSTREAM *s);
1013
+ PL_EXPORT(bool) PL_release_stream_noerror(IOSTREAM *s);
1014
+ PL_EXPORT(IOSTREAM *) PL_open_resource(module_t m,
1015
+ const char *name,
1016
+ const char *rc_class,
1017
+ const char *mode);
1018
+
1019
+ PL_EXPORT(IOSTREAM *)*_PL_streams(void); /* base of streams */
1020
+ PL_EXPORT(IOSTREAM *) _PL_stream(int which);
1021
+ #ifndef PL_KERNEL
1022
+ #define Suser_input _PL_stream(0)
1023
+ #define Suser_output _PL_stream(1)
1024
+ #define Suser_error _PL_stream(2)
1025
+ #define Scurrent_input _PL_stream(3)
1026
+ #define Scurrent_output _PL_stream(4)
1027
+ #endif
1028
+
1029
+ #define PL_WRT_QUOTED 0x01 /* quote atoms and strings */
1030
+ #define PL_WRT_IGNOREOPS 0x02 /* ignore list/operators */
1031
+ #define PL_WRT_NUMBERVARS 0x04 /* print $VAR(N) as a variable */
1032
+ #define PL_WRT_PORTRAY 0x08 /* call portray */
1033
+ #define PL_WRT_CHARESCAPES 0x10 /* Output ISO escape sequences */
1034
+ #define PL_WRT_BACKQUOTED_STRING 0x20 /* Write strings as `...` */
1035
+ /* Write attributed variables */
1036
+ #define PL_WRT_ATTVAR_IGNORE 0x040 /* Default: just write the var */
1037
+ #define PL_WRT_ATTVAR_DOTS 0x080 /* Write as Var{...} */
1038
+ #define PL_WRT_ATTVAR_WRITE 0x100 /* Write as Var{Attributes} */
1039
+ #define PL_WRT_ATTVAR_PORTRAY 0x200 /* Use Module:portray_attrs/2 */
1040
+ #define PL_WRT_ATTVAR_MASK \
1041
+ (PL_WRT_ATTVAR_IGNORE | \
1042
+ PL_WRT_ATTVAR_DOTS | \
1043
+ PL_WRT_ATTVAR_WRITE | \
1044
+ PL_WRT_ATTVAR_PORTRAY)
1045
+ #define PL_WRT_BLOB_PORTRAY 0x400 /* Use portray for non-text blobs */
1046
+ #define PL_WRT_NO_CYCLES 0x800 /* Never emit @(Template,Subst) */
1047
+ #define PL_WRT_NEWLINE 0x2000 /* Add a newline */
1048
+ #define PL_WRT_VARNAMES 0x4000 /* Internal: variable_names(List) */
1049
+ #define PL_WRT_BACKQUOTE_IS_SYMBOL 0x8000 /* ` is a symbol char */
1050
+ #define PL_WRT_DOTLISTS 0x10000 /* Write lists as .(A,B) */
1051
+ #define PL_WRT_BRACETERMS 0x20000 /* Write {A} as {}(A) */
1052
+ #define PL_WRT_NODICT 0x40000 /* Do not write dicts pretty */
1053
+ #define PL_WRT_NODOTINATOM 0x80000 /* never write a.b unquoted */
1054
+ #define PL_WRT_NO_LISTS 0x100000 /* Do not write lists as [...] */
1055
+ #define PL_WRT_RAT_NATURAL 0x200000 /* Write rationals as 1/3 */
1056
+ #define PL_WRT_CHARESCAPES_UNICODE 0x400000 /* Use \uXXXX escapes */
1057
+ #define PL_WRT_QUOTE_NON_ASCII 0x800000 /* Quote atoms containing non-ascii */
1058
+ #define PL_WRT_PARTIAL 0x1000000 /* Partial output */
1059
+ #define PL_WRT_NO_CHARESCAPES 0x2000000 /* Do not Output ISO escapes */
1060
+ #define PL_WRT_INFIX_COMMA 0x4000000 /* Write (a,b), with PL_WRT_IGNOREOPS */
1061
+
1062
+ #define PL_WRT_PORTABLE (PL_WRT_IGNOREOPS|PL_WRT_INFIX_COMMA)
1063
+
1064
+ PL_EXPORT(bool) PL_write_term(IOSTREAM *s,
1065
+ term_t term,
1066
+ int precedence,
1067
+ int flags);
1068
+
1069
+ /* PL_ttymode() results */
1070
+ #define PL_NOTTY 0 /* -tty in effect */
1071
+ #define PL_RAWTTY 1 /* get_single_char/1 */
1072
+ #define PL_COOKEDTTY 2 /* normal input */
1073
+
1074
+ PL_EXPORT(int) PL_ttymode(IOSTREAM *s);
1075
+
1076
+ PL_EXPORT(bool) PL_put_term_from_chars(term_t t, int flags,
1077
+ size_t len, const char *s);
1078
+ PL_EXPORT(bool) PL_chars_to_term(const char *chars,
1079
+ term_t term);
1080
+ PL_EXPORT(bool) PL_wchars_to_term(const pl_wchar_t *chars,
1081
+ term_t term);
1082
+
1083
+
1084
+ /*******************************
1085
+ * EMBEDDING *
1086
+ *******************************/
1087
+
1088
+ #define PL_CLEANUP_STATUS_MASK (0x0ffff)
1089
+ #define PL_CLEANUP_NO_RECLAIM_MEMORY (0x10000)
1090
+ #define PL_CLEANUP_NO_CANCEL (0x20000)
1091
+ #define PL_HALT_WITH_EXCEPTION (0x40000)
1092
+
1093
+ #define PL_CLEANUP_CANCELED 0
1094
+ #define PL_CLEANUP_SUCCESS 1
1095
+ #define PL_CLEANUP_FAILED -1
1096
+ #define PL_CLEANUP_RECURSIVE -2
1097
+
1098
+ PL_EXPORT(bool) PL_initialise(int argc, char **argv);
1099
+ PL_EXPORT(bool) PL_winitialise(int argc, wchar_t **argv);
1100
+ PL_EXPORT(bool) PL_is_initialised(int *argc, char ***argv);
1101
+ PL_EXPORT(bool) PL_set_resource_db_mem(const unsigned char *data,
1102
+ size_t size);
1103
+ PL_EXPORT(bool) PL_toplevel(void);
1104
+ PL_EXPORT(int) PL_cleanup(int status);
1105
+ PL_EXPORT(void) PL_cleanup_fork(void);
1106
+ PL_EXPORT(bool) PL_halt(int status);
1107
+
1108
+ /*******************************
1109
+ * DYNAMIC LINKING *
1110
+ *******************************/
1111
+
1112
+ PL_EXPORT(void *) PL_dlopen(const char *file, int flags);
1113
+ PL_EXPORT(const char *) PL_dlerror(void);
1114
+ PL_EXPORT(void *) PL_dlsym(void *handle, char *symbol);
1115
+ PL_EXPORT(int) PL_dlclose(void *handle);
1116
+
1117
+
1118
+ /*******************************
1119
+ * INPUT/PROMPT/ETC *
1120
+ *******************************/
1121
+
1122
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1123
+ NOTE: the functions in this section are not documented, as as yet not
1124
+ adviced for public usage. They are support commandline editors such as
1125
+ libedit.
1126
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1127
+
1128
+ PL_EXPORT(void) PL_add_to_protocol(const char *buf, size_t count);
1129
+ PL_EXPORT(char *) PL_prompt_string(IOSTREAM *in);
1130
+ PL_EXPORT(void) PL_write_prompt(bool dowrite);
1131
+ PL_EXPORT(void) PL_prompt_next(IOSTREAM *in);
1132
+ PL_EXPORT(char *) PL_atom_generator(const char *prefix, int state);
1133
+ PL_EXPORT(pl_wchar_t*) PL_atom_generator_w(const pl_wchar_t *pref,
1134
+ pl_wchar_t *buffer,
1135
+ size_t buflen,
1136
+ int state);
1137
+
1138
+
1139
+ /*******************************
1140
+ * MEMORY ALLOCATION *
1141
+ *******************************/
1142
+
1143
+ PL_EXPORT(void *) PL_malloc(size_t size);
1144
+ PL_EXPORT(void *) PL_malloc_atomic(size_t size);
1145
+ PL_EXPORT(void *) PL_malloc_uncollectable(size_t size);
1146
+ PL_EXPORT(void *) PL_malloc_atomic_uncollectable(size_t size);
1147
+ PL_EXPORT(void *) PL_realloc(void *mem, size_t size);
1148
+ PL_EXPORT(void *) PL_malloc_unmanaged(size_t size);
1149
+ PL_EXPORT(void *) PL_malloc_atomic_unmanaged(size_t size);
1150
+ PL_EXPORT(void) PL_free(void *mem);
1151
+ PL_EXPORT(bool) PL_linger(void *mem);
1152
+
1153
+
1154
+ /********************************
1155
+ * HOOKS *
1156
+ ********************************/
1157
+
1158
+ /* PL_dispatch() modes */
1159
+ #define PL_DISPATCH_NOWAIT 0 /* Dispatch only once */
1160
+ #define PL_DISPATCH_WAIT 1 /* Dispatch till input available */
1161
+ #define PL_DISPATCH_INSTALLED 2 /* dispatch function installed? */
1162
+
1163
+ #define PL_DISPATCH_INPUT 0 /* There is input available */
1164
+ #define PL_DISPATCH_TIMEOUT 1 /* Dispatch timeout */
1165
+
1166
+ typedef int (*PL_dispatch_hook_t)(IOSTREAM *fd);
1167
+ typedef void (*PL_abort_hook_t)(void);
1168
+ typedef void (*PL_initialise_hook_t)(int argc, char **argv);
1169
+ typedef int (*PL_agc_hook_t)(atom_t a);
1170
+
1171
+ PL_EXPORT(bool) PL_dispatch(IOSTREAM *fd, int wait);
1172
+ PL_EXPORT(PL_dispatch_hook_t) PL_dispatch_hook(PL_dispatch_hook_t);
1173
+ PL_EXPORT(void) PL_abort_hook(PL_abort_hook_t);
1174
+ PL_EXPORT(void) PL_initialise_hook(PL_initialise_hook_t);
1175
+ PL_EXPORT(bool) PL_abort_unhook(PL_abort_hook_t);
1176
+ PL_EXPORT(PL_agc_hook_t) PL_agc_hook(PL_agc_hook_t);
1177
+
1178
+
1179
+ /*******************************
1180
+ * OPTIONS *
1181
+ *******************************/
1182
+
1183
+ typedef enum
1184
+ { _OPT_END = -1,
1185
+ OPT_BOOL = 0, /* int */
1186
+ OPT_INT, /* int */
1187
+ OPT_INT64, /* int64_t */
1188
+ OPT_UINT64, /* uint64_t */
1189
+ OPT_SIZE, /* size_t */
1190
+ OPT_DOUBLE, /* double */
1191
+ OPT_STRING, /* char* (UTF-8) */
1192
+ OPT_ATOM, /* atom_t */
1193
+ OPT_TERM, /* term_t */
1194
+ OPT_LOCALE /* void* */
1195
+ } _PL_opt_enum_t;
1196
+
1197
+ #define OPT_TYPE_MASK 0xff
1198
+ #define OPT_INF 0x100 /* allow 'inf' */
1199
+
1200
+ #define OPT_UNKNOWN_DEFAULT 0x0 /* Default (from flag) */
1201
+ #define OPT_UNKNOWN_ERROR 0x1 /* Unknown Prolog flags raise error */
1202
+ #define OPT_UNKNOWN_IGNORE 0x2 /* Unknown Prolog flags are ignored */
1203
+ #define OPT_UNKNOWN_WARNING 0x3 /* Unknown Prolog flags warn */
1204
+ #define OPT_UNKNOWN_MASK 0x3
1205
+ #define OPT_ALL OPT_UNKNOWN_ERROR /* Compatibility; deprecated */
1206
+
1207
+ typedef struct
1208
+ { atom_t name; /* Name of option */
1209
+ _PL_opt_enum_t type; /* Type of option */
1210
+ const char * string; /* For foreign access */
1211
+ } PL_option_t;
1212
+
1213
+ #define PL_OPTION(name, type) { 0, type, name }
1214
+ #define PL_OPTIONS_END { 0, _OPT_END, (const char*)0 }
1215
+
1216
+ PL_EXPORT(bool) PL_scan_options(term_t options, int flags, const char *opttype,
1217
+ PL_option_t specs[], ...);
1218
+
1219
+
1220
+ /********************************
1221
+ * SIGNALS *
1222
+ *********************************/
1223
+
1224
+ /* PL_signal() masks (deprecated) */
1225
+ #define PL_SIGSYNC 0x00010000 /* call handler synchronously */
1226
+ #define PL_SIGNOFRAME 0x00020000 /* Do not create a Prolog frame */
1227
+
1228
+ #define PLSIG_THROW 0x0002 /* throw signal(num, name) */
1229
+ #define PLSIG_SYNC 0x0004 /* call synchronously */
1230
+ #define PLSIG_NOFRAME 0x0008 /* Do not create a Prolog frame */
1231
+ #define PLSIG_IGNORE 0x0010 /* ignore signal entirely */
1232
+
1233
+
1234
+
1235
+
1236
+ typedef struct pl_sigaction
1237
+ { void (*sa_cfunction)(int); /* traditional C function */
1238
+ predicate_t sa_predicate; /* call a predicate */
1239
+ int sa_flags; /* additional flags */
1240
+ void *reserved[2]; /* future extentions */
1241
+ } pl_sigaction_t;
1242
+
1243
+
1244
+ PL_EXPORT(void) (*PL_signal(int sig, void (*func)(int)))(int); /* WDEPRECATED */
1245
+ PL_EXPORT(int) PL_sigaction(int sig, pl_sigaction_t *act, pl_sigaction_t *old);
1246
+ PL_EXPORT(void) PL_interrupt(int sig);
1247
+ PL_EXPORT(bool) PL_raise(int sig);
1248
+ PL_EXPORT(int) PL_handle_signals(void);
1249
+ PL_EXPORT(int) PL_get_signum_ex(term_t sig, int *n);
1250
+
1251
+
1252
+ /********************************
1253
+ * PROLOG ACTION/QUERY *
1254
+ *********************************/
1255
+
1256
+ #define PL_ACTION_TRACE 1 /* switch to trace mode */
1257
+ #define PL_ACTION_DEBUG 2 /* switch to debug mode */
1258
+ #define PL_ACTION_BACKTRACE 3 /* show a backtrace (stack dump) */
1259
+ #define PL_ACTION_BREAK 4 /* create a break environment */
1260
+ #define PL_ACTION_HALT 5 /* halt Prolog execution */
1261
+ #define PL_ACTION_ABORT 6 /* generate a Prolog abort */
1262
+ /* 7: Obsolete PL_ACTION_SYMBOLFILE */
1263
+ #define PL_ACTION_WRITE 8 /* write via Prolog i/o buffer */
1264
+ #define PL_ACTION_FLUSH 9 /* Flush Prolog i/o buffer */
1265
+ #define PL_ACTION_GUIAPP 10 /* Win32: set when this is a gui */
1266
+ #define PL_ACTION_ATTACH_CONSOLE 11 /* MT: Attach a console */
1267
+ #define PL_GMP_SET_ALLOC_FUNCTIONS 12 /* GMP: do not change allocation functions */
1268
+ #define PL_ACTION_TRADITIONAL 13 /* Set --traditional */
1269
+
1270
+ #define PL_BT_SAFE 0x1 /* Do not try to print goals */
1271
+ #define PL_BT_USER 0x2 /* Only show user-goals */
1272
+
1273
+ PL_EXPORT(bool) PL_action(int, ...); /* perform some action */
1274
+ PL_EXPORT(void) PL_on_halt(int (*)(int, void *), void *);
1275
+ PL_EXPORT(void) PL_exit_hook(int (*)(int, void *), void *);
1276
+ PL_EXPORT(void) PL_backtrace(int depth, int flags);
1277
+ PL_EXPORT(char *) PL_backtrace_string(int depth, int flags);
1278
+ PL_EXPORT(bool) PL_check_data(term_t data);
1279
+ PL_EXPORT(bool) PL_check_stacks(void);
1280
+ PL_EXPORT(bool) PL_current_prolog_flag(atom_t name, int type, void *ptr);
1281
+
1282
+
1283
+ /*******************************
1284
+ * VERSIONS *
1285
+ *******************************/
1286
+
1287
+ #define PL_VERSION_SYSTEM 1 /* Prolog version */
1288
+ #define PL_VERSION_FLI 2 /* PL_* compatibility */
1289
+ #define PL_VERSION_REC 3 /* PL_record_external() compatibility */
1290
+ #define PL_VERSION_QLF 4 /* Saved QLF format version */
1291
+ #define PL_VERSION_QLF_LOAD 5 /* Min loadable QLF format version */
1292
+ #define PL_VERSION_VM 6 /* VM signature */
1293
+ #define PL_VERSION_BUILT_IN 7 /* Built-in predicate signature */
1294
+
1295
+ #define PL_version(id) PL_version_info(id)
1296
+ PL_EXPORT(unsigned int) PL_version_info(int which);
1297
+
1298
+
1299
+ /********************************
1300
+ * QUERY PROLOG *
1301
+ *********************************/
1302
+
1303
+ #define PL_QUERY_ARGC 1 /* return main() argc */
1304
+ #define PL_QUERY_ARGV 2 /* return main() argv */
1305
+ /* 3: Obsolete PL_QUERY_SYMBOLFILE */
1306
+ /* 4: Obsolete PL_QUERY_ORGSYMBOLFILE*/
1307
+ #define PL_QUERY_GETC 5 /* Read character from terminal */
1308
+ #define PL_QUERY_MAX_INTEGER 6 /* largest integer */
1309
+ #define PL_QUERY_MIN_INTEGER 7 /* smallest integer */
1310
+ #define PL_QUERY_MAX_TAGGED_INT 8 /* largest tagged integer */
1311
+ #define PL_QUERY_MIN_TAGGED_INT 9 /* smallest tagged integer */
1312
+ #define PL_QUERY_VERSION 10 /* 207006 = 2.7.6 */
1313
+ #define PL_QUERY_MAX_THREADS 11 /* maximum thread count */
1314
+ #define PL_QUERY_ENCODING 12 /* I/O encoding */
1315
+ #define PL_QUERY_USER_CPU 13 /* User CPU in milliseconds */
1316
+ #define PL_QUERY_HALTING 14 /* If true, we are in PL_cleanup() */
1317
+
1318
+ PL_EXPORT(intptr_t) PL_query(int); /* get information from Prolog */
1319
+
1320
+
1321
+ /*******************************
1322
+ * PROLOG THREADS *
1323
+ *******************************/
1324
+
1325
+ #define PL_THREAD_NO_DEBUG 0x01 /* Start thread in nodebug mode */
1326
+ #define PL_THREAD_NOT_DETACHED 0x02 /* Allow Prolog to join */
1327
+ #define PL_THREAD_CUR_STREAMS 0x04 /* Copy current{input,output} */
1328
+
1329
+ typedef enum
1330
+ { PL_THREAD_CANCEL_FAILED = false, /* failed to cancel; try abort */
1331
+ PL_THREAD_CANCEL_JOINED = true, /* cancelled and joined */
1332
+ PL_THREAD_CANCEL_MUST_JOIN /* cancelled, must join */
1333
+ } rc_cancel;
1334
+
1335
+ typedef struct
1336
+ { size_t stack_limit; /* Total stack limit (bytes) */
1337
+ size_t table_space; /* Total tabling space limit (bytes) */
1338
+ char * alias; /* alias name */
1339
+ rc_cancel (*cancel)(int id); /* cancel function */
1340
+ intptr_t flags; /* PL_THREAD_* flags */
1341
+ size_t max_queue_size; /* Max size of associated queue */
1342
+ char * thread_class; /* Thread class */
1343
+ void * reserved[2]; /* reserved for extensions */
1344
+ } PL_thread_attr_t;
1345
+
1346
+
1347
+ PL_EXPORT(int) PL_thread_self(void); /* Prolog thread id (-1 if none) */
1348
+ PL_EXPORT(int) PL_unify_thread_id(term_t t, int i); /* -1 if i is invalid */
1349
+ PL_EXPORT(bool) PL_get_thread_id_ex(term_t t, int *idp);
1350
+ PL_EXPORT(bool) PL_get_thread_alias(int tid, atom_t *alias); /* Locks alias */
1351
+ PL_EXPORT(int) PL_thread_attach_engine(PL_thread_attr_t *attr);
1352
+ PL_EXPORT(bool) PL_thread_destroy_engine(void);
1353
+ PL_EXPORT(bool) PL_thread_at_exit(void (*function)(void *),
1354
+ void *closure,
1355
+ bool global);
1356
+ PL_EXPORT(bool) PL_thread_raise(int tid, int sig);
1357
+ #if defined(_WINDOWS_) || defined(_WINDOWS_H) /* <windows.h> is included */
1358
+ PL_EXPORT(bool) PL_w32thread_raise(DWORD dwTid, int sig);
1359
+ #endif
1360
+ #ifdef __WINDOWS__
1361
+ PL_EXPORT(bool) PL_w32_wrap_ansi_console(void);
1362
+ PL_EXPORT(const char*) PL_w32_running_under_wine(void);
1363
+ #endif
1364
+
1365
+ /*******************************
1366
+ * ENGINES *
1367
+ *******************************/
1368
+
1369
+ /* Requires multi-threading or engine support enabled. In
1370
+ * both cases the flag `engines` is `true`.
1371
+ */
1372
+
1373
+ #define PL_ENGINE_MAIN ((PL_engine_t)0x1)
1374
+ #define PL_ENGINE_CURRENT ((PL_engine_t)0x2)
1375
+ #define PL_ENGINE_NONE ((PL_engine_t)0x3)
1376
+
1377
+ #define PL_ENGINE_SET 0 /* engine set successfully */
1378
+ #define PL_ENGINE_INVAL 2 /* engine doesn't exist */
1379
+ #define PL_ENGINE_INUSE 3 /* engine is in use */
1380
+
1381
+ PL_EXPORT(PL_engine_t) PL_current_engine(void);
1382
+ PL_EXPORT(PL_engine_t) PL_create_engine(PL_thread_attr_t *attributes);
1383
+ PL_EXPORT(int) PL_set_engine(PL_engine_t engine, PL_engine_t *old);
1384
+ PL_EXPORT(bool) PL_destroy_engine(PL_engine_t engine);
1385
+ PL_EXPORT(PL_engine_t) _PL_switch_engine(PL_engine_t e);
1386
+ PL_EXPORT(PL_engine_t) _PL_reset_engine(PL_engine_t old);
1387
+
1388
+ #define PL_WITH_ENGINE(e) \
1389
+ for(PL_engine_t old = _PL_switch_engine(e); \
1390
+ old; \
1391
+ old = _PL_reset_engine(old)) \
1392
+ for(bool __we = true; __we; __we=false)
1393
+
1394
+
1395
+ /*******************************
1396
+ * HASH TABLES *
1397
+ *******************************/
1398
+ typedef _PLS(table) *hash_table_t;
1399
+ typedef _PLS(table_enum) *hash_table_enum_t;
1400
+ typedef uint64_t table_key_t;
1401
+ typedef uint64_t table_value_t;
1402
+
1403
+ #define PL_HT_NEW 0x0001
1404
+ #define PL_HT_UPDATE 0x0002
1405
+
1406
+ PL_EXPORT(hash_table_t) PL_new_hash_table(size_t size,
1407
+ void (*free_symbol)(table_key_t n, table_value_t v));
1408
+ PL_EXPORT(bool) PL_free_hash_table(hash_table_t table);
1409
+ PL_EXPORT(table_value_t) PL_lookup_hash_table(hash_table_t table, table_key_t key);
1410
+ PL_EXPORT(table_value_t) PL_add_hash_table(hash_table_t table,
1411
+ table_key_t key, table_value_t value, int flags);
1412
+ PL_EXPORT(table_value_t) PL_del_hash_table(hash_table_t table, table_key_t key);
1413
+ PL_EXPORT(bool) PL_clear_hash_table(hash_table_t table);
1414
+ PL_EXPORT(hash_table_enum_t) PL_new_hash_table_enum(hash_table_t table);
1415
+ PL_EXPORT(void) PL_free_hash_table_enum(hash_table_enum_t e);
1416
+ PL_EXPORT(bool) PL_advance_hash_table_enum(hash_table_enum_t e,
1417
+ table_key_t *key, table_value_t *value);
1418
+
1419
+
1420
+ /*******************************
1421
+ * PROFILER *
1422
+ *******************************/
1423
+
1424
+ typedef struct
1425
+ { bool (*unify)(term_t t, void *handle); /* implementation --> Prolog */
1426
+ bool (*get)(term_t t, void **handle); /* Prolog --> implementation */
1427
+ void (*activate)(bool active); /* (de)activate */
1428
+ void (*release)(void *handle); /* Release handle */
1429
+ void *dummy[4]; /* reserved */
1430
+ intptr_t magic; /* PROFTYPE_MAGIC */
1431
+ } PL_prof_type_t;
1432
+
1433
+ PL_EXPORT(bool) PL_register_profile_type(PL_prof_type_t *type);
1434
+ PL_EXPORT(void*) PL_prof_call(void *handle, PL_prof_type_t *type);
1435
+ PL_EXPORT(void) PL_prof_exit(void *node);
1436
+
1437
+
1438
+ /*******************************
1439
+ * DEBUG *
1440
+ *******************************/
1441
+
1442
+ PL_EXPORT(int) PL_prolog_debug(const char *topic);
1443
+ PL_EXPORT(int) PL_prolog_nodebug(const char *topic);
1444
+
1445
+
1446
+ /*******************************
1447
+ * WINDOWS MESSAGES *
1448
+ *******************************/
1449
+
1450
+ #if defined(_WINDOWS_) || defined(_WINDOWS_H) /* <windows.h> is included */
1451
+ #define PL_MSG_EXCEPTION_RAISED -1
1452
+ #define PL_MSG_IGNORED 0
1453
+ #define PL_MSG_HANDLED 1
1454
+
1455
+ PL_EXPORT(LRESULT) PL_win_message_proc(HWND hwnd,
1456
+ UINT message,
1457
+ WPARAM wParam,
1458
+ LPARAM lParam);
1459
+ #endif /* _WINDOWS_/_WINDOWS_H */
1460
+
1461
+
1462
+ /*******************************
1463
+ * FAST XPCE SUPPORT *
1464
+ *******************************/
1465
+
1466
+ typedef struct
1467
+ { int type; /* PL_INTEGER or PL_ATOM */
1468
+ union
1469
+ { uintptr_t i; /* integer reference value */
1470
+ atom_t a; /* atom reference value */
1471
+ } value;
1472
+ } xpceref_t;
1473
+
1474
+ PL_EXPORT(bool) _PL_get_xpce_reference(term_t t, xpceref_t *ref);
1475
+ PL_EXPORT(bool) _PL_unify_xpce_reference(term_t t, xpceref_t *ref);
1476
+ PL_EXPORT(bool) _PL_put_xpce_reference_i(term_t t, uintptr_t r);
1477
+ PL_EXPORT(bool) _PL_put_xpce_reference_a(term_t t, atom_t name);
1478
+
1479
+
1480
+
1481
+ /*******************************
1482
+ * TRACE SUPPORT *
1483
+ *******************************/
1484
+
1485
+ typedef struct pl_context_t
1486
+ { PL_engine_t ld; /* Engine */
1487
+ _PLS(queryFrame) *qf; /* Current query */
1488
+ _PLS(localFrame) *fr; /* Current localframe */
1489
+ _PLQ(code) * pc; /* Code pointer */
1490
+ void * reserved[10]; /* Reserved for extensions */
1491
+ } pl_context_t;
1492
+
1493
+ PL_EXPORT(bool) PL_get_context(struct pl_context_t *c, int thead_id);
1494
+ PL_EXPORT(bool) PL_step_context(struct pl_context_t *c);
1495
+ PL_EXPORT(int) PL_describe_context(struct pl_context_t *c,
1496
+ char *buf, size_t len);
1497
+
1498
+ /* Define as 1 if undefined or defined as empty */
1499
+ #if !defined(PL_ARITY_AS_SIZE) || (0-PL_ARITY_AS_SIZE-1)==1
1500
+ #undef PL_ARITY_AS_SIZE
1501
+ #define PL_ARITY_AS_SIZE 1
1502
+ #endif
1503
+
1504
+ #if PL_ARITY_AS_SIZE
1505
+ #define PL_new_functor(f,a) PL_new_functor_sz(f,a)
1506
+ #define PL_functor_arity(f) PL_functor_arity_sz(f)
1507
+ #define PL_get_name_arity(t,n,a) PL_get_name_arity_sz(t,n,a)
1508
+ #define PL_get_compound_name_arity(t,n,a) PL_get_compound_name_arity_sz(t,n,a)
1509
+ #define PL_get_arg(i,t,a) PL_get_arg_sz(i,t,a)
1510
+ #define PL_unify_arg(i,t,a) PL_unify_arg_sz(i,t,a)
1511
+ #define _PL_get_arg(i,t,a) _PL_get_arg_sz(i,t,a)
1512
+ #else
1513
+ #warning "Term arity has changed from int to size_t."
1514
+ #warning "Please update your code or use #define PL_ARITY_AS_SIZE 0."
1515
+ #endif
1516
+
1517
+ /* Provide SWIPL_HOME when compiling using swipl-ld. */
1518
+ #ifdef _SWIPL_HOME
1519
+ #define _pl_xstr(a) _pl_str(a)
1520
+ #define _pl_str(a) #a
1521
+ #define SWIPL_HOME _pl_xstr(_SWIPL_HOME)
1522
+ #endif
1523
+
1524
+ #ifdef __cplusplus
1525
+ }
1526
+ #endif
1527
+
1528
+ /* Undefine the shorthands used in this file along with any of PL_OPAQUE
1529
+ * or PL_STRUCT that were not provided externally.
1530
+ */
1531
+ #undef _PLQ
1532
+ #undef _PLS
1533
+
1534
+ #ifdef _DEFINED_PL_OPAQUE
1535
+ #undef _DEFINED_PL_OPAQUE
1536
+ #undef PL_OPAQUE
1537
+ #endif
1538
+
1539
+ #ifdef _DEFINED_PL_STRUCT
1540
+ #undef _DEFINED_PL_STRUCT
1541
+ #undef PL_STRUCT
1542
+ #endif
1543
+
1544
+ #endif /*_SWI_PROLOG_H*/