Cygwin 是";保存“U程序/1”;Windows7 64位机器上的Sicstus Prolog 4.2出现故障?

Cygwin 是";保存“U程序/1”;Windows7 64位机器上的Sicstus Prolog 4.2出现故障?,cygwin,windows-7-x64,sicstus-prolog,Cygwin,Windows 7 X64,Sicstus Prolog,在Windows7 64位安装中,我从Cygwin提示符启动了sicstus,并创建了一个prolog程序。然后,我使用以下命令保存了它,该命令在我当前的文件夹中创建了文件“test.sav” save_program(test). 当我尝试运行此文件时,会收到一条神秘的错误消息: $ ./test.sav ! Existence error in argument 1 of restore/1 ! file '%0.bat' does not exist ! goal: restore('

在Windows7 64位安装中,我从Cygwin提示符启动了sicstus,并创建了一个prolog程序。然后,我使用以下命令保存了它,该命令在我当前的文件夹中创建了文件“test.sav”

save_program(test).
当我尝试运行此文件时,会收到一条神秘的错误消息:

$ ./test.sav
! Existence error in argument 1 of restore/1
! file '%0.bat' does not exist
! goal:  restore('%0.bat')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.
./test.sav: line 2: $'\032\r': command not found
./test.sav: line 8: x??xU?u/:?HBa?m[F?????ld?l???l?????./test.sav: line 9: syntax error near unexpected token `)'
./test.sav: line 9: `}?????????8?h????)}???C?qa?   ??.?????????/F??7W???yE?lL}>}L???????"???o%"?aac|S[G?????"W????'??K?1Q???????H??M?4??=???bE?
???t[<??????I??\)T?*????????N+?4??@h? ?'?{?1J?*????F?Q??q?<B?5@????l?(s?x?`r?????b?5??%:#I?Eb?@????1-???|a?????  ?D??G?)??O?
我还尝试以不同的方式加载文件:

$ sicstus -l ./test.sav
% loading c:/eclipse/workspace_prolog/busstuc/test.sav...
% c:/eclipse/workspace_prolog/busstuc/test.sav loaded, 0 msec 104 bytes
! Consistency error: memory and saved_state are inconsistent
! type 32-bit,BDD,GAUGE,ALL_BUT_PROLOG, saved state, type 32-bit,BDD,GAUGE, emulator
! goal:  ensure_loaded(user:'./test.sav')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.
有人能给我解释一下为什么这不起作用吗? 我做错什么了吗? 谢谢

编辑:根据Per的建议,我将文件名从test.sav更改为test.bat。发生这种情况:

C:\eclipse\workspace_prolog\BussTUC>sicstus-4.2.0 -r C:\eclipse\workspace_prolog\BussTUC\test.bat.bat -a
! Existence error in argument 1 of restore/1
! file 'C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat' does not exist
! goal:  restore('C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.

C:\eclipse\workspace_prolog\BussTUC># META_INFO 1
'#' is not recognized as an internal or external command,
operable program or batch file.

C:\eclipse\workspace_prolog\BussTUC>The system cannot write to the specified device.
The system cannot write to the specified device.
 | The system cannot write to the specified device.

这项未经记录且不受支持的功能显然从未在Windows上运行过

相反,您可以使用一个预构建的运行时系统,从包含可执行文件的文件夹加载main.sav。例如,将test.sav另存为main.sav,并将其与sprti.exe一起放在包含SICStus适当文件夹结构的文件夹中,如手册中Windows目标计算机上的运行时系统部分所述

最常见的解决方案是使用spld.exe工具构建一个自包含的可执行文件,但这需要Microsoft提供相应的C编译器


(我是SICStus Prolog开发人员之一)

嗨,我试过这个。。。它没有解决问题。。。请参阅上面的“我的编辑”。Windows前缀是在很久以前引入的,目的是使此功能能够像在Unix和类似系统上一样工作。它没有文档记录,而且显然从未在Windows上工作过。显式加载应该可以工作,但在加载保存的状态(即sicstus.exe-r./test.sav)时,应该使用-r而不是-l
C:\eclipse\workspace_prolog\BussTUC>sicstus-4.2.0 -r C:\eclipse\workspace_prolog\BussTUC\test.bat.bat -a
! Existence error in argument 1 of restore/1
! file 'C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat' does not exist
! goal:  restore('C:\\eclipse\\workspace_prolog\\BussTUC\\test.bat.bat')
SICStus 4.2.0 (x86-win32-nt-4): Mon Mar  7 20:21:12 WEST 2011
Licensed to SP4idi.ntnu.no
| ?- halt.

C:\eclipse\workspace_prolog\BussTUC># META_INFO 1
'#' is not recognized as an internal or external command,
operable program or batch file.

C:\eclipse\workspace_prolog\BussTUC>The system cannot write to the specified device.
The system cannot write to the specified device.
 | The system cannot write to the specified device.