clipsruby 0.0.12 → 0.0.15
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 +119 -8
- data/ext/clipsruby/clipsruby.c +251 -2
- 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: 1c09bd00794b99f18db2f3e1a7e79add255696071f73192f1009d97f6bc6a222
|
4
|
+
data.tar.gz: e68259458eb14602e69184d82723518b3ad99bf082a4a23994f0fb6b54ffffa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f147d8a530205d27de62750701a2359ed5e0fdc9b7e6d01f9d953878f9dbc501f742406f6199a27b57231e465c48e608c1df4514b758e524f12e5f40d4f6fac4
|
7
|
+
data.tar.gz: 7927273ee5ed8945f122032796c07cb44def5d597d6a07cc1e24d2aa7788b3b02477b134463d007a4f4db32339e8860ccfa91bf9225d1d685e3d5e931daf0f62
|
data/README.md
CHANGED
@@ -39,6 +39,54 @@ CLIPS::Environment.batch_star(env, "./my-batch.bat")
|
|
39
39
|
env.batch_star("./my-batch.bat")
|
40
40
|
```
|
41
41
|
|
42
|
+
### `CLIPS::Environment.save`
|
43
|
+
### `env.save`
|
44
|
+
|
45
|
+
Pass the path in which we'll save the environment constructs.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
CLIPS::Environment.save(env, "./my-save.clp")
|
49
|
+
env.save("./my-save.clp")
|
50
|
+
```
|
51
|
+
|
52
|
+
### `CLIPS::Environment.load`
|
53
|
+
### `env.load`
|
54
|
+
|
55
|
+
Pass the path to a file that will load the constructs stored in the file
|
56
|
+
into the environment. Remember to `reset` the environment if you need.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
CLIPS::Environment.load(env, "./my-load.clp")
|
60
|
+
env.load("./my-load.clp")
|
61
|
+
```
|
62
|
+
|
63
|
+
### `CLIPS::Environment.save_facts`
|
64
|
+
### `env.save_facts`
|
65
|
+
|
66
|
+
Pass the path in which we'll save the environment facts.
|
67
|
+
The third argument is optional, and determines whether to store the visible or local facts.
|
68
|
+
By default, it'll store local.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
CLIPS::Environment.save_facts(env, "./my-save-facts.clp")
|
72
|
+
env.save_facts("./my-save-facts.clp")
|
73
|
+
CLIPS::Environment.save_facts(env, "./my-save-facts.clp", :local)
|
74
|
+
env.save_facts("./my-save-facts.clp", :local)
|
75
|
+
CLIPS::Environment.save_facts(env, "./my-save-facts.clp", :visible)
|
76
|
+
env.save_facts("./my-save-facts.clp", :visible)
|
77
|
+
```
|
78
|
+
|
79
|
+
### `CLIPS::Environment.load_facts`
|
80
|
+
### `env.load_facts`
|
81
|
+
|
82
|
+
Pass the path to a file that will load the facts stored in the file
|
83
|
+
into the environment.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
CLIPS::Environment.load_facts(env, "./my-load-facts.clp")
|
87
|
+
env.load_facts("./my-load-facts.clp")
|
88
|
+
```
|
89
|
+
|
42
90
|
### `CLIPS::Environment.bsave`
|
43
91
|
### `env.bsave`
|
44
92
|
|
@@ -68,12 +116,12 @@ The third argument is optional, and determines whether to store the visible or l
|
|
68
116
|
By default, it'll store local.
|
69
117
|
|
70
118
|
```ruby
|
71
|
-
CLIPS::Environment.
|
72
|
-
env.
|
73
|
-
CLIPS::Environment.
|
74
|
-
env.
|
75
|
-
CLIPS::Environment.
|
76
|
-
env.
|
119
|
+
CLIPS::Environment.bsave_facts(env, "./my-bsave-facts.bin")
|
120
|
+
env.bsave_facts("./my-bsave-facts.bin")
|
121
|
+
CLIPS::Environment.bsave_facts(env, "./my-bsave-facts.bin", :local)
|
122
|
+
env.bsave_facts("./my-bsave-facts.bin", :local)
|
123
|
+
CLIPS::Environment.bsave_facts(env, "./my-bsave-facts.bin", :visible)
|
124
|
+
env.bsave_facts("./my-bsave-facts.bin", :visible)
|
77
125
|
```
|
78
126
|
|
79
127
|
### `CLIPS::Environment.bload_facts`
|
@@ -83,8 +131,8 @@ Pass the path to a binary file that will load the facts stored in the file
|
|
83
131
|
into the environment.
|
84
132
|
|
85
133
|
```ruby
|
86
|
-
CLIPS::Environment.
|
87
|
-
env.
|
134
|
+
CLIPS::Environment.bload_facts(env, "./my-bload-facts.bin")
|
135
|
+
env.bload_facts("./my-bload-facts.bin")
|
88
136
|
```
|
89
137
|
|
90
138
|
### `CLIPS::Environment.assert_string`
|
@@ -107,6 +155,19 @@ fact = CLIPS::Environment.assert_hash(env, :my_deftemplate, a: 1, b: "asdf", c:
|
|
107
155
|
fact2 = env.assert_hash(:my_deftemplate, d: 4.5, e: :asdf)
|
108
156
|
```
|
109
157
|
|
158
|
+
### `CLIPS::Environment.find_fact`
|
159
|
+
### `CLIPS::Environment#find_fact`
|
160
|
+
|
161
|
+
A light wrapper around the CLIPS find-fact function. Accepts a fact set template and query,
|
162
|
+
returns the first Facts in the environment that match as Ruby objects.
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
CLIPS::Environment.find_facts(env, "(?f my_deftemplate)")
|
166
|
+
env.find_fact("(?f my_deftemplate)")
|
167
|
+
CLIPS::Environment.find_fact(env, "(?f my_deftemplate)", "(eq ?f:b \"asdf\")")
|
168
|
+
env.find_fact("(?f my_deftemplate)", "(= ?f:a 1)")
|
169
|
+
```
|
170
|
+
|
110
171
|
### `CLIPS::Environment.find_all_facts`
|
111
172
|
### `CLIPS::Environment#find_all_facts`
|
112
173
|
|
@@ -215,6 +276,16 @@ CLIPS::Environment::Fact.to_h(fact)
|
|
215
276
|
fact.to_h
|
216
277
|
```
|
217
278
|
|
279
|
+
### `CLIPS::Environment::Fact.index`
|
280
|
+
### `CLIPS::Environment::Fact#index`
|
281
|
+
|
282
|
+
Returns the index of the fact in working memory
|
283
|
+
|
284
|
+
```ruby
|
285
|
+
CLIPS::Environment::Fact.index(fact)
|
286
|
+
fact.index
|
287
|
+
```
|
288
|
+
|
218
289
|
### `CLIPS::Environment::Fact.deftemplate_name`
|
219
290
|
### `CLIPS::Environment::Fact#deftemplate_name`
|
220
291
|
|
@@ -267,6 +338,46 @@ CLIPS::Environment::Fact.modify(fact, bar: 123)
|
|
267
338
|
fact.modify(foo: "my new foo!")
|
268
339
|
```
|
269
340
|
|
341
|
+
### `CLIPS::Environment.find_defrule`
|
342
|
+
### `CLIPS::Environment#find_defrule`
|
343
|
+
|
344
|
+
Finds a defrule by name and returns a CLIPS::Environment::Defrule object
|
345
|
+
|
346
|
+
```ruby
|
347
|
+
CLIPS::Environment.find_defrule(:a)
|
348
|
+
env.find_defrule("foo")
|
349
|
+
```
|
350
|
+
|
351
|
+
### `CLIPS::Environment::Defrule.name`
|
352
|
+
### `CLIPS::Environment::Defrule#name`
|
353
|
+
|
354
|
+
Returns the name of a defrule as a symbol
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
CLIPS::Environment::Defrule.name(defrule)
|
358
|
+
defrule.name
|
359
|
+
```
|
360
|
+
|
361
|
+
### `CLIPS::Environment::Defrule.is_deletable`
|
362
|
+
### `CLIPS::Environment::Defrule#is_deletable`
|
363
|
+
|
364
|
+
Returns a boolean whether the Defrule is deletable or not
|
365
|
+
|
366
|
+
```ruby
|
367
|
+
CLIPS::Environment::Defrule.is_deletable(defrule)
|
368
|
+
defrule.is_deletable
|
369
|
+
```
|
370
|
+
|
371
|
+
### `CLIPS::Environment::Defrule.pp_form`
|
372
|
+
### `CLIPS::Environment::Defrule#pp_form`
|
373
|
+
|
374
|
+
Returns a pretty printed string representation of the Defrule
|
375
|
+
|
376
|
+
```ruby
|
377
|
+
CLIPS::Environment::Defrule.pp_form(defrule)
|
378
|
+
defrule.pp_form
|
379
|
+
```
|
380
|
+
|
270
381
|
## Running the tests
|
271
382
|
|
272
383
|
Simply do `rake compile` and then `rake test` in order to run the tests.
|
data/ext/clipsruby/clipsruby.c
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
#include "clips.h"
|
2
2
|
#include "ruby.h"
|
3
3
|
|
4
|
+
size_t defrule_size(const void *data)
|
5
|
+
{
|
6
|
+
return sizeof(Defrule);
|
7
|
+
}
|
8
|
+
|
9
|
+
static const rb_data_type_t Defrule_type = {
|
10
|
+
.function = {
|
11
|
+
.dsize = defrule_size
|
12
|
+
},
|
13
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
14
|
+
};
|
15
|
+
|
4
16
|
size_t fact_size(const void *data)
|
5
17
|
{
|
6
18
|
return sizeof(Fact);
|
@@ -642,6 +654,32 @@ static VALUE clips_environment_static_eval(VALUE self, VALUE rbEnvironment, VALU
|
|
642
654
|
return clips_environment_eval(rbEnvironment, string);
|
643
655
|
}
|
644
656
|
|
657
|
+
static VALUE clips_environment_find_fact(int argc, VALUE *argv, VALUE environment) {
|
658
|
+
VALUE fact_set_template, query;
|
659
|
+
|
660
|
+
rb_scan_args(argc, argv, "11", &fact_set_template, &query);
|
661
|
+
if (NIL_P(query)) {
|
662
|
+
query = rb_str_new_cstr("TRUE");
|
663
|
+
}
|
664
|
+
|
665
|
+
return clips_environment_eval(
|
666
|
+
environment,
|
667
|
+
rb_sprintf("(find-fact (%s) %s)", StringValueCStr(fact_set_template), StringValueCStr(query)));
|
668
|
+
}
|
669
|
+
|
670
|
+
static VALUE clips_environment_static_find_fact(int argc, VALUE *argv, VALUE klass) {
|
671
|
+
VALUE rbEnvironment, fact_set_template, query;
|
672
|
+
|
673
|
+
rb_scan_args(argc, argv, "21", &rbEnvironment, &fact_set_template, &query);
|
674
|
+
if (NIL_P(query)) {
|
675
|
+
query = rb_str_new_cstr("TRUE");
|
676
|
+
}
|
677
|
+
|
678
|
+
return clips_environment_eval(
|
679
|
+
rbEnvironment,
|
680
|
+
rb_sprintf("(find-fact (%s) %s)", StringValueCStr(fact_set_template), StringValueCStr(query)));
|
681
|
+
}
|
682
|
+
|
645
683
|
static VALUE clips_environment_find_all_facts(int argc, VALUE *argv, VALUE environment) {
|
646
684
|
VALUE fact_set_template, query;
|
647
685
|
|
@@ -747,6 +785,117 @@ static VALUE clips_environment_static_reset(VALUE self, VALUE rbEnvironment)
|
|
747
785
|
return clips_environment_reset(rbEnvironment);
|
748
786
|
}
|
749
787
|
|
788
|
+
static VALUE clips_environment_save(VALUE self, VALUE path)
|
789
|
+
{
|
790
|
+
Environment *env;
|
791
|
+
|
792
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
793
|
+
|
794
|
+
if (Save(env, StringValueCStr(path))) {
|
795
|
+
return Qtrue;
|
796
|
+
} else {
|
797
|
+
return Qfalse;
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
static VALUE clips_environment_static_save(VALUE self, VALUE rbEnvironment, VALUE path)
|
802
|
+
{
|
803
|
+
return clips_environment_save(rbEnvironment, path);
|
804
|
+
}
|
805
|
+
|
806
|
+
static VALUE clips_environment_load(VALUE self, VALUE path)
|
807
|
+
{
|
808
|
+
Environment *env;
|
809
|
+
|
810
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
811
|
+
|
812
|
+
switch (Load(env, StringValueCStr(path)))
|
813
|
+
{
|
814
|
+
case LE_NO_ERROR:
|
815
|
+
break;
|
816
|
+
case LE_OPEN_FILE_ERROR:
|
817
|
+
rb_warn("could not load: issue opening file.");
|
818
|
+
return Qnil;
|
819
|
+
case LE_PARSING_ERROR:
|
820
|
+
rb_warn("could not load: parsing issue.");
|
821
|
+
return Qnil;
|
822
|
+
}
|
823
|
+
return Qtrue;
|
824
|
+
}
|
825
|
+
|
826
|
+
static VALUE clips_environment_static_load(VALUE self, VALUE rbEnvironment, VALUE path)
|
827
|
+
{
|
828
|
+
return clips_environment_load(rbEnvironment, path);
|
829
|
+
}
|
830
|
+
|
831
|
+
static VALUE clips_environment_save_facts(int argc, VALUE *argv, VALUE rbEnvironment) {
|
832
|
+
VALUE path, scope;
|
833
|
+
Environment *env;
|
834
|
+
|
835
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
836
|
+
|
837
|
+
rb_scan_args(argc, argv, "11", &path, &scope);
|
838
|
+
if (NIL_P(scope)) {
|
839
|
+
scope = ID2SYM(rb_intern("local"));
|
840
|
+
}
|
841
|
+
|
842
|
+
int number_of_facts_saved;
|
843
|
+
|
844
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
845
|
+
number_of_facts_saved = SaveFacts(env, StringValueCStr(path), VISIBLE_SAVE);
|
846
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
847
|
+
number_of_facts_saved = SaveFacts(env, StringValueCStr(path), LOCAL_SAVE);
|
848
|
+
} else {
|
849
|
+
rb_warn("could not bsave_facts: unsupported scope.");
|
850
|
+
return Qnil;
|
851
|
+
}
|
852
|
+
return INT2NUM(number_of_facts_saved);
|
853
|
+
}
|
854
|
+
|
855
|
+
static VALUE clips_environment_static_save_facts(int argc, VALUE *argv, VALUE klass) {
|
856
|
+
VALUE rbEnvironment, path, scope;
|
857
|
+
Environment *env;
|
858
|
+
|
859
|
+
rb_scan_args(argc, argv, "21", &rbEnvironment, &path, &scope);
|
860
|
+
|
861
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
862
|
+
|
863
|
+
if (NIL_P(scope)) {
|
864
|
+
scope = ID2SYM(rb_intern("local"));
|
865
|
+
}
|
866
|
+
|
867
|
+
int number_of_facts_saved;
|
868
|
+
|
869
|
+
if (scope == ID2SYM(rb_intern("visible"))) {
|
870
|
+
number_of_facts_saved = SaveFacts(env, StringValueCStr(path), VISIBLE_SAVE);
|
871
|
+
} else if (scope == ID2SYM(rb_intern("local"))) {
|
872
|
+
number_of_facts_saved = SaveFacts(env, StringValueCStr(path), LOCAL_SAVE);
|
873
|
+
} else {
|
874
|
+
rb_warn("could not bsave_facts: unsupported scope.");
|
875
|
+
return Qnil;
|
876
|
+
}
|
877
|
+
return INT2NUM(number_of_facts_saved);
|
878
|
+
}
|
879
|
+
|
880
|
+
static VALUE clips_environment_load_facts(VALUE self, VALUE path)
|
881
|
+
{
|
882
|
+
Environment *env;
|
883
|
+
|
884
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
885
|
+
int number_of_facts_loaded = LoadFacts(env, StringValueCStr(path));
|
886
|
+
|
887
|
+
if (number_of_facts_loaded == -1) {
|
888
|
+
return Qnil;
|
889
|
+
} else {
|
890
|
+
return INT2NUM(number_of_facts_loaded);
|
891
|
+
}
|
892
|
+
}
|
893
|
+
|
894
|
+
static VALUE clips_environment_static_load_facts(VALUE self, VALUE rbEnvironment, VALUE path)
|
895
|
+
{
|
896
|
+
return clips_environment_load_facts(rbEnvironment, path);
|
897
|
+
}
|
898
|
+
|
750
899
|
static VALUE clips_environment_bsave(VALUE self, VALUE path)
|
751
900
|
{
|
752
901
|
Environment *env;
|
@@ -794,14 +943,18 @@ static VALUE clips_environment_bsave_facts(int argc, VALUE *argv, VALUE rbEnviro
|
|
794
943
|
scope = ID2SYM(rb_intern("local"));
|
795
944
|
}
|
796
945
|
|
946
|
+
int number_of_facts_saved;
|
947
|
+
|
797
948
|
if (scope == ID2SYM(rb_intern("visible"))) {
|
798
|
-
|
949
|
+
number_of_facts_saved = BinarySaveFacts(env, StringValueCStr(path), VISIBLE_SAVE);
|
799
950
|
} else if (scope == ID2SYM(rb_intern("local"))) {
|
800
|
-
|
951
|
+
number_of_facts_saved = BinarySaveFacts(env, StringValueCStr(path), LOCAL_SAVE);
|
801
952
|
} else {
|
802
953
|
rb_warn("could not bsave_facts: unsupported scope.");
|
803
954
|
return Qnil;
|
804
955
|
}
|
956
|
+
|
957
|
+
return INT2NUM(number_of_facts_saved);
|
805
958
|
}
|
806
959
|
|
807
960
|
static VALUE clips_environment_static_bsave_facts(int argc, VALUE *argv, VALUE klass) {
|
@@ -1026,6 +1179,82 @@ static VALUE clips_environment_fact_static_index(VALUE self, VALUE rbFact)
|
|
1026
1179
|
return clips_environment_fact_index(rbFact);
|
1027
1180
|
}
|
1028
1181
|
|
1182
|
+
static VALUE clips_environment_find_defrule(VALUE self, VALUE defrule_name)
|
1183
|
+
{
|
1184
|
+
Environment *env;
|
1185
|
+
Defrule *rule;
|
1186
|
+
|
1187
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
1188
|
+
|
1189
|
+
switch (TYPE(defrule_name)) {
|
1190
|
+
case T_STRING:
|
1191
|
+
rule = FindDefrule(env, StringValueCStr(defrule_name));
|
1192
|
+
break;
|
1193
|
+
case T_SYMBOL:
|
1194
|
+
rule = FindDefrule(env, rb_id2name(SYM2ID(defrule_name)));
|
1195
|
+
break;
|
1196
|
+
default:
|
1197
|
+
rb_warn("defrule name must be a symbol or string");
|
1198
|
+
return Qnil;
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
if (rule == NULL) {
|
1202
|
+
return Qnil;
|
1203
|
+
} else {
|
1204
|
+
return TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Defrule")), &Defrule_type, rule);
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
static VALUE clips_environment_static_find_defrule(VALUE self, VALUE rbEnvironment, VALUE defrule_name)
|
1209
|
+
{
|
1210
|
+
return clips_environment_find_defrule(rbEnvironment, defrule_name);
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
static VALUE clips_environment_defrule_name(VALUE self)
|
1214
|
+
{
|
1215
|
+
Defrule *defrule;
|
1216
|
+
|
1217
|
+
TypedData_Get_Struct(self, Defrule, &Defrule_type, defrule);
|
1218
|
+
|
1219
|
+
return ID2SYM(rb_intern(DefruleName(defrule)));
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
static VALUE clips_environment_defrule_static_name(VALUE self, VALUE rbDefrule)
|
1223
|
+
{
|
1224
|
+
return clips_environment_defrule_name(rbDefrule);
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
static VALUE clips_environment_defrule_pp_form(VALUE self)
|
1228
|
+
{
|
1229
|
+
Defrule *defrule;
|
1230
|
+
|
1231
|
+
TypedData_Get_Struct(self, Defrule, &Defrule_type, defrule);
|
1232
|
+
|
1233
|
+
return rb_str_new2(DefrulePPForm(defrule));
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
static VALUE clips_environment_defrule_static_pp_form(VALUE self, VALUE rbDefrule)
|
1237
|
+
{
|
1238
|
+
return clips_environment_defrule_pp_form(rbDefrule);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
static VALUE clips_environment_defrule_is_deletable(VALUE self)
|
1242
|
+
{
|
1243
|
+
Defrule *defrule;
|
1244
|
+
|
1245
|
+
TypedData_Get_Struct(self, Defrule, &Defrule_type, defrule);
|
1246
|
+
|
1247
|
+
if (DefruleIsDeletable(defrule)) {
|
1248
|
+
return Qtrue;
|
1249
|
+
} else {
|
1250
|
+
return Qfalse;
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
static VALUE clips_environment_defrule_static_is_deletable(VALUE self, VALUE rbDefrule)
|
1255
|
+
{
|
1256
|
+
return clips_environment_defrule_is_deletable(rbDefrule);
|
1257
|
+
}
|
1029
1258
|
|
1030
1259
|
void Init_clipsruby(void)
|
1031
1260
|
{
|
@@ -1048,6 +1277,8 @@ void Init_clipsruby(void)
|
|
1048
1277
|
rb_define_method(rbEnvironment, "run", clips_environment_run, -1);
|
1049
1278
|
rb_define_singleton_method(rbEnvironment, "_eval", clips_environment_static_eval, 2);
|
1050
1279
|
rb_define_method(rbEnvironment, "_eval", clips_environment_eval, 1);
|
1280
|
+
rb_define_singleton_method(rbEnvironment, "find_fact", clips_environment_static_find_fact, -1);
|
1281
|
+
rb_define_method(rbEnvironment, "find_fact", clips_environment_find_fact, -1);
|
1051
1282
|
rb_define_singleton_method(rbEnvironment, "find_all_facts", clips_environment_static_find_all_facts, -1);
|
1052
1283
|
rb_define_method(rbEnvironment, "find_all_facts", clips_environment_find_all_facts, -1);
|
1053
1284
|
rb_define_singleton_method(rbEnvironment, "batch_star", clips_environment_static_batch_star, 2);
|
@@ -1056,6 +1287,14 @@ void Init_clipsruby(void)
|
|
1056
1287
|
rb_define_method(rbEnvironment, "clear", clips_environment_clear, 0);
|
1057
1288
|
rb_define_singleton_method(rbEnvironment, "reset", clips_environment_static_reset, 1);
|
1058
1289
|
rb_define_method(rbEnvironment, "reset", clips_environment_reset, 0);
|
1290
|
+
rb_define_singleton_method(rbEnvironment, "save", clips_environment_static_save, 2);
|
1291
|
+
rb_define_method(rbEnvironment, "save", clips_environment_save, 1);
|
1292
|
+
rb_define_singleton_method(rbEnvironment, "load", clips_environment_static_load, 2);
|
1293
|
+
rb_define_method(rbEnvironment, "load", clips_environment_load, 1);
|
1294
|
+
rb_define_singleton_method(rbEnvironment, "save_facts", clips_environment_static_save_facts, -1);
|
1295
|
+
rb_define_method(rbEnvironment, "save_facts", clips_environment_save_facts, -1);
|
1296
|
+
rb_define_singleton_method(rbEnvironment, "load_facts", clips_environment_static_load_facts, 2);
|
1297
|
+
rb_define_method(rbEnvironment, "load_facts", clips_environment_load_facts, 1);
|
1059
1298
|
rb_define_singleton_method(rbEnvironment, "bsave", clips_environment_static_bsave, 2);
|
1060
1299
|
rb_define_method(rbEnvironment, "bsave", clips_environment_bsave, 1);
|
1061
1300
|
rb_define_singleton_method(rbEnvironment, "bload", clips_environment_static_bload, 2);
|
@@ -1064,6 +1303,8 @@ void Init_clipsruby(void)
|
|
1064
1303
|
rb_define_method(rbEnvironment, "bsave_facts", clips_environment_bsave_facts, -1);
|
1065
1304
|
rb_define_singleton_method(rbEnvironment, "bload_facts", clips_environment_static_bload_facts, 2);
|
1066
1305
|
rb_define_method(rbEnvironment, "bload_facts", clips_environment_bload_facts, 1);
|
1306
|
+
rb_define_singleton_method(rbEnvironment, "find_defrule", clips_environment_static_find_defrule, 2);
|
1307
|
+
rb_define_method(rbEnvironment, "find_defrule", clips_environment_find_defrule, 1);
|
1067
1308
|
|
1068
1309
|
VALUE rbFact = rb_define_class_under(rbEnvironment, "Fact", rb_cObject);
|
1069
1310
|
rb_define_singleton_method(rbFact, "deftemplate_name", clips_environment_fact_static_deftemplate_name, 1);
|
@@ -1081,5 +1322,13 @@ void Init_clipsruby(void)
|
|
1081
1322
|
rb_define_singleton_method(rbFact, "index", clips_environment_fact_static_index, 1);
|
1082
1323
|
rb_define_method(rbFact, "index", clips_environment_fact_index, 0);
|
1083
1324
|
|
1325
|
+
VALUE rbDefrule = rb_define_class_under(rbEnvironment, "Defrule", rb_cObject);
|
1326
|
+
rb_define_singleton_method(rbDefrule, "name", clips_environment_defrule_static_name, 1);
|
1327
|
+
rb_define_method(rbDefrule, "name", clips_environment_defrule_name, 0);
|
1328
|
+
rb_define_singleton_method(rbDefrule, "pp_form", clips_environment_defrule_static_pp_form, 1);
|
1329
|
+
rb_define_method(rbDefrule, "pp_form", clips_environment_defrule_pp_form, 0);
|
1330
|
+
rb_define_singleton_method(rbDefrule, "is_deletable", clips_environment_defrule_static_is_deletable, 1);
|
1331
|
+
rb_define_method(rbDefrule, "is_deletable", clips_environment_defrule_is_deletable, 0);
|
1332
|
+
|
1084
1333
|
VALUE rbInstance = rb_define_class_under(rbEnvironment, "Instance", rb_cObject);
|
1085
1334
|
}
|
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.15
|
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-09-
|
11
|
+
date: 2024-09-10 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
|