Skip to content

Commit 5da0247

Browse files
authored
Merge pull request #68 from lmntal/develop
2.3.1 release
2 parents e681aa4 + 889a481 commit 5da0247

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3424
-206
lines changed

DEVELOP

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ src/Makefile.am に追加したファイルを書き加える.
5050
-- プロファイリング用のオプションを設定(実行時間に影響するので注意)
5151

5252
* コーディング
53-
- C89の仕様に従う
53+
- C99の仕様に従う
5454
- ただし、autoconfによりinlineキーワードやint32_t型などが使用できる
5555
- 一般的なUnix/Linux環境で動作させる
5656
- 32/64bitで動作させる

NEWS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
SLIM (2.3.1) -- 2017/06/13
2+
* new features
3+
+ add statespace library
4+
+ add membrane library
5+
+ add set library
6+
+ add unit test library
7+
+ add zerostep library
8+
* first-class rewrite rules (experimental)
9+
+ enabled with --enable-firstclass-rule configure option
10+
* refactoring
11+
* fix --dump-json doesn't dump string atom correctly
12+
113
SLIM (2.3.0) -- 2017/03/29
214
* display commit id in version string
315
* test script with TAP

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.3.1

configure.ac

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# $Id: configure.ac,v 1.13 2008/10/05 11:22:41 riki Exp $
44

55
AC_PREREQ(2.61)
6-
AC_INIT([SLIM], [2.3.0], [lmntal@ueda.info.waseda.ac.jp], [slim])
6+
AC_INIT([SLIM], [2.3.1], [lmntal@ueda.info.waseda.ac.jp], [slim])
77
# AC_REVISION($Revision: 1.13 $)
88
# AC_COPYRIGHT (copyright-notice)
99
AC_CANONICAL_TARGET
@@ -27,7 +27,7 @@ DX_INIT_DOXYGEN(SLIM, doc/doxygen.cfg, doc/doxygen)
2727
# Checks for programs.
2828
#
2929

30-
CFLAGS="-O $CFLAGS"
30+
CFLAGS="-O -std=gnu99 $CFLAGS"
3131
CXXFLAGS="-g -O2 -mmmx -msse $CXXFLAGS"
3232

3333
AC_LANG(C)
@@ -69,6 +69,7 @@ default_enable_jni=no
6969
default_enable_tcmalloc=yes
7070
default_enable_minmax=no
7171
default_enable_cunit=no
72+
default_enable_firstclass_rule=no
7273
default_minimal_state=no
7374
default_cunit_home="/usr/local"
7475

@@ -134,6 +135,12 @@ AC_ARG_ENABLE([minimal_state],
134135
[],
135136
[enable_minimal_state="$default_minimal_state"])
136137

138+
AC_ARG_ENABLE([firstclass_rule],
139+
[AS_HELP_STRING([--enable-firstclass-rule]
140+
[turn on first class rules (default no)])],
141+
[],
142+
[enable_firstclass_rule="$default_enable_firstclass_rule"])
143+
137144
# devel
138145
if test "$enable_devel" = "yes"; then
139146
AC_MSG_RESULT([enable devel: yes])
@@ -217,6 +224,13 @@ else
217224
AC_MSG_RESULT([enable minimal-state: no])
218225
fi
219226

227+
if test "$enable_firstclass_rule" = "yes"; then
228+
AC_MSG_RESULT([enable first-class rule: yes])
229+
AC_DEFINE([USE_FIRSTCLASS_RULE], 1, [enable first class rule])
230+
else
231+
AC_MSG_RESULT([enable first-class rule: no])
232+
fi
233+
220234
AM_CONDITIONAL(ENABLE_JNI, test "$enable_jni" = "yes")
221235
AM_CONDITIONAL(ENABLE_TCMALLOC, test "$enable_tcmalloc" = "yes")
222236
AM_CONDITIONAL(ENABLE_CUNIT, test "$enable_cunit" = "yes")
@@ -893,6 +907,7 @@ AC_OUTPUT(Makefile \
893907
test/Makefile \
894908
test/system_check/Makefile \
895909
test/statespace/Makefile \
910+
test/library_check/Makefile \
896911
third_party/Makefile \
897912
third_party/zdelta-2.1/Makefile \
898913
third_party/google-perftools-1.8.3/Makefile \

lib/membrane.lmn

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* membrane.lmn - Membrane module
3+
* Author: Yutaro Tsunekawa, Taichi Tomioka, Nozomi Matsuzawa
4+
*
5+
* Copyright (c) 2017, Ueda Laboratory LMNtal Group <lmntal@ueda.info.waseda.ac.jp>
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are
10+
* met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binary form must reproduce the above copyright
16+
* notice, this list of conditions and the following disclaimer in
17+
* the documentation and/or other materials provided with the
18+
* distribution.
19+
*
20+
* 3. Neither the name of the Ueda Laboratory LMNtal Group nor the
21+
* names of its contributors may be used to endorse or promote
22+
* products derived from this software without specific prior
23+
* written permission.
24+
*
25+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
{
40+
module(membrane).
41+
42+
/*
43+
* Ret = membrane.eq(M0, M1, R0, R1)
44+
* M0とM1が一致するかどうかを判定する
45+
*
46+
* Ret: 一致すればtrue, そうでなければfalse
47+
* M0, M1: 膜
48+
* R0, R1: M0, M1と同じ膜
49+
*/
50+
Ret = membrane.eq(M0, M1, R0, R1) :- Ret = '$callback'('cb_mem_equals', M0, M1, R0, R1).
51+
52+
/*
53+
* Ret = membrane.hash(Mem, RetMem)
54+
* プロセスのハッシュ値を計算する
55+
*
56+
* Ret: ハッシュ値(整数)
57+
* Mem: ハッシュ値を計算したい膜
58+
* RetMem: Memと同じ膜
59+
*/
60+
Ret = membrane.hash(Mem, RetMem) :- Ret = '$callback'('cb_mhash', Mem, RetMem).
61+
}.

lib/react_rule.lmn

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* react_rule.lmn - React Rule module
3+
* Author: Yutaro Tsunekawa, Taichi Tomioka, Nozomi Matsuzawa
4+
*
5+
* Copyright (c) 2017, Ueda Laboratory LMNtal Group <lmntal@ueda.info.waseda.ac.jp>
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are
10+
* met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binary form must reproduce the above copyright
16+
* notice, this list of conditions and the following disclaimer in
17+
* the documentation and/or other materials provided with the
18+
* distribution.
19+
*
20+
* 3. Neither the name of the Ueda Laboratory LMNtal Group nor the
21+
* names of its contributors may be used to endorse or promote
22+
* products derived from this software without specific prior
23+
* written permission.
24+
*
25+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
{
40+
module(react_rule).
41+
42+
/*
43+
* Ret = react_rule.react(Rule, Graph, RetRule)
44+
* ルールを1ステップ適用した結果を得る
45+
*
46+
* Ret: successアトムにRuleをGraphに適用した後の膜が接続されたもの. 適用できなければfailアトムにGraphと同じ膜が接続されたもの
47+
* Graph: 適用したいプロセスが入った膜.
48+
* Rule: 適用したいルールが入っている膜. 複数ある場合はどれか一つが非決定的に選ばれる
49+
* RetRule: Ruleと同じ膜
50+
*/
51+
Ret = react_rule.react(Rule, Graph, RetRule) :- Ret = '$callback'('cb_react_rule', Rule, Graph, RetRule).
52+
}.

lib/set.lmn

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
* set.lmn - Set module
3+
*
4+
* Copyright (c) 2017, Ueda Laboratory LMNtal Group <lmntal@ueda.info.waseda.ac.jp>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are
9+
* met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright
15+
* notice, this list of conditions and the following disclaimer in
16+
* the documentation and/or other materials provided with the
17+
* distribution.
18+
*
19+
* 3. Neither the name of the Ueda Laboratory LMNtal Group nor the
20+
* names of its contributors may be used to endorse or promote
21+
* products derived from this software without specific prior
22+
* written permission.
23+
*
24+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35+
*
36+
*/
37+
38+
39+
40+
/*
41+
NAME
42+
Set module
43+
44+
SYNOPSIS
45+
46+
AUTHOR
47+
Yutaro Tsunekawa
48+
49+
HISTORY
50+
2017/05/03(Wed)
51+
*/
52+
53+
{
54+
module(set).
55+
56+
Ret = set.init :- Ret = set_empty.
57+
58+
set.free(Set) :- class(Set, "set") |
59+
'$callback'('cb_set_free', Set).
60+
61+
Ret = set.insert(Set, Val) :-
62+
'$callback'('cb_set_insert', Set, Val, Ret).
63+
64+
Ret = set.find(set_empty, Val, Res) :- ground(Val) | Ret = set_empty, Res = none.
65+
66+
Ret = set.find(set_empty, {$v[]}, Res) :- | Ret = set_empty, Res = none.
67+
68+
Ret = set.find(Set, Val, Res) :- class(Set, "set") |
69+
'$callback'('cb_set_find', Set, Val, Res, Ret).
70+
71+
Ret = set.to_list(set_empty) :- Ret = [].
72+
73+
Ret = set.to_list(Set) :- class(Set, "set") |
74+
'$callback'('cb_set_to_list', Set, Ret).
75+
76+
Ret = set.copy(set_empty, S) :- Ret = set_empty, S = set_empty.
77+
78+
Ret = set.copy(S0, S1) :- class(S0, "set") |
79+
'$callback'('cb_set_copy', S0, S1, Ret).
80+
81+
Ret = set.erase(Set, Val) :- class(Set, "set") |
82+
'$callback'('cb_set_erase', Set, Val, Ret).
83+
84+
Ret = set.erase(set_empty, $v) :- unary($v) |
85+
Ret = set_empty.
86+
87+
Ret = set.union(Set0, Set1) :- class(Set0, "set"), class(Set1, "set") |
88+
'$callback'('cb_set_union', Set0, Set1, Ret).
89+
90+
Ret = set.union(Set, set_empty) :- Ret = Set.
91+
92+
Ret = set.union(set_empty, Set) :- Ret = Set.
93+
94+
Ret = set.intersect(Set0, Set1) :- class(Set0, "set"), class(Set1, "set") |
95+
'$callback'('cb_set_intersect', Set0, Set1, Ret).
96+
97+
Ret = set.intersect(Set, set_empty) :- Ret = set_empty, free(Set).
98+
99+
Ret = set.intersect(set_empty, Set) :- Ret = set_empty, free(Set).
100+
101+
Ret = set.diff(set_empty, set_empty) :-
102+
Ret = set_empty.
103+
104+
Ret = set.diff(set_empty, S1) :- class(S1, "set") |
105+
Ret = set_empty.
106+
107+
Ret = set.diff(S0, set_empty) :- class(S0, "set") |
108+
Ret = S0.
109+
110+
Ret = set.diff(S0, S1) :- class(S0, "set"), class(S1, "set") |
111+
'$callback'('cb_set_diff', S0, S1, Ret).
112+
}

lib/state_space.lmn

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* state_space.lmn - State Space module
3+
* Author: Yutaro Tsunekawa, Taichi Tomioka, Nozomi Matsuzawa
4+
*
5+
* Copyright (c) 2017, Ueda Laboratory LMNtal Group <lmntal@ueda.info.waseda.ac.jp>
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are
10+
* met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binary form must reproduce the above copyright
16+
* notice, this list of conditions and the following disclaimer in
17+
* the documentation and/or other materials provided with the
18+
* distribution.
19+
*
20+
* 3. Neither the name of the Ueda Laboratory LMNtal Group nor the
21+
* names of its contributors may be used to endorse or promote
22+
* products derived from this software without specific prior
23+
* written permission.
24+
*
25+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
{
40+
module(state_space).
41+
42+
/*
43+
* Ret = state_space.react_nd_set(Rule, Graph, RetRule)
44+
* 複数ルールに対応したreact_nd
45+
*
46+
* Ret: RuleをGraphに一回適用したときにあり得る書き換え後の状態を表す膜のリスト. 適用できなければ空リストが返る
47+
* Graph: 適用したいプロセスが入った膜.
48+
* Rule: 適用したいルールセットが入っている膜.
49+
* RetRule: Ruleと同じ膜
50+
*/
51+
Ret = state_space.react_nd_set(Rule, Graph, RetRule) :- '$callback'('cb_react_ruleset_nd', Rule, Graph, RetRule, Ret).
52+
53+
Ret = state_space.state_map_init :- '$callback'('cb_state_map_init', Ret).
54+
55+
state_space.state_map_free(Map) :- class(Map, "state_map") |
56+
'$callback'('cb_state_map_free', Map).
57+
58+
Ret = state_space.state_map_find(Map, {$key[]}, Res) :- class(Map, "state_map") |
59+
'$callback'('cb_state_map_id_find', Map, {$key[]}, Res, Ret).
60+
61+
Ret = state_space.state_map_find(Map, $key, Res) :- class(Map, "state_map"), int($key) |
62+
'$callback'('cb_state_map_state_find', Map, $key, Res, Ret).
63+
}.

0 commit comments

Comments
 (0)