我在我的 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?
当我查看文件的头部时,这就是我得到的:
$ head ./test.sav
sicstus-4.2.0 -r %0.bat -a %1 %2 %3 %4 %5 %6 %7 %8 %9
# META_INFO 1
# FILE: "c:/eclipse/workspace_prolog/busstuc/test.sav"
# FR: "timeout"
# META_INFO END
version=4 archmask=0x2c81a
x??xU?u/:?HBa?m[F?????ld?l???l?????head: write error: Permission denied
head: write error
我还尝试以不同的方式加载文件:
$ 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.