如何在jspin中指定C库的路径?

时间:2013-04-08 07:54:08

标签: mingw spin promela

我正在使用jspin并尝试在c_code表达式中包含stdio.h库:

c_code
{
    #include <stdio.h>
}

但是,我收到以下错误:

spin: error: No file 'stdio.h'

我已经检查了安装mingw的目录,里面有stdio.h。因此,我想,这完全是错误的道路。如何在jspin中设置包含路径?

1 个答案:

答案 0 :(得分:1)

尝试:

c_decl {
  \#include <stdio.h>
}

\#是关键部分(Spinroot.com for c_decl)。此外,使用c_decl{}因为.h文件不包含任何代码。

[edit]关于fprintf()没有显示输出;我不能说我知道原因。我尝试了你的特定代码。结果如下:

ebg@ebg$ rm /tmp/foo.bar
ebg@ebg$ spin -a test.pml
ebg@ebg$ gcc -o test pan.c
ebg@ebg$ ./test
hint: this search is more efficient if pan.c is compiled -DSAFETY

(Spin Version 6.2.4 -- 21 November 2012)
    + Partial Order Reduction

Full statespace search for:
    never claim             - (none specified)
    assertion violations    +
    acceptance   cycles     - (not selected)
    invalid end states  +

State-vector 12 byte, depth reached 2, errors: 0
        3 states, stored
        0 states, matched
        3 transitions (= stored+matched)
        0 atomic steps
hash conflicts:         0 (resolved)

Stats on memory usage (in Megabytes):
    0.000   equivalent memory usage for states (stored*(State-vector + overhead))
    0.292   actual memory usage for states
  128.000   memory used for hash table (-w24)
    0.534   memory used for DFS stack (-m10000)
  128.730   total actual memory usage


unreached in init
    (0 of 2 states)

pan: elapsed time 0 seconds
ebg@ebg$ cat /tmp/foo.bar 
some str

以下是我使用的代码:

c_decl {
  \#include <stdio.h>
}

init {
  c_code {
    FILE *file;

    file = fopen ("/tmp/foo.bar", "a+");
    fprintf (file, "%s", "some str");
    fclose (file);
  }
}