在 SWI-Prolog 中创建保存的状态 [英] Creating a saved state in SWI-Prolog

查看:34
本文介绍了在 SWI-Prolog 中创建保存的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Windows 的顶层创建一个保存状态,但我不断收到此错误:

I am trying to create a saved state from toplevel in Windows, but I keep getting this error:

1 ?- qsave_program('U:/boo64.prc').
%   library(broadcast) compiled into broadcast 0.00 sec, 7,504 bytes
%   library(debug) compiled into prolog_debug 0.00 sec, 21,544 bytes
%   library(option) compiled into swi_option 0.00 sec, 14,416 bytes
%   library(arithmetic) compiled into arithmetic 0.00 sec, 33,872 bytes
%  library(settings) compiled into settings 0.00 sec, 120,152 bytes
% c:/program files/swi-prolog/library/listing compiled into prolog_listing 0.00 sec, 180,936 bytes
%   library(occurs) compiled into occurs 0.00 sec, 5,144 bytes
%  library(prolog_clause) compiled into prolog_clause 0.00 sec, 61,544 bytes
% c:/program files/swi-prolog/library/prolog_stack compiled into prolog_stack 0.00 sec, 77,320 bytes
ERROR: '$mark_executable'/1: file `U:/boo64.prc' does not exist (No such file or directory)
2 ?- 

我认为应该这样做.为什么它甚至尝试调用mark_executable"?我想要的只是一个可以从嵌入式 C/C++ 应用程序加载的资源文件.

I thought this should do it. Why does it even try to call 'mark_executable'? All I want is a ressource file that I can load from my embedded C/C++ application.

有人可以帮忙吗?

推荐答案

qsave_program 的 SWI-Prolog 文档简洁且难以理解,但是从这里开始.最后两节,创建保存状态使用 -c 命令行选项编译至少会给你一个尝试的例子.

The SWI-Prolog documentation for qsave_program is terse and difficult to follow, but start here. The last two sections, Creating a saved-state and Compilation using the -c command-line option will at least give you an example to try.

我认为这里的问题是使用 qsave_program 的 1 参数版本强制程序状态不仅保存为资源,而且保存为附加到依赖于机器的可执行文件末尾的资源,Prolog 模拟器.Windows 上的此类文件需要 .exe 扩展名,但您试图强制使用 .prc 扩展名.

I think the problem here is that using the 1-argument version of qsave_program forces the program state to be save not just as a resource but as a resource appended to the end of a machine dependent executable, the Prolog emulator. Such a file on Windows needs the .exe extension, but you are trying to force a .prc extension.

从示例中,我将尝试使用 atom boo64 作为您的 File 参数.如果您想从程序保存状态中删除模拟器,或检查该资源,请查看 此页面.

From the example I would try using atom boo64 as your File argument. If you want to remove the emulator from the program saved state, or examine that resource, check out the Sections linked at the bottom of this page.

这篇关于在 SWI-Prolog 中创建保存的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆