clipsruby 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +84 -0
- data/ext/clipsruby/clipsruby.c +274 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fc073e3a6ed11b566b2aff954ff17fcb2874fa1cf83f8b4fbeba5b893d204bc
|
4
|
+
data.tar.gz: f9c000d65fae9a2140f43bf234e8b3360937f461df35e5b2e659dac942048063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522fe0e9ca9ad792684bac67b24708897f68840586c180e5e8712fa9920561b1f9316e968d22bb7cf5371f1467705b2b6e739a649cff0d7fa22f76433164e60e
|
7
|
+
data.tar.gz: 630373e7297ac2945d7a560d4db06262b482b526591e7a7d685a6305ffbd6e5f2864ad58b49eea0e8481f7806515dba5d4cd29388685b7d2429cf79a18307097
|
data/README.md
CHANGED
@@ -152,6 +152,31 @@ CLIPS::Environment.load_facts(env, "./my-load-facts.clp")
|
|
152
152
|
env.load_facts("./my-load-facts.clp")
|
153
153
|
```
|
154
154
|
|
155
|
+
#### `CLIPS::Environment.save_instances` / `env.save_instances`
|
156
|
+
|
157
|
+
Pass the path in which we'll save the environment instances.
|
158
|
+
The third argument is optional, and determines whether to store the visible or local instances.
|
159
|
+
By default, it'll store local.
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
CLIPS::Environment.save_instances(env, "./my-save-instances.clp")
|
163
|
+
env.save_instances("./my-save-instances.clp")
|
164
|
+
CLIPS::Environment.save_instances(env, "./my-save-instances.clp", :local)
|
165
|
+
env.save_instances("./my-save-instances.clp", :local)
|
166
|
+
CLIPS::Environment.save_instances(env, "./my-save-instances.clp", :visible)
|
167
|
+
env.save_instances("./my-save-instances.clp", :visible)
|
168
|
+
```
|
169
|
+
|
170
|
+
#### `CLIPS::Environment.load_instances` / `env.load_instances`
|
171
|
+
|
172
|
+
Pass the path to a file that will load the instances stored in the file
|
173
|
+
into the environment.
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
CLIPS::Environment.load_instances(env, "./my-load-instances.clp")
|
177
|
+
env.load_instances("./my-load-instances.clp")
|
178
|
+
```
|
179
|
+
|
155
180
|
#### `CLIPS::Environment.bsave` / `env.bsave`
|
156
181
|
|
157
182
|
Pass the path in which we'll save the binary representation of the environment constructs.
|
@@ -196,6 +221,32 @@ CLIPS::Environment.bload_facts(env, "./my-bload-facts.bin")
|
|
196
221
|
env.bload_facts("./my-bload-facts.bin")
|
197
222
|
```
|
198
223
|
|
224
|
+
#### `CLIPS::Environment.bsave_instances` / `env.bsave_instances`
|
225
|
+
|
226
|
+
Pass the path in which we'll save the binary representation of the environment instances.
|
227
|
+
The third argument is optional, and determines whether to store the visible or local instances.
|
228
|
+
By default, it'll store local.
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
CLIPS::Environment.bsave_instances(env, "./my-bsave-instances.bin")
|
232
|
+
env.bsave_instances("./my-bsave-instances.bin")
|
233
|
+
CLIPS::Environment.bsave_instances(env, "./my-bsave-instances.bin", :local)
|
234
|
+
env.bsave_instances("./my-bsave-instances.bin", :local)
|
235
|
+
CLIPS::Environment.bsave_instances(env, "./my-bsave-instances.bin", :visible)
|
236
|
+
env.bsave_instances("./my-bsave-instances.bin", :visible)
|
237
|
+
```
|
238
|
+
|
239
|
+
#### `CLIPS::Environment.bload_facts` / `env.bload_facts`
|
240
|
+
|
241
|
+
Pass the path to a binary file that will load the facts stored in the file
|
242
|
+
into the environment.
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
CLIPS::Environment.bload_facts(env, "./my-bload-facts.bin")
|
246
|
+
env.bload_facts("./my-bload-facts.bin")
|
247
|
+
```
|
248
|
+
|
249
|
+
|
199
250
|
#### `CLIPS::Environment.assert_string` / `CLIPS::Environment#assert_string`
|
200
251
|
|
201
252
|
Assert a string as a Fact in the CLIPS environment.
|
@@ -350,6 +401,15 @@ CLIPS::Environment.find_defmodule(:a)
|
|
350
401
|
env.find_defmodule("foo")
|
351
402
|
```
|
352
403
|
|
404
|
+
#### `CLIPS::Environment.get_activation_list` / `CLIPS::Environment#get_activation_list`
|
405
|
+
|
406
|
+
Return an array of Activation objects in the current demodule.
|
407
|
+
|
408
|
+
```ruby
|
409
|
+
CLIPS::Environment.get_activation_list
|
410
|
+
env.get_activation_list
|
411
|
+
```
|
412
|
+
|
353
413
|
#### `CLIPS::Environment.get_defclass_list` / `CLIPS::Environment#get_defclass_list`
|
354
414
|
|
355
415
|
Return an array of Defclass names as symbols in the environment. Pass an argument of a
|
@@ -799,6 +859,19 @@ CLIPS::Environment::Defrule.salience(defrule)
|
|
799
859
|
defrule.salience
|
800
860
|
```
|
801
861
|
|
862
|
+
#### `CLIPS::Environment::Defrule.matches` / `CLIPS::Environment::Defrule#matches`
|
863
|
+
|
864
|
+
Returns an array holding the number of pattern matches, partial matches,
|
865
|
+
and activations for a given rule. Pass a first argument of
|
866
|
+
`:verbose`, `:succinct`, or `:terse` to determine the amount of information
|
867
|
+
to print to `STDOUT` (`:verbose` by default).
|
868
|
+
|
869
|
+
```ruby
|
870
|
+
CLIPS::Environment::Defrule.matches(defrule, :succinct)
|
871
|
+
defrule.matches(:terse)
|
872
|
+
[pattern, partial, activations] = defrule.matches
|
873
|
+
```
|
874
|
+
|
802
875
|
### Defmodule Methods
|
803
876
|
|
804
877
|
#### `CLIPS::Environment::Defmodule.name` / `CLIPS::Environment::Defmodule#name`
|
@@ -1090,6 +1163,17 @@ CLIPS::Environment::Deffacts.pp_form(deffacts)
|
|
1090
1163
|
deffacts.pp_form
|
1091
1164
|
```
|
1092
1165
|
|
1166
|
+
### Activation Methods
|
1167
|
+
|
1168
|
+
#### `CLIPS::Environment::Activation.defule_name` / `CLIPS::Environment::Activation#defule_name`
|
1169
|
+
|
1170
|
+
Returns the name of a defrule that triggered this activation.
|
1171
|
+
|
1172
|
+
```ruby
|
1173
|
+
CLIPS::Environment::Activation.defrule_name
|
1174
|
+
activation.defrule_name
|
1175
|
+
```
|
1176
|
+
|
1093
1177
|
## Running the tests
|
1094
1178
|
|
1095
1179
|
Simply do `rake compile` and then `rake test` in order to run the tests.
|
data/ext/clipsruby/clipsruby.c
CHANGED
@@ -103,6 +103,18 @@ static const rb_data_type_t Instance_type = {
|
|
103
103
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
104
104
|
};
|
105
105
|
|
106
|
+
size_t activation_size(const void *data)
|
107
|
+
{
|
108
|
+
return sizeof(Activation);
|
109
|
+
}
|
110
|
+
|
111
|
+
static const rb_data_type_t Activation_type = {
|
112
|
+
.function = {
|
113
|
+
.dsize = activation_size
|
114
|
+
},
|
115
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
116
|
+
};
|
117
|
+
|
106
118
|
static VALUE clips_environment_fact_deftemplate(VALUE self)
|
107
119
|
{
|
108
120
|
VALUE rbDeftemplate, rbEnvironment;
|
@@ -276,6 +288,11 @@ VALUE instance_alloc(VALUE self)
|
|
276
288
|
return TypedData_Wrap_Struct(self, &Instance_type, NULL);
|
277
289
|
}
|
278
290
|
|
291
|
+
VALUE activation_alloc(VALUE self)
|
292
|
+
{
|
293
|
+
return TypedData_Wrap_Struct(self, &Activation_type, NULL);
|
294
|
+
}
|
295
|
+
|
279
296
|
VALUE environment_alloc(VALUE self)
|
280
297
|
{
|
281
298
|
return TypedData_Wrap_Struct(self, &Environment_type, CreateEnvironment());
|
@@ -1633,6 +1650,63 @@ static VALUE clips_environment_defclass_static_slots(int argc, VALUE *argv, VALU
|
|
1633
1650
|
return out;
|
1634
1651
|
}
|
1635
1652
|
|
1653
|
+
static VALUE clips_environment_defrule_matches(int argc, VALUE *argv, VALUE rbDefrule)
|
1654
|
+
{
|
1655
|
+
VALUE verbosity, rbEnvironment, out;
|
1656
|
+
Defrule *defrule;
|
1657
|
+
CLIPSValue value;
|
1658
|
+
|
1659
|
+
rb_scan_args(argc, argv, "01", &verbosity);
|
1660
|
+
|
1661
|
+
TypedData_Get_Struct(rbDefrule, Defrule, &Defrule_type, defrule);
|
1662
|
+
|
1663
|
+
rbEnvironment = rb_iv_get(rbDefrule, "@environment");
|
1664
|
+
|
1665
|
+
if (NIL_P(verbosity) || verbosity == ID2SYM(rb_intern("verbose"))) {
|
1666
|
+
Matches(defrule, VERBOSE, &value);
|
1667
|
+
} else if (verbosity == ID2SYM(rb_intern("succinct"))) {
|
1668
|
+
Matches(defrule, SUCCINCT, &value);
|
1669
|
+
} else if (verbosity == ID2SYM(rb_intern("terse"))) {
|
1670
|
+
Matches(defrule, TERSE, &value);
|
1671
|
+
} else {
|
1672
|
+
rb_warn("could not find matches for defrule: unsupported verbosity.");
|
1673
|
+
return Qnil;
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
1677
|
+
|
1678
|
+
return out;
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
|
1682
|
+
static VALUE clips_environment_defrule_static_matches(int argc, VALUE *argv, VALUE klass)
|
1683
|
+
{
|
1684
|
+
VALUE rbDefrule, verbosity, rbEnvironment, out;
|
1685
|
+
Defrule *defrule;
|
1686
|
+
CLIPSValue value;
|
1687
|
+
|
1688
|
+
rb_scan_args(argc, argv, "11", &rbDefrule, &verbosity);
|
1689
|
+
|
1690
|
+
TypedData_Get_Struct(rbDefrule, Defrule, &Defrule_type, defrule);
|
1691
|
+
|
1692
|
+
rbEnvironment = rb_iv_get(rbDefrule, "@environment");
|
1693
|
+
|
1694
|
+
if (verbosity == ID2SYM(rb_intern("verbose"))) {
|
1695
|
+
Matches(defrule, VERBOSE, &value);
|
1696
|
+
} else if (verbosity == ID2SYM(rb_intern("succinct"))) {
|
1697
|
+
Matches(defrule, SUCCINCT, &value);
|
1698
|
+
} else if (verbosity == ID2SYM(rb_intern("terse"))) {
|
1699
|
+
Matches(defrule, TERSE, &value);
|
1700
|
+
} else {
|
1701
|
+
rb_warn("could not find matches for defrule: unsupported verbosity.");
|
1702
|
+
return Qnil;
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
1706
|
+
|
1707
|
+
return out;
|
1708
|
+
}
|
1709
|
+
|
1636
1710
|
static VALUE clips_environment_run(int argc, VALUE *argv, VALUE environment) {
|
1637
1711
|
VALUE integer;
|
1638
1712
|
Environment *env;
|
@@ -1984,6 +2058,74 @@ static VALUE clips_environment_static_load_facts(VALUE self, VALUE rbEnvironment
|
|
1984
2058
|
return clips_environment_load_facts(rbEnvironment, path);
|
1985
2059
|
}
|
1986
2060
|
|
2061
|
+
static VALUE clips_environment_save_instances(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2062
|
+
VALUE path, scope;
|
2063
|
+
Environment *env;
|
2064
|
+
|
2065
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2066
|
+
|
2067
|
+
rb_scan_args(argc, argv, "11", &path, &scope);
|
2068
|
+
if (NIL_P(scope)) {
|
2069
|
+
scope = ID2SYM(rb_intern("local"));
|
2070
|
+
}
|
2071
|
+
|
2072
|
+
int number_of_instances_saved;
|
2073
|
+
|
2074
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
2075
|
+
number_of_instances_saved = SaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
|
2076
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
2077
|
+
number_of_instances_saved = SaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
|
2078
|
+
} else {
|
2079
|
+
rb_warn("could not save_instances: unsupported scope.");
|
2080
|
+
return Qnil;
|
2081
|
+
}
|
2082
|
+
return INT2NUM(number_of_instances_saved);
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
static VALUE clips_environment_static_save_instances(int argc, VALUE *argv, VALUE klass) {
|
2086
|
+
VALUE rbEnvironment, path, scope;
|
2087
|
+
Environment *env;
|
2088
|
+
|
2089
|
+
rb_scan_args(argc, argv, "21", &rbEnvironment, &path, &scope);
|
2090
|
+
|
2091
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2092
|
+
|
2093
|
+
if (NIL_P(scope)) {
|
2094
|
+
scope = ID2SYM(rb_intern("local"));
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
int number_of_instances_saved;
|
2098
|
+
|
2099
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
2100
|
+
number_of_instances_saved = SaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
|
2101
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
2102
|
+
number_of_instances_saved = SaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
|
2103
|
+
} else {
|
2104
|
+
rb_warn("could not save_instances: unsupported scope.");
|
2105
|
+
return Qnil;
|
2106
|
+
}
|
2107
|
+
return INT2NUM(number_of_instances_saved);
|
2108
|
+
}
|
2109
|
+
|
2110
|
+
static VALUE clips_environment_load_instances(VALUE self, VALUE path)
|
2111
|
+
{
|
2112
|
+
Environment *env;
|
2113
|
+
|
2114
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
2115
|
+
int number_of_instances_loaded = LoadInstances(env, StringValueCStr(path));
|
2116
|
+
|
2117
|
+
if (number_of_instances_loaded == -1) {
|
2118
|
+
return Qnil;
|
2119
|
+
} else {
|
2120
|
+
return INT2NUM(number_of_instances_loaded);
|
2121
|
+
}
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
static VALUE clips_environment_static_load_instances(VALUE self, VALUE rbEnvironment, VALUE path)
|
2125
|
+
{
|
2126
|
+
return clips_environment_load_instances(rbEnvironment, path);
|
2127
|
+
}
|
2128
|
+
|
1987
2129
|
static VALUE clips_environment_bsave(VALUE self, VALUE path)
|
1988
2130
|
{
|
1989
2131
|
Environment *env;
|
@@ -2089,6 +2231,76 @@ static VALUE clips_environment_static_bload_facts(VALUE self, VALUE rbEnvironmen
|
|
2089
2231
|
return clips_environment_bload_facts(rbEnvironment, path);
|
2090
2232
|
}
|
2091
2233
|
|
2234
|
+
static VALUE clips_environment_bsave_instances(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2235
|
+
VALUE path, scope;
|
2236
|
+
Environment *env;
|
2237
|
+
|
2238
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2239
|
+
|
2240
|
+
rb_scan_args(argc, argv, "11", &path, &scope);
|
2241
|
+
if (NIL_P(scope)) {
|
2242
|
+
scope = ID2SYM(rb_intern("local"));
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
int number_of_instances_saved;
|
2246
|
+
|
2247
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
2248
|
+
number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
|
2249
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
2250
|
+
number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
|
2251
|
+
} else {
|
2252
|
+
rb_warn("could not bsave_instances: unsupported scope.");
|
2253
|
+
return Qnil;
|
2254
|
+
}
|
2255
|
+
|
2256
|
+
return INT2NUM(number_of_instances_saved);
|
2257
|
+
}
|
2258
|
+
|
2259
|
+
static VALUE clips_environment_static_bsave_instances(int argc, VALUE *argv, VALUE klass) {
|
2260
|
+
VALUE rbEnvironment, path, scope;
|
2261
|
+
Environment *env;
|
2262
|
+
|
2263
|
+
rb_scan_args(argc, argv, "21", &rbEnvironment, &path, &scope);
|
2264
|
+
|
2265
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2266
|
+
|
2267
|
+
if (NIL_P(scope)) {
|
2268
|
+
scope = ID2SYM(rb_intern("local"));
|
2269
|
+
}
|
2270
|
+
|
2271
|
+
int number_of_instances_saved;
|
2272
|
+
|
2273
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
2274
|
+
number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
|
2275
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
2276
|
+
number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
|
2277
|
+
} else {
|
2278
|
+
rb_warn("could not bsave_instances: unsupported scope.");
|
2279
|
+
return Qnil;
|
2280
|
+
}
|
2281
|
+
return INT2NUM(number_of_instances_saved);
|
2282
|
+
}
|
2283
|
+
|
2284
|
+
static VALUE clips_environment_bload_instances(VALUE self, VALUE path)
|
2285
|
+
{
|
2286
|
+
Environment *env;
|
2287
|
+
|
2288
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
2289
|
+
int number_of_instances_loaded = BinaryLoadInstances(env, StringValueCStr(path));
|
2290
|
+
|
2291
|
+
if (number_of_instances_loaded == -1) {
|
2292
|
+
return Qnil;
|
2293
|
+
} else {
|
2294
|
+
return INT2NUM(number_of_instances_loaded);
|
2295
|
+
}
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
static VALUE clips_environment_static_bload_instances(VALUE self, VALUE rbEnvironment, VALUE path)
|
2299
|
+
{
|
2300
|
+
return clips_environment_bload_instances(rbEnvironment, path);
|
2301
|
+
}
|
2302
|
+
|
2303
|
+
|
2092
2304
|
static VALUE clips_environment_fact_slot_names(VALUE self)
|
2093
2305
|
{
|
2094
2306
|
Fact *fact;
|
@@ -3610,6 +3822,36 @@ static VALUE clips_environment_static_get_defmodule_list(VALUE self, VALUE rbEnv
|
|
3610
3822
|
return clips_environment_get_defmodule_list(rbEnvironment);
|
3611
3823
|
}
|
3612
3824
|
|
3825
|
+
static VALUE clips_environment_get_activation_list(VALUE self)
|
3826
|
+
{
|
3827
|
+
Activation *theActivation;
|
3828
|
+
Environment *env;
|
3829
|
+
VALUE rbActivation, returnArray;
|
3830
|
+
|
3831
|
+
returnArray = rb_ary_new2(0);
|
3832
|
+
|
3833
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
3834
|
+
|
3835
|
+
for (
|
3836
|
+
theActivation = GetNextActivation(env,NULL);
|
3837
|
+
theActivation != NULL;
|
3838
|
+
theActivation = GetNextActivation(env,theActivation)
|
3839
|
+
) {
|
3840
|
+
rbActivation =
|
3841
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Activation")), &Activation_type, theActivation);
|
3842
|
+
|
3843
|
+
rb_iv_set(rbActivation, "@environment", self);
|
3844
|
+
rb_ary_push(returnArray, rbActivation);
|
3845
|
+
}
|
3846
|
+
|
3847
|
+
return returnArray;
|
3848
|
+
}
|
3849
|
+
|
3850
|
+
static VALUE clips_environment_static_get_activation_list(VALUE self, VALUE rbEnvironment)
|
3851
|
+
{
|
3852
|
+
return clips_environment_get_activation_list(rbEnvironment);
|
3853
|
+
}
|
3854
|
+
|
3613
3855
|
static VALUE clips_environment_defrule_name(VALUE self)
|
3614
3856
|
{
|
3615
3857
|
Defrule *defrule;
|
@@ -4534,6 +4776,21 @@ static VALUE clips_environment_static_get_watch_state(VALUE self, VALUE rbEnviro
|
|
4534
4776
|
return clips_environment_get_watch_state(rbEnvironment, item);
|
4535
4777
|
}
|
4536
4778
|
|
4779
|
+
static VALUE clips_environment_activation_defrule_name(VALUE self)
|
4780
|
+
{
|
4781
|
+
Activation *activation;
|
4782
|
+
|
4783
|
+
TypedData_Get_Struct(self, Activation, &Activation_type, activation);
|
4784
|
+
|
4785
|
+
return ID2SYM(rb_intern(ActivationRuleName(activation)));
|
4786
|
+
}
|
4787
|
+
|
4788
|
+
static VALUE clips_environment_activation_static_defrule_name(VALUE self, VALUE rbActivation)
|
4789
|
+
{
|
4790
|
+
return clips_environment_activation_defrule_name(rbActivation);
|
4791
|
+
}
|
4792
|
+
|
4793
|
+
|
4537
4794
|
void Init_clipsruby(void)
|
4538
4795
|
{
|
4539
4796
|
VALUE rbCLIPS = rb_define_module("CLIPS");
|
@@ -4573,6 +4830,10 @@ void Init_clipsruby(void)
|
|
4573
4830
|
rb_define_method(rbEnvironment, "save_facts", clips_environment_save_facts, -1);
|
4574
4831
|
rb_define_singleton_method(rbEnvironment, "load_facts", clips_environment_static_load_facts, 2);
|
4575
4832
|
rb_define_method(rbEnvironment, "load_facts", clips_environment_load_facts, 1);
|
4833
|
+
rb_define_singleton_method(rbEnvironment, "save_instances", clips_environment_static_save_instances, -1);
|
4834
|
+
rb_define_method(rbEnvironment, "save_instances", clips_environment_save_instances, -1);
|
4835
|
+
rb_define_singleton_method(rbEnvironment, "load_instances", clips_environment_static_load_instances, 2);
|
4836
|
+
rb_define_method(rbEnvironment, "load_instances", clips_environment_load_instances, 1);
|
4576
4837
|
rb_define_singleton_method(rbEnvironment, "bsave", clips_environment_static_bsave, 2);
|
4577
4838
|
rb_define_method(rbEnvironment, "bsave", clips_environment_bsave, 1);
|
4578
4839
|
rb_define_singleton_method(rbEnvironment, "bload", clips_environment_static_bload, 2);
|
@@ -4581,6 +4842,10 @@ void Init_clipsruby(void)
|
|
4581
4842
|
rb_define_method(rbEnvironment, "bsave_facts", clips_environment_bsave_facts, -1);
|
4582
4843
|
rb_define_singleton_method(rbEnvironment, "bload_facts", clips_environment_static_bload_facts, 2);
|
4583
4844
|
rb_define_method(rbEnvironment, "bload_facts", clips_environment_bload_facts, 1);
|
4845
|
+
rb_define_singleton_method(rbEnvironment, "bsave_instances", clips_environment_static_bsave_instances, -1);
|
4846
|
+
rb_define_method(rbEnvironment, "bsave_instances", clips_environment_bsave_instances, -1);
|
4847
|
+
rb_define_singleton_method(rbEnvironment, "bload_instances", clips_environment_static_bload_instances, 2);
|
4848
|
+
rb_define_method(rbEnvironment, "bload_instances", clips_environment_bload_instances, 1);
|
4584
4849
|
rb_define_singleton_method(rbEnvironment, "find_defrule", clips_environment_static_find_defrule, 2);
|
4585
4850
|
rb_define_method(rbEnvironment, "find_defrule", clips_environment_find_defrule, 1);
|
4586
4851
|
rb_define_singleton_method(rbEnvironment, "find_defmodule", clips_environment_static_find_defmodule, 2);
|
@@ -4607,6 +4872,8 @@ void Init_clipsruby(void)
|
|
4607
4872
|
rb_define_method(rbEnvironment, "get_defrule_list", clips_environment_get_defrule_list, -1);
|
4608
4873
|
rb_define_singleton_method(rbEnvironment, "get_defmodule_list", clips_environment_static_get_defmodule_list, 1);
|
4609
4874
|
rb_define_method(rbEnvironment, "get_defmodule_list", clips_environment_get_defmodule_list, 0);
|
4875
|
+
rb_define_singleton_method(rbEnvironment, "get_activation_list", clips_environment_static_get_activation_list, 1);
|
4876
|
+
rb_define_method(rbEnvironment, "get_activation_list", clips_environment_get_activation_list, 0);
|
4610
4877
|
rb_define_singleton_method(rbEnvironment, "find_deffacts", clips_environment_static_find_deffacts, 2);
|
4611
4878
|
rb_define_method(rbEnvironment, "find_deffacts", clips_environment_find_deffacts, 1);
|
4612
4879
|
rb_define_singleton_method(rbEnvironment, "watch", clips_environment_static_watch, 2);
|
@@ -4784,6 +5051,8 @@ void Init_clipsruby(void)
|
|
4784
5051
|
rb_define_method(rbDefrule, "defmodule_name", clips_environment_defrule_defmodule_name, 0);
|
4785
5052
|
rb_define_singleton_method(rbDefrule, "defmodule", clips_environment_defrule_static_defmodule, 1);
|
4786
5053
|
rb_define_method(rbDefrule, "defmodule", clips_environment_defrule_defmodule, 0);
|
5054
|
+
rb_define_singleton_method(rbDefrule, "matches", clips_environment_defrule_static_matches, -1);
|
5055
|
+
rb_define_method(rbDefrule, "matches", clips_environment_defrule_matches, -1);
|
4787
5056
|
|
4788
5057
|
VALUE rbDefclass = rb_define_class_under(rbEnvironment, "Defclass", rb_cObject);
|
4789
5058
|
rb_define_alloc_func(rbDefclass, defclass_alloc);
|
@@ -4818,4 +5087,9 @@ void Init_clipsruby(void)
|
|
4818
5087
|
rb_define_method(rbInstance, "pp_form", clips_environment_instance_pp_form, 0);
|
4819
5088
|
rb_define_singleton_method(rbInstance, "to_h", clips_environment_instance_static_to_h, -1);
|
4820
5089
|
rb_define_method(rbInstance, "to_h", clips_environment_instance_to_h, -1);
|
5090
|
+
|
5091
|
+
VALUE rbActivation = rb_define_class_under(rbEnvironment, "Activation", rb_cObject);
|
5092
|
+
rb_define_alloc_func(rbActivation, activation_alloc);
|
5093
|
+
rb_define_singleton_method(rbActivation, "defrule_name", clips_environment_activation_static_defrule_name, 1);
|
5094
|
+
rb_define_method(rbActivation, "defrule_name", clips_environment_activation_defrule_name, 0);
|
4821
5095
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipsruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Johnston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Calling the CLIPS programming language from within Ruby
|
14
14
|
email: mrryanjohnston@gmail.com
|